@camstack/addon-model-studio 1.1.19 → 1.1.21

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 (19) hide show
  1. package/dist/{MotionZonesSettings-q2DHJUhF.mjs → MotionZonesSettings-vLmqEjTu.mjs} +1 -1
  2. package/dist/PrivacyMaskSettings-DW8pV0rs.mjs +368 -0
  3. package/dist/_stub.js +14 -33
  4. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-BJpX0GrT.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-BD7O4C0O.mjs} +4 -4
  5. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-COqVsV64.mjs +26 -0
  6. package/dist/{hostInit-CKMIvqcK.mjs → hostInit-D7rXC_4j.mjs} +3 -3
  7. package/dist/model-studio.addon.js +686 -42
  8. package/dist/model-studio.addon.mjs +686 -42
  9. package/dist/{player-overlays-RlufPcFT.mjs → player-overlays-BHBGqRYR.mjs} +1 -1
  10. package/dist/remoteEntry.js +1 -1
  11. package/dist/{trash-2-D4UCvyvL.mjs → trash-2-D3Mohghw.mjs} +21 -4
  12. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-Ci4VG-wO.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-BKbceXPH.mjs} +1 -1
  13. package/package.json +1 -1
  14. package/dist/PrivacyMaskSettings-BlogYb0t.mjs +0 -290
  15. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CceEEAzo.mjs +0 -26
  16. package/python/__pycache__/convert.cpython-314.pyc +0 -0
  17. package/python/__pycache__/convert_lib.cpython-312.pyc +0 -0
  18. package/python/__pycache__/convert_lib.cpython-314.pyc +0 -0
  19. package/python/__tests__/__pycache__/test_convert_lib.cpython-314.pyc +0 -0
@@ -7316,8 +7316,31 @@ var AdoptionJobSchema = object({
7316
7316
  error: string().nullable()
7317
7317
  });
7318
7318
  /**
7319
- * Per-camera FUNCTION SWITCHES — the one coherent on/off surface over the
7320
- * pipeline functions an operator thinks in terms of.
7319
+ * Per-camera FUNCTION SWITCHES.
7320
+ *
7321
+ * ## The aggregate group is being withdrawn — the BADGE is not (D113)
7322
+ *
7323
+ * This file shipped as "the one coherent on/off surface over the pipeline
7324
+ * functions an operator thinks in terms of". The operator's verdict on
7325
+ * 2026-08-12 was that the coherent surface bought complexity and no clarity:
7326
+ * every function already had a settings page of its own, and a second place to
7327
+ * turn it off is a second place to look. Each switch is going back to its own
7328
+ * component's original options — detection to the detection-pipeline wrapper
7329
+ * binding, audio analysis to its own, recording to `RecordingConfig.enabled`
7330
+ * (which was always first-class; the switch was a veneer over
7331
+ * `recording.setDeviceConfig`), notifications to a notification-center
7332
+ * per-device setting, the two camera planes to their own components.
7333
+ *
7334
+ * What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
7335
+ * thing that lets a status surface say DISABLED instead of BROKEN, recomposed
7336
+ * straight from the authorities with no group in the middle. That rule was
7337
+ * never about a control panel.
7338
+ *
7339
+ * Everything else here — {@link CAMERA_SWITCH_CATALOG}, {@link CameraSwitch},
7340
+ * {@link deriveCameraSwitches}, the `pipelineOrchestrator.getCameraSwitches` /
7341
+ * `setCameraSwitch` pair — is a COMPATIBILITY surface for as long as deployed
7342
+ * viewers (v1.0.305) and the admin UI still call it. It is deleted when they
7343
+ * stop; nothing new may be built on it.
7321
7344
  *
7322
7345
  * ## This file adds no state
7323
7346
  *
@@ -7668,7 +7691,15 @@ var RecordingConfigSchema = object({
7668
7691
  * Each completed/failed run also lands one durable ops-log row on its owning
7669
7692
  * addon surface.
7670
7693
  */
