@camstack/addon-remote-storage 1.2.86 → 1.2.88

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/s3.addon.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-4AFxH3Ch.js");
5
+ const require_shared = require("./shared-DGPc5-3O.js");
6
6
  let node_stream = require("node:stream");
7
7
  let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
8
8
  let _aws_sdk_lib_storage = require("@aws-sdk/lib-storage");
package/dist/s3.addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-C1Q2-FHB.mjs";
1
+ import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-B2_dMV3o.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { DeleteObjectCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
4
4
  import { Upload } from "@aws-sdk/lib-storage";
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-4AFxH3Ch.js");
5
+ const require_shared = require("./shared-DGPc5-3O.js");
6
6
  let ssh2 = require("ssh2");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_shared.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-C1Q2-FHB.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-B2_dMV3o.mjs";
2
2
  import { Client } from "ssh2";
3
3
  import * as path from "node:path";
4
4
  //#region src/providers/sftp/sftp-config-schema.ts
@@ -7612,6 +7612,157 @@ var CameraSwitchGroupSchema = object({
7612
7612
  /** Unix ms when the group was composed server-side. */
7613
7613
  fetchedAt: number()
7614
7614
  });
7615
+ /**
7616
+ * What the gate decided about a birth, from the CALLER's point of view.
7617
+ *
7618
+ * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
7619
+ * at all — it is a deferral, and the row is written when the deferral ENDS.
7620
+ * The third member is the one the gate's own type cannot express, because
7621
+ * exhaustion is a property of how long the caller waited.
7622
+ */
7623
+ var BirthDecisionVerdictSchema = _enum([
7624
+ "confirmed",
7625
+ "suppressed",
7626
+ "exhausted-fallback"
7627
+ ]);
7628
+ /** One birth decision, as it is kept. */
7629
+ var BirthDecisionRecordSchema = object({
7630
+ id: string(),
7631
+ /** Epoch ms the VERDICT was taken (not the birth instant — see `firstSeen`). */
7632
+ at: number().int(),
7633
+ /** The camera. Required: every question here is asked per-camera. */
7634
+ deviceId: number().int(),
7635
+ /**
7636
+ * The track the decision was about. PROVENANCE, not ownership — a suppressed
7637
+ * birth has no track at all, and a confirmed one is expected to age out long
7638
+ * before this row does. Named `sourceTrackId` so the retention model's
7639
+ * ownership derivation (`collection-classification.ts`, which keys on a
7640
+ * column literally called `trackId`) cannot reach it.
7641
+ */
7642
+ sourceTrackId: string(),
7643
+ /** The candidate's claimed class. The miss rate is asked per class too. */
7644
+ className: string(),
7645
+ verdict: BirthDecisionVerdictSchema,
7646
+ /**
7647
+ * The gate's own `ConfirmationReason` (`confirmed`, `suppressed`,
7648
+ * `native-pass`, `no-crop`, `timeout`, `carried-inconclusive`, …), or `null`
7649
+ * when the gate is DISABLED and every birth is waved through. `null` is not
7650
+ * "unknown": it says the gate took no measurement because it was off, which
7651
+ * is a different population and must never be averaged in with the rest.
7652
+ */
7653
+ reason: string().nullable(),
7654
+ /** Deferral attempts this birth used. 0 = decided on its first look. */
7655
+ attempts: number().int(),
7656
+ /** Ms from the FIRST undecided attempt to this verdict. 0 = never deferred. */
7657
+ deferredForMs: number().int(),
7658
+ /**
7659
+ * THE COLUMN THE RE-OFFER DEFECT IS COUNTED IN.
7660
+ *
7661
+ * `true` when the frame the verdict was taken on carried no matched
7662
+ * detection for this track — the tracker was coasting a frozen box and the
7663
+ * subject was not observed. The deferred-birth re-offer pulls the candidate
7664
+ * straight out of `result.tracked` without checking, so this is reachable
7665
+ * today; the question is the RATE, per camera, and whether refusing those
7666
+ * frames would have cost real tracks (cross-read against `verdict` and
7667
+ * `decidedByBirthEvidence`).
7668
+ */
7669
+ decidedOnCoastedFrame: boolean(),
7670
+ /** Were D379 birth-instant pixels in hand when this candidate was submitted? */
7671
+ birthEvidenceAvailable: boolean(),
7672
+ /**
7673
+ * Did those pixels DECIDE it (`cropSource === 'carried'`)? Available and
7674
+ * deciding are different: the carried crop is confirm-only, so a candidate
7675
+ * can hold evidence, be found inconclusive on it, and be decided by a native
7676
+ * crop of a later instant. A coasted decision backed by carried evidence is
7677
+ * a real observation of the birth instant; one without it is not.
7678
+ */
7679
+ decidedByBirthEvidence: boolean(),
7680
+ /** Best class-compatible crop score, or `null` when nothing compatible was
7681
+ * found — deliberately not 0, which would be a measurement that never was. */
7682
+ bestScore: number().nullable(),
7683
+ /** The bar this candidate actually faced (the phantom-cell hook may raise it). */
7684
+ appliedMinConfidence: number().nullable(),
7685
+ /**
7686
+ * The track's own `firstSeen` — the candidate's first frame, which is where
7687
+ * the timeline starts. `null` for a suppressed birth, which has no track.
7688
+ */
7689
+ firstSeen: number().int().nullable(),
7690
+ /**
7691
+ * The device's most recent motion RISING EDGE at the moment of the decision,
7692
+ * or `null` when there is none, it is older than
7693
+ * {@link MAX_BIRTH_LATENCY_PROXY_MS}, or this runner never saw one.
7694
+ */
7695
+ motionOnsetAt: number().int().nullable(),
7696
+ /**
7697
+ * `firstSeen − motionOnsetAt` — THE OPERATOR'S COMPLAINT, IN MILLISECONDS,
7698
+ * AND THE WEAKEST NUMBER IN THIS ROW. Read the error bars before quoting it.
7699
+ *
7700
+ * **Why motion onset and not something else.** Two other proxies were
7701
+ * considered and rejected:
7702
+ * - *the recording/pipeline session start*: for a camera on
7703
+ * `detectionMode: 'always'` the session opens at process start, hours
7704
+ * before any subject. It measures nothing.
7705
+ * - *the first detection on the device in this burst*: CIRCULAR. A track's
7706
+ * `firstSeen` IS the first detection of that object, so for the track that
7707
+ * OPENS a burst — the only one the operator is complaining about — the two
7708
+ * are the same instant and the latency is 0 by construction.
7709
+ * Motion onset is the only in-process signal produced by a DIFFERENT
7710
+ * mechanism from the object detector, so it is the only one that can precede
7711
+ * it. It is also already maintained per-device at frame rate on this very
7712
+ * node (`handleMotionAnalysis` / `handleOnboardMotion`), which is what makes
7713
+ * it free — and, decisively, the frame path and the motion path are gated to
7714
+ * the SAME designated post-processing node, so the mirror is never empty for
7715
+ * a camera whose births land here.
7716
+ *
7717
+ * **Error bars, all of them.**
7718
+ * 1. *Motion has no class.* A burst opened by rain, a headlight sweeping a
7719
+ * wall or a branch, and only later joined by the person, OVERSTATES the
7720
+ * latency without bound. Mitigated, never removed, by
7721
+ * {@link BirthDecisionRecord.birthIndexInBurst}: only index 0 is a
7722
+ * candidate for "this burst is this subject", and even then it is a
7723
+ * candidate, not a fact.
7724
+ * 2. *The sign is not guaranteed.* The analyzer needs a pixel-count and
7725
+ * intensity threshold. A subject entering slowly at the far edge of the
7726
+ * frame can clear the detector's confidence floor BEFORE it clears the
7727
+ * motion floor, making this negative. Negatives are stored as-is and
7728
+ * never clamped — clamping would fabricate the distribution's left tail,
7729
+ * which is the half that says the proxy is unreliable.
7730
+ * 3. *Onboard motion carries firmware latency of unknown, per-model offset*
7731
+ * (hundreds of ms), plus camera-vs-hub clock skew on top. Numbers are
7732
+ * therefore comparable WITHIN a camera and not across cameras of
7733
+ * different motion sources. The motion source is deliberately not copied
7734
+ * here — it belongs to the addon that owns the device (D224) and this is
7735
+ * a write on the frame path — so group by `deviceId`, which is how the
7736
+ * question is always asked anyway.
7737
+ * 4. *Continuous motion.* On a busy scene the burst never closes and the
7738
+ * onset is minutes old. Bounded by {@link MAX_BIRTH_LATENCY_PROXY_MS};
7739
+ * past it this is `null`.
7740
+ * 5. *No motion signal at all* — analyzer off, onboard-only camera not
7741
+ * reporting, or nothing since boot: `null`. Which is the truth about a
7742
+ * camera nobody has a reference instant for.
7743
+ *
7744
+ * So this is a per-camera DISTRIBUTION over index-0 births, and it is honest
7745
+ * as such. It is not a per-track fact and must never be shown as one.
7746
+ */
7747
+ birthLatencyMs: number().int().nullable(),
7748
+ /**
7749
+ * How many births this device has already decided since that motion onset.
7750
+ * 0 = the first, i.e. the only index at which the burst plausibly belongs to
7751
+ * this subject. `null` when there is no usable onset.
7752
+ */
7753
+ birthIndexInBurst: number().int().nullable()
7754
+ });
7755
+ /** Query input for `listBirthDecisions` — newest first, one camera or all. */
7756
+ var BirthDecisionQueryInputSchema = object({
7757
+ /** Restrict to a single camera; omit for every row. */
7758
+ deviceId: number().int().optional(),
7759
+ /** Only decisions at or after this epoch ms. */
7760
+ since: number().int().optional(),
7761
+ /** Restrict to one verdict — the miss rate is read one population at a time. */
7762
+ verdict: BirthDecisionVerdictSchema.optional(),
7763
+ /** Max rows returned, newest-first. */
7764
+ limit: number().int().min(1).max(5e3).optional()
7765
+ });
7615
7766
  /** One archived note — the operator's words plus enough context to find what
7616
7767
  * they were looking at, after the track itself is gone. */
7617
7768
  var ArchivedDebugNoteSchema = object({
@@ -19736,7 +19887,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19736
19887
  deviceId: number(),
19737
19888
  trackId: string(),
19738
19889
  flags: TrackFlagsPatchSchema
19739
- }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
19890
+ }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
19740
19891
  kind: "query",
19741
19892
  auth: "admin"
19742
19893
  }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
