@camstack/addon-provider-homeassistant 1.2.6 → 1.2.8

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 +483 -81
  2. package/dist/addon.mjs +483 -81
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let node_crypto = require("node:crypto");
3
3
  let node_zlib = require("node:zlib");
4
- //#region ../types/dist/event-category-BLcNejAE.mjs
4
+ //#region ../types/dist/event-category-Bz24uP1U.mjs
5
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
6
6
  EventCategory["SystemBoot"] = "system.boot";
7
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -272,6 +272,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
272
272
  */
273
273
  EventCategory["DeviceStateChanged"] = "device.state-changed";
274
274
  /**
275
+ * Frame occupancy for a camera CHANGED — a tracked object was gained or
276
+ * lost. Carries `{ deviceId, totalObjects, byClass, zones }`.
277
+ *
278
+ * Emitted only on a change, so a steady scene is silent. It exists so a
279
+ * client can stop polling `zoneAnalytics.getCurrentSnapshot`: that was the
280
+ * one live badge with no push signal at all, and it cost a request every
281
+ * four seconds per visible camera.
282
+ *
283
+ * Like every event it is telemetry and may be dropped ([D8]) — a consumer
284
+ * keeps a slow reconcile rather than trusting it alone.
285
+ */
286
+ EventCategory["ZoneAnalyticsOccupancyChanged"] = "zone-analytics.occupancy-changed";
287
+ /**
275
288
  * Cap event fired by every device that registers the `battery`
276
289
  * capability. Mirrors the cap definition's `onStatusChanged`. Carries
277
290
  * `{ deviceId, status: BatteryStatus }`. Subscribers (alert center,
@@ -7318,35 +7331,22 @@ function buildCapturingReply(envelope) {
7318
7331
  */
7319
7332
  var RecordingWeekdaySchema = number().int().min(0).max(6);
7320
7333
  var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
7321
- var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
7322
- kind: literal("timeOfDay"),
7323
- start: string().regex(HHMM),
7324
- end: string().regex(HHMM),
7325
- /** Restrict to these weekdays; omit = every day. */
7326
- days: array(RecordingWeekdaySchema).optional()
7327
- })]);
7328
- var RecordingModeSchema = _enum([
7329
- "continuous",
7330
- "onMotion",
7331
- "onAudioThreshold"
7332
- ]);
7333
7334
  /**
7334
- * First-class, authoritative per-camera storage mode — the explicit choice the
7335
- * UI reads directly (never inferred from `rules`):
7336
- * - `off` — not recording.
7337
- * - `events` — record only around triggers (motion / audio threshold),
7338
- * with pre/post-buffer.
7339
- * - `continuous` — record 24/7 within the schedule.
7335
+ * DERIVED per-camera storage summary — the single field cheap consumers read
7336
+ * (the viewer's status dot, the camera list) instead of walking `bands`:
7337
+ * - `off` — no band covers the camera (or it is disabled).
7338
+ * - `events` — every band records around triggers only.
7339
+ * - `continuous` — at least one band records continuously.
7340
7340
  *
7341
- * `mode` compiles one-way to the internal `rules[]` consumed by the policy
7342
- * engine (see `compileRules`); `rules[]` is never authored directly anymore.
7341
+ * NEVER authored: the recorder stamps it from the authoritative `bands` on
7342
+ * every save (`activeModeForConfig`). Writing it has no effect.
7343
7343
  */
7344
7344
  var RecordingStorageModeSchema = _enum([
7345
7345
  "off",
7346
7346
  "events",
7347
7347
  "continuous"
7348
7348
  ]);
