@camstack/addon-ai 0.2.18 → 0.2.20

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.
Files changed (3) hide show
  1. package/dist/addon.js +139 -35
  2. package/dist/addon.mjs +139 -35
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -13101,7 +13101,23 @@ var NotificationActionSchema = object({
13101
13101
  * else — see `notification-center/action-token.ts` for what that does and
13102
13102
  * does not buy.
13103
13103
  */
13104
- destructive: boolean().optional()
13104
+ destructive: boolean().optional(),
13105
+ /**
13106
+ * How the tap should REACH the url.
13107
+ *
13108
+ * `navigate` (absent, and every button authored before this field) opens it:
13109
+ * the phone leaves the notification and shows whatever the callback returns.
13110
+ * That is right for a button whose answer the operator wants to read.
13111
+ *
13112
+ * `background` fires it as a POST and stays put. It exists for the buttons
13113
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
13114
+ * an answer to the notification, and being thrown into a browser tab to
13115
+ * confirm it costs more attention than the notification did. A backend that
13116
+ * cannot do a background call renders it as an ordinary link (the adapters
13117
+ * fall back rather than dropping the button), so this is a preference, never
13118
+ * a requirement.
13119
+ */
13120
+ mode: _enum(["navigate", "background"]).optional()
13105
13121
  });
13106
13122
  /**
13107
13123
  * The canonical notification. `body` is the only hard field (Apprise model).
@@ -14102,6 +14118,9 @@ var NcSystemEventConditionSchema = object({
14102
14118
  nodeIds: array(string().min(1)).min(1).optional(),
14103
14119
  packageNames: array(string().min(1)).min(1).optional()
14104
14120
  });
14121
+ /** Hard ceiling on a window (24h). A snooze that could not expire would be an
14122
+ * outage the operator asked for once and forgot. */
14123
+ var NC_SNOOZE_MAX_MINUTES = 1440;
14105
14124
  /** Weekly schedule — OR of windows; absence on the rule = always active. */