@@ -20178,6 +20329,22 @@ var occupancyRecheckFramesField = {
20178
20329
  step: 1
20179
20330
  };
20180
20331
  /**
20332
+ * Frames one PRE-ROLL catch-up burst may send to inference at session open.
20333
+ *
20334
+ * The default of 12 over a ~4 s retained window is one frame per ~333 ms of
20335
+ * footage, and costs ~480 ms of ONE inference permit at the 40 ms/frame this
20336
+ * fleet measures — one-shot, and only ever taken while a permit would still be
20337
+ * spare for live. `0` turns the burst off entirely (the history is still
20338
+ * decoded, because that is how the dial reaches a decodable GOP, and is then
20339
+ * discarded — the pre-D411 behaviour).
20340
+ */
20341
+ var preRollInferenceFramesField = {
20342
+ min: 0,
20343
+ max: 30,
20344
+ default: 12,
20345
+ step: 1
20346
+ };
20347
+ /**
20181
20348
  * Source enum for motion signals fed to the runner. Extensible — add
20182
20349
  * new variants here when new motion-trigger paths are wired in
20183
20350
  * (`wasm-cross-camera`, `event-bus-relay`, etc.). The runner uses
@@ -20418,6 +20585,31 @@ var RunnerCameraConfigSchema = object({
20418
20585
  * to every occupancy rule until something moved in front of it. The churn is
20419
20586
  * now paid on the interval instead — see `occupancyRecheckSecField`.
20420
20587
  */
