@camstack/addon-osd-manager 0.1.4 → 0.1.6

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.
package/dist/index.mjs CHANGED
@@ -7276,8 +7276,31 @@ var AdoptionJobSchema = object({
7276
7276
  error: string().nullable()
7277
7277
  });
7278
7278
  /**
7279
- * Per-camera FUNCTION SWITCHES — the one coherent on/off surface over the
7280
- * pipeline functions an operator thinks in terms of.
7279
+ * Per-camera FUNCTION SWITCHES.
7280
+ *
7281
+ * ## The aggregate group is being withdrawn — the BADGE is not (D113)
7282
+ *
7283
+ * This file shipped as "the one coherent on/off surface over the pipeline
7284
+ * functions an operator thinks in terms of". The operator's verdict on
7285
+ * 2026-08-12 was that the coherent surface bought complexity and no clarity:
7286
+ * every function already had a settings page of its own, and a second place to
7287
+ * turn it off is a second place to look. Each switch is going back to its own
7288
+ * component's original options — detection to the detection-pipeline wrapper
7289
+ * binding, audio analysis to its own, recording to `RecordingConfig.enabled`
7290
+ * (which was always first-class; the switch was a veneer over
7291
+ * `recording.setDeviceConfig`), notifications to a notification-center
7292
+ * per-device setting, the two camera planes to their own components.
7293
+ *
7294
+ * What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
7295
+ * thing that lets a status surface say DISABLED instead of BROKEN, recomposed
7296
+ * straight from the authorities with no group in the middle. That rule was
7297
+ * never about a control panel.
7298
+ *
7299
+ * Everything else here — {@link CAMERA_SWITCH_CATALOG}, {@link CameraSwitch},
7300
+ * {@link deriveCameraSwitches}, the `pipelineOrchestrator.getCameraSwitches` /
7301
+ * `setCameraSwitch` pair — is a COMPATIBILITY surface for as long as deployed
7302
+ * viewers (v1.0.305) and the admin UI still call it. It is deleted when they
7303
+ * stop; nothing new may be built on it.
7281
7304
  *
7282
7305
  * ## This file adds no state
7283
7306
  *
@@ -7622,14 +7645,21 @@ var RecordingConfigSchema = object({
7622
7645
  /**
7623
7646
  * Entity-relocation job state (storage entity-routing spec, Phase 4).
7624
7647
  *
7625
- * One shape shared by the recorder's `relocateFootage` (segments) and
7626
- * pipeline-analytics' `relocateMedia` (event media blobs) so the admin Data
7627
- * page renders both movers with one component. Jobs are in-RAM (a restart
7628
- * forgets them re-running is safe by construction: copy-if-absent, delete
7629
- * after verify) and each completed/failed run also lands one durable ops-log
7630
- * row on the owning addon's surface.
7648
+ * One shape shared by the recorder and pipeline-analytics internal movers.
7649
+ * The public admin surface is `storage-migration`; child jobs remain in RAM
7650
+ * because copy-if-absent, verify, delete and index/row repoint are resumable.
7651
+ * Each completed/failed run also lands one durable ops-log row on its owning
7652
+ * addon surface.
7653
+ */
7654
+ /**
7655
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
7656
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
7657
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
7658
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
7659
+ * runs at all.
7631
7660
  */
