@camstack/system 1.2.84 → 1.2.86

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 (60) hide show
  1. package/dist/addon-runner.js +1 -1
  2. package/dist/addon-runner.mjs +1 -1
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +32 -2
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +32 -2
  17. package/dist/builtins/device-manager/device-meta-actions.d.ts +12 -0
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  19. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  20. package/dist/builtins/hub-forwarder/index.js +1 -1
  21. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  23. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  25. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  26. package/dist/builtins/local-network/local-network.addon.js +1 -1
  27. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  28. package/dist/builtins/loki-logging/index.js +1 -1
  29. package/dist/builtins/loki-logging/index.mjs +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  31. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  32. package/dist/builtins/platform-probe/index.js +1 -1
  33. package/dist/builtins/platform-probe/index.mjs +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  35. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  36. package/dist/builtins/snapshot/index.js +66 -11
  37. package/dist/builtins/snapshot/index.mjs +66 -11
  38. package/dist/builtins/snapshot/snapshot.addon.d.ts +39 -3
  39. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  40. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  45. package/dist/builtins/system-config/system-config.addon.js +1 -1
  46. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  47. package/dist/builtins/winston-logging/index.js +1 -1
  48. package/dist/builtins/winston-logging/index.mjs +1 -1
  49. package/dist/{dist-BAwlOEUy.mjs → dist-B90N7AWO.mjs} +575 -34
  50. package/dist/{dist-CQy9KjsL.js → dist-BV5Bug9t.js} +575 -34
  51. package/dist/index.js +73 -16
  52. package/dist/index.mjs +73 -16
  53. package/dist/kernel/addon-installer.d.ts +49 -5
  54. package/dist/kernel/moleculer/event-bus-core.d.ts +47 -1
  55. package/dist/kernel/transport/child-cap-protocol.d.ts +32 -0
  56. package/dist/kernel/transport/hub-cap-forward.d.ts +8 -0
  57. package/dist/kernel/transport/parent-unowned-call.d.ts +19 -0
  58. package/dist/{manifest-python-deps-DG_LLcZF.js → manifest-python-deps-C0zkl1Ae.js} +133 -53
  59. package/dist/{manifest-python-deps-C1DMs1J9.mjs → manifest-python-deps-fWzdEasI.mjs} +133 -53
  60. package/package.json +6 -1
