@camstack/addon-post-analysis 1.2.128 → 1.2.129
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/{dist-CRDS5ykk.mjs → dist-CGhP6T_c.mjs} +2336 -2247
- package/dist/{dist-D6O14xf_.js → dist-DFeeUt_t.js} +2336 -2247
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +1 -1
- package/dist/pipeline-analytics/_stub.js +1 -1
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-BZm5TUIO.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-D4G4SLMY.mjs} +3 -3
- package/dist/pipeline-analytics/{_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-UGfPXz4L.mjs → _virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-C2KWpXJG.mjs} +1 -1
- package/dist/pipeline-analytics/{hostInit-CQz_Ev1M.mjs → hostInit-TOYw2CMN.mjs} +3 -3
- package/dist/pipeline-analytics/index.js +170 -7
- package/dist/pipeline-analytics/index.mjs +170 -7
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
|
@@ -17210,2182 +17210,2434 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
17210
17210
|
});
|
|
17211
17211
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
17212
17212
|
/**
|
|
17213
|
-
*
|
|
17214
|
-
*
|
|
17215
|
-
*
|
|
17216
|
-
* persisted media. Owns the post-detection domain end-to-end:
|
|
17217
|
-
*
|
|
17218
|
-
* runner emits PipelineInferenceResult
|
|
17219
|
-
* ↓ (event bus)
|
|
17220
|
-
* pipeline-analytics subscriber
|
|
17221
|
-
* ↓ SORT tracker + zone engine + state analyzer + event emitter
|
|
17222
|
-
* → three DB collections (one per kind), one FS media tree, one
|
|
17223
|
-
* unified event emitter (FrameTracked + TrackStarted/Ended +
|
|
17224
|
-
* DetectionEvent on bus)
|
|
17225
|
-
*
|
|
17226
|
-
* Pure subscriber model. No `processFrame` cap method — the runner
|
|
17227
|
-
* already publishes the raw frame on the bus. The cap surface is
|
|
17228
|
-
* only QUERIES + per-device settings, bound on/off via
|
|
17229
|
-
* `device-manager.setWrapperActive`. `defaultActive: true` because
|
|
17230
|
-
* every camera with a detection pipeline wants its raw detections
|
|
17231
|
-
* refined; operators opt out per-device via BindingsTab when needed.
|
|
17232
|
-
*
|
|
17233
|
-
* Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
|
|
17234
|
-
* (per-device surface) and `track-trail` caps — see P11 cleanup.
|
|
17213
|
+
* Reference to the frame's retained NATIVE surface + the parent crop's placement
|
|
17214
|
+
* within the frame, so the executor can re-cut a leaf child ROI at native
|
|
17215
|
+
* resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
|
|
17235
17216
|
*/
|
|
17236
|
-
var
|
|
17237
|
-
|
|
17238
|
-
|
|
17239
|
-
|
|
17240
|
-
|
|
17241
|
-
|
|
17242
|
-
|
|
17243
|
-
|
|
17244
|
-
|
|
17245
|
-
|
|
17246
|
-
|
|
17247
|
-
|
|
17217
|
+
var NativeCropRefSchema = object({
|
|
17218
|
+
/** Handle keying the retained native surface (node-pinned to its owner). */
|
|
17219
|
+
handle: FrameHandleSchema,
|
|
17220
|
+
/** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
|
|
17221
|
+
cropFrameSpace: object({
|
|
17222
|
+
x: number(),
|
|
17223
|
+
y: number(),
|
|
17224
|
+
w: number(),
|
|
17225
|
+
h: number()
|
|
17226
|
+
})
|
|
17227
|
+
});
|
|
17228
|
+
object({
|
|
17229
|
+
crop: object({
|
|
17230
|
+
left: number(),
|
|
17231
|
+
top: number(),
|
|
17232
|
+
width: number().positive(),
|
|
17233
|
+
height: number().positive()
|
|
17234
|
+
}).optional(),
|
|
17235
|
+
content: object({
|
|
17236
|
+
width: number().int().positive(),
|
|
17237
|
+
height: number().int().positive()
|
|
17238
|
+
}),
|
|
17239
|
+
fit: _enum(["stretch", "contain"]),
|
|
17240
|
+
format: _enum([
|
|
17241
|
+
"rgb",
|
|
17242
|
+
"gray",
|
|
17243
|
+
"jpeg"
|
|
17244
|
+
])
|
|
17245
|
+
});
|
|
17248
17246
|
/**
|
|
17249
|
-
*
|
|
17250
|
-
*
|
|
17251
|
-
*
|
|
17247
|
+
* Process-local frame identity. It is serializable so it can ride an in-process
|
|
17248
|
+
* capability call, but `registryId` deliberately prevents resolution in any
|
|
17249
|
+
* other process or execution group.
|
|
17252
17250
|
*/
|
|
17253
|
-
var
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17258
|
-
"
|
|
17259
|
-
|
|
17260
|
-
|
|
17261
|
-
|
|
17262
|
-
|
|
17263
|
-
"
|
|
17264
|
-
"
|
|
17265
|
-
"
|
|
17266
|
-
"
|
|
17267
|
-
"
|
|
17251
|
+
var FrameRefSchema = object({
|
|
17252
|
+
registryId: string().min(1),
|
|
17253
|
+
id: string().min(1),
|
|
17254
|
+
width: number().int().positive(),
|
|
17255
|
+
height: number().int().positive(),
|
|
17256
|
+
format: _enum(["rgb", "gray"]),
|
|
17257
|
+
timestamp: number(),
|
|
17258
|
+
capturedAt: number().optional()
|
|
17259
|
+
});
|
|
17260
|
+
var ModelFormatSchema$1 = _enum([
|
|
17261
|
+
"onnx",
|
|
17262
|
+
"coreml",
|
|
17263
|
+
"openvino",
|
|
17264
|
+
"tflite",
|
|
17265
|
+
"pt",
|
|
17266
|
+
"gguf"
|
|
17268
17267
|
]);
|
|
17269
|
-
var
|
|
17270
|
-
"
|
|
17271
|
-
"
|
|
17272
|
-
"
|
|
17273
|
-
"
|
|
17274
|
-
"
|
|
17275
|
-
"custom",
|
|
17276
|
-
"package"
|
|
17268
|
+
var PipelineSlotSchema = _enum([
|
|
17269
|
+
"detector",
|
|
17270
|
+
"cropper",
|
|
17271
|
+
"classifier",
|
|
17272
|
+
"refiner",
|
|
17273
|
+
"audio-classifier"
|
|
17277
17274
|
]);
|
|
17278
|
-
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
|
|
17282
|
-
|
|
17283
|
-
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
17284
|
-
labelKey: string(),
|
|
17285
|
-
/** English fallback label (kept for clients that don't translate). */
|
|
17286
|
-
label: string(),
|
|
17287
|
-
/** Hex color for timeline/legend rendering. */
|
|
17288
|
-
color: string(),
|
|
17289
|
-
/** Dictionary id → lucide component on the UI side. */
|
|
17290
|
-
iconId: string(),
|
|
17291
|
-
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
17292
|
-
icon: EventKindIconSchema,
|
|
17293
|
-
category: EventKindCategorySchema,
|
|
17294
|
-
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
17295
|
-
parentKind: string().nullable(),
|
|
17296
|
-
/** Derived from `parentKind`, explicit for the client tree. */
|
|
17297
|
-
level: EventKindLevelSchema,
|
|
17298
|
-
/** Which cap + device contributes this kind. For built-ins the camera
|
|
17299
|
-
* itself; for sensor kinds the LINKED source device. */
|
|
17300
|
-
source: object({
|
|
17301
|
-
capName: string(),
|
|
17302
|
-
deviceId: number()
|
|
17303
|
-
})
|
|
17275
|
+
var PipelineEngineChoiceSchema = object({
|
|
17276
|
+
runtime: _enum(["node", "python"]),
|
|
17277
|
+
backend: string(),
|
|
17278
|
+
format: ModelFormatSchema$1,
|
|
17279
|
+
device: string().optional()
|
|
17304
17280
|
});
|
|
17305
|
-
|
|
17306
|
-
|
|
17307
|
-
|
|
17308
|
-
|
|
17281
|
+
var AvailableEngineSchema = object({
|
|
17282
|
+
engine: PipelineEngineChoiceSchema,
|
|
17283
|
+
devices: array(object({
|
|
17284
|
+
id: string(),
|
|
17285
|
+
label: string(),
|
|
17286
|
+
description: string().optional()
|
|
17287
|
+
})).readonly(),
|
|
17288
|
+
defaultDevice: string()
|
|
17309
17289
|
});
|
|
17310
|
-
var
|
|
17290
|
+
var PipelineDefaultStepSchema = lazy(() => object({
|
|
17291
|
+
addonId: string(),
|
|
17292
|
+
addonName: string(),
|
|
17293
|
+
slot: PipelineSlotSchema,
|
|
17294
|
+
inputClasses: array(string()).readonly(),
|
|
17295
|
+
outputClasses: array(string()).readonly(),
|
|
17296
|
+
enabled: boolean(),
|
|
17297
|
+
modelId: string(),
|
|
17298
|
+
children: array(PipelineDefaultStepSchema).readonly(),
|
|
17299
|
+
group: string().optional(),
|
|
17300
|
+
settings: record(string(), unknown()).optional()
|
|
17301
|
+
}));
|
|
17302
|
+
var PipelineTemplateStepSchema = lazy(() => object({
|
|
17303
|
+
addonId: string(),
|
|
17304
|
+
enabled: boolean(),
|
|
17305
|
+
modelId: string(),
|
|
17306
|
+
children: array(PipelineTemplateStepSchema).readonly(),
|
|
17307
|
+
settings: record(string(), unknown()).optional()
|
|
17308
|
+
}));
|
|
17309
|
+
var PipelineTemplateSchema$1 = object({
|
|
17311
17310
|
id: string(),
|
|
17312
|
-
|
|
17313
|
-
|
|
17314
|
-
|
|
17315
|
-
|
|
17316
|
-
|
|
17317
|
-
/** Event kind id — matches an `EventKindDescriptor.kind`. */
|
|
17318
|
-
kind: string(),
|
|
17319
|
-
/** Snapshot of the sensor cap's runtime-state slice at the change. */
|
|
17320
|
-
value: record(string(), unknown()).nullable(),
|
|
17321
|
-
timestamp: number()
|
|
17311
|
+
name: string(),
|
|
17312
|
+
createdAt: string(),
|
|
17313
|
+
updatedAt: string(),
|
|
17314
|
+
engine: PipelineEngineChoiceSchema,
|
|
17315
|
+
steps: array(PipelineTemplateStepSchema).readonly()
|
|
17322
17316
|
});
|
|
17323
|
-
var
|
|
17324
|
-
|
|
17325
|
-
|
|
17326
|
-
|
|
17327
|
-
|
|
17317
|
+
var PipelineModelOptionSchema = object({
|
|
17318
|
+
id: string(),
|
|
17319
|
+
name: string(),
|
|
17320
|
+
formats: record(string(), object({
|
|
17321
|
+
downloaded: boolean(),
|
|
17322
|
+
sizeMB: number()
|
|
17323
|
+
})),
|
|
17324
|
+
group: ModelVariantGroupSchema.optional(),
|
|
17325
|
+
legacy: boolean().optional(),
|
|
17326
|
+
provider: ModelProviderIdSchema.optional()
|
|
17328
17327
|
});
|
|
17329
|
-
var
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17333
|
-
|
|
17328
|
+
var ConfigFieldBridge = custom();
|
|
17329
|
+
var PipelineAddonSchemaSchema = object({
|
|
17330
|
+
id: string(),
|
|
17331
|
+
name: string(),
|
|
17332
|
+
slot: PipelineSlotSchema,
|
|
17333
|
+
inputClasses: array(string()).readonly(),
|
|
17334
|
+
outputClasses: array(string()).readonly(),
|
|
17335
|
+
childSlots: array(PipelineSlotSchema).readonly(),
|
|
17336
|
+
models: array(PipelineModelOptionSchema).readonly(),
|
|
17337
|
+
defaultModelId: string(),
|
|
17338
|
+
defaultModelIdByFormat: record(string(), string()).optional(),
|
|
17339
|
+
enabledByDefault: boolean().optional(),
|
|
17340
|
+
backfillIntoExistingOverrides: boolean().optional(),
|
|
17341
|
+
defaultConfidence: number(),
|
|
17342
|
+
group: string().optional(),
|
|
17343
|
+
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
17334
17344
|
});
|
|
17335
|
-
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
|
|
17339
|
-
|
|
17340
|
-
|
|
17341
|
-
var TrackEnvelopeSchema = object({
|
|
17342
|
-
minX: number(),
|
|
17343
|
-
minY: number(),
|
|
17344
|
-
maxX: number(),
|
|
17345
|
-
maxY: number()
|
|
17345
|
+
var PipelineSlotSchemaSchema = object({
|
|
17346
|
+
id: PipelineSlotSchema,
|
|
17347
|
+
label: string(),
|
|
17348
|
+
priority: number(),
|
|
17349
|
+
parentSlot: PipelineSlotSchema.nullable(),
|
|
17350
|
+
addons: array(PipelineAddonSchemaSchema).readonly()
|
|
17346
17351
|
});
|
|
17347
|
-
|
|
17348
|
-
|
|
17349
|
-
|
|
17350
|
-
|
|
17351
|
-
* keeps every scalar the list surfaces actually render (ids, class(es),
|
|
17352
|
-
* label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
|
|
17353
|
-
* zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
|
|
17354
|
-
* `snapshots` as EMPTY arrays — detail views re-fetch the full row via
|
|
17355
|
-
* `getTrack`. Mirrors the event-store `projection` convention
|
|
17356
|
-
* (`getObjectEvents` et al.).
|
|
17357
|
-
*/
|
|
17358
|
-
var TrackProjectionSchema = _enum(["full", "slim"]);
|
|
17359
|
-
/**
|
|
17360
|
-
* One audio-classification label heard on the track's camera while the
|
|
17361
|
-
* track was alive, aggregated per label. An "episode" is one persisted
|
|
17362
|
-
* audio event (the confident-classification path: score ≥ the device's
|
|
17363
|
-
* `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
|
|
17364
|
-
* one 32 ms inference chunk, so counts stay human-scaled.
|
|
17365
|
-
*/
|
|
17366
|
-
var TrackAudioLabelSchema = object({
|
|
17367
|
-
label: string(),
|
|
17368
|
-
/** Highest classification score observed across the label's episodes. */
|
|
17369
|
-
peakScore: number(),
|
|
17370
|
-
/** Number of coalesced audio-event episodes carrying this label. */
|
|
17371
|
-
count: number(),
|
|
17372
|
-
firstAt: number(),
|
|
17373
|
-
lastAt: number()
|
|
17352
|
+
var PipelineSchemaSchema = object({
|
|
17353
|
+
availableEngines: array(AvailableEngineSchema).readonly(),
|
|
17354
|
+
selectedEngine: PipelineEngineChoiceSchema,
|
|
17355
|
+
slots: array(PipelineSlotSchemaSchema).readonly()
|
|
17374
17356
|
});
|
|
17375
|
-
|
|
17376
|
-
|
|
17377
|
-
|
|
17378
|
-
|
|
17379
|
-
|
|
17380
|
-
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
17384
|
-
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
|
|
17390
|
-
|
|
17391
|
-
|
|
17392
|
-
|
|
17393
|
-
|
|
17394
|
-
|
|
17395
|
-
*
|
|
17396
|
-
*
|
|
17397
|
-
*
|
|
17398
|
-
*
|
|
17399
|
-
*
|
|
17400
|
-
|
|
17401
|
-
|
|
17402
|
-
* - `trained` — the retrain page has taken what it needed. The frames it chose
|
|
17403
|
-
* were COPIED into the retrain dataset at selection time, so the dataset no
|
|
17404
|
-
* longer depends on the track's media and the track becomes EVICTABLE again.
|
|
17405
|
-
* Terminal for the plain `markForTrain` toggle: returning it to `staging` is
|
|
17406
|
-
* a deliberate action of the retrain page, not a side effect of a checkbox.
|
|
17407
|
-
*
|
|
17408
|
-
* There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
|
|
17409
|
-
* the store's filter language has only positive equality and `whereIn` — no
|
|
17410
|
-
* negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
|
|
17411
|
-
* would make the entire pre-column history immortal in one deploy.
|
|
17412
|
-
*/
|
|
17413
|
-
var RetrainStatusSchema = _enum([
|
|
17414
|
-
"none",
|
|
17415
|
-
"staging",
|
|
17416
|
-
"trained"
|
|
17417
|
-
]);
|
|
17418
|
-
/**
|
|
17419
|
-
* Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
|
|
17420
|
-
* by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
|
|
17421
|
-
* so the two surfaces cannot drift.
|
|
17422
|
-
*
|
|
17423
|
-
* **Absent ≠ false.** A track that has never been touched omits the field; an
|
|
17424
|
-
* explicitly un-flagged track carries `false`. Legacy rows written before the
|
|
17425
|
-
* columns existed read as absent, and a consumer that needs a boolean should say
|
|
17426
|
-
* `flag === true`, not `flag !== false`.
|
|
17427
|
-
*
|
|
17428
|
-
* `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
|
|
17429
|
-
* it is exactly `retrainStatus === 'staging'`, in both directions. Writing
|
|
17430
|
-
* `true` moves `none → staging`, writing `false` moves `staging → none`, and a
|
|
17431
|
-
* `trained` track reports `false` while refusing both writes. The boolean is
|
|
17432
|
-
* kept because three surfaces drive a toggle off it; anything that needs to tell
|
|
17433
|
-
* "never marked" from "already trained" must read `retrainStatus`.
|
|
17434
|
-
*
|
|
17435
|
-
* `debug` does NOT pin; it is attention, not durability.
|
|
17436
|
-
*
|
|
17437
|
-
* `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
|
|
17438
|
-
* A favourited track is skipped by retention the same way `staging` is, but
|
|
17439
|
-
* it does not enter `none|staging|trained` and has no staging budget.
|
|
17440
|
-
*/
|
|
17441
|
-
var TrackFlagFields = {
|
|
17442
|
-
/** Operator marked this track as training material — i.e. `retrainStatus` is
|
|
17443
|
-
* `'staging'`. */
|
|
17444
|
-
markForTrain: boolean().optional(),
|
|
17445
|
-
/** Operator marked this track for diagnostic attention. */
|
|
17446
|
-
debug: boolean().optional(),
|
|
17447
|
-
/** Operator favourited this track. Pins it against pruning. */
|
|
17448
|
-
favourited: boolean().optional()
|
|
17449
|
-
};
|
|
17450
|
-
/**
|
|
17451
|
-
* The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
|
|
17452
|
-
* Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
|
|
17453
|
-
* write patch, and the status is not something the toggle sets — it is what the
|
|
17454
|
-
* toggle's boolean is derived from. Absent on an in-RAM track never touched;
|
|
17455
|
-
* always present on a persisted row (the column default materialises `'none'`).
|
|
17456
|
-
*/
|
|
17457
|
-
var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
|
|
17458
|
-
/**
|
|
17459
|
-
* The write half: a PARTIAL patch. An omitted key is left untouched, so setting
|
|
17460
|
-
* one flag can never clear the other — the toggles are independent and are
|
|
17461
|
-
* driven from three surfaces that do not know about each other.
|
|
17462
|
-
*/
|
|
17463
|
-
var TrackFlagsPatchSchema = object(TrackFlagFields);
|
|
17464
|
-
/**
|
|
17465
|
-
* The resolved flag state after a write. Both fields are REQUIRED here (absent
|
|
17466
|
-
* collapses to `false`) so a caller can drive a toggle's checked state off the
|
|
17467
|
-
* mutation result without a re-fetch.
|
|
17468
|
-
*/
|
|
17469
|
-
var TrackFlagsSchema = object({
|
|
17470
|
-
trackId: string(),
|
|
17471
|
-
markForTrain: boolean(),
|
|
17472
|
-
debug: boolean(),
|
|
17473
|
-
favourited: boolean(),
|
|
17474
|
-
/** The lifecycle state the boolean was derived from. Required here (unlike on
|
|
17475
|
-
* a track row) because this shape is only ever produced by the write body,
|
|
17476
|
-
* which always knows it — and a surface that has just written needs to render
|
|
17477
|
-
* `trained` without a re-fetch. */
|
|
17478
|
-
retrainStatus: RetrainStatusSchema
|
|
17357
|
+
var EngineProvisioningSchema = object({
|
|
17358
|
+
runtimeId: _enum([
|
|
17359
|
+
"onnx",
|
|
17360
|
+
"openvino",
|
|
17361
|
+
"coreml",
|
|
17362
|
+
"edgetpu"
|
|
17363
|
+
]).nullable(),
|
|
17364
|
+
device: string().nullable(),
|
|
17365
|
+
state: _enum([
|
|
17366
|
+
"idle",
|
|
17367
|
+
"installing",
|
|
17368
|
+
"verifying",
|
|
17369
|
+
"ready",
|
|
17370
|
+
"failed"
|
|
17371
|
+
]),
|
|
17372
|
+
progress: number().optional(),
|
|
17373
|
+
error: string().optional(),
|
|
17374
|
+
nextRetryAt: number().optional(),
|
|
17375
|
+
/**
|
|
17376
|
+
* Gate A (config-correctness gate at engine change): human-readable
|
|
17377
|
+
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
17378
|
+
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
17379
|
+
* has a <format> build"). Additive/optional: informational only, never
|
|
17380
|
+
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
17381
|
+
* Absent/empty when the node-default tree resolves cleanly.
|
|
17382
|
+
*/
|
|
17383
|
+
configIssues: array(string()).optional()
|
|
17479
17384
|
});
|
|
17480
|
-
|
|
17481
|
-
|
|
17482
|
-
* WHO decided a label, and when. Carried per tier so a value can be traced to
|
|
17483
|
-
* the step and model that produced it — which is what makes the write rule
|
|
17484
|
-
* arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
|
|
17485
|
-
* and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
|
|
17486
|
-
*
|
|
17487
|
-
* `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
|
|
17488
|
-
* `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
|
|
17489
|
-
* `migration:4g` for a value the 4g migration moved from the single-slot era —
|
|
17490
|
-
* that value has no provenance, and the write rule lets ANY properly-attributed
|
|
17491
|
-
* write of the same tier replace it regardless of score.
|
|
17492
|
-
*/
|
|
17493
|
-
var LabelAttributionSchema = object({
|
|
17494
|
-
stepId: string(),
|
|
17385
|
+
var PipelineStepInputSchema = lazy(() => object({
|
|
17386
|
+
addonId: string(),
|
|
17495
17387
|
modelId: string().optional(),
|
|
17496
|
-
|
|
17388
|
+
enabled: boolean().default(true),
|
|
17389
|
+
children: array(PipelineStepInputSchema).optional(),
|
|
17390
|
+
settings: record(string(), unknown()).optional(),
|
|
17391
|
+
jumpDeviceKey: string().optional()
|
|
17392
|
+
}));
|
|
17393
|
+
var ModelSubstitutionSchema = object({
|
|
17394
|
+
addonId: string(),
|
|
17395
|
+
chosen: string(),
|
|
17396
|
+
running: string(),
|
|
17397
|
+
format: string()
|
|
17398
|
+
});
|
|
17399
|
+
var PipelineValidationIssueSchema = object({
|
|
17400
|
+
addonId: string(),
|
|
17401
|
+
kind: _enum(["unknown-addon", "no-format-build"]),
|
|
17402
|
+
detail: string()
|
|
17403
|
+
});
|
|
17404
|
+
var PipelineValidationResultSchema = object({
|
|
17405
|
+
ok: boolean(),
|
|
17406
|
+
issues: array(PipelineValidationIssueSchema).readonly(),
|
|
17407
|
+
substitutions: array(ModelSubstitutionSchema).readonly(),
|
|
17408
|
+
/** The node's `currentEngine.format` this validation ran against. */
|
|
17409
|
+
format: string()
|
|
17410
|
+
});
|
|
17411
|
+
var ReferenceImageEntrySchema = object({
|
|
17412
|
+
filename: string(),
|
|
17413
|
+
stepIds: array(string()).readonly().optional()
|
|
17414
|
+
});
|
|
17415
|
+
var ReferenceImageBodySchema = object({
|
|
17416
|
+
base64: string(),
|
|
17417
|
+
filename: string()
|
|
17418
|
+
});
|
|
17419
|
+
var ReferenceAudioEntrySchema = object({
|
|
17420
|
+
filename: string(),
|
|
17421
|
+
sizeKb: number()
|
|
17422
|
+
});
|
|
17423
|
+
var ReferenceAudioBodySchema = object({ base64: string() });
|
|
17424
|
+
var AudioBackendSchema = object({
|
|
17425
|
+
id: string(),
|
|
17426
|
+
name: string(),
|
|
17427
|
+
description: string(),
|
|
17428
|
+
available: boolean(),
|
|
17497
17429
|
/**
|
|
17498
|
-
*
|
|
17499
|
-
*
|
|
17500
|
-
*
|
|
17501
|
-
*
|
|
17502
|
-
* notification rule authored on "Gianluca" stopped matching the moment the
|
|
17503
|
-
* operator fixed the spelling in the gallery, and nothing said so. The id is
|
|
17504
|
-
* the thing that does not move, so it is what a rule matches on
|
|
17505
|
-
* (`NcConditions.identities`) and the text is what a human is shown.
|
|
17506
|
-
*
|
|
17507
|
-
* Absent when the label names no gallery row — a plate the OCR read but no
|
|
17508
|
-
* vehicle claims, a sub-class, a species, any tier-1 value.
|
|
17430
|
+
* Raw classifier labels this backend can emit (e.g. YAMNet's
|
|
17431
|
+
* 521-class set or Apple SoundAnalysis's 303-class set). Used by
|
|
17432
|
+
* the benchmark UI to populate the `enabledMicroClasses` filter
|
|
17433
|
+
* specific to the selected backend without a separate fetch.
|
|
17509
17434
|
*/
|
|
17510
|
-
|
|
17435
|
+
rawLabels: array(string()).readonly().optional()
|
|
17436
|
+
});
|
|
17437
|
+
var AudioCapabilitiesSchema = object({
|
|
17438
|
+
activeBackend: string(),
|
|
17439
|
+
availableBackends: array(AudioBackendSchema).readonly(),
|
|
17440
|
+
sampleRate: number(),
|
|
17441
|
+
chunkDurationMs: number()
|
|
17442
|
+
});
|
|
17443
|
+
var DownloadModelResultSchema = object({
|
|
17444
|
+
filePath: string(),
|
|
17445
|
+
sizeMB: number(),
|
|
17446
|
+
durationMs: number()
|
|
17511
17447
|
});
|
|
17512
17448
|
/**
|
|
17513
|
-
*
|
|
17514
|
-
* `
|
|
17515
|
-
*
|
|
17516
|
-
*
|
|
17517
|
-
*
|
|
17518
|
-
*
|
|
17519
|
-
*
|
|
17520
|
-
*
|
|
17521
|
-
* **Reading it.** What a human should be shown is `subLabel ?? label` — the
|
|
17522
|
-
* finest thing known. Before 4g the single `label` column held the finest
|
|
17523
|
-
* value, so a consumer that has not been updated reads the tier-1 slot and
|
|
17524
|
-
* shows nothing on a species-only row; that is why the migration puts every
|
|
17525
|
-
* pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
|
|
17526
|
-
* and why the read surfaces were changed in the same train.
|
|
17527
|
-
*
|
|
17528
|
-
* **Writing it.** The slots are independent, which is the whole point: a
|
|
17529
|
-
* tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
|
|
17530
|
-
* migratorius`), so fineness cannot regress by construction. Within a tier the
|
|
17531
|
-
* higher score wins. One rule, one implementation — see
|
|
17532
|
-
* `pipeline/label-tier.ts` in addon-post-analysis.
|
|
17533
|
-
*/
|
|
17534
|
-
var TieredLabelFields = {
|
|
17535
|
-
/** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
|
|
17536
|
-
label: string().optional(),
|
|
17537
|
-
/** Confidence of the tier-1 value, as reported by the deciding step. */
|
|
17538
|
-
labelScore: number().optional(),
|
|
17539
|
-
/** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
|
|
17540
|
-
labelMeta: LabelAttributionSchema.optional(),
|
|
17541
|
-
/** Tier 2 — the instance. See {@link LabelTierSchema}. */
|
|
17542
|
-
subLabel: string().optional(),
|
|
17543
|
-
/** Confidence of the tier-2 value, as reported by the deciding step. */
|
|
17544
|
-
subLabelScore: number().optional(),
|
|
17545
|
-
/** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
|
|
17546
|
-
subLabelMeta: LabelAttributionSchema.optional()
|
|
17547
|
-
};
|
|
17548
|
-
/** Per-camera slice of a training-export estimate. */
|
|
17549
|
-
var TrainingExportDeviceTotalsSchema = object({
|
|
17550
|
-
deviceId: number(),
|
|
17551
|
-
tracks: number().int(),
|
|
17552
|
-
files: number().int(),
|
|
17553
|
-
bytes: number().int()
|
|
17554
|
-
});
|
|
17555
|
-
/**
|
|
17556
|
-
* What a training export WOULD contain. Computed from media index rows only —
|
|
17557
|
-
* no blob is read to produce this.
|
|
17449
|
+
* Wrapper carrying a single test run's result. Replaces the legacy
|
|
17450
|
+
* ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
|
|
17451
|
+
* canonical `AudioResult` from the Phase 6 output rework: one
|
|
17452
|
+
* `AudioDetection` per class above `minScore`, top-N candidates in
|
|
17453
|
+
* `debug.alternateLabels['audio-classifier']`, per-source timings in
|
|
17454
|
+
* `debug.stepTimings`. The outer `success`/`error` fields stay so the
|
|
17455
|
+
* benchmark UI can still report a clean failure when the classifier
|
|
17456
|
+
* cap isn't available.
|
|
17558
17457
|
*/
|
|
17559
|
-
var
|
|
17560
|
-
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
byteCount: number().int(),
|
|
17564
|
-
/** More marked tracks exist than a single pass carries. */
|
|
17565
|
-
truncated: boolean(),
|
|
17566
|
-
devices: array(TrainingExportDeviceTotalsSchema).readonly()
|
|
17458
|
+
var AudioTestResultSchema = object({
|
|
17459
|
+
success: boolean(),
|
|
17460
|
+
error: string().optional(),
|
|
17461
|
+
frame: custom().optional()
|
|
17567
17462
|
});
|
|
17568
|
-
var
|
|
17569
|
-
|
|
17570
|
-
|
|
17571
|
-
|
|
17572
|
-
|
|
17573
|
-
|
|
17574
|
-
|
|
17575
|
-
|
|
17576
|
-
|
|
17577
|
-
|
|
17578
|
-
|
|
17579
|
-
|
|
17580
|
-
|
|
17581
|
-
|
|
17582
|
-
|
|
17583
|
-
|
|
17584
|
-
|
|
17463
|
+
var PipelineConfigBridge = custom();
|
|
17464
|
+
var ConfigUISchemaBridge = custom();
|
|
17465
|
+
var ConfigUISchemaNullableBridge = custom();
|
|
17466
|
+
var InferenceCapabilitiesBridge = custom();
|
|
17467
|
+
var ModelAvailabilityListBridge = custom();
|
|
17468
|
+
var PipelineRunResultBridge = custom();
|
|
17469
|
+
method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
|
|
17470
|
+
modelId: string(),
|
|
17471
|
+
settings: record(string(), unknown()).readonly()
|
|
17472
|
+
}))), method(object({ steps: record(string(), object({
|
|
17473
|
+
modelId: string(),
|
|
17474
|
+
settings: record(string(), unknown()).readonly()
|
|
17475
|
+
})) }), object({ success: literal(true) }), {
|
|
17476
|
+
kind: "mutation",
|
|
17477
|
+
auth: "admin"
|
|
17478
|
+
}), method(object({ nodeId: string() }), object({
|
|
17479
|
+
success: literal(true),
|
|
17480
|
+
clearedDevices: number()
|
|
17481
|
+
}), {
|
|
17482
|
+
kind: "mutation",
|
|
17483
|
+
auth: "admin"
|
|
17484
|
+
}), method(object({ nodeId: string() }), object({ unhealthy: array(object({
|
|
17485
|
+
/** `<backend>:<device>`, e.g. `openvino:gpu`. */
|
|
17486
|
+
deviceKey: string(),
|
|
17585
17487
|
/**
|
|
17586
|
-
*
|
|
17587
|
-
*
|
|
17588
|
-
*
|
|
17589
|
-
*
|
|
17590
|
-
* and no card can render — so every free-text search surface was structurally
|
|
17591
|
-
* unable to answer "show me the tracks in Uscio", and did not fail loudly, it
|
|
17592
|
-
* just returned nothing. Resolving here rather than in each client keeps ONE
|
|
17593
|
-
* derivation and costs the clients no extra call (the `zones` cap is
|
|
17594
|
-
* per-device, so a client-side resolve would be a per-camera fan-out on a
|
|
17595
|
-
* surface built to avoid exactly that).
|
|
17596
|
-
*
|
|
17597
|
-
* Resolved, never invented: a zone deleted since the track was written has no
|
|
17598
|
-
* name and is DROPPED, so this array can be shorter than `zonesVisited` — the
|
|
17599
|
-
* two are not positionally aligned. Absent when the track visited no zone, or
|
|
17600
|
-
* when the zone catalogue could not be read.
|
|
17488
|
+
* `failed` — the per-device restart budget is exhausted; no pool
|
|
17489
|
+
* will be spawned until an operator re-arms it or the runner
|
|
17490
|
+
* respawns. `backoff` — under budget, waiting out the backoff (or
|
|
17491
|
+
* a cached pool observed dead and not yet condemned).
|
|
17601
17492
|
*/
|
|
17602
|
-
|
|
17603
|
-
/**
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
/**
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17619
|
-
|
|
17620
|
-
|
|
17621
|
-
|
|
17622
|
-
|
|
17623
|
-
|
|
17624
|
-
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
|
|
17628
|
-
|
|
17493
|
+
state: _enum(["failed", "backoff"]),
|
|
17494
|
+
/** Epoch ms of the death that produced this state. */
|
|
17495
|
+
since: number(),
|
|
17496
|
+
/** Pool deaths inside the current window. */
|
|
17497
|
+
deaths: number(),
|
|
17498
|
+
/** The last death's message. */
|
|
17499
|
+
lastError: string()
|
|
17500
|
+
})).readonly() })), method(object({
|
|
17501
|
+
nodeId: string(),
|
|
17502
|
+
deviceKey: string()
|
|
17503
|
+
}), object({ rearmed: boolean() }), {
|
|
17504
|
+
kind: "mutation",
|
|
17505
|
+
auth: "admin"
|
|
17506
|
+
}), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({ steps: array(PipelineStepInputSchema) }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
|
|
17507
|
+
name: string(),
|
|
17508
|
+
steps: array(PipelineTemplateStepSchema).readonly(),
|
|
17509
|
+
engine: PipelineEngineChoiceSchema
|
|
17510
|
+
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
|
|
17511
|
+
id: string(),
|
|
17512
|
+
name: string().optional(),
|
|
17513
|
+
steps: array(PipelineTemplateStepSchema).readonly().optional()
|
|
17514
|
+
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
|
|
17515
|
+
addonId: string(),
|
|
17516
|
+
modelId: string(),
|
|
17517
|
+
format: ModelFormatSchema$1
|
|
17518
|
+
}), DownloadModelResultSchema, { kind: "mutation" }), method(object({
|
|
17519
|
+
addonId: string(),
|
|
17520
|
+
modelId: string(),
|
|
17521
|
+
format: ModelFormatSchema$1
|
|
17522
|
+
}), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
17523
|
+
engine: PipelineEngineChoiceSchema.optional(),
|
|
17524
|
+
steps: array(PipelineStepInputSchema).min(1),
|
|
17525
|
+
frame: FrameInputSchema.optional(),
|
|
17629
17526
|
/**
|
|
17630
|
-
*
|
|
17631
|
-
*
|
|
17632
|
-
*
|
|
17633
|
-
* enabled. Set once and never cleared.
|
|
17634
|
-
*
|
|
17635
|
-
* **This exists so "face present but not recognised" is expressible.** A
|
|
17636
|
-
* recognised identity lands in `subLabel` (attributed to the face chain via
|
|
17637
|
-
* `subLabelMeta.stepId`), so before this field a track with an unmatched face
|
|
17638
|
-
* and a track with no face at all were byte-identical on the wire and no
|
|
17639
|
-
* surface could tell them apart. The read is `hasFace === true && subLabel
|
|
17640
|
-
* === undefined`.
|
|
17641
|
-
*
|
|
17642
|
-
* **Absent ≠ false.** Every row written before the column existed omits it,
|
|
17643
|
-
* and so does every server that predates the field — a consumer must test
|
|
17644
|
-
* `=== true` and render nothing otherwise, never infer "no face".
|
|
17527
|
+
* Process-local lazy frame. Valid only when caller and provider resolve
|
|
17528
|
+
* in the same execution-group process; split/cross-node callers use
|
|
17529
|
+
* `frame`/`image` inline compatibility instead.
|
|
17645
17530
|
*/
|
|
17646
|
-
|
|
17531
|
+
frameRef: FrameRefSchema.optional(),
|
|
17647
17532
|
/**
|
|
17648
|
-
*
|
|
17649
|
-
*
|
|
17650
|
-
*
|
|
17651
|
-
* The STRICT twin of {@link hasFace}, and the pair only earns its keep
|
|
17652
|
-
* because the two disagree. `hasFace` is stamped at the TOP of the face
|
|
17653
|
-
* branch, before every gate, and means no more than "a face detector produced
|
|
17654
|
-
* a face detail". This one is stamped at the single moment the gallery row
|
|
17655
|
-
* LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
|
|
17656
|
-
* past the embedding-magnitude verdict, the `minFacePx` detection gate, the
|
|
17657
|
-
* candidate gate, the imageless-track drop (no crop was ever captured) and
|
|
17658
|
-
* the crop-store drop. Everything between the detector and that insert can
|
|
17659
|
-
* legitimately refuse the face, so a flag written any earlier promises the
|
|
17660
|
-
* operator something to assign and delivers nothing.
|
|
17661
|
-
*
|
|
17662
|
-
* **Independent of recognition.** A face collected but never auto-matched is
|
|
17663
|
-
* still assignable — it is in fact the face an operator most wants to reach —
|
|
17664
|
-
* so this is NOT gated on `recognizedIdentityId`. Recognition lands in
|
|
17665
|
-
* `subLabel`; this says only that the raw material exists.
|
|
17666
|
-
*
|
|
17667
|
-
* **Set once, never cleared.** A track that produced a gallery row produced
|
|
17668
|
-
* one; deleting the row later is the gallery's business, not this flag's.
|
|
17669
|
-
*
|
|
17670
|
-
* **Absent ≠ false**, the same rule as {@link hasFace}: every row written
|
|
17671
|
-
* before the column omits it, and so does every server that predates the
|
|
17672
|
-
* field. A consumer must test `=== true` and render nothing otherwise —
|
|
17673
|
-
* never infer "no assignable face".
|
|
17533
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
17534
|
+
* the decoded pixels live in. One more member of the one-of
|
|
17535
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
17674
17536
|
*/
|
|
17675
|
-
|
|
17537
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
17538
|
+
imageBase64: string().optional(),
|
|
17676
17539
|
/**
|
|
17677
|
-
*
|
|
17678
|
-
* (
|
|
17679
|
-
*
|
|
17680
|
-
*
|
|
17681
|
-
*
|
|
17682
|
-
* said "the person is not lost — it is reported so both entities stay on the
|
|
17683
|
-
* record"; in fact the pair went into a per-processor RAM field behind an
|
|
17684
|
-
* accessor nobody called, and every durable surface said `vehicle`, full
|
|
17685
|
-
* stop. This is the composition note that makes the row true.
|
|
17686
|
-
*
|
|
17687
|
-
* A COMPOSITION, never a class and never a label. "This vehicle contains a
|
|
17688
|
-
* person" is not an answer to "what is this" — both label tiers would refuse
|
|
17689
|
-
* a macro token anyway (D89), and correctly. Nothing here changes what the
|
|
17690
|
-
* subject IS: a cyclist stays one vehicle track, occupancy still counts one,
|
|
17691
|
-
* and a `person` rule still does not fire for someone cycling past.
|
|
17692
|
-
*
|
|
17693
|
-
* **Absent ≠ false**, exactly like {@link hasFace}: every row written before
|
|
17694
|
-
* the column, and every hub that predates the field, omits it. Test
|
|
17695
|
-
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
17540
|
+
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
17541
|
+
* hops (hub → forked worker via Moleculer MsgPack) because it
|
|
17542
|
+
* skips the 33% base64 overhead + the per-call base64 decode on
|
|
17543
|
+
* the detection-pipeline worker. Callers can pass either; exactly
|
|
17544
|
+
* one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
|
|
17696
17545
|
*/
|
|
17697
|
-
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17706
|
-
|
|
17707
|
-
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
/**
|
|
17717
|
-
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
|
|
17546
|
+
image: _instanceof(Uint8Array).optional(),
|
|
17547
|
+
referenceImage: string().optional(),
|
|
17548
|
+
deviceId: number().optional(),
|
|
17549
|
+
sessionId: string().optional(),
|
|
17550
|
+
/**
|
|
17551
|
+
* Execution plane. 'full' (default) runs the whole tree — benchmark,
|
|
17552
|
+
* reference-image, and detail-subtree calls. 'frame' is the live
|
|
17553
|
+
* per-frame dispatch: ONLY root-plane steps run; crop children
|
|
17554
|
+
* (inputClasses ≠ null) are skipped and served per-track via
|
|
17555
|
+
* pipelineRunner.runDetailSubtree (two-plane design).
|
|
17556
|
+
*/
|
|
17557
|
+
plane: _enum(["full", "frame"]).optional(),
|
|
17558
|
+
/**
|
|
17559
|
+
* Inference-device selector (Phase 2 multi-device). Format
|
|
17560
|
+
* `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
|
|
17561
|
+
* Omitted ⇒ the runner's default device (current single-engine
|
|
17562
|
+
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
17563
|
+
*/
|
|
17564
|
+
deviceKey: string().optional(),
|
|
17565
|
+
/**
|
|
17566
|
+
* Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
|
|
17567
|
+
* when the parent crop was resolved from the frame's retained NATIVE
|
|
17568
|
+
* surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
|
|
17569
|
+
* child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
|
|
17570
|
+
* resolution from that surface — the SAME quality path faces already
|
|
17571
|
+
* had — instead of the downscaled parent tile. `handle` keys the native
|
|
17572
|
+
* surface (node-pinned to its owner); `cropFrameSpace` is the parent
|
|
17573
|
+
* crop's padded/clamped rectangle in FRAME-space pixels, used to compose
|
|
17574
|
+
* the executor's crop-normalized child ROI back into frame-normalized
|
|
17575
|
+
* coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
|
|
17576
|
+
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
17577
|
+
* (today's behaviour on the fallback path).
|
|
17578
|
+
*/
|
|
17579
|
+
nativeCropRef: NativeCropRefSchema.optional()
|
|
17580
|
+
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
17581
|
+
engine: PipelineEngineChoiceSchema.optional(),
|
|
17582
|
+
steps: array(PipelineStepInputSchema).min(1),
|
|
17583
|
+
frames: array(FrameInputSchema).min(1).max(255),
|
|
17584
|
+
deviceId: number().optional(),
|
|
17585
|
+
sessionId: string().optional(),
|
|
17586
|
+
/**
|
|
17587
|
+
* Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
|
|
17588
|
+
* the batch to the Python pool's bench preprocess cache
|
|
17589
|
+
* (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
|
|
17590
|
+
* preprocessed ONCE and every later inference is a pure-inference cache
|
|
17591
|
+
* hit — the sustained-throughput run measures inference, not
|
|
17592
|
+
* decode+preprocess+infer. Omitted/0 for live frames (all different →
|
|
17593
|
+
* full preprocess every call, correct). Fresh per sustained run;
|
|
17594
|
+
* released via `uncacheFrame`.
|
|
17595
|
+
*/
|
|
17596
|
+
frameId: number().int().nonnegative().optional(),
|
|
17597
|
+
/** Inference-device selector (Phase 2 multi-device); see runPipeline. */
|
|
17598
|
+
deviceKey: string().optional()
|
|
17599
|
+
}), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
|
|
17600
|
+
data: _instanceof(Uint8Array),
|
|
17601
|
+
width: number().int().positive(),
|
|
17602
|
+
height: number().int().positive(),
|
|
17603
|
+
format: _enum([
|
|
17604
|
+
"rgb",
|
|
17605
|
+
"bgr",
|
|
17606
|
+
"gray"
|
|
17607
|
+
])
|
|
17608
|
+
}), object({
|
|
17609
|
+
frameId: number(),
|
|
17610
|
+
width: number(),
|
|
17611
|
+
height: number()
|
|
17612
|
+
}), { kind: "mutation" }), method(object({
|
|
17613
|
+
stepId: string(),
|
|
17614
|
+
frameId: number().int()
|
|
17615
|
+
}), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
|
|
17616
|
+
batchMode: string(),
|
|
17617
|
+
windowMs: number(),
|
|
17618
|
+
maxBatchSize: number(),
|
|
17619
|
+
concurrency: number()
|
|
17620
|
+
})), method(_void(), array(object({
|
|
17621
|
+
engineKey: string(),
|
|
17622
|
+
engine: PipelineEngineChoiceSchema,
|
|
17623
|
+
modelsLoaded: array(string()).readonly(),
|
|
17624
|
+
inUseByCameras: array(number()).readonly(),
|
|
17625
|
+
/**
|
|
17626
|
+
* Origin of this resident factory.
|
|
17627
|
+
* - `runtime` — main camera-serving engine (no idle TTL).
|
|
17628
|
+
* - `warm-override` — benchmark/test override held in the warm
|
|
17629
|
+
* cache; auto-disposed after the idle TTL.
|
|
17630
|
+
* - `device-pool` — a concurrent per-device pool (Phase 2
|
|
17631
|
+
* multi-device, keyed by `deviceKey`) resolved
|
|
17632
|
+
* via `resolveDeviceFactory`. Runs alongside the
|
|
17633
|
+
* `runtime` engine on a DIFFERENT accelerator
|
|
17634
|
+
* (NPU / iGPU / Coral) — this is how the
|
|
17635
|
+
* Engines tab shows all pools running at once.
|
|
17636
|
+
*/
|
|
17637
|
+
kind: _enum([
|
|
17638
|
+
"runtime",
|
|
17639
|
+
"warm-override",
|
|
17640
|
+
"device-pool"
|
|
17641
|
+
]),
|
|
17642
|
+
/** Native pid of the underlying Python pool (null when no pool). */
|
|
17643
|
+
poolPid: number().nullable(),
|
|
17644
|
+
/** ms since this factory was last used (null when not warm-tracked). */
|
|
17645
|
+
idleMs: number().nullable(),
|
|
17646
|
+
/** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
|
|
17647
|
+
idleTtlMs: number().nullable()
|
|
17648
|
+
})).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
|
|
17649
|
+
kind: "mutation",
|
|
17650
|
+
auth: "admin"
|
|
17651
|
+
}), method(object({
|
|
17652
|
+
engine: PipelineEngineChoiceSchema,
|
|
17653
|
+
force: boolean().optional()
|
|
17654
|
+
}), object({
|
|
17655
|
+
success: boolean(),
|
|
17656
|
+
reason: string().optional()
|
|
17657
|
+
}), {
|
|
17658
|
+
kind: "mutation",
|
|
17659
|
+
auth: "admin"
|
|
17660
|
+
}), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
|
|
17661
|
+
addonId: string(),
|
|
17662
|
+
modelId: string(),
|
|
17663
|
+
filename: string().optional(),
|
|
17664
|
+
settings: record(string(), unknown()).optional()
|
|
17665
|
+
}), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
|
|
17723
17666
|
/**
|
|
17724
|
-
*
|
|
17725
|
-
*
|
|
17726
|
-
*
|
|
17727
|
-
*
|
|
17728
|
-
*
|
|
17729
|
-
*
|
|
17667
|
+
* Per-stage gating mode applied to the zones a rule references.
|
|
17668
|
+
*
|
|
17669
|
+
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
17670
|
+
* When at least one `include` rule fires for a stage, only entities
|
|
17671
|
+
* inside one of those zones pass that stage.
|
|
17672
|
+
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
17673
|
+
* Entities inside one of those zones are dropped at that stage.
|
|
17674
|
+
*
|
|
17675
|
+
* `monitor`-style observation (count without filtering) is not a rule
|
|
17676
|
+
* mode — zones without any matching rule are observed naturally by
|
|
17677
|
+
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
17678
|
+
* count, not filter" use case needs no rule at all.
|
|
17730
17679
|
*/
|
|
17731
|
-
var
|
|
17680
|
+
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
17732
17681
|
/**
|
|
17733
|
-
*
|
|
17734
|
-
*
|
|
17735
|
-
*
|
|
17736
|
-
*
|
|
17737
|
-
* on them.
|
|
17682
|
+
* Per-consumer rule that references existing zones (geometry) and
|
|
17683
|
+
* defines how a specific pipeline stage should treat them. Each
|
|
17684
|
+
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
17685
|
+
* settings:
|
|
17738
17686
|
*
|
|
17739
|
-
*
|
|
17740
|
-
*
|
|
17741
|
-
*
|
|
17687
|
+
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
17688
|
+
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
17689
|
+
* - future: notification rules, audio gating, etc.
|
|
17742
17690
|
*
|
|
17743
|
-
*
|
|
17744
|
-
*
|
|
17745
|
-
*
|
|
17746
|
-
* the
|
|
17691
|
+
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
17692
|
+
* express "ignore motion in ALL of {garden, street}" with a single
|
|
17693
|
+
* rule. `classFilter` narrows the rule to specific object classes —
|
|
17694
|
+
* "drop person detections in the street, but keep cars" is one
|
|
17695
|
+
* `exclude` rule with `classFilter: ['person']`.
|
|
17696
|
+
*
|
|
17697
|
+
* `enabled` is a soft toggle — the operator can keep the rule
|
|
17698
|
+
* configured but inert without deleting it.
|
|
17747
17699
|
*/
|
|
17748
|
-
var
|
|
17749
|
-
|
|
17750
|
-
|
|
17751
|
-
|
|
17752
|
-
|
|
17753
|
-
|
|
17754
|
-
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
source: DetectionSourceSchema.optional(),
|
|
17700
|
+
var ZoneRuleSchema = object({
|
|
17701
|
+
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
17702
|
+
id: string(),
|
|
17703
|
+
/** Optional human-readable label rendered in the rule editor. */
|
|
17704
|
+
name: string().optional(),
|
|
17705
|
+
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
17706
|
+
* listed zones (OR-set: a detection in any one of them counts).
|
|
17707
|
+
* At least one zone id required — a rule with no targets is a
|
|
17708
|
+
* configuration mistake and the form validator rejects it. */
|
|
17709
|
+
zoneIds: array(string()).min(1).readonly(),
|
|
17710
|
+
mode: ZoneRuleModeEnum,
|
|
17760
17711
|
/**
|
|
17761
|
-
*
|
|
17762
|
-
*
|
|
17763
|
-
*
|
|
17764
|
-
* (group by `trackId`, pick a representative `frameId` as the parent frame).
|
|
17765
|
-
* Optional for backward-compat with pre-existing rows / the slim projection
|
|
17766
|
-
* includes it (it is light). Absent on rows written before this field.
|
|
17712
|
+
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
17713
|
+
* applies to every class. Class strings match the `macroClass`
|
|
17714
|
+
* field on detections (e.g. `person`, `car`, `dog`).
|
|
17767
17715
|
*/
|
|
17768
|
-
|
|
17769
|
-
/** Omitted in slim projection. */
|
|
17770
|
-
trackId: string().optional(),
|
|
17771
|
-
className: string(),
|
|
17772
|
-
...TieredLabelFields,
|
|
17773
|
-
/** Omitted in slim projection. */
|
|
17774
|
-
confidence: number().optional(),
|
|
17775
|
-
/** Heavy JSON — omitted in slim projection. */
|
|
17776
|
-
bbox: BoundingBoxSchema.optional(),
|
|
17777
|
-
/** Heavy JSON — omitted in slim projection. */
|
|
17778
|
-
zones: array(string()).readonly().optional(),
|
|
17779
|
-
/** Omitted in slim projection. */
|
|
17780
|
-
state: TrackStateSchema.optional(),
|
|
17716
|
+
classFilter: array(string()).readonly().optional(),
|
|
17781
17717
|
/**
|
|
17782
|
-
*
|
|
17783
|
-
*
|
|
17784
|
-
*
|
|
17718
|
+
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
17719
|
+
* required to consider an entity "in the zone". Defaults to the
|
|
17720
|
+
* consumer's stage default when omitted. Kept for back-compat with
|
|
17721
|
+
* existing per-rule overrides; new operators pick the value via
|
|
17722
|
+
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
17723
|
+
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
17785
17724
|
*/
|
|
17786
|
-
|
|
17787
|
-
/**
|
|
17788
|
-
*
|
|
17789
|
-
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
*
|
|
17795
|
-
*
|
|
17796
|
-
*
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
/**
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
*
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
classification: object({
|
|
17812
|
-
className: string(),
|
|
17813
|
-
originalClass: string().optional(),
|
|
17814
|
-
score: number()
|
|
17815
|
-
}).optional(),
|
|
17816
|
-
/** Populated by B5 (recording playback URL for this event). */
|
|
17817
|
-
mediaUrl: string().optional()
|
|
17725
|
+
overlapThreshold: number().min(0).max(1).optional(),
|
|
17726
|
+
/**
|
|
17727
|
+
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
17728
|
+
* of the detection's bbox that must lie inside the zone for the
|
|
17729
|
+
* rule to match. Documented default is 85%; the engine substitutes
|
|
17730
|
+
* that when the field is omitted (kept optional so existing rules
|
|
17731
|
+
* stored without it stay valid).
|
|
17732
|
+
*
|
|
17733
|
+
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
17734
|
+
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
17735
|
+
* field exposed in the UI. Internally both feed the same gate.
|
|
17736
|
+
*/
|
|
17737
|
+
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
17738
|
+
/**
|
|
17739
|
+
* When `true` and a detection has a segmentation mask, use the
|
|
17740
|
+
* mask for overlap instead of the bbox. Detection-stage only;
|
|
17741
|
+
* motion rules ignore this field.
|
|
17742
|
+
*/
|
|
17743
|
+
preferMask: boolean().optional(),
|
|
17744
|
+
/**
|
|
17745
|
+
* Soft-toggle: `false` disables the rule without deleting it.
|
|
17746
|
+
* Defaults to `true` so operators creating a rule via the UI
|
|
17747
|
+
* see it active immediately.
|
|
17748
|
+
*/
|
|
17749
|
+
enabled: boolean().default(true)
|
|
17818
17750
|
});
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17751
|
+
array(ZoneRuleSchema).readonly();
|
|
17752
|
+
/**
|
|
17753
|
+
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
17754
|
+
*
|
|
17755
|
+
* Zones describe **where** in the frame the operator wants to flag
|
|
17756
|
+
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
17757
|
+
* each pipeline stage uses them. Splitting the two means a single
|
|
17758
|
+
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
17759
|
+
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
17760
|
+
* — without three duplicated polygons.
|
|
17761
|
+
*
|
|
17762
|
+
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
17763
|
+
* `zones` device-state slice on every mutation. Consumers
|
|
17764
|
+
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
17765
|
+
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
17766
|
+
* mirror with `onChanged`).
|
|
17767
|
+
*
|
|
17768
|
+
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
17769
|
+
* survive resolution changes and stream profile switches.
|
|
17770
|
+
*
|
|
17771
|
+
* `kind` discriminates between full polygons (closed regions used
|
|
17772
|
+
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
17773
|
+
* line segments used for cross events). Onboard / firmware-reported
|
|
17774
|
+
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
17775
|
+
* task list.
|
|
17776
|
+
*/
|
|
17777
|
+
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
17778
|
+
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
17779
|
+
var PolygonPointSchema = object({
|
|
17780
|
+
x: number(),
|
|
17781
|
+
y: number()
|
|
17782
|
+
});
|
|
17783
|
+
/** A camera detection zone — pure geometry/identity. */
|
|
17784
|
+
var ZoneSchema = object({
|
|
17785
|
+
id: string(),
|
|
17786
|
+
name: string(),
|
|
17787
|
+
kind: ZoneKindEnum.default("polygon"),
|
|
17788
|
+
/** Polygon vertices, fraction of frame (0–1). */
|
|
17789
|
+
polygon: array(PolygonPointSchema).readonly(),
|
|
17790
|
+
/** Visual color for UI rendering. */
|
|
17791
|
+
color: string().default("#3b82f6")
|
|
17839
17792
|
});
|
|
17840
17793
|
/**
|
|
17841
|
-
*
|
|
17794
|
+
* Zones capability — per-camera CRUD over polygon detection zones.
|
|
17842
17795
|
*
|
|
17843
|
-
*
|
|
17844
|
-
*
|
|
17845
|
-
*
|
|
17846
|
-
*
|
|
17847
|
-
* blocks the whole view.
|
|
17796
|
+
* Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
|
|
17797
|
+
* to per-device settings and mirrors into the `zones` device-state
|
|
17798
|
+
* slice on every mutation, so downstream consumers can subscribe via
|
|
17799
|
+
* `dev.state.zones.onChanged`.
|
|
17848
17800
|
*
|
|
17849
|
-
*
|
|
17850
|
-
*
|
|
17801
|
+
* The cap surface only handles geometry + identity; filtering
|
|
17802
|
+
* behaviour (per-class, include/exclude, threshold) lives in the
|
|
17803
|
+
* consumer addons' rule arrays — see `ZoneRuleSchema` exported from
|
|
17804
|
+
* `capabilities/schemas/zone-rule.js`.
|
|
17851
17805
|
*/
|
|
17852
|
-
var
|
|
17806
|
+
var zonesCapability = {
|
|
17807
|
+
name: "zones",
|
|
17808
|
+
scope: "device",
|
|
17809
|
+
mode: "singleton",
|
|
17810
|
+
deviceTypes: [DeviceType.Camera],
|
|
17811
|
+
methods: {
|
|
17812
|
+
listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
|
|
17813
|
+
addZone: method(object({
|
|
17814
|
+
deviceId: number(),
|
|
17815
|
+
zone: ZoneSchema
|
|
17816
|
+
}), _void(), {
|
|
17817
|
+
kind: "mutation",
|
|
17818
|
+
auth: "admin"
|
|
17819
|
+
}),
|
|
17820
|
+
removeZone: method(object({
|
|
17821
|
+
deviceId: number(),
|
|
17822
|
+
zoneId: string()
|
|
17823
|
+
}), _void(), {
|
|
17824
|
+
kind: "mutation",
|
|
17825
|
+
auth: "admin"
|
|
17826
|
+
}),
|
|
17827
|
+
updateZone: method(object({
|
|
17828
|
+
deviceId: number(),
|
|
17829
|
+
zone: ZoneSchema
|
|
17830
|
+
}), _void(), {
|
|
17831
|
+
kind: "mutation",
|
|
17832
|
+
auth: "admin"
|
|
17833
|
+
})
|
|
17834
|
+
},
|
|
17835
|
+
/**
|
|
17836
|
+
* Runtime-state slice — the live zone catalogue mirrored by the
|
|
17837
|
+
* orchestrator on every CRUD mutation. Consumers read via
|
|
17838
|
+
* `device.state.zones.value` / `.watch(...)` without round-tripping
|
|
17839
|
+
* the cap, and the codegen DeviceProxy auto-wires the reactive
|
|
17840
|
+
* handle. Slice shape is `{ zones: Zone[] }` so future extensions
|
|
17841
|
+
* (e.g. zone groupings) can sit alongside the polygon list.
|
|
17842
|
+
*/
|
|
17843
|
+
runtimeState: object({ zones: array(ZoneSchema).readonly() }),
|
|
17844
|
+
/**
|
|
17845
|
+
* Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
|
|
17846
|
+
*
|
|
17847
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
17848
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
17849
|
+
*/
|
|
17850
|
+
durability: "restored"
|
|
17851
|
+
};
|
|
17853
17852
|
/**
|
|
17854
|
-
*
|
|
17853
|
+
* pipeline-analytics — device-scoped wrapper cap. Refines raw
|
|
17854
|
+
* per-frame detections emitted by the pipeline runner into tracked
|
|
17855
|
+
* objects, per-kind event collections (motion / object / audio), and
|
|
17856
|
+
* persisted media. Owns the post-detection domain end-to-end:
|
|
17855
17857
|
*
|
|
17856
|
-
*
|
|
17857
|
-
*
|
|
17858
|
-
*
|
|
17859
|
-
*
|
|
17858
|
+
* runner emits PipelineInferenceResult
|
|
17859
|
+
* ↓ (event bus)
|
|
17860
|
+
* pipeline-analytics subscriber
|
|
17861
|
+
* ↓ SORT tracker + zone engine + state analyzer + event emitter
|
|
17862
|
+
* → three DB collections (one per kind), one FS media tree, one
|
|
17863
|
+
* unified event emitter (FrameTracked + TrackStarted/Ended +
|
|
17864
|
+
* DetectionEvent on bus)
|
|
17860
17865
|
*
|
|
17861
|
-
*
|
|
17862
|
-
*
|
|
17863
|
-
*
|
|
17864
|
-
*
|
|
17866
|
+
* Pure subscriber model. No `processFrame` cap method — the runner
|
|
17867
|
+
* already publishes the raw frame on the bus. The cap surface is
|
|
17868
|
+
* only QUERIES + per-device settings, bound on/off via
|
|
17869
|
+
* `device-manager.setWrapperActive`. `defaultActive: true` because
|
|
17870
|
+
* every camera with a detection pipeline wants its raw detections
|
|
17871
|
+
* refined; operators opt out per-device via BindingsTab when needed.
|
|
17872
|
+
*
|
|
17873
|
+
* Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
|
|
17874
|
+
* (per-device surface) and `track-trail` caps — see P11 cleanup.
|
|
17865
17875
|
*/
|
|
17866
|
-
var
|
|
17876
|
+
var TrackStateSchema = _enum([
|
|
17877
|
+
"new",
|
|
17878
|
+
"entered",
|
|
17879
|
+
"left",
|
|
17880
|
+
"moving",
|
|
17881
|
+
"idle"
|
|
17882
|
+
]);
|
|
17883
|
+
var EventKindSchema = _enum([
|
|
17884
|
+
"motion",
|
|
17885
|
+
"object",
|
|
17886
|
+
"audio"
|
|
17887
|
+
]);
|
|
17888
|
+
/**
|
|
17889
|
+
* Spatial filter for `listTracks` — the rect + polygon variants of the shared
|
|
17890
|
+
* MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
|
|
17891
|
+
* of the camera frame (top-left origin), matching the drawing-plane editor.
|
|
17892
|
+
*/
|
|
17893
|
+
var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
|
|
17894
|
+
/** Closed icon vocabulary so clients render a known glyph per kind. */
|
|
17895
|
+
var EventKindIconSchema = _enum([
|
|
17896
|
+
"motion",
|
|
17897
|
+
"audio",
|
|
17867
17898
|
"person",
|
|
17868
17899
|
"vehicle",
|
|
17869
17900
|
"animal",
|
|
17901
|
+
"door",
|
|
17902
|
+
"pir",
|
|
17903
|
+
"smoke",
|
|
17904
|
+
"water",
|
|
17905
|
+
"button",
|
|
17870
17906
|
"package",
|
|
17871
|
-
"
|
|
17872
|
-
"plate"
|
|
17907
|
+
"generic"
|
|
17873
17908
|
]);
|
|
17874
|
-
|
|
17875
|
-
|
|
17876
|
-
|
|
17877
|
-
|
|
17878
|
-
|
|
17879
|
-
|
|
17880
|
-
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17909
|
+
var EventKindCategorySchema = _enum([
|
|
17910
|
+
"motion",
|
|
17911
|
+
"audio",
|
|
17912
|
+
"detection",
|
|
17913
|
+
"sensor",
|
|
17914
|
+
"control",
|
|
17915
|
+
"custom",
|
|
17916
|
+
"package"
|
|
17917
|
+
]);
|
|
17918
|
+
/** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
|
|
17919
|
+
var EventKindLevelSchema = _enum(["macro", "sub"]);
|
|
17920
|
+
var EventKindDescriptorSchema = object({
|
|
17921
|
+
/** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
|
|
17922
|
+
kind: string(),
|
|
17923
|
+
/** i18n key resolved on the UI side; `label` is the English fallback. */
|
|
17924
|
+
labelKey: string(),
|
|
17925
|
+
/** English fallback label (kept for clients that don't translate). */
|
|
17926
|
+
label: string(),
|
|
17927
|
+
/** Hex color for timeline/legend rendering. */
|
|
17928
|
+
color: string(),
|
|
17929
|
+
/** Dictionary id → lucide component on the UI side. */
|
|
17930
|
+
iconId: string(),
|
|
17931
|
+
/** Legacy closed-vocab glyph — fallback for `iconId`. */
|
|
17932
|
+
icon: EventKindIconSchema,
|
|
17933
|
+
category: EventKindCategorySchema,
|
|
17934
|
+
/** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
|
|
17935
|
+
parentKind: string().nullable(),
|
|
17936
|
+
/** Derived from `parentKind`, explicit for the client tree. */
|
|
17937
|
+
level: EventKindLevelSchema,
|
|
17938
|
+
/** Which cap + device contributes this kind. For built-ins the camera
|
|
17939
|
+
* itself; for sensor kinds the LINKED source device. */
|
|
17940
|
+
source: object({
|
|
17941
|
+
capName: string(),
|
|
17942
|
+
deviceId: number()
|
|
17943
|
+
})
|
|
17884
17944
|
});
|
|
17885
|
-
/**
|
|
17886
|
-
|
|
17887
|
-
*
|
|
17888
|
-
* `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
|
|
17889
|
-
* (letterboxed root / zone-cropped package / subject-cropped classifier) are
|
|
17890
|
-
* derived from it at export and never stored — storing them is how one feature
|
|
17891
|
-
* space ends up holding two crops of the same subject (D52).
|
|
17892
|
-
*/
|
|
17893
|
-
var RetrainAnnotationSchema = object({
|
|
17894
|
-
id: string(),
|
|
17895
|
-
trackId: string(),
|
|
17945
|
+
/** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
|
|
17946
|
+
var EventKindsForDeviceSchema = object({
|
|
17896
17947
|
deviceId: number(),
|
|
17897
|
-
|
|
17898
|
-
mediaKey: string(),
|
|
17899
|
-
bbox: RetrainBboxSchema,
|
|
17900
|
-
macroClass: RetrainMacroClassSchema,
|
|
17901
|
-
label: string().optional(),
|
|
17902
|
-
subLabel: string().optional(),
|
|
17903
|
-
kind: RetrainAnnotationKindSchema,
|
|
17904
|
-
source: RetrainAnnotationSourceSchema,
|
|
17905
|
-
/** Which model proposed this box — or, on a `model_error`, drew the phantom. */
|
|
17906
|
-
assistModelId: string().optional(),
|
|
17907
|
-
assistScore: number().optional(),
|
|
17908
|
-
exportedInBatch: string().optional(),
|
|
17909
|
-
createdAt: number()
|
|
17910
|
-
});
|
|
17911
|
-
/** The write form — the server owns `id`, `createdAt` and the frame binding. */
|
|
17912
|
-
var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
|
|
17913
|
-
id: true,
|
|
17914
|
-
trackId: true,
|
|
17915
|
-
deviceId: true,
|
|
17916
|
-
mediaKey: true,
|
|
17917
|
-
createdAt: true,
|
|
17918
|
-
exportedInBatch: true
|
|
17948
|
+
kinds: array(EventKindDescriptorSchema).readonly()
|
|
17919
17949
|
});
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
17950
|
+
var SensorEventSchema = object({
|
|
17951
|
+
id: string(),
|
|
17952
|
+
/** The CAMERA the event is attributed to (a sensor linked to N cameras
|
|
17953
|
+
* yields N rows, one per camera). */
|
|
17923
17954
|
deviceId: number(),
|
|
17924
|
-
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
/**
|
|
17929
|
-
|
|
17930
|
-
|
|
17931
|
-
* `frameCount: 0` is exactly "staging, still to work". */
|
|
17932
|
-
annotationCount: number().int()
|
|
17955
|
+
/** The linked sensor device whose state changed. */
|
|
17956
|
+
sourceDeviceId: number(),
|
|
17957
|
+
/** Event kind id — matches an `EventKindDescriptor.kind`. */
|
|
17958
|
+
kind: string(),
|
|
17959
|
+
/** Snapshot of the sensor cap's runtime-state slice at the change. */
|
|
17960
|
+
value: record(string(), unknown()).nullable(),
|
|
17961
|
+
timestamp: number()
|
|
17933
17962
|
});
|
|
17934
|
-
|
|
17935
|
-
|
|
17936
|
-
|
|
17937
|
-
kind: MediaFileKindEnum,
|
|
17963
|
+
var TrackPositionSchema = object({
|
|
17964
|
+
x: number(),
|
|
17965
|
+
y: number(),
|
|
17938
17966
|
timestamp: number(),
|
|
17939
|
-
|
|
17940
|
-
/** A copy of this original already exists — selecting it is free and cannot
|
|
17941
|
-
* fail, whatever became of the original. */
|
|
17942
|
-
copied: boolean()
|
|
17943
|
-
});
|
|
17944
|
-
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
17945
|
-
var RetrainFrameSchema = object({
|
|
17946
|
-
frameId: string(),
|
|
17947
|
-
deviceId: number(),
|
|
17948
|
-
trackId: string(),
|
|
17949
|
-
/** Provenance only. It may already point at nothing — that is expected. */
|
|
17950
|
-
sourceMediaKey: string(),
|
|
17951
|
-
sourceKind: MediaFileKindEnum,
|
|
17952
|
-
sizeBytes: number().int(),
|
|
17953
|
-
width: number().int(),
|
|
17954
|
-
height: number().int(),
|
|
17955
|
-
copiedAt: number()
|
|
17956
|
-
});
|
|
17957
|
-
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
17958
|
-
var RetrainCopyRefusalSchema = _enum([
|
|
17959
|
-
"source-missing",
|
|
17960
|
-
"unreadable-image",
|
|
17961
|
-
"write-failed"
|
|
17962
|
-
]);
|
|
17963
|
-
var RetrainFrameSelectionSchema = object({
|
|
17964
|
-
copied: array(RetrainFrameSchema).readonly(),
|
|
17965
|
-
refused: array(object({
|
|
17966
|
-
sourceMediaKey: string(),
|
|
17967
|
-
reason: RetrainCopyRefusalSchema
|
|
17968
|
-
})).readonly()
|
|
17967
|
+
bbox: BoundingBoxSchema
|
|
17969
17968
|
});
|
|
17970
|
-
var
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
/**
|
|
17974
|
-
|
|
17969
|
+
var TrackSnapshotSchema = object({
|
|
17970
|
+
timestamp: number(),
|
|
17971
|
+
position: TrackPositionSchema,
|
|
17972
|
+
/** MediaStore key; resolve via `getTrackMedia({ trackId })`. */
|
|
17973
|
+
mediaKey: string()
|
|
17975
17974
|
});
|
|
17976
|
-
/** What the operator asked the assist to look for. */
|
|
17977
|
-
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
17978
|
-
kind: literal("package"),
|
|
17979
|
-
zone: RetrainBboxSchema.optional()
|
|
17980
|
-
}), object({
|
|
17981
|
-
kind: literal("objects"),
|
|
17982
|
-
modelId: string(),
|
|
17983
|
-
minScore: number().optional()
|
|
17984
|
-
})]);
|
|
17985
17975
|
/**
|
|
17986
|
-
*
|
|
17987
|
-
*
|
|
17988
|
-
*
|
|
17976
|
+
* Normalized 0..1 trajectory envelope (min/max over every position bbox,
|
|
17977
|
+
* divided by the track's detection-frame dims), computed at persist time.
|
|
17978
|
+
* Absent when the frame dims were unknown when the track was persisted
|
|
17979
|
+
* (legacy rows / dims-less sources) and on active (in-RAM) tracks.
|
|
17989
17980
|
*/
|
|
17990
|
-
var
|
|
17991
|
-
|
|
17992
|
-
|
|
17993
|
-
|
|
17994
|
-
|
|
17995
|
-
/** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
|
|
17996
|
-
proposals: array(RetrainAnnotationDraftSchema).readonly(),
|
|
17997
|
-
/** Returned by the runner but removed by the threshold. */
|
|
17998
|
-
belowThreshold: number().int()
|
|
17999
|
-
}), object({
|
|
18000
|
-
kind: literal("refused"),
|
|
18001
|
-
/** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
|
|
18002
|
-
reason: string(),
|
|
18003
|
-
detail: string().optional()
|
|
18004
|
-
})]);
|
|
18005
|
-
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
18006
|
-
var RetrainTransitionResultSchema = object({
|
|
18007
|
-
trackId: string(),
|
|
18008
|
-
/** Where the track ended up, whatever happened. */
|
|
18009
|
-
retrainStatus: RetrainStatusSchema,
|
|
18010
|
-
/** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
|
|
18011
|
-
changed: boolean(),
|
|
18012
|
-
reason: _enum([
|
|
18013
|
-
"unknown-track",
|
|
18014
|
-
"no-frames-copied",
|
|
18015
|
-
"not-staging",
|
|
18016
|
-
"not-trained",
|
|
18017
|
-
"unchanged"
|
|
18018
|
-
]).optional()
|
|
18019
|
-
});
|
|
18020
|
-
var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
|
|
18021
|
-
var MAX_EVENT_QUERY_LIMIT = 5e3;
|
|
18022
|
-
var DeviceEventQueryInput = object({
|
|
18023
|
-
deviceId: number(),
|
|
18024
|
-
since: number().optional(),
|
|
18025
|
-
until: number().optional(),
|
|
18026
|
-
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
|
|
18027
|
-
/** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
|
|
18028
|
-
* optional `mediaUrl` (populated by B5). `full` (default) keeps today's
|
|
18029
|
-
* exact behaviour. Callers may omit this field — the store defaults to
|
|
18030
|
-
* `full` when not provided. */
|
|
18031
|
-
projection: _enum(["full", "slim"]).optional()
|
|
18032
|
-
});
|
|
18033
|
-
var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
|
|
18034
|
-
var RecentTracksQueryInput = object({
|
|
18035
|
-
/** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
|
|
18036
|
-
deviceIds: array(number()),
|
|
18037
|
-
/** Window lower bound on `lastSeen` (inclusive). */
|
|
18038
|
-
since: number().optional(),
|
|
18039
|
-
/** Window upper bound on `lastSeen` (inclusive). */
|
|
18040
|
-
until: number().optional(),
|
|
18041
|
-
/** Page size. Default 200, max 1000. */
|
|
18042
|
-
limit: number().int().min(1).max(1e3).default(200),
|
|
18043
|
-
/** Opaque continuation cursor from a previous page's `nextCursor`.
|
|
18044
|
-
* Encodes the (lastSeen, trackId) sort position — treat as opaque. */
|
|
18045
|
-
cursor: string().optional(),
|
|
18046
|
-
/** See {@link TrackProjectionSchema}. Default `full`. */
|
|
18047
|
-
projection: TrackProjectionSchema.optional(),
|
|
18048
|
-
/** Include stationary-promoted rows (parked objects). Default false: the
|
|
18049
|
-
* feed lists passages; parking records live on the stationary registry. */
|
|
18050
|
-
includeStationary: boolean().optional()
|
|
18051
|
-
});
|
|
18052
|
-
var RecentTracksPageSchema = object({
|
|
18053
|
-
/** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
|
|
18054
|
-
tracks: array(TrackSchema).readonly(),
|
|
18055
|
-
/** Cursor for the next page, or null when this page is the last. */
|
|
18056
|
-
nextCursor: string().nullable()
|
|
18057
|
-
});
|
|
18058
|
-
var LIST_GROUPS_DEFAULT_LIMIT = 40;
|
|
18059
|
-
var LIST_GROUPS_MAX_LIMIT = 100;
|
|
18060
|
-
var AnalyticsGroupRecordSchema = object({
|
|
18061
|
-
id: string(),
|
|
18062
|
-
deviceId: number().int(),
|
|
18063
|
-
openedAt: number().int(),
|
|
18064
|
-
closedAt: number().int(),
|
|
18065
|
-
timestamp: number().int(),
|
|
18066
|
-
memberCount: number().int(),
|
|
18067
|
-
memberTrackIds: array(string()).readonly(),
|
|
18068
|
-
className: string(),
|
|
18069
|
-
classes: array(string()).readonly(),
|
|
18070
|
-
/** Relative event-media path, or null when the group has no picture yet. */
|
|
18071
|
-
mediaUrl: string().nullable(),
|
|
18072
|
-
singleton: boolean()
|
|
17981
|
+
var TrackEnvelopeSchema = object({
|
|
17982
|
+
minX: number(),
|
|
17983
|
+
minY: number(),
|
|
17984
|
+
maxX: number(),
|
|
17985
|
+
maxY: number()
|
|
18073
17986
|
});
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
|
|
18080
|
-
|
|
18081
|
-
|
|
18082
|
-
|
|
18083
|
-
|
|
18084
|
-
|
|
18085
|
-
|
|
18086
|
-
|
|
18087
|
-
|
|
18088
|
-
|
|
18089
|
-
|
|
18090
|
-
|
|
18091
|
-
|
|
18092
|
-
|
|
18093
|
-
|
|
18094
|
-
|
|
18095
|
-
|
|
18096
|
-
|
|
18097
|
-
|
|
18098
|
-
|
|
18099
|
-
|
|
18100
|
-
|
|
18101
|
-
since: number(),
|
|
18102
|
-
/** Window upper bound (track firstSeen ≤ until). */
|
|
18103
|
-
until: number(),
|
|
18104
|
-
limit: number().int().min(1).max(200).default(50),
|
|
18105
|
-
/** Drop tracks scoring below this importance. */
|
|
18106
|
-
minImportance: number().min(0).max(1).optional(),
|
|
18107
|
-
/** Restrict to a single class (e.g. 'person'). */
|
|
18108
|
-
classFilter: string().optional()
|
|
18109
|
-
});
|
|
18110
|
-
var KeyEventSchema = object({
|
|
18111
|
-
/** The representative event id (the track's best ObjectEvent, else its trackId). */
|
|
18112
|
-
id: string(),
|
|
18113
|
-
trackId: string(),
|
|
18114
|
-
/** Track start time (firstSeen). */
|
|
18115
|
-
timestamp: number(),
|
|
18116
|
-
className: string(),
|
|
18117
|
-
...TieredLabelFields,
|
|
18118
|
-
importance: number(),
|
|
18119
|
-
/** Highest-confidence ObjectEvent id for the track (empty when none). */
|
|
18120
|
-
bestEventId: string(),
|
|
18121
|
-
/** Track lifetime in ms (lastSeen - firstSeen). */
|
|
18122
|
-
windowMs: number().optional(),
|
|
18123
|
-
...TrackFlagFields,
|
|
18124
|
-
...TrackRetrainFields
|
|
18125
|
-
});
|
|
18126
|
-
object({
|
|
18127
|
-
trackId: string(),
|
|
18128
|
-
className: string(),
|
|
18129
|
-
confidence: number(),
|
|
18130
|
-
bbox: BoundingBoxSchema,
|
|
18131
|
-
zones: array(string()).readonly(),
|
|
18132
|
-
state: TrackStateSchema
|
|
18133
|
-
});
|
|
18134
|
-
var OverlayDetectionSchema = looseObject({
|
|
18135
|
-
id: string(),
|
|
18136
|
-
kind: _enum(["first-level", "detail"]),
|
|
18137
|
-
macroClass: string(),
|
|
18138
|
-
score: number(),
|
|
18139
|
-
bbox: object({
|
|
18140
|
-
x: number(),
|
|
18141
|
-
y: number(),
|
|
18142
|
-
width: number(),
|
|
18143
|
-
height: number()
|
|
18144
|
-
}),
|
|
18145
|
-
labels: array(looseObject({
|
|
18146
|
-
label: string(),
|
|
18147
|
-
score: number()
|
|
18148
|
-
})).readonly(),
|
|
18149
|
-
parentId: string().optional()
|
|
18150
|
-
});
|
|
18151
|
-
var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
|
|
18152
|
-
var SearchObjectEventsInput = object({
|
|
18153
|
-
text: string(),
|
|
18154
|
-
deviceId: number().optional(),
|
|
18155
|
-
since: number().optional(),
|
|
18156
|
-
until: number().optional(),
|
|
18157
|
-
classFilter: string().optional(),
|
|
18158
|
-
limit: number().default(50),
|
|
18159
|
-
minScore: number().min(0).max(1).default(.2)
|
|
18160
|
-
});
|
|
18161
|
-
var TrackCascadeCountsSchema = object({
|
|
18162
|
-
/** Persisted track roots deleted (authoritative). */
|
|
18163
|
-
tracks: number().int(),
|
|
18164
|
-
/** Object events removed with their tracks (best-effort; see note above). */
|
|
18165
|
-
events: number().int(),
|
|
18166
|
-
/** Track/face/plate-owned media removed (best-effort). Never identity media. */
|
|
18167
|
-
media: number().int(),
|
|
18168
|
-
/** Unassigned (non-enrolled) face reads removed (best-effort). */
|
|
18169
|
-
faces: number().int(),
|
|
18170
|
-
/** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
|
|
18171
|
-
plates: number().int(),
|
|
18172
|
-
/** Per-track CLIP search vectors removed (best-effort). */
|
|
18173
|
-
embeddings: number().int(),
|
|
18174
|
-
/** Group membership + group rows removed with their last member (best-effort). */
|
|
18175
|
-
groups: number().int()
|
|
18176
|
-
});
|
|
18177
|
-
/** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
|
|
18178
|
-
var DiskReconcileCountsSchema = object({
|
|
18179
|
-
mediaDropped: number().int(),
|
|
18180
|
-
tracks: number().int(),
|
|
18181
|
-
events: number().int()
|
|
18182
|
-
});
|
|
18183
|
-
/** Event-store footprint for one camera. */
|
|
18184
|
-
var EventStoreDeviceFootprintSchema = object({
|
|
18185
|
-
deviceId: number(),
|
|
18186
|
-
/** Persisted event rows (motion + object + audio) for the camera. */
|
|
18187
|
-
rows: number().int(),
|
|
18188
|
-
/** Event-owned media bytes on disk for the camera. */
|
|
18189
|
-
bytes: number().int()
|
|
18190
|
-
});
|
|
18191
|
-
/** Aggregate event-store footprint: global totals + per-camera breakdown. */
|
|
18192
|
-
var EventStoreFootprintSchema = object({
|
|
18193
|
-
totalRows: number().int(),
|
|
18194
|
-
totalBytes: number().int(),
|
|
18195
|
-
devices: array(EventStoreDeviceFootprintSchema).readonly()
|
|
18196
|
-
});
|
|
18197
|
-
/** Per-kind counts returned by the event-prune / device-delete mutations. */
|
|
18198
|
-
var EventPruneCountsSchema = object({
|
|
18199
|
-
motion: number().int(),
|
|
18200
|
-
object: number().int(),
|
|
18201
|
-
audio: number().int()
|
|
17987
|
+
/**
|
|
17988
|
+
* Row projection for track list queries. `full` (default) returns the
|
|
17989
|
+
* complete Track including the frame-rate `positions[]` history and the
|
|
17990
|
+
* `snapshots[]` references — megabytes across a page of tracks. `slim`
|
|
17991
|
+
* keeps every scalar the list surfaces actually render (ids, class(es),
|
|
17992
|
+
* label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
|
|
17993
|
+
* zonesVisited, bestEventId, envelope, hasFace, hasEmbeddedFace, hasRider) and returns `positions` /
|
|
17994
|
+
* `snapshots` as EMPTY arrays — detail views re-fetch the full row via
|
|
17995
|
+
* `getTrack`. Mirrors the event-store `projection` convention
|
|
17996
|
+
* (`getObjectEvents` et al.).
|
|
17997
|
+
*/
|
|
17998
|
+
var TrackProjectionSchema = _enum(["full", "slim"]);
|
|
17999
|
+
/**
|
|
18000
|
+
* One audio-classification label heard on the track's camera while the
|
|
18001
|
+
* track was alive, aggregated per label. An "episode" is one persisted
|
|
18002
|
+
* audio event (the confident-classification path: score ≥ the device's
|
|
18003
|
+
* `classificationMinScore`, class-change-or-heartbeat coalesced) — NOT
|
|
18004
|
+
* one 32 ms inference chunk, so counts stay human-scaled.
|
|
18005
|
+
*/
|
|
18006
|
+
var TrackAudioLabelSchema = object({
|
|
18007
|
+
label: string(),
|
|
18008
|
+
/** Highest classification score observed across the label's episodes. */
|
|
18009
|
+
peakScore: number(),
|
|
18010
|
+
/** Number of coalesced audio-event episodes carrying this label. */
|
|
18011
|
+
count: number(),
|
|
18012
|
+
firstAt: number(),
|
|
18013
|
+
lastAt: number()
|
|
18202
18014
|
});
|
|
18203
18015
|
/**
|
|
18204
|
-
*
|
|
18016
|
+
* How a track was produced. `pipeline` (default / absent) = the spatial
|
|
18017
|
+
* detection+tracking pipeline. Every OTHER value is a SYNTHETIC projection —
|
|
18018
|
+
* no positions, a single snapshot, and no bbox trajectory at all:
|
|
18205
18019
|
*
|
|
18206
|
-
*
|
|
18207
|
-
*
|
|
18208
|
-
*
|
|
18209
|
-
*
|
|
18210
|
-
*
|
|
18020
|
+
* - `sensor` — a linked sensor/control device state change.
|
|
18021
|
+
* - `audio` — an audio event on the camera itself that was anomalous for
|
|
18022
|
+
* THAT camera, loud, and heard while nothing visual was happening (D62).
|
|
18023
|
+
*
|
|
18024
|
+
* The spatial subsystems (tracker association, occupancy count, re-id /
|
|
18025
|
+
* embedding, resurrection) MUST skip every synthetic source. Test for that
|
|
18026
|
+
* with `isSpatialTrack`, which allow-lists `pipeline` — a `!== 'sensor'`
|
|
18027
|
+
* check silently readmits every source added after it was written.
|
|
18211
18028
|
*/
|
|
18212
|
-
var
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
|
|
18216
|
-
|
|
18217
|
-
/** Stop after this many tracks; the result reports whether more remain. */
|
|
18218
|
-
maxTracks: number().int().positive().optional(),
|
|
18219
|
-
/**
|
|
18220
|
-
* Run every embedding on THIS node instead of round-robining the fleet.
|
|
18221
|
-
*
|
|
18222
|
-
* Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
|
|
18223
|
-
* field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
|
|
18224
|
-
* calling it that would pin the rebuild REQUEST itself to that node — the
|
|
18225
|
-
* rebuild orchestration lives on the hub, and only the per-track step runs
|
|
18226
|
-
* remotely. This field is data; the per-track pin is applied inside.
|
|
18227
|
-
*
|
|
18228
|
-
* Absent ⇒ round-robin over every online node whose runner can serve the
|
|
18229
|
-
* pinned model.
|
|
18230
|
-
*/
|
|
18231
|
-
executeOnNodeId: string().optional(),
|
|
18232
|
-
/**
|
|
18233
|
-
* Milliseconds to wait between tracks; omit for the built-in default, `0` to
|
|
18234
|
-
* run flat out.
|
|
18235
|
-
*
|
|
18236
|
-
* A rebuild is bulk maintenance on hub-main's single thread. Measured
|
|
18237
|
-
* 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
|
|
18238
|
-
* pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
|
|
18239
|
-
* force is logged at start and finish so a deliberately slow pass reads
|
|
18240
|
-
* differently from a stalled one.
|
|
18241
|
-
*/
|
|
18242
|
-
pacingMs: number().int().nonnegative().optional()
|
|
18243
|
-
});
|
|
18029
|
+
var TrackSourceSchema = _enum([
|
|
18030
|
+
"pipeline",
|
|
18031
|
+
"sensor",
|
|
18032
|
+
"audio"
|
|
18033
|
+
]);
|
|
18244
18034
|
/**
|
|
18245
|
-
*
|
|
18035
|
+
* Where a track sits in the RETRAIN lifecycle (D81).
|
|
18246
18036
|
*
|
|
18247
|
-
*
|
|
18248
|
-
*
|
|
18249
|
-
*
|
|
18250
|
-
*
|
|
18037
|
+
* - `none` — never marked, or un-marked. Evictable.
|
|
18038
|
+
* - `staging` — the operator wants this track as training material and has not
|
|
18039
|
+
* finished with it. **This is the only state retention holds**: the track and
|
|
18040
|
+
* everything it owns (object events, crops, keyframes, CLIP vector) survive
|
|
18041
|
+
* the device's age window.
|
|
18042
|
+
* - `trained` — the retrain page has taken what it needed. The frames it chose
|
|
18043
|
+
* were COPIED into the retrain dataset at selection time, so the dataset no
|
|
18044
|
+
* longer depends on the track's media and the track becomes EVICTABLE again.
|
|
18045
|
+
* Terminal for the plain `markForTrain` toggle: returning it to `staging` is
|
|
18046
|
+
* a deliberate action of the retrain page, not a side effect of a checkbox.
|
|
18047
|
+
*
|
|
18048
|
+
* There is no `null`. The state is stored `TEXT NOT NULL DEFAULT 'none'` because
|
|
18049
|
+
* the store's filter language has only positive equality and `whereIn` — no
|
|
18050
|
+
* negation, no IS NULL — so a NULL would be unselectable by ANY predicate and
|
|
18051
|
+
* would make the entire pre-column history immortal in one deploy.
|
|
18251
18052
|
*/
|
|
18252
|
-
var
|
|
18053
|
+
var RetrainStatusSchema = _enum([
|
|
18054
|
+
"none",
|
|
18055
|
+
"staging",
|
|
18056
|
+
"trained"
|
|
18057
|
+
]);
|
|
18253
18058
|
/**
|
|
18254
|
-
*
|
|
18059
|
+
* Per-track OPERATOR flags — set by hand from the admin UI or the viewer, never
|
|
18060
|
+
* by the pipeline. Spread into `TrackSchema` and `KeyEventSchema` from one place
|
|
18061
|
+
* so the two surfaces cannot drift.
|
|
18255
18062
|
*
|
|
18256
|
-
*
|
|
18257
|
-
*
|
|
18258
|
-
*
|
|
18259
|
-
*
|
|
18260
|
-
*
|
|
18063
|
+
* **Absent ≠ false.** A track that has never been touched omits the field; an
|
|
18064
|
+
* explicitly un-flagged track carries `false`. Legacy rows written before the
|
|
18065
|
+
* columns existed read as absent, and a consumer that needs a boolean should say
|
|
18066
|
+
* `flag === true`, not `flag !== false`.
|
|
18067
|
+
*
|
|
18068
|
+
* `markForTrain` is the WIRE FACE of {@link RetrainStatusSchema}, not a column:
|
|
18069
|
+
* it is exactly `retrainStatus === 'staging'`, in both directions. Writing
|
|
18070
|
+
* `true` moves `none → staging`, writing `false` moves `staging → none`, and a
|
|
18071
|
+
* `trained` track reports `false` while refusing both writes. The boolean is
|
|
18072
|
+
* kept because three surfaces drive a toggle off it; anything that needs to tell
|
|
18073
|
+
* "never marked" from "already trained" must read `retrainStatus`.
|
|
18074
|
+
*
|
|
18075
|
+
* `debug` does NOT pin; it is attention, not durability.
|
|
18076
|
+
*
|
|
18077
|
+
* `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
|
|
18078
|
+
* A favourited track is skipped by retention the same way `staging` is, but
|
|
18079
|
+
* it does not enter `none|staging|trained` and has no staging budget.
|
|
18261
18080
|
*/
|
|
18262
|
-
var
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
});
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18307
|
-
|
|
18308
|
-
|
|
18309
|
-
|
|
18310
|
-
|
|
18311
|
-
|
|
18312
|
-
|
|
18313
|
-
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18328
|
-
|
|
18329
|
-
|
|
18330
|
-
|
|
18331
|
-
|
|
18332
|
-
|
|
18333
|
-
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
* `device-manager.getLinkedDevices`, mapped through `EVENT_KIND_BY_CAP`).
|
|
18369
|
-
*/
|
|
18370
|
-
listEventKinds: method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()),
|
|
18371
|
-
/**
|
|
18372
|
-
* The same answer for many cameras in ONE call.
|
|
18373
|
-
*
|
|
18374
|
-
* `listEventKinds` is the slowest per-device query on the hub — measured
|
|
18375
|
-
* at ~100 ms against 6-11 ms for its neighbours — because composing it
|
|
18376
|
-
* costs a `getCameraStatus`, a `getLinkedDevices` and one `getBindings`
|
|
18377
|
-
* per linked device. The viewer asks for it once per camera at first
|
|
18378
|
-
* paint, so twelve cameras paid twelve of those round-trips on top of the
|
|
18379
|
-
* per-camera cost.
|
|
18380
|
-
*
|
|
18381
|
-
* Batched, the camera statuses come from ONE `getCameraStatuses` instead
|
|
18382
|
-
* of N, and the per-device composition runs concurrently.
|
|
18383
|
-
*
|
|
18384
|
-
* Per-device rather than pre-merged on purpose: a caller that renders one
|
|
18385
|
-
* camera's lanes needs to know WHICH camera a kind came from, and merging
|
|
18386
|
-
* is three lines the caller can do. `listEventKinds` stays for
|
|
18387
|
-
* single-device callers.
|
|
18388
|
-
*/
|
|
18389
|
-
listEventKindsBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()),
|
|
18390
|
-
/**
|
|
18391
|
-
* Sensor-event history for a camera: state changes of LINKED sensor
|
|
18392
|
-
* devices, attributed to the camera at ingest time (one row per linked
|
|
18393
|
-
* camera). Mirrors `getAudioEvents` query semantics; `kinds` narrows to
|
|
18394
|
-
* a kind subset.
|
|
18395
|
-
*/
|
|
18396
|
-
getSensorEvents: method(object({
|
|
18397
|
-
deviceId: number(),
|
|
18398
|
-
since: number().optional(),
|
|
18399
|
-
until: number().optional(),
|
|
18400
|
-
kinds: array(string()).optional(),
|
|
18401
|
-
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
|
|
18402
|
-
}), array(SensorEventSchema).readonly()),
|
|
18403
|
-
/**
|
|
18404
|
-
* Importance-ranked highlights for a device+window. Queries completed
|
|
18405
|
-
* tracks by (deviceId, firstSeen ∈ [since,until]), scores each (or reuses
|
|
18406
|
-
* the persisted score), filters by minImportance/classFilter, orders by
|
|
18407
|
-
* importance desc, and returns up to `limit` compact key events mapped to
|
|
18408
|
-
* each track's best event. Legacy tracks lacking a persisted score are
|
|
18409
|
-
* scored on-read (no write). Degrades to `[]` on error.
|
|
18410
|
-
*/
|
|
18411
|
-
getKeyEvents: method(KeyEventQueryInput, array(KeyEventSchema).readonly()),
|
|
18412
|
-
/** Server-side bucketed event counts for the 24-hour timeline.
|
|
18413
|
-
* Returns one entry per non-empty bucket; empty buckets are omitted. */
|
|
18414
|
-
getEventDensity: method(object({
|
|
18415
|
-
deviceId: number(),
|
|
18416
|
-
since: number(),
|
|
18417
|
-
until: number(),
|
|
18418
|
-
bucketMs: number().int().positive()
|
|
18419
|
-
}), array(object({
|
|
18420
|
-
bucketStart: number(),
|
|
18421
|
-
motion: number().int(),
|
|
18422
|
-
object: number().int(),
|
|
18423
|
-
audio: number().int()
|
|
18424
|
-
})).readonly()),
|
|
18425
|
-
/**
|
|
18426
|
-
* @deprecated Prefer `pruneTracksBefore` — the track is the ROOT of the
|
|
18427
|
-
* analytics model and retention must cascade from it (design §5.1). This
|
|
18428
|
-
* event-only prune leaves orphaned tracks/faces/plates/embeddings behind.
|
|
18429
|
-
* Retained as a compat shim for the Phase-B3 recorder orchestration caller,
|
|
18430
|
-
* which prunes events to keep history aligned with available footage and
|
|
18431
|
-
* reads the per-kind counts. Delete all events (motion + object + audio)
|
|
18432
|
-
* for the given device older than `cutoffMs` (exclusive) + their thumbnails
|
|
18433
|
-
* in lockstep; returns per-kind deleted counts.
|
|
18434
|
-
*/
|
|
18435
|
-
pruneEventsBefore: method(object({
|
|
18436
|
-
deviceId: number(),
|
|
18437
|
-
cutoffMs: number()
|
|
18438
|
-
}), object({
|
|
18439
|
-
motion: number().int(),
|
|
18440
|
-
object: number().int(),
|
|
18441
|
-
audio: number().int()
|
|
18442
|
-
}), {
|
|
18443
|
-
kind: "mutation",
|
|
18444
|
-
auth: "admin"
|
|
18445
|
-
}),
|
|
18446
|
-
/**
|
|
18447
|
-
* Track-centric retention entry point (design §5.1). Selects every
|
|
18448
|
-
* persisted track for the device whose `lastSeen < cutoffMs` (paged) and
|
|
18449
|
-
* runs the extensible whole-track deletion cascade (design §3): object
|
|
18450
|
-
* events + their media, track/face/plate-owned media, unassigned face
|
|
18451
|
-
* reads, per-track CLIP embeddings, then the track root LAST. ENROLLED
|
|
18452
|
-
* (assigned) faces/plates and `ownerKind:'identity'` media are exempt —
|
|
18453
|
-
* the durable matching gallery always persists. Fires the per-track
|
|
18454
|
-
* live-state cleanup so a pruned track can't linger in dispatch/overlay
|
|
18455
|
-
* state. Returns per-family deleted counts (`tracks` authoritative).
|
|
18456
|
-
*
|
|
18457
|
-
* Replaces `pruneEventsBefore` as the correct time-based retention prune.
|
|
18458
|
-
*/
|
|
18459
|
-
pruneTracksBefore: method(object({
|
|
18460
|
-
deviceId: number(),
|
|
18461
|
-
cutoffMs: number()
|
|
18462
|
-
}), TrackCascadeCountsSchema, {
|
|
18463
|
-
kind: "mutation",
|
|
18464
|
-
auth: "admin"
|
|
18465
|
-
}),
|
|
18466
|
-
/**
|
|
18467
|
-
* Operator "clean slate" for a device (design §5.3): prune EVERY track for
|
|
18468
|
-
* the device via the same cascade as `pruneTracksBefore` with `cutoffMs =
|
|
18469
|
-
* now`. One call per device — no client-side track enumeration. Enrolled
|
|
18470
|
-
* gallery + identity media are exempt (design §4). Returns per-family
|
|
18471
|
-
* deleted counts.
|
|
18472
|
-
*/
|
|
18473
|
-
wipeAllAnalytics: method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
|
|
18474
|
-
kind: "mutation",
|
|
18475
|
-
auth: "admin"
|
|
18476
|
-
}),
|
|
18477
|
-
/**
|
|
18478
|
-
* Disk-wins reconcile for one camera. Drops media index rows whose blobs
|
|
18479
|
-
* are gone, then cascades tracks (including favourited and staging) that
|
|
18480
|
-
* have no remaining files. Enrolled identity/vehicle/scene media is never
|
|
18481
|
-
* probed. Trackless motion/audio events with no remaining file are dropped,
|
|
18482
|
-
* including snapshot-less rows.
|
|
18483
|
-
*/
|
|
18484
|
-
reconcileFromDisk: method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
|
|
18485
|
-
kind: "mutation",
|
|
18486
|
-
auth: "admin"
|
|
18487
|
-
}),
|
|
18488
|
-
/**
|
|
18489
|
-
* Delete whole tracks (object events) by id for the given device,
|
|
18490
|
-
* cascading their media in lockstep. Returns the number of tracks
|
|
18491
|
-
* actually deleted plus the ids that could not be removed.
|
|
18492
|
-
*
|
|
18493
|
-
* Operator-driven from the DI Events page (batch delete). Routes through
|
|
18494
|
-
* the same widened track-deletion cascade (design §5.2).
|
|
18495
|
-
*/
|
|
18496
|
-
deleteTracks: method(object({
|
|
18497
|
-
deviceId: number(),
|
|
18498
|
-
trackIds: array(string()).min(1)
|
|
18499
|
-
}), object({
|
|
18500
|
-
deleted: number().int(),
|
|
18501
|
-
failed: array(string()).readonly()
|
|
18502
|
-
}), {
|
|
18503
|
-
kind: "mutation",
|
|
18504
|
-
auth: "admin"
|
|
18505
|
-
}),
|
|
18506
|
-
/**
|
|
18507
|
-
* Set the per-track operator flags (`markForTrain`, `debug`, `favourited`) on ONE track.
|
|
18508
|
-
* The patch is PARTIAL — an omitted key is left untouched — because the
|
|
18509
|
-
* three surfaces that write it (admin Events grid, viewer track detail,
|
|
18510
|
-
* viewer cluster detail) each own one toggle and must not clobber the other.
|
|
18511
|
-
*
|
|
18512
|
-
* Writes the track ROW: `markForTrain`/`debug` are per-TRACK state, so they
|
|
18513
|
-
* live where `label` and `importance` live, not in any per-device settings
|
|
18514
|
-
* store. Updates the in-RAM active track too, so a flag set on a live track
|
|
18515
|
-
* survives its expiry-time persist.
|
|
18516
|
-
*
|
|
18517
|
-
* `auth: 'protected'` (the default), NOT `admin`: the viewer is an
|
|
18518
|
-
* authenticated non-admin surface and two of the three call sites are
|
|
18519
|
-
* there. The note that used to sit here said to revisit this the day a flag
|
|
18520
|
-
* gained an effect that costs storage, and D81 is that day — `markForTrain`
|
|
18521
|
-
* now pins. It STAYS protected, and the reason is that the alternative
|
|
18522
|
-
* makes the feature pointless: marking a track is something you do while
|
|
18523
|
-
* looking at it, on the surface you were already looking at it on, and that
|
|
18524
|
-
* surface is the viewer. What the storage cost gets instead is a BOUND — a
|
|
18525
|
-
* per-device pin budget enforced in the body, refusing a new pin past the
|
|
18526
|
-
* limit while always allowing un-marking. `deleteTracks` next door is still
|
|
18527
|
-
* admin, because destroying evidence and preserving it are not symmetric.
|
|
18528
|
-
*
|
|
18529
|
-
* `markForTrain` writes the retrain LIFECYCLE, not a boolean column: `true`
|
|
18530
|
-
* is `none → staging`, `false` is `staging → none`. A track already
|
|
18531
|
-
* `trained` refuses BOTH — its frames are copies inside the retrain dataset
|
|
18532
|
-
* and re-staging it from a generic toggle is how the same material gets
|
|
18533
|
-
* annotated twice under two ground truths. Returning a trained track to
|
|
18534
|
-
* staging is a deliberate action of the retrain page, which is also the only
|
|
18535
|
-
* thing that produces `trained` in the first place.
|
|
18536
|
-
*
|
|
18537
|
-
* Returns the RESOLVED state of both flags (absent → `false`) plus the
|
|
18538
|
-
* `retrainStatus` they were derived from, so a caller can drive its toggle
|
|
18539
|
-
* — and render a `trained` badge — without a re-fetch. Rejects an unknown
|
|
18540
|
-
* track, a new staging mark on a device already holding its full budget, and
|
|
18541
|
-
* any `markForTrain` write against a trained track.
|
|
18542
|
-
*/
|
|
18543
|
-
setTrackFlags: method(object({
|
|
18544
|
-
/** Log/audit scope only — the trackId is globally unique on its own. */
|
|
18545
|
-
deviceId: number(),
|
|
18546
|
-
trackId: string(),
|
|
18547
|
-
flags: TrackFlagsPatchSchema
|
|
18548
|
-
}), TrackFlagsSchema, { kind: "mutation" }),
|
|
18549
|
-
/**
|
|
18550
|
-
* Durable event-store footprint for the management UI: event rows
|
|
18551
|
-
* (motion + object + audio) counted per camera + total, plus the
|
|
18552
|
-
* event-owned media bytes on disk per camera + total. Stat/count-based,
|
|
18553
|
-
* computed on demand.
|
|
18554
|
-
*/
|
|
18555
|
-
getEventStoreFootprint: method(object({}), EventStoreFootprintSchema, {
|
|
18556
|
-
kind: "query",
|
|
18557
|
-
auth: "admin"
|
|
18558
|
-
}),
|
|
18559
|
-
/**
|
|
18560
|
-
* Cluster-wide prune of events older than `olderThanMs` (exclusive) across
|
|
18561
|
-
* every camera, deleting each event's media in lockstep. Logged to the
|
|
18562
|
-
* events ops-log with `reason` (default `'retention'`). Returns the summed
|
|
18563
|
-
* per-kind deleted counts.
|
|
18564
|
-
*/
|
|
18565
|
-
pruneEvents: method(object({
|
|
18566
|
-
olderThanMs: number(),
|
|
18567
|
-
reason: OpsLogReasonSchema.optional()
|
|
18568
|
-
}), EventPruneCountsSchema, {
|
|
18569
|
-
kind: "mutation",
|
|
18570
|
-
auth: "admin"
|
|
18571
|
-
}),
|
|
18572
|
-
/**
|
|
18573
|
-
* Manually delete EVERY event (motion + object + audio) for one camera and
|
|
18574
|
-
* its event-owned media in lockstep. Logged to the events ops-log as
|
|
18575
|
-
* `op:'manual-delete', reason:'manual'`. Destructive — the admin UI guards
|
|
18576
|
-
* it behind a confirm.
|
|
18577
|
-
*/
|
|
18578
|
-
deleteDeviceEvents: method(object({ deviceId: number() }), EventPruneCountsSchema, {
|
|
18579
|
-
kind: "mutation",
|
|
18580
|
-
auth: "admin"
|
|
18581
|
-
}),
|
|
18582
|
-
/** The events ops-log rows (newest-first), optionally scoped to one camera.
|
|
18583
|
-
* Backed by a declared pipeline-analytics SQLite collection. */
|
|
18584
|
-
/** Internal migration-participant lease. It drains active MediaStore
|
|
18585
|
-
* writes and refuses new ones without changing analytics bindings. */
|
|
18586
|
-
pauseForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
|
|
18587
|
-
kind: "mutation",
|
|
18588
|
-
auth: "admin"
|
|
18589
|
-
}),
|
|
18590
|
-
resumeForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
|
|
18591
|
-
kind: "mutation",
|
|
18592
|
-
auth: "admin"
|
|
18593
|
-
}),
|
|
18594
|
-
/** Drops cached location roots after the storage coordinator repoints a
|
|
18595
|
-
* default so future event-media writes use the new root. */
|
|
18596
|
-
refreshStorageLocationsForMigration: method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
|
|
18597
|
-
kind: "mutation",
|
|
18598
|
-
auth: "admin"
|
|
18599
|
-
}),
|
|
18600
|
-
startStorageMigrationMove: method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
|
|
18601
|
-
kind: "mutation",
|
|
18602
|
-
auth: "admin"
|
|
18603
|
-
}),
|
|
18604
|
-
getStorageMigrationMoveStatus: method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }),
|
|
18605
|
-
cancelStorageMigrationMove: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
18606
|
-
kind: "mutation",
|
|
18607
|
-
auth: "admin"
|
|
18608
|
-
}),
|
|
18609
|
-
/**
|
|
18610
|
-
* Moves event media between locations — the OPERATOR's mover, without the
|
|
18611
|
-
* coordinator's lease. Twin of `recording.relocateFootage`: the same
|
|
18612
|
-
* engine the lease-gated coordinated migration uses
|
|
18613
|
-
* (`startStorageMigrationMove`), armable in the background and WITHOUT
|
|
18614
|
-
* pausing anything. Exists because `eventMedia` was the only storage
|
|
18615
|
-
* class whose only move path went through the recorder's global pause.
|
|
18616
|
-
*/
|
|
18617
|
-
relocateMedia: method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
18618
|
-
kind: "mutation",
|
|
18619
|
-
auth: "admin"
|
|
18620
|
-
}),
|
|
18621
|
-
/** Every relocate job this addon knows about, newest first (in RAM: the
|
|
18622
|
-
* move is resumable, so a lost list costs nothing but the display). */
|
|
18623
|
-
listRelocateMediaJobs: method(object({}), array(RelocateJobSchema).readonly(), {
|
|
18624
|
-
kind: "query",
|
|
18625
|
-
auth: "admin"
|
|
18626
|
-
}),
|
|
18627
|
-
/** Cancel a running or queued relocate job. */
|
|
18628
|
-
cancelRelocateMedia: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
18629
|
-
kind: "mutation",
|
|
18630
|
-
auth: "admin"
|
|
18631
|
-
}),
|
|
18632
|
-
listOpsLog: method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
18633
|
-
kind: "query",
|
|
18634
|
-
auth: "admin"
|
|
18635
|
-
}),
|
|
18636
|
-
/**
|
|
18637
|
-
* The CHEAP QUESTION, asked before any media moves: how big is the dataset
|
|
18638
|
-
* the marked (`markForTrain`) tracks would produce?
|
|
18639
|
-
*
|
|
18640
|
-
* Answered from media INDEX rows only — key, kind, size, timestamp — so it
|
|
18641
|
-
* costs ~2 KB of reads per track and no blob reads at all. The measured harm
|
|
18642
|
-
* behind D56 was a bulk pass that read and base64'd every blob a track owned
|
|
18643
|
-
* before deciding anything, taking hub-main to 82 s busy out of 120; an
|
|
18644
|
-
* export is that same I/O shape, so it inherits the same discipline: know
|
|
18645
|
-
* the size, then decide.
|
|
18646
|
-
*
|
|
18647
|
-
* `truncated` reports that more marked tracks exist than one pass carries.
|
|
18648
|
-
* Empty `deviceIds` ⇒ every device that has marked tracks.
|
|
18649
|
-
*/
|
|
18650
|
-
getTrainingExportSummary: method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
|
|
18651
|
-
kind: "query",
|
|
18652
|
-
auth: "admin"
|
|
18653
|
-
}),
|
|
18654
|
-
/**
|
|
18655
|
-
* Where to download the dataset archive.
|
|
18656
|
-
*
|
|
18657
|
-
* The BYTES do not come back through this cap — they come from the returned
|
|
18658
|
-
* data-plane URL, which streams a tar built entry by entry. A multi-gigabyte
|
|
18659
|
-
* archive base64'd through a unary RPC envelope would be held whole in
|
|
18660
|
-
* memory twice on a hub this repo has already OOM'd once (D9/D18 are the
|
|
18661
|
-
* same lesson about frames). `getDownloadUrl` on `recordingExport` is the
|
|
18662
|
-
* precedent, and this follows it deliberately.
|
|
18663
|
-
*
|
|
18664
|
-
* The archive contains a `manifest.json` FIRST, then the stored media
|
|
18665
|
-
* VERBATIM under `tracks/<deviceId>/<trackId>/…`. No crop is derived and no
|
|
18666
|
-
* model is run: a training set's pixels must be the pixels the pipeline saw.
|
|
18667
|
-
*/
|
|
18668
|
-
getTrainingExportUrl: method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
18669
|
-
kind: "query",
|
|
18670
|
-
auth: "admin"
|
|
18671
|
-
}),
|
|
18672
|
-
/**
|
|
18673
|
-
* The staging worklist for one camera, or for every camera that has one.
|
|
18674
|
-
*
|
|
18675
|
-
* Fetched ON DEMAND, over the staging set only — the page never scans
|
|
18676
|
-
* history, because making the working set small is the entire purpose of
|
|
18677
|
-
* the mark. Each row carries how many frames the dataset already holds from
|
|
18678
|
-
* the track and how many subjects were annotated on them, so
|
|
18679
|
-
* `frameCount: 0` reads as "still to work" without a second call per track.
|
|
18680
|
-
*
|
|
18681
|
-
* `auth: 'admin'`, unlike the viewer-level mark itself: marking a track is
|
|
18682
|
-
* curation you do while looking at it, but building the training set the
|
|
18683
|
-
* fleet's models are fine-tuned on is not.
|
|
18684
|
-
*/
|
|
18685
|
-
listRetrainStaging: method(object({
|
|
18686
|
-
/** Empty ⇒ every camera that has staging tracks. A LIST, not a single
|
|
18687
|
-
* `deviceId`, deliberately: `deviceId` would make this device-bound and
|
|
18688
|
-
* route it at one camera's owner, and "every camera" would stop being
|
|
18689
|
-
* expressible at all. */
|
|
18690
|
-
deviceIds: array(number()).optional(),
|
|
18691
|
-
limit: number().int().min(1).max(500).optional()
|
|
18692
|
-
}), array(RetrainTrackSchema).readonly(), {
|
|
18693
|
-
kind: "query",
|
|
18694
|
-
auth: "admin"
|
|
18695
|
-
}),
|
|
18696
|
-
/**
|
|
18697
|
-
* What a track can contribute, and what it already has.
|
|
18698
|
-
*
|
|
18699
|
-
* `candidates` are the track's whole, unannotated frames — index rows only,
|
|
18700
|
-
* so this is cheap. `copies` are the frames already inside the dataset, and
|
|
18701
|
-
* a candidate whose copy exists is marked `copied: true`: selecting it again
|
|
18702
|
-
* is free and CANNOT fail, whatever became of the original.
|
|
18703
|
-
*
|
|
18704
|
-
* A crop, a thumbnail and `fullFrameBoxed` are never candidates. The last
|
|
18705
|
-
* one matters most: it has the model's own rectangle burned into the pixels,
|
|
18706
|
-
* and a detector trained on it learns to find a green line.
|
|
18707
|
-
*/
|
|
18708
|
-
listRetrainFrames: method(object({ trackId: string() }), RetrainFrameListSchema, {
|
|
18709
|
-
kind: "query",
|
|
18710
|
-
auth: "admin"
|
|
18711
|
-
}),
|
|
18712
|
-
/**
|
|
18713
|
-
* COPY-ON-SELECT — the write that makes `trained` safe to evict.
|
|
18714
|
-
*
|
|
18715
|
-
* Selecting a frame copies its bytes into retrain storage immediately: not
|
|
18716
|
-
* a reference, not a lease. Once the copy exists the dataset no longer
|
|
18717
|
-
* depends on the track's media, which is exactly what lets D81 hand a
|
|
18718
|
-
* `trained` track back to retention.
|
|
18719
|
-
*
|
|
18720
|
-
* The order inside is load-bearing and is pinned by a test: an EXISTING
|
|
18721
|
-
* copy is returned without touching the source, so an original that
|
|
18722
|
-
* evaporated blocks the selection of THAT ORIGINAL and never the copy
|
|
18723
|
-
* already taken. Every refusal comes back named — a dropped selection is
|
|
18724
|
-
* never silent, on the wire or in the log.
|
|
18725
|
-
*/
|
|
18726
|
-
selectRetrainFrames: method(object({
|
|
18727
|
-
deviceId: number(),
|
|
18728
|
-
trackId: string(),
|
|
18729
|
-
mediaKeys: array(string()).min(1)
|
|
18730
|
-
}), RetrainFrameSelectionSchema, {
|
|
18731
|
-
kind: "mutation",
|
|
18732
|
-
auth: "admin"
|
|
18733
|
-
}),
|
|
18734
|
-
/** Un-select a frame: its annotations go first, then the copy and its blob.
|
|
18735
|
-
* Deliberately destructive and deliberately explicit — it is the only way
|
|
18736
|
-
* a frame leaves the dataset before export. */
|
|
18737
|
-
deselectRetrainFrame: method(object({
|
|
18738
|
-
deviceId: number(),
|
|
18739
|
-
trackId: string(),
|
|
18740
|
-
frameId: string()
|
|
18741
|
-
}), object({
|
|
18742
|
-
removed: boolean(),
|
|
18743
|
-
removedAnnotations: number().int()
|
|
18744
|
-
}), {
|
|
18745
|
-
kind: "mutation",
|
|
18746
|
-
auth: "admin"
|
|
18747
|
-
}),
|
|
18748
|
-
/**
|
|
18749
|
-
* The pixels of ONE copied frame, base64.
|
|
18750
|
-
*
|
|
18751
|
-
* Through the cap rather than a data plane because it is genuinely one
|
|
18752
|
-
* frame at a time, on demand, at human speed — the shape D9/D18 permit
|
|
18753
|
-
* (what they forbid is frames crossing a boundary at frame RATE). The
|
|
18754
|
-
* annotation canvas needs the image and its exact dimensions in the same
|
|
18755
|
-
* answer: a canvas that places a normalised box against a size it guessed
|
|
18756
|
-
* draws every box in the wrong place.
|
|
18757
|
-
*/
|
|
18758
|
-
getRetrainFrameImage: method(object({ frameId: string() }), object({
|
|
18759
|
-
base64: string(),
|
|
18760
|
-
width: number().int(),
|
|
18761
|
-
height: number().int()
|
|
18762
|
-
}), {
|
|
18763
|
-
kind: "query",
|
|
18764
|
-
auth: "admin"
|
|
18765
|
-
}),
|
|
18766
|
-
/**
|
|
18767
|
-
* Ask the pipeline what it sees, as a PROPOSAL.
|
|
18768
|
-
*
|
|
18769
|
-
* Runs through `pipelineRunner.runStatelessStep` on the COPIED frame, and
|
|
18770
|
-
* every box comes back as a draft with `source: 'assist'` plus the model and
|
|
18771
|
-
* score that produced it. The operator confirms, edits, adds and deletes;
|
|
18772
|
-
* nothing is stored until `saveRetrainAnnotations`.
|
|
18773
|
-
*
|
|
18774
|
-
* For packages the request is `rfdetr-package` on the ZONE CROP at 0.35 —
|
|
18775
|
-
* never the whole frame, where a package detector at that threshold proposes
|
|
18776
|
-
* furniture. A package request with no zone is REFUSED rather than widened,
|
|
18777
|
-
* because the silent widening would look like a bad model for as long as
|
|
18778
|
-
* nobody checked which rectangle it ran on.
|
|
18779
|
-
*/
|
|
18780
|
-
proposeRetrainAnnotations: method(object({
|
|
18781
|
-
deviceId: number(),
|
|
18782
|
-
trackId: string(),
|
|
18783
|
-
frameId: string(),
|
|
18784
|
-
subject: RetrainAssistSubjectSchema,
|
|
18785
|
-
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
18786
|
-
nodeId: string().optional()
|
|
18787
|
-
}), RetrainAssistResultSchema, {
|
|
18788
|
-
kind: "mutation",
|
|
18789
|
-
auth: "admin"
|
|
18790
|
-
}),
|
|
18791
|
-
/** Every annotation on a track, oldest first. */
|
|
18792
|
-
listRetrainAnnotations: method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
18793
|
-
kind: "query",
|
|
18794
|
-
auth: "admin"
|
|
18795
|
-
}),
|
|
18796
|
-
/**
|
|
18797
|
-
* Replace EVERY annotation on one frame with the supplied set.
|
|
18798
|
-
*
|
|
18799
|
-
* Whole-frame replacement, not per-box upsert: the unit of ground truth is
|
|
18800
|
-
* the frame, and "the operator deleted a box" must be the same durable
|
|
18801
|
-
* outcome as "the operator never drew it". A per-box patch would let a frame
|
|
18802
|
-
* keep a box the operator removed on a surface that only knew about the
|
|
18803
|
-
* boxes it sent.
|
|
18804
|
-
*
|
|
18805
|
-
* Refuses a macro class typed into `label` or `subLabel` — the tiers are
|
|
18806
|
-
* separate and the guard is at the WRITE, because a mixed taxonomy cannot
|
|
18807
|
-
* be un-mixed by reading it.
|
|
18808
|
-
*/
|
|
18809
|
-
saveRetrainAnnotations: method(object({
|
|
18810
|
-
deviceId: number(),
|
|
18811
|
-
trackId: string(),
|
|
18812
|
-
frameId: string(),
|
|
18813
|
-
annotations: array(RetrainAnnotationDraftSchema)
|
|
18814
|
-
}), array(RetrainAnnotationSchema).readonly(), {
|
|
18815
|
-
kind: "mutation",
|
|
18816
|
-
auth: "admin"
|
|
18817
|
-
}),
|
|
18818
|
-
/**
|
|
18819
|
-
* Finish with a track: `staging → trained`. **The only writer of that
|
|
18820
|
-
* state** — D81 shipped the column with it deliberately unreachable.
|
|
18821
|
-
*
|
|
18822
|
-
* Refuses a track the dataset holds no copies from. `trained` un-pins the
|
|
18823
|
-
* track's media, so completing without a copy is a delete order for material
|
|
18824
|
-
* nothing ever extracted anything from; that refusal IS the safety argument
|
|
18825
|
-
* of D81, expressed as a precondition.
|
|
18826
|
-
*/
|
|
18827
|
-
completeRetrainTrack: method(object({
|
|
18828
|
-
deviceId: number(),
|
|
18829
|
-
trackId: string()
|
|
18830
|
-
}), RetrainTransitionResultSchema, {
|
|
18831
|
-
kind: "mutation",
|
|
18832
|
-
auth: "admin"
|
|
18833
|
-
}),
|
|
18834
|
-
/**
|
|
18835
|
-
* The deliberate return: `trained → staging`, for the rare case.
|
|
18836
|
-
*
|
|
18837
|
-
* The generic `setTrackFlags` toggle refuses this in both directions by
|
|
18838
|
-
* design (D81) — re-staging from a checkbox is how the same material gets
|
|
18839
|
-
* annotated twice under two ground truths. Doing it here means the operator
|
|
18840
|
-
* is looking at the annotations that already exist while they decide, and
|
|
18841
|
-
* those annotations are LEFT ALONE: "put this back" must not be a
|
|
18842
|
-
* destructive act wearing a navigational name.
|
|
18843
|
-
*/
|
|
18844
|
-
restageRetrainTrack: method(object({
|
|
18845
|
-
deviceId: number(),
|
|
18846
|
-
trackId: string()
|
|
18847
|
-
}), RetrainTransitionResultSchema, {
|
|
18848
|
-
kind: "mutation",
|
|
18849
|
-
auth: "admin"
|
|
18850
|
-
}),
|
|
18851
|
-
/**
|
|
18852
|
-
* Where to download the ANNOTATED dataset.
|
|
18853
|
-
*
|
|
18854
|
-
* The sibling of `getTrainingExportUrl` and deliberately not the same
|
|
18855
|
-
* archive: that one streams a marked track's stored media verbatim, this one
|
|
18856
|
-
* streams the retrain COPIES plus an `annotations.json` carrying, for every
|
|
18857
|
-
* subject, the canonical full-frame box AND the geometry derived for each
|
|
18858
|
-
* model shape (letterboxed root / zone-cropped package / subject-cropped
|
|
18859
|
-
* classifier). Derived at export, never stored — one box in, three shapes
|
|
18860
|
-
* out, so two crops of the same subject can never end up in one feature
|
|
18861
|
-
* space (D52).
|
|
18862
|
-
*/
|
|
18863
|
-
getRetrainExportUrl: method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
18864
|
-
kind: "query",
|
|
18865
|
-
auth: "admin"
|
|
18866
|
-
}),
|
|
18867
|
-
getEventMedia: method(object({
|
|
18868
|
-
eventId: string(),
|
|
18869
|
-
kind: MediaFileKindEnum.optional(),
|
|
18870
|
-
deviceId: number()
|
|
18871
|
-
}), array(MediaFileSchema).readonly()),
|
|
18872
|
-
/** All media rows owned by a track. `kinds` narrows to a kind subset so a
|
|
18873
|
-
* client can fetch the SMALL display variants on open and pull the
|
|
18874
|
-
* multi-MB native variants only on demand (mirrors `getEventMedia.kind`).
|
|
18875
|
-
* Absent ⇒ every kind (back-compat). */
|
|
18876
|
-
getTrackMedia: method(object({
|
|
18877
|
-
trackId: string(),
|
|
18878
|
-
kinds: array(MediaFileKindEnum).optional(),
|
|
18879
|
-
deviceId: number()
|
|
18880
|
-
}), array(MediaFileSchema).readonly()),
|
|
18881
|
-
/**
|
|
18882
|
-
* What media a track HAS, without any of it.
|
|
18883
|
-
*
|
|
18884
|
-
* The detail view needs the shape of a track's media to build its strip —
|
|
18885
|
-
* which kinds exist, in what order, at what size — and then wants each tile
|
|
18886
|
-
* fetched as an image, not as base64 inside this response. Measured: the
|
|
18887
|
-
* full `getTrackMedia` is 5.3-7.7 MB and blocks the view; this manifest is
|
|
18888
|
-
* ~2 KB.
|
|
18889
|
-
*
|
|
18890
|
-
* It also restores a fact a `kinds` filter destroys: filtering
|
|
18891
|
-
* `getTrackMedia` drops whole ROWS, taking `kind` and `sizeBytes` with
|
|
18892
|
-
* them, so a client that fetched only the small variants could no longer
|
|
18893
|
-
* tell a full-resolution variant existed — and the affordance that opens it
|
|
18894
|
-
* would silently disappear.
|
|
18895
|
-
*/
|
|
18896
|
-
listTrackMedia: method(object({
|
|
18897
|
-
trackId: string(),
|
|
18898
|
-
deviceId: number()
|
|
18899
|
-
}), array(MediaFileInfoSchema).readonly()),
|
|
18900
|
-
/**
|
|
18901
|
-
* Search object events by text query using CLIP cosine similarity.
|
|
18902
|
-
* Encodes `text` via the `embedding-encoder` cap, queries the
|
|
18903
|
-
* `ObjectEmbeddingStore` with optional prefilters, ranks all matching
|
|
18904
|
-
* embeddings by cosine similarity, and joins winners to their
|
|
18905
|
-
* ObjectEvents by trackId. Returns up to `limit` events scored ≥
|
|
18906
|
-
* `minScore`, sorted descending by score.
|
|
18907
|
-
*/
|
|
18908
|
-
searchObjectEvents: method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()),
|
|
18909
|
-
wipeObjectEmbeddings: method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
18910
|
-
kind: "mutation",
|
|
18911
|
-
auth: "admin"
|
|
18912
|
-
}),
|
|
18913
|
-
rebuildObjectEmbeddings: method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
18914
|
-
kind: "mutation",
|
|
18915
|
-
auth: "admin"
|
|
18916
|
-
}),
|
|
18917
|
-
getObjectEmbeddingRebuildStatus: method(object({}), RebuildStatusSchema)
|
|
18918
|
-
},
|
|
18919
|
-
events: {
|
|
18920
|
-
/**
|
|
18921
|
-
* Enriched frame emitted after refinement — the live-overlay source of
|
|
18922
|
-
* truth (two-plane re-injection). Carries the frame's detections in the
|
|
18923
|
-
* `ObjectDetection` wire shape: first-level roots (with track info +
|
|
18924
|
-
* enrichment labels) plus synthesized `kind:'detail'` face/plate entries
|
|
18925
|
-
* re-projected from per-track detail state, so stream overlays render
|
|
18926
|
-
* boxes + recognized names without querying full Track state.
|
|
18927
|
-
*/
|
|
18928
|
-
onFrameTracked: { data: object({
|
|
18929
|
-
deviceId: number(),
|
|
18930
|
-
timestamp: number(),
|
|
18931
|
-
frameWidth: number(),
|
|
18932
|
-
frameHeight: number(),
|
|
18933
|
-
detections: array(OverlayDetectionSchema).readonly()
|
|
18934
|
-
}) },
|
|
18935
|
-
/** Track entered active state (first-seen). */
|
|
18936
|
-
onTrackStarted: { data: object({
|
|
18937
|
-
deviceId: number(),
|
|
18938
|
-
trackId: string(),
|
|
18939
|
-
className: string()
|
|
18940
|
-
}) },
|
|
18941
|
-
/** Track expired (TTL reached after last detection). */
|
|
18942
|
-
onTrackEnded: { data: object({
|
|
18943
|
-
deviceId: number(),
|
|
18944
|
-
trackId: string(),
|
|
18945
|
-
className: string(),
|
|
18946
|
-
durationMs: number()
|
|
18947
|
-
}) },
|
|
18948
|
-
/** Canonical "something happened at device X" event, per-kind. */
|
|
18949
|
-
onDetectionEvent: { data: object({
|
|
18950
|
-
deviceId: number(),
|
|
18951
|
-
kind: EventKindSchema,
|
|
18952
|
-
eventId: string(),
|
|
18953
|
-
timestamp: number()
|
|
18954
|
-
}) }
|
|
18955
|
-
}
|
|
18081
|
+
var TrackFlagFields = {
|
|
18082
|
+
/** Operator marked this track as training material — i.e. `retrainStatus` is
|
|
18083
|
+
* `'staging'`. */
|
|
18084
|
+
markForTrain: boolean().optional(),
|
|
18085
|
+
/** Operator marked this track for diagnostic attention. */
|
|
18086
|
+
debug: boolean().optional(),
|
|
18087
|
+
/** Operator favourited this track. Pins it against pruning. */
|
|
18088
|
+
favourited: boolean().optional()
|
|
18089
|
+
};
|
|
18090
|
+
/**
|
|
18091
|
+
* The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
|
|
18092
|
+
* Deliberately NOT part of {@link TrackFlagFields}: that group also builds the
|
|
18093
|
+
* write patch, and the status is not something the toggle sets — it is what the
|
|
18094
|
+
* toggle's boolean is derived from. Absent on an in-RAM track never touched;
|
|
18095
|
+
* always present on a persisted row (the column default materialises `'none'`).
|
|
18096
|
+
*/
|
|
18097
|
+
var TrackRetrainFields = { retrainStatus: RetrainStatusSchema.optional() };
|
|
18098
|
+
/**
|
|
18099
|
+
* The write half: a PARTIAL patch. An omitted key is left untouched, so setting
|
|
18100
|
+
* one flag can never clear the other — the toggles are independent and are
|
|
18101
|
+
* driven from three surfaces that do not know about each other.
|
|
18102
|
+
*/
|
|
18103
|
+
var TrackFlagsPatchSchema = object(TrackFlagFields);
|
|
18104
|
+
/**
|
|
18105
|
+
* The resolved flag state after a write. Both fields are REQUIRED here (absent
|
|
18106
|
+
* collapses to `false`) so a caller can drive a toggle's checked state off the
|
|
18107
|
+
* mutation result without a re-fetch.
|
|
18108
|
+
*/
|
|
18109
|
+
var TrackFlagsSchema = object({
|
|
18110
|
+
trackId: string(),
|
|
18111
|
+
markForTrain: boolean(),
|
|
18112
|
+
debug: boolean(),
|
|
18113
|
+
favourited: boolean(),
|
|
18114
|
+
/** The lifecycle state the boolean was derived from. Required here (unlike on
|
|
18115
|
+
* a track row) because this shape is only ever produced by the write body,
|
|
18116
|
+
* which always knows it — and a surface that has just written needs to render
|
|
18117
|
+
* `trained` without a re-fetch. */
|
|
18118
|
+
retrainStatus: RetrainStatusSchema
|
|
18119
|
+
});
|
|
18120
|
+
union([literal(1), literal(2)]);
|
|
18121
|
+
/**
|
|
18122
|
+
* WHO decided a label, and when. Carried per tier so a value can be traced to
|
|
18123
|
+
* the step and model that produced it — which is what makes the write rule
|
|
18124
|
+
* arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
|
|
18125
|
+
* and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
|
|
18126
|
+
*
|
|
18127
|
+
* `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
|
|
18128
|
+
* `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
|
|
18129
|
+
* `migration:4g` for a value the 4g migration moved from the single-slot era —
|
|
18130
|
+
* that value has no provenance, and the write rule lets ANY properly-attributed
|
|
18131
|
+
* write of the same tier replace it regardless of score.
|
|
18132
|
+
*/
|
|
18133
|
+
var LabelAttributionSchema = object({
|
|
18134
|
+
stepId: string(),
|
|
18135
|
+
modelId: string().optional(),
|
|
18136
|
+
decidedAt: number(),
|
|
18137
|
+
/**
|
|
18138
|
+
* The GALLERY id behind a recognised tier-2 label — a face-gallery
|
|
18139
|
+
* `Identity.id` or a plate-gallery `Vehicle.id` (both `randomUUID`).
|
|
18140
|
+
*
|
|
18141
|
+
* The text alone is a DISPLAY NAME, and a display name is renameable: a
|
|
18142
|
+
* notification rule authored on "Gianluca" stopped matching the moment the
|
|
18143
|
+
* operator fixed the spelling in the gallery, and nothing said so. The id is
|
|
18144
|
+
* the thing that does not move, so it is what a rule matches on
|
|
18145
|
+
* (`NcConditions.identities`) and the text is what a human is shown.
|
|
18146
|
+
*
|
|
18147
|
+
* Absent when the label names no gallery row — a plate the OCR read but no
|
|
18148
|
+
* vehicle claims, a sub-class, a species, any tier-1 value.
|
|
18149
|
+
*/
|
|
18150
|
+
identityId: string().optional()
|
|
18151
|
+
});
|
|
18152
|
+
/**
|
|
18153
|
+
* The TIERED label model (roadmap 4g), spread into `TrackSchema` and
|
|
18154
|
+
* `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
|
|
18155
|
+
* track and its events always answer the same question the same way.
|
|
18156
|
+
*
|
|
18157
|
+
* Two scalar columns, not an array: every consumer wants "the coarse one" or
|
|
18158
|
+
* "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
|
|
18159
|
+
* is tier 2, and each carries its own score + attribution.
|
|
18160
|
+
*
|
|
18161
|
+
* **Reading it.** What a human should be shown is `subLabel ?? label` — the
|
|
18162
|
+
* finest thing known. Before 4g the single `label` column held the finest
|
|
18163
|
+
* value, so a consumer that has not been updated reads the tier-1 slot and
|
|
18164
|
+
* shows nothing on a species-only row; that is why the migration puts every
|
|
18165
|
+
* pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
|
|
18166
|
+
* and why the read surfaces were changed in the same train.
|
|
18167
|
+
*
|
|
18168
|
+
* **Writing it.** The slots are independent, which is the whole point: a
|
|
18169
|
+
* tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
|
|
18170
|
+
* migratorius`), so fineness cannot regress by construction. Within a tier the
|
|
18171
|
+
* higher score wins. One rule, one implementation — see
|
|
18172
|
+
* `pipeline/label-tier.ts` in addon-post-analysis.
|
|
18173
|
+
*/
|
|
18174
|
+
var TieredLabelFields = {
|
|
18175
|
+
/** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
|
|
18176
|
+
label: string().optional(),
|
|
18177
|
+
/** Confidence of the tier-1 value, as reported by the deciding step. */
|
|
18178
|
+
labelScore: number().optional(),
|
|
18179
|
+
/** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
|
|
18180
|
+
labelMeta: LabelAttributionSchema.optional(),
|
|
18181
|
+
/** Tier 2 — the instance. See {@link LabelTierSchema}. */
|
|
18182
|
+
subLabel: string().optional(),
|
|
18183
|
+
/** Confidence of the tier-2 value, as reported by the deciding step. */
|
|
18184
|
+
subLabelScore: number().optional(),
|
|
18185
|
+
/** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
|
|
18186
|
+
subLabelMeta: LabelAttributionSchema.optional()
|
|
18956
18187
|
};
|
|
18188
|
+
/** Per-camera slice of a training-export estimate. */
|
|
18189
|
+
var TrainingExportDeviceTotalsSchema = object({
|
|
18190
|
+
deviceId: number(),
|
|
18191
|
+
tracks: number().int(),
|
|
18192
|
+
files: number().int(),
|
|
18193
|
+
bytes: number().int()
|
|
18194
|
+
});
|
|
18957
18195
|
/**
|
|
18958
|
-
*
|
|
18959
|
-
*
|
|
18960
|
-
|
|
18196
|
+
* What a training export WOULD contain. Computed from media index rows only —
|
|
18197
|
+
* no blob is read to produce this.
|
|
18198
|
+
*/
|
|
18199
|
+
var TrainingExportSummarySchema = object({
|
|
18200
|
+
generatedAt: number(),
|
|
18201
|
+
trackCount: number().int(),
|
|
18202
|
+
fileCount: number().int(),
|
|
18203
|
+
byteCount: number().int(),
|
|
18204
|
+
/** More marked tracks exist than a single pass carries. */
|
|
18205
|
+
truncated: boolean(),
|
|
18206
|
+
devices: array(TrainingExportDeviceTotalsSchema).readonly()
|
|
18207
|
+
});
|
|
18208
|
+
var TrackSchema = object({
|
|
18209
|
+
trackId: string(),
|
|
18210
|
+
deviceId: number(),
|
|
18211
|
+
className: string(),
|
|
18212
|
+
...TieredLabelFields,
|
|
18213
|
+
producingDeviceName: string().optional(),
|
|
18214
|
+
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
18215
|
+
source: TrackSourceSchema.optional(),
|
|
18216
|
+
firstSeen: number(),
|
|
18217
|
+
lastSeen: number(),
|
|
18218
|
+
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
18219
|
+
positions: array(TrackPositionSchema).readonly(),
|
|
18220
|
+
/** Periodic snapshots at snapshotIntervalMs cadence (subject to
|
|
18221
|
+
* saveThumbnails policy). */
|
|
18222
|
+
snapshots: array(TrackSnapshotSchema).readonly(),
|
|
18223
|
+
/** Deduplicated zones the track has entered at least once. Zone IDS. */
|
|
18224
|
+
zonesVisited: array(string()).readonly(),
|
|
18225
|
+
/**
|
|
18226
|
+
* Human NAMES for {@link zonesVisited}, resolved at READ time against the
|
|
18227
|
+
* `zones` capability.
|
|
18228
|
+
*
|
|
18229
|
+
* `zonesVisited` persists ids (`cfeec78c-8d69-…`), which no operator can type
|
|
18230
|
+
* and no card can render — so every free-text search surface was structurally
|
|
18231
|
+
* unable to answer "show me the tracks in Uscio", and did not fail loudly, it
|
|
18232
|
+
* just returned nothing. Resolving here rather than in each client keeps ONE
|
|
18233
|
+
* derivation and costs the clients no extra call (the `zones` cap is
|
|
18234
|
+
* per-device, so a client-side resolve would be a per-camera fan-out on a
|
|
18235
|
+
* surface built to avoid exactly that).
|
|
18236
|
+
*
|
|
18237
|
+
* Resolved, never invented: a zone deleted since the track was written has no
|
|
18238
|
+
* name and is DROPPED, so this array can be shorter than `zonesVisited` — the
|
|
18239
|
+
* two are not positionally aligned. Absent when the track visited no zone, or
|
|
18240
|
+
* when the zone catalogue could not be read.
|
|
18241
|
+
*/
|
|
18242
|
+
zoneNames: array(string()).readonly().optional(),
|
|
18243
|
+
/** Deduplicated set of detector classes observed for this track over its
|
|
18244
|
+
* life (a track may be reclassified, e.g. person→vehicle). Absent on
|
|
18245
|
+
* legacy rows written before class accumulation shipped. */
|
|
18246
|
+
classes: array(string()).readonly().optional(),
|
|
18247
|
+
/** Cumulative normalized distance travelled (0..1 units = full frame width). */
|
|
18248
|
+
totalDistance: number(),
|
|
18249
|
+
state: TrackStateSchema,
|
|
18250
|
+
active: boolean(),
|
|
18251
|
+
/** Deterministic key-event importance score in [0,1] (server-computed at
|
|
18252
|
+
* track expiry, recomputed on late label). Absent on legacy rows written
|
|
18253
|
+
* before scoring shipped — consumers degrade to absence / compute-on-read. */
|
|
18254
|
+
importance: number().optional(),
|
|
18255
|
+
/** Id of the track's highest-confidence ObjectEvent (its representative
|
|
18256
|
+
* "best" frame). Absent when the track produced no object events. */
|
|
18257
|
+
bestEventId: string().optional(),
|
|
18258
|
+
/** Tag of the importance sub-signal that dominated the score
|
|
18259
|
+
* (identity|dwell|proximity|class|confidence|travel|zone). */
|
|
18260
|
+
importanceReason: string().optional(),
|
|
18261
|
+
/** Audio-classification labels heard on the camera during the track's
|
|
18262
|
+
* life (score ≥ device `classificationMinScore`), aggregated per label.
|
|
18263
|
+
* Absent on legacy rows / tracks with no confident audio. */
|
|
18264
|
+
audioLabels: array(TrackAudioLabelSchema).readonly().optional(),
|
|
18265
|
+
/** Normalized 0..1 trajectory envelope (see {@link TrackEnvelopeSchema}).
|
|
18266
|
+
* Populated from the persisted envelope columns on historical reads;
|
|
18267
|
+
* absent on legacy rows, dims-less tracks and active (in-RAM) tracks. */
|
|
18268
|
+
envelope: TrackEnvelopeSchema.optional(),
|
|
18269
|
+
/**
|
|
18270
|
+
* A face DETECTOR found a face on this track — nothing more. It says the
|
|
18271
|
+
* detail plane produced a `face` detail; it does NOT say the face was
|
|
18272
|
+
* embedded, matched, above `minFacePx`, or that the recognizer was even
|
|
18273
|
+
* enabled. Set once and never cleared.
|
|
18274
|
+
*
|
|
18275
|
+
* **This exists so "face present but not recognised" is expressible.** A
|
|
18276
|
+
* recognised identity lands in `subLabel` (attributed to the face chain via
|
|
18277
|
+
* `subLabelMeta.stepId`), so before this field a track with an unmatched face
|
|
18278
|
+
* and a track with no face at all were byte-identical on the wire and no
|
|
18279
|
+
* surface could tell them apart. The read is `hasFace === true && subLabel
|
|
18280
|
+
* === undefined`.
|
|
18281
|
+
*
|
|
18282
|
+
* **Absent ≠ false.** Every row written before the column existed omits it,
|
|
18283
|
+
* and so does every server that predates the field — a consumer must test
|
|
18284
|
+
* `=== true` and render nothing otherwise, never infer "no face".
|
|
18285
|
+
*/
|
|
18286
|
+
hasFace: boolean().optional(),
|
|
18287
|
+
/**
|
|
18288
|
+
* This track has a face row IN THE GALLERY: a crop **and** an embedding — a
|
|
18289
|
+
* face an operator could ASSIGN to an identity.
|
|
18290
|
+
*
|
|
18291
|
+
* The STRICT twin of {@link hasFace}, and the pair only earns its keep
|
|
18292
|
+
* because the two disagree. `hasFace` is stamped at the TOP of the face
|
|
18293
|
+
* branch, before every gate, and means no more than "a face detector produced
|
|
18294
|
+
* a face detail". This one is stamped at the single moment the gallery row
|
|
18295
|
+
* LANDS — after `FaceRecognizer.onTrackEnd` successfully persists it, i.e.
|
|
18296
|
+
* past the embedding-magnitude verdict, the `minFacePx` detection gate, the
|
|
18297
|
+
* candidate gate, the imageless-track drop (no crop was ever captured) and
|
|
18298
|
+
* the crop-store drop. Everything between the detector and that insert can
|
|
18299
|
+
* legitimately refuse the face, so a flag written any earlier promises the
|
|
18300
|
+
* operator something to assign and delivers nothing.
|
|
18301
|
+
*
|
|
18302
|
+
* **Independent of recognition.** A face collected but never auto-matched is
|
|
18303
|
+
* still assignable — it is in fact the face an operator most wants to reach —
|
|
18304
|
+
* so this is NOT gated on `recognizedIdentityId`. Recognition lands in
|
|
18305
|
+
* `subLabel`; this says only that the raw material exists.
|
|
18306
|
+
*
|
|
18307
|
+
* **Set once, never cleared.** A track that produced a gallery row produced
|
|
18308
|
+
* one; deleting the row later is the gallery's business, not this flag's.
|
|
18309
|
+
*
|
|
18310
|
+
* **Absent ≠ false**, the same rule as {@link hasFace}: every row written
|
|
18311
|
+
* before the column omits it, and so does every server that predates the
|
|
18312
|
+
* field. A consumer must test `=== true` and render nothing otherwise —
|
|
18313
|
+
* never infer "no assignable face".
|
|
18314
|
+
*/
|
|
18315
|
+
hasEmbeddedFace: boolean().optional(),
|
|
18316
|
+
/**
|
|
18317
|
+
* This subject CONTAINS a folded rider — a person the rider-pairing step
|
|
18318
|
+
* ([D34](../decisions/adr-0034.md)) removed from the frame BEFORE the tracker,
|
|
18319
|
+
* so the passage is tracked once and as a VEHICLE.
|
|
18320
|
+
*
|
|
18321
|
+
* It exists because the fold's record was dishonest. D34 and the code both
|
|
18322
|
+
* said "the person is not lost — it is reported so both entities stay on the
|
|
18323
|
+
* record"; in fact the pair went into a per-processor RAM field behind an
|
|
18324
|
+
* accessor nobody called, and every durable surface said `vehicle`, full
|
|
18325
|
+
* stop. This is the composition note that makes the row true.
|
|
18326
|
+
*
|
|
18327
|
+
* A COMPOSITION, never a class and never a label. "This vehicle contains a
|
|
18328
|
+
* person" is not an answer to "what is this" — both label tiers would refuse
|
|
18329
|
+
* a macro token anyway (D89), and correctly. Nothing here changes what the
|
|
18330
|
+
* subject IS: a cyclist stays one vehicle track, occupancy still counts one,
|
|
18331
|
+
* and a `person` rule still does not fire for someone cycling past.
|
|
18332
|
+
*
|
|
18333
|
+
* **Absent ≠ false**, exactly like {@link hasFace}: every row written before
|
|
18334
|
+
* the column, and every hub that predates the field, omits it. Test
|
|
18335
|
+
* `=== true` and render nothing otherwise — never infer "no rider".
|
|
18336
|
+
*/
|
|
18337
|
+
hasRider: boolean().optional(),
|
|
18338
|
+
...TrackFlagFields,
|
|
18339
|
+
...TrackRetrainFields
|
|
18340
|
+
});
|
|
18341
|
+
var BaseEventFields = {
|
|
18342
|
+
id: string(),
|
|
18343
|
+
deviceId: number(),
|
|
18344
|
+
timestamp: number()
|
|
18345
|
+
};
|
|
18346
|
+
var MotionEventSchema = object({
|
|
18347
|
+
...BaseEventFields,
|
|
18348
|
+
kind: literal("motion"),
|
|
18349
|
+
regionCount: number(),
|
|
18350
|
+
/** Heavy JSON array — omitted in slim projection. */
|
|
18351
|
+
regions: array(object({
|
|
18352
|
+
bbox: BoundingBoxSchema,
|
|
18353
|
+
pixelCount: number(),
|
|
18354
|
+
intensity: number()
|
|
18355
|
+
})).readonly().optional(),
|
|
18356
|
+
/** Omitted in slim projection. */
|
|
18357
|
+
frameWidth: number().optional(),
|
|
18358
|
+
/** Omitted in slim projection. */
|
|
18359
|
+
frameHeight: number().optional(),
|
|
18360
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
18361
|
+
mediaUrl: string().optional()
|
|
18362
|
+
});
|
|
18363
|
+
/**
|
|
18364
|
+
* Which detection SOURCE produced an object event. `pipeline` = the ML
|
|
18365
|
+
* detection pipeline (decoded-frame inference); `onboard` = the camera's
|
|
18366
|
+
* native on-device AI. Both flow through the SAME analysis layers (zoning,
|
|
18367
|
+
* tracking, per-kind persistence) but stay distinguishable so consumers
|
|
18368
|
+
* (advanced-notifier, occupancy, …) can select which source(s) to act on.
|
|
18369
|
+
* Absent on legacy rows ⇒ treat as `pipeline`.
|
|
18370
|
+
*/
|
|
18371
|
+
var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
|
|
18372
|
+
/**
|
|
18373
|
+
* The confirmed zone crossing that produced an object event. Present ONLY on
|
|
18374
|
+
* an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
|
|
18375
|
+
* event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
|
|
18376
|
+
* appearance event carry none, so a rule asking for a direction fails closed
|
|
18377
|
+
* on them.
|
|
18378
|
+
*
|
|
18379
|
+
* Exactly ONE crossing per event: the emitter turns each confirmed crossing
|
|
18380
|
+
* into its own event, so a frame in which a track enters A while leaving B
|
|
18381
|
+
* produces two events with two directions — never one ambiguous row.
|
|
18382
|
+
*
|
|
18383
|
+
* `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
|
|
18384
|
+
* membership the box has NOW, and by definition it no longer contains the zone
|
|
18385
|
+
* that was just left. Without the id here, a zone-scoped rule could never match
|
|
18386
|
+
* the exit it asked for.
|
|
18961
18387
|
*/
|
|
18962
|
-
var
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18968
|
-
y: number(),
|
|
18969
|
-
w: number(),
|
|
18970
|
-
h: number()
|
|
18971
|
-
})
|
|
18388
|
+
var ZoneCrossingSchema = object({
|
|
18389
|
+
direction: _enum(["enter", "exit"]),
|
|
18390
|
+
/** Admin zone id crossed. */
|
|
18391
|
+
zoneId: string(),
|
|
18392
|
+
/** Zone display name at crossing time (falls back to the id). */
|
|
18393
|
+
zoneName: string().optional()
|
|
18972
18394
|
});
|
|
18973
|
-
object({
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
|
|
18978
|
-
|
|
18395
|
+
var ObjectEventSchema = object({
|
|
18396
|
+
...BaseEventFields,
|
|
18397
|
+
kind: literal("object"),
|
|
18398
|
+
/** Detection source. Optional for backward-compat; absent ⇒ `pipeline`. */
|
|
18399
|
+
source: DetectionSourceSchema.optional(),
|
|
18400
|
+
/**
|
|
18401
|
+
* Inference-frame id shared by every object event emitted from the SAME frame
|
|
18402
|
+
* — the "scene/parent" key. Lets a consumer group co-occurring detections (e.g.
|
|
18403
|
+
* 2 people + 1 dog) under one full frame, and link a track's frames over time
|
|
18404
|
+
* (group by `trackId`, pick a representative `frameId` as the parent frame).
|
|
18405
|
+
* Optional for backward-compat with pre-existing rows / the slim projection
|
|
18406
|
+
* includes it (it is light). Absent on rows written before this field.
|
|
18407
|
+
*/
|
|
18408
|
+
frameId: string().optional(),
|
|
18409
|
+
/** Omitted in slim projection. */
|
|
18410
|
+
trackId: string().optional(),
|
|
18411
|
+
className: string(),
|
|
18412
|
+
...TieredLabelFields,
|
|
18413
|
+
/** Omitted in slim projection. */
|
|
18414
|
+
confidence: number().optional(),
|
|
18415
|
+
/** Heavy JSON — omitted in slim projection. */
|
|
18416
|
+
bbox: BoundingBoxSchema.optional(),
|
|
18417
|
+
/** Heavy JSON — omitted in slim projection. */
|
|
18418
|
+
zones: array(string()).readonly().optional(),
|
|
18419
|
+
/** Omitted in slim projection. */
|
|
18420
|
+
state: TrackStateSchema.optional(),
|
|
18421
|
+
/**
|
|
18422
|
+
* The zone crossing this event IS, when it is one. Absent on every other
|
|
18423
|
+
* event kind (movement state, appearance, package) — see
|
|
18424
|
+
* {@link ZoneCrossingSchema}. Omitted in slim projection.
|
|
18425
|
+
*/
|
|
18426
|
+
zoneCrossing: ZoneCrossingSchema.optional(),
|
|
18427
|
+
/** Detection-frame dimensions in pixels — let consumers normalize the
|
|
18428
|
+
* pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
|
|
18429
|
+
frameWidth: number().optional(),
|
|
18430
|
+
frameHeight: number().optional(),
|
|
18431
|
+
/** MediaStore key for the crop attached to this event (if any). */
|
|
18432
|
+
mediaKey: string().optional(),
|
|
18433
|
+
/** Design B: MediaStore key of the track's native-resolution key frame (the
|
|
18434
|
+
* best-detection full frame). Resolve via the event-media data-plane
|
|
18435
|
+
* (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
|
|
18436
|
+
* draws `bbox` over the native frame. Absent on legacy rows / non-decoded
|
|
18437
|
+
* sources — consumers fall back to `mediaKey` (the tight crop). */
|
|
18438
|
+
keyFrameMediaKey: string().optional(),
|
|
18439
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
18440
|
+
mediaUrl: string().optional(),
|
|
18441
|
+
/** The parent track's key-event importance [0,1], propagated to every object
|
|
18442
|
+
* event of the track (so an event row can be sorted by importance without a
|
|
18443
|
+
* track join). Absent on legacy rows / before the track was scored. */
|
|
18444
|
+
importance: number().optional()
|
|
18445
|
+
});
|
|
18446
|
+
var AudioEventSchema = object({
|
|
18447
|
+
...BaseEventFields,
|
|
18448
|
+
kind: literal("audio"),
|
|
18449
|
+
rms: number(),
|
|
18450
|
+
dbfs: number(),
|
|
18451
|
+
classification: object({
|
|
18452
|
+
className: string(),
|
|
18453
|
+
originalClass: string().optional(),
|
|
18454
|
+
score: number()
|
|
18979
18455
|
}).optional(),
|
|
18980
|
-
|
|
18981
|
-
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18456
|
+
/** Populated by B5 (recording playback URL for this event). */
|
|
18457
|
+
mediaUrl: string().optional()
|
|
18458
|
+
});
|
|
18459
|
+
var MediaFileKindEnum = _enum([
|
|
18460
|
+
"crop",
|
|
18461
|
+
"thumbnail",
|
|
18462
|
+
"snapshot",
|
|
18463
|
+
"firstFrame",
|
|
18464
|
+
"lastFrame",
|
|
18465
|
+
"fullFrame",
|
|
18466
|
+
"fullFrameBoxed",
|
|
18467
|
+
"faceCrop",
|
|
18468
|
+
"plateCrop",
|
|
18469
|
+
"keyFrame",
|
|
18470
|
+
"keyFrameSmall",
|
|
18471
|
+
"thumbnailSmall"
|
|
18472
|
+
]);
|
|
18473
|
+
var MediaFileSchema = object({
|
|
18474
|
+
key: string(),
|
|
18475
|
+
kind: MediaFileKindEnum,
|
|
18476
|
+
base64: string(),
|
|
18477
|
+
sizeBytes: number(),
|
|
18478
|
+
timestamp: number()
|
|
18990
18479
|
});
|
|
18991
18480
|
/**
|
|
18992
|
-
*
|
|
18993
|
-
*
|
|
18994
|
-
*
|
|
18481
|
+
* One media row WITHOUT its bytes.
|
|
18482
|
+
*
|
|
18483
|
+
* A track's media is 5-8 MB of base64 (measured: 7.67 MB across 23 files for a
|
|
18484
|
+
* 140 s track), and a client that renders tiles from the media data plane needs
|
|
18485
|
+
* to know only WHAT EXISTS — the bytes then arrive per tile, lazily, over HTTP
|
|
18486
|
+
* with an immutable cache, instead of all at once inside a tRPC response that
|
|
18487
|
+
* blocks the whole view.
|
|
18488
|
+
*
|
|
18489
|
+
* `sizeBytes` is carried because it is what lets a client decide between the
|
|
18490
|
+
* stored blob and a `?variant=thumb` rendering without fetching either.
|
|
18995
18491
|
*/
|
|
18996
|
-
var
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
18492
|
+
var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
|
|
18493
|
+
/**
|
|
18494
|
+
* The MACRO tier of an annotation — a CLOSED set.
|
|
18495
|
+
*
|
|
18496
|
+
* This is what the exported detector predicts, so a typo here is a new class
|
|
18497
|
+
* with one example in it. `label` and `subLabel` are open strings by contrast:
|
|
18498
|
+
* the whole point of the page is teaching the model things it does not know
|
|
18499
|
+
* yet, and constraining that vocabulary would make it useless.
|
|
18500
|
+
*
|
|
18501
|
+
* A macro class is NEVER a label. The provider refuses a write whose `label` or
|
|
18502
|
+
* `subLabel` is one of these values, in any casing, because once `person`
|
|
18503
|
+
* exists in both tiers "every person box" stops being answerable without
|
|
18504
|
+
* knowing every string anyone ever typed — and the damage is retroactive.
|
|
18505
|
+
*/
|
|
18506
|
+
var RetrainMacroClassSchema = _enum([
|
|
18507
|
+
"person",
|
|
18508
|
+
"vehicle",
|
|
18509
|
+
"animal",
|
|
18510
|
+
"package",
|
|
18511
|
+
"face",
|
|
18512
|
+
"plate"
|
|
18513
|
+
]);
|
|
18514
|
+
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
18515
|
+
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
18516
|
+
/** Did a human draw this box, or did the assist propose it? */
|
|
18517
|
+
var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
|
|
18518
|
+
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
18519
|
+
var RetrainBboxSchema = object({
|
|
18520
|
+
x: number(),
|
|
18521
|
+
y: number(),
|
|
18522
|
+
w: number(),
|
|
18523
|
+
h: number()
|
|
18524
|
+
});
|
|
18525
|
+
/**
|
|
18526
|
+
* One annotated subject.
|
|
18527
|
+
*
|
|
18528
|
+
* `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
|
|
18529
|
+
* (letterboxed root / zone-cropped package / subject-cropped classifier) are
|
|
18530
|
+
* derived from it at export and never stored — storing them is how one feature
|
|
18531
|
+
* space ends up holding two crops of the same subject (D52).
|
|
18532
|
+
*/
|
|
18533
|
+
var RetrainAnnotationSchema = object({
|
|
18534
|
+
id: string(),
|
|
18535
|
+
trackId: string(),
|
|
18536
|
+
deviceId: number(),
|
|
18537
|
+
/** The COPY in retrain storage — never the source track's media key. */
|
|
18538
|
+
mediaKey: string(),
|
|
18539
|
+
bbox: RetrainBboxSchema,
|
|
18540
|
+
macroClass: RetrainMacroClassSchema,
|
|
18541
|
+
label: string().optional(),
|
|
18542
|
+
subLabel: string().optional(),
|
|
18543
|
+
kind: RetrainAnnotationKindSchema,
|
|
18544
|
+
source: RetrainAnnotationSourceSchema,
|
|
18545
|
+
/** Which model proposed this box — or, on a `model_error`, drew the phantom. */
|
|
18546
|
+
assistModelId: string().optional(),
|
|
18547
|
+
assistScore: number().optional(),
|
|
18548
|
+
exportedInBatch: string().optional(),
|
|
18549
|
+
createdAt: number()
|
|
18550
|
+
});
|
|
18551
|
+
/** The write form — the server owns `id`, `createdAt` and the frame binding. */
|
|
18552
|
+
var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
|
|
18553
|
+
id: true,
|
|
18554
|
+
trackId: true,
|
|
18555
|
+
deviceId: true,
|
|
18556
|
+
mediaKey: true,
|
|
18557
|
+
createdAt: true,
|
|
18558
|
+
exportedInBatch: true
|
|
18559
|
+
});
|
|
18560
|
+
/** A track sitting in `staging`, with everything the worklist needs to rank it. */
|
|
18561
|
+
var RetrainTrackSchema = object({
|
|
18562
|
+
trackId: string(),
|
|
18563
|
+
deviceId: number(),
|
|
18564
|
+
className: string(),
|
|
18565
|
+
label: string().optional(),
|
|
18566
|
+
firstSeen: number(),
|
|
18567
|
+
lastSeen: number(),
|
|
18568
|
+
/** How many frames the dataset already holds from this track. */
|
|
18569
|
+
frameCount: number().int(),
|
|
18570
|
+
/** How many subjects have been annotated on those frames. `0` with
|
|
18571
|
+
* `frameCount: 0` is exactly "staging, still to work". */
|
|
18572
|
+
annotationCount: number().int()
|
|
18573
|
+
});
|
|
18574
|
+
/** A frame the picker may offer — an index row, no blob was read to produce it. */
|
|
18575
|
+
var RetrainFrameCandidateSchema = object({
|
|
18576
|
+
mediaKey: string(),
|
|
18577
|
+
kind: MediaFileKindEnum,
|
|
19002
18578
|
timestamp: number(),
|
|
19003
|
-
|
|
18579
|
+
sizeBytes: number().int(),
|
|
18580
|
+
/** A copy of this original already exists — selecting it is free and cannot
|
|
18581
|
+
* fail, whatever became of the original. */
|
|
18582
|
+
copied: boolean()
|
|
19004
18583
|
});
|
|
19005
|
-
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
18584
|
+
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
18585
|
+
var RetrainFrameSchema = object({
|
|
18586
|
+
frameId: string(),
|
|
18587
|
+
deviceId: number(),
|
|
18588
|
+
trackId: string(),
|
|
18589
|
+
/** Provenance only. It may already point at nothing — that is expected. */
|
|
18590
|
+
sourceMediaKey: string(),
|
|
18591
|
+
sourceKind: MediaFileKindEnum,
|
|
18592
|
+
sizeBytes: number().int(),
|
|
18593
|
+
width: number().int(),
|
|
18594
|
+
height: number().int(),
|
|
18595
|
+
copiedAt: number()
|
|
18596
|
+
});
|
|
18597
|
+
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
18598
|
+
var RetrainCopyRefusalSchema = _enum([
|
|
18599
|
+
"source-missing",
|
|
18600
|
+
"unreadable-image",
|
|
18601
|
+
"write-failed"
|
|
19019
18602
|
]);
|
|
19020
|
-
var
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
|
|
18603
|
+
var RetrainFrameSelectionSchema = object({
|
|
18604
|
+
copied: array(RetrainFrameSchema).readonly(),
|
|
18605
|
+
refused: array(object({
|
|
18606
|
+
sourceMediaKey: string(),
|
|
18607
|
+
reason: RetrainCopyRefusalSchema
|
|
18608
|
+
})).readonly()
|
|
19025
18609
|
});
|
|
19026
|
-
var
|
|
19027
|
-
|
|
19028
|
-
|
|
19029
|
-
|
|
19030
|
-
|
|
19031
|
-
description: string().optional()
|
|
19032
|
-
})).readonly(),
|
|
19033
|
-
defaultDevice: string()
|
|
18610
|
+
var RetrainFrameListSchema = object({
|
|
18611
|
+
candidates: array(RetrainFrameCandidateSchema).readonly(),
|
|
18612
|
+
copies: array(RetrainFrameSchema).readonly(),
|
|
18613
|
+
/** What the page pre-selects — the native key frame when one survives. */
|
|
18614
|
+
autoPickMediaKey: string().optional()
|
|
19034
18615
|
});
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
enabled: boolean(),
|
|
18616
|
+
/** What the operator asked the assist to look for. */
|
|
18617
|
+
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
18618
|
+
kind: literal("package"),
|
|
18619
|
+
zone: RetrainBboxSchema.optional()
|
|
18620
|
+
}), object({
|
|
18621
|
+
kind: literal("objects"),
|
|
19042
18622
|
modelId: string(),
|
|
19043
|
-
|
|
19044
|
-
|
|
19045
|
-
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
18623
|
+
minScore: number().optional()
|
|
18624
|
+
})]);
|
|
18625
|
+
/**
|
|
18626
|
+
* The assist's answer — a discriminated union, because "the model saw nothing"
|
|
18627
|
+
* and "this node cannot run that model" lead to different next moves and a
|
|
18628
|
+
* nullable result cannot tell them apart.
|
|
18629
|
+
*/
|
|
18630
|
+
var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
18631
|
+
kind: literal("proposed"),
|
|
19050
18632
|
modelId: string(),
|
|
19051
|
-
|
|
19052
|
-
|
|
19053
|
-
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
|
|
19060
|
-
|
|
18633
|
+
stepId: string(),
|
|
18634
|
+
minScore: number(),
|
|
18635
|
+
/** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
|
|
18636
|
+
proposals: array(RetrainAnnotationDraftSchema).readonly(),
|
|
18637
|
+
/** Returned by the runner but removed by the threshold. */
|
|
18638
|
+
belowThreshold: number().int()
|
|
18639
|
+
}), object({
|
|
18640
|
+
kind: literal("refused"),
|
|
18641
|
+
/** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
|
|
18642
|
+
reason: string(),
|
|
18643
|
+
detail: string().optional()
|
|
18644
|
+
})]);
|
|
18645
|
+
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
18646
|
+
var RetrainTransitionResultSchema = object({
|
|
18647
|
+
trackId: string(),
|
|
18648
|
+
/** Where the track ended up, whatever happened. */
|
|
18649
|
+
retrainStatus: RetrainStatusSchema,
|
|
18650
|
+
/** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
|
|
18651
|
+
changed: boolean(),
|
|
18652
|
+
reason: _enum([
|
|
18653
|
+
"unknown-track",
|
|
18654
|
+
"no-frames-copied",
|
|
18655
|
+
"not-staging",
|
|
18656
|
+
"not-trained",
|
|
18657
|
+
"unchanged"
|
|
18658
|
+
]).optional()
|
|
19061
18659
|
});
|
|
19062
|
-
var
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
18660
|
+
var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
|
|
18661
|
+
var MAX_EVENT_QUERY_LIMIT = 5e3;
|
|
18662
|
+
var DeviceEventQueryInput = object({
|
|
18663
|
+
deviceId: number(),
|
|
18664
|
+
since: number().optional(),
|
|
18665
|
+
until: number().optional(),
|
|
18666
|
+
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT),
|
|
18667
|
+
/** `slim` drops heavy JSON fields (regions/bbox/zones) and carries an
|
|
18668
|
+
* optional `mediaUrl` (populated by B5). `full` (default) keeps today's
|
|
18669
|
+
* exact behaviour. Callers may omit this field — the store defaults to
|
|
18670
|
+
* `full` when not provided. */
|
|
18671
|
+
projection: _enum(["full", "slim"]).optional()
|
|
19072
18672
|
});
|
|
19073
|
-
var
|
|
19074
|
-
var
|
|
18673
|
+
var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
|
|
18674
|
+
var RecentTracksQueryInput = object({
|
|
18675
|
+
/** Devices to merge. An empty array yields `{ tracks: [], nextCursor: null }`. */
|
|
18676
|
+
deviceIds: array(number()),
|
|
18677
|
+
/** Window lower bound on `lastSeen` (inclusive). */
|
|
18678
|
+
since: number().optional(),
|
|
18679
|
+
/** Window upper bound on `lastSeen` (inclusive). */
|
|
18680
|
+
until: number().optional(),
|
|
18681
|
+
/** Page size. Default 200, max 1000. */
|
|
18682
|
+
limit: number().int().min(1).max(1e3).default(200),
|
|
18683
|
+
/** Opaque continuation cursor from a previous page's `nextCursor`.
|
|
18684
|
+
* Encodes the (lastSeen, trackId) sort position — treat as opaque. */
|
|
18685
|
+
cursor: string().optional(),
|
|
18686
|
+
/** See {@link TrackProjectionSchema}. Default `full`. */
|
|
18687
|
+
projection: TrackProjectionSchema.optional(),
|
|
18688
|
+
/** Include stationary-promoted rows (parked objects). Default false: the
|
|
18689
|
+
* feed lists passages; parking records live on the stationary registry. */
|
|
18690
|
+
includeStationary: boolean().optional()
|
|
18691
|
+
});
|
|
18692
|
+
var RecentTracksPageSchema = object({
|
|
18693
|
+
/** Merged page, ordered by (`lastSeen` DESC, `trackId` DESC). */
|
|
18694
|
+
tracks: array(TrackSchema).readonly(),
|
|
18695
|
+
/** Cursor for the next page, or null when this page is the last. */
|
|
18696
|
+
nextCursor: string().nullable()
|
|
18697
|
+
});
|
|
18698
|
+
var LIST_GROUPS_DEFAULT_LIMIT = 40;
|
|
18699
|
+
var LIST_GROUPS_MAX_LIMIT = 100;
|
|
18700
|
+
var AnalyticsGroupRecordSchema = object({
|
|
19075
18701
|
id: string(),
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
group: string().optional(),
|
|
19088
|
-
configSchema: array(ConfigFieldBridge).readonly().optional()
|
|
18702
|
+
deviceId: number().int(),
|
|
18703
|
+
openedAt: number().int(),
|
|
18704
|
+
closedAt: number().int(),
|
|
18705
|
+
timestamp: number().int(),
|
|
18706
|
+
memberCount: number().int(),
|
|
18707
|
+
memberTrackIds: array(string()).readonly(),
|
|
18708
|
+
className: string(),
|
|
18709
|
+
classes: array(string()).readonly(),
|
|
18710
|
+
/** Relative event-media path, or null when the group has no picture yet. */
|
|
18711
|
+
mediaUrl: string().nullable(),
|
|
18712
|
+
singleton: boolean()
|
|
19089
18713
|
});
|
|
19090
|
-
var
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
|
|
18714
|
+
var AnalyticsGroupMemberSchema = object({
|
|
18715
|
+
trackId: string(),
|
|
18716
|
+
deviceId: number().int(),
|
|
18717
|
+
className: string(),
|
|
18718
|
+
firstSeen: number().int(),
|
|
18719
|
+
lastSeen: number().int(),
|
|
18720
|
+
mediaUrl: string().nullable()
|
|
19096
18721
|
});
|
|
19097
|
-
var
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
18722
|
+
var AnalyticsGroupDetailSchema = AnalyticsGroupRecordSchema.extend({ members: array(AnalyticsGroupMemberSchema).readonly() });
|
|
18723
|
+
var ListGroupsQueryInput = object({
|
|
18724
|
+
/** Devices to merge. An empty array yields `{ groups: [], nextCursor: null }`. */
|
|
18725
|
+
deviceIds: array(number()),
|
|
18726
|
+
/** Window lower bound on `closedAt` (inclusive). */
|
|
18727
|
+
since: number().optional(),
|
|
18728
|
+
/** Window upper bound on `openedAt` (inclusive). */
|
|
18729
|
+
until: number().optional(),
|
|
18730
|
+
limit: number().int().min(1).max(LIST_GROUPS_MAX_LIMIT).default(LIST_GROUPS_DEFAULT_LIMIT),
|
|
18731
|
+
/** Opaque continuation cursor from a previous page's `nextCursor`. */
|
|
18732
|
+
cursor: string().optional()
|
|
19101
18733
|
});
|
|
19102
|
-
var
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
"openvino",
|
|
19106
|
-
"coreml",
|
|
19107
|
-
"edgetpu"
|
|
19108
|
-
]).nullable(),
|
|
19109
|
-
device: string().nullable(),
|
|
19110
|
-
state: _enum([
|
|
19111
|
-
"idle",
|
|
19112
|
-
"installing",
|
|
19113
|
-
"verifying",
|
|
19114
|
-
"ready",
|
|
19115
|
-
"failed"
|
|
19116
|
-
]),
|
|
19117
|
-
progress: number().optional(),
|
|
19118
|
-
error: string().optional(),
|
|
19119
|
-
nextRetryAt: number().optional(),
|
|
19120
|
-
/**
|
|
19121
|
-
* Gate A (config-correctness gate at engine change): human-readable
|
|
19122
|
-
* config issues surfaced EAGERLY when the node's engine changes — model
|
|
19123
|
-
* substitutions ("chose X, running Y") and zero-build steps ("no model
|
|
19124
|
-
* has a <format> build"). Additive/optional: informational only, never
|
|
19125
|
-
* enforced here — `assertEngineReady` (readiness) still gates inference.
|
|
19126
|
-
* Absent/empty when the node-default tree resolves cleanly.
|
|
19127
|
-
*/
|
|
19128
|
-
configIssues: array(string()).optional()
|
|
18734
|
+
var ListGroupsPageSchema = object({
|
|
18735
|
+
groups: array(AnalyticsGroupRecordSchema).readonly(),
|
|
18736
|
+
nextCursor: string().nullable()
|
|
19129
18737
|
});
|
|
19130
|
-
var
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
running: string(),
|
|
19142
|
-
format: string()
|
|
18738
|
+
var KeyEventQueryInput = object({
|
|
18739
|
+
deviceId: number(),
|
|
18740
|
+
/** Window lower bound (track firstSeen ≥ since). */
|
|
18741
|
+
since: number(),
|
|
18742
|
+
/** Window upper bound (track firstSeen ≤ until). */
|
|
18743
|
+
until: number(),
|
|
18744
|
+
limit: number().int().min(1).max(200).default(50),
|
|
18745
|
+
/** Drop tracks scoring below this importance. */
|
|
18746
|
+
minImportance: number().min(0).max(1).optional(),
|
|
18747
|
+
/** Restrict to a single class (e.g. 'person'). */
|
|
18748
|
+
classFilter: string().optional()
|
|
19143
18749
|
});
|
|
19144
|
-
var
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
18750
|
+
var KeyEventSchema = object({
|
|
18751
|
+
/** The representative event id (the track's best ObjectEvent, else its trackId). */
|
|
18752
|
+
id: string(),
|
|
18753
|
+
trackId: string(),
|
|
18754
|
+
/** Track start time (firstSeen). */
|
|
18755
|
+
timestamp: number(),
|
|
18756
|
+
className: string(),
|
|
18757
|
+
...TieredLabelFields,
|
|
18758
|
+
importance: number(),
|
|
18759
|
+
/** Highest-confidence ObjectEvent id for the track (empty when none). */
|
|
18760
|
+
bestEventId: string(),
|
|
18761
|
+
/** Track lifetime in ms (lastSeen - firstSeen). */
|
|
18762
|
+
windowMs: number().optional(),
|
|
18763
|
+
...TrackFlagFields,
|
|
18764
|
+
...TrackRetrainFields
|
|
19148
18765
|
});
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
18766
|
+
object({
|
|
18767
|
+
trackId: string(),
|
|
18768
|
+
className: string(),
|
|
18769
|
+
confidence: number(),
|
|
18770
|
+
bbox: BoundingBoxSchema,
|
|
18771
|
+
zones: array(string()).readonly(),
|
|
18772
|
+
state: TrackStateSchema
|
|
19155
18773
|
});
|
|
19156
|
-
var
|
|
19157
|
-
|
|
19158
|
-
|
|
18774
|
+
var OverlayDetectionSchema = looseObject({
|
|
18775
|
+
id: string(),
|
|
18776
|
+
kind: _enum(["first-level", "detail"]),
|
|
18777
|
+
macroClass: string(),
|
|
18778
|
+
score: number(),
|
|
18779
|
+
bbox: object({
|
|
18780
|
+
x: number(),
|
|
18781
|
+
y: number(),
|
|
18782
|
+
width: number(),
|
|
18783
|
+
height: number()
|
|
18784
|
+
}),
|
|
18785
|
+
labels: array(looseObject({
|
|
18786
|
+
label: string(),
|
|
18787
|
+
score: number()
|
|
18788
|
+
})).readonly(),
|
|
18789
|
+
parentId: string().optional()
|
|
19159
18790
|
});
|
|
19160
|
-
var
|
|
19161
|
-
|
|
19162
|
-
|
|
18791
|
+
var ScoredObjectEventSchema = ObjectEventSchema.extend({ score: number() });
|
|
18792
|
+
var SearchObjectEventsInput = object({
|
|
18793
|
+
text: string(),
|
|
18794
|
+
deviceId: number().optional(),
|
|
18795
|
+
since: number().optional(),
|
|
18796
|
+
until: number().optional(),
|
|
18797
|
+
classFilter: string().optional(),
|
|
18798
|
+
limit: number().default(50),
|
|
18799
|
+
minScore: number().min(0).max(1).default(.2)
|
|
19163
18800
|
});
|
|
19164
|
-
var
|
|
19165
|
-
|
|
19166
|
-
|
|
18801
|
+
var TrackCascadeCountsSchema = object({
|
|
18802
|
+
/** Persisted track roots deleted (authoritative). */
|
|
18803
|
+
tracks: number().int(),
|
|
18804
|
+
/** Object events removed with their tracks (best-effort; see note above). */
|
|
18805
|
+
events: number().int(),
|
|
18806
|
+
/** Track/face/plate-owned media removed (best-effort). Never identity media. */
|
|
18807
|
+
media: number().int(),
|
|
18808
|
+
/** Unassigned (non-enrolled) face reads removed (best-effort). */
|
|
18809
|
+
faces: number().int(),
|
|
18810
|
+
/** Unassigned plate reads removed (best-effort; plate leg deferred to plate-intelligence). */
|
|
18811
|
+
plates: number().int(),
|
|
18812
|
+
/** Per-track CLIP search vectors removed (best-effort). */
|
|
18813
|
+
embeddings: number().int(),
|
|
18814
|
+
/** Group membership + group rows removed with their last member (best-effort). */
|
|
18815
|
+
groups: number().int()
|
|
19167
18816
|
});
|
|
19168
|
-
|
|
19169
|
-
var
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
available: boolean(),
|
|
19174
|
-
/**
|
|
19175
|
-
* Raw classifier labels this backend can emit (e.g. YAMNet's
|
|
19176
|
-
* 521-class set or Apple SoundAnalysis's 303-class set). Used by
|
|
19177
|
-
* the benchmark UI to populate the `enabledMicroClasses` filter
|
|
19178
|
-
* specific to the selected backend without a separate fetch.
|
|
19179
|
-
*/
|
|
19180
|
-
rawLabels: array(string()).readonly().optional()
|
|
18817
|
+
/** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
|
|
18818
|
+
var DiskReconcileCountsSchema = object({
|
|
18819
|
+
mediaDropped: number().int(),
|
|
18820
|
+
tracks: number().int(),
|
|
18821
|
+
events: number().int()
|
|
19181
18822
|
});
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
18823
|
+
/** Event-store footprint for one camera. */
|
|
18824
|
+
var EventStoreDeviceFootprintSchema = object({
|
|
18825
|
+
deviceId: number(),
|
|
18826
|
+
/** Persisted event rows (motion + object + audio) for the camera. */
|
|
18827
|
+
rows: number().int(),
|
|
18828
|
+
/** Event-owned media bytes on disk for the camera. */
|
|
18829
|
+
bytes: number().int()
|
|
19187
18830
|
});
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
18831
|
+
/** Aggregate event-store footprint: global totals + per-camera breakdown. */
|
|
18832
|
+
var EventStoreFootprintSchema = object({
|
|
18833
|
+
totalRows: number().int(),
|
|
18834
|
+
totalBytes: number().int(),
|
|
18835
|
+
devices: array(EventStoreDeviceFootprintSchema).readonly()
|
|
18836
|
+
});
|
|
18837
|
+
/** Per-kind counts returned by the event-prune / device-delete mutations. */
|
|
18838
|
+
var EventPruneCountsSchema = object({
|
|
18839
|
+
motion: number().int(),
|
|
18840
|
+
object: number().int(),
|
|
18841
|
+
audio: number().int()
|
|
19192
18842
|
});
|
|
19193
18843
|
/**
|
|
19194
|
-
*
|
|
19195
|
-
*
|
|
19196
|
-
*
|
|
19197
|
-
*
|
|
19198
|
-
*
|
|
19199
|
-
*
|
|
19200
|
-
*
|
|
19201
|
-
* cap isn't available.
|
|
18844
|
+
* Re-embed stored tracks from their key frames.
|
|
18845
|
+
*
|
|
18846
|
+
* The reason this is an operator-callable method and not a migration script:
|
|
18847
|
+
* every knob that decides what a vector MEANS — encoder model, crop margin,
|
|
18848
|
+
* squaring — is only changeable if the existing vectors can be regenerated.
|
|
18849
|
+
* Mixing feature spaces in one index makes cosine scores incomparable, and the
|
|
18850
|
+
* symptom is a quality regression with no visible cause.
|
|
19202
18851
|
*/
|
|
19203
|
-
var
|
|
19204
|
-
|
|
19205
|
-
error: string().optional(),
|
|
19206
|
-
frame: custom().optional()
|
|
19207
|
-
});
|
|
19208
|
-
var PipelineConfigBridge = custom();
|
|
19209
|
-
var ConfigUISchemaBridge = custom();
|
|
19210
|
-
var ConfigUISchemaNullableBridge = custom();
|
|
19211
|
-
var InferenceCapabilitiesBridge = custom();
|
|
19212
|
-
var ModelAvailabilityListBridge = custom();
|
|
19213
|
-
var PipelineRunResultBridge = custom();
|
|
19214
|
-
method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
|
|
19215
|
-
modelId: string(),
|
|
19216
|
-
settings: record(string(), unknown()).readonly()
|
|
19217
|
-
}))), method(object({ steps: record(string(), object({
|
|
19218
|
-
modelId: string(),
|
|
19219
|
-
settings: record(string(), unknown()).readonly()
|
|
19220
|
-
})) }), object({ success: literal(true) }), {
|
|
19221
|
-
kind: "mutation",
|
|
19222
|
-
auth: "admin"
|
|
19223
|
-
}), method(object({ nodeId: string() }), object({
|
|
19224
|
-
success: literal(true),
|
|
19225
|
-
clearedDevices: number()
|
|
19226
|
-
}), {
|
|
19227
|
-
kind: "mutation",
|
|
19228
|
-
auth: "admin"
|
|
19229
|
-
}), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({ steps: array(PipelineStepInputSchema) }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
|
|
19230
|
-
name: string(),
|
|
19231
|
-
steps: array(PipelineTemplateStepSchema).readonly(),
|
|
19232
|
-
engine: PipelineEngineChoiceSchema
|
|
19233
|
-
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
|
|
19234
|
-
id: string(),
|
|
19235
|
-
name: string().optional(),
|
|
19236
|
-
steps: array(PipelineTemplateStepSchema).readonly().optional()
|
|
19237
|
-
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
|
|
19238
|
-
addonId: string(),
|
|
19239
|
-
modelId: string(),
|
|
19240
|
-
format: ModelFormatSchema$1
|
|
19241
|
-
}), DownloadModelResultSchema, { kind: "mutation" }), method(object({
|
|
19242
|
-
addonId: string(),
|
|
19243
|
-
modelId: string(),
|
|
19244
|
-
format: ModelFormatSchema$1
|
|
19245
|
-
}), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
19246
|
-
engine: PipelineEngineChoiceSchema.optional(),
|
|
19247
|
-
steps: array(PipelineStepInputSchema).min(1),
|
|
19248
|
-
frame: FrameInputSchema.optional(),
|
|
19249
|
-
/**
|
|
19250
|
-
* Process-local lazy frame. Valid only when caller and provider resolve
|
|
19251
|
-
* in the same execution-group process; split/cross-node callers use
|
|
19252
|
-
* `frame`/`image` inline compatibility instead.
|
|
19253
|
-
*/
|
|
19254
|
-
frameRef: FrameRefSchema.optional(),
|
|
19255
|
-
/**
|
|
19256
|
-
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
19257
|
-
* the decoded pixels live in. One more member of the one-of
|
|
19258
|
-
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
19259
|
-
*/
|
|
19260
|
-
frameHandle: FrameHandleSchema.optional(),
|
|
19261
|
-
imageBase64: string().optional(),
|
|
19262
|
-
/**
|
|
19263
|
-
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
19264
|
-
* hops (hub → forked worker via Moleculer MsgPack) because it
|
|
19265
|
-
* skips the 33% base64 overhead + the per-call base64 decode on
|
|
19266
|
-
* the detection-pipeline worker. Callers can pass either; exactly
|
|
19267
|
-
* one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
|
|
19268
|
-
*/
|
|
19269
|
-
image: _instanceof(Uint8Array).optional(),
|
|
19270
|
-
referenceImage: string().optional(),
|
|
18852
|
+
var RebuildObjectEmbeddingsInput = object({
|
|
18853
|
+
/** Restrict to one camera. Omit for the whole fleet. */
|
|
19271
18854
|
deviceId: number().optional(),
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
* per-frame dispatch: ONLY root-plane steps run; crop children
|
|
19277
|
-
* (inputClasses ≠ null) are skipped and served per-track via
|
|
19278
|
-
* pipelineRunner.runDetailSubtree (two-plane design).
|
|
19279
|
-
*/
|
|
19280
|
-
plane: _enum(["full", "frame"]).optional(),
|
|
19281
|
-
/**
|
|
19282
|
-
* Inference-device selector (Phase 2 multi-device). Format
|
|
19283
|
-
* `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
|
|
19284
|
-
* Omitted ⇒ the runner's default device (current single-engine
|
|
19285
|
-
* behaviour). Selects WHICH device pool of the node runs the call.
|
|
19286
|
-
*/
|
|
19287
|
-
deviceKey: string().optional(),
|
|
18855
|
+
since: number().optional(),
|
|
18856
|
+
until: number().optional(),
|
|
18857
|
+
/** Stop after this many tracks; the result reports whether more remain. */
|
|
18858
|
+
maxTracks: number().int().positive().optional(),
|
|
19288
18859
|
/**
|
|
19289
|
-
*
|
|
19290
|
-
*
|
|
19291
|
-
*
|
|
19292
|
-
*
|
|
19293
|
-
*
|
|
19294
|
-
*
|
|
19295
|
-
*
|
|
19296
|
-
*
|
|
19297
|
-
*
|
|
19298
|
-
*
|
|
19299
|
-
* of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
|
|
19300
|
-
* (today's behaviour on the fallback path).
|
|
18860
|
+
* Run every embedding on THIS node instead of round-robining the fleet.
|
|
18861
|
+
*
|
|
18862
|
+
* Named `executeOnNodeId` and not `nodeId` on purpose: an inline `nodeId`
|
|
18863
|
+
* field in cap args is read by `parent-unowned-call.ts` as a ROUTING PIN, so
|
|
18864
|
+
* calling it that would pin the rebuild REQUEST itself to that node — the
|
|
18865
|
+
* rebuild orchestration lives on the hub, and only the per-track step runs
|
|
18866
|
+
* remotely. This field is data; the per-track pin is applied inside.
|
|
18867
|
+
*
|
|
18868
|
+
* Absent ⇒ round-robin over every online node whose runner can serve the
|
|
18869
|
+
* pinned model.
|
|
19301
18870
|
*/
|
|
19302
|
-
|
|
19303
|
-
}), PipelineRunResultBridge, { kind: "mutation" }), method(object({
|
|
19304
|
-
engine: PipelineEngineChoiceSchema.optional(),
|
|
19305
|
-
steps: array(PipelineStepInputSchema).min(1),
|
|
19306
|
-
frames: array(FrameInputSchema).min(1).max(255),
|
|
19307
|
-
deviceId: number().optional(),
|
|
19308
|
-
sessionId: string().optional(),
|
|
18871
|
+
executeOnNodeId: string().optional(),
|
|
19309
18872
|
/**
|
|
19310
|
-
*
|
|
19311
|
-
*
|
|
19312
|
-
*
|
|
19313
|
-
*
|
|
19314
|
-
*
|
|
19315
|
-
*
|
|
19316
|
-
*
|
|
19317
|
-
*
|
|
18873
|
+
* Milliseconds to wait between tracks; omit for the built-in default, `0` to
|
|
18874
|
+
* run flat out.
|
|
18875
|
+
*
|
|
18876
|
+
* A rebuild is bulk maintenance on hub-main's single thread. Measured
|
|
18877
|
+
* 2026-08-06, an unpaced pass held that thread busy 82.2 s out of 120 and
|
|
18878
|
+
* pushed `nodes.topology` from 0.25 s to 26 s for 43 minutes. The value in
|
|
18879
|
+
* force is logged at start and finish so a deliberately slow pass reads
|
|
18880
|
+
* differently from a stalled one.
|
|
19318
18881
|
*/
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19337
|
-
|
|
19338
|
-
|
|
19339
|
-
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
})
|
|
19344
|
-
|
|
19345
|
-
|
|
19346
|
-
|
|
19347
|
-
|
|
18882
|
+
pacingMs: number().int().nonnegative().optional()
|
|
18883
|
+
});
|
|
18884
|
+
/**
|
|
18885
|
+
* Result of emptying the CLIP index.
|
|
18886
|
+
*
|
|
18887
|
+
* The clean slate before a policy change: a new crop margin or encoder model
|
|
18888
|
+
* leaves two feature spaces in one index whose cosine scores are not
|
|
18889
|
+
* comparable, so wiping and rebuilding is the only way to be sure every vector
|
|
18890
|
+
* means the same thing.
|
|
18891
|
+
*/
|
|
18892
|
+
var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
|
|
18893
|
+
/**
|
|
18894
|
+
* Acknowledgement that a rebuild STARTED.
|
|
18895
|
+
*
|
|
18896
|
+
* The pass costs ~1s per track — 45 minutes for a 2,600-track fleet — so it
|
|
18897
|
+
* runs detached and this returns immediately. Waiting for it made the client
|
|
18898
|
+
* time out while the work carried on server-side, which is the worst of both:
|
|
18899
|
+
* no result and no way to know it was still going. Poll
|
|
18900
|
+
* `getObjectEmbeddingRebuildStatus` for progress.
|
|
18901
|
+
*/
|
|
18902
|
+
var RebuildObjectEmbeddingsResultSchema = object({
|
|
18903
|
+
started: boolean(),
|
|
18904
|
+
/** True when a pass was already running; the new request is ignored. */
|
|
18905
|
+
alreadyRunning: boolean()
|
|
18906
|
+
});
|
|
18907
|
+
var RebuildStatusSchema = object({
|
|
18908
|
+
running: boolean(),
|
|
18909
|
+
scanned: number(),
|
|
18910
|
+
rebuilt: number(),
|
|
18911
|
+
/** Tracks whose key frame is gone — nothing to re-embed from. */
|
|
18912
|
+
missingKeyFrame: number(),
|
|
18913
|
+
/** Tracks with no usable detection box. */
|
|
18914
|
+
missingBbox: number(),
|
|
19348
18915
|
/**
|
|
19349
|
-
*
|
|
19350
|
-
*
|
|
19351
|
-
*
|
|
19352
|
-
*
|
|
19353
|
-
* - `device-pool` — a concurrent per-device pool (Phase 2
|
|
19354
|
-
* multi-device, keyed by `deviceKey`) resolved
|
|
19355
|
-
* via `resolveDeviceFactory`. Runs alongside the
|
|
19356
|
-
* `runtime` engine on a DIFFERENT accelerator
|
|
19357
|
-
* (NPU / iGPU / Coral) — this is how the
|
|
19358
|
-
* Engines tab shows all pools running at once.
|
|
18916
|
+
* Tracks an executing node REFUSED rather than broke on — an unreadable key
|
|
18917
|
+
* frame, a step that threw. Separate from `failed` because the remedy is
|
|
18918
|
+
* different, and because a whole camera silently contributing zero vectors
|
|
18919
|
+
* is the shape of failure a rebuild must never hide.
|
|
19359
18920
|
*/
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
|
|
19375
|
-
|
|
19376
|
-
|
|
19377
|
-
|
|
19378
|
-
|
|
19379
|
-
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
})
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
18921
|
+
notRunnable: number(),
|
|
18922
|
+
/**
|
|
18923
|
+
* The pass stopped because NO node could serve the pinned model.
|
|
18924
|
+
*
|
|
18925
|
+
* Distinct from `notRunnable` on purpose: that one says "this track was
|
|
18926
|
+
* refused", this one says "the cluster cannot do this work at all" — every
|
|
18927
|
+
* candidate node either lacks the `clip-embedding` step, lacks a build of the
|
|
18928
|
+
* pinned model for its engine format, or dropped out. The remedy is a model /
|
|
18929
|
+
* engine change, not a per-camera one. Non-zero here always comes with
|
|
18930
|
+
* `complete: false`.
|
|
18931
|
+
*/
|
|
18932
|
+
noCapableNode: number(),
|
|
18933
|
+
failed: number(),
|
|
18934
|
+
/** Set once a pass ends: true only when EVERYTHING was covered. */
|
|
18935
|
+
complete: boolean().nullable(),
|
|
18936
|
+
startedAtMs: number().nullable(),
|
|
18937
|
+
finishedAtMs: number().nullable(),
|
|
18938
|
+
/** Present when the pass ended by throwing. */
|
|
18939
|
+
error: string().nullable()
|
|
18940
|
+
});
|
|
18941
|
+
var ReplayFrameInputSchema = object({
|
|
18942
|
+
timestamp: number(),
|
|
18943
|
+
frame: PipelineRunResultBridge
|
|
18944
|
+
});
|
|
18945
|
+
var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
|
|
18946
|
+
className: string(),
|
|
18947
|
+
firstSeenMs: number(),
|
|
18948
|
+
lastSeenMs: number(),
|
|
18949
|
+
/** Bbox of the track's FIRST matched detection, pixel-space in the clip's
|
|
18950
|
+
* frame — a representative box for the diff's `(className, window, IoU)`
|
|
18951
|
+
* pairing (`replay-diff.ts`). A replay does not need the full per-frame
|
|
18952
|
+
* trajectory production's `Track.positions` keeps. */
|
|
18953
|
+
bbox: BoundingBoxSchema,
|
|
18954
|
+
/** How many of the input frames this track matched a real detection on
|
|
18955
|
+
* (never a coasted/extrapolated frame) — the replay's own signal for "how
|
|
18956
|
+
* solid is this track", cheaper than re-deriving it from a trajectory. */
|
|
18957
|
+
framesMatched: number().int()
|
|
18958
|
+
})).readonly() });
|
|
18959
|
+
var pipelineAnalyticsCapability = {
|
|
18960
|
+
name: "pipeline-analytics",
|
|
18961
|
+
scope: "device",
|
|
18962
|
+
mode: "singleton",
|
|
18963
|
+
kind: "wrapper",
|
|
18964
|
+
defaultActive: true,
|
|
18965
|
+
deviceTypes: [DeviceType.Camera],
|
|
18966
|
+
exposesDeviceSettings: true,
|
|
18967
|
+
methods: {
|
|
18968
|
+
getActiveTracks: method(object({ deviceId: number() }), array(TrackSchema).readonly()),
|
|
18969
|
+
getTrack: method(object({
|
|
18970
|
+
deviceId: number(),
|
|
18971
|
+
trackId: string()
|
|
18972
|
+
}), TrackSchema.nullable()),
|
|
18973
|
+
/** Historical completed tracks for a device. Queried from the
|
|
18974
|
+
* persisted `pipeline-analytics:tracks` collection; active tracks
|
|
18975
|
+
* still in RAM are not included. */
|
|
18976
|
+
listTracks: method(object({
|
|
18977
|
+
deviceId: number(),
|
|
18978
|
+
since: number().optional(),
|
|
18979
|
+
until: number().optional(),
|
|
18980
|
+
limit: number().optional(),
|
|
18981
|
+
/** Spatial filter — only tracks whose trajectory intersects the zone
|
|
18982
|
+
* (normalized 0..1 rect or polygon). SQL-prefiltered on the persisted
|
|
18983
|
+
* envelope columns, then precisely tested per position. Tracks with
|
|
18984
|
+
* an unknown envelope (no frame dims at persist time) always match. */
|
|
18985
|
+
zone: TrackZoneFilterSchema.optional(),
|
|
18986
|
+
/** See {@link TrackProjectionSchema}. Default `full` (backward
|
|
18987
|
+
* compatible — omitting the field keeps today's exact behaviour). */
|
|
18988
|
+
projection: TrackProjectionSchema.optional(),
|
|
18989
|
+
/** Include stationary-promoted rows (parked objects handed to the
|
|
18990
|
+
* stationary registry). Default false: the timeline lists passages,
|
|
18991
|
+
* not parking records (operator decision, 2026-08-15). */
|
|
18992
|
+
includeStationary: boolean().optional()
|
|
18993
|
+
}), array(TrackSchema).readonly()),
|
|
18994
|
+
/**
|
|
18995
|
+
* Batched cluster-wide track listing — ONE call for the events page /
|
|
18996
|
+
* reel first paint instead of a per-camera `listTracks` fan-out. Merges
|
|
18997
|
+
* the persisted completed tracks of every requested device, sorted by
|
|
18998
|
+
* `lastSeen` DESC with a stable (lastSeen, trackId) cursor. Per-device
|
|
18999
|
+
* indexed pages (`idx_tracks_device_lastSeen`) are k-way merged
|
|
19000
|
+
* provider-side; `projection: 'slim'` drops the heavy `positions[]` /
|
|
19001
|
+
* `snapshots[]` JSON (returned as empty arrays). Active in-RAM tracks
|
|
19002
|
+
* are not included (same contract as `listTracks`).
|
|
19003
|
+
*/
|
|
19004
|
+
listRecentTracks: method(RecentTracksQueryInput, RecentTracksPageSchema),
|
|
19005
|
+
/**
|
|
19006
|
+
* Batched co-moving group listing — the Groups feed. Same merge/cursor
|
|
19007
|
+
* contract as {@link listRecentTracks}. A group is a sealed partition of
|
|
19008
|
+
* one session; `getGroup` is the detail with members.
|
|
19009
|
+
*/
|
|
19010
|
+
listGroups: method(ListGroupsQueryInput, ListGroupsPageSchema),
|
|
19011
|
+
getGroup: method(object({
|
|
19012
|
+
deviceId: number(),
|
|
19013
|
+
groupId: string().min(1)
|
|
19014
|
+
}), AnalyticsGroupDetailSchema.nullable()),
|
|
19015
|
+
clearTracks: method(object({ deviceId: number() }), _void(), {
|
|
19016
|
+
kind: "mutation",
|
|
19017
|
+
auth: "admin"
|
|
19018
|
+
}),
|
|
19019
|
+
getMotionEvents: method(DeviceEventQueryInput, array(MotionEventSchema).readonly()),
|
|
19020
|
+
getObjectEvents: method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()),
|
|
19021
|
+
getAudioEvents: method(DeviceEventQueryInput, array(AudioEventSchema).readonly()),
|
|
19022
|
+
/**
|
|
19023
|
+
* Every event kind the device can produce: built-ins (motion + audio),
|
|
19024
|
+
* detection classes actually observed for the device (from the track
|
|
19025
|
+
* history), and sensor kinds contributed by LINKED devices (resolved via
|
|
19026
|
+
* `device-manager.getLinkedDevices`, mapped through `EVENT_KIND_BY_CAP`).
|
|
19027
|
+
*/
|
|
19028
|
+
listEventKinds: method(object({ deviceId: number() }), array(EventKindDescriptorSchema).readonly()),
|
|
19029
|
+
/**
|
|
19030
|
+
* The same answer for many cameras in ONE call.
|
|
19031
|
+
*
|
|
19032
|
+
* `listEventKinds` is the slowest per-device query on the hub — measured
|
|
19033
|
+
* at ~100 ms against 6-11 ms for its neighbours — because composing it
|
|
19034
|
+
* costs a `getCameraStatus`, a `getLinkedDevices` and one `getBindings`
|
|
19035
|
+
* per linked device. The viewer asks for it once per camera at first
|
|
19036
|
+
* paint, so twelve cameras paid twelve of those round-trips on top of the
|
|
19037
|
+
* per-camera cost.
|
|
19038
|
+
*
|
|
19039
|
+
* Batched, the camera statuses come from ONE `getCameraStatuses` instead
|
|
19040
|
+
* of N, and the per-device composition runs concurrently.
|
|
19041
|
+
*
|
|
19042
|
+
* Per-device rather than pre-merged on purpose: a caller that renders one
|
|
19043
|
+
* camera's lanes needs to know WHICH camera a kind came from, and merging
|
|
19044
|
+
* is three lines the caller can do. `listEventKinds` stays for
|
|
19045
|
+
* single-device callers.
|
|
19046
|
+
*/
|
|
19047
|
+
listEventKindsBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(EventKindsForDeviceSchema).readonly()),
|
|
19048
|
+
/**
|
|
19049
|
+
* Sensor-event history for a camera: state changes of LINKED sensor
|
|
19050
|
+
* devices, attributed to the camera at ingest time (one row per linked
|
|
19051
|
+
* camera). Mirrors `getAudioEvents` query semantics; `kinds` narrows to
|
|
19052
|
+
* a kind subset.
|
|
19053
|
+
*/
|
|
19054
|
+
getSensorEvents: method(object({
|
|
19055
|
+
deviceId: number(),
|
|
19056
|
+
since: number().optional(),
|
|
19057
|
+
until: number().optional(),
|
|
19058
|
+
kinds: array(string()).optional(),
|
|
19059
|
+
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
|
|
19060
|
+
}), array(SensorEventSchema).readonly()),
|
|
19061
|
+
/**
|
|
19062
|
+
* Importance-ranked highlights for a device+window. Queries completed
|
|
19063
|
+
* tracks by (deviceId, firstSeen ∈ [since,until]), scores each (or reuses
|
|
19064
|
+
* the persisted score), filters by minImportance/classFilter, orders by
|
|
19065
|
+
* importance desc, and returns up to `limit` compact key events mapped to
|
|
19066
|
+
* each track's best event. Legacy tracks lacking a persisted score are
|
|
19067
|
+
* scored on-read (no write). Degrades to `[]` on error.
|
|
19068
|
+
*/
|
|
19069
|
+
getKeyEvents: method(KeyEventQueryInput, array(KeyEventSchema).readonly()),
|
|
19070
|
+
/** Server-side bucketed event counts for the 24-hour timeline.
|
|
19071
|
+
* Returns one entry per non-empty bucket; empty buckets are omitted. */
|
|
19072
|
+
getEventDensity: method(object({
|
|
19073
|
+
deviceId: number(),
|
|
19074
|
+
since: number(),
|
|
19075
|
+
until: number(),
|
|
19076
|
+
bucketMs: number().int().positive()
|
|
19077
|
+
}), array(object({
|
|
19078
|
+
bucketStart: number(),
|
|
19079
|
+
motion: number().int(),
|
|
19080
|
+
object: number().int(),
|
|
19081
|
+
audio: number().int()
|
|
19082
|
+
})).readonly()),
|
|
19083
|
+
/**
|
|
19084
|
+
* @deprecated Prefer `pruneTracksBefore` — the track is the ROOT of the
|
|
19085
|
+
* analytics model and retention must cascade from it (design §5.1). This
|
|
19086
|
+
* event-only prune leaves orphaned tracks/faces/plates/embeddings behind.
|
|
19087
|
+
* Retained as a compat shim for the Phase-B3 recorder orchestration caller,
|
|
19088
|
+
* which prunes events to keep history aligned with available footage and
|
|
19089
|
+
* reads the per-kind counts. Delete all events (motion + object + audio)
|
|
19090
|
+
* for the given device older than `cutoffMs` (exclusive) + their thumbnails
|
|
19091
|
+
* in lockstep; returns per-kind deleted counts.
|
|
19092
|
+
*/
|
|
19093
|
+
pruneEventsBefore: method(object({
|
|
19094
|
+
deviceId: number(),
|
|
19095
|
+
cutoffMs: number()
|
|
19096
|
+
}), object({
|
|
19097
|
+
motion: number().int(),
|
|
19098
|
+
object: number().int(),
|
|
19099
|
+
audio: number().int()
|
|
19100
|
+
}), {
|
|
19101
|
+
kind: "mutation",
|
|
19102
|
+
auth: "admin"
|
|
19103
|
+
}),
|
|
19104
|
+
/**
|
|
19105
|
+
* Track-centric retention entry point (design §5.1). Selects every
|
|
19106
|
+
* persisted track for the device whose `lastSeen < cutoffMs` (paged) and
|
|
19107
|
+
* runs the extensible whole-track deletion cascade (design §3): object
|
|
19108
|
+
* events + their media, track/face/plate-owned media, unassigned face
|
|
19109
|
+
* reads, per-track CLIP embeddings, then the track root LAST. ENROLLED
|
|
19110
|
+
* (assigned) faces/plates and `ownerKind:'identity'` media are exempt —
|
|
19111
|
+
* the durable matching gallery always persists. Fires the per-track
|
|
19112
|
+
* live-state cleanup so a pruned track can't linger in dispatch/overlay
|
|
19113
|
+
* state. Returns per-family deleted counts (`tracks` authoritative).
|
|
19114
|
+
*
|
|
19115
|
+
* Replaces `pruneEventsBefore` as the correct time-based retention prune.
|
|
19116
|
+
*/
|
|
19117
|
+
pruneTracksBefore: method(object({
|
|
19118
|
+
deviceId: number(),
|
|
19119
|
+
cutoffMs: number()
|
|
19120
|
+
}), TrackCascadeCountsSchema, {
|
|
19121
|
+
kind: "mutation",
|
|
19122
|
+
auth: "admin"
|
|
19123
|
+
}),
|
|
19124
|
+
/**
|
|
19125
|
+
* Operator "clean slate" for a device (design §5.3): prune EVERY track for
|
|
19126
|
+
* the device via the same cascade as `pruneTracksBefore` with `cutoffMs =
|
|
19127
|
+
* now`. One call per device — no client-side track enumeration. Enrolled
|
|
19128
|
+
* gallery + identity media are exempt (design §4). Returns per-family
|
|
19129
|
+
* deleted counts.
|
|
19130
|
+
*/
|
|
19131
|
+
wipeAllAnalytics: method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
|
|
19132
|
+
kind: "mutation",
|
|
19133
|
+
auth: "admin"
|
|
19134
|
+
}),
|
|
19135
|
+
/**
|
|
19136
|
+
* Disk-wins reconcile for one camera. Drops media index rows whose blobs
|
|
19137
|
+
* are gone, then cascades tracks (including favourited and staging) that
|
|
19138
|
+
* have no remaining files. Enrolled identity/vehicle/scene media is never
|
|
19139
|
+
* probed. Trackless motion/audio events with no remaining file are dropped,
|
|
19140
|
+
* including snapshot-less rows.
|
|
19141
|
+
*/
|
|
19142
|
+
reconcileFromDisk: method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
|
|
19143
|
+
kind: "mutation",
|
|
19144
|
+
auth: "admin"
|
|
19145
|
+
}),
|
|
19146
|
+
/**
|
|
19147
|
+
* Delete whole tracks (object events) by id for the given device,
|
|
19148
|
+
* cascading their media in lockstep. Returns the number of tracks
|
|
19149
|
+
* actually deleted plus the ids that could not be removed.
|
|
19150
|
+
*
|
|
19151
|
+
* Operator-driven from the DI Events page (batch delete). Routes through
|
|
19152
|
+
* the same widened track-deletion cascade (design §5.2).
|
|
19153
|
+
*/
|
|
19154
|
+
deleteTracks: method(object({
|
|
19155
|
+
deviceId: number(),
|
|
19156
|
+
trackIds: array(string()).min(1)
|
|
19157
|
+
}), object({
|
|
19158
|
+
deleted: number().int(),
|
|
19159
|
+
failed: array(string()).readonly()
|
|
19160
|
+
}), {
|
|
19161
|
+
kind: "mutation",
|
|
19162
|
+
auth: "admin"
|
|
19163
|
+
}),
|
|
19164
|
+
/**
|
|
19165
|
+
* Set the per-track operator flags (`markForTrain`, `debug`, `favourited`) on ONE track.
|
|
19166
|
+
* The patch is PARTIAL — an omitted key is left untouched — because the
|
|
19167
|
+
* three surfaces that write it (admin Events grid, viewer track detail,
|
|
19168
|
+
* viewer cluster detail) each own one toggle and must not clobber the other.
|
|
19169
|
+
*
|
|
19170
|
+
* Writes the track ROW: `markForTrain`/`debug` are per-TRACK state, so they
|
|
19171
|
+
* live where `label` and `importance` live, not in any per-device settings
|
|
19172
|
+
* store. Updates the in-RAM active track too, so a flag set on a live track
|
|
19173
|
+
* survives its expiry-time persist.
|
|
19174
|
+
*
|
|
19175
|
+
* `auth: 'protected'` (the default), NOT `admin`: the viewer is an
|
|
19176
|
+
* authenticated non-admin surface and two of the three call sites are
|
|
19177
|
+
* there. The note that used to sit here said to revisit this the day a flag
|
|
19178
|
+
* gained an effect that costs storage, and D81 is that day — `markForTrain`
|
|
19179
|
+
* now pins. It STAYS protected, and the reason is that the alternative
|
|
19180
|
+
* makes the feature pointless: marking a track is something you do while
|
|
19181
|
+
* looking at it, on the surface you were already looking at it on, and that
|
|
19182
|
+
* surface is the viewer. What the storage cost gets instead is a BOUND — a
|
|
19183
|
+
* per-device pin budget enforced in the body, refusing a new pin past the
|
|
19184
|
+
* limit while always allowing un-marking. `deleteTracks` next door is still
|
|
19185
|
+
* admin, because destroying evidence and preserving it are not symmetric.
|
|
19186
|
+
*
|
|
19187
|
+
* `markForTrain` writes the retrain LIFECYCLE, not a boolean column: `true`
|
|
19188
|
+
* is `none → staging`, `false` is `staging → none`. A track already
|
|
19189
|
+
* `trained` refuses BOTH — its frames are copies inside the retrain dataset
|
|
19190
|
+
* and re-staging it from a generic toggle is how the same material gets
|
|
19191
|
+
* annotated twice under two ground truths. Returning a trained track to
|
|
19192
|
+
* staging is a deliberate action of the retrain page, which is also the only
|
|
19193
|
+
* thing that produces `trained` in the first place.
|
|
19194
|
+
*
|
|
19195
|
+
* Returns the RESOLVED state of both flags (absent → `false`) plus the
|
|
19196
|
+
* `retrainStatus` they were derived from, so a caller can drive its toggle
|
|
19197
|
+
* — and render a `trained` badge — without a re-fetch. Rejects an unknown
|
|
19198
|
+
* track, a new staging mark on a device already holding its full budget, and
|
|
19199
|
+
* any `markForTrain` write against a trained track.
|
|
19200
|
+
*/
|
|
19201
|
+
setTrackFlags: method(object({
|
|
19202
|
+
/** Log/audit scope only — the trackId is globally unique on its own. */
|
|
19203
|
+
deviceId: number(),
|
|
19204
|
+
trackId: string(),
|
|
19205
|
+
flags: TrackFlagsPatchSchema
|
|
19206
|
+
}), TrackFlagsSchema, { kind: "mutation" }),
|
|
19207
|
+
/**
|
|
19208
|
+
* Durable event-store footprint for the management UI: event rows
|
|
19209
|
+
* (motion + object + audio) counted per camera + total, plus the
|
|
19210
|
+
* event-owned media bytes on disk per camera + total. Stat/count-based,
|
|
19211
|
+
* computed on demand.
|
|
19212
|
+
*/
|
|
19213
|
+
getEventStoreFootprint: method(object({}), EventStoreFootprintSchema, {
|
|
19214
|
+
kind: "query",
|
|
19215
|
+
auth: "admin"
|
|
19216
|
+
}),
|
|
19217
|
+
/**
|
|
19218
|
+
* Cluster-wide prune of events older than `olderThanMs` (exclusive) across
|
|
19219
|
+
* every camera, deleting each event's media in lockstep. Logged to the
|
|
19220
|
+
* events ops-log with `reason` (default `'retention'`). Returns the summed
|
|
19221
|
+
* per-kind deleted counts.
|
|
19222
|
+
*/
|
|
19223
|
+
pruneEvents: method(object({
|
|
19224
|
+
olderThanMs: number(),
|
|
19225
|
+
reason: OpsLogReasonSchema.optional()
|
|
19226
|
+
}), EventPruneCountsSchema, {
|
|
19227
|
+
kind: "mutation",
|
|
19228
|
+
auth: "admin"
|
|
19229
|
+
}),
|
|
19230
|
+
/**
|
|
19231
|
+
* Manually delete EVERY event (motion + object + audio) for one camera and
|
|
19232
|
+
* its event-owned media in lockstep. Logged to the events ops-log as
|
|
19233
|
+
* `op:'manual-delete', reason:'manual'`. Destructive — the admin UI guards
|
|
19234
|
+
* it behind a confirm.
|
|
19235
|
+
*/
|
|
19236
|
+
deleteDeviceEvents: method(object({ deviceId: number() }), EventPruneCountsSchema, {
|
|
19237
|
+
kind: "mutation",
|
|
19238
|
+
auth: "admin"
|
|
19239
|
+
}),
|
|
19240
|
+
/** The events ops-log rows (newest-first), optionally scoped to one camera.
|
|
19241
|
+
* Backed by a declared pipeline-analytics SQLite collection. */
|
|
19242
|
+
/** Internal migration-participant lease. It drains active MediaStore
|
|
19243
|
+
* writes and refuses new ones without changing analytics bindings. */
|
|
19244
|
+
pauseForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
|
|
19245
|
+
kind: "mutation",
|
|
19246
|
+
auth: "admin"
|
|
19247
|
+
}),
|
|
19248
|
+
resumeForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
|
|
19249
|
+
kind: "mutation",
|
|
19250
|
+
auth: "admin"
|
|
19251
|
+
}),
|
|
19252
|
+
/** Drops cached location roots after the storage coordinator repoints a
|
|
19253
|
+
* default so future event-media writes use the new root. */
|
|
19254
|
+
refreshStorageLocationsForMigration: method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
|
|
19255
|
+
kind: "mutation",
|
|
19256
|
+
auth: "admin"
|
|
19257
|
+
}),
|
|
19258
|
+
startStorageMigrationMove: method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
|
|
19259
|
+
kind: "mutation",
|
|
19260
|
+
auth: "admin"
|
|
19261
|
+
}),
|
|
19262
|
+
getStorageMigrationMoveStatus: method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }),
|
|
19263
|
+
cancelStorageMigrationMove: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
19264
|
+
kind: "mutation",
|
|
19265
|
+
auth: "admin"
|
|
19266
|
+
}),
|
|
19267
|
+
/**
|
|
19268
|
+
* Moves event media between locations — the OPERATOR's mover, without the
|
|
19269
|
+
* coordinator's lease. Twin of `recording.relocateFootage`: the same
|
|
19270
|
+
* engine the lease-gated coordinated migration uses
|
|
19271
|
+
* (`startStorageMigrationMove`), armable in the background and WITHOUT
|
|
19272
|
+
* pausing anything. Exists because `eventMedia` was the only storage
|
|
19273
|
+
* class whose only move path went through the recorder's global pause.
|
|
19274
|
+
*/
|
|
19275
|
+
relocateMedia: method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
19276
|
+
kind: "mutation",
|
|
19277
|
+
auth: "admin"
|
|
19278
|
+
}),
|
|
19279
|
+
/** Every relocate job this addon knows about, newest first (in RAM: the
|
|
19280
|
+
* move is resumable, so a lost list costs nothing but the display). */
|
|
19281
|
+
listRelocateMediaJobs: method(object({}), array(RelocateJobSchema).readonly(), {
|
|
19282
|
+
kind: "query",
|
|
19283
|
+
auth: "admin"
|
|
19284
|
+
}),
|
|
19285
|
+
/** Cancel a running or queued relocate job. */
|
|
19286
|
+
cancelRelocateMedia: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
19287
|
+
kind: "mutation",
|
|
19288
|
+
auth: "admin"
|
|
19289
|
+
}),
|
|
19290
|
+
listOpsLog: method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
|
|
19291
|
+
kind: "query",
|
|
19292
|
+
auth: "admin"
|
|
19293
|
+
}),
|
|
19294
|
+
/**
|
|
19295
|
+
* The CHEAP QUESTION, asked before any media moves: how big is the dataset
|
|
19296
|
+
* the marked (`markForTrain`) tracks would produce?
|
|
19297
|
+
*
|
|
19298
|
+
* Answered from media INDEX rows only — key, kind, size, timestamp — so it
|
|
19299
|
+
* costs ~2 KB of reads per track and no blob reads at all. The measured harm
|
|
19300
|
+
* behind D56 was a bulk pass that read and base64'd every blob a track owned
|
|
19301
|
+
* before deciding anything, taking hub-main to 82 s busy out of 120; an
|
|
19302
|
+
* export is that same I/O shape, so it inherits the same discipline: know
|
|
19303
|
+
* the size, then decide.
|
|
19304
|
+
*
|
|
19305
|
+
* `truncated` reports that more marked tracks exist than one pass carries.
|
|
19306
|
+
* Empty `deviceIds` ⇒ every device that has marked tracks.
|
|
19307
|
+
*/
|
|
19308
|
+
getTrainingExportSummary: method(object({ deviceIds: array(number()).optional() }), TrainingExportSummarySchema, {
|
|
19309
|
+
kind: "query",
|
|
19310
|
+
auth: "admin"
|
|
19311
|
+
}),
|
|
19312
|
+
/**
|
|
19313
|
+
* Where to download the dataset archive.
|
|
19314
|
+
*
|
|
19315
|
+
* The BYTES do not come back through this cap — they come from the returned
|
|
19316
|
+
* data-plane URL, which streams a tar built entry by entry. A multi-gigabyte
|
|
19317
|
+
* archive base64'd through a unary RPC envelope would be held whole in
|
|
19318
|
+
* memory twice on a hub this repo has already OOM'd once (D9/D18 are the
|
|
19319
|
+
* same lesson about frames). `getDownloadUrl` on `recordingExport` is the
|
|
19320
|
+
* precedent, and this follows it deliberately.
|
|
19321
|
+
*
|
|
19322
|
+
* The archive contains a `manifest.json` FIRST, then the stored media
|
|
19323
|
+
* VERBATIM under `tracks/<deviceId>/<trackId>/…`. No crop is derived and no
|
|
19324
|
+
* model is run: a training set's pixels must be the pixels the pipeline saw.
|
|
19325
|
+
*/
|
|
19326
|
+
getTrainingExportUrl: method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
19327
|
+
kind: "query",
|
|
19328
|
+
auth: "admin"
|
|
19329
|
+
}),
|
|
19330
|
+
/**
|
|
19331
|
+
* The staging worklist for one camera, or for every camera that has one.
|
|
19332
|
+
*
|
|
19333
|
+
* Fetched ON DEMAND, over the staging set only — the page never scans
|
|
19334
|
+
* history, because making the working set small is the entire purpose of
|
|
19335
|
+
* the mark. Each row carries how many frames the dataset already holds from
|
|
19336
|
+
* the track and how many subjects were annotated on them, so
|
|
19337
|
+
* `frameCount: 0` reads as "still to work" without a second call per track.
|
|
19338
|
+
*
|
|
19339
|
+
* `auth: 'admin'`, unlike the viewer-level mark itself: marking a track is
|
|
19340
|
+
* curation you do while looking at it, but building the training set the
|
|
19341
|
+
* fleet's models are fine-tuned on is not.
|
|
19342
|
+
*/
|
|
19343
|
+
listRetrainStaging: method(object({
|
|
19344
|
+
/** Empty ⇒ every camera that has staging tracks. A LIST, not a single
|
|
19345
|
+
* `deviceId`, deliberately: `deviceId` would make this device-bound and
|
|
19346
|
+
* route it at one camera's owner, and "every camera" would stop being
|
|
19347
|
+
* expressible at all. */
|
|
19348
|
+
deviceIds: array(number()).optional(),
|
|
19349
|
+
limit: number().int().min(1).max(500).optional()
|
|
19350
|
+
}), array(RetrainTrackSchema).readonly(), {
|
|
19351
|
+
kind: "query",
|
|
19352
|
+
auth: "admin"
|
|
19353
|
+
}),
|
|
19354
|
+
/**
|
|
19355
|
+
* What a track can contribute, and what it already has.
|
|
19356
|
+
*
|
|
19357
|
+
* `candidates` are the track's whole, unannotated frames — index rows only,
|
|
19358
|
+
* so this is cheap. `copies` are the frames already inside the dataset, and
|
|
19359
|
+
* a candidate whose copy exists is marked `copied: true`: selecting it again
|
|
19360
|
+
* is free and CANNOT fail, whatever became of the original.
|
|
19361
|
+
*
|
|
19362
|
+
* A crop, a thumbnail and `fullFrameBoxed` are never candidates. The last
|
|
19363
|
+
* one matters most: it has the model's own rectangle burned into the pixels,
|
|
19364
|
+
* and a detector trained on it learns to find a green line.
|
|
19365
|
+
*/
|
|
19366
|
+
listRetrainFrames: method(object({ trackId: string() }), RetrainFrameListSchema, {
|
|
19367
|
+
kind: "query",
|
|
19368
|
+
auth: "admin"
|
|
19369
|
+
}),
|
|
19370
|
+
/**
|
|
19371
|
+
* COPY-ON-SELECT — the write that makes `trained` safe to evict.
|
|
19372
|
+
*
|
|
19373
|
+
* Selecting a frame copies its bytes into retrain storage immediately: not
|
|
19374
|
+
* a reference, not a lease. Once the copy exists the dataset no longer
|
|
19375
|
+
* depends on the track's media, which is exactly what lets D81 hand a
|
|
19376
|
+
* `trained` track back to retention.
|
|
19377
|
+
*
|
|
19378
|
+
* The order inside is load-bearing and is pinned by a test: an EXISTING
|
|
19379
|
+
* copy is returned without touching the source, so an original that
|
|
19380
|
+
* evaporated blocks the selection of THAT ORIGINAL and never the copy
|
|
19381
|
+
* already taken. Every refusal comes back named — a dropped selection is
|
|
19382
|
+
* never silent, on the wire or in the log.
|
|
19383
|
+
*/
|
|
19384
|
+
selectRetrainFrames: method(object({
|
|
19385
|
+
deviceId: number(),
|
|
19386
|
+
trackId: string(),
|
|
19387
|
+
mediaKeys: array(string()).min(1)
|
|
19388
|
+
}), RetrainFrameSelectionSchema, {
|
|
19389
|
+
kind: "mutation",
|
|
19390
|
+
auth: "admin"
|
|
19391
|
+
}),
|
|
19392
|
+
/** Un-select a frame: its annotations go first, then the copy and its blob.
|
|
19393
|
+
* Deliberately destructive and deliberately explicit — it is the only way
|
|
19394
|
+
* a frame leaves the dataset before export. */
|
|
19395
|
+
deselectRetrainFrame: method(object({
|
|
19396
|
+
deviceId: number(),
|
|
19397
|
+
trackId: string(),
|
|
19398
|
+
frameId: string()
|
|
19399
|
+
}), object({
|
|
19400
|
+
removed: boolean(),
|
|
19401
|
+
removedAnnotations: number().int()
|
|
19402
|
+
}), {
|
|
19403
|
+
kind: "mutation",
|
|
19404
|
+
auth: "admin"
|
|
19405
|
+
}),
|
|
19406
|
+
/**
|
|
19407
|
+
* The pixels of ONE copied frame, base64.
|
|
19408
|
+
*
|
|
19409
|
+
* Through the cap rather than a data plane because it is genuinely one
|
|
19410
|
+
* frame at a time, on demand, at human speed — the shape D9/D18 permit
|
|
19411
|
+
* (what they forbid is frames crossing a boundary at frame RATE). The
|
|
19412
|
+
* annotation canvas needs the image and its exact dimensions in the same
|
|
19413
|
+
* answer: a canvas that places a normalised box against a size it guessed
|
|
19414
|
+
* draws every box in the wrong place.
|
|
19415
|
+
*/
|
|
19416
|
+
getRetrainFrameImage: method(object({ frameId: string() }), object({
|
|
19417
|
+
base64: string(),
|
|
19418
|
+
width: number().int(),
|
|
19419
|
+
height: number().int()
|
|
19420
|
+
}), {
|
|
19421
|
+
kind: "query",
|
|
19422
|
+
auth: "admin"
|
|
19423
|
+
}),
|
|
19424
|
+
/**
|
|
19425
|
+
* Ask the pipeline what it sees, as a PROPOSAL.
|
|
19426
|
+
*
|
|
19427
|
+
* Runs through `pipelineRunner.runStatelessStep` on the COPIED frame, and
|
|
19428
|
+
* every box comes back as a draft with `source: 'assist'` plus the model and
|
|
19429
|
+
* score that produced it. The operator confirms, edits, adds and deletes;
|
|
19430
|
+
* nothing is stored until `saveRetrainAnnotations`.
|
|
19431
|
+
*
|
|
19432
|
+
* For packages the request is `rfdetr-package` on the ZONE CROP at 0.35 —
|
|
19433
|
+
* never the whole frame, where a package detector at that threshold proposes
|
|
19434
|
+
* furniture. A package request with no zone is REFUSED rather than widened,
|
|
19435
|
+
* because the silent widening would look like a bad model for as long as
|
|
19436
|
+
* nobody checked which rectangle it ran on.
|
|
19437
|
+
*/
|
|
19438
|
+
proposeRetrainAnnotations: method(object({
|
|
19439
|
+
deviceId: number(),
|
|
19440
|
+
trackId: string(),
|
|
19441
|
+
frameId: string(),
|
|
19442
|
+
subject: RetrainAssistSubjectSchema,
|
|
19443
|
+
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
19444
|
+
nodeId: string().optional()
|
|
19445
|
+
}), RetrainAssistResultSchema, {
|
|
19446
|
+
kind: "mutation",
|
|
19447
|
+
auth: "admin"
|
|
19448
|
+
}),
|
|
19449
|
+
/**
|
|
19450
|
+
* The FrameProcessor pass of a replay run — see the `Replay` section
|
|
19451
|
+
* above this capability's definition for why this is not the
|
|
19452
|
+
* `processFrame` method this file's header says pipeline-analytics does
|
|
19453
|
+
* not have.
|
|
19454
|
+
*
|
|
19455
|
+
* Constructs a FRESH `FrameProcessor` for `(deviceId, source)`, feeds it
|
|
19456
|
+
* `frames` IN THE ORDER GIVEN (the caller is responsible for time
|
|
19457
|
+
* ordering — this method does not sort), and returns the tracks it
|
|
19458
|
+
* produced. Zero persistence: no `TrackStore`, no event bus, no media
|
|
19459
|
+
* capture. `zones` / `detectionRules` are the run's OWN zone set —
|
|
19460
|
+
* typically the camera's real zones plus an ephemeral overlay
|
|
19461
|
+
* (`addon-benchmark`'s `replay-plan.ts`), never read from or written to
|
|
19462
|
+
* the `zones` capability by this method itself.
|
|
19463
|
+
*/
|
|
19464
|
+
runReplayFrameProcessor: method(object({
|
|
19465
|
+
deviceId: number(),
|
|
19466
|
+
source: DetectionSourceSchema,
|
|
19467
|
+
zones: array(ZoneSchema).readonly().optional(),
|
|
19468
|
+
detectionRules: array(ZoneRuleSchema).readonly().optional(),
|
|
19469
|
+
zoneMembershipMinOverlap: number().min(0).max(1).optional(),
|
|
19470
|
+
frames: array(ReplayFrameInputSchema).min(1)
|
|
19471
|
+
}), RunReplayFrameProcessorResultSchema, {
|
|
19472
|
+
kind: "mutation",
|
|
19473
|
+
auth: "admin"
|
|
19474
|
+
}),
|
|
19475
|
+
/** Every annotation on a track, oldest first. */
|
|
19476
|
+
listRetrainAnnotations: method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
19477
|
+
kind: "query",
|
|
19478
|
+
auth: "admin"
|
|
19479
|
+
}),
|
|
19480
|
+
/**
|
|
19481
|
+
* Replace EVERY annotation on one frame with the supplied set.
|
|
19482
|
+
*
|
|
19483
|
+
* Whole-frame replacement, not per-box upsert: the unit of ground truth is
|
|
19484
|
+
* the frame, and "the operator deleted a box" must be the same durable
|
|
19485
|
+
* outcome as "the operator never drew it". A per-box patch would let a frame
|
|
19486
|
+
* keep a box the operator removed on a surface that only knew about the
|
|
19487
|
+
* boxes it sent.
|
|
19488
|
+
*
|
|
19489
|
+
* Refuses a macro class typed into `label` or `subLabel` — the tiers are
|
|
19490
|
+
* separate and the guard is at the WRITE, because a mixed taxonomy cannot
|
|
19491
|
+
* be un-mixed by reading it.
|
|
19492
|
+
*/
|
|
19493
|
+
saveRetrainAnnotations: method(object({
|
|
19494
|
+
deviceId: number(),
|
|
19495
|
+
trackId: string(),
|
|
19496
|
+
frameId: string(),
|
|
19497
|
+
annotations: array(RetrainAnnotationDraftSchema)
|
|
19498
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
19499
|
+
kind: "mutation",
|
|
19500
|
+
auth: "admin"
|
|
19501
|
+
}),
|
|
19502
|
+
/**
|
|
19503
|
+
* Finish with a track: `staging → trained`. **The only writer of that
|
|
19504
|
+
* state** — D81 shipped the column with it deliberately unreachable.
|
|
19505
|
+
*
|
|
19506
|
+
* Refuses a track the dataset holds no copies from. `trained` un-pins the
|
|
19507
|
+
* track's media, so completing without a copy is a delete order for material
|
|
19508
|
+
* nothing ever extracted anything from; that refusal IS the safety argument
|
|
19509
|
+
* of D81, expressed as a precondition.
|
|
19510
|
+
*/
|
|
19511
|
+
completeRetrainTrack: method(object({
|
|
19512
|
+
deviceId: number(),
|
|
19513
|
+
trackId: string()
|
|
19514
|
+
}), RetrainTransitionResultSchema, {
|
|
19515
|
+
kind: "mutation",
|
|
19516
|
+
auth: "admin"
|
|
19517
|
+
}),
|
|
19518
|
+
/**
|
|
19519
|
+
* The deliberate return: `trained → staging`, for the rare case.
|
|
19520
|
+
*
|
|
19521
|
+
* The generic `setTrackFlags` toggle refuses this in both directions by
|
|
19522
|
+
* design (D81) — re-staging from a checkbox is how the same material gets
|
|
19523
|
+
* annotated twice under two ground truths. Doing it here means the operator
|
|
19524
|
+
* is looking at the annotations that already exist while they decide, and
|
|
19525
|
+
* those annotations are LEFT ALONE: "put this back" must not be a
|
|
19526
|
+
* destructive act wearing a navigational name.
|
|
19527
|
+
*/
|
|
19528
|
+
restageRetrainTrack: method(object({
|
|
19529
|
+
deviceId: number(),
|
|
19530
|
+
trackId: string()
|
|
19531
|
+
}), RetrainTransitionResultSchema, {
|
|
19532
|
+
kind: "mutation",
|
|
19533
|
+
auth: "admin"
|
|
19534
|
+
}),
|
|
19535
|
+
/**
|
|
19536
|
+
* Where to download the ANNOTATED dataset.
|
|
19537
|
+
*
|
|
19538
|
+
* The sibling of `getTrainingExportUrl` and deliberately not the same
|
|
19539
|
+
* archive: that one streams a marked track's stored media verbatim, this one
|
|
19540
|
+
* streams the retrain COPIES plus an `annotations.json` carrying, for every
|
|
19541
|
+
* subject, the canonical full-frame box AND the geometry derived for each
|
|
19542
|
+
* model shape (letterboxed root / zone-cropped package / subject-cropped
|
|
19543
|
+
* classifier). Derived at export, never stored — one box in, three shapes
|
|
19544
|
+
* out, so two crops of the same subject can never end up in one feature
|
|
19545
|
+
* space (D52).
|
|
19546
|
+
*/
|
|
19547
|
+
getRetrainExportUrl: method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
19548
|
+
kind: "query",
|
|
19549
|
+
auth: "admin"
|
|
19550
|
+
}),
|
|
19551
|
+
getEventMedia: method(object({
|
|
19552
|
+
eventId: string(),
|
|
19553
|
+
kind: MediaFileKindEnum.optional(),
|
|
19554
|
+
deviceId: number()
|
|
19555
|
+
}), array(MediaFileSchema).readonly()),
|
|
19556
|
+
/** All media rows owned by a track. `kinds` narrows to a kind subset so a
|
|
19557
|
+
* client can fetch the SMALL display variants on open and pull the
|
|
19558
|
+
* multi-MB native variants only on demand (mirrors `getEventMedia.kind`).
|
|
19559
|
+
* Absent ⇒ every kind (back-compat). */
|
|
19560
|
+
getTrackMedia: method(object({
|
|
19561
|
+
trackId: string(),
|
|
19562
|
+
kinds: array(MediaFileKindEnum).optional(),
|
|
19563
|
+
deviceId: number()
|
|
19564
|
+
}), array(MediaFileSchema).readonly()),
|
|
19565
|
+
/**
|
|
19566
|
+
* What media a track HAS, without any of it.
|
|
19567
|
+
*
|
|
19568
|
+
* The detail view needs the shape of a track's media to build its strip —
|
|
19569
|
+
* which kinds exist, in what order, at what size — and then wants each tile
|
|
19570
|
+
* fetched as an image, not as base64 inside this response. Measured: the
|
|
19571
|
+
* full `getTrackMedia` is 5.3-7.7 MB and blocks the view; this manifest is
|
|
19572
|
+
* ~2 KB.
|
|
19573
|
+
*
|
|
19574
|
+
* It also restores a fact a `kinds` filter destroys: filtering
|
|
19575
|
+
* `getTrackMedia` drops whole ROWS, taking `kind` and `sizeBytes` with
|
|
19576
|
+
* them, so a client that fetched only the small variants could no longer
|
|
19577
|
+
* tell a full-resolution variant existed — and the affordance that opens it
|
|
19578
|
+
* would silently disappear.
|
|
19579
|
+
*/
|
|
19580
|
+
listTrackMedia: method(object({
|
|
19581
|
+
trackId: string(),
|
|
19582
|
+
deviceId: number()
|
|
19583
|
+
}), array(MediaFileInfoSchema).readonly()),
|
|
19584
|
+
/**
|
|
19585
|
+
* Search object events by text query using CLIP cosine similarity.
|
|
19586
|
+
* Encodes `text` via the `embedding-encoder` cap, queries the
|
|
19587
|
+
* `ObjectEmbeddingStore` with optional prefilters, ranks all matching
|
|
19588
|
+
* embeddings by cosine similarity, and joins winners to their
|
|
19589
|
+
* ObjectEvents by trackId. Returns up to `limit` events scored ≥
|
|
19590
|
+
* `minScore`, sorted descending by score.
|
|
19591
|
+
*/
|
|
19592
|
+
searchObjectEvents: method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()),
|
|
19593
|
+
wipeObjectEmbeddings: method(object({}), WipeObjectEmbeddingsResultSchema, {
|
|
19594
|
+
kind: "mutation",
|
|
19595
|
+
auth: "admin"
|
|
19596
|
+
}),
|
|
19597
|
+
rebuildObjectEmbeddings: method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
|
|
19598
|
+
kind: "mutation",
|
|
19599
|
+
auth: "admin"
|
|
19600
|
+
}),
|
|
19601
|
+
getObjectEmbeddingRebuildStatus: method(object({}), RebuildStatusSchema)
|
|
19602
|
+
},
|
|
19603
|
+
events: {
|
|
19604
|
+
/**
|
|
19605
|
+
* Enriched frame emitted after refinement — the live-overlay source of
|
|
19606
|
+
* truth (two-plane re-injection). Carries the frame's detections in the
|
|
19607
|
+
* `ObjectDetection` wire shape: first-level roots (with track info +
|
|
19608
|
+
* enrichment labels) plus synthesized `kind:'detail'` face/plate entries
|
|
19609
|
+
* re-projected from per-track detail state, so stream overlays render
|
|
19610
|
+
* boxes + recognized names without querying full Track state.
|
|
19611
|
+
*/
|
|
19612
|
+
onFrameTracked: { data: object({
|
|
19613
|
+
deviceId: number(),
|
|
19614
|
+
timestamp: number(),
|
|
19615
|
+
frameWidth: number(),
|
|
19616
|
+
frameHeight: number(),
|
|
19617
|
+
detections: array(OverlayDetectionSchema).readonly()
|
|
19618
|
+
}) },
|
|
19619
|
+
/** Track entered active state (first-seen). */
|
|
19620
|
+
onTrackStarted: { data: object({
|
|
19621
|
+
deviceId: number(),
|
|
19622
|
+
trackId: string(),
|
|
19623
|
+
className: string()
|
|
19624
|
+
}) },
|
|
19625
|
+
/** Track expired (TTL reached after last detection). */
|
|
19626
|
+
onTrackEnded: { data: object({
|
|
19627
|
+
deviceId: number(),
|
|
19628
|
+
trackId: string(),
|
|
19629
|
+
className: string(),
|
|
19630
|
+
durationMs: number()
|
|
19631
|
+
}) },
|
|
19632
|
+
/** Canonical "something happened at device X" event, per-kind. */
|
|
19633
|
+
onDetectionEvent: { data: object({
|
|
19634
|
+
deviceId: number(),
|
|
19635
|
+
kind: EventKindSchema,
|
|
19636
|
+
eventId: string(),
|
|
19637
|
+
timestamp: number()
|
|
19638
|
+
}) }
|
|
19639
|
+
}
|
|
19640
|
+
};
|
|
19389
19641
|
object({
|
|
19390
19642
|
activeCameras: number(),
|
|
19391
19643
|
throttledCameras: number(),
|
|
@@ -19411,106 +19663,6 @@ var CameraMetricsSchema = object({
|
|
|
19411
19663
|
});
|
|
19412
19664
|
var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
|
|
19413
19665
|
/**
|
|
19414
|
-
* Zone — pure geometry + identity. NO filtering behaviour.
|
|
19415
|
-
*
|
|
19416
|
-
* Zones describe **where** in the frame the operator wants to flag
|
|
19417
|
-
* something; consumer-owned {@link ZoneRule} arrays describe **how**
|
|
19418
|
-
* each pipeline stage uses them. Splitting the two means a single
|
|
19419
|
-
* polygon "Driveway" can simultaneously back a motion-exclude rule,
|
|
19420
|
-
* a detection-include rule on `['car']`, and an occupancy aggregate
|
|
19421
|
-
* — without three duplicated polygons.
|
|
19422
|
-
*
|
|
19423
|
-
* Owned by the orchestrator addon (provider) and mirrored into the
|
|
19424
|
-
* `zones` device-state slice on every mutation. Consumers
|
|
19425
|
-
* (motion-wasm, pipeline-executor, analytics, admin UI) read either
|
|
19426
|
-
* via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
|
|
19427
|
-
* mirror with `onChanged`).
|
|
19428
|
-
*
|
|
19429
|
-
* Coordinates are normalised fractions of the frame (0–1) so zones
|
|
19430
|
-
* survive resolution changes and stream profile switches.
|
|
19431
|
-
*
|
|
19432
|
-
* `kind` discriminates between full polygons (closed regions used
|
|
19433
|
-
* for intrusion / occupancy filters) and tripwires (open 2-point
|
|
19434
|
-
* line segments used for cross events). Onboard / firmware-reported
|
|
19435
|
-
* zones (Reolink, ONVIF) are out of scope for now — see the deferred
|
|
19436
|
-
* task list.
|
|
19437
|
-
*/
|
|
19438
|
-
var ZoneKindEnum = _enum(["polygon", "tripwire"]);
|
|
19439
|
-
/** Polygon vertex in fraction-of-frame coordinates (0–1). */
|
|
19440
|
-
var PolygonPointSchema = object({
|
|
19441
|
-
x: number(),
|
|
19442
|
-
y: number()
|
|
19443
|
-
});
|
|
19444
|
-
/** A camera detection zone — pure geometry/identity. */
|
|
19445
|
-
var ZoneSchema = object({
|
|
19446
|
-
id: string(),
|
|
19447
|
-
name: string(),
|
|
19448
|
-
kind: ZoneKindEnum.default("polygon"),
|
|
19449
|
-
/** Polygon vertices, fraction of frame (0–1). */
|
|
19450
|
-
polygon: array(PolygonPointSchema).readonly(),
|
|
19451
|
-
/** Visual color for UI rendering. */
|
|
19452
|
-
color: string().default("#3b82f6")
|
|
19453
|
-
});
|
|
19454
|
-
/**
|
|
19455
|
-
* Zones capability — per-camera CRUD over polygon detection zones.
|
|
19456
|
-
*
|
|
19457
|
-
* Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
|
|
19458
|
-
* to per-device settings and mirrors into the `zones` device-state
|
|
19459
|
-
* slice on every mutation, so downstream consumers can subscribe via
|
|
19460
|
-
* `dev.state.zones.onChanged`.
|
|
19461
|
-
*
|
|
19462
|
-
* The cap surface only handles geometry + identity; filtering
|
|
19463
|
-
* behaviour (per-class, include/exclude, threshold) lives in the
|
|
19464
|
-
* consumer addons' rule arrays — see `ZoneRuleSchema` exported from
|
|
19465
|
-
* `capabilities/schemas/zone-rule.js`.
|
|
19466
|
-
*/
|
|
19467
|
-
var zonesCapability = {
|
|
19468
|
-
name: "zones",
|
|
19469
|
-
scope: "device",
|
|
19470
|
-
mode: "singleton",
|
|
19471
|
-
deviceTypes: [DeviceType.Camera],
|
|
19472
|
-
methods: {
|
|
19473
|
-
listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
|
|
19474
|
-
addZone: method(object({
|
|
19475
|
-
deviceId: number(),
|
|
19476
|
-
zone: ZoneSchema
|
|
19477
|
-
}), _void(), {
|
|
19478
|
-
kind: "mutation",
|
|
19479
|
-
auth: "admin"
|
|
19480
|
-
}),
|
|
19481
|
-
removeZone: method(object({
|
|
19482
|
-
deviceId: number(),
|
|
19483
|
-
zoneId: string()
|
|
19484
|
-
}), _void(), {
|
|
19485
|
-
kind: "mutation",
|
|
19486
|
-
auth: "admin"
|
|
19487
|
-
}),
|
|
19488
|
-
updateZone: method(object({
|
|
19489
|
-
deviceId: number(),
|
|
19490
|
-
zone: ZoneSchema
|
|
19491
|
-
}), _void(), {
|
|
19492
|
-
kind: "mutation",
|
|
19493
|
-
auth: "admin"
|
|
19494
|
-
})
|
|
19495
|
-
},
|
|
19496
|
-
/**
|
|
19497
|
-
* Runtime-state slice — the live zone catalogue mirrored by the
|
|
19498
|
-
* orchestrator on every CRUD mutation. Consumers read via
|
|
19499
|
-
* `device.state.zones.value` / `.watch(...)` without round-tripping
|
|
19500
|
-
* the cap, and the codegen DeviceProxy auto-wires the reactive
|
|
19501
|
-
* handle. Slice shape is `{ zones: Zone[] }` so future extensions
|
|
19502
|
-
* (e.g. zone groupings) can sit alongside the polygon list.
|
|
19503
|
-
*/
|
|
19504
|
-
runtimeState: object({ zones: array(ZoneSchema).readonly() }),
|
|
19505
|
-
/**
|
|
19506
|
-
* Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
|
|
19507
|
-
*
|
|
19508
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
19509
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
19510
|
-
*/
|
|
19511
|
-
durability: "restored"
|
|
19512
|
-
};
|
|
19513
|
-
/**
|
|
19514
19666
|
* A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
|
|
19515
19667
|
* decode worker resolves it against the RETAINED native frame's real pixel dims,
|
|
19516
19668
|
* so the caller supplies only the detection-res bbox divided by the detection
|
|
@@ -28950,92 +29102,6 @@ var sceneMonitorCapability = {
|
|
|
28950
29102
|
durability: "session"
|
|
28951
29103
|
};
|
|
28952
29104
|
/**
|
|
28953
|
-
* Per-stage gating mode applied to the zones a rule references.
|
|
28954
|
-
*
|
|
28955
|
-
* - `include`: the rule contributes to a **whitelist** for its stage.
|
|
28956
|
-
* When at least one `include` rule fires for a stage, only entities
|
|
28957
|
-
* inside one of those zones pass that stage.
|
|
28958
|
-
* - `exclude`: the rule contributes to a **blacklist** for its stage.
|
|
28959
|
-
* Entities inside one of those zones are dropped at that stage.
|
|
28960
|
-
*
|
|
28961
|
-
* `monitor`-style observation (count without filtering) is not a rule
|
|
28962
|
-
* mode — zones without any matching rule are observed naturally by
|
|
28963
|
-
* `zone-analytics` (live snapshot + history), so an "I just want to
|
|
28964
|
-
* count, not filter" use case needs no rule at all.
|
|
28965
|
-
*/
|
|
28966
|
-
var ZoneRuleModeEnum = _enum(["include", "exclude"]);
|
|
28967
|
-
/**
|
|
28968
|
-
* Per-consumer rule that references existing zones (geometry) and
|
|
28969
|
-
* defines how a specific pipeline stage should treat them. Each
|
|
28970
|
-
* consumer addon owns its own `ZoneRule[]` array in its per-device
|
|
28971
|
-
* settings:
|
|
28972
|
-
*
|
|
28973
|
-
* - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
|
|
28974
|
-
* - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
|
|
28975
|
-
* - future: notification rules, audio gating, etc.
|
|
28976
|
-
*
|
|
28977
|
-
* One rule applies to N zones (`zoneIds[]`) so the operator can
|
|
28978
|
-
* express "ignore motion in ALL of {garden, street}" with a single
|
|
28979
|
-
* rule. `classFilter` narrows the rule to specific object classes —
|
|
28980
|
-
* "drop person detections in the street, but keep cars" is one
|
|
28981
|
-
* `exclude` rule with `classFilter: ['person']`.
|
|
28982
|
-
*
|
|
28983
|
-
* `enabled` is a soft toggle — the operator can keep the rule
|
|
28984
|
-
* configured but inert without deleting it.
|
|
28985
|
-
*/
|
|
28986
|
-
var ZoneRuleSchema = object({
|
|
28987
|
-
/** Stable rule id — survives edits, used by the UI for diffing. */
|
|
28988
|
-
id: string(),
|
|
28989
|
-
/** Optional human-readable label rendered in the rule editor. */
|
|
28990
|
-
name: string().optional(),
|
|
28991
|
-
/** Zones this rule targets. The rule's `mode` applies to ALL
|
|
28992
|
-
* listed zones (OR-set: a detection in any one of them counts).
|
|
28993
|
-
* At least one zone id required — a rule with no targets is a
|
|
28994
|
-
* configuration mistake and the form validator rejects it. */
|
|
28995
|
-
zoneIds: array(string()).min(1).readonly(),
|
|
28996
|
-
mode: ZoneRuleModeEnum,
|
|
28997
|
-
/**
|
|
28998
|
-
* Class names this rule applies to. Empty / undefined ⇒ rule
|
|
28999
|
-
* applies to every class. Class strings match the `macroClass`
|
|
29000
|
-
* field on detections (e.g. `person`, `car`, `dog`).
|
|
29001
|
-
*/
|
|
29002
|
-
classFilter: array(string()).readonly().optional(),
|
|
29003
|
-
/**
|
|
29004
|
-
* Minimum bbox/mask overlap (0–1) with any of the rule's zones
|
|
29005
|
-
* required to consider an entity "in the zone". Defaults to the
|
|
29006
|
-
* consumer's stage default when omitted. Kept for back-compat with
|
|
29007
|
-
* existing per-rule overrides; new operators pick the value via
|
|
29008
|
-
* `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
|
|
29009
|
-
* set, the lower-level engine reads it as a 0–1 fraction.
|
|
29010
|
-
*/
|
|
29011
|
-
overlapThreshold: number().min(0).max(1).optional(),
|
|
29012
|
-
/**
|
|
29013
|
-
* Operator-friendly version of `overlapThreshold` — the percentage
|
|
29014
|
-
* of the detection's bbox that must lie inside the zone for the
|
|
29015
|
-
* rule to match. Documented default is 85%; the engine substitutes
|
|
29016
|
-
* that when the field is omitted (kept optional so existing rules
|
|
29017
|
-
* stored without it stay valid).
|
|
29018
|
-
*
|
|
29019
|
-
* When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
|
|
29020
|
-
* rule, the engine prefers `bboxInclusionPct` because it's the
|
|
29021
|
-
* field exposed in the UI. Internally both feed the same gate.
|
|
29022
|
-
*/
|
|
29023
|
-
bboxInclusionPct: number().min(0).max(100).optional(),
|
|
29024
|
-
/**
|
|
29025
|
-
* When `true` and a detection has a segmentation mask, use the
|
|
29026
|
-
* mask for overlap instead of the bbox. Detection-stage only;
|
|
29027
|
-
* motion rules ignore this field.
|
|
29028
|
-
*/
|
|
29029
|
-
preferMask: boolean().optional(),
|
|
29030
|
-
/**
|
|
29031
|
-
* Soft-toggle: `false` disables the rule without deleting it.
|
|
29032
|
-
* Defaults to `true` so operators creating a rule via the UI
|
|
29033
|
-
* see it active immediately.
|
|
29034
|
-
*/
|
|
29035
|
-
enabled: boolean().default(true)
|
|
29036
|
-
});
|
|
29037
|
-
array(ZoneRuleSchema).readonly();
|
|
29038
|
-
/**
|
|
29039
29105
|
* Script-runner cap. Models HA `script.*` entities on
|
|
29040
29106
|
* `DeviceType.Script`. A Script is a pre-recorded action sequence
|
|
29041
29107
|
* that can be invoked imperatively — optionally with a variables
|
|
@@ -35024,6 +35090,12 @@ Object.freeze({
|
|
|
35024
35090
|
addonId: null,
|
|
35025
35091
|
access: "create"
|
|
35026
35092
|
},
|
|
35093
|
+
"pipelineAnalytics.runReplayFrameProcessor": {
|
|
35094
|
+
capName: "pipeline-analytics",
|
|
35095
|
+
capScope: "device",
|
|
35096
|
+
addonId: null,
|
|
35097
|
+
access: "create"
|
|
35098
|
+
},
|
|
35027
35099
|
"pipelineAnalytics.saveRetrainAnnotations": {
|
|
35028
35100
|
capName: "pipeline-analytics",
|
|
35029
35101
|
capScope: "device",
|
|
@@ -35156,6 +35228,12 @@ Object.freeze({
|
|
|
35156
35228
|
addonId: null,
|
|
35157
35229
|
access: "view"
|
|
35158
35230
|
},
|
|
35231
|
+
"pipelineExecutor.getInferenceDeviceHealth": {
|
|
35232
|
+
capName: "pipeline-executor",
|
|
35233
|
+
capScope: "system",
|
|
35234
|
+
addonId: null,
|
|
35235
|
+
access: "view"
|
|
35236
|
+
},
|
|
35159
35237
|
"pipelineExecutor.getOrchestratorConfigSchema": {
|
|
35160
35238
|
capName: "pipeline-executor",
|
|
35161
35239
|
capScope: "system",
|
|
@@ -35228,6 +35306,12 @@ Object.freeze({
|
|
|
35228
35306
|
addonId: null,
|
|
35229
35307
|
access: "view"
|
|
35230
35308
|
},
|
|
35309
|
+
"pipelineExecutor.rearmInferenceDevice": {
|
|
35310
|
+
capName: "pipeline-executor",
|
|
35311
|
+
capScope: "system",
|
|
35312
|
+
addonId: null,
|
|
35313
|
+
access: "create"
|
|
35314
|
+
},
|
|
35231
35315
|
"pipelineExecutor.runAudioTest": {
|
|
35232
35316
|
capName: "pipeline-executor",
|
|
35233
35317
|
capScope: "system",
|
|
@@ -38476,6 +38560,11 @@ Object.freeze({
|
|
|
38476
38560
|
form: "single",
|
|
38477
38561
|
optional: false
|
|
38478
38562
|
}],
|
|
38563
|
+
"pipelineAnalytics.runReplayFrameProcessor": [{
|
|
38564
|
+
name: "deviceId",
|
|
38565
|
+
form: "single",
|
|
38566
|
+
optional: false
|
|
38567
|
+
}],
|
|
38479
38568
|
"pipelineAnalytics.saveRetrainAnnotations": [{
|
|
38480
38569
|
name: "deviceId",
|
|
38481
38570
|
form: "single",
|