7349
- /** Which detectors trigger an `events`-mode recording. */
7349
+ /** Which detectors trigger an `events`-mode band. */
7350
7350
  var RecordingTriggersSchema = object({
7351
7351
  motion: boolean().optional(),
7352
7352
  audioThresholdDbfs: number().optional()
@@ -7382,18 +7382,6 @@ var RecordingBandSchema = object({
7382
7382
  preBufferSec: number().min(0).optional(),
7383
7383
  postBufferSec: number().min(0).optional()
7384
7384
  });
7385
- var RecordingRuleSchema = object({
7386
- schedule: RecordingScheduleSchema,
7387
- mode: RecordingModeSchema,
7388
- /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
7389
- preBufferSec: number().min(0).default(0),
7390
- /** Keep recording until this many seconds after the last trigger. */
7391
- postBufferSec: number().min(0).default(0),
7392
- /** Each new trigger restarts the post-buffer window. */
7393
- resetTimeoutOnNewEvent: boolean().default(true),
7394
- /** onAudioThreshold only — dBFS level that counts as a trigger. */
7395
- thresholdDbfs: number().optional()
7396
- });
7397
7385
  /**
7398
7386
  * Per-device retention overrides. Every field is optional; an unset or `0`
7399
7387
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7427,40 +7415,28 @@ var ScrubThumbnailPresetSchema = _enum([
7427
7415
  /**
7428
7416
  * The full per-camera recording intent — the wire shape of a RecordingTarget.
7429
7417
  *
7430
- * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
7431
- * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
7432
- * only for transition + migration (`migrateRulesToMode`); the policy engine
7433
- * consumes the compiled output of `compileRules(config)`, never `rules` directly.
7418
+ * `bands` is the ONLY authored recording intent: what to record, when, and on
7419
+ * which trigger. `mode` is a derived summary the recorder stamps on save; every
7420
+ * other field is a storage knob (profiles, segment length, retention, scrub).
7421
+ *
7422
+ * STRICT on purpose: the legacy authoring surface (`schedule`/`schedules`/
7423
+ * `triggers`/`preBufferSec`/`postBufferSec`/`rules`) was retired 2026-07-30.
7424
+ * A stale caller must fail loudly — silently stripping its legacy intent would
7425
+ * persist a band-less config, i.e. silently stop recording the camera.
7434
7426
  */
7435
7427
  var RecordingConfigSchema = object({
7436
7428
  enabled: boolean(),
7437
- /** Authoritative storage mode. Absent on legacy targets derived once via
7438
- * `migrateRulesToMode`, then persisted. */
7429
+ /** DERIVED summary of `bands`, stamped by the recorder on every save.
7430
+ * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7439
7431
  mode: RecordingStorageModeSchema.optional(),
7440
7432
  profiles: array(CamProfileSchema).optional(),
7441
7433
  segmentSeconds: number().int().positive().optional(),
7442
- /** Shared recording time-bands for `events` & `continuous` — record only when
7443
- * the wall-clock falls inside one of these windows. Omit or empty = always.
7444
- * `continuous` compiles to one rule per band; `events` to band × trigger. */
7445
- schedules: array(RecordingScheduleSchema).optional(),
7446
- /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
7447
- * normalized into `schedules` on read and never written going forward. (Not
7448
- * tagged `@deprecated`: the normalization paths must read it cast-free.) */
7449
- schedule: RecordingScheduleSchema.optional(),
7450
- /** `events`-mode only — which detectors trigger a recording. */
7451
- triggers: RecordingTriggersSchema.optional(),
7452
- /** `events`-mode only — seconds retained before / after a trigger. */
7453
- preBufferSec: number().min(0).optional(),
7454
- postBufferSec: number().min(0).optional(),
7455
- /** DEPRECATED authoring input; retained for migration/transition. */
7456
- rules: array(RecordingRuleSchema).optional(),
7457
7434
  /**
7458
- * AUTHORITATIVE mode-per-band recording model (recorder). When present it
7459
- * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
7460
- * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
7461
- * derived into bands once via `migrateConfigToBands`.
7435
+ * AUTHORITATIVE mode-per-band recording model the single source of truth
7436
+ * the recorder's band engine consumes. An empty array = record nothing;
7437
+ * "off" is the absence of a covering band, never a band value.
7462
7438
  */
7463
- bands: array(RecordingBandSchema).optional(),
7439
+ bands: array(RecordingBandSchema).default([]),
7464
7440
  retention: RecordingRetentionSchema.optional(),
7465
7441
  /**
7466
7442
  * Per-camera scrub-thumbnail fidelity preset (resolution + JPEG quality for
@@ -7468,8 +7444,15 @@ var RecordingConfigSchema = object({
7468
7444
  * windows only — existing sheets are immutable, and each window's index
7469
7445
  * carries its own tile dims so mixed-preset history renders correctly.
7470
7446
  */
7471
- scrubThumbnails: ScrubThumbnailPresetSchema.optional()
7472
- });
7447
+ scrubThumbnails: ScrubThumbnailPresetSchema.optional(),
7448
+ /**
7449
+ * OPT-IN thumbnail-strip generation for this camera: every keyframe of the
7450
+ * low recording saved as a JPEG (the fast-drag scrub depth), a derived
7451
+ * cache that eviction reclaims with the footage. Absent/false = no strips
7452
+ * are written and scrub reads exact keyframes at every velocity.
7453
+ */
7454
+ stripsEnabled: boolean().optional()
7455
+ }).strict();
7473
7456
  /**
7474
7457
  * Ops-log — the durable, append-only operations audit shared by the
7475
7458
  * recordings and events management surfaces.
@@ -7488,7 +7471,8 @@ var OpsLogOpSchema = _enum([
7488
7471
  "prune",
7489
7472
  "manual-delete",
7490
7473
  "rescan",
7491
- "retention-run"
7474
+ "retention-run",
7475
+ "relocate"
7492
7476
  ]);
7493
7477
  /** Why the operation ran. */
