@camstack/addon-terminal 0.1.16 → 0.1.17

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 +518 -17
  2. package/dist/addon.mjs +518 -17
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7679,7 +7679,15 @@ var RecordingConfigSchema = object({
7679
7679
  * Each completed/failed run also lands one durable ops-log row on its owning
7680
7680
  * addon surface.
7681
7681
  */
7682
+ /**
7683
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
7684
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
7685
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
7686
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
7687
+ * runs at all.
7688
+ */
7682
7689
  var RelocateJobStateSchema = _enum([
7690
+ "queued",
7683
7691
  "running",
7684
7692
  "done",
7685
7693
  "failed",
@@ -7714,6 +7722,15 @@ var RelocateFootageInputSchema = object({
7714
7722
  /** Limits relocation to the logical profile class. Omit only for the
7715
7723
  * pre-orchestration compatibility path. */
7716
7724
  footageClass: RelocateFootageClassSchema.optional(),
7725
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
7726
+ * is what a whole-disk drain means. The rebalance path always sets it: its
7727
+ * unit is a (camera, profile) pile, not a disk. */
7728
+ deviceId: number().int().optional(),
7729
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
7730
+ * Finer than `footageClass`, which cannot separate high from mid — and the
7731
+ * placement plan assigns those two independently, so a rebalance that could
7732
+ * only say "recordings" would move footage the plan never asked to move. */
7733
+ profiles: array(string()).optional(),
7717
7734
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7718
7735
  * never allowed to starve live writers. */
7719
7736
  throttleMbps: number().min(1).max(1e3).optional()
@@ -7849,6 +7866,21 @@ var StorageLocationSchema = object({
7849
7866
  nodeId: string().optional(),
7850
7867
  isDefault: boolean().default(false),
7851
7868
  isSystem: boolean().default(false),
7869
+ /**
7870
+ * Operator opt-in: whether consumers that BALANCE across several locations
7871
+ * of a type may write here. Recordings reads it today; event media and
7872
+ * backups are the next consumers, which is why the flag lives on the
7873
+ * location rather than in any one addon's store — nothing has to be
7874
+ * extended to add the next consumer.
7875
+ *
7876
+ * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
7877
+ * flag existed reads back with no flag and keeps working exactly as before;
7878
+ * that is the whole compat story, and it is why no migration ships with it.
7879
+ * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
7880
+ * disk must not silently start writing to it); the default of a type is
7881
+ * always stamped `true`.
7882
+ */
7883
+ enabled: boolean().optional(),
7852
7884
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
7853
7885
  * for node-local locations it can reach) — never persisted, absent when the
7854
7886
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -12346,7 +12378,8 @@ method(object({
12346
12378
  }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12347
12379
  /**
12348
12380
  * filesystem-browse — per-node capability for browsing the node's local
12349
- * filesystem, sandboxed to operator-configured allowed roots. Used by the
12381
+ * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12382
+ * are sandboxed to operator-configured allowed roots (D115). Used by the
12350
12383
  * admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
12351
12384
  * (one provider per node); the hub calls it with `{nodeId}` so the codegen
12352
12385
  * routes to that exact node (default `nodeIdMode:'routing'`).
@@ -14187,6 +14220,13 @@ var MaskGridDimsSchema = object({
14187
14220
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
14188
14221
  * this one field keeps the schema additive — a rule still declares exactly
14189
14222
  * one trigger.
14223
+ *
14224
+ * AUDIO rules add no member here, for the reason occupancy added none: the
14225
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
14226
+ * mirror.ts` fails the build on a member the app cannot render) and every
14227
+ * member costs a release train. A sustained-sound rule is therefore an
14228
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
14229
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
14190
14230
  */
14191
14231
  var NcDeliverySchema = _enum([
14192
14232
  "immediate",
@@ -14201,15 +14241,32 @@ var NcDeliverySchema = _enum([
14201
14241
  * depend on a provider's raw event name or payload shape.
14202
14242
  */
14203
14243
  var NcSystemEventKindSchema = _enum([
14204
- "camera-online",
14205
- "camera-offline",
14244
+ "device-online",
14245
+ "device-offline",
14246
+ "device-disabled",
14247
+ "device-enabled",
14206
14248
  "stream-online",
14207
14249
  "stream-offline",
14208
14250
  "node-online",
14209
14251
  "node-offline",
14210
14252
  "addon-update-available",
14211
- "server-update-available"
14253
+ "server-update-available",
14254
+ "alarm-triggered",
14255
+ "alarm-armed",
14256
+ "alarm-disarmed",
14257
+ "camera-online",
14258
+ "camera-offline",
14259
+ "camera-disabled",
14260
+ "camera-enabled"
14261
+ ]);
14262
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
14263
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
14264
+ "camera-online",
14265
+ "camera-offline",
14266
+ "camera-disabled",
14267
+ "camera-enabled"
14212
14268
  ]);
14269
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
14213
14270
  /**
14214
14271
  * One coherent system-event condition. `kinds` is the required opt-in safety
14215
14272
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -14218,6 +14275,18 @@ var NcSystemEventKindSchema = _enum([
14218
14275
  var NcSystemEventConditionSchema = object({
14219
14276
  kinds: array(NcSystemEventKindSchema).min(1),
14220
14277
  deviceIds: array(number().int()).min(1).optional(),
14278
+ /**
14279
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
14280
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
14281
+ * is what a liveness rule means when nobody said otherwise.
14282
+ *
14283
+ * This is where "only my cameras" is expressed, and it lives on the rule for
14284
+ * one reason: the intake cannot know which devices this household cares
14285
+ * about, and a producer-side filter is one no operator can change. Fails
14286
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
14287
+ * does not carry) matches no `deviceTypes` list.
14288
+ */
14289
+ deviceTypes: array(string().min(1)).min(1).optional(),
14221
14290
  nodeIds: array(string().min(1)).min(1).optional(),
14222
14291
  packageNames: array(string().min(1)).min(1).optional()
14223
14292
  });
@@ -14268,6 +14337,47 @@ var NcOccupancyConditionSchema = object({
14268
14337
  sustainSeconds: number().int().min(0).max(3600).default(15)
14269
14338
  });
14270
14339
  /**
14340
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
14341
+ *
14342
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
14343
+ * reference notifier uses, so an operator moving between them re-uses what
14344
+ * they already know): a rule matches when, over a sampling window of
14345
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14346
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14347
+ *
14348
+ * - `dbThreshold` — its level is at or above this many dBFS (see
14349
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14350
+ * - `labels` — the classifier put at least one of these labels on it.
14351
+ *
14352
+ * Both are OPTIONAL and independent, which is the point of the shape: a
14353
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
14354
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14355
+ * is given** — a window in which every sample is trivially a hit would fire on
14356
+ * silence, so the engine refuses such a condition rather than notifying on
14357
+ * nothing (the schema cannot express "at least one of" without becoming a
14358
+ * ZodEffects the cap path would have to special-case).
14359
+ *
14360
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
14361
+ * must be FULL before it can match — a window that has been open for two
14362
+ * seconds of its ten is 100% of nothing, and firing on it would make
14363
+ * `samplingSeconds` decorative.
14364
+ *
14365
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
14366
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
14367
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
14368
+ * an operator who typed `dog` mean the same thing.
14369
+ */
14370
+ var NcAudioConditionSchema = object({
14371
+ /** Audio macro labels; absent = any sound (level-only rule). */
14372
+ labels: array(string().min(1)).min(1).optional(),
14373
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
14374
+ dbThreshold: number().min(-96).max(0).optional(),
14375
+ /** Percentage of the window's samples that must be hits (1–100). */
14376
+ hitPercent: number().int().min(1).max(100).default(60),
14377
+ /** Length of the sampling window in seconds. */
14378
+ samplingSeconds: number().int().min(1).max(300).default(10)
14379
+ });
14380
+ /**
14271
14381
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
14272
14382
  *
14273
14383
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -14540,7 +14650,33 @@ var NcConditionsSchema = object({
14540
14650
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
14541
14651
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
14542
14652
  */
14543
- occupancy: NcOccupancyConditionSchema.optional()
14653
+ occupancy: NcOccupancyConditionSchema.optional(),
14654
+ /**
14655
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
14656
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
14657
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
14658
+ * a window that is not full yet, neither filter given). See
14659
+ * {@link NcAudioCondition}.
14660
+ *
14661
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
14662
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
14663
+ * a detection, a track or a device event (the same fail-closed pairing
14664
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
14665
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
14666
+ * (an `immediate` rule naming an `audio-*` class, one notification per
14667
+ * classified sample) stays exactly as it was for rules that already use it.
14668
+ *
14669
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
14670
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
14671
+ * (`camstack/src/data/notification-center.ts`, guarded by
14672
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
14673
+ * condition fields it does not know when a rule is saved from the phone.
14674
+ * Publishing an editor for a condition the app cannot round-trip is how an
14675
+ * operator loses a rule's conditions by opening it — so the descriptor, the
14676
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
14677
+ * does an audio rule become authorable.
14678
+ */
14679
+ audio: NcAudioConditionSchema.optional()
14544
14680
  });
14545
14681
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
14546
14682
  var NcRuleTargetSchema = object({
@@ -14654,6 +14790,73 @@ var NcThrottleSchema = object({
14654
14790
  */
14655
14791
  granularity: NcThrottleGranularitySchema.optional()
14656
14792
  });
14793
+ /**
14794
+ * How long the confirm gate may hold ONE notification, and how big the picture
14795
+ * it judges may be.
14796
+ *
14797
+ * The clamp is the product decision, not a coincidence of the model: p50 was
14798
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
14799
+ * arrives after the visitor has gone is not a notification. 448 px was enough
14800
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
14801
+ * tokens for pixels the model pools away.
14802
+ */
14803
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
14804
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
14805
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
14806
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
14807
+ var NcConfirmExpectSchema = object({
14808
+ op: _enum([
14809
+ ">=",
14810
+ ">",
14811
+ "<=",
14812
+ "<",
14813
+ "=="
14814
+ ]),
14815
+ count: number().int().min(0).max(1e3)
14816
+ });
14817
+ /**
14818
+ * AI CONFIRM — a vision model looks at the picture this notification is about
14819
+ * to ship and says whether it agrees with the rule.
14820
+ *
14821
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
14822
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
14823
+ * on the operator's phone is not a verdict about this notification.
14824
+ *
14825
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
14826
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
14827
+ * the default and every fail-open is COUNTED, because a gate that always fails
14828
+ * open looks in the log exactly like a gate that works.
14829
+ *
14830
+ * Every field is `.optional()` rather than relied on as a Zod default at the
14831
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
14832
+ * production failures in one day), so the gate reads absent as the constant
14833
+ * above rather than trusting a parse it may never have seen.
14834
+ */
14835
+ var NcConfirmSchema = object({
14836
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
14837
+ * same thing, and both mean "deliver exactly as before". */
14838
+ enabled: boolean().default(false),
14839
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
14840
+ profileId: string().optional(),
14841
+ /**
14842
+ * The operator's question, in his own words. Absent = a question derived
14843
+ * from the rule (its class and its expectation).
14844
+ *
14845
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
14846
+ * banners, signage and plates as instructions if you let them reach the
14847
+ * prompt — proven live — so the authoritative contract stays in the system
14848
+ * turn and only rule-authored words land here.
14849
+ */
14850
+ prompt: string().max(1e3).optional(),
14851
+ /** Fire only when the model's count satisfies this. Absent = the model's
14852
+ * own boolean verdict decides. */
14853
+ expect: NcConfirmExpectSchema.optional(),
14854
+ timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
14855
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
14856
+ onTimeout: _enum(["fire", "suppress"]).default("fire"),
14857
+ /** Longest edge the judged image is downscaled to before it is sent. */
14858
+ maxImagePx: number().int().min(64).max(2048).default(448)
14859
+ });
14657
14860
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
14658
14861
  var NcRuleInputSchema = object({
14659
14862
  name: string().min(1).max(200),
@@ -14714,7 +14917,13 @@ var NcRuleInputSchema = object({
14714
14917
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
14715
14918
  * shape as every other actuation.
14716
14919
  */
14717
- actions: NcRuleActionsSchema.optional()
14920
+ actions: NcRuleActionsSchema.optional(),
14921
+ /**
14922
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
14923
+ * a rule that predates the gate must keep delivering byte-for-byte as it
14924
+ * did, and absent is the only way to say that without a migration.
14925
+ */
14926
+ confirm: NcConfirmSchema.optional()
14718
14927
  });
14719
14928
  /**
14720
14929
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -14725,7 +14934,37 @@ var NcRuleInputSchema = object({
14725
14934
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
14726
14935
  * `updateRule` patch.
14727
14936
  */
14728
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
14937
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
14938
+ disabledTargetIds: array(string()).optional(),
14939
+ /**
14940
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
14941
+ *
14942
+ * It makes the key optional to SUPPLY; the parse still materialises the
14943
+ * default when the key is absent. And `NcRuleStore.update` merges with
14944
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
14945
+ * one — which made every partial edit destructive:
14946
+ *
14947
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
14948
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
14949
+ * setEnabled(ruleId, false) → conditions reset to `{}`
14950
+ *
14951
+ * A rule scoped to one camera and one zone silently became a rule that
14952
+ * matches EVERY event on EVERY camera, and lost its `media` policy
14953
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
14954
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
14955
+ * within a minute of a two-field patch.
14956
+ *
14957
+ * So every defaulted field is re-declared here WITHOUT its default. The
14958
+ * inner defaults still apply when the caller DOES send the key — `{}` for
14959
+ * conditions remains a real instruction ("clear them") — and only the
14960
+ * absent key is now genuinely absent.
14961
+ */
14962
+ enabled: boolean().optional(),
14963
+ conditions: NcConditionsSchema.optional(),
14964
+ media: NcMediaPolicySchema.optional(),
14965
+ throttle: NcThrottleSchema.optional(),
14966
+ priority: number().int().min(1).max(5).optional()
14967
+ });
14729
14968
  /** A persisted rule. */
14730
14969
  var NcRuleSchema = NcRuleInputSchema.extend({
14731
14970
  id: string(),
@@ -15026,6 +15265,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
15026
15265
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
15027
15266
  * copy would lie the first time a rule is disabled.
15028
15267
  */
15268
+ /**
15269
+ * Why a device a mode NAMES is nonetheless not armed by it.
15270
+ *
15271
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
15272
+ * per-camera notification switch the Notification Center already owns,
15273
+ * `detection-off` is the device's own detection binding being inactive, and
15274
+ * `offline` is the device manager's liveness. A fourth reason would mean a
15275
+ * fourth authority, and inventing one here is how a panel starts disagreeing
15276
+ * with the switches the operator actually used.
15277
+ */
15278
+ var NcAlarmSkipReasonSchema = _enum([
15279
+ "muted",
15280
+ "detection-off",
15281
+ "offline"
15282
+ ]);
15283
+ var NcAlarmSkippedDeviceSchema = object({
15284
+ deviceId: number().int(),
15285
+ reason: NcAlarmSkipReasonSchema
15286
+ });
15029
15287
  var NcAlarmModeCoverageSchema = object({
15030
15288
  mode: AlarmArmModeSchema,
15031
15289
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -15033,7 +15291,18 @@ var NcAlarmModeCoverageSchema = object({
15033
15291
  /** At least one covering rule has no device scope, so the mode covers all. */
15034
15292
  allDevices: boolean(),
15035
15293
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
15036
- deviceIds: array(number().int())
15294
+ deviceIds: array(number().int()),
15295
+ /**
15296
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
15297
+ * excludes it.
15298
+ *
15299
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
15300
+ * twelve makes it false in exactly the way nobody notices until an incident.
15301
+ * Defaulted to `[]` so a coverage answer computed before this field existed
15302
+ * still parses as "nothing known to be skipped" rather than failing the whole
15303
+ * alarm tab.
15304
+ */
15305
+ skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
15037
15306
  });
15038
15307
  var NcAlarmConfigSchema = object({
15039
15308
  /**
@@ -24754,7 +25023,19 @@ var RecordingManifestSchema = object({
24754
25023
  * profiles/subtrees/locations on this node). */
24755
25024
  var RecordingDeviceUsageSchema = object({
24756
25025
  deviceId: number(),
24757
- usedBytes: number()
25026
+ usedBytes: number(),
25027
+ /**
25028
+ * Start of this camera's OLDEST indexed segment, across every profile and
25029
+ * location — the "Oldest footage" column in Recordings → Storage, and the
25030
+ * only honest answer to "is retention actually holding?" per camera.
25031
+ *
25032
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
25033
+ * predates this field omits it entirely, and a hub whose types carry the
25034
+ * field must keep validating that older provider's payload: the framework
25035
+ * (types) and the addon ship on different trains, and the addon is usually
25036
+ * the later of the two.
25037
+ */
25038
+ oldestMs: number().nullable().optional()
24758
25039
  });
24759
25040
  /** Recording storage usage + capacity for one storage location. */
24760
25041
  var RecordingLocationUsageSchema = object({
@@ -24782,6 +25063,57 @@ var RecordingStorageUsageSchema = object({
24782
25063
  locations: array(RecordingLocationUsageSchema)
24783
25064
  });
24784
25065
  /**
25066
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
25067
+ *
25068
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
25069
+ * is the operator asking for the EXISTING archive to be brought into line with
25070
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
25071
+ * location, run FIFO behind the single-flight mover.
25072
+ *
25073
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
25074
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
25075
+ * (empty on the plan).
25076
+ */
25077
+ var RecordingRebalanceMoveSchema = object({
25078
+ deviceId: number(),
25079
+ profile: string(),
25080
+ fromLocationId: string(),
25081
+ toLocationId: string(),
25082
+ bytes: number(),
25083
+ files: number().int()
25084
+ });
25085
+ /** Why a pile that is out of place is staying there. Every refusal is
25086
+ * reported: a rebalance that silently drops a camera reads exactly like one
25087
+ * that had nothing to do. */
25088
+ var RecordingRebalanceSkipReasonSchema = _enum([
25089
+ "unassigned",
25090
+ "target-not-writable",
25091
+ "below-threshold",
25092
+ "no-headroom"
25093
+ ]);
25094
+ var RecordingRebalanceSkipSchema = object({
25095
+ deviceId: number(),
25096
+ profile: string(),
25097
+ fromLocationId: string(),
25098
+ /** The location the plan wants; null when the camera has no assignment. */
25099
+ toLocationId: string().nullable(),
25100
+ bytes: number(),
25101
+ reason: RecordingRebalanceSkipReasonSchema
25102
+ });
25103
+ var RecordingRebalancePlanSchema = object({
25104
+ moves: array(RecordingRebalanceMoveSchema),
25105
+ skipped: array(RecordingRebalanceSkipSchema),
25106
+ bytesToMove: number(),
25107
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
25108
+ jobIds: array(string())
25109
+ });
25110
+ var RecordingRebalanceInputSchema = object({
25111
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
25112
+ throttleMbps: number().min(1).max(1e3).optional(),
25113
+ /** Ignore piles smaller than this (default 1 GB). */
25114
+ minMoveGb: number().min(0).optional()
25115
+ });
25116
+ /**
24785
25117
  * Result of locating footage at a wall-clock instant for one device/profile.
24786
25118
  * `segment` carries the covering segment's window; `gap` reports the forward
24787
25119
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -24944,9 +25276,24 @@ method(object({
24944
25276
  }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
24945
25277
  kind: "mutation",
24946
25278
  auth: "admin"
25279
+ }), method(RelocateFootageInputSchema, object({ jobId: string() }), {
25280
+ kind: "mutation",
25281
+ auth: "admin"
25282
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
25283
+ kind: "query",
25284
+ auth: "admin"
25285
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
25286
+ kind: "mutation",
25287
+ auth: "admin"
25288
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25289
+ kind: "query",
25290
+ auth: "admin"
25291
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25292
+ kind: "mutation",
25293
+ auth: "admin"
24947
25294
  });
24948
25295
  /**
24949
- * `recordingExport` cap — render a footage time range into a single downloadable
25296
+ * `recording-export` cap — render a footage time range into a single downloadable
24950
25297
  * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
24951
25298
  * bounded lifetime with a durable history, auto-expiry, and optional
24952
25299
  * delete-after-download.
@@ -31783,6 +32130,12 @@ Object.freeze({
31783
32130
  addonId: null,
31784
32131
  access: "create"
31785
32132
  },
32133
+ "recording.cancelRelocateJob": {
32134
+ capName: "recording",
32135
+ capScope: "system",
32136
+ addonId: null,
32137
+ access: "create"
32138
+ },
31786
32139
  "recording.cancelStorageMigrationMove": {
31787
32140
  capName: "recording",
31788
32141
  capScope: "system",
@@ -31837,6 +32190,12 @@ Object.freeze({
31837
32190
  addonId: null,
31838
32191
  access: "view"
31839
32192
  },
32193
+ "recording.listRelocateJobs": {
32194
+ capName: "recording",
32195
+ capScope: "system",
32196
+ addonId: null,
32197
+ access: "view"
32198
+ },
31840
32199
  "recording.locateSegment": {
31841
32200
  capName: "recording",
31842
32201
  capScope: "system",
@@ -31849,6 +32208,12 @@ Object.freeze({
31849
32208
  addonId: null,
31850
32209
  access: "create"
31851
32210
  },
32211
+ "recording.planStorageRebalance": {
32212
+ capName: "recording",
32213
+ capScope: "system",
32214
+ addonId: null,
32215
+ access: "view"
32216
+ },
31852
32217
  "recording.pruneFootage": {
31853
32218
  capName: "recording",
31854
32219
  capScope: "system",
@@ -31873,6 +32238,12 @@ Object.freeze({
31873
32238
  addonId: null,
31874
32239
  access: "create"
31875
32240
  },
32241
+ "recording.relocateFootage": {
32242
+ capName: "recording",
32243
+ capScope: "system",
32244
+ addonId: null,
32245
+ access: "create"
32246
+ },
31876
32247
  "recording.renderClip": {
31877
32248
  capName: "recording",
31878
32249
  capScope: "system",
@@ -31909,44 +32280,50 @@ Object.freeze({
31909
32280
  addonId: null,
31910
32281
  access: "create"
31911
32282
  },
32283
+ "recording.startStorageRebalance": {
32284
+ capName: "recording",
32285
+ capScope: "system",
32286
+ addonId: null,
32287
+ access: "create"
32288
+ },
31912
32289
  "recordingExport.cancelExport": {
31913
- capName: "recordingExport",
32290
+ capName: "recording-export",
31914
32291
  capScope: "system",
31915
32292
  addonId: null,
31916
32293
  access: "create"
31917
32294
  },
31918
32295
  "recordingExport.createExport": {
31919
- capName: "recordingExport",
32296
+ capName: "recording-export",
31920
32297
  capScope: "system",
31921
32298
  addonId: null,
31922
32299
  access: "create"
31923
32300
  },
31924
32301
  "recordingExport.deleteExport": {
31925
- capName: "recordingExport",
32302
+ capName: "recording-export",
31926
32303
  capScope: "system",
31927
32304
  addonId: null,
31928
32305
  access: "delete"
31929
32306
  },
31930
32307
  "recordingExport.getDownloadUrl": {
31931
- capName: "recordingExport",
32308
+ capName: "recording-export",
31932
32309
  capScope: "system",
31933
32310
  addonId: null,
31934
32311
  access: "view"
31935
32312
  },
31936
32313
  "recordingExport.getExport": {
31937
- capName: "recordingExport",
32314
+ capName: "recording-export",
31938
32315
  capScope: "system",
31939
32316
  addonId: null,
31940
32317
  access: "view"
31941
32318
  },
31942
32319
  "recordingExport.listExports": {
31943
- capName: "recordingExport",
32320
+ capName: "recording-export",
31944
32321
  capScope: "system",
31945
32322
  addonId: null,
31946
32323
  access: "view"
31947
32324
  },
31948
32325
  "recordingExport.readExportBytes": {
31949
- capName: "recordingExport",
32326
+ capName: "recording-export",
31950
32327
  capScope: "system",
31951
32328
  addonId: null,
31952
32329
  access: "view"
@@ -33323,6 +33700,104 @@ var FramerateField = number().int().min(1).max(60);
33323
33700
  var TargetsField = array(NcRuleTargetSchema).min(1);
33324
33701
  var PriorityField = number().int().min(1).max(5);
33325
33702
  /**
33703
+ * Explicit override of the DENSE sampling cadence, seconds.
33704
+ *
33705
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
33706
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
33707
+ * made that same base 3 s and rendered a person pass as two frames.)
33708
+ *
33709
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
33710
+ * `denseCadenceSec` and played at `framerate` occupies
33711
+ *
33712
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
33713
+ *
33714
+ * 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.
33715
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
33716
+ * and therefore the length of a quiet night, does not move.
33717
+ *
33718
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
33719
+ * the recording has them returns the same frames, requested twice. Must be
33720
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
33721
+ * a uniform video the operator believes is two-rate — and upsert refuses it
33722
+ * rather than letting the export cap reject the render hours after the window.
33723
+ */
33724
+ var DenseCadenceSecField = number().min(.1).max(3600);
33725
+ /**
33726
+ * Minimum seconds of OUTPUT video each detection range must occupy.
33727
+ *
33728
+ * The operator-facing form of the arithmetic above: instead of solving for a
33729
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
33730
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
33731
+ * that range every ~583 ms.
33732
+ *
33733
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
33734
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
33735
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
33736
+ * ranges are sampled denser than they need. Per-range cadences require a cap
33737
+ * schema change and are the tracked follow-up.
33738
+ *
33739
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
33740
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
33741
+ * by real footage, never met by duplicating frames into motion that never
33742
+ * happened.
33743
+ */
33744
+ var MinDwellSecField = number().min(0).max(60);
33745
+ /**
33746
+ * Caption burned into the notification's preview frame.
33747
+ *
33748
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
33749
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
33750
+ * templating dialect for one field would be a second thing to explain.
33751
+ *
33752
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
33753
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
33754
+ * the reason this is not `.min(1)`.
33755
+ */
33756
+ var PreviewTextField = string().max(200);
33757
+ /**
33758
+ * Whether the notification's preview is a STILL or a short animation.
33759
+ *
33760
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
33761
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
33762
+ * night reads better as three seconds of motion than as one frame of it. Both
33763
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
33764
+ * simply applies it to a dozen frames sampled across the render and assembles
33765
+ * them.
33766
+ *
33767
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
33768
+ * seeks and a palette pass, and no rule that never asked for one should start
33769
+ * paying that on the deploy that shipped it.
33770
+ *
33771
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
33772
+ */
33773
+ var PreviewModeField = _enum(["image", "gif"]);
33774
+ /**
33775
+ * Which detection classes the notification reports counts for.
33776
+ *
33777
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
33778
+ * plan — no second query — aggregated per class. Absent or empty means "every
33779
+ * class the window actually contained", which is what an operator who never
33780
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
33781
+ * counts cars all night).
33782
+ *
33783
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
33784
+ * …). An unknown name simply never matches and reports nothing — it is not an
33785
+ * error, because a rule may legitimately name a class this camera's model does
33786
+ * not emit.
33787
+ *
33788
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
33789
+ * - `{{detections}}` — total over the reported classes
33790
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
33791
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
33792
+ * one per class, `count_` + the class name
33793
+ *
33794
+ * With NO custom body template the summary is appended to the derived body, and
33795
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
33796
+ * reads. With a custom template the operator owns every word — nothing is
33797
+ * appended, so `{{detectionSummary}}` is how he asks for it.
33798
+ */
33799
+ var ReportClassesField = array(string().min(1).max(40)).max(20);
33800
+ /**
33326
33801
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
33327
33802
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
33328
33803
  * here (see the ownership note above).
@@ -33342,9 +33817,30 @@ var TimelapseRuleInputSchema = object({
33342
33817
  cadenceSec: CadenceSecField.default(15),
33343
33818
  /** Output frames per second of the assembled mp4 (predecessor parity). */
33344
33819
  framerate: FramerateField.default(10),
33820
+ /**
33821
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
33822
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
33823
+ * field gets.
33824
+ */
33825
+ denseCadenceSec: DenseCadenceSecField.optional(),
33826
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
33827
+ minDwellSec: MinDwellSecField.optional(),
33345
33828
  /** `notification-output` targets the finished video/thumbnail is sent to. */
33346
33829
  targets: TargetsField,
33347
33830
  template: TimelapseTemplateSchema.optional(),
33831
+ /**
33832
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
33833
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
33834
+ *
33835
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
33836
+ * the notification's title/body, and clearing it (`template: null`) must not
33837
+ * silently clear the caption too.
33838
+ */
33839
+ previewText: PreviewTextField.optional(),
33840
+ /** Still or animation — see {@link PreviewModeField}. */
33841
+ previewMode: PreviewModeField.default("image"),
33842
+ /** Classes the notification counts — see {@link ReportClassesField}. */
33843
+ reportClasses: ReportClassesField.optional(),
33348
33844
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
33349
33845
  priority: PriorityField.default(3)
33350
33846
  });
@@ -33355,8 +33851,13 @@ object({
33355
33851
  schedule: NcScheduleSchema.optional(),
33356
33852
  cadenceSec: CadenceSecField.optional(),
33357
33853
  framerate: FramerateField.optional(),
33854
+ denseCadenceSec: DenseCadenceSecField.optional(),
33855
+ minDwellSec: MinDwellSecField.optional(),
33358
33856
  targets: TargetsField.optional(),
33359
33857
  template: TimelapseTemplateSchema.nullable().optional(),
33858
+ previewText: PreviewTextField.optional(),
33859
+ previewMode: PreviewModeField.optional(),
33860
+ reportClasses: ReportClassesField.optional(),
33360
33861
  priority: PriorityField.optional()
33361
33862
  });
33362
33863
  TimelapseRuleInputSchema.extend({