@camstack/addon-provider-reolink 1.2.21 → 1.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +1070 -74
  2. package/dist/addon.mjs +1070 -74
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7244,8 +7244,31 @@ var AdoptionJobSchema = object({
7244
7244
  error: string().nullable()
7245
7245
  });
7246
7246
  /**
7247
- * Per-camera FUNCTION SWITCHES — the one coherent on/off surface over the
7248
- * pipeline functions an operator thinks in terms of.
7247
+ * Per-camera FUNCTION SWITCHES.
7248
+ *
7249
+ * ## The aggregate group is being withdrawn — the BADGE is not (D113)
7250
+ *
7251
+ * This file shipped as "the one coherent on/off surface over the pipeline
7252
+ * functions an operator thinks in terms of". The operator's verdict on
7253
+ * 2026-08-12 was that the coherent surface bought complexity and no clarity:
7254
+ * every function already had a settings page of its own, and a second place to
7255
+ * turn it off is a second place to look. Each switch is going back to its own
7256
+ * component's original options — detection to the detection-pipeline wrapper
7257
+ * binding, audio analysis to its own, recording to `RecordingConfig.enabled`
7258
+ * (which was always first-class; the switch was a veneer over
7259
+ * `recording.setDeviceConfig`), notifications to a notification-center
7260
+ * per-device setting, the two camera planes to their own components.
7261
+ *
7262
+ * What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
7263
+ * thing that lets a status surface say DISABLED instead of BROKEN, recomposed
7264
+ * straight from the authorities with no group in the middle. That rule was
7265
+ * never about a control panel.
7266
+ *
7267
+ * Everything else here — {@link CAMERA_SWITCH_CATALOG}, {@link CameraSwitch},
7268
+ * {@link deriveCameraSwitches}, the `pipelineOrchestrator.getCameraSwitches` /
7269
+ * `setCameraSwitch` pair — is a COMPATIBILITY surface for as long as deployed
7270
+ * viewers (v1.0.305) and the admin UI still call it. It is deleted when they
7271
+ * stop; nothing new may be built on it.
7249
7272
  *
7250
7273
  * ## This file adds no state
7251
7274
  *
@@ -7590,14 +7613,21 @@ var RecordingConfigSchema = object({
7590
7613
  /**
7591
7614
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
7592
7615
  *
7593
- * One shape shared by the recorder's `relocateFootage` (segments) and
7594
- * pipeline-analytics' `relocateMedia` (event media blobs) so the admin Data
7595
- * page renders both movers with one component. Jobs are in-RAM (a restart
7596
- * forgets them re-running is safe by construction: copy-if-absent, delete
7597
- * after verify) and each completed/failed run also lands one durable ops-log
7598
- * row on the owning addon's surface.
7616
+ * One shape shared by the recorder and pipeline-analytics internal movers.
7617
+ * The public admin surface is `storage-migration`; child jobs remain in RAM
7618
+ * because copy-if-absent, verify, delete and index/row repoint are resumable.
7619
+ * Each completed/failed run also lands one durable ops-log row on its owning
7620
+ * addon surface.
7621
+ */
7622
+ /**
7623
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
7624
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
7625
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
7626
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
7627
+ * runs at all.
7599
7628
  */
