@camstack/addon-post-analysis 1.2.50 → 1.2.51
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-Bm5GpbGn.js → dist-CnSzKo7x.js} +993 -4
- package/dist/{dist-BhadCxSQ.mjs → dist-DTeVOZBt.mjs} +970 -4
- package/dist/embedding-encoder/index.js +1 -1
- package/dist/embedding-encoder/index.mjs +2 -1
- package/dist/node-CnEKzHgS.js +653 -0
- package/dist/node-pIpcQ_aN.mjs +649 -0
- package/dist/pipeline-analytics/_stub.js +1 -1
- package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-B0B7ZGiM.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-D-6lLgLp.mjs} +2 -2
- package/dist/pipeline-analytics/{_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CJ3AVT6B.mjs → _virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-JSo2V9IT.mjs} +1 -1
- package/dist/pipeline-analytics/{hostInit-BahNk1yZ.mjs → hostInit-DPOdauxs.mjs} +2 -2
- package/dist/pipeline-analytics/index.js +14754 -11416
- package/dist/pipeline-analytics/index.mjs +14755 -11417
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/node-Co0YpEFr.mjs +0 -148
- package/dist/node-HEkeoPPw.js +0 -151
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
|
-
|
|
22
|
+
require("node:crypto");
|
|
23
23
|
//#region ../types/dist/event-category-41fKf-q9.mjs
|
|
24
24
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
25
25
|
EventCategory["SystemBoot"] = "system.boot";
|
|
@@ -7157,6 +7157,473 @@ function sleep(ms) {
|
|
|
7157
7157
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
7158
7158
|
}
|
|
7159
7159
|
//#endregion
|
|
7160
|
+
//#region ../types/dist/fmp4-box-splitter-B53u9-Nu.mjs
|
|
7161
|
+
var AUDIO_ENCODER_BY_CODEC = {
|
|
7162
|
+
opus: "libopus",
|
|
7163
|
+
aac: "aac",
|
|
7164
|
+
pcmu: "pcm_mulaw",
|
|
7165
|
+
pcma: "pcm_alaw"
|
|
7166
|
+
};
|
|
7167
|
+
/**
|
|
7168
|
+
* Camera-microphone audio, per codec. Lives HERE rather than in
|
|
7169
|
+
* `encode-defaults.ts` only to avoid an import cycle (`encode-defaults` depends
|
|
7170
|
+
* on these types); it is re-exported from there, which is where to read it.
|
|
7171
|
+
*
|
|
7172
|
+
* Every source in this repo is a mono camera mic. The former broker preset
|
|
7173
|
+
* encoded Opus at `channels: 2`, spending bitrate duplicating one channel —
|
|
7174
|
+
* that is the value this consolidation changed.
|
|
7175
|
+
*/
|
|
7176
|
+
var AUDIO_PRESETS = {
|
|
7177
|
+
aac: {
|
|
7178
|
+
kind: "encode",
|
|
7179
|
+
codec: "aac",
|
|
7180
|
+
bitrateKbps: 128,
|
|
7181
|
+
sampleRateHz: 48e3,
|
|
7182
|
+
channels: 1
|
|
7183
|
+
},
|
|
7184
|
+
opus: {
|
|
7185
|
+
kind: "encode",
|
|
7186
|
+
codec: "opus",
|
|
7187
|
+
bitrateKbps: 64,
|
|
7188
|
+
sampleRateHz: 48e3,
|
|
7189
|
+
channels: 1
|
|
7190
|
+
},
|
|
7191
|
+
pcmu: {
|
|
7192
|
+
kind: "encode",
|
|
7193
|
+
codec: "pcmu",
|
|
7194
|
+
sampleRateHz: 8e3,
|
|
7195
|
+
channels: 1
|
|
7196
|
+
}
|
|
7197
|
+
};
|
|
7198
|
+
/** `-hide_banner -loglevel <level>` — every ffmpeg site opens with this. */
|
|
7199
|
+
function logBannerArgs(level) {
|
|
7200
|
+
return [
|
|
7201
|
+
"-hide_banner",
|
|
7202
|
+
"-loglevel",
|
|
7203
|
+
level
|
|
7204
|
+
];
|
|
7205
|
+
}
|
|
7206
|
+
/** `true` when the resolved value means "decode in software" (⇒ no `-hwaccel`). */
|
|
7207
|
+
function isSoftwareDecode(decodeHwAccel) {
|
|
7208
|
+
return !decodeHwAccel || decodeHwAccel === "none" || decodeHwAccel === "copy";
|
|
7209
|
+
}
|
|
7210
|
+
/**
|
|
7211
|
+
* Every INPUT option, in order, terminated by `-i <url>`. Nothing may be
|
|
7212
|
+
* appended to this list by a caller — that is the whole point of the function.
|
|
7213
|
+
*/
|
|
7214
|
+
function buildInputArgs(input, decodeHwAccel) {
|
|
7215
|
+
const args = [];
|
|
7216
|
+
if (!isSoftwareDecode(decodeHwAccel)) args.push("-hwaccel", String(decodeHwAccel));
|
|
7217
|
+
if (input.extraArgs?.length) args.push(...input.extraArgs);
|
|
7218
|
+
if (input.analyzeDurationUs !== void 0) args.push("-analyzeduration", String(input.analyzeDurationUs));
|
|
7219
|
+
if (input.probeSizeBytes !== void 0) args.push("-probesize", String(input.probeSizeBytes));
|
|
7220
|
+
if (input.fflags?.length) for (const flag of input.fflags) args.push("-fflags", flag);
|
|
7221
|
+
if (input.rtspTransport) args.push("-rtsp_transport", input.rtspTransport);
|
|
7222
|
+
args.push("-i", input.url);
|
|
7223
|
+
return args;
|
|
7224
|
+
}
|
|
7225
|
+
/** The `-vf` filter args, or `[]` when a consumer `-vf` already claims the slot. */
|
|
7226
|
+
function buildVideoFilterArgs(scale, outputArgs) {
|
|
7227
|
+
if (!scale) return [];
|
|
7228
|
+
if (outputArgs.some((a) => a === "-vf")) return [];
|
|
7229
|
+
if (scale.mode === "exact") return ["-vf", `scale=${scale.width}:${scale.height}`];
|
|
7230
|
+
return ["-vf", `scale='min(${scale.width},iw)':'min(${scale.height},ih)':force_original_aspect_ratio=decrease:force_divisible_by=2`];
|
|
7231
|
+
}
|
|
7232
|
+
/** Rate-control args for an encode plan. */
|
|
7233
|
+
function buildRateControlArgs(video) {
|
|
7234
|
+
const kbps = video.bitrateKbps;
|
|
7235
|
+
if (kbps === void 0) return [];
|
|
7236
|
+
const rc = video.rateControl ?? {
|
|
7237
|
+
kind: "cap",
|
|
7238
|
+
vbvSeconds: 2
|
|
7239
|
+
};
|
|
7240
|
+
const bufsize = Math.max(1, Math.round(kbps * rc.vbvSeconds));
|
|
7241
|
+
return [
|
|
7242
|
+
...rc.kind === "cbr" ? ["-b:v", `${kbps}k`] : [],
|
|
7243
|
+
"-maxrate",
|
|
7244
|
+
`${kbps}k`,
|
|
7245
|
+
"-bufsize",
|
|
7246
|
+
`${bufsize}k`
|
|
7247
|
+
];
|
|
7248
|
+
}
|
|
7249
|
+
/** The whole video block (`-vf` … `-c:v` … knobs), after `-i`. */
|
|
7250
|
+
function buildVideoArgs(video, outputArgs) {
|
|
7251
|
+
if (video.kind === "copy") return [
|
|
7252
|
+
"-c:v",
|
|
7253
|
+
"copy",
|
|
7254
|
+
...video.bitstreamFilter ? ["-bsf:v", video.bitstreamFilter] : []
|
|
7255
|
+
];
|
|
7256
|
+
const args = [
|
|
7257
|
+
...buildVideoFilterArgs(video.scale, outputArgs),
|
|
7258
|
+
"-c:v",
|
|
7259
|
+
video.encoder
|
|
7260
|
+
];
|
|
7261
|
+
if (video.preset !== void 0) args.push("-preset", video.preset);
|
|
7262
|
+
if (video.tune !== void 0) args.push("-tune", video.tune);
|
|
7263
|
+
if (video.profile !== void 0) args.push("-profile:v", video.profile);
|
|
7264
|
+
if (video.level !== void 0) args.push("-level", video.level);
|
|
7265
|
+
if (video.pixelFormat !== void 0) args.push("-pix_fmt", video.pixelFormat);
|
|
7266
|
+
if (video.fps !== void 0) args.push("-r", String(video.fps));
|
|
7267
|
+
if (video.gopFrames !== void 0) args.push("-g", String(video.gopFrames));
|
|
7268
|
+
if (video.forceKeyFramesSeconds !== void 0) args.push("-force_key_frames", `expr:gte(t,n_forced*${video.forceKeyFramesSeconds})`);
|
|
7269
|
+
if (video.bf !== void 0) args.push("-bf", String(video.bf));
|
|
7270
|
+
args.push(...buildRateControlArgs(video));
|
|
7271
|
+
if (video.bitstreamFilter !== void 0) args.push("-bsf:v", video.bitstreamFilter);
|
|
7272
|
+
return args;
|
|
7273
|
+
}
|
|
7274
|
+
/** The whole audio block, after `-i`. */
|
|
7275
|
+
function buildAudioArgs(audio) {
|
|
7276
|
+
if (audio.kind === "none") return ["-an"];
|
|
7277
|
+
if (audio.kind === "copy") return ["-c:a", "copy"];
|
|
7278
|
+
const args = [];
|
|
7279
|
+
if (audio.filter !== void 0) args.push("-af", audio.filter);
|
|
7280
|
+
args.push("-c:a", AUDIO_ENCODER_BY_CODEC[audio.codec]);
|
|
7281
|
+
if (audio.application !== void 0) args.push("-application", audio.application);
|
|
7282
|
+
if (audio.frameDurationMs !== void 0) args.push("-frame_duration", String(audio.frameDurationMs));
|
|
7283
|
+
if (audio.globalHeader === true) args.push("-flags", "+global_header");
|
|
7284
|
+
if (audio.sampleRateHz !== void 0) args.push("-ar", String(audio.sampleRateHz));
|
|
7285
|
+
if (audio.bitrateKbps !== void 0) args.push("-b:a", `${audio.bitrateKbps}k`);
|
|
7286
|
+
if (audio.vbvBufferKbits !== void 0) args.push("-bufsize", `${audio.vbvBufferKbits}k`);
|
|
7287
|
+
if (audio.channels !== void 0) args.push("-ac", String(audio.channels));
|
|
7288
|
+
return args;
|
|
7289
|
+
}
|
|
7290
|
+
/** RTP output-leg args (`-payload_type`, `-ssrc`, `-sdp_file`, `-f rtp <url>`). */
|
|
7291
|
+
function buildRtpOutputArgs(out) {
|
|
7292
|
+
const args = [];
|
|
7293
|
+
if (out.payloadType !== void 0) args.push("-payload_type", String(out.payloadType));
|
|
7294
|
+
if (out.ssrc !== void 0) args.push("-ssrc", String(out.ssrc));
|
|
7295
|
+
if (out.sdpFile !== void 0) args.push("-sdp_file", out.sdpFile);
|
|
7296
|
+
args.push("-f", "rtp", out.url);
|
|
7297
|
+
return args;
|
|
7298
|
+
}
|
|
7299
|
+
/** `true` when the sink is a raw elementary bytestream that cannot mux audio. */
|
|
7300
|
+
function isElementaryVideoSink(sink) {
|
|
7301
|
+
return sink.kind === "stdout" && (sink.container === "h264" || sink.container === "hevc");
|
|
7302
|
+
}
|
|
7303
|
+
/**
|
|
7304
|
+
* The fragmented-MP4 muxer flags, in the order the recorder has proven them
|
|
7305
|
+
* (`recorder/addon/ffmpeg-args.ts` passes the same `movflags` string through
|
|
7306
|
+
* `-segment_format_options`, across every vendor in the fleet):
|
|
7307
|
+
*
|
|
7308
|
+
* - `frag_keyframe` — cut a fragment at each key frame, so every fragment
|
|
7309
|
+
* opens on a sync sample. HKSV's whole requirement.
|
|
7310
|
+
* - `empty_moov` — write `ftyp`+`moov` up front with no samples in it, which
|
|
7311
|
+
* is what makes the head a standalone INITIALISATION segment.
|
|
7312
|
+
* - `default_base_moof` — fragment offsets are self-relative, so a fragment is
|
|
7313
|
+
* demuxable without the bytes that preceded it. D31's byte-range read path
|
|
7314
|
+
* depends on exactly this property of the recorder's segments.
|
|
7315
|
+
*/
|
|
7316
|
+
var FMP4_MOVFLAGS = "+frag_keyframe+empty_moov+default_base_moof";
|
|
7317
|
+
/**
|
|
7318
|
+
* The terminal sink args for every non-`rtp-outputs` sink. Exhaustive over the
|
|
7319
|
+
* union so a new member cannot fall through to `['-f', container, 'pipe:1']`,
|
|
7320
|
+
* which is what a plain `container` read would have done for `mp4` — a valid
|
|
7321
|
+
* argv that writes a NON-fragmented, unseekable-to-a-pipe MP4 and produces one
|
|
7322
|
+
* unusable byte stream.
|
|
7323
|
+
*/
|
|
7324
|
+
function buildStdoutOrRtspSinkArgs(sink) {
|
|
7325
|
+
if (sink.kind === "rtsp-listen") return [
|
|
7326
|
+
"-f",
|
|
7327
|
+
"rtsp",
|
|
7328
|
+
"-rtsp_transport",
|
|
7329
|
+
"tcp",
|
|
7330
|
+
"-rtsp_flags",
|
|
7331
|
+
"listen",
|
|
7332
|
+
sink.url
|
|
7333
|
+
];
|
|
7334
|
+
if (sink.kind === "rtp-outputs") return [];
|
|
7335
|
+
return sink.container === "mp4" ? buildFmp4SinkArgs(sink) : [
|
|
7336
|
+
"-f",
|
|
7337
|
+
sink.container,
|
|
7338
|
+
"pipe:1"
|
|
7339
|
+
];
|
|
7340
|
+
}
|
|
7341
|
+
/**
|
|
7342
|
+
* How far BELOW the negotiated fragment length `-min_frag_duration` is set.
|
|
7343
|
+
*
|
|
7344
|
+
* `-min_frag_duration` refuses to cut before that much media has accumulated,
|
|
7345
|
+
* and then waits for the next key frame. Set to exactly `fragmentMs`, the
|
|
7346
|
+
* commonest camera configuration in existence — a key-frame grid EQUAL to the
|
|
7347
|
+
* requested fragment length — lands the deadline on the same instant as the key
|
|
7348
|
+
* frame, loses the race, and skips to the following one: **every fragment comes
|
|
7349
|
+
* out at twice the requested length.**
|
|
7350
|
+
*
|
|
7351
|
+
* Measured on the live fleet 2026-08-07, camera 615, `-c:v copy` (D84):
|
|
7352
|
+
*
|
|
7353
|
+
* | slot | GOP | `-min_frag_duration` | median gap |
|
|
7354
|
+
* | --- | --- | --- | --- |
|
|
7355
|
+
* | 1280×720 | 40 f @ 10 fps = 4.0 s | 4000 ms | **7944 ms** |
|
|
7356
|
+
* | 1280×720 | 40 f @ 10 fps = 4.0 s | 3600 ms | 3973 ms |
|
|
7357
|
+
* | 3840×2160 | 100 f @ 25 fps = 4.0 s | 4000 ms | 8042 ms |
|
|
7358
|
+
* | 3840×2160 | 100 f @ 25 fps = 4.0 s | 3600 ms | 3998 ms |
|
|
7359
|
+
*
|
|
7360
|
+
* A doubled fragment is not a cosmetic overshoot: HKSV requires every fragment
|
|
7361
|
+
* to be no longer than the length the controller SELECTED, so the shipped-but-
|
|
7362
|
+
* inert phase-1 sink would have violated the contract on its first real clip.
|
|
7363
|
+
*
|
|
7364
|
+
* 10 % is chosen against the two failures either side of it. Too small and
|
|
7365
|
+
* ordinary jitter (measured spread 3953-4096 ms) re-loses the race; too large
|
|
7366
|
+
* and a source with a key frame slightly EARLY than the grid gets cut there,
|
|
7367
|
+
* yielding a short fragment for no reason.
|
|
7368
|
+
*/
|
|
7369
|
+
var FMP4_MIN_FRAG_MARGIN = .9;
|
|
7370
|
+
/** `-movflags … -min_frag_duration <us> -f mp4 pipe:1`. */
|
|
7371
|
+
function buildFmp4SinkArgs(sink) {
|
|
7372
|
+
return [
|
|
7373
|
+
"-movflags",
|
|
7374
|
+
FMP4_MOVFLAGS,
|
|
7375
|
+
"-min_frag_duration",
|
|
7376
|
+
String(Math.max(0, Math.round(sink.fragmentMs * FMP4_MIN_FRAG_MARGIN * 1e3))),
|
|
7377
|
+
"-f",
|
|
7378
|
+
"mp4",
|
|
7379
|
+
"pipe:1"
|
|
7380
|
+
];
|
|
7381
|
+
}
|
|
7382
|
+
/**
|
|
7383
|
+
* A second output mapping source audio to RTP-over-UDP. `0:a:0?` makes the
|
|
7384
|
+
* audio optional so a source with no audio skips it instead of failing the
|
|
7385
|
+
* whole invocation.
|
|
7386
|
+
*/
|
|
7387
|
+
function buildAudioSidecarArgs(sidecar) {
|
|
7388
|
+
return [
|
|
7389
|
+
"-map",
|
|
7390
|
+
"0:a:0?",
|
|
7391
|
+
...buildAudioArgs(sidecar.codec === "pcma" ? {
|
|
7392
|
+
kind: "encode",
|
|
7393
|
+
codec: "pcma",
|
|
7394
|
+
sampleRateHz: 8e3,
|
|
7395
|
+
channels: 1
|
|
7396
|
+
} : AUDIO_PRESETS[sidecar.codec]),
|
|
7397
|
+
...buildRtpOutputArgs({
|
|
7398
|
+
url: sidecar.rtpUrl,
|
|
7399
|
+
sdpFile: sidecar.sdpFile
|
|
7400
|
+
})
|
|
7401
|
+
];
|
|
7402
|
+
}
|
|
7403
|
+
/**
|
|
7404
|
+
* Assemble the full ffmpeg argument list. Layout:
|
|
7405
|
+
*
|
|
7406
|
+
* -hide_banner -loglevel <level>
|
|
7407
|
+
* [-hwaccel <backend|auto>] ─┐ INPUT options — strictly before -i.
|
|
7408
|
+
* [<input.extraArgs>] │
|
|
7409
|
+
* [-fflags <flag>…] │
|
|
7410
|
+
* [-rtsp_transport tcp] │
|
|
7411
|
+
* -i <url> ─┘
|
|
7412
|
+
* <video block> <threads> <audio block> ─┐ OUTPUT options.
|
|
7413
|
+
* <consumer outputArgs verbatim> │
|
|
7414
|
+
* <sink> ─┘ terminal
|
|
7415
|
+
*/
|
|
7416
|
+
function buildFfmpegArgs(inv) {
|
|
7417
|
+
const head = [...logBannerArgs(inv.logLevel), ...buildInputArgs(inv.input, inv.decodeHwAccel)];
|
|
7418
|
+
const threadArgs = inv.threadCount > 0 ? ["-threads", String(inv.threadCount)] : [];
|
|
7419
|
+
if (inv.sink.kind === "rtp-outputs") {
|
|
7420
|
+
const videoLeg = inv.sink.video ? [
|
|
7421
|
+
"-an",
|
|
7422
|
+
"-map",
|
|
7423
|
+
"0:v:0",
|
|
7424
|
+
...buildVideoArgs(inv.video, inv.outputArgs),
|
|
7425
|
+
...threadArgs,
|
|
7426
|
+
...inv.outputArgs,
|
|
7427
|
+
...buildRtpOutputArgs(inv.sink.video)
|
|
7428
|
+
] : [];
|
|
7429
|
+
const audioLeg = inv.sink.audio ? [
|
|
7430
|
+
"-vn",
|
|
7431
|
+
"-map",
|
|
7432
|
+
"0:a:0?",
|
|
7433
|
+
...buildAudioArgs(inv.audio),
|
|
7434
|
+
...buildRtpOutputArgs(inv.sink.audio)
|
|
7435
|
+
] : [];
|
|
7436
|
+
return [
|
|
7437
|
+
...head,
|
|
7438
|
+
...videoLeg,
|
|
7439
|
+
...audioLeg
|
|
7440
|
+
];
|
|
7441
|
+
}
|
|
7442
|
+
const audioArgs = isElementaryVideoSink(inv.sink) ? ["-an"] : buildAudioArgs(inv.audio);
|
|
7443
|
+
const sinkArgs = buildStdoutOrRtspSinkArgs(inv.sink);
|
|
7444
|
+
return [
|
|
7445
|
+
...head,
|
|
7446
|
+
...buildVideoArgs(inv.video, inv.outputArgs),
|
|
7447
|
+
...threadArgs,
|
|
7448
|
+
...audioArgs,
|
|
7449
|
+
...inv.outputArgs,
|
|
7450
|
+
...sinkArgs,
|
|
7451
|
+
...inv.audioSidecar ? buildAudioSidecarArgs(inv.audioSidecar) : []
|
|
7452
|
+
];
|
|
7453
|
+
}
|
|
7454
|
+
var DEFAULT_MAX_UNIT_BYTES = 16 * 1024 * 1024;
|
|
7455
|
+
/** Header size for a normal box, and for one carrying a 64-bit `largesize`. */
|
|
7456
|
+
var BOX_HEADER_BYTES = 8;
|
|
7457
|
+
var LARGE_BOX_HEADER_BYTES = 16;
|
|
7458
|
+
var Fmp4BoxSplitter = class {
|
|
7459
|
+
maxUnitBytes;
|
|
7460
|
+
/** Bytes of the CURRENT unit plus any partial box after it. */
|
|
7461
|
+
buffer = new Uint8Array(0);
|
|
7462
|
+
/** Where the current unit starts inside {@link buffer}. */
|
|
7463
|
+
unitStart = 0;
|
|
7464
|
+
/** Where the box scanner has reached inside {@link buffer}. */
|
|
7465
|
+
cursor = 0;
|
|
7466
|
+
state = "init";
|
|
7467
|
+
nextSequence = 0;
|
|
7468
|
+
faultReason = null;
|
|
7469
|
+
interstitial = /* @__PURE__ */ new Set();
|
|
7470
|
+
constructor(options = {}) {
|
|
7471
|
+
this.maxUnitBytes = options.maxUnitBytes ?? DEFAULT_MAX_UNIT_BYTES;
|
|
7472
|
+
}
|
|
7473
|
+
/**
|
|
7474
|
+
* Non-null once the stream cannot be split. The splitter emits nothing
|
|
7475
|
+
* further, so a caller polls this to kill the child rather than watching a
|
|
7476
|
+
* silent stall — a fragmenter that quietly stops producing looks exactly like
|
|
7477
|
+
* a camera with no motion.
|
|
7478
|
+
*/
|
|
7479
|
+
get fault() {
|
|
7480
|
+
return this.faultReason;
|
|
7481
|
+
}
|
|
7482
|
+
/** Bytes currently held. The memory bound, observable rather than asserted. */
|
|
7483
|
+
get pendingBytes() {
|
|
7484
|
+
return this.buffer.length - this.unitStart;
|
|
7485
|
+
}
|
|
7486
|
+
/**
|
|
7487
|
+
* Top-level box types seen BETWEEN fragments and discarded — `mfra`, `free`,
|
|
7488
|
+
* a stray `sidx`. Reported rather than dropped in silence: they are legal and
|
|
7489
|
+
* useless to a fragment consumer, but a type nobody expected showing up here
|
|
7490
|
+
* is the first symptom of a muxer that is not writing what we think it is.
|
|
7491
|
+
*/
|
|
7492
|
+
get discardedInterstitialTypes() {
|
|
7493
|
+
return [...this.interstitial];
|
|
7494
|
+
}
|
|
7495
|
+
/**
|
|
7496
|
+
* Feed bytes; get back whatever units completed. Returns `[]` once faulted.
|
|
7497
|
+
*/
|
|
7498
|
+
push(chunk) {
|
|
7499
|
+
if (this.faultReason !== null || chunk.length === 0) return [];
|
|
7500
|
+
this.append(chunk);
|
|
7501
|
+
if (this.pendingBytes > this.maxUnitBytes) return this.fail(`a single fMP4 unit exceeded ${this.maxUnitBytes} bytes — this stream is not fragmented`);
|
|
7502
|
+
return this.drainBoxes();
|
|
7503
|
+
}
|
|
7504
|
+
append(chunk) {
|
|
7505
|
+
if (this.buffer.length === 0) {
|
|
7506
|
+
this.buffer = chunk.slice();
|
|
7507
|
+
return;
|
|
7508
|
+
}
|
|
7509
|
+
const next = new Uint8Array(this.buffer.length + chunk.length);
|
|
7510
|
+
next.set(this.buffer, 0);
|
|
7511
|
+
next.set(chunk, this.buffer.length);
|
|
7512
|
+
this.buffer = next;
|
|
7513
|
+
}
|
|
7514
|
+
/** Consume every COMPLETE top-level box now in the buffer. */
|
|
7515
|
+
drainBoxes() {
|
|
7516
|
+
const units = [];
|
|
7517
|
+
for (;;) {
|
|
7518
|
+
const header = this.readHeader();
|
|
7519
|
+
if (this.faultReason !== null) return units;
|
|
7520
|
+
if (header === null) break;
|
|
7521
|
+
if (this.cursor + header.totalBytes > this.buffer.length) break;
|
|
7522
|
+
const boxStart = this.cursor;
|
|
7523
|
+
const boxEnd = boxStart + header.totalBytes;
|
|
7524
|
+
this.cursor = boxEnd;
|
|
7525
|
+
const unit = this.consumeBox(header.type, boxStart, boxEnd);
|
|
7526
|
+
if (this.faultReason !== null) return units;
|
|
7527
|
+
if (unit !== null) units.push(unit);
|
|
7528
|
+
}
|
|
7529
|
+
this.compact();
|
|
7530
|
+
return units;
|
|
7531
|
+
}
|
|
7532
|
+
/**
|
|
7533
|
+
* Apply one box to the state machine. Returns a unit when this box CLOSED
|
|
7534
|
+
* one, `null` otherwise.
|
|
7535
|
+
*/
|
|
7536
|
+
consumeBox(type, boxStart, boxEnd) {
|
|
7537
|
+
if (this.state === "init") {
|
|
7538
|
+
if (type !== "moof") return null;
|
|
7539
|
+
if (boxStart === this.unitStart) {
|
|
7540
|
+
this.fail("a moof arrived before any initialisation box — there is no ftyp/moov to send");
|
|
7541
|
+
return null;
|
|
7542
|
+
}
|
|
7543
|
+
const init = this.emit("init", this.unitStart, boxStart);
|
|
7544
|
+
this.unitStart = boxStart;
|
|
7545
|
+
this.state = "fragment";
|
|
7546
|
+
return init;
|
|
7547
|
+
}
|
|
7548
|
+
if (this.state === "idle") {
|
|
7549
|
+
if (type !== "moof") {
|
|
7550
|
+
this.interstitial.add(type);
|
|
7551
|
+
this.unitStart = boxEnd;
|
|
7552
|
+
return null;
|
|
7553
|
+
}
|
|
7554
|
+
this.unitStart = boxStart;
|
|
7555
|
+
this.state = "fragment";
|
|
7556
|
+
return null;
|
|
7557
|
+
}
|
|
7558
|
+
if (type !== "mdat") return null;
|
|
7559
|
+
const fragment = this.emit("fragment", this.unitStart, boxEnd);
|
|
7560
|
+
this.unitStart = boxEnd;
|
|
7561
|
+
this.state = "idle";
|
|
7562
|
+
return fragment;
|
|
7563
|
+
}
|
|
7564
|
+
/**
|
|
7565
|
+
* Parse the header at {@link cursor}, or `null` when too few bytes have
|
|
7566
|
+
* arrived to know. Faults on a size the splitter cannot honour.
|
|
7567
|
+
*/
|
|
7568
|
+
readHeader() {
|
|
7569
|
+
const available = this.buffer.length - this.cursor;
|
|
7570
|
+
if (available < BOX_HEADER_BYTES) return null;
|
|
7571
|
+
const view = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
|
7572
|
+
const size = view.getUint32(this.cursor);
|
|
7573
|
+
const type = String.fromCharCode(this.buffer[this.cursor + 4] ?? 0, this.buffer[this.cursor + 5] ?? 0, this.buffer[this.cursor + 6] ?? 0, this.buffer[this.cursor + 7] ?? 0);
|
|
7574
|
+
if (size === 0) {
|
|
7575
|
+
this.fail(`box "${type}" declares size 0 (to EOF) — an unbounded box cannot be fragmented`);
|
|
7576
|
+
return null;
|
|
7577
|
+
}
|
|
7578
|
+
if (size === 1) {
|
|
7579
|
+
if (available < LARGE_BOX_HEADER_BYTES) return null;
|
|
7580
|
+
const large = view.getBigUint64(this.cursor + BOX_HEADER_BYTES);
|
|
7581
|
+
if (large > BigInt(this.maxUnitBytes)) {
|
|
7582
|
+
this.fail(`box "${type}" declares ${large} bytes, over the ${this.maxUnitBytes} byte bound`);
|
|
7583
|
+
return null;
|
|
7584
|
+
}
|
|
7585
|
+
return {
|
|
7586
|
+
type,
|
|
7587
|
+
totalBytes: Number(large)
|
|
7588
|
+
};
|
|
7589
|
+
}
|
|
7590
|
+
if (size < BOX_HEADER_BYTES) {
|
|
7591
|
+
this.fail(`box "${type}" declares an impossible size of ${size} bytes`);
|
|
7592
|
+
return null;
|
|
7593
|
+
}
|
|
7594
|
+
return {
|
|
7595
|
+
type,
|
|
7596
|
+
totalBytes: size
|
|
7597
|
+
};
|
|
7598
|
+
}
|
|
7599
|
+
emit(kind, start, end) {
|
|
7600
|
+
const sequence = this.nextSequence;
|
|
7601
|
+
this.nextSequence += 1;
|
|
7602
|
+
return {
|
|
7603
|
+
kind,
|
|
7604
|
+
data: this.buffer.slice(start, end),
|
|
7605
|
+
sequence
|
|
7606
|
+
};
|
|
7607
|
+
}
|
|
7608
|
+
/**
|
|
7609
|
+
* Drop everything already emitted or discarded. Without this the buffer is
|
|
7610
|
+
* the whole stream and the process dies in hours, not minutes.
|
|
7611
|
+
*/
|
|
7612
|
+
compact() {
|
|
7613
|
+
if (this.unitStart === 0) return;
|
|
7614
|
+
this.buffer = this.buffer.slice(this.unitStart);
|
|
7615
|
+
this.cursor -= this.unitStart;
|
|
7616
|
+
this.unitStart = 0;
|
|
7617
|
+
}
|
|
7618
|
+
fail(reason) {
|
|
7619
|
+
this.faultReason = reason;
|
|
7620
|
+
this.buffer = new Uint8Array(0);
|
|
7621
|
+
this.unitStart = 0;
|
|
7622
|
+
this.cursor = 0;
|
|
7623
|
+
return [];
|
|
7624
|
+
}
|
|
7625
|
+
};
|
|
7626
|
+
//#endregion
|
|
7160
7627
|
//#region ../types/dist/err-msg-IQTHeDzc.mjs
|
|
7161
7628
|
/**
|
|
7162
7629
|
import { errMsg } from '@camstack/types'
|
|
@@ -15701,6 +16168,60 @@ var TrackFlagsSchema = object({
|
|
|
15701
16168
|
* `trained` without a re-fetch. */
|
|
15702
16169
|
retrainStatus: RetrainStatusSchema
|
|
15703
16170
|
});
|
|
16171
|
+
union([literal(1), literal(2)]);
|
|
16172
|
+
/**
|
|
16173
|
+
* WHO decided a label, and when. Carried per tier so a value can be traced to
|
|
16174
|
+
* the step and model that produced it — which is what makes the write rule
|
|
16175
|
+
* arguable after the fact ("why is 592's label `dog` and not `Canis lupus`?")
|
|
16176
|
+
* and what lets a migrated, UNATTRIBUTED value be told apart from a real one.
|
|
16177
|
+
*
|
|
16178
|
+
* `stepId` is the pipeline step id (`animal-classifier`, `bird-classifier`,
|
|
16179
|
+
* `plate-ocr`, `face-embedding`, `object-detection`), or the sentinel
|
|
16180
|
+
* `migration:4g` for a value the 4g migration moved from the single-slot era —
|
|
16181
|
+
* that value has no provenance, and the write rule lets ANY properly-attributed
|
|
16182
|
+
* write of the same tier replace it regardless of score.
|
|
16183
|
+
*/
|
|
16184
|
+
var LabelAttributionSchema = object({
|
|
16185
|
+
stepId: string(),
|
|
16186
|
+
modelId: string().optional(),
|
|
16187
|
+
decidedAt: number()
|
|
16188
|
+
});
|
|
16189
|
+
/**
|
|
16190
|
+
* The TIERED label model (roadmap 4g), spread into `TrackSchema` and
|
|
16191
|
+
* `ObjectEventSchema` from ONE place so the two surfaces cannot drift — a
|
|
16192
|
+
* track and its events always answer the same question the same way.
|
|
16193
|
+
*
|
|
16194
|
+
* Two scalar columns, not an array: every consumer wants "the coarse one" or
|
|
16195
|
+
* "the fine one", and an array made both a scan. `label` is tier 1, `subLabel`
|
|
16196
|
+
* is tier 2, and each carries its own score + attribution.
|
|
16197
|
+
*
|
|
16198
|
+
* **Reading it.** What a human should be shown is `subLabel ?? label` — the
|
|
16199
|
+
* finest thing known. Before 4g the single `label` column held the finest
|
|
16200
|
+
* value, so a consumer that has not been updated reads the tier-1 slot and
|
|
16201
|
+
* shows nothing on a species-only row; that is why the migration puts every
|
|
16202
|
+
* pre-4g value in tier 2 (it cannot regress a display that reads the fallback)
|
|
16203
|
+
* and why the read surfaces were changed in the same train.
|
|
16204
|
+
*
|
|
16205
|
+
* **Writing it.** The slots are independent, which is the whole point: a
|
|
16206
|
+
* tier-1 write (`bird`) can never overwrite a tier-2 value (`Turdus
|
|
16207
|
+
* migratorius`), so fineness cannot regress by construction. Within a tier the
|
|
16208
|
+
* higher score wins. One rule, one implementation — see
|
|
16209
|
+
* `pipeline/label-tier.ts` in addon-post-analysis.
|
|
16210
|
+
*/
|
|
16211
|
+
var TieredLabelFields = {
|
|
16212
|
+
/** Tier 1 — the sub-class. See {@link LabelTierSchema}. */
|
|
16213
|
+
label: string().optional(),
|
|
16214
|
+
/** Confidence of the tier-1 value, as reported by the deciding step. */
|
|
16215
|
+
labelScore: number().optional(),
|
|
16216
|
+
/** Provenance of the tier-1 value. See {@link LabelAttributionSchema}. */
|
|
16217
|
+
labelMeta: LabelAttributionSchema.optional(),
|
|
16218
|
+
/** Tier 2 — the instance. See {@link LabelTierSchema}. */
|
|
16219
|
+
subLabel: string().optional(),
|
|
16220
|
+
/** Confidence of the tier-2 value, as reported by the deciding step. */
|
|
16221
|
+
subLabelScore: number().optional(),
|
|
16222
|
+
/** Provenance of the tier-2 value. See {@link LabelAttributionSchema}. */
|
|
16223
|
+
subLabelMeta: LabelAttributionSchema.optional()
|
|
16224
|
+
};
|
|
15704
16225
|
/** Per-camera slice of a training-export estimate. */
|
|
15705
16226
|
var TrainingExportDeviceTotalsSchema = object({
|
|
15706
16227
|
deviceId: number(),
|
|
@@ -15725,7 +16246,7 @@ var TrackSchema = object({
|
|
|
15725
16246
|
trackId: string(),
|
|
15726
16247
|
deviceId: number(),
|
|
15727
16248
|
className: string(),
|
|
15728
|
-
|
|
16249
|
+
...TieredLabelFields,
|
|
15729
16250
|
producingDeviceName: string().optional(),
|
|
15730
16251
|
/** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
|
|
15731
16252
|
source: TrackSourceSchema.optional(),
|
|
@@ -15838,7 +16359,7 @@ var ObjectEventSchema = object({
|
|
|
15838
16359
|
/** Omitted in slim projection. */
|
|
15839
16360
|
trackId: string().optional(),
|
|
15840
16361
|
className: string(),
|
|
15841
|
-
|
|
16362
|
+
...TieredLabelFields,
|
|
15842
16363
|
/** Omitted in slim projection. */
|
|
15843
16364
|
confidence: number().optional(),
|
|
15844
16365
|
/** Heavy JSON — omitted in slim projection. */
|
|
@@ -15919,6 +16440,173 @@ var MediaFileSchema = object({
|
|
|
15919
16440
|
* stored blob and a `?variant=thumb` rendering without fetching either.
|
|
15920
16441
|
*/
|
|
15921
16442
|
var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
|
|
16443
|
+
/**
|
|
16444
|
+
* The MACRO tier of an annotation — a CLOSED set.
|
|
16445
|
+
*
|
|
16446
|
+
* This is what the exported detector predicts, so a typo here is a new class
|
|
16447
|
+
* with one example in it. `label` and `subLabel` are open strings by contrast:
|
|
16448
|
+
* the whole point of the page is teaching the model things it does not know
|
|
16449
|
+
* yet, and constraining that vocabulary would make it useless.
|
|
16450
|
+
*
|
|
16451
|
+
* A macro class is NEVER a label. The provider refuses a write whose `label` or
|
|
16452
|
+
* `subLabel` is one of these values, in any casing, because once `person`
|
|
16453
|
+
* exists in both tiers "every person box" stops being answerable without
|
|
16454
|
+
* knowing every string anyone ever typed — and the damage is retroactive.
|
|
16455
|
+
*/
|
|
16456
|
+
var RetrainMacroClassSchema = _enum([
|
|
16457
|
+
"person",
|
|
16458
|
+
"vehicle",
|
|
16459
|
+
"animal",
|
|
16460
|
+
"package",
|
|
16461
|
+
"face",
|
|
16462
|
+
"plate"
|
|
16463
|
+
]);
|
|
16464
|
+
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
16465
|
+
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
16466
|
+
/** Did a human draw this box, or did the assist propose it? */
|
|
16467
|
+
var RetrainAnnotationSourceSchema = _enum(["operator", "assist"]);
|
|
16468
|
+
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
16469
|
+
var RetrainBboxSchema = object({
|
|
16470
|
+
x: number(),
|
|
16471
|
+
y: number(),
|
|
16472
|
+
w: number(),
|
|
16473
|
+
h: number()
|
|
16474
|
+
});
|
|
16475
|
+
/**
|
|
16476
|
+
* One annotated subject.
|
|
16477
|
+
*
|
|
16478
|
+
* `bbox` is normalised against the full frame, ALWAYS. The per-model shapes
|
|
16479
|
+
* (letterboxed root / zone-cropped package / subject-cropped classifier) are
|
|
16480
|
+
* derived from it at export and never stored — storing them is how one feature
|
|
16481
|
+
* space ends up holding two crops of the same subject (D52).
|
|
16482
|
+
*/
|
|
16483
|
+
var RetrainAnnotationSchema = object({
|
|
16484
|
+
id: string(),
|
|
16485
|
+
trackId: string(),
|
|
16486
|
+
deviceId: number(),
|
|
16487
|
+
/** The COPY in retrain storage — never the source track's media key. */
|
|
16488
|
+
mediaKey: string(),
|
|
16489
|
+
bbox: RetrainBboxSchema,
|
|
16490
|
+
macroClass: RetrainMacroClassSchema,
|
|
16491
|
+
label: string().optional(),
|
|
16492
|
+
subLabel: string().optional(),
|
|
16493
|
+
kind: RetrainAnnotationKindSchema,
|
|
16494
|
+
source: RetrainAnnotationSourceSchema,
|
|
16495
|
+
/** Which model proposed this box — or, on a `model_error`, drew the phantom. */
|
|
16496
|
+
assistModelId: string().optional(),
|
|
16497
|
+
assistScore: number().optional(),
|
|
16498
|
+
exportedInBatch: string().optional(),
|
|
16499
|
+
createdAt: number()
|
|
16500
|
+
});
|
|
16501
|
+
/** The write form — the server owns `id`, `createdAt` and the frame binding. */
|
|
16502
|
+
var RetrainAnnotationDraftSchema = RetrainAnnotationSchema.omit({
|
|
16503
|
+
id: true,
|
|
16504
|
+
trackId: true,
|
|
16505
|
+
deviceId: true,
|
|
16506
|
+
mediaKey: true,
|
|
16507
|
+
createdAt: true,
|
|
16508
|
+
exportedInBatch: true
|
|
16509
|
+
});
|
|
16510
|
+
/** A track sitting in `staging`, with everything the worklist needs to rank it. */
|
|
16511
|
+
var RetrainTrackSchema = object({
|
|
16512
|
+
trackId: string(),
|
|
16513
|
+
deviceId: number(),
|
|
16514
|
+
className: string(),
|
|
16515
|
+
label: string().optional(),
|
|
16516
|
+
firstSeen: number(),
|
|
16517
|
+
lastSeen: number(),
|
|
16518
|
+
/** How many frames the dataset already holds from this track. */
|
|
16519
|
+
frameCount: number().int(),
|
|
16520
|
+
/** How many subjects have been annotated on those frames. `0` with
|
|
16521
|
+
* `frameCount: 0` is exactly "staging, still to work". */
|
|
16522
|
+
annotationCount: number().int()
|
|
16523
|
+
});
|
|
16524
|
+
/** A frame the picker may offer — an index row, no blob was read to produce it. */
|
|
16525
|
+
var RetrainFrameCandidateSchema = object({
|
|
16526
|
+
mediaKey: string(),
|
|
16527
|
+
kind: MediaFileKindEnum,
|
|
16528
|
+
timestamp: number(),
|
|
16529
|
+
sizeBytes: number().int(),
|
|
16530
|
+
/** A copy of this original already exists — selecting it is free and cannot
|
|
16531
|
+
* fail, whatever became of the original. */
|
|
16532
|
+
copied: boolean()
|
|
16533
|
+
});
|
|
16534
|
+
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
16535
|
+
var RetrainFrameSchema = object({
|
|
16536
|
+
frameId: string(),
|
|
16537
|
+
deviceId: number(),
|
|
16538
|
+
trackId: string(),
|
|
16539
|
+
/** Provenance only. It may already point at nothing — that is expected. */
|
|
16540
|
+
sourceMediaKey: string(),
|
|
16541
|
+
sourceKind: MediaFileKindEnum,
|
|
16542
|
+
sizeBytes: number().int(),
|
|
16543
|
+
width: number().int(),
|
|
16544
|
+
height: number().int(),
|
|
16545
|
+
copiedAt: number()
|
|
16546
|
+
});
|
|
16547
|
+
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
16548
|
+
var RetrainCopyRefusalSchema = _enum([
|
|
16549
|
+
"source-missing",
|
|
16550
|
+
"unreadable-image",
|
|
16551
|
+
"write-failed"
|
|
16552
|
+
]);
|
|
16553
|
+
var RetrainFrameSelectionSchema = object({
|
|
16554
|
+
copied: array(RetrainFrameSchema).readonly(),
|
|
16555
|
+
refused: array(object({
|
|
16556
|
+
sourceMediaKey: string(),
|
|
16557
|
+
reason: RetrainCopyRefusalSchema
|
|
16558
|
+
})).readonly()
|
|
16559
|
+
});
|
|
16560
|
+
var RetrainFrameListSchema = object({
|
|
16561
|
+
candidates: array(RetrainFrameCandidateSchema).readonly(),
|
|
16562
|
+
copies: array(RetrainFrameSchema).readonly(),
|
|
16563
|
+
/** What the page pre-selects — the native key frame when one survives. */
|
|
16564
|
+
autoPickMediaKey: string().optional()
|
|
16565
|
+
});
|
|
16566
|
+
/** What the operator asked the assist to look for. */
|
|
16567
|
+
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
16568
|
+
kind: literal("package"),
|
|
16569
|
+
zone: RetrainBboxSchema.optional()
|
|
16570
|
+
}), object({
|
|
16571
|
+
kind: literal("objects"),
|
|
16572
|
+
modelId: string(),
|
|
16573
|
+
minScore: number().optional()
|
|
16574
|
+
})]);
|
|
16575
|
+
/**
|
|
16576
|
+
* The assist's answer — a discriminated union, because "the model saw nothing"
|
|
16577
|
+
* and "this node cannot run that model" lead to different next moves and a
|
|
16578
|
+
* nullable result cannot tell them apart.
|
|
16579
|
+
*/
|
|
16580
|
+
var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
16581
|
+
kind: literal("proposed"),
|
|
16582
|
+
modelId: string(),
|
|
16583
|
+
stepId: string(),
|
|
16584
|
+
minScore: number(),
|
|
16585
|
+
/** Drafts, ready to edit. `source: 'assist'` until the operator touches one. */
|
|
16586
|
+
proposals: array(RetrainAnnotationDraftSchema).readonly(),
|
|
16587
|
+
/** Returned by the runner but removed by the threshold. */
|
|
16588
|
+
belowThreshold: number().int()
|
|
16589
|
+
}), object({
|
|
16590
|
+
kind: literal("refused"),
|
|
16591
|
+
/** `no-zone` is ours; the rest are the runner's own refusal vocabulary. */
|
|
16592
|
+
reason: string(),
|
|
16593
|
+
detail: string().optional()
|
|
16594
|
+
})]);
|
|
16595
|
+
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
16596
|
+
var RetrainTransitionResultSchema = object({
|
|
16597
|
+
trackId: string(),
|
|
16598
|
+
/** Where the track ended up, whatever happened. */
|
|
16599
|
+
retrainStatus: RetrainStatusSchema,
|
|
16600
|
+
/** `false` ⇒ the move was refused or was a no-op; `reason` says which. */
|
|
16601
|
+
changed: boolean(),
|
|
16602
|
+
reason: _enum([
|
|
16603
|
+
"unknown-track",
|
|
16604
|
+
"no-frames-copied",
|
|
16605
|
+
"not-staging",
|
|
16606
|
+
"not-trained",
|
|
16607
|
+
"unchanged"
|
|
16608
|
+
]).optional()
|
|
16609
|
+
});
|
|
15922
16610
|
var DEFAULT_EVENT_QUERY_LIMIT = 1e3;
|
|
15923
16611
|
var MAX_EVENT_QUERY_LIMIT = 5e3;
|
|
15924
16612
|
var DeviceEventQueryInput = object({
|
|
@@ -15973,7 +16661,7 @@ var KeyEventSchema = object({
|
|
|
15973
16661
|
/** Track start time (firstSeen). */
|
|
15974
16662
|
timestamp: number(),
|
|
15975
16663
|
className: string(),
|
|
15976
|
-
|
|
16664
|
+
...TieredLabelFields,
|
|
15977
16665
|
importance: number(),
|
|
15978
16666
|
/** Highest-confidence ObjectEvent id for the track (empty when none). */
|
|
15979
16667
|
bestEventId: string(),
|
|
@@ -16464,6 +17152,201 @@ var pipelineAnalyticsCapability = {
|
|
|
16464
17152
|
kind: "query",
|
|
16465
17153
|
auth: "admin"
|
|
16466
17154
|
}),
|
|
17155
|
+
/**
|
|
17156
|
+
* The staging worklist for one camera, or for every camera that has one.
|
|
17157
|
+
*
|
|
17158
|
+
* Fetched ON DEMAND, over the staging set only — the page never scans
|
|
17159
|
+
* history, because making the working set small is the entire purpose of
|
|
17160
|
+
* the mark. Each row carries how many frames the dataset already holds from
|
|
17161
|
+
* the track and how many subjects were annotated on them, so
|
|
17162
|
+
* `frameCount: 0` reads as "still to work" without a second call per track.
|
|
17163
|
+
*
|
|
17164
|
+
* `auth: 'admin'`, unlike the viewer-level mark itself: marking a track is
|
|
17165
|
+
* curation you do while looking at it, but building the training set the
|
|
17166
|
+
* fleet's models are fine-tuned on is not.
|
|
17167
|
+
*/
|
|
17168
|
+
listRetrainStaging: method(object({
|
|
17169
|
+
/** Empty ⇒ every camera that has staging tracks. A LIST, not a single
|
|
17170
|
+
* `deviceId`, deliberately: `deviceId` would make this device-bound and
|
|
17171
|
+
* route it at one camera's owner, and "every camera" would stop being
|
|
17172
|
+
* expressible at all. */
|
|
17173
|
+
deviceIds: array(number()).optional(),
|
|
17174
|
+
limit: number().int().min(1).max(500).optional()
|
|
17175
|
+
}), array(RetrainTrackSchema).readonly(), {
|
|
17176
|
+
kind: "query",
|
|
17177
|
+
auth: "admin"
|
|
17178
|
+
}),
|
|
17179
|
+
/**
|
|
17180
|
+
* What a track can contribute, and what it already has.
|
|
17181
|
+
*
|
|
17182
|
+
* `candidates` are the track's whole, unannotated frames — index rows only,
|
|
17183
|
+
* so this is cheap. `copies` are the frames already inside the dataset, and
|
|
17184
|
+
* a candidate whose copy exists is marked `copied: true`: selecting it again
|
|
17185
|
+
* is free and CANNOT fail, whatever became of the original.
|
|
17186
|
+
*
|
|
17187
|
+
* A crop, a thumbnail and `fullFrameBoxed` are never candidates. The last
|
|
17188
|
+
* one matters most: it has the model's own rectangle burned into the pixels,
|
|
17189
|
+
* and a detector trained on it learns to find a green line.
|
|
17190
|
+
*/
|
|
17191
|
+
listRetrainFrames: method(object({ trackId: string() }), RetrainFrameListSchema, {
|
|
17192
|
+
kind: "query",
|
|
17193
|
+
auth: "admin"
|
|
17194
|
+
}),
|
|
17195
|
+
/**
|
|
17196
|
+
* COPY-ON-SELECT — the write that makes `trained` safe to evict.
|
|
17197
|
+
*
|
|
17198
|
+
* Selecting a frame copies its bytes into retrain storage immediately: not
|
|
17199
|
+
* a reference, not a lease. Once the copy exists the dataset no longer
|
|
17200
|
+
* depends on the track's media, which is exactly what lets D81 hand a
|
|
17201
|
+
* `trained` track back to retention.
|
|
17202
|
+
*
|
|
17203
|
+
* The order inside is load-bearing and is pinned by a test: an EXISTING
|
|
17204
|
+
* copy is returned without touching the source, so an original that
|
|
17205
|
+
* evaporated blocks the selection of THAT ORIGINAL and never the copy
|
|
17206
|
+
* already taken. Every refusal comes back named — a dropped selection is
|
|
17207
|
+
* never silent, on the wire or in the log.
|
|
17208
|
+
*/
|
|
17209
|
+
selectRetrainFrames: method(object({
|
|
17210
|
+
deviceId: number(),
|
|
17211
|
+
trackId: string(),
|
|
17212
|
+
mediaKeys: array(string()).min(1)
|
|
17213
|
+
}), RetrainFrameSelectionSchema, {
|
|
17214
|
+
kind: "mutation",
|
|
17215
|
+
auth: "admin"
|
|
17216
|
+
}),
|
|
17217
|
+
/** Un-select a frame: its annotations go first, then the copy and its blob.
|
|
17218
|
+
* Deliberately destructive and deliberately explicit — it is the only way
|
|
17219
|
+
* a frame leaves the dataset before export. */
|
|
17220
|
+
deselectRetrainFrame: method(object({
|
|
17221
|
+
deviceId: number(),
|
|
17222
|
+
trackId: string(),
|
|
17223
|
+
frameId: string()
|
|
17224
|
+
}), object({
|
|
17225
|
+
removed: boolean(),
|
|
17226
|
+
removedAnnotations: number().int()
|
|
17227
|
+
}), {
|
|
17228
|
+
kind: "mutation",
|
|
17229
|
+
auth: "admin"
|
|
17230
|
+
}),
|
|
17231
|
+
/**
|
|
17232
|
+
* The pixels of ONE copied frame, base64.
|
|
17233
|
+
*
|
|
17234
|
+
* Through the cap rather than a data plane because it is genuinely one
|
|
17235
|
+
* frame at a time, on demand, at human speed — the shape D9/D18 permit
|
|
17236
|
+
* (what they forbid is frames crossing a boundary at frame RATE). The
|
|
17237
|
+
* annotation canvas needs the image and its exact dimensions in the same
|
|
17238
|
+
* answer: a canvas that places a normalised box against a size it guessed
|
|
17239
|
+
* draws every box in the wrong place.
|
|
17240
|
+
*/
|
|
17241
|
+
getRetrainFrameImage: method(object({ frameId: string() }), object({
|
|
17242
|
+
base64: string(),
|
|
17243
|
+
width: number().int(),
|
|
17244
|
+
height: number().int()
|
|
17245
|
+
}), {
|
|
17246
|
+
kind: "query",
|
|
17247
|
+
auth: "admin"
|
|
17248
|
+
}),
|
|
17249
|
+
/**
|
|
17250
|
+
* Ask the pipeline what it sees, as a PROPOSAL.
|
|
17251
|
+
*
|
|
17252
|
+
* Runs through `pipelineRunner.runStatelessStep` on the COPIED frame, and
|
|
17253
|
+
* every box comes back as a draft with `source: 'assist'` plus the model and
|
|
17254
|
+
* score that produced it. The operator confirms, edits, adds and deletes;
|
|
17255
|
+
* nothing is stored until `saveRetrainAnnotations`.
|
|
17256
|
+
*
|
|
17257
|
+
* For packages the request is `rfdetr-package` on the ZONE CROP at 0.35 —
|
|
17258
|
+
* never the whole frame, where a package detector at that threshold proposes
|
|
17259
|
+
* furniture. A package request with no zone is REFUSED rather than widened,
|
|
17260
|
+
* because the silent widening would look like a bad model for as long as
|
|
17261
|
+
* nobody checked which rectangle it ran on.
|
|
17262
|
+
*/
|
|
17263
|
+
proposeRetrainAnnotations: method(object({
|
|
17264
|
+
deviceId: number(),
|
|
17265
|
+
trackId: string(),
|
|
17266
|
+
frameId: string(),
|
|
17267
|
+
subject: RetrainAssistSubjectSchema,
|
|
17268
|
+
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
17269
|
+
nodeId: string().optional()
|
|
17270
|
+
}), RetrainAssistResultSchema, {
|
|
17271
|
+
kind: "mutation",
|
|
17272
|
+
auth: "admin"
|
|
17273
|
+
}),
|
|
17274
|
+
/** Every annotation on a track, oldest first. */
|
|
17275
|
+
listRetrainAnnotations: method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
|
|
17276
|
+
kind: "query",
|
|
17277
|
+
auth: "admin"
|
|
17278
|
+
}),
|
|
17279
|
+
/**
|
|
17280
|
+
* Replace EVERY annotation on one frame with the supplied set.
|
|
17281
|
+
*
|
|
17282
|
+
* Whole-frame replacement, not per-box upsert: the unit of ground truth is
|
|
17283
|
+
* the frame, and "the operator deleted a box" must be the same durable
|
|
17284
|
+
* outcome as "the operator never drew it". A per-box patch would let a frame
|
|
17285
|
+
* keep a box the operator removed on a surface that only knew about the
|
|
17286
|
+
* boxes it sent.
|
|
17287
|
+
*
|
|
17288
|
+
* Refuses a macro class typed into `label` or `subLabel` — the tiers are
|
|
17289
|
+
* separate and the guard is at the WRITE, because a mixed taxonomy cannot
|
|
17290
|
+
* be un-mixed by reading it.
|
|
17291
|
+
*/
|
|
17292
|
+
saveRetrainAnnotations: method(object({
|
|
17293
|
+
deviceId: number(),
|
|
17294
|
+
trackId: string(),
|
|
17295
|
+
frameId: string(),
|
|
17296
|
+
annotations: array(RetrainAnnotationDraftSchema)
|
|
17297
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
17298
|
+
kind: "mutation",
|
|
17299
|
+
auth: "admin"
|
|
17300
|
+
}),
|
|
17301
|
+
/**
|
|
17302
|
+
* Finish with a track: `staging → trained`. **The only writer of that
|
|
17303
|
+
* state** — D81 shipped the column with it deliberately unreachable.
|
|
17304
|
+
*
|
|
17305
|
+
* Refuses a track the dataset holds no copies from. `trained` un-pins the
|
|
17306
|
+
* track's media, so completing without a copy is a delete order for material
|
|
17307
|
+
* nothing ever extracted anything from; that refusal IS the safety argument
|
|
17308
|
+
* of D81, expressed as a precondition.
|
|
17309
|
+
*/
|
|
17310
|
+
completeRetrainTrack: method(object({
|
|
17311
|
+
deviceId: number(),
|
|
17312
|
+
trackId: string()
|
|
17313
|
+
}), RetrainTransitionResultSchema, {
|
|
17314
|
+
kind: "mutation",
|
|
17315
|
+
auth: "admin"
|
|
17316
|
+
}),
|
|
17317
|
+
/**
|
|
17318
|
+
* The deliberate return: `trained → staging`, for the rare case.
|
|
17319
|
+
*
|
|
17320
|
+
* The generic `setTrackFlags` toggle refuses this in both directions by
|
|
17321
|
+
* design (D81) — re-staging from a checkbox is how the same material gets
|
|
17322
|
+
* annotated twice under two ground truths. Doing it here means the operator
|
|
17323
|
+
* is looking at the annotations that already exist while they decide, and
|
|
17324
|
+
* those annotations are LEFT ALONE: "put this back" must not be a
|
|
17325
|
+
* destructive act wearing a navigational name.
|
|
17326
|
+
*/
|
|
17327
|
+
restageRetrainTrack: method(object({
|
|
17328
|
+
deviceId: number(),
|
|
17329
|
+
trackId: string()
|
|
17330
|
+
}), RetrainTransitionResultSchema, {
|
|
17331
|
+
kind: "mutation",
|
|
17332
|
+
auth: "admin"
|
|
17333
|
+
}),
|
|
17334
|
+
/**
|
|
17335
|
+
* Where to download the ANNOTATED dataset.
|
|
17336
|
+
*
|
|
17337
|
+
* The sibling of `getTrainingExportUrl` and deliberately not the same
|
|
17338
|
+
* archive: that one streams a marked track's stored media verbatim, this one
|
|
17339
|
+
* streams the retrain COPIES plus an `annotations.json` carrying, for every
|
|
17340
|
+
* subject, the canonical full-frame box AND the geometry derived for each
|
|
17341
|
+
* model shape (letterboxed root / zone-cropped package / subject-cropped
|
|
17342
|
+
* classifier). Derived at export, never stored — one box in, three shapes
|
|
17343
|
+
* out, so two crops of the same subject can never end up in one feature
|
|
17344
|
+
* space (D52).
|
|
17345
|
+
*/
|
|
17346
|
+
getRetrainExportUrl: method(object({ deviceIds: array(number()).optional() }), object({ url: string() }), {
|
|
17347
|
+
kind: "query",
|
|
17348
|
+
auth: "admin"
|
|
17349
|
+
}),
|
|
16467
17350
|
getEventMedia: method(object({
|
|
16468
17351
|
eventId: string(),
|
|
16469
17352
|
kind: MediaFileKindEnum.optional()
|
|
@@ -17128,6 +18011,22 @@ var DetailResultSchema = object({
|
|
|
17128
18011
|
bbox: NativeCropBboxSchema.optional(),
|
|
17129
18012
|
embedding: string().optional(),
|
|
17130
18013
|
label: string().optional(),
|
|
18014
|
+
/**
|
|
18015
|
+
* The tier `label` occupies, copied VERBATIM from the producing step's
|
|
18016
|
+
* `StepDefinition.labelTier` (roadmap 4g). Present only when `label` is.
|
|
18017
|
+
*
|
|
18018
|
+
* It rides the wire rather than being resolved by the consumer because the
|
|
18019
|
+
* declaration lives with the step definition, which only the executing node
|
|
18020
|
+
* has: post-analysis holds no step registry, and re-deriving the tier from
|
|
18021
|
+
* `className` there would be exactly the inference this model exists to
|
|
18022
|
+
* forbid. A `label` that arrives WITHOUT this field is refused by the write
|
|
18023
|
+
* rule and logged (`label tier undeclared`) — an older runner therefore
|
|
18024
|
+
* stops enriching rather than guessing, which is why addon-pipeline is
|
|
18025
|
+
* deployed BEFORE addon-post-analysis.
|
|
18026
|
+
*/
|
|
18027
|
+
labelTier: union([literal(1), literal(2)]).optional(),
|
|
18028
|
+
/** Model that produced `label` — carried into the tier's attribution. */
|
|
18029
|
+
labelModelId: string().optional(),
|
|
17131
18030
|
alignedCropJpeg: string().optional(),
|
|
17132
18031
|
/** Face short side (px) measured on the NATIVE crop surface. The `bbox`
|
|
17133
18032
|
* above is detection-frame px (≈6× smaller on a 4K camera) — min-face-size
|
|
@@ -30077,6 +30976,12 @@ Object.freeze({
|
|
|
30077
30976
|
addonId: null,
|
|
30078
30977
|
access: "delete"
|
|
30079
30978
|
},
|
|
30979
|
+
"pipelineAnalytics.completeRetrainTrack": {
|
|
30980
|
+
capName: "pipeline-analytics",
|
|
30981
|
+
capScope: "device",
|
|
30982
|
+
addonId: null,
|
|
30983
|
+
access: "create"
|
|
30984
|
+
},
|
|
30080
30985
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
30081
30986
|
capName: "pipeline-analytics",
|
|
30082
30987
|
capScope: "device",
|
|
@@ -30089,6 +30994,12 @@ Object.freeze({
|
|
|
30089
30994
|
addonId: null,
|
|
30090
30995
|
access: "delete"
|
|
30091
30996
|
},
|
|
30997
|
+
"pipelineAnalytics.deselectRetrainFrame": {
|
|
30998
|
+
capName: "pipeline-analytics",
|
|
30999
|
+
capScope: "device",
|
|
31000
|
+
addonId: null,
|
|
31001
|
+
access: "create"
|
|
31002
|
+
},
|
|
30092
31003
|
"pipelineAnalytics.getActiveTracks": {
|
|
30093
31004
|
capName: "pipeline-analytics",
|
|
30094
31005
|
capScope: "device",
|
|
@@ -30149,6 +31060,18 @@ Object.freeze({
|
|
|
30149
31060
|
addonId: null,
|
|
30150
31061
|
access: "view"
|
|
30151
31062
|
},
|
|
31063
|
+
"pipelineAnalytics.getRetrainExportUrl": {
|
|
31064
|
+
capName: "pipeline-analytics",
|
|
31065
|
+
capScope: "device",
|
|
31066
|
+
addonId: null,
|
|
31067
|
+
access: "view"
|
|
31068
|
+
},
|
|
31069
|
+
"pipelineAnalytics.getRetrainFrameImage": {
|
|
31070
|
+
capName: "pipeline-analytics",
|
|
31071
|
+
capScope: "device",
|
|
31072
|
+
addonId: null,
|
|
31073
|
+
access: "view"
|
|
31074
|
+
},
|
|
30152
31075
|
"pipelineAnalytics.getSensorEvents": {
|
|
30153
31076
|
capName: "pipeline-analytics",
|
|
30154
31077
|
capScope: "device",
|
|
@@ -30203,6 +31126,24 @@ Object.freeze({
|
|
|
30203
31126
|
addonId: null,
|
|
30204
31127
|
access: "view"
|
|
30205
31128
|
},
|
|
31129
|
+
"pipelineAnalytics.listRetrainAnnotations": {
|
|
31130
|
+
capName: "pipeline-analytics",
|
|
31131
|
+
capScope: "device",
|
|
31132
|
+
addonId: null,
|
|
31133
|
+
access: "view"
|
|
31134
|
+
},
|
|
31135
|
+
"pipelineAnalytics.listRetrainFrames": {
|
|
31136
|
+
capName: "pipeline-analytics",
|
|
31137
|
+
capScope: "device",
|
|
31138
|
+
addonId: null,
|
|
31139
|
+
access: "view"
|
|
31140
|
+
},
|
|
31141
|
+
"pipelineAnalytics.listRetrainStaging": {
|
|
31142
|
+
capName: "pipeline-analytics",
|
|
31143
|
+
capScope: "device",
|
|
31144
|
+
addonId: null,
|
|
31145
|
+
access: "view"
|
|
31146
|
+
},
|
|
30206
31147
|
"pipelineAnalytics.listTrackMedia": {
|
|
30207
31148
|
capName: "pipeline-analytics",
|
|
30208
31149
|
capScope: "device",
|
|
@@ -30215,6 +31156,12 @@ Object.freeze({
|
|
|
30215
31156
|
addonId: null,
|
|
30216
31157
|
access: "view"
|
|
30217
31158
|
},
|
|
31159
|
+
"pipelineAnalytics.proposeRetrainAnnotations": {
|
|
31160
|
+
capName: "pipeline-analytics",
|
|
31161
|
+
capScope: "device",
|
|
31162
|
+
addonId: null,
|
|
31163
|
+
access: "create"
|
|
31164
|
+
},
|
|
30218
31165
|
"pipelineAnalytics.pruneEvents": {
|
|
30219
31166
|
capName: "pipeline-analytics",
|
|
30220
31167
|
capScope: "device",
|
|
@@ -30245,12 +31192,30 @@ Object.freeze({
|
|
|
30245
31192
|
addonId: null,
|
|
30246
31193
|
access: "create"
|
|
30247
31194
|
},
|
|
31195
|
+
"pipelineAnalytics.restageRetrainTrack": {
|
|
31196
|
+
capName: "pipeline-analytics",
|
|
31197
|
+
capScope: "device",
|
|
31198
|
+
addonId: null,
|
|
31199
|
+
access: "create"
|
|
31200
|
+
},
|
|
31201
|
+
"pipelineAnalytics.saveRetrainAnnotations": {
|
|
31202
|
+
capName: "pipeline-analytics",
|
|
31203
|
+
capScope: "device",
|
|
31204
|
+
addonId: null,
|
|
31205
|
+
access: "create"
|
|
31206
|
+
},
|
|
30248
31207
|
"pipelineAnalytics.searchObjectEvents": {
|
|
30249
31208
|
capName: "pipeline-analytics",
|
|
30250
31209
|
capScope: "device",
|
|
30251
31210
|
addonId: null,
|
|
30252
31211
|
access: "view"
|
|
30253
31212
|
},
|
|
31213
|
+
"pipelineAnalytics.selectRetrainFrames": {
|
|
31214
|
+
capName: "pipeline-analytics",
|
|
31215
|
+
capScope: "device",
|
|
31216
|
+
addonId: null,
|
|
31217
|
+
access: "create"
|
|
31218
|
+
},
|
|
30254
31219
|
"pipelineAnalytics.setTrackFlags": {
|
|
30255
31220
|
capName: "pipeline-analytics",
|
|
30256
31221
|
capScope: "device",
|
|
@@ -32778,6 +33743,18 @@ Object.defineProperty(exports, "EventCategory", {
|
|
|
32778
33743
|
return EventCategory;
|
|
32779
33744
|
}
|
|
32780
33745
|
});
|
|
33746
|
+
Object.defineProperty(exports, "Fmp4BoxSplitter", {
|
|
33747
|
+
enumerable: true,
|
|
33748
|
+
get: function() {
|
|
33749
|
+
return Fmp4BoxSplitter;
|
|
33750
|
+
}
|
|
33751
|
+
});
|
|
33752
|
+
Object.defineProperty(exports, "LabelAttributionSchema", {
|
|
33753
|
+
enumerable: true,
|
|
33754
|
+
get: function() {
|
|
33755
|
+
return LabelAttributionSchema;
|
|
33756
|
+
}
|
|
33757
|
+
});
|
|
32781
33758
|
Object.defineProperty(exports, "MACRO_LABELS", {
|
|
32782
33759
|
enumerable: true,
|
|
32783
33760
|
get: function() {
|
|
@@ -32922,6 +33899,12 @@ Object.defineProperty(exports, "buildEventKindDescriptor", {
|
|
|
32922
33899
|
return buildEventKindDescriptor;
|
|
32923
33900
|
}
|
|
32924
33901
|
});
|
|
33902
|
+
Object.defineProperty(exports, "buildFfmpegArgs", {
|
|
33903
|
+
enumerable: true,
|
|
33904
|
+
get: function() {
|
|
33905
|
+
return buildFfmpegArgs;
|
|
33906
|
+
}
|
|
33907
|
+
});
|
|
32925
33908
|
Object.defineProperty(exports, "cosineSimilarity", {
|
|
32926
33909
|
enumerable: true,
|
|
32927
33910
|
get: function() {
|
|
@@ -32994,6 +33977,12 @@ Object.defineProperty(exports, "isScheduleActive", {
|
|
|
32994
33977
|
return isScheduleActive;
|
|
32995
33978
|
}
|
|
32996
33979
|
});
|
|
33980
|
+
Object.defineProperty(exports, "isSoftwareDecode", {
|
|
33981
|
+
enumerable: true,
|
|
33982
|
+
get: function() {
|
|
33983
|
+
return isSoftwareDecode;
|
|
33984
|
+
}
|
|
33985
|
+
});
|
|
32997
33986
|
Object.defineProperty(exports, "kebabToCamel", {
|
|
32998
33987
|
enumerable: true,
|
|
32999
33988
|
get: function() {
|