7494
7478
  var OpsLogReasonSchema = _enum([
@@ -7527,6 +7511,55 @@ var OpsLogQueryInputSchema = object({
7527
7511
  limit: number().int().min(1).max(1e3).optional()
7528
7512
  });
7529
7513
  /**
7514
+ * Entity-relocation job state (storage entity-routing spec, Phase 4).
7515
+ *
7516
+ * One shape shared by the recorder's `relocateFootage` (segments + strips) and
7517
+ * pipeline-analytics' `relocateMedia` (event media blobs) so the admin Data
7518
+ * page renders both movers with one component. Jobs are in-RAM (a restart
7519
+ * forgets them — re-running is safe by construction: copy-if-absent, delete
7520
+ * after verify) and each completed/failed run also lands one durable ops-log
7521
+ * row on the owning addon's surface.
7522
+ */
7523
+ var RelocateJobStateSchema = _enum([
7524
+ "running",
7525
+ "done",
7526
+ "failed",
7527
+ "cancelled"
7528
+ ]);
7529
+ var RelocateJobSchema = object({
7530
+ jobId: string(),
7531
+ state: RelocateJobStateSchema,
7532
+ /** Source location — for media relocation this is informational ('*': rows
7533
+ * move from wherever they are to the target). */
7534
+ fromLocationId: string(),
7535
+ toLocationId: string(),
7536
+ /** Scoped device, or null = every device. */
7537
+ deviceId: number().nullable(),
7538
+ /** What the job moves (owner-addon specific: segments/strips or media). */
7539
+ entities: array(string()),
7540
+ filesMoved: number().int(),
7541
+ bytesMoved: number().int(),
7542
+ /** Total files discovered up front; null while (or when) unknown. */
7543
+ filesTotal: number().int().nullable(),
7544
+ startedAt: number(),
7545
+ finishedAt: number().nullable(),
7546
+ error: string().nullable()
7547
+ });
7548
+ var RelocateFootageInputSchema = object({
7549
+ deviceId: number().optional(),
7550
+ fromLocationId: string(),
7551
+ toLocationId: string(),
7552
+ entities: array(_enum(["segments", "strips"])).optional(),
7553
+ /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7554
+ * never allowed to starve live writers. */
7555
+ throttleMbps: number().min(1).max(1e3).optional()
7556
+ });
7557
+ var RelocateMediaInputSchema = object({
7558
+ deviceId: number().optional(),
7559
+ toLocationId: string(),
7560
+ throttleMbps: number().min(1).max(1e3).optional()
7561
+ });
7562
+ /**
7530
7563
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7531
7564
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7532
7565
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -7576,6 +7609,13 @@ var StorageLocationSchema = object({
7576
7609
  nodeId: string().optional(),
7577
7610
  isDefault: boolean().default(false),
7578
7611
  isSystem: boolean().default(false),
7612
+ /** COMPUTED at read time by the orchestrator (statfs of the backing volume
7613
+ * for node-local locations it can reach) — never persisted, absent when the
7614
+ * volume is remote/unreachable. The single capacity truth every UI reads. */
7615
+ capacity: object({
7616
+ totalBytes: number(),
7617
+ availableBytes: number()
7618
+ }).nullable().optional(),
7579
7619
  createdAt: number(),
7580
7620
  updatedAt: number()
7581
7621
  });
@@ -8343,7 +8383,8 @@ var NcTaxonomyEntrySchema = object({
8343
8383
  /** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
8344
8384
  parentKind: string().nullable()
8345
8385
  });
8346
- object({
8386
+ /** The complete NC picker taxonomy — three grouped buckets. */
8387
+ var NcTaxonomySchema = object({
8347
8388
  videoClasses: array(NcTaxonomyEntrySchema),
8348
8389
  audioKinds: array(NcTaxonomyEntrySchema),
8349
8390
  labels: array(NcTaxonomyEntrySchema)
@@ -9309,9 +9350,20 @@ var DEGRADE_ORDER = {
9309
9350
  "markdown"
9310
9351
  ]
9311
9352
  };
9312
- /** Pick the best target format the kind supports for a given source format. */
9353
+ /**
9354
+ * Pick the best target format the kind supports for a given source format.
9355
+ *
9356
+ * TOLERANT of a source outside the union. `NotificationSchema.format` carries
9357
+ * `.default('text')`, but that default only runs where the schema is PARSED —
9358
+ * the tRPC router. A cap call arriving from another addon (`ctx.api`) skips
9359
+ * that parse, so `format` reaches here `undefined`, and the bare
9360
+ * `DEGRADE_ORDER[source]` threw `is not iterable`. That broke the one promise
9361
+ * the degrade path makes ("never throws — degradation is reported, never
9362
+ * surfaced as an error") and dead-lettered every Notification-Center delivery
9363
+ * for a day (2026-07-30). An unknown source degrades like `text`.
9364
+ */
9313
9365
  function resolveFormat(source, supported) {
9314
- for (const candidate of DEGRADE_ORDER[source]) if (supported.includes(candidate)) return candidate;
9366
+ for (const candidate of DEGRADE_ORDER[source] ?? DEGRADE_ORDER.text) if (supported.includes(candidate)) return candidate;
9315
9367
  return supported[0] ?? "text";
9316
9368
  }
9317
9369
  /** Transcode a body between formats. */
@@ -9356,7 +9408,7 @@ function resolveLevel(levels, n) {
9356
9408
  })[0]);
9357
9409
  }
9358
9410
  function splitBody(body, maxLen) {
9359
- if (maxLen <= 0 || body.length <= maxLen) return [body];
9411
+ if (!Number.isFinite(maxLen) || maxLen <= 0 || body.length <= maxLen) return [body];
9360
9412
  const parts = [];
9361
9413
  for (let i = 0; i < body.length; i += maxLen) parts.push(body.slice(i, i + maxLen));
9362
9414
  return parts;
@@ -9439,6 +9491,7 @@ function prepareNotification(caps, n) {
9439
9491
  renderedAs
9440
9492
  };
9441
9493
  }
9494
+ new Set(["devices", "classes"]);
9442
9495
  /**
9443
9496
  * Shared geometry vocabulary for on-frame shape caps — privacy-mask,
9444
9497
  * motion-zones, and the detection zones/lines editor all speak this one
@@ -9597,6 +9650,29 @@ var NcOccupancyConditionSchema = object({
9597
9650
  count: number().int().min(0).default(1),
9598
9651
  sustainSeconds: number().int().min(0).max(3600).default(15)
9599
9652
  });
9653
+ /**
9654
+ * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
9655
+ *
9656
+ * The values are not symmetric, and deliberately so — the absent value has to
9657
+ * mean exactly what every rule authored before this condition existed already
9658
+ * does:
9659
+ * - `enter` — entries and every NON-crossing record (movement state,
9660
+ * package, sensor). Exits are rejected. **This is the absent behaviour**:
9661
+ * an operator who never asked for exits must not start receiving them.
9662
+ * - `exit` — ONLY an exit crossing. A record that is not a crossing at all
9663
+ * fails closed, because "the car left the drive" is a question about a
9664
+ * boundary, not about a detection.
9665
+ * - `any` — no direction filter; entries, exits and non-crossings alike.
9666
+ *
9667
+ * A rule asking for a direction should normally also scope `zones`, which the
9668
+ * engine evaluates against the crossed zone as well as the current membership
9669
+ * (an exit's membership no longer contains the zone it just left).
9670
+ */
9671
+ var NcCrossingSchema = _enum([
9672
+ "enter",
9673
+ "exit",
9674
+ "any"
9675
+ ]);
9600
9676
  /** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
9601
9677
  var NcZoneConditionSchema = object({
9602
9678
  ids: array(string().min(1)).min(1),
@@ -9621,6 +9697,13 @@ var NcConditionsSchema = object({
9621
9697
  /** Veto zones — any hit fails the rule. */