20588
+ /**
20589
+ * Infer the session's PRE-ROLL — the retained history the restreamer replays
20590
+ * at session open — instead of decoding it and throwing it away.
20591
+ *
20592
+ * DEFAULT `true`, and the default is the argument. This is not a new
20593
+ * capability being offered cautiously: the pre-roll is ALREADY requested,
20594
+ * already served, already decoded and already paid for on every on-motion
20595
+ * detection session that asks for history. What shipped was a last-moment
20596
+ * discard — `FrameSlot`'s throttle compares wall clocks, and ~4 s of media
20597
+ * arriving inside a few hundred ms of wall clock looks to it like one frame's
20598
+ * worth. Device 617, 2026-09-08: a re-run of the SAME model over the stored
20599
+ * recording scored the subject `vehicle 0.5669` — above the 0.50 floor —
20600
+ * 1.68 s BEFORE the live track was born, on a frame that was in the pre-roll,
20601
+ * was decoded, and was freed.
20602
+ *
20603
+ * Shipping that as opt-in would ship the bug: an operator cannot discover a
20604
+ * setting whose absence looks exactly like a camera that noticed the cyclist
20605
+ * late. What makes ON safe is not a switch but the BOUND —
20606
+ * `preRollInferenceFrames`, a wall-clock ceiling, and a lane that never takes
20607
+ * the last inference permit — so the switch exists for the camera where the
20608
+ * history is worthless (a doorbell whose subject is always already at the
20609
+ * door), not as a hedge against the feature.
20610
+ */
20611
+ preRollInferenceEnabled: boolean().default(true),
20612
+ preRollInferenceFrames: number().min(preRollInferenceFramesField.min).max(preRollInferenceFramesField.max).default(preRollInferenceFramesField.default),
20421
20613
  occupancyRecheckEnabled: boolean().default(true),
