@camstack/addon-provider-rtsp 1.2.20 → 1.2.21

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 +179 -44
  2. package/dist/addon.mjs +179 -44
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  let node_net = require("node:net");
25
25
  node_net = __toESM(node_net);
26
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
26
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
27
27
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
28
28
  EventCategory["SystemBoot"] = "system.boot";
29
29
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -40,9 +40,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
40
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
41
41
  /**
42
42
  * A newer addon or server-root package version was found by the
43
- * authoritative registry check. Emitted once per
44
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
45
- * polling of the same result is deduplicated by the checker.
43
+ * authoritative registry check. Emitted once when any observed
44
+ * `latestVersion` changes (or a package/node first appears behind);
45
+ * the payload carries the full currently-available list. Repeated
46
+ * polling of the same latests is silent.
46
47
  */
47
48
  EventCategory["UpdateAvailable"] = "update.available";
48
49
  /**
@@ -61,6 +62,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
61
62
  EventCategory["AddonInstalled"] = "addon.installed";
62
63
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
63
64
  EventCategory["AddonCrashed"] = "addon.crashed";
65
+ /**
66
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
67
+ *
68
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
69
+ * respawned"); this is the one that never resolves itself. Emitted exactly
70
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
71
+ * addons it hosted and the crash count that tripped the breaker.
72
+ *
73
+ * It exists because a runner marked terminally `failed` used to be SILENT:
74
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
75
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
76
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
77
+ * operator's phone told him. The Notification Center's system-event intake
78
+ * consumes this category and maps it to the `addon-crash-loop` kind.
79
+ */
80
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
64
81
  EventCategory["AddonError"] = "addon.error";
65
82
  EventCategory["AddonPageReady"] = "addon.page-ready";
66
83
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7604,6 +7621,10 @@ var RecordingBandSchema = object({
7604
7621
  preBufferSec: number().min(0).optional(),
7605
7622
  postBufferSec: number().min(0).optional()
7606
7623
  });
7624
+ ({
7625
+ preBufferSec: 10,
7626
+ postBufferSec: 30
7627
+ }).postBufferSec * 1e3;
7607
7628
  /**
7608
7629
  * Per-device retention overrides. Every field is optional; an unset or `0`
7609
7630
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7651,6 +7672,12 @@ var RecordingConfigSchema = object({
7651
7672
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7652
7673
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7653
7674
  mode: RecordingStorageModeSchema.optional(),
7675
+ /**
7676
+ * Which assigned broker slots to record. Absent / empty = {@link
7677
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7678
+ * camera's currently assigned slots — never `mid` unless the operator
7679
+ * picks it, and never a slot the broker has not assigned.
7680
+ */
7654
7681
  profiles: array(CamProfileSchema).optional(),
7655
7682
  segmentSeconds: number().int().positive().optional(),
7656
7683
  /**
@@ -7731,7 +7758,11 @@ var RelocateFootageInputSchema = object({
7731
7758
  profiles: array(string()).optional(),
7732
7759
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7733
7760
  * never allowed to starve live writers. */
7734
- throttleMbps: number().min(1).max(1e3).optional()
7761
+ throttleMbps: number().min(1).max(1e3).optional(),
7762
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7763
+ * pile. Used when a full drain is too expensive and the operator only
7764
+ * wants the recent window on the new disk. */
7765
+ sinceMs: number().int().optional()
7735
7766
  });
7736
7767
  /** Internal, lease-scoped participant operation. It is intentionally separate
7737
7768
  * from persistent recording settings: a migration never changes
@@ -14596,6 +14627,7 @@ var NcSystemEventKindSchema = _enum([
14596
14627
  "node-offline",
14597
14628
  "node-inference-unavailable",
14598
14629
  "detection-blind",
14630
+ "addon-crash-loop",
14599
14631
  "addon-update-available",
14600
14632
  "server-update-available",
14601
14633
  "alarm-triggered",
@@ -14603,6 +14635,9 @@ var NcSystemEventKindSchema = _enum([
14603
14635
  "alarm-disarmed",
14604
14636
  "alarm-arming",
14605
14637
  "alarm-arm-refused",
14638
+ "addon-updated",
14639
+ "server-updated",
14640
+ "export-completed",
14606
14641
  "camera-online",
14607
14642
  "camera-offline",
14608
14643
  "camera-disabled",
@@ -16496,13 +16531,19 @@ var RetrainStatusSchema = _enum([
16496
16531
  * "never marked" from "already trained" must read `retrainStatus`.
16497
16532
  *
16498
16533
  * `debug` does NOT pin; it is attention, not durability.
16534
+ *
16535
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16536
+ * A favourited track is skipped by retention the same way `staging` is, but
16537
+ * it does not enter `none|staging|trained` and has no staging budget.
16499
16538
  */
