camstack 1.2.128 → 1.2.130

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.
@@ -14522,7 +14522,7 @@ function date4(params) {
14522
14522
  // ../../node_modules/zod/v4/classic/external.js
14523
14523
  config(en_default());
14524
14524
 
14525
- // ../types/dist/sleep-uGNYCvYp.mjs
14525
+ // ../types/dist/sleep-DMghvp8F.mjs
14526
14526
  var WELL_KNOWN_TABS = [
14527
14527
  {
14528
14528
  id: "overview",
@@ -15582,6 +15582,147 @@ var CameraSwitchGroupSchema = external_exports.object({
15582
15582
  /** Unix ms when the group was composed server-side. */
15583
15583
  fetchedAt: external_exports.number()
15584
15584
  });
15585
+ var BirthDecisionVerdictSchema = external_exports.enum([
15586
+ "confirmed",
15587
+ "suppressed",
15588
+ "exhausted-fallback"
15589
+ ]);
15590
+ var BirthDecisionRecordSchema = external_exports.object({
15591
+ id: external_exports.string(),
15592
+ /** Epoch ms the VERDICT was taken (not the birth instant — see `firstSeen`). */
15593
+ at: external_exports.number().int(),
15594
+ /** The camera. Required: every question here is asked per-camera. */
15595
+ deviceId: external_exports.number().int(),
15596
+ /**
15597
+ * The track the decision was about. PROVENANCE, not ownership — a suppressed
15598
+ * birth has no track at all, and a confirmed one is expected to age out long
15599
+ * before this row does. Named `sourceTrackId` so the retention model's
15600
+ * ownership derivation (`collection-classification.ts`, which keys on a
15601
+ * column literally called `trackId`) cannot reach it.
15602
+ */
15603
+ sourceTrackId: external_exports.string(),
15604
+ /** The candidate's claimed class. The miss rate is asked per class too. */
15605
+ className: external_exports.string(),
15606
+ verdict: BirthDecisionVerdictSchema,
15607
+ /**
15608
+ * The gate's own `ConfirmationReason` (`confirmed`, `suppressed`,
15609
+ * `native-pass`, `no-crop`, `timeout`, `carried-inconclusive`, …), or `null`
15610
+ * when the gate is DISABLED and every birth is waved through. `null` is not
15611
+ * "unknown": it says the gate took no measurement because it was off, which
15612
+ * is a different population and must never be averaged in with the rest.
15613
+ */
15614
+ reason: external_exports.string().nullable(),
15615
+ /** Deferral attempts this birth used. 0 = decided on its first look. */
15616
+ attempts: external_exports.number().int(),
15617
+ /** Ms from the FIRST undecided attempt to this verdict. 0 = never deferred. */
15618
+ deferredForMs: external_exports.number().int(),
15619
+ /**
15620
+ * THE COLUMN THE RE-OFFER DEFECT IS COUNTED IN.
15621
+ *
15622
+ * `true` when the frame the verdict was taken on carried no matched
15623
+ * detection for this track — the tracker was coasting a frozen box and the
15624
+ * subject was not observed. The deferred-birth re-offer pulls the candidate
15625
+ * straight out of `result.tracked` without checking, so this is reachable
15626
+ * today; the question is the RATE, per camera, and whether refusing those
15627
+ * frames would have cost real tracks (cross-read against `verdict` and
15628
+ * `decidedByBirthEvidence`).
15629
+ */
15630
+ decidedOnCoastedFrame: external_exports.boolean(),
15631
+ /** Were D379 birth-instant pixels in hand when this candidate was submitted? */
15632
+ birthEvidenceAvailable: external_exports.boolean(),
15633
+ /**
15634
+ * Did those pixels DECIDE it (`cropSource === 'carried'`)? Available and
15635
+ * deciding are different: the carried crop is confirm-only, so a candidate
15636
+ * can hold evidence, be found inconclusive on it, and be decided by a native
15637
+ * crop of a later instant. A coasted decision backed by carried evidence is
15638
+ * a real observation of the birth instant; one without it is not.
15639
+ */
15640
+ decidedByBirthEvidence: external_exports.boolean(),
15641
+ /** Best class-compatible crop score, or `null` when nothing compatible was
15642
+ * found — deliberately not 0, which would be a measurement that never was. */
15643
+ bestScore: external_exports.number().nullable(),
15644
+ /** The bar this candidate actually faced (the phantom-cell hook may raise it). */
15645
+ appliedMinConfidence: external_exports.number().nullable(),
15646
+ /**
15647
+ * The track's own `firstSeen` — the candidate's first frame, which is where
15648
+ * the timeline starts. `null` for a suppressed birth, which has no track.
15649
+ */
15650
+ firstSeen: external_exports.number().int().nullable(),
15651
+ /**
15652
+ * The device's most recent motion RISING EDGE at the moment of the decision,
15653
+ * or `null` when there is none, it is older than
15654
+ * {@link MAX_BIRTH_LATENCY_PROXY_MS}, or this runner never saw one.
15655
+ */
15656
+ motionOnsetAt: external_exports.number().int().nullable(),
15657
+ /**
15658
+ * `firstSeen − motionOnsetAt` — THE OPERATOR'S COMPLAINT, IN MILLISECONDS,
15659
+ * AND THE WEAKEST NUMBER IN THIS ROW. Read the error bars before quoting it.
15660
+ *
15661
+ * **Why motion onset and not something else.** Two other proxies were
15662
+ * considered and rejected:
15663
+ * - *the recording/pipeline session start*: for a camera on
15664
+ * `detectionMode: 'always'` the session opens at process start, hours
15665
+ * before any subject. It measures nothing.
15666
+ * - *the first detection on the device in this burst*: CIRCULAR. A track's
15667
+ * `firstSeen` IS the first detection of that object, so for the track that
15668
+ * OPENS a burst — the only one the operator is complaining about — the two
15669
+ * are the same instant and the latency is 0 by construction.
15670
+ * Motion onset is the only in-process signal produced by a DIFFERENT
15671
+ * mechanism from the object detector, so it is the only one that can precede
15672
+ * it. It is also already maintained per-device at frame rate on this very
15673
+ * node (`handleMotionAnalysis` / `handleOnboardMotion`), which is what makes
15674
+ * it free — and, decisively, the frame path and the motion path are gated to
15675
+ * the SAME designated post-processing node, so the mirror is never empty for
15676
+ * a camera whose births land here.
15677
+ *
15678
+ * **Error bars, all of them.**
15679
+ * 1. *Motion has no class.* A burst opened by rain, a headlight sweeping a
15680
+ * wall or a branch, and only later joined by the person, OVERSTATES the
15681
+ * latency without bound. Mitigated, never removed, by
15682
+ * {@link BirthDecisionRecord.birthIndexInBurst}: only index 0 is a
15683
+ * candidate for "this burst is this subject", and even then it is a
15684
+ * candidate, not a fact.
15685
+ * 2. *The sign is not guaranteed.* The analyzer needs a pixel-count and
15686
+ * intensity threshold. A subject entering slowly at the far edge of the
15687
+ * frame can clear the detector's confidence floor BEFORE it clears the
15688
+ * motion floor, making this negative. Negatives are stored as-is and
15689
+ * never clamped — clamping would fabricate the distribution's left tail,
15690
+ * which is the half that says the proxy is unreliable.
15691
+ * 3. *Onboard motion carries firmware latency of unknown, per-model offset*
15692
+ * (hundreds of ms), plus camera-vs-hub clock skew on top. Numbers are
15693
+ * therefore comparable WITHIN a camera and not across cameras of
15694
+ * different motion sources. The motion source is deliberately not copied
15695
+ * here — it belongs to the addon that owns the device (D224) and this is
15696
+ * a write on the frame path — so group by `deviceId`, which is how the
15697
+ * question is always asked anyway.
15698
+ * 4. *Continuous motion.* On a busy scene the burst never closes and the
15699
+ * onset is minutes old. Bounded by {@link MAX_BIRTH_LATENCY_PROXY_MS};
15700
+ * past it this is `null`.
15701
+ * 5. *No motion signal at all* — analyzer off, onboard-only camera not
15702
+ * reporting, or nothing since boot: `null`. Which is the truth about a
15703
+ * camera nobody has a reference instant for.
15704
+ *
15705
+ * So this is a per-camera DISTRIBUTION over index-0 births, and it is honest
15706
+ * as such. It is not a per-track fact and must never be shown as one.
15707
+ */
15708
+ birthLatencyMs: external_exports.number().int().nullable(),
15709
+ /**
15710
+ * How many births this device has already decided since that motion onset.
15711
+ * 0 = the first, i.e. the only index at which the burst plausibly belongs to
15712
+ * this subject. `null` when there is no usable onset.
15713
+ */
15714
+ birthIndexInBurst: external_exports.number().int().nullable()
15715
+ });
15716
+ var BirthDecisionQueryInputSchema = external_exports.object({
15717
+ /** Restrict to a single camera; omit for every row. */
15718
+ deviceId: external_exports.number().int().optional(),
15719
+ /** Only decisions at or after this epoch ms. */
15720
+ since: external_exports.number().int().optional(),
15721
+ /** Restrict to one verdict — the miss rate is read one population at a time. */
15722
+ verdict: BirthDecisionVerdictSchema.optional(),
15723
+ /** Max rows returned, newest-first. */
15724
+ limit: external_exports.number().int().min(1).max(5e3).optional()
15725
+ });
15585
15726
  var ArchivedDebugNoteSchema = external_exports.object({
15586
15727
  /** Archive row id. Derived from `(sourceTrackId, note)`, so re-archiving the
15587
15728
  * same sentence about the same track lands on the row already there. */
@@ -27482,6 +27623,26 @@ var pipelineAnalyticsCapability = {
27482
27623
  */
27483
27624
  listArchivedDebugNotes: method(ArchivedDebugNoteQueryInputSchema, external_exports.array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }),
27484
27625
  /**
27626
+ * Birth decisions — one row per resolved confirmation-gate verdict (D409).
27627
+ *
27628
+ * The READ half of a measurement, and only that: it gates nothing and no
27629
+ * runtime path consults it. It exists because the two questions the
27630
+ * operator's "traccia partita in ritardo" marks raised are both multi-day
27631
+ * and `logs.query` holds under an hour of fleet traffic —
27632
+ * • how often is a birth DECIDED on a frame the subject was not observed
27633
+ * in (`decidedOnCoastedFrame`), and did D379's carried pixels make it a
27634
+ * real observation anyway (`decidedByBirthEvidence`);
27635
+ * • how long after the camera's motion onset does a track's `firstSeen`
27636
+ * land (`birthLatencyMs` — read its error bars in
27637
+ * `BirthDecisionRecordSchema` before quoting it).
27638
+ *
27639
+ * Newest-first, capped by `limit` (default
27640
+ * {@link BIRTH_DECISION_DEFAULT_LIMIT}), optionally scoped to one camera,
27641
+ * one verdict, or a `since`. The table is bounded by row count, not age —
27642
+ * see {@link MAX_BIRTH_DECISION_RECORDS}.
27643
+ */
27644
+ listBirthDecisions: method(BirthDecisionQueryInputSchema, external_exports.array(BirthDecisionRecordSchema).readonly(), { kind: "query" }),
27645
+ /**
27485
27646
  * Durable event-store footprint for the management UI: event rows
27486
27647
  * (motion + object + audio) counted per camera + total, plus the
27487
27648
  * event-owned media bytes on disk per camera + total. Stat/count-based,
@@ -28201,6 +28362,12 @@ var occupancyRecheckFramesField = {
28201
28362
  default: 4,
28202
28363
  step: 1
28203
28364
  };
28365
+ var preRollInferenceFramesField = {
28366
+ min: 0,
28367
+ max: 30,
28368
+ default: 12,
28369
+ step: 1
28370
+ };
28204
28371
  var MotionSourceEnum = external_exports.enum([
28205
28372
  "onboard",
28206
28373
  "analyzer",
@@ -28362,6 +28529,31 @@ var RunnerCameraConfigSchema = external_exports.object({
28362
28529
  * to every occupancy rule until something moved in front of it. The churn is
28363
28530
  * now paid on the interval instead — see `occupancyRecheckSecField`.
28364
28531
  */
28532
+ /**
28533
+ * Infer the session's PRE-ROLL — the retained history the restreamer replays
28534
+ * at session open — instead of decoding it and throwing it away.
28535
+ *
28536
+ * DEFAULT `true`, and the default is the argument. This is not a new
28537
+ * capability being offered cautiously: the pre-roll is ALREADY requested,
28538
+ * already served, already decoded and already paid for on every on-motion
28539
+ * detection session that asks for history. What shipped was a last-moment
28540
+ * discard — `FrameSlot`'s throttle compares wall clocks, and ~4 s of media
28541
+ * arriving inside a few hundred ms of wall clock looks to it like one frame's
28542
+ * worth. Device 617, 2026-09-08: a re-run of the SAME model over the stored
28543
+ * recording scored the subject `vehicle 0.5669` — above the 0.50 floor —
28544
+ * 1.68 s BEFORE the live track was born, on a frame that was in the pre-roll,
28545
+ * was decoded, and was freed.
28546
+ *
28547
+ * Shipping that as opt-in would ship the bug: an operator cannot discover a
28548
+ * setting whose absence looks exactly like a camera that noticed the cyclist
28549
+ * late. What makes ON safe is not a switch but the BOUND —
28550
+ * `preRollInferenceFrames`, a wall-clock ceiling, and a lane that never takes
28551
+ * the last inference permit — so the switch exists for the camera where the
28552
+ * history is worthless (a doorbell whose subject is always already at the
28553
+ * door), not as a hedge against the feature.
28554
+ */
28555
+ preRollInferenceEnabled: external_exports.boolean().default(true),
28556
+ preRollInferenceFrames: external_exports.number().min(preRollInferenceFramesField.min).max(preRollInferenceFramesField.max).default(preRollInferenceFramesField.default),
28365
28557
  occupancyRecheckEnabled: external_exports.boolean().default(true),
28366
28558
  occupancyRecheckSec: external_exports.number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
28367
28559
  occupancyRecheckFrames: external_exports.number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
@@ -28501,6 +28693,29 @@ var RunnerCameraDeviceUIFields = [
28501
28693
  includes: "onboard"
28502
28694
  }
28503
28695
  },
28696
+ {
28697
+ key: "preRollInferenceEnabled",
28698
+ type: "boolean",
28699
+ style: "checkbox",
28700
+ label: "Detect in the pre-roll",
28701
+ description: "Run detection over the few seconds of footage the camera had already buffered when motion fired, so a subject that was in view before the trigger is found at the moment it appeared rather than seconds later. The burst is bounded and never delays live detection.",
28702
+ default: true
28703
+ },
28704
+ {
28705
+ key: "preRollInferenceFrames",
28706
+ type: "slider",
28707
+ label: "Pre-roll frames",
28708
+ description: "How many frames of buffered history may be detected on, per session. Higher samples the history more densely; 0 disables the pass.",
28709
+ min: preRollInferenceFramesField.min,
28710
+ max: preRollInferenceFramesField.max,
28711
+ step: preRollInferenceFramesField.step,
28712
+ default: preRollInferenceFramesField.default,
28713
+ showValue: true,
28714
+ showWhen: {
28715
+ field: "preRollInferenceEnabled",
28716
+ equals: true
28717
+ }
28718
+ },
28504
28719
  {
28505
28720
  key: "occupancyRecheckEnabled",
28506
28721
  type: "boolean",
@@ -43557,6 +43772,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
43557
43772
  addonId: null,
43558
43773
  access: "view"
43559
43774
  },
43775
+ "pipelineAnalytics.listBirthDecisions": {
43776
+ capName: "pipeline-analytics",
43777
+ capScope: "device",
43778
+ addonId: null,
43779
+ access: "view"
43780
+ },
43560
43781
  "pipelineAnalytics.listEventKinds": {
43561
43782
  capName: "pipeline-analytics",
43562
43783
  capScope: "device",
@@ -47349,6 +47570,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
47349
47570
  form: "single",
47350
47571
  optional: true
47351
47572
  }],
47573
+ "pipelineAnalytics.listBirthDecisions": [{
47574
+ name: "deviceId",
47575
+ form: "single",
47576
+ optional: true
47577
+ }],
47352
47578
  "pipelineAnalytics.listEventKinds": [{
47353
47579
  name: "deviceId",
47354
47580
  form: "single",
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runDiscover
4
- } from "./chunk-5NJCDSOQ.js";
4
+ } from "./chunk-FK6R4ZJQ.js";
5
5
  import "./chunk-LMMQX4CK.js";
6
6
 
7
7
  // src/cli.ts
@@ -38,7 +38,7 @@ async function runServe(args) {
38
38
  ...typeof values.data === "string" ? { data: values.data } : {}
39
39
  };
40
40
  Object.assign(process.env, buildServeEnv(opts));
41
- await import("./launcher-BSFU3OHE.js");
41
+ await import("./launcher-O4PI5LJI.js");
42
42
  }
43
43
 
44
44
  // src/commands/agent.ts
@@ -83,7 +83,7 @@ async function runAgent(args) {
83
83
  ...typeof values.port === "string" ? { port: values.port } : {}
84
84
  };
85
85
  Object.assign(process.env, buildAgentEnv(opts));
86
- await import("./launcher-BSFU3OHE.js");
86
+ await import("./launcher-O4PI5LJI.js");
87
87
  }
88
88
 
89
89
  // src/commands/setup.ts
@@ -1130,7 +1130,7 @@ function isUnknown(_value) {
1130
1130
  return true;
1131
1131
  }
1132
1132
  async function resolveServerInteractive(presetNamespace) {
1133
- const { discoverNodes, resolveHubFromDiscovered, filterHubNodes, DEFAULT_HUB_HTTPS_PORT } = await import("./discover-7JKBAMMQ.js");
1133
+ const { discoverNodes, resolveHubFromDiscovered, filterHubNodes, DEFAULT_HUB_HTTPS_PORT } = await import("./discover-Q75B3UUE.js");
1134
1134
  if (presetNamespace) {
1135
1135
  const spinner4 = clack.spinner();
1136
1136
  spinner4.start(`Discovering hub on LAN (namespace "${presetNamespace}")`);
@@ -5,7 +5,7 @@ import {
5
5
  filterHubNodes,
6
6
  resolveHubFromDiscovered,
7
7
  runDiscover
8
- } from "./chunk-5NJCDSOQ.js";
8
+ } from "./chunk-FK6R4ZJQ.js";
9
9
  import "./chunk-LMMQX4CK.js";
10
10
  export {
11
11
  DEFAULT_HUB_HTTPS_PORT,
@@ -23633,9 +23633,9 @@ var require_zod = __commonJS({
23633
23633
  }
23634
23634
  });
23635
23635
 
23636
- // ../system/dist/dist-C5xJy-uL.js
23637
- var require_dist_C5xJy_uL = __commonJS({
23638
- "../system/dist/dist-C5xJy-uL.js"(exports) {
23636
+ // ../system/dist/dist-9GQQ9F3s.js
23637
+ var require_dist_9GQQ9F3s = __commonJS({
23638
+ "../system/dist/dist-9GQQ9F3s.js"(exports) {
23639
23639
  "use strict";
23640
23640
  var zod = require_zod();
23641
23641
  var EventCategory = /* @__PURE__ */ (function(EventCategory2) {
@@ -26065,6 +26065,147 @@ var require_dist_C5xJy_uL = __commonJS({
26065
26065
  for (const tab of tabs) for (const child of fieldsOf(tab)) walkField(child, out);
26066
26066
  }
26067
26067
  }
26068
+ var BirthDecisionVerdictSchema = zod.z.enum([
26069
+ "confirmed",
26070
+ "suppressed",
26071
+ "exhausted-fallback"
26072
+ ]);
26073
+ var BirthDecisionRecordSchema = zod.z.object({
26074
+ id: zod.z.string(),
26075
+ /** Epoch ms the VERDICT was taken (not the birth instant — see `firstSeen`). */
26076
+ at: zod.z.number().int(),
26077
+ /** The camera. Required: every question here is asked per-camera. */
26078
+ deviceId: zod.z.number().int(),
26079
+ /**
26080
+ * The track the decision was about. PROVENANCE, not ownership — a suppressed
26081
+ * birth has no track at all, and a confirmed one is expected to age out long
26082
+ * before this row does. Named `sourceTrackId` so the retention model's
26083
+ * ownership derivation (`collection-classification.ts`, which keys on a
26084
+ * column literally called `trackId`) cannot reach it.
26085
+ */
26086
+ sourceTrackId: zod.z.string(),
26087
+ /** The candidate's claimed class. The miss rate is asked per class too. */
26088
+ className: zod.z.string(),
26089
+ verdict: BirthDecisionVerdictSchema,
26090
+ /**
26091
+ * The gate's own `ConfirmationReason` (`confirmed`, `suppressed`,
26092
+ * `native-pass`, `no-crop`, `timeout`, `carried-inconclusive`, …), or `null`
26093
+ * when the gate is DISABLED and every birth is waved through. `null` is not
26094
+ * "unknown": it says the gate took no measurement because it was off, which
26095
+ * is a different population and must never be averaged in with the rest.
26096
+ */
26097
+ reason: zod.z.string().nullable(),
26098
+ /** Deferral attempts this birth used. 0 = decided on its first look. */
26099
+ attempts: zod.z.number().int(),
26100
+ /** Ms from the FIRST undecided attempt to this verdict. 0 = never deferred. */
26101
+ deferredForMs: zod.z.number().int(),
26102
+ /**
26103
+ * THE COLUMN THE RE-OFFER DEFECT IS COUNTED IN.
26104
+ *
26105
+ * `true` when the frame the verdict was taken on carried no matched
26106
+ * detection for this track — the tracker was coasting a frozen box and the
26107
+ * subject was not observed. The deferred-birth re-offer pulls the candidate
26108
+ * straight out of `result.tracked` without checking, so this is reachable
26109
+ * today; the question is the RATE, per camera, and whether refusing those
26110
+ * frames would have cost real tracks (cross-read against `verdict` and
26111
+ * `decidedByBirthEvidence`).
26112
+ */
26113
+ decidedOnCoastedFrame: zod.z.boolean(),
26114
+ /** Were D379 birth-instant pixels in hand when this candidate was submitted? */
26115
+ birthEvidenceAvailable: zod.z.boolean(),
26116
+ /**
26117
+ * Did those pixels DECIDE it (`cropSource === 'carried'`)? Available and
26118
+ * deciding are different: the carried crop is confirm-only, so a candidate
26119
+ * can hold evidence, be found inconclusive on it, and be decided by a native
26120
+ * crop of a later instant. A coasted decision backed by carried evidence is
26121
+ * a real observation of the birth instant; one without it is not.
26122
+ */
26123
+ decidedByBirthEvidence: zod.z.boolean(),
26124
+ /** Best class-compatible crop score, or `null` when nothing compatible was
26125
+ * found — deliberately not 0, which would be a measurement that never was. */
26126
+ bestScore: zod.z.number().nullable(),
26127
+ /** The bar this candidate actually faced (the phantom-cell hook may raise it). */
26128
+ appliedMinConfidence: zod.z.number().nullable(),
26129
+ /**
26130
+ * The track's own `firstSeen` — the candidate's first frame, which is where
26131
+ * the timeline starts. `null` for a suppressed birth, which has no track.
26132
+ */
26133
+ firstSeen: zod.z.number().int().nullable(),
26134
+ /**
26135
+ * The device's most recent motion RISING EDGE at the moment of the decision,
26136
+ * or `null` when there is none, it is older than
26137
+ * {@link MAX_BIRTH_LATENCY_PROXY_MS}, or this runner never saw one.
26138
+ */
26139
+ motionOnsetAt: zod.z.number().int().nullable(),
26140
+ /**
26141
+ * `firstSeen − motionOnsetAt` — THE OPERATOR'S COMPLAINT, IN MILLISECONDS,
26142
+ * AND THE WEAKEST NUMBER IN THIS ROW. Read the error bars before quoting it.
26143
+ *
26144
+ * **Why motion onset and not something else.** Two other proxies were
26145
+ * considered and rejected:
26146
+ * - *the recording/pipeline session start*: for a camera on
26147
+ * `detectionMode: 'always'` the session opens at process start, hours
26148
+ * before any subject. It measures nothing.
26149
+ * - *the first detection on the device in this burst*: CIRCULAR. A track's
26150
+ * `firstSeen` IS the first detection of that object, so for the track that
26151
+ * OPENS a burst — the only one the operator is complaining about — the two
26152
+ * are the same instant and the latency is 0 by construction.
26153
+ * Motion onset is the only in-process signal produced by a DIFFERENT
26154
+ * mechanism from the object detector, so it is the only one that can precede
26155
+ * it. It is also already maintained per-device at frame rate on this very
26156
+ * node (`handleMotionAnalysis` / `handleOnboardMotion`), which is what makes
26157
+ * it free — and, decisively, the frame path and the motion path are gated to
26158
+ * the SAME designated post-processing node, so the mirror is never empty for
26159
+ * a camera whose births land here.
26160
+ *
26161
+ * **Error bars, all of them.**
26162
+ * 1. *Motion has no class.* A burst opened by rain, a headlight sweeping a
26163
+ * wall or a branch, and only later joined by the person, OVERSTATES the
26164
+ * latency without bound. Mitigated, never removed, by
26165
+ * {@link BirthDecisionRecord.birthIndexInBurst}: only index 0 is a
26166
+ * candidate for "this burst is this subject", and even then it is a
26167
+ * candidate, not a fact.
26168
+ * 2. *The sign is not guaranteed.* The analyzer needs a pixel-count and
26169
+ * intensity threshold. A subject entering slowly at the far edge of the
26170
+ * frame can clear the detector's confidence floor BEFORE it clears the
26171
+ * motion floor, making this negative. Negatives are stored as-is and
26172
+ * never clamped — clamping would fabricate the distribution's left tail,
26173
+ * which is the half that says the proxy is unreliable.
26174
+ * 3. *Onboard motion carries firmware latency of unknown, per-model offset*
26175
+ * (hundreds of ms), plus camera-vs-hub clock skew on top. Numbers are
26176
+ * therefore comparable WITHIN a camera and not across cameras of
26177
+ * different motion sources. The motion source is deliberately not copied
26178
+ * here — it belongs to the addon that owns the device (D224) and this is
26179
+ * a write on the frame path — so group by `deviceId`, which is how the
26180
+ * question is always asked anyway.
26181
+ * 4. *Continuous motion.* On a busy scene the burst never closes and the
26182
+ * onset is minutes old. Bounded by {@link MAX_BIRTH_LATENCY_PROXY_MS};
26183
+ * past it this is `null`.
26184
+ * 5. *No motion signal at all* — analyzer off, onboard-only camera not
26185
+ * reporting, or nothing since boot: `null`. Which is the truth about a
26186
+ * camera nobody has a reference instant for.
26187
+ *
26188
+ * So this is a per-camera DISTRIBUTION over index-0 births, and it is honest
26189
+ * as such. It is not a per-track fact and must never be shown as one.
26190
+ */
26191
+ birthLatencyMs: zod.z.number().int().nullable(),
26192
+ /**
26193
+ * How many births this device has already decided since that motion onset.
26194
+ * 0 = the first, i.e. the only index at which the burst plausibly belongs to
26195
+ * this subject. `null` when there is no usable onset.
26196
+ */
26197
+ birthIndexInBurst: zod.z.number().int().nullable()
26198
+ });
26199
+ var BirthDecisionQueryInputSchema = zod.z.object({
26200
+ /** Restrict to a single camera; omit for every row. */
26201
+ deviceId: zod.z.number().int().optional(),
26202
+ /** Only decisions at or after this epoch ms. */
26203
+ since: zod.z.number().int().optional(),
26204
+ /** Restrict to one verdict — the miss rate is read one population at a time. */
26205
+ verdict: BirthDecisionVerdictSchema.optional(),
26206
+ /** Max rows returned, newest-first. */
26207
+ limit: zod.z.number().int().min(1).max(5e3).optional()
26208
+ });
26068
26209
  var ArchivedDebugNoteSchema = zod.z.object({
26069
26210
  /** Archive row id. Derived from `(sourceTrackId, note)`, so re-archiving the
26070
26211
  * same sentence about the same track lands on the row already there. */
@@ -38251,6 +38392,26 @@ var require_dist_C5xJy_uL = __commonJS({
38251
38392
  */
38252
38393
  listArchivedDebugNotes: method(ArchivedDebugNoteQueryInputSchema, zod.z.array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }),
38253
38394
  /**
38395
+ * Birth decisions — one row per resolved confirmation-gate verdict (D409).
38396
+ *
38397
+ * The READ half of a measurement, and only that: it gates nothing and no
38398
+ * runtime path consults it. It exists because the two questions the
38399
+ * operator's "traccia partita in ritardo" marks raised are both multi-day
38400
+ * and `logs.query` holds under an hour of fleet traffic —
38401
+ * • how often is a birth DECIDED on a frame the subject was not observed
38402
+ * in (`decidedOnCoastedFrame`), and did D379's carried pixels make it a
38403
+ * real observation anyway (`decidedByBirthEvidence`);
38404
+ * • how long after the camera's motion onset does a track's `firstSeen`
38405
+ * land (`birthLatencyMs` — read its error bars in
38406
+ * `BirthDecisionRecordSchema` before quoting it).
38407
+ *
38408
+ * Newest-first, capped by `limit` (default
38409
+ * {@link BIRTH_DECISION_DEFAULT_LIMIT}), optionally scoped to one camera,
38410
+ * one verdict, or a `since`. The table is bounded by row count, not age —
38411
+ * see {@link MAX_BIRTH_DECISION_RECORDS}.
38412
+ */
38413
+ listBirthDecisions: method(BirthDecisionQueryInputSchema, zod.z.array(BirthDecisionRecordSchema).readonly(), { kind: "query" }),
38414
+ /**
38254
38415
  * Durable event-store footprint for the management UI: event rows
38255
38416
  * (motion + object + audio) counted per camera + total, plus the
38256
38417
  * event-owned media bytes on disk per camera + total. Stat/count-based,
@@ -38970,6 +39131,12 @@ var require_dist_C5xJy_uL = __commonJS({
38970
39131
  default: 4,
38971
39132
  step: 1
38972
39133
  };
39134
+ var preRollInferenceFramesField = {
39135
+ min: 0,
39136
+ max: 30,
39137
+ default: 12,
39138
+ step: 1
39139
+ };
38973
39140
  var MotionSourceEnum = zod.z.enum([
38974
39141
  "onboard",
38975
39142
  "analyzer",
@@ -39131,6 +39298,31 @@ var require_dist_C5xJy_uL = __commonJS({
39131
39298
  * to every occupancy rule until something moved in front of it. The churn is
39132
39299
  * now paid on the interval instead — see `occupancyRecheckSecField`.
39133
39300
  */
39301
+ /**
39302
+ * Infer the session's PRE-ROLL — the retained history the restreamer replays
39303
+ * at session open — instead of decoding it and throwing it away.
39304
+ *
39305
+ * DEFAULT `true`, and the default is the argument. This is not a new
39306
+ * capability being offered cautiously: the pre-roll is ALREADY requested,
39307
+ * already served, already decoded and already paid for on every on-motion
39308
+ * detection session that asks for history. What shipped was a last-moment
39309
+ * discard — `FrameSlot`'s throttle compares wall clocks, and ~4 s of media
39310
+ * arriving inside a few hundred ms of wall clock looks to it like one frame's
39311
+ * worth. Device 617, 2026-09-08: a re-run of the SAME model over the stored
39312
+ * recording scored the subject `vehicle 0.5669` — above the 0.50 floor —
39313
+ * 1.68 s BEFORE the live track was born, on a frame that was in the pre-roll,
39314
+ * was decoded, and was freed.
39315
+ *
39316
+ * Shipping that as opt-in would ship the bug: an operator cannot discover a
39317
+ * setting whose absence looks exactly like a camera that noticed the cyclist
39318
+ * late. What makes ON safe is not a switch but the BOUND —
39319
+ * `preRollInferenceFrames`, a wall-clock ceiling, and a lane that never takes
39320
+ * the last inference permit — so the switch exists for the camera where the
39321
+ * history is worthless (a doorbell whose subject is always already at the
39322
+ * door), not as a hedge against the feature.
39323
+ */
39324
+ preRollInferenceEnabled: zod.z.boolean().default(true),
39325
+ preRollInferenceFrames: zod.z.number().min(preRollInferenceFramesField.min).max(preRollInferenceFramesField.max).default(preRollInferenceFramesField.default),
39134
39326
  occupancyRecheckEnabled: zod.z.boolean().default(true),
39135
39327
  occupancyRecheckSec: zod.z.number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
39136
39328
  occupancyRecheckFrames: zod.z.number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
@@ -39159,7 +39351,7 @@ var require_dist_C5xJy_uL = __commonJS({
39159
39351
  */
39160
39352
  inferenceDevices: zod.z.array(RunnerInferenceDeviceSchema).readonly().optional()
39161
39353
  });
39162
- motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, audioMotionWindowMsField.min, audioMotionWindowMsField.max, audioMotionWindowMsField.step, audioMotionWindowMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
39354
+ motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, maxSessionHoldMsField.min, maxSessionHoldMsField.max, maxSessionHoldMsField.step, maxSessionHoldMsField.default, audioMotionWindowMsField.min, audioMotionWindowMsField.max, audioMotionWindowMsField.step, audioMotionWindowMsField.default, preRollInferenceFramesField.min, preRollInferenceFramesField.max, preRollInferenceFramesField.step, preRollInferenceFramesField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
39163
39355
  var RunnerLocalLoadSchema = zod.z.object({
39164
39356
  /** Moleculer node id of this runner instance. */
39165
39357
  nodeId: zod.z.string(),
@@ -55001,6 +55193,12 @@ var require_dist_C5xJy_uL = __commonJS({
55001
55193
  addonId: null,
55002
55194
  access: "view"
55003
55195
  },
55196
+ "pipelineAnalytics.listBirthDecisions": {
55197
+ capName: "pipeline-analytics",
55198
+ capScope: "device",
55199
+ addonId: null,
55200
+ access: "view"
55201
+ },
55004
55202
  "pipelineAnalytics.listEventKinds": {
55005
55203
  capName: "pipeline-analytics",
55006
55204
  capScope: "device",
@@ -58793,6 +58991,11 @@ var require_dist_C5xJy_uL = __commonJS({
58793
58991
  form: "single",
58794
58992
  optional: true
58795
58993
  }],
58994
+ "pipelineAnalytics.listBirthDecisions": [{
58995
+ name: "deviceId",
58996
+ form: "single",
58997
+ optional: true
58998
+ }],
58796
58999
  "pipelineAnalytics.listEventKinds": [{
58797
59000
  name: "deviceId",
58798
59001
  form: "single",
@@ -61105,7 +61308,7 @@ var require_alerts_addon = __commonJS({
61105
61308
  [Symbol.toStringTag]: { value: "Module" }
61106
61309
  });
61107
61310
  require_chunk_Cek0wNdY();
61108
- var require_dist10 = require_dist_C5xJy_uL();
61311
+ var require_dist10 = require_dist_9GQQ9F3s();
61109
61312
  function selectExpired(alerts, cutoffMs) {
61110
61313
  return alerts.filter((a) => a.createdAt < cutoffMs).sort((a, b) => a.createdAt - b.createdAt).map((a) => a.id);
61111
61314
  }
@@ -61924,7 +62127,7 @@ var require_console_logging = __commonJS({
61924
62127
  [Symbol.toStringTag]: { value: "Module" }
61925
62128
  });
61926
62129
  require_chunk_Cek0wNdY();
61927
- var require_dist10 = require_dist_C5xJy_uL();
62130
+ var require_dist10 = require_dist_9GQQ9F3s();
61928
62131
  var require_formatter = require_formatter_DqAKDlvN();
61929
62132
  var LEVEL_RANK = {
61930
62133
  debug: 0,
@@ -62018,7 +62221,7 @@ var require_core_blocks_addon = __commonJS({
62018
62221
  "use strict";
62019
62222
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
62020
62223
  var require_chunk = require_chunk_Cek0wNdY();
62021
- var require_dist10 = require_dist_C5xJy_uL();
62224
+ var require_dist10 = require_dist_9GQQ9F3s();
62022
62225
  var node_crypto = __require("crypto");
62023
62226
  var node_fs_promises = __require("fs/promises");
62024
62227
  node_fs_promises = require_chunk.__toESM(node_fs_promises);
@@ -62915,11 +63118,11 @@ var require_core_blocks = __commonJS({
62915
63118
  }
62916
63119
  });
62917
63120
 
62918
- // ../system/dist/retired-settings-keys-CONISA8J.js
62919
- var require_retired_settings_keys_CONISA8J = __commonJS({
62920
- "../system/dist/retired-settings-keys-CONISA8J.js"(exports) {
63121
+ // ../system/dist/retired-settings-keys-DfdSH46H.js
63122
+ var require_retired_settings_keys_DfdSH46H = __commonJS({
63123
+ "../system/dist/retired-settings-keys-DfdSH46H.js"(exports) {
62921
63124
  "use strict";
62922
- var require_dist10 = require_dist_C5xJy_uL();
63125
+ var require_dist10 = require_dist_9GQQ9F3s();
62923
63126
  function settingsStoreIsAuthoritativeHere(env) {
62924
63127
  const raw = (env["CAMSTACK_ROLE"] ?? "").trim().toLowerCase();
62925
63128
  return raw === "" || raw === "hub";
@@ -65154,8 +65357,8 @@ var require_device_manager_addon = __commonJS({
65154
65357
  [Symbol.toStringTag]: { value: "Module" }
65155
65358
  });
65156
65359
  require_chunk_Cek0wNdY();
65157
- var require_dist10 = require_dist_C5xJy_uL();
65158
- var require_retired_settings_keys = require_retired_settings_keys_CONISA8J();
65360
+ var require_dist10 = require_dist_9GQQ9F3s();
65361
+ var require_retired_settings_keys = require_retired_settings_keys_DfdSH46H();
65159
65362
  var node_crypto = __require("crypto");
65160
65363
  var _camstack_types_node = require_node();
65161
65364
  var JOB_HISTORY = 20;
@@ -70780,7 +70983,7 @@ var require_hub_forwarder = __commonJS({
70780
70983
  [Symbol.toStringTag]: { value: "Module" }
70781
70984
  });
70782
70985
  require_chunk_Cek0wNdY();
70783
- var require_dist10 = require_dist_C5xJy_uL();
70986
+ var require_dist10 = require_dist_9GQQ9F3s();
70784
70987
  var require_formatter = require_formatter_DqAKDlvN();
70785
70988
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
70786
70989
  var HubForwarderDestination = class {
@@ -70917,7 +71120,7 @@ var require_liveness_monitor_addon = __commonJS({
70917
71120
  "use strict";
70918
71121
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
70919
71122
  require_chunk_Cek0wNdY();
70920
- var require_dist10 = require_dist_C5xJy_uL();
71123
+ var require_dist10 = require_dist_9GQQ9F3s();
70921
71124
  var NO_DEVICES = "liveness:no-devices";
70922
71125
  var ALL_OFFLINE = "liveness:all-devices-offline";
70923
71126
  var NO_FOOTAGE_PREFIX = "liveness:no-footage:";
@@ -71113,7 +71316,7 @@ var require_local_auth_addon = __commonJS({
71113
71316
  [Symbol.toStringTag]: { value: "Module" }
71114
71317
  });
71115
71318
  var require_chunk = require_chunk_Cek0wNdY();
71116
- var require_dist10 = require_dist_C5xJy_uL();
71319
+ var require_dist10 = require_dist_9GQQ9F3s();
71117
71320
  var node_crypto = __require("crypto");
71118
71321
  node_crypto = require_chunk.__toESM(node_crypto);
71119
71322
  var crypto$1 = __require("crypto");
@@ -78926,7 +79129,7 @@ var require_loki_logging = __commonJS({
78926
79129
  [Symbol.toStringTag]: { value: "Module" }
78927
79130
  });
78928
79131
  require_chunk_Cek0wNdY();
78929
- var require_dist10 = require_dist_C5xJy_uL();
79132
+ var require_dist10 = require_dist_9GQQ9F3s();
78930
79133
  function sanitizeLabelName(raw) {
78931
79134
  const replaced = raw.replaceAll(/[^a-zA-Z0-9_]/g, "_");
78932
79135
  return /^[a-zA-Z_]/.test(replaced) ? replaced : `_${replaced}`;
@@ -79491,7 +79694,7 @@ var require_native_metrics_addon = __commonJS({
79491
79694
  [Symbol.toStringTag]: { value: "Module" }
79492
79695
  });
79493
79696
  var require_chunk = require_chunk_Cek0wNdY();
79494
- var require_dist10 = require_dist_C5xJy_uL();
79697
+ var require_dist10 = require_dist_9GQQ9F3s();
79495
79698
  var node_fs_promises = __require("fs/promises");
79496
79699
  var node_child_process = __require("child_process");
79497
79700
  var node_util = __require("util");
@@ -82075,7 +82278,7 @@ var require_filesystem_storage_addon = __commonJS({
82075
82278
  [Symbol.toStringTag]: { value: "Module" }
82076
82279
  });
82077
82280
  var require_chunk = require_chunk_Cek0wNdY();
82078
- var require_dist10 = require_dist_C5xJy_uL();
82281
+ var require_dist10 = require_dist_9GQQ9F3s();
82079
82282
  var node_crypto = __require("crypto");
82080
82283
  var node_fs_promises = __require("fs/promises");
82081
82284
  var node_path = __require("path");
@@ -83191,8 +83394,8 @@ var require_sqlite_settings_addon = __commonJS({
83191
83394
  [Symbol.toStringTag]: { value: "Module" }
83192
83395
  });
83193
83396
  var require_chunk = require_chunk_Cek0wNdY();
83194
- var require_dist10 = require_dist_C5xJy_uL();
83195
- var require_retired_settings_keys = require_retired_settings_keys_CONISA8J();
83397
+ var require_dist10 = require_dist_9GQQ9F3s();
83398
+ var require_retired_settings_keys = require_retired_settings_keys_DfdSH46H();
83196
83399
  var node_crypto = __require("crypto");
83197
83400
  var node_fs = __require("fs");
83198
83401
  var node_module = __require("module");
@@ -85696,7 +85899,7 @@ var require_storage_orchestrator_addon = __commonJS({
85696
85899
  [Symbol.toStringTag]: { value: "Module" }
85697
85900
  });
85698
85901
  var require_chunk = require_chunk_Cek0wNdY();
85699
- var require_dist10 = require_dist_C5xJy_uL();
85902
+ var require_dist10 = require_dist_9GQQ9F3s();
85700
85903
  var require_hub_cap_forward = require_hub_cap_forward_DmHNjbB0();
85701
85904
  var zod = require_zod();
85702
85905
  var node_crypto = __require("crypto");
@@ -89346,7 +89549,7 @@ var require_system_config_addon = __commonJS({
89346
89549
  [Symbol.toStringTag]: { value: "Module" }
89347
89550
  });
89348
89551
  require_chunk_Cek0wNdY();
89349
- var require_dist10 = require_dist_C5xJy_uL();
89552
+ var require_dist10 = require_dist_9GQQ9F3s();
89350
89553
  var SECTION_TITLES = {
89351
89554
  server: "Server",
89352
89555
  auth: "Authentication"
@@ -107407,7 +107610,7 @@ var require_winston_logging = __commonJS({
107407
107610
  [Symbol.toStringTag]: { value: "Module" }
107408
107611
  });
107409
107612
  var require_chunk = require_chunk_Cek0wNdY();
107410
- var require_dist10 = require_dist_C5xJy_uL();
107613
+ var require_dist10 = require_dist_9GQQ9F3s();
107411
107614
  var require_formatter = require_formatter_DqAKDlvN();
107412
107615
  var node_path = __require("path");
107413
107616
  node_path = require_chunk.__toESM(node_path);
@@ -109352,9 +109555,9 @@ var require_event_category_BVo6ta6 = __commonJS({
109352
109555
  }
109353
109556
  });
109354
109557
 
109355
- // ../types/dist/sleep-IjLtwkO5.js
109356
- var require_sleep_IjLtwkO5 = __commonJS({
109357
- "../types/dist/sleep-IjLtwkO5.js"(exports) {
109558
+ // ../types/dist/sleep-Bo9cUOXp.js
109559
+ var require_sleep_Bo9cUOXp = __commonJS({
109560
+ "../types/dist/sleep-Bo9cUOXp.js"(exports) {
109358
109561
  "use strict";
109359
109562
  var require_event_category = require_event_category_BVo6ta6();
109360
109563
  var zod = require_zod();
@@ -112087,6 +112290,7 @@ var require_sleep_IjLtwkO5 = __commonJS({
112087
112290
  deleteTracks: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "deleteTracks", "mutation", input),
112088
112291
  setTrackFlags: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "setTrackFlags", "mutation", input),
112089
112292
  listArchivedDebugNotes: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "listArchivedDebugNotes", "query", input),
112293
+ listBirthDecisions: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "listBirthDecisions", "query", input),
112090
112294
  getEventStoreFootprint: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getEventStoreFootprint", "query", input),
112091
112295
  getEventMediaFootprintByKind: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getEventMediaFootprintByKind", "query", input),
112092
112296
  pruneEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "pruneEvents", "mutation", input),
@@ -113087,7 +113291,7 @@ var require_addon = __commonJS({
113087
113291
  "use strict";
113088
113292
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
113089
113293
  var require_event_category = require_event_category_BVo6ta6();
113090
- var require_sleep = require_sleep_IjLtwkO5();
113294
+ var require_sleep = require_sleep_Bo9cUOXp();
113091
113295
  var require_err_msg = require_err_msg_COpsHMw2();
113092
113296
  var CAP_INPUT_DEFAULTS = Object.freeze({
113093
113297
  "addons": { "getLogs": { "limit": 100 } },
@@ -113220,6 +113424,8 @@ var require_addon = __commonJS({
113220
113424
  "pipelineEnabled": true,
113221
113425
  "zones": [],
113222
113426
  "onboardMotionDrivesAnalyzer": true,
113427
+ "preRollInferenceEnabled": true,
113428
+ "preRollInferenceFrames": 12,
113223
113429
  "occupancyRecheckEnabled": true,
113224
113430
  "occupancyRecheckSec": 300,
113225
113431
  "occupancyRecheckFrames": 4,
@@ -132018,7 +132224,7 @@ var require_dist3 = __commonJS({
132018
132224
  "use strict";
132019
132225
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
132020
132226
  var require_chunk = require_chunk_Cek0wNdY();
132021
- var require_dist10 = require_dist_C5xJy_uL();
132227
+ var require_dist10 = require_dist_9GQQ9F3s();
132022
132228
  var require_builtins_alerts_alerts_addon = require_alerts_addon();
132023
132229
  require_alerts();
132024
132230
  var require_formatter = require_formatter_DqAKDlvN();
@@ -213135,7 +213341,7 @@ var require_dist4 = __commonJS({
213135
213341
  "use strict";
213136
213342
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
213137
213343
  var require_event_category = require_event_category_BVo6ta6();
213138
- var require_sleep = require_sleep_IjLtwkO5();
213344
+ var require_sleep = require_sleep_Bo9cUOXp();
213139
213345
  var require_canonical_hash = require_canonical_hash_DNV8S5ET();
213140
213346
  var require_enums2 = require_enums();
213141
213347
  var require_err_msg = require_err_msg_COpsHMw2();
@@ -213888,6 +214094,150 @@ var require_dist4 = __commonJS({
213888
214094
  for (const tab of tabs) for (const child of fieldsOf(tab)) walkField(child, out);
213889
214095
  }
213890
214096
  }
214097
+ var MAX_BIRTH_DECISION_RECORDS = 3e4;
214098
+ var BIRTH_DECISION_DEFAULT_LIMIT = 500;
214099
+ var MAX_BIRTH_LATENCY_PROXY_MS = 6e4;
214100
+ var BirthDecisionVerdictSchema = zod.z.enum([
214101
+ "confirmed",
214102
+ "suppressed",
214103
+ "exhausted-fallback"
214104
+ ]);
214105
+ var BirthDecisionRecordSchema = zod.z.object({
214106
+ id: zod.z.string(),
214107
+ /** Epoch ms the VERDICT was taken (not the birth instant — see `firstSeen`). */
214108
+ at: zod.z.number().int(),
214109
+ /** The camera. Required: every question here is asked per-camera. */
214110
+ deviceId: zod.z.number().int(),
214111
+ /**
214112
+ * The track the decision was about. PROVENANCE, not ownership — a suppressed
214113
+ * birth has no track at all, and a confirmed one is expected to age out long
214114
+ * before this row does. Named `sourceTrackId` so the retention model's
214115
+ * ownership derivation (`collection-classification.ts`, which keys on a
214116
+ * column literally called `trackId`) cannot reach it.
214117
+ */
214118
+ sourceTrackId: zod.z.string(),
214119
+ /** The candidate's claimed class. The miss rate is asked per class too. */
214120
+ className: zod.z.string(),
214121
+ verdict: BirthDecisionVerdictSchema,
214122
+ /**
214123
+ * The gate's own `ConfirmationReason` (`confirmed`, `suppressed`,
214124
+ * `native-pass`, `no-crop`, `timeout`, `carried-inconclusive`, …), or `null`
214125
+ * when the gate is DISABLED and every birth is waved through. `null` is not
214126
+ * "unknown": it says the gate took no measurement because it was off, which
214127
+ * is a different population and must never be averaged in with the rest.
214128
+ */
214129
+ reason: zod.z.string().nullable(),
214130
+ /** Deferral attempts this birth used. 0 = decided on its first look. */
214131
+ attempts: zod.z.number().int(),
214132
+ /** Ms from the FIRST undecided attempt to this verdict. 0 = never deferred. */
214133
+ deferredForMs: zod.z.number().int(),
214134
+ /**
214135
+ * THE COLUMN THE RE-OFFER DEFECT IS COUNTED IN.
214136
+ *
214137
+ * `true` when the frame the verdict was taken on carried no matched
214138
+ * detection for this track — the tracker was coasting a frozen box and the
214139
+ * subject was not observed. The deferred-birth re-offer pulls the candidate
214140
+ * straight out of `result.tracked` without checking, so this is reachable
214141
+ * today; the question is the RATE, per camera, and whether refusing those
214142
+ * frames would have cost real tracks (cross-read against `verdict` and
214143
+ * `decidedByBirthEvidence`).
214144
+ */
214145
+ decidedOnCoastedFrame: zod.z.boolean(),
214146
+ /** Were D379 birth-instant pixels in hand when this candidate was submitted? */
214147
+ birthEvidenceAvailable: zod.z.boolean(),
214148
+ /**
214149
+ * Did those pixels DECIDE it (`cropSource === 'carried'`)? Available and
214150
+ * deciding are different: the carried crop is confirm-only, so a candidate
214151
+ * can hold evidence, be found inconclusive on it, and be decided by a native
214152
+ * crop of a later instant. A coasted decision backed by carried evidence is
214153
+ * a real observation of the birth instant; one without it is not.
214154
+ */
214155
+ decidedByBirthEvidence: zod.z.boolean(),
214156
+ /** Best class-compatible crop score, or `null` when nothing compatible was
214157
+ * found — deliberately not 0, which would be a measurement that never was. */
214158
+ bestScore: zod.z.number().nullable(),
214159
+ /** The bar this candidate actually faced (the phantom-cell hook may raise it). */
214160
+ appliedMinConfidence: zod.z.number().nullable(),
214161
+ /**
214162
+ * The track's own `firstSeen` — the candidate's first frame, which is where
214163
+ * the timeline starts. `null` for a suppressed birth, which has no track.
214164
+ */
214165
+ firstSeen: zod.z.number().int().nullable(),
214166
+ /**
214167
+ * The device's most recent motion RISING EDGE at the moment of the decision,
214168
+ * or `null` when there is none, it is older than
214169
+ * {@link MAX_BIRTH_LATENCY_PROXY_MS}, or this runner never saw one.
214170
+ */
214171
+ motionOnsetAt: zod.z.number().int().nullable(),
214172
+ /**
214173
+ * `firstSeen − motionOnsetAt` — THE OPERATOR'S COMPLAINT, IN MILLISECONDS,
214174
+ * AND THE WEAKEST NUMBER IN THIS ROW. Read the error bars before quoting it.
214175
+ *
214176
+ * **Why motion onset and not something else.** Two other proxies were
214177
+ * considered and rejected:
214178
+ * - *the recording/pipeline session start*: for a camera on
214179
+ * `detectionMode: 'always'` the session opens at process start, hours
214180
+ * before any subject. It measures nothing.
214181
+ * - *the first detection on the device in this burst*: CIRCULAR. A track's
214182
+ * `firstSeen` IS the first detection of that object, so for the track that
214183
+ * OPENS a burst — the only one the operator is complaining about — the two
214184
+ * are the same instant and the latency is 0 by construction.
214185
+ * Motion onset is the only in-process signal produced by a DIFFERENT
214186
+ * mechanism from the object detector, so it is the only one that can precede
214187
+ * it. It is also already maintained per-device at frame rate on this very
214188
+ * node (`handleMotionAnalysis` / `handleOnboardMotion`), which is what makes
214189
+ * it free — and, decisively, the frame path and the motion path are gated to
214190
+ * the SAME designated post-processing node, so the mirror is never empty for
214191
+ * a camera whose births land here.
214192
+ *
214193
+ * **Error bars, all of them.**
214194
+ * 1. *Motion has no class.* A burst opened by rain, a headlight sweeping a
214195
+ * wall or a branch, and only later joined by the person, OVERSTATES the
214196
+ * latency without bound. Mitigated, never removed, by
214197
+ * {@link BirthDecisionRecord.birthIndexInBurst}: only index 0 is a
214198
+ * candidate for "this burst is this subject", and even then it is a
214199
+ * candidate, not a fact.
214200
+ * 2. *The sign is not guaranteed.* The analyzer needs a pixel-count and
214201
+ * intensity threshold. A subject entering slowly at the far edge of the
214202
+ * frame can clear the detector's confidence floor BEFORE it clears the
214203
+ * motion floor, making this negative. Negatives are stored as-is and
214204
+ * never clamped — clamping would fabricate the distribution's left tail,
214205
+ * which is the half that says the proxy is unreliable.
214206
+ * 3. *Onboard motion carries firmware latency of unknown, per-model offset*
214207
+ * (hundreds of ms), plus camera-vs-hub clock skew on top. Numbers are
214208
+ * therefore comparable WITHIN a camera and not across cameras of
214209
+ * different motion sources. The motion source is deliberately not copied
214210
+ * here — it belongs to the addon that owns the device (D224) and this is
214211
+ * a write on the frame path — so group by `deviceId`, which is how the
214212
+ * question is always asked anyway.
214213
+ * 4. *Continuous motion.* On a busy scene the burst never closes and the
214214
+ * onset is minutes old. Bounded by {@link MAX_BIRTH_LATENCY_PROXY_MS};
214215
+ * past it this is `null`.
214216
+ * 5. *No motion signal at all* — analyzer off, onboard-only camera not
214217
+ * reporting, or nothing since boot: `null`. Which is the truth about a
214218
+ * camera nobody has a reference instant for.
214219
+ *
214220
+ * So this is a per-camera DISTRIBUTION over index-0 births, and it is honest
214221
+ * as such. It is not a per-track fact and must never be shown as one.
214222
+ */
214223
+ birthLatencyMs: zod.z.number().int().nullable(),
214224
+ /**
214225
+ * How many births this device has already decided since that motion onset.
214226
+ * 0 = the first, i.e. the only index at which the burst plausibly belongs to
214227
+ * this subject. `null` when there is no usable onset.
214228
+ */
214229
+ birthIndexInBurst: zod.z.number().int().nullable()
214230
+ });
214231
+ var BirthDecisionQueryInputSchema = zod.z.object({
214232
+ /** Restrict to a single camera; omit for every row. */
214233
+ deviceId: zod.z.number().int().optional(),
214234
+ /** Only decisions at or after this epoch ms. */
214235
+ since: zod.z.number().int().optional(),
214236
+ /** Restrict to one verdict — the miss rate is read one population at a time. */
214237
+ verdict: BirthDecisionVerdictSchema.optional(),
214238
+ /** Max rows returned, newest-first. */
214239
+ limit: zod.z.number().int().min(1).max(5e3).optional()
214240
+ });
213891
214241
  var MAX_ARCHIVED_DEBUG_NOTES = 5e3;
213892
214242
  var ARCHIVED_DEBUG_NOTES_DEFAULT_LIMIT = 200;
213893
214243
  var ArchivedDebugNoteSchema = zod.z.object({
@@ -228496,6 +228846,26 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
228496
228846
  */
228497
228847
  listArchivedDebugNotes: require_sleep.method(ArchivedDebugNoteQueryInputSchema, zod.z.array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }),
228498
228848
  /**
228849
+ * Birth decisions — one row per resolved confirmation-gate verdict (D409).
228850
+ *
228851
+ * The READ half of a measurement, and only that: it gates nothing and no
228852
+ * runtime path consults it. It exists because the two questions the
228853
+ * operator's "traccia partita in ritardo" marks raised are both multi-day
228854
+ * and `logs.query` holds under an hour of fleet traffic —
228855
+ * • how often is a birth DECIDED on a frame the subject was not observed
228856
+ * in (`decidedOnCoastedFrame`), and did D379's carried pixels make it a
228857
+ * real observation anyway (`decidedByBirthEvidence`);
228858
+ * • how long after the camera's motion onset does a track's `firstSeen`
228859
+ * land (`birthLatencyMs` — read its error bars in
228860
+ * `BirthDecisionRecordSchema` before quoting it).
228861
+ *
228862
+ * Newest-first, capped by `limit` (default
228863
+ * {@link BIRTH_DECISION_DEFAULT_LIMIT}), optionally scoped to one camera,
228864
+ * one verdict, or a `since`. The table is bounded by row count, not age —
228865
+ * see {@link MAX_BIRTH_DECISION_RECORDS}.
228866
+ */
228867
+ listBirthDecisions: require_sleep.method(BirthDecisionQueryInputSchema, zod.z.array(BirthDecisionRecordSchema).readonly(), { kind: "query" }),
228868
+ /**
228499
228869
  * Durable event-store footprint for the management UI: event rows
228500
228870
  * (motion + object + audio) counted per camera + total, plus the
228501
228871
  * event-owned media bytes on disk per camera + total. Stat/count-based,
@@ -229215,6 +229585,12 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
229215
229585
  default: 4,
229216
229586
  step: 1
229217
229587
  };
229588
+ var preRollInferenceFramesField = {
229589
+ min: 0,
229590
+ max: 30,
229591
+ default: 12,
229592
+ step: 1
229593
+ };
229218
229594
  var MotionSourceEnum = zod.z.enum([
229219
229595
  "onboard",
229220
229596
  "analyzer",
@@ -229376,6 +229752,31 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
229376
229752
  * to every occupancy rule until something moved in front of it. The churn is
229377
229753
  * now paid on the interval instead — see `occupancyRecheckSecField`.
229378
229754
  */
229755
+ /**
229756
+ * Infer the session's PRE-ROLL — the retained history the restreamer replays
229757
+ * at session open — instead of decoding it and throwing it away.
229758
+ *
229759
+ * DEFAULT `true`, and the default is the argument. This is not a new
229760
+ * capability being offered cautiously: the pre-roll is ALREADY requested,
229761
+ * already served, already decoded and already paid for on every on-motion
229762
+ * detection session that asks for history. What shipped was a last-moment
229763
+ * discard — `FrameSlot`'s throttle compares wall clocks, and ~4 s of media
229764
+ * arriving inside a few hundred ms of wall clock looks to it like one frame's
229765
+ * worth. Device 617, 2026-09-08: a re-run of the SAME model over the stored
229766
+ * recording scored the subject `vehicle 0.5669` — above the 0.50 floor —
229767
+ * 1.68 s BEFORE the live track was born, on a frame that was in the pre-roll,
229768
+ * was decoded, and was freed.
229769
+ *
229770
+ * Shipping that as opt-in would ship the bug: an operator cannot discover a
229771
+ * setting whose absence looks exactly like a camera that noticed the cyclist
229772
+ * late. What makes ON safe is not a switch but the BOUND —
229773
+ * `preRollInferenceFrames`, a wall-clock ceiling, and a lane that never takes
229774
+ * the last inference permit — so the switch exists for the camera where the
229775
+ * history is worthless (a doorbell whose subject is always already at the
229776
+ * door), not as a hedge against the feature.
229777
+ */
229778
+ preRollInferenceEnabled: zod.z.boolean().default(true),
229779
+ preRollInferenceFrames: zod.z.number().min(preRollInferenceFramesField.min).max(preRollInferenceFramesField.max).default(preRollInferenceFramesField.default),
229379
229780
  occupancyRecheckEnabled: zod.z.boolean().default(true),
229380
229781
  occupancyRecheckSec: zod.z.number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
229381
229782
  occupancyRecheckFrames: zod.z.number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
@@ -229515,6 +229916,29 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
229515
229916
  includes: "onboard"
229516
229917
  }
229517
229918
  },
229919
+ {
229920
+ key: "preRollInferenceEnabled",
229921
+ type: "boolean",
229922
+ style: "checkbox",
229923
+ label: "Detect in the pre-roll",
229924
+ description: "Run detection over the few seconds of footage the camera had already buffered when motion fired, so a subject that was in view before the trigger is found at the moment it appeared rather than seconds later. The burst is bounded and never delays live detection.",
229925
+ default: true
229926
+ },
229927
+ {
229928
+ key: "preRollInferenceFrames",
229929
+ type: "slider",
229930
+ label: "Pre-roll frames",
229931
+ description: "How many frames of buffered history may be detected on, per session. Higher samples the history more densely; 0 disables the pass.",
229932
+ min: preRollInferenceFramesField.min,
229933
+ max: preRollInferenceFramesField.max,
229934
+ step: preRollInferenceFramesField.step,
229935
+ default: preRollInferenceFramesField.default,
229936
+ showValue: true,
229937
+ showWhen: {
229938
+ field: "preRollInferenceEnabled",
229939
+ equals: true
229940
+ }
229941
+ },
229518
229942
  {
229519
229943
  key: "occupancyRecheckEnabled",
229520
229944
  type: "boolean",
@@ -248933,6 +249357,12 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
248933
249357
  addonId: null,
248934
249358
  access: "view"
248935
249359
  },
249360
+ "pipelineAnalytics.listBirthDecisions": {
249361
+ capName: "pipeline-analytics",
249362
+ capScope: "device",
249363
+ addonId: null,
249364
+ access: "view"
249365
+ },
248936
249366
  "pipelineAnalytics.listEventKinds": {
248937
249367
  capName: "pipeline-analytics",
248938
249368
  capScope: "device",
@@ -252989,6 +253419,11 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
252989
253419
  form: "single",
252990
253420
  optional: true
252991
253421
  }],
253422
+ "pipelineAnalytics.listBirthDecisions": [{
253423
+ name: "deviceId",
253424
+ form: "single",
253425
+ optional: true
253426
+ }],
252992
253427
  "pipelineAnalytics.listEventKinds": [{
252993
253428
  name: "deviceId",
252994
253429
  form: "single",
@@ -257720,6 +258155,7 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
257720
258155
  exports.BASE_LIVE_EGRESS_PROFILE = BASE_LIVE_EGRESS_PROFILE;
257721
258156
  exports.BATTERY_DEVICE_PROFILE = BATTERY_DEVICE_PROFILE;
257722
258157
  exports.BATTERY_UNREACHABLE_AFTER_MS = BATTERY_UNREACHABLE_AFTER_MS;
258158
+ exports.BIRTH_DECISION_DEFAULT_LIMIT = BIRTH_DECISION_DEFAULT_LIMIT;
257723
258159
  exports.BOOT_RECOVERY_BACKOFF_MS = require_sleep.BOOT_RECOVERY_BACKOFF_MS;
257724
258160
  exports.BacklightModeSchema = BacklightModeSchema;
257725
258161
  exports.BackupDestinationInfoSchema = BackupDestinationInfoSchema;
@@ -257733,6 +258169,9 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
257733
258169
  exports.BaseDeviceProvider = BaseDeviceProvider;
257734
258170
  exports.BatteryStatusSchema = BatteryStatusSchema;
257735
258171
  exports.BinaryStatusSchema = BinaryStatusSchema;
258172
+ exports.BirthDecisionQueryInputSchema = BirthDecisionQueryInputSchema;
258173
+ exports.BirthDecisionRecordSchema = BirthDecisionRecordSchema;
258174
+ exports.BirthDecisionVerdictSchema = BirthDecisionVerdictSchema;
257736
258175
  exports.BoundingBoxSchema = BoundingBoxSchema;
257737
258176
  exports.BrightnessStatusSchema = BrightnessStatusSchema;
257738
258177
  exports.BrokerAddInputSchema = AddInputSchema;
@@ -258109,6 +258548,8 @@ ${recipe.triggers.map((t, i) => emitTrigger(t, i)).join("\n\n")}
258109
258548
  exports.LoginStageEnum = LoginStageEnum;
258110
258549
  exports.MACRO_LABELS = MACRO_LABELS;
258111
258550
  exports.MAX_ARCHIVED_DEBUG_NOTES = MAX_ARCHIVED_DEBUG_NOTES;
258551
+ exports.MAX_BIRTH_DECISION_RECORDS = MAX_BIRTH_DECISION_RECORDS;
258552
+ exports.MAX_BIRTH_LATENCY_PROXY_MS = MAX_BIRTH_LATENCY_PROXY_MS;
258112
258553
  exports.MAX_CLIP_EVENT_IDS = MAX_CLIP_EVENT_IDS;
258113
258554
  exports.MAX_CLIP_LABELS = MAX_CLIP_LABELS;
258114
258555
  exports.MAX_CONDITION_DEPTH = MAX_CONDITION_DEPTH;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstack",
3
- "version": "1.2.128",
3
+ "version": "1.2.130",
4
4
  "description": "CLI tool for managing and running CamStack server",
5
5
  "keywords": [
6
6
  "camstack",