14106
14125
  var NcScheduleSchema = object({
14107
14126
  windows: array(object({
@@ -14478,15 +14497,15 @@ var NcConditionsSchema = object({
14478
14497
  * (an `immediate` rule naming an `audio-*` class, one notification per
14479
14498
  * classified sample) stays exactly as it was for rules that already use it.
14480
14499
  *
14481
- * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
14482
- * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
14483
- * (`camstack/src/data/notification-center.ts`, guarded by
14484
- * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
14500
+ * In {@link NC_CONDITION_CATALOG} since P2, and the ORDER it got there is the
14501
+ * rule rather than an accident: the viewer mirrors the descriptor enums BY
14502
+ * HAND (`camstack/src/data/notification-center.ts`, guarded by
14503
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor strips the
14485
14504
  * condition fields it does not know when a rule is saved from the phone.
14486
14505
  * Publishing an editor for a condition the app cannot round-trip is how an
14487
- * operator loses a rule's conditions by opening it — so the descriptor, the
14488
- * admin widget and the viewer mirror land together (P2 + P3), and only then
14489
- * does an audio rule become authorable.
14506
+ * operator loses a rule's conditions by opening it — so the viewer mirror
14507
+ * (P3, shipped) went FIRST, and the descriptor an editor renders from
14508
+ * follows here.
14490
14509
  */
14491
14510
  audio: NcAudioConditionSchema.optional()
14492
14511
  });
@@ -14722,6 +14741,30 @@ var NcRuleInputSchema = object({
14722
14741
  */
14723
14742
  snoozeAllowGlobal: boolean().optional(),
14724
14743
  /**
14744
+ * The snooze durations THIS rule's notification offers as buttons, in
14745
+ * minutes.
14746
+ *
14747
+ * Three states, and all three are distinct — which is exactly why this is
14748
+ * `.optional()` and never `.default()`. A Zod default does not run on the
14749
+ * addon cap path (three production failures in one day), so a schema default
14750
+ * would collapse the first two:
14751
+ *
14752
+ * | value | meaning |
14753
+ * | --- | --- |
14754
+ * | absent | the operator never said ⇒ {@link NC_DEFAULT_SNOOZE_MINUTES} |
14755
+ * | `[]` | **no snooze buttons on this rule** — the explicit override |
14756
+ * | a list | these choices, de-duplicated and sorted, at most four |
14757
+ *
14758
+ * `.max(4)` because the notifier's own action budget is small (ntfy allows
14759
+ * three buttons in total) and a rule that spent it all on snooze choices
14760
+ * would push its own tap-through actions off the notification.
14761
+ *
14762
+ * An empty list is NOT an alarm exemption: a rule the alarm is about, or
14763
+ * that arms the panel, is exempt automatically and cannot be silenced by a
14764
+ * window from anywhere (D133).
14765
+ */
14766
+ snoozeOptions: array(number().int().min(1).max(NC_SNOOZE_MAX_MINUTES)).max(4).optional(),
14767
+ /**
14725
14768
  * Devices this rule ACTUATES — arm the alarm, open a gate, turn on a light.
14726
14769
  *
14727
14770
  * This is what makes the rule set the alarm's trigger set without the alarm
@@ -14821,6 +14864,7 @@ var NcConditionDescriptorSchema = object({
14821
14864
  "device",
14822
14865
  "package",
14823
14866
  "occupancy",
14867
+ "audio",
14824
14868
  "system"
14825
14869
  ]),
14826
14870
  label: string(),
@@ -14839,6 +14883,7 @@ var NcConditionDescriptorSchema = object({
14839
14883
  "crossingSelect",
14840
14884
  "polygonDraw",
14841
14885
  "occupancy",
14886
+ "audio",
14842
14887
  "deviceState",
14843
14888
  "systemEvent"
14844
14889
  ]),
@@ -14990,7 +15035,20 @@ var NcSnoozeInputSchema = object({
14990
15035
  ruleId: string().optional(),
14991
15036
  /** Required when `scope: 'device'`. */
14992
15037
  deviceId: number().int().optional(),
14993
- durationMinutes: number().int().min(1).max(1440),
15038
+ /**
15039
+ * Narrow the window to these subject classes — "the cat, not the person".
15040
+ *
15041
+ * ORTHOGONAL to `scope`, deliberately, and absent means EVERY class: that is
15042
+ * what every window authored before this field meant, so no persisted row
15043
+ * changes meaning and no client has to learn anything to keep working.
15044
+ *
15045
+ * It is what makes the window's real key `(deviceId, classes[])` and lets it
15046
+ * cross rules (D133): the operator points at a camera and a kind of thing,
15047
+ * not at whichever of their four rules happened to produce the notification
15048
+ * they are dismissing.
15049
+ */
15050
+ classes: array(string().min(1)).min(1).optional(),
15051
+ durationMinutes: number().int().min(1).max(NC_SNOOZE_MAX_MINUTES),
14994
15052
  /**
14995
15053
  * Silence this for EVERY recipient, not just the caller. Permission is
14996
15054
  * checked server-side (the rule's `snoozeAllowGlobal`, or admin for the
@@ -15015,6 +15073,10 @@ var NcSnoozeSchema = object({
15015
15073
  scope: NcSnoozeScopeSchema,
15016
15074
  ruleId: string().optional(),
15017
15075
  deviceId: number().int().optional(),
15076
+ /** Subject classes this window covers. ABSENT = every class — see
15077
+ * {@link NcSnoozeInputSchema.shape.classes}. Lives in the JSON blob and has
15078
+ * no SQLite column: nothing queries a window by class. */
15079
+ classes: array(string().min(1)).min(1).optional(),
15018
15080
  startedAt: number(),
15019
15081
  /** Exclusive: at exactly this instant the snooze is over. Expiry is a
15020
15082
  * COMPARISON, not a job — no sweeper can leave the operator silenced. */
@@ -23717,13 +23779,24 @@ method(object({
23717
23779
  /** Playback-speed multiplier for the render (1 = realtime). */
23718
23780
  var ExportSpeedSchema = number().min(.25).max(32);
23719
23781
  /**
23720
- * One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
23782
+ * One dense interval, in WALL-CLOCK SECONDS FROM THE EXPORT'S OWN `fromMs`.
23783
+ *
23784
+ * **Wall clock, not ffmpeg's `t`** — and the recorder translates. A caller
23785
+ * derives these bounds from things that happened at a TIME (a track's
23786
+ * `firstSeen`), while `t` runs over the source playlist: the concatenation of
23787
+ * every segment present for the range, with each recording GAP removed. The
23788
+ * two agree only on a window that recorded without one interruption, and only
23789
+ * the render side knows the segments, so the translation lives there
23790
+ * (`export-dense-map.ts`, addon-pipeline).
23791
+ *
23792
+ * It was not always so. These seconds were fed to `between(t,…)` verbatim, and
23793
+ * on a 10 h window holding 29,393 s of footage every range landed late by the
23794
+ * gap accumulated before it — up to 6,607 s, well past EOF. Nothing matched,
23795
+ * the video was a uniform timelapse, and the log line reported the five ranges
23796
+ * that had been ASKED for (2026-08-13, export `57d14363`, camera 615).
23721
23797
  *
23722
- * Relative and not absolute epoch on purpose: the renderer's frame-select
23723
- * expression sees ffmpeg's `t`, which starts at 0 for the export's source
23724
- * playlist. Handing it absolute epochs would make every call site responsible
23725
- * for the same subtraction, and the one that forgot would emit a filter that
23726
- * selects nothing — silently, as a uniform timelapse.
23798
+ * Relative and not absolute epoch, because an absolute epoch would make every
23799
+ * call site responsible for the same subtraction.
23727
23800
  */
23728
23801
  var ExportDenseRangeSchema = object({
23729
23802
  fromSec: number().nonnegative(),
@@ -30576,6 +30649,7 @@ Object.freeze({
30576
30649
  "network-access": "ingress",
30577
30650
  "smtp-provider": "email"
30578
30651
  });
30652
+ new Map(AUDIO_MACRO_LABELS.flatMap((macro) => macro.icon === void 0 ? [] : [[macro.id, macro.icon]]));
30579
30653
  new Set(["devices", "classes"]);
30580
30654
  /**
30581
30655
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
@@ -30853,25 +30927,32 @@ object({
30853
30927
  var NativeLeaseAdmissionSchema = _enum(["all", "inferred"]);
30854
30928
  object({
30855
30929
  /**
30856
- * How long a retained native frame is served before it counts as a miss.
30930
+ * How many delivered frames the worker HOLDS at once, waiting for each one's
30931
+ * detection result.
30857
30932
  *
30858
- * Must cover the FULL late-crop horizon: detection inference + the
30859
- * cross-process inference-result hop to hub post-analysis + tracking + the
30860
- * tRPC crop round-trip back. Below ~500 ms the busiest cameras' subject crops
30861
- * outrun it and fall back to the ≤640 detection frame; above ~3 s the resident
30862
- * RAM per busy camera grows linearly with no measured hit-rate gain.
30933
+ * This replaced a TTL on 2026-08-13, and the replacement is the whole point:
30934
+ * a time window was never related to the event the pixels were waiting for.
30935
+ * A held frame now lives from delivery until the runner has its `FrameResult`
30936
+ * — at which moment the runner cuts the subject tiles it actually wanted and
30937
+ * releases the frame. The bound exists only so a runner that stops answering
30938
+ * cannot pin RAM: above it the OLDEST held frame is dropped and counted.
30939
+ *
30940
+ * Sizing: the steady state is `inferenceLatency × deliveredFps`, measured at
30941
+ * 40-160 ms × ≤25 fps = 1-4 frames. The default leaves headroom for a hiccup
30942
+ * without ever approaching the old resident set (43 frames × 24.9 MB at 4K).
30943
+ * Raising it does not buy hit rate — it buys tolerance for a slow runner, and
30944
+ * `holdOverflow` on the metrics line is what says you need it.
30863
30945
  */
30864
- ttlMs: number().int().min(250).max(1e4),
30946
+ holdFrames: number().int().min(1).max(64),
30865
30947
  /**
30866
30948
  * Hard per-decode-worker RAM ceiling for retained native frames, in MB.
30867
30949
  *
30868
- * Intended as a SAFETY ceiling with the TTL as the effective cap — but check
30869
- * which one is actually binding before reasoning from that. At the shipped
30870
- * 1024 MB and a 2 800 ms TTL, a 4K camera hits the CEILING first (~43 frames
30871
- * at ~24 MB each) and the TTL never gets to expire anything; `leaseMb` /
30872
- * `leaseFrames` on the metrics line say which. When the ceiling binds, a
30873
- * change that admits fewer frames buys retention WINDOW at constant RAM
30874
- * rather than giving RAM back — lower this knob if RAM is what you wanted.
30950
+ * Since 2026-08-13 this is a SAFETY ceiling and nothing else: `holdFrames`
30951
+ * is what decides how much is held, and the ceiling is the number above which
30952
+ * something is wrong. Before that it was the effective cap — at 1024 MB with
30953
+ * a 2 800 ms TTL a 4K camera sat pinned at `leaseMb:1020, leaseFrames:43`
30954
+ * with the TTL expiring nothing, which is exactly the confusion the hold
30955
+ * removes. `leaseMb` / `leaseFrames` still say what is resident.
30875
30956
  * `0` DISABLES the lease entirely and falls the worker back to the tiny
30876
30957
  * leak-prone GPU surface ring (~85% crop miss; that is what the lease exists
30877
30958
  * to replace).
@@ -30897,22 +30978,45 @@ object({
30897
30978
  * there is the signal that some caller names frames outside the inference set
30898
30979
  * and that this must go back to `all`.
30899
30980
  */
30900
- admission: NativeLeaseAdmissionSchema
30981
+ admission: NativeLeaseAdmissionSchema,
30982
+ /**
30983
+ * RAM ceiling per decode worker, in MB, for the SUBJECT TILES — the
30984
+ * compressed native crops the worker cuts at the moment a frame's detection
30985
+ * result arrives, and keeps long after the frame itself is freed.
30986
+ *
30987
+ * This is the knob that replaced the old retention window, and it buys about
30988
+ * three orders of magnitude more of it: a tile is one subject at native
30989
+ * resolution, JPEG-encoded (~60-120 KB on a 4K person), against ~24.9 MB for
30990
+ * the frame it was cut from. A frame on which nothing was detected costs
30991
+ * nothing at all, which is the real change — the old lease paid per FRAME and
30992
+ * was interrogated per SUBJECT.
30993
+ *
30994
+ * `0` DISABLES tiles, leaving only the hold window and the ≤640 RAM
30995
+ * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
30996
+ * reproduce that.
30997
+ */
30998
+ tileBudgetMb: number().int().min(0).max(1024)
30901
30999
  });
30902
31000
  /**
30903
- * The values in force when the operator has set nothing — byte-for-byte the
30904
- * constants the decode worker shipped with as env-var defaults, so making these
30905
- * settings changed no behaviour on the day it landed.
31001
+ * The values in force when the operator has set nothing.
31002
+ *
31003
+ * `budgetMb` stays at 1024 on the day the hold landed, deliberately: it stopped
31004
+ * being the retention window and became the OOM ceiling, and lowering a ceiling
31005
+ * in the same change that redefines it would make a regression and a retune
31006
+ * indistinguishable. Cut it once `tileHits` / `holdOverflow` have been read on
31007
+ * live traffic.
30906
31008
  */
30907
31009
  var DEFAULT_NATIVE_LEASE_SETTINGS = {
30908
- ttlMs: 1200,
31010
+ holdFrames: 8,
30909
31011
  budgetMb: 1024,
30910
31012
  activityMs: 15e3,
31013
+ tileBudgetMb: 64,
30911
31014
  admission: "inferred"
30912
31015
  };
30913
- DEFAULT_NATIVE_LEASE_SETTINGS.ttlMs;
31016
+ DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
30914
31017
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
30915
31018
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
31019
+ DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
30916
31020
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
30917
31021
  //#endregion
30918
31022
  //#region src/adapters/adapter.ts
package/dist/addon.mjs CHANGED
@@ -13063,7 +13063,23 @@ var NotificationActionSchema = object({
13063
13063
  * else — see `notification-center/action-token.ts` for what that does and
13064
13064
  * does not buy.
13065
13065
  */
13066
- destructive: boolean().optional()
13066
+ destructive: boolean().optional(),
13067
+ /**
13068
+ * How the tap should REACH the url.
13069
+ *
13070
+ * `navigate` (absent, and every button authored before this field) opens it:
13071
+ * the phone leaves the notification and shows whatever the callback returns.
13072
+ * That is right for a button whose answer the operator wants to read.
13073
+ *
13074
+ * `background` fires it as a POST and stays put. It exists for the buttons
13075
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
13076
+ * an answer to the notification, and being thrown into a browser tab to
13077
+ * confirm it costs more attention than the notification did. A backend that
13078
+ * cannot do a background call renders it as an ordinary link (the adapters
13079
+ * fall back rather than dropping the button), so this is a preference, never
13080
+ * a requirement.
13081
+ */
13082
+ mode: _enum(["navigate", "background"]).optional()
13067
13083
  });
13068
13084
  /**
13069
13085
  * The canonical notification. `body` is the only hard field (Apprise model).
@@ -14064,6 +14080,9 @@ var NcSystemEventConditionSchema = object({
14064
14080
  nodeIds: array(string().min(1)).min(1).optional(),
14065
14081
  packageNames: array(string().min(1)).min(1).optional()
14066
14082
  });
14083
+ /** Hard ceiling on a window (24h). A snooze that could not expire would be an
14084
+ * outage the operator asked for once and forgot. */
14085
+ var NC_SNOOZE_MAX_MINUTES = 1440;
14067
14086
  /** Weekly schedule — OR of windows; absence on the rule = always active. */
14068
14087
  var NcScheduleSchema = object({
14069
14088
  windows: array(object({
@@ -14440,15 +14459,15 @@ var NcConditionsSchema = object({
14440
14459
  * (an `immediate` rule naming an `audio-*` class, one notification per
14441
14460
  * classified sample) stays exactly as it was for rules that already use it.
14442
14461
  *
14443
- * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
14444
- * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
14445
- * (`camstack/src/data/notification-center.ts`, guarded by
14446
- * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
14462
+ * In {@link NC_CONDITION_CATALOG} since P2, and the ORDER it got there is the
14463
+ * rule rather than an accident: the viewer mirrors the descriptor enums BY
14464
+ * HAND (`camstack/src/data/notification-center.ts`, guarded by
14465
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor strips the
14447
14466
  * condition fields it does not know when a rule is saved from the phone.
14448
14467
  * Publishing an editor for a condition the app cannot round-trip is how an
14449
- * operator loses a rule's conditions by opening it — so the descriptor, the
14450
- * admin widget and the viewer mirror land together (P2 + P3), and only then
14451
- * does an audio rule become authorable.
14468
+ * operator loses a rule's conditions by opening it — so the viewer mirror
14469
+ * (P3, shipped) went FIRST, and the descriptor an editor renders from
14470
+ * follows here.
14452
14471
  */
14453
14472
  audio: NcAudioConditionSchema.optional()
14454
14473
  });
@@ -14684,6 +14703,30 @@ var NcRuleInputSchema = object({
14684
14703
  */
14685
14704
  snoozeAllowGlobal: boolean().optional(),
14686
14705
  /**
14706
+ * The snooze durations THIS rule's notification offers as buttons, in
14707
+ * minutes.
14708
+ *
14709
+ * Three states, and all three are distinct — which is exactly why this is
14710
+ * `.optional()` and never `.default()`. A Zod default does not run on the
14711
+ * addon cap path (three production failures in one day), so a schema default
14712
+ * would collapse the first two:
14713
+ *
14714
+ * | value | meaning |
14715
+ * | --- | --- |
14716
+ * | absent | the operator never said ⇒ {@link NC_DEFAULT_SNOOZE_MINUTES} |
14717
+ * | `[]` | **no snooze buttons on this rule** — the explicit override |
14718
+ * | a list | these choices, de-duplicated and sorted, at most four |
14719
+ *
14720
+ * `.max(4)` because the notifier's own action budget is small (ntfy allows
14721
+ * three buttons in total) and a rule that spent it all on snooze choices
14722
+ * would push its own tap-through actions off the notification.
14723
+ *
14724
+ * An empty list is NOT an alarm exemption: a rule the alarm is about, or
14725
+ * that arms the panel, is exempt automatically and cannot be silenced by a
14726
+ * window from anywhere (D133).
14727
+ */
14728
+ snoozeOptions: array(number().int().min(1).max(NC_SNOOZE_MAX_MINUTES)).max(4).optional(),
14729
+ /**
14687
14730
  * Devices this rule ACTUATES — arm the alarm, open a gate, turn on a light.
14688
14731
  *
14689
14732
  * This is what makes the rule set the alarm's trigger set without the alarm
@@ -14783,6 +14826,7 @@ var NcConditionDescriptorSchema = object({
14783
14826
  "device",
14784
14827
  "package",
14785
14828
  "occupancy",
14829
+ "audio",
14786
14830
  "system"
14787
14831
  ]),
14788
14832
  label: string(),
@@ -14801,6 +14845,7 @@ var NcConditionDescriptorSchema = object({
14801
14845
  "crossingSelect",
14802
14846
  "polygonDraw",
14803
14847
  "occupancy",
14848
+ "audio",
14804
14849
  "deviceState",
14805
14850
  "systemEvent"
14806
14851
  ]),
@@ -14952,7 +14997,20 @@ var NcSnoozeInputSchema = object({
14952
14997
  ruleId: string().optional(),
14953
14998
  /** Required when `scope: 'device'`. */
14954
14999
  deviceId: number().int().optional(),
14955
- durationMinutes: number().int().min(1).max(1440),
15000
+ /**
15001
+ * Narrow the window to these subject classes — "the cat, not the person".
15002
+ *
15003
+ * ORTHOGONAL to `scope`, deliberately, and absent means EVERY class: that is
15004
+ * what every window authored before this field meant, so no persisted row
15005
+ * changes meaning and no client has to learn anything to keep working.
15006
+ *
15007
+ * It is what makes the window's real key `(deviceId, classes[])` and lets it
15008
+ * cross rules (D133): the operator points at a camera and a kind of thing,
15009
+ * not at whichever of their four rules happened to produce the notification
15010
+ * they are dismissing.
15011
+ */
15012
+ classes: array(string().min(1)).min(1).optional(),
15013
+ durationMinutes: number().int().min(1).max(NC_SNOOZE_MAX_MINUTES),
14956
15014
  /**
14957
15015
  * Silence this for EVERY recipient, not just the caller. Permission is
14958
15016
  * checked server-side (the rule's `snoozeAllowGlobal`, or admin for the
@@ -14977,6 +15035,10 @@ var NcSnoozeSchema = object({
14977
15035
  scope: NcSnoozeScopeSchema,
14978
15036
  ruleId: string().optional(),
14979
15037
  deviceId: number().int().optional(),
15038
+ /** Subject classes this window covers. ABSENT = every class — see
15039
+ * {@link NcSnoozeInputSchema.shape.classes}. Lives in the JSON blob and has
15040
+ * no SQLite column: nothing queries a window by class. */
15041
+ classes: array(string().min(1)).min(1).optional(),
14980
15042
  startedAt: number(),
14981
15043
  /** Exclusive: at exactly this instant the snooze is over. Expiry is a
14982
15044
  * COMPARISON, not a job — no sweeper can leave the operator silenced. */
@@ -23679,13 +23741,24 @@ method(object({
23679
23741
  /** Playback-speed multiplier for the render (1 = realtime). */
23680
23742
  var ExportSpeedSchema = number().min(.25).max(32);
23681
23743
  /**
23682
- * One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
23744
+ * One dense interval, in WALL-CLOCK SECONDS FROM THE EXPORT'S OWN `fromMs`.
23745
+ *
23746
+ * **Wall clock, not ffmpeg's `t`** — and the recorder translates. A caller
23747
+ * derives these bounds from things that happened at a TIME (a track's
23748
+ * `firstSeen`), while `t` runs over the source playlist: the concatenation of
23749
+ * every segment present for the range, with each recording GAP removed. The
23750
+ * two agree only on a window that recorded without one interruption, and only
23751
+ * the render side knows the segments, so the translation lives there
23752
+ * (`export-dense-map.ts`, addon-pipeline).
23753
+ *
23754
+ * It was not always so. These seconds were fed to `between(t,…)` verbatim, and
23755
+ * on a 10 h window holding 29,393 s of footage every range landed late by the
23756
+ * gap accumulated before it — up to 6,607 s, well past EOF. Nothing matched,
23757
+ * the video was a uniform timelapse, and the log line reported the five ranges
23758
+ * that had been ASKED for (2026-08-13, export `57d14363`, camera 615).
23683
23759
  *
23684
- * Relative and not absolute epoch on purpose: the renderer's frame-select
23685
- * expression sees ffmpeg's `t`, which starts at 0 for the export's source
23686
- * playlist. Handing it absolute epochs would make every call site responsible
23687
- * for the same subtraction, and the one that forgot would emit a filter that
23688
- * selects nothing — silently, as a uniform timelapse.
23760
+ * Relative and not absolute epoch, because an absolute epoch would make every
23761
+ * call site responsible for the same subtraction.
23689
23762
  */
23690
23763
  var ExportDenseRangeSchema = object({
23691
23764
  fromSec: number().nonnegative(),
@@ -30538,6 +30611,7 @@ Object.freeze({
30538
30611
  "network-access": "ingress",
30539
30612
  "smtp-provider": "email"
30540
30613
  });
30614
+ new Map(AUDIO_MACRO_LABELS.flatMap((macro) => macro.icon === void 0 ? [] : [[macro.id, macro.icon]]));
30541
30615
  new Set(["devices", "classes"]);
30542
30616
  /**
30543
30617
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
@@ -30815,25 +30889,32 @@ object({
30815
30889
  var NativeLeaseAdmissionSchema = _enum(["all", "inferred"]);
30816
30890
  object({
30817
30891
  /**
30818
- * How long a retained native frame is served before it counts as a miss.
30892
+ * How many delivered frames the worker HOLDS at once, waiting for each one's
30893
+ * detection result.
30819
30894
  *
30820
- * Must cover the FULL late-crop horizon: detection inference + the
30821
- * cross-process inference-result hop to hub post-analysis + tracking + the
30822
- * tRPC crop round-trip back. Below ~500 ms the busiest cameras' subject crops
30823
- * outrun it and fall back to the ≤640 detection frame; above ~3 s the resident
30824
- * RAM per busy camera grows linearly with no measured hit-rate gain.
30895
+ * This replaced a TTL on 2026-08-13, and the replacement is the whole point:
30896
+ * a time window was never related to the event the pixels were waiting for.
30897
+ * A held frame now lives from delivery until the runner has its `FrameResult`
30898
+ * — at which moment the runner cuts the subject tiles it actually wanted and
30899
+ * releases the frame. The bound exists only so a runner that stops answering
30900
+ * cannot pin RAM: above it the OLDEST held frame is dropped and counted.
30901
+ *
30902
+ * Sizing: the steady state is `inferenceLatency × deliveredFps`, measured at
30903
+ * 40-160 ms × ≤25 fps = 1-4 frames. The default leaves headroom for a hiccup
30904
+ * without ever approaching the old resident set (43 frames × 24.9 MB at 4K).
30905
+ * Raising it does not buy hit rate — it buys tolerance for a slow runner, and
30906
+ * `holdOverflow` on the metrics line is what says you need it.
30825
30907
  */
30826
- ttlMs: number().int().min(250).max(1e4),
30908
+ holdFrames: number().int().min(1).max(64),
30827
30909
  /**
30828
30910
  * Hard per-decode-worker RAM ceiling for retained native frames, in MB.
30829
30911
  *
30830
- * Intended as a SAFETY ceiling with the TTL as the effective cap — but check
30831
- * which one is actually binding before reasoning from that. At the shipped
30832
- * 1024 MB and a 2 800 ms TTL, a 4K camera hits the CEILING first (~43 frames
30833
- * at ~24 MB each) and the TTL never gets to expire anything; `leaseMb` /
30834
- * `leaseFrames` on the metrics line say which. When the ceiling binds, a
30835
- * change that admits fewer frames buys retention WINDOW at constant RAM
30836
- * rather than giving RAM back — lower this knob if RAM is what you wanted.
30912
+ * Since 2026-08-13 this is a SAFETY ceiling and nothing else: `holdFrames`
30913
+ * is what decides how much is held, and the ceiling is the number above which
30914
+ * something is wrong. Before that it was the effective cap — at 1024 MB with
30915
+ * a 2 800 ms TTL a 4K camera sat pinned at `leaseMb:1020, leaseFrames:43`
30916
+ * with the TTL expiring nothing, which is exactly the confusion the hold
30917
+ * removes. `leaseMb` / `leaseFrames` still say what is resident.
30837
30918
  * `0` DISABLES the lease entirely and falls the worker back to the tiny
30838
30919
  * leak-prone GPU surface ring (~85% crop miss; that is what the lease exists
30839
30920
  * to replace).
@@ -30859,22 +30940,45 @@ object({
30859
30940
  * there is the signal that some caller names frames outside the inference set
30860
30941
  * and that this must go back to `all`.
30861
30942
  */
30862
- admission: NativeLeaseAdmissionSchema
30943
+ admission: NativeLeaseAdmissionSchema,
30944
+ /**
30945
+ * RAM ceiling per decode worker, in MB, for the SUBJECT TILES — the
30946
+ * compressed native crops the worker cuts at the moment a frame's detection
30947
+ * result arrives, and keeps long after the frame itself is freed.
30948
+ *
30949
+ * This is the knob that replaced the old retention window, and it buys about
30950
+ * three orders of magnitude more of it: a tile is one subject at native
30951
+ * resolution, JPEG-encoded (~60-120 KB on a 4K person), against ~24.9 MB for
30952
+ * the frame it was cut from. A frame on which nothing was detected costs
30953
+ * nothing at all, which is the real change — the old lease paid per FRAME and
30954
+ * was interrogated per SUBJECT.
30955
+ *
30956
+ * `0` DISABLES tiles, leaving only the hold window and the ≤640 RAM
30957
+ * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
30958
+ * reproduce that.
30959
+ */
30960
+ tileBudgetMb: number().int().min(0).max(1024)
30863
30961
  });
30864
30962
  /**
30865
- * The values in force when the operator has set nothing — byte-for-byte the
30866
- * constants the decode worker shipped with as env-var defaults, so making these
30867
- * settings changed no behaviour on the day it landed.
30963
+ * The values in force when the operator has set nothing.
30964
+ *
30965
+ * `budgetMb` stays at 1024 on the day the hold landed, deliberately: it stopped
30966
+ * being the retention window and became the OOM ceiling, and lowering a ceiling
30967
+ * in the same change that redefines it would make a regression and a retune
30968
+ * indistinguishable. Cut it once `tileHits` / `holdOverflow` have been read on
30969
+ * live traffic.
30868
30970
  */
30869
30971
  var DEFAULT_NATIVE_LEASE_SETTINGS = {
30870
- ttlMs: 1200,
30972
+ holdFrames: 8,
30871
30973
  budgetMb: 1024,
30872
30974
  activityMs: 15e3,
30975
+ tileBudgetMb: 64,
30873
30976
  admission: "inferred"
30874
30977
  };
30875
- DEFAULT_NATIVE_LEASE_SETTINGS.ttlMs;
30978
+ DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
30876
30979
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
30877
30980
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
30981
+ DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
30878
30982
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
30879
30983
  //#endregion
30880
30984
  //#region src/adapters/adapter.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-ai",
3
- "version": "0.2.18",
3
+ "version": "0.2.20",
4
4
  "description": "AI addon for CamStack — the `llm` collection provider (cloud, LAN, and camstack-managed local llama.cpp profiles) plus the per-node `llm-runtime` managed executor.",
5
5
  "keywords": [
6
6
  "camstack",