16500
16539
  var TrackFlagFields = {
16501
16540
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16502
16541
  * `'staging'`. */
16503
16542
  markForTrain: boolean().optional(),
16504
16543
  /** Operator marked this track for diagnostic attention. */
16505
- debug: boolean().optional()
16544
+ debug: boolean().optional(),
16545
+ /** Operator favourited this track. Pins it against pruning. */
16546
+ favourited: boolean().optional()
16506
16547
  };
16507
16548
  /**
16508
16549
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16527,6 +16568,7 @@ var TrackFlagsSchema = object({
16527
16568
  trackId: string(),
16528
16569
  markForTrain: boolean(),
16529
16570
  debug: boolean(),
16571
+ favourited: boolean(),
16530
16572
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16531
16573
  * a track row) because this shape is only ever produced by the write body,
16532
16574
  * which always knows it — and a surface that has just written needs to render
@@ -17159,6 +17201,12 @@ var TrackCascadeCountsSchema = object({
17159
17201
  /** Per-track CLIP search vectors removed (best-effort). */
17160
17202
  embeddings: number().int()
17161
17203
  });
17204
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17205
+ var DiskReconcileCountsSchema = object({
17206
+ mediaDropped: number().int(),
17207
+ tracks: number().int(),
17208
+ events: number().int()
17209
+ });
17162
17210
  /** Event-store footprint for one camera. */