20422
20614
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
20423
20615
  occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
@@ -20446,7 +20638,7 @@ var RunnerCameraConfigSchema = object({
20446
20638
  */
20447
20639
  inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
20448
20640
  });
20449
- 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;
20641
+ 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;
20450
20642
  /**
20451
20643
  * Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
20452
20644
  * load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
@@ -33200,6 +33392,12 @@ Object.freeze({
33200
33392
  addonId: null,
33201
33393
  access: "view"
33202
33394
  },
33395
+ "pipelineAnalytics.listBirthDecisions": {
33396
+ capName: "pipeline-analytics",
33397
+ capScope: "device",
33398
+ addonId: null,
33399
+ access: "view"
33400
+ },
33203
33401
  "pipelineAnalytics.listEventKinds": {
33204
33402
  capName: "pipeline-analytics",
33205
33403
  capScope: "device",
@@ -36992,6 +37190,11 @@ Object.freeze({
36992
37190
  form: "single",
36993
37191
  optional: true
36994
37192
  }],
37193
+ "pipelineAnalytics.listBirthDecisions": [{
37194
+ name: "deviceId",
37195
+ form: "single",
37196
+ optional: true
37197
+ }],
36995
37198
  "pipelineAnalytics.listEventKinds": [{
36996
37199
  name: "deviceId",
36997
37200
  form: "single",
@@ -7635,6 +7635,157 @@ var CameraSwitchGroupSchema = object({
7635
7635
  /** Unix ms when the group was composed server-side. */
7636
7636
  fetchedAt: number()
7637
7637
  });