7600
7629
  var RelocateJobStateSchema = _enum([
7630
+ "queued",
7601
7631
  "running",
7602
7632
  "done",
7603
7633
  "failed",
@@ -7622,19 +7652,109 @@ var RelocateJobSchema = object({
7622
7652
  finishedAt: number().nullable(),
7623
7653
  error: string().nullable()
7624
7654
  });
7655
+ /** Profile-derived footage selection used only by the migration coordinator:
7656
+ * `recordings` owns high+mid; `recordingsLow` owns low. */
7657
+ var RelocateFootageClassSchema = _enum(["recordings", "recordingsLow"]);
7625
7658
  var RelocateFootageInputSchema = object({
7626
- deviceId: number().optional(),
7627
7659
  fromLocationId: string(),
7628
7660
  toLocationId: string(),
7629
7661
  entities: array(_enum(["segments"])).optional(),
7662
+ /** Limits relocation to the logical profile class. Omit only for the
7663
+ * pre-orchestration compatibility path. */
7664
+ footageClass: RelocateFootageClassSchema.optional(),
7665
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
7666
+ * is what a whole-disk drain means. The rebalance path always sets it: its
7667
+ * unit is a (camera, profile) pile, not a disk. */
7668
+ deviceId: number().int().optional(),
7669
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
7670
+ * Finer than `footageClass`, which cannot separate high from mid — and the
7671
+ * placement plan assigns those two independently, so a rebalance that could
7672
+ * only say "recordings" would move footage the plan never asked to move. */
7673
+ profiles: array(string()).optional(),
7630
7674
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7631
7675
  * never allowed to starve live writers. */
7632
7676
  throttleMbps: number().min(1).max(1e3).optional()
7633
7677
  });
7634
- var RelocateMediaInputSchema = object({
7635
- deviceId: number().optional(),
7678
+ /** Internal, lease-scoped participant operation. It is intentionally separate
7679
+ * from persistent recording settings: a migration never changes
7680
+ * `RecordingConfig.enabled` or camera wrapper bindings. */
7681
+ var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7682
+ var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7683
+ var StorageMigrationMediaMoveInputSchema = object({
7636
7684
  toLocationId: string(),
7637
7685
  throttleMbps: number().min(1).max(1e3).optional()
7686
+ }).extend({ leaseId: string().min(1) });
7687
+ /** The independently selectable logical storage classes. `recordings`
7688
+ * encompasses the high and mid segment profiles; `recordingsLow` is low
7689
+ * segments; `eventMedia` is post-analysis blobs. */
7690
+ var StorageMigrationClassSchema = _enum([
7691
+ "recordings",
7692
+ "recordingsLow",
7693
+ "eventMedia"
7694
+ ]);
7695
+ /** A destination is always an existing, fully-qualified location id. The
7696
+ * migration API intentionally never changes a source location's `basePath`:
7697
+ * callers create a new `<type>:<slug>` location, then select it here. */
7698
+ var StorageMigrationDestinationsSchema = object({
7699
+ recordings: string().min(1).optional(),
7700
+ recordingsLow: string().min(1).optional(),
7701
+ eventMedia: string().min(1).optional()
7702
+ }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
7703
+ /** Shared input for planning and starting an orchestrated storage migration. */
7704
+ var StorageMigrationInputSchema = object({
7705
+ destinations: StorageMigrationDestinationsSchema,
7706
+ throttleMbps: number().min(1).max(1e3).optional()
7707
+ });
7708
+ /** The durable coordinator state machine. The only phase that changes default
7709
+ * locations is `repointing`, after every selected mover has completed and been
7710
+ * verified. */
7711
+ var StorageMigrationPhaseSchema = _enum([
7712
+ "planning",
7713
+ "pausing",
7714
+ "moving",
7715
+ "verifying",
7716
+ "repointing",
7717
+ "refreshing",
7718
+ "resuming",
7719
+ "done",
7720
+ "failed",
7721
+ "cancelled"
7722
+ ]);
7723
+ var StorageMigrationParticipantSchema = _enum([
7724
+ "pipeline",
7725
+ "recorder",
7726
+ "analytics"
7727
+ ]);
7728
+ var StorageMigrationMoveSchema = object({
7729
+ storageClass: StorageMigrationClassSchema,
7730
+ fromLocationId: string(),
7731
+ toLocationId: string(),
7732
+ moverJobId: string().nullable(),
7733
+ state: RelocateJobStateSchema.nullable(),
7734
+ error: string().nullable()
7735
+ });
7736
+ var StorageMigrationJobSchema = object({
7737
+ jobId: string(),
7738
+ phase: StorageMigrationPhaseSchema,
7739
+ destinations: StorageMigrationDestinationsSchema,
7740
+ throttleMbps: number(),
7741
+ moves: array(StorageMigrationMoveSchema),
7742
+ pauseLeaseId: string().nullable(),
7743
+ pausedParticipants: array(StorageMigrationParticipantSchema),
7744
+ repointed: boolean(),
7745
+ cancelRequested: boolean(),
7746
+ startedAt: number(),
7747
+ updatedAt: number(),
7748
+ finishedAt: number().nullable(),
7749
+ error: string().nullable()
7750
+ });
7751
+ var StorageMigrationPlanSchema = object({
7752
+ destinations: StorageMigrationDestinationsSchema,
7753
+ moves: array(object({
7754
+ storageClass: StorageMigrationClassSchema,
7755
+ fromLocationId: string(),
7756
+ toLocationId: string()
7757
+ }))
7638
7758
  });
7639
7759
  /**
7640
7760
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -7686,6 +7806,21 @@ var StorageLocationSchema = object({
7686
7806
  nodeId: string().optional(),
7687
7807
  isDefault: boolean().default(false),
7688
7808
  isSystem: boolean().default(false),
7809
+ /**
7810
+ * Operator opt-in: whether consumers that BALANCE across several locations
7811
+ * of a type may write here. Recordings reads it today; event media and
7812
+ * backups are the next consumers, which is why the flag lives on the
7813
+ * location rather than in any one addon's store — nothing has to be
7814
+ * extended to add the next consumer.
7815
+ *
7816
+ * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
7817
+ * flag existed reads back with no flag and keeps working exactly as before;
7818
+ * that is the whole compat story, and it is why no migration ships with it.
7819
+ * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
7820
+ * disk must not silently start writing to it); the default of a type is
7821
+ * always stamped `true`.
7822
+ */
7823
+ enabled: boolean().optional(),
7689
7824
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
7690
7825
  * for node-local locations it can reach) — never persisted, absent when the
7691
7826
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -12425,7 +12560,8 @@ method(object({
12425
12560
  }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12426
12561
  /**
12427
12562
  * filesystem-browse — per-node capability for browsing the node's local
12428
- * filesystem, sandboxed to operator-configured allowed roots. Used by the
12563
+ * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12564
+ * are sandboxed to operator-configured allowed roots (D115). Used by the
12429
12565
  * admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
12430
12566
  * (one provider per node); the hub calls it with `{nodeId}` so the codegen
12431
12567
  * routes to that exact node (default `nodeIdMode:'routing'`).
@@ -14266,6 +14402,13 @@ var MaskGridDimsSchema = object({
14266
14402
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
14267
14403
  * this one field keeps the schema additive — a rule still declares exactly
14268
14404
  * one trigger.
14405
+ *
14406
+ * AUDIO rules add no member here, for the reason occupancy added none: the
14407
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
14408
+ * mirror.ts` fails the build on a member the app cannot render) and every
14409
+ * member costs a release train. A sustained-sound rule is therefore an
14410
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
14411
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
14269
14412
  */
14270
14413
  var NcDeliverySchema = _enum([
14271
14414
  "immediate",
@@ -14280,15 +14423,32 @@ var NcDeliverySchema = _enum([
14280
14423
  * depend on a provider's raw event name or payload shape.
14281
14424
  */
14282
14425
  var NcSystemEventKindSchema = _enum([
14283
- "camera-online",
14284
- "camera-offline",
14426
+ "device-online",
14427
+ "device-offline",
14428
+ "device-disabled",
14429
+ "device-enabled",
14285
14430
  "stream-online",
14286
14431
  "stream-offline",
14287
14432
  "node-online",
14288
14433
  "node-offline",
14289
14434
  "addon-update-available",
14290
- "server-update-available"
14435
+ "server-update-available",
14436
+ "alarm-triggered",
14437
+ "alarm-armed",
14438
+ "alarm-disarmed",
14439
+ "camera-online",
14440
+ "camera-offline",
14441
+ "camera-disabled",
14442
+ "camera-enabled"
14443
+ ]);
14444
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
14445
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
14446
+ "camera-online",
14447
+ "camera-offline",
14448
+ "camera-disabled",
14449
+ "camera-enabled"
14291
14450
  ]);
14451
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
14292
14452
  /**
14293
14453
  * One coherent system-event condition. `kinds` is the required opt-in safety
14294
14454
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -14297,6 +14457,18 @@ var NcSystemEventKindSchema = _enum([
14297
14457
  var NcSystemEventConditionSchema = object({
14298
14458
  kinds: array(NcSystemEventKindSchema).min(1),
14299
14459
  deviceIds: array(number().int()).min(1).optional(),
14460
+ /**
14461
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
14462
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
14463
+ * is what a liveness rule means when nobody said otherwise.
14464
+ *
14465
+ * This is where "only my cameras" is expressed, and it lives on the rule for
14466
+ * one reason: the intake cannot know which devices this household cares
14467
+ * about, and a producer-side filter is one no operator can change. Fails
14468
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
14469
+ * does not carry) matches no `deviceTypes` list.
14470
+ */
14471
+ deviceTypes: array(string().min(1)).min(1).optional(),
14300
14472
  nodeIds: array(string().min(1)).min(1).optional(),
14301
14473
  packageNames: array(string().min(1)).min(1).optional()
14302
14474
  });
@@ -14347,6 +14519,47 @@ var NcOccupancyConditionSchema = object({
14347
14519
  sustainSeconds: number().int().min(0).max(3600).default(15)
14348
14520
  });
14349
14521
  /**
14522
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
14523
+ *
14524
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
14525
+ * reference notifier uses, so an operator moving between them re-uses what
14526
+ * they already know): a rule matches when, over a sampling window of
14527
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14528
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14529
+ *
14530
+ * - `dbThreshold` — its level is at or above this many dBFS (see
14531
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14532
+ * - `labels` — the classifier put at least one of these labels on it.
14533
+ *
14534
+ * Both are OPTIONAL and independent, which is the point of the shape: a
14535
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
14536
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14537
+ * is given** — a window in which every sample is trivially a hit would fire on
14538
+ * silence, so the engine refuses such a condition rather than notifying on
14539
+ * nothing (the schema cannot express "at least one of" without becoming a
14540
+ * ZodEffects the cap path would have to special-case).
14541
+ *
14542
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
14543
+ * must be FULL before it can match — a window that has been open for two
14544
+ * seconds of its ten is 100% of nothing, and firing on it would make
14545
+ * `samplingSeconds` decorative.
14546
+ *
14547
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
14548
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
14549
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
14550
+ * an operator who typed `dog` mean the same thing.
14551
+ */
14552
+ var NcAudioConditionSchema = object({
14553
+ /** Audio macro labels; absent = any sound (level-only rule). */
14554
+ labels: array(string().min(1)).min(1).optional(),
14555
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
14556
+ dbThreshold: number().min(-96).max(0).optional(),
14557
+ /** Percentage of the window's samples that must be hits (1–100). */
14558
+ hitPercent: number().int().min(1).max(100).default(60),
14559
+ /** Length of the sampling window in seconds. */
14560
+ samplingSeconds: number().int().min(1).max(300).default(10)
14561
+ });
14562
+ /**
14350
14563
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
14351
14564
  *
14352
14565
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -14619,7 +14832,33 @@ var NcConditionsSchema = object({
14619
14832
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
14620
14833
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
14621
14834
  */
14622
- occupancy: NcOccupancyConditionSchema.optional()
14835
+ occupancy: NcOccupancyConditionSchema.optional(),
14836
+ /**
14837
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
14838
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
14839
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
14840
+ * a window that is not full yet, neither filter given). See
14841
+ * {@link NcAudioCondition}.
14842
+ *
14843
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
14844
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
14845
+ * a detection, a track or a device event (the same fail-closed pairing
14846
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
14847
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
14848
+ * (an `immediate` rule naming an `audio-*` class, one notification per
14849
+ * classified sample) stays exactly as it was for rules that already use it.
14850
+ *
14851
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
14852
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
14853
+ * (`camstack/src/data/notification-center.ts`, guarded by
14854
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
14855
+ * condition fields it does not know when a rule is saved from the phone.
14856
+ * Publishing an editor for a condition the app cannot round-trip is how an
14857
+ * operator loses a rule's conditions by opening it — so the descriptor, the
14858
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
14859
+ * does an audio rule become authorable.
14860
+ */
14861
+ audio: NcAudioConditionSchema.optional()
14623
14862
  });
14624
14863
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
14625
14864
  var NcRuleTargetSchema = object({
@@ -14733,6 +14972,73 @@ var NcThrottleSchema = object({
14733
14972
  */
14734
14973
  granularity: NcThrottleGranularitySchema.optional()
14735
14974
  });
14975
+ /**
14976
+ * How long the confirm gate may hold ONE notification, and how big the picture
14977
+ * it judges may be.
14978
+ *
14979
+ * The clamp is the product decision, not a coincidence of the model: p50 was
14980
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
14981
+ * arrives after the visitor has gone is not a notification. 448 px was enough
14982
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
14983
+ * tokens for pixels the model pools away.
14984
+ */
14985
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
14986
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
14987
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
14988
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
14989
+ var NcConfirmExpectSchema = object({
14990
+ op: _enum([
14991
+ ">=",
14992
+ ">",
14993
+ "<=",
14994
+ "<",
14995
+ "=="
14996
+ ]),
14997
+ count: number().int().min(0).max(1e3)
14998
+ });
14999
+ /**
15000
+ * AI CONFIRM — a vision model looks at the picture this notification is about
15001
+ * to ship and says whether it agrees with the rule.
15002
+ *
15003
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
15004
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
15005
+ * on the operator's phone is not a verdict about this notification.
15006
+ *
15007
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
15008
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
15009
+ * the default and every fail-open is COUNTED, because a gate that always fails
15010
+ * open looks in the log exactly like a gate that works.
15011
+ *
15012
+ * Every field is `.optional()` rather than relied on as a Zod default at the
15013
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
15014
+ * production failures in one day), so the gate reads absent as the constant
15015
+ * above rather than trusting a parse it may never have seen.
15016
+ */
15017
+ var NcConfirmSchema = object({
15018
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
15019
+ * same thing, and both mean "deliver exactly as before". */
15020
+ enabled: boolean().default(false),
15021
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
15022
+ profileId: string().optional(),
15023
+ /**
15024
+ * The operator's question, in his own words. Absent = a question derived
15025
+ * from the rule (its class and its expectation).
15026
+ *
15027
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
15028
+ * banners, signage and plates as instructions if you let them reach the
15029
+ * prompt — proven live — so the authoritative contract stays in the system
15030
+ * turn and only rule-authored words land here.
15031
+ */
15032
+ prompt: string().max(1e3).optional(),
15033
+ /** Fire only when the model's count satisfies this. Absent = the model's
15034
+ * own boolean verdict decides. */
15035
+ expect: NcConfirmExpectSchema.optional(),
15036
+ timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
15037
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
15038
+ onTimeout: _enum(["fire", "suppress"]).default("fire"),
15039
+ /** Longest edge the judged image is downscaled to before it is sent. */
15040
+ maxImagePx: number().int().min(64).max(2048).default(448)
15041
+ });
14736
15042
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
14737
15043
  var NcRuleInputSchema = object({
14738
15044
  name: string().min(1).max(200),
@@ -14793,7 +15099,13 @@ var NcRuleInputSchema = object({
14793
15099
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
14794
15100
  * shape as every other actuation.
14795
15101
  */
14796
- actions: NcRuleActionsSchema.optional()
15102
+ actions: NcRuleActionsSchema.optional(),
15103
+ /**
15104
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
15105
+ * a rule that predates the gate must keep delivering byte-for-byte as it
15106
+ * did, and absent is the only way to say that without a migration.
15107
+ */
15108
+ confirm: NcConfirmSchema.optional()
14797
15109
  });
14798
15110
  /**
14799
15111
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -14804,7 +15116,37 @@ var NcRuleInputSchema = object({
14804
15116
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
14805
15117
  * `updateRule` patch.
14806
15118
  */
14807
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
15119
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
15120
+ disabledTargetIds: array(string()).optional(),
15121
+ /**
15122
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
15123
+ *
15124
+ * It makes the key optional to SUPPLY; the parse still materialises the
15125
+ * default when the key is absent. And `NcRuleStore.update` merges with
15126
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
15127
+ * one — which made every partial edit destructive:
15128
+ *
15129
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
15130
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
15131
+ * setEnabled(ruleId, false) → conditions reset to `{}`
15132
+ *
15133
+ * A rule scoped to one camera and one zone silently became a rule that
15134
+ * matches EVERY event on EVERY camera, and lost its `media` policy
15135
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
15136
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
15137
+ * within a minute of a two-field patch.
15138
+ *
15139
+ * So every defaulted field is re-declared here WITHOUT its default. The
15140
+ * inner defaults still apply when the caller DOES send the key — `{}` for
15141
+ * conditions remains a real instruction ("clear them") — and only the
15142
+ * absent key is now genuinely absent.
15143
+ */
15144
+ enabled: boolean().optional(),
15145
+ conditions: NcConditionsSchema.optional(),
15146
+ media: NcMediaPolicySchema.optional(),
15147
+ throttle: NcThrottleSchema.optional(),
15148
+ priority: number().int().min(1).max(5).optional()
15149
+ });
14808
15150
  /** A persisted rule. */
14809
15151
  var NcRuleSchema = NcRuleInputSchema.extend({
14810
15152
  id: string(),
@@ -15105,6 +15447,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
15105
15447
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
15106
15448
  * copy would lie the first time a rule is disabled.
15107
15449
  */
15450
+ /**
15451
+ * Why a device a mode NAMES is nonetheless not armed by it.
15452
+ *
15453
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
15454
+ * per-camera notification switch the Notification Center already owns,
15455
+ * `detection-off` is the device's own detection binding being inactive, and
15456
+ * `offline` is the device manager's liveness. A fourth reason would mean a
15457
+ * fourth authority, and inventing one here is how a panel starts disagreeing
15458
+ * with the switches the operator actually used.
15459
+ */
15460
+ var NcAlarmSkipReasonSchema = _enum([
15461
+ "muted",
15462
+ "detection-off",
15463
+ "offline"
15464
+ ]);
15465
+ var NcAlarmSkippedDeviceSchema = object({
15466
+ deviceId: number().int(),
15467
+ reason: NcAlarmSkipReasonSchema
15468
+ });
15108
15469
  var NcAlarmModeCoverageSchema = object({
15109
15470
  mode: AlarmArmModeSchema,
15110
15471
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -15112,7 +15473,18 @@ var NcAlarmModeCoverageSchema = object({
15112
15473
  /** At least one covering rule has no device scope, so the mode covers all. */
15113
15474
  allDevices: boolean(),
15114
15475
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
15115
- deviceIds: array(number().int())
15476
+ deviceIds: array(number().int()),
15477
+ /**
15478
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
15479
+ * excludes it.
15480
+ *
15481
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
15482
+ * twelve makes it false in exactly the way nobody notices until an incident.
15483
+ * Defaulted to `[]` so a coverage answer computed before this field existed
15484
+ * still parses as "nothing known to be skipped" rather than failing the whole
15485
+ * alarm tab.
15486
+ */
15487
+ skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
15116
15488
  });
15117
15489
  var NcAlarmConfigSchema = object({
15118
15490
  /**
@@ -16475,13 +16847,19 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16475
16847
  }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
16476
16848
  kind: "mutation",
16477
16849
  auth: "admin"
16478
- }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
16850
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
16479
16851
  kind: "mutation",
16480
16852
  auth: "admin"
16481
- }), method(object({}), array(RelocateJobSchema).readonly(), {
16482
- kind: "query",
16853
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
16854
+ kind: "mutation",
16483
16855
  auth: "admin"
16484
- }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
16856
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
16857
+ kind: "mutation",
16858
+ auth: "admin"
16859
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
16860
+ kind: "mutation",
16861
+ auth: "admin"
16862
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
16485
16863
  kind: "mutation",
16486
16864
  auth: "admin"
16487
16865
  }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
@@ -17938,9 +18316,16 @@ var CameraStatusSchema = object({
17938
18316
  audio: CameraAudioStatusSchema.nullable(),
17939
18317
  recording: CameraRecordingStatusSchema.nullable(),
17940
18318
  /**
17941
- * Per-camera function switches an OPERATOR has turned off
18319
+ * Per-camera functions an OPERATOR has turned off
17942
18320
  * ([D61](../../../../docs/decisions/adr-0067.md)).
17943
18321
  *
18322
+ * Composed from the AUTHORITIES themselves — the wrapper bindings,
18323
+ * `RecordingConfig.enabled`, the notification mute, the broker's audio
18324
+ * policy, the camera's own microphone — via `composeSwitchedOff`, not from
18325
+ * the deprecated `getCameraSwitches` group ([D113](../../../../docs/decisions/adr-0113.md)).
18326
+ * The badge outlives the control panel: the panel was a convenience, this is
18327
+ * the difference between a camera being off and a camera being dead.
18328
+ *
17944
18329
  * This is the difference between DISABLED and BROKEN. A camera whose
17945
18330
  * `detection` block reports zero fps and whose `switchedOff` contains
17946
18331
  * `'object-detection'` was switched off by a person; the same camera with an
@@ -18011,7 +18396,13 @@ var NodeInferenceDevicesSchema = object({
18011
18396
  reachable: boolean(),
18012
18397
  devices: array(NodeInferenceDeviceSchema).readonly()
18013
18398
  });
18014
- method(object({
18399
+ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18400
+ kind: "mutation",
18401
+ auth: "admin"
18402
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18403
+ kind: "mutation",
18404
+ auth: "admin"
18405
+ }), method(object({
18015
18406
  deviceId: number(),
18016
18407
  agentNodeId: string()
18017
18408
  }), object({ success: literal(true) }), {
@@ -18541,24 +18932,28 @@ var snapshotCapability = {
18541
18932
  *
18542
18933
  * `getSnapshotOverview` is cache-only by contract: it answers from whatever
18543
18934
  * the wrapper happens to hold and never captures. Under D93 the client
18544
- * versions its image URL on that answer, and an image REQUEST is what enrols
18545
- * a camera in the keep-warm loop. Both of those are satisfiable by the
18546
- * client's own image cache — `expo-image` is URL-keyed and never revalidates
18547
- * — so a URL painted in a previous session comes off disk with no network,
18548
- * no enrolment, and nothing warming. Measured on the live hub: reopening
18549
- * after two minutes idle painted 15 of 16 tiles at **168 s old** with zero
18550
- * HTTP requests, and the fleet only recovered because a later poll happened
18551
- * to observe a different identity.
18935
+ * versions its image URL on that answer, and an image REQUEST was the only
18936
+ * demand signal. Both of those are satisfiable by the client's own image
18937
+ * cache — `expo-image` is URL-keyed and never revalidates — so a URL painted
18938
+ * in a previous session comes off disk with no network, no demand, and no
18939
+ * capture. Measured on the live hub: reopening after two minutes idle
18940
+ * painted 15 of 16 tiles at **168 s old** with zero HTTP requests, and the
18941
+ * fleet only recovered because a later poll happened to observe a different
18942
+ * identity.
18552
18943
  *
18553
18944
  * ## The two properties that fix it
18554
18945
  *
18555
18946
  * **It is an RPC, so no client cache can answer it.** The demand signal
18556
- * always reaches the wrapper. This method therefore MAY create keep-warm
18557
- * subscriptions, where `getSnapshotOverview` must never (D93) — the
18558
- * distinction is not "one is newer" but that the overview poll is app-wide
18559
- * (a creating overview would warm every camera on the install) while this is
18560
- * called by a rendered surface naming the tiles it is actually painting, at
18561
- * the width it is painting them.
18947
+ * always reaches the wrapper. This method therefore CAPTURES, where
18948
+ * `getSnapshotOverview` must never (D93) — the distinction is not "one is
18949
+ * newer" but that the overview poll is app-wide (a capturing overview would
18950
+ * dial every camera on the install) while this is called by a rendered
18951
+ * surface naming the tiles it is actually painting, at the width it is
18952
+ * painting them.
18953
+ *
18954
+ * Since 2026-08-11 this is the ONLY thing that refreshes a snapshot: the
18955
+ * server-side keep-warm loop was removed (operator directive — on-demand,
18956
+ * always), so a camera nobody is looking at costs nothing at all.
18562
18957
  *
18563
18958
  * **It waits, briefly and boundedly, for the capture it triggered.** The
18564
18959
  * returned `capturedAt` is the frame the link will serve, not the frame the
@@ -18776,6 +19171,13 @@ method(object({ locationId: string() }), EvictableUsageSchema), method(object({
18776
19171
  locationId: string(),
18777
19172
  targetBytes: number().int().positive()
18778
19173
  }), EvictResultSchema, { kind: "mutation" });
19174
+ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19175
+ kind: "mutation",
19176
+ auth: "admin"
19177
+ }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
19178
+ kind: "mutation",
19179
+ auth: "admin"
19180
+ });
18779
19181
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
18780
19182
  providerId: string().min(1),
18781
19183
  displayName: string().min(1),
@@ -18879,6 +19281,28 @@ var TerminalProfileInfoSchema = object({
18879
19281
  label: string(),
18880
19282
  description: string().optional()
18881
19283
  });
19284
+ /**
19285
+ * A durable operator-created Terminal instance. Profiles are templates; only
19286
+ * an instance declares a camera.
19287
+ */
19288
+ var TerminalInstanceInfoSchema = object({
19289
+ instanceId: string(),
19290
+ cameraStableId: string(),
19291
+ nodeId: string(),
19292
+ profileId: string(),
19293
+ profileLabel: string(),
19294
+ name: string(),
19295
+ enabled: boolean()
19296
+ });
19297
+ var TerminalLegacyCameraSchema = object({
19298
+ stableId: string(),
19299
+ nodeId: string(),
19300
+ profileId: string(),
19301
+ profileLabel: string(),
19302
+ name: string(),
19303
+ /** Only legacy monitor cameras can retain their historic stable identity. */
19304
+ adoptable: boolean()
19305
+ });
18882
19306
  var TerminalOutputEventSchema = discriminatedUnion("kind", [object({
18883
19307
  seq: number().int().positive(),
18884
19308
  kind: literal("data"),
@@ -18895,7 +19319,29 @@ var TerminalOutputBatchSchema = object({
18895
19319
  snapshot: string().optional(),
18896
19320
  events: array(TerminalOutputEventSchema).readonly()
18897
19321
  });
18898
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
19322
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalInstanceInfoSchema).readonly(), { auth: "admin" }), method(object({
19323
+ targetNodeId: string().min(1),
19324
+ profileId: string().min(1),
19325
+ name: string().trim().min(1).max(160).optional()
19326
+ }), TerminalInstanceInfoSchema, {
19327
+ kind: "mutation",
19328
+ auth: "admin"
19329
+ }), method(object({ instanceId: string().min(1) }), _void(), {
19330
+ kind: "mutation",
19331
+ auth: "admin"
19332
+ }), method(object({
19333
+ instanceId: string().min(1),
19334
+ enabled: boolean()
19335
+ }), TerminalInstanceInfoSchema, {
19336
+ kind: "mutation",
19337
+ auth: "admin"
19338
+ }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
19339
+ stableId: string().min(1),
19340
+ name: string().trim().min(1).max(160).optional()
19341
+ }), TerminalInstanceInfoSchema, {
19342
+ kind: "mutation",
19343
+ auth: "admin"
19344
+ }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
18899
19345
  profileId: string(),
18900
19346
  cols: number().int().positive(),
18901
19347
  rows: number().int().positive()
@@ -18912,7 +19358,13 @@ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }),
18912
19358
  }), method(object({
18913
19359
  sessionId: string(),
18914
19360
  afterSeq: number().int().nonnegative(),
18915
- waitMs: number().int().min(0).max(2e3).default(0)
19361
+ waitMs: number().int().min(0).max(2e3).default(0),
19362
+ /**
19363
+ * Wait when a just-opened session has no output yet. Kept opt-in so a
19364
+ * browser's initial repaint remains immediate; the camera snapshot
19365
+ * relay uses it to avoid encoding a blank startup frame.
19366
+ */
19367
+ waitForOutput: boolean().optional()
18916
19368
  }), TerminalOutputBatchSchema, {
18917
19369
  kind: "mutation",
18918
19370
  auth: "admin",
@@ -21410,6 +21862,7 @@ var FaceInfoSchema = object({
21410
21862
  var FaceFilterEnum = _enum([
21411
21863
  "unassigned",
21412
21864
  "recognized",
21865
+ "identified",
21413
21866
  "all"
21414
21867
  ]);
21415
21868
  var MediaFileLiteSchema$1 = object({
@@ -21438,6 +21891,8 @@ method(_void(), array(IdentitySchema).readonly()), method(object({ name: string(
21438
21891
  kind: "mutation",
21439
21892
  auth: "admin"
21440
21893
  }), method(object({
21894
+ /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
21895
+ deviceId: number().int().optional(),
21441
21896
  limit: number().int().positive().optional(),
21442
21897
  filter: FaceFilterEnum.optional(),
21443
21898
  /**
@@ -23718,6 +24173,10 @@ var OsdSourceSchema = discriminatedUnion("kind", [
23718
24173
  capName: string().min(1).max(64),
23719
24174
  /** Dot path inside the slice, e.g. `detected`, `value`, `mode`. */
23720
24175
  valuePath: string().min(1).max(64)
24176
+ }),
24177
+ object({
24178
+ kind: literal("latest-recognition"),
24179
+ recognition: _enum(["person", "plate"])
23721
24180
  })
23722
24181
  ]);
23723
24182
  var OsdSlotBindingSchema = object({
@@ -23823,6 +24282,15 @@ method(object({ deviceId: number().int() }), object({
23823
24282
  }), object({ success: literal(true) }), {
23824
24283
  kind: "mutation",
23825
24284
  auth: "admin"
24285
+ }), method(object({
24286
+ sourceDeviceId: number().int(),
24287
+ targetDeviceId: number().int()
24288
+ }), object({
24289
+ copied: number().int().nonnegative(),
24290
+ skipped: number().int().nonnegative()
24291
+ }), {
24292
+ kind: "mutation",
24293
+ auth: "admin"
23826
24294
  }), method(object({
23827
24295
  deviceId: number().int(),
23828
24296
  slotId: string().min(1),
@@ -24832,7 +25300,19 @@ var RecordingManifestSchema = object({
24832
25300
  * profiles/subtrees/locations on this node). */
24833
25301
  var RecordingDeviceUsageSchema = object({
24834
25302
  deviceId: number(),
24835
- usedBytes: number()
25303
+ usedBytes: number(),
25304
+ /**
25305
+ * Start of this camera's OLDEST indexed segment, across every profile and
25306
+ * location — the "Oldest footage" column in Recordings → Storage, and the
25307
+ * only honest answer to "is retention actually holding?" per camera.
25308
+ *
25309
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
25310
+ * predates this field omits it entirely, and a hub whose types carry the
25311
+ * field must keep validating that older provider's payload: the framework
25312
+ * (types) and the addon ship on different trains, and the addon is usually
25313
+ * the later of the two.
25314
+ */
25315
+ oldestMs: number().nullable().optional()
24836
25316
  });
24837
25317
  /** Recording storage usage + capacity for one storage location. */
24838
25318
  var RecordingLocationUsageSchema = object({
@@ -24860,6 +25340,57 @@ var RecordingStorageUsageSchema = object({
24860
25340
  locations: array(RecordingLocationUsageSchema)
24861
25341
  });
24862
25342
  /**
25343
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
25344
+ *
25345
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
25346
+ * is the operator asking for the EXISTING archive to be brought into line with
25347
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
25348
+ * location, run FIFO behind the single-flight mover.
25349
+ *
25350
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
25351
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
25352
+ * (empty on the plan).
25353
+ */
25354
+ var RecordingRebalanceMoveSchema = object({
25355
+ deviceId: number(),
25356
+ profile: string(),
25357
+ fromLocationId: string(),
25358
+ toLocationId: string(),
25359
+ bytes: number(),
25360
+ files: number().int()
25361
+ });
25362
+ /** Why a pile that is out of place is staying there. Every refusal is
25363
+ * reported: a rebalance that silently drops a camera reads exactly like one
25364
+ * that had nothing to do. */
25365
+ var RecordingRebalanceSkipReasonSchema = _enum([
25366
+ "unassigned",
25367
+ "target-not-writable",
25368
+ "below-threshold",
25369
+ "no-headroom"
25370
+ ]);
25371
+ var RecordingRebalanceSkipSchema = object({
25372
+ deviceId: number(),
25373
+ profile: string(),
25374
+ fromLocationId: string(),
25375
+ /** The location the plan wants; null when the camera has no assignment. */
25376
+ toLocationId: string().nullable(),
25377
+ bytes: number(),
25378
+ reason: RecordingRebalanceSkipReasonSchema
25379
+ });
25380
+ var RecordingRebalancePlanSchema = object({
25381
+ moves: array(RecordingRebalanceMoveSchema),
25382
+ skipped: array(RecordingRebalanceSkipSchema),
25383
+ bytesToMove: number(),
25384
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
25385
+ jobIds: array(string())
25386
+ });
25387
+ var RecordingRebalanceInputSchema = object({
25388
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
25389
+ throttleMbps: number().min(1).max(1e3).optional(),
25390
+ /** Ignore piles smaller than this (default 1 GB). */
25391
+ minMoveGb: number().min(0).optional()
25392
+ });
25393
+ /**
24863
25394
  * Result of locating footage at a wall-clock instant for one device/profile.
24864
25395
  * `segment` carries the covering segment's window; `gap` reports the forward
24865
25396
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -25007,6 +25538,21 @@ method(object({
25007
25538
  }), {
25008
25539
  kind: "mutation",
25009
25540
  auth: "admin"
25541
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
25542
+ kind: "mutation",
25543
+ auth: "admin"
25544
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
25545
+ kind: "mutation",
25546
+ auth: "admin"
25547
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
25548
+ kind: "mutation",
25549
+ auth: "admin"
25550
+ }), method(StorageMigrationFootageMoveInputSchema, object({ jobId: string() }), {
25551
+ kind: "mutation",
25552
+ auth: "admin"
25553
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
25554
+ kind: "mutation",
25555
+ auth: "admin"
25010
25556
  }), method(RelocateFootageInputSchema, object({ jobId: string() }), {
25011
25557
  kind: "mutation",
25012
25558
  auth: "admin"
@@ -25016,9 +25562,15 @@ method(object({
25016
25562
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
25017
25563
  kind: "mutation",
25018
25564
  auth: "admin"
25565
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25566
+ kind: "query",
25567
+ auth: "admin"
25568
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25569
+ kind: "mutation",
25570
+ auth: "admin"
25019
25571
  });
25020
25572
  /**
25021
- * `recordingExport` cap — render a footage time range into a single downloadable
25573
+ * `recording-export` cap — render a footage time range into a single downloadable
25022
25574
  * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
25023
25575
  * bounded lifetime with a durable history, auto-expiry, and optional
25024
25576
  * delete-after-download.
@@ -25033,10 +25585,42 @@ method(object({
25033
25585
  */
25034
25586
  /** Playback-speed multiplier for the render (1 = realtime). */
25035
25587
  var ExportSpeedSchema = number().min(.25).max(32);
25588
+ /**
25589
+ * One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
25590
+ *
25591
+ * Relative and not absolute epoch on purpose: the renderer's frame-select
25592
+ * expression sees ffmpeg's `t`, which starts at 0 for the export's source
25593
+ * playlist. Handing it absolute epochs would make every call site responsible
25594
+ * for the same subtraction, and the one that forgot would emit a filter that
25595
+ * selects nothing — silently, as a uniform timelapse.
25596
+ */
25597
+ var ExportDenseRangeSchema = object({
25598
+ fromSec: number().nonnegative(),
25599
+ toSec: number().nonnegative()
25600
+ }).refine((r) => r.toSec > r.fromSec, { message: "dense range must have toSec > fromSec" });
25601
+ /**
25602
+ * Dense-interval overlay for a timelapse: sample at `dense.everyMs` INSIDE the
25603
+ * listed ranges and at the base `everyMs` everywhere else.
25604
+ *
25605
+ * `everyMs` must be strictly smaller than the base cadence — a dense rate that
25606
+ * is not denser renders a uniform timelapse the operator believes is two-rate.
25607
+ */
25608
+ var ExportDenseSchema = object({
25609
+ everyMs: number().int().positive(),
25610
+ ranges: array(ExportDenseRangeSchema).min(1).max(200)
25611
+ });
25036
25612
  /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
25037
25613
  var ExportTimelapseSchema = object({
25038
25614
  everyMs: number().int().positive(),
25039
- outputFps: number().int().min(1).max(60).optional()
25615
+ outputFps: number().int().min(1).max(60).optional(),
25616
+ /** Optional second, FASTER rate over the intervals that matter. */
25617
+ dense: ExportDenseSchema.optional()
25618
+ }).superRefine((v, ctx) => {
25619
+ if (v.dense !== void 0 && v.dense.everyMs >= v.everyMs) ctx.addIssue({
25620
+ code: ZodIssueCode$16.custom,
25621
+ message: "dense.everyMs must be strictly smaller than the base everyMs",
25622
+ path: ["dense", "everyMs"]
25623
+ });
25040
25624
  });
25041
25625
  /**
25042
25626
  * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
@@ -25094,6 +25678,19 @@ var ExportDownloadSchema = object({
25094
25678
  url: string(),
25095
25679
  endpoints: array(string())
25096
25680
  });
25681
+ /**
25682
+ * A finished export's bytes, inline.
25683
+ *
25684
+ * `bytes` is the DECODED length — the number the caller bounds and logs
25685
+ * against, so nobody has to infer it from the base64 length.
25686
+ */
25687
+ var ExportBytesSchema = object({
25688
+ base64: string(),
25689
+ contentType: string(),
25690
+ /** Suggested filename, extension included. */
25691
+ name: string(),
25692
+ bytes: number().int().nonnegative()
25693
+ });
25097
25694
  method(object({
25098
25695
  deviceId: number(),
25099
25696
  profile: string(),
@@ -25118,6 +25715,9 @@ method(object({
25118
25715
  }), method(object({ exportId: string() }), ExportDownloadSchema, {
25119
25716
  kind: "query",
25120
25717
  auth: "protected"
25718
+ }), method(object({ exportId: string() }), ExportBytesSchema, {
25719
+ kind: "query",
25720
+ auth: "protected"
25121
25721
  });
25122
25722
  /**
25123
25723
  * scene-monitor — device-scoped reference-region state cap. An operator marks
@@ -30910,6 +31510,12 @@ Object.freeze({
30910
31510
  addonId: null,
30911
31511
  access: "delete"
30912
31512
  },
31513
+ "osdManager.copyDeviceConfiguration": {
31514
+ capName: "osd-manager",
31515
+ capScope: "system",
31516
+ addonId: null,
31517
+ access: "create"
31518
+ },
30913
31519
  "osdManager.getConditionSupport": {
30914
31520
  capName: "osd-manager",
30915
31521
  capScope: "system",
@@ -31006,7 +31612,7 @@ Object.freeze({
31006
31612
  addonId: null,
31007
31613
  access: "create"
31008
31614
  },
31009
- "pipelineAnalytics.cancelMediaRelocate": {
31615
+ "pipelineAnalytics.cancelStorageMigrationMove": {
31010
31616
  capName: "pipeline-analytics",
31011
31617
  capScope: "device",
31012
31618
  addonId: null,
@@ -31078,12 +31684,6 @@ Object.freeze({
31078
31684
  addonId: null,
31079
31685
  access: "view"
31080
31686
  },
31081
- "pipelineAnalytics.getMediaRelocateStatus": {
31082
- capName: "pipeline-analytics",
31083
- capScope: "device",
31084
- addonId: null,
31085
- access: "view"
31086
- },
31087
31687
  "pipelineAnalytics.getMotionEvents": {
31088
31688
  capName: "pipeline-analytics",
31089
31689
  capScope: "device",
@@ -31120,6 +31720,12 @@ Object.freeze({
31120
31720
  addonId: null,
31121
31721
  access: "view"
31122
31722
  },
31723
+ "pipelineAnalytics.getStorageMigrationMoveStatus": {
31724
+ capName: "pipeline-analytics",
31725
+ capScope: "device",
31726
+ addonId: null,
31727
+ access: "view"
31728
+ },
31123
31729
  "pipelineAnalytics.getTrack": {
31124
31730
  capName: "pipeline-analytics",
31125
31731
  capScope: "device",
@@ -31198,6 +31804,12 @@ Object.freeze({
31198
31804
  addonId: null,
31199
31805
  access: "view"
31200
31806
  },
31807
+ "pipelineAnalytics.pauseForStorageMigration": {
31808
+ capName: "pipeline-analytics",
31809
+ capScope: "device",
31810
+ addonId: null,
31811
+ access: "create"
31812
+ },
31201
31813
  "pipelineAnalytics.proposeRetrainAnnotations": {
31202
31814
  capName: "pipeline-analytics",
31203
31815
  capScope: "device",
@@ -31228,7 +31840,7 @@ Object.freeze({
31228
31840
  addonId: null,
31229
31841
  access: "create"
31230
31842
  },
31231
- "pipelineAnalytics.relocateMedia": {
31843
+ "pipelineAnalytics.refreshStorageLocationsForMigration": {
31232
31844
  capName: "pipeline-analytics",
31233
31845
  capScope: "device",
31234
31846
  addonId: null,
@@ -31240,6 +31852,12 @@ Object.freeze({
31240
31852
  addonId: null,
31241
31853
  access: "create"
31242
31854
  },
31855
+ "pipelineAnalytics.resumeForStorageMigration": {
31856
+ capName: "pipeline-analytics",
31857
+ capScope: "device",
31858
+ addonId: null,
31859
+ access: "create"
31860
+ },
31243
31861
  "pipelineAnalytics.saveRetrainAnnotations": {
31244
31862
  capName: "pipeline-analytics",
31245
31863
  capScope: "device",
@@ -31264,6 +31882,12 @@ Object.freeze({
31264
31882
  addonId: null,
31265
31883
  access: "create"
31266
31884
  },
31885
+ "pipelineAnalytics.startStorageMigrationMove": {
31886
+ capName: "pipeline-analytics",
31887
+ capScope: "device",
31888
+ addonId: null,
31889
+ access: "create"
31890
+ },
31267
31891
  "pipelineAnalytics.wipeAllAnalytics": {
31268
31892
  capName: "pipeline-analytics",
31269
31893
  capScope: "device",
@@ -31630,6 +32254,12 @@ Object.freeze({
31630
32254
  addonId: null,
31631
32255
  access: "view"
31632
32256
  },
32257
+ "pipelineOrchestrator.pauseForStorageMigration": {
32258
+ capName: "pipeline-orchestrator",
32259
+ capScope: "system",
32260
+ addonId: null,
32261
+ access: "create"
32262
+ },
31633
32263
  "pipelineOrchestrator.rebalance": {
31634
32264
  capName: "pipeline-orchestrator",
31635
32265
  capScope: "system",
@@ -31654,6 +32284,12 @@ Object.freeze({
31654
32284
  addonId: null,
31655
32285
  access: "view"
31656
32286
  },
32287
+ "pipelineOrchestrator.resumeForStorageMigration": {
32288
+ capName: "pipeline-orchestrator",
32289
+ capScope: "system",
32290
+ addonId: null,
32291
+ access: "create"
32292
+ },
31657
32293
  "pipelineOrchestrator.saveTemplate": {
31658
32294
  capName: "pipeline-orchestrator",
31659
32295
  capScope: "system",
@@ -32050,7 +32686,13 @@ Object.freeze({
32050
32686
  addonId: null,
32051
32687
  access: "create"
32052
32688
  },
32053
- "recording.cancelRelocate": {
32689
+ "recording.cancelRelocateJob": {
32690
+ capName: "recording",
32691
+ capScope: "system",
32692
+ addonId: null,
32693
+ access: "create"
32694
+ },
32695
+ "recording.cancelStorageMigrationMove": {
32054
32696
  capName: "recording",
32055
32697
  capScope: "system",
32056
32698
  addonId: null,
@@ -32086,7 +32728,7 @@ Object.freeze({
32086
32728
  addonId: null,
32087
32729
  access: "view"
32088
32730
  },
32089
- "recording.getRelocateStatus": {
32731
+ "recording.getStorageMigrationMoveStatus": {
32090
32732
  capName: "recording",
32091
32733
  capScope: "system",
32092
32734
  addonId: null,
@@ -32104,12 +32746,30 @@ Object.freeze({
32104
32746
  addonId: null,
32105
32747
  access: "view"
32106
32748
  },
32749
+ "recording.listRelocateJobs": {
32750
+ capName: "recording",
32751
+ capScope: "system",
32752
+ addonId: null,
32753
+ access: "view"
32754
+ },
32107
32755
  "recording.locateSegment": {
32108
32756
  capName: "recording",
32109
32757
  capScope: "system",
32110
32758
  addonId: null,
32111
32759
  access: "view"
32112
32760
  },
32761
+ "recording.pauseForStorageMigration": {
32762
+ capName: "recording",
32763
+ capScope: "system",
32764
+ addonId: null,
32765
+ access: "create"
32766
+ },
32767
+ "recording.planStorageRebalance": {
32768
+ capName: "recording",
32769
+ capScope: "system",
32770
+ addonId: null,
32771
+ access: "view"
32772
+ },
32113
32773
  "recording.pruneFootage": {
32114
32774
  capName: "recording",
32115
32775
  capScope: "system",
@@ -32128,6 +32788,12 @@ Object.freeze({
32128
32788
  addonId: null,
32129
32789
  access: "view"
32130
32790
  },
32791
+ "recording.refreshStorageLocationsForMigration": {
32792
+ capName: "recording",
32793
+ capScope: "system",
32794
+ addonId: null,
32795
+ access: "create"
32796
+ },
32131
32797
  "recording.relocateFootage": {
32132
32798
  capName: "recording",
32133
32799
  capScope: "system",
@@ -32152,44 +32818,68 @@ Object.freeze({
32152
32818
  addonId: null,
32153
32819
  access: "create"
32154
32820
  },
32821
+ "recording.resumeForStorageMigration": {
32822
+ capName: "recording",
32823
+ capScope: "system",
32824
+ addonId: null,
32825
+ access: "create"
32826
+ },
32155
32827
  "recording.setDeviceConfig": {
32156
32828
  capName: "recording",
32157
32829
  capScope: "system",
32158
32830
  addonId: null,
32159
32831
  access: "create"
32160
32832
  },
32833
+ "recording.startStorageMigrationMove": {
32834
+ capName: "recording",
32835
+ capScope: "system",
32836
+ addonId: null,
32837
+ access: "create"
32838
+ },
32839
+ "recording.startStorageRebalance": {
32840
+ capName: "recording",
32841
+ capScope: "system",
32842
+ addonId: null,
32843
+ access: "create"
32844
+ },
32161
32845
  "recordingExport.cancelExport": {
32162
- capName: "recordingExport",
32846
+ capName: "recording-export",
32163
32847
  capScope: "system",
32164
32848
  addonId: null,
32165
32849
  access: "create"
32166
32850
  },
32167
32851
  "recordingExport.createExport": {
32168
- capName: "recordingExport",
32852
+ capName: "recording-export",
32169
32853
  capScope: "system",
32170
32854
  addonId: null,
32171
32855
  access: "create"
32172
32856
  },
32173
32857
  "recordingExport.deleteExport": {
32174
- capName: "recordingExport",
32858
+ capName: "recording-export",
32175
32859
  capScope: "system",
32176
32860
  addonId: null,
32177
32861
  access: "delete"
32178
32862
  },
32179
32863
  "recordingExport.getDownloadUrl": {
32180
- capName: "recordingExport",
32864
+ capName: "recording-export",
32181
32865
  capScope: "system",
32182
32866
  addonId: null,
32183
32867
  access: "view"
32184
32868
  },
32185
32869
  "recordingExport.getExport": {
32186
- capName: "recordingExport",
32870
+ capName: "recording-export",
32187
32871
  capScope: "system",
32188
32872
  addonId: null,
32189
32873
  access: "view"
32190
32874
  },
32191
32875
  "recordingExport.listExports": {
32192
- capName: "recordingExport",
32876
+ capName: "recording-export",
32877
+ capScope: "system",
32878
+ addonId: null,
32879
+ access: "view"
32880
+ },
32881
+ "recordingExport.readExportBytes": {
32882
+ capName: "recording-export",
32193
32883
  capScope: "system",
32194
32884
  addonId: null,
32195
32885
  access: "view"
@@ -32548,6 +33238,30 @@ Object.freeze({
32548
33238
  addonId: null,
32549
33239
  access: "view"
32550
33240
  },
33241
+ "storageMigration.cancel": {
33242
+ capName: "storage-migration",
33243
+ capScope: "system",
33244
+ addonId: null,
33245
+ access: "create"
33246
+ },
33247
+ "storageMigration.plan": {
33248
+ capName: "storage-migration",
33249
+ capScope: "system",
33250
+ addonId: null,
33251
+ access: "view"
33252
+ },
33253
+ "storageMigration.start": {
33254
+ capName: "storage-migration",
33255
+ capScope: "system",
33256
+ addonId: null,
33257
+ access: "create"
33258
+ },
33259
+ "storageMigration.status": {
33260
+ capName: "storage-migration",
33261
+ capScope: "system",
33262
+ addonId: null,
33263
+ access: "view"
33264
+ },
32551
33265
  "storageProvider.abortUpload": {
32552
33266
  capName: "storage-provider",
32553
33267
  capScope: "system",
@@ -32926,12 +33640,42 @@ Object.freeze({
32926
33640
  addonId: null,
32927
33641
  access: "create"
32928
33642
  },
33643
+ "terminalSession.adoptLegacyMonitor": {
33644
+ capName: "terminal-session",
33645
+ capScope: "system",
33646
+ addonId: null,
33647
+ access: "create"
33648
+ },
32929
33649
  "terminalSession.close": {
32930
33650
  capName: "terminal-session",
32931
33651
  capScope: "system",
32932
33652
  addonId: null,
32933
33653
  access: "create"
32934
33654
  },
33655
+ "terminalSession.createInstance": {
33656
+ capName: "terminal-session",
33657
+ capScope: "system",
33658
+ addonId: null,
33659
+ access: "create"
33660
+ },
33661
+ "terminalSession.deleteInstance": {
33662
+ capName: "terminal-session",
33663
+ capScope: "system",
33664
+ addonId: null,
33665
+ access: "delete"
33666
+ },
33667
+ "terminalSession.listInstances": {
33668
+ capName: "terminal-session",
33669
+ capScope: "system",
33670
+ addonId: null,
33671
+ access: "view"
33672
+ },
33673
+ "terminalSession.listLegacyCameras": {
33674
+ capName: "terminal-session",
33675
+ capScope: "system",
33676
+ addonId: null,
33677
+ access: "view"
33678
+ },
32935
33679
  "terminalSession.listProfiles": {
32936
33680
  capName: "terminal-session",
32937
33681
  capScope: "system",
@@ -32962,6 +33706,12 @@ Object.freeze({
32962
33706
  addonId: null,
32963
33707
  access: "create"
32964
33708
  },
33709
+ "terminalSession.setInstanceEnabled": {
33710
+ capName: "terminal-session",
33711
+ capScope: "system",
33712
+ addonId: null,
33713
+ access: "create"
33714
+ },
32965
33715
  "terminalSession.writeInput": {
32966
33716
  capName: "terminal-session",
32967
33717
  capScope: "system",
@@ -33506,6 +34256,104 @@ var FramerateField = number().int().min(1).max(60);
33506
34256
  var TargetsField = array(NcRuleTargetSchema).min(1);
33507
34257
  var PriorityField = number().int().min(1).max(5);
33508
34258
  /**
34259
+ * Explicit override of the DENSE sampling cadence, seconds.
34260
+ *
34261
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
34262
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
34263
+ * made that same base 3 s and rendered a person pass as two frames.)
34264
+ *
34265
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
34266
+ * `denseCadenceSec` and played at `framerate` occupies
34267
+ *
34268
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
34269
+ *
34270
+ * 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.
34271
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
34272
+ * and therefore the length of a quiet night, does not move.
34273
+ *
34274
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
34275
+ * the recording has them returns the same frames, requested twice. Must be
34276
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
34277
+ * a uniform video the operator believes is two-rate — and upsert refuses it
34278
+ * rather than letting the export cap reject the render hours after the window.
34279
+ */
34280
+ var DenseCadenceSecField = number().min(.1).max(3600);
34281
+ /**
34282
+ * Minimum seconds of OUTPUT video each detection range must occupy.
34283
+ *
34284
+ * The operator-facing form of the arithmetic above: instead of solving for a
34285
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
34286
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
34287
+ * that range every ~583 ms.
34288
+ *
34289
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
34290
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
34291
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
34292
+ * ranges are sampled denser than they need. Per-range cadences require a cap
34293
+ * schema change and are the tracked follow-up.
34294
+ *
34295
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
34296
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
34297
+ * by real footage, never met by duplicating frames into motion that never
34298
+ * happened.
34299
+ */
34300
+ var MinDwellSecField = number().min(0).max(60);
34301
+ /**
34302
+ * Caption burned into the notification's preview frame.
34303
+ *
34304
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
34305
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
34306
+ * templating dialect for one field would be a second thing to explain.
34307
+ *
34308
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
34309
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
34310
+ * the reason this is not `.min(1)`.
34311
+ */
34312
+ var PreviewTextField = string().max(200);
34313
+ /**
34314
+ * Whether the notification's preview is a STILL or a short animation.
34315
+ *
34316
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
34317
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
34318
+ * night reads better as three seconds of motion than as one frame of it. Both
34319
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
34320
+ * simply applies it to a dozen frames sampled across the render and assembles
34321
+ * them.
34322
+ *
34323
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
34324
+ * seeks and a palette pass, and no rule that never asked for one should start
34325
+ * paying that on the deploy that shipped it.
34326
+ *
34327
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
34328
+ */
34329
+ var PreviewModeField = _enum(["image", "gif"]);
34330
+ /**
34331
+ * Which detection classes the notification reports counts for.
34332
+ *
34333
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
34334
+ * plan — no second query — aggregated per class. Absent or empty means "every
34335
+ * class the window actually contained", which is what an operator who never
34336
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
34337
+ * counts cars all night).
34338
+ *
34339
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
34340
+ * …). An unknown name simply never matches and reports nothing — it is not an
34341
+ * error, because a rule may legitimately name a class this camera's model does
34342
+ * not emit.
34343
+ *
34344
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
34345
+ * - `{{detections}}` — total over the reported classes
34346
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
34347
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
34348
+ * one per class, `count_` + the class name
34349
+ *
34350
+ * With NO custom body template the summary is appended to the derived body, and
34351
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
34352
+ * reads. With a custom template the operator owns every word — nothing is
34353
+ * appended, so `{{detectionSummary}}` is how he asks for it.
34354
+ */
34355
+ var ReportClassesField = array(string().min(1).max(40)).max(20);
34356
+ /**
33509
34357
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
33510
34358
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
33511
34359
  * here (see the ownership note above).
@@ -33525,9 +34373,30 @@ var TimelapseRuleInputSchema = object({
33525
34373
  cadenceSec: CadenceSecField.default(15),
33526
34374
  /** Output frames per second of the assembled mp4 (predecessor parity). */
33527
34375
  framerate: FramerateField.default(10),
34376
+ /**
34377
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
34378
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
34379
+ * field gets.
34380
+ */
34381
+ denseCadenceSec: DenseCadenceSecField.optional(),
34382
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
34383
+ minDwellSec: MinDwellSecField.optional(),
33528
34384
  /** `notification-output` targets the finished video/thumbnail is sent to. */
33529
34385
  targets: TargetsField,
33530
34386
  template: TimelapseTemplateSchema.optional(),
34387
+ /**
34388
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
34389
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
34390
+ *
34391
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
34392
+ * the notification's title/body, and clearing it (`template: null`) must not
34393
+ * silently clear the caption too.
34394
+ */
34395
+ previewText: PreviewTextField.optional(),
34396
+ /** Still or animation — see {@link PreviewModeField}. */
34397
+ previewMode: PreviewModeField.default("image"),
34398
+ /** Classes the notification counts — see {@link ReportClassesField}. */
34399
+ reportClasses: ReportClassesField.optional(),
33531
34400
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
33532
34401
  priority: PriorityField.default(3)
33533
34402
  });
@@ -33538,8 +34407,13 @@ object({
33538
34407
  schedule: NcScheduleSchema.optional(),
33539
34408
  cadenceSec: CadenceSecField.optional(),
33540
34409
  framerate: FramerateField.optional(),
34410
+ denseCadenceSec: DenseCadenceSecField.optional(),
34411
+ minDwellSec: MinDwellSecField.optional(),
33541
34412
  targets: TargetsField.optional(),
33542
34413
  template: TimelapseTemplateSchema.nullable().optional(),
34414
+ previewText: PreviewTextField.optional(),
34415
+ previewMode: PreviewModeField.optional(),
34416
+ reportClasses: ReportClassesField.optional(),
33543
34417
  priority: PriorityField.optional()
33544
34418
  });
33545
34419
  TimelapseRuleInputSchema.extend({
@@ -33551,10 +34425,28 @@ TimelapseRuleInputSchema.extend({
33551
34425
  */
33552
34426
  ownerUserId: string().optional(),
33553
34427
  /**
33554
- * Epoch-ms of the last successful generation the 1-hour re-generation
33555
- * guard's durable state (predecessor parity). Absent = never generated.
34428
+ * Epoch-ms of the NEWEST successful generation across every camera of this
34429
+ * rule. What a UI shows, and the compatibility floor for
34430
+ * {@link readTimelapseGeneratedAt}. Absent = never generated.
33556
34431
  */
33557
34432
  lastGeneratedAt: number().optional(),
34433
+ /**
34434
+ * PER-CAMERA generation state, keyed by `String(deviceId)` — the
34435
+ * re-generation guard's real durable state.
34436
+ *
34437
+ * One rule covers several cameras and each renders its own video, so a rule
34438
+ * -wide stamp is wrong in the direction that DESTROYS work: camera A
34439
+ * succeeding at 06:05 tells camera B, whose render failed, that it is
34440
+ * already done — and B's night is gone for good, because the window will not
34441
+ * come back.
34442
+ *
34443
+ * ADDITIVE, so the migration is free: a row written before this field simply
34444
+ * has no map, and {@link readTimelapseGeneratedAt} falls back to
34445
+ * {@link TimelapseRuleSchema.shape.lastGeneratedAt}. Reading an old row as
34446
+ * "never generated" would re-render and re-notify every camera of every rule
34447
+ * once, on the deploy that shipped the map.
34448
+ */
34449
+ generatedByDevice: record(string(), number()).optional(),
33558
34450
  /** userId of the caller who created the rule (server-stamped). */
33559
34451
  createdBy: string(),
33560
34452
  createdAt: number(),
@@ -223509,6 +224401,47 @@ function isRecoverableBaichuanError(err) {
223509
224401
  return RECOVERABLE_FRAGMENTS.some((fragment) => message.includes(fragment));
223510
224402
  }
223511
224403
  //#endregion
224404
+ //#region src/ptz-zoom.ts
224405
+ /**
224406
+ * Fraction of total zoom travel moved by ONE press. ~8 presses to cross
224407
+ * the full range reads like a zoom rocker.
224408
+ */
224409
+ var ZOOM_STEP_FRACTION = .12;
224410
+ /** `zoomToFactor` expresses an absolute movePos as `factor * 1000`. */
224411
+ var ZOOM_FACTOR_SCALE = 1e3;
224412
+ /** Pause before the retry above — long enough for the lens to settle. */
224413
+ var ZOOM_SET_RETRY_MS = 1500;
224414
+ /**
224415
+ * Resolve the absolute zoom position one press should drive to.
224416
+ *
224417
+ * Only the SIGN of `zoom` is read. Pan/tilt already discard their
224418
+ * magnitude, and the two clients disagree on it anyway — the viewer
224419
+ * sends ±0.2 per press while ui-library sends ±1 — so honouring
224420
+ * magnitude would make the same button travel different distances
224421
+ * depending on which app pressed it.
224422
+ */
224423
+ var resolveZoomStep = (travel, zoom) => {
224424
+ if (!Number.isFinite(travel.minPos) || !Number.isFinite(travel.maxPos)) return {
224425
+ kind: "refused",
224426
+ reason: "no-travel"
224427
+ };
224428
+ if (travel.maxPos <= travel.minPos) return {
224429
+ kind: "refused",
224430
+ reason: "no-travel"
224431
+ };
224432
+ const step = (travel.maxPos - travel.minPos) * ZOOM_STEP_FRACTION;
224433
+ const raw = travel.curPos + Math.sign(zoom) * step;
224434
+ const target = Math.round(Math.min(travel.maxPos, Math.max(travel.minPos, raw)));
224435
+ if (target === travel.curPos) return {
224436
+ kind: "refused",
224437
+ reason: "at-limit"
224438
+ };
224439
+ return {
224440
+ kind: "move",
224441
+ target
224442
+ };
224443
+ };
224444
+ //#endregion
223512
224445
  //#region src/intercom-encoder.ts
223513
224446
  /**
223514
224447
  * IMA ADPCM (DVI4) encoder — Reolink Baichuan talk-back wire format.
@@ -228931,14 +229864,16 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
228931
229864
  }
228932
229865
  }
228933
229866
  /**
228934
- * Translate normalized (-1..1) pan/tilt/zoom to one or more discrete
228935
- * Baichuan PTZ commands. Camstack ptz uses ONVIF-style continuous
229867
+ * Translate normalized (-1..1) pan/tilt to discrete Baichuan
229868
+ * directional commands. Camstack ptz uses ONVIF-style continuous
228936
229869
  * motion vectors; Reolink Baichuan needs discrete directional
228937
- * commands (Left/Right/Up/Down/ZoomIn/ZoomOut). Magnitudes map to
228938
- * speed (0–63 typical). Continuous=true issues 'start' (camera moves
228939
- * until next 'stop'); continuous=false issues 'start' followed by an
228940
- * autoStop after a short window so a single tap of an arrow key
228941
- * results in a tiny nudge.
229870
+ * commands (Left/Right/Up/Down). Magnitudes map to speed (0–63
229871
+ * typical). Continuous=true issues 'start' (camera moves until next
229872
+ * 'stop'); continuous=false issues 'start' followed by an autoStop
229873
+ * after a short window so a single tap of an arrow key results in a
229874
+ * tiny nudge.
229875
+ *
229876
+ * Zoom is NOT a direction on this frame — see `runZoom`.
228942
229877
  */
228943
229878
  async runPtz(pan, tilt, zoom, speed, continuous) {
228944
229879
  const api = await this.ensureApi();
@@ -228946,7 +229881,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
228946
229881
  const cmds = [];
228947
229882
  if (pan !== void 0 && Math.abs(pan) > .01) cmds.push(pan > 0 ? "Right" : "Left");
228948
229883
  if (tilt !== void 0 && Math.abs(tilt) > .01) cmds.push(tilt > 0 ? "Up" : "Down");
228949
- if (zoom !== void 0 && Math.abs(zoom) > .01) cmds.push(zoom > 0 ? "ZoomIn" : "ZoomOut");
229884
+ if (zoom !== void 0 && Math.abs(zoom) > .01) await this.runZoom(api, channel, zoom);
228950
229885
  if (cmds.length === 0) return;
228951
229886
  const baichuanSpeed = speed === void 0 ? 32 : Math.max(1, Math.min(63, Math.round(speed * 63)));
228952
229887
  for (const command of cmds) try {
@@ -228966,6 +229901,67 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
228966
229901
  });
228967
229902
  }
228968
229903
  }
229904
+ /**
229905
+ * Step the lens along the camera's own zoom travel.
229906
+ *
229907
+ * Baichuan has NO directional zoom on MSG_ID_PTZ_CONTROL (cmd 18) —
229908
+ * that frame accepts left/right/up/down and nothing else, so every
229909
+ * zoom this provider ever sent threw `Unsupported PTZ command for
229910
+ * MSG_ID_PTZ_CONTROL: ZoomIn` inside the lib, got swallowed into a
229911
+ * WARN, and returned void. The cap reported success and the lens
229912
+ * never moved: zoom has never worked on a Reolink here.
229913
+ *
229914
+ * The step arithmetic lives in `resolveZoomStep` (`./ptz-zoom.js`);
229915
+ * this method is only the I/O around it. A camera whose answer
229916
+ * carries no `<zoom>` block has no zoom to drive — that is a dropped
229917
+ * command and it is logged as one.
229918
+ */
229919
+ async runZoom(api, channel, zoom) {
229920
+ try {
229921
+ const range = (await api.getZoomFocus(channel)).zoom;
229922
+ if (!range) {
229923
+ this.ctx.logger.warn("Baichuan zoom dropped — camera reported no zoom travel", {
229924
+ tags: { deviceId: this.id },
229925
+ meta: { reason: "no-zoom-block" }
229926
+ });
229927
+ return;
229928
+ }
229929
+ const step = resolveZoomStep(range, zoom);
229930
+ if (step.kind === "refused") {
229931
+ this.ctx.logger.warn("Baichuan zoom dropped", {
229932
+ tags: { deviceId: this.id },
229933
+ meta: {
229934
+ reason: step.reason,
229935
+ curPos: range.curPos,
229936
+ minPos: range.minPos,
229937
+ maxPos: range.maxPos
229938
+ }
229939
+ });
229940
+ return;
229941
+ }
229942
+ for (let attempt = 1;; attempt += 1) try {
229943
+ await api.zoomToFactor(channel, step.target / ZOOM_FACTOR_SCALE);
229944
+ break;
229945
+ } catch (err) {
229946
+ if (attempt >= 2) throw err;
229947
+ await new Promise((resolve) => setTimeout(resolve, ZOOM_SET_RETRY_MS));
229948
+ }
229949
+ this.ctx.logger.debug("Baichuan zoom applied", {
229950
+ tags: { deviceId: this.id },
229951
+ meta: {
229952
+ from: range.curPos,
229953
+ to: step.target,
229954
+ minPos: range.minPos,
229955
+ maxPos: range.maxPos
229956
+ }
229957
+ });
229958
+ } catch (err) {
229959
+ this.ctx.logger.warn("Baichuan zoom command failed", {
229960
+ tags: { deviceId: this.id },
229961
+ meta: { error: err instanceof Error ? err.message : String(err) }
229962
+ });
229963
+ }
229964
+ }
228969
229965
  async getStreamSources() {
228970
229966
  return buildStreamIds(this.channelCount()).map((s, i) => ({
228971
229967
  id: s.id,
@@ -229274,6 +230270,10 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
229274
230270
  async materializeStreamSocket(camStreamId) {
229275
230271
  const parts = parseCamStreamId(camStreamId, this.getChannel());
229276
230272
  if (!parts || parts.kind !== "native") return;
230273
+ this.ctx.logger.info("broker requested rfc4571 source refresh — materializing on demand", {
230274
+ tags: { deviceId: this.id },
230275
+ meta: { camStreamId }
230276
+ });
229277
230277
  const server = await this.ensureRfc4571Server(camStreamId, parts.channel, parts.profile);
229278
230278
  if (!server) {
229279
230279
  this.ctx.logger.warn("materializeStreamSocket: ensureRfc4571Server returned null", { tags: {
@@ -233768,10 +234768,6 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
233768
234768
  this.ctx.logger.debug("broker requested source refresh without a camStreamId — broker will re-pull the catalog", { tags: { deviceId } });
233769
234769
  return;
233770
234770
  }
233771
- this.ctx.logger.info("broker requested rfc4571 source refresh — materializing on demand", {
233772
- tags: { deviceId },
233773
- meta: { camStreamId }
233774
- });
233775
234771
  await dev.materializeStreamSocket(camStreamId);
233776
234772
  }
233777
234773
  async supportsDiscovery() {