17163
17211
  var EventStoreDeviceFootprintSchema = object({
17164
17212
  deviceId: number(),
@@ -17335,6 +17383,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17335
17383
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17336
17384
  kind: "mutation",
17337
17385
  auth: "admin"
17386
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17387
+ kind: "mutation",
17388
+ auth: "admin"
17338
17389
  }), method(object({
17339
17390
  deviceId: number(),
17340
17391
  trackIds: array(string()).min(1)
@@ -18885,6 +18936,24 @@ var CameraStatusDegradationSchema = object({
18885
18936
  *
18886
18937
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18887
18938
  */
18939
+ var DiskReconcileJobSchema = object({
18940
+ state: _enum([
18941
+ "idle",
18942
+ "running",
18943
+ "done",
18944
+ "error"
18945
+ ]),
18946
+ total: number().int().nonnegative(),
18947
+ completed: number().int().nonnegative(),
18948
+ currentDeviceId: number().int().nullable(),
18949
+ failed: array(number().int()).readonly(),
18950
+ mediaDropped: number().int().nonnegative(),
18951
+ tracks: number().int().nonnegative(),
18952
+ events: number().int().nonnegative(),
18953
+ startedAtMs: number().int().nullable(),
18954
+ finishedAtMs: number().int().nullable(),
18955
+ error: string().nullable()
18956
+ });
18888
18957
  var CameraStatusSchema = object({
18889
18958
  deviceId: number(),
18890
18959
  assignment: CameraAssignmentStatusSchema,
@@ -19116,7 +19185,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19116
19185
  }), CameraSwitchGroupSchema, {
19117
19186
  kind: "mutation",
19118
19187
  auth: "admin"
19119
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19188
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19189
+ kind: "mutation",
19190
+ auth: "admin"
19191
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19120
19192
  name: string(),
19121
19193
  description: string().optional(),
19122
19194
  config: CameraPipelineConfigSchema
@@ -20293,20 +20365,6 @@ var VectorStatsResultSchema = object({
20293
20365
  exact: boolean()
20294
20366
  });
20295
20367
  method(VectorDeclareIndexInputSchema, _void(), { kind: "mutation" }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, { kind: "mutation" }), method(VectorQueryInputSchema, VectorQueryResultSchema), method(VectorGetInputSchema, VectorGetResultSchema), method(VectorDeleteInputSchema, VectorDeleteResultSchema, { kind: "mutation" }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, { kind: "mutation" }), method(VectorStatsInputSchema, VectorStatsResultSchema);
20296
- /**
20297
- * `videoclips` — the unified, navigable-clip surface for a camera.
20298
- *
20299
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20300
- * provider per device, substitutable. The DEFAULT provider (registered by
20301
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20302
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20303
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20304
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20305
- * wrapper provider for its device and serve its own clip catalog + URLs.
20306
- *
20307
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20308
- * temporal overlap, so the API never decides `continuous` vs `events`.
20309
- */
20310
20368
  var ClipSchema = object({
20311
20369
  /** Opaque, provider-namespaced id. The default provider encodes the time
20312
20370
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20323,8 +20381,57 @@ var ClipSchema = object({
20323
20381
  startMs: number(),
20324
20382
  endMs: number()
20325
20383
  }),
20326
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20327
- thumbnail: string().optional()
20384
+ /**
20385
+ * Lazy thumbnail URL, never inlined.
20386
+ *
20387
+ * Recording-derived clips (events-mode keep-window, and the prepared
20388
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20389
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20390
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20391
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20392
+ * mint their own stills.
20393
+ *
20394
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20395
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20396
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20397
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20398
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20399
+ * A read that FAILS drops the claim; it never invents it.
20400
+ */
20401
+ thumbnail: string().optional(),
20402
+ /**
20403
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20404
+ * can be decoded. Present whenever the visit came from recorded availability;
20405
+ * absent on a per-event padded window (there is no footage to promise).
20406
+ *
20407
+ * This is not a thumbnail and not a second byte path: it is the argument to
20408
+ * the recorder's existing still route. The surface — never the provider —
20409
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20410
+ * contiguous range, not of the visit: a visit spans its holes by
20411
+ * construction, so a naive midpoint lands in dead air.
20412
+ */
20413
+ stillAtMs: number().optional(),
20414
+ /**
20415
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20416
+ * first within kind (object → motion → audio), capped at
20417
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20418
+ *
20419
+ * Bounded because it is not a payload the surface pages through: one visit on
20420
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20421
+ * camera-day. Read {@link eventCount} for the true total.
20422
+ */
20423
+ eventIds: array(string()).optional(),
20424
+ /** How many analytics events actually overlap this visit. Differs from
20425
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20426
+ * list is never mistaken for a quiet visit. */
20427
+ eventCount: number().int().nonnegative().optional(),
20428
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20429
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20430
+ * bar keeps showing them via `recording.getAvailability`. */
20431
+ holes: array(object({
20432
+ startMs: number(),
20433
+ endMs: number()
20434
+ })).optional()
20328
20435
  });
20329
20436
  var ClipPlaybackSchema = object({
20330
20437
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20788,7 +20895,14 @@ var SearchResultSchema = object({
20788
20895
  });
20789
20896
  var AutoUpdateSettingsSchema = object({
20790
20897
  channel: ChannelSchema,
20791
- intervalSeconds: number()
20898
+ intervalSeconds: number(),
20899
+ /**
20900
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20901
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20902
+ * about a publish and installing it are different decisions. Clamped
20903
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20904
+ */
20905
+ updateCheckIntervalSeconds: number()
20792
20906
  });
20793
20907
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20794
20908
  var RestartAddonResultSchema = unknown();
@@ -20929,7 +21043,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20929
21043
  auth: "admin"
20930
21044
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20931
21045
  channel: ChannelSchema,
20932
- intervalSeconds: number().min(300).max(86400).optional()
21046
+ intervalSeconds: number().min(300).max(86400).optional(),
21047
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21048
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20933
21049
  }), unknown(), {
20934
21050
  kind: "mutation",
20935
21051
  auth: "admin"
@@ -26618,7 +26734,9 @@ var ExportOptionsSchema = object({
26618
26734
  includeAudio: boolean(),
26619
26735
  maxLifeMs: number().int().positive(),
26620
26736
  deleteAfterDownload: boolean(),
26621
- title: string().max(200).optional()
26737
+ title: string().max(200).optional(),
26738
+ /** Notification-output target ids to ping when this export becomes ready. */
26739
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26622
26740
  }).superRefine((v, ctx) => {
26623
26741
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26624
26742
  code: ZodIssueCode.custom,
@@ -26677,10 +26795,18 @@ var ExportBytesSchema = object({
26677
26795
  });
26678
26796
  method(object({
26679
26797
  deviceId: number(),
26680
- profile: string(),
26798
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26799
+ profile: string().optional(),
26800
+ profiles: array(string()).min(1).optional(),
26681
26801
  fromMs: number(),
26682
26802
  toMs: number(),
26683
26803
  options: ExportOptionsSchema
26804
+ }).superRefine((v, ctx) => {
26805
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26806
+ code: ZodIssueCode.custom,
26807
+ message: "pass profiles[] (min 1) or legacy profile",
26808
+ path: ["profiles"]
26809
+ });
26684
26810
  }), ExportRecordSchema, {
26685
26811
  kind: "mutation",
26686
26812
  auth: "protected"
@@ -29622,15 +29748,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29622
29748
  labels: ["probe not implemented"]
29623
29749
  };
29624
29750
  }
29625
- /**
29626
- * Top-level devices restored at once in {@link onRestoreDevices}.
29627
- *
29628
- * Four covers the fleets this ships to without turning a boot into a burst a
29629
- * camera NVR answers with a refusal. A provider whose upstream is a single
29630
- * session with a serial command channel (a Baichuan hub, an NVR that
29631
- * serialises ISAPI) should lower it; nothing needs to raise it.
29632
- */
29633
- restoreConcurrency = 4;
29634
29751
  async restoreDevices(savedDevices) {
29635
29752
  await this.onRestoreDevices(savedDevices);
29636
29753
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29685,14 +29802,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29685
29802
  });
29686
29803
  }
29687
29804
  };
29688
- let nextTopLevel = 0;
29689
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29690
- for (;;) {
29691
- const saved = topLevel[nextTopLevel++];
29692
- if (saved === void 0) return;
29693
- await restoreOne(saved);
29694
- }
29695
- }));
29805
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29696
29806
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29697
29807
  for (const saved of childRows) {
29698
29808
  const Class = this.deviceClasses[saved.type];
@@ -33031,6 +33141,12 @@ Object.freeze({
33031
33141
  addonId: null,
33032
33142
  access: "create"
33033
33143
  },
33144
+ "pipelineAnalytics.reconcileFromDisk": {
33145
+ capName: "pipeline-analytics",
33146
+ capScope: "device",
33147
+ addonId: null,
33148
+ access: "create"
33149
+ },
33034
33150
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33035
33151
  capName: "pipeline-analytics",
33036
33152
  capScope: "device",
@@ -33433,6 +33549,12 @@ Object.freeze({
33433
33549
  addonId: null,
33434
33550
  access: "view"
33435
33551
  },
33552
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33553
+ capName: "pipeline-orchestrator",
33554
+ capScope: "system",
33555
+ addonId: null,
33556
+ access: "view"
33557
+ },
33436
33558
  "pipelineOrchestrator.listAgentSettings": {
33437
33559
  capName: "pipeline-orchestrator",
33438
33560
  capScope: "system",
@@ -33457,6 +33579,12 @@ Object.freeze({
33457
33579
  addonId: null,
33458
33580
  access: "create"
33459
33581
  },
33582
+ "pipelineOrchestrator.reconcileFromDisk": {
33583
+ capName: "pipeline-orchestrator",
33584
+ capScope: "system",
33585
+ addonId: null,
33586
+ access: "create"
33587
+ },
33460
33588
  "pipelineOrchestrator.removeAgentSettings": {
33461
33589
  capName: "pipeline-orchestrator",
33462
33590
  capScope: "system",
@@ -36448,6 +36576,11 @@ Object.freeze({
36448
36576
  form: "single",
36449
36577
  optional: true
36450
36578
  }],
36579
+ "pipelineAnalytics.reconcileFromDisk": [{
36580
+ name: "deviceId",
36581
+ form: "single",
36582
+ optional: false
36583
+ }],
36451
36584
  "pipelineAnalytics.restageRetrainTrack": [{
36452
36585
  name: "deviceId",
36453
36586
  form: "single",
@@ -37577,6 +37710,8 @@ function maskUrlCredentials(rawUrl) {
37577
37710
  return rawUrl;
37578
37711
  }
37579
37712
  }
37713
+ var MB = 1024 * 1024;
37714
+ 1024 * MB, 3072 * MB;
37580
37715
  //#endregion
37581
37716
  //#region src/rtsp-reachability.ts
37582
37717
  /**
package/dist/addon.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import net from "node:net";
2
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
2
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -16,9 +16,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
16
16
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
17
17
  /**
18
18
  * A newer addon or server-root package version was found by the
19
- * authoritative registry check. Emitted once per
20
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
21
- * polling of the same result is deduplicated by the checker.
19
+ * authoritative registry check. Emitted once when any observed
20
+ * `latestVersion` changes (or a package/node first appears behind);
21
+ * the payload carries the full currently-available list. Repeated
22
+ * polling of the same latests is silent.
22
23
  */
23
24
  EventCategory["UpdateAvailable"] = "update.available";
24
25
  /**
@@ -37,6 +38,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
37
38
  EventCategory["AddonInstalled"] = "addon.installed";
38
39
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
39
40
  EventCategory["AddonCrashed"] = "addon.crashed";
41
+ /**
42
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
43
+ *
44
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
45
+ * respawned"); this is the one that never resolves itself. Emitted exactly
46
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
47
+ * addons it hosted and the crash count that tripped the breaker.
48
+ *
49
+ * It exists because a runner marked terminally `failed` used to be SILENT:
50
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
51
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
52
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
53
+ * operator's phone told him. The Notification Center's system-event intake
54
+ * consumes this category and maps it to the `addon-crash-loop` kind.
55
+ */
56
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
40
57
  EventCategory["AddonError"] = "addon.error";
41
58
  EventCategory["AddonPageReady"] = "addon.page-ready";
42
59
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7580,6 +7597,10 @@ var RecordingBandSchema = object({
7580
7597
  preBufferSec: number().min(0).optional(),
7581
7598
  postBufferSec: number().min(0).optional()
7582
7599
  });
7600
+ ({
7601
+ preBufferSec: 10,
7602
+ postBufferSec: 30
7603
+ }).postBufferSec * 1e3;
7583
7604
  /**
7584
7605
  * Per-device retention overrides. Every field is optional; an unset or `0`
7585
7606
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7627,6 +7648,12 @@ var RecordingConfigSchema = object({
7627
7648
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7628
7649
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7629
7650
  mode: RecordingStorageModeSchema.optional(),
7651
+ /**
7652
+ * Which assigned broker slots to record. Absent / empty = {@link
7653
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7654
+ * camera's currently assigned slots — never `mid` unless the operator
7655
+ * picks it, and never a slot the broker has not assigned.
7656
+ */
7630
7657
  profiles: array(CamProfileSchema).optional(),
7631
7658
  segmentSeconds: number().int().positive().optional(),
7632
7659
  /**
@@ -7707,7 +7734,11 @@ var RelocateFootageInputSchema = object({
7707
7734
  profiles: array(string()).optional(),
7708
7735
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7709
7736
  * never allowed to starve live writers. */
7710
- throttleMbps: number().min(1).max(1e3).optional()
7737
+ throttleMbps: number().min(1).max(1e3).optional(),
7738
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7739
+ * pile. Used when a full drain is too expensive and the operator only
7740
+ * wants the recent window on the new disk. */
7741
+ sinceMs: number().int().optional()
7711
7742
  });
7712
7743
  /** Internal, lease-scoped participant operation. It is intentionally separate
7713
7744
  * from persistent recording settings: a migration never changes
@@ -14572,6 +14603,7 @@ var NcSystemEventKindSchema = _enum([
14572
14603
  "node-offline",
14573
14604
  "node-inference-unavailable",
14574
14605
  "detection-blind",
14606
+ "addon-crash-loop",
14575
14607
  "addon-update-available",
14576
14608
  "server-update-available",
14577
14609
  "alarm-triggered",
@@ -14579,6 +14611,9 @@ var NcSystemEventKindSchema = _enum([
14579
14611
  "alarm-disarmed",
14580
14612
  "alarm-arming",
14581
14613
  "alarm-arm-refused",
14614
+ "addon-updated",
14615
+ "server-updated",
14616
+ "export-completed",
14582
14617
  "camera-online",
14583
14618
  "camera-offline",
14584
14619
  "camera-disabled",
@@ -16472,13 +16507,19 @@ var RetrainStatusSchema = _enum([
16472
16507
  * "never marked" from "already trained" must read `retrainStatus`.
16473
16508
  *
16474
16509
  * `debug` does NOT pin; it is attention, not durability.
16510
+ *
16511
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16512
+ * A favourited track is skipped by retention the same way `staging` is, but
16513
+ * it does not enter `none|staging|trained` and has no staging budget.
16475
16514
  */
16476
16515
  var TrackFlagFields = {
16477
16516
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16478
16517
  * `'staging'`. */
16479
16518
  markForTrain: boolean().optional(),
16480
16519
  /** Operator marked this track for diagnostic attention. */
16481
- debug: boolean().optional()
16520
+ debug: boolean().optional(),
16521
+ /** Operator favourited this track. Pins it against pruning. */
16522
+ favourited: boolean().optional()
16482
16523
  };
16483
16524
  /**
16484
16525
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16503,6 +16544,7 @@ var TrackFlagsSchema = object({
16503
16544
  trackId: string(),
16504
16545
  markForTrain: boolean(),
16505
16546
  debug: boolean(),
16547
+ favourited: boolean(),
16506
16548
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16507
16549
  * a track row) because this shape is only ever produced by the write body,
16508
16550
  * which always knows it — and a surface that has just written needs to render
@@ -17135,6 +17177,12 @@ var TrackCascadeCountsSchema = object({
17135
17177
  /** Per-track CLIP search vectors removed (best-effort). */
17136
17178
  embeddings: number().int()
17137
17179
  });
17180
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17181
+ var DiskReconcileCountsSchema = object({
17182
+ mediaDropped: number().int(),
17183
+ tracks: number().int(),
17184
+ events: number().int()
17185
+ });
17138
17186
  /** Event-store footprint for one camera. */
17139
17187
  var EventStoreDeviceFootprintSchema = object({
17140
17188
  deviceId: number(),
@@ -17311,6 +17359,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17311
17359
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17312
17360
  kind: "mutation",
17313
17361
  auth: "admin"
17362
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17363
+ kind: "mutation",
17364
+ auth: "admin"
17314
17365
  }), method(object({
17315
17366
  deviceId: number(),
17316
17367
  trackIds: array(string()).min(1)
@@ -18861,6 +18912,24 @@ var CameraStatusDegradationSchema = object({
18861
18912
  *
18862
18913
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18863
18914
  */
18915
+ var DiskReconcileJobSchema = object({
18916
+ state: _enum([
18917
+ "idle",
18918
+ "running",
18919
+ "done",
18920
+ "error"
18921
+ ]),
18922
+ total: number().int().nonnegative(),
18923
+ completed: number().int().nonnegative(),
18924
+ currentDeviceId: number().int().nullable(),
18925
+ failed: array(number().int()).readonly(),
18926
+ mediaDropped: number().int().nonnegative(),
18927
+ tracks: number().int().nonnegative(),
18928
+ events: number().int().nonnegative(),
18929
+ startedAtMs: number().int().nullable(),
18930
+ finishedAtMs: number().int().nullable(),
18931
+ error: string().nullable()
18932
+ });
18864
18933
  var CameraStatusSchema = object({
18865
18934
  deviceId: number(),
18866
18935
  assignment: CameraAssignmentStatusSchema,
@@ -19092,7 +19161,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19092
19161
  }), CameraSwitchGroupSchema, {
19093
19162
  kind: "mutation",
19094
19163
  auth: "admin"
19095
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19164
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19165
+ kind: "mutation",
19166
+ auth: "admin"
19167
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19096
19168
  name: string(),
19097
19169
  description: string().optional(),
19098
19170
  config: CameraPipelineConfigSchema
@@ -20269,20 +20341,6 @@ var VectorStatsResultSchema = object({
20269
20341
  exact: boolean()
20270
20342
  });
20271
20343
  method(VectorDeclareIndexInputSchema, _void(), { kind: "mutation" }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, { kind: "mutation" }), method(VectorQueryInputSchema, VectorQueryResultSchema), method(VectorGetInputSchema, VectorGetResultSchema), method(VectorDeleteInputSchema, VectorDeleteResultSchema, { kind: "mutation" }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, { kind: "mutation" }), method(VectorStatsInputSchema, VectorStatsResultSchema);
20272
- /**
20273
- * `videoclips` — the unified, navigable-clip surface for a camera.
20274
- *
20275
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20276
- * provider per device, substitutable. The DEFAULT provider (registered by
20277
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20278
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20279
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20280
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20281
- * wrapper provider for its device and serve its own clip catalog + URLs.
20282
- *
20283
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20284
- * temporal overlap, so the API never decides `continuous` vs `events`.
20285
- */
20286
20344
  var ClipSchema = object({
20287
20345
  /** Opaque, provider-namespaced id. The default provider encodes the time
20288
20346
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20299,8 +20357,57 @@ var ClipSchema = object({
20299
20357
  startMs: number(),
20300
20358
  endMs: number()
20301
20359
  }),
20302
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20303
- thumbnail: string().optional()
20360
+ /**
20361
+ * Lazy thumbnail URL, never inlined.
20362
+ *
20363
+ * Recording-derived clips (events-mode keep-window, and the prepared
20364
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20365
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20366
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20367
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20368
+ * mint their own stills.
20369
+ *
20370
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20371
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20372
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20373
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20374
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20375
+ * A read that FAILS drops the claim; it never invents it.
20376
+ */
20377
+ thumbnail: string().optional(),
20378
+ /**
20379
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20380
+ * can be decoded. Present whenever the visit came from recorded availability;
20381
+ * absent on a per-event padded window (there is no footage to promise).
20382
+ *
20383
+ * This is not a thumbnail and not a second byte path: it is the argument to
20384
+ * the recorder's existing still route. The surface — never the provider —
20385
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20386
+ * contiguous range, not of the visit: a visit spans its holes by
20387
+ * construction, so a naive midpoint lands in dead air.
20388
+ */
20389
+ stillAtMs: number().optional(),
20390
+ /**
20391
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20392
+ * first within kind (object → motion → audio), capped at
20393
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20394
+ *
20395
+ * Bounded because it is not a payload the surface pages through: one visit on
20396
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20397
+ * camera-day. Read {@link eventCount} for the true total.
20398
+ */
20399
+ eventIds: array(string()).optional(),
20400
+ /** How many analytics events actually overlap this visit. Differs from
20401
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20402
+ * list is never mistaken for a quiet visit. */
20403
+ eventCount: number().int().nonnegative().optional(),
20404
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20405
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20406
+ * bar keeps showing them via `recording.getAvailability`. */
20407
+ holes: array(object({
20408
+ startMs: number(),
20409
+ endMs: number()
20410
+ })).optional()
20304
20411
  });
20305
20412
  var ClipPlaybackSchema = object({
20306
20413
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20764,7 +20871,14 @@ var SearchResultSchema = object({
20764
20871
  });
20765
20872
  var AutoUpdateSettingsSchema = object({
20766
20873
  channel: ChannelSchema,
20767
- intervalSeconds: number()
20874
+ intervalSeconds: number(),
20875
+ /**
20876
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20877
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20878
+ * about a publish and installing it are different decisions. Clamped
20879
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20880
+ */
20881
+ updateCheckIntervalSeconds: number()
20768
20882
  });
20769
20883
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20770
20884
  var RestartAddonResultSchema = unknown();
@@ -20905,7 +21019,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20905
21019
  auth: "admin"
20906
21020
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20907
21021
  channel: ChannelSchema,
20908
- intervalSeconds: number().min(300).max(86400).optional()
21022
+ intervalSeconds: number().min(300).max(86400).optional(),
21023
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21024
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20909
21025
  }), unknown(), {
20910
21026
  kind: "mutation",
20911
21027
  auth: "admin"
@@ -26594,7 +26710,9 @@ var ExportOptionsSchema = object({
26594
26710
  includeAudio: boolean(),
26595
26711
  maxLifeMs: number().int().positive(),
26596
26712
  deleteAfterDownload: boolean(),
26597
- title: string().max(200).optional()
26713
+ title: string().max(200).optional(),
26714
+ /** Notification-output target ids to ping when this export becomes ready. */
26715
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26598
26716
  }).superRefine((v, ctx) => {
26599
26717
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26600
26718
  code: ZodIssueCode.custom,
@@ -26653,10 +26771,18 @@ var ExportBytesSchema = object({
26653
26771
  });
26654
26772
  method(object({
26655
26773
  deviceId: number(),
26656
- profile: string(),
26774
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26775
+ profile: string().optional(),
26776
+ profiles: array(string()).min(1).optional(),
26657
26777
  fromMs: number(),
26658
26778
  toMs: number(),
26659
26779
  options: ExportOptionsSchema
26780
+ }).superRefine((v, ctx) => {
26781
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26782
+ code: ZodIssueCode.custom,
26783
+ message: "pass profiles[] (min 1) or legacy profile",
26784
+ path: ["profiles"]
26785
+ });
26660
26786
  }), ExportRecordSchema, {
26661
26787
  kind: "mutation",
26662
26788
  auth: "protected"
@@ -29598,15 +29724,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29598
29724
  labels: ["probe not implemented"]
29599
29725
  };
29600
29726
  }
29601
- /**
29602
- * Top-level devices restored at once in {@link onRestoreDevices}.
29603
- *
29604
- * Four covers the fleets this ships to without turning a boot into a burst a
29605
- * camera NVR answers with a refusal. A provider whose upstream is a single
29606
- * session with a serial command channel (a Baichuan hub, an NVR that
29607
- * serialises ISAPI) should lower it; nothing needs to raise it.
29608
- */
29609
- restoreConcurrency = 4;
29610
29727
  async restoreDevices(savedDevices) {
29611
29728
  await this.onRestoreDevices(savedDevices);
29612
29729
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29661,14 +29778,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29661
29778
  });
29662
29779
  }
29663
29780
  };
29664
- let nextTopLevel = 0;
29665
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29666
- for (;;) {
29667
- const saved = topLevel[nextTopLevel++];
29668
- if (saved === void 0) return;
29669
- await restoreOne(saved);
29670
- }
29671
- }));
29781
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29672
29782
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29673
29783
  for (const saved of childRows) {
29674
29784
  const Class = this.deviceClasses[saved.type];
@@ -33007,6 +33117,12 @@ Object.freeze({
33007
33117
  addonId: null,
33008
33118
  access: "create"
33009
33119
  },
33120
+ "pipelineAnalytics.reconcileFromDisk": {
33121
+ capName: "pipeline-analytics",
33122
+ capScope: "device",
33123
+ addonId: null,
33124
+ access: "create"
33125
+ },
33010
33126
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33011
33127
  capName: "pipeline-analytics",
33012
33128
  capScope: "device",
@@ -33409,6 +33525,12 @@ Object.freeze({
33409
33525
  addonId: null,
33410
33526
  access: "view"
33411
33527
  },
33528
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33529
+ capName: "pipeline-orchestrator",
33530
+ capScope: "system",
33531
+ addonId: null,
33532
+ access: "view"
33533
+ },
33412
33534
  "pipelineOrchestrator.listAgentSettings": {
33413
33535
  capName: "pipeline-orchestrator",
33414
33536
  capScope: "system",
@@ -33433,6 +33555,12 @@ Object.freeze({
33433
33555
  addonId: null,
33434
33556
  access: "create"
33435
33557
  },
33558
+ "pipelineOrchestrator.reconcileFromDisk": {
33559
+ capName: "pipeline-orchestrator",
33560
+ capScope: "system",
33561
+ addonId: null,
33562
+ access: "create"
33563
+ },
33436
33564
  "pipelineOrchestrator.removeAgentSettings": {
33437
33565
  capName: "pipeline-orchestrator",
33438
33566
  capScope: "system",
@@ -36424,6 +36552,11 @@ Object.freeze({
36424
36552
  form: "single",
36425
36553
  optional: true
36426
36554
  }],
36555
+ "pipelineAnalytics.reconcileFromDisk": [{
36556
+ name: "deviceId",
36557
+ form: "single",
36558
+ optional: false
36559
+ }],
36427
36560
  "pipelineAnalytics.restageRetrainTrack": [{
36428
36561
  name: "deviceId",
36429
36562
  form: "single",
@@ -37553,6 +37686,8 @@ function maskUrlCredentials(rawUrl) {
37553
37686
  return rawUrl;
37554
37687
  }
37555
37688
  }
37689
+ var MB = 1024 * 1024;
37690
+ 1024 * MB, 3072 * MB;
37556
37691
  //#endregion
37557
37692
  //#region src/rtsp-reachability.ts
37558
37693
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rtsp",
3
- "version": "1.2.20",
3
+ "version": "1.2.21",
4
4
  "description": "Generic RTSP camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",