@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.mjs CHANGED
@@ -7656,7 +7656,15 @@ var RecordingConfigSchema = object({
7656
7656
  * Each completed/failed run also lands one durable ops-log row on its owning
7657
7657
  * addon surface.
7658
7658
  */
7659
+ /**
7660
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
7661
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
7662
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
7663
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
7664
+ * runs at all.
7665
+ */
7659
7666
  var RelocateJobStateSchema = _enum([
7667
+ "queued",
7660
7668
  "running",
7661
7669
  "done",
7662
7670
  "failed",
@@ -7691,6 +7699,15 @@ var RelocateFootageInputSchema = object({
7691
7699
  /** Limits relocation to the logical profile class. Omit only for the
7692
7700
  * pre-orchestration compatibility path. */
7693
7701
  footageClass: RelocateFootageClassSchema.optional(),
7702
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
7703
+ * is what a whole-disk drain means. The rebalance path always sets it: its
7704
+ * unit is a (camera, profile) pile, not a disk. */
7705
+ deviceId: number().int().optional(),
7706
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
7707
+ * Finer than `footageClass`, which cannot separate high from mid — and the
7708
+ * placement plan assigns those two independently, so a rebalance that could
7709
+ * only say "recordings" would move footage the plan never asked to move. */
7710
+ profiles: array(string()).optional(),
7694
7711
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7695
7712
  * never allowed to starve live writers. */
7696
7713
  throttleMbps: number().min(1).max(1e3).optional()
@@ -7826,6 +7843,21 @@ var StorageLocationSchema = object({
7826
7843
  nodeId: string().optional(),
7827
7844
  isDefault: boolean().default(false),
7828
7845
  isSystem: boolean().default(false),
7846
+ /**
7847
+ * Operator opt-in: whether consumers that BALANCE across several locations
7848
+ * of a type may write here. Recordings reads it today; event media and
7849
+ * backups are the next consumers, which is why the flag lives on the
7850
+ * location rather than in any one addon's store — nothing has to be
7851
+ * extended to add the next consumer.
7852
+ *
7853
+ * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
7854
+ * flag existed reads back with no flag and keeps working exactly as before;
7855
+ * that is the whole compat story, and it is why no migration ships with it.
7856
+ * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
7857
+ * disk must not silently start writing to it); the default of a type is
7858
+ * always stamped `true`.
7859
+ */
7860
+ enabled: boolean().optional(),
7829
7861
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
7830
7862
  * for node-local locations it can reach) — never persisted, absent when the
7831
7863
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -12323,7 +12355,8 @@ method(object({
12323
12355
  }), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
12324
12356
  /**
12325
12357
  * filesystem-browse — per-node capability for browsing the node's local
12326
- * filesystem, sandboxed to operator-configured allowed roots. Used by the
12358
+ * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
12359
+ * are sandboxed to operator-configured allowed roots (D115). Used by the
12327
12360
  * admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
12328
12361
  * (one provider per node); the hub calls it with `{nodeId}` so the codegen
12329
12362
  * routes to that exact node (default `nodeIdMode:'routing'`).
@@ -14164,6 +14197,13 @@ var MaskGridDimsSchema = object({
14164
14197
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
14165
14198
  * this one field keeps the schema additive — a rule still declares exactly
14166
14199
  * one trigger.
14200
+ *
14201
+ * AUDIO rules add no member here, for the reason occupancy added none: the
14202
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
14203
+ * mirror.ts` fails the build on a member the app cannot render) and every
14204
+ * member costs a release train. A sustained-sound rule is therefore an
14205
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
14206
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
14167
14207
  */
14168
14208
  var NcDeliverySchema = _enum([
14169
14209
  "immediate",
@@ -14178,15 +14218,32 @@ var NcDeliverySchema = _enum([
14178
14218
  * depend on a provider's raw event name or payload shape.
14179
14219
  */
14180
14220
  var NcSystemEventKindSchema = _enum([
14181
- "camera-online",
14182
- "camera-offline",
14221
+ "device-online",
14222
+ "device-offline",
14223
+ "device-disabled",
14224
+ "device-enabled",
14183
14225
  "stream-online",
14184
14226
  "stream-offline",
14185
14227
  "node-online",
14186
14228
  "node-offline",
14187
14229
  "addon-update-available",
14188
- "server-update-available"
14230
+ "server-update-available",
14231
+ "alarm-triggered",
14232
+ "alarm-armed",
14233
+ "alarm-disarmed",
14234
+ "camera-online",
14235
+ "camera-offline",
14236
+ "camera-disabled",
14237
+ "camera-enabled"
14238
+ ]);
14239
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
14240
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
14241
+ "camera-online",
14242
+ "camera-offline",
14243
+ "camera-disabled",
14244
+ "camera-enabled"
14189
14245
  ]);
14246
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
14190
14247
  /**
14191
14248
  * One coherent system-event condition. `kinds` is the required opt-in safety
14192
14249
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -14195,6 +14252,18 @@ var NcSystemEventKindSchema = _enum([
14195
14252
  var NcSystemEventConditionSchema = object({
14196
14253
  kinds: array(NcSystemEventKindSchema).min(1),
14197
14254
  deviceIds: array(number().int()).min(1).optional(),
14255
+ /**
14256
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
14257
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
14258
+ * is what a liveness rule means when nobody said otherwise.
14259
+ *
14260
+ * This is where "only my cameras" is expressed, and it lives on the rule for
14261
+ * one reason: the intake cannot know which devices this household cares
14262
+ * about, and a producer-side filter is one no operator can change. Fails
14263
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
14264
+ * does not carry) matches no `deviceTypes` list.
14265
+ */
14266
+ deviceTypes: array(string().min(1)).min(1).optional(),
14198
14267
  nodeIds: array(string().min(1)).min(1).optional(),
14199
14268
  packageNames: array(string().min(1)).min(1).optional()
14200
14269
  });
@@ -14245,6 +14314,47 @@ var NcOccupancyConditionSchema = object({
14245
14314
  sustainSeconds: number().int().min(0).max(3600).default(15)
14246
14315
  });
14247
14316
  /**
14317
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
14318
+ *
14319
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
14320
+ * reference notifier uses, so an operator moving between them re-uses what
14321
+ * they already know): a rule matches when, over a sampling window of
14322
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14323
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14324
+ *
14325
+ * - `dbThreshold` — its level is at or above this many dBFS (see
14326
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14327
+ * - `labels` — the classifier put at least one of these labels on it.
14328
+ *
14329
+ * Both are OPTIONAL and independent, which is the point of the shape: a
14330
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
14331
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14332
+ * is given** — a window in which every sample is trivially a hit would fire on
14333
+ * silence, so the engine refuses such a condition rather than notifying on
14334
+ * nothing (the schema cannot express "at least one of" without becoming a
14335
+ * ZodEffects the cap path would have to special-case).
14336
+ *
14337
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
14338
+ * must be FULL before it can match — a window that has been open for two
14339
+ * seconds of its ten is 100% of nothing, and firing on it would make
14340
+ * `samplingSeconds` decorative.
14341
+ *
14342
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
14343
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
14344
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
14345
+ * an operator who typed `dog` mean the same thing.
14346
+ */
14347
+ var NcAudioConditionSchema = object({
14348
+ /** Audio macro labels; absent = any sound (level-only rule). */
14349
+ labels: array(string().min(1)).min(1).optional(),
14350
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
14351
+ dbThreshold: number().min(-96).max(0).optional(),
14352
+ /** Percentage of the window's samples that must be hits (1–100). */
14353
+ hitPercent: number().int().min(1).max(100).default(60),
14354
+ /** Length of the sampling window in seconds. */
14355
+ samplingSeconds: number().int().min(1).max(300).default(10)
14356
+ });
14357
+ /**
14248
14358
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
14249
14359
  *
14250
14360
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -14517,7 +14627,33 @@ var NcConditionsSchema = object({
14517
14627
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
14518
14628
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
14519
14629
  */
14520
- occupancy: NcOccupancyConditionSchema.optional()
14630
+ occupancy: NcOccupancyConditionSchema.optional(),
14631
+ /**
14632
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
14633
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
14634
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
14635
+ * a window that is not full yet, neither filter given). See
14636
+ * {@link NcAudioCondition}.
14637
+ *
14638
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
14639
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
14640
+ * a detection, a track or a device event (the same fail-closed pairing
14641
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
14642
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
14643
+ * (an `immediate` rule naming an `audio-*` class, one notification per
14644
+ * classified sample) stays exactly as it was for rules that already use it.
14645
+ *
14646
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
14647
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
14648
+ * (`camstack/src/data/notification-center.ts`, guarded by
14649
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
14650
+ * condition fields it does not know when a rule is saved from the phone.
14651
+ * Publishing an editor for a condition the app cannot round-trip is how an
14652
+ * operator loses a rule's conditions by opening it — so the descriptor, the
14653
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
14654
+ * does an audio rule become authorable.
14655
+ */
14656
+ audio: NcAudioConditionSchema.optional()
14521
14657
  });
14522
14658
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
14523
14659
  var NcRuleTargetSchema = object({
@@ -14631,6 +14767,73 @@ var NcThrottleSchema = object({
14631
14767
  */
14632
14768
  granularity: NcThrottleGranularitySchema.optional()
14633
14769
  });
14770
+ /**
14771
+ * How long the confirm gate may hold ONE notification, and how big the picture
14772
+ * it judges may be.
14773
+ *
14774
+ * The clamp is the product decision, not a coincidence of the model: p50 was
14775
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
14776
+ * arrives after the visitor has gone is not a notification. 448 px was enough
14777
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
14778
+ * tokens for pixels the model pools away.
14779
+ */
14780
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
14781
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
14782
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
14783
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
14784
+ var NcConfirmExpectSchema = object({
14785
+ op: _enum([
14786
+ ">=",
14787
+ ">",
14788
+ "<=",
14789
+ "<",
14790
+ "=="
14791
+ ]),
14792
+ count: number().int().min(0).max(1e3)
14793
+ });
14794
+ /**
14795
+ * AI CONFIRM — a vision model looks at the picture this notification is about
14796
+ * to ship and says whether it agrees with the rule.
14797
+ *
14798
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
14799
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
14800
+ * on the operator's phone is not a verdict about this notification.
14801
+ *
14802
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
14803
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
14804
+ * the default and every fail-open is COUNTED, because a gate that always fails
14805
+ * open looks in the log exactly like a gate that works.
14806
+ *
14807
+ * Every field is `.optional()` rather than relied on as a Zod default at the
14808
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
14809
+ * production failures in one day), so the gate reads absent as the constant
14810
+ * above rather than trusting a parse it may never have seen.
14811
+ */
14812
+ var NcConfirmSchema = object({
14813
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
14814
+ * same thing, and both mean "deliver exactly as before". */
14815
+ enabled: boolean().default(false),
14816
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
14817
+ profileId: string().optional(),
14818
+ /**
14819
+ * The operator's question, in his own words. Absent = a question derived
14820
+ * from the rule (its class and its expectation).
14821
+ *
14822
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
14823
+ * banners, signage and plates as instructions if you let them reach the
14824
+ * prompt — proven live — so the authoritative contract stays in the system
14825
+ * turn and only rule-authored words land here.
14826
+ */
14827
+ prompt: string().max(1e3).optional(),
14828
+ /** Fire only when the model's count satisfies this. Absent = the model's
14829
+ * own boolean verdict decides. */
14830
+ expect: NcConfirmExpectSchema.optional(),
14831
+ timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
14832
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
14833
+ onTimeout: _enum(["fire", "suppress"]).default("fire"),
14834
+ /** Longest edge the judged image is downscaled to before it is sent. */
14835
+ maxImagePx: number().int().min(64).max(2048).default(448)
14836
+ });
14634
14837
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
14635
14838
  var NcRuleInputSchema = object({
14636
14839
  name: string().min(1).max(200),
@@ -14691,7 +14894,13 @@ var NcRuleInputSchema = object({
14691
14894
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
14692
14895
  * shape as every other actuation.
14693
14896
  */
14694
- actions: NcRuleActionsSchema.optional()
14897
+ actions: NcRuleActionsSchema.optional(),
14898
+ /**
14899
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
14900
+ * a rule that predates the gate must keep delivering byte-for-byte as it
14901
+ * did, and absent is the only way to say that without a migration.
14902
+ */
14903
+ confirm: NcConfirmSchema.optional()
14695
14904
  });
14696
14905
  /**
14697
14906
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -14702,7 +14911,37 @@ var NcRuleInputSchema = object({
14702
14911
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
14703
14912
  * `updateRule` patch.
14704
14913
  */
14705
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
14914
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
14915
+ disabledTargetIds: array(string()).optional(),
14916
+ /**
14917
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
14918
+ *
14919
+ * It makes the key optional to SUPPLY; the parse still materialises the
14920
+ * default when the key is absent. And `NcRuleStore.update` merges with
14921
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
14922
+ * one — which made every partial edit destructive:
14923
+ *
14924
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
14925
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
14926
+ * setEnabled(ruleId, false) → conditions reset to `{}`
14927
+ *
14928
+ * A rule scoped to one camera and one zone silently became a rule that
14929
+ * matches EVERY event on EVERY camera, and lost its `media` policy
14930
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
14931
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
14932
+ * within a minute of a two-field patch.
14933
+ *
14934
+ * So every defaulted field is re-declared here WITHOUT its default. The
14935
+ * inner defaults still apply when the caller DOES send the key — `{}` for
14936
+ * conditions remains a real instruction ("clear them") — and only the
14937
+ * absent key is now genuinely absent.
14938
+ */
14939
+ enabled: boolean().optional(),
14940
+ conditions: NcConditionsSchema.optional(),
14941
+ media: NcMediaPolicySchema.optional(),
14942
+ throttle: NcThrottleSchema.optional(),
14943
+ priority: number().int().min(1).max(5).optional()
14944
+ });
14706
14945
  /** A persisted rule. */
14707
14946
  var NcRuleSchema = NcRuleInputSchema.extend({
14708
14947
  id: string(),
@@ -15003,6 +15242,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
15003
15242
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
15004
15243
  * copy would lie the first time a rule is disabled.
15005
15244
  */
15245
+ /**
15246
+ * Why a device a mode NAMES is nonetheless not armed by it.
15247
+ *
15248
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
15249
+ * per-camera notification switch the Notification Center already owns,
15250
+ * `detection-off` is the device's own detection binding being inactive, and
15251
+ * `offline` is the device manager's liveness. A fourth reason would mean a
15252
+ * fourth authority, and inventing one here is how a panel starts disagreeing
15253
+ * with the switches the operator actually used.
15254
+ */
15255
+ var NcAlarmSkipReasonSchema = _enum([
15256
+ "muted",
15257
+ "detection-off",
15258
+ "offline"
15259
+ ]);
15260
+ var NcAlarmSkippedDeviceSchema = object({
15261
+ deviceId: number().int(),
15262
+ reason: NcAlarmSkipReasonSchema
15263
+ });
15006
15264
  var NcAlarmModeCoverageSchema = object({
15007
15265
  mode: AlarmArmModeSchema,
15008
15266
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -15010,7 +15268,18 @@ var NcAlarmModeCoverageSchema = object({
15010
15268
  /** At least one covering rule has no device scope, so the mode covers all. */
15011
15269
  allDevices: boolean(),
15012
15270
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
15013
- deviceIds: array(number().int())
15271
+ deviceIds: array(number().int()),
15272
+ /**
15273
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
15274
+ * excludes it.
15275
+ *
15276
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
15277
+ * twelve makes it false in exactly the way nobody notices until an incident.
15278
+ * Defaulted to `[]` so a coverage answer computed before this field existed
15279
+ * still parses as "nothing known to be skipped" rather than failing the whole
15280
+ * alarm tab.
15281
+ */
15282
+ skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
15014
15283
  });
15015
15284
  var NcAlarmConfigSchema = object({
15016
15285
  /**
@@ -24731,7 +25000,19 @@ var RecordingManifestSchema = object({
24731
25000
  * profiles/subtrees/locations on this node). */
24732
25001
  var RecordingDeviceUsageSchema = object({
24733
25002
  deviceId: number(),
24734
- usedBytes: number()
25003
+ usedBytes: number(),
25004
+ /**
25005
+ * Start of this camera's OLDEST indexed segment, across every profile and
25006
+ * location — the "Oldest footage" column in Recordings → Storage, and the
25007
+ * only honest answer to "is retention actually holding?" per camera.
25008
+ *
25009
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
25010
+ * predates this field omits it entirely, and a hub whose types carry the
25011
+ * field must keep validating that older provider's payload: the framework
25012
+ * (types) and the addon ship on different trains, and the addon is usually
25013
+ * the later of the two.
25014
+ */
25015
+ oldestMs: number().nullable().optional()
24735
25016
  });
24736
25017
  /** Recording storage usage + capacity for one storage location. */
24737
25018
  var RecordingLocationUsageSchema = object({
@@ -24759,6 +25040,57 @@ var RecordingStorageUsageSchema = object({
24759
25040
  locations: array(RecordingLocationUsageSchema)
24760
25041
  });
24761
25042
  /**
25043
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
25044
+ *
25045
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
25046
+ * is the operator asking for the EXISTING archive to be brought into line with
25047
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
25048
+ * location, run FIFO behind the single-flight mover.
25049
+ *
25050
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
25051
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
25052
+ * (empty on the plan).
25053
+ */
25054
+ var RecordingRebalanceMoveSchema = object({
25055
+ deviceId: number(),
25056
+ profile: string(),
25057
+ fromLocationId: string(),
25058
+ toLocationId: string(),
25059
+ bytes: number(),
25060
+ files: number().int()
25061
+ });
25062
+ /** Why a pile that is out of place is staying there. Every refusal is
25063
+ * reported: a rebalance that silently drops a camera reads exactly like one
25064
+ * that had nothing to do. */
25065
+ var RecordingRebalanceSkipReasonSchema = _enum([
25066
+ "unassigned",
25067
+ "target-not-writable",
25068
+ "below-threshold",
25069
+ "no-headroom"
25070
+ ]);
25071
+ var RecordingRebalanceSkipSchema = object({
25072
+ deviceId: number(),
25073
+ profile: string(),
25074
+ fromLocationId: string(),
25075
+ /** The location the plan wants; null when the camera has no assignment. */
25076
+ toLocationId: string().nullable(),
25077
+ bytes: number(),
25078
+ reason: RecordingRebalanceSkipReasonSchema
25079
+ });
25080
+ var RecordingRebalancePlanSchema = object({
25081
+ moves: array(RecordingRebalanceMoveSchema),
25082
+ skipped: array(RecordingRebalanceSkipSchema),
25083
+ bytesToMove: number(),
25084
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
25085
+ jobIds: array(string())
25086
+ });
25087
+ var RecordingRebalanceInputSchema = object({
25088
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
25089
+ throttleMbps: number().min(1).max(1e3).optional(),
25090
+ /** Ignore piles smaller than this (default 1 GB). */
25091
+ minMoveGb: number().min(0).optional()
25092
+ });
25093
+ /**
24762
25094
  * Result of locating footage at a wall-clock instant for one device/profile.
24763
25095
  * `segment` carries the covering segment's window; `gap` reports the forward
24764
25096
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -24921,9 +25253,24 @@ method(object({
24921
25253
  }), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
24922
25254
  kind: "mutation",
24923
25255
  auth: "admin"
25256
+ }), method(RelocateFootageInputSchema, object({ jobId: string() }), {
25257
+ kind: "mutation",
25258
+ auth: "admin"
25259
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
25260
+ kind: "query",
25261
+ auth: "admin"
25262
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
25263
+ kind: "mutation",
25264
+ auth: "admin"
25265
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25266
+ kind: "query",
25267
+ auth: "admin"
25268
+ }), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25269
+ kind: "mutation",
25270
+ auth: "admin"
24924
25271
  });
24925
25272
  /**
24926
- * `recordingExport` cap — render a footage time range into a single downloadable
25273
+ * `recording-export` cap — render a footage time range into a single downloadable
24927
25274
  * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
24928
25275
  * bounded lifetime with a durable history, auto-expiry, and optional
24929
25276
  * delete-after-download.
@@ -31760,6 +32107,12 @@ Object.freeze({
31760
32107
  addonId: null,
31761
32108
  access: "create"
31762
32109
  },
32110
+ "recording.cancelRelocateJob": {
32111
+ capName: "recording",
32112
+ capScope: "system",
32113
+ addonId: null,
32114
+ access: "create"
32115
+ },
31763
32116
  "recording.cancelStorageMigrationMove": {
31764
32117
  capName: "recording",
31765
32118
  capScope: "system",
@@ -31814,6 +32167,12 @@ Object.freeze({
31814
32167
  addonId: null,
31815
32168
  access: "view"
31816
32169
  },
32170
+ "recording.listRelocateJobs": {
32171
+ capName: "recording",
32172
+ capScope: "system",
32173
+ addonId: null,
32174
+ access: "view"
32175
+ },
31817
32176
  "recording.locateSegment": {
31818
32177
  capName: "recording",
31819
32178
  capScope: "system",
@@ -31826,6 +32185,12 @@ Object.freeze({
31826
32185
  addonId: null,
31827
32186
  access: "create"
31828
32187
  },
32188
+ "recording.planStorageRebalance": {
32189
+ capName: "recording",
32190
+ capScope: "system",
32191
+ addonId: null,
32192
+ access: "view"
32193
+ },
31829
32194
  "recording.pruneFootage": {
31830
32195
  capName: "recording",
31831
32196
  capScope: "system",
@@ -31850,6 +32215,12 @@ Object.freeze({
31850
32215
  addonId: null,
31851
32216
  access: "create"
31852
32217
  },
32218
+ "recording.relocateFootage": {
32219
+ capName: "recording",
32220
+ capScope: "system",
32221
+ addonId: null,
32222
+ access: "create"
32223
+ },
31853
32224
  "recording.renderClip": {
31854
32225
  capName: "recording",
31855
32226
  capScope: "system",
@@ -31886,44 +32257,50 @@ Object.freeze({
31886
32257
  addonId: null,
31887
32258
  access: "create"
31888
32259
  },
32260
+ "recording.startStorageRebalance": {
32261
+ capName: "recording",
32262
+ capScope: "system",
32263
+ addonId: null,
32264
+ access: "create"
32265
+ },
31889
32266
  "recordingExport.cancelExport": {
31890
- capName: "recordingExport",
32267
+ capName: "recording-export",
31891
32268
  capScope: "system",
31892
32269
  addonId: null,
31893
32270
  access: "create"
31894
32271
  },
31895
32272
  "recordingExport.createExport": {
31896
- capName: "recordingExport",
32273
+ capName: "recording-export",
31897
32274
  capScope: "system",
31898
32275
  addonId: null,
31899
32276
  access: "create"
31900
32277
  },
31901
32278
  "recordingExport.deleteExport": {
31902
- capName: "recordingExport",
32279
+ capName: "recording-export",
31903
32280
  capScope: "system",
31904
32281
  addonId: null,
31905
32282
  access: "delete"
31906
32283
  },
31907
32284
  "recordingExport.getDownloadUrl": {
31908
- capName: "recordingExport",
32285
+ capName: "recording-export",
31909
32286
  capScope: "system",
31910
32287
  addonId: null,
31911
32288
  access: "view"
31912
32289
  },
31913
32290
  "recordingExport.getExport": {
31914
- capName: "recordingExport",
32291
+ capName: "recording-export",
31915
32292
  capScope: "system",
31916
32293
  addonId: null,
31917
32294
  access: "view"
31918
32295
  },
31919
32296
  "recordingExport.listExports": {
31920
- capName: "recordingExport",
32297
+ capName: "recording-export",
31921
32298
  capScope: "system",
31922
32299
  addonId: null,
31923
32300
  access: "view"
31924
32301
  },
31925
32302
  "recordingExport.readExportBytes": {
31926
- capName: "recordingExport",
32303
+ capName: "recording-export",
31927
32304
  capScope: "system",
31928
32305
  addonId: null,
31929
32306
  access: "view"
@@ -33300,6 +33677,104 @@ var FramerateField = number().int().min(1).max(60);
33300
33677
  var TargetsField = array(NcRuleTargetSchema).min(1);
33301
33678
  var PriorityField = number().int().min(1).max(5);
33302
33679
  /**
33680
+ * Explicit override of the DENSE sampling cadence, seconds.
33681
+ *
33682
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
33683
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
33684
+ * made that same base 3 s and rendered a person pass as two frames.)
33685
+ *
33686
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
33687
+ * `denseCadenceSec` and played at `framerate` occupies
33688
+ *
33689
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
33690
+ *
33691
+ * 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.
33692
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
33693
+ * and therefore the length of a quiet night, does not move.
33694
+ *
33695
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
33696
+ * the recording has them returns the same frames, requested twice. Must be
33697
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
33698
+ * a uniform video the operator believes is two-rate — and upsert refuses it
33699
+ * rather than letting the export cap reject the render hours after the window.
33700
+ */
33701
+ var DenseCadenceSecField = number().min(.1).max(3600);
33702
+ /**
33703
+ * Minimum seconds of OUTPUT video each detection range must occupy.
33704
+ *
33705
+ * The operator-facing form of the arithmetic above: instead of solving for a
33706
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
33707
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
33708
+ * that range every ~583 ms.
33709
+ *
33710
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
33711
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
33712
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
33713
+ * ranges are sampled denser than they need. Per-range cadences require a cap
33714
+ * schema change and are the tracked follow-up.
33715
+ *
33716
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
33717
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
33718
+ * by real footage, never met by duplicating frames into motion that never
33719
+ * happened.
33720
+ */
33721
+ var MinDwellSecField = number().min(0).max(60);
33722
+ /**
33723
+ * Caption burned into the notification's preview frame.
33724
+ *
33725
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
33726
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
33727
+ * templating dialect for one field would be a second thing to explain.
33728
+ *
33729
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
33730
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
33731
+ * the reason this is not `.min(1)`.
33732
+ */
33733
+ var PreviewTextField = string().max(200);
33734
+ /**
33735
+ * Whether the notification's preview is a STILL or a short animation.
33736
+ *
33737
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
33738
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
33739
+ * night reads better as three seconds of motion than as one frame of it. Both
33740
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
33741
+ * simply applies it to a dozen frames sampled across the render and assembles
33742
+ * them.
33743
+ *
33744
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
33745
+ * seeks and a palette pass, and no rule that never asked for one should start
33746
+ * paying that on the deploy that shipped it.
33747
+ *
33748
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
33749
+ */
33750
+ var PreviewModeField = _enum(["image", "gif"]);
33751
+ /**
33752
+ * Which detection classes the notification reports counts for.
33753
+ *
33754
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
33755
+ * plan — no second query — aggregated per class. Absent or empty means "every
33756
+ * class the window actually contained", which is what an operator who never
33757
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
33758
+ * counts cars all night).
33759
+ *
33760
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
33761
+ * …). An unknown name simply never matches and reports nothing — it is not an
33762
+ * error, because a rule may legitimately name a class this camera's model does
33763
+ * not emit.
33764
+ *
33765
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
33766
+ * - `{{detections}}` — total over the reported classes
33767
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
33768
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
33769
+ * one per class, `count_` + the class name
33770
+ *
33771
+ * With NO custom body template the summary is appended to the derived body, and
33772
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
33773
+ * reads. With a custom template the operator owns every word — nothing is
33774
+ * appended, so `{{detectionSummary}}` is how he asks for it.
33775
+ */
33776
+ var ReportClassesField = array(string().min(1).max(40)).max(20);
33777
+ /**
33303
33778
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
33304
33779
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
33305
33780
  * here (see the ownership note above).
@@ -33319,9 +33794,30 @@ var TimelapseRuleInputSchema = object({
33319
33794
  cadenceSec: CadenceSecField.default(15),
33320
33795
  /** Output frames per second of the assembled mp4 (predecessor parity). */
33321
33796
  framerate: FramerateField.default(10),
33797
+ /**
33798
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
33799
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
33800
+ * field gets.
33801
+ */
33802
+ denseCadenceSec: DenseCadenceSecField.optional(),
33803
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
33804
+ minDwellSec: MinDwellSecField.optional(),
33322
33805
  /** `notification-output` targets the finished video/thumbnail is sent to. */
33323
33806
  targets: TargetsField,
33324
33807
  template: TimelapseTemplateSchema.optional(),
33808
+ /**
33809
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
33810
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
33811
+ *
33812
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
33813
+ * the notification's title/body, and clearing it (`template: null`) must not
33814
+ * silently clear the caption too.
33815
+ */
33816
+ previewText: PreviewTextField.optional(),
33817
+ /** Still or animation — see {@link PreviewModeField}. */
33818
+ previewMode: PreviewModeField.default("image"),
33819
+ /** Classes the notification counts — see {@link ReportClassesField}. */
33820
+ reportClasses: ReportClassesField.optional(),
33325
33821
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
33326
33822
  priority: PriorityField.default(3)
33327
33823
  });
@@ -33332,8 +33828,13 @@ object({
33332
33828
  schedule: NcScheduleSchema.optional(),
33333
33829
  cadenceSec: CadenceSecField.optional(),
33334
33830
  framerate: FramerateField.optional(),
33831
+ denseCadenceSec: DenseCadenceSecField.optional(),
33832
+ minDwellSec: MinDwellSecField.optional(),
33335
33833
  targets: TargetsField.optional(),
33336
33834
  template: TimelapseTemplateSchema.nullable().optional(),
33835
+ previewText: PreviewTextField.optional(),
33836
+ previewMode: PreviewModeField.optional(),
33837
+ reportClasses: ReportClassesField.optional(),
33337
33838
  priority: PriorityField.optional()
33338
33839
  });
33339
33840
  TimelapseRuleInputSchema.extend({