7638
+ /**
7639
+ * What the gate decided about a birth, from the CALLER's point of view.
7640
+ *
7641
+ * Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
7642
+ * at all — it is a deferral, and the row is written when the deferral ENDS.
7643
+ * The third member is the one the gate's own type cannot express, because
7644
+ * exhaustion is a property of how long the caller waited.
7645
+ */
7646
+ var BirthDecisionVerdictSchema = _enum([
7647
+ "confirmed",
7648
+ "suppressed",
7649
+ "exhausted-fallback"
7650
+ ]);
7651
+ /** One birth decision, as it is kept. */
7652
+ var BirthDecisionRecordSchema = object({
7653
+ id: string(),
7654
+ /** Epoch ms the VERDICT was taken (not the birth instant — see `firstSeen`). */
7655
+ at: number().int(),
7656
+ /** The camera. Required: every question here is asked per-camera. */
7657
+ deviceId: number().int(),
7658
+ /**
7659
+ * The track the decision was about. PROVENANCE, not ownership — a suppressed
7660
+ * birth has no track at all, and a confirmed one is expected to age out long
7661
+ * before this row does. Named `sourceTrackId` so the retention model's
7662
+ * ownership derivation (`collection-classification.ts`, which keys on a
7663
+ * column literally called `trackId`) cannot reach it.
7664
+ */
7665
+ sourceTrackId: string(),
7666
+ /** The candidate's claimed class. The miss rate is asked per class too. */
7667
+ className: string(),
7668
+ verdict: BirthDecisionVerdictSchema,
7669
+ /**
7670
+ * The gate's own `ConfirmationReason` (`confirmed`, `suppressed`,
7671
+ * `native-pass`, `no-crop`, `timeout`, `carried-inconclusive`, …), or `null`
7672
+ * when the gate is DISABLED and every birth is waved through. `null` is not
7673
+ * "unknown": it says the gate took no measurement because it was off, which
7674
+ * is a different population and must never be averaged in with the rest.
7675
+ */
7676
+ reason: string().nullable(),
7677
+ /** Deferral attempts this birth used. 0 = decided on its first look. */
7678
+ attempts: number().int(),
7679
+ /** Ms from the FIRST undecided attempt to this verdict. 0 = never deferred. */
7680
+ deferredForMs: number().int(),
7681
+ /**
7682
+ * THE COLUMN THE RE-OFFER DEFECT IS COUNTED IN.
7683
+ *
7684
+ * `true` when the frame the verdict was taken on carried no matched
7685
+ * detection for this track — the tracker was coasting a frozen box and the
7686
+ * subject was not observed. The deferred-birth re-offer pulls the candidate
7687
+ * straight out of `result.tracked` without checking, so this is reachable
7688
+ * today; the question is the RATE, per camera, and whether refusing those
7689
+ * frames would have cost real tracks (cross-read against `verdict` and
7690
+ * `decidedByBirthEvidence`).
7691
+ */
7692
+ decidedOnCoastedFrame: boolean(),
7693
+ /** Were D379 birth-instant pixels in hand when this candidate was submitted? */
7694
+ birthEvidenceAvailable: boolean(),
7695
+ /**
7696
+ * Did those pixels DECIDE it (`cropSource === 'carried'`)? Available and
7697
+ * deciding are different: the carried crop is confirm-only, so a candidate
7698
+ * can hold evidence, be found inconclusive on it, and be decided by a native
7699
+ * crop of a later instant. A coasted decision backed by carried evidence is
7700
+ * a real observation of the birth instant; one without it is not.
7701
+ */
7702
+ decidedByBirthEvidence: boolean(),
7703
+ /** Best class-compatible crop score, or `null` when nothing compatible was
7704
+ * found — deliberately not 0, which would be a measurement that never was. */
7705
+ bestScore: number().nullable(),
7706
+ /** The bar this candidate actually faced (the phantom-cell hook may raise it). */
7707
+ appliedMinConfidence: number().nullable(),
7708
+ /**
7709
+ * The track's own `firstSeen` — the candidate's first frame, which is where
7710
+ * the timeline starts. `null` for a suppressed birth, which has no track.
7711
+ */
7712
+ firstSeen: number().int().nullable(),
7713
+ /**
7714
+ * The device's most recent motion RISING EDGE at the moment of the decision,
7715
+ * or `null` when there is none, it is older than
7716
+ * {@link MAX_BIRTH_LATENCY_PROXY_MS}, or this runner never saw one.
7717
+ */
7718
+ motionOnsetAt: number().int().nullable(),
7719
+ /**
7720
+ * `firstSeen − motionOnsetAt` — THE OPERATOR'S COMPLAINT, IN MILLISECONDS,
7721
+ * AND THE WEAKEST NUMBER IN THIS ROW. Read the error bars before quoting it.
7722
+ *
7723
+ * **Why motion onset and not something else.** Two other proxies were
7724
+ * considered and rejected:
7725
+ * - *the recording/pipeline session start*: for a camera on
7726
+ * `detectionMode: 'always'` the session opens at process start, hours
7727
+ * before any subject. It measures nothing.
7728
+ * - *the first detection on the device in this burst*: CIRCULAR. A track's
7729
+ * `firstSeen` IS the first detection of that object, so for the track that
7730
+ * OPENS a burst — the only one the operator is complaining about — the two
7731
+ * are the same instant and the latency is 0 by construction.
7732
+ * Motion onset is the only in-process signal produced by a DIFFERENT
7733
+ * mechanism from the object detector, so it is the only one that can precede
7734
+ * it. It is also already maintained per-device at frame rate on this very
7735
+ * node (`handleMotionAnalysis` / `handleOnboardMotion`), which is what makes
7736
+ * it free — and, decisively, the frame path and the motion path are gated to
7737
+ * the SAME designated post-processing node, so the mirror is never empty for
7738
+ * a camera whose births land here.
7739
+ *
7740
+ * **Error bars, all of them.**
7741
+ * 1. *Motion has no class.* A burst opened by rain, a headlight sweeping a
7742
+ * wall or a branch, and only later joined by the person, OVERSTATES the
7743
+ * latency without bound. Mitigated, never removed, by
7744
+ * {@link BirthDecisionRecord.birthIndexInBurst}: only index 0 is a
7745
+ * candidate for "this burst is this subject", and even then it is a
7746
+ * candidate, not a fact.
7747
+ * 2. *The sign is not guaranteed.* The analyzer needs a pixel-count and
7748
+ * intensity threshold. A subject entering slowly at the far edge of the
7749
+ * frame can clear the detector's confidence floor BEFORE it clears the
7750
+ * motion floor, making this negative. Negatives are stored as-is and
7751
+ * never clamped — clamping would fabricate the distribution's left tail,
7752
+ * which is the half that says the proxy is unreliable.
7753
+ * 3. *Onboard motion carries firmware latency of unknown, per-model offset*
7754
+ * (hundreds of ms), plus camera-vs-hub clock skew on top. Numbers are
7755
+ * therefore comparable WITHIN a camera and not across cameras of
7756
+ * different motion sources. The motion source is deliberately not copied
7757
+ * here — it belongs to the addon that owns the device (D224) and this is
7758
+ * a write on the frame path — so group by `deviceId`, which is how the
7759
+ * question is always asked anyway.
7760
+ * 4. *Continuous motion.* On a busy scene the burst never closes and the
7761
+ * onset is minutes old. Bounded by {@link MAX_BIRTH_LATENCY_PROXY_MS};
7762
+ * past it this is `null`.
7763
+ * 5. *No motion signal at all* — analyzer off, onboard-only camera not
7764
+ * reporting, or nothing since boot: `null`. Which is the truth about a
7765
+ * camera nobody has a reference instant for.
7766
+ *
7767
+ * So this is a per-camera DISTRIBUTION over index-0 births, and it is honest
7768
+ * as such. It is not a per-track fact and must never be shown as one.
7769
+ */
7770
+ birthLatencyMs: number().int().nullable(),
7771
+ /**
7772
+ * How many births this device has already decided since that motion onset.
7773
+ * 0 = the first, i.e. the only index at which the burst plausibly belongs to
7774
+ * this subject. `null` when there is no usable onset.
7775
+ */
7776
+ birthIndexInBurst: number().int().nullable()
7777
+ });
7778
+ /** Query input for `listBirthDecisions` — newest first, one camera or all. */
7779
+ var BirthDecisionQueryInputSchema = object({
7780
+ /** Restrict to a single camera; omit for every row. */
7781
+ deviceId: number().int().optional(),
7782
+ /** Only decisions at or after this epoch ms. */
7783
+ since: number().int().optional(),
7784
+ /** Restrict to one verdict — the miss rate is read one population at a time. */
7785
+ verdict: BirthDecisionVerdictSchema.optional(),
7786
+ /** Max rows returned, newest-first. */
7787
+ limit: number().int().min(1).max(5e3).optional()
7788
+ });
7638
7789
  /** One archived note — the operator's words plus enough context to find what
7639
7790
  * they were looking at, after the track itself is gone. */