7632
7661
  var RelocateJobStateSchema = _enum([
7662
+ "queued",
7633
7663
  "running",
7634
7664
  "done",
7635
7665
  "failed",
@@ -7654,19 +7684,109 @@ var RelocateJobSchema = object({
7654
7684
  finishedAt: number().nullable(),
7655
7685
  error: string().nullable()
7656
7686
  });
7687
+ /** Profile-derived footage selection used only by the migration coordinator:
7688
+ * `recordings` owns high+mid; `recordingsLow` owns low. */
7689
+ var RelocateFootageClassSchema = _enum(["recordings", "recordingsLow"]);
7657
7690
  var RelocateFootageInputSchema = object({
7658
- deviceId: number().optional(),
7659
7691
  fromLocationId: string(),
7660
7692
  toLocationId: string(),
7661
7693
  entities: array(_enum(["segments"])).optional(),
7694
+ /** Limits relocation to the logical profile class. Omit only for the
7695
+ * pre-orchestration compatibility path. */
7696
+ footageClass: RelocateFootageClassSchema.optional(),
7697
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
7698
+ * is what a whole-disk drain means. The rebalance path always sets it: its
7699
+ * unit is a (camera, profile) pile, not a disk. */
7700
+ deviceId: number().int().optional(),
7701
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
7702
+ * Finer than `footageClass`, which cannot separate high from mid — and the
7703
+ * placement plan assigns those two independently, so a rebalance that could
7704
+ * only say "recordings" would move footage the plan never asked to move. */
7705
+ profiles: array(string()).optional(),
7662
7706
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7663
7707
  * never allowed to starve live writers. */
7664
7708
  throttleMbps: number().min(1).max(1e3).optional()
7665
7709
  });
7666
- var RelocateMediaInputSchema = object({
7667
- deviceId: number().optional(),
7710
+ /** Internal, lease-scoped participant operation. It is intentionally separate
7711
+ * from persistent recording settings: a migration never changes
7712
+ * `RecordingConfig.enabled` or camera wrapper bindings. */
7713
+ var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
7714
+ var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
7715
+ var StorageMigrationMediaMoveInputSchema = object({
7668
7716
  toLocationId: string(),
7669
7717
  throttleMbps: number().min(1).max(1e3).optional()
7718
+ }).extend({ leaseId: string().min(1) });
7719
+ /** The independently selectable logical storage classes. `recordings`
7720
+ * encompasses the high and mid segment profiles; `recordingsLow` is low
7721
+ * segments; `eventMedia` is post-analysis blobs. */
7722
+ var StorageMigrationClassSchema = _enum([
7723
+ "recordings",
7724
+ "recordingsLow",
7725
+ "eventMedia"
7726
+ ]);
7727
+ /** A destination is always an existing, fully-qualified location id. The
7728
+ * migration API intentionally never changes a source location's `basePath`:
7729
+ * callers create a new `<type>:<slug>` location, then select it here. */
7730
+ var StorageMigrationDestinationsSchema = object({
7731
+ recordings: string().min(1).optional(),
7732
+ recordingsLow: string().min(1).optional(),
7733
+ eventMedia: string().min(1).optional()
7734
+ }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
7735
+ /** Shared input for planning and starting an orchestrated storage migration. */
7736
+ var StorageMigrationInputSchema = object({
7737
+ destinations: StorageMigrationDestinationsSchema,
7738
+ throttleMbps: number().min(1).max(1e3).optional()
7739
+ });
7740
+ /** The durable coordinator state machine. The only phase that changes default
7741
+ * locations is `repointing`, after every selected mover has completed and been
7742
+ * verified. */
7743
+ var StorageMigrationPhaseSchema = _enum([
7744
+ "planning",
7745
+ "pausing",
7746
+ "moving",
7747
+ "verifying",
7748
+ "repointing",
7749
+ "refreshing",
7750
+ "resuming",
7751
+ "done",
7752
+ "failed",
7753
+ "cancelled"
7754
+ ]);
7755
+ var StorageMigrationParticipantSchema = _enum([
7756
+ "pipeline",
7757
+ "recorder",
7758
+ "analytics"
7759
+ ]);
7760
+ var StorageMigrationMoveSchema = object({
7761
+ storageClass: StorageMigrationClassSchema,
7762
+ fromLocationId: string(),
7763
+ toLocationId: string(),
7764
+ moverJobId: string().nullable(),
7765
+ state: RelocateJobStateSchema.nullable(),
7766
+ error: string().nullable()
7767
+ });
7768
+ var StorageMigrationJobSchema = object({
7769
+ jobId: string(),
7770
+ phase: StorageMigrationPhaseSchema,
7771
+ destinations: StorageMigrationDestinationsSchema,
7772
+ throttleMbps: number(),
7773
+ moves: array(StorageMigrationMoveSchema),
7774
+ pauseLeaseId: string().nullable(),
7775
+ pausedParticipants: array(StorageMigrationParticipantSchema),
7776
+ repointed: boolean(),
7777
+ cancelRequested: boolean(),
7778
+ startedAt: number(),
7779
+ updatedAt: number(),
7780
+ finishedAt: number().nullable(),
7781
+ error: string().nullable()
7782
+ });
7783
+ var StorageMigrationPlanSchema = object({
7784
+ destinations: StorageMigrationDestinationsSchema,
7785
+ moves: array(object({
7786
+ storageClass: StorageMigrationClassSchema,
7787
+ fromLocationId: string(),
7788
+ toLocationId: string()
7789
+ }))
7670
7790
  });
7671
7791
  /**
7672
7792
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -7718,6 +7838,21 @@ var StorageLocationSchema = object({
7718
7838
  nodeId: string().optional(),
7719
7839
  isDefault: boolean().default(false),
7720
7840
  isSystem: boolean().default(false),
7841
+ /**
7842
+ * Operator opt-in: whether consumers that BALANCE across several locations
7843
+ * of a type may write here. Recordings reads it today; event media and
7844
+ * backups are the next consumers, which is why the flag lives on the
7845
+ * location rather than in any one addon's store — nothing has to be
7846
+ * extended to add the next consumer.
7847
+ *
7848
+ * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
7849
+ * flag existed reads back with no flag and keeps working exactly as before;
7850
+ * that is the whole compat story, and it is why no migration ships with it.
7851
+ * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
7852
+ * disk must not silently start writing to it); the default of a type is
7853
+ * always stamped `true`.
7854
+ */
7855
+ enabled: boolean().optional(),
7721
7856
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
7722
7857
  * for node-local locations it can reach) — never persisted, absent when the
7723
7858
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -13517,7 +13652,8 @@ var embeddingEncoderCapability = {
13517
13652
  };
13518
13653
  /**
13519
13654
  * filesystem-browse — per-node capability for browsing the node's local
13520
- * filesystem, sandboxed to operator-configured allowed roots. Used by the
13655
+ * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13656
+ * are sandboxed to operator-configured allowed roots (D115). Used by the
13521
13657
  * admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
13522
13658
  * (one provider per node); the hub calls it with `{nodeId}` so the codegen
13523
13659
  * routes to that exact node (default `nodeIdMode:'routing'`).
@@ -13538,9 +13674,9 @@ var filesystemBrowseCapability = {
13538
13674
  mode: "singleton",
13539
13675
  internal: true,
13540
13676
  methods: {
13541
- /** The allowed roots browsing is sandboxed to on this node. */
13677
+ /** The roots `createDir` is sandboxed to on this node. Browsing is not confined to them. */
13542
13678
  listAllowedRoots: method(_void(), array(string()).readonly(), { auth: "admin" }),
13543
- /** Immediate subdirectories of `path` (must be within an allowed root) + free/total bytes. */
13679
+ /** Immediate subdirectories of any absolute `path` + free/total bytes. Read-only. */
13544
13680
  browse: method(object({ path: string() }), BrowseResultSchema, { auth: "admin" }),
13545
13681
  /** Create a subdirectory (within an allowed root). Returns its absolute path. */
13546
13682
  createDir: method(object({ path: string() }), object({ path: string() }), {
@@ -15571,6 +15707,13 @@ var MaskGridDimsSchema = object({
15571
15707
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
15572
15708
  * this one field keeps the schema additive — a rule still declares exactly
15573
15709
  * one trigger.
15710
+ *
15711
+ * AUDIO rules add no member here, for the reason occupancy added none: the
15712
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
15713
+ * mirror.ts` fails the build on a member the app cannot render) and every
15714
+ * member costs a release train. A sustained-sound rule is therefore an
15715
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
15716
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
15574
15717
  */
15575
15718
  var NcDeliverySchema = _enum([
15576
15719
  "immediate",
@@ -15585,15 +15728,32 @@ var NcDeliverySchema = _enum([
15585
15728
  * depend on a provider's raw event name or payload shape.
15586
15729
  */
15587
15730
  var NcSystemEventKindSchema = _enum([
15588
- "camera-online",
15589
- "camera-offline",
15731
+ "device-online",
15732
+ "device-offline",
15733
+ "device-disabled",
15734
+ "device-enabled",
15590
15735
  "stream-online",
15591
15736
  "stream-offline",
15592
15737
  "node-online",
15593
15738
  "node-offline",
15594
15739
  "addon-update-available",
15595
- "server-update-available"
15740
+ "server-update-available",
15741
+ "alarm-triggered",
15742
+ "alarm-armed",
15743
+ "alarm-disarmed",
15744
+ "camera-online",
15745
+ "camera-offline",
15746
+ "camera-disabled",
15747
+ "camera-enabled"
15748
+ ]);
15749
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
15750
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
15751
+ "camera-online",
15752
+ "camera-offline",
15753
+ "camera-disabled",
15754
+ "camera-enabled"
15596
15755
  ]);
15756
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
15597
15757
  /**
15598
15758
  * One coherent system-event condition. `kinds` is the required opt-in safety
15599
15759
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -15602,6 +15762,18 @@ var NcSystemEventKindSchema = _enum([
15602
15762
  var NcSystemEventConditionSchema = object({
15603
15763
  kinds: array(NcSystemEventKindSchema).min(1),
15604
15764
  deviceIds: array(number().int()).min(1).optional(),
15765
+ /**
15766
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
15767
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
15768
+ * is what a liveness rule means when nobody said otherwise.
15769
+ *
15770
+ * This is where "only my cameras" is expressed, and it lives on the rule for
15771
+ * one reason: the intake cannot know which devices this household cares
15772
+ * about, and a producer-side filter is one no operator can change. Fails
15773
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
15774
+ * does not carry) matches no `deviceTypes` list.
15775
+ */
15776
+ deviceTypes: array(string().min(1)).min(1).optional(),
15605
15777
  nodeIds: array(string().min(1)).min(1).optional(),
15606
15778
  packageNames: array(string().min(1)).min(1).optional()
15607
15779
  });
@@ -15652,6 +15824,47 @@ var NcOccupancyConditionSchema = object({
15652
15824
  sustainSeconds: number().int().min(0).max(3600).default(15)
15653
15825
  });
15654
15826
  /**
15827
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
15828
+ *
15829
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
15830
+ * reference notifier uses, so an operator moving between them re-uses what
15831
+ * they already know): a rule matches when, over a sampling window of
15832
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
15833
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
15834
+ *
15835
+ * - `dbThreshold` — its level is at or above this many dBFS (see
15836
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
15837
+ * - `labels` — the classifier put at least one of these labels on it.
15838
+ *
15839
+ * Both are OPTIONAL and independent, which is the point of the shape: a
15840
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
15841
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
15842
+ * is given** — a window in which every sample is trivially a hit would fire on
15843
+ * silence, so the engine refuses such a condition rather than notifying on
15844
+ * nothing (the schema cannot express "at least one of" without becoming a
15845
+ * ZodEffects the cap path would have to special-case).
15846
+ *
15847
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
15848
+ * must be FULL before it can match — a window that has been open for two
15849
+ * seconds of its ten is 100% of nothing, and firing on it would make
15850
+ * `samplingSeconds` decorative.
15851
+ *
15852
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
15853
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
15854
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
15855
+ * an operator who typed `dog` mean the same thing.
15856
+ */
15857
+ var NcAudioConditionSchema = object({
15858
+ /** Audio macro labels; absent = any sound (level-only rule). */
15859
+ labels: array(string().min(1)).min(1).optional(),
15860
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
15861
+ dbThreshold: number().min(-96).max(0).optional(),
15862
+ /** Percentage of the window's samples that must be hits (1–100). */
15863
+ hitPercent: number().int().min(1).max(100).default(60),
15864
+ /** Length of the sampling window in seconds. */
15865
+ samplingSeconds: number().int().min(1).max(300).default(10)
15866
+ });
15867
+ /**
15655
15868
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
15656
15869
  *
15657
15870
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -15924,7 +16137,33 @@ var NcConditionsSchema = object({
15924
16137
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
15925
16138
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
15926
16139
  */
15927
- occupancy: NcOccupancyConditionSchema.optional()
16140
+ occupancy: NcOccupancyConditionSchema.optional(),
16141
+ /**
16142
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
16143
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
16144
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
16145
+ * a window that is not full yet, neither filter given). See
16146
+ * {@link NcAudioCondition}.
16147
+ *
16148
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
16149
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
16150
+ * a detection, a track or a device event (the same fail-closed pairing
16151
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
16152
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
16153
+ * (an `immediate` rule naming an `audio-*` class, one notification per
16154
+ * classified sample) stays exactly as it was for rules that already use it.
16155
+ *
16156
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
16157
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
16158
+ * (`camstack/src/data/notification-center.ts`, guarded by
16159
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
16160
+ * condition fields it does not know when a rule is saved from the phone.
16161
+ * Publishing an editor for a condition the app cannot round-trip is how an
16162
+ * operator loses a rule's conditions by opening it — so the descriptor, the
16163
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
16164
+ * does an audio rule become authorable.
16165
+ */
16166
+ audio: NcAudioConditionSchema.optional()
15928
16167
  });
15929
16168
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
15930
16169
  var NcRuleTargetSchema = object({
@@ -16038,6 +16277,73 @@ var NcThrottleSchema = object({
16038
16277
  */
16039
16278
  granularity: NcThrottleGranularitySchema.optional()
16040
16279
  });
16280
+ /**
16281
+ * How long the confirm gate may hold ONE notification, and how big the picture
16282
+ * it judges may be.
16283
+ *
16284
+ * The clamp is the product decision, not a coincidence of the model: p50 was
16285
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
16286
+ * arrives after the visitor has gone is not a notification. 448 px was enough
16287
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
16288
+ * tokens for pixels the model pools away.
16289
+ */
16290
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
16291
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
16292
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
16293
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
16294
+ var NcConfirmExpectSchema = object({
16295
+ op: _enum([
16296
+ ">=",
16297
+ ">",
16298
+ "<=",
16299
+ "<",
16300
+ "=="
16301
+ ]),
16302
+ count: number().int().min(0).max(1e3)
16303
+ });
16304
+ /**
16305
+ * AI CONFIRM — a vision model looks at the picture this notification is about
16306
+ * to ship and says whether it agrees with the rule.
16307
+ *
16308
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
16309
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
16310
+ * on the operator's phone is not a verdict about this notification.
16311
+ *
16312
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
16313
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
16314
+ * the default and every fail-open is COUNTED, because a gate that always fails
16315
+ * open looks in the log exactly like a gate that works.
16316
+ *
16317
+ * Every field is `.optional()` rather than relied on as a Zod default at the
16318
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
16319
+ * production failures in one day), so the gate reads absent as the constant
16320
+ * above rather than trusting a parse it may never have seen.
16321
+ */
16322
+ var NcConfirmSchema = object({
16323
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
16324
+ * same thing, and both mean "deliver exactly as before". */
16325
+ enabled: boolean().default(false),
16326
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
16327
+ profileId: string().optional(),
16328
+ /**
16329
+ * The operator's question, in his own words. Absent = a question derived
16330
+ * from the rule (its class and its expectation).
16331
+ *
16332
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
16333
+ * banners, signage and plates as instructions if you let them reach the
16334
+ * prompt — proven live — so the authoritative contract stays in the system
16335
+ * turn and only rule-authored words land here.
16336
+ */
16337
+ prompt: string().max(1e3).optional(),
16338
+ /** Fire only when the model's count satisfies this. Absent = the model's
16339
+ * own boolean verdict decides. */
16340
+ expect: NcConfirmExpectSchema.optional(),
16341
+ timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
16342
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
16343
+ onTimeout: _enum(["fire", "suppress"]).default("fire"),
16344
+ /** Longest edge the judged image is downscaled to before it is sent. */
16345
+ maxImagePx: number().int().min(64).max(2048).default(448)
16346
+ });
16041
16347
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
16042
16348
  var NcRuleInputSchema = object({
16043
16349
  name: string().min(1).max(200),
@@ -16098,7 +16404,13 @@ var NcRuleInputSchema = object({
16098
16404
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
16099
16405
  * shape as every other actuation.
16100
16406
  */
16101
- actions: NcRuleActionsSchema.optional()
16407
+ actions: NcRuleActionsSchema.optional(),
16408
+ /**
16409
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
16410
+ * a rule that predates the gate must keep delivering byte-for-byte as it
16411
+ * did, and absent is the only way to say that without a migration.
16412
+ */
16413
+ confirm: NcConfirmSchema.optional()
16102
16414
  });
16103
16415
  /**
16104
16416
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -16109,7 +16421,37 @@ var NcRuleInputSchema = object({
16109
16421
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
16110
16422
  * `updateRule` patch.
16111
16423
  */
16112
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: array(string()).optional() });
16424
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
16425
+ disabledTargetIds: array(string()).optional(),
16426
+ /**
16427
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
16428
+ *
16429
+ * It makes the key optional to SUPPLY; the parse still materialises the
16430
+ * default when the key is absent. And `NcRuleStore.update` merges with
16431
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
16432
+ * one — which made every partial edit destructive:
16433
+ *
16434
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
16435
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
16436
+ * setEnabled(ruleId, false) → conditions reset to `{}`
16437
+ *
16438
+ * A rule scoped to one camera and one zone silently became a rule that
16439
+ * matches EVERY event on EVERY camera, and lost its `media` policy
16440
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
16441
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
16442
+ * within a minute of a two-field patch.
16443
+ *
16444
+ * So every defaulted field is re-declared here WITHOUT its default. The
16445
+ * inner defaults still apply when the caller DOES send the key — `{}` for
16446
+ * conditions remains a real instruction ("clear them") — and only the
16447
+ * absent key is now genuinely absent.
16448
+ */
16449
+ enabled: boolean().optional(),
16450
+ conditions: NcConditionsSchema.optional(),
16451
+ media: NcMediaPolicySchema.optional(),
16452
+ throttle: NcThrottleSchema.optional(),
16453
+ priority: number().int().min(1).max(5).optional()
16454
+ });
16113
16455
  /** A persisted rule. */
16114
16456
  var NcRuleSchema = NcRuleInputSchema.extend({
16115
16457
  id: string(),
@@ -16222,12 +16564,20 @@ var NC_CONDITION_CATALOG = [
16222
16564
  valueType: "systemEvent",
16223
16565
  options: [
16224
16566
  {
16225
- value: "camera-online",
16226
- label: "Camera online"
16567
+ value: "device-online",
16568
+ label: "Device online"
16227
16569
  },
16228
16570
  {
16229
- value: "camera-offline",
16230
- label: "Camera offline"
16571
+ value: "device-offline",
16572
+ label: "Device offline"
16573
+ },
16574
+ {
16575
+ value: "device-disabled",
16576
+ label: "Device switched off"
16577
+ },
16578
+ {
16579
+ value: "device-enabled",
16580
+ label: "Device switched on"
16231
16581
  },
16232
16582
  {
16233
16583
  value: "stream-online",
@@ -16252,12 +16602,24 @@ var NC_CONDITION_CATALOG = [
16252
16602
  {
16253
16603
  value: "server-update-available",
16254
16604
  label: "Server update available"
16605
+ },
16606
+ {
16607
+ value: "alarm-triggered",
16608
+ label: "Alarm triggered"
16609
+ },
16610
+ {
16611
+ value: "alarm-armed",
16612
+ label: "Alarm armed"
16613
+ },
16614
+ {
16615
+ value: "alarm-disarmed",
16616
+ label: "Alarm disarmed"
16255
16617
  }
16256
16618
  ],
16257
16619
  operator: "in",
16258
16620
  appliesTo: ["system-event"],
16259
16621
  phase: "P1",
16260
- description: "Infrastructure and update events. Optionally narrow camera/stream events by device, node events by node id, and addon updates by package name."
16622
+ description: "Infrastructure and update events. Device liveness covers EVERY device type — narrow it by device type (cameras only, say) and/or by device, node events by node id, and addon updates by package name."
16261
16623
  },
16262
16624
  {
16263
16625
  id: "devices",
@@ -16780,6 +17142,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
16780
17142
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
16781
17143
  * copy would lie the first time a rule is disabled.
16782
17144
  */
17145
+ /**
17146
+ * Why a device a mode NAMES is nonetheless not armed by it.
17147
+ *
17148
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
17149
+ * per-camera notification switch the Notification Center already owns,
17150
+ * `detection-off` is the device's own detection binding being inactive, and
17151
+ * `offline` is the device manager's liveness. A fourth reason would mean a
17152
+ * fourth authority, and inventing one here is how a panel starts disagreeing
17153
+ * with the switches the operator actually used.
17154
+ */
17155
+ var NcAlarmSkipReasonSchema = _enum([
17156
+ "muted",
17157
+ "detection-off",
17158
+ "offline"
17159
+ ]);
17160
+ var NcAlarmSkippedDeviceSchema = object({
17161
+ deviceId: number().int(),
17162
+ reason: NcAlarmSkipReasonSchema
17163
+ });
16783
17164
  var NcAlarmModeCoverageSchema = object({
16784
17165
  mode: AlarmArmModeSchema,
16785
17166
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -16787,7 +17168,18 @@ var NcAlarmModeCoverageSchema = object({
16787
17168
  /** At least one covering rule has no device scope, so the mode covers all. */
16788
17169
  allDevices: boolean(),
16789
17170
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
16790
- deviceIds: array(number().int())
17171
+ deviceIds: array(number().int()),
17172
+ /**
17173
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
17174
+ * excludes it.
17175
+ *
17176
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
17177
+ * twelve makes it false in exactly the way nobody notices until an incident.
17178
+ * Defaulted to `[]` so a coverage answer computed before this field existed
17179
+ * still parses as "nothing known to be skipped" rather than failing the whole
17180
+ * alarm tab.
17181
+ */
17182
+ skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
16791
17183
  });
16792
17184
  var NcAlarmConfigSchema = object({
16793
17185
  /**
@@ -18436,20 +18828,28 @@ var pipelineAnalyticsCapability = {
18436
18828
  }),
18437
18829
  /** The events ops-log rows (newest-first), optionally scoped to one camera.
18438
18830
  * Backed by a declared pipeline-analytics SQLite collection. */
18439
- /**
18440
- * Move event-media blobs onto `toLocationId` (entity-routing spec Phase
18441
- * 4): per-row copy stamp row.locationId → delete old blob. Rows already
18442
- * at the target are skipped, so a re-run resumes. Single-flight.
18443
- */
18444
- relocateMedia: method(RelocateMediaInputSchema, object({ jobId: string() }), {
18831
+ /** Internal migration-participant lease. It drains active MediaStore
18832
+ * writes and refuses new ones without changing analytics bindings. */
18833
+ pauseForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18445
18834
  kind: "mutation",
18446
18835
  auth: "admin"
18447
18836
  }),
18448
- getMediaRelocateStatus: method(object({}), array(RelocateJobSchema).readonly(), {
18449
- kind: "query",
18837
+ resumeForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
18838
+ kind: "mutation",
18450
18839
  auth: "admin"
18451
18840
  }),
18452
- cancelMediaRelocate: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18841
+ /** Drops cached location roots after the storage coordinator repoints a
18842
+ * default so future event-media writes use the new root. */
18843
+ refreshStorageLocationsForMigration: method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
18844
+ kind: "mutation",
18845
+ auth: "admin"
18846
+ }),
18847
+ startStorageMigrationMove: method(StorageMigrationMediaMoveInputSchema, object({ jobId: string() }), {
18848
+ kind: "mutation",
18849
+ auth: "admin"
18850
+ }),
18851
+ getStorageMigrationMoveStatus: method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }),
18852
+ cancelStorageMigrationMove: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
18453
18853
  kind: "mutation",
18454
18854
  auth: "admin"
18455
18855
  }),
@@ -20406,9 +20806,16 @@ var CameraStatusSchema = object({
20406
20806
  audio: CameraAudioStatusSchema.nullable(),
20407
20807
  recording: CameraRecordingStatusSchema.nullable(),
20408
20808
  /**
20409
- * Per-camera function switches an OPERATOR has turned off
20809
+ * Per-camera functions an OPERATOR has turned off
20410
20810
  * ([D61](../../../../docs/decisions/adr-0067.md)).
20411
20811
  *
20812
+ * Composed from the AUTHORITIES themselves — the wrapper bindings,
20813
+ * `RecordingConfig.enabled`, the notification mute, the broker's audio
20814
+ * policy, the camera's own microphone — via `composeSwitchedOff`, not from
20815
+ * the deprecated `getCameraSwitches` group ([D113](../../../../docs/decisions/adr-0113.md)).
20816
+ * The badge outlives the control panel: the panel was a convenience, this is
20817
+ * the difference between a camera being off and a camera being dead.
20818
+ *
20412
20819
  * This is the difference between DISABLED and BROKEN. A camera whose
20413
20820
  * `detection` block reports zero fps and whose `switchedOff` contains
20414
20821
  * `'object-detection'` was switched off by a person; the same camera with an
@@ -20498,6 +20905,16 @@ var pipelineOrchestratorCapability = {
20498
20905
  nodeIdMode: "data",
20499
20906
  exposesDeviceSettings: true,
20500
20907
  methods: {
20908
+ /** Internal storage-migration participant lease. While held, dispatch
20909
+ * requests are accepted as pending but no new runner attachment starts. */
20910
+ pauseForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
20911
+ kind: "mutation",
20912
+ auth: "admin"
20913
+ }),
20914
+ resumeForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
20915
+ kind: "mutation",
20916
+ auth: "admin"
20917
+ }),
20501
20918
  /**
20502
20919
  * Pin a camera's pipeline to a specific agent (L1 affinity).
20503
20920
  * The orchestrator re-evaluates the assignment immediately and persists
@@ -20837,6 +21254,10 @@ var pipelineOrchestratorCapability = {
20837
21254
  agentNodeId: string().optional()
20838
21255
  }), CameraPipelineConfigSchema),
20839
21256
  /**
21257
+ * @deprecated The aggregate switch group is being withdrawn
21258
+ * ([D113](../../../../docs/decisions/adr-0113.md)). Build nothing new on
21259
+ * this pair; read the authority directly.
21260
+ *
20840
21261
  * The whole per-camera function switch group, DERIVED — never a stored
20841
21262
  * list ([D61](../../../../docs/decisions/adr-0067.md)).
20842
21263
  *
@@ -20850,9 +21271,23 @@ var pipelineOrchestratorCapability = {
20850
21271
  * `auth: 'view'` deliberately — a NON-admin must be able to see that a
20851
21272
  * camera is quiet because somebody switched it off. Only the mutation is
20852
21273
  * admin-gated.
21274
+ *
21275
+ * **Removal plan.** It stays and it KEEPS WORKING while shipped viewers
21276
+ * (v1.0.305) and the admin UI still call it — removing it now is a broken
21277
+ * app on a device nobody can redeploy from here. It is served by a thin
21278
+ * shim over the same authorities (`camera-switch-service.ts`), so the
21279
+ * behaviour of the pair is the behaviour of the authorities by
21280
+ * construction. It is deleted once every surface reaches its own
21281
+ * component's options and the last caller is gone. Nothing on this server
21282
+ * reads it: `CameraStatus.switchedOff` is composed from the authorities
21283
+ * directly via `composeSwitchedOff`.
20853
21284
  */
20854
21285
  getCameraSwitches: method(object({ deviceId: number() }), CameraSwitchGroupSchema),
20855
21286
  /**
21287
+ * @deprecated See {@link getCameraSwitches}. Write the authority — the
21288
+ * wrapper binding, `RecordingConfig.enabled`, the notification mute — not
21289
+ * this ([D113](../../../../docs/decisions/adr-0113.md)).
21290
+ *
20856
21291
  * Flip ONE switch, routed to its existing authority.
20857
21292
  *
20858
21293
  * Never writes a parallel map: `recording` patches `RecordingConfig.enabled`
@@ -21334,24 +21769,28 @@ var snapshotCapability = {
21334
21769
  *
21335
21770
  * `getSnapshotOverview` is cache-only by contract: it answers from whatever
21336
21771
  * the wrapper happens to hold and never captures. Under D93 the client
21337
- * versions its image URL on that answer, and an image REQUEST is what enrols
21338
- * a camera in the keep-warm loop. Both of those are satisfiable by the
21339
- * client's own image cache — `expo-image` is URL-keyed and never revalidates
21340
- * — so a URL painted in a previous session comes off disk with no network,
21341
- * no enrolment, and nothing warming. Measured on the live hub: reopening
21342
- * after two minutes idle painted 15 of 16 tiles at **168 s old** with zero
21343
- * HTTP requests, and the fleet only recovered because a later poll happened
21344
- * to observe a different identity.
21772
+ * versions its image URL on that answer, and an image REQUEST was the only
21773
+ * demand signal. Both of those are satisfiable by the client's own image
21774
+ * cache — `expo-image` is URL-keyed and never revalidates — so a URL painted
21775
+ * in a previous session comes off disk with no network, no demand, and no
21776
+ * capture. Measured on the live hub: reopening after two minutes idle
21777
+ * painted 15 of 16 tiles at **168 s old** with zero HTTP requests, and the
21778
+ * fleet only recovered because a later poll happened to observe a different
21779
+ * identity.
21345
21780
  *
21346
21781
  * ## The two properties that fix it
21347
21782
  *
21348
21783
  * **It is an RPC, so no client cache can answer it.** The demand signal
21349
- * always reaches the wrapper. This method therefore MAY create keep-warm
21350
- * subscriptions, where `getSnapshotOverview` must never (D93) — the
21351
- * distinction is not "one is newer" but that the overview poll is app-wide
21352
- * (a creating overview would warm every camera on the install) while this is
21353
- * called by a rendered surface naming the tiles it is actually painting, at
21354
- * the width it is painting them.
21784
+ * always reaches the wrapper. This method therefore CAPTURES, where
21785
+ * `getSnapshotOverview` must never (D93) — the distinction is not "one is
21786
+ * newer" but that the overview poll is app-wide (a capturing overview would
21787
+ * dial every camera on the install) while this is called by a rendered
21788
+ * surface naming the tiles it is actually painting, at the width it is
21789
+ * painting them.
21790
+ *
21791
+ * Since 2026-08-11 this is the ONLY thing that refreshes a snapshot: the
21792
+ * server-side keep-warm loop was removed (operator directive — on-demand,
21793
+ * always), so a camera nobody is looking at costs nothing at all.
21355
21794
  *
21356
21795
  * **It waits, briefly and boundedly, for the capture it triggered.** The
21357
21796
  * returned `capturedAt` is the frame the link will serve, not the frame the
@@ -21639,6 +22078,28 @@ var storageEvictableCapability = {
21639
22078
  }), EvictResultSchema, { kind: "mutation" })
21640
22079
  }
21641
22080
  };
22081
+ /**
22082
+ * The single operator-facing storage migration surface. It coordinates the
22083
+ * pipeline, recorder and post-analysis participants; callers never mutate a
22084
+ * camera recording config or invoke an individual mover directly.
22085
+ */
22086
+ var storageMigrationCapability = {
22087
+ name: "storage-migration",
22088
+ scope: "system",
22089
+ mode: "singleton",
22090
+ methods: {
22091
+ plan: method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin" }),
22092
+ start: method(StorageMigrationInputSchema, object({ jobId: string() }), {
22093
+ kind: "mutation",
22094
+ auth: "admin"
22095
+ }),
22096
+ status: method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }),
22097
+ cancel: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
22098
+ kind: "mutation",
22099
+ auth: "admin"
22100
+ })
22101
+ }
22102
+ };
21642
22103
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21643
22104
  providerId: string().min(1),
21644
22105
  displayName: string().min(1),
@@ -21787,6 +22248,28 @@ var TerminalProfileInfoSchema = object({
21787
22248
  label: string(),
21788
22249
  description: string().optional()
21789
22250
  });
22251
+ /**
22252
+ * A durable operator-created Terminal instance. Profiles are templates; only
22253
+ * an instance declares a camera.
22254
+ */
22255
+ var TerminalInstanceInfoSchema = object({
22256
+ instanceId: string(),
22257
+ cameraStableId: string(),
22258
+ nodeId: string(),
22259
+ profileId: string(),
22260
+ profileLabel: string(),
22261
+ name: string(),
22262
+ enabled: boolean()
22263
+ });
22264
+ var TerminalLegacyCameraSchema = object({
22265
+ stableId: string(),
22266
+ nodeId: string(),
22267
+ profileId: string(),
22268
+ profileLabel: string(),
22269
+ name: string(),
22270
+ /** Only legacy monitor cameras can retain their historic stable identity. */
22271
+ adoptable: boolean()
22272
+ });
21790
22273
  var TerminalOutputEventSchema = discriminatedUnion("kind", [object({
21791
22274
  seq: number().int().positive(),
21792
22275
  kind: literal("data"),
@@ -21806,10 +22289,9 @@ var TerminalOutputBatchSchema = object({
21806
22289
  /**
21807
22290
  * terminal-session — singleton system capability for interactive TTY sessions.
21808
22291
  *
21809
- * Phase 1 (this cap): open/resize/close/list a pty running an allowlisted
21810
- * profile, streamed to xterm.js over the data plane. Phase 2 (streaming a
21811
- * session as a camera) is a separate device-provider concern and does not
21812
- * change this contract.
22292
+ * Owns both live PTY lifecycle and durable Terminal instance management.
22293
+ * Profiles are allowlisted templates; an explicit instance is the only path
22294
+ * that declares a camera.
21813
22295
  */
21814
22296
  var terminalSessionCapability = {
21815
22297
  name: "terminal-session",
@@ -21818,6 +22300,37 @@ var terminalSessionCapability = {
21818
22300
  methods: {
21819
22301
  /** Pre-declared profiles the operator may open. */
21820
22302
  listProfiles: method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }),
22303
+ /** Explicit durable Terminal instances, managed centrally on the hub. */
22304
+ listInstances: method(_void(), array(TerminalInstanceInfoSchema).readonly(), { auth: "admin" }),
22305
+ createInstance: method(object({
22306
+ targetNodeId: string().min(1),
22307
+ profileId: string().min(1),
22308
+ name: string().trim().min(1).max(160).optional()
22309
+ }), TerminalInstanceInfoSchema, {
22310
+ kind: "mutation",
22311
+ auth: "admin"
22312
+ }),
22313
+ deleteInstance: method(object({ instanceId: string().min(1) }), _void(), {
22314
+ kind: "mutation",
22315
+ auth: "admin"
22316
+ }),
22317
+ setInstanceEnabled: method(object({
22318
+ instanceId: string().min(1),
22319
+ enabled: boolean()
22320
+ }), TerminalInstanceInfoSchema, {
22321
+ kind: "mutation",
22322
+ auth: "admin"
22323
+ }),
22324
+ /** Existing automatic cameras are shown for explicit migration only. */
22325
+ listLegacyCameras: method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }),
22326
+ /** Explicitly adopt one legacy monitor camera, retaining its stable id. */
22327
+ adoptLegacyMonitor: method(object({
22328
+ stableId: string().min(1),
22329
+ name: string().trim().min(1).max(160).optional()
22330
+ }), TerminalInstanceInfoSchema, {
22331
+ kind: "mutation",
22332
+ auth: "admin"
22333
+ }),
21821
22334
  /** Live sessions currently hosted by the provider. */
21822
22335
  listSessions: method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }),
21823
22336
  /**
@@ -21849,7 +22362,13 @@ var terminalSessionCapability = {
21849
22362
  pullOutput: method(object({
21850
22363
  sessionId: string(),
21851
22364
  afterSeq: number().int().nonnegative(),
21852
- waitMs: number().int().min(0).max(2e3).default(0)
22365
+ waitMs: number().int().min(0).max(2e3).default(0),
22366
+ /**
22367
+ * Wait when a just-opened session has no output yet. Kept opt-in so a
22368
+ * browser's initial repaint remains immediate; the camera snapshot
22369
+ * relay uses it to avoid encoding a blank startup frame.
22370
+ */
22371
+ waitForOutput: boolean().optional()
21853
22372
  }), TerminalOutputBatchSchema, {
21854
22373
  kind: "mutation",
21855
22374
  auth: "admin",
@@ -28581,7 +29100,19 @@ var RecordingManifestSchema = object({
28581
29100
  * profiles/subtrees/locations on this node). */
28582
29101
  var RecordingDeviceUsageSchema = object({
28583
29102
  deviceId: number(),
28584
- usedBytes: number()
29103
+ usedBytes: number(),
29104
+ /**
29105
+ * Start of this camera's OLDEST indexed segment, across every profile and
29106
+ * location — the "Oldest footage" column in Recordings → Storage, and the
29107
+ * only honest answer to "is retention actually holding?" per camera.
29108
+ *
29109
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
29110
+ * predates this field omits it entirely, and a hub whose types carry the
29111
+ * field must keep validating that older provider's payload: the framework
29112
+ * (types) and the addon ship on different trains, and the addon is usually
29113
+ * the later of the two.
29114
+ */
29115
+ oldestMs: number().nullable().optional()
28585
29116
  });
28586
29117
  /** Recording storage usage + capacity for one storage location. */
28587
29118
  var RecordingLocationUsageSchema = object({
@@ -28609,6 +29140,57 @@ var RecordingStorageUsageSchema = object({
28609
29140
  locations: array(RecordingLocationUsageSchema)
28610
29141
  });
28611
29142
  /**
29143
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
29144
+ *
29145
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
29146
+ * is the operator asking for the EXISTING archive to be brought into line with
29147
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
29148
+ * location, run FIFO behind the single-flight mover.
29149
+ *
29150
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
29151
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
29152
+ * (empty on the plan).
29153
+ */
29154
+ var RecordingRebalanceMoveSchema = object({
29155
+ deviceId: number(),
29156
+ profile: string(),
29157
+ fromLocationId: string(),
29158
+ toLocationId: string(),
29159
+ bytes: number(),
29160
+ files: number().int()
29161
+ });
29162
+ /** Why a pile that is out of place is staying there. Every refusal is
29163
+ * reported: a rebalance that silently drops a camera reads exactly like one
29164
+ * that had nothing to do. */
29165
+ var RecordingRebalanceSkipReasonSchema = _enum([
29166
+ "unassigned",
29167
+ "target-not-writable",
29168
+ "below-threshold",
29169
+ "no-headroom"
29170
+ ]);
29171
+ var RecordingRebalanceSkipSchema = object({
29172
+ deviceId: number(),
29173
+ profile: string(),
29174
+ fromLocationId: string(),
29175
+ /** The location the plan wants; null when the camera has no assignment. */
29176
+ toLocationId: string().nullable(),
29177
+ bytes: number(),
29178
+ reason: RecordingRebalanceSkipReasonSchema
29179
+ });
29180
+ var RecordingRebalancePlanSchema = object({
29181
+ moves: array(RecordingRebalanceMoveSchema),
29182
+ skipped: array(RecordingRebalanceSkipSchema),
29183
+ bytesToMove: number(),
29184
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
29185
+ jobIds: array(string())
29186
+ });
29187
+ var RecordingRebalanceInputSchema = object({
29188
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
29189
+ throttleMbps: number().min(1).max(1e3).optional(),
29190
+ /** Ignore piles smaller than this (default 1 GB). */
29191
+ minMoveGb: number().min(0).optional()
29192
+ });
29193
+ /**
28612
29194
  * Result of locating footage at a wall-clock instant for one device/profile.
28613
29195
  * `segment` carries the covering segment's window; `gap` reports the forward
28614
29196
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -28777,12 +29359,6 @@ var recordingCapability = {
28777
29359
  auth: "admin"
28778
29360
  }),
28779
29361
  /**
28780
- * Move footage (recorded segments) from one recordings location to
28781
- * another — the drain workflow's mover (entity-routing spec Phase 4).
28782
- * Throttled copy → size-verify → delete source → index refresh; resumable
28783
- * by construction (copy-if-absent). Single-flight: one job at a time.
28784
- */
28785
- /**
28786
29362
  * Render a short GIF from recorded footage around `aroundMs` (low profile,
28787
29363
  * palette-free ffmpeg gif). Synchronous — the window is a few seconds of
28788
29364
  * `low`, rendering in ~1-2s. Built for notification attachments: the
@@ -28834,23 +29410,65 @@ var recordingCapability = {
28834
29410
  kind: "mutation",
28835
29411
  auth: "admin"
28836
29412
  }),
29413
+ /** Internal migration-participant lease. Blocks new recorder attaches and
29414
+ * waits for writers to exit while their watchers index final segments. */
29415
+ pauseForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
29416
+ kind: "mutation",
29417
+ auth: "admin"
29418
+ }),
29419
+ resumeForStorageMigration: method(StorageMigrationLeaseInputSchema, object({ resumed: literal(true) }), {
29420
+ kind: "mutation",
29421
+ auth: "admin"
29422
+ }),
29423
+ /** Re-resolve location roots after the coordinator changes defaults. */
29424
+ refreshStorageLocationsForMigration: method(StorageMigrationLeaseInputSchema, object({ refreshed: literal(true) }), {
29425
+ kind: "mutation",
29426
+ auth: "admin"
29427
+ }),
29428
+ /** Internal mover, callable only by the storage-migration coordinator. */
29429
+ startStorageMigrationMove: method(StorageMigrationFootageMoveInputSchema, object({ jobId: string() }), {
29430
+ kind: "mutation",
29431
+ auth: "admin"
29432
+ }),
29433
+ getStorageMigrationMoveStatus: method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }),
29434
+ cancelStorageMigrationMove: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
29435
+ kind: "mutation",
29436
+ auth: "admin"
29437
+ }),
29438
+ /**
29439
+ * Move footage between locations — the OPERATOR's mover, scoped to one
29440
+ * camera (and optionally to specific profiles) rather than a whole disk.
29441
+ * Queued FIFO behind the single-flight engine, so arming several is safe.
29442
+ */
28837
29443
  relocateFootage: method(RelocateFootageInputSchema, object({ jobId: string() }), {
28838
29444
  kind: "mutation",
28839
29445
  auth: "admin"
28840
29446
  }),
28841
- /** Every known relocate job (in-RAM, newest-first). */
28842
- getRelocateStatus: method(object({}), array(RelocateJobSchema).readonly(), {
29447
+ /** Every relocate job this recorder knows about, newest first (in RAM: the
29448
+ * move is resumable, so a lost list costs nothing but the display). */
29449
+ listRelocateJobs: method(object({}), array(RelocateJobSchema).readonly(), {
28843
29450
  kind: "query",
28844
29451
  auth: "admin"
28845
29452
  }),
28846
- cancelRelocate: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
29453
+ /** Cancel a running or queued relocate job. A queued job never runs. */
29454
+ cancelRelocateJob: method(object({ jobId: string() }), object({ cancelled: boolean() }), {
29455
+ kind: "mutation",
29456
+ auth: "admin"
29457
+ }),
29458
+ /** What a rebalance WOULD move, and what it would refuse. Moves nothing. */
29459
+ planStorageRebalance: method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
29460
+ kind: "query",
29461
+ auth: "admin"
29462
+ }),
29463
+ /** Arm the rebalance: enqueue one relocate job per planned move. */
29464
+ startStorageRebalance: method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
28847
29465
  kind: "mutation",
28848
29466
  auth: "admin"
28849
29467
  })
28850
29468
  }
28851
29469
  };
28852
29470
  /**
28853
- * `recordingExport` cap — render a footage time range into a single downloadable
29471
+ * `recording-export` cap — render a footage time range into a single downloadable
28854
29472
  * MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
28855
29473
  * bounded lifetime with a durable history, auto-expiry, and optional
28856
29474
  * delete-after-download.
@@ -28865,10 +29483,42 @@ var recordingCapability = {
28865
29483
  */
28866
29484
  /** Playback-speed multiplier for the render (1 = realtime). */
28867
29485
  var ExportSpeedSchema = number().min(.25).max(32);
29486
+ /**
29487
+ * One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
29488
+ *
29489
+ * Relative and not absolute epoch on purpose: the renderer's frame-select
29490
+ * expression sees ffmpeg's `t`, which starts at 0 for the export's source
29491
+ * playlist. Handing it absolute epochs would make every call site responsible
29492
+ * for the same subtraction, and the one that forgot would emit a filter that
29493
+ * selects nothing — silently, as a uniform timelapse.
29494
+ */
29495
+ var ExportDenseRangeSchema = object({
29496
+ fromSec: number().nonnegative(),
29497
+ toSec: number().nonnegative()
29498
+ }).refine((r) => r.toSec > r.fromSec, { message: "dense range must have toSec > fromSec" });
29499
+ /**
29500
+ * Dense-interval overlay for a timelapse: sample at `dense.everyMs` INSIDE the
29501
+ * listed ranges and at the base `everyMs` everywhere else.
29502
+ *
29503
+ * `everyMs` must be strictly smaller than the base cadence — a dense rate that
29504
+ * is not denser renders a uniform timelapse the operator believes is two-rate.
29505
+ */
29506
+ var ExportDenseSchema = object({
29507
+ everyMs: number().int().positive(),
29508
+ ranges: array(ExportDenseRangeSchema).min(1).max(200)
29509
+ });
28868
29510
  /** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
28869
29511
  var ExportTimelapseSchema = object({
28870
29512
  everyMs: number().int().positive(),
28871
- outputFps: number().int().min(1).max(60).optional()
29513
+ outputFps: number().int().min(1).max(60).optional(),
29514
+ /** Optional second, FASTER rate over the intervals that matter. */
29515
+ dense: ExportDenseSchema.optional()
29516
+ }).superRefine((v, ctx) => {
29517
+ if (v.dense !== void 0 && v.dense.everyMs >= v.everyMs) ctx.addIssue({
29518
+ code: ZodIssueCode.custom,
29519
+ message: "dense.everyMs must be strictly smaller than the base everyMs",
29520
+ path: ["dense", "everyMs"]
29521
+ });
28872
29522
  });
28873
29523
  /**
28874
29524
  * Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
@@ -28926,8 +29576,21 @@ var ExportDownloadSchema = object({
28926
29576
  url: string(),
28927
29577
  endpoints: array(string())
28928
29578
  });
29579
+ /**
29580
+ * A finished export's bytes, inline.
29581
+ *
29582
+ * `bytes` is the DECODED length — the number the caller bounds and logs
29583
+ * against, so nobody has to infer it from the base64 length.
29584
+ */
29585
+ var ExportBytesSchema = object({
29586
+ base64: string(),
29587
+ contentType: string(),
29588
+ /** Suggested filename, extension included. */
29589
+ name: string(),
29590
+ bytes: number().int().nonnegative()
29591
+ });
28929
29592
  var recordingExportCapability = {
28930
- name: "recordingExport",
29593
+ name: "recording-export",
28931
29594
  scope: "system",
28932
29595
  mode: "singleton",
28933
29596
  methods: {
@@ -28965,6 +29628,27 @@ var recordingExportCapability = {
28965
29628
  getDownloadUrl: method(object({ exportId: string() }), ExportDownloadSchema, {
28966
29629
  kind: "query",
28967
29630
  auth: "protected"
29631
+ }),
29632
+ /**
29633
+ * The finished file's BYTES, base64, for a caller that must republish them
29634
+ * somewhere a session-less fetcher can reach.
29635
+ *
29636
+ * `getDownloadUrl` is the right answer for a human: the download route is
29637
+ * served `access: 'authenticated'`, which a browser satisfies and a
29638
+ * notifier BACKEND does not. It answers a RELATIVE path, so it is not even
29639
+ * a URL an outside fetcher could try. This method exists for the one case
29640
+ * that needs the other thing — a scheduled timelapse whose video has to
29641
+ * become a public attachment on the notification artifact plane.
29642
+ *
29643
+ * Deliberately narrow: `ready` only (a queued, rendering, failed, expired
29644
+ * or deleted export has no file, and answering "0 bytes" for one is how a
29645
+ * caller ships an empty attachment), still inside its lifetime, and under
29646
+ * {@link RECORDING_EXPORT_MAX_READ_BYTES}. Every refusal throws with the
29647
+ * reason — none of them is silent.
29648
+ */
29649
+ readExportBytes: method(object({ exportId: string() }), ExportBytesSchema, {
29650
+ kind: "query",
29651
+ auth: "protected"
28968
29652
  })
28969
29653
  }
28970
29654
  };
@@ -30798,6 +31482,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
30798
31482
  ssoBridgeCapability,
30799
31483
  storageCapability,
30800
31484
  storageEvictableCapability,
31485
+ storageMigrationCapability,
30801
31486
  storageProviderCapability,
30802
31487
  streamBrokerCapability,
30803
31488
  streamCatalogCapability,
@@ -33826,7 +34511,7 @@ Object.freeze({
33826
34511
  addonId: null,
33827
34512
  access: "create"
33828
34513
  },
33829
- "pipelineAnalytics.cancelMediaRelocate": {
34514
+ "pipelineAnalytics.cancelStorageMigrationMove": {
33830
34515
  capName: "pipeline-analytics",
33831
34516
  capScope: "device",
33832
34517
  addonId: null,
@@ -33898,12 +34583,6 @@ Object.freeze({
33898
34583
  addonId: null,
33899
34584
  access: "view"
33900
34585
  },
33901
- "pipelineAnalytics.getMediaRelocateStatus": {
33902
- capName: "pipeline-analytics",
33903
- capScope: "device",
33904
- addonId: null,
33905
- access: "view"
33906
- },
33907
34586
  "pipelineAnalytics.getMotionEvents": {
33908
34587
  capName: "pipeline-analytics",
33909
34588
  capScope: "device",
@@ -33940,6 +34619,12 @@ Object.freeze({
33940
34619
  addonId: null,
33941
34620
  access: "view"
33942
34621
  },
34622
+ "pipelineAnalytics.getStorageMigrationMoveStatus": {
34623
+ capName: "pipeline-analytics",
34624
+ capScope: "device",
34625
+ addonId: null,
34626
+ access: "view"
34627
+ },
33943
34628
  "pipelineAnalytics.getTrack": {
33944
34629
  capName: "pipeline-analytics",
33945
34630
  capScope: "device",
@@ -34018,6 +34703,12 @@ Object.freeze({
34018
34703
  addonId: null,
34019
34704
  access: "view"
34020
34705
  },
34706
+ "pipelineAnalytics.pauseForStorageMigration": {
34707
+ capName: "pipeline-analytics",
34708
+ capScope: "device",
34709
+ addonId: null,
34710
+ access: "create"
34711
+ },
34021
34712
  "pipelineAnalytics.proposeRetrainAnnotations": {
34022
34713
  capName: "pipeline-analytics",
34023
34714
  capScope: "device",
@@ -34048,7 +34739,7 @@ Object.freeze({
34048
34739
  addonId: null,
34049
34740
  access: "create"
34050
34741
  },
34051
- "pipelineAnalytics.relocateMedia": {
34742
+ "pipelineAnalytics.refreshStorageLocationsForMigration": {
34052
34743
  capName: "pipeline-analytics",
34053
34744
  capScope: "device",
34054
34745
  addonId: null,
@@ -34060,6 +34751,12 @@ Object.freeze({
34060
34751
  addonId: null,
34061
34752
  access: "create"
34062
34753
  },
34754
+ "pipelineAnalytics.resumeForStorageMigration": {
34755
+ capName: "pipeline-analytics",
34756
+ capScope: "device",
34757
+ addonId: null,
34758
+ access: "create"
34759
+ },
34063
34760
  "pipelineAnalytics.saveRetrainAnnotations": {
34064
34761
  capName: "pipeline-analytics",
34065
34762
  capScope: "device",
@@ -34084,6 +34781,12 @@ Object.freeze({
34084
34781
  addonId: null,
34085
34782
  access: "create"
34086
34783
  },
34784
+ "pipelineAnalytics.startStorageMigrationMove": {
34785
+ capName: "pipeline-analytics",
34786
+ capScope: "device",
34787
+ addonId: null,
34788
+ access: "create"
34789
+ },
34087
34790
  "pipelineAnalytics.wipeAllAnalytics": {
34088
34791
  capName: "pipeline-analytics",
34089
34792
  capScope: "device",
@@ -34450,6 +35153,12 @@ Object.freeze({
34450
35153
  addonId: null,
34451
35154
  access: "view"
34452
35155
  },
35156
+ "pipelineOrchestrator.pauseForStorageMigration": {
35157
+ capName: "pipeline-orchestrator",
35158
+ capScope: "system",
35159
+ addonId: null,
35160
+ access: "create"
35161
+ },
34453
35162
  "pipelineOrchestrator.rebalance": {
34454
35163
  capName: "pipeline-orchestrator",
34455
35164
  capScope: "system",
@@ -34474,6 +35183,12 @@ Object.freeze({
34474
35183
  addonId: null,
34475
35184
  access: "view"
34476
35185
  },
35186
+ "pipelineOrchestrator.resumeForStorageMigration": {
35187
+ capName: "pipeline-orchestrator",
35188
+ capScope: "system",
35189
+ addonId: null,
35190
+ access: "create"
35191
+ },
34477
35192
  "pipelineOrchestrator.saveTemplate": {
34478
35193
  capName: "pipeline-orchestrator",
34479
35194
  capScope: "system",
@@ -34870,7 +35585,13 @@ Object.freeze({
34870
35585
  addonId: null,
34871
35586
  access: "create"
34872
35587
  },
34873
- "recording.cancelRelocate": {
35588
+ "recording.cancelRelocateJob": {
35589
+ capName: "recording",
35590
+ capScope: "system",
35591
+ addonId: null,
35592
+ access: "create"
35593
+ },
35594
+ "recording.cancelStorageMigrationMove": {
34874
35595
  capName: "recording",
34875
35596
  capScope: "system",
34876
35597
  addonId: null,
@@ -34906,7 +35627,7 @@ Object.freeze({
34906
35627
  addonId: null,
34907
35628
  access: "view"
34908
35629
  },
34909
- "recording.getRelocateStatus": {
35630
+ "recording.getStorageMigrationMoveStatus": {
34910
35631
  capName: "recording",
34911
35632
  capScope: "system",
34912
35633
  addonId: null,
@@ -34924,12 +35645,30 @@ Object.freeze({
34924
35645
  addonId: null,
34925
35646
  access: "view"
34926
35647
  },
35648
+ "recording.listRelocateJobs": {
35649
+ capName: "recording",
35650
+ capScope: "system",
35651
+ addonId: null,
35652
+ access: "view"
35653
+ },
34927
35654
  "recording.locateSegment": {
34928
35655
  capName: "recording",
34929
35656
  capScope: "system",
34930
35657
  addonId: null,
34931
35658
  access: "view"
34932
35659
  },
35660
+ "recording.pauseForStorageMigration": {
35661
+ capName: "recording",
35662
+ capScope: "system",
35663
+ addonId: null,
35664
+ access: "create"
35665
+ },
35666
+ "recording.planStorageRebalance": {
35667
+ capName: "recording",
35668
+ capScope: "system",
35669
+ addonId: null,
35670
+ access: "view"
35671
+ },
34933
35672
  "recording.pruneFootage": {
34934
35673
  capName: "recording",
34935
35674
  capScope: "system",
@@ -34948,6 +35687,12 @@ Object.freeze({
34948
35687
  addonId: null,
34949
35688
  access: "view"
34950
35689
  },
35690
+ "recording.refreshStorageLocationsForMigration": {
35691
+ capName: "recording",
35692
+ capScope: "system",
35693
+ addonId: null,
35694
+ access: "create"
35695
+ },
34951
35696
  "recording.relocateFootage": {
34952
35697
  capName: "recording",
34953
35698
  capScope: "system",
@@ -34972,44 +35717,68 @@ Object.freeze({
34972
35717
  addonId: null,
34973
35718
  access: "create"
34974
35719
  },
35720
+ "recording.resumeForStorageMigration": {
35721
+ capName: "recording",
35722
+ capScope: "system",
35723
+ addonId: null,
35724
+ access: "create"
35725
+ },
34975
35726
  "recording.setDeviceConfig": {
34976
35727
  capName: "recording",
34977
35728
  capScope: "system",
34978
35729
  addonId: null,
34979
35730
  access: "create"
34980
35731
  },
35732
+ "recording.startStorageMigrationMove": {
35733
+ capName: "recording",
35734
+ capScope: "system",
35735
+ addonId: null,
35736
+ access: "create"
35737
+ },
35738
+ "recording.startStorageRebalance": {
35739
+ capName: "recording",
35740
+ capScope: "system",
35741
+ addonId: null,
35742
+ access: "create"
35743
+ },
34981
35744
  "recordingExport.cancelExport": {
34982
- capName: "recordingExport",
35745
+ capName: "recording-export",
34983
35746
  capScope: "system",
34984
35747
  addonId: null,
34985
35748
  access: "create"
34986
35749
  },
34987
35750
  "recordingExport.createExport": {
34988
- capName: "recordingExport",
35751
+ capName: "recording-export",
34989
35752
  capScope: "system",
34990
35753
  addonId: null,
34991
35754
  access: "create"
34992
35755
  },
34993
35756
  "recordingExport.deleteExport": {
34994
- capName: "recordingExport",
35757
+ capName: "recording-export",
34995
35758
  capScope: "system",
34996
35759
  addonId: null,
34997
35760
  access: "delete"
34998
35761
  },
34999
35762
  "recordingExport.getDownloadUrl": {
35000
- capName: "recordingExport",
35763
+ capName: "recording-export",
35001
35764
  capScope: "system",
35002
35765
  addonId: null,
35003
35766
  access: "view"
35004
35767
  },
35005
35768
  "recordingExport.getExport": {
35006
- capName: "recordingExport",
35769
+ capName: "recording-export",
35007
35770
  capScope: "system",
35008
35771
  addonId: null,
35009
35772
  access: "view"
35010
35773
  },
35011
35774
  "recordingExport.listExports": {
35012
- capName: "recordingExport",
35775
+ capName: "recording-export",
35776
+ capScope: "system",
35777
+ addonId: null,
35778
+ access: "view"
35779
+ },
35780
+ "recordingExport.readExportBytes": {
35781
+ capName: "recording-export",
35013
35782
  capScope: "system",
35014
35783
  addonId: null,
35015
35784
  access: "view"
@@ -35368,6 +36137,30 @@ Object.freeze({
35368
36137
  addonId: null,
35369
36138
  access: "view"
35370
36139
  },
36140
+ "storageMigration.cancel": {
36141
+ capName: "storage-migration",
36142
+ capScope: "system",
36143
+ addonId: null,
36144
+ access: "create"
36145
+ },
36146
+ "storageMigration.plan": {
36147
+ capName: "storage-migration",
36148
+ capScope: "system",
36149
+ addonId: null,
36150
+ access: "view"
36151
+ },
36152
+ "storageMigration.start": {
36153
+ capName: "storage-migration",
36154
+ capScope: "system",
36155
+ addonId: null,
36156
+ access: "create"
36157
+ },
36158
+ "storageMigration.status": {
36159
+ capName: "storage-migration",
36160
+ capScope: "system",
36161
+ addonId: null,
36162
+ access: "view"
36163
+ },
35371
36164
  "storageProvider.abortUpload": {
35372
36165
  capName: "storage-provider",
35373
36166
  capScope: "system",
@@ -35746,12 +36539,42 @@ Object.freeze({
35746
36539
  addonId: null,
35747
36540
  access: "create"
35748
36541
  },
36542
+ "terminalSession.adoptLegacyMonitor": {
36543
+ capName: "terminal-session",
36544
+ capScope: "system",
36545
+ addonId: null,
36546
+ access: "create"
36547
+ },
35749
36548
  "terminalSession.close": {
35750
36549
  capName: "terminal-session",
35751
36550
  capScope: "system",
35752
36551
  addonId: null,
35753
36552
  access: "create"
35754
36553
  },
36554
+ "terminalSession.createInstance": {
36555
+ capName: "terminal-session",
36556
+ capScope: "system",
36557
+ addonId: null,
36558
+ access: "create"
36559
+ },
36560
+ "terminalSession.deleteInstance": {
36561
+ capName: "terminal-session",
36562
+ capScope: "system",
36563
+ addonId: null,
36564
+ access: "delete"
36565
+ },
36566
+ "terminalSession.listInstances": {
36567
+ capName: "terminal-session",
36568
+ capScope: "system",
36569
+ addonId: null,
36570
+ access: "view"
36571
+ },
36572
+ "terminalSession.listLegacyCameras": {
36573
+ capName: "terminal-session",
36574
+ capScope: "system",
36575
+ addonId: null,
36576
+ access: "view"
36577
+ },
35755
36578
  "terminalSession.listProfiles": {
35756
36579
  capName: "terminal-session",
35757
36580
  capScope: "system",
@@ -35782,6 +36605,12 @@ Object.freeze({
35782
36605
  addonId: null,
35783
36606
  access: "create"
35784
36607
  },
36608
+ "terminalSession.setInstanceEnabled": {
36609
+ capName: "terminal-session",
36610
+ capScope: "system",
36611
+ addonId: null,
36612
+ access: "create"
36613
+ },
35785
36614
  "terminalSession.writeInput": {
35786
36615
  capName: "terminal-session",
35787
36616
  capScope: "system",
@@ -36386,6 +37215,104 @@ var FramerateField = number().int().min(1).max(60);
36386
37215
  var TargetsField = array(NcRuleTargetSchema).min(1);
36387
37216
  var PriorityField = number().int().min(1).max(5);
36388
37217
  /**
37218
+ * Explicit override of the DENSE sampling cadence, seconds.
37219
+ *
37220
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
37221
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
37222
+ * made that same base 3 s and rendered a person pass as two frames.)
37223
+ *
37224
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
37225
+ * `denseCadenceSec` and played at `framerate` occupies
37226
+ *
37227
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
37228
+ *
37229
+ * 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.
37230
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
37231
+ * and therefore the length of a quiet night, does not move.
37232
+ *
37233
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
37234
+ * the recording has them returns the same frames, requested twice. Must be
37235
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
37236
+ * a uniform video the operator believes is two-rate — and upsert refuses it
37237
+ * rather than letting the export cap reject the render hours after the window.
37238
+ */
37239
+ var DenseCadenceSecField = number().min(.1).max(3600);
37240
+ /**
37241
+ * Minimum seconds of OUTPUT video each detection range must occupy.
37242
+ *
37243
+ * The operator-facing form of the arithmetic above: instead of solving for a
37244
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
37245
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
37246
+ * that range every ~583 ms.
37247
+ *
37248
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
37249
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
37250
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
37251
+ * ranges are sampled denser than they need. Per-range cadences require a cap
37252
+ * schema change and are the tracked follow-up.
37253
+ *
37254
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
37255
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
37256
+ * by real footage, never met by duplicating frames into motion that never
37257
+ * happened.
37258
+ */
37259
+ var MinDwellSecField = number().min(0).max(60);
37260
+ /**
37261
+ * Caption burned into the notification's preview frame.
37262
+ *
37263
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
37264
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
37265
+ * templating dialect for one field would be a second thing to explain.
37266
+ *
37267
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
37268
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
37269
+ * the reason this is not `.min(1)`.
37270
+ */
37271
+ var PreviewTextField = string().max(200);
37272
+ /**
37273
+ * Whether the notification's preview is a STILL or a short animation.
37274
+ *
37275
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
37276
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
37277
+ * night reads better as three seconds of motion than as one frame of it. Both
37278
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
37279
+ * simply applies it to a dozen frames sampled across the render and assembles
37280
+ * them.
37281
+ *
37282
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
37283
+ * seeks and a palette pass, and no rule that never asked for one should start
37284
+ * paying that on the deploy that shipped it.
37285
+ *
37286
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
37287
+ */
37288
+ var PreviewModeField = _enum(["image", "gif"]);
37289
+ /**
37290
+ * Which detection classes the notification reports counts for.
37291
+ *
37292
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
37293
+ * plan — no second query — aggregated per class. Absent or empty means "every
37294
+ * class the window actually contained", which is what an operator who never
37295
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
37296
+ * counts cars all night).
37297
+ *
37298
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
37299
+ * …). An unknown name simply never matches and reports nothing — it is not an
37300
+ * error, because a rule may legitimately name a class this camera's model does
37301
+ * not emit.
37302
+ *
37303
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
37304
+ * - `{{detections}}` — total over the reported classes
37305
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
37306
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
37307
+ * one per class, `count_` + the class name
37308
+ *
37309
+ * With NO custom body template the summary is appended to the derived body, and
37310
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
37311
+ * reads. With a custom template the operator owns every word — nothing is
37312
+ * appended, so `{{detectionSummary}}` is how he asks for it.
37313
+ */
37314
+ var ReportClassesField = array(string().min(1).max(40)).max(20);
37315
+ /**
36389
37316
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
36390
37317
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
36391
37318
  * here (see the ownership note above).
@@ -36405,9 +37332,30 @@ var TimelapseRuleInputSchema = object({
36405
37332
  cadenceSec: CadenceSecField.default(15),
36406
37333
  /** Output frames per second of the assembled mp4 (predecessor parity). */
36407
37334
  framerate: FramerateField.default(10),
37335
+ /**
37336
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
37337
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
37338
+ * field gets.
37339
+ */
37340
+ denseCadenceSec: DenseCadenceSecField.optional(),
37341
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
37342
+ minDwellSec: MinDwellSecField.optional(),
36408
37343
  /** `notification-output` targets the finished video/thumbnail is sent to. */
36409
37344
  targets: TargetsField,
36410
37345
  template: TimelapseTemplateSchema.optional(),
37346
+ /**
37347
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
37348
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
37349
+ *
37350
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
37351
+ * the notification's title/body, and clearing it (`template: null`) must not
37352
+ * silently clear the caption too.
37353
+ */
37354
+ previewText: PreviewTextField.optional(),
37355
+ /** Still or animation — see {@link PreviewModeField}. */
37356
+ previewMode: PreviewModeField.default("image"),
37357
+ /** Classes the notification counts — see {@link ReportClassesField}. */
37358
+ reportClasses: ReportClassesField.optional(),
36411
37359
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
36412
37360
  priority: PriorityField.default(3)
36413
37361
  });
@@ -36418,8 +37366,13 @@ object({
36418
37366
  schedule: NcScheduleSchema.optional(),
36419
37367
  cadenceSec: CadenceSecField.optional(),
36420
37368
  framerate: FramerateField.optional(),
37369
+ denseCadenceSec: DenseCadenceSecField.optional(),
37370
+ minDwellSec: MinDwellSecField.optional(),
36421
37371
  targets: TargetsField.optional(),
36422
37372
  template: TimelapseTemplateSchema.nullable().optional(),
37373
+ previewText: PreviewTextField.optional(),
37374
+ previewMode: PreviewModeField.optional(),
37375
+ reportClasses: ReportClassesField.optional(),
36423
37376
  priority: PriorityField.optional()
36424
37377
  });
36425
37378
  TimelapseRuleInputSchema.extend({
@@ -36431,10 +37384,28 @@ TimelapseRuleInputSchema.extend({
36431
37384
  */
36432
37385
  ownerUserId: string().optional(),
36433
37386
  /**
36434
- * Epoch-ms of the last successful generation the 1-hour re-generation
36435
- * guard's durable state (predecessor parity). Absent = never generated.
37387
+ * Epoch-ms of the NEWEST successful generation across every camera of this
37388
+ * rule. What a UI shows, and the compatibility floor for
37389
+ * {@link readTimelapseGeneratedAt}. Absent = never generated.
36436
37390
  */
36437
37391
  lastGeneratedAt: number().optional(),
37392
+ /**
37393
+ * PER-CAMERA generation state, keyed by `String(deviceId)` — the
37394
+ * re-generation guard's real durable state.
37395
+ *
37396
+ * One rule covers several cameras and each renders its own video, so a rule
37397
+ * -wide stamp is wrong in the direction that DESTROYS work: camera A
37398
+ * succeeding at 06:05 tells camera B, whose render failed, that it is
37399
+ * already done — and B's night is gone for good, because the window will not
37400
+ * come back.
37401
+ *
37402
+ * ADDITIVE, so the migration is free: a row written before this field simply
37403
+ * has no map, and {@link readTimelapseGeneratedAt} falls back to
37404
+ * {@link TimelapseRuleSchema.shape.lastGeneratedAt}. Reading an old row as
37405
+ * "never generated" would re-render and re-notify every camera of every rule
37406
+ * once, on the deploy that shipped the map.
37407
+ */
37408
+ generatedByDevice: record(string(), number()).optional(),
36438
37409
  /** userId of the caller who created the rule (server-stamped). */
36439
37410
  createdBy: string(),
36440
37411
  createdAt: number(),