@camstack/addon-export-hap 1.2.24 → 1.2.25

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.
@@ -24384,13 +24384,24 @@ method(object({
24384
24384
  /** Playback-speed multiplier for the render (1 = realtime). */
24385
24385
  var ExportSpeedSchema = number().min(.25).max(32);
24386
24386
  /**
24387
- * One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
24388
- *
24389
- * Relative and not absolute epoch on purpose: the renderer's frame-select
24390
- * expression sees ffmpeg's `t`, which starts at 0 for the export's source
24391
- * playlist. Handing it absolute epochs would make every call site responsible
24392
- * for the same subtraction, and the one that forgot would emit a filter that
24393
- * selects nothing silently, as a uniform timelapse.
24387
+ * One dense interval, in WALL-CLOCK SECONDS FROM THE EXPORT'S OWN `fromMs`.
24388
+ *
24389
+ * **Wall clock, not ffmpeg's `t`** and the recorder translates. A caller
24390
+ * derives these bounds from things that happened at a TIME (a track's
24391
+ * `firstSeen`), while `t` runs over the source playlist: the concatenation of
24392
+ * every segment present for the range, with each recording GAP removed. The
24393
+ * two agree only on a window that recorded without one interruption, and only
24394
+ * the render side knows the segments, so the translation lives there
24395
+ * (`export-dense-map.ts`, addon-pipeline).
24396
+ *
24397
+ * It was not always so. These seconds were fed to `between(t,…)` verbatim, and
24398
+ * on a 10 h window holding 29,393 s of footage every range landed late by the
24399
+ * gap accumulated before it — up to 6,607 s, well past EOF. Nothing matched,
24400
+ * the video was a uniform timelapse, and the log line reported the five ranges
24401
+ * that had been ASKED for (2026-08-13, export `57d14363`, camera 615).
24402
+ *
24403
+ * Relative and not absolute epoch, because an absolute epoch would make every
24404
+ * call site responsible for the same subtraction.
24394
24405
  */
24395
24406
  var ExportDenseRangeSchema = object({
24396
24407
  fromSec: number().nonnegative(),
@@ -31520,25 +31531,32 @@ object({
31520
31531
  var NativeLeaseAdmissionSchema = _enum(["all", "inferred"]);
31521
31532
  object({
31522
31533
  /**
31523
- * How long a retained native frame is served before it counts as a miss.
31534
+ * How many delivered frames the worker HOLDS at once, waiting for each one's
31535
+ * detection result.
31536
+ *
31537
+ * This replaced a TTL on 2026-08-13, and the replacement is the whole point:
31538
+ * a time window was never related to the event the pixels were waiting for.
31539
+ * A held frame now lives from delivery until the runner has its `FrameResult`
31540
+ * — at which moment the runner cuts the subject tiles it actually wanted and
31541
+ * releases the frame. The bound exists only so a runner that stops answering
31542
+ * cannot pin RAM: above it the OLDEST held frame is dropped and counted.
31524
31543
  *
31525
- * Must cover the FULL late-crop horizon: detection inference + the
31526
- * cross-process inference-result hop to hub post-analysis + tracking + the
31527
- * tRPC crop round-trip back. Below ~500 ms the busiest cameras' subject crops
31528
- * outrun it and fall back to the ≤640 detection frame; above ~3 s the resident
31529
- * RAM per busy camera grows linearly with no measured hit-rate gain.
31544
+ * Sizing: the steady state is `inferenceLatency × deliveredFps`, measured at
31545
+ * 40-160 ms × ≤25 fps = 1-4 frames. The default leaves headroom for a hiccup
31546
+ * without ever approaching the old resident set (43 frames × 24.9 MB at 4K).
31547
+ * Raising it does not buy hit rate it buys tolerance for a slow runner, and
31548
+ * `holdOverflow` on the metrics line is what says you need it.
31530
31549
  */
31531
- ttlMs: number().int().min(250).max(1e4),
31550
+ holdFrames: number().int().min(1).max(64),
31532
31551
  /**
31533
31552
  * Hard per-decode-worker RAM ceiling for retained native frames, in MB.
31534
31553
  *
31535
- * Intended as a SAFETY ceiling with the TTL as the effective cap — but check
31536
- * which one is actually binding before reasoning from that. At the shipped
31537
- * 1024 MB and a 2 800 ms TTL, a 4K camera hits the CEILING first (~43 frames
31538
- * at ~24 MB each) and the TTL never gets to expire anything; `leaseMb` /
31539
- * `leaseFrames` on the metrics line say which. When the ceiling binds, a
31540
- * change that admits fewer frames buys retention WINDOW at constant RAM
31541
- * rather than giving RAM back — lower this knob if RAM is what you wanted.
31554
+ * Since 2026-08-13 this is a SAFETY ceiling and nothing else: `holdFrames`
31555
+ * is what decides how much is held, and the ceiling is the number above which
31556
+ * something is wrong. Before that it was the effective cap at 1024 MB with
31557
+ * a 2 800 ms TTL a 4K camera sat pinned at `leaseMb:1020, leaseFrames:43`
31558
+ * with the TTL expiring nothing, which is exactly the confusion the hold
31559
+ * removes. `leaseMb` / `leaseFrames` still say what is resident.
31542
31560
  * `0` DISABLES the lease entirely and falls the worker back to the tiny
31543
31561
  * leak-prone GPU surface ring (~85% crop miss; that is what the lease exists
31544
31562
  * to replace).
@@ -31564,22 +31582,45 @@ object({
31564
31582
  * there is the signal that some caller names frames outside the inference set
31565
31583
  * and that this must go back to `all`.
31566
31584
  */
31567
- admission: NativeLeaseAdmissionSchema
31585
+ admission: NativeLeaseAdmissionSchema,
31586
+ /**
31587
+ * RAM ceiling per decode worker, in MB, for the SUBJECT TILES — the
31588
+ * compressed native crops the worker cuts at the moment a frame's detection
31589
+ * result arrives, and keeps long after the frame itself is freed.
31590
+ *
31591
+ * This is the knob that replaced the old retention window, and it buys about
31592
+ * three orders of magnitude more of it: a tile is one subject at native
31593
+ * resolution, JPEG-encoded (~60-120 KB on a 4K person), against ~24.9 MB for
31594
+ * the frame it was cut from. A frame on which nothing was detected costs
31595
+ * nothing at all, which is the real change — the old lease paid per FRAME and
31596
+ * was interrogated per SUBJECT.
31597
+ *
31598
+ * `0` DISABLES tiles, leaving only the hold window and the ≤640 RAM
31599
+ * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
31600
+ * reproduce that.
31601
+ */
31602
+ tileBudgetMb: number().int().min(0).max(1024)
31568
31603
  });
31569
31604
  /**
31570
- * The values in force when the operator has set nothing — byte-for-byte the
31571
- * constants the decode worker shipped with as env-var defaults, so making these
31572
- * settings changed no behaviour on the day it landed.
31605
+ * The values in force when the operator has set nothing.
31606
+ *
31607
+ * `budgetMb` stays at 1024 on the day the hold landed, deliberately: it stopped
31608
+ * being the retention window and became the OOM ceiling, and lowering a ceiling
31609
+ * in the same change that redefines it would make a regression and a retune
31610
+ * indistinguishable. Cut it once `tileHits` / `holdOverflow` have been read on
31611
+ * live traffic.
31573
31612
  */
31574
31613
  var DEFAULT_NATIVE_LEASE_SETTINGS = {
31575
- ttlMs: 1200,
31614
+ holdFrames: 8,
31576
31615
  budgetMb: 1024,
31577
31616
  activityMs: 15e3,
31617
+ tileBudgetMb: 64,
31578
31618
  admission: "inferred"
31579
31619
  };
31580
- DEFAULT_NATIVE_LEASE_SETTINGS.ttlMs;
31620
+ DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
31581
31621
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
31582
31622
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
31623
+ DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
31583
31624
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
31584
31625
  /**
31585
31626
  * Compute the stable 64-char lowercase-hex fingerprint of a device's
@@ -24372,13 +24372,24 @@ method(object({
24372
24372
  /** Playback-speed multiplier for the render (1 = realtime). */
24373
24373
  var ExportSpeedSchema = number().min(.25).max(32);
24374
24374
  /**
24375
- * One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
24376
- *
24377
- * Relative and not absolute epoch on purpose: the renderer's frame-select
24378
- * expression sees ffmpeg's `t`, which starts at 0 for the export's source
24379
- * playlist. Handing it absolute epochs would make every call site responsible
24380
- * for the same subtraction, and the one that forgot would emit a filter that
24381
- * selects nothing silently, as a uniform timelapse.
24375
+ * One dense interval, in WALL-CLOCK SECONDS FROM THE EXPORT'S OWN `fromMs`.
24376
+ *
24377
+ * **Wall clock, not ffmpeg's `t`** and the recorder translates. A caller
24378
+ * derives these bounds from things that happened at a TIME (a track's
24379
+ * `firstSeen`), while `t` runs over the source playlist: the concatenation of
24380
+ * every segment present for the range, with each recording GAP removed. The
24381
+ * two agree only on a window that recorded without one interruption, and only
24382
+ * the render side knows the segments, so the translation lives there
24383
+ * (`export-dense-map.ts`, addon-pipeline).
24384
+ *
24385
+ * It was not always so. These seconds were fed to `between(t,…)` verbatim, and
24386
+ * on a 10 h window holding 29,393 s of footage every range landed late by the
24387
+ * gap accumulated before it — up to 6,607 s, well past EOF. Nothing matched,
24388
+ * the video was a uniform timelapse, and the log line reported the five ranges
24389
+ * that had been ASKED for (2026-08-13, export `57d14363`, camera 615).
24390
+ *
24391
+ * Relative and not absolute epoch, because an absolute epoch would make every
24392
+ * call site responsible for the same subtraction.
24382
24393
  */
24383
24394
  var ExportDenseRangeSchema = object({
24384
24395
  fromSec: number().nonnegative(),
@@ -31508,25 +31519,32 @@ object({
31508
31519
  var NativeLeaseAdmissionSchema = _enum(["all", "inferred"]);
31509
31520
  object({
31510
31521
  /**
31511
- * How long a retained native frame is served before it counts as a miss.
31522
+ * How many delivered frames the worker HOLDS at once, waiting for each one's
31523
+ * detection result.
31524
+ *
31525
+ * This replaced a TTL on 2026-08-13, and the replacement is the whole point:
31526
+ * a time window was never related to the event the pixels were waiting for.
31527
+ * A held frame now lives from delivery until the runner has its `FrameResult`
31528
+ * — at which moment the runner cuts the subject tiles it actually wanted and
31529
+ * releases the frame. The bound exists only so a runner that stops answering
31530
+ * cannot pin RAM: above it the OLDEST held frame is dropped and counted.
31512
31531
  *
31513
- * Must cover the FULL late-crop horizon: detection inference + the
31514
- * cross-process inference-result hop to hub post-analysis + tracking + the
31515
- * tRPC crop round-trip back. Below ~500 ms the busiest cameras' subject crops
31516
- * outrun it and fall back to the ≤640 detection frame; above ~3 s the resident
31517
- * RAM per busy camera grows linearly with no measured hit-rate gain.
31532
+ * Sizing: the steady state is `inferenceLatency × deliveredFps`, measured at
31533
+ * 40-160 ms × ≤25 fps = 1-4 frames. The default leaves headroom for a hiccup
31534
+ * without ever approaching the old resident set (43 frames × 24.9 MB at 4K).
31535
+ * Raising it does not buy hit rate it buys tolerance for a slow runner, and
31536
+ * `holdOverflow` on the metrics line is what says you need it.
31518
31537
  */
31519
- ttlMs: number().int().min(250).max(1e4),
31538
+ holdFrames: number().int().min(1).max(64),
31520
31539
  /**
31521
31540
  * Hard per-decode-worker RAM ceiling for retained native frames, in MB.
31522
31541
  *
31523
- * Intended as a SAFETY ceiling with the TTL as the effective cap — but check
31524
- * which one is actually binding before reasoning from that. At the shipped
31525
- * 1024 MB and a 2 800 ms TTL, a 4K camera hits the CEILING first (~43 frames
31526
- * at ~24 MB each) and the TTL never gets to expire anything; `leaseMb` /
31527
- * `leaseFrames` on the metrics line say which. When the ceiling binds, a
31528
- * change that admits fewer frames buys retention WINDOW at constant RAM
31529
- * rather than giving RAM back — lower this knob if RAM is what you wanted.
31542
+ * Since 2026-08-13 this is a SAFETY ceiling and nothing else: `holdFrames`
31543
+ * is what decides how much is held, and the ceiling is the number above which
31544
+ * something is wrong. Before that it was the effective cap at 1024 MB with
31545
+ * a 2 800 ms TTL a 4K camera sat pinned at `leaseMb:1020, leaseFrames:43`
31546
+ * with the TTL expiring nothing, which is exactly the confusion the hold
31547
+ * removes. `leaseMb` / `leaseFrames` still say what is resident.
31530
31548
  * `0` DISABLES the lease entirely and falls the worker back to the tiny
31531
31549
  * leak-prone GPU surface ring (~85% crop miss; that is what the lease exists
31532
31550
  * to replace).
@@ -31552,22 +31570,45 @@ object({
31552
31570
  * there is the signal that some caller names frames outside the inference set
31553
31571
  * and that this must go back to `all`.
31554
31572
  */
31555
- admission: NativeLeaseAdmissionSchema
31573
+ admission: NativeLeaseAdmissionSchema,
31574
+ /**
31575
+ * RAM ceiling per decode worker, in MB, for the SUBJECT TILES — the
31576
+ * compressed native crops the worker cuts at the moment a frame's detection
31577
+ * result arrives, and keeps long after the frame itself is freed.
31578
+ *
31579
+ * This is the knob that replaced the old retention window, and it buys about
31580
+ * three orders of magnitude more of it: a tile is one subject at native
31581
+ * resolution, JPEG-encoded (~60-120 KB on a 4K person), against ~24.9 MB for
31582
+ * the frame it was cut from. A frame on which nothing was detected costs
31583
+ * nothing at all, which is the real change — the old lease paid per FRAME and
31584
+ * was interrogated per SUBJECT.
31585
+ *
31586
+ * `0` DISABLES tiles, leaving only the hold window and the ≤640 RAM
31587
+ * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
31588
+ * reproduce that.
31589
+ */
31590
+ tileBudgetMb: number().int().min(0).max(1024)
31556
31591
  });
31557
31592
  /**
31558
- * The values in force when the operator has set nothing — byte-for-byte the
31559
- * constants the decode worker shipped with as env-var defaults, so making these
31560
- * settings changed no behaviour on the day it landed.
31593
+ * The values in force when the operator has set nothing.
31594
+ *
31595
+ * `budgetMb` stays at 1024 on the day the hold landed, deliberately: it stopped
31596
+ * being the retention window and became the OOM ceiling, and lowering a ceiling
31597
+ * in the same change that redefines it would make a regression and a retune
31598
+ * indistinguishable. Cut it once `tileHits` / `holdOverflow` have been read on
31599
+ * live traffic.
31561
31600
  */
31562
31601
  var DEFAULT_NATIVE_LEASE_SETTINGS = {
31563
- ttlMs: 1200,
31602
+ holdFrames: 8,
31564
31603
  budgetMb: 1024,
31565
31604
  activityMs: 15e3,
31605
+ tileBudgetMb: 64,
31566
31606
  admission: "inferred"
31567
31607
  };
31568
- DEFAULT_NATIVE_LEASE_SETTINGS.ttlMs;
31608
+ DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
31569
31609
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
31570
31610
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
31611
+ DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
31571
31612
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
31572
31613
  /**
31573
31614
  * Compute the stable 64-char lowercase-hex fingerprint of a device's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-hap",
3
- "version": "1.2.24",
3
+ "version": "1.2.25",
4
4
  "description": "HomeKit (HAP) bridge exporter for CamStack devices. Publishes a bridged accessory per exposed device — MotionSensor in this MVP; Camera/Doorbell/Switch/Light follow.",
5
5
  "keywords": [
6
6
  "camstack",