@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.mjs CHANGED
@@ -7239,8 +7239,31 @@ var AdoptionJobSchema = object({
7239
7239
  error: string().nullable()
7240
7240
  });
7241
7241
  /**
7242
- * Per-camera FUNCTION SWITCHES — the one coherent on/off surface over the
7243
- * pipeline functions an operator thinks in terms of.
7242
+ * Per-camera FUNCTION SWITCHES.
7243
+ *
7244
+ * ## The aggregate group is being withdrawn — the BADGE is not (D113)
7245
+ *
7246
+ * This file shipped as "the one coherent on/off surface over the pipeline
7247
+ * functions an operator thinks in terms of". The operator's verdict on
7248
+ * 2026-08-12 was that the coherent surface bought complexity and no clarity:
7249
+ * every function already had a settings page of its own, and a second place to
7250
+ * turn it off is a second place to look. Each switch is going back to its own
7251
+ * component's original options — detection to the detection-pipeline wrapper
7252
+ * binding, audio analysis to its own, recording to `RecordingConfig.enabled`
7253
+ * (which was always first-class; the switch was a veneer over
7254
+ * `recording.setDeviceConfig`), notifications to a notification-center
7255
+ * per-device setting, the two camera planes to their own components.
7256
+ *
7257
+ * What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
7258
+ * thing that lets a status surface say DISABLED instead of BROKEN, recomposed
7259
+ * straight from the authorities with no group in the middle. That rule was
7260
+ * never about a control panel.
7261
+ *
7262
+ * Everything else here — {@link CAMERA_SWITCH_CATALOG}, {@link CameraSwitch},
7263
+ * {@link deriveCameraSwitches}, the `pipelineOrchestrator.getCameraSwitches` /
7264
+ * `setCameraSwitch` pair — is a COMPATIBILITY surface for as long as deployed
7265
+ * viewers (v1.0.305) and the admin UI still call it. It is deleted when they
7266
+ * stop; nothing new may be built on it.
7244
7267
  *
7245
7268
  * ## This file adds no state
7246
7269
  *
@@ -7585,14 +7608,21 @@ var RecordingConfigSchema = object({
7585
7608
  /**
7586
7609
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
7587
7610
  *
7588
- * One shape shared by the recorder's `relocateFootage` (segments) and
7589
- * pipeline-analytics' `relocateMedia` (event media blobs) so the admin Data
7590
- * page renders both movers with one component. Jobs are in-RAM (a restart
7591
- * forgets them re-running is safe by construction: copy-if-absent, delete
7592
- * after verify) and each completed/failed run also lands one durable ops-log
7593
- * row on the owning addon's surface.
7611
+ * One shape shared by the recorder and pipeline-analytics internal movers.
7612
+ * The public admin surface is `storage-migration`; child jobs remain in RAM
7613
+ * because copy-if-absent, verify, delete and index/row repoint are resumable.
7614
+ * Each completed/failed run also lands one durable ops-log row on its owning
7615
+ * addon surface.
7616
+ */
7617
+ /**
7618
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
7619
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
7620
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
7621
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
7622
+ * runs at all.
7594
7623
  */
