@camstack/addon-matter-broker 0.2.28 → 0.2.30

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 (3) hide show
  1. package/dist/addon.js +1968 -1820
  2. package/dist/addon.mjs +1968 -1820
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -15860,7 +15860,23 @@ var NcHistoryEntrySchema = object({
15860
15860
  updatedAt: number(),
15861
15861
  /** Failure detail — present on a `dead` row. */
15862
15862
  error: string$2().optional(),
15863
- subject: NcHistorySubjectSchema
15863
+ subject: NcHistorySubjectSchema,
15864
+ /**
15865
+ * Ids of the artefacts (still, then gif, then clip) this row's successful
15866
+ * delivery indexed in the artefact library — a REFERENCE, never the bytes
15867
+ * (an artefact is often megabytes; this row is durable JSON rewritten on
15868
+ * every delivery attempt). Absent on a row still pending/dead, a row
15869
+ * delivered before this field shipped, or a wiring with no artefact index.
15870
+ *
15871
+ * Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
15872
+ * outlives any one URL's TTL, so a caller mints a fresh link on demand
15873
+ * rather than trusting one frozen at delivery time. `resolveArtifactUrl`
15874
+ * also answers `null` for an id whose artefact has since expired past the
15875
+ * retained shelf's own age bound — the degrade a caller (the Home
15876
+ * Assistant export) must render as "no image right now", never as a
15877
+ * broken link.
15878
+ */
15879
+ artifactIds: array(string$2().min(1)).optional()
15864
15880
  });
15865
15881
  /**
15866
15882
  * Query filter for `getHistory` (spec §4.2). Every field is a narrowing
@@ -16087,7 +16103,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
16087
16103
  }), method(object({}), object({
16088
16104
  catalog: array(NcConditionDescriptorSchema),
16089
16105
  taxonomy: NcTaxonomySchema.optional()
16090
- })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
16106
+ })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string$2().min(1) }), object({ url: string$2().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
16091
16107
  kind: "mutation",
16092
16108
  caller: "required"
16093
16109
  }), method(object({ snoozeId: string$2() }), object({ success: literal(true) }), {
@@ -16427,1760 +16443,1996 @@ var OauthIntegrationDescriptorSchema = object({
16427
16443
  });
16428
16444
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
16429
16445
  /**
16430
- * pipeline-analytics device-scoped wrapper cap. Refines raw
16431
- * per-frame detections emitted by the pipeline runner into tracked
16432
- * objects, per-kind event collections (motion / object / audio), and
16433
- * persisted media. Owns the post-detection domain end-to-end:
16434
- *
16435
- * runner emits PipelineInferenceResult
16436
- * ↓ (event bus)
16437
- * pipeline-analytics subscriber
16438
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
16439
- * → three DB collections (one per kind), one FS media tree, one
16440
- * unified event emitter (FrameTracked + TrackStarted/Ended +
16441
- * DetectionEvent on bus)
16442
- *
16443
- * Pure subscriber model. No `processFrame` cap method — the runner
16444
- * already publishes the raw frame on the bus. The cap surface is
16445
- * only QUERIES + per-device settings, bound on/off via
16446
- * `device-manager.setWrapperActive`. `defaultActive: true` because
16447
- * every camera with a detection pipeline wants its raw detections
16448
- * refined; operators opt out per-device via BindingsTab when needed.
16449
- *
16450
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
16451
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
16446
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
16447
+ * within the frame, so the executor can re-cut a leaf child ROI at native
16448
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
16452
16449
  */
16453
- var TrackStateSchema = _enum([
16454
- "new",
16455
- "entered",
16456
- "left",
16457
- "moving",
16458
- "idle"
16459
- ]);
16460
- var EventKindSchema = _enum([
16461
- "motion",
16462
- "object",
16463
- "audio"
16464
- ]);
16450
+ var NativeCropRefSchema = object({
16451
+ /** Handle keying the retained native surface (node-pinned to its owner). */
16452
+ handle: FrameHandleSchema,
16453
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
16454
+ cropFrameSpace: object({
16455
+ x: number(),
16456
+ y: number(),
16457
+ w: number(),
16458
+ h: number()
16459
+ })
16460
+ });
16461
+ object({
16462
+ crop: object({
16463
+ left: number(),
16464
+ top: number(),
16465
+ width: number().positive(),
16466
+ height: number().positive()
16467
+ }).optional(),
16468
+ content: object({
16469
+ width: number().int().positive(),
16470
+ height: number().int().positive()
16471
+ }),
16472
+ fit: _enum(["stretch", "contain"]),
16473
+ format: _enum([
16474
+ "rgb",
16475
+ "gray",
16476
+ "jpeg"
16477
+ ])
16478
+ });
16465
16479
  /**
16466
- * Spatial filter for `listTracks` the rect + polygon variants of the shared
16467
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
16468
- * of the camera frame (top-left origin), matching the drawing-plane editor.
16480
+ * Process-local frame identity. It is serializable so it can ride an in-process
16481
+ * capability call, but `registryId` deliberately prevents resolution in any
16482
+ * other process or execution group.
16469
16483
  */
