Dominevo
ReferenceDevice capabilities

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

Capabilitypipeline-analytics
Provided byAn 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 deviceone
Device typescamera
Sourcepackages/types/src/capabilities/pipeline-analytics.cap.ts

Methods

MethodKindRequired of a providerAccess
getActiveTracksqueryyesdefault
getTrackqueryyesdefault
listTracksqueryyesdefault
listRecentTracksqueryyesdefault
clearTracksmutationyesadmin
getMotionEventsqueryyesdefault
getObjectEventsqueryyesdefault
getAudioEventsqueryyesdefault
listEventKindsqueryyesdefault
listEventKindsBatchqueryyesdefault
getSensorEventsqueryyesdefault
getKeyEventsqueryyesdefault
getKeyEventsBatchqueryyesdefault
readLongTermSeriesqueryyesdefault
getEventDensityqueryyesdefault
getEventDensityBatchqueryyesdefault
pruneEventsBeforemutationyesadmin
pruneTracksBeforemutationyesadmin
wipeAllAnalyticsmutationyesadmin
reconcileFromDiskmutationyesadmin
deleteTracksmutationyesadmin
setTrackFlagsmutationyesdefault
listArchivedDebugNotesqueryyesdefault
setTrackRelationmutationyesdefault
clearTrackRelationmutationyesdefault
setTrackPuritymutationyesdefault
listTrackRelationsqueryyesdefault
listBirthDecisionsqueryyesdefault
getEventStoreFootprintqueryyesadmin
getEventMediaFootprintByKindqueryyesadmin
pruneEventsmutationyesadmin
deleteDeviceEventsmutationyesadmin
pauseForStorageMigrationmutationyesadmin
resumeForStorageMigrationmutationyesadmin
refreshStorageLocationsForMigrationmutationyesadmin
startStorageMigrationMovemutationyesadmin
getStorageMigrationMoveStatusqueryyesadmin
cancelStorageMigrationMovemutationyesadmin
relocateMediamutationyesadmin
countUnstampedEventMediaqueryyesadmin
getMediaLocationCensusqueryyesadmin
countRelocatableMediaqueryyesadmin
listRelocateMediaJobsqueryyesadmin
cancelRelocateMediamutationyesadmin
listOpsLogqueryyesadmin
reclaimDebugMediamutationyesadmin
getMediaReclaimStatusqueryyesadmin
getTrainingExportSummaryqueryyesadmin
getTrainingExportUrlqueryyesadmin
listRetrainStagingqueryyesadmin
listRetrainCorpusPagequeryyesadmin
getRetrainCorpusKpiqueryyesadmin
listRetrainFramesqueryyesadmin
selectRetrainFramesmutationyesadmin
deselectRetrainFramemutationyesadmin
getRetrainFrameImagequeryyesadmin
proposeRetrainAnnotationsmutationyesadmin
listRetrainAnnotationsqueryyesadmin
saveRetrainAnnotationsmutationyesadmin
backfillRetrainOriginsmutationyesadmin
completeRetrainTrackmutationyesadmin
restageRetrainTrackmutationyesadmin
getRetrainExportUrlqueryyesadmin
setRetrainFrameCompletemutationyesadmin
writeRetrainArchivemutationyesadmin
offerRetrainArchivemutationyesadmin
listRetrainAssistProfilesqueryyesadmin
proposeRetrainAnnotationsWithLlmmutationyesadmin
createRetrainCollectionmutationyesadmin
listRetrainCollectionsqueryyesadmin
resolveRetrainTrainingCorpusqueryyesadmin
renameRetrainCollectionmutationyesadmin
deleteRetrainCollectionmutationyesadmin
addRetrainFrameFromRecordingmutationyesadmin
addRetrainFramesToCollectionmutationyesadmin
removeRetrainFrameFromCollectionmutationyesadmin
listRetrainCollectionFramesqueryyesadmin
getEventMediaqueryyesdefault
getTrackMediaqueryyesdefault
listTrackMediaqueryyesdefault
listEventMediaqueryyesdefault
ownersWithMediaqueryyesdefault
searchObjectEventsqueryyesdefault
wipeObjectEmbeddingsmutationyesadmin
rebuildObjectEmbeddingsmutationyesadmin
getObjectEmbeddingRebuildStatusqueryyesdefault

getActiveTracks