@@ -3710,7 +3710,15 @@ var RecordingConfigSchema = zod.z.object({
3710
3710
  * Each completed/failed run also lands one durable ops-log row on its owning
3711
3711
  * addon surface.
3712
3712
  */
3713
+ /**
3714
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
3715
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
3716
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
3717
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
3718
+ * runs at all.
3719
+ */
3713
3720
  var RelocateJobStateSchema = zod.z.enum([
3721
+ "queued",
3714
3722
  "running",
3715
3723
  "done",
3716
3724
  "failed",
@@ -3745,6 +3753,15 @@ var RelocateFootageInputSchema = zod.z.object({
3745
3753
  /** Limits relocation to the logical profile class. Omit only for the
3746
3754
  * pre-orchestration compatibility path. */
3747
3755
  footageClass: RelocateFootageClassSchema.optional(),
3756
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
3757
+ * is what a whole-disk drain means. The rebalance path always sets it: its
3758
+ * unit is a (camera, profile) pile, not a disk. */
3759
+ deviceId: zod.z.number().int().optional(),
3760
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
3761
+ * Finer than `footageClass`, which cannot separate high from mid — and the
3762
+ * placement plan assigns those two independently, so a rebalance that could
3763
+ * only say "recordings" would move footage the plan never asked to move. */
3764
+ profiles: zod.z.array(zod.z.string()).optional(),
3748
3765
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
3749
3766
  * never allowed to starve live writers. */
3750
3767
  throttleMbps: zod.z.number().min(1).max(1e3).optional()
@@ -12054,6 +12071,13 @@ var MaskGridDimsSchema = zod.z.object({
12054
12071
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
12055
12072
  * this one field keeps the schema additive — a rule still declares exactly
12056
12073
  * one trigger.
12074
+ *
12075
+ * AUDIO rules add no member here, for the reason occupancy added none: the
12076
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
12077
+ * mirror.ts` fails the build on a member the app cannot render) and every
12078
+ * member costs a release train. A sustained-sound rule is therefore an
12079
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
12080
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
12057
12081
  */
12058
12082
  var NcDeliverySchema = zod.z.enum([
12059
12083
  "immediate",
@@ -12068,15 +12092,32 @@ var NcDeliverySchema = zod.z.enum([
12068
12092
  * depend on a provider's raw event name or payload shape.
12069
12093
  */
12070
12094
  var NcSystemEventKindSchema = zod.z.enum([
12071
- "camera-online",
12072
- "camera-offline",
12095
+ "device-online",
12096
+ "device-offline",
12097
+ "device-disabled",
12098
+ "device-enabled",
12073
12099
  "stream-online",
12074
12100
  "stream-offline",
12075
12101
  "node-online",
12076
12102
  "node-offline",
12077
12103
  "addon-update-available",
12078
- "server-update-available"
12104
+ "server-update-available",
12105
+ "alarm-triggered",
12106
+ "alarm-armed",
12107
+ "alarm-disarmed",
12108
+ "camera-online",
12109
+ "camera-offline",
12110
+ "camera-disabled",
12111
+ "camera-enabled"
12079
12112
  ]);
12113
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
12114
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
12115
+ "camera-online",
12116
+ "camera-offline",
12117
+ "camera-disabled",
12118
+ "camera-enabled"
12119
+ ]);
12120
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
12080
12121
  /**
12081
12122
  * One coherent system-event condition. `kinds` is the required opt-in safety
12082
12123
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -12085,6 +12126,18 @@ var NcSystemEventKindSchema = zod.z.enum([
12085
12126
  var NcSystemEventConditionSchema = zod.z.object({
12086
12127
  kinds: zod.z.array(NcSystemEventKindSchema).min(1),
12087
12128
  deviceIds: zod.z.array(zod.z.number().int()).min(1).optional(),
12129
+ /**
12130
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
12131
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
12132
+ * is what a liveness rule means when nobody said otherwise.
12133
+ *
12134
+ * This is where "only my cameras" is expressed, and it lives on the rule for
12135
+ * one reason: the intake cannot know which devices this household cares
12136
+ * about, and a producer-side filter is one no operator can change. Fails
12137
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
12138
+ * does not carry) matches no `deviceTypes` list.
12139
+ */
12140
+ deviceTypes: zod.z.array(zod.z.string().min(1)).min(1).optional(),
12088
12141
  nodeIds: zod.z.array(zod.z.string().min(1)).min(1).optional(),
12089
12142
  packageNames: zod.z.array(zod.z.string().min(1)).min(1).optional()
12090
12143
  });
@@ -12137,6 +12190,47 @@ var NcOccupancyConditionSchema = zod.z.object({
12137
12190
  sustainSeconds: zod.z.number().int().min(0).max(3600).default(15)
12138
12191
  });
12139
12192
  /**
12193
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
12194
+ *
12195
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
12196
+ * reference notifier uses, so an operator moving between them re-uses what
12197
+ * they already know): a rule matches when, over a sampling window of
12198
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
12199
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
12200
+ *
12201
+ * - `dbThreshold` — its level is at or above this many dBFS (see
12202
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
12203
+ * - `labels` — the classifier put at least one of these labels on it.
12204
+ *
12205
+ * Both are OPTIONAL and independent, which is the point of the shape: a
12206
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
12207
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
12208
+ * is given** — a window in which every sample is trivially a hit would fire on
12209
+ * silence, so the engine refuses such a condition rather than notifying on
12210
+ * nothing (the schema cannot express "at least one of" without becoming a
12211
+ * ZodEffects the cap path would have to special-case).
12212
+ *
12213
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
12214
+ * must be FULL before it can match — a window that has been open for two
12215
+ * seconds of its ten is 100% of nothing, and firing on it would make
12216
+ * `samplingSeconds` decorative.
12217
+ *
12218
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
12219
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
12220
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
12221
+ * an operator who typed `dog` mean the same thing.
12222
+ */
12223
+ var NcAudioConditionSchema = zod.z.object({
12224
+ /** Audio macro labels; absent = any sound (level-only rule). */
12225
+ labels: zod.z.array(zod.z.string().min(1)).min(1).optional(),
12226
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
12227
+ dbThreshold: zod.z.number().min(-96).max(0).optional(),
12228
+ /** Percentage of the window's samples that must be hits (1–100). */
12229
+ hitPercent: zod.z.number().int().min(1).max(100).default(60),
12230
+ /** Length of the sampling window in seconds. */
12231
+ samplingSeconds: zod.z.number().int().min(1).max(300).default(10)
12232
+ });
12233
+ /**
12140
12234
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
12141
12235
  *
12142
12236
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -12420,7 +12514,33 @@ var NcConditionsSchema = zod.z.object({
12420
12514
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
12421
12515
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
12422
12516
  */
12423
- occupancy: NcOccupancyConditionSchema.optional()
12517
+ occupancy: NcOccupancyConditionSchema.optional(),
12518
+ /**
12519
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
12520
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
12521
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
12522
+ * a window that is not full yet, neither filter given). See
12523
+ * {@link NcAudioCondition}.
12524
+ *
12525
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
12526
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
12527
+ * a detection, a track or a device event (the same fail-closed pairing
12528
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
12529
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
12530
+ * (an `immediate` rule naming an `audio-*` class, one notification per
12531
+ * classified sample) stays exactly as it was for rules that already use it.
12532
+ *
12533
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
12534
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
12535
+ * (`camstack/src/data/notification-center.ts`, guarded by
12536
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
12537
+ * condition fields it does not know when a rule is saved from the phone.
12538
+ * Publishing an editor for a condition the app cannot round-trip is how an
12539
+ * operator loses a rule's conditions by opening it — so the descriptor, the
12540
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
12541
+ * does an audio rule become authorable.
12542
+ */
12543
+ audio: NcAudioConditionSchema.optional()
12424
12544
  });
12425
12545
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
12426
12546
  var NcRuleTargetSchema = zod.z.object({
@@ -12534,6 +12654,73 @@ var NcThrottleSchema = zod.z.object({
12534
12654
  */
12535
12655
  granularity: NcThrottleGranularitySchema.optional()
12536
12656
  });
12657
+ /**
12658
+ * How long the confirm gate may hold ONE notification, and how big the picture
12659
+ * it judges may be.
12660
+ *
12661
+ * The clamp is the product decision, not a coincidence of the model: p50 was
12662
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
12663
+ * arrives after the visitor has gone is not a notification. 448 px was enough
12664
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
12665
+ * tokens for pixels the model pools away.
12666
+ */
12667
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
12668
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
12669
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
12670
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
12671
+ var NcConfirmExpectSchema = zod.z.object({
12672
+ op: zod.z.enum([
12673
+ ">=",
12674
+ ">",
12675
+ "<=",
12676
+ "<",
12677
+ "=="
12678
+ ]),
12679
+ count: zod.z.number().int().min(0).max(1e3)
12680
+ });
12681
+ /**
12682
+ * AI CONFIRM — a vision model looks at the picture this notification is about
12683
+ * to ship and says whether it agrees with the rule.
12684
+ *
12685
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
12686
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
12687
+ * on the operator's phone is not a verdict about this notification.
12688
+ *
12689
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
12690
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
12691
+ * the default and every fail-open is COUNTED, because a gate that always fails
12692
+ * open looks in the log exactly like a gate that works.
12693
+ *
12694
+ * Every field is `.optional()` rather than relied on as a Zod default at the
12695
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
12696
+ * production failures in one day), so the gate reads absent as the constant
12697
+ * above rather than trusting a parse it may never have seen.
12698
+ */
12699
+ var NcConfirmSchema = zod.z.object({
12700
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
12701
+ * same thing, and both mean "deliver exactly as before". */
12702
+ enabled: zod.z.boolean().default(false),
12703
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
12704
+ profileId: zod.z.string().optional(),
12705
+ /**
12706
+ * The operator's question, in his own words. Absent = a question derived
12707
+ * from the rule (its class and its expectation).
12708
+ *
12709
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
12710
+ * banners, signage and plates as instructions if you let them reach the
12711
+ * prompt — proven live — so the authoritative contract stays in the system
12712
+ * turn and only rule-authored words land here.
12713
+ */
12714
+ prompt: zod.z.string().max(1e3).optional(),
12715
+ /** Fire only when the model's count satisfies this. Absent = the model's
12716
+ * own boolean verdict decides. */
12717
+ expect: NcConfirmExpectSchema.optional(),
12718
+ timeoutMs: zod.z.number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
12719
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
12720
+ onTimeout: zod.z.enum(["fire", "suppress"]).default("fire"),
12721
+ /** Longest edge the judged image is downscaled to before it is sent. */
12722
+ maxImagePx: zod.z.number().int().min(64).max(2048).default(448)
12723
+ });
12537
12724
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
12538
12725
  var NcRuleInputSchema = zod.z.object({
12539
12726
  name: zod.z.string().min(1).max(200),
@@ -12594,7 +12781,13 @@ var NcRuleInputSchema = zod.z.object({
12594
12781
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
12595
12782
  * shape as every other actuation.
12596
12783
  */
12597
- actions: NcRuleActionsSchema.optional()
12784
+ actions: NcRuleActionsSchema.optional(),
12785
+ /**
12786
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
12787
+ * a rule that predates the gate must keep delivering byte-for-byte as it
12788
+ * did, and absent is the only way to say that without a migration.
12789
+ */
12790
+ confirm: NcConfirmSchema.optional()
12598
12791
  });
12599
12792
  /**
12600
12793
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -12605,7 +12798,37 @@ var NcRuleInputSchema = zod.z.object({
12605
12798
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
12606
12799
  * `updateRule` patch.
12607
12800
  */
12608
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: zod.z.array(zod.z.string()).optional() });
12801
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
12802
+ disabledTargetIds: zod.z.array(zod.z.string()).optional(),
12803
+ /**
12804
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
12805
+ *
12806
+ * It makes the key optional to SUPPLY; the parse still materialises the
12807
+ * default when the key is absent. And `NcRuleStore.update` merges with
12808
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
12809
+ * one — which made every partial edit destructive:
12810
+ *
12811
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
12812
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
12813
+ * setEnabled(ruleId, false) → conditions reset to `{}`
12814
+ *
12815
+ * A rule scoped to one camera and one zone silently became a rule that
12816
+ * matches EVERY event on EVERY camera, and lost its `media` policy
12817
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
12818
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
12819
+ * within a minute of a two-field patch.
12820
+ *
12821
+ * So every defaulted field is re-declared here WITHOUT its default. The
12822
+ * inner defaults still apply when the caller DOES send the key — `{}` for
12823
+ * conditions remains a real instruction ("clear them") — and only the
12824
+ * absent key is now genuinely absent.
12825
+ */
12826
+ enabled: zod.z.boolean().optional(),
12827
+ conditions: NcConditionsSchema.optional(),
12828
+ media: NcMediaPolicySchema.optional(),
12829
+ throttle: NcThrottleSchema.optional(),
12830
+ priority: zod.z.number().int().min(1).max(5).optional()
12831
+ });
12609
12832
  /** A persisted rule. */
12610
12833
  var NcRuleSchema = NcRuleInputSchema.extend({
12611
12834
  id: zod.z.string(),
@@ -12906,6 +13129,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
12906
13129
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
12907
13130
  * copy would lie the first time a rule is disabled.
12908
13131
  */
13132
+ /**
13133
+ * Why a device a mode NAMES is nonetheless not armed by it.
13134
+ *
13135
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
13136
+ * per-camera notification switch the Notification Center already owns,
13137
+ * `detection-off` is the device's own detection binding being inactive, and
13138
+ * `offline` is the device manager's liveness. A fourth reason would mean a
13139
+ * fourth authority, and inventing one here is how a panel starts disagreeing
13140
+ * with the switches the operator actually used.
13141
+ */
13142
+ var NcAlarmSkipReasonSchema = zod.z.enum([
13143
+ "muted",
13144
+ "detection-off",
13145
+ "offline"
13146
+ ]);
13147
+ var NcAlarmSkippedDeviceSchema = zod.z.object({
13148
+ deviceId: zod.z.number().int(),
13149
+ reason: NcAlarmSkipReasonSchema
13150
+ });
12909
13151
  var NcAlarmModeCoverageSchema = zod.z.object({
12910
13152
  mode: AlarmArmModeSchema,
12911
13153
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -12913,7 +13155,18 @@ var NcAlarmModeCoverageSchema = zod.z.object({
12913
13155
  /** At least one covering rule has no device scope, so the mode covers all. */
12914
13156
  allDevices: zod.z.boolean(),
12915
13157
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
12916
- deviceIds: zod.z.array(zod.z.number().int())
13158
+ deviceIds: zod.z.array(zod.z.number().int()),
13159
+ /**
13160
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
13161
+ * excludes it.
13162
+ *
13163
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
13164
+ * twelve makes it false in exactly the way nobody notices until an incident.
13165
+ * Defaulted to `[]` so a coverage answer computed before this field existed
13166
+ * still parses as "nothing known to be skipped" rather than failing the whole
13167
+ * alarm tab.
13168
+ */
13169
+ skippedDevices: zod.z.array(NcAlarmSkippedDeviceSchema).default([])
12917
13170
  });
12918
13171
  var NcAlarmConfigSchema = zod.z.object({
12919
13172
  /**
@@ -25014,7 +25267,19 @@ var RecordingManifestSchema = zod.z.object({
25014
25267
  * profiles/subtrees/locations on this node). */
25015
25268
  var RecordingDeviceUsageSchema = zod.z.object({
25016
25269
  deviceId: zod.z.number(),
25017
- usedBytes: zod.z.number()
25270
+ usedBytes: zod.z.number(),
25271
+ /**
25272
+ * Start of this camera's OLDEST indexed segment, across every profile and
25273
+ * location — the "Oldest footage" column in Recordings → Storage, and the
25274
+ * only honest answer to "is retention actually holding?" per camera.
25275
+ *
25276
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
25277
+ * predates this field omits it entirely, and a hub whose types carry the
25278
+ * field must keep validating that older provider's payload: the framework
25279
+ * (types) and the addon ship on different trains, and the addon is usually
25280
+ * the later of the two.
25281
+ */
25282
+ oldestMs: zod.z.number().nullable().optional()
25018
25283
  });
25019
25284
  /** Recording storage usage + capacity for one storage location. */
25020
25285
  var RecordingLocationUsageSchema = zod.z.object({
@@ -25042,6 +25307,57 @@ var RecordingStorageUsageSchema = zod.z.object({
25042
25307
  locations: zod.z.array(RecordingLocationUsageSchema)
25043
25308
  });
25044
25309
  /**
25310
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
25311
+ *
25312
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
25313
+ * is the operator asking for the EXISTING archive to be brought into line with
25314
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
25315
+ * location, run FIFO behind the single-flight mover.
25316
+ *
25317
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
25318
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
25319
+ * (empty on the plan).
25320
+ */
25321
+ var RecordingRebalanceMoveSchema = zod.z.object({
25322
+ deviceId: zod.z.number(),
25323
+ profile: zod.z.string(),
25324
+ fromLocationId: zod.z.string(),
25325
+ toLocationId: zod.z.string(),
25326
+ bytes: zod.z.number(),
25327
+ files: zod.z.number().int()
25328
+ });
25329
+ /** Why a pile that is out of place is staying there. Every refusal is
25330
+ * reported: a rebalance that silently drops a camera reads exactly like one
25331
+ * that had nothing to do. */
25332
+ var RecordingRebalanceSkipReasonSchema = zod.z.enum([
25333
+ "unassigned",
25334
+ "target-not-writable",
25335
+ "below-threshold",
25336
+ "no-headroom"
25337
+ ]);
25338
+ var RecordingRebalanceSkipSchema = zod.z.object({
25339
+ deviceId: zod.z.number(),
25340
+ profile: zod.z.string(),
25341
+ fromLocationId: zod.z.string(),
25342
+ /** The location the plan wants; null when the camera has no assignment. */
25343
+ toLocationId: zod.z.string().nullable(),
25344
+ bytes: zod.z.number(),
25345
+ reason: RecordingRebalanceSkipReasonSchema
25346
+ });
25347
+ var RecordingRebalancePlanSchema = zod.z.object({
25348
+ moves: zod.z.array(RecordingRebalanceMoveSchema),
25349
+ skipped: zod.z.array(RecordingRebalanceSkipSchema),
25350
+ bytesToMove: zod.z.number(),
25351
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
25352
+ jobIds: zod.z.array(zod.z.string())
25353
+ });
25354
+ var RecordingRebalanceInputSchema = zod.z.object({
25355
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
25356
+ throttleMbps: zod.z.number().min(1).max(1e3).optional(),
25357
+ /** Ignore piles smaller than this (default 1 GB). */
25358
+ minMoveGb: zod.z.number().min(0).optional()
25359
+ });
25360
+ /**
25045
25361
  * Result of locating footage at a wall-clock instant for one device/profile.
25046
25362
  * `segment` carries the covering segment's window; `gap` reports the forward
25047
25363
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -25285,6 +25601,36 @@ var recordingCapability = {
25285
25601
  cancelStorageMigrationMove: method(zod.z.object({ jobId: zod.z.string() }), zod.z.object({ cancelled: zod.z.boolean() }), {
25286
25602
  kind: "mutation",
25287
25603
  auth: "admin"
25604
+ }),
25605
+ /**
25606
+ * Move footage between locations — the OPERATOR's mover, scoped to one
25607
+ * camera (and optionally to specific profiles) rather than a whole disk.
25608
+ * Queued FIFO behind the single-flight engine, so arming several is safe.
25609
+ */
25610
+ relocateFootage: method(RelocateFootageInputSchema, zod.z.object({ jobId: zod.z.string() }), {
25611
+ kind: "mutation",
25612
+ auth: "admin"
25613
+ }),
25614
+ /** Every relocate job this recorder knows about, newest first (in RAM: the
25615
+ * move is resumable, so a lost list costs nothing but the display). */
25616
+ listRelocateJobs: method(zod.z.object({}), zod.z.array(RelocateJobSchema).readonly(), {
25617
+ kind: "query",
25618
+ auth: "admin"
25619
+ }),
25620
+ /** Cancel a running or queued relocate job. A queued job never runs. */
25621
+ cancelRelocateJob: method(zod.z.object({ jobId: zod.z.string() }), zod.z.object({ cancelled: zod.z.boolean() }), {
25622
+ kind: "mutation",
25623
+ auth: "admin"
25624
+ }),
25625
+ /** What a rebalance WOULD move, and what it would refuse. Moves nothing. */
25626
+ planStorageRebalance: method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25627
+ kind: "query",
25628
+ auth: "admin"
25629
+ }),
25630
+ /** Arm the rebalance: enqueue one relocate job per planned move. */
25631
+ startStorageRebalance: method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25632
+ kind: "mutation",
25633
+ auth: "admin"
25288
25634
  })
25289
25635
  }
25290
25636
  };
@@ -25305,13 +25651,24 @@ var recordingCapability = {
25305
25651
  /** Playback-speed multiplier for the render (1 = realtime). */
25306
25652
  var ExportSpeedSchema = zod.z.number().min(.25).max(32);
25307
25653
  /**
25308
- * One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
25654
+ * One dense interval, in WALL-CLOCK SECONDS FROM THE EXPORT'S OWN `fromMs`.
25655
+ *
25656
+ * **Wall clock, not ffmpeg's `t`** — and the recorder translates. A caller
25657
+ * derives these bounds from things that happened at a TIME (a track's
25658
+ * `firstSeen`), while `t` runs over the source playlist: the concatenation of
25659
+ * every segment present for the range, with each recording GAP removed. The
25660
+ * two agree only on a window that recorded without one interruption, and only
25661
+ * the render side knows the segments, so the translation lives there
25662
+ * (`export-dense-map.ts`, addon-pipeline).
25309
25663
  *
25310
- * Relative and not absolute epoch on purpose: the renderer's frame-select
25311
- * expression sees ffmpeg's `t`, which starts at 0 for the export's source
25312
- * playlist. Handing it absolute epochs would make every call site responsible
25313
- * for the same subtraction, and the one that forgot would emit a filter that
25314
- * selects nothing silently, as a uniform timelapse.
25664
+ * It was not always so. These seconds were fed to `between(t,…)` verbatim, and
25665
+ * on a 10 h window holding 29,393 s of footage every range landed late by the
25666
+ * gap accumulated before it up to 6,607 s, well past EOF. Nothing matched,
25667
+ * the video was a uniform timelapse, and the log line reported the five ranges
25668
+ * that had been ASKED for (2026-08-13, export `57d14363`, camera 615).
25669
+ *
25670
+ * Relative and not absolute epoch, because an absolute epoch would make every
25671
+ * call site responsible for the same subtraction.
25315
25672
  */
25316
25673
  var ExportDenseRangeSchema = zod.z.object({
25317
25674
  fromSec: zod.z.number().nonnegative(),
@@ -32031,6 +32388,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32031
32388
  addonId: null,
32032
32389
  access: "create"
32033
32390
  },
32391
+ "recording.cancelRelocateJob": {
32392
+ capName: "recording",
32393
+ capScope: "system",
32394
+ addonId: null,
32395
+ access: "create"
32396
+ },
32034
32397
  "recording.cancelStorageMigrationMove": {
32035
32398
  capName: "recording",
32036
32399
  capScope: "system",
@@ -32085,6 +32448,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32085
32448
  addonId: null,
32086
32449
  access: "view"
32087
32450
  },
32451
+ "recording.listRelocateJobs": {
32452
+ capName: "recording",
32453
+ capScope: "system",
32454
+ addonId: null,
32455
+ access: "view"
32456
+ },
32088
32457
  "recording.locateSegment": {
32089
32458
  capName: "recording",
32090
32459
  capScope: "system",
@@ -32097,6 +32466,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32097
32466
  addonId: null,
32098
32467
  access: "create"
32099
32468
  },
32469
+ "recording.planStorageRebalance": {
32470
+ capName: "recording",
32471
+ capScope: "system",
32472
+ addonId: null,
32473
+ access: "view"
32474
+ },
32100
32475
  "recording.pruneFootage": {
32101
32476
  capName: "recording",
32102
32477
  capScope: "system",
@@ -32121,6 +32496,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32121
32496
  addonId: null,
32122
32497
  access: "create"
32123
32498
  },
32499
+ "recording.relocateFootage": {
32500
+ capName: "recording",
32501
+ capScope: "system",
32502
+ addonId: null,
32503
+ access: "create"
32504
+ },
32124
32505
  "recording.renderClip": {
32125
32506
  capName: "recording",
32126
32507
  capScope: "system",
@@ -32157,6 +32538,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32157
32538
  addonId: null,
32158
32539
  access: "create"
32159
32540
  },
32541
+ "recording.startStorageRebalance": {
32542
+ capName: "recording",
32543
+ capScope: "system",
32544
+ addonId: null,
32545
+ access: "create"
32546
+ },
32160
32547
  "recordingExport.cancelExport": {
32161
32548
  capName: "recording-export",
32162
32549
  capScope: "system",
@@ -33571,6 +33958,104 @@ var FramerateField = zod.z.number().int().min(1).max(60);
33571
33958
  var TargetsField = zod.z.array(NcRuleTargetSchema).min(1);
33572
33959
  var PriorityField = zod.z.number().int().min(1).max(5);
33573
33960
  /**
33961
+ * Explicit override of the DENSE sampling cadence, seconds.
33962
+ *
33963
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
33964
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
33965
+ * made that same base 3 s and rendered a person pass as two frames.)
33966
+ *
33967
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
33968
+ * `denseCadenceSec` and played at `framerate` occupies
33969
+ *
33970
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
33971
+ *
33972
+ * so a 7 s pass at 1 s / 12 fps is 0.58 s of video, and at 0.5 s it is 1.17 s.
33973
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
33974
+ * and therefore the length of a quiet night, does not move.
33975
+ *
33976
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
33977
+ * the recording has them returns the same frames, requested twice. Must be
33978
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
33979
+ * a uniform video the operator believes is two-rate — and upsert refuses it
33980
+ * rather than letting the export cap reject the render hours after the window.
33981
+ */
33982
+ var DenseCadenceSecField = zod.z.number().min(.1).max(3600);
33983
+ /**
33984
+ * Minimum seconds of OUTPUT video each detection range must occupy.
33985
+ *
33986
+ * The operator-facing form of the arithmetic above: instead of solving for a
33987
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
33988
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
33989
+ * that range every ~583 ms.
33990
+ *
33991
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
33992
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
33993
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
33994
+ * ranges are sampled denser than they need. Per-range cadences require a cap
33995
+ * schema change and are the tracked follow-up.
33996
+ *
33997
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
33998
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
33999
+ * by real footage, never met by duplicating frames into motion that never
34000
+ * happened.
34001
+ */
34002
+ var MinDwellSecField = zod.z.number().min(0).max(60);
34003
+ /**
34004
+ * Caption burned into the notification's preview frame.
34005
+ *
34006
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
34007
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
34008
+ * templating dialect for one field would be a second thing to explain.
34009
+ *
34010
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
34011
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
34012
+ * the reason this is not `.min(1)`.
34013
+ */
34014
+ var PreviewTextField = zod.z.string().max(200);
34015
+ /**
34016
+ * Whether the notification's preview is a STILL or a short animation.
34017
+ *
34018
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
34019
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
34020
+ * night reads better as three seconds of motion than as one frame of it. Both
34021
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
34022
+ * simply applies it to a dozen frames sampled across the render and assembles
34023
+ * them.
34024
+ *
34025
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
34026
+ * seeks and a palette pass, and no rule that never asked for one should start
34027
+ * paying that on the deploy that shipped it.
34028
+ *
34029
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
34030
+ */
34031
+ var PreviewModeField = zod.z.enum(["image", "gif"]);
34032
+ /**
34033
+ * Which detection classes the notification reports counts for.
34034
+ *
34035
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
34036
+ * plan — no second query — aggregated per class. Absent or empty means "every
34037
+ * class the window actually contained", which is what an operator who never
34038
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
34039
+ * counts cars all night).
34040
+ *
34041
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
34042
+ * …). An unknown name simply never matches and reports nothing — it is not an
34043
+ * error, because a rule may legitimately name a class this camera's model does
34044
+ * not emit.
34045
+ *
34046
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
34047
+ * - `{{detections}}` — total over the reported classes
34048
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
34049
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
34050
+ * one per class, `count_` + the class name
34051
+ *
34052
+ * With NO custom body template the summary is appended to the derived body, and
34053
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
34054
+ * reads. With a custom template the operator owns every word — nothing is
34055
+ * appended, so `{{detectionSummary}}` is how he asks for it.
34056
+ */
34057
+ var ReportClassesField = zod.z.array(zod.z.string().min(1).max(40)).max(20);
34058
+ /**
33574
34059
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
33575
34060
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
33576
34061
  * here (see the ownership note above).
@@ -33590,9 +34075,30 @@ var TimelapseRuleInputSchema = zod.z.object({
33590
34075
  cadenceSec: CadenceSecField.default(15),
33591
34076
  /** Output frames per second of the assembled mp4 (predecessor parity). */
33592
34077
  framerate: FramerateField.default(10),
34078
+ /**
34079
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
34080
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
34081
+ * field gets.
34082
+ */
34083
+ denseCadenceSec: DenseCadenceSecField.optional(),
34084
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
34085
+ minDwellSec: MinDwellSecField.optional(),
33593
34086
  /** `notification-output` targets the finished video/thumbnail is sent to. */
33594
34087
  targets: TargetsField,
33595
34088
  template: TimelapseTemplateSchema.optional(),
34089
+ /**
34090
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
34091
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
34092
+ *
34093
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
34094
+ * the notification's title/body, and clearing it (`template: null`) must not
34095
+ * silently clear the caption too.
34096
+ */
34097
+ previewText: PreviewTextField.optional(),
34098
+ /** Still or animation — see {@link PreviewModeField}. */
34099
+ previewMode: PreviewModeField.default("image"),
34100
+ /** Classes the notification counts — see {@link ReportClassesField}. */
34101
+ reportClasses: ReportClassesField.optional(),
33596
34102
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
33597
34103
  priority: PriorityField.default(3)
33598
34104
  });
@@ -33603,8 +34109,13 @@ zod.z.object({
33603
34109
  schedule: NcScheduleSchema.optional(),
33604
34110
  cadenceSec: CadenceSecField.optional(),
33605
34111
  framerate: FramerateField.optional(),
34112
+ denseCadenceSec: DenseCadenceSecField.optional(),
34113
+ minDwellSec: MinDwellSecField.optional(),
33606
34114
  targets: TargetsField.optional(),
33607
34115
  template: TimelapseTemplateSchema.nullable().optional(),
34116
+ previewText: PreviewTextField.optional(),
34117
+ previewMode: PreviewModeField.optional(),
34118
+ reportClasses: ReportClassesField.optional(),
33608
34119
  priority: PriorityField.optional()
33609
34120
  });
33610
34121
  TimelapseRuleInputSchema.extend({
@@ -33688,25 +34199,32 @@ zod.z.object({
33688
34199
  var NativeLeaseAdmissionSchema = zod.z.enum(["all", "inferred"]);
33689
34200
  zod.z.object({
33690
34201
  /**
33691
- * How long a retained native frame is served before it counts as a miss.
34202
+ * How many delivered frames the worker HOLDS at once, waiting for each one's
34203
+ * detection result.
34204
+ *
34205
+ * This replaced a TTL on 2026-08-13, and the replacement is the whole point:
34206
+ * a time window was never related to the event the pixels were waiting for.
34207
+ * A held frame now lives from delivery until the runner has its `FrameResult`
34208
+ * — at which moment the runner cuts the subject tiles it actually wanted and
34209
+ * releases the frame. The bound exists only so a runner that stops answering
34210
+ * cannot pin RAM: above it the OLDEST held frame is dropped and counted.
33692
34211
  *
33693
- * Must cover the FULL late-crop horizon: detection inference + the
33694
- * cross-process inference-result hop to hub post-analysis + tracking + the
33695
- * tRPC crop round-trip back. Below ~500 ms the busiest cameras' subject crops
33696
- * outrun it and fall back to the ≤640 detection frame; above ~3 s the resident
33697
- * RAM per busy camera grows linearly with no measured hit-rate gain.
34212
+ * Sizing: the steady state is `inferenceLatency × deliveredFps`, measured at
34213
+ * 40-160 ms × ≤25 fps = 1-4 frames. The default leaves headroom for a hiccup
34214
+ * without ever approaching the old resident set (43 frames × 24.9 MB at 4K).
34215
+ * Raising it does not buy hit rate it buys tolerance for a slow runner, and
34216
+ * `holdOverflow` on the metrics line is what says you need it.
33698
34217
  */
33699
- ttlMs: zod.z.number().int().min(250).max(1e4),
34218
+ holdFrames: zod.z.number().int().min(1).max(64),
33700
34219
  /**
33701
34220
  * Hard per-decode-worker RAM ceiling for retained native frames, in MB.
33702
34221
  *
33703
- * Intended as a SAFETY ceiling with the TTL as the effective cap — but check
33704
- * which one is actually binding before reasoning from that. At the shipped
33705
- * 1024 MB and a 2 800 ms TTL, a 4K camera hits the CEILING first (~43 frames
33706
- * at ~24 MB each) and the TTL never gets to expire anything; `leaseMb` /
33707
- * `leaseFrames` on the metrics line say which. When the ceiling binds, a
33708
- * change that admits fewer frames buys retention WINDOW at constant RAM
33709
- * rather than giving RAM back — lower this knob if RAM is what you wanted.
34222
+ * Since 2026-08-13 this is a SAFETY ceiling and nothing else: `holdFrames`
34223
+ * is what decides how much is held, and the ceiling is the number above which
34224
+ * something is wrong. Before that it was the effective cap at 1024 MB with
34225
+ * a 2 800 ms TTL a 4K camera sat pinned at `leaseMb:1020, leaseFrames:43`
34226
+ * with the TTL expiring nothing, which is exactly the confusion the hold
34227
+ * removes. `leaseMb` / `leaseFrames` still say what is resident.
33710
34228
  * `0` DISABLES the lease entirely and falls the worker back to the tiny
33711
34229
  * leak-prone GPU surface ring (~85% crop miss; that is what the lease exists
33712
34230
  * to replace).
@@ -33732,22 +34250,45 @@ zod.z.object({
33732
34250
  * there is the signal that some caller names frames outside the inference set
33733
34251
  * and that this must go back to `all`.
33734
34252
  */
33735
- admission: NativeLeaseAdmissionSchema
34253
+ admission: NativeLeaseAdmissionSchema,
34254
+ /**
34255
+ * RAM ceiling per decode worker, in MB, for the SUBJECT TILES — the
34256
+ * compressed native crops the worker cuts at the moment a frame's detection
34257
+ * result arrives, and keeps long after the frame itself is freed.
34258
+ *
34259
+ * This is the knob that replaced the old retention window, and it buys about
34260
+ * three orders of magnitude more of it: a tile is one subject at native
34261
+ * resolution, JPEG-encoded (~60-120 KB on a 4K person), against ~24.9 MB for
34262
+ * the frame it was cut from. A frame on which nothing was detected costs
34263
+ * nothing at all, which is the real change — the old lease paid per FRAME and
34264
+ * was interrogated per SUBJECT.
34265
+ *
34266
+ * `0` DISABLES tiles, leaving only the hold window and the ≤640 RAM
34267
+ * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
34268
+ * reproduce that.
34269
+ */
34270
+ tileBudgetMb: zod.z.number().int().min(0).max(1024)
33736
34271
  });
33737
34272
  /**
33738
- * The values in force when the operator has set nothing — byte-for-byte the
33739
- * constants the decode worker shipped with as env-var defaults, so making these
33740
- * settings changed no behaviour on the day it landed.
34273
+ * The values in force when the operator has set nothing.
34274
+ *
34275
+ * `budgetMb` stays at 1024 on the day the hold landed, deliberately: it stopped
34276
+ * being the retention window and became the OOM ceiling, and lowering a ceiling
34277
+ * in the same change that redefines it would make a regression and a retune
34278
+ * indistinguishable. Cut it once `tileHits` / `holdOverflow` have been read on
34279
+ * live traffic.
33741
34280
  */
33742
34281
  var DEFAULT_NATIVE_LEASE_SETTINGS = {
33743
- ttlMs: 1200,
34282
+ holdFrames: 8,
33744
34283
  budgetMb: 1024,
33745
34284
  activityMs: 15e3,
34285
+ tileBudgetMb: 64,
33746
34286
  admission: "inferred"
33747
34287
  };
33748
- DEFAULT_NATIVE_LEASE_SETTINGS.ttlMs;
34288
+ DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
33749
34289
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
33750
34290
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
34291
+ DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
33751
34292
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
33752
34293
  /**
33753
34294
  * The addon id as the REGISTRY, the wire and the durable stores spell it.