7595
7624
  var RelocateJobStateSchema = _enum([
7625
+ "queued",
7596
7626
  "running",
7597
7627
  "done",
7598
7628
  "failed",
@@ -7617,19 +7647,109 @@ var RelocateJobSchema = object({
7617
7647
  finishedAt: number().nullable(),
7618
7648
  error: string().nullable()
7619
7649
  });
7650
+ /** Profile-derived footage selection used only by the migration coordinator:
7651
+ * `recordings` owns high+mid; `recordingsLow` owns low. */
7652
+ var RelocateFootageClassSchema = _enum(["recordings", "recordingsLow"]);
7620
7653
  var RelocateFootageInputSchema = object({
7621
- deviceId: number().optional(),
7622
7654
  fromLocationId: string(),
7623
7655
  toLocationId: string(),
7624
7656
  entities: array(_enum(["segments"])).optional(),
7657
+ /** Limits relocation to the logical profile class. Omit only for the
7658
+ * pre-orchestration compatibility path. */
7659
+ footageClass: RelocateFootageClassSchema.optional(),
7660
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
7661
+ * is what a whole-disk drain means. The rebalance path always sets it: its
7662
+ * unit is a (camera, profile) pile, not a disk. */
7663
+ deviceId: number().int().optional(),
7664
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
7665
+ * Finer than `footageClass`, which cannot separate high from mid — and the
7666
+ * placement plan assigns those two independently, so a rebalance that could
7667
+ * only say "recordings" would move footage the plan never asked to move. */
7668
+ profiles: array(string()).optional(),
7625
7669
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7626
7670
  * never allowed to starve live writers. */
7627
7671
  throttleMbps: number().min(1).max(1e3).optional()
7628
7672
  });
7629
- var RelocateMediaInputSchema = object({
7630
- deviceId: number().optional(),
7673
+ /** Internal, lease-scoped participant operation. It is intentionally separate
7674
+ * from persistent recording settings: a migration never changes
7675
+ * `RecordingConfig.enabled` or camera wrapper bindings. */
7676
+ var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7677
+ var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7678
+ var StorageMigrationMediaMoveInputSchema = object({
7631
7679
  toLocationId: string(),
7632
7680
  throttleMbps: number().min(1).max(1e3).optional()
7681
+ }).extend({ leaseId: string().min(1) });
7682
+ /** The independently selectable logical storage classes. `recordings`
7683
+ * encompasses the high and mid segment profiles; `recordingsLow` is low
7684
+ * segments; `eventMedia` is post-analysis blobs. */
7685
+ var StorageMigrationClassSchema = _enum([
7686
+ "recordings",
7687
+ "recordingsLow",
7688
+ "eventMedia"
7689
+ ]);
7690
+ /** A destination is always an existing, fully-qualified location id. The
7691
+ * migration API intentionally never changes a source location's `basePath`:
7692
+ * callers create a new `<type>:<slug>` location, then select it here. */
7693
+ var StorageMigrationDestinationsSchema = object({
7694
+ recordings: string().min(1).optional(),
7695
+ recordingsLow: string().min(1).optional(),
7696
+ eventMedia: string().min(1).optional()
7697
+ }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
7698
+ /** Shared input for planning and starting an orchestrated storage migration. */
7699
+ var StorageMigrationInputSchema = object({
7700
+ destinations: StorageMigrationDestinationsSchema,
7701
+ throttleMbps: number().min(1).max(1e3).optional()
7702
+ });
7703
+ /** The durable coordinator state machine. The only phase that changes default
7704
+ * locations is `repointing`, after every selected mover has completed and been
7705
+ * verified. */
7706
+ var StorageMigrationPhaseSchema = _enum([
7707
+ "planning",
7708
+ "pausing",
7709
+ "moving",
7710
+ "verifying",
7711
+ "repointing",
7712
+ "refreshing",
7713
+ "resuming",
7714
+ "done",
7715
+ "failed",
7716
+ "cancelled"
7717
+ ]);
7718
+ var StorageMigrationParticipantSchema = _enum([
7719
+ "pipeline",
7720
+ "recorder",
7721
+ "analytics"
7722
+ ]);
7723
+ var StorageMigrationMoveSchema = object({
7724
+ storageClass: StorageMigrationClassSchema,
7725
+ fromLocationId: string(),
7726
+ toLocationId: string(),
7727
+ moverJobId: string().nullable(),
7728
+ state: RelocateJobStateSchema.nullable(),
7729
+ error: string().nullable()
7730
+ });
7731
+ var StorageMigrationJobSchema = object({
7732
+ jobId: string(),
7733
+ phase: StorageMigrationPhaseSchema,
7734
+ destinations: StorageMigrationDestinationsSchema,
7735
+ throttleMbps: number(),
7736
+ moves: array(StorageMigrationMoveSchema),
7737
+ pauseLeaseId: string().nullable(),
7738
+ pausedParticipants: array(StorageMigrationParticipantSchema),
7739
+ repointed: boolean(),
7740
+ cancelRequested: boolean(),
7741
+ startedAt: number(),
7742
+ updatedAt: number(),
7743
+ finishedAt: number().nullable(),
7744
+ error: string().nullable()
7745
+ });
7746
+ var StorageMigrationPlanSchema = object({
7747
+ destinations: StorageMigrationDestinationsSchema,
7748
+ moves: array(object({
7749
+ storageClass: StorageMigrationClassSchema,
7750
+ fromLocationId: string(),
7751
+ toLocationId: string()
7752
+ }))
7633
7753
  });
7634
7754
  /**
7635
7755
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -7681,6 +7801,21 @@ var StorageLocationSchema = object({
7681
7801
  nodeId: string().optional(),
7682
7802
  isDefault: boolean().default(false),
7683
7803
  isSystem: boolean().default(false),
7804
+ /**
7805
+ * Operator opt-in: whether consumers that BALANCE across several locations
7806
+ * of a type may write here. Recordings reads it today; event media and
7807
+ * backups are the next consumers, which is why the flag lives on the
7808
+ * location rather than in any one addon's store — nothing has to be
7809
+ * extended to add the next consumer.
7810
+ *
7811
+ * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
7812
+ * flag existed reads back with no flag and keeps working exactly as before;
7813
+ * that is the whole compat story, and it is why no migration ships with it.
7814
+ * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
7815
+ * disk must not silently start writing to it); the default of a type is
7816
+ * always stamped `true`.
7817
+ */
7818
+ enabled: boolean().optional(),
7684
7819
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
7685
7820
  * for node-local locations it can reach) — never persisted, absent when the
7686
7821
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -12420,7 +12555,8 @@ method(object({
12420
12555
  }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12421
12556
  /**
12422
12557
  * filesystem-browse — per-node capability for browsing the node's local
12423
- * filesystem, sandboxed to operator-configured allowed roots. Used by the
12558
+ * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12559
+ * are sandboxed to operator-configured allowed roots (D115). Used by the
12424
12560
  * admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
12425
12561
  * (one provider per node); the hub calls it with `{nodeId}` so the codegen
12426
12562
  * routes to that exact node (default `nodeIdMode:'routing'`).
@@ -14261,6 +14397,13 @@ var MaskGridDimsSchema = object({
14261
14397
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
14262
14398
  * this one field keeps the schema additive — a rule still declares exactly
14263
14399
  * one trigger.
14400
+ *
14401
+ * AUDIO rules add no member here, for the reason occupancy added none: the
14402
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
14403
+ * mirror.ts` fails the build on a member the app cannot render) and every
14404
+ * member costs a release train. A sustained-sound rule is therefore an
14405
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
14406
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
14264
14407
  */
14265
14408
  var NcDeliverySchema = _enum([
14266
14409
  "immediate",
@@ -14275,15 +14418,32 @@ var NcDeliverySchema = _enum([
14275
14418
  * depend on a provider's raw event name or payload shape.
14276
14419
  */
14277
14420
  var NcSystemEventKindSchema = _enum([
14278
- "camera-online",
14279
- "camera-offline",
14421
+ "device-online",
14422
+ "device-offline",
14423
+ "device-disabled",
14424
+ "device-enabled",
14280
14425
  "stream-online",
14281
14426
  "stream-offline",
14282
14427
  "node-online",
14283
14428
  "node-offline",
14284
14429
  "addon-update-available",
14285
- "server-update-available"
14430
+ "server-update-available",
14431
+ "alarm-triggered",
14432
+ "alarm-armed",
14433
+ "alarm-disarmed",
14434
+ "camera-online",
14435
+ "camera-offline",
14436
+ "camera-disabled",
14437
+ "camera-enabled"
14438
+ ]);
14439
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
14440
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
14441
+ "camera-online",
14442
+ "camera-offline",
14443
+ "camera-disabled",
14444
+ "camera-enabled"
14286
14445
  ]);
14446
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
14287
14447
  /**
14288
14448
  * One coherent system-event condition. `kinds` is the required opt-in safety
14289
14449
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -14292,6 +14452,18 @@ var NcSystemEventKindSchema = _enum([
14292
14452
  var NcSystemEventConditionSchema = object({
14293
14453
  kinds: array(NcSystemEventKindSchema).min(1),
14294
14454
  deviceIds: array(number().int()).min(1).optional(),
14455
+ /**
14456
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
14457
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
14458
+ * is what a liveness rule means when nobody said otherwise.
14459
+ *
14460
+ * This is where "only my cameras" is expressed, and it lives on the rule for
14461
+ * one reason: the intake cannot know which devices this household cares
14462
+ * about, and a producer-side filter is one no operator can change. Fails
14463
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
14464
+ * does not carry) matches no `deviceTypes` list.
14465
+ */
14466
+ deviceTypes: array(string().min(1)).min(1).optional(),
14295
14467
  nodeIds: array(string().min(1)).min(1).optional(),
14296
14468
  packageNames: array(string().min(1)).min(1).optional()
14297
14469
  });
@@ -14342,6 +14514,47 @@ var NcOccupancyConditionSchema = object({
14342
14514
  sustainSeconds: number().int().min(0).max(3600).default(15)
14343
14515
  });
14344
14516
  /**
14517
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
14518
+ *
14519
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
14520
+ * reference notifier uses, so an operator moving between them re-uses what
14521
+ * they already know): a rule matches when, over a sampling window of
14522
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14523
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14524
+ *
14525
+ * - `dbThreshold` — its level is at or above this many dBFS (see
14526
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14527
+ * - `labels` — the classifier put at least one of these labels on it.
14528
+ *
14529
+ * Both are OPTIONAL and independent, which is the point of the shape: a
14530
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
14531
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14532
+ * is given** — a window in which every sample is trivially a hit would fire on
14533
+ * silence, so the engine refuses such a condition rather than notifying on
14534
+ * nothing (the schema cannot express "at least one of" without becoming a
14535
+ * ZodEffects the cap path would have to special-case).
14536
+ *
14537
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
14538
+ * must be FULL before it can match — a window that has been open for two
14539
+ * seconds of its ten is 100% of nothing, and firing on it would make
14540
+ * `samplingSeconds` decorative.
14541
+ *
14542
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
14543
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
14544
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
14545
+ * an operator who typed `dog` mean the same thing.
14546
+ */
14547
+ var NcAudioConditionSchema = object({
14548
+ /** Audio macro labels; absent = any sound (level-only rule). */
14549
+ labels: array(string().min(1)).min(1).optional(),
14550
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
14551
+ dbThreshold: number().min(-96).max(0).optional(),
14552
+ /** Percentage of the window's samples that must be hits (1–100). */
14553
+ hitPercent: number().int().min(1).max(100).default(60),
14554
+ /** Length of the sampling window in seconds. */
14555
+ samplingSeconds: number().int().min(1).max(300).default(10)
14556
+ });
14557
+ /**
14345
14558
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
14346
14559
  *
14347
14560
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -14614,7 +14827,33 @@ var NcConditionsSchema = object({
14614
14827
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
14615
14828
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
14616
14829
  */
14617
- occupancy: NcOccupancyConditionSchema.optional()
14830
+ occupancy: NcOccupancyConditionSchema.optional(),
14831
+ /**
14832
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
14833
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
14834
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
14835
+ * a window that is not full yet, neither filter given). See
14836
+ * {@link NcAudioCondition}.
14837
+ *
14838
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
14839
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
14840
+ * a detection, a track or a device event (the same fail-closed pairing
14841
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
14842
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
14843
+ * (an `immediate` rule naming an `audio-*` class, one notification per
14844
+ * classified sample) stays exactly as it was for rules that already use it.
14845
+ *
14846
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
14847
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
14848
+ * (`camstack/src/data/notification-center.ts`, guarded by
14849
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
14850
+ * condition fields it does not know when a rule is saved from the phone.
14851
+ * Publishing an editor for a condition the app cannot round-trip is how an
14852
+ * operator loses a rule's conditions by opening it — so the descriptor, the
14853
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
14854
+ * does an audio rule become authorable.
14855
+ */
14856
+ audio: NcAudioConditionSchema.optional()
14618
14857
  });
14619
14858
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
14620
14859
  var NcRuleTargetSchema = object({
@@ -14728,6 +14967,73 @@ var NcThrottleSchema = object({
14728
14967
  */
14729
14968
  granularity: NcThrottleGranularitySchema.optional()
14730
14969
  });
14970
+ /**
14971
+ * How long the confirm gate may hold ONE notification, and how big the picture
14972
+ * it judges may be.
14973
+ *
14974
+ * The clamp is the product decision, not a coincidence of the model: p50 was
14975
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
14976
+ * arrives after the visitor has gone is not a notification. 448 px was enough
14977
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
14978
+ * tokens for pixels the model pools away.
14979
+ */
14980
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
14981
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
14982
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
14983
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
14984
+ var NcConfirmExpectSchema = object({
14985
+ op: _enum([
14986
+ ">=",
14987
+ ">",
14988
+ "<=",
14989
+ "<",
14990
+ "=="
14991
+ ]),
14992
+ count: number().int().min(0).max(1e3)
14993
+ });
14994
+ /**
14995
+ * AI CONFIRM — a vision model looks at the picture this notification is about
14996
+ * to ship and says whether it agrees with the rule.
14997
+ *
14998
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
14999
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
15000
+ * on the operator's phone is not a verdict about this notification.
15001
+ *
15002
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
15003
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
15004
+ * the default and every fail-open is COUNTED, because a gate that always fails
15005
+ * open looks in the log exactly like a gate that works.
15006
+ *
15007
+ * Every field is `.optional()` rather than relied on as a Zod default at the
15008
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
15009
+ * production failures in one day), so the gate reads absent as the constant
15010
+ * above rather than trusting a parse it may never have seen.
15011
+ */
15012
+ var NcConfirmSchema = object({
15013
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
15014
+ * same thing, and both mean "deliver exactly as before". */
15015
+ enabled: boolean().default(false),
15016
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
15017
+ profileId: string().optional(),
15018
+ /**
15019
+ * The operator's question, in his own words. Absent = a question derived
15020
+ * from the rule (its class and its expectation).
15021
+ *
15022
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
15023
+ * banners, signage and plates as instructions if you let them reach the
15024
+ * prompt — proven live — so the authoritative contract stays in the system
15025
+ * turn and only rule-authored words land here.
15026
+ */
15027
+ prompt: string().max(1e3).optional(),
15028
+ /** Fire only when the model's count satisfies this. Absent = the model's
15029
+ * own boolean verdict decides. */
15030
+ expect: NcConfirmExpectSchema.optional(),
15031
+ timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
15032
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
15033
+ onTimeout: _enum(["fire", "suppress"]).default("fire"),
15034
+ /** Longest edge the judged image is downscaled to before it is sent. */
15035
+ maxImagePx: number().int().min(64).max(2048).default(448)
15036
+ });
14731
15037
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
14732
15038
  var NcRuleInputSchema = object({
14733
15039
  name: string().min(1).max(200),
@@ -14788,7 +15094,13 @@ var NcRuleInputSchema = object({
14788
15094
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
14789
15095
  * shape as every other actuation.
14790
15096
  */
14791
- actions: NcRuleActionsSchema.optional()
15097
+ actions: NcRuleActionsSchema.optional(),
15098
+ /**
15099
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
15100
+ * a rule that predates the gate must keep delivering byte-for-byte as it
15101
+ * did, and absent is the only way to say that without a migration.
15102
+ */
15103
+ confirm: NcConfirmSchema.optional()
14792
15104
  });
14793
15105
  /**
14794
15106
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -14799,7 +15111,37 @@ var NcRuleInputSchema = object({
14799
15111
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
14800
15112
  * `updateRule` patch.
14801
15113
  */
14802
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
15114
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
15115
+ disabledTargetIds: array(string()).optional(),
15116
+ /**
15117
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
15118
+ *
15119
+ * It makes the key optional to SUPPLY; the parse still materialises the
15120
+ * default when the key is absent. And `NcRuleStore.update` merges with
15121
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
15122
+ * one — which made every partial edit destructive:
15123
+ *
15124
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
15125
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
15126
+ * setEnabled(ruleId, false) → conditions reset to `{}`
15127
+ *
15128
+ * A rule scoped to one camera and one zone silently became a rule that
15129
+ * matches EVERY event on EVERY camera, and lost its `media` policy
15130
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
15131
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
15132
+ * within a minute of a two-field patch.
15133
+ *
15134
+ * So every defaulted field is re-declared here WITHOUT its default. The
15135
+ * inner defaults still apply when the caller DOES send the key — `{}` for
15136
+ * conditions remains a real instruction ("clear them") — and only the
15137
+ * absent key is now genuinely absent.
15138
+ */
15139
+ enabled: boolean().optional(),
15140
+ conditions: NcConditionsSchema.optional(),
15141
+ media: NcMediaPolicySchema.optional(),
15142
+ throttle: NcThrottleSchema.optional(),
15143
+ priority: number().int().min(1).max(5).optional()
15144
+ });
14803
15145
  /** A persisted rule. */
14804
15146
  var NcRuleSchema = NcRuleInputSchema.extend({
14805
15147
  id: string(),
@@ -15100,6 +15442,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
15100
15442
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
15101
15443
  * copy would lie the first time a rule is disabled.
15102
15444
  */
15445
+ /**
15446
+ * Why a device a mode NAMES is nonetheless not armed by it.
15447
+ *
15448
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
15449
+ * per-camera notification switch the Notification Center already owns,
15450
+ * `detection-off` is the device's own detection binding being inactive, and
15451
+ * `offline` is the device manager's liveness. A fourth reason would mean a
15452
+ * fourth authority, and inventing one here is how a panel starts disagreeing
15453
+ * with the switches the operator actually used.
15454
+ */
15455
+ var NcAlarmSkipReasonSchema = _enum([
15456
+ "muted",
15457
+ "detection-off",
15458
+ "offline"
15459
+ ]);
15460
+ var NcAlarmSkippedDeviceSchema = object({
15461
+ deviceId: number().int(),
15462
+ reason: NcAlarmSkipReasonSchema
15463
+ });
15103
15464
  var NcAlarmModeCoverageSchema = object({
15104
15465
  mode: AlarmArmModeSchema,
15105
15466
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -15107,7 +15468,18 @@ var NcAlarmModeCoverageSchema = object({
15107
15468
  /** At least one covering rule has no device scope, so the mode covers all. */
15108
15469
  allDevices: boolean(),
15109
15470
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
15110
- deviceIds: array(number().int())
15471
+ deviceIds: array(number().int()),
15472
+ /**
15473
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
15474
+ * excludes it.
15475
+ *
15476
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
15477
+ * twelve makes it false in exactly the way nobody notices until an incident.
15478
+ * Defaulted to `[]` so a coverage answer computed before this field existed
15479
+ * still parses as "nothing known to be skipped" rather than failing the whole
15480
+ * alarm tab.
15481
+ */
15482
+ skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
15111
15483
  });
15112
15484
  var NcAlarmConfigSchema = object({
15113
15485
  /**
@@ -16470,13 +16842,19 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16470
16842
  }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
16471
16843
  kind: "mutation",
16472
16844
  auth: "admin"
16473
- }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
16845
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
16474
16846
  kind: "mutation",
16475
16847
  auth: "admin"
16476
- }), method(object({}), array(RelocateJobSchema).readonly(), {
16477
- kind: "query",
16848
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
16849
+ kind: "mutation",
16478
16850
  auth: "admin"
16479
- }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
16851
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
16852
+ kind: "mutation",
16853
+ auth: "admin"
16854
+ }), method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
16855
+ kind: "mutation",
16856
+ auth: "admin"
16857
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
16480
16858
  kind: "mutation",
16481
16859
  auth: "admin"
16482
16860
  }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
@@ -17933,9 +18311,16 @@ var CameraStatusSchema = object({
17933
18311
  audio: CameraAudioStatusSchema.nullable(),
17934
18312
  recording: CameraRecordingStatusSchema.nullable(),
17935
18313
  /**
17936
- * Per-camera function switches an OPERATOR has turned off
18314
+ * Per-camera functions an OPERATOR has turned off
17937
18315
  * ([D61](../../../../docs/decisions/adr-0067.md)).
17938
18316
  *
18317
+ * Composed from the AUTHORITIES themselves — the wrapper bindings,
18318
+ * `RecordingConfig.enabled`, the notification mute, the broker's audio
18319
+ * policy, the camera's own microphone — via `composeSwitchedOff`, not from
18320
+ * the deprecated `getCameraSwitches` group ([D113](../../../../docs/decisions/adr-0113.md)).
18321
+ * The badge outlives the control panel: the panel was a convenience, this is
18322
+ * the difference between a camera being off and a camera being dead.
18323
+ *
17939
18324
  * This is the difference between DISABLED and BROKEN. A camera whose
17940
18325
  * `detection` block reports zero fps and whose `switchedOff` contains
17941
18326
  * `'object-detection'` was switched off by a person; the same camera with an
@@ -18006,7 +18391,13 @@ var NodeInferenceDevicesSchema = object({
18006
18391
  reachable: boolean(),
18007
18392
  devices: array(NodeInferenceDeviceSchema).readonly()
18008
18393
  });
18009
- method(object({
18394
+ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18395
+ kind: "mutation",
18396
+ auth: "admin"
18397
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18398
+ kind: "mutation",
18399
+ auth: "admin"
18400
+ }), method(object({
18010
18401
  deviceId: number(),
18011
18402
  agentNodeId: string()
18012
18403
  }), object({ success: literal(true) }), {
@@ -18536,24 +18927,28 @@ var snapshotCapability = {
18536
18927
  *
18537
18928
  * `getSnapshotOverview` is cache-only by contract: it answers from whatever
18538
18929
  * the wrapper happens to hold and never captures. Under D93 the client
18539
- * versions its image URL on that answer, and an image REQUEST is what enrols
18540
- * a camera in the keep-warm loop. Both of those are satisfiable by the
18541
- * client's own image cache — `expo-image` is URL-keyed and never revalidates
18542
- * — so a URL painted in a previous session comes off disk with no network,
18543
- * no enrolment, and nothing warming. Measured on the live hub: reopening
18544
- * after two minutes idle painted 15 of 16 tiles at **168 s old** with zero
18545
- * HTTP requests, and the fleet only recovered because a later poll happened
18546
- * to observe a different identity.
18930
+ * versions its image URL on that answer, and an image REQUEST was the only
18931
+ * demand signal. Both of those are satisfiable by the client's own image
18932
+ * cache — `expo-image` is URL-keyed and never revalidates — so a URL painted
18933
+ * in a previous session comes off disk with no network, no demand, and no
18934
+ * capture. Measured on the live hub: reopening after two minutes idle
18935
+ * painted 15 of 16 tiles at **168 s old** with zero HTTP requests, and the
18936
+ * fleet only recovered because a later poll happened to observe a different
18937
+ * identity.
18547
18938
  *
18548
18939
  * ## The two properties that fix it
18549
18940
  *
18550
18941
  * **It is an RPC, so no client cache can answer it.** The demand signal
18551
- * always reaches the wrapper. This method therefore MAY create keep-warm
18552
- * subscriptions, where `getSnapshotOverview` must never (D93) — the
18553
- * distinction is not "one is newer" but that the overview poll is app-wide
18554
- * (a creating overview would warm every camera on the install) while this is
18555
- * called by a rendered surface naming the tiles it is actually painting, at
18556
- * the width it is painting them.
18942
+ * always reaches the wrapper. This method therefore CAPTURES, where
18943
+ * `getSnapshotOverview` must never (D93) — the distinction is not "one is
18944
+ * newer" but that the overview poll is app-wide (a capturing overview would
18945
+ * dial every camera on the install) while this is called by a rendered
18946
+ * surface naming the tiles it is actually painting, at the width it is
18947
+ * painting them.
18948
+ *
18949
+ * Since 2026-08-11 this is the ONLY thing that refreshes a snapshot: the
18950
+ * server-side keep-warm loop was removed (operator directive — on-demand,
18951
+ * always), so a camera nobody is looking at costs nothing at all.
18557
18952
  *
18558
18953
  * **It waits, briefly and boundedly, for the capture it triggered.** The
18559
18954
  * returned `capturedAt` is the frame the link will serve, not the frame the
@@ -18771,6 +19166,13 @@ method(object({ locationId: string() }), EvictableUsageSchema), method(object({
18771
19166
  locationId: string(),
18772
19167
  targetBytes: number().int().positive()
18773
19168
  }), EvictResultSchema, { kind: "mutation" });
19169
+ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }), method(StorageMigrationInputSchema, object({ jobId: string() }), {
19170
+ kind: "mutation",
19171
+ auth: "admin"
19172
+ }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
19173
+ kind: "mutation",
19174
+ auth: "admin"
19175
+ });
18774
19176
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
18775
19177
  providerId: string().min(1),
18776
19178
  displayName: string().min(1),
@@ -18874,6 +19276,28 @@ var TerminalProfileInfoSchema = object({
18874
19276
  label: string(),
18875
19277
  description: string().optional()
18876
19278
  });
19279
+ /**
19280
+ * A durable operator-created Terminal instance. Profiles are templates; only
19281
+ * an instance declares a camera.
19282
+ */
19283
+ var TerminalInstanceInfoSchema = object({
19284
+ instanceId: string(),
19285
+ cameraStableId: string(),
19286
+ nodeId: string(),
19287
+ profileId: string(),
19288
+ profileLabel: string(),
19289
+ name: string(),
19290
+ enabled: boolean()
19291
+ });
19292
+ var TerminalLegacyCameraSchema = object({
19293
+ stableId: string(),
19294
+ nodeId: string(),
19295
+ profileId: string(),
19296
+ profileLabel: string(),
19297
+ name: string(),
19298
+ /** Only legacy monitor cameras can retain their historic stable identity. */
19299
+ adoptable: boolean()
19300
+ });
18877
19301
  var TerminalOutputEventSchema = discriminatedUnion("kind", [object({
18878
19302
  seq: number().int().positive(),
18879
19303
  kind: literal("data"),
@@ -18890,7 +19314,29 @@ var TerminalOutputBatchSchema = object({
18890
19314
  snapshot: string().optional(),
18891
19315
  events: array(TerminalOutputEventSchema).readonly()
18892
19316
  });
18893
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
19317
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalInstanceInfoSchema).readonly(), { auth: "admin" }), method(object({
19318
+ targetNodeId: string().min(1),
19319
+ profileId: string().min(1),
19320
+ name: string().trim().min(1).max(160).optional()
19321
+ }), TerminalInstanceInfoSchema, {
19322
+ kind: "mutation",
19323
+ auth: "admin"
19324
+ }), method(object({ instanceId: string().min(1) }), _void(), {
19325
+ kind: "mutation",
19326
+ auth: "admin"
19327
+ }), method(object({
19328
+ instanceId: string().min(1),
19329
+ enabled: boolean()
19330
+ }), TerminalInstanceInfoSchema, {
19331
+ kind: "mutation",
19332
+ auth: "admin"
19333
+ }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
19334
+ stableId: string().min(1),
19335
+ name: string().trim().min(1).max(160).optional()
19336
+ }), TerminalInstanceInfoSchema, {
19337
+ kind: "mutation",
19338
+ auth: "admin"
19339
+ }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(object({
18894
19340
  profileId: string(),
18895
19341
  cols: number().int().positive(),
18896
19342
  rows: number().int().positive()
@@ -18907,7 +19353,13 @@ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }),
18907
19353
  }), method(object({
18908
19354
  sessionId: string(),
18909
19355
  afterSeq: number().int().nonnegative(),
18910
- waitMs: number().int().min(0).max(2e3).default(0)
19356
+ waitMs: number().int().min(0).max(2e3).default(0),
19357
+ /**
19358
+ * Wait when a just-opened session has no output yet. Kept opt-in so a
19359
+ * browser's initial repaint remains immediate; the camera snapshot
19360
+ * relay uses it to avoid encoding a blank startup frame.
19361
+ */
19362
+ waitForOutput: boolean().optional()
18911
19363
  }), TerminalOutputBatchSchema, {
18912
19364
  kind: "mutation",
18913
19365
  auth: "admin",
@@ -21405,6 +21857,7 @@ var FaceInfoSchema = object({
21405
21857
  var FaceFilterEnum = _enum([
21406
21858
  "unassigned",
21407
21859
  "recognized",
21860
+ "identified",
21408
21861
  "all"
21409
21862
  ]);
21410
21863
  var MediaFileLiteSchema$1 = object({
@@ -21433,6 +21886,8 @@ method(_void(), array(IdentitySchema).readonly()), method(object({ name: string(
21433
21886
  kind: "mutation",
21434
21887
  auth: "admin"
21435
21888
  }), method(object({
21889
+ /** Restrict to one camera. Absent keeps the cluster-wide gallery view. */
21890
+ deviceId: number().int().optional(),
21436
21891
  limit: number().int().positive().optional(),
21437
21892
  filter: FaceFilterEnum.optional(),
21438
21893
  /**
@@ -23713,6 +24168,10 @@ var OsdSourceSchema = discriminatedUnion("kind", [
23713
24168
  capName: string().min(1).max(64),
23714
24169
  /** Dot path inside the slice, e.g. `detected`, `value`, `mode`. */
23715
24170
  valuePath: string().min(1).max(64)
24171
+ }),
24172
+ object({
24173
+ kind: literal("latest-recognition"),
24174
+ recognition: _enum(["person", "plate"])
23716
24175
  })
23717
24176
  ]);
23718
24177
  var OsdSlotBindingSchema = object({
@@ -23818,6 +24277,15 @@ method(object({ deviceId: number().int() }), object({
23818
24277
  }), object({ success: literal(true) }), {
23819
24278
  kind: "mutation",
23820
24279
  auth: "admin"
24280
+ }), method(object({
24281
+ sourceDeviceId: number().int(),
24282
+ targetDeviceId: number().int()
24283
+ }), object({
24284
+ copied: number().int().nonnegative(),
24285
+ skipped: number().int().nonnegative()
24286
+ }), {
24287
+ kind: "mutation",
24288
+ auth: "admin"
23821
24289
  }), method(object({
23822
24290
  deviceId: number().int(),
23823
24291
  slotId: string().min(1),
@@ -24827,7 +25295,19 @@ var RecordingManifestSchema = object({
24827
25295
  * profiles/subtrees/locations on this node). */
24828
25296
  var RecordingDeviceUsageSchema = object({
24829
25297
  deviceId: number(),
24830
- usedBytes: number()
25298
+ usedBytes: number(),
25299
+ /**
25300
+ * Start of this camera's OLDEST indexed segment, across every profile and
25301
+ * location — the "Oldest footage" column in Recordings → Storage, and the
25302
+ * only honest answer to "is retention actually holding?" per camera.
25303
+ *
25304
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
25305
+ * predates this field omits it entirely, and a hub whose types carry the
25306
+ * field must keep validating that older provider's payload: the framework
25307
+ * (types) and the addon ship on different trains, and the addon is usually
25308
+ * the later of the two.
25309
+ */
25310
+ oldestMs: number().nullable().optional()
24831
25311
  });
24832
25312
  /** Recording storage usage + capacity for one storage location. */
24833
25313
  var RecordingLocationUsageSchema = object({
@@ -24855,6 +25335,57 @@ var RecordingStorageUsageSchema = object({
24855
25335
  locations: array(RecordingLocationUsageSchema)
24856
25336
  });
24857
25337
  /**
25338
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
25339
+ *
25340
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
25341
+ * is the operator asking for the EXISTING archive to be brought into line with
25342
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
25343
+ * location, run FIFO behind the single-flight mover.
25344
+ *
25345
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
25346
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
25347
+ * (empty on the plan).
25348
+ */
25349
+ var RecordingRebalanceMoveSchema = object({
25350
+ deviceId: number(),
25351
+ profile: string(),
25352
+ fromLocationId: string(),
25353
+ toLocationId: string(),
25354
+ bytes: number(),
25355
+ files: number().int()
25356
+ });
25357
+ /** Why a pile that is out of place is staying there. Every refusal is
25358
+ * reported: a rebalance that silently drops a camera reads exactly like one
25359
+ * that had nothing to do. */
25360
+ var RecordingRebalanceSkipReasonSchema = _enum([
25361
+ "unassigned",
25362
+ "target-not-writable",
25363
+ "below-threshold",
25364
+ "no-headroom"
25365
+ ]);
25366
+ var RecordingRebalanceSkipSchema = object({
25367
+ deviceId: number(),
25368
+ profile: string(),
25369
+ fromLocationId: string(),
25370
+ /** The location the plan wants; null when the camera has no assignment. */
25371
+ toLocationId: string().nullable(),
25372
+ bytes: number(),
25373
+ reason: RecordingRebalanceSkipReasonSchema
25374
+ });
25375
+ var RecordingRebalancePlanSchema = object({
25376
+ moves: array(RecordingRebalanceMoveSchema),
25377
+ skipped: array(RecordingRebalanceSkipSchema),
25378
+ bytesToMove: number(),
25379
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
25380
+ jobIds: array(string())
25381
+ });
25382
+ var RecordingRebalanceInputSchema = object({
25383
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
25384
+ throttleMbps: number().min(1).max(1e3).optional(),
25385
+ /** Ignore piles smaller than this (default 1 GB). */
25386
+ minMoveGb: number().min(0).optional()
25387
+ });
25388
+ /**
24858
25389
  * Result of locating footage at a wall-clock instant for one device/profile.
24859
25390
  * `segment` carries the covering segment's window; `gap` reports the forward
24860
25391
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -25002,6 +25533,21 @@ method(object({
25002
25533
  }), {
25003
25534
  kind: "mutation",
25004
25535
  auth: "admin"
25536
+ }), method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
25537
+ kind: "mutation",
25538
+ auth: "admin"
25539
+ }), method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
25540
+ kind: "mutation",
25541
+ auth: "admin"
25542
+ }), method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
25543
+ kind: "mutation",
25544
+ auth: "admin"
25545
+ }), method(StorageMigrationFootageMoveInputSchema, object({ jobId: string() }), {
25546
+ kind: "mutation",
25547
+ auth: "admin"
25548
+ }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
25549
+ kind: "mutation",
25550
+ auth: "admin"
25005
25551
  }), method(RelocateFootageInputSchema, object({ jobId: string() }), {
25006
25552
  kind: "mutation",
25007
25553
  auth: "admin"
@@ -25011,9 +25557,15 @@ method(object({
25011
25557
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
25012
25558
  kind: "mutation",
25013
25559
  auth: "admin"
25560
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25561
+ kind: "query",
25562
+ auth: "admin"
25563
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25564
+ kind: "mutation",
25565
+ auth: "admin"
25014
25566
  });
25015
25567
  /**
25016
- * `recordingExport` cap — render a footage time range into a single downloadable
25568
+ * `recording-export` cap — render a footage time range into a single downloadable
25017
25569
  * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
25018
25570
  * bounded lifetime with a durable history, auto-expiry, and optional
25019
25571
  * delete-after-download.
@@ -25028,10 +25580,42 @@ method(object({
25028
25580
  */
25029
25581
  /** Playback-speed multiplier for the render (1 = realtime). */
25030
25582
  var ExportSpeedSchema = number().min(.25).max(32);
25583
+ /**
25584
+ * One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
25585
+ *
25586
+ * Relative and not absolute epoch on purpose: the renderer's frame-select
25587
+ * expression sees ffmpeg's `t`, which starts at 0 for the export's source
25588
+ * playlist. Handing it absolute epochs would make every call site responsible
25589
+ * for the same subtraction, and the one that forgot would emit a filter that
25590
+ * selects nothing — silently, as a uniform timelapse.
25591
+ */
25592
+ var ExportDenseRangeSchema = object({
25593
+ fromSec: number().nonnegative(),
25594
+ toSec: number().nonnegative()
25595
+ }).refine((r) => r.toSec > r.fromSec, { message: "dense range must have toSec > fromSec" });
25596
+ /**
25597
+ * Dense-interval overlay for a timelapse: sample at `dense.everyMs` INSIDE the
25598
+ * listed ranges and at the base `everyMs` everywhere else.
25599
+ *
25600
+ * `everyMs` must be strictly smaller than the base cadence — a dense rate that
25601
+ * is not denser renders a uniform timelapse the operator believes is two-rate.
25602
+ */
25603
+ var ExportDenseSchema = object({
25604
+ everyMs: number().int().positive(),
25605
+ ranges: array(ExportDenseRangeSchema).min(1).max(200)
25606
+ });
25031
25607
  /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
25032
25608
  var ExportTimelapseSchema = object({
25033
25609
  everyMs: number().int().positive(),
25034
- outputFps: number().int().min(1).max(60).optional()
25610
+ outputFps: number().int().min(1).max(60).optional(),
25611
+ /** Optional second, FASTER rate over the intervals that matter. */
25612
+ dense: ExportDenseSchema.optional()
25613
+ }).superRefine((v, ctx) => {
25614
+ if (v.dense !== void 0 && v.dense.everyMs >= v.everyMs) ctx.addIssue({
25615
+ code: ZodIssueCode$16.custom,
25616
+ message: "dense.everyMs must be strictly smaller than the base everyMs",
25617
+ path: ["dense", "everyMs"]
25618
+ });
25035
25619
  });
25036
25620
  /**
25037
25621
  * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
@@ -25089,6 +25673,19 @@ var ExportDownloadSchema = object({
25089
25673
  url: string(),
25090
25674
  endpoints: array(string())
25091
25675
  });
25676
+ /**
25677
+ * A finished export's bytes, inline.
25678
+ *
25679
+ * `bytes` is the DECODED length — the number the caller bounds and logs
25680
+ * against, so nobody has to infer it from the base64 length.
25681
+ */
25682
+ var ExportBytesSchema = object({
25683
+ base64: string(),
25684
+ contentType: string(),
25685
+ /** Suggested filename, extension included. */
25686
+ name: string(),
25687
+ bytes: number().int().nonnegative()
25688
+ });
25092
25689
  method(object({
25093
25690
  deviceId: number(),
25094
25691
  profile: string(),
@@ -25113,6 +25710,9 @@ method(object({
25113
25710
  }), method(object({ exportId: string() }), ExportDownloadSchema, {
25114
25711
  kind: "query",
25115
25712
  auth: "protected"
25713
+ }), method(object({ exportId: string() }), ExportBytesSchema, {
25714
+ kind: "query",
25715
+ auth: "protected"
25116
25716
  });
25117
25717
  /**
25118
25718
  * scene-monitor — device-scoped reference-region state cap. An operator marks
@@ -30905,6 +31505,12 @@ Object.freeze({
30905
31505
  addonId: null,
30906
31506
  access: "delete"
30907
31507
  },
31508
+ "osdManager.copyDeviceConfiguration": {
31509
+ capName: "osd-manager",
31510
+ capScope: "system",
31511
+ addonId: null,
31512
+ access: "create"
31513
+ },
30908
31514
  "osdManager.getConditionSupport": {
30909
31515
  capName: "osd-manager",
30910
31516
  capScope: "system",
@@ -31001,7 +31607,7 @@ Object.freeze({
31001
31607
  addonId: null,
31002
31608
  access: "create"
31003
31609
  },
31004
- "pipelineAnalytics.cancelMediaRelocate": {
31610
+ "pipelineAnalytics.cancelStorageMigrationMove": {
31005
31611
  capName: "pipeline-analytics",
31006
31612
  capScope: "device",
31007
31613
  addonId: null,
@@ -31073,12 +31679,6 @@ Object.freeze({
31073
31679
  addonId: null,
31074
31680
  access: "view"
31075
31681
  },
31076
- "pipelineAnalytics.getMediaRelocateStatus": {
31077
- capName: "pipeline-analytics",
31078
- capScope: "device",
31079
- addonId: null,
31080
- access: "view"
31081
- },
31082
31682
  "pipelineAnalytics.getMotionEvents": {
31083
31683
  capName: "pipeline-analytics",
31084
31684
  capScope: "device",
@@ -31115,6 +31715,12 @@ Object.freeze({
31115
31715
  addonId: null,
31116
31716
  access: "view"
31117
31717
  },
31718
+ "pipelineAnalytics.getStorageMigrationMoveStatus": {
31719
+ capName: "pipeline-analytics",
31720
+ capScope: "device",
31721
+ addonId: null,
31722
+ access: "view"
31723
+ },
31118
31724
  "pipelineAnalytics.getTrack": {
31119
31725
  capName: "pipeline-analytics",
31120
31726
  capScope: "device",
@@ -31193,6 +31799,12 @@ Object.freeze({
31193
31799
  addonId: null,
31194
31800
  access: "view"
31195
31801
  },
31802
+ "pipelineAnalytics.pauseForStorageMigration": {
31803
+ capName: "pipeline-analytics",
31804
+ capScope: "device",
31805
+ addonId: null,
31806
+ access: "create"
31807
+ },
31196
31808
  "pipelineAnalytics.proposeRetrainAnnotations": {
31197
31809
  capName: "pipeline-analytics",
31198
31810
  capScope: "device",
@@ -31223,7 +31835,7 @@ Object.freeze({
31223
31835
  addonId: null,
31224
31836
  access: "create"
31225
31837
  },
31226
- "pipelineAnalytics.relocateMedia": {
31838
+ "pipelineAnalytics.refreshStorageLocationsForMigration": {
31227
31839
  capName: "pipeline-analytics",
31228
31840
  capScope: "device",
31229
31841
  addonId: null,
@@ -31235,6 +31847,12 @@ Object.freeze({
31235
31847
  addonId: null,
31236
31848
  access: "create"
31237
31849
  },
31850
+ "pipelineAnalytics.resumeForStorageMigration": {
31851
+ capName: "pipeline-analytics",
31852
+ capScope: "device",
31853
+ addonId: null,
31854
+ access: "create"
31855
+ },
31238
31856
  "pipelineAnalytics.saveRetrainAnnotations": {
31239
31857
  capName: "pipeline-analytics",
31240
31858
  capScope: "device",
@@ -31259,6 +31877,12 @@ Object.freeze({
31259
31877
  addonId: null,
31260
31878
  access: "create"
31261
31879
  },
31880
+ "pipelineAnalytics.startStorageMigrationMove": {
31881
+ capName: "pipeline-analytics",
31882
+ capScope: "device",
31883
+ addonId: null,
31884
+ access: "create"
31885
+ },
31262
31886
  "pipelineAnalytics.wipeAllAnalytics": {
31263
31887
  capName: "pipeline-analytics",
31264
31888
  capScope: "device",
@@ -31625,6 +32249,12 @@ Object.freeze({
31625
32249
  addonId: null,
31626
32250
  access: "view"
31627
32251
  },
32252
+ "pipelineOrchestrator.pauseForStorageMigration": {
32253
+ capName: "pipeline-orchestrator",
32254
+ capScope: "system",
32255
+ addonId: null,
32256
+ access: "create"
32257
+ },
31628
32258
  "pipelineOrchestrator.rebalance": {
31629
32259
  capName: "pipeline-orchestrator",
31630
32260
  capScope: "system",
@@ -31649,6 +32279,12 @@ Object.freeze({
31649
32279
  addonId: null,
31650
32280
  access: "view"
31651
32281
  },
32282
+ "pipelineOrchestrator.resumeForStorageMigration": {
32283
+ capName: "pipeline-orchestrator",
32284
+ capScope: "system",
32285
+ addonId: null,
32286
+ access: "create"
32287
+ },
31652
32288
  "pipelineOrchestrator.saveTemplate": {
31653
32289
  capName: "pipeline-orchestrator",
31654
32290
  capScope: "system",
@@ -32045,7 +32681,13 @@ Object.freeze({
32045
32681
  addonId: null,
32046
32682
  access: "create"
32047
32683
  },
32048
- "recording.cancelRelocate": {
32684
+ "recording.cancelRelocateJob": {
32685
+ capName: "recording",
32686
+ capScope: "system",
32687
+ addonId: null,
32688
+ access: "create"
32689
+ },
32690
+ "recording.cancelStorageMigrationMove": {
32049
32691
  capName: "recording",
32050
32692
  capScope: "system",
32051
32693
  addonId: null,
@@ -32081,7 +32723,7 @@ Object.freeze({
32081
32723
  addonId: null,
32082
32724
  access: "view"
32083
32725
  },
32084
- "recording.getRelocateStatus": {
32726
+ "recording.getStorageMigrationMoveStatus": {
32085
32727
  capName: "recording",
32086
32728
  capScope: "system",
32087
32729
  addonId: null,
@@ -32099,12 +32741,30 @@ Object.freeze({
32099
32741
  addonId: null,
32100
32742
  access: "view"
32101
32743
  },
32744
+ "recording.listRelocateJobs": {
32745
+ capName: "recording",
32746
+ capScope: "system",
32747
+ addonId: null,
32748
+ access: "view"
32749
+ },
32102
32750
  "recording.locateSegment": {
32103
32751
  capName: "recording",
32104
32752
  capScope: "system",
32105
32753
  addonId: null,
32106
32754
  access: "view"
32107
32755
  },
32756
+ "recording.pauseForStorageMigration": {
32757
+ capName: "recording",
32758
+ capScope: "system",
32759
+ addonId: null,
32760
+ access: "create"
32761
+ },
32762
+ "recording.planStorageRebalance": {
32763
+ capName: "recording",
32764
+ capScope: "system",
32765
+ addonId: null,
32766
+ access: "view"
32767
+ },
32108
32768
  "recording.pruneFootage": {
32109
32769
  capName: "recording",
32110
32770
  capScope: "system",
@@ -32123,6 +32783,12 @@ Object.freeze({
32123
32783
  addonId: null,
32124
32784
  access: "view"
32125
32785
  },
32786
+ "recording.refreshStorageLocationsForMigration": {
32787
+ capName: "recording",
32788
+ capScope: "system",
32789
+ addonId: null,
32790
+ access: "create"
32791
+ },
32126
32792
  "recording.relocateFootage": {
32127
32793
  capName: "recording",
32128
32794
  capScope: "system",
@@ -32147,44 +32813,68 @@ Object.freeze({
32147
32813
  addonId: null,
32148
32814
  access: "create"
32149
32815
  },
32816
+ "recording.resumeForStorageMigration": {
32817
+ capName: "recording",
32818
+ capScope: "system",
32819
+ addonId: null,
32820
+ access: "create"
32821
+ },
32150
32822
  "recording.setDeviceConfig": {
32151
32823
  capName: "recording",
32152
32824
  capScope: "system",
32153
32825
  addonId: null,
32154
32826
  access: "create"
32155
32827
  },
32828
+ "recording.startStorageMigrationMove": {
32829
+ capName: "recording",
32830
+ capScope: "system",
32831
+ addonId: null,
32832
+ access: "create"
32833
+ },
32834
+ "recording.startStorageRebalance": {
32835
+ capName: "recording",
32836
+ capScope: "system",
32837
+ addonId: null,
32838
+ access: "create"
32839
+ },
32156
32840
  "recordingExport.cancelExport": {
32157
- capName: "recordingExport",
32841
+ capName: "recording-export",
32158
32842
  capScope: "system",
32159
32843
  addonId: null,
32160
32844
  access: "create"
32161
32845
  },
32162
32846
  "recordingExport.createExport": {
32163
- capName: "recordingExport",
32847
+ capName: "recording-export",
32164
32848
  capScope: "system",
32165
32849
  addonId: null,
32166
32850
  access: "create"
32167
32851
  },
32168
32852
  "recordingExport.deleteExport": {
32169
- capName: "recordingExport",
32853
+ capName: "recording-export",
32170
32854
  capScope: "system",
32171
32855
  addonId: null,
32172
32856
  access: "delete"
32173
32857
  },
32174
32858
  "recordingExport.getDownloadUrl": {
32175
- capName: "recordingExport",
32859
+ capName: "recording-export",
32176
32860
  capScope: "system",
32177
32861
  addonId: null,
32178
32862
  access: "view"
32179
32863
  },
32180
32864
  "recordingExport.getExport": {
32181
- capName: "recordingExport",
32865
+ capName: "recording-export",
32182
32866
  capScope: "system",
32183
32867
  addonId: null,
32184
32868
  access: "view"
32185
32869
  },
32186
32870
  "recordingExport.listExports": {
32187
- capName: "recordingExport",
32871
+ capName: "recording-export",
32872
+ capScope: "system",
32873
+ addonId: null,
32874
+ access: "view"
32875
+ },
32876
+ "recordingExport.readExportBytes": {
32877
+ capName: "recording-export",
32188
32878
  capScope: "system",
32189
32879
  addonId: null,
32190
32880
  access: "view"
@@ -32543,6 +33233,30 @@ Object.freeze({
32543
33233
  addonId: null,
32544
33234
  access: "view"
32545
33235
  },
33236
+ "storageMigration.cancel": {
33237
+ capName: "storage-migration",
33238
+ capScope: "system",
33239
+ addonId: null,
33240
+ access: "create"
33241
+ },
33242
+ "storageMigration.plan": {
33243
+ capName: "storage-migration",
33244
+ capScope: "system",
33245
+ addonId: null,
33246
+ access: "view"
33247
+ },
33248
+ "storageMigration.start": {
33249
+ capName: "storage-migration",
33250
+ capScope: "system",
33251
+ addonId: null,
33252
+ access: "create"
33253
+ },
33254
+ "storageMigration.status": {
33255
+ capName: "storage-migration",
33256
+ capScope: "system",
33257
+ addonId: null,
33258
+ access: "view"
33259
+ },
32546
33260
  "storageProvider.abortUpload": {
32547
33261
  capName: "storage-provider",
32548
33262
  capScope: "system",
@@ -32921,12 +33635,42 @@ Object.freeze({
32921
33635
  addonId: null,
32922
33636
  access: "create"
32923
33637
  },
33638
+ "terminalSession.adoptLegacyMonitor": {
33639
+ capName: "terminal-session",
33640
+ capScope: "system",
33641
+ addonId: null,
33642
+ access: "create"
33643
+ },
32924
33644
  "terminalSession.close": {
32925
33645
  capName: "terminal-session",
32926
33646
  capScope: "system",
32927
33647
  addonId: null,
32928
33648
  access: "create"
32929
33649
  },
33650
+ "terminalSession.createInstance": {
33651
+ capName: "terminal-session",
33652
+ capScope: "system",
33653
+ addonId: null,
33654
+ access: "create"
33655
+ },
33656
+ "terminalSession.deleteInstance": {
33657
+ capName: "terminal-session",
33658
+ capScope: "system",
33659
+ addonId: null,
33660
+ access: "delete"
33661
+ },
33662
+ "terminalSession.listInstances": {
33663
+ capName: "terminal-session",
33664
+ capScope: "system",
33665
+ addonId: null,
33666
+ access: "view"
33667
+ },
33668
+ "terminalSession.listLegacyCameras": {
33669
+ capName: "terminal-session",
33670
+ capScope: "system",
33671
+ addonId: null,
33672
+ access: "view"
33673
+ },
32930
33674
  "terminalSession.listProfiles": {
32931
33675
  capName: "terminal-session",
32932
33676
  capScope: "system",
@@ -32957,6 +33701,12 @@ Object.freeze({
32957
33701
  addonId: null,
32958
33702
  access: "create"
32959
33703
  },
33704
+ "terminalSession.setInstanceEnabled": {
33705
+ capName: "terminal-session",
33706
+ capScope: "system",
33707
+ addonId: null,
33708
+ access: "create"
33709
+ },
32960
33710
  "terminalSession.writeInput": {
32961
33711
  capName: "terminal-session",
32962
33712
  capScope: "system",
@@ -33501,6 +34251,104 @@ var FramerateField = number().int().min(1).max(60);
33501
34251
  var TargetsField = array(NcRuleTargetSchema).min(1);
33502
34252
  var PriorityField = number().int().min(1).max(5);
33503
34253
  /**
34254
+ * Explicit override of the DENSE sampling cadence, seconds.
34255
+ *
34256
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
34257
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
34258
+ * made that same base 3 s and rendered a person pass as two frames.)
34259
+ *
34260
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
34261
+ * `denseCadenceSec` and played at `framerate` occupies
34262
+ *
34263
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
34264
+ *
34265
+ * 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.
34266
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
34267
+ * and therefore the length of a quiet night, does not move.
34268
+ *
34269
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
34270
+ * the recording has them returns the same frames, requested twice. Must be
34271
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
34272
+ * a uniform video the operator believes is two-rate — and upsert refuses it
34273
+ * rather than letting the export cap reject the render hours after the window.
34274
+ */
34275
+ var DenseCadenceSecField = number().min(.1).max(3600);
34276
+ /**
34277
+ * Minimum seconds of OUTPUT video each detection range must occupy.
34278
+ *
34279
+ * The operator-facing form of the arithmetic above: instead of solving for a
34280
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
34281
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
34282
+ * that range every ~583 ms.
34283
+ *
34284
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
34285
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
34286
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
34287
+ * ranges are sampled denser than they need. Per-range cadences require a cap
34288
+ * schema change and are the tracked follow-up.
34289
+ *
34290
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
34291
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
34292
+ * by real footage, never met by duplicating frames into motion that never
34293
+ * happened.
34294
+ */
34295
+ var MinDwellSecField = number().min(0).max(60);
34296
+ /**
34297
+ * Caption burned into the notification's preview frame.
34298
+ *
34299
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
34300
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
34301
+ * templating dialect for one field would be a second thing to explain.
34302
+ *
34303
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
34304
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
34305
+ * the reason this is not `.min(1)`.
34306
+ */
34307
+ var PreviewTextField = string().max(200);
34308
+ /**
34309
+ * Whether the notification's preview is a STILL or a short animation.
34310
+ *
34311
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
34312
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
34313
+ * night reads better as three seconds of motion than as one frame of it. Both
34314
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
34315
+ * simply applies it to a dozen frames sampled across the render and assembles
34316
+ * them.
34317
+ *
34318
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
34319
+ * seeks and a palette pass, and no rule that never asked for one should start
34320
+ * paying that on the deploy that shipped it.
34321
+ *
34322
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
34323
+ */
34324
+ var PreviewModeField = _enum(["image", "gif"]);
34325
+ /**
34326
+ * Which detection classes the notification reports counts for.
34327
+ *
34328
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
34329
+ * plan — no second query — aggregated per class. Absent or empty means "every
34330
+ * class the window actually contained", which is what an operator who never
34331
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
34332
+ * counts cars all night).
34333
+ *
34334
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
34335
+ * …). An unknown name simply never matches and reports nothing — it is not an
34336
+ * error, because a rule may legitimately name a class this camera's model does
34337
+ * not emit.
34338
+ *
34339
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
34340
+ * - `{{detections}}` — total over the reported classes
34341
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
34342
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
34343
+ * one per class, `count_` + the class name
34344
+ *
34345
+ * With NO custom body template the summary is appended to the derived body, and
34346
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
34347
+ * reads. With a custom template the operator owns every word — nothing is
34348
+ * appended, so `{{detectionSummary}}` is how he asks for it.
34349
+ */
34350
+ var ReportClassesField = array(string().min(1).max(40)).max(20);
34351
+ /**
33504
34352
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
33505
34353
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
33506
34354
  * here (see the ownership note above).
@@ -33520,9 +34368,30 @@ var TimelapseRuleInputSchema = object({
33520
34368
  cadenceSec: CadenceSecField.default(15),
33521
34369
  /** Output frames per second of the assembled mp4 (predecessor parity). */
33522
34370
  framerate: FramerateField.default(10),
34371
+ /**
34372
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
34373
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
34374
+ * field gets.
34375
+ */
34376
+ denseCadenceSec: DenseCadenceSecField.optional(),
34377
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
34378
+ minDwellSec: MinDwellSecField.optional(),
33523
34379
  /** `notification-output` targets the finished video/thumbnail is sent to. */
33524
34380
  targets: TargetsField,
33525
34381
  template: TimelapseTemplateSchema.optional(),
34382
+ /**
34383
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
34384
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
34385
+ *
34386
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
34387
+ * the notification's title/body, and clearing it (`template: null`) must not
34388
+ * silently clear the caption too.
34389
+ */
34390
+ previewText: PreviewTextField.optional(),
34391
+ /** Still or animation — see {@link PreviewModeField}. */
34392
+ previewMode: PreviewModeField.default("image"),
34393
+ /** Classes the notification counts — see {@link ReportClassesField}. */
34394
+ reportClasses: ReportClassesField.optional(),
33526
34395
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
33527
34396
  priority: PriorityField.default(3)
33528
34397
  });
@@ -33533,8 +34402,13 @@ object({
33533
34402
  schedule: NcScheduleSchema.optional(),
33534
34403
  cadenceSec: CadenceSecField.optional(),
33535
34404
  framerate: FramerateField.optional(),
34405
+ denseCadenceSec: DenseCadenceSecField.optional(),
34406
+ minDwellSec: MinDwellSecField.optional(),
33536
34407
  targets: TargetsField.optional(),
33537
34408
  template: TimelapseTemplateSchema.nullable().optional(),
34409
+ previewText: PreviewTextField.optional(),
34410
+ previewMode: PreviewModeField.optional(),
34411
+ reportClasses: ReportClassesField.optional(),
33538
34412
  priority: PriorityField.optional()
33539
34413
  });
33540
34414
  TimelapseRuleInputSchema.extend({
@@ -33546,10 +34420,28 @@ TimelapseRuleInputSchema.extend({
33546
34420
  */
33547
34421
  ownerUserId: string().optional(),
33548
34422
  /**
33549
- * Epoch-ms of the last successful generation the 1-hour re-generation
33550
- * guard's durable state (predecessor parity). Absent = never generated.
34423
+ * Epoch-ms of the NEWEST successful generation across every camera of this
34424
+ * rule. What a UI shows, and the compatibility floor for
34425
+ * {@link readTimelapseGeneratedAt}. Absent = never generated.
33551
34426
  */
33552
34427
  lastGeneratedAt: number().optional(),
34428
+ /**
34429
+ * PER-CAMERA generation state, keyed by `String(deviceId)` — the
34430
+ * re-generation guard's real durable state.
34431
+ *
34432
+ * One rule covers several cameras and each renders its own video, so a rule
34433
+ * -wide stamp is wrong in the direction that DESTROYS work: camera A
34434
+ * succeeding at 06:05 tells camera B, whose render failed, that it is
34435
+ * already done — and B's night is gone for good, because the window will not
34436
+ * come back.
34437
+ *
34438
+ * ADDITIVE, so the migration is free: a row written before this field simply
34439
+ * has no map, and {@link readTimelapseGeneratedAt} falls back to
34440
+ * {@link TimelapseRuleSchema.shape.lastGeneratedAt}. Reading an old row as
34441
+ * "never generated" would re-render and re-notify every camera of every rule
34442
+ * once, on the deploy that shipped the map.
34443
+ */
34444
+ generatedByDevice: record(string(), number()).optional(),
33553
34445
  /** userId of the caller who created the rule (server-stamped). */
33554
34446
  createdBy: string(),
33555
34447
  createdAt: number(),
@@ -223489,6 +224381,47 @@ function isRecoverableBaichuanError(err) {
223489
224381
  return RECOVERABLE_FRAGMENTS.some((fragment) => message.includes(fragment));
223490
224382
  }
223491
224383
  //#endregion
224384
+ //#region src/ptz-zoom.ts
224385
+ /**
224386
+ * Fraction of total zoom travel moved by ONE press. ~8 presses to cross
224387
+ * the full range reads like a zoom rocker.
224388
+ */
224389
+ var ZOOM_STEP_FRACTION = .12;
224390
+ /** `zoomToFactor` expresses an absolute movePos as `factor * 1000`. */
224391
+ var ZOOM_FACTOR_SCALE = 1e3;
224392
+ /** Pause before the retry above — long enough for the lens to settle. */
224393
+ var ZOOM_SET_RETRY_MS = 1500;
224394
+ /**
224395
+ * Resolve the absolute zoom position one press should drive to.
224396
+ *
224397
+ * Only the SIGN of `zoom` is read. Pan/tilt already discard their
224398
+ * magnitude, and the two clients disagree on it anyway — the viewer
224399
+ * sends ±0.2 per press while ui-library sends ±1 — so honouring
224400
+ * magnitude would make the same button travel different distances
224401
+ * depending on which app pressed it.
224402
+ */
224403
+ var resolveZoomStep = (travel, zoom) => {
224404
+ if (!Number.isFinite(travel.minPos) || !Number.isFinite(travel.maxPos)) return {
224405
+ kind: "refused",
224406
+ reason: "no-travel"
224407
+ };
224408
+ if (travel.maxPos <= travel.minPos) return {
224409
+ kind: "refused",
224410
+ reason: "no-travel"
224411
+ };
224412
+ const step = (travel.maxPos - travel.minPos) * ZOOM_STEP_FRACTION;
224413
+ const raw = travel.curPos + Math.sign(zoom) * step;
224414
+ const target = Math.round(Math.min(travel.maxPos, Math.max(travel.minPos, raw)));
224415
+ if (target === travel.curPos) return {
224416
+ kind: "refused",
224417
+ reason: "at-limit"
224418
+ };
224419
+ return {
224420
+ kind: "move",
224421
+ target
224422
+ };
224423
+ };
224424
+ //#endregion
223492
224425
  //#region src/intercom-encoder.ts
223493
224426
  /**
223494
224427
  * IMA ADPCM (DVI4) encoder — Reolink Baichuan talk-back wire format.
@@ -228911,14 +229844,16 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
228911
229844
  }
228912
229845
  }
228913
229846
  /**
228914
- * Translate normalized (-1..1) pan/tilt/zoom to one or more discrete
228915
- * Baichuan PTZ commands. Camstack ptz uses ONVIF-style continuous
229847
+ * Translate normalized (-1..1) pan/tilt to discrete Baichuan
229848
+ * directional commands. Camstack ptz uses ONVIF-style continuous
228916
229849
  * motion vectors; Reolink Baichuan needs discrete directional
228917
- * commands (Left/Right/Up/Down/ZoomIn/ZoomOut). Magnitudes map to
228918
- * speed (0–63 typical). Continuous=true issues 'start' (camera moves
228919
- * until next 'stop'); continuous=false issues 'start' followed by an
228920
- * autoStop after a short window so a single tap of an arrow key
228921
- * results in a tiny nudge.
229850
+ * commands (Left/Right/Up/Down). Magnitudes map to speed (0–63
229851
+ * typical). Continuous=true issues 'start' (camera moves until next
229852
+ * 'stop'); continuous=false issues 'start' followed by an autoStop
229853
+ * after a short window so a single tap of an arrow key results in a
229854
+ * tiny nudge.
229855
+ *
229856
+ * Zoom is NOT a direction on this frame — see `runZoom`.
228922
229857
  */
228923
229858
  async runPtz(pan, tilt, zoom, speed, continuous) {
228924
229859
  const api = await this.ensureApi();
@@ -228926,7 +229861,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
228926
229861
  const cmds = [];
228927
229862
  if (pan !== void 0 && Math.abs(pan) > .01) cmds.push(pan > 0 ? "Right" : "Left");
228928
229863
  if (tilt !== void 0 && Math.abs(tilt) > .01) cmds.push(tilt > 0 ? "Up" : "Down");
228929
- if (zoom !== void 0 && Math.abs(zoom) > .01) cmds.push(zoom > 0 ? "ZoomIn" : "ZoomOut");
229864
+ if (zoom !== void 0 && Math.abs(zoom) > .01) await this.runZoom(api, channel, zoom);
228930
229865
  if (cmds.length === 0) return;
228931
229866
  const baichuanSpeed = speed === void 0 ? 32 : Math.max(1, Math.min(63, Math.round(speed * 63)));
228932
229867
  for (const command of cmds) try {
@@ -228946,6 +229881,67 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
228946
229881
  });
228947
229882
  }
228948
229883
  }
229884
+ /**
229885
+ * Step the lens along the camera's own zoom travel.
229886
+ *
229887
+ * Baichuan has NO directional zoom on MSG_ID_PTZ_CONTROL (cmd 18) —
229888
+ * that frame accepts left/right/up/down and nothing else, so every
229889
+ * zoom this provider ever sent threw `Unsupported PTZ command for
229890
+ * MSG_ID_PTZ_CONTROL: ZoomIn` inside the lib, got swallowed into a
229891
+ * WARN, and returned void. The cap reported success and the lens
229892
+ * never moved: zoom has never worked on a Reolink here.
229893
+ *
229894
+ * The step arithmetic lives in `resolveZoomStep` (`./ptz-zoom.js`);
229895
+ * this method is only the I/O around it. A camera whose answer
229896
+ * carries no `<zoom>` block has no zoom to drive — that is a dropped
229897
+ * command and it is logged as one.
229898
+ */
229899
+ async runZoom(api, channel, zoom) {
229900
+ try {
229901
+ const range = (await api.getZoomFocus(channel)).zoom;
229902
+ if (!range) {
229903
+ this.ctx.logger.warn("Baichuan zoom dropped — camera reported no zoom travel", {
229904
+ tags: { deviceId: this.id },
229905
+ meta: { reason: "no-zoom-block" }
229906
+ });
229907
+ return;
229908
+ }
229909
+ const step = resolveZoomStep(range, zoom);
229910
+ if (step.kind === "refused") {
229911
+ this.ctx.logger.warn("Baichuan zoom dropped", {
229912
+ tags: { deviceId: this.id },
229913
+ meta: {
229914
+ reason: step.reason,
229915
+ curPos: range.curPos,
229916
+ minPos: range.minPos,
229917
+ maxPos: range.maxPos
229918
+ }
229919
+ });
229920
+ return;
229921
+ }
229922
+ for (let attempt = 1;; attempt += 1) try {
229923
+ await api.zoomToFactor(channel, step.target / ZOOM_FACTOR_SCALE);
229924
+ break;
229925
+ } catch (err) {
229926
+ if (attempt >= 2) throw err;
229927
+ await new Promise((resolve) => setTimeout(resolve, ZOOM_SET_RETRY_MS));
229928
+ }
229929
+ this.ctx.logger.debug("Baichuan zoom applied", {
229930
+ tags: { deviceId: this.id },
229931
+ meta: {
229932
+ from: range.curPos,
229933
+ to: step.target,
229934
+ minPos: range.minPos,
229935
+ maxPos: range.maxPos
229936
+ }
229937
+ });
229938
+ } catch (err) {
229939
+ this.ctx.logger.warn("Baichuan zoom command failed", {
229940
+ tags: { deviceId: this.id },
229941
+ meta: { error: err instanceof Error ? err.message : String(err) }
229942
+ });
229943
+ }
229944
+ }
228949
229945
  async getStreamSources() {
228950
229946
  return buildStreamIds(this.channelCount()).map((s, i) => ({
228951
229947
  id: s.id,
@@ -229254,6 +230250,10 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
229254
230250
  async materializeStreamSocket(camStreamId) {
229255
230251
  const parts = parseCamStreamId(camStreamId, this.getChannel());
229256
230252
  if (!parts || parts.kind !== "native") return;
230253
+ this.ctx.logger.info("broker requested rfc4571 source refresh — materializing on demand", {
230254
+ tags: { deviceId: this.id },
230255
+ meta: { camStreamId }
230256
+ });
229257
230257
  const server = await this.ensureRfc4571Server(camStreamId, parts.channel, parts.profile);
229258
230258
  if (!server) {
229259
230259
  this.ctx.logger.warn("materializeStreamSocket: ensureRfc4571Server returned null", { tags: {
@@ -233748,10 +234748,6 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
233748
234748
  this.ctx.logger.debug("broker requested source refresh without a camStreamId — broker will re-pull the catalog", { tags: { deviceId } });
233749
234749
  return;
233750
234750
  }
233751
- this.ctx.logger.info("broker requested rfc4571 source refresh — materializing on demand", {
233752
- tags: { deviceId },
233753
- meta: { camStreamId }
233754
- });
233755
234751
  await dev.materializeStreamSocket(camStreamId);
233756
234752
  }
233757
234753
  async supportsDiscovery() {