@camstack/addon-pipeline 1.2.130 → 1.2.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{addon-utils-DH78p79i.js → addon-utils-DzCn6z7v.js} +1 -1
- package/dist/audio-analyzer/index.js +3 -3
- package/dist/audio-analyzer/index.mjs +2 -2
- package/dist/detection-pipeline/index.js +332 -20
- package/dist/detection-pipeline/index.mjs +330 -18
- package/dist/{dist-Wt81pN5Y.mjs → dist-BZYUUBUx.mjs} +1900 -1714
- package/dist/{dist-DOw-izoI.js → dist-DBP47QOz.js} +1900 -1714
- package/dist/{event-loop-stall-monitor-Bld7jNCb.js → event-loop-stall-monitor-CiH_MHfO.js} +1 -1
- package/dist/{event-loop-stall-monitor-CtQCOZqm.mjs → event-loop-stall-monitor-IACE22fK.mjs} +1 -1
- package/dist/{lazy-sharp-BbNI2ZD-.js → lazy-sharp-B_kETjyQ.js} +1 -1
- package/dist/motion-wasm/index.js +2 -2
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/pipeline-runner/index.js +4 -4
- package/dist/pipeline-runner/index.mjs +3 -3
- package/dist/{process-memory-1_D3EZT9.mjs → process-memory-C7rsraCR.mjs} +1 -1
- package/dist/{process-memory-D9H5qjDl.js → process-memory-CtXQAA3d.js} +1 -1
- package/dist/recorder/index.js +326 -17
- package/dist/recorder/index.mjs +325 -16
- package/dist/{segment-demux-js-BW-Q-j2A.mjs → segment-demux-js-BL1UDdiI.mjs} +1 -1
- package/dist/{segment-demux-js-C2jBBqGW.js → segment-demux-js-wTzFi5UW.js} +1 -1
- package/dist/session-decode/decode-worker-child.js +2 -2
- package/dist/session-decode/decode-worker-child.mjs +1 -1
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-Dw-iwP4y.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-DlKJZ-_M.mjs} +3 -3
- package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Bme2OZQp.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DXKTNEae.mjs} +1 -1
- package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-D36MoVV1.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BUw_aTfK.mjs} +1 -1
- package/dist/stream-broker/demux-worker-child.js +1 -1
- package/dist/stream-broker/demux-worker-child.mjs +1 -1
- package/dist/stream-broker/{hostInit-DEVCEYgu.mjs → hostInit-kDKgfUjp.mjs} +3 -3
- package/dist/stream-broker/index.js +2 -2
- package/dist/stream-broker/index.mjs +2 -2
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/dist/{worker-protocol-nAZl_Rsv.js → worker-protocol-C3zaz0Jv.js} +1 -1
- package/dist/{worker-protocol-rpnr7Ldd.mjs → worker-protocol-Cut8984B.mjs} +1 -1
- package/package.json +1 -1
|
@@ -17360,7 +17360,23 @@ var NcHistoryEntrySchema = object({
|
|
|
17360
17360
|
updatedAt: number(),
|
|
17361
17361
|
/** Failure detail — present on a `dead` row. */
|
|
17362
17362
|
error: string().optional(),
|
|
17363
|
-
subject: NcHistorySubjectSchema
|
|
17363
|
+
subject: NcHistorySubjectSchema,
|
|
17364
|
+
/**
|
|
17365
|
+
* Ids of the artefacts (still, then gif, then clip) this row's successful
|
|
17366
|
+
* delivery indexed in the artefact library — a REFERENCE, never the bytes
|
|
17367
|
+
* (an artefact is often megabytes; this row is durable JSON rewritten on
|
|
17368
|
+
* every delivery attempt). Absent on a row still pending/dead, a row
|
|
17369
|
+
* delivered before this field shipped, or a wiring with no artefact index.
|
|
17370
|
+
*
|
|
17371
|
+
* Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
|
|
17372
|
+
* outlives any one URL's TTL, so a caller mints a fresh link on demand
|
|
17373
|
+
* rather than trusting one frozen at delivery time. `resolveArtifactUrl`
|
|
17374
|
+
* also answers `null` for an id whose artefact has since expired past the
|
|
17375
|
+
* retained shelf's own age bound — the degrade a caller (the Home
|
|
17376
|
+
* Assistant export) must render as "no image right now", never as a
|
|
17377
|
+
* broken link.
|
|
17378
|
+
*/
|
|
17379
|
+
artifactIds: array(string().min(1)).optional()
|
|
17364
17380
|
});
|
|
17365
17381
|
/**
|
|
17366
17382
|
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
@@ -17587,7 +17603,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
17587
17603
|
}), method(object({}), object({
|
|
17588
17604
|
catalog: array(NcConditionDescriptorSchema),
|
|
17589
17605
|
taxonomy: NcTaxonomySchema.optional()
|
|
17590
|
-
})), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
17606
|
+
})), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
17591
17607
|
kind: "mutation",
|
|
17592
17608
|
caller: "required"
|
|
17593
17609
|
}), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
|
|
@@ -17927,1596 +17943,273 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
17927
17943
|
});
|
|
17928
17944
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
17929
17945
|
/**
|
|
17930
|
-
*
|
|
17931
|
-
*
|
|
17932
|
-
*
|
|
17933
|
-
* persisted media. Owns the post-detection domain end-to-end:
|
|
17934
|
-
*
|
|
17935
|
-
* runner emits PipelineInferenceResult
|
|
17936
|
-
* ↓ (event bus)
|
|
17937
|
-
* pipeline-analytics subscriber
|
|
17938
|
-
* ↓ SORT tracker + zone engine + state analyzer + event emitter
|
|
17939
|
-
* → three DB collections (one per kind), one FS media tree, one
|
|
17940
|
-
* unified event emitter (FrameTracked + TrackStarted/Ended +
|
|
17941
|
-
* DetectionEvent on bus)
|
|
17942
|
-
*
|
|
17943
|
-
* Pure subscriber model. No `processFrame` cap method — the runner
|
|
17944
|
-
* already publishes the raw frame on the bus. The cap surface is
|
|
17945
|
-
* only QUERIES + per-device settings, bound on/off via
|
|
17946
|
-
* `device-manager.setWrapperActive`. `defaultActive: true` because
|
|
17947
|
-
* every camera with a detection pipeline wants its raw detections
|
|
17948
|
-
* refined; operators opt out per-device via BindingsTab when needed.
|
|
17949
|
-
*
|
|
17950
|
-
* Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
|
|
17951
|
-
* (per-device surface) and `track-trail` caps — see P11 cleanup.
|
|
17946
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
17947
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
17948
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
17952
17949
|
*/
|
|
17953
|
-
var
|
|
17954
|
-
|
|
17955
|
-
|
|
17956
|
-
|
|
17957
|
-
|
|
17958
|
-
|
|
17959
|
-
|
|
17960
|
-
|
|
17961
|
-
|
|
17962
|
-
|
|
17963
|
-
|
|
17964
|
-
|
|
17950
|
+
var NativeCropRefSchema = object({
|
|
17951
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
17952
|
+
handle: FrameHandleSchema,
|
|
17953
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
17954
|
+
cropFrameSpace: object({
|
|
17955
|
+
x: number(),
|
|
17956
|
+
y: number(),
|
|
17957
|
+
w: number(),
|
|
17958
|
+
h: number()
|
|
17959
|
+
})
|
|
17960
|
+
});
|
|
17961
|
+
object({
|
|
17962
|
+
crop: object({
|
|
17963
|
+
left: number(),
|
|
17964
|
+
top: number(),
|
|
17965
|
+
width: number().positive(),
|
|
17966
|
+
height: number().positive()
|
|
17967
|
+
}).optional(),
|
|
17968
|
+
content: object({
|
|
17969
|
+
width: number().int().positive(),
|
|
17970
|
+
height: number().int().positive()
|
|
17971
|
+
}),
|
|
17972
|
+
fit: _enum(["stretch", "contain"]),
|
|
17973
|
+
format: _enum([
|
|
17974
|
+
"rgb",
|
|
17975
|
+
"gray",
|
|
17976
|
+
"jpeg"
|
|
17977
|
+
])
|
|
17978
|
+
});
|
|
17965
17979
|
/**
|
|
17966
|
-
*
|
|
17967
|
-
*
|
|
17968
|
-
*
|
|
17980
|
+
* Process-local frame identity. It is serializable so it can ride an in-process
|
|
17981
|
+
* capability call, but `registryId` deliberately prevents resolution in any
|
|
17982
|
+
* other process or execution group.
|
|
17969
17983
|
*/
|
|
17970
|
-
var
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
"
|
|
17976
|
-
|
|
17977
|
-
|
|
17978
|
-
|
|
17979
|
-
|
|
17980
|
-
"
|
|
17981
|
-
"
|
|
17982
|
-
"
|
|
17983
|
-
"
|
|
17984
|
-
"
|
|
17984
|
+
var FrameRefSchema = object({
|
|
17985
|
+
registryId: string().min(1),
|
|
17986
|
+
id: string().min(1),
|
|
17987
|
+
width: number().int().positive(),
|
|
17988
|
+
height: number().int().positive(),
|
|
17989
|
+
format: _enum(["rgb", "gray"]),
|
|
17990
|
+
timestamp: number(),
|
|
17991
|
+
capturedAt: number().optional()
|
|
17992
|
+
});
|
|
17993
|
+
var ModelFormatSchema$1 = _enum([
|
|
17994
|
+
"onnx",
|
|
17995
|
+
"coreml",
|
|
17996
|
+
"openvino",
|
|
17997
|
+
"tflite",
|
|
17998
|
+
"pt",
|
|
17999
|
+
"gguf"
|
|
17985
18000
|
]);
|
|
17986
|
-
var
|
|
17987
|
-
"
|
|
17988
|
-
"
|
|
17989
|
-
"
|
|
17990
|
-
"
|
|
17991
|
-
"
|
|
17992
|
-
"custom",
|
|
17993
|
-
"package"
|
|
18001
|
+
var PipelineSlotSchema = _enum([
|
|
18002
|
+
"detector",
|
|
18003
|
+
"cropper",
|
|
18004
|
+
"classifier",
|
|
18005
|
+
"refiner",
|
|
18006
|
+
"audio-classifier"
|
|
17994
18007
|
]);
|
|
17995
|
-
|
|
17996
|
-
|
|
17997
|
-
|
|
17998
|
-
|
|
17999
|
-
|
|
18000
|
-
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
18001
|
-
labelKey: string(),
|
|
18002
|
-
/** English fallback label (kept for clients that don't translate). */
|
|
18003
|
-
label: string(),
|
|
18004
|
-
/** Hex color for timeline/legend rendering. */
|
|
18005
|
-
color: string(),
|
|
18006
|
-
/** Dictionary id → lucide component on the UI side. */
|
|
18007
|
-
iconId: string(),
|
|
18008
|
-
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
18009
|
-
icon: EventKindIconSchema,
|
|
18010
|
-
category: EventKindCategorySchema,
|
|
18011
|
-
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
18012
|
-
parentKind: string().nullable(),
|
|
18013
|
-
/** Derived from `parentKind`, explicit for the client tree. */
|
|
18014
|
-
level: EventKindLevelSchema,
|
|
18015
|
-
/** Which cap + device contributes this kind. For built-ins the camera
|
|
18016
|
-
* itself; for sensor kinds the LINKED source device. */
|
|
18017
|
-
source: object({
|
|
18018
|
-
capName: string(),
|
|
18019
|
-
deviceId: number()
|
|
18020
|
-
})
|
|
18008
|
+
var PipelineEngineChoiceSchema = object({
|
|
18009
|
+
runtime: _enum(["node", "python"]),
|
|
18010
|
+
backend: string(),
|
|
18011
|
+
format: ModelFormatSchema$1,
|
|
18012
|
+
device: string().optional()
|
|
18021
18013
|
});
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18014
|
+
var AvailableEngineSchema = object({
|
|
18015
|
+
engine: PipelineEngineChoiceSchema,
|
|
18016
|
+
devices: array(object({
|
|
18017
|
+
id: string(),
|
|
18018
|
+
label: string(),
|
|
18019
|
+
description: string().optional()
|
|
18020
|
+
})).readonly(),
|
|
18021
|
+
defaultDevice: string()
|
|
18026
18022
|
});
|
|
18027
|
-
var
|
|
18023
|
+
var PipelineDefaultStepSchema = lazy(() => object({
|
|
18024
|
+
addonId: string(),
|
|
18025
|
+
addonName: string(),
|
|
18026
|
+
slot: PipelineSlotSchema,
|
|
18027
|
+
inputClasses: array(string()).readonly(),
|
|
18028
|
+
outputClasses: array(string()).readonly(),
|
|
18029
|
+
enabled: boolean(),
|
|
18030
|
+
modelId: string(),
|
|
18031
|
+
children: array(PipelineDefaultStepSchema).readonly(),
|
|
18032
|
+
group: string().optional(),
|
|
18033
|
+
settings: record(string(), unknown()).optional()
|
|
18034
|
+
}));
|
|
18035
|
+
var PipelineTemplateStepSchema = lazy(() => object({
|
|
18036
|
+
addonId: string(),
|
|
18037
|
+
enabled: boolean(),
|
|
18038
|
+
modelId: string(),
|
|
18039
|
+
children: array(PipelineTemplateStepSchema).readonly(),
|
|
18040
|
+
settings: record(string(), unknown()).optional()
|
|
18041
|
+
}));
|
|
18042
|
+
var PipelineTemplateSchema$1 = object({
|
|
18028
18043
|
id: string(),
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
/** Event kind id — matches an `EventKindDescriptor.kind`. */
|
|
18035
|
-
kind: string(),
|
|
18036
|
-
/** Snapshot of the sensor cap's runtime-state slice at the change. */
|
|
18037
|
-
value: record(string(), unknown()).nullable(),
|
|
18038
|
-
timestamp: number()
|
|
18044
|
+
name: string(),
|
|
18045
|
+
createdAt: string(),
|
|
18046
|
+
updatedAt: string(),
|
|
18047
|
+
engine: PipelineEngineChoiceSchema,
|
|
18048
|
+
steps: array(PipelineTemplateStepSchema).readonly()
|
|
18039
18049
|
});
|
|
18040
|
-
var
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18050
|
+
var PipelineModelOptionSchema = object({
|
|
18051
|
+
id: string(),
|
|
18052
|
+
name: string(),
|
|
18053
|
+
formats: record(string(), object({
|
|
18054
|
+
downloaded: boolean(),
|
|
18055
|
+
sizeMB: number()
|
|
18056
|
+
})),
|
|
18057
|
+
group: ModelVariantGroupSchema.optional(),
|
|
18058
|
+
legacy: boolean().optional(),
|
|
18059
|
+
provider: ModelProviderIdSchema.optional()
|
|
18045
18060
|
});
|
|
18046
|
-
var
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
|
|
18061
|
+
var ConfigFieldBridge = custom();
|
|
18062
|
+
var PipelineAddonSchemaSchema = object({
|
|
18063
|
+
id: string(),
|
|
18064
|
+
name: string(),
|
|
18065
|
+
slot: PipelineSlotSchema,
|
|
18066
|
+
inputClasses: array(string()).readonly(),
|
|
18067
|
+
outputClasses: array(string()).readonly(),
|
|
18068
|
+
childSlots: array(PipelineSlotSchema).readonly(),
|
|
18069
|
+
models: array(PipelineModelOptionSchema).readonly(),
|
|
18070
|
+
defaultModelId: string(),
|
|
18071
|
+
defaultModelIdByFormat: record(string(), string()).optional(),
|
|
18072
|
+
enabledByDefault: boolean().optional(),
|
|
18073
|
+
backfillIntoExistingOverrides: boolean().optional(),
|
|
18074
|
+
defaultConfidence: number(),
|
|
18075
|
+
group: string().optional(),
|
|
18076
|
+
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
18051
18077
|
});
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18057
|
-
|
|
18058
|
-
var TrackEnvelopeSchema = object({
|
|
18059
|
-
minX: number(),
|
|
18060
|
-
minY: number(),
|
|
18061
|
-
maxX: number(),
|
|
18062
|
-
maxY: number()
|
|
18078
|
+
var PipelineSlotSchemaSchema = object({
|
|
18079
|
+
id: PipelineSlotSchema,
|
|
18080
|
+
label: string(),
|
|
18081
|
+
priority: number(),
|
|
18082
|
+
parentSlot: PipelineSlotSchema.nullable(),
|
|
18083
|
+
addons: array(PipelineAddonSchemaSchema).readonly()
|
|
18063
18084
|
});
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
* keeps every scalar the list surfaces actually render (ids, class(es),
|
|
18069
|
-
* label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
|
|
18070
|
-
* zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
|
|
18071
|
-
* `snapshots` as EMPTY arrays — detail views re-fetch the full row via
|
|
18072
|
-
* `getTrack`. Mirrors the event-store `projection` convention
|
|
18073
|
-
* (`getObjectEvents` et al.).
|
|
18074
|
-
*/
|
|
18075
|
-
var TrackProjectionSchema = _enum(["full", "slim"]);
|
|
18076
|
-
/**
|
|
18077
|
-
* One audio-classification label heard on the track's camera while the
|
|
18078
|
-
* track was alive, aggregated per label. An "episode" is one persisted
|
|
18079
|
-
* audio event (the confident-classification path: score ≥ the device's
|
|
18080
|
-
* `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
|
|
18081
|
-
* one 32 ms inference chunk, so counts stay human-scaled.
|
|
18082
|
-
*/
|
|
18083
|
-
var TrackAudioLabelSchema = object({
|
|
18084
|
-
label: string(),
|
|
18085
|
-
/** Highest classification score observed across the label's episodes. */
|
|
18086
|
-
peakScore: number(),
|
|
18087
|
-
/** Number of coalesced audio-event episodes carrying this label. */
|
|
18088
|
-
count: number(),
|
|
18089
|
-
firstAt: number(),
|
|
18090
|
-
lastAt: number()
|
|
18085
|
+
var PipelineSchemaSchema = object({
|
|
18086
|
+
availableEngines: array(AvailableEngineSchema).readonly(),
|
|
18087
|
+
selectedEngine: PipelineEngineChoiceSchema,
|
|
18088
|
+
slots: array(PipelineSlotSchemaSchema).readonly()
|
|
18091
18089
|
});
|
|
18092
|
-
|
|
18093
|
-
|
|
18094
|
-
|
|
18095
|
-
|
|
18096
|
-
|
|
18097
|
-
|
|
18098
|
-
|
|
18099
|
-
|
|
18100
|
-
|
|
18101
|
-
|
|
18102
|
-
|
|
18103
|
-
|
|
18104
|
-
|
|
18105
|
-
|
|
18106
|
-
|
|
18107
|
-
|
|
18108
|
-
|
|
18109
|
-
|
|
18110
|
-
|
|
18111
|
-
|
|
18112
|
-
*
|
|
18113
|
-
*
|
|
18114
|
-
*
|
|
18115
|
-
*
|
|
18116
|
-
*
|
|
18117
|
-
|
|
18118
|
-
|
|
18119
|
-
* - `trained` — the retrain page has taken what it needed. The frames it chose
|
|
18120
|
-
* were COPIED into the retrain dataset at selection time, so the dataset no
|
|
18121
|
-
* longer depends on the track's media and the track becomes EVICTABLE again.
|
|
18122
|
-
* Terminal for the plain `markForTrain` toggle: returning it to `staging` is
|
|
18123
|
-
* a deliberate action of the retrain page, not a side effect of a checkbox.
|
|
18124
|
-
*
|
|
18125
|
-
* There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
|
|
18126
|
-
* the store's filter language has only positive equality and `whereIn` — no
|
|
18127
|
-
* negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
|
|
18128
|
-
* would make the entire pre-column history immortal in one deploy.
|
|
18129
|
-
*/
|
|
18130
|
-
var RetrainStatusSchema = _enum([
|
|
18131
|
-
"none",
|
|
18132
|
-
"staging",
|
|
18133
|
-
"trained"
|
|
18134
|
-
]);
|
|
18135
|
-
/**
|
|
18136
|
-
* Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
|
|
18137
|
-
* by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
|
|
18138
|
-
* so the two surfaces cannot drift.
|
|
18139
|
-
*
|
|
18140
|
-
* **Absent ≠ false.** A track that has never been touched omits the field; an
|
|
18141
|
-
* explicitly un-flagged track carries `false`. Legacy rows written before the
|
|
18142
|
-
* columns existed read as absent, and a consumer that needs a boolean should say
|
|
18143
|
-
* `flag === true`, not `flag !== false`.
|
|
18144
|
-
*
|
|
18145
|
-
* `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
|
|
18146
|
-
* it is exactly `retrainStatus === 'staging'`, in both directions. Writing
|
|
18147
|
-
* `true` moves `none → staging`, writing `false` moves `staging → none`, and a
|
|
18148
|
-
* `trained` track reports `false` while refusing both writes. The boolean is
|
|
18149
|
-
* kept because three surfaces drive a toggle off it; anything that needs to tell
|
|
18150
|
-
* "never marked" from "already trained" must read `retrainStatus`.
|
|
18151
|
-
*
|
|
18152
|
-
* `debug` does NOT pin; it is attention, not durability.
|
|
18153
|
-
*
|
|
18154
|
-
* `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
|
|
18155
|
-
* A favourited track is skipped by retention the same way `staging` is, but
|
|
18156
|
-
* it does not enter `none|staging|trained` and has no staging budget.
|
|
18157
|
-
*/
|
|
18158
|
-
var TrackFlagFields = {
|
|
18159
|
-
/** Operator marked this track as training material — i.e. `retrainStatus` is
|
|
18160
|
-
* `'staging'`. */
|
|
18161
|
-
markForTrain: boolean().optional(),
|
|
18162
|
-
/** Operator marked this track for diagnostic attention. */
|
|
18163
|
-
debug: boolean().optional(),
|
|
18164
|
-
/** Operator favourited this track. Pins it against pruning. */
|
|
18165
|
-
favourited: boolean().optional()
|
|
18166
|
-
};
|
|
18167
|
-
/**
|
|
18168
|
-
* The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
|
|
18169
|
-
* Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
|
|
18170
|
-
* write patch, and the status is not something the toggle sets — it is what the
|
|
18171
|
-
* toggle's boolean is derived from. Absent on an in-RAM track never touched;
|
|
18172
|
-
* always present on a persisted row (the column default materialises `'none'`).
|
|
18173
|
-
*/
|
|
18174
|
-
var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
|
|
18175
|
-
/**
|
|
18176
|
-
* The write half: a PARTIAL patch. An omitted key is left untouched, so setting
|
|
18177
|
-
* one flag can never clear the other — the toggles are independent and are
|
|
18178
|
-
* driven from three surfaces that do not know about each other.
|
|
18179
|
-
*/
|
|
18180
|
-
var TrackFlagsPatchSchema = object(TrackFlagFields);
|
|
18181
|
-
/**
|
|
18182
|
-
* The resolved flag state after a write. Both fields are REQUIRED here (absent
|
|
18183
|
-
* collapses to `false`) so a caller can drive a toggle's checked state off the
|
|
18184
|
-
* mutation result without a re-fetch.
|
|
18185
|
-
*/
|
|
18186
|
-
var TrackFlagsSchema = object({
|
|
18187
|
-
trackId: string(),
|
|
18188
|
-
markForTrain: boolean(),
|
|
18189
|
-
debug: boolean(),
|
|
18190
|
-
favourited: boolean(),
|
|
18191
|
-
/** The lifecycle state the boolean was derived from. Required here (unlike on
|
|
18192
|
-
* a track row) because this shape is only ever produced by the write body,
|
|
18193
|
-
* which always knows it — and a surface that has just written needs to render
|
|
18194
|
-
* `trained` without a re-fetch. */
|
|
18195
|
-
retrainStatus: RetrainStatusSchema
|
|
18090
|
+
var EngineProvisioningSchema = object({
|
|
18091
|
+
runtimeId: _enum([
|
|
18092
|
+
"onnx",
|
|
18093
|
+
"openvino",
|
|
18094
|
+
"coreml",
|
|
18095
|
+
"edgetpu"
|
|
18096
|
+
]).nullable(),
|
|
18097
|
+
device: string().nullable(),
|
|
18098
|
+
state: _enum([
|
|
18099
|
+
"idle",
|
|
18100
|
+
"installing",
|
|
18101
|
+
"verifying",
|
|
18102
|
+
"ready",
|
|
18103
|
+
"failed"
|
|
18104
|
+
]),
|
|
18105
|
+
progress: number().optional(),
|
|
18106
|
+
error: string().optional(),
|
|
18107
|
+
nextRetryAt: number().optional(),
|
|
18108
|
+
/**
|
|
18109
|
+
* Gate A (config-correctness gate at engine change): human-readable
|
|
18110
|
+
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
18111
|
+
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
18112
|
+
* has a <format> build"). Additive/optional: informational only, never
|
|
18113
|
+
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
18114
|
+
* Absent/empty when the node-default tree resolves cleanly.
|
|
18115
|
+
*/
|
|
18116
|
+
configIssues: array(string()).optional()
|
|
18196
18117
|
});
|
|
18197
|
-
|
|
18198
|
-
|
|
18199
|
-
* WHO decided a label, and when. Carried per tier so a value can be traced to
|
|
18200
|
-
* the step and model that produced it — which is what makes the write rule
|
|
18201
|
-
* arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
|
|
18202
|
-
* and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
|
|
18203
|
-
*
|
|
18204
|
-
* `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
|
|
18205
|
-
* `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
|
|
18206
|
-
* `migration:4g` for a value the 4g migration moved from the single-slot era —
|
|
18207
|
-
* that value has no provenance, and the write rule lets ANY properly-attributed
|
|
18208
|
-
* write of the same tier replace it regardless of score.
|
|
18209
|
-
*/
|
|
18210
|
-
var LabelAttributionSchema = object({
|
|
18211
|
-
stepId: string(),
|
|
18118
|
+
var PipelineStepInputSchema = lazy(() => object({
|
|
18119
|
+
addonId: string(),
|
|
18212
18120
|
modelId: string().optional(),
|
|
18213
|
-
|
|
18121
|
+
enabled: boolean().default(true),
|
|
18122
|
+
children: array(PipelineStepInputSchema).optional(),
|
|
18123
|
+
settings: record(string(), unknown()).optional(),
|
|
18124
|
+
jumpDeviceKey: string().optional()
|
|
18125
|
+
}));
|
|
18126
|
+
var ModelSubstitutionSchema = object({
|
|
18127
|
+
addonId: string(),
|
|
18128
|
+
chosen: string(),
|
|
18129
|
+
running: string(),
|
|
18130
|
+
format: string()
|
|
18131
|
+
});
|
|
18132
|
+
var PipelineValidationIssueSchema = object({
|
|
18133
|
+
addonId: string(),
|
|
18134
|
+
kind: _enum(["unknown-addon", "no-format-build"]),
|
|
18135
|
+
detail: string()
|
|
18136
|
+
});
|
|
18137
|
+
var PipelineValidationResultSchema = object({
|
|
18138
|
+
ok: boolean(),
|
|
18139
|
+
issues: array(PipelineValidationIssueSchema).readonly(),
|
|
18140
|
+
substitutions: array(ModelSubstitutionSchema).readonly(),
|
|
18141
|
+
/** The node's `currentEngine.format` this validation ran against. */
|
|
18142
|
+
format: string()
|
|
18143
|
+
});
|
|
18144
|
+
var ReferenceImageEntrySchema = object({
|
|
18145
|
+
filename: string(),
|
|
18146
|
+
stepIds: array(string()).readonly().optional()
|
|
18147
|
+
});
|
|
18148
|
+
var ReferenceImageBodySchema = object({
|
|
18149
|
+
base64: string(),
|
|
18150
|
+
filename: string()
|
|
18151
|
+
});
|
|
18152
|
+
var ReferenceAudioEntrySchema = object({
|
|
18153
|
+
filename: string(),
|
|
18154
|
+
sizeKb: number()
|
|
18155
|
+
});
|
|
18156
|
+
var ReferenceAudioBodySchema = object({ base64: string() });
|
|
18157
|
+
var AudioBackendSchema = object({
|
|
18158
|
+
id: string(),
|
|
18159
|
+
name: string(),
|
|
18160
|
+
description: string(),
|
|
18161
|
+
available: boolean(),
|
|
18214
18162
|
/**
|
|
18215
|
-
*
|
|
18216
|
-
*
|
|
18217
|
-
*
|
|
18218
|
-
*
|
|
18219
|
-
* notification rule authored on "Gianluca" stopped matching the moment the
|
|
18220
|
-
* operator fixed the spelling in the gallery, and nothing said so. The id is
|
|
18221
|
-
* the thing that does not move, so it is what a rule matches on
|
|
18222
|
-
* (`NcConditions.identities`) and the text is what a human is shown.
|
|
18223
|
-
*
|
|
18224
|
-
* Absent when the label names no gallery row — a plate the OCR read but no
|
|
18225
|
-
* vehicle claims, a sub-class, a species, any tier-1 value.
|
|
18163
|
+
* Raw classifier labels this backend can emit (e.g. YAMNet's
|
|
18164
|
+
* 521-class set or Apple SoundAnalysis's 303-class set). Used by
|
|
18165
|
+
* the benchmark UI to populate the `enabledMicroClasses` filter
|
|
18166
|
+
* specific to the selected backend without a separate fetch.
|
|
18226
18167
|
*/
|
|
18227
|
-
|
|
18168
|
+
rawLabels: array(string()).readonly().optional()
|
|
18169
|
+
});
|
|
18170
|
+
var AudioCapabilitiesSchema = object({
|
|
18171
|
+
activeBackend: string(),
|
|
18172
|
+
availableBackends: array(AudioBackendSchema).readonly(),
|
|
18173
|
+
sampleRate: number(),
|
|
18174
|
+
chunkDurationMs: number()
|
|
18175
|
+
});
|
|
18176
|
+
var DownloadModelResultSchema = object({
|
|
18177
|
+
filePath: string(),
|
|
18178
|
+
sizeMB: number(),
|
|
18179
|
+
durationMs: number()
|
|
18228
18180
|
});
|
|
18229
18181
|
/**
|
|
18230
|
-
*
|
|
18231
|
-
* `
|
|
18232
|
-
*
|
|
18233
|
-
*
|
|
18234
|
-
*
|
|
18235
|
-
*
|
|
18236
|
-
*
|
|
18237
|
-
*
|
|
18238
|
-
* **Reading it.** What a human should be shown is `subLabel ?? label` — the
|
|
18239
|
-
* finest thing known. Before 4g the single `label` column held the finest
|
|
18240
|
-
* value, so a consumer that has not been updated reads the tier-1 slot and
|
|
18241
|
-
* shows nothing on a species-only row; that is why the migration puts every
|
|
18242
|
-
* pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
|
|
18243
|
-
* and why the read surfaces were changed in the same train.
|
|
18244
|
-
*
|
|
18245
|
-
* **Writing it.** The slots are independent, which is the whole point: a
|
|
18246
|
-
* tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
|
|
18247
|
-
* migratorius`), so fineness cannot regress by construction. Within a tier the
|
|
18248
|
-
* higher score wins. One rule, one implementation — see
|
|
18249
|
-
* `pipeline/label-tier.ts` in addon-post-analysis.
|
|
18250
|
-
*/
|
|
18251
|
-
var TieredLabelFields = {
|
|
18252
|
-
/** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
|
|
18253
|
-
label: string().optional(),
|
|
18254
|
-
/** Confidence of the tier-1 value, as reported by the deciding step. */
|
|
18255
|
-
labelScore: number().optional(),
|
|
18256
|
-
/** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
|
|
18257
|
-
labelMeta: LabelAttributionSchema.optional(),
|
|
18258
|
-
/** Tier 2 — the instance. See {@link LabelTierSchema}. */
|
|
18259
|
-
subLabel: string().optional(),
|
|
18260
|
-
/** Confidence of the tier-2 value, as reported by the deciding step. */
|
|
18261
|
-
subLabelScore: number().optional(),
|
|
18262
|
-
/** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
|
|
18263
|
-
subLabelMeta: LabelAttributionSchema.optional()
|
|
18264
|
-
};
|
|
18265
|
-
/** Per-camera slice of a training-export estimate. */
|
|
18266
|
-
var TrainingExportDeviceTotalsSchema = object({
|
|
18267
|
-
deviceId: number(),
|
|
18268
|
-
tracks: number().int(),
|
|
18269
|
-
files: number().int(),
|
|
18270
|
-
bytes: number().int()
|
|
18271
|
-
});
|
|
18272
|
-
/**
|
|
18273
|
-
* What a training export WOULD contain. Computed from media index rows only —
|
|
18274
|
-
* no blob is read to produce this.
|
|
18182
|
+
* Wrapper carrying a single test run's result. Replaces the legacy
|
|
18183
|
+
* ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
|
|
18184
|
+
* canonical `AudioResult` from the Phase 6 output rework: one
|
|
18185
|
+
* `AudioDetection` per class above `minScore`, top-N candidates in
|
|
18186
|
+
* `debug.alternateLabels['audio-classifier']`, per-source timings in
|
|
18187
|
+
* `debug.stepTimings`. The outer `success`/`error` fields stay so the
|
|
18188
|
+
* benchmark UI can still report a clean failure when the classifier
|
|
18189
|
+
* cap isn't available.
|
|
18275
18190
|
*/
|
|
18276
|
-
var
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
byteCount: number().int(),
|
|
18281
|
-
/** More marked tracks exist than a single pass carries. */
|
|
18282
|
-
truncated: boolean(),
|
|
18283
|
-
devices: array(TrainingExportDeviceTotalsSchema).readonly()
|
|
18284
|
-
});
|
|
18285
|
-
var TrackSchema = object({
|
|
18286
|
-
trackId: string(),
|
|
18287
|
-
deviceId: number(),
|
|
18288
|
-
className: string(),
|
|
18289
|
-
...TieredLabelFields,
|
|
18290
|
-
producingDeviceName: string().optional(),
|
|
18291
|
-
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
18292
|
-
source: TrackSourceSchema.optional(),
|
|
18293
|
-
firstSeen: number(),
|
|
18294
|
-
lastSeen: number(),
|
|
18295
|
-
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
18296
|
-
positions: array(TrackPositionSchema).readonly(),
|
|
18297
|
-
/** Periodic snapshots at snapshotIntervalMs cadence (subject to
|
|
18298
|
-
* saveThumbnails policy). */
|
|
18299
|
-
snapshots: array(TrackSnapshotSchema).readonly(),
|
|
18300
|
-
/** Deduplicated zones the track has entered at least once. Zone IDS. */
|
|
18301
|
-
zonesVisited: array(string()).readonly(),
|
|
18302
|
-
/**
|
|
18303
|
-
* Human NAMES for {@link zonesVisited}, resolved at READ time against the
|
|
18304
|
-
* `zones` capability.
|
|
18305
|
-
*
|
|
18306
|
-
* `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
|
|
18307
|
-
* and no card can render — so every free-text search surface was structurally
|
|
18308
|
-
* unable to answer "show me the tracks in Uscio", and did not fail loudly, it
|
|
18309
|
-
* just returned nothing. Resolving here rather than in each client keeps ONE
|
|
18310
|
-
* derivation and costs the clients no extra call (the `zones` cap is
|
|
18311
|
-
* per-device, so a client-side resolve would be a per-camera fan-out on a
|
|
18312
|
-
* surface built to avoid exactly that).
|
|
18313
|
-
*
|
|
18314
|
-
* Resolved, never invented: a zone deleted since the track was written has no
|
|
18315
|
-
* name and is DROPPED, so this array can be shorter than `zonesVisited` — the
|
|
18316
|
-
* two are not positionally aligned. Absent when the track visited no zone, or
|
|
18317
|
-
* when the zone catalogue could not be read.
|
|
18318
|
-
*/
|
|
18319
|
-
zoneNames: array(string()).readonly().optional(),
|
|
18320
|
-
/** Deduplicated set of detector classes observed for this track over its
|
|
18321
|
-
* life (a track may be reclassified, e.g. person→vehicle). Absent on
|
|
18322
|
-
* legacy rows written before class accumulation shipped. */
|
|
18323
|
-
classes: array(string()).readonly().optional(),
|
|
18324
|
-
/** Cumulative normalized distance travelled (0..1 units = full frame width). */
|
|
18325
|
-
totalDistance: number(),
|
|
18326
|
-
state: TrackStateSchema,
|
|
18327
|
-
active: boolean(),
|
|
18328
|
-
/** Deterministic key-event importance score in [0,1] (server-computed at
|
|
18329
|
-
* track expiry, recomputed on late label). Absent on legacy rows written
|
|
18330
|
-
* before scoring shipped — consumers degrade to absence / compute-on-read. */
|
|
18331
|
-
importance: number().optional(),
|
|
18332
|
-
/** Id of the track's highest-confidence ObjectEvent (its representative
|
|
18333
|
-
* "best" frame). Absent when the track produced no object events. */
|
|
18334
|
-
bestEventId: string().optional(),
|
|
18335
|
-
/** Tag of the importance sub-signal that dominated the score
|
|
18336
|
-
* (identity|dwell|proximity|class|confidence|travel|zone). */
|
|
18337
|
-
importanceReason: string().optional(),
|
|
18338
|
-
/** Audio-classification labels heard on the camera during the track's
|
|
18339
|
-
* life (score ≥ device `classificationMinScore`), aggregated per label.
|
|
18340
|
-
* Absent on legacy rows / tracks with no confident audio. */
|
|
18341
|
-
audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
|
|
18342
|
-
/** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
|
|
18343
|
-
* Populated from the persisted envelope columns on historical reads;
|
|
18344
|
-
* absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
|
|
18345
|
-
envelope: TrackEnvelopeSchema.optional(),
|
|
18346
|
-
/**
|
|
18347
|
-
* A face DETECTOR found a face on this track — nothing more. It says the
|
|
18348
|
-
* detail plane produced a `face` detail; it does NOT say the face was
|
|
18349
|
-
* embedded, matched, above `minFacePx`, or that the recognizer was even
|
|
18350
|
-
* enabled. Set once and never cleared.
|
|
18351
|
-
*
|
|
18352
|
-
* **This exists so "face present but not recognised" is expressible.** A
|
|
18353
|
-
* recognised identity lands in `subLabel` (attributed to the face chain via
|
|
18354
|
-
* `subLabelMeta.stepId`), so before this field a track with an unmatched face
|
|
18355
|
-
* and a track with no face at all were byte-identical on the wire and no
|
|
18356
|
-
* surface could tell them apart. The read is `hasFace === true && subLabel
|
|
18357
|
-
* === undefined`.
|
|
18358
|
-
*
|
|
18359
|
-
* **Absent ≠ false.** Every row written before the column existed omits it,
|
|
18360
|
-
* and so does every server that predates the field — a consumer must test
|
|
18361
|
-
* `=== true` and render nothing otherwise, never infer "no face".
|
|
18362
|
-
*/
|
|
18363
|
-
hasFace: boolean().optional(),
|
|
18364
|
-
/**
|
|
18365
|
-
* This track has a face row IN THE GALLERY: a crop **and** an embedding — a
|
|
18366
|
-
* face an operator could ASSIGN to an identity.
|
|
18367
|
-
*
|
|
18368
|
-
* The STRICT twin of {@link hasFace}, and the pair only earns its keep
|
|
18369
|
-
* because the two disagree. `hasFace` is stamped at the TOP of the face
|
|
18370
|
-
* branch, before every gate, and means no more than "a face detector produced
|
|
18371
|
-
* a face detail". This one is stamped at the single moment the gallery row
|
|
18372
|
-
* LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
|
|
18373
|
-
* past the embedding-magnitude verdict, the `minFacePx` detection gate, the
|
|
18374
|
-
* candidate gate, the imageless-track drop (no crop was ever captured) and
|
|
18375
|
-
* the crop-store drop. Everything between the detector and that insert can
|
|
18376
|
-
* legitimately refuse the face, so a flag written any earlier promises the
|
|
18377
|
-
* operator something to assign and delivers nothing.
|
|
18378
|
-
*
|
|
18379
|
-
* **Independent of recognition.** A face collected but never auto-matched is
|
|
18380
|
-
* still assignable — it is in fact the face an operator most wants to reach —
|
|
18381
|
-
* so this is NOT gated on `recognizedIdentityId`. Recognition lands in
|
|
18382
|
-
* `subLabel`; this says only that the raw material exists.
|
|
18383
|
-
*
|
|
18384
|
-
* **Set once, never cleared.** A track that produced a gallery row produced
|
|
18385
|
-
* one; deleting the row later is the gallery's business, not this flag's.
|
|
18386
|
-
*
|
|
18387
|
-
* **Absent ≠ false**, the same rule as {@link hasFace}: every row written
|
|
18388
|
-
* before the column omits it, and so does every server that predates the
|
|
18389
|
-
* field. A consumer must test `=== true` and render nothing otherwise —
|
|
18390
|
-
* never infer "no assignable face".
|
|
18391
|
-
*/
|
|
18392
|
-
hasEmbeddedFace: boolean().optional(),
|
|
18393
|
-
/**
|
|
18394
|
-
* This subject CONTAINS a folded rider — a person the rider-pairing step
|
|
18395
|
-
* ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
|
|
18396
|
-
* so the passage is tracked once and as a VEHICLE.
|
|
18397
|
-
*
|
|
18398
|
-
* It exists because the fold's record was dishonest. D34 and the code both
|
|
18399
|
-
* said "the person is not lost — it is reported so both entities stay on the
|
|
18400
|
-
* record"; in fact the pair went into a per-processor RAM field behind an
|
|
18401
|
-
* accessor nobody called, and every durable surface said `vehicle`, full
|
|
18402
|
-
* stop. This is the composition note that makes the row true.
|
|
18403
|
-
*
|
|
18404
|
-
* A COMPOSITION, never a class and never a label. "This vehicle contains a
|
|
18405
|
-
* person" is not an answer to "what is this" — both label tiers would refuse
|
|
18406
|
-
* a macro token anyway (D89), and correctly. Nothing here changes what the
|
|
18407
|
-
* subject IS: a cyclist stays one vehicle track, occupancy still counts one,
|
|
18408
|
-
* and a `person` rule still does not fire for someone cycling past.
|
|
18409
|
-
*
|
|
18410
|
-
* **Absent ≠ false**, exactly like {@link hasFace}: every row written before
|
|
18411
|
-
* the column, and every hub that predates the field, omits it. Test
|
|
18412
|
-
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
18413
|
-
*/
|
|
18414
|
-
hasRider: boolean().optional(),
|
|
18415
|
-
...TrackFlagFields,
|
|
18416
|
-
...TrackRetrainFields
|
|
18417
|
-
});
|
|
18418
|
-
var BaseEventFields = {
|
|
18419
|
-
id: string(),
|
|
18420
|
-
deviceId: number(),
|
|
18421
|
-
timestamp: number()
|
|
18422
|
-
};
|
|
18423
|
-
var MotionEventSchema = object({
|
|
18424
|
-
...BaseEventFields,
|
|
18425
|
-
kind: literal("motion"),
|
|
18426
|
-
regionCount: number(),
|
|
18427
|
-
/** Heavy JSON array — omitted in slim projection. */
|
|
18428
|
-
regions: array(object({
|
|
18429
|
-
bbox: BoundingBoxSchema,
|
|
18430
|
-
pixelCount: number(),
|
|
18431
|
-
intensity: number()
|
|
18432
|
-
})).readonly().optional(),
|
|
18433
|
-
/** Omitted in slim projection. */
|
|
18434
|
-
frameWidth: number().optional(),
|
|
18435
|
-
/** Omitted in slim projection. */
|
|
18436
|
-
frameHeight: number().optional(),
|
|
18437
|
-
/** Populated by B5 (recording playback URL for this event). */
|
|
18438
|
-
mediaUrl: string().optional()
|
|
18191
|
+
var AudioTestResultSchema = object({
|
|
18192
|
+
success: boolean(),
|
|
18193
|
+
error: string().optional(),
|
|
18194
|
+
frame: custom().optional()
|
|
18439
18195
|
});
|
|
18196
|
+
var PipelineConfigBridge = custom();
|
|
18197
|
+
var ConfigUISchemaBridge = custom();
|
|
18198
|
+
var ConfigUISchemaNullableBridge = custom();
|
|
18199
|
+
var InferenceCapabilitiesBridge = custom();
|
|
18200
|
+
var ModelAvailabilityListBridge = custom();
|
|
18201
|
+
var PipelineRunResultBridge = custom();
|
|
18440
18202
|
/**
|
|
18441
|
-
*
|
|
18442
|
-
* detection pipeline (decoded-frame inference); `onboard` = the camera's
|
|
18443
|
-
* native on-device AI. Both flow through the SAME analysis layers (zoning,
|
|
18444
|
-
* tracking, per-kind persistence) but stay distinguishable so consumers
|
|
18445
|
-
* (advanced-notifier, occupancy, …) can select which source(s) to act on.
|
|
18446
|
-
* Absent on legacy rows ⇒ treat as `pipeline`.
|
|
18447
|
-
*/
|
|
18448
|
-
var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
|
|
18449
|
-
/**
|
|
18450
|
-
* The confirmed zone crossing that produced an object event. Present ONLY on
|
|
18451
|
-
* an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
|
|
18452
|
-
* event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
|
|
18453
|
-
* appearance event carry none, so a rule asking for a direction fails closed
|
|
18454
|
-
* on them.
|
|
18203
|
+
* Pipeline executor — detection engine + configuration + inference API.
|
|
18455
18204
|
*
|
|
18456
|
-
*
|
|
18457
|
-
*
|
|
18458
|
-
* produces two events with two directions — never one ambiguous row.
|
|
18205
|
+
* Merged from: pipeline-executor, pipeline-config, inference, detection-config.
|
|
18206
|
+
* Implemented by the detection-pipeline addon.
|
|
18459
18207
|
*
|
|
18460
|
-
*
|
|
18461
|
-
*
|
|
18462
|
-
*
|
|
18463
|
-
*
|
|
18464
|
-
|
|
18465
|
-
var ZoneCrossingSchema = object({
|
|
18466
|
-
direction: _enum(["enter", "exit"]),
|
|
18467
|
-
/** Admin zone id crossed. */
|
|
18468
|
-
zoneId: string(),
|
|
18469
|
-
/** Zone display name at crossing time (falls back to the id). */
|
|
18470
|
-
zoneName: string().optional()
|
|
18471
|
-
});
|
|
18472
|
-
var ObjectEventSchema = object({
|
|
18473
|
-
...BaseEventFields,
|
|
18474
|
-
kind: literal("object"),
|
|
18475
|
-
/** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
|
|
18476
|
-
source: DetectionSourceSchema.optional(),
|
|
18477
|
-
/**
|
|
18478
|
-
* Inference-frame id shared by every object event emitted from the SAME frame
|
|
18479
|
-
* — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
|
|
18480
|
-
* 2 people + 1 dog) under one full frame, and link a track's frames over time
|
|
18481
|
-
* (group by `trackId`, pick a representative `frameId` as the parent frame).
|
|
18482
|
-
* Optional for backward-compat with pre-existing rows / the slim projection
|
|
18483
|
-
* includes it (it is light). Absent on rows written before this field.
|
|
18484
|
-
*/
|
|
18485
|
-
frameId: string().optional(),
|
|
18486
|
-
/** Omitted in slim projection. */
|
|
18487
|
-
trackId: string().optional(),
|
|
18488
|
-
className: string(),
|
|
18489
|
-
...TieredLabelFields,
|
|
18490
|
-
/** Omitted in slim projection. */
|
|
18491
|
-
confidence: number().optional(),
|
|
18492
|
-
/** Heavy JSON — omitted in slim projection. */
|
|
18493
|
-
bbox: BoundingBoxSchema.optional(),
|
|
18494
|
-
/** Heavy JSON — omitted in slim projection. */
|
|
18495
|
-
zones: array(string()).readonly().optional(),
|
|
18496
|
-
/** Omitted in slim projection. */
|
|
18497
|
-
state: TrackStateSchema.optional(),
|
|
18498
|
-
/**
|
|
18499
|
-
* The zone crossing this event IS, when it is one. Absent on every other
|
|
18500
|
-
* event kind (movement state, appearance, package) — see
|
|
18501
|
-
* {@link ZoneCrossingSchema}. Omitted in slim projection.
|
|
18502
|
-
*/
|
|
18503
|
-
zoneCrossing: ZoneCrossingSchema.optional(),
|
|
18504
|
-
/** Detection-frame dimensions in pixels — let consumers normalize the
|
|
18505
|
-
* pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
|
|
18506
|
-
frameWidth: number().optional(),
|
|
18507
|
-
frameHeight: number().optional(),
|
|
18508
|
-
/** MediaStore key for the crop attached to this event (if any). */
|
|
18509
|
-
mediaKey: string().optional(),
|
|
18510
|
-
/** Design B: MediaStore key of the track's native-resolution key frame (the
|
|
18511
|
-
* best-detection full frame). Resolve via the event-media data-plane
|
|
18512
|
-
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
|
|
18513
|
-
* draws `bbox` over the native frame. Absent on legacy rows / non-decoded
|
|
18514
|
-
* sources — consumers fall back to `mediaKey` (the tight crop). */
|
|
18515
|
-
keyFrameMediaKey: string().optional(),
|
|
18516
|
-
/** Populated by B5 (recording playback URL for this event). */
|
|
18517
|
-
mediaUrl: string().optional(),
|
|
18518
|
-
/** The parent track's key-event importance [0,1], propagated to every object
|
|
18519
|
-
* event of the track (so an event row can be sorted by importance without a
|
|
18520
|
-
* track join). Absent on legacy rows / before the track was scored. */
|
|
18521
|
-
importance: number().optional()
|
|
18522
|
-
});
|
|
18523
|
-
var AudioEventSchema = object({
|
|
18524
|
-
...BaseEventFields,
|
|
18525
|
-
kind: literal("audio"),
|
|
18526
|
-
rms: number(),
|
|
18527
|
-
dbfs: number(),
|
|
18528
|
-
classification: object({
|
|
18529
|
-
className: string(),
|
|
18530
|
-
originalClass: string().optional(),
|
|
18531
|
-
score: number()
|
|
18532
|
-
}).optional(),
|
|
18533
|
-
/** Populated by B5 (recording playback URL for this event). */
|
|
18534
|
-
mediaUrl: string().optional()
|
|
18535
|
-
});
|
|
18536
|
-
var MediaFileKindEnum = _enum([
|
|
18537
|
-
"crop",
|
|
18538
|
-
"thumbnail",
|
|
18539
|
-
"snapshot",
|
|
18540
|
-
"firstFrame",
|
|
18541
|
-
"lastFrame",
|
|
18542
|
-
"fullFrame",
|
|
18543
|
-
"fullFrameBoxed",
|
|
18544
|
-
"faceCrop",
|
|
18545
|
-
"plateCrop",
|
|
18546
|
-
"keyFrame",
|
|
18547
|
-
"keyFrameSmall",
|
|
18548
|
-
"thumbnailSmall"
|
|
18549
|
-
]);
|
|
18550
|
-
var MediaFileSchema = object({
|
|
18551
|
-
key: string(),
|
|
18552
|
-
kind: MediaFileKindEnum,
|
|
18553
|
-
base64: string(),
|
|
18554
|
-
sizeBytes: number(),
|
|
18555
|
-
timestamp: number()
|
|
18556
|
-
});
|
|
18557
|
-
/**
|
|
18558
|
-
* One media row WITHOUT its bytes.
|
|
18559
|
-
*
|
|
18560
|
-
* A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
|
|
18561
|
-
* 140 s track), and a client that renders tiles from the media data plane needs
|
|
18562
|
-
* to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
|
|
18563
|
-
* with an immutable cache, instead of all at once inside a tRPC response that
|
|
18564
|
-
* blocks the whole view.
|
|
18565
|
-
*
|
|
18566
|
-
* `sizeBytes` is carried because it is what lets a client decide between the
|
|
18567
|
-
* stored blob and a `?variant=thumb` rendering without fetching either.
|
|
18568
|
-
*/
|
|
18569
|
-
var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
|
|
18570
|
-
/**
|
|
18571
|
-
* The MACRO tier of an annotation — a CLOSED set.
|
|
18572
|
-
*
|
|
18573
|
-
* This is what the exported detector predicts, so a typo here is a new class
|
|
18574
|
-
* with one example in it. `label` and `subLabel` are open strings by contrast:
|
|
18575
|
-
* the whole point of the page is teaching the model things it does not know
|
|
18576
|
-
* yet, and constraining that vocabulary would make it useless.
|
|
18577
|
-
*
|
|
18578
|
-
* A macro class is NEVER a label. The provider refuses a write whose `label` or
|
|
18579
|
-
* `subLabel` is one of these values, in any casing, because once `person`
|
|
18580
|
-
* exists in both tiers "every person box" stops being answerable without
|
|
18581
|
-
* knowing every string anyone ever typed — and the damage is retroactive.
|
|
18582
|
-
*/
|
|
18583
|
-
var RetrainMacroClassSchema = _enum([
|
|
18584
|
-
"person",
|
|
18585
|
-
"vehicle",
|
|
18586
|
-
"animal",
|
|
18587
|
-
"package",
|
|
18588
|
-
"face",
|
|
18589
|
-
"plate"
|
|
18590
|
-
]);
|
|
18591
|
-
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
18592
|
-
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
18593
|
-
/** Did a human draw this box, or did the assist propose it? */
|
|
18594
|
-
var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
|
|
18595
|
-
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
18596
|
-
var RetrainBboxSchema = object({
|
|
18597
|
-
x: number(),
|
|
18598
|
-
y: number(),
|
|
18599
|
-
w: number(),
|
|
18600
|
-
h: number()
|
|
18601
|
-
});
|
|
18602
|
-
/**
|
|
18603
|
-
* One annotated subject.
|
|
18604
|
-
*
|
|
18605
|
-
* `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
|
|
18606
|
-
* (letterboxed root / zone-cropped package / subject-cropped classifier) are
|
|
18607
|
-
* derived from it at export and never stored — storing them is how one feature
|
|
18608
|
-
* space ends up holding two crops of the same subject (D52).
|
|
18609
|
-
*/
|
|
18610
|
-
var RetrainAnnotationSchema = object({
|
|
18611
|
-
id: string(),
|
|
18612
|
-
trackId: string(),
|
|
18613
|
-
deviceId: number(),
|
|
18614
|
-
/** The COPY in retrain storage — never the source track's media key. */
|
|
18615
|
-
mediaKey: string(),
|
|
18616
|
-
bbox: RetrainBboxSchema,
|
|
18617
|
-
macroClass: RetrainMacroClassSchema,
|
|
18618
|
-
label: string().optional(),
|
|
18619
|
-
subLabel: string().optional(),
|
|
18620
|
-
kind: RetrainAnnotationKindSchema,
|
|
18621
|
-
source: RetrainAnnotationSourceSchema,
|
|
18622
|
-
/** Which model proposed this box — or, on a `model_error`, drew the phantom. */
|
|
18623
|
-
assistModelId: string().optional(),
|
|
18624
|
-
assistScore: number().optional(),
|
|
18625
|
-
exportedInBatch: string().optional(),
|
|
18626
|
-
createdAt: number()
|
|
18627
|
-
});
|
|
18628
|
-
/** The write form — the server owns `id`, `createdAt` and the frame binding. */
|
|
18629
|
-
var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
|
|
18630
|
-
id: true,
|
|
18631
|
-
trackId: true,
|
|
18632
|
-
deviceId: true,
|
|
18633
|
-
mediaKey: true,
|
|
18634
|
-
createdAt: true,
|
|
18635
|
-
exportedInBatch: true
|
|
18636
|
-
});
|
|
18637
|
-
/** A track sitting in `staging`, with everything the worklist needs to rank it. */
|
|
18638
|
-
var RetrainTrackSchema = object({
|
|
18639
|
-
trackId: string(),
|
|
18640
|
-
deviceId: number(),
|
|
18641
|
-
className: string(),
|
|
18642
|
-
label: string().optional(),
|
|
18643
|
-
firstSeen: number(),
|
|
18644
|
-
lastSeen: number(),
|
|
18645
|
-
/** How many frames the dataset already holds from this track. */
|
|
18646
|
-
frameCount: number().int(),
|
|
18647
|
-
/** How many subjects have been annotated on those frames. `0` with
|
|
18648
|
-
* `frameCount: 0` is exactly "staging, still to work". */
|
|
18649
|
-
annotationCount: number().int()
|
|
18650
|
-
});
|
|
18651
|
-
/** A frame the picker may offer — an index row, no blob was read to produce it. */
|
|
18652
|
-
var RetrainFrameCandidateSchema = object({
|
|
18653
|
-
mediaKey: string(),
|
|
18654
|
-
kind: MediaFileKindEnum,
|
|
18655
|
-
timestamp: number(),
|
|
18656
|
-
sizeBytes: number().int(),
|
|
18657
|
-
/** A copy of this original already exists — selecting it is free and cannot
|
|
18658
|
-
* fail, whatever became of the original. */
|
|
18659
|
-
copied: boolean()
|
|
18660
|
-
});
|
|
18661
|
-
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
18662
|
-
var RetrainFrameSchema = object({
|
|
18663
|
-
frameId: string(),
|
|
18664
|
-
deviceId: number(),
|
|
18665
|
-
trackId: string(),
|
|
18666
|
-
/** Provenance only. It may already point at nothing — that is expected. */
|
|
18667
|
-
sourceMediaKey: string(),
|
|
18668
|
-
sourceKind: MediaFileKindEnum,
|
|
18669
|
-
sizeBytes: number().int(),
|
|
18670
|
-
width: number().int(),
|
|
18671
|
-
height: number().int(),
|
|
18672
|
-
copiedAt: number()
|
|
18673
|
-
});
|
|
18674
|
-
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
18675
|
-
var RetrainCopyRefusalSchema = _enum([
|
|
18676
|
-
"source-missing",
|
|
18677
|
-
"unreadable-image",
|
|
18678
|
-
"write-failed"
|
|
18679
|
-
]);
|
|
18680
|
-
var RetrainFrameSelectionSchema = object({
|
|
18681
|
-
copied: array(RetrainFrameSchema).readonly(),
|
|
18682
|
-
refused: array(object({
|
|
18683
|
-
sourceMediaKey: string(),
|
|
18684
|
-
reason: RetrainCopyRefusalSchema
|
|
18685
|
-
})).readonly()
|
|
18686
|
-
});
|
|
18687
|
-
var RetrainFrameListSchema = object({
|
|
18688
|
-
candidates: array(RetrainFrameCandidateSchema).readonly(),
|
|
18689
|
-
copies: array(RetrainFrameSchema).readonly(),
|
|
18690
|
-
/** What the page pre-selects — the native key frame when one survives. */
|
|
18691
|
-
autoPickMediaKey: string().optional()
|
|
18692
|
-
});
|
|
18693
|
-
/** What the operator asked the assist to look for. */
|
|
18694
|
-
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
18695
|
-
kind: literal("package"),
|
|
18696
|
-
zone: RetrainBboxSchema.optional()
|
|
18697
|
-
}), object({
|
|
18698
|
-
kind: literal("objects"),
|
|
18699
|
-
modelId: string(),
|
|
18700
|
-
minScore: number().optional()
|
|
18701
|
-
})]);
|
|
18702
|
-
/**
|
|
18703
|
-
* The assist's answer — a discriminated union, because "the model saw nothing"
|
|
18704
|
-
* and "this node cannot run that model" lead to different next moves and a
|
|
18705
|
-
* nullable result cannot tell them apart.
|
|
18706
|
-
*/
|
|
18707
|
-
var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
18708
|
-
kind: literal("proposed"),
|
|
18709
|
-
modelId: string(),
|
|
18710
|
-
stepId: string(),
|
|
18711
|
-
minScore: number(),
|
|
18712
|
-
/** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
|
|
18713
|
-
proposals: array(RetrainAnnotationDraftSchema).readonly(),
|
|
18714
|
-
/** Returned by the runner but removed by the threshold. */
|
|
18715
|
-
belowThreshold: number().int()
|
|
18716
|
-
}), object({
|
|
18717
|
-
kind: literal("refused"),
|
|
18718
|
-
/** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
|
|
18719
|
-
reason: string(),
|
|
18720
|
-
detail: string().optional()
|
|
18721
|
-
})]);
|
|
18722
|
-
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
18723
|
-
var RetrainTransitionResultSchema = object({
|
|
18724
|
-
trackId: string(),
|
|
18725
|
-
/** Where the track ended up, whatever happened. */
|
|
18726
|
-
retrainStatus: RetrainStatusSchema,
|
|
18727
|
-
/** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
|
|
18728
|
-
changed: boolean(),
|
|
18729
|
-
reason: _enum([
|
|
18730
|
-
"unknown-track",
|
|
18731
|
-
"no-frames-copied",
|
|
18732
|
-
"not-staging",
|
|
18733
|
-
"not-trained",
|
|
18734
|
-
"unchanged"
|
|
18735
|
-
]).optional()
|
|
18736
|
-
});
|
|
18737
|
-
var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
|
|
18738
|
-
var MAX_EVENT_QUERY_LIMIT = 5e3;
|
|
18739
|
-
var DeviceEventQueryInput = object({
|
|
18740
|
-
deviceId: number(),
|
|
18741
|
-
since: number().optional(),
|
|
18742
|
-
until: number().optional(),
|
|
18743
|
-
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
|
|
18744
|
-
/** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
|
|
18745
|
-
* optional `mediaUrl` (populated by B5). `full` (default) keeps today's
|
|
18746
|
-
* exact behaviour. Callers may omit this field — the store defaults to
|
|
18747
|
-
* `full` when not provided. */
|
|
18748
|
-
projection: _enum(["full", "slim"]).optional()
|
|
18749
|
-
});
|
|
18750
|
-
var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
|
|
18751
|
-
var RecentTracksQueryInput = object({
|
|
18752
|
-
/** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
|
|
18753
|
-
deviceIds: array(number()),
|
|
18754
|
-
/** Window lower bound on `lastSeen` (inclusive). */
|
|
18755
|
-
since: number().optional(),
|
|
18756
|
-
/** Window upper bound on `lastSeen` (inclusive). */
|
|
18757
|
-
until: number().optional(),
|
|
18758
|
-
/** Page size. Default 200, max 1000. */
|
|
18759
|
-
limit: number().int().min(1).max(1e3).default(200),
|
|
18760
|
-
/** Opaque continuation cursor from a previous page's `nextCursor`.
|
|
18761
|
-
* Encodes the (lastSeen, trackId) sort position — treat as opaque. */
|
|
18762
|
-
cursor: string().optional(),
|
|
18763
|
-
/** See {@link TrackProjectionSchema}. Default `full`. */
|
|
18764
|
-
projection: TrackProjectionSchema.optional(),
|
|
18765
|
-
/** Include stationary-promoted rows (parked objects). Default false: the
|
|
18766
|
-
* feed lists passages; parking records live on the stationary registry. */
|
|
18767
|
-
includeStationary: boolean().optional()
|
|
18768
|
-
});
|
|
18769
|
-
var RecentTracksPageSchema = object({
|
|
18770
|
-
/** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
|
|
18771
|
-
tracks: array(TrackSchema).readonly(),
|
|
18772
|
-
/** Cursor for the next page, or null when this page is the last. */
|
|
18773
|
-
nextCursor: string().nullable()
|
|
18774
|
-
});
|
|
18775
|
-
var LIST_GROUPS_DEFAULT_LIMIT = 40;
|
|
18776
|
-
var LIST_GROUPS_MAX_LIMIT = 100;
|
|
18777
|
-
var AnalyticsGroupRecordSchema = object({
|
|
18778
|
-
id: string(),
|
|
18779
|
-
deviceId: number().int(),
|
|
18780
|
-
openedAt: number().int(),
|
|
18781
|
-
closedAt: number().int(),
|
|
18782
|
-
timestamp: number().int(),
|
|
18783
|
-
memberCount: number().int(),
|
|
18784
|
-
memberTrackIds: array(string()).readonly(),
|
|
18785
|
-
className: string(),
|
|
18786
|
-
classes: array(string()).readonly(),
|
|
18787
|
-
/** Relative event-media path, or null when the group has no picture yet. */
|
|
18788
|
-
mediaUrl: string().nullable(),
|
|
18789
|
-
singleton: boolean()
|
|
18790
|
-
});
|
|
18791
|
-
var AnalyticsGroupMemberSchema = object({
|
|
18792
|
-
trackId: string(),
|
|
18793
|
-
deviceId: number().int(),
|
|
18794
|
-
className: string(),
|
|
18795
|
-
firstSeen: number().int(),
|
|
18796
|
-
lastSeen: number().int(),
|
|
18797
|
-
mediaUrl: string().nullable()
|
|
18798
|
-
});
|
|
18799
|
-
var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
|
|
18800
|
-
var ListGroupsQueryInput = object({
|
|
18801
|
-
/** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
|
|
18802
|
-
deviceIds: array(number()),
|
|
18803
|
-
/** Window lower bound on `closedAt` (inclusive). */
|
|
18804
|
-
since: number().optional(),
|
|
18805
|
-
/** Window upper bound on `openedAt` (inclusive). */
|
|
18806
|
-
until: number().optional(),
|
|
18807
|
-
limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
|
|
18808
|
-
/** Opaque continuation cursor from a previous page's `nextCursor`. */
|
|
18809
|
-
cursor: string().optional()
|
|
18810
|
-
});
|
|
18811
|
-
var ListGroupsPageSchema = object({
|
|
18812
|
-
groups: array(AnalyticsGroupRecordSchema).readonly(),
|
|
18813
|
-
nextCursor: string().nullable()
|
|
18814
|
-
});
|
|
18815
|
-
var KeyEventQueryInput = object({
|
|
18816
|
-
deviceId: number(),
|
|
18817
|
-
/** Window lower bound (track firstSeen ≥ since). */
|
|
18818
|
-
since: number(),
|
|
18819
|
-
/** Window upper bound (track firstSeen ≤ until). */
|
|
18820
|
-
until: number(),
|
|
18821
|
-
limit: number().int().min(1).max(200).default(50),
|
|
18822
|
-
/** Drop tracks scoring below this importance. */
|
|
18823
|
-
minImportance: number().min(0).max(1).optional(),
|
|
18824
|
-
/** Restrict to a single class (e.g. 'person'). */
|
|
18825
|
-
classFilter: string().optional()
|
|
18826
|
-
});
|
|
18827
|
-
var KeyEventSchema = object({
|
|
18828
|
-
/** The representative event id (the track's best ObjectEvent, else its trackId). */
|
|
18829
|
-
id: string(),
|
|
18830
|
-
trackId: string(),
|
|
18831
|
-
/** Track start time (firstSeen). */
|
|
18832
|
-
timestamp: number(),
|
|
18833
|
-
className: string(),
|
|
18834
|
-
...TieredLabelFields,
|
|
18835
|
-
importance: number(),
|
|
18836
|
-
/** Highest-confidence ObjectEvent id for the track (empty when none). */
|
|
18837
|
-
bestEventId: string(),
|
|
18838
|
-
/** Track lifetime in ms (lastSeen - firstSeen). */
|
|
18839
|
-
windowMs: number().optional(),
|
|
18840
|
-
...TrackFlagFields,
|
|
18841
|
-
...TrackRetrainFields
|
|
18842
|
-
});
|
|
18843
|
-
object({
|
|
18844
|
-
trackId: string(),
|
|
18845
|
-
className: string(),
|
|
18846
|
-
confidence: number(),
|
|
18847
|
-
bbox: BoundingBoxSchema,
|
|
18848
|
-
zones: array(string()).readonly(),
|
|
18849
|
-
state: TrackStateSchema
|
|
18850
|
-
});
|
|
18851
|
-
var OverlayDetectionSchema = looseObject({
|
|
18852
|
-
id: string(),
|
|
18853
|
-
kind: _enum(["first-level", "detail"]),
|
|
18854
|
-
macroClass: string(),
|
|
18855
|
-
score: number(),
|
|
18856
|
-
bbox: object({
|
|
18857
|
-
x: number(),
|
|
18858
|
-
y: number(),
|
|
18859
|
-
width: number(),
|
|
18860
|
-
height: number()
|
|
18861
|
-
}),
|
|
18862
|
-
labels: array(looseObject({
|
|
18863
|
-
label: string(),
|
|
18864
|
-
score: number()
|
|
18865
|
-
})).readonly(),
|
|
18866
|
-
parentId: string().optional()
|
|
18867
|
-
});
|
|
18868
|
-
var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
|
|
18869
|
-
var SearchObjectEventsInput = object({
|
|
18870
|
-
text: string(),
|
|
18871
|
-
deviceId: number().optional(),
|
|
18872
|
-
since: number().optional(),
|
|
18873
|
-
until: number().optional(),
|
|
18874
|
-
classFilter: string().optional(),
|
|
18875
|
-
limit: number().default(50),
|
|
18876
|
-
minScore: number().min(0).max(1).default(.2)
|
|
18877
|
-
});
|
|
18878
|
-
var TrackCascadeCountsSchema = object({
|
|
18879
|
-
/** Persisted track roots deleted (authoritative). */
|
|
18880
|
-
tracks: number().int(),
|
|
18881
|
-
/** Object events removed with their tracks (best-effort; see note above). */
|
|
18882
|
-
events: number().int(),
|
|
18883
|
-
/** Track/face/plate-owned media removed (best-effort). Never identity media. */
|
|
18884
|
-
media: number().int(),
|
|
18885
|
-
/** Unassigned (non-enrolled) face reads removed (best-effort). */
|
|
18886
|
-
faces: number().int(),
|
|
18887
|
-
/** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
|
|
18888
|
-
plates: number().int(),
|
|
18889
|
-
/** Per-track CLIP search vectors removed (best-effort). */
|
|
18890
|
-
embeddings: number().int(),
|
|
18891
|
-
/** Group membership + group rows removed with their last member (best-effort). */
|
|
18892
|
-
groups: number().int()
|
|
18893
|
-
});
|
|
18894
|
-
/** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
|
|
18895
|
-
var DiskReconcileCountsSchema = object({
|
|
18896
|
-
mediaDropped: number().int(),
|
|
18897
|
-
tracks: number().int(),
|
|
18898
|
-
events: number().int()
|
|
18899
|
-
});
|
|
18900
|
-
/** Event-store footprint for one camera. */
|
|
18901
|
-
var EventStoreDeviceFootprintSchema = object({
|
|
18902
|
-
deviceId: number(),
|
|
18903
|
-
/** Persisted event rows (motion + object + audio) for the camera. */
|
|
18904
|
-
rows: number().int(),
|
|
18905
|
-
/** Event-owned media bytes on disk for the camera. */
|
|
18906
|
-
bytes: number().int()
|
|
18907
|
-
});
|
|
18908
|
-
/** Aggregate event-store footprint: global totals + per-camera breakdown. */
|
|
18909
|
-
var EventStoreFootprintSchema = object({
|
|
18910
|
-
totalRows: number().int(),
|
|
18911
|
-
totalBytes: number().int(),
|
|
18912
|
-
devices: array(EventStoreDeviceFootprintSchema).readonly()
|
|
18913
|
-
});
|
|
18914
|
-
/** Per-kind counts returned by the event-prune / device-delete mutations. */
|
|
18915
|
-
var EventPruneCountsSchema = object({
|
|
18916
|
-
motion: number().int(),
|
|
18917
|
-
object: number().int(),
|
|
18918
|
-
audio: number().int()
|
|
18919
|
-
});
|
|
18920
|
-
/**
|
|
18921
|
-
* Re-embed stored tracks from their key frames.
|
|
18922
|
-
*
|
|
18923
|
-
* The reason this is an operator-callable method and not a migration script:
|
|
18924
|
-
* every knob that decides what a vector MEANS — encoder model, crop margin,
|
|
18925
|
-
* squaring — is only changeable if the existing vectors can be regenerated.
|
|
18926
|
-
* Mixing feature spaces in one index makes cosine scores incomparable, and the
|
|
18927
|
-
* symptom is a quality regression with no visible cause.
|
|
18928
|
-
*/
|
|
18929
|
-
var RebuildObjectEmbeddingsInput = object({
|
|
18930
|
-
/** Restrict to one camera. Omit for the whole fleet. */
|
|
18931
|
-
deviceId: number().optional(),
|
|
18932
|
-
since: number().optional(),
|
|
18933
|
-
until: number().optional(),
|
|
18934
|
-
/** Stop after this many tracks; the result reports whether more remain. */
|
|
18935
|
-
maxTracks: number().int().positive().optional(),
|
|
18936
|
-
/**
|
|
18937
|
-
* Run every embedding on THIS node instead of round-robining the fleet.
|
|
18938
|
-
*
|
|
18939
|
-
* Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
|
|
18940
|
-
* field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
|
|
18941
|
-
* calling it that would pin the rebuild REQUEST itself to that node — the
|
|
18942
|
-
* rebuild orchestration lives on the hub, and only the per-track step runs
|
|
18943
|
-
* remotely. This field is data; the per-track pin is applied inside.
|
|
18944
|
-
*
|
|
18945
|
-
* Absent ⇒ round-robin over every online node whose runner can serve the
|
|
18946
|
-
* pinned model.
|
|
18947
|
-
*/
|
|
18948
|
-
executeOnNodeId: string().optional(),
|
|
18949
|
-
/**
|
|
18950
|
-
* Milliseconds to wait between tracks; omit for the built-in default, `0` to
|
|
18951
|
-
* run flat out.
|
|
18952
|
-
*
|
|
18953
|
-
* A rebuild is bulk maintenance on hub-main's single thread. Measured
|
|
18954
|
-
* 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
|
|
18955
|
-
* pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
|
|
18956
|
-
* force is logged at start and finish so a deliberately slow pass reads
|
|
18957
|
-
* differently from a stalled one.
|
|
18958
|
-
*/
|
|
18959
|
-
pacingMs: number().int().nonnegative().optional()
|
|
18960
|
-
});
|
|
18961
|
-
/**
|
|
18962
|
-
* Result of emptying the CLIP index.
|
|
18963
|
-
*
|
|
18964
|
-
* The clean slate before a policy change: a new crop margin or encoder model
|
|
18965
|
-
* leaves two feature spaces in one index whose cosine scores are not
|
|
18966
|
-
* comparable, so wiping and rebuilding is the only way to be sure every vector
|
|
18967
|
-
* means the same thing.
|
|
18968
|
-
*/
|
|
18969
|
-
var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
|
|
18970
|
-
/**
|
|
18971
|
-
* Acknowledgement that a rebuild STARTED.
|
|
18972
|
-
*
|
|
18973
|
-
* The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
|
|
18974
|
-
* runs detached and this returns immediately. Waiting for it made the client
|
|
18975
|
-
* time out while the work carried on server-side, which is the worst of both:
|
|
18976
|
-
* no result and no way to know it was still going. Poll
|
|
18977
|
-
* `getObjectEmbeddingRebuildStatus` for progress.
|
|
18978
|
-
*/
|
|
18979
|
-
var RebuildObjectEmbeddingsResultSchema = object({
|
|
18980
|
-
started: boolean(),
|
|
18981
|
-
/** True when a pass was already running; the new request is ignored. */
|
|
18982
|
-
alreadyRunning: boolean()
|
|
18983
|
-
});
|
|
18984
|
-
var RebuildStatusSchema = object({
|
|
18985
|
-
running: boolean(),
|
|
18986
|
-
scanned: number(),
|
|
18987
|
-
rebuilt: number(),
|
|
18988
|
-
/** Tracks whose key frame is gone — nothing to re-embed from. */
|
|
18989
|
-
missingKeyFrame: number(),
|
|
18990
|
-
/** Tracks with no usable detection box. */
|
|
18991
|
-
missingBbox: number(),
|
|
18992
|
-
/**
|
|
18993
|
-
* Tracks an executing node REFUSED rather than broke on — an unreadable key
|
|
18994
|
-
* frame, a step that threw. Separate from `failed` because the remedy is
|
|
18995
|
-
* different, and because a whole camera silently contributing zero vectors
|
|
18996
|
-
* is the shape of failure a rebuild must never hide.
|
|
18997
|
-
*/
|
|
18998
|
-
notRunnable: number(),
|
|
18999
|
-
/**
|
|
19000
|
-
* The pass stopped because NO node could serve the pinned model.
|
|
19001
|
-
*
|
|
19002
|
-
* Distinct from `notRunnable` on purpose: that one says "this track was
|
|
19003
|
-
* refused", this one says "the cluster cannot do this work at all" — every
|
|
19004
|
-
* candidate node either lacks the `clip-embedding` step, lacks a build of the
|
|
19005
|
-
* pinned model for its engine format, or dropped out. The remedy is a model /
|
|
19006
|
-
* engine change, not a per-camera one. Non-zero here always comes with
|
|
19007
|
-
* `complete: false`.
|
|
19008
|
-
*/
|
|
19009
|
-
noCapableNode: number(),
|
|
19010
|
-
failed: number(),
|
|
19011
|
-
/** Set once a pass ends: true only when EVERYTHING was covered. */
|
|
19012
|
-
complete: boolean().nullable(),
|
|
19013
|
-
startedAtMs: number().nullable(),
|
|
19014
|
-
finishedAtMs: number().nullable(),
|
|
19015
|
-
/** Present when the pass ended by throwing. */
|
|
19016
|
-
error: string().nullable()
|
|
19017
|
-
});
|
|
19018
|
-
DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
|
|
19019
|
-
deviceId: number(),
|
|
19020
|
-
trackId: string()
|
|
19021
|
-
}), TrackSchema.nullable()), method(object({
|
|
19022
|
-
deviceId: number(),
|
|
19023
|
-
since: number().optional(),
|
|
19024
|
-
until: number().optional(),
|
|
19025
|
-
limit: number().optional(),
|
|
19026
|
-
/** Spatial filter — only tracks whose trajectory intersects the zone
|
|
19027
|
-
* (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
|
|
19028
|
-
* envelope columns, then precisely tested per position. Tracks with
|
|
19029
|
-
* an unknown envelope (no frame dims at persist time) always match. */
|
|
19030
|
-
zone: TrackZoneFilterSchema.optional(),
|
|
19031
|
-
/** See {@link TrackProjectionSchema}. Default `full` (backward
|
|
19032
|
-
* compatible — omitting the field keeps today's exact behaviour). */
|
|
19033
|
-
projection: TrackProjectionSchema.optional(),
|
|
19034
|
-
/** Include stationary-promoted rows (parked objects handed to the
|
|
19035
|
-
* stationary registry). Default false: the timeline lists passages,
|
|
19036
|
-
* not parking records (operator decision, 2026-08-15). */
|
|
19037
|
-
includeStationary: boolean().optional()
|
|
19038
|
-
}), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
|
|
19039
|
-
deviceId: number(),
|
|
19040
|
-
groupId: string().min(1)
|
|
19041
|
-
}), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
|
|
19042
|
-
kind: "mutation",
|
|
19043
|
-
auth: "admin"
|
|
19044
|
-
}), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()), method(object({
|
|
19045
|
-
deviceId: number(),
|
|
19046
|
-
since: number().optional(),
|
|
19047
|
-
until: number().optional(),
|
|
19048
|
-
kinds: array(string()).optional(),
|
|
19049
|
-
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
|
|
19050
|
-
}), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
|
|
19051
|
-
deviceId: number(),
|
|
19052
|
-
since: number(),
|
|
19053
|
-
until: number(),
|
|
19054
|
-
bucketMs: number().int().positive()
|
|
19055
|
-
}), array(object({
|
|
19056
|
-
bucketStart: number(),
|
|
19057
|
-
motion: number().int(),
|
|
19058
|
-
object: number().int(),
|
|
19059
|
-
audio: number().int()
|
|
19060
|
-
})).readonly()), method(object({
|
|
19061
|
-
deviceId: number(),
|
|
19062
|
-
cutoffMs: number()
|
|
19063
|
-
}), object({
|
|
19064
|
-
motion: number().int(),
|
|
19065
|
-
object: number().int(),
|
|
19066
|
-
audio: number().int()
|
|
19067
|
-
}), {
|
|
19068
|
-
kind: "mutation",
|
|
19069
|
-
auth: "admin"
|
|
19070
|
-
}), method(object({
|
|
19071
|
-
deviceId: number(),
|
|
19072
|
-
cutoffMs: number()
|
|
19073
|
-
}), TrackCascadeCountsSchema, {
|
|
19074
|
-
kind: "mutation",
|
|
19075
|
-
auth: "admin"
|
|
19076
|
-
}), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
|
|
19077
|
-
kind: "mutation",
|
|
19078
|
-
auth: "admin"
|
|
19079
|
-
}), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
|
|
19080
|
-
kind: "mutation",
|
|
19081
|
-
auth: "admin"
|
|
19082
|
-
}), method(object({
|
|
19083
|
-
deviceId: number(),
|
|
19084
|
-
trackIds: array(string()).min(1)
|
|
19085
|
-
}), object({
|
|
19086
|
-
deleted: number().int(),
|
|
19087
|
-
failed: array(string()).readonly()
|
|
19088
|
-
}), {
|
|
19089
|
-
kind: "mutation",
|
|
19090
|
-
auth: "admin"
|
|
19091
|
-
}), method(object({
|
|
19092
|
-
/** Log/audit scope only — the trackId is globally unique on its own. */
|
|
19093
|
-
deviceId: number(),
|
|
19094
|
-
trackId: string(),
|
|
19095
|
-
flags: TrackFlagsPatchSchema
|
|
19096
|
-
}), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
|
|
19097
|
-
kind: "query",
|
|
19098
|
-
auth: "admin"
|
|
19099
|
-
}), method(object({
|
|
19100
|
-
olderThanMs: number(),
|
|
19101
|
-
reason: OpsLogReasonSchema.optional()
|
|
19102
|
-
}), EventPruneCountsSchema, {
|
|
19103
|
-
kind: "mutation",
|
|
19104
|
-
auth: "admin"
|
|
19105
|
-
}), method(object({ deviceId: number() }), EventPruneCountsSchema, {
|
|
19106
|
-
kind: "mutation",
|
|
19107
|
-
auth: "admin"
|
|
19108
|
-
}), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
|
|
19109
|
-
kind: "mutation",
|
|
19110
|
-
auth: "admin"
|
|
19111
|
-
}), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
|
|
19112
|
-
kind: "mutation",
|
|
19113
|
-
auth: "admin"
|
|
19114
|
-
}), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
|
|
19115
|
-
kind: "mutation",
|
|
19116
|
-
auth: "admin"
|
|
19117
|
-
}), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
|
|
19118
|
-
kind: "mutation",
|
|
19119
|
-
auth: "admin"
|
|
19120
|
-
}), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
19121
|
-
kind: "mutation",
|
|
19122
|
-
auth: "admin"
|
|
19123
|
-
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
19124
|
-
kind: "mutation",
|
|
19125
|
-
auth: "admin"
|
|
19126
|
-
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
19127
|
-
kind: "query",
|
|
19128
|
-
auth: "admin"
|
|
19129
|
-
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
19130
|
-
kind: "mutation",
|
|
19131
|
-
auth: "admin"
|
|
19132
|
-
}), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
19133
|
-
kind: "query",
|
|
19134
|
-
auth: "admin"
|
|
19135
|
-
}), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
|
|
19136
|
-
kind: "query",
|
|
19137
|
-
auth: "admin"
|
|
19138
|
-
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
19139
|
-
kind: "query",
|
|
19140
|
-
auth: "admin"
|
|
19141
|
-
}), method(object({
|
|
19142
|
-
/** Empty ⇒ every camera that has staging tracks. A LIST, not a single
|
|
19143
|
-
* `deviceId`, deliberately: `deviceId` would make this device-bound and
|
|
19144
|
-
* route it at one camera's owner, and "every camera" would stop being
|
|
19145
|
-
* expressible at all. */
|
|
19146
|
-
deviceIds: array(number()).optional(),
|
|
19147
|
-
limit: number().int().min(1).max(500).optional()
|
|
19148
|
-
}), array(RetrainTrackSchema).readonly(), {
|
|
19149
|
-
kind: "query",
|
|
19150
|
-
auth: "admin"
|
|
19151
|
-
}), method(object({ trackId: string() }), RetrainFrameListSchema, {
|
|
19152
|
-
kind: "query",
|
|
19153
|
-
auth: "admin"
|
|
19154
|
-
}), method(object({
|
|
19155
|
-
deviceId: number(),
|
|
19156
|
-
trackId: string(),
|
|
19157
|
-
mediaKeys: array(string()).min(1)
|
|
19158
|
-
}), RetrainFrameSelectionSchema, {
|
|
19159
|
-
kind: "mutation",
|
|
19160
|
-
auth: "admin"
|
|
19161
|
-
}), method(object({
|
|
19162
|
-
deviceId: number(),
|
|
19163
|
-
trackId: string(),
|
|
19164
|
-
frameId: string()
|
|
19165
|
-
}), object({
|
|
19166
|
-
removed: boolean(),
|
|
19167
|
-
removedAnnotations: number().int()
|
|
19168
|
-
}), {
|
|
19169
|
-
kind: "mutation",
|
|
19170
|
-
auth: "admin"
|
|
19171
|
-
}), method(object({ frameId: string() }), object({
|
|
19172
|
-
base64: string(),
|
|
19173
|
-
width: number().int(),
|
|
19174
|
-
height: number().int()
|
|
19175
|
-
}), {
|
|
19176
|
-
kind: "query",
|
|
19177
|
-
auth: "admin"
|
|
19178
|
-
}), method(object({
|
|
19179
|
-
deviceId: number(),
|
|
19180
|
-
trackId: string(),
|
|
19181
|
-
frameId: string(),
|
|
19182
|
-
subject: RetrainAssistSubjectSchema,
|
|
19183
|
-
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
19184
|
-
nodeId: string().optional()
|
|
19185
|
-
}), RetrainAssistResultSchema, {
|
|
19186
|
-
kind: "mutation",
|
|
19187
|
-
auth: "admin"
|
|
19188
|
-
}), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
19189
|
-
kind: "query",
|
|
19190
|
-
auth: "admin"
|
|
19191
|
-
}), method(object({
|
|
19192
|
-
deviceId: number(),
|
|
19193
|
-
trackId: string(),
|
|
19194
|
-
frameId: string(),
|
|
19195
|
-
annotations: array(RetrainAnnotationDraftSchema)
|
|
19196
|
-
}), array(RetrainAnnotationSchema).readonly(), {
|
|
19197
|
-
kind: "mutation",
|
|
19198
|
-
auth: "admin"
|
|
19199
|
-
}), method(object({
|
|
19200
|
-
deviceId: number(),
|
|
19201
|
-
trackId: string()
|
|
19202
|
-
}), RetrainTransitionResultSchema, {
|
|
19203
|
-
kind: "mutation",
|
|
19204
|
-
auth: "admin"
|
|
19205
|
-
}), method(object({
|
|
19206
|
-
deviceId: number(),
|
|
19207
|
-
trackId: string()
|
|
19208
|
-
}), RetrainTransitionResultSchema, {
|
|
19209
|
-
kind: "mutation",
|
|
19210
|
-
auth: "admin"
|
|
19211
|
-
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
19212
|
-
kind: "query",
|
|
19213
|
-
auth: "admin"
|
|
19214
|
-
}), method(object({
|
|
19215
|
-
eventId: string(),
|
|
19216
|
-
kind: MediaFileKindEnum.optional(),
|
|
19217
|
-
deviceId: number()
|
|
19218
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
19219
|
-
trackId: string(),
|
|
19220
|
-
kinds: array(MediaFileKindEnum).optional(),
|
|
19221
|
-
deviceId: number()
|
|
19222
|
-
}), array(MediaFileSchema).readonly()), method(object({
|
|
19223
|
-
trackId: string(),
|
|
19224
|
-
deviceId: number()
|
|
19225
|
-
}), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
19226
|
-
kind: "mutation",
|
|
19227
|
-
auth: "admin"
|
|
19228
|
-
}), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
19229
|
-
kind: "mutation",
|
|
19230
|
-
auth: "admin"
|
|
19231
|
-
}), method(object({}), RebuildStatusSchema), object({
|
|
19232
|
-
deviceId: number(),
|
|
19233
|
-
timestamp: number(),
|
|
19234
|
-
frameWidth: number(),
|
|
19235
|
-
frameHeight: number(),
|
|
19236
|
-
detections: array(OverlayDetectionSchema).readonly()
|
|
19237
|
-
}), object({
|
|
19238
|
-
deviceId: number(),
|
|
19239
|
-
trackId: string(),
|
|
19240
|
-
className: string()
|
|
19241
|
-
}), object({
|
|
19242
|
-
deviceId: number(),
|
|
19243
|
-
trackId: string(),
|
|
19244
|
-
className: string(),
|
|
19245
|
-
durationMs: number()
|
|
19246
|
-
}), object({
|
|
19247
|
-
deviceId: number(),
|
|
19248
|
-
kind: EventKindSchema,
|
|
19249
|
-
eventId: string(),
|
|
19250
|
-
timestamp: number()
|
|
19251
|
-
});
|
|
19252
|
-
/**
|
|
19253
|
-
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
19254
|
-
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
19255
|
-
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
19256
|
-
*/
|
|
19257
|
-
var NativeCropRefSchema = object({
|
|
19258
|
-
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
19259
|
-
handle: FrameHandleSchema,
|
|
19260
|
-
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
19261
|
-
cropFrameSpace: object({
|
|
19262
|
-
x: number(),
|
|
19263
|
-
y: number(),
|
|
19264
|
-
w: number(),
|
|
19265
|
-
h: number()
|
|
19266
|
-
})
|
|
19267
|
-
});
|
|
19268
|
-
object({
|
|
19269
|
-
crop: object({
|
|
19270
|
-
left: number(),
|
|
19271
|
-
top: number(),
|
|
19272
|
-
width: number().positive(),
|
|
19273
|
-
height: number().positive()
|
|
19274
|
-
}).optional(),
|
|
19275
|
-
content: object({
|
|
19276
|
-
width: number().int().positive(),
|
|
19277
|
-
height: number().int().positive()
|
|
19278
|
-
}),
|
|
19279
|
-
fit: _enum(["stretch", "contain"]),
|
|
19280
|
-
format: _enum([
|
|
19281
|
-
"rgb",
|
|
19282
|
-
"gray",
|
|
19283
|
-
"jpeg"
|
|
19284
|
-
])
|
|
19285
|
-
});
|
|
19286
|
-
/**
|
|
19287
|
-
* Process-local frame identity. It is serializable so it can ride an in-process
|
|
19288
|
-
* capability call, but `registryId` deliberately prevents resolution in any
|
|
19289
|
-
* other process or execution group.
|
|
19290
|
-
*/
|
|
19291
|
-
var FrameRefSchema = object({
|
|
19292
|
-
registryId: string().min(1),
|
|
19293
|
-
id: string().min(1),
|
|
19294
|
-
width: number().int().positive(),
|
|
19295
|
-
height: number().int().positive(),
|
|
19296
|
-
format: _enum(["rgb", "gray"]),
|
|
19297
|
-
timestamp: number(),
|
|
19298
|
-
capturedAt: number().optional()
|
|
19299
|
-
});
|
|
19300
|
-
var ModelFormatSchema$1 = _enum([
|
|
19301
|
-
"onnx",
|
|
19302
|
-
"coreml",
|
|
19303
|
-
"openvino",
|
|
19304
|
-
"tflite",
|
|
19305
|
-
"pt",
|
|
19306
|
-
"gguf"
|
|
19307
|
-
]);
|
|
19308
|
-
var PipelineSlotSchema = _enum([
|
|
19309
|
-
"detector",
|
|
19310
|
-
"cropper",
|
|
19311
|
-
"classifier",
|
|
19312
|
-
"refiner",
|
|
19313
|
-
"audio-classifier"
|
|
19314
|
-
]);
|
|
19315
|
-
var PipelineEngineChoiceSchema = object({
|
|
19316
|
-
runtime: _enum(["node", "python"]),
|
|
19317
|
-
backend: string(),
|
|
19318
|
-
format: ModelFormatSchema$1,
|
|
19319
|
-
device: string().optional()
|
|
19320
|
-
});
|
|
19321
|
-
var AvailableEngineSchema = object({
|
|
19322
|
-
engine: PipelineEngineChoiceSchema,
|
|
19323
|
-
devices: array(object({
|
|
19324
|
-
id: string(),
|
|
19325
|
-
label: string(),
|
|
19326
|
-
description: string().optional()
|
|
19327
|
-
})).readonly(),
|
|
19328
|
-
defaultDevice: string()
|
|
19329
|
-
});
|
|
19330
|
-
var PipelineDefaultStepSchema = lazy(() => object({
|
|
19331
|
-
addonId: string(),
|
|
19332
|
-
addonName: string(),
|
|
19333
|
-
slot: PipelineSlotSchema,
|
|
19334
|
-
inputClasses: array(string()).readonly(),
|
|
19335
|
-
outputClasses: array(string()).readonly(),
|
|
19336
|
-
enabled: boolean(),
|
|
19337
|
-
modelId: string(),
|
|
19338
|
-
children: array(PipelineDefaultStepSchema).readonly(),
|
|
19339
|
-
group: string().optional(),
|
|
19340
|
-
settings: record(string(), unknown()).optional()
|
|
19341
|
-
}));
|
|
19342
|
-
var PipelineTemplateStepSchema = lazy(() => object({
|
|
19343
|
-
addonId: string(),
|
|
19344
|
-
enabled: boolean(),
|
|
19345
|
-
modelId: string(),
|
|
19346
|
-
children: array(PipelineTemplateStepSchema).readonly(),
|
|
19347
|
-
settings: record(string(), unknown()).optional()
|
|
19348
|
-
}));
|
|
19349
|
-
var PipelineTemplateSchema$1 = object({
|
|
19350
|
-
id: string(),
|
|
19351
|
-
name: string(),
|
|
19352
|
-
createdAt: string(),
|
|
19353
|
-
updatedAt: string(),
|
|
19354
|
-
engine: PipelineEngineChoiceSchema,
|
|
19355
|
-
steps: array(PipelineTemplateStepSchema).readonly()
|
|
19356
|
-
});
|
|
19357
|
-
var PipelineModelOptionSchema = object({
|
|
19358
|
-
id: string(),
|
|
19359
|
-
name: string(),
|
|
19360
|
-
formats: record(string(), object({
|
|
19361
|
-
downloaded: boolean(),
|
|
19362
|
-
sizeMB: number()
|
|
19363
|
-
})),
|
|
19364
|
-
group: ModelVariantGroupSchema.optional(),
|
|
19365
|
-
legacy: boolean().optional(),
|
|
19366
|
-
provider: ModelProviderIdSchema.optional()
|
|
19367
|
-
});
|
|
19368
|
-
var ConfigFieldBridge = custom();
|
|
19369
|
-
var PipelineAddonSchemaSchema = object({
|
|
19370
|
-
id: string(),
|
|
19371
|
-
name: string(),
|
|
19372
|
-
slot: PipelineSlotSchema,
|
|
19373
|
-
inputClasses: array(string()).readonly(),
|
|
19374
|
-
outputClasses: array(string()).readonly(),
|
|
19375
|
-
childSlots: array(PipelineSlotSchema).readonly(),
|
|
19376
|
-
models: array(PipelineModelOptionSchema).readonly(),
|
|
19377
|
-
defaultModelId: string(),
|
|
19378
|
-
defaultModelIdByFormat: record(string(), string()).optional(),
|
|
19379
|
-
enabledByDefault: boolean().optional(),
|
|
19380
|
-
backfillIntoExistingOverrides: boolean().optional(),
|
|
19381
|
-
defaultConfidence: number(),
|
|
19382
|
-
group: string().optional(),
|
|
19383
|
-
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
19384
|
-
});
|
|
19385
|
-
var PipelineSlotSchemaSchema = object({
|
|
19386
|
-
id: PipelineSlotSchema,
|
|
19387
|
-
label: string(),
|
|
19388
|
-
priority: number(),
|
|
19389
|
-
parentSlot: PipelineSlotSchema.nullable(),
|
|
19390
|
-
addons: array(PipelineAddonSchemaSchema).readonly()
|
|
19391
|
-
});
|
|
19392
|
-
var PipelineSchemaSchema = object({
|
|
19393
|
-
availableEngines: array(AvailableEngineSchema).readonly(),
|
|
19394
|
-
selectedEngine: PipelineEngineChoiceSchema,
|
|
19395
|
-
slots: array(PipelineSlotSchemaSchema).readonly()
|
|
19396
|
-
});
|
|
19397
|
-
var EngineProvisioningSchema = object({
|
|
19398
|
-
runtimeId: _enum([
|
|
19399
|
-
"onnx",
|
|
19400
|
-
"openvino",
|
|
19401
|
-
"coreml",
|
|
19402
|
-
"edgetpu"
|
|
19403
|
-
]).nullable(),
|
|
19404
|
-
device: string().nullable(),
|
|
19405
|
-
state: _enum([
|
|
19406
|
-
"idle",
|
|
19407
|
-
"installing",
|
|
19408
|
-
"verifying",
|
|
19409
|
-
"ready",
|
|
19410
|
-
"failed"
|
|
19411
|
-
]),
|
|
19412
|
-
progress: number().optional(),
|
|
19413
|
-
error: string().optional(),
|
|
19414
|
-
nextRetryAt: number().optional(),
|
|
19415
|
-
/**
|
|
19416
|
-
* Gate A (config-correctness gate at engine change): human-readable
|
|
19417
|
-
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
19418
|
-
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
19419
|
-
* has a <format> build"). Additive/optional: informational only, never
|
|
19420
|
-
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
19421
|
-
* Absent/empty when the node-default tree resolves cleanly.
|
|
19422
|
-
*/
|
|
19423
|
-
configIssues: array(string()).optional()
|
|
19424
|
-
});
|
|
19425
|
-
var PipelineStepInputSchema = lazy(() => object({
|
|
19426
|
-
addonId: string(),
|
|
19427
|
-
modelId: string().optional(),
|
|
19428
|
-
enabled: boolean().default(true),
|
|
19429
|
-
children: array(PipelineStepInputSchema).optional(),
|
|
19430
|
-
settings: record(string(), unknown()).optional(),
|
|
19431
|
-
jumpDeviceKey: string().optional()
|
|
19432
|
-
}));
|
|
19433
|
-
var ModelSubstitutionSchema = object({
|
|
19434
|
-
addonId: string(),
|
|
19435
|
-
chosen: string(),
|
|
19436
|
-
running: string(),
|
|
19437
|
-
format: string()
|
|
19438
|
-
});
|
|
19439
|
-
var PipelineValidationIssueSchema = object({
|
|
19440
|
-
addonId: string(),
|
|
19441
|
-
kind: _enum(["unknown-addon", "no-format-build"]),
|
|
19442
|
-
detail: string()
|
|
19443
|
-
});
|
|
19444
|
-
var PipelineValidationResultSchema = object({
|
|
19445
|
-
ok: boolean(),
|
|
19446
|
-
issues: array(PipelineValidationIssueSchema).readonly(),
|
|
19447
|
-
substitutions: array(ModelSubstitutionSchema).readonly(),
|
|
19448
|
-
/** The node's `currentEngine.format` this validation ran against. */
|
|
19449
|
-
format: string()
|
|
19450
|
-
});
|
|
19451
|
-
var ReferenceImageEntrySchema = object({
|
|
19452
|
-
filename: string(),
|
|
19453
|
-
stepIds: array(string()).readonly().optional()
|
|
19454
|
-
});
|
|
19455
|
-
var ReferenceImageBodySchema = object({
|
|
19456
|
-
base64: string(),
|
|
19457
|
-
filename: string()
|
|
19458
|
-
});
|
|
19459
|
-
var ReferenceAudioEntrySchema = object({
|
|
19460
|
-
filename: string(),
|
|
19461
|
-
sizeKb: number()
|
|
19462
|
-
});
|
|
19463
|
-
var ReferenceAudioBodySchema = object({ base64: string() });
|
|
19464
|
-
var AudioBackendSchema = object({
|
|
19465
|
-
id: string(),
|
|
19466
|
-
name: string(),
|
|
19467
|
-
description: string(),
|
|
19468
|
-
available: boolean(),
|
|
19469
|
-
/**
|
|
19470
|
-
* Raw classifier labels this backend can emit (e.g. YAMNet's
|
|
19471
|
-
* 521-class set or Apple SoundAnalysis's 303-class set). Used by
|
|
19472
|
-
* the benchmark UI to populate the `enabledMicroClasses` filter
|
|
19473
|
-
* specific to the selected backend without a separate fetch.
|
|
19474
|
-
*/
|
|
19475
|
-
rawLabels: array(string()).readonly().optional()
|
|
19476
|
-
});
|
|
19477
|
-
var AudioCapabilitiesSchema = object({
|
|
19478
|
-
activeBackend: string(),
|
|
19479
|
-
availableBackends: array(AudioBackendSchema).readonly(),
|
|
19480
|
-
sampleRate: number(),
|
|
19481
|
-
chunkDurationMs: number()
|
|
19482
|
-
});
|
|
19483
|
-
var DownloadModelResultSchema = object({
|
|
19484
|
-
filePath: string(),
|
|
19485
|
-
sizeMB: number(),
|
|
19486
|
-
durationMs: number()
|
|
19487
|
-
});
|
|
19488
|
-
/**
|
|
19489
|
-
* Wrapper carrying a single test run's result. Replaces the legacy
|
|
19490
|
-
* ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
|
|
19491
|
-
* canonical `AudioResult` from the Phase 6 output rework: one
|
|
19492
|
-
* `AudioDetection` per class above `minScore`, top-N candidates in
|
|
19493
|
-
* `debug.alternateLabels['audio-classifier']`, per-source timings in
|
|
19494
|
-
* `debug.stepTimings`. The outer `success`/`error` fields stay so the
|
|
19495
|
-
* benchmark UI can still report a clean failure when the classifier
|
|
19496
|
-
* cap isn't available.
|
|
19497
|
-
*/
|
|
19498
|
-
var AudioTestResultSchema = object({
|
|
19499
|
-
success: boolean(),
|
|
19500
|
-
error: string().optional(),
|
|
19501
|
-
frame: custom().optional()
|
|
19502
|
-
});
|
|
19503
|
-
var PipelineConfigBridge = custom();
|
|
19504
|
-
var ConfigUISchemaBridge = custom();
|
|
19505
|
-
var ConfigUISchemaNullableBridge = custom();
|
|
19506
|
-
var InferenceCapabilitiesBridge = custom();
|
|
19507
|
-
var ModelAvailabilityListBridge = custom();
|
|
19508
|
-
var PipelineRunResultBridge = custom();
|
|
19509
|
-
/**
|
|
19510
|
-
* Pipeline executor — detection engine + configuration + inference API.
|
|
19511
|
-
*
|
|
19512
|
-
* Merged from: pipeline-executor, pipeline-config, inference, detection-config.
|
|
19513
|
-
* Implemented by the detection-pipeline addon.
|
|
19514
|
-
*
|
|
19515
|
-
* Per-device surface (DeviceSettingsContribution + the "is detection
|
|
19516
|
-
* enabled for this camera?" toggle) lives on the paired
|
|
19517
|
-
* `detection-pipeline` cap (device-scoped, singleton, wrapper
|
|
19518
|
-
* defaultActive) — same split pattern used by stream-broker /
|
|
19519
|
-
* camera-streams and audio-analyzer / audio-analysis.
|
|
18208
|
+
* Per-device surface (DeviceSettingsContribution + the "is detection
|
|
18209
|
+
* enabled for this camera?" toggle) lives on the paired
|
|
18210
|
+
* `detection-pipeline` cap (device-scoped, singleton, wrapper
|
|
18211
|
+
* defaultActive) — same split pattern used by stream-broker /
|
|
18212
|
+
* camera-streams and audio-analyzer / audio-analysis.
|
|
19520
18213
|
*/
|
|
19521
18214
|
var pipelineExecutorCapability = {
|
|
19522
18215
|
name: "pipeline-executor",
|
|
@@ -19568,6 +18261,60 @@ var pipelineExecutorCapability = {
|
|
|
19568
18261
|
kind: "mutation",
|
|
19569
18262
|
auth: "admin"
|
|
19570
18263
|
}),
|
|
18264
|
+
/**
|
|
18265
|
+
* Which of THIS node's inference devices the executor currently refuses,
|
|
18266
|
+
* and why. `nodeId` is the ROUTING key (stripped by the generated router).
|
|
18267
|
+
*
|
|
18268
|
+
* The channel that did not exist. Pool health was known only inside the
|
|
18269
|
+
* detection addon and was an input to no routing decision anywhere: the
|
|
18270
|
+
* per-dispatch capability gate is keyed on model FORMAT and so can never
|
|
18271
|
+
* separate `openvino:gpu` from `openvino:npu`, and the orchestrator's live
|
|
18272
|
+
* eligibility probe (`platformProbe.getCapabilities`) answers about
|
|
18273
|
+
* HARDWARE — which was present throughout. So when the hub's `openvino:gpu`
|
|
18274
|
+
* Python worker was SIGABRT'd by the Intel GPU plugin on 2026-08-25, the
|
|
18275
|
+
* balancer went on handing that dead pool cameras by rotation for 31 hours:
|
|
18276
|
+
* ~370 000 `PoolWorker[w0]: not initialized` lines, every frame lost.
|
|
18277
|
+
*
|
|
18278
|
+
* Read semantics the caller depends on, and which the provider guarantees:
|
|
18279
|
+
* this is a synchronous read of in-memory state. It never probes hardware,
|
|
18280
|
+
* never spawns a pool and never throws — an EMPTY `unhealthy` means "asked,
|
|
18281
|
+
* nothing is refused", which is what re-admits a device. A read that FAILS
|
|
18282
|
+
* (node offline, version skew) must therefore be distinguishable from an
|
|
18283
|
+
* empty answer, and it is: it rejects.
|
|
18284
|
+
*/
|
|
18285
|
+
getInferenceDeviceHealth: method(object({ nodeId: string() }), object({ unhealthy: array(object({
|
|
18286
|
+
/** `<backend>:<device>`, e.g. `openvino:gpu`. */
|
|
18287
|
+
deviceKey: string(),
|
|
18288
|
+
/**
|
|
18289
|
+
* `failed` — the per-device restart budget is exhausted; no pool
|
|
18290
|
+
* will be spawned until an operator re-arms it or the runner
|
|
18291
|
+
* respawns. `backoff` — under budget, waiting out the backoff (or
|
|
18292
|
+
* a cached pool observed dead and not yet condemned).
|
|
18293
|
+
*/
|
|
18294
|
+
state: _enum(["failed", "backoff"]),
|
|
18295
|
+
/** Epoch ms of the death that produced this state. */
|
|
18296
|
+
since: number(),
|
|
18297
|
+
/** Pool deaths inside the current window. */
|
|
18298
|
+
deaths: number(),
|
|
18299
|
+
/** The last death's message. */
|
|
18300
|
+
lastError: string()
|
|
18301
|
+
})).readonly() })),
|
|
18302
|
+
/**
|
|
18303
|
+
* Re-arm a terminally `failed` inference device on `nodeId`: forget its
|
|
18304
|
+
* restart budget so the next dispatch builds a fresh pool.
|
|
18305
|
+
*
|
|
18306
|
+
* The terminal state is deliberate (the abort it bounds is deterministic —
|
|
18307
|
+
* an automatic probation would just respawn Python forever, more slowly),
|
|
18308
|
+
* and a terminal state an operator cannot leave is a silent fault. This is
|
|
18309
|
+
* the way out. `rearmed:false` means there was nothing to forget.
|
|
18310
|
+
*/
|
|
18311
|
+
rearmInferenceDevice: method(object({
|
|
18312
|
+
nodeId: string(),
|
|
18313
|
+
deviceKey: string()
|
|
18314
|
+
}), object({ rearmed: boolean() }), {
|
|
18315
|
+
kind: "mutation",
|
|
18316
|
+
auth: "admin"
|
|
18317
|
+
}),
|
|
19571
18318
|
getSchema: method(_void(), PipelineSchemaSchema),
|
|
19572
18319
|
getGlobalSteps: method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()),
|
|
19573
18320
|
getGlobalPipelineConfig: method(_void(), PipelineConfigBridge),
|
|
@@ -19833,6 +18580,1503 @@ var pipelineExecutorCapability = {
|
|
|
19833
18580
|
getDetectionConfigSchema: method(_void(), ConfigUISchemaNullableBridge)
|
|
19834
18581
|
}
|
|
19835
18582
|
};
|
|
18583
|
+
/**
|
|
18584
|
+
* Per-stage gating mode applied to the zones a rule references.
|
|
18585
|
+
*
|
|
18586
|
+
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
18587
|
+
* When at least one `include` rule fires for a stage, only entities
|
|
18588
|
+
* inside one of those zones pass that stage.
|
|
18589
|
+
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
18590
|
+
* Entities inside one of those zones are dropped at that stage.
|
|
18591
|
+
*
|
|
18592
|
+
* `monitor`-style observation (count without filtering) is not a rule
|
|
18593
|
+
* mode — zones without any matching rule are observed naturally by
|
|
18594
|
+
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
18595
|
+
* count, not filter" use case needs no rule at all.
|
|
18596
|
+
*/
|
|
18597
|
+
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
18598
|
+
/**
|
|
18599
|
+
* Per-consumer rule that references existing zones (geometry) and
|
|
18600
|
+
* defines how a specific pipeline stage should treat them. Each
|
|
18601
|
+
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
18602
|
+
* settings:
|
|
18603
|
+
*
|
|
18604
|
+
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
18605
|
+
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
18606
|
+
* - future: notification rules, audio gating, etc.
|
|
18607
|
+
*
|
|
18608
|
+
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
18609
|
+
* express "ignore motion in ALL of {garden, street}" with a single
|
|
18610
|
+
* rule. `classFilter` narrows the rule to specific object classes —
|
|
18611
|
+
* "drop person detections in the street, but keep cars" is one
|
|
18612
|
+
* `exclude` rule with `classFilter: ['person']`.
|
|
18613
|
+
*
|
|
18614
|
+
* `enabled` is a soft toggle — the operator can keep the rule
|
|
18615
|
+
* configured but inert without deleting it.
|
|
18616
|
+
*/
|
|
18617
|
+
var ZoneRuleSchema = object({
|
|
18618
|
+
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
18619
|
+
id: string(),
|
|
18620
|
+
/** Optional human-readable label rendered in the rule editor. */
|
|
18621
|
+
name: string().optional(),
|
|
18622
|
+
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
18623
|
+
* listed zones (OR-set: a detection in any one of them counts).
|
|
18624
|
+
* At least one zone id required — a rule with no targets is a
|
|
18625
|
+
* configuration mistake and the form validator rejects it. */
|
|
18626
|
+
zoneIds: array(string()).min(1).readonly(),
|
|
18627
|
+
mode: ZoneRuleModeEnum,
|
|
18628
|
+
/**
|
|
18629
|
+
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
18630
|
+
* applies to every class. Class strings match the `macroClass`
|
|
18631
|
+
* field on detections (e.g. `person`, `car`, `dog`).
|
|
18632
|
+
*/
|
|
18633
|
+
classFilter: array(string()).readonly().optional(),
|
|
18634
|
+
/**
|
|
18635
|
+
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
18636
|
+
* required to consider an entity "in the zone". Defaults to the
|
|
18637
|
+
* consumer's stage default when omitted. Kept for back-compat with
|
|
18638
|
+
* existing per-rule overrides; new operators pick the value via
|
|
18639
|
+
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
18640
|
+
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
18641
|
+
*/
|
|
18642
|
+
overlapThreshold: number().min(0).max(1).optional(),
|
|
18643
|
+
/**
|
|
18644
|
+
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
18645
|
+
* of the detection's bbox that must lie inside the zone for the
|
|
18646
|
+
* rule to match. Documented default is 85%; the engine substitutes
|
|
18647
|
+
* that when the field is omitted (kept optional so existing rules
|
|
18648
|
+
* stored without it stay valid).
|
|
18649
|
+
*
|
|
18650
|
+
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
18651
|
+
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
18652
|
+
* field exposed in the UI. Internally both feed the same gate.
|
|
18653
|
+
*/
|
|
18654
|
+
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
18655
|
+
/**
|
|
18656
|
+
* When `true` and a detection has a segmentation mask, use the
|
|
18657
|
+
* mask for overlap instead of the bbox. Detection-stage only;
|
|
18658
|
+
* motion rules ignore this field.
|
|
18659
|
+
*/
|
|
18660
|
+
preferMask: boolean().optional(),
|
|
18661
|
+
/**
|
|
18662
|
+
* Soft-toggle: `false` disables the rule without deleting it.
|
|
18663
|
+
* Defaults to `true` so operators creating a rule via the UI
|
|
18664
|
+
* see it active immediately.
|
|
18665
|
+
*/
|
|
18666
|
+
enabled: boolean().default(true)
|
|
18667
|
+
});
|
|
18668
|
+
array(ZoneRuleSchema).readonly();
|
|
18669
|
+
/**
|
|
18670
|
+
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
18671
|
+
*
|
|
18672
|
+
* Zones describe **where** in the frame the operator wants to flag
|
|
18673
|
+
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
18674
|
+
* each pipeline stage uses them. Splitting the two means a single
|
|
18675
|
+
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
18676
|
+
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
18677
|
+
* — without three duplicated polygons.
|
|
18678
|
+
*
|
|
18679
|
+
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
18680
|
+
* `zones` device-state slice on every mutation. Consumers
|
|
18681
|
+
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
18682
|
+
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
18683
|
+
* mirror with `onChanged`).
|
|
18684
|
+
*
|
|
18685
|
+
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
18686
|
+
* survive resolution changes and stream profile switches.
|
|
18687
|
+
*
|
|
18688
|
+
* `kind` discriminates between full polygons (closed regions used
|
|
18689
|
+
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
18690
|
+
* line segments used for cross events). Onboard / firmware-reported
|
|
18691
|
+
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
18692
|
+
* task list.
|
|
18693
|
+
*/
|
|
18694
|
+
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
18695
|
+
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
18696
|
+
var PolygonPointSchema = object({
|
|
18697
|
+
x: number(),
|
|
18698
|
+
y: number()
|
|
18699
|
+
});
|
|
18700
|
+
/** A camera detection zone — pure geometry/identity. */
|
|
18701
|
+
var ZoneSchema = object({
|
|
18702
|
+
id: string(),
|
|
18703
|
+
name: string(),
|
|
18704
|
+
kind: ZoneKindEnum.default("polygon"),
|
|
18705
|
+
/** Polygon vertices, fraction of frame (0–1). */
|
|
18706
|
+
polygon: array(PolygonPointSchema).readonly(),
|
|
18707
|
+
/** Visual color for UI rendering. */
|
|
18708
|
+
color: string().default("#3b82f6")
|
|
18709
|
+
});
|
|
18710
|
+
DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
|
|
18711
|
+
deviceId: number(),
|
|
18712
|
+
zone: ZoneSchema
|
|
18713
|
+
}), _void(), {
|
|
18714
|
+
kind: "mutation",
|
|
18715
|
+
auth: "admin"
|
|
18716
|
+
}), method(object({
|
|
18717
|
+
deviceId: number(),
|
|
18718
|
+
zoneId: string()
|
|
18719
|
+
}), _void(), {
|
|
18720
|
+
kind: "mutation",
|
|
18721
|
+
auth: "admin"
|
|
18722
|
+
}), method(object({
|
|
18723
|
+
deviceId: number(),
|
|
18724
|
+
zone: ZoneSchema
|
|
18725
|
+
}), _void(), {
|
|
18726
|
+
kind: "mutation",
|
|
18727
|
+
auth: "admin"
|
|
18728
|
+
}), object({ zones: array(ZoneSchema).readonly() });
|
|
18729
|
+
/**
|
|
18730
|
+
* pipeline-analytics — device-scoped wrapper cap. Refines raw
|
|
18731
|
+
* per-frame detections emitted by the pipeline runner into tracked
|
|
18732
|
+
* objects, per-kind event collections (motion / object / audio), and
|
|
18733
|
+
* persisted media. Owns the post-detection domain end-to-end:
|
|
18734
|
+
*
|
|
18735
|
+
* runner emits PipelineInferenceResult
|
|
18736
|
+
* ↓ (event bus)
|
|
18737
|
+
* pipeline-analytics subscriber
|
|
18738
|
+
* ↓ SORT tracker + zone engine + state analyzer + event emitter
|
|
18739
|
+
* → three DB collections (one per kind), one FS media tree, one
|
|
18740
|
+
* unified event emitter (FrameTracked + TrackStarted/Ended +
|
|
18741
|
+
* DetectionEvent on bus)
|
|
18742
|
+
*
|
|
18743
|
+
* Pure subscriber model. No `processFrame` cap method — the runner
|
|
18744
|
+
* already publishes the raw frame on the bus. The cap surface is
|
|
18745
|
+
* only QUERIES + per-device settings, bound on/off via
|
|
18746
|
+
* `device-manager.setWrapperActive`. `defaultActive: true` because
|
|
18747
|
+
* every camera with a detection pipeline wants its raw detections
|
|
18748
|
+
* refined; operators opt out per-device via BindingsTab when needed.
|
|
18749
|
+
*
|
|
18750
|
+
* Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
|
|
18751
|
+
* (per-device surface) and `track-trail` caps — see P11 cleanup.
|
|
18752
|
+
*/
|
|
18753
|
+
var TrackStateSchema = _enum([
|
|
18754
|
+
"new",
|
|
18755
|
+
"entered",
|
|
18756
|
+
"left",
|
|
18757
|
+
"moving",
|
|
18758
|
+
"idle"
|
|
18759
|
+
]);
|
|
18760
|
+
var EventKindSchema = _enum([
|
|
18761
|
+
"motion",
|
|
18762
|
+
"object",
|
|
18763
|
+
"audio"
|
|
18764
|
+
]);
|
|
18765
|
+
/**
|
|
18766
|
+
* Spatial filter for `listTracks` — the rect + polygon variants of the shared
|
|
18767
|
+
* MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
|
|
18768
|
+
* of the camera frame (top-left origin), matching the drawing-plane editor.
|
|
18769
|
+
*/
|
|
18770
|
+
var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
|
|
18771
|
+
/** Closed icon vocabulary so clients render a known glyph per kind. */
|
|
18772
|
+
var EventKindIconSchema = _enum([
|
|
18773
|
+
"motion",
|
|
18774
|
+
"audio",
|
|
18775
|
+
"person",
|
|
18776
|
+
"vehicle",
|
|
18777
|
+
"animal",
|
|
18778
|
+
"door",
|
|
18779
|
+
"pir",
|
|
18780
|
+
"smoke",
|
|
18781
|
+
"water",
|
|
18782
|
+
"button",
|
|
18783
|
+
"package",
|
|
18784
|
+
"generic"
|
|
18785
|
+
]);
|
|
18786
|
+
var EventKindCategorySchema = _enum([
|
|
18787
|
+
"motion",
|
|
18788
|
+
"audio",
|
|
18789
|
+
"detection",
|
|
18790
|
+
"sensor",
|
|
18791
|
+
"control",
|
|
18792
|
+
"custom",
|
|
18793
|
+
"package"
|
|
18794
|
+
]);
|
|
18795
|
+
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
18796
|
+
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
18797
|
+
var EventKindDescriptorSchema = object({
|
|
18798
|
+
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
18799
|
+
kind: string(),
|
|
18800
|
+
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
18801
|
+
labelKey: string(),
|
|
18802
|
+
/** English fallback label (kept for clients that don't translate). */
|
|
18803
|
+
label: string(),
|
|
18804
|
+
/** Hex color for timeline/legend rendering. */
|
|
18805
|
+
color: string(),
|
|
18806
|
+
/** Dictionary id → lucide component on the UI side. */
|
|
18807
|
+
iconId: string(),
|
|
18808
|
+
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
18809
|
+
icon: EventKindIconSchema,
|
|
18810
|
+
category: EventKindCategorySchema,
|
|
18811
|
+
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
18812
|
+
parentKind: string().nullable(),
|
|
18813
|
+
/** Derived from `parentKind`, explicit for the client tree. */
|
|
18814
|
+
level: EventKindLevelSchema,
|
|
18815
|
+
/** Which cap + device contributes this kind. For built-ins the camera
|
|
18816
|
+
* itself; for sensor kinds the LINKED source device. */
|
|
18817
|
+
source: object({
|
|
18818
|
+
capName: string(),
|
|
18819
|
+
deviceId: number()
|
|
18820
|
+
})
|
|
18821
|
+
});
|
|
18822
|
+
/** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
|
|
18823
|
+
var EventKindsForDeviceSchema = object({
|
|
18824
|
+
deviceId: number(),
|
|
18825
|
+
kinds: array(EventKindDescriptorSchema).readonly()
|
|
18826
|
+
});
|
|
18827
|
+
var SensorEventSchema = object({
|
|
18828
|
+
id: string(),
|
|
18829
|
+
/** The CAMERA the event is attributed to (a sensor linked to N cameras
|
|
18830
|
+
* yields N rows, one per camera). */
|
|
18831
|
+
deviceId: number(),
|
|
18832
|
+
/** The linked sensor device whose state changed. */
|
|
18833
|
+
sourceDeviceId: number(),
|
|
18834
|
+
/** Event kind id — matches an `EventKindDescriptor.kind`. */
|
|
18835
|
+
kind: string(),
|
|
18836
|
+
/** Snapshot of the sensor cap's runtime-state slice at the change. */
|
|
18837
|
+
value: record(string(), unknown()).nullable(),
|
|
18838
|
+
timestamp: number()
|
|
18839
|
+
});
|
|
18840
|
+
var TrackPositionSchema = object({
|
|
18841
|
+
x: number(),
|
|
18842
|
+
y: number(),
|
|
18843
|
+
timestamp: number(),
|
|
18844
|
+
bbox: BoundingBoxSchema
|
|
18845
|
+
});
|
|
18846
|
+
var TrackSnapshotSchema = object({
|
|
18847
|
+
timestamp: number(),
|
|
18848
|
+
position: TrackPositionSchema,
|
|
18849
|
+
/** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
|
|
18850
|
+
mediaKey: string()
|
|
18851
|
+
});
|
|
18852
|
+
/**
|
|
18853
|
+
* Normalized 0..1 trajectory envelope (min/max over every position bbox,
|
|
18854
|
+
* divided by the track's detection-frame dims), computed at persist time.
|
|
18855
|
+
* Absent when the frame dims were unknown when the track was persisted
|
|
18856
|
+
* (legacy rows / dims-less sources) and on active (in-RAM) tracks.
|
|
18857
|
+
*/
|
|
18858
|
+
var TrackEnvelopeSchema = object({
|
|
18859
|
+
minX: number(),
|
|
18860
|
+
minY: number(),
|
|
18861
|
+
maxX: number(),
|
|
18862
|
+
maxY: number()
|
|
18863
|
+
});
|
|
18864
|
+
/**
|
|
18865
|
+
* Row projection for track list queries. `full` (default) returns the
|
|
18866
|
+
* complete Track including the frame-rate `positions[]` history and the
|
|
18867
|
+
* `snapshots[]` references — megabytes across a page of tracks. `slim`
|
|
18868
|
+
* keeps every scalar the list surfaces actually render (ids, class(es),
|
|
18869
|
+
* label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
|
|
18870
|
+
* zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
|
|
18871
|
+
* `snapshots` as EMPTY arrays — detail views re-fetch the full row via
|
|
18872
|
+
* `getTrack`. Mirrors the event-store `projection` convention
|
|
18873
|
+
* (`getObjectEvents` et al.).
|
|
18874
|
+
*/
|
|
18875
|
+
var TrackProjectionSchema = _enum(["full", "slim"]);
|
|
18876
|
+
/**
|
|
18877
|
+
* One audio-classification label heard on the track's camera while the
|
|
18878
|
+
* track was alive, aggregated per label. An "episode" is one persisted
|
|
18879
|
+
* audio event (the confident-classification path: score ≥ the device's
|
|
18880
|
+
* `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
|
|
18881
|
+
* one 32 ms inference chunk, so counts stay human-scaled.
|
|
18882
|
+
*/
|
|
18883
|
+
var TrackAudioLabelSchema = object({
|
|
18884
|
+
label: string(),
|
|
18885
|
+
/** Highest classification score observed across the label's episodes. */
|
|
18886
|
+
peakScore: number(),
|
|
18887
|
+
/** Number of coalesced audio-event episodes carrying this label. */
|
|
18888
|
+
count: number(),
|
|
18889
|
+
firstAt: number(),
|
|
18890
|
+
lastAt: number()
|
|
18891
|
+
});
|
|
18892
|
+
/**
|
|
18893
|
+
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
18894
|
+
* detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
|
|
18895
|
+
* no positions, a single snapshot, and no bbox trajectory at all:
|
|
18896
|
+
*
|
|
18897
|
+
* - `sensor` — a linked sensor/control device state change.
|
|
18898
|
+
* - `audio` — an audio event on the camera itself that was anomalous for
|
|
18899
|
+
* THAT camera, loud, and heard while nothing visual was happening (D62).
|
|
18900
|
+
*
|
|
18901
|
+
* The spatial subsystems (tracker association, occupancy count, re-id /
|
|
18902
|
+
* embedding, resurrection) MUST skip every synthetic source. Test for that
|
|
18903
|
+
* with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
|
|
18904
|
+
* check silently readmits every source added after it was written.
|
|
18905
|
+
*/
|
|
18906
|
+
var TrackSourceSchema = _enum([
|
|
18907
|
+
"pipeline",
|
|
18908
|
+
"sensor",
|
|
18909
|
+
"audio"
|
|
18910
|
+
]);
|
|
18911
|
+
/**
|
|
18912
|
+
* Where a track sits in the RETRAIN lifecycle (D81).
|
|
18913
|
+
*
|
|
18914
|
+
* - `none` — never marked, or un-marked. Evictable.
|
|
18915
|
+
* - `staging` — the operator wants this track as training material and has not
|
|
18916
|
+
* finished with it. **This is the only state retention holds**: the track and
|
|
18917
|
+
* everything it owns (object events, crops, keyframes, CLIP vector) survive
|
|
18918
|
+
* the device's age window.
|
|
18919
|
+
* - `trained` — the retrain page has taken what it needed. The frames it chose
|
|
18920
|
+
* were COPIED into the retrain dataset at selection time, so the dataset no
|
|
18921
|
+
* longer depends on the track's media and the track becomes EVICTABLE again.
|
|
18922
|
+
* Terminal for the plain `markForTrain` toggle: returning it to `staging` is
|
|
18923
|
+
* a deliberate action of the retrain page, not a side effect of a checkbox.
|
|
18924
|
+
*
|
|
18925
|
+
* There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
|
|
18926
|
+
* the store's filter language has only positive equality and `whereIn` — no
|
|
18927
|
+
* negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
|
|
18928
|
+
* would make the entire pre-column history immortal in one deploy.
|
|
18929
|
+
*/
|
|
18930
|
+
var RetrainStatusSchema = _enum([
|
|
18931
|
+
"none",
|
|
18932
|
+
"staging",
|
|
18933
|
+
"trained"
|
|
18934
|
+
]);
|
|
18935
|
+
/**
|
|
18936
|
+
* Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
|
|
18937
|
+
* by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
|
|
18938
|
+
* so the two surfaces cannot drift.
|
|
18939
|
+
*
|
|
18940
|
+
* **Absent ≠ false.** A track that has never been touched omits the field; an
|
|
18941
|
+
* explicitly un-flagged track carries `false`. Legacy rows written before the
|
|
18942
|
+
* columns existed read as absent, and a consumer that needs a boolean should say
|
|
18943
|
+
* `flag === true`, not `flag !== false`.
|
|
18944
|
+
*
|
|
18945
|
+
* `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
|
|
18946
|
+
* it is exactly `retrainStatus === 'staging'`, in both directions. Writing
|
|
18947
|
+
* `true` moves `none → staging`, writing `false` moves `staging → none`, and a
|
|
18948
|
+
* `trained` track reports `false` while refusing both writes. The boolean is
|
|
18949
|
+
* kept because three surfaces drive a toggle off it; anything that needs to tell
|
|
18950
|
+
* "never marked" from "already trained" must read `retrainStatus`.
|
|
18951
|
+
*
|
|
18952
|
+
* `debug` does NOT pin; it is attention, not durability.
|
|
18953
|
+
*
|
|
18954
|
+
* `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
|
|
18955
|
+
* A favourited track is skipped by retention the same way `staging` is, but
|
|
18956
|
+
* it does not enter `none|staging|trained` and has no staging budget.
|
|
18957
|
+
*/
|
|
18958
|
+
var TrackFlagFields = {
|
|
18959
|
+
/** Operator marked this track as training material — i.e. `retrainStatus` is
|
|
18960
|
+
* `'staging'`. */
|
|
18961
|
+
markForTrain: boolean().optional(),
|
|
18962
|
+
/** Operator marked this track for diagnostic attention. */
|
|
18963
|
+
debug: boolean().optional(),
|
|
18964
|
+
/** Operator favourited this track. Pins it against pruning. */
|
|
18965
|
+
favourited: boolean().optional()
|
|
18966
|
+
};
|
|
18967
|
+
/**
|
|
18968
|
+
* The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
|
|
18969
|
+
* Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
|
|
18970
|
+
* write patch, and the status is not something the toggle sets — it is what the
|
|
18971
|
+
* toggle's boolean is derived from. Absent on an in-RAM track never touched;
|
|
18972
|
+
* always present on a persisted row (the column default materialises `'none'`).
|
|
18973
|
+
*/
|
|
18974
|
+
var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
|
|
18975
|
+
/**
|
|
18976
|
+
* The write half: a PARTIAL patch. An omitted key is left untouched, so setting
|
|
18977
|
+
* one flag can never clear the other — the toggles are independent and are
|
|
18978
|
+
* driven from three surfaces that do not know about each other.
|
|
18979
|
+
*/
|
|
18980
|
+
var TrackFlagsPatchSchema = object(TrackFlagFields);
|
|
18981
|
+
/**
|
|
18982
|
+
* The resolved flag state after a write. Both fields are REQUIRED here (absent
|
|
18983
|
+
* collapses to `false`) so a caller can drive a toggle's checked state off the
|
|
18984
|
+
* mutation result without a re-fetch.
|
|
18985
|
+
*/
|
|
18986
|
+
var TrackFlagsSchema = object({
|
|
18987
|
+
trackId: string(),
|
|
18988
|
+
markForTrain: boolean(),
|
|
18989
|
+
debug: boolean(),
|
|
18990
|
+
favourited: boolean(),
|
|
18991
|
+
/** The lifecycle state the boolean was derived from. Required here (unlike on
|
|
18992
|
+
* a track row) because this shape is only ever produced by the write body,
|
|
18993
|
+
* which always knows it — and a surface that has just written needs to render
|
|
18994
|
+
* `trained` without a re-fetch. */
|
|
18995
|
+
retrainStatus: RetrainStatusSchema
|
|
18996
|
+
});
|
|
18997
|
+
union([literal(1), literal(2)]);
|
|
18998
|
+
/**
|
|
18999
|
+
* WHO decided a label, and when. Carried per tier so a value can be traced to
|
|
19000
|
+
* the step and model that produced it — which is what makes the write rule
|
|
19001
|
+
* arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
|
|
19002
|
+
* and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
|
|
19003
|
+
*
|
|
19004
|
+
* `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
|
|
19005
|
+
* `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
|
|
19006
|
+
* `migration:4g` for a value the 4g migration moved from the single-slot era —
|
|
19007
|
+
* that value has no provenance, and the write rule lets ANY properly-attributed
|
|
19008
|
+
* write of the same tier replace it regardless of score.
|
|
19009
|
+
*/
|
|
19010
|
+
var LabelAttributionSchema = object({
|
|
19011
|
+
stepId: string(),
|
|
19012
|
+
modelId: string().optional(),
|
|
19013
|
+
decidedAt: number(),
|
|
19014
|
+
/**
|
|
19015
|
+
* The GALLERY id behind a recognised tier-2 label — a face-gallery
|
|
19016
|
+
* `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
|
|
19017
|
+
*
|
|
19018
|
+
* The text alone is a DISPLAY NAME, and a display name is renameable: a
|
|
19019
|
+
* notification rule authored on "Gianluca" stopped matching the moment the
|
|
19020
|
+
* operator fixed the spelling in the gallery, and nothing said so. The id is
|
|
19021
|
+
* the thing that does not move, so it is what a rule matches on
|
|
19022
|
+
* (`NcConditions.identities`) and the text is what a human is shown.
|
|
19023
|
+
*
|
|
19024
|
+
* Absent when the label names no gallery row — a plate the OCR read but no
|
|
19025
|
+
* vehicle claims, a sub-class, a species, any tier-1 value.
|
|
19026
|
+
*/
|
|
19027
|
+
identityId: string().optional()
|
|
19028
|
+
});
|
|
19029
|
+
/**
|
|
19030
|
+
* The TIERED label model (roadmap 4g), spread into `TrackSchema` and
|
|
19031
|
+
* `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
|
|
19032
|
+
* track and its events always answer the same question the same way.
|
|
19033
|
+
*
|
|
19034
|
+
* Two scalar columns, not an array: every consumer wants "the coarse one" or
|
|
19035
|
+
* "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
|
|
19036
|
+
* is tier 2, and each carries its own score + attribution.
|
|
19037
|
+
*
|
|
19038
|
+
* **Reading it.** What a human should be shown is `subLabel ?? label` — the
|
|
19039
|
+
* finest thing known. Before 4g the single `label` column held the finest
|
|
19040
|
+
* value, so a consumer that has not been updated reads the tier-1 slot and
|
|
19041
|
+
* shows nothing on a species-only row; that is why the migration puts every
|
|
19042
|
+
* pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
|
|
19043
|
+
* and why the read surfaces were changed in the same train.
|
|
19044
|
+
*
|
|
19045
|
+
* **Writing it.** The slots are independent, which is the whole point: a
|
|
19046
|
+
* tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
|
|
19047
|
+
* migratorius`), so fineness cannot regress by construction. Within a tier the
|
|
19048
|
+
* higher score wins. One rule, one implementation — see
|
|
19049
|
+
* `pipeline/label-tier.ts` in addon-post-analysis.
|
|
19050
|
+
*/
|
|
19051
|
+
var TieredLabelFields = {
|
|
19052
|
+
/** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
|
|
19053
|
+
label: string().optional(),
|
|
19054
|
+
/** Confidence of the tier-1 value, as reported by the deciding step. */
|
|
19055
|
+
labelScore: number().optional(),
|
|
19056
|
+
/** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
|
|
19057
|
+
labelMeta: LabelAttributionSchema.optional(),
|
|
19058
|
+
/** Tier 2 — the instance. See {@link LabelTierSchema}. */
|
|
19059
|
+
subLabel: string().optional(),
|
|
19060
|
+
/** Confidence of the tier-2 value, as reported by the deciding step. */
|
|
19061
|
+
subLabelScore: number().optional(),
|
|
19062
|
+
/** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
|
|
19063
|
+
subLabelMeta: LabelAttributionSchema.optional()
|
|
19064
|
+
};
|
|
19065
|
+
/** Per-camera slice of a training-export estimate. */
|
|
19066
|
+
var TrainingExportDeviceTotalsSchema = object({
|
|
19067
|
+
deviceId: number(),
|
|
19068
|
+
tracks: number().int(),
|
|
19069
|
+
files: number().int(),
|
|
19070
|
+
bytes: number().int()
|
|
19071
|
+
});
|
|
19072
|
+
/**
|
|
19073
|
+
* What a training export WOULD contain. Computed from media index rows only —
|
|
19074
|
+
* no blob is read to produce this.
|
|
19075
|
+
*/
|
|
19076
|
+
var TrainingExportSummarySchema = object({
|
|
19077
|
+
generatedAt: number(),
|
|
19078
|
+
trackCount: number().int(),
|
|
19079
|
+
fileCount: number().int(),
|
|
19080
|
+
byteCount: number().int(),
|
|
19081
|
+
/** More marked tracks exist than a single pass carries. */
|
|
19082
|
+
truncated: boolean(),
|
|
19083
|
+
devices: array(TrainingExportDeviceTotalsSchema).readonly()
|
|
19084
|
+
});
|
|
19085
|
+
var TrackSchema = object({
|
|
19086
|
+
trackId: string(),
|
|
19087
|
+
deviceId: number(),
|
|
19088
|
+
className: string(),
|
|
19089
|
+
...TieredLabelFields,
|
|
19090
|
+
producingDeviceName: string().optional(),
|
|
19091
|
+
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
19092
|
+
source: TrackSourceSchema.optional(),
|
|
19093
|
+
firstSeen: number(),
|
|
19094
|
+
lastSeen: number(),
|
|
19095
|
+
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
19096
|
+
positions: array(TrackPositionSchema).readonly(),
|
|
19097
|
+
/** Periodic snapshots at snapshotIntervalMs cadence (subject to
|
|
19098
|
+
* saveThumbnails policy). */
|
|
19099
|
+
snapshots: array(TrackSnapshotSchema).readonly(),
|
|
19100
|
+
/** Deduplicated zones the track has entered at least once. Zone IDS. */
|
|
19101
|
+
zonesVisited: array(string()).readonly(),
|
|
19102
|
+
/**
|
|
19103
|
+
* Human NAMES for {@link zonesVisited}, resolved at READ time against the
|
|
19104
|
+
* `zones` capability.
|
|
19105
|
+
*
|
|
19106
|
+
* `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
|
|
19107
|
+
* and no card can render — so every free-text search surface was structurally
|
|
19108
|
+
* unable to answer "show me the tracks in Uscio", and did not fail loudly, it
|
|
19109
|
+
* just returned nothing. Resolving here rather than in each client keeps ONE
|
|
19110
|
+
* derivation and costs the clients no extra call (the `zones` cap is
|
|
19111
|
+
* per-device, so a client-side resolve would be a per-camera fan-out on a
|
|
19112
|
+
* surface built to avoid exactly that).
|
|
19113
|
+
*
|
|
19114
|
+
* Resolved, never invented: a zone deleted since the track was written has no
|
|
19115
|
+
* name and is DROPPED, so this array can be shorter than `zonesVisited` — the
|
|
19116
|
+
* two are not positionally aligned. Absent when the track visited no zone, or
|
|
19117
|
+
* when the zone catalogue could not be read.
|
|
19118
|
+
*/
|
|
19119
|
+
zoneNames: array(string()).readonly().optional(),
|
|
19120
|
+
/** Deduplicated set of detector classes observed for this track over its
|
|
19121
|
+
* life (a track may be reclassified, e.g. person→vehicle). Absent on
|
|
19122
|
+
* legacy rows written before class accumulation shipped. */
|
|
19123
|
+
classes: array(string()).readonly().optional(),
|
|
19124
|
+
/** Cumulative normalized distance travelled (0..1 units = full frame width). */
|
|
19125
|
+
totalDistance: number(),
|
|
19126
|
+
state: TrackStateSchema,
|
|
19127
|
+
active: boolean(),
|
|
19128
|
+
/** Deterministic key-event importance score in [0,1] (server-computed at
|
|
19129
|
+
* track expiry, recomputed on late label). Absent on legacy rows written
|
|
19130
|
+
* before scoring shipped — consumers degrade to absence / compute-on-read. */
|
|
19131
|
+
importance: number().optional(),
|
|
19132
|
+
/** Id of the track's highest-confidence ObjectEvent (its representative
|
|
19133
|
+
* "best" frame). Absent when the track produced no object events. */
|
|
19134
|
+
bestEventId: string().optional(),
|
|
19135
|
+
/** Tag of the importance sub-signal that dominated the score
|
|
19136
|
+
* (identity|dwell|proximity|class|confidence|travel|zone). */
|
|
19137
|
+
importanceReason: string().optional(),
|
|
19138
|
+
/** Audio-classification labels heard on the camera during the track's
|
|
19139
|
+
* life (score ≥ device `classificationMinScore`), aggregated per label.
|
|
19140
|
+
* Absent on legacy rows / tracks with no confident audio. */
|
|
19141
|
+
audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
|
|
19142
|
+
/** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
|
|
19143
|
+
* Populated from the persisted envelope columns on historical reads;
|
|
19144
|
+
* absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
|
|
19145
|
+
envelope: TrackEnvelopeSchema.optional(),
|
|
19146
|
+
/**
|
|
19147
|
+
* A face DETECTOR found a face on this track — nothing more. It says the
|
|
19148
|
+
* detail plane produced a `face` detail; it does NOT say the face was
|
|
19149
|
+
* embedded, matched, above `minFacePx`, or that the recognizer was even
|
|
19150
|
+
* enabled. Set once and never cleared.
|
|
19151
|
+
*
|
|
19152
|
+
* **This exists so "face present but not recognised" is expressible.** A
|
|
19153
|
+
* recognised identity lands in `subLabel` (attributed to the face chain via
|
|
19154
|
+
* `subLabelMeta.stepId`), so before this field a track with an unmatched face
|
|
19155
|
+
* and a track with no face at all were byte-identical on the wire and no
|
|
19156
|
+
* surface could tell them apart. The read is `hasFace === true && subLabel
|
|
19157
|
+
* === undefined`.
|
|
19158
|
+
*
|
|
19159
|
+
* **Absent ≠ false.** Every row written before the column existed omits it,
|
|
19160
|
+
* and so does every server that predates the field — a consumer must test
|
|
19161
|
+
* `=== true` and render nothing otherwise, never infer "no face".
|
|
19162
|
+
*/
|
|
19163
|
+
hasFace: boolean().optional(),
|
|
19164
|
+
/**
|
|
19165
|
+
* This track has a face row IN THE GALLERY: a crop **and** an embedding — a
|
|
19166
|
+
* face an operator could ASSIGN to an identity.
|
|
19167
|
+
*
|
|
19168
|
+
* The STRICT twin of {@link hasFace}, and the pair only earns its keep
|
|
19169
|
+
* because the two disagree. `hasFace` is stamped at the TOP of the face
|
|
19170
|
+
* branch, before every gate, and means no more than "a face detector produced
|
|
19171
|
+
* a face detail". This one is stamped at the single moment the gallery row
|
|
19172
|
+
* LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
|
|
19173
|
+
* past the embedding-magnitude verdict, the `minFacePx` detection gate, the
|
|
19174
|
+
* candidate gate, the imageless-track drop (no crop was ever captured) and
|
|
19175
|
+
* the crop-store drop. Everything between the detector and that insert can
|
|
19176
|
+
* legitimately refuse the face, so a flag written any earlier promises the
|
|
19177
|
+
* operator something to assign and delivers nothing.
|
|
19178
|
+
*
|
|
19179
|
+
* **Independent of recognition.** A face collected but never auto-matched is
|
|
19180
|
+
* still assignable — it is in fact the face an operator most wants to reach —
|
|
19181
|
+
* so this is NOT gated on `recognizedIdentityId`. Recognition lands in
|
|
19182
|
+
* `subLabel`; this says only that the raw material exists.
|
|
19183
|
+
*
|
|
19184
|
+
* **Set once, never cleared.** A track that produced a gallery row produced
|
|
19185
|
+
* one; deleting the row later is the gallery's business, not this flag's.
|
|
19186
|
+
*
|
|
19187
|
+
* **Absent ≠ false**, the same rule as {@link hasFace}: every row written
|
|
19188
|
+
* before the column omits it, and so does every server that predates the
|
|
19189
|
+
* field. A consumer must test `=== true` and render nothing otherwise —
|
|
19190
|
+
* never infer "no assignable face".
|
|
19191
|
+
*/
|
|
19192
|
+
hasEmbeddedFace: boolean().optional(),
|
|
19193
|
+
/**
|
|
19194
|
+
* This subject CONTAINS a folded rider — a person the rider-pairing step
|
|
19195
|
+
* ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
|
|
19196
|
+
* so the passage is tracked once and as a VEHICLE.
|
|
19197
|
+
*
|
|
19198
|
+
* It exists because the fold's record was dishonest. D34 and the code both
|
|
19199
|
+
* said "the person is not lost — it is reported so both entities stay on the
|
|
19200
|
+
* record"; in fact the pair went into a per-processor RAM field behind an
|
|
19201
|
+
* accessor nobody called, and every durable surface said `vehicle`, full
|
|
19202
|
+
* stop. This is the composition note that makes the row true.
|
|
19203
|
+
*
|
|
19204
|
+
* A COMPOSITION, never a class and never a label. "This vehicle contains a
|
|
19205
|
+
* person" is not an answer to "what is this" — both label tiers would refuse
|
|
19206
|
+
* a macro token anyway (D89), and correctly. Nothing here changes what the
|
|
19207
|
+
* subject IS: a cyclist stays one vehicle track, occupancy still counts one,
|
|
19208
|
+
* and a `person` rule still does not fire for someone cycling past.
|
|
19209
|
+
*
|
|
19210
|
+
* **Absent ≠ false**, exactly like {@link hasFace}: every row written before
|
|
19211
|
+
* the column, and every hub that predates the field, omits it. Test
|
|
19212
|
+
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
19213
|
+
*/
|
|
19214
|
+
hasRider: boolean().optional(),
|
|
19215
|
+
...TrackFlagFields,
|
|
19216
|
+
...TrackRetrainFields
|
|
19217
|
+
});
|
|
19218
|
+
var BaseEventFields = {
|
|
19219
|
+
id: string(),
|
|
19220
|
+
deviceId: number(),
|
|
19221
|
+
timestamp: number()
|
|
19222
|
+
};
|
|
19223
|
+
var MotionEventSchema = object({
|
|
19224
|
+
...BaseEventFields,
|
|
19225
|
+
kind: literal("motion"),
|
|
19226
|
+
regionCount: number(),
|
|
19227
|
+
/** Heavy JSON array — omitted in slim projection. */
|
|
19228
|
+
regions: array(object({
|
|
19229
|
+
bbox: BoundingBoxSchema,
|
|
19230
|
+
pixelCount: number(),
|
|
19231
|
+
intensity: number()
|
|
19232
|
+
})).readonly().optional(),
|
|
19233
|
+
/** Omitted in slim projection. */
|
|
19234
|
+
frameWidth: number().optional(),
|
|
19235
|
+
/** Omitted in slim projection. */
|
|
19236
|
+
frameHeight: number().optional(),
|
|
19237
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
19238
|
+
mediaUrl: string().optional()
|
|
19239
|
+
});
|
|
19240
|
+
/**
|
|
19241
|
+
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
19242
|
+
* detection pipeline (decoded-frame inference); `onboard` = the camera's
|
|
19243
|
+
* native on-device AI. Both flow through the SAME analysis layers (zoning,
|
|
19244
|
+
* tracking, per-kind persistence) but stay distinguishable so consumers
|
|
19245
|
+
* (advanced-notifier, occupancy, …) can select which source(s) to act on.
|
|
19246
|
+
* Absent on legacy rows ⇒ treat as `pipeline`.
|
|
19247
|
+
*/
|
|
19248
|
+
var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
|
|
19249
|
+
/**
|
|
19250
|
+
* The confirmed zone crossing that produced an object event. Present ONLY on
|
|
19251
|
+
* an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
|
|
19252
|
+
* event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
|
|
19253
|
+
* appearance event carry none, so a rule asking for a direction fails closed
|
|
19254
|
+
* on them.
|
|
19255
|
+
*
|
|
19256
|
+
* Exactly ONE crossing per event: the emitter turns each confirmed crossing
|
|
19257
|
+
* into its own event, so a frame in which a track enters A while leaving B
|
|
19258
|
+
* produces two events with two directions — never one ambiguous row.
|
|
19259
|
+
*
|
|
19260
|
+
* `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
|
|
19261
|
+
* membership the box has NOW, and by definition it no longer contains the zone
|
|
19262
|
+
* that was just left. Without the id here, a zone-scoped rule could never match
|
|
19263
|
+
* the exit it asked for.
|
|
19264
|
+
*/
|
|
19265
|
+
var ZoneCrossingSchema = object({
|
|
19266
|
+
direction: _enum(["enter", "exit"]),
|
|
19267
|
+
/** Admin zone id crossed. */
|
|
19268
|
+
zoneId: string(),
|
|
19269
|
+
/** Zone display name at crossing time (falls back to the id). */
|
|
19270
|
+
zoneName: string().optional()
|
|
19271
|
+
});
|
|
19272
|
+
var ObjectEventSchema = object({
|
|
19273
|
+
...BaseEventFields,
|
|
19274
|
+
kind: literal("object"),
|
|
19275
|
+
/** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
|
|
19276
|
+
source: DetectionSourceSchema.optional(),
|
|
19277
|
+
/**
|
|
19278
|
+
* Inference-frame id shared by every object event emitted from the SAME frame
|
|
19279
|
+
* — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
|
|
19280
|
+
* 2 people + 1 dog) under one full frame, and link a track's frames over time
|
|
19281
|
+
* (group by `trackId`, pick a representative `frameId` as the parent frame).
|
|
19282
|
+
* Optional for backward-compat with pre-existing rows / the slim projection
|
|
19283
|
+
* includes it (it is light). Absent on rows written before this field.
|
|
19284
|
+
*/
|
|
19285
|
+
frameId: string().optional(),
|
|
19286
|
+
/** Omitted in slim projection. */
|
|
19287
|
+
trackId: string().optional(),
|
|
19288
|
+
className: string(),
|
|
19289
|
+
...TieredLabelFields,
|
|
19290
|
+
/** Omitted in slim projection. */
|
|
19291
|
+
confidence: number().optional(),
|
|
19292
|
+
/** Heavy JSON — omitted in slim projection. */
|
|
19293
|
+
bbox: BoundingBoxSchema.optional(),
|
|
19294
|
+
/** Heavy JSON — omitted in slim projection. */
|
|
19295
|
+
zones: array(string()).readonly().optional(),
|
|
19296
|
+
/** Omitted in slim projection. */
|
|
19297
|
+
state: TrackStateSchema.optional(),
|
|
19298
|
+
/**
|
|
19299
|
+
* The zone crossing this event IS, when it is one. Absent on every other
|
|
19300
|
+
* event kind (movement state, appearance, package) — see
|
|
19301
|
+
* {@link ZoneCrossingSchema}. Omitted in slim projection.
|
|
19302
|
+
*/
|
|
19303
|
+
zoneCrossing: ZoneCrossingSchema.optional(),
|
|
19304
|
+
/** Detection-frame dimensions in pixels — let consumers normalize the
|
|
19305
|
+
* pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
|
|
19306
|
+
frameWidth: number().optional(),
|
|
19307
|
+
frameHeight: number().optional(),
|
|
19308
|
+
/** MediaStore key for the crop attached to this event (if any). */
|
|
19309
|
+
mediaKey: string().optional(),
|
|
19310
|
+
/** Design B: MediaStore key of the track's native-resolution key frame (the
|
|
19311
|
+
* best-detection full frame). Resolve via the event-media data-plane
|
|
19312
|
+
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
|
|
19313
|
+
* draws `bbox` over the native frame. Absent on legacy rows / non-decoded
|
|
19314
|
+
* sources — consumers fall back to `mediaKey` (the tight crop). */
|
|
19315
|
+
keyFrameMediaKey: string().optional(),
|
|
19316
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
19317
|
+
mediaUrl: string().optional(),
|
|
19318
|
+
/** The parent track's key-event importance [0,1], propagated to every object
|
|
19319
|
+
* event of the track (so an event row can be sorted by importance without a
|
|
19320
|
+
* track join). Absent on legacy rows / before the track was scored. */
|
|
19321
|
+
importance: number().optional()
|
|
19322
|
+
});
|
|
19323
|
+
var AudioEventSchema = object({
|
|
19324
|
+
...BaseEventFields,
|
|
19325
|
+
kind: literal("audio"),
|
|
19326
|
+
rms: number(),
|
|
19327
|
+
dbfs: number(),
|
|
19328
|
+
classification: object({
|
|
19329
|
+
className: string(),
|
|
19330
|
+
originalClass: string().optional(),
|
|
19331
|
+
score: number()
|
|
19332
|
+
}).optional(),
|
|
19333
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
19334
|
+
mediaUrl: string().optional()
|
|
19335
|
+
});
|
|
19336
|
+
var MediaFileKindEnum = _enum([
|
|
19337
|
+
"crop",
|
|
19338
|
+
"thumbnail",
|
|
19339
|
+
"snapshot",
|
|
19340
|
+
"firstFrame",
|
|
19341
|
+
"lastFrame",
|
|
19342
|
+
"fullFrame",
|
|
19343
|
+
"fullFrameBoxed",
|
|
19344
|
+
"faceCrop",
|
|
19345
|
+
"plateCrop",
|
|
19346
|
+
"keyFrame",
|
|
19347
|
+
"keyFrameSmall",
|
|
19348
|
+
"thumbnailSmall"
|
|
19349
|
+
]);
|
|
19350
|
+
var MediaFileSchema = object({
|
|
19351
|
+
key: string(),
|
|
19352
|
+
kind: MediaFileKindEnum,
|
|
19353
|
+
base64: string(),
|
|
19354
|
+
sizeBytes: number(),
|
|
19355
|
+
timestamp: number()
|
|
19356
|
+
});
|
|
19357
|
+
/**
|
|
19358
|
+
* One media row WITHOUT its bytes.
|
|
19359
|
+
*
|
|
19360
|
+
* A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
|
|
19361
|
+
* 140 s track), and a client that renders tiles from the media data plane needs
|
|
19362
|
+
* to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
|
|
19363
|
+
* with an immutable cache, instead of all at once inside a tRPC response that
|
|
19364
|
+
* blocks the whole view.
|
|
19365
|
+
*
|
|
19366
|
+
* `sizeBytes` is carried because it is what lets a client decide between the
|
|
19367
|
+
* stored blob and a `?variant=thumb` rendering without fetching either.
|
|
19368
|
+
*/
|
|
19369
|
+
var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
|
|
19370
|
+
/**
|
|
19371
|
+
* The MACRO tier of an annotation — a CLOSED set.
|
|
19372
|
+
*
|
|
19373
|
+
* This is what the exported detector predicts, so a typo here is a new class
|
|
19374
|
+
* with one example in it. `label` and `subLabel` are open strings by contrast:
|
|
19375
|
+
* the whole point of the page is teaching the model things it does not know
|
|
19376
|
+
* yet, and constraining that vocabulary would make it useless.
|
|
19377
|
+
*
|
|
19378
|
+
* A macro class is NEVER a label. The provider refuses a write whose `label` or
|
|
19379
|
+
* `subLabel` is one of these values, in any casing, because once `person`
|
|
19380
|
+
* exists in both tiers "every person box" stops being answerable without
|
|
19381
|
+
* knowing every string anyone ever typed — and the damage is retroactive.
|
|
19382
|
+
*/
|
|
19383
|
+
var RetrainMacroClassSchema = _enum([
|
|
19384
|
+
"person",
|
|
19385
|
+
"vehicle",
|
|
19386
|
+
"animal",
|
|
19387
|
+
"package",
|
|
19388
|
+
"face",
|
|
19389
|
+
"plate"
|
|
19390
|
+
]);
|
|
19391
|
+
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
19392
|
+
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
19393
|
+
/** Did a human draw this box, or did the assist propose it? */
|
|
19394
|
+
var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
|
|
19395
|
+
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
19396
|
+
var RetrainBboxSchema = object({
|
|
19397
|
+
x: number(),
|
|
19398
|
+
y: number(),
|
|
19399
|
+
w: number(),
|
|
19400
|
+
h: number()
|
|
19401
|
+
});
|
|
19402
|
+
/**
|
|
19403
|
+
* One annotated subject.
|
|
19404
|
+
*
|
|
19405
|
+
* `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
|
|
19406
|
+
* (letterboxed root / zone-cropped package / subject-cropped classifier) are
|
|
19407
|
+
* derived from it at export and never stored — storing them is how one feature
|
|
19408
|
+
* space ends up holding two crops of the same subject (D52).
|
|
19409
|
+
*/
|
|
19410
|
+
var RetrainAnnotationSchema = object({
|
|
19411
|
+
id: string(),
|
|
19412
|
+
trackId: string(),
|
|
19413
|
+
deviceId: number(),
|
|
19414
|
+
/** The COPY in retrain storage — never the source track's media key. */
|
|
19415
|
+
mediaKey: string(),
|
|
19416
|
+
bbox: RetrainBboxSchema,
|
|
19417
|
+
macroClass: RetrainMacroClassSchema,
|
|
19418
|
+
label: string().optional(),
|
|
19419
|
+
subLabel: string().optional(),
|
|
19420
|
+
kind: RetrainAnnotationKindSchema,
|
|
19421
|
+
source: RetrainAnnotationSourceSchema,
|
|
19422
|
+
/** Which model proposed this box — or, on a `model_error`, drew the phantom. */
|
|
19423
|
+
assistModelId: string().optional(),
|
|
19424
|
+
assistScore: number().optional(),
|
|
19425
|
+
exportedInBatch: string().optional(),
|
|
19426
|
+
createdAt: number()
|
|
19427
|
+
});
|
|
19428
|
+
/** The write form — the server owns `id`, `createdAt` and the frame binding. */
|
|
19429
|
+
var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
|
|
19430
|
+
id: true,
|
|
19431
|
+
trackId: true,
|
|
19432
|
+
deviceId: true,
|
|
19433
|
+
mediaKey: true,
|
|
19434
|
+
createdAt: true,
|
|
19435
|
+
exportedInBatch: true
|
|
19436
|
+
});
|
|
19437
|
+
/** A track sitting in `staging`, with everything the worklist needs to rank it. */
|
|
19438
|
+
var RetrainTrackSchema = object({
|
|
19439
|
+
trackId: string(),
|
|
19440
|
+
deviceId: number(),
|
|
19441
|
+
className: string(),
|
|
19442
|
+
label: string().optional(),
|
|
19443
|
+
firstSeen: number(),
|
|
19444
|
+
lastSeen: number(),
|
|
19445
|
+
/** How many frames the dataset already holds from this track. */
|
|
19446
|
+
frameCount: number().int(),
|
|
19447
|
+
/** How many subjects have been annotated on those frames. `0` with
|
|
19448
|
+
* `frameCount: 0` is exactly "staging, still to work". */
|
|
19449
|
+
annotationCount: number().int()
|
|
19450
|
+
});
|
|
19451
|
+
/** A frame the picker may offer — an index row, no blob was read to produce it. */
|
|
19452
|
+
var RetrainFrameCandidateSchema = object({
|
|
19453
|
+
mediaKey: string(),
|
|
19454
|
+
kind: MediaFileKindEnum,
|
|
19455
|
+
timestamp: number(),
|
|
19456
|
+
sizeBytes: number().int(),
|
|
19457
|
+
/** A copy of this original already exists — selecting it is free and cannot
|
|
19458
|
+
* fail, whatever became of the original. */
|
|
19459
|
+
copied: boolean()
|
|
19460
|
+
});
|
|
19461
|
+
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
19462
|
+
var RetrainFrameSchema = object({
|
|
19463
|
+
frameId: string(),
|
|
19464
|
+
deviceId: number(),
|
|
19465
|
+
trackId: string(),
|
|
19466
|
+
/** Provenance only. It may already point at nothing — that is expected. */
|
|
19467
|
+
sourceMediaKey: string(),
|
|
19468
|
+
sourceKind: MediaFileKindEnum,
|
|
19469
|
+
sizeBytes: number().int(),
|
|
19470
|
+
width: number().int(),
|
|
19471
|
+
height: number().int(),
|
|
19472
|
+
copiedAt: number()
|
|
19473
|
+
});
|
|
19474
|
+
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
19475
|
+
var RetrainCopyRefusalSchema = _enum([
|
|
19476
|
+
"source-missing",
|
|
19477
|
+
"unreadable-image",
|
|
19478
|
+
"write-failed"
|
|
19479
|
+
]);
|
|
19480
|
+
var RetrainFrameSelectionSchema = object({
|
|
19481
|
+
copied: array(RetrainFrameSchema).readonly(),
|
|
19482
|
+
refused: array(object({
|
|
19483
|
+
sourceMediaKey: string(),
|
|
19484
|
+
reason: RetrainCopyRefusalSchema
|
|
19485
|
+
})).readonly()
|
|
19486
|
+
});
|
|
19487
|
+
var RetrainFrameListSchema = object({
|
|
19488
|
+
candidates: array(RetrainFrameCandidateSchema).readonly(),
|
|
19489
|
+
copies: array(RetrainFrameSchema).readonly(),
|
|
19490
|
+
/** What the page pre-selects — the native key frame when one survives. */
|
|
19491
|
+
autoPickMediaKey: string().optional()
|
|
19492
|
+
});
|
|
19493
|
+
/** What the operator asked the assist to look for. */
|
|
19494
|
+
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
19495
|
+
kind: literal("package"),
|
|
19496
|
+
zone: RetrainBboxSchema.optional()
|
|
19497
|
+
}), object({
|
|
19498
|
+
kind: literal("objects"),
|
|
19499
|
+
modelId: string(),
|
|
19500
|
+
minScore: number().optional()
|
|
19501
|
+
})]);
|
|
19502
|
+
/**
|
|
19503
|
+
* The assist's answer — a discriminated union, because "the model saw nothing"
|
|
19504
|
+
* and "this node cannot run that model" lead to different next moves and a
|
|
19505
|
+
* nullable result cannot tell them apart.
|
|
19506
|
+
*/
|
|
19507
|
+
var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
19508
|
+
kind: literal("proposed"),
|
|
19509
|
+
modelId: string(),
|
|
19510
|
+
stepId: string(),
|
|
19511
|
+
minScore: number(),
|
|
19512
|
+
/** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
|
|
19513
|
+
proposals: array(RetrainAnnotationDraftSchema).readonly(),
|
|
19514
|
+
/** Returned by the runner but removed by the threshold. */
|
|
19515
|
+
belowThreshold: number().int()
|
|
19516
|
+
}), object({
|
|
19517
|
+
kind: literal("refused"),
|
|
19518
|
+
/** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
|
|
19519
|
+
reason: string(),
|
|
19520
|
+
detail: string().optional()
|
|
19521
|
+
})]);
|
|
19522
|
+
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
19523
|
+
var RetrainTransitionResultSchema = object({
|
|
19524
|
+
trackId: string(),
|
|
19525
|
+
/** Where the track ended up, whatever happened. */
|
|
19526
|
+
retrainStatus: RetrainStatusSchema,
|
|
19527
|
+
/** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
|
|
19528
|
+
changed: boolean(),
|
|
19529
|
+
reason: _enum([
|
|
19530
|
+
"unknown-track",
|
|
19531
|
+
"no-frames-copied",
|
|
19532
|
+
"not-staging",
|
|
19533
|
+
"not-trained",
|
|
19534
|
+
"unchanged"
|
|
19535
|
+
]).optional()
|
|
19536
|
+
});
|
|
19537
|
+
var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
|
|
19538
|
+
var MAX_EVENT_QUERY_LIMIT = 5e3;
|
|
19539
|
+
var DeviceEventQueryInput = object({
|
|
19540
|
+
deviceId: number(),
|
|
19541
|
+
since: number().optional(),
|
|
19542
|
+
until: number().optional(),
|
|
19543
|
+
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
|
|
19544
|
+
/** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
|
|
19545
|
+
* optional `mediaUrl` (populated by B5). `full` (default) keeps today's
|
|
19546
|
+
* exact behaviour. Callers may omit this field — the store defaults to
|
|
19547
|
+
* `full` when not provided. */
|
|
19548
|
+
projection: _enum(["full", "slim"]).optional()
|
|
19549
|
+
});
|
|
19550
|
+
var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
|
|
19551
|
+
var RecentTracksQueryInput = object({
|
|
19552
|
+
/** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
|
|
19553
|
+
deviceIds: array(number()),
|
|
19554
|
+
/** Window lower bound on `lastSeen` (inclusive). */
|
|
19555
|
+
since: number().optional(),
|
|
19556
|
+
/** Window upper bound on `lastSeen` (inclusive). */
|
|
19557
|
+
until: number().optional(),
|
|
19558
|
+
/** Page size. Default 200, max 1000. */
|
|
19559
|
+
limit: number().int().min(1).max(1e3).default(200),
|
|
19560
|
+
/** Opaque continuation cursor from a previous page's `nextCursor`.
|
|
19561
|
+
* Encodes the (lastSeen, trackId) sort position — treat as opaque. */
|
|
19562
|
+
cursor: string().optional(),
|
|
19563
|
+
/** See {@link TrackProjectionSchema}. Default `full`. */
|
|
19564
|
+
projection: TrackProjectionSchema.optional(),
|
|
19565
|
+
/** Include stationary-promoted rows (parked objects). Default false: the
|
|
19566
|
+
* feed lists passages; parking records live on the stationary registry. */
|
|
19567
|
+
includeStationary: boolean().optional()
|
|
19568
|
+
});
|
|
19569
|
+
var RecentTracksPageSchema = object({
|
|
19570
|
+
/** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
|
|
19571
|
+
tracks: array(TrackSchema).readonly(),
|
|
19572
|
+
/** Cursor for the next page, or null when this page is the last. */
|
|
19573
|
+
nextCursor: string().nullable()
|
|
19574
|
+
});
|
|
19575
|
+
var LIST_GROUPS_DEFAULT_LIMIT = 40;
|
|
19576
|
+
var LIST_GROUPS_MAX_LIMIT = 100;
|
|
19577
|
+
var AnalyticsGroupRecordSchema = object({
|
|
19578
|
+
id: string(),
|
|
19579
|
+
deviceId: number().int(),
|
|
19580
|
+
openedAt: number().int(),
|
|
19581
|
+
closedAt: number().int(),
|
|
19582
|
+
timestamp: number().int(),
|
|
19583
|
+
memberCount: number().int(),
|
|
19584
|
+
memberTrackIds: array(string()).readonly(),
|
|
19585
|
+
className: string(),
|
|
19586
|
+
classes: array(string()).readonly(),
|
|
19587
|
+
/** Relative event-media path, or null when the group has no picture yet. */
|
|
19588
|
+
mediaUrl: string().nullable(),
|
|
19589
|
+
singleton: boolean()
|
|
19590
|
+
});
|
|
19591
|
+
var AnalyticsGroupMemberSchema = object({
|
|
19592
|
+
trackId: string(),
|
|
19593
|
+
deviceId: number().int(),
|
|
19594
|
+
className: string(),
|
|
19595
|
+
firstSeen: number().int(),
|
|
19596
|
+
lastSeen: number().int(),
|
|
19597
|
+
mediaUrl: string().nullable()
|
|
19598
|
+
});
|
|
19599
|
+
var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
|
|
19600
|
+
var ListGroupsQueryInput = object({
|
|
19601
|
+
/** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
|
|
19602
|
+
deviceIds: array(number()),
|
|
19603
|
+
/** Window lower bound on `closedAt` (inclusive). */
|
|
19604
|
+
since: number().optional(),
|
|
19605
|
+
/** Window upper bound on `openedAt` (inclusive). */
|
|
19606
|
+
until: number().optional(),
|
|
19607
|
+
limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
|
|
19608
|
+
/** Opaque continuation cursor from a previous page's `nextCursor`. */
|
|
19609
|
+
cursor: string().optional()
|
|
19610
|
+
});
|
|
19611
|
+
var ListGroupsPageSchema = object({
|
|
19612
|
+
groups: array(AnalyticsGroupRecordSchema).readonly(),
|
|
19613
|
+
nextCursor: string().nullable()
|
|
19614
|
+
});
|
|
19615
|
+
var KeyEventQueryInput = object({
|
|
19616
|
+
deviceId: number(),
|
|
19617
|
+
/** Window lower bound (track firstSeen ≥ since). */
|
|
19618
|
+
since: number(),
|
|
19619
|
+
/** Window upper bound (track firstSeen ≤ until). */
|
|
19620
|
+
until: number(),
|
|
19621
|
+
limit: number().int().min(1).max(200).default(50),
|
|
19622
|
+
/** Drop tracks scoring below this importance. */
|
|
19623
|
+
minImportance: number().min(0).max(1).optional(),
|
|
19624
|
+
/** Restrict to a single class (e.g. 'person'). */
|
|
19625
|
+
classFilter: string().optional()
|
|
19626
|
+
});
|
|
19627
|
+
var KeyEventSchema = object({
|
|
19628
|
+
/** The representative event id (the track's best ObjectEvent, else its trackId). */
|
|
19629
|
+
id: string(),
|
|
19630
|
+
trackId: string(),
|
|
19631
|
+
/** Track start time (firstSeen). */
|
|
19632
|
+
timestamp: number(),
|
|
19633
|
+
className: string(),
|
|
19634
|
+
...TieredLabelFields,
|
|
19635
|
+
importance: number(),
|
|
19636
|
+
/** Highest-confidence ObjectEvent id for the track (empty when none). */
|
|
19637
|
+
bestEventId: string(),
|
|
19638
|
+
/** Track lifetime in ms (lastSeen - firstSeen). */
|
|
19639
|
+
windowMs: number().optional(),
|
|
19640
|
+
...TrackFlagFields,
|
|
19641
|
+
...TrackRetrainFields
|
|
19642
|
+
});
|
|
19643
|
+
object({
|
|
19644
|
+
trackId: string(),
|
|
19645
|
+
className: string(),
|
|
19646
|
+
confidence: number(),
|
|
19647
|
+
bbox: BoundingBoxSchema,
|
|
19648
|
+
zones: array(string()).readonly(),
|
|
19649
|
+
state: TrackStateSchema
|
|
19650
|
+
});
|
|
19651
|
+
var OverlayDetectionSchema = looseObject({
|
|
19652
|
+
id: string(),
|
|
19653
|
+
kind: _enum(["first-level", "detail"]),
|
|
19654
|
+
macroClass: string(),
|
|
19655
|
+
score: number(),
|
|
19656
|
+
bbox: object({
|
|
19657
|
+
x: number(),
|
|
19658
|
+
y: number(),
|
|
19659
|
+
width: number(),
|
|
19660
|
+
height: number()
|
|
19661
|
+
}),
|
|
19662
|
+
labels: array(looseObject({
|
|
19663
|
+
label: string(),
|
|
19664
|
+
score: number()
|
|
19665
|
+
})).readonly(),
|
|
19666
|
+
parentId: string().optional()
|
|
19667
|
+
});
|
|
19668
|
+
var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
|
|
19669
|
+
var SearchObjectEventsInput = object({
|
|
19670
|
+
text: string(),
|
|
19671
|
+
deviceId: number().optional(),
|
|
19672
|
+
since: number().optional(),
|
|
19673
|
+
until: number().optional(),
|
|
19674
|
+
classFilter: string().optional(),
|
|
19675
|
+
limit: number().default(50),
|
|
19676
|
+
minScore: number().min(0).max(1).default(.2)
|
|
19677
|
+
});
|
|
19678
|
+
var TrackCascadeCountsSchema = object({
|
|
19679
|
+
/** Persisted track roots deleted (authoritative). */
|
|
19680
|
+
tracks: number().int(),
|
|
19681
|
+
/** Object events removed with their tracks (best-effort; see note above). */
|
|
19682
|
+
events: number().int(),
|
|
19683
|
+
/** Track/face/plate-owned media removed (best-effort). Never identity media. */
|
|
19684
|
+
media: number().int(),
|
|
19685
|
+
/** Unassigned (non-enrolled) face reads removed (best-effort). */
|
|
19686
|
+
faces: number().int(),
|
|
19687
|
+
/** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
|
|
19688
|
+
plates: number().int(),
|
|
19689
|
+
/** Per-track CLIP search vectors removed (best-effort). */
|
|
19690
|
+
embeddings: number().int(),
|
|
19691
|
+
/** Group membership + group rows removed with their last member (best-effort). */
|
|
19692
|
+
groups: number().int()
|
|
19693
|
+
});
|
|
19694
|
+
/** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
|
|
19695
|
+
var DiskReconcileCountsSchema = object({
|
|
19696
|
+
mediaDropped: number().int(),
|
|
19697
|
+
tracks: number().int(),
|
|
19698
|
+
events: number().int()
|
|
19699
|
+
});
|
|
19700
|
+
/** Event-store footprint for one camera. */
|
|
19701
|
+
var EventStoreDeviceFootprintSchema = object({
|
|
19702
|
+
deviceId: number(),
|
|
19703
|
+
/** Persisted event rows (motion + object + audio) for the camera. */
|
|
19704
|
+
rows: number().int(),
|
|
19705
|
+
/** Event-owned media bytes on disk for the camera. */
|
|
19706
|
+
bytes: number().int()
|
|
19707
|
+
});
|
|
19708
|
+
/** Aggregate event-store footprint: global totals + per-camera breakdown. */
|
|
19709
|
+
var EventStoreFootprintSchema = object({
|
|
19710
|
+
totalRows: number().int(),
|
|
19711
|
+
totalBytes: number().int(),
|
|
19712
|
+
devices: array(EventStoreDeviceFootprintSchema).readonly()
|
|
19713
|
+
});
|
|
19714
|
+
/** Per-kind counts returned by the event-prune / device-delete mutations. */
|
|
19715
|
+
var EventPruneCountsSchema = object({
|
|
19716
|
+
motion: number().int(),
|
|
19717
|
+
object: number().int(),
|
|
19718
|
+
audio: number().int()
|
|
19719
|
+
});
|
|
19720
|
+
/**
|
|
19721
|
+
* Re-embed stored tracks from their key frames.
|
|
19722
|
+
*
|
|
19723
|
+
* The reason this is an operator-callable method and not a migration script:
|
|
19724
|
+
* every knob that decides what a vector MEANS — encoder model, crop margin,
|
|
19725
|
+
* squaring — is only changeable if the existing vectors can be regenerated.
|
|
19726
|
+
* Mixing feature spaces in one index makes cosine scores incomparable, and the
|
|
19727
|
+
* symptom is a quality regression with no visible cause.
|
|
19728
|
+
*/
|
|
19729
|
+
var RebuildObjectEmbeddingsInput = object({
|
|
19730
|
+
/** Restrict to one camera. Omit for the whole fleet. */
|
|
19731
|
+
deviceId: number().optional(),
|
|
19732
|
+
since: number().optional(),
|
|
19733
|
+
until: number().optional(),
|
|
19734
|
+
/** Stop after this many tracks; the result reports whether more remain. */
|
|
19735
|
+
maxTracks: number().int().positive().optional(),
|
|
19736
|
+
/**
|
|
19737
|
+
* Run every embedding on THIS node instead of round-robining the fleet.
|
|
19738
|
+
*
|
|
19739
|
+
* Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
|
|
19740
|
+
* field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
|
|
19741
|
+
* calling it that would pin the rebuild REQUEST itself to that node — the
|
|
19742
|
+
* rebuild orchestration lives on the hub, and only the per-track step runs
|
|
19743
|
+
* remotely. This field is data; the per-track pin is applied inside.
|
|
19744
|
+
*
|
|
19745
|
+
* Absent ⇒ round-robin over every online node whose runner can serve the
|
|
19746
|
+
* pinned model.
|
|
19747
|
+
*/
|
|
19748
|
+
executeOnNodeId: string().optional(),
|
|
19749
|
+
/**
|
|
19750
|
+
* Milliseconds to wait between tracks; omit for the built-in default, `0` to
|
|
19751
|
+
* run flat out.
|
|
19752
|
+
*
|
|
19753
|
+
* A rebuild is bulk maintenance on hub-main's single thread. Measured
|
|
19754
|
+
* 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
|
|
19755
|
+
* pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
|
|
19756
|
+
* force is logged at start and finish so a deliberately slow pass reads
|
|
19757
|
+
* differently from a stalled one.
|
|
19758
|
+
*/
|
|
19759
|
+
pacingMs: number().int().nonnegative().optional()
|
|
19760
|
+
});
|
|
19761
|
+
/**
|
|
19762
|
+
* Result of emptying the CLIP index.
|
|
19763
|
+
*
|
|
19764
|
+
* The clean slate before a policy change: a new crop margin or encoder model
|
|
19765
|
+
* leaves two feature spaces in one index whose cosine scores are not
|
|
19766
|
+
* comparable, so wiping and rebuilding is the only way to be sure every vector
|
|
19767
|
+
* means the same thing.
|
|
19768
|
+
*/
|
|
19769
|
+
var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
|
|
19770
|
+
/**
|
|
19771
|
+
* Acknowledgement that a rebuild STARTED.
|
|
19772
|
+
*
|
|
19773
|
+
* The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
|
|
19774
|
+
* runs detached and this returns immediately. Waiting for it made the client
|
|
19775
|
+
* time out while the work carried on server-side, which is the worst of both:
|
|
19776
|
+
* no result and no way to know it was still going. Poll
|
|
19777
|
+
* `getObjectEmbeddingRebuildStatus` for progress.
|
|
19778
|
+
*/
|
|
19779
|
+
var RebuildObjectEmbeddingsResultSchema = object({
|
|
19780
|
+
started: boolean(),
|
|
19781
|
+
/** True when a pass was already running; the new request is ignored. */
|
|
19782
|
+
alreadyRunning: boolean()
|
|
19783
|
+
});
|
|
19784
|
+
var RebuildStatusSchema = object({
|
|
19785
|
+
running: boolean(),
|
|
19786
|
+
scanned: number(),
|
|
19787
|
+
rebuilt: number(),
|
|
19788
|
+
/** Tracks whose key frame is gone — nothing to re-embed from. */
|
|
19789
|
+
missingKeyFrame: number(),
|
|
19790
|
+
/** Tracks with no usable detection box. */
|
|
19791
|
+
missingBbox: number(),
|
|
19792
|
+
/**
|
|
19793
|
+
* Tracks an executing node REFUSED rather than broke on — an unreadable key
|
|
19794
|
+
* frame, a step that threw. Separate from `failed` because the remedy is
|
|
19795
|
+
* different, and because a whole camera silently contributing zero vectors
|
|
19796
|
+
* is the shape of failure a rebuild must never hide.
|
|
19797
|
+
*/
|
|
19798
|
+
notRunnable: number(),
|
|
19799
|
+
/**
|
|
19800
|
+
* The pass stopped because NO node could serve the pinned model.
|
|
19801
|
+
*
|
|
19802
|
+
* Distinct from `notRunnable` on purpose: that one says "this track was
|
|
19803
|
+
* refused", this one says "the cluster cannot do this work at all" — every
|
|
19804
|
+
* candidate node either lacks the `clip-embedding` step, lacks a build of the
|
|
19805
|
+
* pinned model for its engine format, or dropped out. The remedy is a model /
|
|
19806
|
+
* engine change, not a per-camera one. Non-zero here always comes with
|
|
19807
|
+
* `complete: false`.
|
|
19808
|
+
*/
|
|
19809
|
+
noCapableNode: number(),
|
|
19810
|
+
failed: number(),
|
|
19811
|
+
/** Set once a pass ends: true only when EVERYTHING was covered. */
|
|
19812
|
+
complete: boolean().nullable(),
|
|
19813
|
+
startedAtMs: number().nullable(),
|
|
19814
|
+
finishedAtMs: number().nullable(),
|
|
19815
|
+
/** Present when the pass ended by throwing. */
|
|
19816
|
+
error: string().nullable()
|
|
19817
|
+
});
|
|
19818
|
+
var ReplayFrameInputSchema = object({
|
|
19819
|
+
timestamp: number(),
|
|
19820
|
+
frame: PipelineRunResultBridge
|
|
19821
|
+
});
|
|
19822
|
+
var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
|
|
19823
|
+
className: string(),
|
|
19824
|
+
firstSeenMs: number(),
|
|
19825
|
+
lastSeenMs: number(),
|
|
19826
|
+
/** Bbox of the track's FIRST matched detection, pixel-space in the clip's
|
|
19827
|
+
* frame — a representative box for the diff's `(className, window, IoU)`
|
|
19828
|
+
* pairing (`replay-diff.ts`). A replay does not need the full per-frame
|
|
19829
|
+
* trajectory production's `Track.positions` keeps. */
|
|
19830
|
+
bbox: BoundingBoxSchema,
|
|
19831
|
+
/** How many of the input frames this track matched a real detection on
|
|
19832
|
+
* (never a coasted/extrapolated frame) — the replay's own signal for "how
|
|
19833
|
+
* solid is this track", cheaper than re-deriving it from a trajectory. */
|
|
19834
|
+
framesMatched: number().int()
|
|
19835
|
+
})).readonly() });
|
|
19836
|
+
DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
|
|
19837
|
+
deviceId: number(),
|
|
19838
|
+
trackId: string()
|
|
19839
|
+
}), TrackSchema.nullable()), method(object({
|
|
19840
|
+
deviceId: number(),
|
|
19841
|
+
since: number().optional(),
|
|
19842
|
+
until: number().optional(),
|
|
19843
|
+
limit: number().optional(),
|
|
19844
|
+
/** Spatial filter — only tracks whose trajectory intersects the zone
|
|
19845
|
+
* (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
|
|
19846
|
+
* envelope columns, then precisely tested per position. Tracks with
|
|
19847
|
+
* an unknown envelope (no frame dims at persist time) always match. */
|
|
19848
|
+
zone: TrackZoneFilterSchema.optional(),
|
|
19849
|
+
/** See {@link TrackProjectionSchema}. Default `full` (backward
|
|
19850
|
+
* compatible — omitting the field keeps today's exact behaviour). */
|
|
19851
|
+
projection: TrackProjectionSchema.optional(),
|
|
19852
|
+
/** Include stationary-promoted rows (parked objects handed to the
|
|
19853
|
+
* stationary registry). Default false: the timeline lists passages,
|
|
19854
|
+
* not parking records (operator decision, 2026-08-15). */
|
|
19855
|
+
includeStationary: boolean().optional()
|
|
19856
|
+
}), array(TrackSchema).readonly()), method(RecentTracksQueryInput, RecentTracksPageSchema), method(ListGroupsQueryInput, ListGroupsPageSchema), method(object({
|
|
19857
|
+
deviceId: number(),
|
|
19858
|
+
groupId: string().min(1)
|
|
19859
|
+
}), AnalyticsGroupDetailSchema.nullable()), method(object({ deviceId: number() }), _void(), {
|
|
19860
|
+
kind: "mutation",
|
|
19861
|
+
auth: "admin"
|
|
19862
|
+
}), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()), method(object({
|
|
19863
|
+
deviceId: number(),
|
|
19864
|
+
since: number().optional(),
|
|
19865
|
+
until: number().optional(),
|
|
19866
|
+
kinds: array(string()).optional(),
|
|
19867
|
+
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
|
|
19868
|
+
}), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
|
|
19869
|
+
deviceId: number(),
|
|
19870
|
+
since: number(),
|
|
19871
|
+
until: number(),
|
|
19872
|
+
bucketMs: number().int().positive()
|
|
19873
|
+
}), array(object({
|
|
19874
|
+
bucketStart: number(),
|
|
19875
|
+
motion: number().int(),
|
|
19876
|
+
object: number().int(),
|
|
19877
|
+
audio: number().int()
|
|
19878
|
+
})).readonly()), method(object({
|
|
19879
|
+
deviceId: number(),
|
|
19880
|
+
cutoffMs: number()
|
|
19881
|
+
}), object({
|
|
19882
|
+
motion: number().int(),
|
|
19883
|
+
object: number().int(),
|
|
19884
|
+
audio: number().int()
|
|
19885
|
+
}), {
|
|
19886
|
+
kind: "mutation",
|
|
19887
|
+
auth: "admin"
|
|
19888
|
+
}), method(object({
|
|
19889
|
+
deviceId: number(),
|
|
19890
|
+
cutoffMs: number()
|
|
19891
|
+
}), TrackCascadeCountsSchema, {
|
|
19892
|
+
kind: "mutation",
|
|
19893
|
+
auth: "admin"
|
|
19894
|
+
}), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
|
|
19895
|
+
kind: "mutation",
|
|
19896
|
+
auth: "admin"
|
|
19897
|
+
}), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
|
|
19898
|
+
kind: "mutation",
|
|
19899
|
+
auth: "admin"
|
|
19900
|
+
}), method(object({
|
|
19901
|
+
deviceId: number(),
|
|
19902
|
+
trackIds: array(string()).min(1)
|
|
19903
|
+
}), object({
|
|
19904
|
+
deleted: number().int(),
|
|
19905
|
+
failed: array(string()).readonly()
|
|
19906
|
+
}), {
|
|
19907
|
+
kind: "mutation",
|
|
19908
|
+
auth: "admin"
|
|
19909
|
+
}), method(object({
|
|
19910
|
+
/** Log/audit scope only — the trackId is globally unique on its own. */
|
|
19911
|
+
deviceId: number(),
|
|
19912
|
+
trackId: string(),
|
|
19913
|
+
flags: TrackFlagsPatchSchema
|
|
19914
|
+
}), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
|
|
19915
|
+
kind: "query",
|
|
19916
|
+
auth: "admin"
|
|
19917
|
+
}), method(object({
|
|
19918
|
+
olderThanMs: number(),
|
|
19919
|
+
reason: OpsLogReasonSchema.optional()
|
|
19920
|
+
}), EventPruneCountsSchema, {
|
|
19921
|
+
kind: "mutation",
|
|
19922
|
+
auth: "admin"
|
|
19923
|
+
}), method(object({ deviceId: number() }), EventPruneCountsSchema, {
|
|
19924
|
+
kind: "mutation",
|
|
19925
|
+
auth: "admin"
|
|
19926
|
+
}), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
|
|
19927
|
+
kind: "mutation",
|
|
19928
|
+
auth: "admin"
|
|
19929
|
+
}), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
|
|
19930
|
+
kind: "mutation",
|
|
19931
|
+
auth: "admin"
|
|
19932
|
+
}), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
|
|
19933
|
+
kind: "mutation",
|
|
19934
|
+
auth: "admin"
|
|
19935
|
+
}), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
|
|
19936
|
+
kind: "mutation",
|
|
19937
|
+
auth: "admin"
|
|
19938
|
+
}), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
19939
|
+
kind: "mutation",
|
|
19940
|
+
auth: "admin"
|
|
19941
|
+
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
19942
|
+
kind: "mutation",
|
|
19943
|
+
auth: "admin"
|
|
19944
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
19945
|
+
kind: "query",
|
|
19946
|
+
auth: "admin"
|
|
19947
|
+
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
19948
|
+
kind: "mutation",
|
|
19949
|
+
auth: "admin"
|
|
19950
|
+
}), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
19951
|
+
kind: "query",
|
|
19952
|
+
auth: "admin"
|
|
19953
|
+
}), method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
|
|
19954
|
+
kind: "query",
|
|
19955
|
+
auth: "admin"
|
|
19956
|
+
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
19957
|
+
kind: "query",
|
|
19958
|
+
auth: "admin"
|
|
19959
|
+
}), method(object({
|
|
19960
|
+
/** Empty ⇒ every camera that has staging tracks. A LIST, not a single
|
|
19961
|
+
* `deviceId`, deliberately: `deviceId` would make this device-bound and
|
|
19962
|
+
* route it at one camera's owner, and "every camera" would stop being
|
|
19963
|
+
* expressible at all. */
|
|
19964
|
+
deviceIds: array(number()).optional(),
|
|
19965
|
+
limit: number().int().min(1).max(500).optional()
|
|
19966
|
+
}), array(RetrainTrackSchema).readonly(), {
|
|
19967
|
+
kind: "query",
|
|
19968
|
+
auth: "admin"
|
|
19969
|
+
}), method(object({ trackId: string() }), RetrainFrameListSchema, {
|
|
19970
|
+
kind: "query",
|
|
19971
|
+
auth: "admin"
|
|
19972
|
+
}), method(object({
|
|
19973
|
+
deviceId: number(),
|
|
19974
|
+
trackId: string(),
|
|
19975
|
+
mediaKeys: array(string()).min(1)
|
|
19976
|
+
}), RetrainFrameSelectionSchema, {
|
|
19977
|
+
kind: "mutation",
|
|
19978
|
+
auth: "admin"
|
|
19979
|
+
}), method(object({
|
|
19980
|
+
deviceId: number(),
|
|
19981
|
+
trackId: string(),
|
|
19982
|
+
frameId: string()
|
|
19983
|
+
}), object({
|
|
19984
|
+
removed: boolean(),
|
|
19985
|
+
removedAnnotations: number().int()
|
|
19986
|
+
}), {
|
|
19987
|
+
kind: "mutation",
|
|
19988
|
+
auth: "admin"
|
|
19989
|
+
}), method(object({ frameId: string() }), object({
|
|
19990
|
+
base64: string(),
|
|
19991
|
+
width: number().int(),
|
|
19992
|
+
height: number().int()
|
|
19993
|
+
}), {
|
|
19994
|
+
kind: "query",
|
|
19995
|
+
auth: "admin"
|
|
19996
|
+
}), method(object({
|
|
19997
|
+
deviceId: number(),
|
|
19998
|
+
trackId: string(),
|
|
19999
|
+
frameId: string(),
|
|
20000
|
+
subject: RetrainAssistSubjectSchema,
|
|
20001
|
+
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
20002
|
+
nodeId: string().optional()
|
|
20003
|
+
}), RetrainAssistResultSchema, {
|
|
20004
|
+
kind: "mutation",
|
|
20005
|
+
auth: "admin"
|
|
20006
|
+
}), method(object({
|
|
20007
|
+
deviceId: number(),
|
|
20008
|
+
source: DetectionSourceSchema,
|
|
20009
|
+
zones: array(ZoneSchema).readonly().optional(),
|
|
20010
|
+
detectionRules: array(ZoneRuleSchema).readonly().optional(),
|
|
20011
|
+
zoneMembershipMinOverlap: number().min(0).max(1).optional(),
|
|
20012
|
+
frames: array(ReplayFrameInputSchema).min(1)
|
|
20013
|
+
}), RunReplayFrameProcessorResultSchema, {
|
|
20014
|
+
kind: "mutation",
|
|
20015
|
+
auth: "admin"
|
|
20016
|
+
}), method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
20017
|
+
kind: "query",
|
|
20018
|
+
auth: "admin"
|
|
20019
|
+
}), method(object({
|
|
20020
|
+
deviceId: number(),
|
|
20021
|
+
trackId: string(),
|
|
20022
|
+
frameId: string(),
|
|
20023
|
+
annotations: array(RetrainAnnotationDraftSchema)
|
|
20024
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
20025
|
+
kind: "mutation",
|
|
20026
|
+
auth: "admin"
|
|
20027
|
+
}), method(object({
|
|
20028
|
+
deviceId: number(),
|
|
20029
|
+
trackId: string()
|
|
20030
|
+
}), RetrainTransitionResultSchema, {
|
|
20031
|
+
kind: "mutation",
|
|
20032
|
+
auth: "admin"
|
|
20033
|
+
}), method(object({
|
|
20034
|
+
deviceId: number(),
|
|
20035
|
+
trackId: string()
|
|
20036
|
+
}), RetrainTransitionResultSchema, {
|
|
20037
|
+
kind: "mutation",
|
|
20038
|
+
auth: "admin"
|
|
20039
|
+
}), method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
20040
|
+
kind: "query",
|
|
20041
|
+
auth: "admin"
|
|
20042
|
+
}), method(object({
|
|
20043
|
+
eventId: string(),
|
|
20044
|
+
kind: MediaFileKindEnum.optional(),
|
|
20045
|
+
deviceId: number()
|
|
20046
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
20047
|
+
trackId: string(),
|
|
20048
|
+
kinds: array(MediaFileKindEnum).optional(),
|
|
20049
|
+
deviceId: number()
|
|
20050
|
+
}), array(MediaFileSchema).readonly()), method(object({
|
|
20051
|
+
trackId: string(),
|
|
20052
|
+
deviceId: number()
|
|
20053
|
+
}), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
20054
|
+
kind: "mutation",
|
|
20055
|
+
auth: "admin"
|
|
20056
|
+
}), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
20057
|
+
kind: "mutation",
|
|
20058
|
+
auth: "admin"
|
|
20059
|
+
}), method(object({}), RebuildStatusSchema), object({
|
|
20060
|
+
deviceId: number(),
|
|
20061
|
+
timestamp: number(),
|
|
20062
|
+
frameWidth: number(),
|
|
20063
|
+
frameHeight: number(),
|
|
20064
|
+
detections: array(OverlayDetectionSchema).readonly()
|
|
20065
|
+
}), object({
|
|
20066
|
+
deviceId: number(),
|
|
20067
|
+
trackId: string(),
|
|
20068
|
+
className: string()
|
|
20069
|
+
}), object({
|
|
20070
|
+
deviceId: number(),
|
|
20071
|
+
trackId: string(),
|
|
20072
|
+
className: string(),
|
|
20073
|
+
durationMs: number()
|
|
20074
|
+
}), object({
|
|
20075
|
+
deviceId: number(),
|
|
20076
|
+
kind: EventKindSchema,
|
|
20077
|
+
eventId: string(),
|
|
20078
|
+
timestamp: number()
|
|
20079
|
+
});
|
|
19836
20080
|
object({
|
|
19837
20081
|
activeCameras: number(),
|
|
19838
20082
|
throttledCameras: number(),
|
|
@@ -19858,66 +20102,6 @@ var CameraMetricsSchema = object({
|
|
|
19858
20102
|
});
|
|
19859
20103
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
19860
20104
|
/**
|
|
19861
|
-
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
19862
|
-
*
|
|
19863
|
-
* Zones describe **where** in the frame the operator wants to flag
|
|
19864
|
-
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
19865
|
-
* each pipeline stage uses them. Splitting the two means a single
|
|
19866
|
-
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
19867
|
-
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
19868
|
-
* — without three duplicated polygons.
|
|
19869
|
-
*
|
|
19870
|
-
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
19871
|
-
* `zones` device-state slice on every mutation. Consumers
|
|
19872
|
-
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
19873
|
-
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
19874
|
-
* mirror with `onChanged`).
|
|
19875
|
-
*
|
|
19876
|
-
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
19877
|
-
* survive resolution changes and stream profile switches.
|
|
19878
|
-
*
|
|
19879
|
-
* `kind` discriminates between full polygons (closed regions used
|
|
19880
|
-
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
19881
|
-
* line segments used for cross events). Onboard / firmware-reported
|
|
19882
|
-
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
19883
|
-
* task list.
|
|
19884
|
-
*/
|
|
19885
|
-
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
19886
|
-
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
19887
|
-
var PolygonPointSchema = object({
|
|
19888
|
-
x: number(),
|
|
19889
|
-
y: number()
|
|
19890
|
-
});
|
|
19891
|
-
/** A camera detection zone — pure geometry/identity. */
|
|
19892
|
-
var ZoneSchema = object({
|
|
19893
|
-
id: string(),
|
|
19894
|
-
name: string(),
|
|
19895
|
-
kind: ZoneKindEnum.default("polygon"),
|
|
19896
|
-
/** Polygon vertices, fraction of frame (0–1). */
|
|
19897
|
-
polygon: array(PolygonPointSchema).readonly(),
|
|
19898
|
-
/** Visual color for UI rendering. */
|
|
19899
|
-
color: string().default("#3b82f6")
|
|
19900
|
-
});
|
|
19901
|
-
DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).readonly()), method(object({
|
|
19902
|
-
deviceId: number(),
|
|
19903
|
-
zone: ZoneSchema
|
|
19904
|
-
}), _void(), {
|
|
19905
|
-
kind: "mutation",
|
|
19906
|
-
auth: "admin"
|
|
19907
|
-
}), method(object({
|
|
19908
|
-
deviceId: number(),
|
|
19909
|
-
zoneId: string()
|
|
19910
|
-
}), _void(), {
|
|
19911
|
-
kind: "mutation",
|
|
19912
|
-
auth: "admin"
|
|
19913
|
-
}), method(object({
|
|
19914
|
-
deviceId: number(),
|
|
19915
|
-
zone: ZoneSchema
|
|
19916
|
-
}), _void(), {
|
|
19917
|
-
kind: "mutation",
|
|
19918
|
-
auth: "admin"
|
|
19919
|
-
}), object({ zones: array(ZoneSchema).readonly() });
|
|
19920
|
-
/**
|
|
19921
20105
|
* A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
|
|
19922
20106
|
* decode worker resolves it against the RETAINED native frame's real pixel dims,
|
|
19923
20107
|
* so the caller supplies only the detection-res bbox divided by the detection
|
|
@@ -27206,6 +27390,39 @@ var ReadGopBytesResultSchema = object({
|
|
|
27206
27390
|
/** Media ms the returned fragment covers. */
|
|
27207
27391
|
gopDurMs: number()
|
|
27208
27392
|
});
|
|
27393
|
+
/**
|
|
27394
|
+
* A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
|
|
27395
|
+
* twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
|
|
27396
|
+
* replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-clip-su-pipeline.md`):
|
|
27397
|
+
* a replay needs several seconds of native pixels, not one frame.
|
|
27398
|
+
*
|
|
27399
|
+
* `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
|
|
27400
|
+
* is `false` when the returned bytes were cut short by the read's own safety
|
|
27401
|
+
* byte cap before covering `[fromMs, toMs)` — a truncation, reported, not a
|
|
27402
|
+
* silently shorter answer. `spans-multiple-segments` is a REFUSAL, not a
|
|
27403
|
+
* degradation: a window whose end falls past the covering segment would need
|
|
27404
|
+
* bytes stitched from a second segment file (its own `ftyp`+`moov`), which is
|
|
27405
|
+
* not one standalone-demuxable stream — the caller's answer is to request a
|
|
27406
|
+
* shorter window or one aligned to a single segment, not to receive spliced
|
|
27407
|
+
* bytes nothing has proven decodable.
|
|
27408
|
+
*/
|
|
27409
|
+
var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
|
|
27410
|
+
kind: literal("ok"),
|
|
27411
|
+
data: _instanceof(Uint8Array),
|
|
27412
|
+
/** Absolute epoch ms of the returned bytes' first sample — at or before
|
|
27413
|
+
* the requested `fromMs` (anchored on the nearest keyframe). */
|
|
27414
|
+
gopStartMs: number(),
|
|
27415
|
+
/** Media ms the returned bytes cover, from `gopStartMs`. */
|
|
27416
|
+
gopDurMs: number(),
|
|
27417
|
+
/** `false` ⇒ the safety byte cap cut the read short before it reached
|
|
27418
|
+
* the requested `toMs`; the caller got fewer frames than asked for. */
|
|
27419
|
+
reachesRequestedEnd: boolean()
|
|
27420
|
+
}), object({
|
|
27421
|
+
kind: literal("spans-multiple-segments"),
|
|
27422
|
+
/** Where the covering segment's own footage runs out — informational,
|
|
27423
|
+
* not a retry hint (retrying the same window would refuse again). */
|
|
27424
|
+
segmentEndMs: number()
|
|
27425
|
+
})]);
|
|
27209
27426
|
var recordingCapability = {
|
|
27210
27427
|
name: "recording",
|
|
27211
27428
|
scope: "system",
|
|
@@ -27285,6 +27502,21 @@ var recordingCapability = {
|
|
|
27285
27502
|
kind: "query",
|
|
27286
27503
|
auth: "admin"
|
|
27287
27504
|
}),
|
|
27505
|
+
/** Read a WINDOW `[fromMs, toMs)` of segment `startMs`, by mfra byte
|
|
27506
|
+
* range — the multi-GOP twin of `readGopBytes`. Refuses (does not
|
|
27507
|
+
* degrade) when the window runs past the covering segment. Used by the
|
|
27508
|
+
* replay clip's `recording` source to fetch several seconds of native
|
|
27509
|
+
* footage for its single ffmpeg decode pass. */
|
|
27510
|
+
readWindowBytes: method(object({
|
|
27511
|
+
deviceId: number(),
|
|
27512
|
+
profile: string(),
|
|
27513
|
+
startMs: number(),
|
|
27514
|
+
fromMs: number(),
|
|
27515
|
+
toMs: number()
|
|
27516
|
+
}), ReadWindowBytesResultSchema, {
|
|
27517
|
+
kind: "query",
|
|
27518
|
+
auth: "admin"
|
|
27519
|
+
}),
|
|
27288
27520
|
setDeviceConfig: method(object({
|
|
27289
27521
|
deviceId: number(),
|
|
27290
27522
|
config: RecordingConfigSchema
|
|
@@ -27963,92 +28195,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSche
|
|
|
27963
28195
|
kind: "mutation",
|
|
27964
28196
|
auth: "admin"
|
|
27965
28197
|
});
|
|
27966
|
-
/**
|
|
27967
|
-
* Per-stage gating mode applied to the zones a rule references.
|
|
27968
|
-
*
|
|
27969
|
-
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
27970
|
-
* When at least one `include` rule fires for a stage, only entities
|
|
27971
|
-
* inside one of those zones pass that stage.
|
|
27972
|
-
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
27973
|
-
* Entities inside one of those zones are dropped at that stage.
|
|
27974
|
-
*
|
|
27975
|
-
* `monitor`-style observation (count without filtering) is not a rule
|
|
27976
|
-
* mode — zones without any matching rule are observed naturally by
|
|
27977
|
-
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
27978
|
-
* count, not filter" use case needs no rule at all.
|
|
27979
|
-
*/
|
|
27980
|
-
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
27981
|
-
/**
|
|
27982
|
-
* Per-consumer rule that references existing zones (geometry) and
|
|
27983
|
-
* defines how a specific pipeline stage should treat them. Each
|
|
27984
|
-
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
27985
|
-
* settings:
|
|
27986
|
-
*
|
|
27987
|
-
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
27988
|
-
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
27989
|
-
* - future: notification rules, audio gating, etc.
|
|
27990
|
-
*
|
|
27991
|
-
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
27992
|
-
* express "ignore motion in ALL of {garden, street}" with a single
|
|
27993
|
-
* rule. `classFilter` narrows the rule to specific object classes —
|
|
27994
|
-
* "drop person detections in the street, but keep cars" is one
|
|
27995
|
-
* `exclude` rule with `classFilter: ['person']`.
|
|
27996
|
-
*
|
|
27997
|
-
* `enabled` is a soft toggle — the operator can keep the rule
|
|
27998
|
-
* configured but inert without deleting it.
|
|
27999
|
-
*/
|
|
28000
|
-
var ZoneRuleSchema = object({
|
|
28001
|
-
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
28002
|
-
id: string(),
|
|
28003
|
-
/** Optional human-readable label rendered in the rule editor. */
|
|
28004
|
-
name: string().optional(),
|
|
28005
|
-
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
28006
|
-
* listed zones (OR-set: a detection in any one of them counts).
|
|
28007
|
-
* At least one zone id required — a rule with no targets is a
|
|
28008
|
-
* configuration mistake and the form validator rejects it. */
|
|
28009
|
-
zoneIds: array(string()).min(1).readonly(),
|
|
28010
|
-
mode: ZoneRuleModeEnum,
|
|
28011
|
-
/**
|
|
28012
|
-
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
28013
|
-
* applies to every class. Class strings match the `macroClass`
|
|
28014
|
-
* field on detections (e.g. `person`, `car`, `dog`).
|
|
28015
|
-
*/
|
|
28016
|
-
classFilter: array(string()).readonly().optional(),
|
|
28017
|
-
/**
|
|
28018
|
-
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
28019
|
-
* required to consider an entity "in the zone". Defaults to the
|
|
28020
|
-
* consumer's stage default when omitted. Kept for back-compat with
|
|
28021
|
-
* existing per-rule overrides; new operators pick the value via
|
|
28022
|
-
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
28023
|
-
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
28024
|
-
*/
|
|
28025
|
-
overlapThreshold: number().min(0).max(1).optional(),
|
|
28026
|
-
/**
|
|
28027
|
-
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
28028
|
-
* of the detection's bbox that must lie inside the zone for the
|
|
28029
|
-
* rule to match. Documented default is 85%; the engine substitutes
|
|
28030
|
-
* that when the field is omitted (kept optional so existing rules
|
|
28031
|
-
* stored without it stay valid).
|
|
28032
|
-
*
|
|
28033
|
-
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
28034
|
-
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
28035
|
-
* field exposed in the UI. Internally both feed the same gate.
|
|
28036
|
-
*/
|
|
28037
|
-
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
28038
|
-
/**
|
|
28039
|
-
* When `true` and a detection has a segmentation mask, use the
|
|
28040
|
-
* mask for overlap instead of the bbox. Detection-stage only;
|
|
28041
|
-
* motion rules ignore this field.
|
|
28042
|
-
*/
|
|
28043
|
-
preferMask: boolean().optional(),
|
|
28044
|
-
/**
|
|
28045
|
-
* Soft-toggle: `false` disables the rule without deleting it.
|
|
28046
|
-
* Defaults to `true` so operators creating a rule via the UI
|
|
28047
|
-
* see it active immediately.
|
|
28048
|
-
*/
|
|
28049
|
-
enabled: boolean().default(true)
|
|
28050
|
-
});
|
|
28051
|
-
array(ZoneRuleSchema).readonly();
|
|
28052
28198
|
object({
|
|
28053
28199
|
/** Whether the script is currently executing. */
|
|
28054
28200
|
isRunning: boolean(),
|
|
@@ -31932,6 +32078,12 @@ Object.freeze({
|
|
|
31932
32078
|
addonId: null,
|
|
31933
32079
|
access: "view"
|
|
31934
32080
|
},
|
|
32081
|
+
"notificationRules.resolveArtifactUrl": {
|
|
32082
|
+
capName: "notification-rules",
|
|
32083
|
+
capScope: "system",
|
|
32084
|
+
addonId: null,
|
|
32085
|
+
access: "view"
|
|
32086
|
+
},
|
|
31935
32087
|
"notificationRules.setAlarmConfig": {
|
|
31936
32088
|
capName: "notification-rules",
|
|
31937
32089
|
capScope: "system",
|
|
@@ -32376,6 +32528,12 @@ Object.freeze({
|
|
|
32376
32528
|
addonId: null,
|
|
32377
32529
|
access: "create"
|
|
32378
32530
|
},
|
|
32531
|
+
"pipelineAnalytics.runReplayFrameProcessor": {
|
|
32532
|
+
capName: "pipeline-analytics",
|
|
32533
|
+
capScope: "device",
|
|
32534
|
+
addonId: null,
|
|
32535
|
+
access: "create"
|
|
32536
|
+
},
|
|
32379
32537
|
"pipelineAnalytics.saveRetrainAnnotations": {
|
|
32380
32538
|
capName: "pipeline-analytics",
|
|
32381
32539
|
capScope: "device",
|
|
@@ -32508,6 +32666,12 @@ Object.freeze({
|
|
|
32508
32666
|
addonId: null,
|
|
32509
32667
|
access: "view"
|
|
32510
32668
|
},
|
|
32669
|
+
"pipelineExecutor.getInferenceDeviceHealth": {
|
|
32670
|
+
capName: "pipeline-executor",
|
|
32671
|
+
capScope: "system",
|
|
32672
|
+
addonId: null,
|
|
32673
|
+
access: "view"
|
|
32674
|
+
},
|
|
32511
32675
|
"pipelineExecutor.getOrchestratorConfigSchema": {
|
|
32512
32676
|
capName: "pipeline-executor",
|
|
32513
32677
|
capScope: "system",
|
|
@@ -32580,6 +32744,12 @@ Object.freeze({
|
|
|
32580
32744
|
addonId: null,
|
|
32581
32745
|
access: "view"
|
|
32582
32746
|
},
|
|
32747
|
+
"pipelineExecutor.rearmInferenceDevice": {
|
|
32748
|
+
capName: "pipeline-executor",
|
|
32749
|
+
capScope: "system",
|
|
32750
|
+
addonId: null,
|
|
32751
|
+
access: "create"
|
|
32752
|
+
},
|
|
32583
32753
|
"pipelineExecutor.runAudioTest": {
|
|
32584
32754
|
capName: "pipeline-executor",
|
|
32585
32755
|
capScope: "system",
|
|
@@ -33318,6 +33488,12 @@ Object.freeze({
|
|
|
33318
33488
|
addonId: null,
|
|
33319
33489
|
access: "view"
|
|
33320
33490
|
},
|
|
33491
|
+
"recording.readWindowBytes": {
|
|
33492
|
+
capName: "recording",
|
|
33493
|
+
capScope: "system",
|
|
33494
|
+
addonId: null,
|
|
33495
|
+
access: "view"
|
|
33496
|
+
},
|
|
33321
33497
|
"recording.refreshStorageLocationsForMigration": {
|
|
33322
33498
|
capName: "recording",
|
|
33323
33499
|
capScope: "system",
|
|
@@ -35828,6 +36004,11 @@ Object.freeze({
|
|
|
35828
36004
|
form: "single",
|
|
35829
36005
|
optional: false
|
|
35830
36006
|
}],
|
|
36007
|
+
"pipelineAnalytics.runReplayFrameProcessor": [{
|
|
36008
|
+
name: "deviceId",
|
|
36009
|
+
form: "single",
|
|
36010
|
+
optional: false
|
|
36011
|
+
}],
|
|
35831
36012
|
"pipelineAnalytics.saveRetrainAnnotations": [{
|
|
35832
36013
|
name: "deviceId",
|
|
35833
36014
|
form: "single",
|
|
@@ -36143,6 +36324,11 @@ Object.freeze({
|
|
|
36143
36324
|
form: "single",
|
|
36144
36325
|
optional: false
|
|
36145
36326
|
}],
|
|
36327
|
+
"recording.readWindowBytes": [{
|
|
36328
|
+
name: "deviceId",
|
|
36329
|
+
form: "single",
|
|
36330
|
+
optional: false
|
|
36331
|
+
}],
|
|
36146
36332
|
"recording.relocateFootage": [{
|
|
36147
36333
|
name: "deviceId",
|
|
36148
36334
|
form: "single",
|