7640
7791
  var ArchivedDebugNoteSchema = object({
@@ -19759,7 +19910,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19759
19910
  deviceId: number(),
19760
19911
  trackId: string(),
19761
19912
  flags: TrackFlagsPatchSchema
19762
- }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
19913
+ }), TrackFlagsSchema, { kind: "mutation" }), method(ArchivedDebugNoteQueryInputSchema, array(ArchivedDebugNoteSchema).readonly(), { kind: "query" }), method(BirthDecisionQueryInputSchema, array(BirthDecisionRecordSchema).readonly(), { kind: "query" }), method(object({}), EventStoreFootprintSchema, {
19763
19914
  kind: "query",
19764
19915
  auth: "admin"
19765
19916
  }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
@@ -20201,6 +20352,22 @@ var occupancyRecheckFramesField = {
20201
20352
  step: 1
20202
20353
  };
20203
20354
  /**
20355
+ * Frames one PRE-ROLL catch-up burst may send to inference at session open.
20356
+ *
20357
+ * The default of 12 over a ~4 s retained window is one frame per ~333 ms of
20358
+ * footage, and costs ~480 ms of ONE inference permit at the 40 ms/frame this
20359
+ * fleet measures — one-shot, and only ever taken while a permit would still be
20360
+ * spare for live. `0` turns the burst off entirely (the history is still
20361
+ * decoded, because that is how the dial reaches a decodable GOP, and is then
20362
+ * discarded — the pre-D411 behaviour).
20363
+ */
20364
+ var preRollInferenceFramesField = {
20365
+ min: 0,
20366
+ max: 30,
20367
+ default: 12,
20368
+ step: 1
20369
+ };
20370
+ /**
20204
20371
  * Source enum for motion signals fed to the runner. Extensible — add
20205
20372
  * new variants here when new motion-trigger paths are wired in
20206
20373
  * (`wasm-cross-camera`, `event-bus-relay`, etc.). The runner uses
@@ -20441,6 +20608,31 @@ var RunnerCameraConfigSchema = object({
20441
20608
  * to every occupancy rule until something moved in front of it. The churn is
20442
20609
  * now paid on the interval instead — see `occupancyRecheckSecField`.
20443
20610
  */
20611
+ /**
20612
+ * Infer the session's PRE-ROLL — the retained history the restreamer replays
20613
+ * at session open — instead of decoding it and throwing it away.
20614
+ *
20615
+ * DEFAULT `true`, and the default is the argument. This is not a new
20616
+ * capability being offered cautiously: the pre-roll is ALREADY requested,
20617
+ * already served, already decoded and already paid for on every on-motion
20618
+ * detection session that asks for history. What shipped was a last-moment
20619
+ * discard — `FrameSlot`'s throttle compares wall clocks, and ~4 s of media
20620
+ * arriving inside a few hundred ms of wall clock looks to it like one frame's
20621
+ * worth. Device 617, 2026-09-08: a re-run of the SAME model over the stored
20622
+ * recording scored the subject `vehicle 0.5669` — above the 0.50 floor —
20623
+ * 1.68 s BEFORE the live track was born, on a frame that was in the pre-roll,
20624
+ * was decoded, and was freed.
20625
+ *
20626
+ * Shipping that as opt-in would ship the bug: an operator cannot discover a
20627
+ * setting whose absence looks exactly like a camera that noticed the cyclist
20628
+ * late. What makes ON safe is not a switch but the BOUND —
20629
+ * `preRollInferenceFrames`, a wall-clock ceiling, and a lane that never takes
20630
+ * the last inference permit — so the switch exists for the camera where the
20631
+ * history is worthless (a doorbell whose subject is always already at the
20632
+ * door), not as a hedge against the feature.
20633
+ */
20634
+ preRollInferenceEnabled: boolean().default(true),
20635
+ preRollInferenceFrames: number().min(preRollInferenceFramesField.min).max(preRollInferenceFramesField.max).default(preRollInferenceFramesField.default),
20444
20636
  occupancyRecheckEnabled: boolean().default(true),
20445
20637
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
20446
20638
  occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
@@ -20469,7 +20661,7 @@ var RunnerCameraConfigSchema = object({
20469
20661
  */
20470
20662
  inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
20471
20663
  });
20472
- 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;
20664
+ 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;
20473
20665
  /**
20474
20666
  * Runtime load summary returned by `getLocalLoad`. Used by the orchestrator's
20475
20667
  * load-balancing levels (L2 capacity-based, L3 hardware-aware) to decide
@@ -33223,6 +33415,12 @@ Object.freeze({
33223
33415
  addonId: null,
33224
33416
  access: "view"
33225
33417
  },
33418
+ "pipelineAnalytics.listBirthDecisions": {
33419
+ capName: "pipeline-analytics",
33420
+ capScope: "device",
33421
+ addonId: null,
33422
+ access: "view"
33423
+ },
33226
33424
  "pipelineAnalytics.listEventKinds": {
33227
33425
  capName: "pipeline-analytics",
33228
33426
  capScope: "device",
@@ -37015,6 +37213,11 @@ Object.freeze({
37015
37213
  form: "single",
37016
37214
  optional: true
37017
37215
  }],
37216
+ "pipelineAnalytics.listBirthDecisions": [{
37217
+ name: "deviceId",
37218
+ form: "single",
37219
+ optional: true
37220
+ }],
37018
37221
  "pipelineAnalytics.listEventKinds": [{
37019
37222
  name: "deviceId",
37020
37223
  form: "single",
package/dist/smb.addon.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-4AFxH3Ch.js");
5
+ const require_shared = require("./shared-DGPc5-3O.js");
6
6
  let node_crypto = require("node:crypto");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_shared.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, s as storageProviderCapability } from "./shared-C1Q2-FHB.mjs";
1
+ import { c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, s as storageProviderCapability } from "./shared-B2_dMV3o.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import * as path from "node:path";
4
4
  import * as fsp from "node:fs/promises";
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-4AFxH3Ch.js");
5
+ const require_shared = require("./shared-DGPc5-3O.js");
6
6
  let node_stream = require("node:stream");
7
7
  let webdav = require("webdav");
8
8
  //#region src/providers/webdav/webdav-config-schema.ts
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-C1Q2-FHB.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-B2_dMV3o.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { AuthType, createClient } from "webdav";
4
4
  //#region src/providers/webdav/webdav-config-schema.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-remote-storage",
3
- "version": "1.2.86",
3
+ "version": "1.2.88",
4
4
  "description": "Remote storage providers (SFTP, S3, WebDAV, SMB) — unifies remote backends behind the storage-provider cap",
5
5
  "keywords": [
6
6
  "camstack",