query

── Tracks ────────────────────────────────────────────────

Input

FieldTypeRequiredDescription
deviceIdnumberyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes

Output

FieldTypeRequiredDescription
trackIdstringyes
deviceIdnumberyes
classNamestringyes
labelstringno
labelScorenumberno
labelMeta{ stepId: string; modelId?: string; decidedAt: number; identityId?: string }no
subLabelstringno
subLabelScorenumberno
subLabelMeta{ stepId: string; modelId?: string; decidedAt: number; identityId?: string }no
producingDeviceNamestringno
source"pipeline" | "onboard" | "sensor" | "audio"no
firstSeennumberyes
lastSeennumberyes
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
zonesVisitedstring[]yes
zoneNamesstring[]no
classesstring[]no
totalDistancenumberyes
state"new" | "entered" | "left" | "moving" | "idle"yes
activebooleanyes
importancenumberno
bestEventIdstringno
importanceReasonstringno
audioLabels({ label: string; peakScore: number; count: number; firstAt: number; lastAt: number })[]no
envelope{ minX: number; minY: number; maxX: number; maxY: number }no
hasFacebooleanno
hasEmbeddedFacebooleanno
hasRiderbooleanno
previewMissReasonstringno
modelIdstringno
openedPlacement{ nodeId: string; deviceKey?: string; modelId?: string }no
closedPlacement{ nodeId: string; deviceKey?: string; modelId?: string }no
frameWidthnumberno
frameHeightnumberno
markForTrainbooleanno
debugbooleanno
debugNotestringno
favouritedbooleanno
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

FieldTypeRequiredDescription
deviceIdnumberyes
sincenumberno
untilnumberno
limitnumberno
zone{ kind: "rect"; x: number; y: number; width: number; height: number } | { kind: "polygon"; points: ({ x: number; y: number })[] }noSpatial 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"noSee { compatible — omitting the field keeps today's exact behaviour).
includeStationarybooleannoInclude stationary-promoted rows (parked objects handed to the stationary registry). Default false: the timeline lists passages, not parking records (operator decision, 2026-08-15).
classesstring[]noRestrict 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")[]noSee {

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