16470
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
16471
- /** Closed icon vocabulary so clients render a known glyph per kind. */
16472
- var EventKindIconSchema = _enum([
16473
- "motion",
16474
- "audio",
16475
- "person",
16476
- "vehicle",
16477
- "animal",
16478
- "door",
16479
- "pir",
16480
- "smoke",
16481
- "water",
16482
- "button",
16483
- "package",
16484
- "generic"
16484
+ var FrameRefSchema = object({
16485
+ registryId: string$2().min(1),
16486
+ id: string$2().min(1),
16487
+ width: number().int().positive(),
16488
+ height: number().int().positive(),
16489
+ format: _enum(["rgb", "gray"]),
16490
+ timestamp: number(),
16491
+ capturedAt: number().optional()
16492
+ });
16493
+ var ModelFormatSchema$1 = _enum([
16494
+ "onnx",
16495
+ "coreml",
16496
+ "openvino",
16497
+ "tflite",
16498
+ "pt",
16499
+ "gguf"
16485
16500
  ]);
16486
- var EventKindCategorySchema = _enum([
16487
- "motion",
16488
- "audio",
16489
- "detection",
16490
- "sensor",
16491
- "control",
16492
- "custom",
16493
- "package"
16501
+ var PipelineSlotSchema = _enum([
16502
+ "detector",
16503
+ "cropper",
16504
+ "classifier",
16505
+ "refiner",
16506
+ "audio-classifier"
16494
16507
  ]);
16495
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16496
- var EventKindLevelSchema = _enum(["macro", "sub"]);
16497
- var EventKindDescriptorSchema = object({
16498
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16499
- kind: string$2(),
16500
- /** i18n key resolved on the UI side; `label` is the English fallback. */
16501
- labelKey: string$2(),
16502
- /** English fallback label (kept for clients that don't translate). */
16503
- label: string$2(),
16504
- /** Hex color for timeline/legend rendering. */
16505
- color: string$2(),
16506
- /** Dictionary id → lucide component on the UI side. */
16507
- iconId: string$2(),
16508
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
16509
- icon: EventKindIconSchema,
16510
- category: EventKindCategorySchema,
16511
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16512
- parentKind: string$2().nullable(),
16513
- /** Derived from `parentKind`, explicit for the client tree. */
16514
- level: EventKindLevelSchema,
16515
- /** Which cap + device contributes this kind. For built-ins the camera
16516
- * itself; for sensor kinds the LINKED source device. */
16517
- source: object({
16518
- capName: string$2(),
16519
- deviceId: number()
16520
- })
16508
+ var PipelineEngineChoiceSchema = object({
16509
+ runtime: _enum(["node", "python"]),
16510
+ backend: string$2(),
16511
+ format: ModelFormatSchema$1,
16512
+ device: string$2().optional()
16521
16513
  });
16522
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
16523
- var EventKindsForDeviceSchema = object({
16524
- deviceId: number(),
16525
- kinds: array(EventKindDescriptorSchema).readonly()
16514
+ var AvailableEngineSchema = object({
16515
+ engine: PipelineEngineChoiceSchema,
16516
+ devices: array(object({
16517
+ id: string$2(),
16518
+ label: string$2(),
16519
+ description: string$2().optional()
16520
+ })).readonly(),
16521
+ defaultDevice: string$2()
16526
16522
  });
16527
- var SensorEventSchema = object({
16523
+ var PipelineDefaultStepSchema = lazy(() => object({
16524
+ addonId: string$2(),
16525
+ addonName: string$2(),
16526
+ slot: PipelineSlotSchema,
16527
+ inputClasses: array(string$2()).readonly(),
16528
+ outputClasses: array(string$2()).readonly(),
16529
+ enabled: boolean(),
16530
+ modelId: string$2(),
16531
+ children: array(PipelineDefaultStepSchema).readonly(),
16532
+ group: string$2().optional(),
16533
+ settings: record(string$2(), unknown()).optional()
16534
+ }));
16535
+ var PipelineTemplateStepSchema = lazy(() => object({
16536
+ addonId: string$2(),
16537
+ enabled: boolean(),
16538
+ modelId: string$2(),
16539
+ children: array(PipelineTemplateStepSchema).readonly(),
16540
+ settings: record(string$2(), unknown()).optional()
16541
+ }));
16542
+ var PipelineTemplateSchema$1 = object({
16528
16543
  id: string$2(),
16529
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
16530
- * yields N rows, one per camera). */
16531
- deviceId: number(),
16532
- /** The linked sensor device whose state changed. */
16533
- sourceDeviceId: number(),
16534
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
16535
- kind: string$2(),
16536
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
16537
- value: record(string$2(), unknown()).nullable(),
16538
- timestamp: number()
16544
+ name: string$2(),
16545
+ createdAt: string$2(),
16546
+ updatedAt: string$2(),
16547
+ engine: PipelineEngineChoiceSchema,
16548
+ steps: array(PipelineTemplateStepSchema).readonly()
16539
16549
  });
16540
- var TrackPositionSchema = object({
16541
- x: number(),
16542
- y: number(),
16543
- timestamp: number(),
16544
- bbox: BoundingBoxSchema
16550
+ var PipelineModelOptionSchema = object({
16551
+ id: string$2(),
16552
+ name: string$2(),
16553
+ formats: record(string$2(), object({
16554
+ downloaded: boolean(),
16555
+ sizeMB: number()
16556
+ })),
16557
+ group: ModelVariantGroupSchema.optional(),
16558
+ legacy: boolean().optional(),
16559
+ provider: ModelProviderIdSchema.optional()
16545
16560
  });
16546
- var TrackSnapshotSchema = object({
16547
- timestamp: number(),
16548
- position: TrackPositionSchema,
16549
- /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
16550
- mediaKey: string$2()
16561
+ var ConfigFieldBridge = custom();
16562
+ var PipelineAddonSchemaSchema = object({
16563
+ id: string$2(),
16564
+ name: string$2(),
16565
+ slot: PipelineSlotSchema,
16566
+ inputClasses: array(string$2()).readonly(),
16567
+ outputClasses: array(string$2()).readonly(),
16568
+ childSlots: array(PipelineSlotSchema).readonly(),
16569
+ models: array(PipelineModelOptionSchema).readonly(),
16570
+ defaultModelId: string$2(),
16571
+ defaultModelIdByFormat: record(string$2(), string$2()).optional(),
16572
+ enabledByDefault: boolean().optional(),
16573
+ backfillIntoExistingOverrides: boolean().optional(),
16574
+ defaultConfidence: number(),
16575
+ group: string$2().optional(),
16576
+ configSchema: array(ConfigFieldBridge).readonly().optional()
16551
16577
  });
16552
- /**
16553
- * Normalized 0..1 trajectory envelope (min/max over every position bbox,
16554
- * divided by the track's detection-frame dims), computed at persist time.
16555
- * Absent when the frame dims were unknown when the track was persisted
16556
- * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
16557
- */
16558
- var TrackEnvelopeSchema = object({
16559
- minX: number(),
16560
- minY: number(),
16561
- maxX: number(),
16562
- maxY: number()
16578
+ var PipelineSlotSchemaSchema = object({
16579
+ id: PipelineSlotSchema,
16580
+ label: string$2(),
16581
+ priority: number(),
16582
+ parentSlot: PipelineSlotSchema.nullable(),
16583
+ addons: array(PipelineAddonSchemaSchema).readonly()
16563
16584
  });
16564
- /**
16565
- * Row projection for track list queries. `full` (default) returns the
16566
- * complete Track including the frame-rate `positions[]` history and the
16567
- * `snapshots[]` references — megabytes across a page of tracks. `slim`
16568
- * keeps every scalar the list surfaces actually render (ids, class(es),
16569
- * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
16570
- * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
16571
- * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
16572
- * `getTrack`. Mirrors the event-store `projection` convention
16573
- * (`getObjectEvents` et al.).
16574
- */
16575
- var TrackProjectionSchema = _enum(["full", "slim"]);
16576
- /**
16577
- * One audio-classification label heard on the track's camera while the
16578
- * track was alive, aggregated per label. An "episode" is one persisted
16579
- * audio event (the confident-classification path: score ≥ the device's
16580
- * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
16581
- * one 32 ms inference chunk, so counts stay human-scaled.
16582
- */
16583
- var TrackAudioLabelSchema = object({
16584
- label: string$2(),
16585
- /** Highest classification score observed across the label's episodes. */
16586
- peakScore: number(),
16587
- /** Number of coalesced audio-event episodes carrying this label. */
16588
- count: number(),
16589
- firstAt: number(),
16590
- lastAt: number()
16585
+ var PipelineSchemaSchema = object({
16586
+ availableEngines: array(AvailableEngineSchema).readonly(),
16587
+ selectedEngine: PipelineEngineChoiceSchema,
16588
+ slots: array(PipelineSlotSchemaSchema).readonly()
16591
16589
  });
16592
- /**
16593
- * How a track was produced. `pipeline` (default / absent) = the spatial
16594
- * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
16595
- * no positions, a single snapshot, and no bbox trajectory at all:
16596
- *
16597
- * - `sensor` — a linked sensor/control device state change.
16598
- * - `audio` — an audio event on the camera itself that was anomalous for
16599
- * THAT camera, loud, and heard while nothing visual was happening (D62).
16600
- *
16601
- * The spatial subsystems (tracker association, occupancy count, re-id /
16602
- * embedding, resurrection) MUST skip every synthetic source. Test for that
16603
- * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
16604
- * check silently readmits every source added after it was written.
16605
- */
16606
- var TrackSourceSchema = _enum([
16607
- "pipeline",
16608
- "sensor",
16609
- "audio"
16610
- ]);
16611
- /**
16612
- * Where a track sits in the RETRAIN lifecycle (D81).
16613
- *
16614
- * - `none` never marked, or un-marked. Evictable.
16615
- * - `staging`the operator wants this track as training material and has not
16616
- * finished with it. **This is the only state retention holds**: the track and
16617
- * everything it owns (object events, crops, keyframes, CLIP vector) survive
16618
- * the device's age window.
16619
- * - `trained` — the retrain page has taken what it needed. The frames it chose
16620
- * were COPIED into the retrain dataset at selection time, so the dataset no
16621
- * longer depends on the track's media and the track becomes EVICTABLE again.
16622
- * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
16623
- * a deliberate action of the retrain page, not a side effect of a checkbox.
16624
- *
16625
- * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
16626
- * the store's filter language has only positive equality and `whereIn` — no
16627
- * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
16628
- * would make the entire pre-column history immortal in one deploy.
16629
- */
16630
- var RetrainStatusSchema = _enum([
16631
- "none",
16632
- "staging",
16633
- "trained"
16634
- ]);
16635
- /**
16636
- * Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
16637
- * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
16638
- * so the two surfaces cannot drift.
16639
- *
16640
- * **Absent ≠ false.** A track that has never been touched omits the field; an
16641
- * explicitly un-flagged track carries `false`. Legacy rows written before the
16642
- * columns existed read as absent, and a consumer that needs a boolean should say
16643
- * `flag === true`, not `flag !== false`.
16644
- *
16645
- * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
16646
- * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
16647
- * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
16648
- * `trained` track reports `false` while refusing both writes. The boolean is
16649
- * kept because three surfaces drive a toggle off it; anything that needs to tell
16650
- * "never marked" from "already trained" must read `retrainStatus`.
16651
- *
16652
- * `debug` does NOT pin; it is attention, not durability.
16653
- *
16654
- * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16655
- * A favourited track is skipped by retention the same way `staging` is, but
16656
- * it does not enter `none|staging|trained` and has no staging budget.
16657
- */
16658
- var TrackFlagFields = {
16659
- /** Operator marked this track as training material — i.e. `retrainStatus` is
16660
- * `'staging'`. */
16661
- markForTrain: boolean().optional(),
16662
- /** Operator marked this track for diagnostic attention. */
16663
- debug: boolean().optional(),
16664
- /** Operator favourited this track. Pins it against pruning. */
16665
- favourited: boolean().optional()
16666
- };
16667
- /**
16668
- * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
16669
- * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
16670
- * write patch, and the status is not something the toggle sets — it is what the
16671
- * toggle's boolean is derived from. Absent on an in-RAM track never touched;
16672
- * always present on a persisted row (the column default materialises `'none'`).
16673
- */
16674
- var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
16675
- /**
16676
- * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
16677
- * one flag can never clear the other — the toggles are independent and are
16678
- * driven from three surfaces that do not know about each other.
16679
- */
16680
- var TrackFlagsPatchSchema = object(TrackFlagFields);
16681
- /**
16682
- * The resolved flag state after a write. Both fields are REQUIRED here (absent
16683
- * collapses to `false`) so a caller can drive a toggle's checked state off the
16684
- * mutation result without a re-fetch.
16685
- */
16686
- var TrackFlagsSchema = object({
16687
- trackId: string$2(),
16688
- markForTrain: boolean(),
16689
- debug: boolean(),
16690
- favourited: boolean(),
16691
- /** The lifecycle state the boolean was derived from. Required here (unlike on
16692
- * a track row) because this shape is only ever produced by the write body,
16693
- * which always knows it — and a surface that has just written needs to render
16694
- * `trained` without a re-fetch. */
16695
- retrainStatus: RetrainStatusSchema
16590
+ var EngineProvisioningSchema = object({
16591
+ runtimeId: _enum([
16592
+ "onnx",
16593
+ "openvino",
16594
+ "coreml",
16595
+ "edgetpu"
16596
+ ]).nullable(),
16597
+ device: string$2().nullable(),
16598
+ state: _enum([
16599
+ "idle",
16600
+ "installing",
16601
+ "verifying",
16602
+ "ready",
16603
+ "failed"
16604
+ ]),
16605
+ progress: number().optional(),
16606
+ error: string$2().optional(),
16607
+ nextRetryAt: number().optional(),
16608
+ /**
16609
+ * Gate A (config-correctness gate at engine change): human-readable
16610
+ * config issues surfaced EAGERLY when the node's engine changes — model
16611
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
16612
+ * has a <format> build"). Additive/optional: informational only, never
16613
+ * enforced here `assertEngineReady` (readiness) still gates inference.
16614
+ * Absent/empty when the node-default tree resolves cleanly.
16615
+ */
16616
+ configIssues: array(string$2()).optional()
16696
16617
  });
16697
- union([literal(1), literal(2)]);
16698
- /**
16699
- * WHO decided a label, and when. Carried per tier so a value can be traced to
16700
- * the step and model that produced it — which is what makes the write rule
16701
- * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
16702
- * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
16703
- *
16704
- * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
16705
- * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
16706
- * `migration:4g` for a value the 4g migration moved from the single-slot era —
16707
- * that value has no provenance, and the write rule lets ANY properly-attributed
16708
- * write of the same tier replace it regardless of score.
16709
- */
16710
- var LabelAttributionSchema = object({
16711
- stepId: string$2(),
16618
+ var PipelineStepInputSchema = lazy(() => object({
16619
+ addonId: string$2(),
16712
16620
  modelId: string$2().optional(),
16713
- decidedAt: number(),
16621
+ enabled: boolean().default(true),
16622
+ children: array(PipelineStepInputSchema).optional(),
16623
+ settings: record(string$2(), unknown()).optional(),
16624
+ jumpDeviceKey: string$2().optional()
16625
+ }));
16626
+ var ModelSubstitutionSchema = object({
16627
+ addonId: string$2(),
16628
+ chosen: string$2(),
16629
+ running: string$2(),
16630
+ format: string$2()
16631
+ });
16632
+ var PipelineValidationIssueSchema = object({
16633
+ addonId: string$2(),
16634
+ kind: _enum(["unknown-addon", "no-format-build"]),
16635
+ detail: string$2()
16636
+ });
16637
+ var PipelineValidationResultSchema = object({
16638
+ ok: boolean(),
16639
+ issues: array(PipelineValidationIssueSchema).readonly(),
16640
+ substitutions: array(ModelSubstitutionSchema).readonly(),
16641
+ /** The node's `currentEngine.format` this validation ran against. */
16642
+ format: string$2()
16643
+ });
16644
+ var ReferenceImageEntrySchema = object({
16645
+ filename: string$2(),
16646
+ stepIds: array(string$2()).readonly().optional()
16647
+ });
16648
+ var ReferenceImageBodySchema = object({
16649
+ base64: string$2(),
16650
+ filename: string$2()
16651
+ });
16652
+ var ReferenceAudioEntrySchema = object({
16653
+ filename: string$2(),
16654
+ sizeKb: number()
16655
+ });
16656
+ var ReferenceAudioBodySchema = object({ base64: string$2() });
16657
+ var AudioBackendSchema = object({
16658
+ id: string$2(),
16659
+ name: string$2(),
16660
+ description: string$2(),
16661
+ available: boolean(),
16714
16662
  /**
16715
- * The GALLERY id behind a recognised tier-2 label — a face-gallery
16716
- * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
16717
- *
16718
- * The text alone is a DISPLAY NAME, and a display name is renameable: a
16719
- * notification rule authored on "Gianluca" stopped matching the moment the
16720
- * operator fixed the spelling in the gallery, and nothing said so. The id is
16721
- * the thing that does not move, so it is what a rule matches on
16722
- * (`NcConditions.identities`) and the text is what a human is shown.
16723
- *
16724
- * Absent when the label names no gallery row — a plate the OCR read but no
16725
- * vehicle claims, a sub-class, a species, any tier-1 value.
16663
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
16664
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
16665
+ * the benchmark UI to populate the `enabledMicroClasses` filter
16666
+ * specific to the selected backend without a separate fetch.
16726
16667
  */
16727
- identityId: string$2().optional()
16668
+ rawLabels: array(string$2()).readonly().optional()
16669
+ });
16670
+ var AudioCapabilitiesSchema = object({
16671
+ activeBackend: string$2(),
16672
+ availableBackends: array(AudioBackendSchema).readonly(),
16673
+ sampleRate: number(),
16674
+ chunkDurationMs: number()
16675
+ });
16676
+ var DownloadModelResultSchema = object({
16677
+ filePath: string$2(),
16678
+ sizeMB: number(),
16679
+ durationMs: number()
16728
16680
  });
16729
16681
  /**
16730
- * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
16731
- * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
16732
- * track and its events always answer the same question the same way.
16733
- *
16734
- * Two scalar columns, not an array: every consumer wants "the coarse one" or
16735
- * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
16736
- * is tier 2, and each carries its own score + attribution.
16737
- *
16738
- * **Reading it.** What a human should be shown is `subLabel ?? label` — the
16739
- * finest thing known. Before 4g the single `label` column held the finest
16740
- * value, so a consumer that has not been updated reads the tier-1 slot and
16741
- * shows nothing on a species-only row; that is why the migration puts every
16742
- * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
16743
- * and why the read surfaces were changed in the same train.
16744
- *
16745
- * **Writing it.** The slots are independent, which is the whole point: a
16746
- * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
16747
- * migratorius`), so fineness cannot regress by construction. Within a tier the
16748
- * higher score wins. One rule, one implementation — see
16749
- * `pipeline/label-tier.ts` in addon-post-analysis.
16750
- */
16751
- var TieredLabelFields = {
16752
- /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
16753
- label: string$2().optional(),
16754
- /** Confidence of the tier-1 value, as reported by the deciding step. */
16755
- labelScore: number().optional(),
16756
- /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
16757
- labelMeta: LabelAttributionSchema.optional(),
16758
- /** Tier 2 — the instance. See {@link LabelTierSchema}. */
16759
- subLabel: string$2().optional(),
16760
- /** Confidence of the tier-2 value, as reported by the deciding step. */
16761
- subLabelScore: number().optional(),
16762
- /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
16763
- subLabelMeta: LabelAttributionSchema.optional()
16764
- };
16765
- /** Per-camera slice of a training-export estimate. */
16766
- var TrainingExportDeviceTotalsSchema = object({
16767
- deviceId: number(),
16768
- tracks: number().int(),
16769
- files: number().int(),
16770
- bytes: number().int()
16771
- });
16772
- /**
16773
- * What a training export WOULD contain. Computed from media index rows only —
16774
- * no blob is read to produce this.
16682
+ * Wrapper carrying a single test run's result. Replaces the legacy
16683
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
16684
+ * canonical `AudioResult` from the Phase 6 output rework: one
16685
+ * `AudioDetection` per class above `minScore`, top-N candidates in
16686
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
16687
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
16688
+ * benchmark UI can still report a clean failure when the classifier
16689
+ * cap isn't available.
16775
16690
  */
16776
- var TrainingExportSummarySchema = object({
16777
- generatedAt: number(),
16778
- trackCount: number().int(),
16779
- fileCount: number().int(),
16780
- byteCount: number().int(),
16781
- /** More marked tracks exist than a single pass carries. */
16782
- truncated: boolean(),
16783
- devices: array(TrainingExportDeviceTotalsSchema).readonly()
16691
+ var AudioTestResultSchema = object({
16692
+ success: boolean(),
16693
+ error: string$2().optional(),
16694
+ frame: custom().optional()
16784
16695
  });
16785
- var TrackSchema = object({
16786
- trackId: string$2(),
16787
- deviceId: number(),
16788
- className: string$2(),
16789
- ...TieredLabelFields,
16790
- producingDeviceName: string$2().optional(),
16791
- /** Track provenance. Absent `pipeline` (legacy rows). */
16792
- source: TrackSourceSchema.optional(),
16793
- firstSeen: number(),
16794
- lastSeen: number(),
16795
- /** Frame-rate position history (subject to maxPositionHistory cap). */
16796
- positions: array(TrackPositionSchema).readonly(),
16797
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
16798
- * saveThumbnails policy). */
16799
- snapshots: array(TrackSnapshotSchema).readonly(),
16800
- /** Deduplicated zones the track has entered at least once. Zone IDS. */
16801
- zonesVisited: array(string$2()).readonly(),
16696
+ var PipelineConfigBridge = custom();
16697
+ var ConfigUISchemaBridge = custom();
16698
+ var ConfigUISchemaNullableBridge = custom();
16699
+ var InferenceCapabilitiesBridge = custom();
16700
+ var ModelAvailabilityListBridge = custom();
16701
+ var PipelineRunResultBridge = custom();
16702
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string$2() }), EngineProvisioningSchema), method(_void(), record(string$2(), object({
16703
+ modelId: string$2(),
16704
+ settings: record(string$2(), unknown()).readonly()
16705
+ }))), method(object({ steps: record(string$2(), object({
16706
+ modelId: string$2(),
16707
+ settings: record(string$2(), unknown()).readonly()
16708
+ })) }), object({ success: literal(true) }), {
16709
+ kind: "mutation",
16710
+ auth: "admin"
16711
+ }), method(object({ nodeId: string$2() }), object({
16712
+ success: literal(true),
16713
+ clearedDevices: number()
16714
+ }), {
16715
+ kind: "mutation",
16716
+ auth: "admin"
16717
+ }), method(object({ nodeId: string$2() }), object({ unhealthy: array(object({
16718
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
16719
+ deviceKey: string$2(),
16802
16720
  /**
16803
- * Human NAMES for {@link zonesVisited}, resolved at READ time against the
16804
- * `zones` capability.
16805
- *
16806
- * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
16807
- * and no card can render — so every free-text search surface was structurally
16808
- * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
16809
- * just returned nothing. Resolving here rather than in each client keeps ONE
16810
- * derivation and costs the clients no extra call (the `zones` cap is
16811
- * per-device, so a client-side resolve would be a per-camera fan-out on a
16812
- * surface built to avoid exactly that).
16813
- *
16814
- * Resolved, never invented: a zone deleted since the track was written has no
16815
- * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
16816
- * two are not positionally aligned. Absent when the track visited no zone, or
16817
- * when the zone catalogue could not be read.
16721
+ * `failed` the per-device restart budget is exhausted; no pool
16722
+ * will be spawned until an operator re-arms it or the runner
16723
+ * respawns. `backoff` — under budget, waiting out the backoff (or
16724
+ * a cached pool observed dead and not yet condemned).
16818
16725
  */
16819
- zoneNames: array(string$2()).readonly().optional(),
16820
- /** Deduplicated set of detector classes observed for this track over its
16821
- * life (a track may be reclassified, e.g. person→vehicle). Absent on
16822
- * legacy rows written before class accumulation shipped. */
16823
- classes: array(string$2()).readonly().optional(),
16824
- /** Cumulative normalized distance travelled (0..1 units = full frame width). */
16825
- totalDistance: number(),
16826
- state: TrackStateSchema,
16827
- active: boolean(),
16828
- /** Deterministic key-event importance score in [0,1] (server-computed at
16829
- * track expiry, recomputed on late label). Absent on legacy rows written
16830
- * before scoring shipped — consumers degrade to absence / compute-on-read. */
16831
- importance: number().optional(),
16832
- /** Id of the track's highest-confidence ObjectEvent (its representative
16833
- * "best" frame). Absent when the track produced no object events. */
16834
- bestEventId: string$2().optional(),
16835
- /** Tag of the importance sub-signal that dominated the score
16836
- * (identity|dwell|proximity|class|confidence|travel|zone). */
16837
- importanceReason: string$2().optional(),
16838
- /** Audio-classification labels heard on the camera during the track's
16839
- * life (score ≥ device `classificationMinScore`), aggregated per label.
16840
- * Absent on legacy rows / tracks with no confident audio. */
16841
- audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
16842
- /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
16843
- * Populated from the persisted envelope columns on historical reads;
16844
- * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
16845
- envelope: TrackEnvelopeSchema.optional(),
16726
+ state: _enum(["failed", "backoff"]),
16727
+ /** Epoch ms of the death that produced this state. */
16728
+ since: number(),
16729
+ /** Pool deaths inside the current window. */
16730
+ deaths: number(),
16731
+ /** The last death's message. */
16732
+ lastError: string$2()
16733
+ })).readonly() })), method(object({
16734
+ nodeId: string$2(),
16735
+ deviceKey: string$2()
16736
+ }), object({ rearmed: boolean() }), {
16737
+ kind: "mutation",
16738
+ auth: "admin"
16739
+ }), 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({
16740
+ name: string$2(),
16741
+ steps: array(PipelineTemplateStepSchema).readonly(),
16742
+ engine: PipelineEngineChoiceSchema
16743
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
16744
+ id: string$2(),
16745
+ name: string$2().optional(),
16746
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
16747
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string$2() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string$2() }), ModelAvailabilityListBridge), method(object({
16748
+ addonId: string$2(),
16749
+ modelId: string$2(),
16750
+ format: ModelFormatSchema$1
16751
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
16752
+ addonId: string$2(),
16753
+ modelId: string$2(),
16754
+ format: ModelFormatSchema$1
16755
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
16756
+ engine: PipelineEngineChoiceSchema.optional(),
16757
+ steps: array(PipelineStepInputSchema).min(1),
16758
+ frame: FrameInputSchema.optional(),
16846
16759
  /**
16847
- * A face DETECTOR found a face on this track — nothing more. It says the
16848
- * detail plane produced a `face` detail; it does NOT say the face was
16849
- * embedded, matched, above `minFacePx`, or that the recognizer was even
16850
- * enabled. Set once and never cleared.
16851
- *
16852
- * **This exists so "face present but not recognised" is expressible.** A
16853
- * recognised identity lands in `subLabel` (attributed to the face chain via
16854
- * `subLabelMeta.stepId`), so before this field a track with an unmatched face
16855
- * and a track with no face at all were byte-identical on the wire and no
16856
- * surface could tell them apart. The read is `hasFace === true && subLabel
16857
- * === undefined`.
16858
- *
16859
- * **Absent ≠ false.** Every row written before the column existed omits it,
16860
- * and so does every server that predates the field — a consumer must test
16861
- * `=== true` and render nothing otherwise, never infer "no face".
16760
+ * Process-local lazy frame. Valid only when caller and provider resolve
16761
+ * in the same execution-group process; split/cross-node callers use
16762
+ * `frame`/`image` inline compatibility instead.
16862
16763
  */
16863
- hasFace: boolean().optional(),
16764
+ frameRef: FrameRefSchema.optional(),
16864
16765
  /**
16865
- * This track has a face row IN THE GALLERY: a crop **and** an embedding a
16866
- * face an operator could ASSIGN to an identity.
16867
- *
16868
- * The STRICT twin of {@link hasFace}, and the pair only earns its keep
16869
- * because the two disagree. `hasFace` is stamped at the TOP of the face
16870
- * branch, before every gate, and means no more than "a face detector produced
16871
- * a face detail". This one is stamped at the single moment the gallery row
16872
- * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
16873
- * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
16874
- * candidate gate, the imageless-track drop (no crop was ever captured) and
16875
- * the crop-store drop. Everything between the detector and that insert can
16876
- * legitimately refuse the face, so a flag written any earlier promises the
16877
- * operator something to assign and delivers nothing.
16878
- *
16879
- * **Independent of recognition.** A face collected but never auto-matched is
16880
- * still assignable — it is in fact the face an operator most wants to reach —
16881
- * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
16882
- * `subLabel`; this says only that the raw material exists.
16883
- *
16884
- * **Set once, never cleared.** A track that produced a gallery row produced
16885
- * one; deleting the row later is the gallery's business, not this flag's.
16886
- *
16887
- * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
16888
- * before the column omits it, and so does every server that predates the
16889
- * field. A consumer must test `=== true` and render nothing otherwise —
16890
- * never infer "no assignable face".
16766
+ * CB5 shm passthrough a `FrameHandle` naming the same ring slot
16767
+ * the decoded pixels live in. One more member of the one-of
16768
+ * frame/frameHandle/image/imageBase64/referenceImage group.
16891
16769
  */
16892
- hasEmbeddedFace: boolean().optional(),
16770
+ frameHandle: FrameHandleSchema.optional(),
16771
+ imageBase64: string$2().optional(),
16893
16772
  /**
16894
- * This subject CONTAINS a folded rider a person the rider-pairing step
16895
- * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
16896
- * so the passage is tracked once and as a VEHICLE.
16897
- *
16898
- * It exists because the fold's record was dishonest. D34 and the code both
16899
- * said "the person is not lost — it is reported so both entities stay on the
16900
- * record"; in fact the pair went into a per-processor RAM field behind an
16901
- * accessor nobody called, and every durable surface said `vehicle`, full
16902
- * stop. This is the composition note that makes the row true.
16903
- *
16904
- * A COMPOSITION, never a class and never a label. "This vehicle contains a
16905
- * person" is not an answer to "what is this" — both label tiers would refuse
16906
- * a macro token anyway (D89), and correctly. Nothing here changes what the
16907
- * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
16908
- * and a `person` rule still does not fire for someone cycling past.
16909
- *
16910
- * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
16911
- * the column, and every hub that predates the field, omits it. Test
16912
- * `=== true` and render nothing otherwise — never infer "no rider".
16773
+ * Binary JPEG bytespreferred over `imageBase64` on internal
16774
+ * hops (hub forked worker via Moleculer MsgPack) because it
16775
+ * skips the 33% base64 overhead + the per-call base64 decode on
16776
+ * the detection-pipeline worker. Callers can pass either; exactly
16777
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
16913
16778
  */
16914
- hasRider: boolean().optional(),
16915
- ...TrackFlagFields,
16916
- ...TrackRetrainFields
16917
- });
16918
- var BaseEventFields = {
16919
- id: string$2(),
16920
- deviceId: number(),
16921
- timestamp: number()
16922
- };
16923
- var MotionEventSchema = object({
16924
- ...BaseEventFields,
16925
- kind: literal("motion"),
16926
- regionCount: number(),
16927
- /** Heavy JSON array omitted in slim projection. */
16928
- regions: array(object({
16929
- bbox: BoundingBoxSchema,
16930
- pixelCount: number(),
16931
- intensity: number()
16932
- })).readonly().optional(),
16933
- /** Omitted in slim projection. */
16934
- frameWidth: number().optional(),
16935
- /** Omitted in slim projection. */
16936
- frameHeight: number().optional(),
16937
- /** Populated by B5 (recording playback URL for this event). */
16938
- mediaUrl: string$2().optional()
16939
- });
16779
+ image: _instanceof(Uint8Array).optional(),
16780
+ referenceImage: string$2().optional(),
16781
+ deviceId: number().optional(),
16782
+ sessionId: string$2().optional(),
16783
+ /**
16784
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
16785
+ * reference-image, and detail-subtree calls. 'frame' is the live
16786
+ * per-frame dispatch: ONLY root-plane steps run; crop children
16787
+ * (inputClasses ≠ null) are skipped and served per-track via
16788
+ * pipelineRunner.runDetailSubtree (two-plane design).
16789
+ */
16790
+ plane: _enum(["full", "frame"]).optional(),
16791
+ /**
16792
+ * Inference-device selector (Phase 2 multi-device). Format
16793
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
16794
+ * Omitted ⇒ the runner's default device (current single-engine
16795
+ * behaviour). Selects WHICH device pool of the node runs the call.
16796
+ */
16797
+ deviceKey: string$2().optional(),
16798
+ /**
16799
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
16800
+ * when the parent crop was resolved from the frame's retained NATIVE
16801
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
16802
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
16803
+ * resolution from that surface — the SAME quality path faces already
16804
+ * had — instead of the downscaled parent tile. `handle` keys the native
16805
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
16806
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
16807
+ * the executor's crop-normalized child ROI back into frame-normalized
16808
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
16809
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
16810
+ * (today's behaviour on the fallback path).
16811
+ */
16812
+ nativeCropRef: NativeCropRefSchema.optional()
16813
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
16814
+ engine: PipelineEngineChoiceSchema.optional(),
16815
+ steps: array(PipelineStepInputSchema).min(1),
16816
+ frames: array(FrameInputSchema).min(1).max(255),
16817
+ deviceId: number().optional(),
16818
+ sessionId: string$2().optional(),
16819
+ /**
16820
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
16821
+ * the batch to the Python pool's bench preprocess cache
16822
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
16823
+ * preprocessed ONCE and every later inference is a pure-inference cache
16824
+ * hit — the sustained-throughput run measures inference, not
16825
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
16826
+ * full preprocess every call, correct). Fresh per sustained run;
16827
+ * released via `uncacheFrame`.
16828
+ */
16829
+ frameId: number().int().nonnegative().optional(),
16830
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
16831
+ deviceKey: string$2().optional()
16832
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
16833
+ data: _instanceof(Uint8Array),
16834
+ width: number().int().positive(),
16835
+ height: number().int().positive(),
16836
+ format: _enum([
16837
+ "rgb",
16838
+ "bgr",
16839
+ "gray"
16840
+ ])
16841
+ }), object({
16842
+ frameId: number(),
16843
+ width: number(),
16844
+ height: number()
16845
+ }), { kind: "mutation" }), method(object({
16846
+ stepId: string$2(),
16847
+ frameId: number().int()
16848
+ }), record(string$2(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
16849
+ batchMode: string$2(),
16850
+ windowMs: number(),
16851
+ maxBatchSize: number(),
16852
+ concurrency: number()
16853
+ })), method(_void(), array(object({
16854
+ engineKey: string$2(),
16855
+ engine: PipelineEngineChoiceSchema,
16856
+ modelsLoaded: array(string$2()).readonly(),
16857
+ inUseByCameras: array(number()).readonly(),
16858
+ /**
16859
+ * Origin of this resident factory.
16860
+ * - `runtime` — main camera-serving engine (no idle TTL).
16861
+ * - `warm-override` — benchmark/test override held in the warm
16862
+ * cache; auto-disposed after the idle TTL.
16863
+ * - `device-pool` — a concurrent per-device pool (Phase 2
16864
+ * multi-device, keyed by `deviceKey`) resolved
16865
+ * via `resolveDeviceFactory`. Runs alongside the
16866
+ * `runtime` engine on a DIFFERENT accelerator
16867
+ * (NPU / iGPU / Coral) — this is how the
16868
+ * Engines tab shows all pools running at once.
16869
+ */
16870
+ kind: _enum([
16871
+ "runtime",
16872
+ "warm-override",
16873
+ "device-pool"
16874
+ ]),
16875
+ /** Native pid of the underlying Python pool (null when no pool). */
16876
+ poolPid: number().nullable(),
16877
+ /** ms since this factory was last used (null when not warm-tracked). */
16878
+ idleMs: number().nullable(),
16879
+ /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
16880
+ idleTtlMs: number().nullable()
16881
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
16882
+ kind: "mutation",
16883
+ auth: "admin"
16884
+ }), method(object({
16885
+ engine: PipelineEngineChoiceSchema,
16886
+ force: boolean().optional()
16887
+ }), object({
16888
+ success: boolean(),
16889
+ reason: string$2().optional()
16890
+ }), {
16891
+ kind: "mutation",
16892
+ auth: "admin"
16893
+ }), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string$2() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string$2() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
16894
+ addonId: string$2(),
16895
+ modelId: string$2(),
16896
+ filename: string$2().optional(),
16897
+ settings: record(string$2(), unknown()).optional()
16898
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
16940
16899
  /**
16941
- * Which detection SOURCE produced an object event. `pipeline` = the ML
16942
- * detection pipeline (decoded-frame inference); `onboard` = the camera's
16943
- * native on-device AI. Both flow through the SAME analysis layers (zoning,
16944
- * tracking, per-kind persistence) but stay distinguishable so consumers
16945
- * (advanced-notifier, occupancy, …) can select which source(s) to act on.
16946
- * Absent on legacy rows treat as `pipeline`.
16900
+ * Per-stage gating mode applied to the zones a rule references.
16901
+ *
16902
+ * - `include`: the rule contributes to a **whitelist** for its stage.
16903
+ * When at least one `include` rule fires for a stage, only entities
16904
+ * inside one of those zones pass that stage.
16905
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
16906
+ * Entities inside one of those zones are dropped at that stage.
16907
+ *
16908
+ * `monitor`-style observation (count without filtering) is not a rule
16909
+ * mode — zones without any matching rule are observed naturally by
16910
+ * `zone-analytics` (live snapshot + history), so an "I just want to
16911
+ * count, not filter" use case needs no rule at all.
16947
16912
  */
16948
- var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
16913
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
16949
16914
  /**
16950
- * The confirmed zone crossing that produced an object event. Present ONLY on
16951
- * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
16952
- * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
16953
- * appearance event carry none, so a rule asking for a direction fails closed
16954
- * on them.
16915
+ * Per-consumer rule that references existing zones (geometry) and
16916
+ * defines how a specific pipeline stage should treat them. Each
16917
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
16918
+ * settings:
16955
16919
  *
16956
- * Exactly ONE crossing per event: the emitter turns each confirmed crossing
16957
- * into its own event, so a frame in which a track enters A while leaving B
16958
- * produces two events with two directions — never one ambiguous row.
16920
+ * - `addon-motion-wasm` `motionZoneRules: ZoneRule[]` (motion stage)
16921
+ * - `addon-detection-pipeline` `detectionZoneRules: ZoneRule[]` (detection stage)
16922
+ * - future: notification rules, audio gating, etc.
16959
16923
  *
16960
- * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
16961
- * membership the box has NOW, and by definition it no longer contains the zone
16962
- * that was just left. Without the id here, a zone-scoped rule could never match
16963
- * the exit it asked for.
16924
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
16925
+ * express "ignore motion in ALL of {garden, street}" with a single
16926
+ * rule. `classFilter` narrows the rule to specific object classes
16927
+ * "drop person detections in the street, but keep cars" is one
16928
+ * `exclude` rule with `classFilter: ['person']`.
16929
+ *
16930
+ * `enabled` is a soft toggle — the operator can keep the rule
16931
+ * configured but inert without deleting it.
16964
16932
  */
16965
- var ZoneCrossingSchema = object({
16966
- direction: _enum(["enter", "exit"]),
16967
- /** Admin zone id crossed. */
16968
- zoneId: string$2(),
16969
- /** Zone display name at crossing time (falls back to the id). */
16970
- zoneName: string$2().optional()
16971
- });
16972
- var ObjectEventSchema = object({
16973
- ...BaseEventFields,
16974
- kind: literal("object"),
16975
- /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
16976
- source: DetectionSourceSchema.optional(),
16933
+ var ZoneRuleSchema = object({
16934
+ /** Stable rule id — survives edits, used by the UI for diffing. */
16935
+ id: string$2(),
16936
+ /** Optional human-readable label rendered in the rule editor. */
16937
+ name: string$2().optional(),
16938
+ /** Zones this rule targets. The rule's `mode` applies to ALL
16939
+ * listed zones (OR-set: a detection in any one of them counts).
16940
+ * At least one zone id required — a rule with no targets is a
16941
+ * configuration mistake and the form validator rejects it. */
16942
+ zoneIds: array(string$2()).min(1).readonly(),
16943
+ mode: ZoneRuleModeEnum,
16977
16944
  /**
16978
- * Inference-frame id shared by every object event emitted from the SAME frame
16979
- * the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
16980
- * 2 people + 1 dog) under one full frame, and link a track's frames over time
16981
- * (group by `trackId`, pick a representative `frameId` as the parent frame).
16982
- * Optional for backward-compat with pre-existing rows / the slim projection
16983
- * includes it (it is light). Absent on rows written before this field.
16945
+ * Class names this rule applies to. Empty / undefined rule
16946
+ * applies to every class. Class strings match the `macroClass`
16947
+ * field on detections (e.g. `person`, `car`, `dog`).
16984
16948
  */
16985
- frameId: string$2().optional(),
16986
- /** Omitted in slim projection. */
16987
- trackId: string$2().optional(),
16988
- className: string$2(),
16989
- ...TieredLabelFields,
16990
- /** Omitted in slim projection. */
16991
- confidence: number().optional(),
16992
- /** Heavy JSON — omitted in slim projection. */
16993
- bbox: BoundingBoxSchema.optional(),
16994
- /** Heavy JSON — omitted in slim projection. */
16995
- zones: array(string$2()).readonly().optional(),
16996
- /** Omitted in slim projection. */
16997
- state: TrackStateSchema.optional(),
16949
+ classFilter: array(string$2()).readonly().optional(),
16998
16950
  /**
16999
- * The zone crossing this event IS, when it is one. Absent on every other
17000
- * event kind (movement state, appearance, package) see
17001
- * {@link ZoneCrossingSchema}. Omitted in slim projection.
16951
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
16952
+ * required to consider an entity "in the zone". Defaults to the
16953
+ * consumer's stage default when omitted. Kept for back-compat with
16954
+ * existing per-rule overrides; new operators pick the value via
16955
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
16956
+ * set, the lower-level engine reads it as a 0–1 fraction.
17002
16957
  */
17003
- zoneCrossing: ZoneCrossingSchema.optional(),
17004
- /** Detection-frame dimensions in pixels — let consumers normalize the
17005
- * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17006
- frameWidth: number().optional(),
17007
- frameHeight: number().optional(),
17008
- /** MediaStore key for the crop attached to this event (if any). */
17009
- mediaKey: string$2().optional(),
17010
- /** Design B: MediaStore key of the track's native-resolution key frame (the
17011
- * best-detection full frame). Resolve via the event-media data-plane
17012
- * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17013
- * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17014
- * sources — consumers fall back to `mediaKey` (the tight crop). */
17015
- keyFrameMediaKey: string$2().optional(),
17016
- /** Populated by B5 (recording playback URL for this event). */
17017
- mediaUrl: string$2().optional(),
17018
- /** The parent track's key-event importance [0,1], propagated to every object
17019
- * event of the track (so an event row can be sorted by importance without a
17020
- * track join). Absent on legacy rows / before the track was scored. */
17021
- importance: number().optional()
17022
- });
17023
- var AudioEventSchema = object({
17024
- ...BaseEventFields,
17025
- kind: literal("audio"),
17026
- rms: number(),
17027
- dbfs: number(),
17028
- classification: object({
17029
- className: string$2(),
17030
- originalClass: string$2().optional(),
17031
- score: number()
17032
- }).optional(),
17033
- /** Populated by B5 (recording playback URL for this event). */
17034
- mediaUrl: string$2().optional()
16958
+ overlapThreshold: number().min(0).max(1).optional(),
16959
+ /**
16960
+ * Operator-friendly version of `overlapThreshold` the percentage
16961
+ * of the detection's bbox that must lie inside the zone for the
16962
+ * rule to match. Documented default is 85%; the engine substitutes
16963
+ * that when the field is omitted (kept optional so existing rules
16964
+ * stored without it stay valid).
16965
+ *
16966
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
16967
+ * rule, the engine prefers `bboxInclusionPct` because it's the
16968
+ * field exposed in the UI. Internally both feed the same gate.
16969
+ */
16970
+ bboxInclusionPct: number().min(0).max(100).optional(),
16971
+ /**
16972
+ * When `true` and a detection has a segmentation mask, use the
16973
+ * mask for overlap instead of the bbox. Detection-stage only;
16974
+ * motion rules ignore this field.
16975
+ */
16976
+ preferMask: boolean().optional(),
16977
+ /**
16978
+ * Soft-toggle: `false` disables the rule without deleting it.
16979
+ * Defaults to `true` so operators creating a rule via the UI
16980
+ * see it active immediately.
16981
+ */
16982
+ enabled: boolean().default(true)
17035
16983
  });
17036
- var MediaFileKindEnum = _enum([
17037
- "crop",
17038
- "thumbnail",
17039
- "snapshot",
17040
- "firstFrame",
17041
- "lastFrame",
17042
- "fullFrame",
17043
- "fullFrameBoxed",
17044
- "faceCrop",
17045
- "plateCrop",
17046
- "keyFrame",
17047
- "keyFrameSmall",
17048
- "thumbnailSmall"
17049
- ]);
17050
- var MediaFileSchema = object({
17051
- key: string$2(),
17052
- kind: MediaFileKindEnum,
17053
- base64: string$2(),
17054
- sizeBytes: number(),
17055
- timestamp: number()
16984
+ array(ZoneRuleSchema).readonly();
16985
+ /**
16986
+ * Zone — pure geometry + identity. NO filtering behaviour.
16987
+ *
16988
+ * Zones describe **where** in the frame the operator wants to flag
16989
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
16990
+ * each pipeline stage uses them. Splitting the two means a single
16991
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
16992
+ * a detection-include rule on `['car']`, and an occupancy aggregate
16993
+ * — without three duplicated polygons.
16994
+ *
16995
+ * Owned by the orchestrator addon (provider) and mirrored into the
16996
+ * `zones` device-state slice on every mutation. Consumers
16997
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
16998
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
16999
+ * mirror with `onChanged`).
17000
+ *
17001
+ * Coordinates are normalised fractions of the frame (0–1) so zones
17002
+ * survive resolution changes and stream profile switches.
17003
+ *
17004
+ * `kind` discriminates between full polygons (closed regions used
17005
+ * for intrusion / occupancy filters) and tripwires (open 2-point
17006
+ * line segments used for cross events). Onboard / firmware-reported
17007
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
17008
+ * task list.
17009
+ */
17010
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
17011
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
17012
+ var PolygonPointSchema = object({
17013
+ x: number(),
17014
+ y: number()
17015
+ });
17016
+ /** A camera detection zone — pure geometry/identity. */
17017
+ var ZoneSchema = object({
17018
+ id: string$2(),
17019
+ name: string$2(),
17020
+ kind: ZoneKindEnum.default("polygon"),
17021
+ /** Polygon vertices, fraction of frame (0–1). */
17022
+ polygon: array(PolygonPointSchema).readonly(),
17023
+ /** Visual color for UI rendering. */
17024
+ color: string$2().default("#3b82f6")
17056
17025
  });
17057
17026
  /**
17058
- * One media row WITHOUT its bytes.
17027
+ * Zones capability per-camera CRUD over polygon detection zones.
17059
17028
  *
17060
- * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17061
- * 140 s track), and a client that renders tiles from the media data plane needs
17062
- * to know only WHAT EXISTS the bytes then arrive per tile, lazily, over HTTP
17063
- * with an immutable cache, instead of all at once inside a tRPC response that
17064
- * blocks the whole view.
17029
+ * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
17030
+ * to per-device settings and mirrors into the `zones` device-state
17031
+ * slice on every mutation, so downstream consumers can subscribe via
17032
+ * `dev.state.zones.onChanged`.
17065
17033
  *
17066
- * `sizeBytes` is carried because it is what lets a client decide between the
17067
- * stored blob and a `?variant=thumb` rendering without fetching either.
17034
+ * The cap surface only handles geometry + identity; filtering
17035
+ * behaviour (per-class, include/exclude, threshold) lives in the
17036
+ * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
17037
+ * `capabilities/schemas/zone-rule.js`.
17068
17038
  */
17069
- var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17039
+ var zonesCapability = {
17040
+ name: "zones",
17041
+ scope: "device",
17042
+ mode: "singleton",
17043
+ deviceTypes: [DeviceType.Camera],
17044
+ methods: {
17045
+ listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
17046
+ addZone: method(object({
17047
+ deviceId: number(),
17048
+ zone: ZoneSchema
17049
+ }), _void(), {
17050
+ kind: "mutation",
17051
+ auth: "admin"
17052
+ }),
17053
+ removeZone: method(object({
17054
+ deviceId: number(),
17055
+ zoneId: string$2()
17056
+ }), _void(), {
17057
+ kind: "mutation",
17058
+ auth: "admin"
17059
+ }),
17060
+ updateZone: method(object({
17061
+ deviceId: number(),
17062
+ zone: ZoneSchema
17063
+ }), _void(), {
17064
+ kind: "mutation",
17065
+ auth: "admin"
17066
+ })
17067
+ },
17068
+ /**
17069
+ * Runtime-state slice — the live zone catalogue mirrored by the
17070
+ * orchestrator on every CRUD mutation. Consumers read via
17071
+ * `device.state.zones.value` / `.watch(...)` without round-tripping
17072
+ * the cap, and the codegen DeviceProxy auto-wires the reactive
17073
+ * handle. Slice shape is `{ zones: Zone[] }` so future extensions
17074
+ * (e.g. zone groupings) can sit alongside the polygon list.
17075
+ */
17076
+ runtimeState: object({ zones: array(ZoneSchema).readonly() }),
17077
+ /**
17078
+ * 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.
17079
+ *
17080
+ * See `RuntimeStateDurability`. Enforced by
17081
+ * `scripts/check-runtime-state-durability.ts`.
17082
+ */
17083
+ durability: "restored"
17084
+ };
17070
17085
  /**
17071
- * The MACRO tier of an annotation — a CLOSED set.
17086
+ * pipeline-analytics device-scoped wrapper cap. Refines raw
17087
+ * per-frame detections emitted by the pipeline runner into tracked
17088
+ * objects, per-kind event collections (motion / object / audio), and
17089
+ * persisted media. Owns the post-detection domain end-to-end:
17072
17090
  *
17073
- * This is what the exported detector predicts, so a typo here is a new class
17074
- * with one example in it. `label` and `subLabel` are open strings by contrast:
17075
- * the whole point of the page is teaching the model things it does not know
17076
- * yet, and constraining that vocabulary would make it useless.
17091
+ * runner emits PipelineInferenceResult
17092
+ * (event bus)
17093
+ * pipeline-analytics subscriber
17094
+ * SORT tracker + zone engine + state analyzer + event emitter
17095
+ * → three DB collections (one per kind), one FS media tree, one
17096
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
17097
+ * DetectionEvent on bus)
17077
17098
  *
17078
- * A macro class is NEVER a label. The provider refuses a write whose `label` or
17079
- * `subLabel` is one of these values, in any casing, because once `person`
17080
- * exists in both tiers "every person box" stops being answerable without
17081
- * knowing every string anyone ever typed — and the damage is retroactive.
17099
+ * Pure subscriber model. No `processFrame` cap method the runner
17100
+ * already publishes the raw frame on the bus. The cap surface is
17101
+ * only QUERIES + per-device settings, bound on/off via
17102
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
17103
+ * every camera with a detection pipeline wants its raw detections
17104
+ * refined; operators opt out per-device via BindingsTab when needed.
17105
+ *
17106
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
17107
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
17082
17108
  */
17083
- var RetrainMacroClassSchema = _enum([
17109
+ var TrackStateSchema = _enum([
17110
+ "new",
17111
+ "entered",
17112
+ "left",
17113
+ "moving",
17114
+ "idle"
17115
+ ]);
17116
+ var EventKindSchema = _enum([
17117
+ "motion",
17118
+ "object",
17119
+ "audio"
17120
+ ]);
17121
+ /**
17122
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
17123
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
17124
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
17125
+ */
17126
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
17127
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
17128
+ var EventKindIconSchema = _enum([
17129
+ "motion",
17130
+ "audio",
17084
17131
  "person",
17085
17132
  "vehicle",
17086
17133
  "animal",
17134
+ "door",
17135
+ "pir",
17136
+ "smoke",
17137
+ "water",
17138
+ "button",
17087
17139
  "package",
17088
- "face",
17089
- "plate"
17140
+ "generic"
17090
17141
  ]);
17091
- /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17092
- var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17093
- /** Did a human draw this box, or did the assist propose it? */
17094
- var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17095
- /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17096
- var RetrainBboxSchema = object({
17097
- x: number(),
17098
- y: number(),
17099
- w: number(),
17100
- h: number()
17101
- });
17102
- /**
17103
- * One annotated subject.
17104
- *
17105
- * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17106
- * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17107
- * derived from it at export and never stored storing them is how one feature
17108
- * space ends up holding two crops of the same subject (D52).
17109
- */
17110
- var RetrainAnnotationSchema = object({
17111
- id: string$2(),
17112
- trackId: string$2(),
17113
- deviceId: number(),
17114
- /** The COPY in retrain storage — never the source track's media key. */
17115
- mediaKey: string$2(),
17116
- bbox: RetrainBboxSchema,
17117
- macroClass: RetrainMacroClassSchema,
17118
- label: string$2().optional(),
17119
- subLabel: string$2().optional(),
17120
- kind: RetrainAnnotationKindSchema,
17121
- source: RetrainAnnotationSourceSchema,
17122
- /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17123
- assistModelId: string$2().optional(),
17124
- assistScore: number().optional(),
17125
- exportedInBatch: string$2().optional(),
17126
- createdAt: number()
17127
- });
17128
- /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17129
- var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17130
- id: true,
17131
- trackId: true,
17132
- deviceId: true,
17133
- mediaKey: true,
17134
- createdAt: true,
17135
- exportedInBatch: true
17142
+ var EventKindCategorySchema = _enum([
17143
+ "motion",
17144
+ "audio",
17145
+ "detection",
17146
+ "sensor",
17147
+ "control",
17148
+ "custom",
17149
+ "package"
17150
+ ]);
17151
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
17152
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
17153
+ var EventKindDescriptorSchema = object({
17154
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
17155
+ kind: string$2(),
17156
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
17157
+ labelKey: string$2(),
17158
+ /** English fallback label (kept for clients that don't translate). */
17159
+ label: string$2(),
17160
+ /** Hex color for timeline/legend rendering. */
17161
+ color: string$2(),
17162
+ /** Dictionary id → lucide component on the UI side. */
17163
+ iconId: string$2(),
17164
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
17165
+ icon: EventKindIconSchema,
17166
+ category: EventKindCategorySchema,
17167
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
17168
+ parentKind: string$2().nullable(),
17169
+ /** Derived from `parentKind`, explicit for the client tree. */
17170
+ level: EventKindLevelSchema,
17171
+ /** Which cap + device contributes this kind. For built-ins the camera
17172
+ * itself; for sensor kinds the LINKED source device. */
17173
+ source: object({
17174
+ capName: string$2(),
17175
+ deviceId: number()
17176
+ })
17136
17177
  });
17137
- /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17138
- var RetrainTrackSchema = object({
17139
- trackId: string$2(),
17178
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
17179
+ var EventKindsForDeviceSchema = object({
17140
17180
  deviceId: number(),
17141
- className: string$2(),
17142
- label: string$2().optional(),
17143
- firstSeen: number(),
17144
- lastSeen: number(),
17145
- /** How many frames the dataset already holds from this track. */
17146
- frameCount: number().int(),
17147
- /** How many subjects have been annotated on those frames. `0` with
17148
- * `frameCount: 0` is exactly "staging, still to work". */
17149
- annotationCount: number().int()
17150
- });
17151
- /** A frame the picker may offer — an index row, no blob was read to produce it. */
17152
- var RetrainFrameCandidateSchema = object({
17153
- mediaKey: string$2(),
17154
- kind: MediaFileKindEnum,
17155
- timestamp: number(),
17156
- sizeBytes: number().int(),
17157
- /** A copy of this original already exists — selecting it is free and cannot
17158
- * fail, whatever became of the original. */
17159
- copied: boolean()
17181
+ kinds: array(EventKindDescriptorSchema).readonly()
17160
17182
  });
17161
- /** A frame the dataset OWNS: bytes copied at selection time. */
17162
- var RetrainFrameSchema = object({
17163
- frameId: string$2(),
17183
+ var SensorEventSchema = object({
17184
+ id: string$2(),
17185
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
17186
+ * yields N rows, one per camera). */
17164
17187
  deviceId: number(),
17165
- trackId: string$2(),
17166
- /** Provenance only. It may already point at nothing — that is expected. */
17167
- sourceMediaKey: string$2(),
17168
- sourceKind: MediaFileKindEnum,
17169
- sizeBytes: number().int(),
17170
- width: number().int(),
17171
- height: number().int(),
17172
- copiedAt: number()
17188
+ /** The linked sensor device whose state changed. */
17189
+ sourceDeviceId: number(),
17190
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
17191
+ kind: string$2(),
17192
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
17193
+ value: record(string$2(), unknown()).nullable(),
17194
+ timestamp: number()
17173
17195
  });
17174
- /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17175
- var RetrainCopyRefusalSchema = _enum([
17176
- "source-missing",
17177
- "unreadable-image",
17178
- "write-failed"
17179
- ]);
17180
- var RetrainFrameSelectionSchema = object({
17181
- copied: array(RetrainFrameSchema).readonly(),
17182
- refused: array(object({
17183
- sourceMediaKey: string$2(),
17184
- reason: RetrainCopyRefusalSchema
17185
- })).readonly()
17196
+ var TrackPositionSchema = object({
17197
+ x: number(),
17198
+ y: number(),
17199
+ timestamp: number(),
17200
+ bbox: BoundingBoxSchema
17186
17201
  });
17187
- var RetrainFrameListSchema = object({
17188
- candidates: array(RetrainFrameCandidateSchema).readonly(),
17189
- copies: array(RetrainFrameSchema).readonly(),
17190
- /** What the page pre-selects the native key frame when one survives. */
17191
- autoPickMediaKey: string$2().optional()
17202
+ var TrackSnapshotSchema = object({
17203
+ timestamp: number(),
17204
+ position: TrackPositionSchema,
17205
+ /** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
17206
+ mediaKey: string$2()
17192
17207
  });
17193
- /** What the operator asked the assist to look for. */
17194
- var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17195
- kind: literal("package"),
17196
- zone: RetrainBboxSchema.optional()
17197
- }), object({
17198
- kind: literal("objects"),
17199
- modelId: string$2(),
17200
- minScore: number().optional()
17201
- })]);
17202
17208
  /**
17203
- * The assist's answer a discriminated union, because "the model saw nothing"
17204
- * and "this node cannot run that model" lead to different next moves and a
17205
- * nullable result cannot tell them apart.
17209
+ * Normalized 0..1 trajectory envelope (min/max over every position bbox,
17210
+ * divided by the track's detection-frame dims), computed at persist time.
17211
+ * Absent when the frame dims were unknown when the track was persisted
17212
+ * (legacy rows / dims-less sources) and on active (in-RAM) tracks.
17206
17213
  */
17207
- var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17208
- kind: literal("proposed"),
17209
- modelId: string$2(),
17210
- stepId: string$2(),
17211
- minScore: number(),
17212
- /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17213
- proposals: array(RetrainAnnotationDraftSchema).readonly(),
17214
- /** Returned by the runner but removed by the threshold. */
17215
- belowThreshold: number().int()
17216
- }), object({
17217
- kind: literal("refused"),
17218
- /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17219
- reason: string$2(),
17220
- detail: string$2().optional()
17221
- })]);
17222
- /** The outcome of a lifecycle move owned by the retrain page. */
17223
- var RetrainTransitionResultSchema = object({
17224
- trackId: string$2(),
17225
- /** Where the track ended up, whatever happened. */
17226
- retrainStatus: RetrainStatusSchema,
17227
- /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17228
- changed: boolean(),
17229
- reason: _enum([
17230
- "unknown-track",
17231
- "no-frames-copied",
17232
- "not-staging",
17233
- "not-trained",
17234
- "unchanged"
17235
- ]).optional()
17236
- });
17237
- var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17238
- var MAX_EVENT_QUERY_LIMIT = 5e3;
17239
- var DeviceEventQueryInput = object({
17240
- deviceId: number(),
17241
- since: number().optional(),
17242
- until: number().optional(),
17243
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17244
- /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17245
- * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17246
- * exact behaviour. Callers may omit this field — the store defaults to
17247
- * `full` when not provided. */
17248
- projection: _enum(["full", "slim"]).optional()
17249
- });
17250
- var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string$2().optional() });
17251
- var RecentTracksQueryInput = object({
17252
- /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17253
- deviceIds: array(number()),
17254
- /** Window lower bound on `lastSeen` (inclusive). */
17255
- since: number().optional(),
17256
- /** Window upper bound on `lastSeen` (inclusive). */
17257
- until: number().optional(),
17258
- /** Page size. Default 200, max 1000. */
17259
- limit: number().int().min(1).max(1e3).default(200),
17260
- /** Opaque continuation cursor from a previous page's `nextCursor`.
17261
- * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17262
- cursor: string$2().optional(),
17263
- /** See {@link TrackProjectionSchema}. Default `full`. */
17264
- projection: TrackProjectionSchema.optional(),
17265
- /** Include stationary-promoted rows (parked objects). Default false: the
17266
- * feed lists passages; parking records live on the stationary registry. */
17267
- includeStationary: boolean().optional()
17268
- });
17269
- var RecentTracksPageSchema = object({
17270
- /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17271
- tracks: array(TrackSchema).readonly(),
17272
- /** Cursor for the next page, or null when this page is the last. */
17273
- nextCursor: string$2().nullable()
17274
- });
17275
- var LIST_GROUPS_DEFAULT_LIMIT = 40;
17276
- var LIST_GROUPS_MAX_LIMIT = 100;
17277
- var AnalyticsGroupRecordSchema = object({
17278
- id: string$2(),
17279
- deviceId: number().int(),
17280
- openedAt: number().int(),
17281
- closedAt: number().int(),
17282
- timestamp: number().int(),
17283
- memberCount: number().int(),
17284
- memberTrackIds: array(string$2()).readonly(),
17285
- className: string$2(),
17286
- classes: array(string$2()).readonly(),
17287
- /** Relative event-media path, or null when the group has no picture yet. */
17288
- mediaUrl: string$2().nullable(),
17289
- singleton: boolean()
17214
+ var TrackEnvelopeSchema = object({
17215
+ minX: number(),
17216
+ minY: number(),
17217
+ maxX: number(),
17218
+ maxY: number()
17290
17219
  });
17291
- var AnalyticsGroupMemberSchema = object({
17292
- trackId: string$2(),
17293
- deviceId: number().int(),
17294
- className: string$2(),
17295
- firstSeen: number().int(),
17296
- lastSeen: number().int(),
17297
- mediaUrl: string$2().nullable()
17298
- });
17299
- var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17300
- var ListGroupsQueryInput = object({
17301
- /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17302
- deviceIds: array(number()),
17303
- /** Window lower bound on `closedAt` (inclusive). */
17304
- since: number().optional(),
17305
- /** Window upper bound on `openedAt` (inclusive). */
17306
- until: number().optional(),
17307
- limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17308
- /** Opaque continuation cursor from a previous page's `nextCursor`. */
17309
- cursor: string$2().optional()
17310
- });
17311
- var ListGroupsPageSchema = object({
17312
- groups: array(AnalyticsGroupRecordSchema).readonly(),
17313
- nextCursor: string$2().nullable()
17314
- });
17315
- var KeyEventQueryInput = object({
17316
- deviceId: number(),
17317
- /** Window lower bound (track firstSeen ≥ since). */
17318
- since: number(),
17319
- /** Window upper bound (track firstSeen ≤ until). */
17320
- until: number(),
17321
- limit: number().int().min(1).max(200).default(50),
17322
- /** Drop tracks scoring below this importance. */
17323
- minImportance: number().min(0).max(1).optional(),
17324
- /** Restrict to a single class (e.g. 'person'). */
17325
- classFilter: string$2().optional()
17326
- });
17327
- var KeyEventSchema = object({
17328
- /** The representative event id (the track's best ObjectEvent, else its trackId). */
17329
- id: string$2(),
17330
- trackId: string$2(),
17331
- /** Track start time (firstSeen). */
17332
- timestamp: number(),
17333
- className: string$2(),
17334
- ...TieredLabelFields,
17335
- importance: number(),
17336
- /** Highest-confidence ObjectEvent id for the track (empty when none). */
17337
- bestEventId: string$2(),
17338
- /** Track lifetime in ms (lastSeen - firstSeen). */
17339
- windowMs: number().optional(),
17340
- ...TrackFlagFields,
17341
- ...TrackRetrainFields
17342
- });
17343
- object({
17344
- trackId: string$2(),
17345
- className: string$2(),
17346
- confidence: number(),
17347
- bbox: BoundingBoxSchema,
17348
- zones: array(string$2()).readonly(),
17349
- state: TrackStateSchema
17350
- });
17351
- var OverlayDetectionSchema = looseObject({
17352
- id: string$2(),
17353
- kind: _enum(["first-level", "detail"]),
17354
- macroClass: string$2(),
17355
- score: number(),
17356
- bbox: object({
17357
- x: number(),
17358
- y: number(),
17359
- width: number(),
17360
- height: number()
17361
- }),
17362
- labels: array(looseObject({
17363
- label: string$2(),
17364
- score: number()
17365
- })).readonly(),
17366
- parentId: string$2().optional()
17367
- });
17368
- var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
17369
- var SearchObjectEventsInput = object({
17370
- text: string$2(),
17371
- deviceId: number().optional(),
17372
- since: number().optional(),
17373
- until: number().optional(),
17374
- classFilter: string$2().optional(),
17375
- limit: number().default(50),
17376
- minScore: number().min(0).max(1).default(.2)
17377
- });
17378
- var TrackCascadeCountsSchema = object({
17379
- /** Persisted track roots deleted (authoritative). */
17380
- tracks: number().int(),
17381
- /** Object events removed with their tracks (best-effort; see note above). */
17382
- events: number().int(),
17383
- /** Track/face/plate-owned media removed (best-effort). Never identity media. */
17384
- media: number().int(),
17385
- /** Unassigned (non-enrolled) face reads removed (best-effort). */
17386
- faces: number().int(),
17387
- /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
17388
- plates: number().int(),
17389
- /** Per-track CLIP search vectors removed (best-effort). */
17390
- embeddings: number().int(),
17391
- /** Group membership + group rows removed with their last member (best-effort). */
17392
- groups: number().int()
17393
- });
17394
- /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17395
- var DiskReconcileCountsSchema = object({
17396
- mediaDropped: number().int(),
17397
- tracks: number().int(),
17398
- events: number().int()
17399
- });
17400
- /** Event-store footprint for one camera. */
17401
- var EventStoreDeviceFootprintSchema = object({
17402
- deviceId: number(),
17403
- /** Persisted event rows (motion + object + audio) for the camera. */
17404
- rows: number().int(),
17405
- /** Event-owned media bytes on disk for the camera. */
17406
- bytes: number().int()
17407
- });
17408
- /** Aggregate event-store footprint: global totals + per-camera breakdown. */
17409
- var EventStoreFootprintSchema = object({
17410
- totalRows: number().int(),
17411
- totalBytes: number().int(),
17412
- devices: array(EventStoreDeviceFootprintSchema).readonly()
17413
- });
17414
- /** Per-kind counts returned by the event-prune / device-delete mutations. */
17415
- var EventPruneCountsSchema = object({
17416
- motion: number().int(),
17417
- object: number().int(),
17418
- audio: number().int()
17220
+ /**
17221
+ * Row projection for track list queries. `full` (default) returns the
17222
+ * complete Track including the frame-rate `positions[]` history and the
17223
+ * `snapshots[]` references — megabytes across a page of tracks. `slim`
17224
+ * keeps every scalar the list surfaces actually render (ids, class(es),
17225
+ * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
17226
+ * zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
17227
+ * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
17228
+ * `getTrack`. Mirrors the event-store `projection` convention
17229
+ * (`getObjectEvents` et al.).
17230
+ */
17231
+ var TrackProjectionSchema = _enum(["full", "slim"]);
17232
+ /**
17233
+ * One audio-classification label heard on the track's camera while the
17234
+ * track was alive, aggregated per label. An "episode" is one persisted
17235
+ * audio event (the confident-classification path: score ≥ the device's
17236
+ * `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
17237
+ * one 32 ms inference chunk, so counts stay human-scaled.
17238
+ */
17239
+ var TrackAudioLabelSchema = object({
17240
+ label: string$2(),
17241
+ /** Highest classification score observed across the label's episodes. */
17242
+ peakScore: number(),
17243
+ /** Number of coalesced audio-event episodes carrying this label. */
17244
+ count: number(),
17245
+ firstAt: number(),
17246
+ lastAt: number()
17419
17247
  });
17420
17248
  /**
17421
- * Re-embed stored tracks from their key frames.
17249
+ * How a track was produced. `pipeline` (default / absent) = the spatial
17250
+ * detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
17251
+ * no positions, a single snapshot, and no bbox trajectory at all:
17422
17252
  *
17423
- * The reason this is an operator-callable method and not a migration script:
17424
- * every knob that decides what a vector MEANS encoder model, crop margin,
17425
- * squaring is only changeable if the existing vectors can be regenerated.
17426
- * Mixing feature spaces in one index makes cosine scores incomparable, and the
17427
- * symptom is a quality regression with no visible cause.
17253
+ * - `sensor` a linked sensor/control device state change.
17254
+ * - `audio` an audio event on the camera itself that was anomalous for
17255
+ * THAT camera, loud, and heard while nothing visual was happening (D62).
17256
+ *
17257
+ * The spatial subsystems (tracker association, occupancy count, re-id /
17258
+ * embedding, resurrection) MUST skip every synthetic source. Test for that
17259
+ * with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
17260
+ * check silently readmits every source added after it was written.
17428
17261
  */
17429
- var RebuildObjectEmbeddingsInput = object({
17430
- /** Restrict to one camera. Omit for the whole fleet. */
17431
- deviceId: number().optional(),
17432
- since: number().optional(),
17433
- until: number().optional(),
17434
- /** Stop after this many tracks; the result reports whether more remain. */
17435
- maxTracks: number().int().positive().optional(),
17436
- /**
17437
- * Run every embedding on THIS node instead of round-robining the fleet.
17438
- *
17439
- * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
17440
- * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
17441
- * calling it that would pin the rebuild REQUEST itself to that node — the
17442
- * rebuild orchestration lives on the hub, and only the per-track step runs
17443
- * remotely. This field is data; the per-track pin is applied inside.
17444
- *
17445
- * Absent ⇒ round-robin over every online node whose runner can serve the
17446
- * pinned model.
17447
- */
17448
- executeOnNodeId: string$2().optional(),
17449
- /**
17450
- * Milliseconds to wait between tracks; omit for the built-in default, `0` to
17451
- * run flat out.
17452
- *
17453
- * A rebuild is bulk maintenance on hub-main's single thread. Measured
17454
- * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
17455
- * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
17456
- * force is logged at start and finish so a deliberately slow pass reads
17457
- * differently from a stalled one.
17458
- */
17459
- pacingMs: number().int().nonnegative().optional()
17460
- });
17262
+ var TrackSourceSchema = _enum([
17263
+ "pipeline",
17264
+ "sensor",
17265
+ "audio"
17266
+ ]);
17461
17267
  /**
17462
- * Result of emptying the CLIP index.
17268
+ * Where a track sits in the RETRAIN lifecycle (D81).
17463
17269
  *
17464
- * The clean slate before a policy change: a new crop margin or encoder model
17465
- * leaves two feature spaces in one index whose cosine scores are not
17466
- * comparable, so wiping and rebuilding is the only way to be sure every vector
17467
- * means the same thing.
17270
+ * - `none` never marked, or un-marked. Evictable.
17271
+ * - `staging` the operator wants this track as training material and has not
17272
+ * finished with it. **This is the only state retention holds**: the track and
17273
+ * everything it owns (object events, crops, keyframes, CLIP vector) survive
17274
+ * the device's age window.
17275
+ * - `trained` — the retrain page has taken what it needed. The frames it chose
17276
+ * were COPIED into the retrain dataset at selection time, so the dataset no
17277
+ * longer depends on the track's media and the track becomes EVICTABLE again.
17278
+ * Terminal for the plain `markForTrain` toggle: returning it to `staging` is
17279
+ * a deliberate action of the retrain page, not a side effect of a checkbox.
17280
+ *
17281
+ * There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
17282
+ * the store's filter language has only positive equality and `whereIn` — no
17283
+ * negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
17284
+ * would make the entire pre-column history immortal in one deploy.
17468
17285
  */
17469
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
17286
+ var RetrainStatusSchema = _enum([
17287
+ "none",
17288
+ "staging",
17289
+ "trained"
17290
+ ]);
17470
17291
  /**
17471
- * Acknowledgement that a rebuild STARTED.
17292
+ * Per-track OPERATOR flags set by hand from the admin UI or the viewer, never
17293
+ * by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
17294
+ * so the two surfaces cannot drift.
17472
17295
  *
17473
- * The pass costs ~1s per track 45 minutes for a 2,600-track fleet so it
17474
- * runs detached and this returns immediately. Waiting for it made the client
17475
- * time out while the work carried on server-side, which is the worst of both:
17476
- * no result and no way to know it was still going. Poll
17477
- * `getObjectEmbeddingRebuildStatus` for progress.
17296
+ * **Absent false.** A track that has never been touched omits the field; an
17297
+ * explicitly un-flagged track carries `false`. Legacy rows written before the
17298
+ * columns existed read as absent, and a consumer that needs a boolean should say
17299
+ * `flag === true`, not `flag !== false`.
17300
+ *
17301
+ * `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
17302
+ * it is exactly `retrainStatus === 'staging'`, in both directions. Writing
17303
+ * `true` moves `none → staging`, writing `false` moves `staging → none`, and a
17304
+ * `trained` track reports `false` while refusing both writes. The boolean is
17305
+ * kept because three surfaces drive a toggle off it; anything that needs to tell
17306
+ * "never marked" from "already trained" must read `retrainStatus`.
17307
+ *
17308
+ * `debug` does NOT pin; it is attention, not durability.
17309
+ *
17310
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17311
+ * A favourited track is skipped by retention the same way `staging` is, but
17312
+ * it does not enter `none|staging|trained` and has no staging budget.
17478
17313
  */
17479
- var RebuildObjectEmbeddingsResultSchema = object({
17480
- started: boolean(),
17481
- /** True when a pass was already running; the new request is ignored. */
17482
- alreadyRunning: boolean()
17483
- });
17484
- var RebuildStatusSchema = object({
17485
- running: boolean(),
17486
- scanned: number(),
17487
- rebuilt: number(),
17488
- /** Tracks whose key frame is gone — nothing to re-embed from. */
17489
- missingKeyFrame: number(),
17490
- /** Tracks with no usable detection box. */
17491
- missingBbox: number(),
17492
- /**
17493
- * Tracks an executing node REFUSED rather than broke on an unreadable key
17494
- * frame, a step that threw. Separate from `failed` because the remedy is
17495
- * different, and because a whole camera silently contributing zero vectors
17496
- * is the shape of failure a rebuild must never hide.
17497
- */
17498
- notRunnable: number(),
17499
- /**
17500
- * The pass stopped because NO node could serve the pinned model.
17501
- *
17502
- * Distinct from `notRunnable` on purpose: that one says "this track was
17503
- * refused", this one says "the cluster cannot do this work at all" — every
17504
- * candidate node either lacks the `clip-embedding` step, lacks a build of the
17505
- * pinned model for its engine format, or dropped out. The remedy is a model /
17506
- * engine change, not a per-camera one. Non-zero here always comes with
17507
- * `complete: false`.
17508
- */
17509
- noCapableNode: number(),
17510
- failed: number(),
17511
- /** Set once a pass ends: true only when EVERYTHING was covered. */
17512
- complete: boolean().nullable(),
17513
- startedAtMs: number().nullable(),
17514
- finishedAtMs: number().nullable(),
17515
- /** Present when the pass ended by throwing. */
17516
- error: string$2().nullable()
17314
+ var TrackFlagFields = {
17315
+ /** Operator marked this track as training material — i.e. `retrainStatus` is
17316
+ * `'staging'`. */
17317
+ markForTrain: boolean().optional(),
17318
+ /** Operator marked this track for diagnostic attention. */
17319
+ debug: boolean().optional(),
17320
+ /** Operator favourited this track. Pins it against pruning. */
17321
+ favourited: boolean().optional()
17322
+ };
17323
+ /**
17324
+ * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
17325
+ * Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
17326
+ * write patch, and the status is not something the toggle sets — it is what the
17327
+ * toggle's boolean is derived from. Absent on an in-RAM track never touched;
17328
+ * always present on a persisted row (the column default materialises `'none'`).
17329
+ */
17330
+ var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
17331
+ /**
17332
+ * The write half: a PARTIAL patch. An omitted key is left untouched, so setting
17333
+ * one flag can never clear the other — the toggles are independent and are
17334
+ * driven from three surfaces that do not know about each other.
17335
+ */
17336
+ var TrackFlagsPatchSchema = object(TrackFlagFields);
17337
+ /**
17338
+ * The resolved flag state after a write. Both fields are REQUIRED here (absent
17339
+ * collapses to `false`) so a caller can drive a toggle's checked state off the
17340
+ * mutation result without a re-fetch.
17341
+ */
17342
+ var TrackFlagsSchema = object({
17343
+ trackId: string$2(),
17344
+ markForTrain: boolean(),
17345
+ debug: boolean(),
17346
+ favourited: boolean(),
17347
+ /** The lifecycle state the boolean was derived from. Required here (unlike on
17348
+ * a track row) because this shape is only ever produced by the write body,
17349
+ * which always knows it — and a surface that has just written needs to render
17350
+ * `trained` without a re-fetch. */
17351
+ retrainStatus: RetrainStatusSchema
17517
17352
  });
17518
- DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
17519
- deviceId: number(),
17520
- trackId: string$2()
17521
- }), TrackSchema.nullable()), method(object({
17522
- deviceId: number(),
17523
- since: number().optional(),
17524
- until: number().optional(),
17525
- limit: number().optional(),
17526
- /** Spatial filter only tracks whose trajectory intersects the zone
17527
- * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
17528
- * envelope columns, then precisely tested per position. Tracks with
17529
- * an unknown envelope (no frame dims at persist time) always match. */
17530
- zone: TrackZoneFilterSchema.optional(),
17531
- /** See {@link TrackProjectionSchema}. Default `full` (backward
17532
- * compatible — omitting the field keeps today's exact behaviour). */
17533
- projection: TrackProjectionSchema.optional(),
17534
- /** Include stationary-promoted rows (parked objects handed to the
17535
- * stationary registry). Default false: the timeline lists passages,
17536
- * not parking records (operator decision, 2026-08-15). */
17537
- includeStationary: boolean().optional()
17538
- }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
17539
- deviceId: number(),
17540
- groupId: string$2().min(1)
17541
- }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
17542
- kind: "mutation",
17543
- auth: "admin"
17544
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()), method(object({
17545
- deviceId: number(),
17546
- since: number().optional(),
17547
- until: number().optional(),
17548
- kinds: array(string$2()).optional(),
17549
- limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
17550
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
17551
- deviceId: number(),
17552
- since: number(),
17553
- until: number(),
17554
- bucketMs: number().int().positive()
17555
- }), array(object({
17556
- bucketStart: number(),
17557
- motion: number().int(),
17558
- object: number().int(),
17559
- audio: number().int()
17560
- })).readonly()), method(object({
17561
- deviceId: number(),
17562
- cutoffMs: number()
17563
- }), object({
17564
- motion: number().int(),
17565
- object: number().int(),
17566
- audio: number().int()
17567
- }), {
17568
- kind: "mutation",
17569
- auth: "admin"
17570
- }), method(object({
17571
- deviceId: number(),
17572
- cutoffMs: number()
17573
- }), TrackCascadeCountsSchema, {
17574
- kind: "mutation",
17575
- auth: "admin"
17576
- }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17577
- kind: "mutation",
17578
- auth: "admin"
17579
- }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17580
- kind: "mutation",
17581
- auth: "admin"
17582
- }), method(object({
17583
- deviceId: number(),
17584
- trackIds: array(string$2()).min(1)
17585
- }), object({
17586
- deleted: number().int(),
17587
- failed: array(string$2()).readonly()
17588
- }), {
17589
- kind: "mutation",
17590
- auth: "admin"
17591
- }), method(object({
17592
- /** Log/audit scope only — the trackId is globally unique on its own. */
17353
+ union([literal(1), literal(2)]);
17354
+ /**
17355
+ * WHO decided a label, and when. Carried per tier so a value can be traced to
17356
+ * the step and model that produced it — which is what makes the write rule
17357
+ * arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
17358
+ * and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
17359
+ *
17360
+ * `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
17361
+ * `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
17362
+ * `migration:4g` for a value the 4g migration moved from the single-slot era —
17363
+ * that value has no provenance, and the write rule lets ANY properly-attributed
17364
+ * write of the same tier replace it regardless of score.
17365
+ */
17366
+ var LabelAttributionSchema = object({
17367
+ stepId: string$2(),
17368
+ modelId: string$2().optional(),
17369
+ decidedAt: number(),
17370
+ /**
17371
+ * The GALLERY id behind a recognised tier-2 label — a face-gallery
17372
+ * `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
17373
+ *
17374
+ * The text alone is a DISPLAY NAME, and a display name is renameable: a
17375
+ * notification rule authored on "Gianluca" stopped matching the moment the
17376
+ * operator fixed the spelling in the gallery, and nothing said so. The id is
17377
+ * the thing that does not move, so it is what a rule matches on
17378
+ * (`NcConditions.identities`) and the text is what a human is shown.
17379
+ *
17380
+ * Absent when the label names no gallery row — a plate the OCR read but no
17381
+ * vehicle claims, a sub-class, a species, any tier-1 value.
17382
+ */
17383
+ identityId: string$2().optional()
17384
+ });
17385
+ /**
17386
+ * The TIERED label model (roadmap 4g), spread into `TrackSchema` and
17387
+ * `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
17388
+ * track and its events always answer the same question the same way.
17389
+ *
17390
+ * Two scalar columns, not an array: every consumer wants "the coarse one" or
17391
+ * "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
17392
+ * is tier 2, and each carries its own score + attribution.
17393
+ *
17394
+ * **Reading it.** What a human should be shown is `subLabel ?? label` — the
17395
+ * finest thing known. Before 4g the single `label` column held the finest
17396
+ * value, so a consumer that has not been updated reads the tier-1 slot and
17397
+ * shows nothing on a species-only row; that is why the migration puts every
17398
+ * pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
17399
+ * and why the read surfaces were changed in the same train.
17400
+ *
17401
+ * **Writing it.** The slots are independent, which is the whole point: a
17402
+ * tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
17403
+ * migratorius`), so fineness cannot regress by construction. Within a tier the
17404
+ * higher score wins. One rule, one implementation — see
17405
+ * `pipeline/label-tier.ts` in addon-post-analysis.
17406
+ */
17407
+ var TieredLabelFields = {
17408
+ /** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
17409
+ label: string$2().optional(),
17410
+ /** Confidence of the tier-1 value, as reported by the deciding step. */
17411
+ labelScore: number().optional(),
17412
+ /** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
17413
+ labelMeta: LabelAttributionSchema.optional(),
17414
+ /** Tier 2 the instance. See {@link LabelTierSchema}. */
17415
+ subLabel: string$2().optional(),
17416
+ /** Confidence of the tier-2 value, as reported by the deciding step. */
17417
+ subLabelScore: number().optional(),
17418
+ /** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
17419
+ subLabelMeta: LabelAttributionSchema.optional()
17420
+ };
17421
+ /** Per-camera slice of a training-export estimate. */
17422
+ var TrainingExportDeviceTotalsSchema = object({
17593
17423
  deviceId: number(),
17424
+ tracks: number().int(),
17425
+ files: number().int(),
17426
+ bytes: number().int()
17427
+ });
17428
+ /**
17429
+ * What a training export WOULD contain. Computed from media index rows only —
17430
+ * no blob is read to produce this.
17431
+ */
17432
+ var TrainingExportSummarySchema = object({
17433
+ generatedAt: number(),
17434
+ trackCount: number().int(),
17435
+ fileCount: number().int(),
17436
+ byteCount: number().int(),
17437
+ /** More marked tracks exist than a single pass carries. */
17438
+ truncated: boolean(),
17439
+ devices: array(TrainingExportDeviceTotalsSchema).readonly()
17440
+ });
17441
+ var TrackSchema = object({
17594
17442
  trackId: string$2(),
17595
- flags: TrackFlagsPatchSchema
17596
- }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
17597
- kind: "query",
17598
- auth: "admin"
17599
- }), method(object({
17600
- olderThanMs: number(),
17601
- reason: OpsLogReasonSchema.optional()
17602
- }), EventPruneCountsSchema, {
17603
- kind: "mutation",
17604
- auth: "admin"
17605
- }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
17606
- kind: "mutation",
17607
- auth: "admin"
17608
- }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
17609
- kind: "mutation",
17610
- auth: "admin"
17611
- }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
17612
- kind: "mutation",
17613
- auth: "admin"
17614
- }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
17615
- kind: "mutation",
17616
- auth: "admin"
17617
- }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string$2() }), {
17618
- kind: "mutation",
17619
- auth: "admin"
17620
- }), method(object({ jobId: string$2() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
17621
- kind: "mutation",
17622
- auth: "admin"
17623
- }), method(RelocateMediaInputSchema, object({ jobId: string$2() }), {
17624
- kind: "mutation",
17625
- auth: "admin"
17626
- }), method(object({}), array(RelocateJobSchema).readonly(), {
17627
- kind: "query",
17628
- auth: "admin"
17629
- }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
17630
- kind: "mutation",
17631
- auth: "admin"
17632
- }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
17633
- kind: "query",
17634
- auth: "admin"
17635
- }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
17636
- kind: "query",
17637
- auth: "admin"
17638
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string$2() }), {
17639
- kind: "query",
17640
- auth: "admin"
17641
- }), method(object({
17642
- /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
17643
- * `deviceId`, deliberately: `deviceId` would make this device-bound and
17644
- * route it at one camera's owner, and "every camera" would stop being
17645
- * expressible at all. */
17646
- deviceIds: array(number()).optional(),
17647
- limit: number().int().min(1).max(500).optional()
17648
- }), array(RetrainTrackSchema).readonly(), {
17649
- kind: "query",
17650
- auth: "admin"
17651
- }), method(object({ trackId: string$2() }), RetrainFrameListSchema, {
17652
- kind: "query",
17653
- auth: "admin"
17654
- }), method(object({
17655
17443
  deviceId: number(),
17656
- trackId: string$2(),
17657
- mediaKeys: array(string$2()).min(1)
17658
- }), RetrainFrameSelectionSchema, {
17659
- kind: "mutation",
17660
- auth: "admin"
17661
- }), method(object({
17444
+ className: string$2(),
17445
+ ...TieredLabelFields,
17446
+ producingDeviceName: string$2().optional(),
17447
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
17448
+ source: TrackSourceSchema.optional(),
17449
+ firstSeen: number(),
17450
+ lastSeen: number(),
17451
+ /** Frame-rate position history (subject to maxPositionHistory cap). */
17452
+ positions: array(TrackPositionSchema).readonly(),
17453
+ /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17454
+ * saveThumbnails policy). */
17455
+ snapshots: array(TrackSnapshotSchema).readonly(),
17456
+ /** Deduplicated zones the track has entered at least once. Zone IDS. */
17457
+ zonesVisited: array(string$2()).readonly(),
17458
+ /**
17459
+ * Human NAMES for {@link zonesVisited}, resolved at READ time against the
17460
+ * `zones` capability.
17461
+ *
17462
+ * `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
17463
+ * and no card can render — so every free-text search surface was structurally
17464
+ * unable to answer "show me the tracks in Uscio", and did not fail loudly, it
17465
+ * just returned nothing. Resolving here rather than in each client keeps ONE
17466
+ * derivation and costs the clients no extra call (the `zones` cap is
17467
+ * per-device, so a client-side resolve would be a per-camera fan-out on a
17468
+ * surface built to avoid exactly that).
17469
+ *
17470
+ * Resolved, never invented: a zone deleted since the track was written has no
17471
+ * name and is DROPPED, so this array can be shorter than `zonesVisited` — the
17472
+ * two are not positionally aligned. Absent when the track visited no zone, or
17473
+ * when the zone catalogue could not be read.
17474
+ */
17475
+ zoneNames: array(string$2()).readonly().optional(),
17476
+ /** Deduplicated set of detector classes observed for this track over its
17477
+ * life (a track may be reclassified, e.g. person→vehicle). Absent on
17478
+ * legacy rows written before class accumulation shipped. */
17479
+ classes: array(string$2()).readonly().optional(),
17480
+ /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17481
+ totalDistance: number(),
17482
+ state: TrackStateSchema,
17483
+ active: boolean(),
17484
+ /** Deterministic key-event importance score in [0,1] (server-computed at
17485
+ * track expiry, recomputed on late label). Absent on legacy rows written
17486
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
17487
+ importance: number().optional(),
17488
+ /** Id of the track's highest-confidence ObjectEvent (its representative
17489
+ * "best" frame). Absent when the track produced no object events. */
17490
+ bestEventId: string$2().optional(),
17491
+ /** Tag of the importance sub-signal that dominated the score
17492
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
17493
+ importanceReason: string$2().optional(),
17494
+ /** Audio-classification labels heard on the camera during the track's
17495
+ * life (score ≥ device `classificationMinScore`), aggregated per label.
17496
+ * Absent on legacy rows / tracks with no confident audio. */
17497
+ audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
17498
+ /** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
17499
+ * Populated from the persisted envelope columns on historical reads;
17500
+ * absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
17501
+ envelope: TrackEnvelopeSchema.optional(),
17502
+ /**
17503
+ * A face DETECTOR found a face on this track — nothing more. It says the
17504
+ * detail plane produced a `face` detail; it does NOT say the face was
17505
+ * embedded, matched, above `minFacePx`, or that the recognizer was even
17506
+ * enabled. Set once and never cleared.
17507
+ *
17508
+ * **This exists so "face present but not recognised" is expressible.** A
17509
+ * recognised identity lands in `subLabel` (attributed to the face chain via
17510
+ * `subLabelMeta.stepId`), so before this field a track with an unmatched face
17511
+ * and a track with no face at all were byte-identical on the wire and no
17512
+ * surface could tell them apart. The read is `hasFace === true && subLabel
17513
+ * === undefined`.
17514
+ *
17515
+ * **Absent ≠ false.** Every row written before the column existed omits it,
17516
+ * and so does every server that predates the field — a consumer must test
17517
+ * `=== true` and render nothing otherwise, never infer "no face".
17518
+ */
17519
+ hasFace: boolean().optional(),
17520
+ /**
17521
+ * This track has a face row IN THE GALLERY: a crop **and** an embedding — a
17522
+ * face an operator could ASSIGN to an identity.
17523
+ *
17524
+ * The STRICT twin of {@link hasFace}, and the pair only earns its keep
17525
+ * because the two disagree. `hasFace` is stamped at the TOP of the face
17526
+ * branch, before every gate, and means no more than "a face detector produced
17527
+ * a face detail". This one is stamped at the single moment the gallery row
17528
+ * LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
17529
+ * past the embedding-magnitude verdict, the `minFacePx` detection gate, the
17530
+ * candidate gate, the imageless-track drop (no crop was ever captured) and
17531
+ * the crop-store drop. Everything between the detector and that insert can
17532
+ * legitimately refuse the face, so a flag written any earlier promises the
17533
+ * operator something to assign and delivers nothing.
17534
+ *
17535
+ * **Independent of recognition.** A face collected but never auto-matched is
17536
+ * still assignable — it is in fact the face an operator most wants to reach —
17537
+ * so this is NOT gated on `recognizedIdentityId`. Recognition lands in
17538
+ * `subLabel`; this says only that the raw material exists.
17539
+ *
17540
+ * **Set once, never cleared.** A track that produced a gallery row produced
17541
+ * one; deleting the row later is the gallery's business, not this flag's.
17542
+ *
17543
+ * **Absent ≠ false**, the same rule as {@link hasFace}: every row written
17544
+ * before the column omits it, and so does every server that predates the
17545
+ * field. A consumer must test `=== true` and render nothing otherwise —
17546
+ * never infer "no assignable face".
17547
+ */
17548
+ hasEmbeddedFace: boolean().optional(),
17549
+ /**
17550
+ * This subject CONTAINS a folded rider — a person the rider-pairing step
17551
+ * ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
17552
+ * so the passage is tracked once and as a VEHICLE.
17553
+ *
17554
+ * It exists because the fold's record was dishonest. D34 and the code both
17555
+ * said "the person is not lost — it is reported so both entities stay on the
17556
+ * record"; in fact the pair went into a per-processor RAM field behind an
17557
+ * accessor nobody called, and every durable surface said `vehicle`, full
17558
+ * stop. This is the composition note that makes the row true.
17559
+ *
17560
+ * A COMPOSITION, never a class and never a label. "This vehicle contains a
17561
+ * person" is not an answer to "what is this" — both label tiers would refuse
17562
+ * a macro token anyway (D89), and correctly. Nothing here changes what the
17563
+ * subject IS: a cyclist stays one vehicle track, occupancy still counts one,
17564
+ * and a `person` rule still does not fire for someone cycling past.
17565
+ *
17566
+ * **Absent ≠ false**, exactly like {@link hasFace}: every row written before
17567
+ * the column, and every hub that predates the field, omits it. Test
17568
+ * `=== true` and render nothing otherwise — never infer "no rider".
17569
+ */
17570
+ hasRider: boolean().optional(),
17571
+ ...TrackFlagFields,
17572
+ ...TrackRetrainFields
17573
+ });
17574
+ var BaseEventFields = {
17575
+ id: string$2(),
17662
17576
  deviceId: number(),
17663
- trackId: string$2(),
17664
- frameId: string$2()
17665
- }), object({
17666
- removed: boolean(),
17667
- removedAnnotations: number().int()
17668
- }), {
17669
- kind: "mutation",
17670
- auth: "admin"
17671
- }), method(object({ frameId: string$2() }), object({
17577
+ timestamp: number()
17578
+ };
17579
+ var MotionEventSchema = object({
17580
+ ...BaseEventFields,
17581
+ kind: literal("motion"),
17582
+ regionCount: number(),
17583
+ /** Heavy JSON array — omitted in slim projection. */
17584
+ regions: array(object({
17585
+ bbox: BoundingBoxSchema,
17586
+ pixelCount: number(),
17587
+ intensity: number()
17588
+ })).readonly().optional(),
17589
+ /** Omitted in slim projection. */
17590
+ frameWidth: number().optional(),
17591
+ /** Omitted in slim projection. */
17592
+ frameHeight: number().optional(),
17593
+ /** Populated by B5 (recording playback URL for this event). */
17594
+ mediaUrl: string$2().optional()
17595
+ });
17596
+ /**
17597
+ * Which detection SOURCE produced an object event. `pipeline` = the ML
17598
+ * detection pipeline (decoded-frame inference); `onboard` = the camera's
17599
+ * native on-device AI. Both flow through the SAME analysis layers (zoning,
17600
+ * tracking, per-kind persistence) but stay distinguishable so consumers
17601
+ * (advanced-notifier, occupancy, …) can select which source(s) to act on.
17602
+ * Absent on legacy rows ⇒ treat as `pipeline`.
17603
+ */
17604
+ var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
17605
+ /**
17606
+ * The confirmed zone crossing that produced an object event. Present ONLY on
17607
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
17608
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
17609
+ * appearance event carry none, so a rule asking for a direction fails closed
17610
+ * on them.
17611
+ *
17612
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
17613
+ * into its own event, so a frame in which a track enters A while leaving B
17614
+ * produces two events with two directions — never one ambiguous row.
17615
+ *
17616
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
17617
+ * membership the box has NOW, and by definition it no longer contains the zone
17618
+ * that was just left. Without the id here, a zone-scoped rule could never match
17619
+ * the exit it asked for.
17620
+ */
17621
+ var ZoneCrossingSchema = object({
17622
+ direction: _enum(["enter", "exit"]),
17623
+ /** Admin zone id crossed. */
17624
+ zoneId: string$2(),
17625
+ /** Zone display name at crossing time (falls back to the id). */
17626
+ zoneName: string$2().optional()
17627
+ });
17628
+ var ObjectEventSchema = object({
17629
+ ...BaseEventFields,
17630
+ kind: literal("object"),
17631
+ /** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
17632
+ source: DetectionSourceSchema.optional(),
17633
+ /**
17634
+ * Inference-frame id shared by every object event emitted from the SAME frame
17635
+ * — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
17636
+ * 2 people + 1 dog) under one full frame, and link a track's frames over time
17637
+ * (group by `trackId`, pick a representative `frameId` as the parent frame).
17638
+ * Optional for backward-compat with pre-existing rows / the slim projection
17639
+ * includes it (it is light). Absent on rows written before this field.
17640
+ */
17641
+ frameId: string$2().optional(),
17642
+ /** Omitted in slim projection. */
17643
+ trackId: string$2().optional(),
17644
+ className: string$2(),
17645
+ ...TieredLabelFields,
17646
+ /** Omitted in slim projection. */
17647
+ confidence: number().optional(),
17648
+ /** Heavy JSON — omitted in slim projection. */
17649
+ bbox: BoundingBoxSchema.optional(),
17650
+ /** Heavy JSON — omitted in slim projection. */
17651
+ zones: array(string$2()).readonly().optional(),
17652
+ /** Omitted in slim projection. */
17653
+ state: TrackStateSchema.optional(),
17654
+ /**
17655
+ * The zone crossing this event IS, when it is one. Absent on every other
17656
+ * event kind (movement state, appearance, package) — see
17657
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
17658
+ */
17659
+ zoneCrossing: ZoneCrossingSchema.optional(),
17660
+ /** Detection-frame dimensions in pixels — let consumers normalize the
17661
+ * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
17662
+ frameWidth: number().optional(),
17663
+ frameHeight: number().optional(),
17664
+ /** MediaStore key for the crop attached to this event (if any). */
17665
+ mediaKey: string$2().optional(),
17666
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
17667
+ * best-detection full frame). Resolve via the event-media data-plane
17668
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
17669
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
17670
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
17671
+ keyFrameMediaKey: string$2().optional(),
17672
+ /** Populated by B5 (recording playback URL for this event). */
17673
+ mediaUrl: string$2().optional(),
17674
+ /** The parent track's key-event importance [0,1], propagated to every object
17675
+ * event of the track (so an event row can be sorted by importance without a
17676
+ * track join). Absent on legacy rows / before the track was scored. */
17677
+ importance: number().optional()
17678
+ });
17679
+ var AudioEventSchema = object({
17680
+ ...BaseEventFields,
17681
+ kind: literal("audio"),
17682
+ rms: number(),
17683
+ dbfs: number(),
17684
+ classification: object({
17685
+ className: string$2(),
17686
+ originalClass: string$2().optional(),
17687
+ score: number()
17688
+ }).optional(),
17689
+ /** Populated by B5 (recording playback URL for this event). */
17690
+ mediaUrl: string$2().optional()
17691
+ });
17692
+ var MediaFileKindEnum = _enum([
17693
+ "crop",
17694
+ "thumbnail",
17695
+ "snapshot",
17696
+ "firstFrame",
17697
+ "lastFrame",
17698
+ "fullFrame",
17699
+ "fullFrameBoxed",
17700
+ "faceCrop",
17701
+ "plateCrop",
17702
+ "keyFrame",
17703
+ "keyFrameSmall",
17704
+ "thumbnailSmall"
17705
+ ]);
17706
+ var MediaFileSchema = object({
17707
+ key: string$2(),
17708
+ kind: MediaFileKindEnum,
17672
17709
  base64: string$2(),
17673
- width: number().int(),
17674
- height: number().int()
17675
- }), {
17676
- kind: "query",
17677
- auth: "admin"
17678
- }), method(object({
17679
- deviceId: number(),
17680
- trackId: string$2(),
17681
- frameId: string$2(),
17682
- subject: RetrainAssistSubjectSchema,
17683
- /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
17684
- nodeId: string$2().optional()
17685
- }), RetrainAssistResultSchema, {
17686
- kind: "mutation",
17687
- auth: "admin"
17688
- }), method(object({ trackId: string$2() }), array(RetrainAnnotationSchema).readonly(), {
17689
- kind: "query",
17690
- auth: "admin"
17691
- }), method(object({
17692
- deviceId: number(),
17693
- trackId: string$2(),
17694
- frameId: string$2(),
17695
- annotations: array(RetrainAnnotationDraftSchema)
17696
- }), array(RetrainAnnotationSchema).readonly(), {
17697
- kind: "mutation",
17698
- auth: "admin"
17699
- }), method(object({
17700
- deviceId: number(),
17701
- trackId: string$2()
17702
- }), RetrainTransitionResultSchema, {
17703
- kind: "mutation",
17704
- auth: "admin"
17705
- }), method(object({
17706
- deviceId: number(),
17707
- trackId: string$2()
17708
- }), RetrainTransitionResultSchema, {
17709
- kind: "mutation",
17710
- auth: "admin"
17711
- }), method(object({ deviceIds: array(number()).optional() }), object({ url: string$2() }), {
17712
- kind: "query",
17713
- auth: "admin"
17714
- }), method(object({
17715
- eventId: string$2(),
17716
- kind: MediaFileKindEnum.optional(),
17717
- deviceId: number()
17718
- }), array(MediaFileSchema).readonly()), method(object({
17719
- trackId: string$2(),
17720
- kinds: array(MediaFileKindEnum).optional(),
17721
- deviceId: number()
17722
- }), array(MediaFileSchema).readonly()), method(object({
17710
+ sizeBytes: number(),
17711
+ timestamp: number()
17712
+ });
17713
+ /**
17714
+ * One media row WITHOUT its bytes.
17715
+ *
17716
+ * A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
17717
+ * 140 s track), and a client that renders tiles from the media data plane needs
17718
+ * to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
17719
+ * with an immutable cache, instead of all at once inside a tRPC response that
17720
+ * blocks the whole view.
17721
+ *
17722
+ * `sizeBytes` is carried because it is what lets a client decide between the
17723
+ * stored blob and a `?variant=thumb` rendering without fetching either.
17724
+ */
17725
+ var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
17726
+ /**
17727
+ * The MACRO tier of an annotation — a CLOSED set.
17728
+ *
17729
+ * This is what the exported detector predicts, so a typo here is a new class
17730
+ * with one example in it. `label` and `subLabel` are open strings by contrast:
17731
+ * the whole point of the page is teaching the model things it does not know
17732
+ * yet, and constraining that vocabulary would make it useless.
17733
+ *
17734
+ * A macro class is NEVER a label. The provider refuses a write whose `label` or
17735
+ * `subLabel` is one of these values, in any casing, because once `person`
17736
+ * exists in both tiers "every person box" stops being answerable without
17737
+ * knowing every string anyone ever typed — and the damage is retroactive.
17738
+ */
17739
+ var RetrainMacroClassSchema = _enum([
17740
+ "person",
17741
+ "vehicle",
17742
+ "animal",
17743
+ "package",
17744
+ "face",
17745
+ "plate"
17746
+ ]);
17747
+ /** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
17748
+ var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
17749
+ /** Did a human draw this box, or did the assist propose it? */
17750
+ var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
17751
+ /** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
17752
+ var RetrainBboxSchema = object({
17753
+ x: number(),
17754
+ y: number(),
17755
+ w: number(),
17756
+ h: number()
17757
+ });
17758
+ /**
17759
+ * One annotated subject.
17760
+ *
17761
+ * `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
17762
+ * (letterboxed root / zone-cropped package / subject-cropped classifier) are
17763
+ * derived from it at export and never stored — storing them is how one feature
17764
+ * space ends up holding two crops of the same subject (D52).
17765
+ */
17766
+ var RetrainAnnotationSchema = object({
17767
+ id: string$2(),
17723
17768
  trackId: string$2(),
17724
- deviceId: number()
17725
- }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
17726
- kind: "mutation",
17727
- auth: "admin"
17728
- }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
17729
- kind: "mutation",
17730
- auth: "admin"
17731
- }), method(object({}), RebuildStatusSchema), object({
17732
- deviceId: number(),
17733
- timestamp: number(),
17734
- frameWidth: number(),
17735
- frameHeight: number(),
17736
- detections: array(OverlayDetectionSchema).readonly()
17737
- }), object({
17738
17769
  deviceId: number(),
17770
+ /** The COPY in retrain storage — never the source track's media key. */
17771
+ mediaKey: string$2(),
17772
+ bbox: RetrainBboxSchema,
17773
+ macroClass: RetrainMacroClassSchema,
17774
+ label: string$2().optional(),
17775
+ subLabel: string$2().optional(),
17776
+ kind: RetrainAnnotationKindSchema,
17777
+ source: RetrainAnnotationSourceSchema,
17778
+ /** Which model proposed this box — or, on a `model_error`, drew the phantom. */
17779
+ assistModelId: string$2().optional(),
17780
+ assistScore: number().optional(),
17781
+ exportedInBatch: string$2().optional(),
17782
+ createdAt: number()
17783
+ });
17784
+ /** The write form — the server owns `id`, `createdAt` and the frame binding. */
17785
+ var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
17786
+ id: true,
17787
+ trackId: true,
17788
+ deviceId: true,
17789
+ mediaKey: true,
17790
+ createdAt: true,
17791
+ exportedInBatch: true
17792
+ });
17793
+ /** A track sitting in `staging`, with everything the worklist needs to rank it. */
17794
+ var RetrainTrackSchema = object({
17739
17795
  trackId: string$2(),
17740
- className: string$2()
17741
- }), object({
17742
17796
  deviceId: number(),
17743
- trackId: string$2(),
17744
17797
  className: string$2(),
17745
- durationMs: number()
17746
- }), object({
17798
+ label: string$2().optional(),
17799
+ firstSeen: number(),
17800
+ lastSeen: number(),
17801
+ /** How many frames the dataset already holds from this track. */
17802
+ frameCount: number().int(),
17803
+ /** How many subjects have been annotated on those frames. `0` with
17804
+ * `frameCount: 0` is exactly "staging, still to work". */
17805
+ annotationCount: number().int()
17806
+ });
17807
+ /** A frame the picker may offer — an index row, no blob was read to produce it. */
17808
+ var RetrainFrameCandidateSchema = object({
17809
+ mediaKey: string$2(),
17810
+ kind: MediaFileKindEnum,
17811
+ timestamp: number(),
17812
+ sizeBytes: number().int(),
17813
+ /** A copy of this original already exists — selecting it is free and cannot
17814
+ * fail, whatever became of the original. */
17815
+ copied: boolean()
17816
+ });
17817
+ /** A frame the dataset OWNS: bytes copied at selection time. */
17818
+ var RetrainFrameSchema = object({
17819
+ frameId: string$2(),
17747
17820
  deviceId: number(),
17748
- kind: EventKindSchema,
17749
- eventId: string$2(),
17750
- timestamp: number()
17821
+ trackId: string$2(),
17822
+ /** Provenance only. It may already point at nothing — that is expected. */
17823
+ sourceMediaKey: string$2(),
17824
+ sourceKind: MediaFileKindEnum,
17825
+ sizeBytes: number().int(),
17826
+ width: number().int(),
17827
+ height: number().int(),
17828
+ copiedAt: number()
17751
17829
  });
17752
- /**
17753
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
17754
- * within the frame, so the executor can re-cut a leaf child ROI at native
17755
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
17756
- */
17757
- var NativeCropRefSchema = object({
17758
- /** Handle keying the retained native surface (node-pinned to its owner). */
17759
- handle: FrameHandleSchema,
17760
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
17761
- cropFrameSpace: object({
17762
- x: number(),
17763
- y: number(),
17764
- w: number(),
17765
- h: number()
17766
- })
17830
+ /** Why a copy-on-select could not be honoured — named, never a silent skip. */
17831
+ var RetrainCopyRefusalSchema = _enum([
17832
+ "source-missing",
17833
+ "unreadable-image",
17834
+ "write-failed"
17835
+ ]);
17836
+ var RetrainFrameSelectionSchema = object({
17837
+ copied: array(RetrainFrameSchema).readonly(),
17838
+ refused: array(object({
17839
+ sourceMediaKey: string$2(),
17840
+ reason: RetrainCopyRefusalSchema
17841
+ })).readonly()
17767
17842
  });
17768
- object({
17769
- crop: object({
17770
- left: number(),
17771
- top: number(),
17772
- width: number().positive(),
17773
- height: number().positive()
17774
- }).optional(),
17775
- content: object({
17776
- width: number().int().positive(),
17777
- height: number().int().positive()
17778
- }),
17779
- fit: _enum(["stretch", "contain"]),
17780
- format: _enum([
17781
- "rgb",
17782
- "gray",
17783
- "jpeg"
17784
- ])
17843
+ var RetrainFrameListSchema = object({
17844
+ candidates: array(RetrainFrameCandidateSchema).readonly(),
17845
+ copies: array(RetrainFrameSchema).readonly(),
17846
+ /** What the page pre-selects — the native key frame when one survives. */
17847
+ autoPickMediaKey: string$2().optional()
17785
17848
  });
17849
+ /** What the operator asked the assist to look for. */
17850
+ var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
17851
+ kind: literal("package"),
17852
+ zone: RetrainBboxSchema.optional()
17853
+ }), object({
17854
+ kind: literal("objects"),
17855
+ modelId: string$2(),
17856
+ minScore: number().optional()
17857
+ })]);
17786
17858
  /**
17787
- * Process-local frame identity. It is serializable so it can ride an in-process
17788
- * capability call, but `registryId` deliberately prevents resolution in any
17789
- * other process or execution group.
17859
+ * The assist's answer a discriminated union, because "the model saw nothing"
17860
+ * and "this node cannot run that model" lead to different next moves and a
17861
+ * nullable result cannot tell them apart.
17790
17862
  */
17791
- var FrameRefSchema = object({
17792
- registryId: string$2().min(1),
17793
- id: string$2().min(1),
17794
- width: number().int().positive(),
17795
- height: number().int().positive(),
17796
- format: _enum(["rgb", "gray"]),
17797
- timestamp: number(),
17798
- capturedAt: number().optional()
17863
+ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
17864
+ kind: literal("proposed"),
17865
+ modelId: string$2(),
17866
+ stepId: string$2(),
17867
+ minScore: number(),
17868
+ /** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
17869
+ proposals: array(RetrainAnnotationDraftSchema).readonly(),
17870
+ /** Returned by the runner but removed by the threshold. */
17871
+ belowThreshold: number().int()
17872
+ }), object({
17873
+ kind: literal("refused"),
17874
+ /** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
17875
+ reason: string$2(),
17876
+ detail: string$2().optional()
17877
+ })]);
17878
+ /** The outcome of a lifecycle move owned by the retrain page. */
17879
+ var RetrainTransitionResultSchema = object({
17880
+ trackId: string$2(),
17881
+ /** Where the track ended up, whatever happened. */
17882
+ retrainStatus: RetrainStatusSchema,
17883
+ /** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
17884
+ changed: boolean(),
17885
+ reason: _enum([
17886
+ "unknown-track",
17887
+ "no-frames-copied",
17888
+ "not-staging",
17889
+ "not-trained",
17890
+ "unchanged"
17891
+ ]).optional()
17799
17892
  });
17800
- var ModelFormatSchema$1 = _enum([
17801
- "onnx",
17802
- "coreml",
17803
- "openvino",
17804
- "tflite",
17805
- "pt",
17806
- "gguf"
17807
- ]);
17808
- var PipelineSlotSchema = _enum([
17809
- "detector",
17810
- "cropper",
17811
- "classifier",
17812
- "refiner",
17813
- "audio-classifier"
17814
- ]);
17815
- var PipelineEngineChoiceSchema = object({
17816
- runtime: _enum(["node", "python"]),
17817
- backend: string$2(),
17818
- format: ModelFormatSchema$1,
17819
- device: string$2().optional()
17893
+ var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
17894
+ var MAX_EVENT_QUERY_LIMIT = 5e3;
17895
+ var DeviceEventQueryInput = object({
17896
+ deviceId: number(),
17897
+ since: number().optional(),
17898
+ until: number().optional(),
17899
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
17900
+ /** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
17901
+ * optional `mediaUrl` (populated by B5). `full` (default) keeps today's
17902
+ * exact behaviour. Callers may omit this field — the store defaults to
17903
+ * `full` when not provided. */
17904
+ projection: _enum(["full", "slim"]).optional()
17820
17905
  });
17821
- var AvailableEngineSchema = object({
17822
- engine: PipelineEngineChoiceSchema,
17823
- devices: array(object({
17824
- id: string$2(),
17825
- label: string$2(),
17826
- description: string$2().optional()
17827
- })).readonly(),
17828
- defaultDevice: string$2()
17906
+ var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string$2().optional() });
17907
+ var RecentTracksQueryInput = object({
17908
+ /** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
17909
+ deviceIds: array(number()),
17910
+ /** Window lower bound on `lastSeen` (inclusive). */
17911
+ since: number().optional(),
17912
+ /** Window upper bound on `lastSeen` (inclusive). */
17913
+ until: number().optional(),
17914
+ /** Page size. Default 200, max 1000. */
17915
+ limit: number().int().min(1).max(1e3).default(200),
17916
+ /** Opaque continuation cursor from a previous page's `nextCursor`.
17917
+ * Encodes the (lastSeen, trackId) sort position — treat as opaque. */
17918
+ cursor: string$2().optional(),
17919
+ /** See {@link TrackProjectionSchema}. Default `full`. */
17920
+ projection: TrackProjectionSchema.optional(),
17921
+ /** Include stationary-promoted rows (parked objects). Default false: the
17922
+ * feed lists passages; parking records live on the stationary registry. */
17923
+ includeStationary: boolean().optional()
17829
17924
  });
17830
- var PipelineDefaultStepSchema = lazy(() => object({
17831
- addonId: string$2(),
17832
- addonName: string$2(),
17833
- slot: PipelineSlotSchema,
17834
- inputClasses: array(string$2()).readonly(),
17835
- outputClasses: array(string$2()).readonly(),
17836
- enabled: boolean(),
17837
- modelId: string$2(),
17838
- children: array(PipelineDefaultStepSchema).readonly(),
17839
- group: string$2().optional(),
17840
- settings: record(string$2(), unknown()).optional()
17841
- }));
17842
- var PipelineTemplateStepSchema = lazy(() => object({
17843
- addonId: string$2(),
17844
- enabled: boolean(),
17845
- modelId: string$2(),
17846
- children: array(PipelineTemplateStepSchema).readonly(),
17847
- settings: record(string$2(), unknown()).optional()
17848
- }));
17849
- var PipelineTemplateSchema$1 = object({
17850
- id: string$2(),
17851
- name: string$2(),
17852
- createdAt: string$2(),
17853
- updatedAt: string$2(),
17854
- engine: PipelineEngineChoiceSchema,
17855
- steps: array(PipelineTemplateStepSchema).readonly()
17925
+ var RecentTracksPageSchema = object({
17926
+ /** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
17927
+ tracks: array(TrackSchema).readonly(),
17928
+ /** Cursor for the next page, or null when this page is the last. */
17929
+ nextCursor: string$2().nullable()
17856
17930
  });
17857
- var PipelineModelOptionSchema = object({
17931
+ var LIST_GROUPS_DEFAULT_LIMIT = 40;
17932
+ var LIST_GROUPS_MAX_LIMIT = 100;
17933
+ var AnalyticsGroupRecordSchema = object({
17858
17934
  id: string$2(),
17859
- name: string$2(),
17860
- formats: record(string$2(), object({
17861
- downloaded: boolean(),
17862
- sizeMB: number()
17863
- })),
17864
- group: ModelVariantGroupSchema.optional(),
17865
- legacy: boolean().optional(),
17866
- provider: ModelProviderIdSchema.optional()
17935
+ deviceId: number().int(),
17936
+ openedAt: number().int(),
17937
+ closedAt: number().int(),
17938
+ timestamp: number().int(),
17939
+ memberCount: number().int(),
17940
+ memberTrackIds: array(string$2()).readonly(),
17941
+ className: string$2(),
17942
+ classes: array(string$2()).readonly(),
17943
+ /** Relative event-media path, or null when the group has no picture yet. */
17944
+ mediaUrl: string$2().nullable(),
17945
+ singleton: boolean()
17867
17946
  });
17868
- var ConfigFieldBridge = custom();
17869
- var PipelineAddonSchemaSchema = object({
17870
- id: string$2(),
17871
- name: string$2(),
17872
- slot: PipelineSlotSchema,
17873
- inputClasses: array(string$2()).readonly(),
17874
- outputClasses: array(string$2()).readonly(),
17875
- childSlots: array(PipelineSlotSchema).readonly(),
17876
- models: array(PipelineModelOptionSchema).readonly(),
17877
- defaultModelId: string$2(),
17878
- defaultModelIdByFormat: record(string$2(), string$2()).optional(),
17879
- enabledByDefault: boolean().optional(),
17880
- backfillIntoExistingOverrides: boolean().optional(),
17881
- defaultConfidence: number(),
17882
- group: string$2().optional(),
17883
- configSchema: array(ConfigFieldBridge).readonly().optional()
17947
+ var AnalyticsGroupMemberSchema = object({
17948
+ trackId: string$2(),
17949
+ deviceId: number().int(),
17950
+ className: string$2(),
17951
+ firstSeen: number().int(),
17952
+ lastSeen: number().int(),
17953
+ mediaUrl: string$2().nullable()
17884
17954
  });
17885
- var PipelineSlotSchemaSchema = object({
17886
- id: PipelineSlotSchema,
17887
- label: string$2(),
17888
- priority: number(),
17889
- parentSlot: PipelineSlotSchema.nullable(),
17890
- addons: array(PipelineAddonSchemaSchema).readonly()
17955
+ var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
17956
+ var ListGroupsQueryInput = object({
17957
+ /** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
17958
+ deviceIds: array(number()),
17959
+ /** Window lower bound on `closedAt` (inclusive). */
17960
+ since: number().optional(),
17961
+ /** Window upper bound on `openedAt` (inclusive). */
17962
+ until: number().optional(),
17963
+ limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
17964
+ /** Opaque continuation cursor from a previous page's `nextCursor`. */
17965
+ cursor: string$2().optional()
17891
17966
  });
17892
- var PipelineSchemaSchema = object({
17893
- availableEngines: array(AvailableEngineSchema).readonly(),
17894
- selectedEngine: PipelineEngineChoiceSchema,
17895
- slots: array(PipelineSlotSchemaSchema).readonly()
17967
+ var ListGroupsPageSchema = object({
17968
+ groups: array(AnalyticsGroupRecordSchema).readonly(),
17969
+ nextCursor: string$2().nullable()
17896
17970
  });
17897
- var EngineProvisioningSchema = object({
17898
- runtimeId: _enum([
17899
- "onnx",
17900
- "openvino",
17901
- "coreml",
17902
- "edgetpu"
17903
- ]).nullable(),
17904
- device: string$2().nullable(),
17905
- state: _enum([
17906
- "idle",
17907
- "installing",
17908
- "verifying",
17909
- "ready",
17910
- "failed"
17911
- ]),
17912
- progress: number().optional(),
17913
- error: string$2().optional(),
17914
- nextRetryAt: number().optional(),
17915
- /**
17916
- * Gate A (config-correctness gate at engine change): human-readable
17917
- * config issues surfaced EAGERLY when the node's engine changes — model
17918
- * substitutions ("chose X, running Y") and zero-build steps ("no model
17919
- * has a <format> build"). Additive/optional: informational only, never
17920
- * enforced here — `assertEngineReady` (readiness) still gates inference.
17921
- * Absent/empty when the node-default tree resolves cleanly.
17922
- */
17923
- configIssues: array(string$2()).optional()
17971
+ var KeyEventQueryInput = object({
17972
+ deviceId: number(),
17973
+ /** Window lower bound (track firstSeen ≥ since). */
17974
+ since: number(),
17975
+ /** Window upper bound (track firstSeen ≤ until). */
17976
+ until: number(),
17977
+ limit: number().int().min(1).max(200).default(50),
17978
+ /** Drop tracks scoring below this importance. */
17979
+ minImportance: number().min(0).max(1).optional(),
17980
+ /** Restrict to a single class (e.g. 'person'). */
17981
+ classFilter: string$2().optional()
17924
17982
  });
17925
- var PipelineStepInputSchema = lazy(() => object({
17926
- addonId: string$2(),
17927
- modelId: string$2().optional(),
17928
- enabled: boolean().default(true),
17929
- children: array(PipelineStepInputSchema).optional(),
17930
- settings: record(string$2(), unknown()).optional(),
17931
- jumpDeviceKey: string$2().optional()
17932
- }));
17933
- var ModelSubstitutionSchema = object({
17934
- addonId: string$2(),
17935
- chosen: string$2(),
17936
- running: string$2(),
17937
- format: string$2()
17983
+ var KeyEventSchema = object({
17984
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
17985
+ id: string$2(),
17986
+ trackId: string$2(),
17987
+ /** Track start time (firstSeen). */
17988
+ timestamp: number(),
17989
+ className: string$2(),
17990
+ ...TieredLabelFields,
17991
+ importance: number(),
17992
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
17993
+ bestEventId: string$2(),
17994
+ /** Track lifetime in ms (lastSeen - firstSeen). */
17995
+ windowMs: number().optional(),
17996
+ ...TrackFlagFields,
17997
+ ...TrackRetrainFields
17938
17998
  });
17939
- var PipelineValidationIssueSchema = object({
17940
- addonId: string$2(),
17941
- kind: _enum(["unknown-addon", "no-format-build"]),
17942
- detail: string$2()
17999
+ object({
18000
+ trackId: string$2(),
18001
+ className: string$2(),
18002
+ confidence: number(),
18003
+ bbox: BoundingBoxSchema,
18004
+ zones: array(string$2()).readonly(),
18005
+ state: TrackStateSchema
17943
18006
  });
17944
- var PipelineValidationResultSchema = object({
17945
- ok: boolean(),
17946
- issues: array(PipelineValidationIssueSchema).readonly(),
17947
- substitutions: array(ModelSubstitutionSchema).readonly(),
17948
- /** The node's `currentEngine.format` this validation ran against. */
17949
- format: string$2()
18007
+ var OverlayDetectionSchema = looseObject({
18008
+ id: string$2(),
18009
+ kind: _enum(["first-level", "detail"]),
18010
+ macroClass: string$2(),
18011
+ score: number(),
18012
+ bbox: object({
18013
+ x: number(),
18014
+ y: number(),
18015
+ width: number(),
18016
+ height: number()
18017
+ }),
18018
+ labels: array(looseObject({
18019
+ label: string$2(),
18020
+ score: number()
18021
+ })).readonly(),
18022
+ parentId: string$2().optional()
17950
18023
  });
17951
- var ReferenceImageEntrySchema = object({
17952
- filename: string$2(),
17953
- stepIds: array(string$2()).readonly().optional()
18024
+ var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
18025
+ var SearchObjectEventsInput = object({
18026
+ text: string$2(),
18027
+ deviceId: number().optional(),
18028
+ since: number().optional(),
18029
+ until: number().optional(),
18030
+ classFilter: string$2().optional(),
18031
+ limit: number().default(50),
18032
+ minScore: number().min(0).max(1).default(.2)
17954
18033
  });
17955
- var ReferenceImageBodySchema = object({
17956
- base64: string$2(),
17957
- filename: string$2()
18034
+ var TrackCascadeCountsSchema = object({
18035
+ /** Persisted track roots deleted (authoritative). */
18036
+ tracks: number().int(),
18037
+ /** Object events removed with their tracks (best-effort; see note above). */
18038
+ events: number().int(),
18039
+ /** Track/face/plate-owned media removed (best-effort). Never identity media. */
18040
+ media: number().int(),
18041
+ /** Unassigned (non-enrolled) face reads removed (best-effort). */
18042
+ faces: number().int(),
18043
+ /** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
18044
+ plates: number().int(),
18045
+ /** Per-track CLIP search vectors removed (best-effort). */
18046
+ embeddings: number().int(),
18047
+ /** Group membership + group rows removed with their last member (best-effort). */
18048
+ groups: number().int()
17958
18049
  });
17959
- var ReferenceAudioEntrySchema = object({
17960
- filename: string$2(),
17961
- sizeKb: number()
18050
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
18051
+ var DiskReconcileCountsSchema = object({
18052
+ mediaDropped: number().int(),
18053
+ tracks: number().int(),
18054
+ events: number().int()
18055
+ });
18056
+ /** Event-store footprint for one camera. */
18057
+ var EventStoreDeviceFootprintSchema = object({
18058
+ deviceId: number(),
18059
+ /** Persisted event rows (motion + object + audio) for the camera. */
18060
+ rows: number().int(),
18061
+ /** Event-owned media bytes on disk for the camera. */
18062
+ bytes: number().int()
18063
+ });
18064
+ /** Aggregate event-store footprint: global totals + per-camera breakdown. */
18065
+ var EventStoreFootprintSchema = object({
18066
+ totalRows: number().int(),
18067
+ totalBytes: number().int(),
18068
+ devices: array(EventStoreDeviceFootprintSchema).readonly()
18069
+ });
18070
+ /** Per-kind counts returned by the event-prune / device-delete mutations. */
18071
+ var EventPruneCountsSchema = object({
18072
+ motion: number().int(),
18073
+ object: number().int(),
18074
+ audio: number().int()
17962
18075
  });
17963
- var ReferenceAudioBodySchema = object({ base64: string$2() });
17964
- var AudioBackendSchema = object({
17965
- id: string$2(),
17966
- name: string$2(),
17967
- description: string$2(),
17968
- available: boolean(),
18076
+ /**
18077
+ * Re-embed stored tracks from their key frames.
18078
+ *
18079
+ * The reason this is an operator-callable method and not a migration script:
18080
+ * every knob that decides what a vector MEANS — encoder model, crop margin,
18081
+ * squaring — is only changeable if the existing vectors can be regenerated.
18082
+ * Mixing feature spaces in one index makes cosine scores incomparable, and the
18083
+ * symptom is a quality regression with no visible cause.
18084
+ */
18085
+ var RebuildObjectEmbeddingsInput = object({
18086
+ /** Restrict to one camera. Omit for the whole fleet. */
18087
+ deviceId: number().optional(),
18088
+ since: number().optional(),
18089
+ until: number().optional(),
18090
+ /** Stop after this many tracks; the result reports whether more remain. */
18091
+ maxTracks: number().int().positive().optional(),
17969
18092
  /**
17970
- * Raw classifier labels this backend can emit (e.g. YAMNet's
17971
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
17972
- * the benchmark UI to populate the `enabledMicroClasses` filter
17973
- * specific to the selected backend without a separate fetch.
18093
+ * Run every embedding on THIS node instead of round-robining the fleet.
18094
+ *
18095
+ * Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
18096
+ * field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
18097
+ * calling it that would pin the rebuild REQUEST itself to that node — the
18098
+ * rebuild orchestration lives on the hub, and only the per-track step runs
18099
+ * remotely. This field is data; the per-track pin is applied inside.
18100
+ *
18101
+ * Absent ⇒ round-robin over every online node whose runner can serve the
18102
+ * pinned model.
17974
18103
  */
17975
- rawLabels: array(string$2()).readonly().optional()
17976
- });
17977
- var AudioCapabilitiesSchema = object({
17978
- activeBackend: string$2(),
17979
- availableBackends: array(AudioBackendSchema).readonly(),
17980
- sampleRate: number(),
17981
- chunkDurationMs: number()
17982
- });
17983
- var DownloadModelResultSchema = object({
17984
- filePath: string$2(),
17985
- sizeMB: number(),
17986
- durationMs: number()
18104
+ executeOnNodeId: string$2().optional(),
18105
+ /**
18106
+ * Milliseconds to wait between tracks; omit for the built-in default, `0` to
18107
+ * run flat out.
18108
+ *
18109
+ * A rebuild is bulk maintenance on hub-main's single thread. Measured
18110
+ * 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
18111
+ * pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
18112
+ * force is logged at start and finish so a deliberately slow pass reads
18113
+ * differently from a stalled one.
18114
+ */
18115
+ pacingMs: number().int().nonnegative().optional()
17987
18116
  });
17988
18117
  /**
17989
- * Wrapper carrying a single test run's result. Replaces the legacy
17990
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
17991
- * canonical `AudioResult` from the Phase 6 output rework: one
17992
- * `AudioDetection` per class above `minScore`, top-N candidates in
17993
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
17994
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
17995
- * benchmark UI can still report a clean failure when the classifier
17996
- * cap isn't available.
18118
+ * Result of emptying the CLIP index.
18119
+ *
18120
+ * The clean slate before a policy change: a new crop margin or encoder model
18121
+ * leaves two feature spaces in one index whose cosine scores are not
18122
+ * comparable, so wiping and rebuilding is the only way to be sure every vector
18123
+ * means the same thing.
17997
18124
  */
17998
- var AudioTestResultSchema = object({
17999
- success: boolean(),
18000
- error: string$2().optional(),
18001
- frame: custom().optional()
18125
+ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
18126
+ /**
18127
+ * Acknowledgement that a rebuild STARTED.
18128
+ *
18129
+ * The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
18130
+ * runs detached and this returns immediately. Waiting for it made the client
18131
+ * time out while the work carried on server-side, which is the worst of both:
18132
+ * no result and no way to know it was still going. Poll
18133
+ * `getObjectEmbeddingRebuildStatus` for progress.
18134
+ */
18135
+ var RebuildObjectEmbeddingsResultSchema = object({
18136
+ started: boolean(),
18137
+ /** True when a pass was already running; the new request is ignored. */
18138
+ alreadyRunning: boolean()
18002
18139
  });
18003
- var PipelineConfigBridge = custom();
18004
- var ConfigUISchemaBridge = custom();
18005
- var ConfigUISchemaNullableBridge = custom();
18006
- var InferenceCapabilitiesBridge = custom();
18007
- var ModelAvailabilityListBridge = custom();
18008
- var PipelineRunResultBridge = custom();
18009
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string$2() }), EngineProvisioningSchema), method(_void(), record(string$2(), object({
18010
- modelId: string$2(),
18011
- settings: record(string$2(), unknown()).readonly()
18012
- }))), method(object({ steps: record(string$2(), object({
18013
- modelId: string$2(),
18014
- settings: record(string$2(), unknown()).readonly()
18015
- })) }), object({ success: literal(true) }), {
18140
+ var RebuildStatusSchema = object({
18141
+ running: boolean(),
18142
+ scanned: number(),
18143
+ rebuilt: number(),
18144
+ /** Tracks whose key frame is gone — nothing to re-embed from. */
18145
+ missingKeyFrame: number(),
18146
+ /** Tracks with no usable detection box. */
18147
+ missingBbox: number(),
18148
+ /**
18149
+ * Tracks an executing node REFUSED rather than broke on — an unreadable key
18150
+ * frame, a step that threw. Separate from `failed` because the remedy is
18151
+ * different, and because a whole camera silently contributing zero vectors
18152
+ * is the shape of failure a rebuild must never hide.
18153
+ */
18154
+ notRunnable: number(),
18155
+ /**
18156
+ * The pass stopped because NO node could serve the pinned model.
18157
+ *
18158
+ * Distinct from `notRunnable` on purpose: that one says "this track was
18159
+ * refused", this one says "the cluster cannot do this work at all" — every
18160
+ * candidate node either lacks the `clip-embedding` step, lacks a build of the
18161
+ * pinned model for its engine format, or dropped out. The remedy is a model /
18162
+ * engine change, not a per-camera one. Non-zero here always comes with
18163
+ * `complete: false`.
18164
+ */
18165
+ noCapableNode: number(),
18166
+ failed: number(),
18167
+ /** Set once a pass ends: true only when EVERYTHING was covered. */
18168
+ complete: boolean().nullable(),
18169
+ startedAtMs: number().nullable(),
18170
+ finishedAtMs: number().nullable(),
18171
+ /** Present when the pass ended by throwing. */
18172
+ error: string$2().nullable()
18173
+ });
18174
+ var ReplayFrameInputSchema = object({
18175
+ timestamp: number(),
18176
+ frame: PipelineRunResultBridge
18177
+ });
18178
+ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
18179
+ className: string$2(),
18180
+ firstSeenMs: number(),
18181
+ lastSeenMs: number(),
18182
+ /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
18183
+ * frame — a representative box for the diff's `(className, window, IoU)`
18184
+ * pairing (`replay-diff.ts`). A replay does not need the full per-frame
18185
+ * trajectory production's `Track.positions` keeps. */
18186
+ bbox: BoundingBoxSchema,
18187
+ /** How many of the input frames this track matched a real detection on
18188
+ * (never a coasted/extrapolated frame) — the replay's own signal for "how
18189
+ * solid is this track", cheaper than re-deriving it from a trajectory. */
18190
+ framesMatched: number().int()
18191
+ })).readonly() });
18192
+ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
18193
+ deviceId: number(),
18194
+ trackId: string$2()
18195
+ }), TrackSchema.nullable()), method(object({
18196
+ deviceId: number(),
18197
+ since: number().optional(),
18198
+ until: number().optional(),
18199
+ limit: number().optional(),
18200
+ /** Spatial filter — only tracks whose trajectory intersects the zone
18201
+ * (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
18202
+ * envelope columns, then precisely tested per position. Tracks with
18203
+ * an unknown envelope (no frame dims at persist time) always match. */
18204
+ zone: TrackZoneFilterSchema.optional(),
18205
+ /** See {@link TrackProjectionSchema}. Default `full` (backward
18206
+ * compatible — omitting the field keeps today's exact behaviour). */
18207
+ projection: TrackProjectionSchema.optional(),
18208
+ /** Include stationary-promoted rows (parked objects handed to the
18209
+ * stationary registry). Default false: the timeline lists passages,
18210
+ * not parking records (operator decision, 2026-08-15). */
18211
+ includeStationary: boolean().optional()
18212
+ }), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
18213
+ deviceId: number(),
18214
+ groupId: string$2().min(1)
18215
+ }), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
18216
+ kind: "mutation",
18217
+ auth: "admin"
18218
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()), method(object({
18219
+ deviceId: number(),
18220
+ since: number().optional(),
18221
+ until: number().optional(),
18222
+ kinds: array(string$2()).optional(),
18223
+ limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
18224
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18225
+ deviceId: number(),
18226
+ since: number(),
18227
+ until: number(),
18228
+ bucketMs: number().int().positive()
18229
+ }), array(object({
18230
+ bucketStart: number(),
18231
+ motion: number().int(),
18232
+ object: number().int(),
18233
+ audio: number().int()
18234
+ })).readonly()), method(object({
18235
+ deviceId: number(),
18236
+ cutoffMs: number()
18237
+ }), object({
18238
+ motion: number().int(),
18239
+ object: number().int(),
18240
+ audio: number().int()
18241
+ }), {
18242
+ kind: "mutation",
18243
+ auth: "admin"
18244
+ }), method(object({
18245
+ deviceId: number(),
18246
+ cutoffMs: number()
18247
+ }), TrackCascadeCountsSchema, {
18248
+ kind: "mutation",
18249
+ auth: "admin"
18250
+ }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18251
+ kind: "mutation",
18252
+ auth: "admin"
18253
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18254
+ kind: "mutation",
18255
+ auth: "admin"
18256
+ }), method(object({
18257
+ deviceId: number(),
18258
+ trackIds: array(string$2()).min(1)
18259
+ }), object({
18260
+ deleted: number().int(),
18261
+ failed: array(string$2()).readonly()
18262
+ }), {
18263
+ kind: "mutation",
18264
+ auth: "admin"
18265
+ }), method(object({
18266
+ /** Log/audit scope only — the trackId is globally unique on its own. */
18267
+ deviceId: number(),
18268
+ trackId: string$2(),
18269
+ flags: TrackFlagsPatchSchema
18270
+ }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
18271
+ kind: "query",
18272
+ auth: "admin"
18273
+ }), method(object({
18274
+ olderThanMs: number(),
18275
+ reason: OpsLogReasonSchema.optional()
18276
+ }), EventPruneCountsSchema, {
18277
+ kind: "mutation",
18278
+ auth: "admin"
18279
+ }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
18280
+ kind: "mutation",
18281
+ auth: "admin"
18282
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18283
+ kind: "mutation",
18284
+ auth: "admin"
18285
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18286
+ kind: "mutation",
18287
+ auth: "admin"
18288
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
18289
+ kind: "mutation",
18290
+ auth: "admin"
18291
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string$2() }), {
18292
+ kind: "mutation",
18293
+ auth: "admin"
18294
+ }), method(object({ jobId: string$2() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
18295
+ kind: "mutation",
18296
+ auth: "admin"
18297
+ }), method(RelocateMediaInputSchema, object({ jobId: string$2() }), {
18298
+ kind: "mutation",
18299
+ auth: "admin"
18300
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18301
+ kind: "query",
18302
+ auth: "admin"
18303
+ }), method(object({ jobId: string$2() }), object({ cancelled: boolean() }), {
18016
18304
  kind: "mutation",
18017
18305
  auth: "admin"
18018
- }), method(object({ nodeId: string$2() }), object({
18019
- success: literal(true),
18020
- clearedDevices: number()
18021
- }), {
18306
+ }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
18307
+ kind: "query",
18308
+ auth: "admin"
18309
+ }), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
18310
+ kind: "query",
18311
+ auth: "admin"
18312
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string$2() }), {
18313
+ kind: "query",
18314
+ auth: "admin"
18315
+ }), method(object({
18316
+ /** Empty ⇒ every camera that has staging tracks. A LIST, not a single
18317
+ * `deviceId`, deliberately: `deviceId` would make this device-bound and
18318
+ * route it at one camera's owner, and "every camera" would stop being
18319
+ * expressible at all. */
18320
+ deviceIds: array(number()).optional(),
18321
+ limit: number().int().min(1).max(500).optional()
18322
+ }), array(RetrainTrackSchema).readonly(), {
18323
+ kind: "query",
18324
+ auth: "admin"
18325
+ }), method(object({ trackId: string$2() }), RetrainFrameListSchema, {
18326
+ kind: "query",
18327
+ auth: "admin"
18328
+ }), method(object({
18329
+ deviceId: number(),
18330
+ trackId: string$2(),
18331
+ mediaKeys: array(string$2()).min(1)
18332
+ }), RetrainFrameSelectionSchema, {
18022
18333
  kind: "mutation",
18023
18334
  auth: "admin"
18024
- }), 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({
18025
- name: string$2(),
18026
- steps: array(PipelineTemplateStepSchema).readonly(),
18027
- engine: PipelineEngineChoiceSchema
18028
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
18029
- id: string$2(),
18030
- name: string$2().optional(),
18031
- steps: array(PipelineTemplateStepSchema).readonly().optional()
18032
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string$2() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string$2() }), ModelAvailabilityListBridge), method(object({
18033
- addonId: string$2(),
18034
- modelId: string$2(),
18035
- format: ModelFormatSchema$1
18036
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
18037
- addonId: string$2(),
18038
- modelId: string$2(),
18039
- format: ModelFormatSchema$1
18040
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
18041
- engine: PipelineEngineChoiceSchema.optional(),
18042
- steps: array(PipelineStepInputSchema).min(1),
18043
- frame: FrameInputSchema.optional(),
18044
- /**
18045
- * Process-local lazy frame. Valid only when caller and provider resolve
18046
- * in the same execution-group process; split/cross-node callers use
18047
- * `frame`/`image` inline compatibility instead.
18048
- */
18049
- frameRef: FrameRefSchema.optional(),
18050
- /**
18051
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
18052
- * the decoded pixels live in. One more member of the one-of
18053
- * frame/frameHandle/image/imageBase64/referenceImage group.
18054
- */
18055
- frameHandle: FrameHandleSchema.optional(),
18056
- imageBase64: string$2().optional(),
18057
- /**
18058
- * Binary JPEG bytes — preferred over `imageBase64` on internal
18059
- * hops (hub → forked worker via Moleculer MsgPack) because it
18060
- * skips the 33% base64 overhead + the per-call base64 decode on
18061
- * the detection-pipeline worker. Callers can pass either; exactly
18062
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
18063
- */
18064
- image: _instanceof(Uint8Array).optional(),
18065
- referenceImage: string$2().optional(),
18066
- deviceId: number().optional(),
18067
- sessionId: string$2().optional(),
18068
- /**
18069
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
18070
- * reference-image, and detail-subtree calls. 'frame' is the live
18071
- * per-frame dispatch: ONLY root-plane steps run; crop children
18072
- * (inputClasses ≠ null) are skipped and served per-track via
18073
- * pipelineRunner.runDetailSubtree (two-plane design).
18074
- */
18075
- plane: _enum(["full", "frame"]).optional(),
18076
- /**
18077
- * Inference-device selector (Phase 2 multi-device). Format
18078
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
18079
- * Omitted ⇒ the runner's default device (current single-engine
18080
- * behaviour). Selects WHICH device pool of the node runs the call.
18081
- */
18082
- deviceKey: string$2().optional(),
18083
- /**
18084
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
18085
- * when the parent crop was resolved from the frame's retained NATIVE
18086
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
18087
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
18088
- * resolution from that surface — the SAME quality path faces already
18089
- * had — instead of the downscaled parent tile. `handle` keys the native
18090
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
18091
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
18092
- * the executor's crop-normalized child ROI back into frame-normalized
18093
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
18094
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
18095
- * (today's behaviour on the fallback path).
18096
- */
18097
- nativeCropRef: NativeCropRefSchema.optional()
18098
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
18099
- engine: PipelineEngineChoiceSchema.optional(),
18100
- steps: array(PipelineStepInputSchema).min(1),
18101
- frames: array(FrameInputSchema).min(1).max(255),
18102
- deviceId: number().optional(),
18103
- sessionId: string$2().optional(),
18104
- /**
18105
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
18106
- * the batch to the Python pool's bench preprocess cache
18107
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
18108
- * preprocessed ONCE and every later inference is a pure-inference cache
18109
- * hit — the sustained-throughput run measures inference, not
18110
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
18111
- * full preprocess every call, correct). Fresh per sustained run;
18112
- * released via `uncacheFrame`.
18113
- */
18114
- frameId: number().int().nonnegative().optional(),
18115
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
18116
- deviceKey: string$2().optional()
18117
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
18118
- data: _instanceof(Uint8Array),
18119
- width: number().int().positive(),
18120
- height: number().int().positive(),
18121
- format: _enum([
18122
- "rgb",
18123
- "bgr",
18124
- "gray"
18125
- ])
18335
+ }), method(object({
18336
+ deviceId: number(),
18337
+ trackId: string$2(),
18338
+ frameId: string$2()
18126
18339
  }), object({
18127
- frameId: number(),
18128
- width: number(),
18129
- height: number()
18130
- }), { kind: "mutation" }), method(object({
18131
- stepId: string$2(),
18132
- frameId: number().int()
18133
- }), record(string$2(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
18134
- batchMode: string$2(),
18135
- windowMs: number(),
18136
- maxBatchSize: number(),
18137
- concurrency: number()
18138
- })), method(_void(), array(object({
18139
- engineKey: string$2(),
18140
- engine: PipelineEngineChoiceSchema,
18141
- modelsLoaded: array(string$2()).readonly(),
18142
- inUseByCameras: array(number()).readonly(),
18143
- /**
18144
- * Origin of this resident factory.
18145
- * - `runtime` — main camera-serving engine (no idle TTL).
18146
- * - `warm-override` — benchmark/test override held in the warm
18147
- * cache; auto-disposed after the idle TTL.
18148
- * - `device-pool` — a concurrent per-device pool (Phase 2
18149
- * multi-device, keyed by `deviceKey`) resolved
18150
- * via `resolveDeviceFactory`. Runs alongside the
18151
- * `runtime` engine on a DIFFERENT accelerator
18152
- * (NPU / iGPU / Coral) — this is how the
18153
- * Engines tab shows all pools running at once.
18154
- */
18155
- kind: _enum([
18156
- "runtime",
18157
- "warm-override",
18158
- "device-pool"
18159
- ]),
18160
- /** Native pid of the underlying Python pool (null when no pool). */
18161
- poolPid: number().nullable(),
18162
- /** ms since this factory was last used (null when not warm-tracked). */
18163
- idleMs: number().nullable(),
18164
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
18165
- idleTtlMs: number().nullable()
18166
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
18340
+ removed: boolean(),
18341
+ removedAnnotations: number().int()
18342
+ }), {
18167
18343
  kind: "mutation",
18168
18344
  auth: "admin"
18345
+ }), method(object({ frameId: string$2() }), object({
18346
+ base64: string$2(),
18347
+ width: number().int(),
18348
+ height: number().int()
18349
+ }), {
18350
+ kind: "query",
18351
+ auth: "admin"
18169
18352
  }), method(object({
18170
- engine: PipelineEngineChoiceSchema,
18171
- force: boolean().optional()
18353
+ deviceId: number(),
18354
+ trackId: string$2(),
18355
+ frameId: string$2(),
18356
+ subject: RetrainAssistSubjectSchema,
18357
+ /** Which node runs it. Absent ⇒ wherever an unowned call lands. */
18358
+ nodeId: string$2().optional()
18359
+ }), RetrainAssistResultSchema, {
18360
+ kind: "mutation",
18361
+ auth: "admin"
18362
+ }), method(object({
18363
+ deviceId: number(),
18364
+ source: DetectionSourceSchema,
18365
+ zones: array(ZoneSchema).readonly().optional(),
18366
+ detectionRules: array(ZoneRuleSchema).readonly().optional(),
18367
+ zoneMembershipMinOverlap: number().min(0).max(1).optional(),
18368
+ frames: array(ReplayFrameInputSchema).min(1)
18369
+ }), RunReplayFrameProcessorResultSchema, {
18370
+ kind: "mutation",
18371
+ auth: "admin"
18372
+ }), method(object({ trackId: string$2() }), array(RetrainAnnotationSchema).readonly(), {
18373
+ kind: "query",
18374
+ auth: "admin"
18375
+ }), method(object({
18376
+ deviceId: number(),
18377
+ trackId: string$2(),
18378
+ frameId: string$2(),
18379
+ annotations: array(RetrainAnnotationDraftSchema)
18380
+ }), array(RetrainAnnotationSchema).readonly(), {
18381
+ kind: "mutation",
18382
+ auth: "admin"
18383
+ }), method(object({
18384
+ deviceId: number(),
18385
+ trackId: string$2()
18386
+ }), RetrainTransitionResultSchema, {
18387
+ kind: "mutation",
18388
+ auth: "admin"
18389
+ }), method(object({
18390
+ deviceId: number(),
18391
+ trackId: string$2()
18392
+ }), RetrainTransitionResultSchema, {
18393
+ kind: "mutation",
18394
+ auth: "admin"
18395
+ }), method(object({ deviceIds: array(number()).optional() }), object({ url: string$2() }), {
18396
+ kind: "query",
18397
+ auth: "admin"
18398
+ }), method(object({
18399
+ eventId: string$2(),
18400
+ kind: MediaFileKindEnum.optional(),
18401
+ deviceId: number()
18402
+ }), array(MediaFileSchema).readonly()), method(object({
18403
+ trackId: string$2(),
18404
+ kinds: array(MediaFileKindEnum).optional(),
18405
+ deviceId: number()
18406
+ }), array(MediaFileSchema).readonly()), method(object({
18407
+ trackId: string$2(),
18408
+ deviceId: number()
18409
+ }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
18410
+ kind: "mutation",
18411
+ auth: "admin"
18412
+ }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
18413
+ kind: "mutation",
18414
+ auth: "admin"
18415
+ }), method(object({}), RebuildStatusSchema), object({
18416
+ deviceId: number(),
18417
+ timestamp: number(),
18418
+ frameWidth: number(),
18419
+ frameHeight: number(),
18420
+ detections: array(OverlayDetectionSchema).readonly()
18421
+ }), object({
18422
+ deviceId: number(),
18423
+ trackId: string$2(),
18424
+ className: string$2()
18172
18425
  }), object({
18173
- success: boolean(),
18174
- reason: string$2().optional()
18175
- }), {
18176
- kind: "mutation",
18177
- auth: "admin"
18178
- }), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string$2() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string$2() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
18179
- addonId: string$2(),
18180
- modelId: string$2(),
18181
- filename: string$2().optional(),
18182
- settings: record(string$2(), unknown()).optional()
18183
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
18426
+ deviceId: number(),
18427
+ trackId: string$2(),
18428
+ className: string$2(),
18429
+ durationMs: number()
18430
+ }), object({
18431
+ deviceId: number(),
18432
+ kind: EventKindSchema,
18433
+ eventId: string$2(),
18434
+ timestamp: number()
18435
+ });
18184
18436
  object({
18185
18437
  activeCameras: number(),
18186
18438
  throttledCameras: number(),
@@ -18206,106 +18458,6 @@ var CameraMetricsSchema = object({
18206
18458
  });
18207
18459
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
18208
18460
  /**
18209
- * Zone — pure geometry + identity. NO filtering behaviour.
18210
- *
18211
- * Zones describe **where** in the frame the operator wants to flag
18212
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
18213
- * each pipeline stage uses them. Splitting the two means a single
18214
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
18215
- * a detection-include rule on `['car']`, and an occupancy aggregate
18216
- * — without three duplicated polygons.
18217
- *
18218
- * Owned by the orchestrator addon (provider) and mirrored into the
18219
- * `zones` device-state slice on every mutation. Consumers
18220
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
18221
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
18222
- * mirror with `onChanged`).
18223
- *
18224
- * Coordinates are normalised fractions of the frame (0–1) so zones
18225
- * survive resolution changes and stream profile switches.
18226
- *
18227
- * `kind` discriminates between full polygons (closed regions used
18228
- * for intrusion / occupancy filters) and tripwires (open 2-point
18229
- * line segments used for cross events). Onboard / firmware-reported
18230
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
18231
- * task list.
18232
- */
18233
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
18234
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
18235
- var PolygonPointSchema = object({
18236
- x: number(),
18237
- y: number()
18238
- });
18239
- /** A camera detection zone — pure geometry/identity. */
18240
- var ZoneSchema = object({
18241
- id: string$2(),
18242
- name: string$2(),
18243
- kind: ZoneKindEnum.default("polygon"),
18244
- /** Polygon vertices, fraction of frame (0–1). */
18245
- polygon: array(PolygonPointSchema).readonly(),
18246
- /** Visual color for UI rendering. */
18247
- color: string$2().default("#3b82f6")
18248
- });
18249
- /**
18250
- * Zones capability — per-camera CRUD over polygon detection zones.
18251
- *
18252
- * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
18253
- * to per-device settings and mirrors into the `zones` device-state
18254
- * slice on every mutation, so downstream consumers can subscribe via
18255
- * `dev.state.zones.onChanged`.
18256
- *
18257
- * The cap surface only handles geometry + identity; filtering
18258
- * behaviour (per-class, include/exclude, threshold) lives in the
18259
- * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
18260
- * `capabilities/schemas/zone-rule.js`.
18261
- */
18262
- var zonesCapability = {
18263
- name: "zones",
18264
- scope: "device",
18265
- mode: "singleton",
18266
- deviceTypes: [DeviceType.Camera],
18267
- methods: {
18268
- listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
18269
- addZone: method(object({
18270
- deviceId: number(),
18271
- zone: ZoneSchema
18272
- }), _void(), {
18273
- kind: "mutation",
18274
- auth: "admin"
18275
- }),
18276
- removeZone: method(object({
18277
- deviceId: number(),
18278
- zoneId: string$2()
18279
- }), _void(), {
18280
- kind: "mutation",
18281
- auth: "admin"
18282
- }),
18283
- updateZone: method(object({
18284
- deviceId: number(),
18285
- zone: ZoneSchema
18286
- }), _void(), {
18287
- kind: "mutation",
18288
- auth: "admin"
18289
- })
18290
- },
18291
- /**
18292
- * Runtime-state slice — the live zone catalogue mirrored by the
18293
- * orchestrator on every CRUD mutation. Consumers read via
18294
- * `device.state.zones.value` / `.watch(...)` without round-tripping
18295
- * the cap, and the codegen DeviceProxy auto-wires the reactive
18296
- * handle. Slice shape is `{ zones: Zone[] }` so future extensions
18297
- * (e.g. zone groupings) can sit alongside the polygon list.
18298
- */
18299
- runtimeState: object({ zones: array(ZoneSchema).readonly() }),
18300
- /**
18301
- * 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.
18302
- *
18303
- * See `RuntimeStateDurability`. Enforced by
18304
- * `scripts/check-runtime-state-durability.ts`.
18305
- */
18306
- durability: "restored"
18307
- };
18308
- /**
18309
18461
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
18310
18462
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
18311
18463
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -26988,6 +27140,39 @@ var ReadGopBytesResultSchema = object({
26988
27140
  /** Media ms the returned fragment covers. */
26989
27141
  gopDurMs: number()
26990
27142
  });
27143
+ /**
27144
+ * A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
27145
+ * twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
27146
+ * replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
27147
+ * a replay needs several seconds of native pixels, not one frame.
27148
+ *
27149
+ * `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
27150
+ * is `false` when the returned bytes were cut short by the read's own safety
27151
+ * byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
27152
+ * silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
27153
+ * degradation: a window whose end falls past the covering segment would need
27154
+ * bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
27155
+ * not one standalone-demuxable stream — the caller's answer is to request a
27156
+ * shorter window or one aligned to a single segment, not to receive spliced
27157
+ * bytes nothing has proven decodable.
27158
+ */
27159
+ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
27160
+ kind: literal("ok"),
27161
+ data: _instanceof(Uint8Array),
27162
+ /** Absolute epoch ms of the returned bytes' first sample — at or before
27163
+ * the requested `fromMs` (anchored on the nearest keyframe). */
27164
+ gopStartMs: number(),
27165
+ /** Media ms the returned bytes cover, from `gopStartMs`. */
27166
+ gopDurMs: number(),
27167
+ /** `false` ⇒ the safety byte cap cut the read short before it reached
27168
+ * the requested `toMs`; the caller got fewer frames than asked for. */
27169
+ reachesRequestedEnd: boolean()
27170
+ }), object({
27171
+ kind: literal("spans-multiple-segments"),
27172
+ /** Where the covering segment's own footage runs out — informational,
27173
+ * not a retry hint (retrying the same window would refuse again). */
27174
+ segmentEndMs: number()
27175
+ })]);
26991
27176
  method(object({
26992
27177
  deviceId: number(),
26993
27178
  fromMs: number(),
@@ -27038,6 +27223,15 @@ method(object({
27038
27223
  }), ReadGopBytesResultSchema, {
27039
27224
  kind: "query",
27040
27225
  auth: "admin"
27226
+ }), method(object({
27227
+ deviceId: number(),
27228
+ profile: string$2(),
27229
+ startMs: number(),
27230
+ fromMs: number(),
27231
+ toMs: number()
27232
+ }), ReadWindowBytesResultSchema, {
27233
+ kind: "query",
27234
+ auth: "admin"
27041
27235
  }), method(object({
27042
27236
  deviceId: number(),
27043
27237
  config: RecordingConfigSchema
@@ -27633,92 +27827,6 @@ var sceneMonitorCapability = {
27633
27827
  durability: "session"
27634
27828
  };
27635
27829
  /**
27636
- * Per-stage gating mode applied to the zones a rule references.
27637
- *
27638
- * - `include`: the rule contributes to a **whitelist** for its stage.
27639
- * When at least one `include` rule fires for a stage, only entities
27640
- * inside one of those zones pass that stage.
27641
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
27642
- * Entities inside one of those zones are dropped at that stage.
27643
- *
27644
- * `monitor`-style observation (count without filtering) is not a rule
27645
- * mode — zones without any matching rule are observed naturally by
27646
- * `zone-analytics` (live snapshot + history), so an "I just want to
27647
- * count, not filter" use case needs no rule at all.
27648
- */
27649
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
27650
- /**
27651
- * Per-consumer rule that references existing zones (geometry) and
27652
- * defines how a specific pipeline stage should treat them. Each
27653
- * consumer addon owns its own `ZoneRule[]` array in its per-device
27654
- * settings:
27655
- *
27656
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
27657
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
27658
- * - future: notification rules, audio gating, etc.
27659
- *
27660
- * One rule applies to N zones (`zoneIds[]`) so the operator can
27661
- * express "ignore motion in ALL of {garden, street}" with a single
27662
- * rule. `classFilter` narrows the rule to specific object classes —
27663
- * "drop person detections in the street, but keep cars" is one
27664
- * `exclude` rule with `classFilter: ['person']`.
27665
- *
27666
- * `enabled` is a soft toggle — the operator can keep the rule
27667
- * configured but inert without deleting it.
27668
- */
27669
- var ZoneRuleSchema = object({
27670
- /** Stable rule id — survives edits, used by the UI for diffing. */
27671
- id: string$2(),
27672
- /** Optional human-readable label rendered in the rule editor. */
27673
- name: string$2().optional(),
27674
- /** Zones this rule targets. The rule's `mode` applies to ALL
27675
- * listed zones (OR-set: a detection in any one of them counts).
27676
- * At least one zone id required — a rule with no targets is a
27677
- * configuration mistake and the form validator rejects it. */
27678
- zoneIds: array(string$2()).min(1).readonly(),
27679
- mode: ZoneRuleModeEnum,
27680
- /**
27681
- * Class names this rule applies to. Empty / undefined ⇒ rule
27682
- * applies to every class. Class strings match the `macroClass`
27683
- * field on detections (e.g. `person`, `car`, `dog`).
27684
- */
27685
- classFilter: array(string$2()).readonly().optional(),
27686
- /**
27687
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
27688
- * required to consider an entity "in the zone". Defaults to the
27689
- * consumer's stage default when omitted. Kept for back-compat with
27690
- * existing per-rule overrides; new operators pick the value via
27691
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
27692
- * set, the lower-level engine reads it as a 0–1 fraction.
27693
- */
27694
- overlapThreshold: number().min(0).max(1).optional(),
27695
- /**
27696
- * Operator-friendly version of `overlapThreshold` — the percentage
27697
- * of the detection's bbox that must lie inside the zone for the
27698
- * rule to match. Documented default is 85%; the engine substitutes
27699
- * that when the field is omitted (kept optional so existing rules
27700
- * stored without it stay valid).
27701
- *
27702
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
27703
- * rule, the engine prefers `bboxInclusionPct` because it's the
27704
- * field exposed in the UI. Internally both feed the same gate.
27705
- */
27706
- bboxInclusionPct: number().min(0).max(100).optional(),
27707
- /**
27708
- * When `true` and a detection has a segmentation mask, use the
27709
- * mask for overlap instead of the bbox. Detection-stage only;
27710
- * motion rules ignore this field.
27711
- */
27712
- preferMask: boolean().optional(),
27713
- /**
27714
- * Soft-toggle: `false` disables the rule without deleting it.
27715
- * Defaults to `true` so operators creating a rule via the UI
27716
- * see it active immediately.
27717
- */
27718
- enabled: boolean().default(true)
27719
- });
27720
- array(ZoneRuleSchema).readonly();
27721
- /**
27722
27830
  * Script-runner cap. Models HA `script.*` entities on
27723
27831
  * `DeviceType.Script`. A Script is a pre-recorded action sequence
27724
27832
  * that can be invoked imperatively — optionally with a variables
@@ -33211,6 +33319,12 @@ Object.freeze({
33211
33319
  addonId: null,
33212
33320
  access: "view"
33213
33321
  },
33322
+ "notificationRules.resolveArtifactUrl": {
33323
+ capName: "notification-rules",
33324
+ capScope: "system",
33325
+ addonId: null,
33326
+ access: "view"
33327
+ },
33214
33328
  "notificationRules.setAlarmConfig": {
33215
33329
  capName: "notification-rules",
33216
33330
  capScope: "system",
@@ -33655,6 +33769,12 @@ Object.freeze({
33655
33769
  addonId: null,
33656
33770
  access: "create"
33657
33771
  },
33772
+ "pipelineAnalytics.runReplayFrameProcessor": {
33773
+ capName: "pipeline-analytics",
33774
+ capScope: "device",
33775
+ addonId: null,
33776
+ access: "create"
33777
+ },
33658
33778
  "pipelineAnalytics.saveRetrainAnnotations": {
33659
33779
  capName: "pipeline-analytics",
33660
33780
  capScope: "device",
@@ -33787,6 +33907,12 @@ Object.freeze({
33787
33907
  addonId: null,
33788
33908
  access: "view"
33789
33909
  },
33910
+ "pipelineExecutor.getInferenceDeviceHealth": {
33911
+ capName: "pipeline-executor",
33912
+ capScope: "system",
33913
+ addonId: null,
33914
+ access: "view"
33915
+ },
33790
33916
  "pipelineExecutor.getOrchestratorConfigSchema": {
33791
33917
  capName: "pipeline-executor",
33792
33918
  capScope: "system",
@@ -33859,6 +33985,12 @@ Object.freeze({
33859
33985
  addonId: null,
33860
33986
  access: "view"
33861
33987
  },
33988
+ "pipelineExecutor.rearmInferenceDevice": {
33989
+ capName: "pipeline-executor",
33990
+ capScope: "system",
33991
+ addonId: null,
33992
+ access: "create"
33993
+ },
33862
33994
  "pipelineExecutor.runAudioTest": {
33863
33995
  capName: "pipeline-executor",
33864
33996
  capScope: "system",
@@ -34597,6 +34729,12 @@ Object.freeze({
34597
34729
  addonId: null,
34598
34730
  access: "view"
34599
34731
  },
34732
+ "recording.readWindowBytes": {
34733
+ capName: "recording",
34734
+ capScope: "system",
34735
+ addonId: null,
34736
+ access: "view"
34737
+ },
34600
34738
  "recording.refreshStorageLocationsForMigration": {
34601
34739
  capName: "recording",
34602
34740
  capScope: "system",
@@ -37107,6 +37245,11 @@ Object.freeze({
37107
37245
  form: "single",
37108
37246
  optional: false
37109
37247
  }],
37248
+ "pipelineAnalytics.runReplayFrameProcessor": [{
37249
+ name: "deviceId",
37250
+ form: "single",
37251
+ optional: false
37252
+ }],
37110
37253
  "pipelineAnalytics.saveRetrainAnnotations": [{
37111
37254
  name: "deviceId",
37112
37255
  form: "single",
@@ -37422,6 +37565,11 @@ Object.freeze({
37422
37565
  form: "single",
37423
37566
  optional: false
37424
37567
  }],
37568
+ "recording.readWindowBytes": [{
37569
+ name: "deviceId",
37570
+ form: "single",
37571
+ optional: false
37572
+ }],
37425
37573
  "recording.relocateFootage": [{
37426
37574
  name: "deviceId",
37427
37575
  form: "single",