@camstack/addon-post-analysis 1.2.267 → 1.2.268
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/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-CJW84Bpj.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-CD926gMQ.mjs} +1 -1
- package/dist/pipeline-analytics/{hostInit-B3uXhoOC.mjs → hostInit-CBvxxcUn.mjs} +1 -1
- package/dist/pipeline-analytics/index.js +579 -56
- package/dist/pipeline-analytics/index.mjs +577 -56
- package/dist/pipeline-analytics/remoteEntry.js +1 -1
- package/package.json +1 -1
|
@@ -38384,7 +38384,7 @@ var StateAnalyzer = class {
|
|
|
38384
38384
|
}
|
|
38385
38385
|
const velocity = track.velocity ? Math.sqrt(track.velocity.dx ** 2 + track.velocity.dy ** 2) : 0;
|
|
38386
38386
|
const dwellTimeMs = timestamp - ts.enteredAt;
|
|
38387
|
-
const settled =
|
|
38387
|
+
const settled = this.speedSaysSettled(ts, track.bbox, velocity) || this.windowSaysStill(ts, track.bbox, timestamp);
|
|
38388
38388
|
let state;
|
|
38389
38389
|
if (ts.frameCount <= this.config.enteringFrames) state = "entering";
|
|
38390
38390
|
else if (settled) {
|
|
@@ -38420,6 +38420,37 @@ var StateAnalyzer = class {
|
|
|
38420
38420
|
return results;
|
|
38421
38421
|
}
|
|
38422
38422
|
/**
|
|
38423
|
+
* The SPEED half of the settled test.
|
|
38424
|
+
*
|
|
38425
|
+
* Uncalibrated (`stillSpeedFracPerSec` undefined) this is the original line
|
|
38426
|
+
* verbatim — the tracker's px-per-update velocity against the flat
|
|
38427
|
+
* `velocityThreshold`. Nothing about an uncalibrated camera changes.
|
|
38428
|
+
*
|
|
38429
|
+
* Calibrated, the same question is asked in the camera's own units: how far
|
|
38430
|
+
* the centroid moved between the last two OBSERVED samples, over the
|
|
38431
|
+
* subject's own box diagonal, over the elapsed SECONDS. Per second and not
|
|
38432
|
+
* per update because these cameras are `armed:on-motion` and deliver a
|
|
38433
|
+
* settle burst plus a poll — 56 ms to 2135 ms between stored positions on
|
|
38434
|
+
* one subject (D399) — so a per-update figure says more about the cadence
|
|
38435
|
+
* than about the subject.
|
|
38436
|
+
*
|
|
38437
|
+
* An interval that cannot be measured (a single sample, a non-positive
|
|
38438
|
+
* elapsed time, a box with no size) is UNKNOWN, and unknown never reads as
|
|
38439
|
+
* settled. A track that young is still inside `enteringFrames` anyway.
|
|
38440
|
+
*/
|
|
38441
|
+
speedSaysSettled(ts, bbox, velocity) {
|
|
38442
|
+
const bar = this.config.stillSpeedFracPerSec;
|
|
38443
|
+
if (bar === void 0) return velocity <= this.config.velocityThreshold;
|
|
38444
|
+
const last = ts.recent[ts.recent.length - 1];
|
|
38445
|
+
const prev = ts.recent[ts.recent.length - 2];
|
|
38446
|
+
if (!last || !prev) return false;
|
|
38447
|
+
const elapsedSec = (last.at - prev.at) / 1e3;
|
|
38448
|
+
if (!(elapsedSec > 0)) return false;
|
|
38449
|
+
const diagonal = Math.hypot(bbox.w, bbox.h);
|
|
38450
|
+
if (!(diagonal > 0)) return false;
|
|
38451
|
+
return Math.hypot(last.x - prev.x, last.y - prev.y) / diagonal / elapsedSec <= bar;
|
|
38452
|
+
}
|
|
38453
|
+
/**
|
|
38423
38454
|
* Whether the centroid has stayed inside a small span for the whole window.
|
|
38424
38455
|
*
|
|
38425
38456
|
* The span is measured across the samples themselves (their bounding box),
|
|
@@ -48128,6 +48159,338 @@ function makeViewerSettingsActionHandlers(store) {
|
|
|
48128
48159
|
};
|
|
48129
48160
|
}
|
|
48130
48161
|
//#endregion
|
|
48162
|
+
//#region src/pipeline-analytics/stillness-calibration-actions.ts
|
|
48163
|
+
/**
|
|
48164
|
+
* stillness-calibration-actions — "measure this camera's own stillness scale".
|
|
48165
|
+
*
|
|
48166
|
+
* ## Why an `addons.custom` action and not a cap method
|
|
48167
|
+
*
|
|
48168
|
+
* Same reason as `face.rescoreTrack` beside it: a cap method's wire schema
|
|
48169
|
+
* lives in `@camstack/types`, which travels inside the `@camstack/server`
|
|
48170
|
+
* closure, so a new one is not callable until a server train ships. Here the
|
|
48171
|
+
* schema lives in this addon's own dist and the hub forwards an opaque
|
|
48172
|
+
* envelope, so `camstack deploy` is the whole delivery.
|
|
48173
|
+
*
|
|
48174
|
+
* ## Why `apply` is explicit and not a fallback
|
|
48175
|
+
*
|
|
48176
|
+
* A calibration run READS recorded tracks and does arithmetic. Applying it
|
|
48177
|
+
* WRITES the camera's settings and changes what the tracker calls settled from
|
|
48178
|
+
* the next frame on. Those are different enough in consequence that a button
|
|
48179
|
+
* labelled "calibrate" must not choose between them on the operator's behalf —
|
|
48180
|
+
* the run reports, the operator applies. A REFUSED run never writes the bar
|
|
48181
|
+
* whatever `apply` says; it writes only the note, so the refusal and its reason
|
|
48182
|
+
* are visible in the form instead of being a toast that scrolls away.
|
|
48183
|
+
*/
|
|
48184
|
+
/** Mirrors `StillnessCalibrationRefusal` — kept literal so the wire schema is
|
|
48185
|
+
* self-describing and a new reason is a deliberate edit in both places. */
|
|
48186
|
+
var StillnessRefusalSchema = require_dist._enum([
|
|
48187
|
+
"no-tracks",
|
|
48188
|
+
"too-few-tracks",
|
|
48189
|
+
"too-few-samples",
|
|
48190
|
+
"no-motion-evidence"
|
|
48191
|
+
]);
|
|
48192
|
+
var StillnessMeasurementSchema = require_dist.object({
|
|
48193
|
+
/** Tracks that contributed at least one speed sample. */
|
|
48194
|
+
trackCount: require_dist.number().int(),
|
|
48195
|
+
/** Tracks the pass actually read, after the cost bound. */
|
|
48196
|
+
tracksRead: require_dist.number().int(),
|
|
48197
|
+
sampleCount: require_dist.number().int(),
|
|
48198
|
+
/** Speed quantiles, subject-box-diagonals per second. `null` when there was
|
|
48199
|
+
* nothing to measure — never 0, which would read as a measured stillness
|
|
48200
|
+
* (D393). */
|
|
48201
|
+
p25: require_dist.number().nullable(),
|
|
48202
|
+
p50: require_dist.number().nullable(),
|
|
48203
|
+
p90: require_dist.number().nullable(),
|
|
48204
|
+
/** Median gap between stored positions (s) — the camera's real cadence. */
|
|
48205
|
+
medianIntervalSec: require_dist.number().nullable(),
|
|
48206
|
+
/** Median subject box diagonal (px) the speeds were normalised by. */
|
|
48207
|
+
medianSubjectDiagonalPx: require_dist.number().nullable()
|
|
48208
|
+
});
|
|
48209
|
+
var StillnessCalibrateInputSchema = require_dist.object({
|
|
48210
|
+
deviceId: require_dist.number().int(),
|
|
48211
|
+
/** How far back to read. Bounded: this pass parses ~10 kB of trajectory a
|
|
48212
|
+
* row, so the window is a suggestion and `maxTracks` is the real bound. */
|
|
48213
|
+
sinceHours: require_dist.number().min(.25).max(720).default(72),
|
|
48214
|
+
/** Hard cost bound on tracks read, newest first. */
|
|
48215
|
+
maxTracks: require_dist.number().int().min(1).max(1e3).default(200),
|
|
48216
|
+
/**
|
|
48217
|
+
* Write the chosen bar onto the camera. Never implicit, and never done at
|
|
48218
|
+
* all for a refused run.
|
|
48219
|
+
*/
|
|
48220
|
+
apply: require_dist.boolean().default(false)
|
|
48221
|
+
});
|
|
48222
|
+
var StillnessCalibrateResultSchema = require_dist.object({
|
|
48223
|
+
deviceId: require_dist.number().int(),
|
|
48224
|
+
/** The window actually read (epoch ms). */
|
|
48225
|
+
since: require_dist.number().int(),
|
|
48226
|
+
until: require_dist.number().int(),
|
|
48227
|
+
accepted: require_dist.boolean(),
|
|
48228
|
+
/** Why it refused. Absent on an accepted run. */
|
|
48229
|
+
reason: StillnessRefusalSchema.optional(),
|
|
48230
|
+
/** The chosen bar, subject-box-diagonals per second. Absent on a refusal —
|
|
48231
|
+
* never 0, which the settings layer reads as "uncalibrated". */
|
|
48232
|
+
bar: require_dist.number().optional(),
|
|
48233
|
+
/** The raw quantile before the rails, so the clamp is arguable. */
|
|
48234
|
+
rawBar: require_dist.number().optional(),
|
|
48235
|
+
clampedBy: require_dist._enum([
|
|
48236
|
+
"none",
|
|
48237
|
+
"floor",
|
|
48238
|
+
"ceiling",
|
|
48239
|
+
"min",
|
|
48240
|
+
"max"
|
|
48241
|
+
]).optional(),
|
|
48242
|
+
measurement: StillnessMeasurementSchema,
|
|
48243
|
+
/** The bar this camera was on BEFORE the run — `null` = uncalibrated. Read
|
|
48244
|
+
* before any write, so the operator sees both numbers. */
|
|
48245
|
+
previousBar: require_dist.number().nullable(),
|
|
48246
|
+
/** Whether the camera's settings were actually written. */
|
|
48247
|
+
applied: require_dist.boolean(),
|
|
48248
|
+
/** The one-line note stored on the camera (accepted or refused). */
|
|
48249
|
+
note: require_dist.string()
|
|
48250
|
+
});
|
|
48251
|
+
var stillnessCalibrationActions = require_dist.defineCustomActions({
|
|
48252
|
+
/**
|
|
48253
|
+
* `admin` because it WRITES a per-camera detection threshold when `apply` is
|
|
48254
|
+
* set, and because the report describes how the camera's subjects move,
|
|
48255
|
+
* which is not a viewer-level fact.
|
|
48256
|
+
*/
|
|
48257
|
+
"stillness.calibrate": require_dist.customAction(StillnessCalibrateInputSchema, StillnessCalibrateResultSchema, {
|
|
48258
|
+
kind: "mutation",
|
|
48259
|
+
auth: "admin"
|
|
48260
|
+
}) });
|
|
48261
|
+
/**
|
|
48262
|
+
* The shipped limits.
|
|
48263
|
+
*
|
|
48264
|
+
* `minTracks` 12 / `minSamples` 200: the four live cameras sampled above
|
|
48265
|
+
* produced 697–8739 samples from 42–51 tracks in a single 60-track read, so a
|
|
48266
|
+
* camera that cannot clear these has genuinely not been watched enough.
|
|
48267
|
+
* `maxTracks` 200 bounds the read: the `positions` blob averages ~10 kB a row
|
|
48268
|
+
* (`track-store.ts`), so this pass is ~2 MB of JSON at its worst.
|
|
48269
|
+
*/
|
|
48270
|
+
var DEFAULT_STILLNESS_CALIBRATION_LIMITS = {
|
|
48271
|
+
minTracks: 12,
|
|
48272
|
+
minSamples: 200,
|
|
48273
|
+
maxTracks: 200,
|
|
48274
|
+
minIntervalSec: .02,
|
|
48275
|
+
maxIntervalSec: 3,
|
|
48276
|
+
quantile: .25,
|
|
48277
|
+
floorFactor: .02,
|
|
48278
|
+
ceilFactor: .25,
|
|
48279
|
+
minBar: .001,
|
|
48280
|
+
maxBar: 1
|
|
48281
|
+
};
|
|
48282
|
+
/** Linear-interpolated quantile. `NaN` for an empty list — never 0, which
|
|
48283
|
+
* would read as a measured zero (D393). */
|
|
48284
|
+
function quantileOf(values, p) {
|
|
48285
|
+
if (values.length === 0) return NaN;
|
|
48286
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
48287
|
+
const idx = (sorted.length - 1) * Math.min(Math.max(p, 0), 1);
|
|
48288
|
+
const lo = Math.floor(idx);
|
|
48289
|
+
const hi = Math.ceil(idx);
|
|
48290
|
+
const at = sorted[lo];
|
|
48291
|
+
const next = sorted[hi];
|
|
48292
|
+
if (at === void 0 || next === void 0) return NaN;
|
|
48293
|
+
return at + (next - at) * (idx - lo);
|
|
48294
|
+
}
|
|
48295
|
+
/**
|
|
48296
|
+
* Per-sample centroid speeds for a camera, in subject-box-diagonals per second.
|
|
48297
|
+
*
|
|
48298
|
+
* A pair of consecutive positions contributes a sample only when the interval
|
|
48299
|
+
* between them is inside `[minIntervalSec, maxIntervalSec]` and the later box
|
|
48300
|
+
* has a positive diagonal. A gap outside that band is a session boundary or a
|
|
48301
|
+
* duplicate read, not a measurement of how fast anything travelled; a box with
|
|
48302
|
+
* no size is unknown geometry, and unknown is never a sample.
|
|
48303
|
+
*/
|
|
48304
|
+
function collectStillnessSamples(tracks, limits) {
|
|
48305
|
+
const speeds = [];
|
|
48306
|
+
const intervals = [];
|
|
48307
|
+
const diagonals = [];
|
|
48308
|
+
let trackCount = 0;
|
|
48309
|
+
const read = tracks.slice(0, limits.maxTracks);
|
|
48310
|
+
for (const track of read) {
|
|
48311
|
+
const positions = [...track.positions].sort((a, b) => a.timestamp - b.timestamp);
|
|
48312
|
+
let contributed = false;
|
|
48313
|
+
for (let i = 1; i < positions.length; i++) {
|
|
48314
|
+
const prev = positions[i - 1];
|
|
48315
|
+
const cur = positions[i];
|
|
48316
|
+
if (prev === void 0 || cur === void 0) continue;
|
|
48317
|
+
const dtSec = (cur.timestamp - prev.timestamp) / 1e3;
|
|
48318
|
+
if (dtSec < limits.minIntervalSec || dtSec > limits.maxIntervalSec) continue;
|
|
48319
|
+
const diagonal = Math.hypot(cur.bbox.w, cur.bbox.h);
|
|
48320
|
+
if (!(diagonal > 0)) continue;
|
|
48321
|
+
const travelled = Math.hypot(cur.x - prev.x, cur.y - prev.y);
|
|
48322
|
+
speeds.push(travelled / diagonal / dtSec);
|
|
48323
|
+
intervals.push(dtSec);
|
|
48324
|
+
diagonals.push(diagonal);
|
|
48325
|
+
contributed = true;
|
|
48326
|
+
}
|
|
48327
|
+
if (contributed) trackCount++;
|
|
48328
|
+
}
|
|
48329
|
+
return {
|
|
48330
|
+
speeds,
|
|
48331
|
+
intervals,
|
|
48332
|
+
diagonals,
|
|
48333
|
+
trackCount,
|
|
48334
|
+
tracksRead: read.length
|
|
48335
|
+
};
|
|
48336
|
+
}
|
|
48337
|
+
function measure$1(samples) {
|
|
48338
|
+
return {
|
|
48339
|
+
trackCount: samples.trackCount,
|
|
48340
|
+
sampleCount: samples.speeds.length,
|
|
48341
|
+
p25: quantileOf(samples.speeds, .25),
|
|
48342
|
+
p50: quantileOf(samples.speeds, .5),
|
|
48343
|
+
p90: quantileOf(samples.speeds, .9),
|
|
48344
|
+
medianIntervalSec: quantileOf(samples.intervals, .5),
|
|
48345
|
+
medianSubjectDiagonalPx: quantileOf(samples.diagonals, .5)
|
|
48346
|
+
};
|
|
48347
|
+
}
|
|
48348
|
+
/**
|
|
48349
|
+
* Choose this camera's stillness speed bar, or refuse with a named reason.
|
|
48350
|
+
*
|
|
48351
|
+
* The order of the gates is the order of the questions: is there anything at
|
|
48352
|
+
* all, is it enough tracks, is it enough samples, and did anything on this
|
|
48353
|
+
* camera ever actually move. The last one is not pedantry — the whole method
|
|
48354
|
+
* scales the bar against the camera's own travel, so with no travel there is
|
|
48355
|
+
* nothing to scale against and the default is the honest answer.
|
|
48356
|
+
*/
|
|
48357
|
+
function calibrateStillnessSpeed(samples, limits) {
|
|
48358
|
+
const measurement = measure$1(samples);
|
|
48359
|
+
if (samples.tracksRead === 0) return {
|
|
48360
|
+
ok: false,
|
|
48361
|
+
reason: "no-tracks",
|
|
48362
|
+
measurement
|
|
48363
|
+
};
|
|
48364
|
+
if (samples.trackCount < limits.minTracks) return {
|
|
48365
|
+
ok: false,
|
|
48366
|
+
reason: "too-few-tracks",
|
|
48367
|
+
measurement
|
|
48368
|
+
};
|
|
48369
|
+
if (samples.speeds.length < limits.minSamples) return {
|
|
48370
|
+
ok: false,
|
|
48371
|
+
reason: "too-few-samples",
|
|
48372
|
+
measurement
|
|
48373
|
+
};
|
|
48374
|
+
if (!(measurement.p90 > 0)) return {
|
|
48375
|
+
ok: false,
|
|
48376
|
+
reason: "no-motion-evidence",
|
|
48377
|
+
measurement
|
|
48378
|
+
};
|
|
48379
|
+
const rawBar = quantileOf(samples.speeds, limits.quantile);
|
|
48380
|
+
const floor = measurement.p90 * limits.floorFactor;
|
|
48381
|
+
const ceiling = measurement.p90 * limits.ceilFactor;
|
|
48382
|
+
let bar = rawBar;
|
|
48383
|
+
let clampedBy = "none";
|
|
48384
|
+
if (bar < floor) {
|
|
48385
|
+
bar = floor;
|
|
48386
|
+
clampedBy = "floor";
|
|
48387
|
+
} else if (bar > ceiling) {
|
|
48388
|
+
bar = ceiling;
|
|
48389
|
+
clampedBy = "ceiling";
|
|
48390
|
+
}
|
|
48391
|
+
if (bar < limits.minBar) {
|
|
48392
|
+
bar = limits.minBar;
|
|
48393
|
+
clampedBy = "min";
|
|
48394
|
+
} else if (bar > limits.maxBar) {
|
|
48395
|
+
bar = limits.maxBar;
|
|
48396
|
+
clampedBy = "max";
|
|
48397
|
+
}
|
|
48398
|
+
return {
|
|
48399
|
+
ok: true,
|
|
48400
|
+
bar,
|
|
48401
|
+
rawBar,
|
|
48402
|
+
clampedBy,
|
|
48403
|
+
measurement
|
|
48404
|
+
};
|
|
48405
|
+
}
|
|
48406
|
+
/** One line an operator can read: what was measured, from how much, and what
|
|
48407
|
+
* rule produced the stored number. Kept short — it rides the settings blob. */
|
|
48408
|
+
function describeStillnessCalibration(outcome) {
|
|
48409
|
+
const m = outcome.measurement;
|
|
48410
|
+
const n = (v) => Number.isFinite(v) ? v.toFixed(4) : "unknown";
|
|
48411
|
+
const evidence = `${m.sampleCount} samples / ${m.trackCount} tracks, p25 ${n(m.p25)}, p50 ${n(m.p50)}, p90 ${n(m.p90)} subject-diagonals/s`;
|
|
48412
|
+
if (!outcome.ok) return `refused (${outcome.reason}) — ${evidence}`;
|
|
48413
|
+
return `bar ${n(outcome.bar)} (raw ${n(outcome.rawBar)}, clamp ${outcome.clampedBy}) — ${evidence}`;
|
|
48414
|
+
}
|
|
48415
|
+
//#endregion
|
|
48416
|
+
//#region src/pipeline-analytics/stillness-settings.ts
|
|
48417
|
+
/**
|
|
48418
|
+
* Per-device STILLNESS SCALE — the one number that says how fast a subject on
|
|
48419
|
+
* THIS camera has to move before it is travelling.
|
|
48420
|
+
*
|
|
48421
|
+
* A threshold belongs to whoever GENERATES the event, per device, never baked
|
|
48422
|
+
* into a classifier default. The judgement this feeds is
|
|
48423
|
+
* `StateAnalyzer.speedSaysSettled`; the measurement behind the number is
|
|
48424
|
+
* `pipeline/tracker/stillness-scale.ts`, which also carries the live
|
|
48425
|
+
* measurement showing why one number cannot serve a 30 m driveway and a 2 m
|
|
48426
|
+
* doorway.
|
|
48427
|
+
*
|
|
48428
|
+
* Cascade and shape mirror `stationary-settings` / `media-settings`: a
|
|
48429
|
+
* per-device override on top of the default, resolved per FIELD, and a parse
|
|
48430
|
+
* that never throws on a bad blob.
|
|
48431
|
+
*
|
|
48432
|
+
* **Absent behaves exactly as today.** The device store is a flat numeric blob
|
|
48433
|
+
* with no room for "unset", so the stored form of absent is `0` — and `0` is
|
|
48434
|
+
* not a bar anyone could want (it would mean nothing on this camera is ever
|
|
48435
|
+
* still) and not a value the calibration can produce (`minBar`). The decision
|
|
48436
|
+
* layer never sees it: {@link resolveStillSpeedFracPerSec} maps it to
|
|
48437
|
+
* `undefined`, and `undefined` is what leaves `StateAnalyzer` on its original
|
|
48438
|
+
* absolute `velocityThreshold` path.
|
|
48439
|
+
*/
|
|
48440
|
+
var StillnessSettingsSchema = require_dist.object({
|
|
48441
|
+
/**
|
|
48442
|
+
* The camera's "not travelling" bar: centroid speed as a fraction of the
|
|
48443
|
+
* SUBJECT's own box diagonal, per second. `0` = not calibrated (see above).
|
|
48444
|
+
*
|
|
48445
|
+
* Measured p50 on the live hub 2026-09-19, for scale: 0.0136 (device 592,
|
|
48446
|
+
* close view, mostly parked subjects) to 0.3081 (device 615, far view, only
|
|
48447
|
+
* transits).
|
|
48448
|
+
*/
|
|
48449
|
+
stillnessSpeedFracPerSec: require_dist.number().min(0).max(1).default(0),
|
|
48450
|
+
/**
|
|
48451
|
+
* When the number above was last CHOSEN — by a calibration run or by the
|
|
48452
|
+
* operator. `0` = never. Purely a readout; nothing gates on it.
|
|
48453
|
+
*/
|
|
48454
|
+
stillnessCalibratedAt: require_dist.number().int().min(0).default(0),
|
|
48455
|
+
/**
|
|
48456
|
+
* What the last calibration run measured and decided, in one line
|
|
48457
|
+
* (`describeStillnessCalibration`) — including a REFUSAL and its named
|
|
48458
|
+
* reason, because "why is this camera still on the default" has to be
|
|
48459
|
+
* answerable without re-running anything.
|
|
48460
|
+
*/
|
|
48461
|
+
stillnessCalibrationNote: require_dist.string().max(400).default("")
|
|
48462
|
+
});
|
|
48463
|
+
var STILLNESS_DEFAULTS = StillnessSettingsSchema.parse({});
|
|
48464
|
+
/**
|
|
48465
|
+
* Resolve a per-device store blob into typed stillness settings. Unknown or
|
|
48466
|
+
* invalid fields fall back to the default for that field — including a bar
|
|
48467
|
+
* outside the calibration's own rails, which is refused rather than clamped:
|
|
48468
|
+
* a number the calibration could never have produced is not evidence about
|
|
48469
|
+
* this camera, and silently bending it into range would present it as if it
|
|
48470
|
+
* were.
|
|
48471
|
+
*/
|
|
48472
|
+
function resolveStillnessSettings(raw) {
|
|
48473
|
+
const pick = (key) => {
|
|
48474
|
+
const parsed = StillnessSettingsSchema.shape[key].safeParse(raw[key]);
|
|
48475
|
+
return parsed.success ? parsed.data : STILLNESS_DEFAULTS[key];
|
|
48476
|
+
};
|
|
48477
|
+
return {
|
|
48478
|
+
stillnessSpeedFracPerSec: pick("stillnessSpeedFracPerSec"),
|
|
48479
|
+
stillnessCalibratedAt: pick("stillnessCalibratedAt"),
|
|
48480
|
+
stillnessCalibrationNote: pick("stillnessCalibrationNote")
|
|
48481
|
+
};
|
|
48482
|
+
}
|
|
48483
|
+
/**
|
|
48484
|
+
* The bar the decision layer gets: a positive, in-rails number, or
|
|
48485
|
+
* `undefined` for "this camera is not calibrated — judge it exactly as
|
|
48486
|
+
* before". The ONE place the stored-zero convention is interpreted.
|
|
48487
|
+
*/
|
|
48488
|
+
function resolveStillSpeedFracPerSec(settings) {
|
|
48489
|
+
const bar = settings.stillnessSpeedFracPerSec;
|
|
48490
|
+
if (!(bar >= .001) || bar > 1) return void 0;
|
|
48491
|
+
return bar;
|
|
48492
|
+
}
|
|
48493
|
+
//#endregion
|
|
48131
48494
|
//#region src/pipeline-analytics/viewer-settings-legacy-adoption.ts
|
|
48132
48495
|
/**
|
|
48133
48496
|
* @durable class=config owner=pipeline-analytics
|
|
@@ -71744,6 +72107,56 @@ var SyntheticTrackMaterializer = class {
|
|
|
71744
72107
|
return track;
|
|
71745
72108
|
}
|
|
71746
72109
|
};
|
|
72110
|
+
//#endregion
|
|
72111
|
+
//#region src/pipeline-analytics/stationary-settings.ts
|
|
72112
|
+
/**
|
|
72113
|
+
* Per-device stationary-object (parked/idle suppression) settings. Cascade: a
|
|
72114
|
+
* per-device override on top of the global default, resolved per field (an
|
|
72115
|
+
* invalid/missing value falls back to its default — parse never throws).
|
|
72116
|
+
* Mirrors `media-settings` / `tracking-settings`.
|
|
72117
|
+
*
|
|
72118
|
+
* The defaults are the SAME constants the registry uses at runtime
|
|
72119
|
+
* (`stationary-types.ts`), imported (not copied) so an unset value and a reset
|
|
72120
|
+
* value both resolve to exactly today's behaviour — "reset == unset == today",
|
|
72121
|
+
* with no drift. Guarded by a unit test asserting the equality.
|
|
72122
|
+
*/
|
|
72123
|
+
var StationarySettingsSchema = require_dist.object({
|
|
72124
|
+
/** Master switch. Off ⇒ this camera gathers no evidence and suppresses
|
|
72125
|
+
* nothing (every parked object keeps spawning normal tracks). */
|
|
72126
|
+
enabled: require_dist.boolean().default(true),
|
|
72127
|
+
/** IoU at/above which a detection is the same parked object, unmoved →
|
|
72128
|
+
* suppress its spawn. `SUPPRESS_IOU`. */
|
|
72129
|
+
suppressIou: require_dist.number().min(.3).max(.9).default(SUPPRESS_IOU),
|
|
72130
|
+
/** Minimum IoU for a detection to be ASSOCIATED with an entry (confirm or
|
|
72131
|
+
* wake it) — the overlap gate that stops a different vehicle from waking a
|
|
72132
|
+
* parked entry (the 617 flood fix). `WAKE_ASSOC_IOU`. */
|
|
72133
|
+
wakeAssocIou: require_dist.number().min(.02).max(.5).default(WAKE_ASSOC_IOU),
|
|
72134
|
+
/** Recent-window stillness after which a track stops holding its motion
|
|
72135
|
+
* session open (also the minimum track age). Creates nothing — birth is
|
|
72136
|
+
* decided by repeated evidence. `SESSION_STILLNESS_WINDOW_MS`. */
|
|
72137
|
+
sessionStillnessWindowMs: require_dist.number().int().min(5e3).max(12e4).default(SESSION_STILLNESS_WINDOW_MS),
|
|
72138
|
+
/** Observed-time TTL: retire an entry unconfirmed for this long (measured on
|
|
72139
|
+
* frames-flowing time, not wall-clock). `ENTRY_TTL_MS`. */
|
|
72140
|
+
entryTtlMs: require_dist.number().int().min(6e4).max(18e5).default(ENTRY_TTL_MS)
|
|
72141
|
+
});
|
|
72142
|
+
var STATIONARY_DEFAULTS = StationarySettingsSchema.parse({});
|
|
72143
|
+
/**
|
|
72144
|
+
* Resolve a per-device store blob into typed stationary settings. Unknown/invalid
|
|
72145
|
+
* fields fall back to the default for that field (never throws on a bad blob).
|
|
72146
|
+
*/
|
|
72147
|
+
function resolveStationarySettings(raw) {
|
|
72148
|
+
const pick = (key) => {
|
|
72149
|
+
const parsed = StationarySettingsSchema.shape[key].safeParse(raw[key]);
|
|
72150
|
+
return parsed.success ? parsed.data : STATIONARY_DEFAULTS[key];
|
|
72151
|
+
};
|
|
72152
|
+
return {
|
|
72153
|
+
enabled: pick("enabled"),
|
|
72154
|
+
suppressIou: pick("suppressIou"),
|
|
72155
|
+
wakeAssocIou: pick("wakeAssocIou"),
|
|
72156
|
+
sessionStillnessWindowMs: pick("sessionStillnessWindowMs"),
|
|
72157
|
+
entryTtlMs: pick("entryTtlMs")
|
|
72158
|
+
};
|
|
72159
|
+
}
|
|
71747
72160
|
var TrackingSettingsSchema = require_dist.object({
|
|
71748
72161
|
/**
|
|
71749
72162
|
* How much of a detection's box must lie inside a zone (0-1 fraction of the
|
|
@@ -71944,56 +72357,6 @@ function resolveTrackingSettings(raw) {
|
|
|
71944
72357
|
};
|
|
71945
72358
|
}
|
|
71946
72359
|
//#endregion
|
|
71947
|
-
//#region src/pipeline-analytics/stationary-settings.ts
|
|
71948
|
-
/**
|
|
71949
|
-
* Per-device stationary-object (parked/idle suppression) settings. Cascade: a
|
|
71950
|
-
* per-device override on top of the global default, resolved per field (an
|
|
71951
|
-
* invalid/missing value falls back to its default — parse never throws).
|
|
71952
|
-
* Mirrors `media-settings` / `tracking-settings`.
|
|
71953
|
-
*
|
|
71954
|
-
* The defaults are the SAME constants the registry uses at runtime
|
|
71955
|
-
* (`stationary-types.ts`), imported (not copied) so an unset value and a reset
|
|
71956
|
-
* value both resolve to exactly today's behaviour — "reset == unset == today",
|
|
71957
|
-
* with no drift. Guarded by a unit test asserting the equality.
|
|
71958
|
-
*/
|
|
71959
|
-
var StationarySettingsSchema = require_dist.object({
|
|
71960
|
-
/** Master switch. Off ⇒ this camera gathers no evidence and suppresses
|
|
71961
|
-
* nothing (every parked object keeps spawning normal tracks). */
|
|
71962
|
-
enabled: require_dist.boolean().default(true),
|
|
71963
|
-
/** IoU at/above which a detection is the same parked object, unmoved →
|
|
71964
|
-
* suppress its spawn. `SUPPRESS_IOU`. */
|
|
71965
|
-
suppressIou: require_dist.number().min(.3).max(.9).default(SUPPRESS_IOU),
|
|
71966
|
-
/** Minimum IoU for a detection to be ASSOCIATED with an entry (confirm or
|
|
71967
|
-
* wake it) — the overlap gate that stops a different vehicle from waking a
|
|
71968
|
-
* parked entry (the 617 flood fix). `WAKE_ASSOC_IOU`. */
|
|
71969
|
-
wakeAssocIou: require_dist.number().min(.02).max(.5).default(WAKE_ASSOC_IOU),
|
|
71970
|
-
/** Recent-window stillness after which a track stops holding its motion
|
|
71971
|
-
* session open (also the minimum track age). Creates nothing — birth is
|
|
71972
|
-
* decided by repeated evidence. `SESSION_STILLNESS_WINDOW_MS`. */
|
|
71973
|
-
sessionStillnessWindowMs: require_dist.number().int().min(5e3).max(12e4).default(SESSION_STILLNESS_WINDOW_MS),
|
|
71974
|
-
/** Observed-time TTL: retire an entry unconfirmed for this long (measured on
|
|
71975
|
-
* frames-flowing time, not wall-clock). `ENTRY_TTL_MS`. */
|
|
71976
|
-
entryTtlMs: require_dist.number().int().min(6e4).max(18e5).default(ENTRY_TTL_MS)
|
|
71977
|
-
});
|
|
71978
|
-
var STATIONARY_DEFAULTS = StationarySettingsSchema.parse({});
|
|
71979
|
-
/**
|
|
71980
|
-
* Resolve a per-device store blob into typed stationary settings. Unknown/invalid
|
|
71981
|
-
* fields fall back to the default for that field (never throws on a bad blob).
|
|
71982
|
-
*/
|
|
71983
|
-
function resolveStationarySettings(raw) {
|
|
71984
|
-
const pick = (key) => {
|
|
71985
|
-
const parsed = StationarySettingsSchema.shape[key].safeParse(raw[key]);
|
|
71986
|
-
return parsed.success ? parsed.data : STATIONARY_DEFAULTS[key];
|
|
71987
|
-
};
|
|
71988
|
-
return {
|
|
71989
|
-
enabled: pick("enabled"),
|
|
71990
|
-
suppressIou: pick("suppressIou"),
|
|
71991
|
-
wakeAssocIou: pick("wakeAssocIou"),
|
|
71992
|
-
sessionStillnessWindowMs: pick("sessionStillnessWindowMs"),
|
|
71993
|
-
entryTtlMs: pick("entryTtlMs")
|
|
71994
|
-
};
|
|
71995
|
-
}
|
|
71996
|
-
//#endregion
|
|
71997
72360
|
//#region src/pipeline-analytics/settings-schema-sections.ts
|
|
71998
72361
|
/** The detection-knob sections, in their original in-form order. */
|
|
71999
72362
|
function buildDetectionSettingsSections() {
|
|
@@ -72539,10 +72902,45 @@ function buildDetectionSettingsSections() {
|
|
|
72539
72902
|
displayScale: 1e3
|
|
72540
72903
|
}
|
|
72541
72904
|
]
|
|
72542
|
-
}
|
|
72905
|
+
},
|
|
72906
|
+
buildStillnessScaleSection()
|
|
72543
72907
|
];
|
|
72544
72908
|
}
|
|
72545
72909
|
/**
|
|
72910
|
+
* The per-camera STILLNESS SCALE — one measured number plus its provenance.
|
|
72911
|
+
*
|
|
72912
|
+
* Its own section rather than a field on `detection-sensitivity` because the
|
|
72913
|
+
* two answer different questions: `stationaryThresholdSec` is HOW LONG a
|
|
72914
|
+
* settled subject must stay settled, which is an operator preference; this is
|
|
72915
|
+
* HOW SLOW counts as settled, which is a fact about the camera and is
|
|
72916
|
+
* measured. Mixing them is how a measurement ends up being guessed at.
|
|
72917
|
+
*/
|
|
72918
|
+
function buildStillnessScaleSection() {
|
|
72919
|
+
return {
|
|
72920
|
+
id: "stillness-scale",
|
|
72921
|
+
title: "Stillness scale (per camera)",
|
|
72922
|
+
description: "How slowly a subject has to move on THIS camera before it counts as settled. A camera looking down a 30 m driveway and one watching a doorway two metres away disagree about this by more than an order of magnitude, so one fleet-wide number cannot be right for both. Leave it at 0 and the camera behaves exactly as it always has (a flat 2 px-per-update bar). Run the `stillness.calibrate` action to measure it from the camera’s own recorded tracks — the run reports what it measured and REFUSES, with a reason, when the evidence is too thin.",
|
|
72923
|
+
columns: 1,
|
|
72924
|
+
fields: [{
|
|
72925
|
+
type: "number",
|
|
72926
|
+
key: "stillnessSpeedFracPerSec",
|
|
72927
|
+
label: "Stillness speed bar",
|
|
72928
|
+
description: "Centroid speed, as a fraction of the subject’s OWN box diagonal, per second, at or below which the subject is not travelling. Subject-relative, so perspective is already divided out; per second, so an irregular on-motion cadence cannot masquerade as speed. 0 = not calibrated (the shipped absolute bar decides, exactly as before). Live reference: 0.0136 on a close, mostly-parked view; 0.3081 on a far view whose subjects only transit.",
|
|
72929
|
+
min: 0,
|
|
72930
|
+
max: 1,
|
|
72931
|
+
step: .001,
|
|
72932
|
+
default: STILLNESS_DEFAULTS.stillnessSpeedFracPerSec
|
|
72933
|
+
}, {
|
|
72934
|
+
type: "text",
|
|
72935
|
+
key: "stillnessCalibrationNote",
|
|
72936
|
+
label: "Last calibration",
|
|
72937
|
+
description: "What the last run measured, from how many samples and tracks, and what it chose — or which named reason it refused for. Display only.",
|
|
72938
|
+
default: STILLNESS_DEFAULTS.stillnessCalibrationNote,
|
|
72939
|
+
readonlyField: true
|
|
72940
|
+
}]
|
|
72941
|
+
};
|
|
72942
|
+
}
|
|
72943
|
+
/**
|
|
72546
72944
|
* Re-home the global analytics sections into the per-device `Analytics`
|
|
72547
72945
|
* top-tab. Every section defaults to the `Analytics` tab (so the
|
|
72548
72946
|
* device-manager aggregator groups them) AND is marked
|
|
@@ -72568,6 +72966,7 @@ function toAnalyticsDeviceSections(sections) {
|
|
|
72568
72966
|
* - `tracking` — the tracker-tuning form incl. the FP knobs (dedup, person↔
|
|
72569
72967
|
* animal dedup, class voting, confirm-bypass, per-class min score).
|
|
72570
72968
|
* - `stationary-objects` — stationary promotion + occupancy tuning.
|
|
72969
|
+
* - `stillness-scale` — the per-camera measured "how slow is settled" bar.
|
|
72571
72970
|
* `DeviceDetail` folds `tab: 'detection-pipeline'` top-tab sections into the
|
|
72572
72971
|
* structural Detection pipeline tab, so re-tagging is all that's needed —
|
|
72573
72972
|
* there is no admin-ui change and no duplicate render (a section has one tab).
|
|
@@ -72576,7 +72975,8 @@ var DETECTION_PIPELINE_SECTION_IDS = new Set([
|
|
|
72576
72975
|
"detection-sensitivity",
|
|
72577
72976
|
"confirmation-gate",
|
|
72578
72977
|
"tracking",
|
|
72579
|
-
"stationary-objects"
|
|
72978
|
+
"stationary-objects",
|
|
72979
|
+
"stillness-scale"
|
|
72580
72980
|
]);
|
|
72581
72981
|
/**
|
|
72582
72982
|
* Re-home the detection-knob sections from the `Analytics` top-tab onto the
|
|
@@ -76308,7 +76708,8 @@ var customActions = {
|
|
|
76308
76708
|
...locationDiscardActions,
|
|
76309
76709
|
...viewerSettingsActions,
|
|
76310
76710
|
...photoEnrollActions,
|
|
76311
|
-
...faceRescoreActions
|
|
76711
|
+
...faceRescoreActions,
|
|
76712
|
+
...stillnessCalibrationActions
|
|
76312
76713
|
};
|
|
76313
76714
|
/**
|
|
76314
76715
|
* Width cap on the ONE full frame a debug crop is cut from.
|
|
@@ -77148,6 +77549,12 @@ var PipelineAnalyticsAddon = class PipelineAnalyticsAddon extends require_dist.B
|
|
|
77148
77549
|
* the frame path like the stationary one and a cold miss answers the
|
|
77149
77550
|
* measured default. */
|
|
77150
77551
|
summarySettingsCache = this.settingsCaches.registerDeviceCache("summary", SETTINGS_CACHE_TTL_MS);
|
|
77552
|
+
/** Per-device STILLNESS SCALE cache — the measured "how slow is settled" bar
|
|
77553
|
+
* (`stillness-settings.ts`). Read once per FrameProcessor build, so this is
|
|
77554
|
+
* a cold-path cache; it exists so a calibration applied through
|
|
77555
|
+
* `stillness.calibrate` reaches the tracker on the next processor rebuild
|
|
77556
|
+
* rather than on the next addon restart. */
|
|
77557
|
+
stillnessSettingsCache = this.settingsCaches.registerDeviceCache("stillness", SETTINGS_CACHE_TTL_MS);
|
|
77151
77558
|
/** Turns stationary appear/depart into package-delivered/picked-up events. */
|
|
77152
77559
|
packageDropDetector = null;
|
|
77153
77560
|
/**
|
|
@@ -77852,7 +78259,8 @@ var PipelineAnalyticsAddon = class PipelineAnalyticsAddon extends require_dist.B
|
|
|
77852
78259
|
...locationDiscardActions,
|
|
77853
78260
|
...viewerSettingsActions,
|
|
77854
78261
|
...photoEnrollActions,
|
|
77855
|
-
...faceRescoreActions
|
|
78262
|
+
...faceRescoreActions,
|
|
78263
|
+
...stillnessCalibrationActions
|
|
77856
78264
|
},
|
|
77857
78265
|
actionHandlers: {
|
|
77858
78266
|
...ncHandlers,
|
|
@@ -77860,6 +78268,7 @@ var PipelineAnalyticsAddon = class PipelineAnalyticsAddon extends require_dist.B
|
|
|
77860
78268
|
...this.buildDebugActionHandlers(),
|
|
77861
78269
|
...this.buildPhotoEnrollActionHandlers(),
|
|
77862
78270
|
...this.buildFaceRescoreActionHandlers(),
|
|
78271
|
+
...this.buildStillnessCalibrationActionHandlers(),
|
|
77863
78272
|
...this.viewerSettingsSnapshots ? makeViewerSettingsActionHandlers(this.viewerSettingsSnapshots) : {}
|
|
77864
78273
|
}
|
|
77865
78274
|
} : {}
|
|
@@ -81843,6 +82252,12 @@ var PipelineAnalyticsAddon = class PipelineAnalyticsAddon extends require_dist.B
|
|
|
81843
82252
|
async resolveDeviceStationarySettings(deviceId) {
|
|
81844
82253
|
return this.stationarySettingsCache.get(deviceId, (id) => this.readDeviceSettings(id, resolveStationarySettings));
|
|
81845
82254
|
}
|
|
82255
|
+
/** Per-device stillness scale. An absent/zero bar resolves to `undefined`
|
|
82256
|
+
* ({@link resolveStillSpeedFracPerSec}) and leaves the state analyzer on
|
|
82257
|
+
* its original absolute threshold — uncalibrated is exactly today. */
|
|
82258
|
+
async resolveDeviceStillnessSettings(deviceId) {
|
|
82259
|
+
return this.stillnessSettingsCache.get(deviceId, (id) => this.readDeviceSettings(id, resolveStillnessSettings));
|
|
82260
|
+
}
|
|
81846
82261
|
/**
|
|
81847
82262
|
* Count SHORT + MOTIONLESS track closes per frame cell.
|
|
81848
82263
|
*
|
|
@@ -84239,6 +84654,7 @@ var PipelineAnalyticsAddon = class PipelineAnalyticsAddon extends require_dist.B
|
|
|
84239
84654
|
if (!p) {
|
|
84240
84655
|
const { minHits, stationaryThresholdSec, minTrackAge, cooldownSec } = await this.resolveDeviceDetectionSensitivitySettings(deviceId);
|
|
84241
84656
|
const trk = await this.resolveDeviceTrackingSettings(deviceId);
|
|
84657
|
+
const stillSpeedFracPerSec = resolveStillSpeedFracPerSec(await this.resolveDeviceStillnessSettings(deviceId));
|
|
84242
84658
|
p = new FrameProcessor(deviceId, {
|
|
84243
84659
|
minHits,
|
|
84244
84660
|
iouThreshold: trk.iouThreshold,
|
|
@@ -84280,7 +84696,10 @@ var PipelineAnalyticsAddon = class PipelineAnalyticsAddon extends require_dist.B
|
|
|
84280
84696
|
vehicle: trk.minSpawnAreaFracVehicle
|
|
84281
84697
|
},
|
|
84282
84698
|
classGroupAssoc: trk.classGroupAssoc
|
|
84283
|
-
}, {
|
|
84699
|
+
}, {
|
|
84700
|
+
stationaryThresholdSec,
|
|
84701
|
+
...stillSpeedFracPerSec !== void 0 ? { stillSpeedFracPerSec } : {}
|
|
84702
|
+
}, {
|
|
84284
84703
|
minTrackAge,
|
|
84285
84704
|
cooldownSec,
|
|
84286
84705
|
minTrackAgeMs: trk.minTrackAgeMs
|
|
@@ -86002,6 +86421,109 @@ var PipelineAnalyticsAddon = class PipelineAnalyticsAddon extends require_dist.B
|
|
|
86002
86421
|
buildFaceRescoreActionHandlers() {
|
|
86003
86422
|
return { "face.rescoreTrack": (input) => this.rescoreFaceForTrack(input) };
|
|
86004
86423
|
}
|
|
86424
|
+
buildStillnessCalibrationActionHandlers() {
|
|
86425
|
+
return { "stillness.calibrate": (input) => this.calibrateStillnessForDevice(input) };
|
|
86426
|
+
}
|
|
86427
|
+
/**
|
|
86428
|
+
* Measure ONE camera's stillness scale from its own recorded tracks.
|
|
86429
|
+
*
|
|
86430
|
+
* Cost-bounded by construction: one `queryRecent` page of at most
|
|
86431
|
+
* `maxTracks` rows over the requested window, `projection: 'full'` because
|
|
86432
|
+
* the trajectory IS the measurement, and nothing else is read. The arithmetic
|
|
86433
|
+
* is `stillness-scale.ts` and is pure — this method only fetches, reports and
|
|
86434
|
+
* (on `apply`) writes.
|
|
86435
|
+
*
|
|
86436
|
+
* A REFUSAL never writes the bar. It does write the note, because "why is
|
|
86437
|
+
* this camera still on the default" has to be answerable from the form
|
|
86438
|
+
* rather than from a toast nobody kept.
|
|
86439
|
+
*/
|
|
86440
|
+
async calibrateStillnessForDevice(input) {
|
|
86441
|
+
const trackStore = this.trackStore;
|
|
86442
|
+
if (!trackStore) throw new Error("stillness.calibrate: the track store is not ready");
|
|
86443
|
+
const until = Date.now();
|
|
86444
|
+
const since = until - Math.round(input.sinceHours * 36e5);
|
|
86445
|
+
const limits = {
|
|
86446
|
+
...DEFAULT_STILLNESS_CALIBRATION_LIMITS,
|
|
86447
|
+
maxTracks: input.maxTracks
|
|
86448
|
+
};
|
|
86449
|
+
const previous = resolveStillSpeedFracPerSec(await this.resolveDeviceStillnessSettings(input.deviceId));
|
|
86450
|
+
const samples = collectStillnessSamples((await trackStore.queryRecent({
|
|
86451
|
+
deviceIds: [input.deviceId],
|
|
86452
|
+
since,
|
|
86453
|
+
until,
|
|
86454
|
+
limit: limits.maxTracks,
|
|
86455
|
+
projection: "full"
|
|
86456
|
+
})).tracks.map((t) => ({
|
|
86457
|
+
trackId: t.trackId,
|
|
86458
|
+
className: t.className,
|
|
86459
|
+
positions: t.positions.map((pos) => ({
|
|
86460
|
+
x: pos.x,
|
|
86461
|
+
y: pos.y,
|
|
86462
|
+
timestamp: pos.timestamp,
|
|
86463
|
+
bbox: {
|
|
86464
|
+
w: pos.bbox.w,
|
|
86465
|
+
h: pos.bbox.h
|
|
86466
|
+
}
|
|
86467
|
+
}))
|
|
86468
|
+
})), limits);
|
|
86469
|
+
const outcome = calibrateStillnessSpeed(samples, limits);
|
|
86470
|
+
const note = describeStillnessCalibration(outcome);
|
|
86471
|
+
const finite = (v) => Number.isFinite(v) ? v : null;
|
|
86472
|
+
const measurement = {
|
|
86473
|
+
trackCount: outcome.measurement.trackCount,
|
|
86474
|
+
tracksRead: samples.tracksRead,
|
|
86475
|
+
sampleCount: outcome.measurement.sampleCount,
|
|
86476
|
+
p25: finite(outcome.measurement.p25),
|
|
86477
|
+
p50: finite(outcome.measurement.p50),
|
|
86478
|
+
p90: finite(outcome.measurement.p90),
|
|
86479
|
+
medianIntervalSec: finite(outcome.measurement.medianIntervalSec),
|
|
86480
|
+
medianSubjectDiagonalPx: finite(outcome.measurement.medianSubjectDiagonalPx)
|
|
86481
|
+
};
|
|
86482
|
+
let applied = false;
|
|
86483
|
+
if (input.apply) {
|
|
86484
|
+
const patch = {
|
|
86485
|
+
stillnessCalibrationNote: note,
|
|
86486
|
+
stillnessCalibratedAt: until
|
|
86487
|
+
};
|
|
86488
|
+
if (outcome.ok) patch["stillnessSpeedFracPerSec"] = outcome.bar;
|
|
86489
|
+
await this.applyDeviceSettingsPatch({
|
|
86490
|
+
deviceId: input.deviceId,
|
|
86491
|
+
patch
|
|
86492
|
+
});
|
|
86493
|
+
applied = outcome.ok;
|
|
86494
|
+
}
|
|
86495
|
+
this.ctx.logger.info("stillness calibration", {
|
|
86496
|
+
tags: { deviceId: input.deviceId },
|
|
86497
|
+
meta: {
|
|
86498
|
+
accepted: outcome.ok,
|
|
86499
|
+
...outcome.ok ? {} : { reason: outcome.reason },
|
|
86500
|
+
...outcome.ok ? {
|
|
86501
|
+
bar: outcome.bar,
|
|
86502
|
+
clampedBy: outcome.clampedBy
|
|
86503
|
+
} : {},
|
|
86504
|
+
previousBar: previous ?? null,
|
|
86505
|
+
applied,
|
|
86506
|
+
windowHours: input.sinceHours,
|
|
86507
|
+
...measurement
|
|
86508
|
+
}
|
|
86509
|
+
});
|
|
86510
|
+
return {
|
|
86511
|
+
deviceId: input.deviceId,
|
|
86512
|
+
since,
|
|
86513
|
+
until,
|
|
86514
|
+
accepted: outcome.ok,
|
|
86515
|
+
...outcome.ok ? {} : { reason: outcome.reason },
|
|
86516
|
+
...outcome.ok ? {
|
|
86517
|
+
bar: outcome.bar,
|
|
86518
|
+
rawBar: outcome.rawBar,
|
|
86519
|
+
clampedBy: outcome.clampedBy
|
|
86520
|
+
} : {},
|
|
86521
|
+
measurement,
|
|
86522
|
+
previousBar: previous ?? null,
|
|
86523
|
+
applied,
|
|
86524
|
+
note
|
|
86525
|
+
};
|
|
86526
|
+
}
|
|
86005
86527
|
buildPhotoEnrollActionHandlers() {
|
|
86006
86528
|
return {
|
|
86007
86529
|
"photo.analyze": async (input) => {
|
|
@@ -87084,6 +87606,7 @@ var PipelineAnalyticsAddon = class PipelineAnalyticsAddon extends require_dist.B
|
|
|
87084
87606
|
this.trackingSettingsCache.delete(input.deviceId);
|
|
87085
87607
|
this.confirmationGateSettingsCache.delete(input.deviceId);
|
|
87086
87608
|
this.mediaSettingsCache.delete(input.deviceId);
|
|
87609
|
+
this.stillnessSettingsCache.delete(input.deviceId);
|
|
87087
87610
|
this.forgetDeviceProcessors(input.deviceId);
|
|
87088
87611
|
return { success: true };
|
|
87089
87612
|
}
|