@camstack/addon-export-hap 1.2.23 → 1.2.24

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.
@@ -8234,7 +8234,15 @@ var RecordingConfigSchema = object({
8234
8234
  * Each completed/failed run also lands one durable ops-log row on its owning
8235
8235
  * addon surface.
8236
8236
  */
8237
+ /**
8238
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
8239
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
8240
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
8241
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
8242
+ * runs at all.
8243
+ */
8237
8244
  var RelocateJobStateSchema = _enum([
8245
+ "queued",
8238
8246
  "running",
8239
8247
  "done",
8240
8248
  "failed",
@@ -8269,6 +8277,15 @@ var RelocateFootageInputSchema = object({
8269
8277
  /** Limits relocation to the logical profile class. Omit only for the
8270
8278
  * pre-orchestration compatibility path. */
8271
8279
  footageClass: RelocateFootageClassSchema.optional(),
8280
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
8281
+ * is what a whole-disk drain means. The rebalance path always sets it: its
8282
+ * unit is a (camera, profile) pile, not a disk. */
8283
+ deviceId: number().int().optional(),
8284
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
8285
+ * Finer than `footageClass`, which cannot separate high from mid — and the
8286
+ * placement plan assigns those two independently, so a rebalance that could
8287
+ * only say "recordings" would move footage the plan never asked to move. */
8288
+ profiles: array(string()).optional(),
8272
8289
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
8273
8290
  * never allowed to starve live writers. */
8274
8291
  throttleMbps: number().min(1).max(1e3).optional()
@@ -8404,6 +8421,21 @@ var StorageLocationSchema = object({
8404
8421
  nodeId: string().optional(),
8405
8422
  isDefault: boolean().default(false),
8406
8423
  isSystem: boolean().default(false),
8424
+ /**
8425
+ * Operator opt-in: whether consumers that BALANCE across several locations
8426
+ * of a type may write here. Recordings reads it today; event media and
8427
+ * backups are the next consumers, which is why the flag lives on the
8428
+ * location rather than in any one addon's store — nothing has to be
8429
+ * extended to add the next consumer.
8430
+ *
8431
+ * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8432
+ * flag existed reads back with no flag and keeps working exactly as before;
8433
+ * that is the whole compat story, and it is why no migration ships with it.
8434
+ * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8435
+ * disk must not silently start writing to it); the default of a type is
8436
+ * always stamped `true`.
8437
+ */
8438
+ enabled: boolean().optional(),
8407
8439
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8408
8440
  * for node-local locations it can reach) — never persisted, absent when the
8409
8441
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -12841,7 +12873,8 @@ method(object({
12841
12873
  }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12842
12874
  /**
12843
12875
  * filesystem-browse — per-node capability for browsing the node's local
12844
- * filesystem, sandboxed to operator-configured allowed roots. Used by the
12876
+ * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12877
+ * are sandboxed to operator-configured allowed roots (D115). Used by the
12845
12878
  * admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
12846
12879
  * (one provider per node); the hub calls it with `{nodeId}` so the codegen
12847
12880
  * routes to that exact node (default `nodeIdMode:'routing'`).
@@ -14654,6 +14687,13 @@ var MaskGridDimsSchema = object({
14654
14687
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
14655
14688
  * this one field keeps the schema additive — a rule still declares exactly
14656
14689
  * one trigger.
14690
+ *
14691
+ * AUDIO rules add no member here, for the reason occupancy added none: the
14692
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
14693
+ * mirror.ts` fails the build on a member the app cannot render) and every
14694
+ * member costs a release train. A sustained-sound rule is therefore an
14695
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
14696
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
14657
14697
  */
14658
14698
  var NcDeliverySchema = _enum([
14659
14699
  "immediate",
@@ -14668,15 +14708,32 @@ var NcDeliverySchema = _enum([
14668
14708
  * depend on a provider's raw event name or payload shape.
14669
14709
  */
14670
14710
  var NcSystemEventKindSchema = _enum([
14671
- "camera-online",
14672
- "camera-offline",
14711
+ "device-online",
14712
+ "device-offline",
14713
+ "device-disabled",
14714
+ "device-enabled",
14673
14715
  "stream-online",
14674
14716
  "stream-offline",
14675
14717
  "node-online",
14676
14718
  "node-offline",
14677
14719
  "addon-update-available",
14678
- "server-update-available"
14720
+ "server-update-available",
14721
+ "alarm-triggered",
14722
+ "alarm-armed",
14723
+ "alarm-disarmed",
14724
+ "camera-online",
14725
+ "camera-offline",
14726
+ "camera-disabled",
14727
+ "camera-enabled"
14679
14728
  ]);
14729
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
14730
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
14731
+ "camera-online",
14732
+ "camera-offline",
14733
+ "camera-disabled",
14734
+ "camera-enabled"
14735
+ ]);
14736
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
14680
14737
  /**
14681
14738
  * One coherent system-event condition. `kinds` is the required opt-in safety
14682
14739
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -14685,6 +14742,18 @@ var NcSystemEventKindSchema = _enum([
14685
14742
  var NcSystemEventConditionSchema = object({
14686
14743
  kinds: array(NcSystemEventKindSchema).min(1),
14687
14744
  deviceIds: array(number().int()).min(1).optional(),
14745
+ /**
14746
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
14747
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
14748
+ * is what a liveness rule means when nobody said otherwise.
14749
+ *
14750
+ * This is where "only my cameras" is expressed, and it lives on the rule for
14751
+ * one reason: the intake cannot know which devices this household cares
14752
+ * about, and a producer-side filter is one no operator can change. Fails
14753
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
14754
+ * does not carry) matches no `deviceTypes` list.
14755
+ */
14756
+ deviceTypes: array(string().min(1)).min(1).optional(),
14688
14757
  nodeIds: array(string().min(1)).min(1).optional(),
14689
14758
  packageNames: array(string().min(1)).min(1).optional()
14690
14759
  });
@@ -14735,6 +14804,47 @@ var NcOccupancyConditionSchema = object({
14735
14804
  sustainSeconds: number().int().min(0).max(3600).default(15)
14736
14805
  });
14737
14806
  /**
14807
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
14808
+ *
14809
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
14810
+ * reference notifier uses, so an operator moving between them re-uses what
14811
+ * they already know): a rule matches when, over a sampling window of
14812
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14813
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14814
+ *
14815
+ * - `dbThreshold` — its level is at or above this many dBFS (see
14816
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14817
+ * - `labels` — the classifier put at least one of these labels on it.
14818
+ *
14819
+ * Both are OPTIONAL and independent, which is the point of the shape: a
14820
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
14821
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14822
+ * is given** — a window in which every sample is trivially a hit would fire on
14823
+ * silence, so the engine refuses such a condition rather than notifying on
14824
+ * nothing (the schema cannot express "at least one of" without becoming a
14825
+ * ZodEffects the cap path would have to special-case).
14826
+ *
14827
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
14828
+ * must be FULL before it can match — a window that has been open for two
14829
+ * seconds of its ten is 100% of nothing, and firing on it would make
14830
+ * `samplingSeconds` decorative.
14831
+ *
14832
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
14833
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
14834
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
14835
+ * an operator who typed `dog` mean the same thing.
14836
+ */
14837
+ var NcAudioConditionSchema = object({
14838
+ /** Audio macro labels; absent = any sound (level-only rule). */
14839
+ labels: array(string().min(1)).min(1).optional(),
14840
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
14841
+ dbThreshold: number().min(-96).max(0).optional(),
14842
+ /** Percentage of the window's samples that must be hits (1–100). */
14843
+ hitPercent: number().int().min(1).max(100).default(60),
14844
+ /** Length of the sampling window in seconds. */
14845
+ samplingSeconds: number().int().min(1).max(300).default(10)
14846
+ });
14847
+ /**
14738
14848
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
14739
14849
  *
14740
14850
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -15007,7 +15117,33 @@ var NcConditionsSchema = object({
15007
15117
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
15008
15118
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
15009
15119
  */
15010
- occupancy: NcOccupancyConditionSchema.optional()
15120
+ occupancy: NcOccupancyConditionSchema.optional(),
15121
+ /**
15122
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
15123
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
15124
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
15125
+ * a window that is not full yet, neither filter given). See
15126
+ * {@link NcAudioCondition}.
15127
+ *
15128
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
15129
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
15130
+ * a detection, a track or a device event (the same fail-closed pairing
15131
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
15132
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
15133
+ * (an `immediate` rule naming an `audio-*` class, one notification per
15134
+ * classified sample) stays exactly as it was for rules that already use it.
15135
+ *
15136
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
15137
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
15138
+ * (`camstack/src/data/notification-center.ts`, guarded by
15139
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
15140
+ * condition fields it does not know when a rule is saved from the phone.
15141
+ * Publishing an editor for a condition the app cannot round-trip is how an
15142
+ * operator loses a rule's conditions by opening it — so the descriptor, the
15143
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
15144
+ * does an audio rule become authorable.
15145
+ */
15146
+ audio: NcAudioConditionSchema.optional()
15011
15147
  });
15012
15148
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
15013
15149
  var NcRuleTargetSchema = object({
@@ -15121,6 +15257,73 @@ var NcThrottleSchema = object({
15121
15257
  */
15122
15258
  granularity: NcThrottleGranularitySchema.optional()
15123
15259
  });
15260
+ /**
15261
+ * How long the confirm gate may hold ONE notification, and how big the picture
15262
+ * it judges may be.
15263
+ *
15264
+ * The clamp is the product decision, not a coincidence of the model: p50 was
15265
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
15266
+ * arrives after the visitor has gone is not a notification. 448 px was enough
15267
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
15268
+ * tokens for pixels the model pools away.
15269
+ */
15270
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
15271
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
15272
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
15273
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
15274
+ var NcConfirmExpectSchema = object({
15275
+ op: _enum([
15276
+ ">=",
15277
+ ">",
15278
+ "<=",
15279
+ "<",
15280
+ "=="
15281
+ ]),
15282
+ count: number().int().min(0).max(1e3)
15283
+ });
15284
+ /**
15285
+ * AI CONFIRM — a vision model looks at the picture this notification is about
15286
+ * to ship and says whether it agrees with the rule.
15287
+ *
15288
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
15289
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
15290
+ * on the operator's phone is not a verdict about this notification.
15291
+ *
15292
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
15293
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
15294
+ * the default and every fail-open is COUNTED, because a gate that always fails
15295
+ * open looks in the log exactly like a gate that works.
15296
+ *
15297
+ * Every field is `.optional()` rather than relied on as a Zod default at the
15298
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
15299
+ * production failures in one day), so the gate reads absent as the constant
15300
+ * above rather than trusting a parse it may never have seen.
15301
+ */
15302
+ var NcConfirmSchema = object({
15303
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
15304
+ * same thing, and both mean "deliver exactly as before". */
15305
+ enabled: boolean().default(false),
15306
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
15307
+ profileId: string().optional(),
15308
+ /**
15309
+ * The operator's question, in his own words. Absent = a question derived
15310
+ * from the rule (its class and its expectation).
15311
+ *
15312
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
15313
+ * banners, signage and plates as instructions if you let them reach the
15314
+ * prompt — proven live — so the authoritative contract stays in the system
15315
+ * turn and only rule-authored words land here.
15316
+ */
15317
+ prompt: string().max(1e3).optional(),
15318
+ /** Fire only when the model's count satisfies this. Absent = the model's
15319
+ * own boolean verdict decides. */
15320
+ expect: NcConfirmExpectSchema.optional(),
15321
+ timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
15322
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
15323
+ onTimeout: _enum(["fire", "suppress"]).default("fire"),
15324
+ /** Longest edge the judged image is downscaled to before it is sent. */
15325
+ maxImagePx: number().int().min(64).max(2048).default(448)
15326
+ });
15124
15327
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
15125
15328
  var NcRuleInputSchema = object({
15126
15329
  name: string().min(1).max(200),
@@ -15181,7 +15384,13 @@ var NcRuleInputSchema = object({
15181
15384
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
15182
15385
  * shape as every other actuation.
15183
15386
  */
15184
- actions: NcRuleActionsSchema.optional()
15387
+ actions: NcRuleActionsSchema.optional(),
15388
+ /**
15389
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
15390
+ * a rule that predates the gate must keep delivering byte-for-byte as it
15391
+ * did, and absent is the only way to say that without a migration.
15392
+ */
15393
+ confirm: NcConfirmSchema.optional()
15185
15394
  });
15186
15395
  /**
15187
15396
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -15192,7 +15401,37 @@ var NcRuleInputSchema = object({
15192
15401
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
15193
15402
  * `updateRule` patch.
15194
15403
  */
15195
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
15404
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
15405
+ disabledTargetIds: array(string()).optional(),
15406
+ /**
15407
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
15408
+ *
15409
+ * It makes the key optional to SUPPLY; the parse still materialises the
15410
+ * default when the key is absent. And `NcRuleStore.update` merges with
15411
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
15412
+ * one — which made every partial edit destructive:
15413
+ *
15414
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
15415
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
15416
+ * setEnabled(ruleId, false) → conditions reset to `{}`
15417
+ *
15418
+ * A rule scoped to one camera and one zone silently became a rule that
15419
+ * matches EVERY event on EVERY camera, and lost its `media` policy
15420
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
15421
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
15422
+ * within a minute of a two-field patch.
15423
+ *
15424
+ * So every defaulted field is re-declared here WITHOUT its default. The
15425
+ * inner defaults still apply when the caller DOES send the key — `{}` for
15426
+ * conditions remains a real instruction ("clear them") — and only the
15427
+ * absent key is now genuinely absent.
15428
+ */
15429
+ enabled: boolean().optional(),
15430
+ conditions: NcConditionsSchema.optional(),
15431
+ media: NcMediaPolicySchema.optional(),
15432
+ throttle: NcThrottleSchema.optional(),
15433
+ priority: number().int().min(1).max(5).optional()
15434
+ });
15196
15435
  /** A persisted rule. */
15197
15436
  var NcRuleSchema = NcRuleInputSchema.extend({
15198
15437
  id: string(),
@@ -15493,6 +15732,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
15493
15732
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
15494
15733
  * copy would lie the first time a rule is disabled.
15495
15734
  */
15735
+ /**
15736
+ * Why a device a mode NAMES is nonetheless not armed by it.
15737
+ *
15738
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
15739
+ * per-camera notification switch the Notification Center already owns,
15740
+ * `detection-off` is the device's own detection binding being inactive, and
15741
+ * `offline` is the device manager's liveness. A fourth reason would mean a
15742
+ * fourth authority, and inventing one here is how a panel starts disagreeing
15743
+ * with the switches the operator actually used.
15744
+ */
15745
+ var NcAlarmSkipReasonSchema = _enum([
15746
+ "muted",
15747
+ "detection-off",
15748
+ "offline"
15749
+ ]);
15750
+ var NcAlarmSkippedDeviceSchema = object({
15751
+ deviceId: number().int(),
15752
+ reason: NcAlarmSkipReasonSchema
15753
+ });
15496
15754
  var NcAlarmModeCoverageSchema = object({
15497
15755
  mode: AlarmArmModeSchema,
15498
15756
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -15500,7 +15758,18 @@ var NcAlarmModeCoverageSchema = object({
15500
15758
  /** At least one covering rule has no device scope, so the mode covers all. */
15501
15759
  allDevices: boolean(),
15502
15760
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
15503
- deviceIds: array(number().int())
15761
+ deviceIds: array(number().int()),
15762
+ /**
15763
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
15764
+ * excludes it.
15765
+ *
15766
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
15767
+ * twelve makes it false in exactly the way nobody notices until an incident.
15768
+ * Defaulted to `[]` so a coverage answer computed before this field existed
15769
+ * still parses as "nothing known to be skipped" rather than failing the whole
15770
+ * alarm tab.
15771
+ */
15772
+ skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
15504
15773
  });
15505
15774
  var NcAlarmConfigSchema = object({
15506
15775
  /**
@@ -23817,7 +24086,19 @@ var RecordingManifestSchema = object({
23817
24086
  * profiles/subtrees/locations on this node). */
23818
24087
  var RecordingDeviceUsageSchema = object({
23819
24088
  deviceId: number(),
23820
- usedBytes: number()
24089
+ usedBytes: number(),
24090
+ /**
24091
+ * Start of this camera's OLDEST indexed segment, across every profile and
24092
+ * location — the "Oldest footage" column in Recordings → Storage, and the
24093
+ * only honest answer to "is retention actually holding?" per camera.
24094
+ *
24095
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
24096
+ * predates this field omits it entirely, and a hub whose types carry the
24097
+ * field must keep validating that older provider's payload: the framework
24098
+ * (types) and the addon ship on different trains, and the addon is usually
24099
+ * the later of the two.
24100
+ */
24101
+ oldestMs: number().nullable().optional()
23821
24102
  });
23822
24103
  /** Recording storage usage + capacity for one storage location. */
23823
24104
  var RecordingLocationUsageSchema = object({
@@ -23845,6 +24126,57 @@ var RecordingStorageUsageSchema = object({
23845
24126
  locations: array(RecordingLocationUsageSchema)
23846
24127
  });
23847
24128
  /**
24129
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
24130
+ *
24131
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
24132
+ * is the operator asking for the EXISTING archive to be brought into line with
24133
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
24134
+ * location, run FIFO behind the single-flight mover.
24135
+ *
24136
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
24137
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
24138
+ * (empty on the plan).
24139
+ */
24140
+ var RecordingRebalanceMoveSchema = object({
24141
+ deviceId: number(),
24142
+ profile: string(),
24143
+ fromLocationId: string(),
24144
+ toLocationId: string(),
24145
+ bytes: number(),
24146
+ files: number().int()
24147
+ });
24148
+ /** Why a pile that is out of place is staying there. Every refusal is
24149
+ * reported: a rebalance that silently drops a camera reads exactly like one
24150
+ * that had nothing to do. */
24151
+ var RecordingRebalanceSkipReasonSchema = _enum([
24152
+ "unassigned",
24153
+ "target-not-writable",
24154
+ "below-threshold",
24155
+ "no-headroom"
24156
+ ]);
24157
+ var RecordingRebalanceSkipSchema = object({
24158
+ deviceId: number(),
24159
+ profile: string(),
24160
+ fromLocationId: string(),
24161
+ /** The location the plan wants; null when the camera has no assignment. */
24162
+ toLocationId: string().nullable(),
24163
+ bytes: number(),
24164
+ reason: RecordingRebalanceSkipReasonSchema
24165
+ });
24166
+ var RecordingRebalancePlanSchema = object({
24167
+ moves: array(RecordingRebalanceMoveSchema),
24168
+ skipped: array(RecordingRebalanceSkipSchema),
24169
+ bytesToMove: number(),
24170
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
24171
+ jobIds: array(string())
24172
+ });
24173
+ var RecordingRebalanceInputSchema = object({
24174
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
24175
+ throttleMbps: number().min(1).max(1e3).optional(),
24176
+ /** Ignore piles smaller than this (default 1 GB). */
24177
+ minMoveGb: number().min(0).optional()
24178
+ });
24179
+ /**
23848
24180
  * Result of locating footage at a wall-clock instant for one device/profile.
23849
24181
  * `segment` carries the covering segment's window; `gap` reports the forward
23850
24182
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -24007,9 +24339,24 @@ method(object({
24007
24339
  }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
24008
24340
  kind: "mutation",
24009
24341
  auth: "admin"
24342
+ }), method(RelocateFootageInputSchema, object({ jobId: string() }), {
24343
+ kind: "mutation",
24344
+ auth: "admin"
24345
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
24346
+ kind: "query",
24347
+ auth: "admin"
24348
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
24349
+ kind: "mutation",
24350
+ auth: "admin"
24351
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
24352
+ kind: "query",
24353
+ auth: "admin"
24354
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
24355
+ kind: "mutation",
24356
+ auth: "admin"
24010
24357
  });
24011
24358
  /**
24012
- * `recordingExport` cap — render a footage time range into a single downloadable
24359
+ * `recording-export` cap — render a footage time range into a single downloadable
24013
24360
  * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
24014
24361
  * bounded lifetime with a durable history, auto-expiry, and optional
24015
24362
  * delete-after-download.
@@ -29350,6 +29697,12 @@ Object.freeze({
29350
29697
  addonId: null,
29351
29698
  access: "create"
29352
29699
  },
29700
+ "recording.cancelRelocateJob": {
29701
+ capName: "recording",
29702
+ capScope: "system",
29703
+ addonId: null,
29704
+ access: "create"
29705
+ },
29353
29706
  "recording.cancelStorageMigrationMove": {
29354
29707
  capName: "recording",
29355
29708
  capScope: "system",
@@ -29404,6 +29757,12 @@ Object.freeze({
29404
29757
  addonId: null,
29405
29758
  access: "view"
29406
29759
  },
29760
+ "recording.listRelocateJobs": {
29761
+ capName: "recording",
29762
+ capScope: "system",
29763
+ addonId: null,
29764
+ access: "view"
29765
+ },
29407
29766
  "recording.locateSegment": {
29408
29767
  capName: "recording",
29409
29768
  capScope: "system",
@@ -29416,6 +29775,12 @@ Object.freeze({
29416
29775
  addonId: null,
29417
29776
  access: "create"
29418
29777
  },
29778
+ "recording.planStorageRebalance": {
29779
+ capName: "recording",
29780
+ capScope: "system",
29781
+ addonId: null,
29782
+ access: "view"
29783
+ },
29419
29784
  "recording.pruneFootage": {
29420
29785
  capName: "recording",
29421
29786
  capScope: "system",
@@ -29440,6 +29805,12 @@ Object.freeze({
29440
29805
  addonId: null,
29441
29806
  access: "create"
29442
29807
  },
29808
+ "recording.relocateFootage": {
29809
+ capName: "recording",
29810
+ capScope: "system",
29811
+ addonId: null,
29812
+ access: "create"
29813
+ },
29443
29814
  "recording.renderClip": {
29444
29815
  capName: "recording",
29445
29816
  capScope: "system",
@@ -29476,44 +29847,50 @@ Object.freeze({
29476
29847
  addonId: null,
29477
29848
  access: "create"
29478
29849
  },
29850
+ "recording.startStorageRebalance": {
29851
+ capName: "recording",
29852
+ capScope: "system",
29853
+ addonId: null,
29854
+ access: "create"
29855
+ },
29479
29856
  "recordingExport.cancelExport": {
29480
- capName: "recordingExport",
29857
+ capName: "recording-export",
29481
29858
  capScope: "system",
29482
29859
  addonId: null,
29483
29860
  access: "create"
29484
29861
  },
29485
29862
  "recordingExport.createExport": {
29486
- capName: "recordingExport",
29863
+ capName: "recording-export",
29487
29864
  capScope: "system",
29488
29865
  addonId: null,
29489
29866
  access: "create"
29490
29867
  },
29491
29868
  "recordingExport.deleteExport": {
29492
- capName: "recordingExport",
29869
+ capName: "recording-export",
29493
29870
  capScope: "system",
29494
29871
  addonId: null,
29495
29872
  access: "delete"
29496
29873
  },
29497
29874
  "recordingExport.getDownloadUrl": {
29498
- capName: "recordingExport",
29875
+ capName: "recording-export",
29499
29876
  capScope: "system",
29500
29877
  addonId: null,
29501
29878
  access: "view"
29502
29879
  },
29503
29880
  "recordingExport.getExport": {
29504
- capName: "recordingExport",
29881
+ capName: "recording-export",
29505
29882
  capScope: "system",
29506
29883
  addonId: null,
29507
29884
  access: "view"
29508
29885
  },
29509
29886
  "recordingExport.listExports": {
29510
- capName: "recordingExport",
29887
+ capName: "recording-export",
29511
29888
  capScope: "system",
29512
29889
  addonId: null,
29513
29890
  access: "view"
29514
29891
  },
29515
29892
  "recordingExport.readExportBytes": {
29516
- capName: "recordingExport",
29893
+ capName: "recording-export",
29517
29894
  capScope: "system",
29518
29895
  addonId: null,
29519
29896
  access: "view"
@@ -30890,6 +31267,104 @@ var FramerateField = number().int().min(1).max(60);
30890
31267
  var TargetsField = array(NcRuleTargetSchema).min(1);
30891
31268
  var PriorityField = number().int().min(1).max(5);
30892
31269
  /**
31270
+ * Explicit override of the DENSE sampling cadence, seconds.
31271
+ *
31272
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
31273
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
31274
+ * made that same base 3 s and rendered a person pass as two frames.)
31275
+ *
31276
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
31277
+ * `denseCadenceSec` and played at `framerate` occupies
31278
+ *
31279
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
31280
+ *
31281
+ * 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.
31282
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
31283
+ * and therefore the length of a quiet night, does not move.
31284
+ *
31285
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
31286
+ * the recording has them returns the same frames, requested twice. Must be
31287
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
31288
+ * a uniform video the operator believes is two-rate — and upsert refuses it
31289
+ * rather than letting the export cap reject the render hours after the window.
31290
+ */
31291
+ var DenseCadenceSecField = number().min(.1).max(3600);
31292
+ /**
31293
+ * Minimum seconds of OUTPUT video each detection range must occupy.
31294
+ *
31295
+ * The operator-facing form of the arithmetic above: instead of solving for a
31296
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
31297
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
31298
+ * that range every ~583 ms.
31299
+ *
31300
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
31301
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
31302
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
31303
+ * ranges are sampled denser than they need. Per-range cadences require a cap
31304
+ * schema change and are the tracked follow-up.
31305
+ *
31306
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
31307
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
31308
+ * by real footage, never met by duplicating frames into motion that never
31309
+ * happened.
31310
+ */
31311
+ var MinDwellSecField = number().min(0).max(60);
31312
+ /**
31313
+ * Caption burned into the notification's preview frame.
31314
+ *
31315
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
31316
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
31317
+ * templating dialect for one field would be a second thing to explain.
31318
+ *
31319
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
31320
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
31321
+ * the reason this is not `.min(1)`.
31322
+ */
31323
+ var PreviewTextField = string().max(200);
31324
+ /**
31325
+ * Whether the notification's preview is a STILL or a short animation.
31326
+ *
31327
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
31328
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
31329
+ * night reads better as three seconds of motion than as one frame of it. Both
31330
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
31331
+ * simply applies it to a dozen frames sampled across the render and assembles
31332
+ * them.
31333
+ *
31334
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
31335
+ * seeks and a palette pass, and no rule that never asked for one should start
31336
+ * paying that on the deploy that shipped it.
31337
+ *
31338
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
31339
+ */
31340
+ var PreviewModeField = _enum(["image", "gif"]);
31341
+ /**
31342
+ * Which detection classes the notification reports counts for.
31343
+ *
31344
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
31345
+ * plan — no second query — aggregated per class. Absent or empty means "every
31346
+ * class the window actually contained", which is what an operator who never
31347
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
31348
+ * counts cars all night).
31349
+ *
31350
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
31351
+ * …). An unknown name simply never matches and reports nothing — it is not an
31352
+ * error, because a rule may legitimately name a class this camera's model does
31353
+ * not emit.
31354
+ *
31355
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
31356
+ * - `{{detections}}` — total over the reported classes
31357
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
31358
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
31359
+ * one per class, `count_` + the class name
31360
+ *
31361
+ * With NO custom body template the summary is appended to the derived body, and
31362
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
31363
+ * reads. With a custom template the operator owns every word — nothing is
31364
+ * appended, so `{{detectionSummary}}` is how he asks for it.
31365
+ */
31366
+ var ReportClassesField = array(string().min(1).max(40)).max(20);
31367
+ /**
30893
31368
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
30894
31369
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
30895
31370
  * here (see the ownership note above).
@@ -30909,9 +31384,30 @@ var TimelapseRuleInputSchema = object({
30909
31384
  cadenceSec: CadenceSecField.default(15),
30910
31385
  /** Output frames per second of the assembled mp4 (predecessor parity). */
30911
31386
  framerate: FramerateField.default(10),
31387
+ /**
31388
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
31389
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
31390
+ * field gets.
31391
+ */
31392
+ denseCadenceSec: DenseCadenceSecField.optional(),
31393
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
31394
+ minDwellSec: MinDwellSecField.optional(),
30912
31395
  /** `notification-output` targets the finished video/thumbnail is sent to. */
30913
31396
  targets: TargetsField,
30914
31397
  template: TimelapseTemplateSchema.optional(),
31398
+ /**
31399
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
31400
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
31401
+ *
31402
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
31403
+ * the notification's title/body, and clearing it (`template: null`) must not
31404
+ * silently clear the caption too.
31405
+ */
31406
+ previewText: PreviewTextField.optional(),
31407
+ /** Still or animation — see {@link PreviewModeField}. */
31408
+ previewMode: PreviewModeField.default("image"),
31409
+ /** Classes the notification counts — see {@link ReportClassesField}. */
31410
+ reportClasses: ReportClassesField.optional(),
30915
31411
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
30916
31412
  priority: PriorityField.default(3)
30917
31413
  });
@@ -30922,8 +31418,13 @@ object({
30922
31418
  schedule: NcScheduleSchema.optional(),
30923
31419
  cadenceSec: CadenceSecField.optional(),
30924
31420
  framerate: FramerateField.optional(),
31421
+ denseCadenceSec: DenseCadenceSecField.optional(),
31422
+ minDwellSec: MinDwellSecField.optional(),
30925
31423
  targets: TargetsField.optional(),
30926
31424
  template: TimelapseTemplateSchema.nullable().optional(),
31425
+ previewText: PreviewTextField.optional(),
31426
+ previewMode: PreviewModeField.optional(),
31427
+ reportClasses: ReportClassesField.optional(),
30927
31428
  priority: PriorityField.optional()
30928
31429
  });
30929
31430
  TimelapseRuleInputSchema.extend({