9622
9698
  zonesExclude: array(string().min(1)).optional(),
9623
9699
  /**
9700
+ * Zone-crossing direction. IMMEDIATE only — a crossing is a per-event fact
9701
+ * and a closed track carries none, so a `track-end` rule asking for one
9702
+ * fails closed (use `zones`, which tests `zonesVisited`). ABSENT = `enter`,
9703
+ * which is exactly today's behaviour. See {@link NcCrossingSchema}.
9704
+ */
9705
+ crossing: NcCrossingSchema.optional(),
9706
+ /**
9624
9707
  * Exact (case-insensitive) match on the record's collapsed `label`
9625
9708
  * (identity name / plate text / subclass).
9626
9709
  */
@@ -9755,17 +9838,85 @@ var NcRuleTargetSchema = object({
9755
9838
  * - `keyFrame` — the clean scene frame (no subject box).
9756
9839
  * - `none` — no attachment.
9757
9840
  */
9758
- var NcMediaPolicySchema = object({ attach: _enum([
9759
- "best",
9760
- "best-matching",
9761
- "keyFrame",
9762
- "none"
9763
- ]).default("best") });
9841
+ /**
9842
+ * WHAT THE PICTURE SHOWS — chosen explicitly, because the implicit ladders
9843
+ * conflate it with the selection strategy and betray the request: asking for
9844
+ * the clean scene frame on an object-event owner used to start at
9845
+ * `fullFrameBoxed`, i.e. the annotated frame (2026-07-30).
9846
+ * - `cropped` — the subject, tight. What "who is at the door" wants.
9847
+ * - `full` — the clean scene, no annotation. What "what is going on" wants.
9848
+ * - `boxed` — the scene WITH the detection boxes drawn, for verifying what
9849
+ * the pipeline actually saw.
9850
+ */
9851
+ var NcMediaFrameSchema = _enum([
9852
+ "cropped",
9853
+ "full",
9854
+ "boxed"
9855
+ ]);
9856
+ var NcMediaPolicySchema = object({
9857
+ attach: _enum([
9858
+ "best",
9859
+ "best-matching",
9860
+ "keyFrame",
9861
+ "none"
9862
+ ]).default("best"),
9863
+ /** What the still shows. Absent = `cropped` (the historical `best` shape). */
9864
+ frame: NcMediaFrameSchema.optional(),
9865
+ /** Crop the attached still to the rule's condition-zone bbox (padded) —
9866
+ * "show me the ZONE", not the whole scene or the subject crop. */
9867
+ zoneCrop: boolean().optional(),
9868
+ /**
9869
+ * Also attach a short GIF cut from the stream broker's clip ring around the
9870
+ * event — NOT from the recording, so the camera does not have to be
9871
+ * recording, and the window sits AROUND the moment instead of a segment
9872
+ * behind it. Fail-closed: a window the ring does not cover contributes no
9873
+ * gif, never a failed notification.
9874
+ */
9875
+ gif: boolean().optional(),
9876
+ /**
9877
+ * Also attach a short MP4 CLIP of the same cut. Same source and the same
9878
+ * fail-closed rule as `gif`. Prefer it where the backend takes video
9879
+ * (telegram, discord, zentik, webhook); backends that do not are handled by
9880
+ * the degrade engine, which drops the video and keeps the still.
9881
+ */
9882
+ clip: boolean().optional(),
9883
+ /** Seconds of footage BEFORE / AFTER the event instant. Defaults 3 / 7. */
9884
+ clipPreRollSec: number().int().min(0).max(30).optional(),
9885
+ clipPostRollSec: number().int().min(0).max(30).optional(),
9886
+ /**
9887
+ * Which stream profile the footage is cut from. Absent = the CHEAPEST
9888
+ * assigned profile: a notification is watched on a phone, so the 4K
9889
+ * rendition would burn CPU to produce a file the client downscales anyway.
9890
+ * A profile that is not assigned falls back to the cheapest, and the render
9891
+ * reports which one actually ran.
9892
+ */
9893
+ profile: CamProfileSchema.optional()
9894
+ });
9895
+ /**
9896
+ * Cooldown GRANULARITY over the subject's class — how much a fired
9897
+ * notification suppresses.
9898
+ * - `shared` (default, and the absent value) — one window for the whole
9899
+ * rule/scope: a cat silences the next dog for `cooldownSec`.
9900
+ * - `per-class` — an independent window per detected class, so cat→dog fires
9901
+ * at once and cat→cat still waits.
9902
+ *
9903
+ * AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
9904
+ * must not be swallowed by a bark's window (the precedent this generalizes —
9905
+ * see `cooldownKey` in the rule engine).
9906
+ */
9907
+ var NcThrottleGranularitySchema = _enum(["shared", "per-class"]);
9764
9908
  /** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
9765
9909
  var NcThrottleSchema = object({
9766
9910
  cooldownSec: number().int().min(0).max(86400).default(60),
9767
9911
  /** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
9768
- scope: _enum(["rule", "rule-device"]).default("rule-device")
9912
+ scope: _enum(["rule", "rule-device"]).default("rule-device"),
9913
+ /**
9914
+ * Class granularity of the cooldown key. Optional rather than defaulted:
9915
+ * a Zod default does NOT run on the addon→addon cap path, so a persisted
9916
+ * rule authored before this field simply carries none — and the engine
9917
+ * reads absent as `shared`, the pre-existing behaviour.
9918
+ */
9919
+ granularity: NcThrottleGranularitySchema.optional()
9769
9920
  });