7694
+ /**
7695
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
7696
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
7697
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
7698
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
7699
+ * runs at all.
7700
+ */
7671
7701
  var RelocateJobStateSchema = _enum([
7702
+ "queued",
7672
7703
  "running",
7673
7704
  "done",
7674
7705
  "failed",
@@ -7703,6 +7734,15 @@ var RelocateFootageInputSchema = object({
7703
7734
  /** Limits relocation to the logical profile class. Omit only for the
7704
7735
  * pre-orchestration compatibility path. */
7705
7736
  footageClass: RelocateFootageClassSchema.optional(),
7737
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
7738
+ * is what a whole-disk drain means. The rebalance path always sets it: its
7739
+ * unit is a (camera, profile) pile, not a disk. */
7740
+ deviceId: number().int().optional(),
7741
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
7742
+ * Finer than `footageClass`, which cannot separate high from mid — and the
7743
+ * placement plan assigns those two independently, so a rebalance that could
7744
+ * only say "recordings" would move footage the plan never asked to move. */
7745
+ profiles: array(string()).optional(),
7706
7746
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7707
7747
  * never allowed to starve live writers. */
7708
7748
  throttleMbps: number().min(1).max(1e3).optional()
@@ -7838,6 +7878,21 @@ var StorageLocationSchema = object({
7838
7878
  nodeId: string().optional(),
7839
7879
  isDefault: boolean().default(false),
7840
7880
  isSystem: boolean().default(false),
7881
+ /**
7882
+ * Operator opt-in: whether consumers that BALANCE across several locations
7883
+ * of a type may write here. Recordings reads it today; event media and
7884
+ * backups are the next consumers, which is why the flag lives on the
7885
+ * location rather than in any one addon's store — nothing has to be
7886
+ * extended to add the next consumer.
7887
+ *
7888
+ * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
7889
+ * flag existed reads back with no flag and keeps working exactly as before;
7890
+ * that is the whole compat story, and it is why no migration ships with it.
7891
+ * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
7892
+ * disk must not silently start writing to it); the default of a type is
7893
+ * always stamped `true`.
7894
+ */
7895
+ enabled: boolean().optional(),
7841
7896
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
7842
7897
  * for node-local locations it can reach) — never persisted, absent when the
7843
7898
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -12175,7 +12230,8 @@ method(object({
12175
12230
  }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12176
12231
  /**
12177
12232
  * filesystem-browse — per-node capability for browsing the node's local
12178
- * filesystem, sandboxed to operator-configured allowed roots. Used by the
12233
+ * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12234
+ * are sandboxed to operator-configured allowed roots (D115). Used by the
12179
12235
  * admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
12180
12236
  * (one provider per node); the hub calls it with `{nodeId}` so the codegen
12181
12237
  * routes to that exact node (default `nodeIdMode:'routing'`).
@@ -13994,6 +14050,13 @@ var MaskGridDimsSchema = object({
13994
14050
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
13995
14051
  * this one field keeps the schema additive — a rule still declares exactly
13996
14052
  * one trigger.
14053
+ *
14054
+ * AUDIO rules add no member here, for the reason occupancy added none: the
14055
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
14056
+ * mirror.ts` fails the build on a member the app cannot render) and every
14057
+ * member costs a release train. A sustained-sound rule is therefore an
14058
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
14059
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
13997
14060
  */
13998
14061
  var NcDeliverySchema = _enum([
13999
14062
  "immediate",
@@ -14008,15 +14071,32 @@ var NcDeliverySchema = _enum([
14008
14071
  * depend on a provider's raw event name or payload shape.
14009
14072
  */
14010
14073
  var NcSystemEventKindSchema = _enum([
14011
- "camera-online",
14012
- "camera-offline",
14074
+ "device-online",
14075
+ "device-offline",
14076
+ "device-disabled",
14077
+ "device-enabled",
14013
14078
  "stream-online",
14014
14079
  "stream-offline",
14015
14080
  "node-online",
14016
14081
  "node-offline",
14017
14082
  "addon-update-available",
14018
- "server-update-available"
14083
+ "server-update-available",
14084
+ "alarm-triggered",
14085
+ "alarm-armed",
14086
+ "alarm-disarmed",
14087
+ "camera-online",
14088
+ "camera-offline",
14089
+ "camera-disabled",
14090
+ "camera-enabled"
14091
+ ]);
14092
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
14093
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
14094
+ "camera-online",
14095
+ "camera-offline",
14096
+ "camera-disabled",
14097
+ "camera-enabled"
14019
14098
  ]);
14099
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
14020
14100
  /**
14021
14101
  * One coherent system-event condition. `kinds` is the required opt-in safety
14022
14102
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -14025,6 +14105,18 @@ var NcSystemEventKindSchema = _enum([
14025
14105
  var NcSystemEventConditionSchema = object({
14026
14106
  kinds: array(NcSystemEventKindSchema).min(1),
14027
14107
  deviceIds: array(number().int()).min(1).optional(),
14108
+ /**
14109
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
14110
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
14111
+ * is what a liveness rule means when nobody said otherwise.
14112
+ *
14113
+ * This is where "only my cameras" is expressed, and it lives on the rule for
14114
+ * one reason: the intake cannot know which devices this household cares
14115
+ * about, and a producer-side filter is one no operator can change. Fails
14116
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
14117
+ * does not carry) matches no `deviceTypes` list.
14118
+ */
14119
+ deviceTypes: array(string().min(1)).min(1).optional(),
14028
14120
  nodeIds: array(string().min(1)).min(1).optional(),
14029
14121
  packageNames: array(string().min(1)).min(1).optional()
14030
14122
  });
@@ -14075,6 +14167,47 @@ var NcOccupancyConditionSchema = object({
14075
14167
  sustainSeconds: number().int().min(0).max(3600).default(15)
14076
14168
  });
14077
14169
  /**
14170
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
14171
+ *
14172
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
14173
+ * reference notifier uses, so an operator moving between them re-uses what
14174
+ * they already know): a rule matches when, over a sampling window of
14175
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14176
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14177
+ *
14178
+ * - `dbThreshold` — its level is at or above this many dBFS (see
14179
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14180
+ * - `labels` — the classifier put at least one of these labels on it.
14181
+ *
14182
+ * Both are OPTIONAL and independent, which is the point of the shape: a
14183
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
14184
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14185
+ * is given** — a window in which every sample is trivially a hit would fire on
14186
+ * silence, so the engine refuses such a condition rather than notifying on
14187
+ * nothing (the schema cannot express "at least one of" without becoming a
14188
+ * ZodEffects the cap path would have to special-case).
14189
+ *
14190
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
14191
+ * must be FULL before it can match — a window that has been open for two
14192
+ * seconds of its ten is 100% of nothing, and firing on it would make
14193
+ * `samplingSeconds` decorative.
14194
+ *
14195
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
14196
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
14197
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
14198
+ * an operator who typed `dog` mean the same thing.
14199
+ */
14200
+ var NcAudioConditionSchema = object({
14201
+ /** Audio macro labels; absent = any sound (level-only rule). */
14202
+ labels: array(string().min(1)).min(1).optional(),
14203
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
14204
+ dbThreshold: number().min(-96).max(0).optional(),
14205
+ /** Percentage of the window's samples that must be hits (1–100). */
14206
+ hitPercent: number().int().min(1).max(100).default(60),
14207
+ /** Length of the sampling window in seconds. */
14208
+ samplingSeconds: number().int().min(1).max(300).default(10)
14209
+ });
14210
+ /**
14078
14211
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
14079
14212
  *
14080
14213
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -14347,7 +14480,33 @@ var NcConditionsSchema = object({
14347
14480
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
14348
14481
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
14349
14482
  */
14350
- occupancy: NcOccupancyConditionSchema.optional()
14483
+ occupancy: NcOccupancyConditionSchema.optional(),
14484
+ /**
14485
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
14486
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
14487
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
14488
+ * a window that is not full yet, neither filter given). See
14489
+ * {@link NcAudioCondition}.
14490
+ *
14491
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
14492
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
14493
+ * a detection, a track or a device event (the same fail-closed pairing
14494
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
14495
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
14496
+ * (an `immediate` rule naming an `audio-*` class, one notification per
14497
+ * classified sample) stays exactly as it was for rules that already use it.
14498
+ *
14499
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
14500
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
14501
+ * (`camstack/src/data/notification-center.ts`, guarded by
14502
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
14503
+ * condition fields it does not know when a rule is saved from the phone.
14504
+ * Publishing an editor for a condition the app cannot round-trip is how an
14505
+ * operator loses a rule's conditions by opening it — so the descriptor, the
14506
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
14507
+ * does an audio rule become authorable.
14508
+ */
14509
+ audio: NcAudioConditionSchema.optional()
14351
14510
  });
14352
14511
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
14353
14512
  var NcRuleTargetSchema = object({
@@ -14461,6 +14620,73 @@ var NcThrottleSchema = object({
14461
14620
  */
14462
14621
  granularity: NcThrottleGranularitySchema.optional()
14463
14622
  });
14623
+ /**
14624
+ * How long the confirm gate may hold ONE notification, and how big the picture
14625
+ * it judges may be.
14626
+ *
14627
+ * The clamp is the product decision, not a coincidence of the model: p50 was
14628
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
14629
+ * arrives after the visitor has gone is not a notification. 448 px was enough
14630
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
14631
+ * tokens for pixels the model pools away.
14632
+ */
14633
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
14634
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
14635
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
14636
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
14637
+ var NcConfirmExpectSchema = object({
14638
+ op: _enum([
14639
+ ">=",
14640
+ ">",
14641
+ "<=",
14642
+ "<",
14643
+ "=="
14644
+ ]),
14645
+ count: number().int().min(0).max(1e3)
14646
+ });
14647
+ /**
14648
+ * AI CONFIRM — a vision model looks at the picture this notification is about
14649
+ * to ship and says whether it agrees with the rule.
14650
+ *
14651
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
14652
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
14653
+ * on the operator's phone is not a verdict about this notification.
14654
+ *
14655
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
14656
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
14657
+ * the default and every fail-open is COUNTED, because a gate that always fails
14658
+ * open looks in the log exactly like a gate that works.
14659
+ *
14660
+ * Every field is `.optional()` rather than relied on as a Zod default at the
14661
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
14662
+ * production failures in one day), so the gate reads absent as the constant
14663
+ * above rather than trusting a parse it may never have seen.
14664
+ */
14665
+ var NcConfirmSchema = object({
14666
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
14667
+ * same thing, and both mean "deliver exactly as before". */
14668
+ enabled: boolean().default(false),
14669
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
14670
+ profileId: string().optional(),
14671
+ /**
14672
+ * The operator's question, in his own words. Absent = a question derived
14673
+ * from the rule (its class and its expectation).
14674
+ *
14675
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
14676
+ * banners, signage and plates as instructions if you let them reach the
14677
+ * prompt — proven live — so the authoritative contract stays in the system
14678
+ * turn and only rule-authored words land here.
14679
+ */
14680
+ prompt: string().max(1e3).optional(),
14681
+ /** Fire only when the model's count satisfies this. Absent = the model's
14682
+ * own boolean verdict decides. */
14683
+ expect: NcConfirmExpectSchema.optional(),
14684
+ timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
14685
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
14686
+ onTimeout: _enum(["fire", "suppress"]).default("fire"),
14687
+ /** Longest edge the judged image is downscaled to before it is sent. */
14688
+ maxImagePx: number().int().min(64).max(2048).default(448)
14689
+ });
14464
14690
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
14465
14691
  var NcRuleInputSchema = object({
14466
14692
  name: string().min(1).max(200),
@@ -14521,7 +14747,13 @@ var NcRuleInputSchema = object({
14521
14747
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
14522
14748
  * shape as every other actuation.
14523
14749
  */
14524
- actions: NcRuleActionsSchema.optional()
14750
+ actions: NcRuleActionsSchema.optional(),
14751
+ /**
14752
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
14753
+ * a rule that predates the gate must keep delivering byte-for-byte as it
14754
+ * did, and absent is the only way to say that without a migration.
14755
+ */
14756
+ confirm: NcConfirmSchema.optional()
14525
14757
  });
14526
14758
  /**
14527
14759
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -14532,7 +14764,37 @@ var NcRuleInputSchema = object({
14532
14764
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
14533
14765
  * `updateRule` patch.
14534
14766
  */
14535
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
14767
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
14768
+ disabledTargetIds: array(string()).optional(),
14769
+ /**
14770
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
14771
+ *
14772
+ * It makes the key optional to SUPPLY; the parse still materialises the
14773
+ * default when the key is absent. And `NcRuleStore.update` merges with
14774
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
14775
+ * one — which made every partial edit destructive:
14776
+ *
14777
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
14778
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
14779
+ * setEnabled(ruleId, false) → conditions reset to `{}`
14780
+ *
14781
+ * A rule scoped to one camera and one zone silently became a rule that
14782
+ * matches EVERY event on EVERY camera, and lost its `media` policy
14783
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
14784
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
14785
+ * within a minute of a two-field patch.
14786
+ *
14787
+ * So every defaulted field is re-declared here WITHOUT its default. The
14788
+ * inner defaults still apply when the caller DOES send the key — `{}` for
14789
+ * conditions remains a real instruction ("clear them") — and only the
14790
+ * absent key is now genuinely absent.
14791
+ */
14792
+ enabled: boolean().optional(),
14793
+ conditions: NcConditionsSchema.optional(),
14794
+ media: NcMediaPolicySchema.optional(),
14795
+ throttle: NcThrottleSchema.optional(),
14796
+ priority: number().int().min(1).max(5).optional()
14797
+ });
14536
14798
  /** A persisted rule. */
14537
14799
  var NcRuleSchema = NcRuleInputSchema.extend({
14538
14800
  id: string(),
@@ -14833,6 +15095,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
14833
15095
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
14834
15096
  * copy would lie the first time a rule is disabled.
14835
15097
  */
15098
+ /**
15099
+ * Why a device a mode NAMES is nonetheless not armed by it.
15100
+ *
15101
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
15102
+ * per-camera notification switch the Notification Center already owns,
15103
+ * `detection-off` is the device's own detection binding being inactive, and
15104
+ * `offline` is the device manager's liveness. A fourth reason would mean a
15105
+ * fourth authority, and inventing one here is how a panel starts disagreeing
15106
+ * with the switches the operator actually used.
15107
+ */
15108
+ var NcAlarmSkipReasonSchema = _enum([
15109
+ "muted",
15110
+ "detection-off",
15111
+ "offline"
15112
+ ]);
15113
+ var NcAlarmSkippedDeviceSchema = object({
15114
+ deviceId: number().int(),
15115
+ reason: NcAlarmSkipReasonSchema
15116
+ });
14836
15117
  var NcAlarmModeCoverageSchema = object({
14837
15118
  mode: AlarmArmModeSchema,
14838
15119
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -14840,7 +15121,18 @@ var NcAlarmModeCoverageSchema = object({
14840
15121
  /** At least one covering rule has no device scope, so the mode covers all. */
14841
15122
  allDevices: boolean(),
14842
15123
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
14843
- deviceIds: array(number().int())
15124
+ deviceIds: array(number().int()),
15125
+ /**
15126
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
15127
+ * excludes it.
15128
+ *
15129
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
15130
+ * twelve makes it false in exactly the way nobody notices until an incident.
15131
+ * Defaulted to `[]` so a coverage answer computed before this field existed
15132
+ * still parses as "nothing known to be skipped" rather than failing the whole
15133
+ * alarm tab.
15134
+ */
15135
+ skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
14844
15136
  });
14845
15137
  var NcAlarmConfigSchema = object({
14846
15138
  /**
@@ -17639,9 +17931,16 @@ var CameraStatusSchema = object({
17639
17931
  audio: CameraAudioStatusSchema.nullable(),
17640
17932
  recording: CameraRecordingStatusSchema.nullable(),
17641
17933
  /**
17642
- * Per-camera function switches an OPERATOR has turned off
17934
+ * Per-camera functions an OPERATOR has turned off
17643
17935
  * ([D61](../../../../docs/decisions/adr-0067.md)).
17644
17936
  *
17937
+ * Composed from the AUTHORITIES themselves — the wrapper bindings,
17938
+ * `RecordingConfig.enabled`, the notification mute, the broker's audio
17939
+ * policy, the camera's own microphone — via `composeSwitchedOff`, not from
17940
+ * the deprecated `getCameraSwitches` group ([D113](../../../../docs/decisions/adr-0113.md)).
17941
+ * The badge outlives the control panel: the panel was a convenience, this is
17942
+ * the difference between a camera being off and a camera being dead.
17943
+ *
17645
17944
  * This is the difference between DISABLED and BROKEN. A camera whose
17646
17945
  * `detection` block reports zero fps and whose `switchedOff` contains
17647
17946
  * `'object-detection'` was switched off by a person; the same camera with an
@@ -23150,7 +23449,19 @@ var RecordingManifestSchema = object({
23150
23449
  * profiles/subtrees/locations on this node). */
23151
23450
  var RecordingDeviceUsageSchema = object({
23152
23451
  deviceId: number(),
23153
- usedBytes: number()
23452
+ usedBytes: number(),
23453
+ /**
23454
+ * Start of this camera's OLDEST indexed segment, across every profile and
23455
+ * location — the "Oldest footage" column in Recordings → Storage, and the
23456
+ * only honest answer to "is retention actually holding?" per camera.
23457
+ *
23458
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
23459
+ * predates this field omits it entirely, and a hub whose types carry the
23460
+ * field must keep validating that older provider's payload: the framework
23461
+ * (types) and the addon ship on different trains, and the addon is usually
23462
+ * the later of the two.
23463
+ */
23464
+ oldestMs: number().nullable().optional()
23154
23465
  });
23155
23466
  /** Recording storage usage + capacity for one storage location. */
23156
23467
  var RecordingLocationUsageSchema = object({
@@ -23178,6 +23489,57 @@ var RecordingStorageUsageSchema = object({
23178
23489
  locations: array(RecordingLocationUsageSchema)
23179
23490
  });
23180
23491
  /**
23492
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
23493
+ *
23494
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
23495
+ * is the operator asking for the EXISTING archive to be brought into line with
23496
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
23497
+ * location, run FIFO behind the single-flight mover.
23498
+ *
23499
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
23500
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
23501
+ * (empty on the plan).
23502
+ */
23503
+ var RecordingRebalanceMoveSchema = object({
23504
+ deviceId: number(),
23505
+ profile: string(),
23506
+ fromLocationId: string(),
23507
+ toLocationId: string(),
23508
+ bytes: number(),
23509
+ files: number().int()
23510
+ });
23511
+ /** Why a pile that is out of place is staying there. Every refusal is
23512
+ * reported: a rebalance that silently drops a camera reads exactly like one
23513
+ * that had nothing to do. */
23514
+ var RecordingRebalanceSkipReasonSchema = _enum([
23515
+ "unassigned",
23516
+ "target-not-writable",
23517
+ "below-threshold",
23518
+ "no-headroom"
23519
+ ]);
23520
+ var RecordingRebalanceSkipSchema = object({
23521
+ deviceId: number(),
23522
+ profile: string(),
23523
+ fromLocationId: string(),
23524
+ /** The location the plan wants; null when the camera has no assignment. */
23525
+ toLocationId: string().nullable(),
23526
+ bytes: number(),
23527
+ reason: RecordingRebalanceSkipReasonSchema
23528
+ });
23529
+ var RecordingRebalancePlanSchema = object({
23530
+ moves: array(RecordingRebalanceMoveSchema),
23531
+ skipped: array(RecordingRebalanceSkipSchema),
23532
+ bytesToMove: number(),
23533
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
23534
+ jobIds: array(string())
23535
+ });
23536
+ var RecordingRebalanceInputSchema = object({
23537
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
23538
+ throttleMbps: number().min(1).max(1e3).optional(),
23539
+ /** Ignore piles smaller than this (default 1 GB). */
23540
+ minMoveGb: number().min(0).optional()
23541
+ });
23542
+ /**
23181
23543
  * Result of locating footage at a wall-clock instant for one device/profile.
23182
23544
  * `segment` carries the covering segment's window; `gap` reports the forward
23183
23545
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -23340,9 +23702,24 @@ method(object({
23340
23702
  }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
23341
23703
  kind: "mutation",
23342
23704
  auth: "admin"
23705
+ }), method(RelocateFootageInputSchema, object({ jobId: string() }), {
23706
+ kind: "mutation",
23707
+ auth: "admin"
23708
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
23709
+ kind: "query",
23710
+ auth: "admin"
23711
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
23712
+ kind: "mutation",
23713
+ auth: "admin"
23714
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
23715
+ kind: "query",
23716
+ auth: "admin"
23717
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
23718
+ kind: "mutation",
23719
+ auth: "admin"
23343
23720
  });
23344
23721
  /**
23345
- * `recordingExport` cap — render a footage time range into a single downloadable
23722
+ * `recording-export` cap — render a footage time range into a single downloadable
23346
23723
  * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
23347
23724
  * bounded lifetime with a durable history, auto-expiry, and optional
23348
23725
  * delete-after-download.
@@ -23357,10 +23734,53 @@ method(object({
23357
23734
  */
23358
23735
  /** Playback-speed multiplier for the render (1 = realtime). */
23359
23736
  var ExportSpeedSchema = number().min(.25).max(32);
23737
+ /**
23738
+ * One dense interval, in WALL-CLOCK SECONDS FROM THE EXPORT'S OWN `fromMs`.
23739
+ *
23740
+ * **Wall clock, not ffmpeg's `t`** — and the recorder translates. A caller
23741
+ * derives these bounds from things that happened at a TIME (a track's
23742
+ * `firstSeen`), while `t` runs over the source playlist: the concatenation of
23743
+ * every segment present for the range, with each recording GAP removed. The
23744
+ * two agree only on a window that recorded without one interruption, and only
23745
+ * the render side knows the segments, so the translation lives there
23746
+ * (`export-dense-map.ts`, addon-pipeline).
23747
+ *
23748
+ * It was not always so. These seconds were fed to `between(t,…)` verbatim, and
23749
+ * on a 10 h window holding 29,393 s of footage every range landed late by the
23750
+ * gap accumulated before it — up to 6,607 s, well past EOF. Nothing matched,
23751
+ * the video was a uniform timelapse, and the log line reported the five ranges
23752
+ * that had been ASKED for (2026-08-13, export `57d14363`, camera 615).
23753
+ *
23754
+ * Relative and not absolute epoch, because an absolute epoch would make every
23755
+ * call site responsible for the same subtraction.
23756
+ */
23757
+ var ExportDenseRangeSchema = object({
23758
+ fromSec: number().nonnegative(),
23759
+ toSec: number().nonnegative()
23760
+ }).refine((r) => r.toSec > r.fromSec, { message: "dense range must have toSec > fromSec" });
23761
+ /**
23762
+ * Dense-interval overlay for a timelapse: sample at `dense.everyMs` INSIDE the
23763
+ * listed ranges and at the base `everyMs` everywhere else.
23764
+ *
23765
+ * `everyMs` must be strictly smaller than the base cadence — a dense rate that
23766
+ * is not denser renders a uniform timelapse the operator believes is two-rate.
23767
+ */
23768
+ var ExportDenseSchema = object({
23769
+ everyMs: number().int().positive(),
23770
+ ranges: array(ExportDenseRangeSchema).min(1).max(200)
23771
+ });
23360
23772
  /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
23361
23773
  var ExportTimelapseSchema = object({
23362
23774
  everyMs: number().int().positive(),
23363
- outputFps: number().int().min(1).max(60).optional()
23775
+ outputFps: number().int().min(1).max(60).optional(),
23776
+ /** Optional second, FASTER rate over the intervals that matter. */
23777
+ dense: ExportDenseSchema.optional()
23778
+ }).superRefine((v, ctx) => {
23779
+ if (v.dense !== void 0 && v.dense.everyMs >= v.everyMs) ctx.addIssue({
23780
+ code: ZodIssueCode.custom,
23781
+ message: "dense.everyMs must be strictly smaller than the base everyMs",
23782
+ path: ["dense", "everyMs"]
23783
+ });
23364
23784
  });
23365
23785
  /**
23366
23786
  * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
@@ -23418,6 +23838,19 @@ var ExportDownloadSchema = object({
23418
23838
  url: string(),
23419
23839
  endpoints: array(string())
23420
23840
  });
23841
+ /**
23842
+ * A finished export's bytes, inline.
23843
+ *
23844
+ * `bytes` is the DECODED length — the number the caller bounds and logs
23845
+ * against, so nobody has to infer it from the base64 length.
23846
+ */
23847
+ var ExportBytesSchema = object({
23848
+ base64: string(),
23849
+ contentType: string(),
23850
+ /** Suggested filename, extension included. */
23851
+ name: string(),
23852
+ bytes: number().int().nonnegative()
23853
+ });
23421
23854
  method(object({
23422
23855
  deviceId: number(),
23423
23856
  profile: string(),
@@ -23442,6 +23875,9 @@ method(object({
23442
23875
  }), method(object({ exportId: string() }), ExportDownloadSchema, {
23443
23876
  kind: "query",
23444
23877
  auth: "protected"
23878
+ }), method(object({ exportId: string() }), ExportBytesSchema, {
23879
+ kind: "query",
23880
+ auth: "protected"
23445
23881
  });
23446
23882
  /**
23447
23883
  * scene-monitor — device-scoped reference-region state cap. An operator marks
@@ -28635,6 +29071,12 @@ Object.freeze({
28635
29071
  addonId: null,
28636
29072
  access: "create"
28637
29073
  },
29074
+ "recording.cancelRelocateJob": {
29075
+ capName: "recording",
29076
+ capScope: "system",
29077
+ addonId: null,
29078
+ access: "create"
29079
+ },
28638
29080
  "recording.cancelStorageMigrationMove": {
28639
29081
  capName: "recording",
28640
29082
  capScope: "system",
@@ -28689,6 +29131,12 @@ Object.freeze({
28689
29131
  addonId: null,
28690
29132
  access: "view"
28691
29133
  },
29134
+ "recording.listRelocateJobs": {
29135
+ capName: "recording",
29136
+ capScope: "system",
29137
+ addonId: null,
29138
+ access: "view"
29139
+ },
28692
29140
  "recording.locateSegment": {
28693
29141
  capName: "recording",
28694
29142
  capScope: "system",
@@ -28701,6 +29149,12 @@ Object.freeze({
28701
29149
  addonId: null,
28702
29150
  access: "create"
28703
29151
  },
29152
+ "recording.planStorageRebalance": {
29153
+ capName: "recording",
29154
+ capScope: "system",
29155
+ addonId: null,
29156
+ access: "view"
29157
+ },
28704
29158
  "recording.pruneFootage": {
28705
29159
  capName: "recording",
28706
29160
  capScope: "system",
@@ -28725,6 +29179,12 @@ Object.freeze({
28725
29179
  addonId: null,
28726
29180
  access: "create"
28727
29181
  },
29182
+ "recording.relocateFootage": {
29183
+ capName: "recording",
29184
+ capScope: "system",
29185
+ addonId: null,
29186
+ access: "create"
29187
+ },
28728
29188
  "recording.renderClip": {
28729
29189
  capName: "recording",
28730
29190
  capScope: "system",
@@ -28761,38 +29221,50 @@ Object.freeze({
28761
29221
  addonId: null,
28762
29222
  access: "create"
28763
29223
  },
29224
+ "recording.startStorageRebalance": {
29225
+ capName: "recording",
29226
+ capScope: "system",
29227
+ addonId: null,
29228
+ access: "create"
29229
+ },
28764
29230
  "recordingExport.cancelExport": {
28765
- capName: "recordingExport",
29231
+ capName: "recording-export",
28766
29232
  capScope: "system",
28767
29233
  addonId: null,
28768
29234
  access: "create"
28769
29235
  },
28770
29236
  "recordingExport.createExport": {
28771
- capName: "recordingExport",
29237
+ capName: "recording-export",
28772
29238
  capScope: "system",
28773
29239
  addonId: null,
28774
29240
  access: "create"
28775
29241
  },
28776
29242
  "recordingExport.deleteExport": {
28777
- capName: "recordingExport",
29243
+ capName: "recording-export",
28778
29244
  capScope: "system",
28779
29245
  addonId: null,
28780
29246
  access: "delete"
28781
29247
  },
28782
29248
  "recordingExport.getDownloadUrl": {
28783
- capName: "recordingExport",
29249
+ capName: "recording-export",
28784
29250
  capScope: "system",
28785
29251
  addonId: null,
28786
29252
  access: "view"
28787
29253
  },
28788
29254
  "recordingExport.getExport": {
28789
- capName: "recordingExport",
29255
+ capName: "recording-export",
28790
29256
  capScope: "system",
28791
29257
  addonId: null,
28792
29258
  access: "view"
28793
29259
  },
28794
29260
  "recordingExport.listExports": {
28795
- capName: "recordingExport",
29261
+ capName: "recording-export",
29262
+ capScope: "system",
29263
+ addonId: null,
29264
+ access: "view"
29265
+ },
29266
+ "recordingExport.readExportBytes": {
29267
+ capName: "recording-export",
28796
29268
  capScope: "system",
28797
29269
  addonId: null,
28798
29270
  access: "view"
@@ -30169,6 +30641,104 @@ var FramerateField = number().int().min(1).max(60);
30169
30641
  var TargetsField = array(NcRuleTargetSchema).min(1);
30170
30642
  var PriorityField = number().int().min(1).max(5);
30171
30643
  /**
30644
+ * Explicit override of the DENSE sampling cadence, seconds.
30645
+ *
30646
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
30647
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
30648
+ * made that same base 3 s and rendered a person pass as two frames.)
30649
+ *
30650
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
30651
+ * `denseCadenceSec` and played at `framerate` occupies
30652
+ *
30653
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
30654
+ *
30655
+ * 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.
30656
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
30657
+ * and therefore the length of a quiet night, does not move.
30658
+ *
30659
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
30660
+ * the recording has them returns the same frames, requested twice. Must be
30661
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
30662
+ * a uniform video the operator believes is two-rate — and upsert refuses it
30663
+ * rather than letting the export cap reject the render hours after the window.
30664
+ */
30665
+ var DenseCadenceSecField = number().min(.1).max(3600);
30666
+ /**
30667
+ * Minimum seconds of OUTPUT video each detection range must occupy.
30668
+ *
30669
+ * The operator-facing form of the arithmetic above: instead of solving for a
30670
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
30671
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
30672
+ * that range every ~583 ms.
30673
+ *
30674
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
30675
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
30676
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
30677
+ * ranges are sampled denser than they need. Per-range cadences require a cap
30678
+ * schema change and are the tracked follow-up.
30679
+ *
30680
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
30681
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
30682
+ * by real footage, never met by duplicating frames into motion that never
30683
+ * happened.
30684
+ */
30685
+ var MinDwellSecField = number().min(0).max(60);
30686
+ /**
30687
+ * Caption burned into the notification's preview frame.
30688
+ *
30689
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
30690
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
30691
+ * templating dialect for one field would be a second thing to explain.
30692
+ *
30693
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
30694
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
30695
+ * the reason this is not `.min(1)`.
30696
+ */
30697
+ var PreviewTextField = string().max(200);
30698
+ /**
30699
+ * Whether the notification's preview is a STILL or a short animation.
30700
+ *
30701
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
30702
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
30703
+ * night reads better as three seconds of motion than as one frame of it. Both
30704
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
30705
+ * simply applies it to a dozen frames sampled across the render and assembles
30706
+ * them.
30707
+ *
30708
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
30709
+ * seeks and a palette pass, and no rule that never asked for one should start
30710
+ * paying that on the deploy that shipped it.
30711
+ *
30712
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
30713
+ */
30714
+ var PreviewModeField = _enum(["image", "gif"]);
30715
+ /**
30716
+ * Which detection classes the notification reports counts for.
30717
+ *
30718
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
30719
+ * plan — no second query — aggregated per class. Absent or empty means "every
30720
+ * class the window actually contained", which is what an operator who never
30721
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
30722
+ * counts cars all night).
30723
+ *
30724
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
30725
+ * …). An unknown name simply never matches and reports nothing — it is not an
30726
+ * error, because a rule may legitimately name a class this camera's model does
30727
+ * not emit.
30728
+ *
30729
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
30730
+ * - `{{detections}}` — total over the reported classes
30731
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
30732
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
30733
+ * one per class, `count_` + the class name
30734
+ *
30735
+ * With NO custom body template the summary is appended to the derived body, and
30736
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
30737
+ * reads. With a custom template the operator owns every word — nothing is
30738
+ * appended, so `{{detectionSummary}}` is how he asks for it.
30739
+ */
30740
+ var ReportClassesField = array(string().min(1).max(40)).max(20);
30741
+ /**
30172
30742
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
30173
30743
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
30174
30744
  * here (see the ownership note above).
@@ -30188,9 +30758,30 @@ var TimelapseRuleInputSchema = object({
30188
30758
  cadenceSec: CadenceSecField.default(15),
30189
30759
  /** Output frames per second of the assembled mp4 (predecessor parity). */
30190
30760
  framerate: FramerateField.default(10),
30761
+ /**
30762
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
30763
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
30764
+ * field gets.
30765
+ */
30766
+ denseCadenceSec: DenseCadenceSecField.optional(),
30767
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
30768
+ minDwellSec: MinDwellSecField.optional(),
30191
30769
  /** `notification-output` targets the finished video/thumbnail is sent to. */
30192
30770
  targets: TargetsField,
30193
30771
  template: TimelapseTemplateSchema.optional(),
30772
+ /**
30773
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
30774
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
30775
+ *
30776
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
30777
+ * the notification's title/body, and clearing it (`template: null`) must not
30778
+ * silently clear the caption too.
30779
+ */
30780
+ previewText: PreviewTextField.optional(),
30781
+ /** Still or animation — see {@link PreviewModeField}. */
30782
+ previewMode: PreviewModeField.default("image"),
30783
+ /** Classes the notification counts — see {@link ReportClassesField}. */
30784
+ reportClasses: ReportClassesField.optional(),
30194
30785
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
30195
30786
  priority: PriorityField.default(3)
30196
30787
  });
@@ -30201,8 +30792,13 @@ object({
30201
30792
  schedule: NcScheduleSchema.optional(),
30202
30793
  cadenceSec: CadenceSecField.optional(),
30203
30794
  framerate: FramerateField.optional(),
30795
+ denseCadenceSec: DenseCadenceSecField.optional(),
30796
+ minDwellSec: MinDwellSecField.optional(),
30204
30797
  targets: TargetsField.optional(),
30205
30798
  template: TimelapseTemplateSchema.nullable().optional(),
30799
+ previewText: PreviewTextField.optional(),
30800
+ previewMode: PreviewModeField.optional(),
30801
+ reportClasses: ReportClassesField.optional(),
30206
30802
  priority: PriorityField.optional()
30207
30803
  });
30208
30804
  TimelapseRuleInputSchema.extend({
@@ -30214,10 +30810,28 @@ TimelapseRuleInputSchema.extend({
30214
30810
  */
30215
30811
  ownerUserId: string().optional(),
30216
30812
  /**
30217
- * Epoch-ms of the last successful generation the 1-hour re-generation
30218
- * guard's durable state (predecessor parity). Absent = never generated.
30813
+ * Epoch-ms of the NEWEST successful generation across every camera of this
30814
+ * rule. What a UI shows, and the compatibility floor for
30815
+ * {@link readTimelapseGeneratedAt}. Absent = never generated.
30219
30816
  */
30220
30817
  lastGeneratedAt: number().optional(),
30818
+ /**
30819
+ * PER-CAMERA generation state, keyed by `String(deviceId)` — the
30820
+ * re-generation guard's real durable state.
30821
+ *
30822
+ * One rule covers several cameras and each renders its own video, so a rule
30823
+ * -wide stamp is wrong in the direction that DESTROYS work: camera A
30824
+ * succeeding at 06:05 tells camera B, whose render failed, that it is
30825
+ * already done — and B's night is gone for good, because the window will not
30826
+ * come back.
30827
+ *
30828
+ * ADDITIVE, so the migration is free: a row written before this field simply
30829
+ * has no map, and {@link readTimelapseGeneratedAt} falls back to
30830
+ * {@link TimelapseRuleSchema.shape.lastGeneratedAt}. Reading an old row as
30831
+ * "never generated" would re-render and re-notify every camera of every rule
30832
+ * once, on the deploy that shipped the map.
30833
+ */
30834
+ generatedByDevice: record(string(), number()).optional(),
30221
30835
  /** userId of the caller who created the rule (server-stamped). */
30222
30836
  createdBy: string(),
30223
30837
  createdAt: number(),
@@ -30268,25 +30882,32 @@ object({
30268
30882
  var NativeLeaseAdmissionSchema = _enum(["all", "inferred"]);
30269
30883
  object({
30270
30884
  /**
30271
- * How long a retained native frame is served before it counts as a miss.
30885
+ * How many delivered frames the worker HOLDS at once, waiting for each one's
30886
+ * detection result.
30887
+ *
30888
+ * This replaced a TTL on 2026-08-13, and the replacement is the whole point:
30889
+ * a time window was never related to the event the pixels were waiting for.
30890
+ * A held frame now lives from delivery until the runner has its `FrameResult`
30891
+ * — at which moment the runner cuts the subject tiles it actually wanted and
30892
+ * releases the frame. The bound exists only so a runner that stops answering
30893
+ * cannot pin RAM: above it the OLDEST held frame is dropped and counted.
30272
30894
  *
30273
- * Must cover the FULL late-crop horizon: detection inference + the
30274
- * cross-process inference-result hop to hub post-analysis + tracking + the
30275
- * tRPC crop round-trip back. Below ~500 ms the busiest cameras' subject crops
30276
- * outrun it and fall back to the ≤640 detection frame; above ~3 s the resident
30277
- * RAM per busy camera grows linearly with no measured hit-rate gain.
30895
+ * Sizing: the steady state is `inferenceLatency × deliveredFps`, measured at
30896
+ * 40-160 ms × ≤25 fps = 1-4 frames. The default leaves headroom for a hiccup
30897
+ * without ever approaching the old resident set (43 frames × 24.9 MB at 4K).
30898
+ * Raising it does not buy hit rate it buys tolerance for a slow runner, and
30899
+ * `holdOverflow` on the metrics line is what says you need it.
30278
30900
  */
30279
- ttlMs: number().int().min(250).max(1e4),
30901
+ holdFrames: number().int().min(1).max(64),
30280
30902
  /**
30281
30903
  * Hard per-decode-worker RAM ceiling for retained native frames, in MB.
30282
30904
  *
30283
- * Intended as a SAFETY ceiling with the TTL as the effective cap — but check
30284
- * which one is actually binding before reasoning from that. At the shipped
30285
- * 1024 MB and a 2 800 ms TTL, a 4K camera hits the CEILING first (~43 frames
30286
- * at ~24 MB each) and the TTL never gets to expire anything; `leaseMb` /
30287
- * `leaseFrames` on the metrics line say which. When the ceiling binds, a
30288
- * change that admits fewer frames buys retention WINDOW at constant RAM
30289
- * rather than giving RAM back — lower this knob if RAM is what you wanted.
30905
+ * Since 2026-08-13 this is a SAFETY ceiling and nothing else: `holdFrames`
30906
+ * is what decides how much is held, and the ceiling is the number above which
30907
+ * something is wrong. Before that it was the effective cap at 1024 MB with
30908
+ * a 2 800 ms TTL a 4K camera sat pinned at `leaseMb:1020, leaseFrames:43`
30909
+ * with the TTL expiring nothing, which is exactly the confusion the hold
30910
+ * removes. `leaseMb` / `leaseFrames` still say what is resident.
30290
30911
  * `0` DISABLES the lease entirely and falls the worker back to the tiny
30291
30912
  * leak-prone GPU surface ring (~85% crop miss; that is what the lease exists
30292
30913
  * to replace).
@@ -30312,22 +30933,45 @@ object({
30312
30933
  * there is the signal that some caller names frames outside the inference set
30313
30934
  * and that this must go back to `all`.
30314
30935
  */
30315
- admission: NativeLeaseAdmissionSchema
30936
+ admission: NativeLeaseAdmissionSchema,
30937
+ /**
30938
+ * RAM ceiling per decode worker, in MB, for the SUBJECT TILES — the
30939
+ * compressed native crops the worker cuts at the moment a frame's detection
30940
+ * result arrives, and keeps long after the frame itself is freed.
30941
+ *
30942
+ * This is the knob that replaced the old retention window, and it buys about
30943
+ * three orders of magnitude more of it: a tile is one subject at native
30944
+ * resolution, JPEG-encoded (~60-120 KB on a 4K person), against ~24.9 MB for
30945
+ * the frame it was cut from. A frame on which nothing was detected costs
30946
+ * nothing at all, which is the real change — the old lease paid per FRAME and
30947
+ * was interrogated per SUBJECT.
30948
+ *
30949
+ * `0` DISABLES tiles, leaving only the hold window and the ≤640 RAM
30950
+ * fallback — i.e. the pre-2026-08-13 miss profile. Set it there only to
30951
+ * reproduce that.
30952
+ */
30953
+ tileBudgetMb: number().int().min(0).max(1024)
30316
30954
  });
30317
30955
  /**
30318
- * The values in force when the operator has set nothing — byte-for-byte the
30319
- * constants the decode worker shipped with as env-var defaults, so making these
30320
- * settings changed no behaviour on the day it landed.
30956
+ * The values in force when the operator has set nothing.
30957
+ *
30958
+ * `budgetMb` stays at 1024 on the day the hold landed, deliberately: it stopped
30959
+ * being the retention window and became the OOM ceiling, and lowering a ceiling
30960
+ * in the same change that redefines it would make a regression and a retune
30961
+ * indistinguishable. Cut it once `tileHits` / `holdOverflow` have been read on
30962
+ * live traffic.
30321
30963
  */
30322
30964
  var DEFAULT_NATIVE_LEASE_SETTINGS = {
30323
- ttlMs: 1200,
30965
+ holdFrames: 8,
30324
30966
  budgetMb: 1024,
30325
30967
  activityMs: 15e3,
30968
+ tileBudgetMb: 64,
30326
30969
  admission: "inferred"
30327
30970
  };
30328
- DEFAULT_NATIVE_LEASE_SETTINGS.ttlMs;
30971
+ DEFAULT_NATIVE_LEASE_SETTINGS.holdFrames;
30329
30972
  DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
30330
30973
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
30974
+ DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
30331
30975
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
30332
30976
  //#endregion
30333
30977
  //#region src/convert-orchestrator.ts