pipeline-analytics
pipeline-analytics — device-scoped wrapper cap.
pipeline-analytics — device-scoped wrapper cap. Refines raw per-frame detections emitted by the pipeline runner into tracked objects, per-kind event collections (motion / object / audio), and persisted media. Owns the post-detection domain end-to-end:
runner emits PipelineInferenceResult ↓ (event bus) pipeline-analytics subscriber ↓ SORT tracker + zone engine + state analyzer + event emitter → three DB collections (one per kind), one FS media tree, one unified event emitter (FrameTracked + TrackStarted/Ended + DetectionEvent on bus)
Pure subscriber model. No processFrame cap method — the runner already publishes the raw frame on the bus. The cap surface is only QUERIES + per-device settings, bound on/off via device-manager.setWrapperActive. defaultActive: true because every camera with a detection pipeline wants its raw detections refined; operators opt out per-device via BindingsTab when needed.
Replaces the legacy analysis-pipeline, analysis-data-persistence (per-device surface) and track-trail caps — see P11 cleanup.
── Shared sub-schemas ──────────────────────────────────────────────
At a glance
| Capability | pipeline-analytics |
| Provided by | An addon wraps the device and provides it. It is bound to a device through the device bindings and can be bound automatically to compatible devices. |
| Active providers per device | one |
| Device types | camera |
| Source | packages/types/src/capabilities/pipeline-analytics.cap.ts |
Methods
getActiveTracks
query
── Tracks ────────────────────────────────────────────────
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes |
Output
({ trackId: string; deviceId: number; className: string; label?: string; labelScore?: number; labelMeta?: { stepId: string; modelId?: string; decidedAt: number; identityId?: string }; subLabel?: string; subLabelScore?: n…
getTrack
query
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
trackId | string | yes | |
deviceId | number | yes | |
className | string | yes | |
label | string | no | |
labelScore | number | no | |
labelMeta | { stepId: string; modelId?: string; decidedAt: number; identityId?: string } | no | |
subLabel | string | no | |
subLabelScore | number | no | |
subLabelMeta | { stepId: string; modelId?: string; decidedAt: number; identityId?: string } | no | |
producingDeviceName | string | no | |
source | "pipeline" | "onboard" | "sensor" | "audio" | no | |
firstSeen | number | yes | |
lastSeen | number | yes | |
positions | ({ x: number; y: number; timestamp: number; bbox: { x: number; y: number; w: number; h: number }; source?: "frame" | "recovery"; score?: number })[] | yes | |
snapshots | ({ timestamp: number; position: { x: number; y: number; timestamp: number; bbox: BoundingBoxSchema; source?: "frame" | "recovery"; score?: number }; mediaId: number })[] | yes | |
zonesVisited | string[] | yes | |
zoneNames | string[] | no | |
classes | string[] | no | |
totalDistance | number | yes | |
state | "new" | "entered" | "left" | "moving" | "idle" | yes | |
active | boolean | yes | |
importance | number | no | |
bestEventId | string | no | |
importanceReason | string | no | |
audioLabels | ({ label: string; peakScore: number; count: number; firstAt: number; lastAt: number })[] | no | |
envelope | { minX: number; minY: number; maxX: number; maxY: number } | no | |
hasFace | boolean | no | |
hasEmbeddedFace | boolean | no | |
hasRider | boolean | no | |
previewMissReason | string | no | |
modelId | string | no | |
openedPlacement | { nodeId: string; deviceKey?: string; modelId?: string } | no | |
closedPlacement | { nodeId: string; deviceKey?: string; modelId?: string } | no | |
frameWidth | number | no | |
frameHeight | number | no | |
markForTrain | boolean | no | |
debug | boolean | no | |
debugNote | string | no | |
favourited | boolean | no | |
retrainStatus | "none" | "staging" | "trained" | no |
listTracks
query
Historical completed tracks for a device. Queried from the persisted pipeline-analytics:tracks collection; active tracks still in RAM are not included.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
since | number | no | |
until | number | no | |
limit | number | no | |
zone | { kind: "rect"; x: number; y: number; width: number; height: number } | { kind: "polygon"; points: ({ x: number; y: number })[] } | no | Spatial filter — only tracks whose trajectory intersects the zone (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted envelope columns, then precisely tested per position. Tracks with an unknown envelope (no frame dims at persist time) always match. |
projection | "full" | "slim" | no | See { compatible — omitting the field keeps today's exact behaviour). |
includeStationary | boolean | no | Include stationary-promoted rows (parked objects handed to the stationary registry). Default false: the timeline lists passages, not parking records (operator decision, 2026-08-15). |
classes | string[] | no | Restrict to these track classes. ABSENT or EMPTY means no filter. Added 2026-09-03: the timeline's class chips filtered in the CLIENT, on a day of rows already downloaded. The zone filter had been moved here for exactly that reason — and it is also what lets the rows come back slim — but the class filter was left behind, so a narrow selection was still a wide read followed by a wide discard. Empty is "show all", not "nothing matches": a chip row with nothing selected is an operator who has not narrowed anything, and an empty timeline would read as a camera that saw nothing. |
excludeSources | ("pipeline" | "onboard" | "sensor" | "audio")[] | no | See { |
Output
({ trackId: string; deviceId: number; className: string; label?: string; labelScore?: number; labelMeta?: { stepId: string; modelId?: string; decidedAt: number; identityId?: string }; subLabel?: string; subLabelScore?: n…
listRecentTracks
query
Batched cluster-wide track listing — ONE call for the events page / reel first paint instead of a per-camera listTracks fan-out. Merges the persisted completed tracks of every requested device, sorted by lastSeen DESC with a stable (lastSeen, trackId) cursor. Per-device indexed pages (idx_tracks_device_lastSeen) are k-way merged provider-side; projection: 'slim' drops the heavy positions[] / snapshots[] JSON (returned as empty arrays). Active in-RAM tracks are not included (same contract as listTracks).
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceIds | number[] | yes | Devices to merge. An empty array yields { tracks: [], nextCursor: null }. |
since | number | no | Window lower bound on lastSeen (inclusive). |
until | number | no | Window upper bound on lastSeen (inclusive). |
limit | number | no (default 200) | Page size. Default 200, max 1000. |
cursor | string | no | Opaque continuation cursor from a previous page's nextCursor. Encodes the (lastSeen, trackId) sort position — treat as opaque. |
projection | "full" | "slim" | no | See { |
includeStationary | boolean | no | Include stationary-promoted rows (parked objects). Default false: the feed lists passages; parking records live on the stationary registry. |
classes | string[] | no | Restrict to these track classes. ABSENT or EMPTY means no filter. The same filter listTracks takes, because the timeline's class chips must mean the same thing whether the scope is one camera or twelve. Until this existed the scoped feed downloaded a page and narrowed it on the phone while the single-camera path narrowed the read — one filter, two costs. A SUPERSET prefilter on classes[], like its single-camera twin: rows whose class list is unreadable are kept, and the client's rule stays the exact one. |
excludeSources | ("pipeline" | "onboard" | "sensor" | "audio")[] | no | See { |
Output
| Field | Type | Required | Description |
|---|---|---|---|
tracks | ({ trackId: string; deviceId: number; className: string; label?: string; labelScore?: number; labelMeta?: { stepId: string; modelId?: string; decidedAt: number; identityId?: string }; subLabel?: string; subLabelScore?: n… | yes | Merged page, ordered by (lastSeen DESC, trackId DESC). |
nextCursor | string | null | yes | Cursor for the next page, or null when this page is the last. |
clearTracks
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes |
Output
Nothing.
getMotionEvents
query
── Events (per-kind, parallel-queryable) ─────────────────
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
since | number | no | |
until | number | no | |
limit | number | no (default 1000) | |
projection | "full" | "slim" | no |
Output
({ id: number; deviceId: number; timestamp: number; kind: "motion"; regionCount: number; regions?: ({ bbox: BoundingBoxSchema; pixelCount: number; intensity: number })[]; frameWidth?: number; frameHeight?: number; mediaU…
getObjectEvents
query
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
since | number | no | |
until | number | no | |
limit | number | no (default 1000) | |
projection | "full" | "slim" | no | |
classFilter | string | no |
Output
({ id: number; deviceId: number; timestamp: number; kind: "object"; source?: "pipeline" | "onboard"; frameId?: string; idempotencyKey?: string; trackId?: string; className: string; label?: string; labelScore?: number; la…
getAudioEvents
query
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
since | number | no | |
until | number | no | |
limit | number | no (default 1000) | |
projection | "full" | "slim" | no |
Output
({ id: number; deviceId: number; timestamp: number; kind: "audio"; rms: number; dbfs: number; classification?: { className: string; originalClass?: string; score: number }; classifyOutcome?: { state: "classified" } | { s…
listEventKinds
query
── Extensible per-device event kinds ─────────────────────
Every event kind the device can produce: built-ins (motion + audio), detection classes actually observed for the device (from the track history), and sensor kinds contributed by LINKED devices (resolved via device-manager.getLinkedDevices, mapped through EVENT_KIND_BY_CAP).
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes |
Output
({ kind: string; labelKey: string; label: string; color: string; iconId: string; icon: "motion" | "audio" | "person" | "vehicle" | "animal" | "door" | "pir" | "smoke" | "water" | "button" | "package" | "generic"; categor…
listEventKindsBatch
query
The same answer for many cameras in ONE call.
listEventKinds is the slowest per-device query on the hub — measured at ~100 ms against 6-11 ms for its neighbours — because composing it costs a getCameraStatus, a getLinkedDevices and one getBindings per linked device. The viewer asks for it once per camera at first paint, so twelve cameras paid twelve of those round-trips on top of the per-camera cost.
Batched, the camera statuses come from ONE getCameraStatuses instead of N, and the per-device composition runs concurrently.
Per-device rather than pre-merged on purpose: a caller that renders one camera's lanes needs to know WHICH camera a kind came from, and merging is three lines the caller can do. listEventKinds stays for single-device callers.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceIds | number[] | yes |
Output
({ deviceId: number; kinds: ({ kind: string; labelKey: string; label: string; color: string; iconId: string; icon: "motion" | "audio" | "person" | "vehicle" | "animal" | "door" | "pir" | "smoke" | "water" | "button" | "p…
getSensorEvents
query
Sensor-event history for a camera: state changes of LINKED sensor devices, attributed to the camera at ingest time (one row per linked camera). Mirrors getAudioEvents query semantics; kinds narrows to a kind subset.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
since | number | no | |
until | number | no | |
kinds | string[] | no | |
limit | number | no (default 1000) |
Output
({ id: string; deviceId: number; sourceDeviceId: number; kind: string; value: Record<string, unknown> | null; timestamp: number })[]
getKeyEvents
query
── Key events (importance-ranked highlights) ─────────────
Importance-ranked highlights for a device+window. Queries completed tracks by (deviceId, firstSeen ∈ [since,until]), scores each (or reuses the persisted score), filters by minImportance/classFilter, orders by importance desc, and returns up to limit compact key events mapped to each track's best event. Legacy tracks lacking a persisted score are scored on-read (no write). Degrades to [] on error.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
since | number | yes | |
until | number | yes | |
limit | number | no (default 50) | |
minImportance | number | no | |
classFilter | string | no |
Output
({ id: string; trackId: string; timestamp: number; className: string; label?: string; labelScore?: number; labelMeta?: { stepId: string; modelId?: string; decidedAt: number; identityId?: string }; subLabel?: string; subL…
getKeyEventsBatch
query
The same ranking, for a SET of cameras, in one round trip.
The Detection Intelligence events feed asks this of every selected camera and re-asks on a 30s timer. Fanned out client-side that is N round trips — browser → hub → post-analysis — for N independent, already-indexed store queries. Batched, the queries are unchanged and run concurrently INSIDE the owner; only the transport collapses.
Deliberately per-device rather than pre-merged: limit stays per camera (a total would let a busy camera starve a quiet one), and a caller that renders one camera's lane needs to know which camera a row came from. getKeyEvents stays for single-device callers.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceIds | number[] | yes | |
since | number | yes | |
until | number | yes | |
limit | number | no (default 50) | |
minImportance | number | no | |
classFilter | string | no |
Output
({ deviceId: number; events: ({ id: string; trackId: string; timestamp: number; className: string; label?: string; labelScore?: number; labelMeta?: LabelAttributionSchema; subLabel?: string; subLabelScore?: number; subLa…
readLongTermSeries
query
── Density (timeline histogram) ────────────────────────── Server-side bucketed event counts for the 24-hour timeline. Returns one entry per non-empty bucket; empty buckets are omitted.
Read one camera's long-term series — 5-minute buckets, kept for a year.
scope is the series' own dimension — for occupancy, spell it with { scope back at once (the caller then groups with {
Bounds are inclusive on the BUCKET START, so a range that ends mid-bucket still returns the bucket it lands in — the alternative is a chart whose last column silently disappears for five minutes out of every five.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
series | "motion" | "audio-dbfs" | "battery" | "occupancy" | yes | |
scope | string | no | Omit for EVERY scope of this series in the range. |
from | number | yes | |
to | number | yes | |
limit | number | no |
Output
({ scope: string; bucketStart: number; samples: number; sum: number; min: number; max: number })[]
getEventDensity
query
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
since | number | yes | |
until | number | yes | |
bucketMs | number | yes |
Output
({ bucketStart: number; motion: number; object: number; audio: number; audioDbfs?: number })[]
getEventDensityBatch
query
The same histogram, for a SET of cameras, in one round trip.
A multi-camera timeline (the tablet grid) re-asks this of every camera in the grid on every day change — N browser → hub → post-analysis round trips for N independent, already-indexed store queries. The queries are unchanged and still run per camera (densityByKind, one per deviceId, concurrently INSIDE the owner); only the transport collapses.
Deliberately per-device rather than pre-merged: a timeline lane belongs to a camera, and a caller that merged would have to un-merge. getEventDensity stays for single-camera callers.
Every requested id gets a row, marked — see { { than truncated.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceIds | number[] | yes | |
since | number | yes | |
until | number | yes | |
bucketMs | number | yes |
Output
({ deviceId: number; read: "read" | "unreadable"; buckets: ({ bucketStart: number; motion: number; object: number; audio: number; audioDbfs?: number })[] })[]
pruneEventsBefore
mutation
── Maintenance ───────────────────────────────────────────
analytics model and retention must cascade from it (design §5.1). This event-only prune leaves orphaned tracks/faces/plates/embeddings behind. Retained as a compat shim for the Phase-B3 recorder orchestration caller, which prunes events to keep history aligned with available footage and reads the per-kind counts. Delete all events (motion + object + audio) for the given device older than cutoffMs (exclusive) + their thumbnails in lockstep; returns per-kind deleted counts.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
cutoffMs | number | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
motion | number | yes | |
object | number | yes | |
audio | number | yes |
pruneTracksBefore
mutation
Track-centric retention entry point (design §5.1). Selects every persisted track for the device whose lastSeen < cutoffMs (paged) and runs the extensible whole-track deletion cascade (design §3): object events + their media, track/face/plate-owned media, unassigned face reads, per-track CLIP embeddings, then the track root LAST. ENROLLED (assigned) faces/plates and ownerKind:'identity' media are exempt — the durable matching gallery always persists. Fires the per-track live-state cleanup so a pruned track can't linger in dispatch/overlay state. Returns per-family deleted counts (tracks authoritative).
Replaces pruneEventsBefore as the correct time-based retention prune.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
cutoffMs | number | yes |
Output
── Track-centric retention cascade counts ────────────────────────── The track is the ROOT of the analytics data model; retention/deletion cascades from it to every derived entity (design §2–5). A cascade run reports the per-family deleted totals. tracks is the AUTHORITATIVE headline — the number of persisted track roots removed. The leaf families (events/media/faces/plates/ embeddings) are reported best-effort: the extensible TrackScopedStore cascade (design §3) deletes them via a Promise<void> contract that does not surface per-store totals, so leaf counts default to 0 until the store return types are widened (out of the retention-cascade scope). Operators read tracks for the "clean slate" confirmation.
| Field | Type | Required | Description |
|---|---|---|---|
tracks | number | yes | Persisted track roots deleted (authoritative). |
events | number | yes | Object events removed with their tracks (best-effort; see note above). |
media | number | yes | Track/face/plate-owned media removed (best-effort). Never identity media. |
faces | number | yes | Unassigned (non-enrolled) face reads removed (best-effort). |
plates | number | yes | Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). |
embeddings | number | yes | Per-track CLIP search vectors removed (best-effort). |
wipeAllAnalytics
mutation
Operator "clean slate" for a device (design §5.3): prune EVERY track for the device via the same cascade as pruneTracksBefore with cutoffMs = now. One call per device — no client-side track enumeration. Enrolled gallery + identity media are exempt (design §4). Returns per-family deleted counts.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes |
Output
── Track-centric retention cascade counts ────────────────────────── The track is the ROOT of the analytics data model; retention/deletion cascades from it to every derived entity (design §2–5). A cascade run reports the per-family deleted totals. tracks is the AUTHORITATIVE headline — the number of persisted track roots removed. The leaf families (events/media/faces/plates/ embeddings) are reported best-effort: the extensible TrackScopedStore cascade (design §3) deletes them via a Promise<void> contract that does not surface per-store totals, so leaf counts default to 0 until the store return types are widened (out of the retention-cascade scope). Operators read tracks for the "clean slate" confirmation.
| Field | Type | Required | Description |
|---|---|---|---|
tracks | number | yes | Persisted track roots deleted (authoritative). |
events | number | yes | Object events removed with their tracks (best-effort; see note above). |
media | number | yes | Track/face/plate-owned media removed (best-effort). Never identity media. |
faces | number | yes | Unassigned (non-enrolled) face reads removed (best-effort). |
plates | number | yes | Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). |
embeddings | number | yes | Per-track CLIP search vectors removed (best-effort). |
reconcileFromDisk
mutation
Disk-wins reconcile for one camera. Drops media index rows whose blobs are gone, then cascades tracks (including favourited and staging) that have no remaining files. Enrolled identity/vehicle/scene media is never probed. Trackless motion/audio events with no remaining file are dropped, including snapshot-less rows.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
mediaDropped | number | yes | |
tracks | number | yes | |
events | number | yes |
deleteTracks
mutation
Delete whole tracks (object events) by id for the given device, cascading their media in lockstep. Returns the number of tracks actually deleted plus the ids that could not be removed.
Operator-driven from the DI Events page (batch delete). Routes through the same widened track-deletion cascade (design §5.2).
sparedMediaIds: media rows the cascade LEFT because a live stationary entry vouches for them (its key frame, owned by a track that moved and was kept). Released when the entry retires. Optional: absent from a provider that predates it.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackIds | string[] | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
deleted | number | yes | |
failed | string[] | yes | |
sparedMediaIds | number[] | no |
setTrackFlags
mutation
Set the per-track operator flags (markForTrain, debug, favourited) on ONE track. The patch is PARTIAL — an omitted key is left untouched — because the three surfaces that write it (admin Events grid, viewer track detail, viewer cluster detail) each own one toggle and must not clobber the other.
Writes the track ROW: markForTrain/debug are per-TRACK state, so they live where label and importance live, not in any per-device settings store. Updates the in-RAM active track too, so a flag set on a live track survives its expiry-time persist.
auth: 'protected' (the default), NOT admin: the viewer is an authenticated non-admin surface and two of the three call sites are there. It STAYS protected, and the reason is that the alternative makes the feature pointless: marking a track is something you do while looking at it, on the surface you were already looking at it on, and that surface is the viewer. What the storage cost gets instead is a BOUND — a per-device pin budget enforced in the body, refusing a new pin past the limit while always allowing un-marking. deleteTracks next door is still admin, because destroying evidence and preserving it are not symmetric.
markForTrain writes the retrain LIFECYCLE, not a boolean column: true is none → staging, false is staging → none. A track already trained refuses BOTH — its frames are copies inside the retrain dataset and re-staging it from a generic toggle is how the same material gets annotated twice under two ground truths. Returning a trained track to staging is a deliberate action of the retrain page, which is also the only thing that produces trained in the first place.
debugNote is the operator's sentence about WHAT to check on this track, and it is bound to debug: writing debug: false clears it in the same statement, and a note sent for a track whose debug is off (and is not being turned on) is DROPPED with a warning rather than stored where nothing will ever read it. An omitted debugNote leaves the stored one alone — which is what lets a surface turn debug on when the operator declined to type anything, without that refusal costing them the flag.
Returns the RESOLVED state of all three flags (absent → false) plus the note (absent → '') and the retrainStatus they were derived from, so a caller can drive its toggle — and render a trained badge — without a re-fetch. Rejects an unknown track, a new staging mark on a device already holding its full budget, and any markForTrain write against a trained track.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | Log/audit scope only — the trackId is globally unique on its own. |
trackId | string | yes | |
flags | { markForTrain?: boolean; debug?: boolean; debugNote?: string; favourited?: boolean } | yes |
Output
The resolved flag state after a write. Both fields are REQUIRED here (absent collapses to false) so a caller can drive a toggle's checked state off the mutation result without a re-fetch.
| Field | Type | Required | Description |
|---|---|---|---|
trackId | string | yes | |
markForTrain | boolean | yes | |
debug | boolean | yes | |
debugNote | string | yes | The note as it STANDS after the write — never absent here (a track with no note reports ''), for the same reason the booleans are required: a surface that has just written must be able to render the note it now owns without a re-fetch, and an absent key would read as "unchanged" on a screen that has no previous value to keep. |
favourited | boolean | yes | |
retrainStatus | "none" | "staging" | "trained" | yes | The lifecycle state the boolean was derived from. Required here (unlike on a track row) because this shape is only ever produced by the write body, which always knows it — and a surface that has just written needs to render trained without a re-fetch. |
listArchivedDebugNotes
query
The archived debug notes, newest first — the corpus of what operators have asked to be checked, across tracks that no longer exist.
setTrackFlags writes it: a patch carrying debug: false still clears the note off the track row in the same statement, but the note is APPENDED here first. This method is the only way to read what was kept.
auth: 'protected', matching setTrackFlags next door and for the same reason: the notes are written from the viewer, by an authenticated non-admin session, and a corpus only an admin can read is a corpus the person who wrote it cannot use. It carries operator prose about cameras and nothing else — no media, no paths, no identities beyond a track's own display label.
Newest-first, capped by limit (default { table itself is bounded by row count, not by age — see { bound for exactly this data.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | no | Restrict to a single camera; omit for every row. |
limit | number | no | Max rows returned, newest-first. |
Output
({ id: string; note: string; deviceId: number; sourceTrackId: string; archivedAt: number; trackStartedAt: number | null; trackClass: string | null; trackLabel: string | null })[]
setTrackRelation
mutation
Tracking-bench ground truth: "this track and that one are the same subject" / "different subjects". One row per unordered pair — re-marking replaces it — and a mark that contradicts an existing chain is REFUSED with the chain named. Writing a mark also sets debug on both tracks. protected, matching setTrackFlags: marking is done from the viewer's track detail by an authenticated non-admin session.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes | |
otherTrackId | string | yes | |
relation | "same-subject" | "different-subjects" | yes | |
presence | "continuous" | no | |
trackSide | "before" | "after" | no | |
otherSide | "before" | "after" | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
deviceId | number | yes | |
leftTrackId | string | yes | |
rightTrackId | string | yes | |
leftSide | "before" | "after" | null | yes | |
rightSide | "before" | "after" | null | yes | |
relation | "same-subject" | "different-subjects" | yes | |
presence | "continuous" | null | yes | |
leftStartedAt | number | null | yes | |
rightStartedAt | number | null | yes | |
createdAt | number | yes | |
updatedAt | number | yes | |
author | string | null | yes |
clearTrackRelation
mutation
Remove the mark between two tracks.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes | |
otherTrackId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
cleared | boolean | yes |
setTrackPurity
mutation
A track that is not ONE subject: mixed (two subjects, optionally switching at switchAtMs) or not-a-subject. pure clears the mark and answers { purity: null }.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes | |
purity | "pure" | "mixed" | "not-a-subject" | yes | |
switchAtMs | number | no |
Output
null when pure cleared the row.
| Field | Type | Required | Description |
|---|---|---|---|
purity | { id: string; deviceId: number; sourceTrackId: string; purity: "mixed" | "not-a-subject"; switchAtMs: number | null; startedAt: number | null; createdAt: number; updatedAt: number; author: string | null } | null | yes |
listTrackRelations
query
A camera's marks, optionally one track's, windowed by track start.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | no | |
since | number | no | |
until | number | no | |
limit | number | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
relations | ({ id: string; deviceId: number; leftTrackId: string; rightTrackId: string; leftSide: "before" | "after" | null; rightSide: "before" | "after" | null; relation: "same-subject" | "different-subjects"; presence: "continuou… | yes | |
purities | ({ id: string; deviceId: number; sourceTrackId: string; purity: "mixed" | "not-a-subject"; switchAtMs: number | null; startedAt: number | null; createdAt: number; updatedAt: number; author: string | null })[] | yes | |
truncated | boolean | yes |
listBirthDecisions
query
Birth decisions — one row per resolved confirmation-gate verdict.
The READ half of a measurement, and only that: it gates nothing and no runtime path consults it. It exists because the two questions the operator's "traccia partita in ritardo" marks raised are both multi-day and logs.query holds under an hour of fleet traffic —
- how long after the camera's motion onset does a track's
firstSeenland (birthLatencyMs— read its error bars inBirthDecisionRecordSchemabefore quoting it).
Newest-first, capped by limit (default { one verdict, or a since. The table is bounded by row count, not age — see {
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | no | Restrict to a single camera; omit for every row. |
since | number | no | Only decisions at or after this epoch ms. |
verdict | "confirmed" | "suppressed" | "exhausted-fallback" | no | Restrict to one verdict — the miss rate is read one population at a time. |
limit | number | no | Max rows returned, newest-first. |
Output
({ id: string; at: number; deviceId: number; sourceTrackId: string; className: string; verdict: "confirmed" | "suppressed" | "exhausted-fallback"; reason: string | null; cropSource?: "carried" | "native" | "fallback" | n…
getEventStoreFootprint
query
── Events management (footprint + prune + ops-log) ───────────
Durable event-store footprint for the management UI: event rows (motion + object + audio) counted per camera + total, plus the event-owned media bytes on disk per camera + total. Stat/count-based, computed on demand.
Input
No fields.
Output
| Field | Type | Required | Description |
|---|---|---|---|
totalRows | number | yes | |
totalBytes | number | yes | |
devices | ({ deviceId: number; rows: number; bytes: number })[] | yes |
getEventMediaFootprintByKind
query
The same media footprint, broken down by { by camera — fleet-wide, or for one camera with deviceId.
Separate from { the two answer different questions on different axes, the per-camera one is what the management table renders on every open, and nothing should pay for a per-kind pass to draw it. See { kinds is enumerated, totalBytes is not, and the gap must be visible to anyone sizing a deletion against it.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
totalRows | number | yes | |
totalBytes | number | yes | |
kinds | ({ kind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" | "debugCrop" | "… | yes | |
unaccountedRows | number | yes | |
unaccountedBytes | number | yes |
pruneEvents
mutation
Cluster-wide prune of events older than olderThanMs (exclusive) across every camera, deleting each event's media in lockstep. Logged to the events ops-log with reason (default 'retention'). Returns the summed per-kind deleted counts.
Input
| Field | Type | Required | Description |
|---|---|---|---|
olderThanMs | number | yes | |
reason | "retention" | "quota" | "manual" | "operator" | "maintenance" | "orphaned-device" | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
motion | number | yes | |
object | number | yes | |
audio | number | yes |
deleteDeviceEvents
mutation
Manually delete EVERY event (motion + object + audio) for one camera and its event-owned media in lockstep. Logged to the events ops-log as op:'manual-delete', reason:'manual'. Destructive — the admin UI guards it behind a confirm.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
motion | number | yes | |
object | number | yes | |
audio | number | yes |
pauseForStorageMigration
mutation
The events ops-log rows (newest-first), optionally scoped to one camera. Backed by a declared pipeline-analytics SQLite collection. Internal migration-participant lease. It drains active MediaStore writes and refuses new ones without changing analytics bindings.
Input
| Field | Type | Required | Description |
|---|---|---|---|
leaseId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
paused | true | yes |
resumeForStorageMigration
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
leaseId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
resumed | true | yes |
refreshStorageLocationsForMigration
mutation
Drops cached location roots after the storage coordinator repoints a default so future event-media writes use the new root.
Input
| Field | Type | Required | Description |
|---|---|---|---|
leaseId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
refreshed | true | yes |
startStorageMigrationMove
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
toLocationId | string | yes | |
fromLocationId | string | no | |
throttleMbps | number | no | |
mode | "move" | "seal" | "gallery" | no | |
leaseId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
jobId | string | yes |
getStorageMigrationMoveStatus
query
Input
| Field | Type | Required | Description |
|---|---|---|---|
jobId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
jobId | string | yes | |
state | "queued" | "running" | "done" | "failed" | "cancelled" | yes | |
fromLocationId | string | yes | |
toLocationId | string | yes | |
deviceId | number | null | yes | |
entities | string[] | yes | |
filesMoved | number | yes | |
bytesMoved | number | yes | |
filesTotal | number | null | yes | |
rowsReconciled | number | no | |
rowsForgotten | number | no | |
startedAt | number | yes | |
finishedAt | number | null | yes | |
error | string | null | yes |
cancelStorageMigrationMove
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
jobId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
cancelled | boolean | yes |
relocateMedia
mutation
Moves event media between locations — the OPERATOR's mover, without the coordinator's lease. Twin of recording.relocateFootage: the same engine the lease-gated coordinated migration uses (startStorageMigrationMove), armable in the background and WITHOUT pausing anything. Exists because eventMedia was the only storage class whose only move path went through the recorder's global pause.
Input
| Field | Type | Required | Description |
|---|---|---|---|
toLocationId | string | yes | |
fromLocationId | string | no | Restrict the pass to rows currently on this location. Omitted / '*' = every row that is not already on toLocationId (the historical behaviour). A named source is what a from→to migration needs: without it "move events off disk 2" also emptied disk 1. |
throttleMbps | number | no | |
mode | "move" | "seal" | "gallery" | no | Omitted = move, the pre-existing behaviour. |
Output
| Field | Type | Required | Description |
|---|---|---|---|
jobId | string | yes |
countUnstampedEventMedia
query
How many media / retrain rows still carry NO locationId.
A NULL row means "wherever eventMedia points NOW", so the instant a repoint moves that pointer every such row reads from the new disk while its bytes are on the old one — the archive goes dark until a drain happens to stamp it. This count is what the migration planner's non-blocking gate reads; relocateMedia({ mode: 'seal' }) is what drives it to zero.
TWO indexed statements per collection, not a walk. The cheap question (present: is there at least one) is asked first and separately from the expensive one (rows), because only the first has to be answerable for the gate to do its job.
null is "not measurable", never zero — at either level. An unreadable collection must not read as a sealed one.
Input
No fields.
Output
How many rows still carry NO locationId — the population a repoint would silently re-aim at a disk that does not hold their bytes.
null = the count could not be taken, and it is NOT permission to cut over. The gate opens on a measured absence and on nothing else; an unread collection and an empty one are different facts, and this repo has already paid for conflating them.
| Field | Type | Required | Description |
|---|---|---|---|
media | { present: boolean; rows: number | null } | yes | |
retrainFrames | { present: boolean; rows: number | null } | yes | |
anyPresent | boolean | yes | True when EITHER collection holds one. The refusal reads this. |
total | number | null | yes | Sum across both, or null when either lane could not be counted. |
getMediaLocationCensus
query
Stored media per storage location: rows and bytes stamped with each asked location id, the rows with none, and the rows naming a location that was not asked about. One indexed aggregate per location (idx_media_location_size, a covering index) plus the NULL one, and one unfiltered total that is a covering-index scan: O(rows), cheap per row but not constant, so a hub with millions of rows pays for it once per call. unlisted is relative to the ids ASKED: it means "gone" only when every location id was asked. A failed read throws; it never reads as zero.
Input
| Field | Type | Required | Description |
|---|---|---|---|
locationIds | string[] | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
locations | ({ locationId: string; rows: number; bytes: number })[] | yes | |
unstamped | { rows: number; bytes: number } | yes | |
unlisted | { rows: number; bytes: number } | yes | Rows stamped with a location id that was not in the asked list. |
total | { rows: number; bytes: number } | yes |
countRelocatableMedia
query
How many rows a pass would STILL act on against toLocationId.
One derivation, two consumers: it is the media lane's denominator and it is the residue behind "drain remaining". Deriving them separately is how "N of M" ends up comparing two different populations.
null means the count could not be taken; it is never zero-filled, because a zero here reads as "nothing left to move".
Input
| Field | Type | Required | Description |
|---|---|---|---|
toLocationId | string | yes | |
fromLocationId | string | no | Restrict the count to one source; omitted / '*' = every non-target row. |
mode | "move" | "seal" | "gallery" | no | Omitted = move. |
Output
How many rows a media pass would still act on against a given target — the media lane's denominator AND its residue, from ONE derivation so the two can never disagree. null = the count could not be taken.
| Field | Type | Required | Description |
|---|---|---|---|
rows | number | yes |
listRelocateMediaJobs
query
Every relocate job this addon knows about, newest first (in RAM: the move is resumable, so a lost list costs nothing but the display).
Input
No fields.
Output
({ jobId: string; state: "queued" | "running" | "done" | "failed" | "cancelled"; fromLocationId: string; toLocationId: string; deviceId: number | null; entities: string[]; filesMoved: number; bytesMoved: number; filesTot…
cancelRelocateMedia
mutation
Cancel a running or queued relocate job.
Input
| Field | Type | Required | Description |
|---|---|---|---|
jobId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
cancelled | boolean | yes |
listOpsLog
query
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | no | Restrict to a single camera; omit for every row. |
limit | number | no | Max rows returned, newest-first. |
Output
({ id: string; at: number; domain: "recording" | "events"; op: "prune" | "manual-delete" | "rescan" | "retention-run" | "relocate" | "orphan-audit"; reason: "retention" | "quota" | "manual" | "operator" | "maintenance" |…
reclaimDebugMedia
mutation
Reclaim the standing debug-media backlog (motion-visit stills + track filmstrips). DETACHED: returns { started } immediately. The pass is tens of minutes; awaiting it is a timeout, not a verdict. Dry-run unless mode: 'reclaim'. Poll getMediaReclaimStatus.
Input
| Field | Type | Required | Description |
|---|---|---|---|
mode | "report" | "reclaim" | no (default "report") | |
scopes | ("motion-still" | "track-filmstrip")[] | no | |
deviceIds | number[] | no | |
restart | boolean | no | |
pageSize | number | no | |
maxRowsPerDevice | number | no | |
maxReclaimPerDevice | number | no | |
maxBytesPerRun | number | no | |
budgetMinutes | number | no | |
throttleBytesPerSec | number | no | |
graceMinutes | number | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
started | boolean | yes | |
alreadyRunning | boolean | yes |
getMediaReclaimStatus
query
Input
No fields.
Output
| Field | Type | Required | Description |
|---|---|---|---|
running | boolean | yes | |
mode | "report" | "reclaim" | null | yes | |
totalExamined | number | yes | |
totalEligible | number | yes | |
totalReclaimed | number | yes | |
totalBytesReclaimed | number | yes | |
totalRefused | number | yes | |
devicesDone | number | yes | |
complete | boolean | null | yes | |
startedAtMs | number | null | yes | |
finishedAtMs | number | null | yes | |
error | string | null | yes |
getTrainingExportSummary
query
── Training export ───────────────────────────────────────
The CHEAP QUESTION, asked before any media moves: how big is the dataset the marked (markForTrain) tracks would produce?
Answered from media INDEX rows only — key, kind, size, timestamp — so it costs ~2 KB of reads per track and no blob reads at all.
truncated reports that more marked tracks exist than one pass carries. Empty deviceIds ⇒ every device that has marked tracks.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceIds | number[] | no |
Output
What a training export WOULD contain. Computed from media index rows only — no blob is read to produce this.
| Field | Type | Required | Description |
|---|---|---|---|
generatedAt | number | yes | |
trackCount | number | yes | |
fileCount | number | yes | |
byteCount | number | yes | |
truncated | boolean | yes | More marked tracks exist than a single pass carries. |
devices | ({ deviceId: number; tracks: number; files: number; bytes: number })[] | yes |
getTrainingExportUrl
query
Where to download the dataset archive.
The BYTES do not come back through this cap — they come from the returned data-plane URL, which streams a tar built entry by entry. A multi-gigabyte archive base64'd through a unary RPC envelope would be held whole in memory twice on a hub this repo has already OOM'd once. getDownloadUrl on recordingExport is the precedent, and this follows it deliberately.
The archive contains a manifest.json FIRST, then the stored media VERBATIM under tracks/<deviceId>/<trackId>/…. No crop is derived and no model is run: a training set's pixels must be the pixels the pipeline saw.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceIds | number[] | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
url | string | yes |
listRetrainStaging
query
── Retrain curation (the retrain page) ───────────────────────
The staging worklist for one camera, or for every camera that has one.
Fetched ON DEMAND, over the staging set only — the page never scans history, because making the working set small is the entire purpose of the mark. Each row carries how many frames the dataset already holds from the track and how many subjects were annotated on them, so frameCount: 0 reads as "still to work" without a second call per track.
auth: 'admin', unlike the viewer-level mark itself: marking a track is curation you do while looking at it, but building the training set the fleet's models are fine-tuned on is not.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceIds | number[] | no | Empty ⇒ every camera that has staging tracks. A LIST, not a single deviceId, deliberately: deviceId would make this device-bound and route it at one camera's owner, and "every camera" would stop being expressible at all. |
limit | number | no |
Output
({ trackId: string; deviceId: number; className: string; label?: string; firstSeen: number; lastSeen: number; frameCount: number; annotationCount: number; verdict?: { verdict: "correct" | "wrong" | "wrong-label"; suggest…
listRetrainCorpusPage
query
Paginated corpus copies for the Frames grid — index reads only.
Filters AND (workState, cameras, one collection, annotated classes). An answered empty match is { frames: [], total: 0, … }, never a pending masquerade. Classification uses workStateOf (annotation count wins over a stray complete flag).
Input
| Field | Type | Required | Description |
|---|---|---|---|
workState | "unannotated" | "annotated" | "complete" | no | |
deviceIds | number[] | no | |
collectionId | string | no | When set, only frames in this named collection. |
classes | ("person" | "vehicle" | "animal" | "package" | "face" | "plate")[] | no | Frames that carry at least one saved annotation in one of these classes. |
page | number | no (default 1) | |
pageSize | number | no (default 50) |
Output
| Field | Type | Required | Description |
|---|---|---|---|
frames | ({ frameId: string; deviceId: number; origin: "track" | "recording"; trackId?: string; sourceMediaId?: number; epochMs?: number; sourceKind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | … | yes | |
total | number | yes | |
page | number | yes | |
pageSize | number | yes |
getRetrainCorpusKpi
query
Global + per-camera corpus KPI. Unfiltered totals; % on a camera row is complete(camera) / corpus total, or null when the corpus is empty.
Input
No fields.
Output
| Field | Type | Required | Description |
|---|---|---|---|
total | number | yes | |
unannotated | number | yes | |
annotated | number | yes | |
complete | number | yes | |
cameras | ({ deviceId: number; unannotated: number; annotated: number; complete: number; pctOfCorpus: number | null })[] | yes |
listRetrainFrames
query
What a track can contribute, and what it already has.
candidates are the track's whole, unannotated frames — index rows only, so this is cheap. copies are the frames already inside the dataset, and a candidate whose copy exists is marked copied: true: selecting it again is free and CANNOT fail, whatever became of the original.
A crop, a thumbnail and fullFrameBoxed are never candidates. The last one matters most: it has the model's own rectangle burned into the pixels, and a detector trained on it learns to find a green line.
Input
| Field | Type | Required | Description |
|---|---|---|---|
trackId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
candidates | ({ mediaId: number; kind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" … | yes | |
copies | ({ frameId: string; deviceId: number; origin: "track" | "recording"; trackId?: string; sourceMediaId?: number; epochMs?: number; sourceKind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | … | yes | |
autoPickMediaId | number | no | What the page pre-selects — the native key frame when one survives. |
selectRetrainFrames
mutation
COPY-ON-SELECT — the write that makes trained safe to evict.
Selecting a frame copies its bytes into retrain storage immediately: not a reference, not a lease.
The order inside is load-bearing and is pinned by a test: an EXISTING copy is returned without touching the source, so an original that evaporated blocks the selection of THAT ORIGINAL and never the copy already taken. Every refusal comes back named — a dropped selection is never silent, on the wire or in the log.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes | |
mediaIds | number[] | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
copied | ({ frameId: string; deviceId: number; origin: "track" | "recording"; trackId?: string; sourceMediaId?: number; epochMs?: number; sourceKind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | … | yes | |
refused | ({ sourceMediaId: number; reason: "source-missing" | "unreadable-image" | "write-failed" })[] | yes |
deselectRetrainFrame
mutation
Un-select a frame: its annotations go first, then the copy and its blob. Deliberately destructive and deliberately explicit — it is the only way a frame leaves the dataset before export.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | no | |
frameId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
removed | boolean | yes | |
removedAnnotations | number | yes |
getRetrainFrameImage
query
The pixels of ONE copied frame, base64.
A base64 envelope holds the frame whole in the producer AND the caller, and a grid of tiles paid that for every tile. Kept for one release for callers that cannot fetch a URL.
The annotation canvas needs the image and its exact dimensions in the same answer: a canvas that places a normalised box against a size it guessed draws every box in the wrong place.
Input
| Field | Type | Required | Description |
|---|---|---|---|
frameId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
base64 | string | yes | |
width | number | yes | |
height | number | yes |
proposeRetrainAnnotations
mutation
Ask the pipeline what it sees, as a PROPOSAL.
Runs through pipelineRunner.runStatelessStep on the COPIED frame, and every box comes back as a draft with source: 'assist' plus the model and score that produced it. The operator confirms, edits, adds and deletes; nothing is stored until saveRetrainAnnotations.
For packages the request is rfdetr-package on the ZONE CROP at 0.35 — never the whole frame, where a package detector at that threshold proposes furniture. A package request with no zone is REFUSED rather than widened, because the silent widening would look like a bad model for as long as nobody checked which rectangle it ran on.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | no | The frame's track, when it has one — checked against the frame. |
frameId | string | yes | |
subject | { kind: "package"; zone?: { x: number; y: number; w: number; h: number } } | { kind: "objects"; modelId: string; minScore?: number } | yes | |
nodeId | string | no | Which node runs it. Absent ⇒ wherever an unowned call lands. |
Output
The assist's answer — a discriminated union, because "the model saw nothing" and "this node cannot run that model" lead to different next moves and a nullable result cannot tell them apart.
{ kind: "proposed"; modelId: string; stepId: string; minScore: number; proposals: ({ bbox: {…}; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; subLabel?: string; kind: "subjec…
listRetrainAnnotations
query
Every annotation on a track, or on named frames (a recording still has no track), oldest first. One of the two is required.
Input
| Field | Type | Required | Description |
|---|---|---|---|
trackId | string | no | |
frameIds | string[] | no |
Output
({ id: string; trackId?: string; deviceId: number; mediaKey: string; bbox: { x: number; y: number; w: number; h: number }; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; subLa…
saveRetrainAnnotations
mutation
Replace EVERY annotation on one frame with the supplied set.
Whole-frame replacement, not per-box upsert: the unit of ground truth is the frame, and "the operator deleted a box" must be the same durable outcome as "the operator never drew it". A per-box patch would let a frame keep a box the operator removed on a surface that only knew about the boxes it sent.
Refuses a macro class typed into label or subLabel — the tiers are separate and the guard is at the WRITE, because a mixed taxonomy cannot be un-mixed by reading it.
ATOMIC and REVISIONED: the replaced rows, the frame's dismissed set and its revision move in one transaction, guarded by the revision the caller saw. A stale expectedRevision writes nothing and throws retrain-revision-conflict (parse it with parseRetrainRevisionConflict); the UI and an MCP agent no longer overwrite each other silently.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | no | The frame's track, when it has one — checked against the frame. |
frameId | string | yes | |
annotations | ({ bbox: { x: number; y: number; w: number; h: number }; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; subLabel?: string; kind: "subject" | "model_error"; source: "operator" … | yes | |
expectedRevision | number | no | The frame's revision the caller saw. A different current revision refuses the save with a retrain-revision-conflict error (parseRetrainRevisionConflict). Absent ⇒ last write wins. |
dismissed | ({ ref: string; snapshot: { source: "operator" | "assist" | "pipeline" | "llm"; ref: string; bbox: {…}; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; score?: number; modelId?… | no | The proposals the operator deleted. Absent ⇒ keep the frame's current set; present ⇒ replace it (an empty array un-dismisses). |
Output
({ id: string; trackId?: string; deviceId: number; mediaKey: string; bbox: { x: number; y: number; w: number; h: number }; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; subLa…
backfillRetrainOrigins
mutation
Give annotations saved BEFORE origins existed the origin a caller reconstructed for them (the MCP track_review_backfill_origin tool matches each row to the pipeline box it equals).
Writes origin and nothing else: ids, creation time and the export stamp are untouched (a re-save through saveRetrainAnnotations would reset all three). A row that already has an origin is SKIPPED — a snapshot taken at accept time is evidence, a reconstruction is a guess. Atomic and revision-guarded like the save; bumps the frame's revision.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | no | |
frameId | string | yes | |
expectedRevision | number | no | |
origins | ({ annotationId: string; origin: { source: "operator" | "assist" | "pipeline" | "llm"; ref: string; bbox: {…}; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; score?: number; m… | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
updated | number | yes | |
skipped | number | yes | |
revision | number | yes |
completeRetrainTrack
mutation
Refuses a track the dataset holds no copies from.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes |
Output
The outcome of a lifecycle move owned by the retrain page.
| Field | Type | Required | Description |
|---|---|---|---|
trackId | string | yes | |
retrainStatus | "none" | "staging" | "trained" | yes | Where the track ended up, whatever happened. |
changed | boolean | yes | false ⇒ the move was refused or was a no-op; reason says which. |
reason | "unknown-track" | "no-frames-copied" | "not-staging" | "not-trained" | "unchanged" | no |
restageRetrainTrack
mutation
The deliberate return: trained → staging, for the rare case.
The generic setTrackFlags toggle refuses this in both directions by design — re-staging from a checkbox is how the same material gets annotated twice under two ground truths. Doing it here means the operator is looking at the annotations that already exist while they decide, and those annotations are LEFT ALONE: "put this back" must not be a destructive act wearing a navigational name.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes |
Output
The outcome of a lifecycle move owned by the retrain page.
| Field | Type | Required | Description |
|---|---|---|---|
trackId | string | yes | |
retrainStatus | "none" | "staging" | "trained" | yes | Where the track ended up, whatever happened. |
changed | boolean | yes | false ⇒ the move was refused or was a no-op; reason says which. |
reason | "unknown-track" | "no-frames-copied" | "not-staging" | "not-trained" | "unchanged" | no |
getRetrainExportUrl
query
Where to download the ANNOTATED dataset.
The sibling of getTrainingExportUrl and deliberately not the same archive: that one streams a marked track's stored media verbatim, this one streams the retrain COPIES plus an annotations.json carrying, for every subject, the canonical full-frame box AND the geometry derived for each model shape (letterboxed root / zone-cropped package / subject-cropped classifier). Derived at export, never stored — one box in, three shapes out, so two crops of the same subject can never end up in one feature space.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceIds | number[] | no | |
frameIds | string[] | no | |
collectionIds | string[] | no | |
collectionId | string | no | |
batchId | string | no | |
completeOnly | boolean | no | |
workState | "unannotated" | "annotated" | "complete" | no | |
classes | ("person" | "vehicle" | "animal" | "package" | "face" | "plate")[] | no | |
layout | "frames" | "crops" | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
url | string | yes |
setRetrainFrameComplete
mutation
The operator's "every subject in this frame is boxed" — set and cleared by hand, never derived: a frame with no box may be a complete hard negative, and a frame with three boxes may still miss a fourth person.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | no | |
frameId | string | yes | |
complete | boolean | yes |
Output
A frame the dataset OWNS: bytes copied at selection time.
| Field | Type | Required | Description |
|---|---|---|---|
frameId | string | yes | |
deviceId | number | yes | |
origin | "track" | "recording" | yes | |
trackId | string | no | The track it was copied from. Absent on a recording still. |
sourceMediaId | number | no | Provenance only. It may already point at nothing — that is expected. Absent on a recording still. |
epochMs | number | no | A recording still: the playhead instant it was taken at. |
sourceKind | "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" | "debugCrop" | "sceneFram… | yes | |
sizeBytes | number | yes | |
width | number | yes | |
height | number | yes | |
copiedAt | number | yes | |
capturedAt | number | no | When the CAMERA captured the frame. |
complete | boolean | yes | The operator's "every subject in this frame is boxed". Detector evaluation keeps only complete frames: an unboxed subject would count as a false positive. |
pipelineBoxes | ({ bbox: { x: number; y: number; w: number; h: number }; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; subLabel?: string; score?: number; modelId?: string; trackId: string; b… | no | The boxes the pipeline drew on this frame. Present on list answers; empty when nothing the track store holds can be placed on it. |
collectionIds | string[] | no | The named collections this frame belongs to. Present on list answers. |
verdict | { verdict: "correct" | "wrong" | "wrong-label"; suggestedClass?: string; suggestedMacroClass?: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; suggestedLabel?: string; trackId: string; at?: number } | no | The notification verdict about this frame's subject: its track's, or — on a recording still landed by a verdict — the one frozen with the still. |
revision | number | no | Bumped by every annotation save. A save that names a stale expectedRevision is refused, so two surfaces cannot overwrite each other. |
dismissed | ({ ref: string; snapshot: { source: "operator" | "assist" | "pipeline" | "llm"; ref: string; bbox: {…}; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; score?: number; modelId?… | no | Proposals the operator deleted — never re-seeded as drafts. |
review | { boxes: ({ ref: string; savedId?: string; status: "unchanged" | "adjusted" | "reclassified" | "added" | "removed" | "model-error"; approximate: boolean; origin?: RetrainOriginSchema; macroClass?: "person" | "vehicle" | … | no | What the operator did with the proposals, computed by the server. |
imageUrl | string | no | The frame's pixels over the admin data plane (full size). Fetch with the admin bearer token; relative to the hub root. |
thumbnailUrl | string | no | The same, as a ~480 px thumbnail for grids. |
writeRetrainArchive
mutation
Stream the annotated archive to a TARGET instead of a browser — the same tar getRetrainExportUrl serves (manifest first, one JPEG in memory at a time, paced), written chunk by chunk into one HTTP request. The bytes never cross this cap and never land on the hub's disk; the answer is what was sent, with its sha256.
Input
| Field | Type | Required | Description |
|---|---|---|---|
filter | { deviceIds?: number[]; frameIds?: string[]; collectionIds?: string[]; collectionId?: string; batchId?: string; completeOnly?: boolean; workState?: "unannotated" | "annotated" | "complete"; classes?: ("person" | "vehicle… | yes | |
layout | "frames" | "crops" | yes | |
target | { kind: "http"; method: "PUT" | "POST"; url: string; headers?: Record<string, string> } | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
batchId | string | yes | |
frames | number | yes | |
crops | number | yes | |
annotations | number | yes | |
missing | number | yes | Frames planned but not shipped (unreadable copy, path too long). |
bytes | number | yes | |
sha256 | string | yes | sha256 of the exact bytes sent. |
status | number | yes | The target's HTTP status. |
offerRetrainArchive
mutation
OFFER the annotated archive instead of pushing it: the same tar writeRetrainArchive streams, behind a one-shot ctx.peerBytes ticket the caller dials at once (same host). For a consumer that cannot expose an upload URL — a training provider streaming straight into its cloud. The answer is the plan; the bytes and their sha256 are the consumer's to measure as they arrive.
Input
| Field | Type | Required | Description |
|---|---|---|---|
filter | { deviceIds?: number[]; frameIds?: string[]; collectionIds?: string[]; collectionId?: string; batchId?: string; completeOnly?: boolean; workState?: "unannotated" | "annotated" | "complete"; classes?: ("person" | "vehicle… | yes | |
layout | "frames" | "crops" | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
ticket | { url: string; hostNodeId: string; expiresAtMs: number; declaredBytes: number | null } | yes | |
frames | number | yes | |
annotations | number | yes |
listRetrainAssistProfiles
query
── AI-vision pre-annotation ─────────────────────────────────── The enabled, vision-capable LLM profiles, each saying whether a frame sent to it leaves the house.
Input
No fields.
Output
({ id: string; name: string; model: string; kind: string; leavesHouse: boolean })[]
proposeRetrainAnnotationsWithLlm
mutation
Ask a vision LLM (the llm capability) about ONE copied frame: list the objects of classes with boxes, and review the boxes already on the canvas (sent by ref). Answers drafts (source: 'llm') and reviews — nothing is stored, nothing is accepted. A profile that sends the frame outside the house is refused unless allowCloud says the operator confirmed this run.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | no | |
frameId | string | yes | |
profileId | string | yes | |
classes | ("person" | "vehicle" | "animal" | "package" | "face" | "plate")[] | yes | |
boxes | ({ ref: string; bbox: { x: number; y: number; w: number; h: number }; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string })[] | yes | |
allowCloud | boolean | yes |
Output
The AI assist's answer. proposed carries drafts (source: 'llm', the model and its confidence) and reviews; items the model got wrong (a box off the frame, an unasked class, an unknown ref) are dropped and counted in rejected. A whole answer that is not the schema is malformed-answer.
{ kind: "proposed"; profileId: string; model: string; leftHouse: boolean; proposals: ({ bbox: {…}; macroClass: "person" | "vehicle" | "animal" | "package" | "face" | "plate"; label?: string; subLabel?: string; kind: "sub…
createRetrainCollection
mutation
── Named training collections ─────────────────────────────────
Create a named collection — a set over the retrain corpus ("packages porch night"). Names are unique case-insensitively and never empty; both refusals are named.
Input
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes |
Output
{ kind: "created"; collection: { id: string; name: string; createdAt: number; frameCount: number } } | { kind: "refused"; reason: "empty-name" | "duplicate-name" }
listRetrainCollections
query
Every collection, newest first, with its frame count.
Input
No fields.
Output
({ id: string; name: string; createdAt: number; frameCount: number })[]
resolveRetrainTrainingCorpus
query
Resolve a live training corpus selection to frame ids + stats (index reads only). Same plan the annotated export builds — training plan/start calls this instead of a frozen dataset version.
Input
| Field | Type | Required | Description |
|---|---|---|---|
collectionIds | string[] | yes | |
workState | "complete" | "annotated_or_complete" | "any_annotated" | no (default "complete") |
Output
{ kind: "resolved"; frameIds: string[]; stats: { frames: number; completeFrames: number; completeness: number; subjects: number; modelErrors: number; hardNegatives: number; cells: {…}[]; cameras: {…}[] }; annotationHash:…
renameRetrainCollection
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
name | string | yes |
Output
{ kind: "renamed"; collection: { id: string; name: string; createdAt: number; frameCount: number } } | { kind: "refused"; reason: "empty-name" | "duplicate-name" | "unknown-collection" }
deleteRetrainCollection
mutation
Delete a collection. Its recording stills that no other collection holds are deleted with their annotations (nothing else reaches them); frames copied from tracks always stay in the dataset.
Input
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
deleted | boolean | yes | |
removedFrames | number | yes |
addRetrainFrameFromRecording
mutation
Add the frame at a recording instant to a collection — the frame the model may have seen NOTHING in. The recorder re-decodes the native frame at epochMs; the dataset copies it (trackless, durable). The same moment twice is one copy. Every refusal is named.
Input
| Field | Type | Required | Description |
|---|---|---|---|
collectionId | string | yes | |
deviceId | number | yes | |
epochMs | number | yes | |
verdictSubject | { trackId: string; className: string; label?: string; bbox?: { x: number; y: number; w: number; h: number }; verdict: "correct" | "wrong" | "wrong-label"; suggestedClass?: string; at?: number } | no | The notified subject, when a verdict landed this still: stored as the frame's own subject proposal so neighbours stay secondary. |
Output
The outcome of adding the frame at a recording instant. Every refusal is named: still-unavailable (not recording, a gap, or an undecodable frame — detail says which), still-busy (the recorder is at its decode bound; try again), unreadable-image, write-failed, unknown-collection.
{ kind: "added"; collectionId: string; frame: { frameId: string; deviceId: number; origin: "track" | "recording"; trackId?: string; sourceMediaId?: number; epochMs?: number; sourceKind: "crop" | "thumbnail" | "snapshot" …
addRetrainFramesToCollection
mutation
Add frames already in the dataset to a collection.
Input
| Field | Type | Required | Description |
|---|---|---|---|
collectionId | string | yes | |
frameIds | string[] | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
added | number | yes | |
alreadyMember | number | yes | |
unknownFrameIds | string[] | yes |
removeRetrainFrameFromCollection
mutation
Remove a frame from a collection. A recording still left in no collection is deleted with its annotations (deletedFrame).
Input
| Field | Type | Required | Description |
|---|---|---|---|
collectionId | string | yes | |
frameId | string | yes |
Output
| Field | Type | Required | Description |
|---|---|---|---|
removed | boolean | yes | |
deletedFrame | boolean | yes |
listRetrainCollectionFrames
query
The frames of a collection, with their pipeline boxes.
Input
| Field | Type | Required | Description |
|---|---|---|---|
collectionId | string | yes |
Output
({ frameId: string; deviceId: number; origin: "track" | "recording"; trackId?: string; sourceMediaId?: number; epochMs?: number; sourceKind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | …
getEventMedia
query
── Media ───────────────────────────────────────────────── deviceId on these three is the AUTHORIZATION subject, not a filter: the scope matcher can only gate what it can see, and a bare trackId / eventId names no device — so without it a device-scoped principal failed closed on every thumbnail (2026-08-15, the "bob sees no track media" report). Optional for back-compat with older clients (their admins bypass the matcher anyway); the provider CROSS-CHECKS it against the track/event's true device and answers empty on a mismatch, so declaring a camera you own never launders another camera's media.
The media an EVENT owns.
ownerType is REQUIRED, and that is the whole correction. This method took a bare eventId and the provider probed motion → object → audio, stopping at the first hit — so on the live hub, where object events own no media of their own and 299 883 of 300 559 media rows are motion-owned, EVERY object event resolved to its motion namesake. A track from 17:34 on camera 101 was served a snapshot from 22:35 eleven days earlier, silently.
Naming the table is not a "qualification" of the ambiguity — a listing BY OWNER has no address to make surrogate: the owner IS (table, id), and half of it is not a question.
Input
| Field | Type | Required | Description |
|---|---|---|---|
ownerType | "motion" | "object" | "audio" | yes | Which of the three event tables owns the row. |
eventId | number | yes | The event's rowid in that table. |
kind | "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" | "debugCrop" | "sceneFram… | no | |
deviceId | number | yes | REQUIRED: it is the authorization subject the scope matcher gates on — an id-only media endpoint would be ungateable, and an optional one would keep an unscoped fast lane open. |
Output
({ mediaId: number; kind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" …
getTrackMedia
query
All media rows owned by a track. kinds narrows to a kind subset so a client can fetch the SMALL display variants on open and pull the multi-MB native variants only on demand (mirrors getEventMedia.kind). Absent ⇒ every kind (back-compat).
Input
| Field | Type | Required | Description |
|---|---|---|---|
trackId | string | yes | |
kinds | ("crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" | "debugCrop" | "sceneFra… | no | |
deviceId | number | yes |
Output
({ mediaId: number; kind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" …
listTrackMedia
query
What media a track HAS, without any of it.
The detail view needs the shape of a track's media to build its strip — which kinds exist, in what order, at what size — and then wants each tile fetched as an image, not as base64 inside this response. Measured: the full getTrackMedia is 5.3-7.7 MB and blocks the view; this manifest is ~2 KB.
It also restores a fact a kinds filter destroys: filtering getTrackMedia drops whole ROWS, taking kind and sizeBytes with them, so a client that fetched only the small variants could no longer tell a full-resolution variant existed — and the affordance that opens it would silently disappear.
Input
| Field | Type | Required | Description |
|---|---|---|---|
trackId | string | yes | |
deviceId | number | yes |
Output
({ mediaId: number; kind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" …
listEventMedia
query
What media an EVENT has, without any of it — the twin getEventMedia never had.
listTrackMedia above got this treatment because a track's media is 5-8 MB. An event's is worse per row, not better: an old-style event owns a crop AND a native-resolution fullFrameBoxed, and the track DETAIL modal — the one surface that legitimately shows the big kinds — unions both listings to build its filmstrip. It then renders every tile from the event-media plane by key and throws the bytes away. Measured on the live hub: one event's fullFrameBoxed is 2 824 077 B, base64'd to ~3.8 MB, allocated whole in hub-main's heap, for a list of keys.
Same deviceId authorization subject as getEventMedia, the same REQUIRED ownerType, and the same rows: this is a projection of that method, never a different question.
Input
| Field | Type | Required | Description |
|---|---|---|---|
ownerType | "motion" | "object" | "audio" | yes | |
eventId | number | yes | |
deviceId | number | yes |
Output
({ mediaId: number; kind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" …
ownersWithMedia
query
Which of ownerIds hold at least ONE media row — an INDEX read, never a blob read, and the LICENCE videoclips needs to publish a thumbnail.
The event-media URL is stamped from a template for every event in the system, so "the plane is up" was being served as "there are bytes": 64 of one camera's 179 clips pointed at a 404 (device 3836, 2026-08-17). This is the question that turns the stamp into a claim.
One call per OWNER KIND, never one per owner: that N+1 is what MediaStore.ownersWithMedia was written to prevent, and crossing a process boundary makes it worse, not better. ownerIds is bounded at the same 5 000 the annotation fetch is bounded at, so one pathological camera-day cannot mint an unbounded request.
THROWS rather than answering partially. A probe that quietly under-reports reads as "these owners have nothing" and the caller drops thumbnails that exist — the opposite failure to the one above, and equally invisible.
deviceId is the authorization subject, exactly as on getEventMedia.
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
ownerKind | "motion" | "object" | "audio" | "track" | yes | |
ownerIds | string[] | yes |
Output
string[]
searchObjectEvents
query
── CLIP semantic text search ─────────────────────────────────
Search object events by text query using CLIP cosine similarity. Encodes text via the embedding-encoder cap, queries the ObjectEmbeddingStore with optional prefilters, ranks all matching embeddings by cosine similarity, and joins winners to their ObjectEvents by trackId. Returns up to limit events scored ≥ minScore, sorted descending by score.
caller: 'required': a modelId that differs from the cluster row is an ADMIN override (the cutover comparison). A share link or a viewer session naming another model is refused by name (model-override-requires-admin), never silently re-pointed.
Input
| Field | Type | Required | Description |
|---|---|---|---|
text | string | yes | |
deviceId | number | no | |
since | number | no | |
until | number | no | |
classFilter | string | no | |
limit | number | no (default 50) | |
minScore | number | no | |
strictness | "loose" | "balanced" | "strict" | no | |
modelId | string | no |
Output
({ id: number; deviceId: number; timestamp: number; kind: "object"; source?: "pipeline" | "onboard"; frameId?: string; idempotencyKey?: string; trackId?: string; className: string; label?: string; labelScore?: number; la…
wipeObjectEmbeddings
mutation
z.object({}), not z.void(): these two are also reachable through the addons.custom bridge, whose envelope always carries an input field. A void input makes them resolve and then reject every call with "expected void, received object" — verified on the live hub.
Input
No fields.
Output
| Field | Type | Required | Description |
|---|---|---|---|
deleted | number | yes | |
failedIndexes | string[] | no |
rebuildObjectEmbeddings
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | no | |
since | number | no | |
until | number | no | |
maxTracks | number | no | |
executeOnNodeId | string | no | |
pacingMs | number | no | |
force | boolean | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
started | boolean | yes | |
alreadyRunning | boolean | yes | |
refusal | "stores-unavailable" | "owner-not-ready" | "store-read-failed" | "three-way-read-unavailable" | "invalid-stored" | "not-cluster-scoped" | "method-unavailable" | "read-failed" | "reads-disagree" | "not-a-clip-model" | "fo… | no | |
modelId | string | no | |
index | string | no |
getObjectEmbeddingRebuildStatus
query
Input
No fields.
Output
| Field | Type | Required | Description |
|---|---|---|---|
running | boolean | yes | |
scanned | number | yes | |
rebuilt | number | yes | |
missingKeyFrame | number | yes | |
missingEvent | number | yes | |
missingBbox | number | yes | |
boxSource | { subjectBox: number; positions: number; event: number; refused: number } | yes | |
alreadyInSpace | number | yes | |
force | boolean | null | yes | |
forcedInSpace | number | yes | |
notRunnable | number | yes | |
noCapableNode | number | yes | |
failed | number | yes | |
complete | boolean | null | yes | |
startedAtMs | number | null | yes | |
finishedAtMs | number | null | yes | |
error | string | null | yes | |
modelId | string | null | yes | |
index | string | null | yes |
Events
onFrameTracked
Enriched frame emitted after refinement — the live-overlay source of truth (two-plane re-injection). Carries the frame's detections in the ObjectDetection wire shape: first-level roots (with track info + enrichment labels) plus synthesized kind:'detail' face/plate entries re-projected from per-track detail state, so stream overlays render boxes + recognized names without querying full Track state.
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
timestamp | number | yes | |
frameWidth | number | yes | |
frameHeight | number | yes | |
detections | ({ id: string; kind: "first-level" | "detail"; macroClass: string; score: number; bbox: { x: number; y: number; width: number; height: number }; labels: ({ label: string; score: number })[]; parentId?: string })[] | yes |
onTrackStarted
Track entered active state (first-seen).
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes | |
className | string | yes |
onTrackEnded
Track expired (TTL reached after last detection).
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
trackId | string | yes | |
className | string | yes | |
durationMs | number | yes |
onDetectionEvent
Canonical "something happened at device X" event, per-kind.
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
kind | "motion" | "object" | "audio" | yes | |
eventId | string | yes | |
timestamp | number | yes |