FieldTypeRequiredDescription
deviceIdsnumber[]yesDevices to merge. An empty array yields { tracks: [], nextCursor: null }.
sincenumbernoWindow lower bound on lastSeen (inclusive).
untilnumbernoWindow upper bound on lastSeen (inclusive).
limitnumberno (default 200)Page size. Default 200, max 1000.
cursorstringnoOpaque continuation cursor from a previous page's nextCursor. Encodes the (lastSeen, trackId) sort position — treat as opaque.
projection"full" | "slim"noSee {
includeStationarybooleannoInclude stationary-promoted rows (parked objects). Default false: the feed lists passages; parking records live on the stationary registry.
classesstring[]noRestrict 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")[]noSee {

Output

FieldTypeRequiredDescription
tracks({ trackId: string; deviceId: number; className: string; label?: string; labelScore?: number; labelMeta?: { stepId: string; modelId?: string; decidedAt: number; identityId?: string }; subLabel?: string; subLabelScore?: n…yesMerged page, ordered by (lastSeen DESC, trackId DESC).
nextCursorstring | nullyesCursor for the next page, or null when this page is the last.

clearTracks

mutation

Input

FieldTypeRequiredDescription
deviceIdnumberyes

Output

Nothing.

getMotionEvents

query

── Events (per-kind, parallel-queryable) ─────────────────

Input

FieldTypeRequiredDescription
deviceIdnumberyes
sincenumberno
untilnumberno
limitnumberno (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

FieldTypeRequiredDescription
deviceIdnumberyes
sincenumberno
untilnumberno
limitnumberno (default 1000)
projection"full" | "slim"no
classFilterstringno

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

FieldTypeRequiredDescription
deviceIdnumberyes
sincenumberno
untilnumberno
limitnumberno (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

FieldTypeRequiredDescription
deviceIdnumberyes

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

FieldTypeRequiredDescription
deviceIdsnumber[]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

FieldTypeRequiredDescription
deviceIdnumberyes
sincenumberno
untilnumberno
kindsstring[]no
limitnumberno (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

FieldTypeRequiredDescription
deviceIdnumberyes
sincenumberyes
untilnumberyes
limitnumberno (default 50)
minImportancenumberno
classFilterstringno

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

FieldTypeRequiredDescription
deviceIdsnumber[]yes
sincenumberyes
untilnumberyes
limitnumberno (default 50)
minImportancenumberno
classFilterstringno

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

FieldTypeRequiredDescription
deviceIdnumberyes
series"motion" | "audio-dbfs" | "battery" | "occupancy"yes
scopestringnoOmit for EVERY scope of this series in the range.
fromnumberyes
tonumberyes
limitnumberno

Output

({ scope: string; bucketStart: number; samples: number; sum: number; min: number; max: number })[]

getEventDensity

query

Input

FieldTypeRequiredDescription
deviceIdnumberyes
sincenumberyes
untilnumberyes
bucketMsnumberyes

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

FieldTypeRequiredDescription
deviceIdsnumber[]yes
sincenumberyes
untilnumberyes
bucketMsnumberyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
cutoffMsnumberyes

Output

FieldTypeRequiredDescription
motionnumberyes
objectnumberyes
audionumberyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
cutoffMsnumberyes

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.

FieldTypeRequiredDescription
tracksnumberyesPersisted track roots deleted (authoritative).
eventsnumberyesObject events removed with their tracks (best-effort; see note above).
medianumberyesTrack/face/plate-owned media removed (best-effort). Never identity media.
facesnumberyesUnassigned (non-enrolled) face reads removed (best-effort).
platesnumberyesUnassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence).
embeddingsnumberyesPer-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

FieldTypeRequiredDescription
deviceIdnumberyes

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.

FieldTypeRequiredDescription
tracksnumberyesPersisted track roots deleted (authoritative).
eventsnumberyesObject events removed with their tracks (best-effort; see note above).
medianumberyesTrack/face/plate-owned media removed (best-effort). Never identity media.
facesnumberyesUnassigned (non-enrolled) face reads removed (best-effort).
platesnumberyesUnassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence).
embeddingsnumberyesPer-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

FieldTypeRequiredDescription
deviceIdnumberyes

Output

FieldTypeRequiredDescription
mediaDroppednumberyes
tracksnumberyes
eventsnumberyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdsstring[]yes

Output

FieldTypeRequiredDescription
deletednumberyes
failedstring[]yes
sparedMediaIdsnumber[]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

FieldTypeRequiredDescription
deviceIdnumberyesLog/audit scope only — the trackId is globally unique on its own.
trackIdstringyes
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.

FieldTypeRequiredDescription
trackIdstringyes
markForTrainbooleanyes
debugbooleanyes
debugNotestringyesThe 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.
favouritedbooleanyes
retrainStatus"none" | "staging" | "trained"yesThe 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

FieldTypeRequiredDescription
deviceIdnumbernoRestrict to a single camera; omit for every row.
limitnumbernoMax 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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes
otherTrackIdstringyes
relation"same-subject" | "different-subjects"yes
presence"continuous"no
trackSide"before" | "after"no
otherSide"before" | "after"no

Output

FieldTypeRequiredDescription
idstringyes
deviceIdnumberyes
leftTrackIdstringyes
rightTrackIdstringyes
leftSide"before" | "after" | nullyes
rightSide"before" | "after" | nullyes
relation"same-subject" | "different-subjects"yes
presence"continuous" | nullyes
leftStartedAtnumber | nullyes
rightStartedAtnumber | nullyes
createdAtnumberyes
updatedAtnumberyes
authorstring | nullyes

clearTrackRelation

mutation

Remove the mark between two tracks.

Input

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes
otherTrackIdstringyes

Output

FieldTypeRequiredDescription
clearedbooleanyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes
purity"pure" | "mixed" | "not-a-subject"yes
switchAtMsnumberno

Output

null when pure cleared the row.

FieldTypeRequiredDescription
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 } | nullyes

listTrackRelations

query

A camera's marks, optionally one track's, windowed by track start.

Input

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringno
sincenumberno
untilnumberno
limitnumberno

Output

FieldTypeRequiredDescription
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
truncatedbooleanyes

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 firstSeen land (birthLatencyMs — read its error bars in BirthDecisionRecordSchema before quoting it).

Newest-first, capped by limit (default { one verdict, or a since. The table is bounded by row count, not age — see {

Input

FieldTypeRequiredDescription
deviceIdnumbernoRestrict to a single camera; omit for every row.
sincenumbernoOnly decisions at or after this epoch ms.
verdict"confirmed" | "suppressed" | "exhausted-fallback"noRestrict to one verdict — the miss rate is read one population at a time.
limitnumbernoMax 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

FieldTypeRequiredDescription
totalRowsnumberyes
totalBytesnumberyes
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

FieldTypeRequiredDescription
deviceIdnumberno

Output

FieldTypeRequiredDescription
totalRowsnumberyes
totalBytesnumberyes
kinds({ kind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" | "debugCrop" | "…yes
unaccountedRowsnumberyes
unaccountedBytesnumberyes

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

FieldTypeRequiredDescription
olderThanMsnumberyes
reason"retention" | "quota" | "manual" | "operator" | "maintenance" | "orphaned-device"no

Output

FieldTypeRequiredDescription
motionnumberyes
objectnumberyes
audionumberyes

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

FieldTypeRequiredDescription
deviceIdnumberyes

Output

FieldTypeRequiredDescription
motionnumberyes
objectnumberyes
audionumberyes

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

FieldTypeRequiredDescription
leaseIdstringyes

Output

FieldTypeRequiredDescription
pausedtrueyes

resumeForStorageMigration

mutation

Input

FieldTypeRequiredDescription
leaseIdstringyes

Output

FieldTypeRequiredDescription
resumedtrueyes

refreshStorageLocationsForMigration

mutation

Drops cached location roots after the storage coordinator repoints a default so future event-media writes use the new root.

Input

FieldTypeRequiredDescription
leaseIdstringyes

Output

FieldTypeRequiredDescription
refreshedtrueyes

startStorageMigrationMove

mutation

Input

FieldTypeRequiredDescription
toLocationIdstringyes
fromLocationIdstringno
throttleMbpsnumberno
mode"move" | "seal" | "gallery"no
leaseIdstringyes

Output

FieldTypeRequiredDescription
jobIdstringyes

getStorageMigrationMoveStatus

query

Input

FieldTypeRequiredDescription
jobIdstringyes

Output

FieldTypeRequiredDescription
jobIdstringyes
state"queued" | "running" | "done" | "failed" | "cancelled"yes
fromLocationIdstringyes
toLocationIdstringyes
deviceIdnumber | nullyes
entitiesstring[]yes
filesMovednumberyes
bytesMovednumberyes
filesTotalnumber | nullyes
rowsReconcilednumberno
rowsForgottennumberno
startedAtnumberyes
finishedAtnumber | nullyes
errorstring | nullyes

cancelStorageMigrationMove

mutation

Input

FieldTypeRequiredDescription
jobIdstringyes

Output

FieldTypeRequiredDescription
cancelledbooleanyes

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

FieldTypeRequiredDescription
toLocationIdstringyes
fromLocationIdstringnoRestrict 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.
throttleMbpsnumberno
mode"move" | "seal" | "gallery"noOmitted = move, the pre-existing behaviour.

Output

FieldTypeRequiredDescription
jobIdstringyes

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.

FieldTypeRequiredDescription
media{ present: boolean; rows: number | null }yes
retrainFrames{ present: boolean; rows: number | null }yes
anyPresentbooleanyesTrue when EITHER collection holds one. The refusal reads this.
totalnumber | nullyesSum 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

FieldTypeRequiredDescription
locationIdsstring[]yes

Output

FieldTypeRequiredDescription
locations({ locationId: string; rows: number; bytes: number })[]yes
unstamped{ rows: number; bytes: number }yes
unlisted{ rows: number; bytes: number }yesRows 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

FieldTypeRequiredDescription
toLocationIdstringyes
fromLocationIdstringnoRestrict the count to one source; omitted / '*' = every non-target row.
mode"move" | "seal" | "gallery"noOmitted = 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.

FieldTypeRequiredDescription
rowsnumberyes

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

FieldTypeRequiredDescription
jobIdstringyes

Output

FieldTypeRequiredDescription
cancelledbooleanyes

listOpsLog

query

Input

FieldTypeRequiredDescription
deviceIdnumbernoRestrict to a single camera; omit for every row.
limitnumbernoMax 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

FieldTypeRequiredDescription
mode"report" | "reclaim"no (default "report")
scopes("motion-still" | "track-filmstrip")[]no
deviceIdsnumber[]no
restartbooleanno
pageSizenumberno
maxRowsPerDevicenumberno
maxReclaimPerDevicenumberno
maxBytesPerRunnumberno
budgetMinutesnumberno
throttleBytesPerSecnumberno
graceMinutesnumberno

Output

FieldTypeRequiredDescription
startedbooleanyes
alreadyRunningbooleanyes

getMediaReclaimStatus

query

Input

No fields.

Output

FieldTypeRequiredDescription
runningbooleanyes
mode"report" | "reclaim" | nullyes
totalExaminednumberyes
totalEligiblenumberyes
totalReclaimednumberyes
totalBytesReclaimednumberyes
totalRefusednumberyes
devicesDonenumberyes
completeboolean | nullyes
startedAtMsnumber | nullyes
finishedAtMsnumber | nullyes
errorstring | nullyes

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

FieldTypeRequiredDescription
deviceIdsnumber[]no

Output

What a training export WOULD contain. Computed from media index rows only — no blob is read to produce this.

FieldTypeRequiredDescription
generatedAtnumberyes
trackCountnumberyes
fileCountnumberyes
byteCountnumberyes
truncatedbooleanyesMore 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

FieldTypeRequiredDescription
deviceIdsnumber[]no

Output

FieldTypeRequiredDescription
urlstringyes

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

FieldTypeRequiredDescription
deviceIdsnumber[]noEmpty ⇒ 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.
limitnumberno

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

FieldTypeRequiredDescription
workState"unannotated" | "annotated" | "complete"no
deviceIdsnumber[]no
collectionIdstringnoWhen set, only frames in this named collection.
classes("person" | "vehicle" | "animal" | "package" | "face" | "plate")[]noFrames that carry at least one saved annotation in one of these classes.
pagenumberno (default 1)
pageSizenumberno (default 50)

Output

FieldTypeRequiredDescription
frames({ frameId: string; deviceId: number; origin: "track" | "recording"; trackId?: string; sourceMediaId?: number; epochMs?: number; sourceKind: "crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | …yes
totalnumberyes
pagenumberyes
pageSizenumberyes

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

FieldTypeRequiredDescription
totalnumberyes
unannotatednumberyes
annotatednumberyes
completenumberyes
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

FieldTypeRequiredDescription
trackIdstringyes

Output

FieldTypeRequiredDescription
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
autoPickMediaIdnumbernoWhat 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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes
mediaIdsnumber[]yes

Output

FieldTypeRequiredDescription
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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringno
frameIdstringyes

Output

FieldTypeRequiredDescription
removedbooleanyes
removedAnnotationsnumberyes

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

FieldTypeRequiredDescription
frameIdstringyes

Output

FieldTypeRequiredDescription
base64stringyes
widthnumberyes
heightnumberyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringnoThe frame's track, when it has one — checked against the frame.
frameIdstringyes
subject{ kind: "package"; zone?: { x: number; y: number; w: number; h: number } } | { kind: "objects"; modelId: string; minScore?: number }yes
nodeIdstringnoWhich 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

FieldTypeRequiredDescription
trackIdstringno
frameIdsstring[]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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringnoThe frame's track, when it has one — checked against the frame.
frameIdstringyes
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
expectedRevisionnumbernoThe 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?…noThe 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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringno
frameIdstringyes
expectedRevisionnumberno
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

FieldTypeRequiredDescription
updatednumberyes
skippednumberyes
revisionnumberyes

completeRetrainTrack

mutation

Refuses a track the dataset holds no copies from.

Input

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes

Output

The outcome of a lifecycle move owned by the retrain page.

FieldTypeRequiredDescription
trackIdstringyes
retrainStatus"none" | "staging" | "trained"yesWhere the track ended up, whatever happened.
changedbooleanyesfalse ⇒ 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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes

Output

The outcome of a lifecycle move owned by the retrain page.

FieldTypeRequiredDescription
trackIdstringyes
retrainStatus"none" | "staging" | "trained"yesWhere the track ended up, whatever happened.
changedbooleanyesfalse ⇒ 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

FieldTypeRequiredDescription
deviceIdsnumber[]no
frameIdsstring[]no
collectionIdsstring[]no
collectionIdstringno
batchIdstringno
completeOnlybooleanno
workState"unannotated" | "annotated" | "complete"no
classes("person" | "vehicle" | "animal" | "package" | "face" | "plate")[]no
layout"frames" | "crops"no

Output

FieldTypeRequiredDescription
urlstringyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringno
frameIdstringyes
completebooleanyes

Output

A frame the dataset OWNS: bytes copied at selection time.

FieldTypeRequiredDescription
frameIdstringyes
deviceIdnumberyes
origin"track" | "recording"yes
trackIdstringnoThe track it was copied from. Absent on a recording still.
sourceMediaIdnumbernoProvenance only. It may already point at nothing — that is expected. Absent on a recording still.
epochMsnumbernoA 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
sizeBytesnumberyes
widthnumberyes
heightnumberyes
copiedAtnumberyes
capturedAtnumbernoWhen the CAMERA captured the frame.
completebooleanyesThe 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…noThe boxes the pipeline drew on this frame. Present on list answers; empty when nothing the track store holds can be placed on it.
collectionIdsstring[]noThe 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 }noThe 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.
revisionnumbernoBumped 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?…noProposals 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" | …noWhat the operator did with the proposals, computed by the server.
imageUrlstringnoThe frame's pixels over the admin data plane (full size). Fetch with the admin bearer token; relative to the hub root.
thumbnailUrlstringnoThe 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

FieldTypeRequiredDescription
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

FieldTypeRequiredDescription
batchIdstringyes
framesnumberyes
cropsnumberyes
annotationsnumberyes
missingnumberyesFrames planned but not shipped (unreadable copy, path too long).
bytesnumberyes
sha256stringyessha256 of the exact bytes sent.
statusnumberyesThe 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

FieldTypeRequiredDescription
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

FieldTypeRequiredDescription
ticket{ url: string; hostNodeId: string; expiresAtMs: number; declaredBytes: number | null }yes
framesnumberyes
annotationsnumberyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringno
frameIdstringyes
profileIdstringyes
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
allowCloudbooleanyes

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

FieldTypeRequiredDescription
namestringyes

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

FieldTypeRequiredDescription
collectionIdsstring[]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

FieldTypeRequiredDescription
idstringyes
namestringyes

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

FieldTypeRequiredDescription
idstringyes

Output

FieldTypeRequiredDescription
deletedbooleanyes
removedFramesnumberyes

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

FieldTypeRequiredDescription
collectionIdstringyes
deviceIdnumberyes
epochMsnumberyes
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 }noThe 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

FieldTypeRequiredDescription
collectionIdstringyes
frameIdsstring[]yes

Output

FieldTypeRequiredDescription
addednumberyes
alreadyMembernumberyes
unknownFrameIdsstring[]yes

removeRetrainFrameFromCollection

mutation

Remove a frame from a collection. A recording still left in no collection is deleted with its annotations (deletedFrame).

Input

FieldTypeRequiredDescription
collectionIdstringyes
frameIdstringyes

Output

FieldTypeRequiredDescription
removedbooleanyes
deletedFramebooleanyes

listRetrainCollectionFrames

query

The frames of a collection, with their pipeline boxes.

Input

FieldTypeRequiredDescription
collectionIdstringyes

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

FieldTypeRequiredDescription
ownerType"motion" | "object" | "audio"yesWhich of the three event tables owns the row.
eventIdnumberyesThe event's rowid in that table.
kind"crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" | "debugCrop" | "sceneFram…no
deviceIdnumberyesREQUIRED: 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

FieldTypeRequiredDescription
trackIdstringyes
kinds("crop" | "thumbnail" | "snapshot" | "firstFrame" | "lastFrame" | "fullFrame" | "fullFrameBoxed" | "faceCrop" | "plateCrop" | "keyFrame" | "keyFrameSmall" | "thumbnailSmall" | "confirmationCrop" | "debugCrop" | "sceneFra…no
deviceIdnumberyes

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

FieldTypeRequiredDescription
trackIdstringyes
deviceIdnumberyes

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

FieldTypeRequiredDescription
ownerType"motion" | "object" | "audio"yes
eventIdnumberyes
deviceIdnumberyes

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

FieldTypeRequiredDescription
deviceIdnumberyes
ownerKind"motion" | "object" | "audio" | "track"yes
ownerIdsstring[]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

FieldTypeRequiredDescription
textstringyes
deviceIdnumberno
sincenumberno
untilnumberno
classFilterstringno
limitnumberno (default 50)
minScorenumberno
strictness"loose" | "balanced" | "strict"no
modelIdstringno

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

FieldTypeRequiredDescription
deletednumberyes
failedIndexesstring[]no

rebuildObjectEmbeddings

mutation

Input

FieldTypeRequiredDescription
deviceIdnumberno
sincenumberno
untilnumberno
maxTracksnumberno
executeOnNodeIdstringno
pacingMsnumberno
forcebooleanno

Output

FieldTypeRequiredDescription
startedbooleanyes
alreadyRunningbooleanyes
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
modelIdstringno
indexstringno

getObjectEmbeddingRebuildStatus

query

Input

No fields.

Output

FieldTypeRequiredDescription
runningbooleanyes
scannednumberyes
rebuiltnumberyes
missingKeyFramenumberyes
missingEventnumberyes
missingBboxnumberyes
boxSource{ subjectBox: number; positions: number; event: number; refused: number }yes
alreadyInSpacenumberyes
forceboolean | nullyes
forcedInSpacenumberyes
notRunnablenumberyes
noCapableNodenumberyes
failednumberyes
completeboolean | nullyes
startedAtMsnumber | nullyes
finishedAtMsnumber | nullyes
errorstring | nullyes
modelIdstring | nullyes
indexstring | nullyes

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.

FieldTypeRequiredDescription
deviceIdnumberyes
timestampnumberyes
frameWidthnumberyes
frameHeightnumberyes
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).

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes
classNamestringyes

onTrackEnded

Track expired (TTL reached after last detection).

FieldTypeRequiredDescription
deviceIdnumberyes
trackIdstringyes
classNamestringyes
durationMsnumberyes

onDetectionEvent

Canonical "something happened at device X" event, per-kind.

FieldTypeRequiredDescription
deviceIdnumberyes
kind"motion" | "object" | "audio"yes
eventIdstringyes
timestampnumberyes

On this page

At a glanceMethodsgetActiveTracksgetTracklistTrackslistRecentTracksclearTracksgetMotionEventsgetObjectEventsgetAudioEventslistEventKindslistEventKindsBatchgetSensorEventsgetKeyEventsgetKeyEventsBatchreadLongTermSeriesgetEventDensitygetEventDensityBatchpruneEventsBeforepruneTracksBeforewipeAllAnalyticsreconcileFromDiskdeleteTrackssetTrackFlagslistArchivedDebugNotessetTrackRelationclearTrackRelationsetTrackPuritylistTrackRelationslistBirthDecisionsgetEventStoreFootprintgetEventMediaFootprintByKindpruneEventsdeleteDeviceEventspauseForStorageMigrationresumeForStorageMigrationrefreshStorageLocationsForMigrationstartStorageMigrationMovegetStorageMigrationMoveStatuscancelStorageMigrationMoverelocateMediacountUnstampedEventMediagetMediaLocationCensuscountRelocatableMedialistRelocateMediaJobscancelRelocateMedialistOpsLogreclaimDebugMediagetMediaReclaimStatusgetTrainingExportSummarygetTrainingExportUrllistRetrainStaginglistRetrainCorpusPagegetRetrainCorpusKpilistRetrainFramesselectRetrainFramesdeselectRetrainFramegetRetrainFrameImageproposeRetrainAnnotationslistRetrainAnnotationssaveRetrainAnnotationsbackfillRetrainOriginscompleteRetrainTrackrestageRetrainTrackgetRetrainExportUrlsetRetrainFrameCompletewriteRetrainArchiveofferRetrainArchivelistRetrainAssistProfilesproposeRetrainAnnotationsWithLlmcreateRetrainCollectionlistRetrainCollectionsresolveRetrainTrainingCorpusrenameRetrainCollectiondeleteRetrainCollectionaddRetrainFrameFromRecordingaddRetrainFramesToCollectionremoveRetrainFrameFromCollectionlistRetrainCollectionFramesgetEventMediagetTrackMedialistTrackMedialistEventMediaownersWithMediasearchObjectEventswipeObjectEmbeddingsrebuildObjectEmbeddingsgetObjectEmbeddingRebuildStatusEventsonFrameTrackedonTrackStartedonTrackEndedonDetectionEvent