9770
9921
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
9771
9922
  var NcRuleInputSchema = object({
@@ -9774,7 +9925,19 @@ var NcRuleInputSchema = object({
9774
9925
  delivery: NcDeliverySchema,
9775
9926
  conditions: NcConditionsSchema.default({}),
9776
9927
  schedule: NcScheduleSchema.optional(),
9777
- targets: array(NcRuleTargetSchema).min(1),
9928
+ /** May be empty when `targetUsers` addresses at least one user — the
9929
+ * "at least one addressee" invariant is enforced by the provider, because
9930
+ * a cross-field refine here would break `NcRulePatchSchema.partial()`. */
9931
+ targets: array(NcRuleTargetSchema),
9932
+ /**
9933
+ * USERS this rule addresses in addition to `targets` (Phase 4). At fire
9934
+ * time each user fans out to the personal targets they own
9935
+ * (`config.ownerUserId`), filtered by that user's `allowedDevices` for the
9936
+ * firing camera — a user is never notified about a device they cannot open.
9937
+ * Per-user opt-outs (`disabledTargetIds`) still apply to the fanned-out
9938
+ * targets.
9939
+ */
9940
+ targetUsers: array(string()).optional(),
9778
9941
  media: NcMediaPolicySchema.default({ attach: "best" }),
9779
9942
  throttle: NcThrottleSchema.default({
9780
9943
  cooldownSec: 60,
@@ -9861,6 +10024,7 @@ var NcConditionDescriptorSchema = object({
9861
10024
  "schedule",
9862
10025
  "plateMatcher",
9863
10026
  "packagePhase",
10027
+ "crossingSelect",
9864
10028
  "polygonDraw",
9865
10029
  "occupancy"
9866
10030
  ]),
@@ -9987,7 +10151,10 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
9987
10151
  }), object({ results: array(NcTestResultSchema) }), {
9988
10152
  kind: "mutation",
9989
10153
  auth: "admin"
9990
- }), method(object({}), object({ catalog: array(NcConditionDescriptorSchema) })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
10154
+ }), method(object({}), object({
10155
+ catalog: array(NcConditionDescriptorSchema),
10156
+ taxonomy: NcTaxonomySchema.optional()
10157
+ })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" });
9991
10158
  /**
9992
10159
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
9993
10160
  *
@@ -10996,6 +11163,28 @@ method(object({
10996
11163
  }), object({ success: literal(true) }), {
10997
11164
  kind: "mutation",
10998
11165
  auth: "admin"
11166
+ }), method(object({
11167
+ deviceId: number(),
11168
+ /** Absent = the LOWEST assigned profile — a notification attachment is
11169
+ * watched on a phone, and the cheap rendition is the right default. */
11170
+ profile: CamProfileSchema.optional(),
11171
+ aroundMs: number(),
11172
+ preRollSec: number().min(0).max(20).default(3),
11173
+ postRollSec: number().min(0).max(20).default(5),
11174
+ format: _enum(["gif", "mp4"]).default("gif"),
11175
+ maxWidth: number().int().min(120).max(1920).default(480),
11176
+ /** GIF only — MP4 keeps the source cadence. */
11177
+ fps: number().int().min(1).max(15).default(5)
11178
+ }), object({
11179
+ base64: string(),
11180
+ mime: string(),
11181
+ bytes: number().int(),
11182
+ /** The profile actually rendered (what the default resolved to). */
11183
+ profile: CamProfileSchema,
11184
+ durationMs: number()
11185
+ }), {
11186
+ kind: "mutation",
11187
+ auth: "admin"
10999
11188
  }), method(_void(), array(CameraStreamSchema).readonly()), method(_void(), array(ProfileSlotSchema).readonly()), method(object({ brokerId: string() }), BrokerStatsSchema), method(object({ brokerId: string() }), object({
11000
11189
  probed: boolean(),
11001
11190
  summary: string()
@@ -19188,7 +19377,10 @@ method(object({
19188
19377
  }), method(object({
19189
19378
  deviceId: number(),
19190
19379
  caps: array(string()).readonly().optional()
19191
- }), record(string(), unknown().nullable()));
19380
+ }), record(string(), unknown().nullable())), method(object({
19381
+ deviceIds: array(number()).readonly(),
19382
+ caps: array(string()).readonly().optional()
19383
+ }), record(string(), record(string(), unknown().nullable())));
19192
19384
  method(object({ deviceId: number() }), record(string(), record(string(), unknown()))), method(object({
19193
19385
  deviceId: number(),
19194
19386
  capName: string()
@@ -20119,6 +20311,36 @@ var TargetKindSchema = object({
20119
20311
  icon: string(),
20120
20312
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
20121
20313
  addonId: string(),
20314
+ /**
20315
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
20316
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
20317
+ * when the addon bundles no icon for that kind — the client then falls back
20318
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
20319
+ *
20320
+ * Root-relative on purpose: it resolves against whatever origin serves a web
20321
+ * client, and a native client joins it onto its own hub base.
20322
+ *
20323
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
20324
+ * field that survived only because the runtime cap-router forwards provider
20325
+ * output verbatim — so every consumer had to re-declare it by hand to stop
20326
+ * its own Zod parse from stripping it, and the whole arrangement would have
20327
+ * broken silently the moment output validation was tightened anywhere.
20328
+ */
20329
+ iconUrl: string().optional(),
20330
+ /**
20331
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
20332
+ *
20333
+ * The server knows this and therefore says it, because the client cannot
20334
+ * safely guess: a React-Native client renders SVG and raster through two
20335
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
20336
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
20337
+ * placeholder glyph for every vector icon while the web build looked fine.
20338
+ *
20339
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
20340
+ * not been updated — a client that cannot determine the type should prefer
20341
+ * its raster path, which is the safe default for an unknown image.
20342
+ */
20343
+ iconMediaType: string().optional(),
20122
20344
  configSchema: ConfigSchemaPassthrough,
20123
20345
  supportsDiscovery: boolean(),
20124
20346
  caps: TargetKindCapsSchema
@@ -20580,6 +20802,29 @@ var MotionEventSchema = object({
20580
20802
  * Absent on legacy rows ⇒ treat as `pipeline`.
20581
20803
  */
20582
20804
  var DetectionSourceSchema = _enum(["pipeline", "onboard"]);
20805
+ /**
20806
+ * The confirmed zone crossing that produced an object event. Present ONLY on
20807
+ * an event emitted BY a crossing (`zone.enter` / `zone.exit`); a movement-state
20808
+ * event (`object.entering` / `leaving` / `stationary` / `loitering`) and an
20809
+ * appearance event carry none, so a rule asking for a direction fails closed
20810
+ * on them.
20811
+ *
20812
+ * Exactly ONE crossing per event: the emitter turns each confirmed crossing
20813
+ * into its own event, so a frame in which a track enters A while leaving B
20814
+ * produces two events with two directions — never one ambiguous row.
20815
+ *
20816
+ * `zoneId` is load-bearing for an EXIT: the event's `zones` list is the
20817
+ * membership the box has NOW, and by definition it no longer contains the zone
20818
+ * that was just left. Without the id here, a zone-scoped rule could never match
20819
+ * the exit it asked for.
20820
+ */
20821
+ var ZoneCrossingSchema = object({
20822
+ direction: _enum(["enter", "exit"]),
20823
+ /** Admin zone id crossed. */
20824
+ zoneId: string(),
20825
+ /** Zone display name at crossing time (falls back to the id). */
20826
+ zoneName: string().optional()
20827
+ });
20583
20828
  var ObjectEventSchema = object({
20584
20829
  ...BaseEventFields,
20585
20830
  kind: literal("object"),
@@ -20606,6 +20851,12 @@ var ObjectEventSchema = object({
20606
20851
  zones: array(string()).readonly().optional(),
20607
20852
  /** Omitted in slim projection. */
20608
20853
  state: TrackStateSchema.optional(),
20854
+ /**
20855
+ * The zone crossing this event IS, when it is one. Absent on every other
20856
+ * event kind (movement state, appearance, package) — see
20857
+ * {@link ZoneCrossingSchema}. Omitted in slim projection.
20858
+ */
20859
+ zoneCrossing: ZoneCrossingSchema.optional(),
20609
20860
  /** Detection-frame dimensions in pixels — let consumers normalize the
20610
20861
  * pixel-space `bbox` onto a displayed image. Omitted in slim projection. */
20611
20862
  frameWidth: number().optional(),
@@ -20864,6 +21115,15 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20864
21115
  }), method(object({ deviceId: number() }), EventPruneCountsSchema, {
20865
21116
  kind: "mutation",
20866
21117
  auth: "admin"
21118
+ }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
21119
+ kind: "mutation",
21120
+ auth: "admin"
21121
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
21122
+ kind: "query",
21123
+ auth: "admin"
21124
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21125
+ kind: "mutation",
21126
+ auth: "admin"
20867
21127
  }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
20868
21128
  kind: "query",
20869
21129
  auth: "admin"
@@ -23432,6 +23692,17 @@ var GetConnectionEndpointsResultSchema = object({ endpoints: array(object({
23432
23692
  */
23433
23693
  priority: number()
23434
23694
  })).readonly() });
23695
+ /**
23696
+ * The chosen outbound endpoint for notification artifacts. `baseUrl: null` =
23697
+ * AUTO (resolved from the candidate ranking at send time); `resolved` reports
23698
+ * what AUTO currently picks, so the UI can show the effective value either way.
23699
+ */
23700
+ var NotificationEndpointSchema = object({
23701
+ /** The operator's explicit choice, or null for AUTO. */
23702
+ baseUrl: string().nullable(),
23703
+ /** What the ranking currently resolves to (null when nothing is reachable). */
23704
+ resolved: string().nullable()
23705
+ });
23435
23706
  var AllowedAddressesSchema = object({
23436
23707
  /**
23437
23708
  * Allowlist of interface addresses operators have explicitly opted
@@ -23454,7 +23725,7 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
23454
23725
  * to avoid mixed-content blocks in the browser. The public
23455
23726
  * tunnel always emits `https://` regardless. */
23456
23727
  scheme: _enum(["http", "https"]).optional()
23457
- }), GetConnectionEndpointsResultSchema), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" });
23728
+ }), GetConnectionEndpointsResultSchema), method(_void(), NotificationEndpointSchema), method(object({ baseUrl: string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" });
23458
23729
  /**
23459
23730
  * mesh-network — collection cap for mesh-VPN providers.
23460
23731
  *
@@ -24253,7 +24524,12 @@ var RecordingDeviceUsageSchema = object({
24253
24524
  var RecordingLocationUsageSchema = object({
24254
24525
  /** StorageLocation id; null for the legacy/degraded single-root fallback. */
24255
24526
  locationId: string().nullable(),
24256
- /** Bytes of recordings stored on this location. */
24527
+ /** Every location id sharing this row's PHYSICAL volume (aliases). One row
24528
+ * is emitted per physical disk (2026-07-29): two locations on one root
24529
+ * previously rendered as two identical "disks" with a nonsensical used
24530
+ * split — hydrate attribution across aliases is arbitrary by nature. */
24531
+ locationIds: array(string()).optional(),
24532
+ /** Bytes of recordings stored on this PHYSICAL volume (all aliases). */
24257
24533
  usedBytes: number(),
24258
24534
  /** Free bytes on the location's volume; null when capacity is unknown (remote). */
24259
24535
  availableBytes: number().nullable(),
@@ -24365,6 +24641,44 @@ method(object({
24365
24641
  }), method(OpsLogQueryInputSchema, array(OpsLogEntrySchema).readonly(), {
24366
24642
  kind: "query",
24367
24643
  auth: "admin"
24644
+ }), method(object({
24645
+ deviceId: number(),
24646
+ aroundMs: number(),
24647
+ preRollSec: number().min(0).max(30).default(2),
24648
+ postRollSec: number().min(0).max(30).default(5),
24649
+ maxWidth: number().int().min(120).max(1280).default(480),
24650
+ fps: number().int().min(1).max(15).default(5)
24651
+ }), object({
24652
+ gifBase64: string(),
24653
+ fromMs: number(),
24654
+ toMs: number()
24655
+ }), {
24656
+ kind: "mutation",
24657
+ auth: "admin"
24658
+ }), method(object({
24659
+ deviceId: number(),
24660
+ aroundMs: number(),
24661
+ preRollSec: number().min(0).max(30).default(3),
24662
+ postRollSec: number().min(0).max(30).default(7),
24663
+ maxWidth: number().int().min(160).max(1920).default(640)
24664
+ }), object({
24665
+ clipBase64: string(),
24666
+ mime: string(),
24667
+ fromMs: number(),
24668
+ toMs: number(),
24669
+ bytes: number().int()
24670
+ }), {
24671
+ kind: "mutation",
24672
+ auth: "admin"
24673
+ }), method(RelocateFootageInputSchema, object({ jobId: string() }), {
24674
+ kind: "mutation",
24675
+ auth: "admin"
24676
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
24677
+ kind: "query",
24678
+ auth: "admin"
24679
+ }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
24680
+ kind: "mutation",
24681
+ auth: "admin"
24368
24682
  });
24369
24683
  /**
24370
24684
  * `recordingExport` cap — render a footage time range into a single downloadable
@@ -25956,6 +26270,12 @@ Object.freeze({
25956
26270
  addonId: null,
25957
26271
  access: "view"
25958
26272
  },
26273
+ "deviceManager.getDeviceStatusAggregateBatch": {
26274
+ capName: "device-manager",
26275
+ capScope: "system",
26276
+ addonId: null,
26277
+ access: "view"
26278
+ },
25959
26279
  "deviceManager.getLinkedDevices": {
25960
26280
  capName: "device-manager",
25961
26281
  capScope: "system",
@@ -26850,6 +27170,12 @@ Object.freeze({
26850
27170
  addonId: null,
26851
27171
  access: "view"
26852
27172
  },
27173
+ "localNetwork.getNotificationEndpoint": {
27174
+ capName: "local-network",
27175
+ capScope: "system",
27176
+ addonId: null,
27177
+ access: "view"
27178
+ },
26853
27179
  "localNetwork.getPreferred": {
26854
27180
  capName: "local-network",
26855
27181
  capScope: "system",
@@ -26874,6 +27200,12 @@ Object.freeze({
26874
27200
  addonId: null,
26875
27201
  access: "create"
26876
27202
  },
27203
+ "localNetwork.setNotificationEndpoint": {
27204
+ capName: "local-network",
27205
+ capScope: "system",
27206
+ addonId: null,
27207
+ access: "create"
27208
+ },
26877
27209
  "lockControl.lock": {
26878
27210
  capName: "lock-control",
26879
27211
  capScope: "device",
@@ -27516,6 +27848,12 @@ Object.freeze({
27516
27848
  addonId: null,
27517
27849
  access: "create"
27518
27850
  },
27851
+ "pipelineAnalytics.cancelMediaRelocate": {
27852
+ capName: "pipeline-analytics",
27853
+ capScope: "device",
27854
+ addonId: null,
27855
+ access: "create"
27856
+ },
27519
27857
  "pipelineAnalytics.clearTracks": {
27520
27858
  capName: "pipeline-analytics",
27521
27859
  capScope: "device",
@@ -27570,6 +27908,12 @@ Object.freeze({
27570
27908
  addonId: null,
27571
27909
  access: "view"
27572
27910
  },
27911
+ "pipelineAnalytics.getMediaRelocateStatus": {
27912
+ capName: "pipeline-analytics",
27913
+ capScope: "device",
27914
+ addonId: null,
27915
+ access: "view"
27916
+ },
27573
27917
  "pipelineAnalytics.getMotionEvents": {
27574
27918
  capName: "pipeline-analytics",
27575
27919
  capScope: "device",
@@ -27642,6 +27986,12 @@ Object.freeze({
27642
27986
  addonId: null,
27643
27987
  access: "create"
27644
27988
  },
27989
+ "pipelineAnalytics.relocateMedia": {
27990
+ capName: "pipeline-analytics",
27991
+ capScope: "device",
27992
+ addonId: null,
27993
+ access: "create"
27994
+ },
27645
27995
  "pipelineAnalytics.searchObjectEvents": {
27646
27996
  capName: "pipeline-analytics",
27647
27997
  capScope: "device",
@@ -28404,6 +28754,12 @@ Object.freeze({
28404
28754
  addonId: null,
28405
28755
  access: "create"
28406
28756
  },
28757
+ "recording.cancelRelocate": {
28758
+ capName: "recording",
28759
+ capScope: "system",
28760
+ addonId: null,
28761
+ access: "create"
28762
+ },
28407
28763
  "recording.deleteFootprint": {
28408
28764
  capName: "recording",
28409
28765
  capScope: "system",
@@ -28434,6 +28790,12 @@ Object.freeze({
28434
28790
  addonId: null,
28435
28791
  access: "view"
28436
28792
  },
28793
+ "recording.getRelocateStatus": {
28794
+ capName: "recording",
28795
+ capScope: "system",
28796
+ addonId: null,
28797
+ access: "view"
28798
+ },
28437
28799
  "recording.getStorageUsage": {
28438
28800
  capName: "recording",
28439
28801
  capScope: "system",
@@ -28464,6 +28826,24 @@ Object.freeze({
28464
28826
  addonId: null,
28465
28827
  access: "view"
28466
28828
  },
28829
+ "recording.relocateFootage": {
28830
+ capName: "recording",
28831
+ capScope: "system",
28832
+ addonId: null,
28833
+ access: "create"
28834
+ },
28835
+ "recording.renderClip": {
28836
+ capName: "recording",
28837
+ capScope: "system",
28838
+ addonId: null,
28839
+ access: "create"
28840
+ },
28841
+ "recording.renderGif": {
28842
+ capName: "recording",
28843
+ capScope: "system",
28844
+ addonId: null,
28845
+ access: "create"
28846
+ },
28467
28847
  "recording.rescanStorage": {
28468
28848
  capName: "recording",
28469
28849
  capScope: "system",
@@ -29058,6 +29438,12 @@ Object.freeze({
29058
29438
  addonId: null,
29059
29439
  access: "create"
29060
29440
  },
29441
+ "streamBroker.renderPreBufferClip": {
29442
+ capName: "stream-broker",
29443
+ capScope: "system",
29444
+ addonId: null,
29445
+ access: "create"
29446
+ },
29061
29447
  "streamBroker.restartProfile": {
29062
29448
  capName: "stream-broker",
29063
29449
  capScope: "system",
@@ -36053,6 +36439,17 @@ var HOME_ASSISTANT_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0
36053
36439
  * the admin UI is served from.
36054
36440
  */
36055
36441
  var HA_NOTIFICATION_ICON_URL = `/addon/${HA_ROUTE_ID}/icons/${HA_ICON_KIND}`;
36442
+ /**
36443
+ * Media type of {@link HA_NOTIFICATION_ICON_URL}, stamped onto the kind
36444
+ * descriptor beside the URL.
36445
+ *
36446
+ * Not decoration: a React-Native client renders SVG and raster through
36447
+ * DIFFERENT components (`react-native-svg` vs `expo-image`, and expo-image does
36448
+ * not decode SVG on iOS/Android), and it cannot infer the type from the URL
36449
+ * because the route path carries no file extension. Without this the viewer
36450
+ * treats the icon as raster and falls back to a placeholder glyph.
36451
+ */
36452
+ var HA_NOTIFICATION_ICON_MEDIA_TYPE = "image/svg+xml";
36056
36453
  /** The icon's identity bytes plus every content coding we may serve, computed
36057
36454
  * once at module load (the icon is immutable). */
36058
36455
  var HA_ICON_IDENTITY = Buffer.from(HOME_ASSISTANT_SVG, "utf8");
@@ -36489,10 +36886,14 @@ function createHaNotificationOutputProvider(deps) {
36489
36886
  }
36490
36887
  return {
36491
36888
  listTargetKinds: async () => {
36492
- return [deps.iconUrl !== void 0 ? {
36889
+ return [deps.iconUrl === void 0 ? descriptor : deps.iconMediaType !== void 0 ? {
36890
+ ...descriptor,
36891
+ iconUrl: deps.iconUrl,
36892
+ iconMediaType: deps.iconMediaType
36893
+ } : {
36493
36894
  ...descriptor,
36494
36895
  iconUrl: deps.iconUrl
36495
- } : descriptor];
36896
+ }];
36496
36897
  },
36497
36898
  listTargets: async () => {
36498
36899
  return (await store.list()).map((target) => ({
@@ -37076,6 +37477,7 @@ var HaProviderAddon = class HaProviderAddon extends BaseDeviceProvider {
37076
37477
  return createHaNotificationOutputProvider({
37077
37478
  addonId: this.ctx.id,
37078
37479
  iconUrl: HA_NOTIFICATION_ICON_URL,
37480
+ iconMediaType: HA_NOTIFICATION_ICON_MEDIA_TYPE,
37079
37481
  store,
37080
37482
  publish: async (brokerId, service, serviceData) => {
37081
37483
  await this.requireRegistry().publish(brokerId, {