@camstack/addon-provider-onvif 1.2.19 → 1.2.20

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
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region \0rolldown/runtime.js
3
3
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
4
  //#endregion
5
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
5
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
6
6
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
7
7
  EventCategory["SystemBoot"] = "system.boot";
8
8
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -19,9 +19,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
19
19
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
20
20
  /**
21
21
  * A newer addon or server-root package version was found by the
22
- * authoritative registry check. Emitted once per
23
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
24
- * polling of the same result is deduplicated by the checker.
22
+ * authoritative registry check. Emitted once when any observed
23
+ * `latestVersion` changes (or a package/node first appears behind);
24
+ * the payload carries the full currently-available list. Repeated
25
+ * polling of the same latests is silent.
25
26
  */
26
27
  EventCategory["UpdateAvailable"] = "update.available";
27
28
  /**
@@ -40,6 +41,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
41
  EventCategory["AddonInstalled"] = "addon.installed";
41
42
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
42
43
  EventCategory["AddonCrashed"] = "addon.crashed";
44
+ /**
45
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
46
+ *
47
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
48
+ * respawned"); this is the one that never resolves itself. Emitted exactly
49
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
50
+ * addons it hosted and the crash count that tripped the breaker.
51
+ *
52
+ * It exists because a runner marked terminally `failed` used to be SILENT:
53
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
54
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
55
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
56
+ * operator's phone told him. The Notification Center's system-event intake
57
+ * consumes this category and maps it to the `addon-crash-loop` kind.
58
+ */
59
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
43
60
  EventCategory["AddonError"] = "addon.error";
44
61
  EventCategory["AddonPageReady"] = "addon.page-ready";
45
62
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7547,6 +7564,10 @@ var RecordingBandSchema = object({
7547
7564
  preBufferSec: number().min(0).optional(),
7548
7565
  postBufferSec: number().min(0).optional()
7549
7566
  });
7567
+ ({
7568
+ preBufferSec: 10,
7569
+ postBufferSec: 30
7570
+ }).postBufferSec * 1e3;
7550
7571
  /**
7551
7572
  * Per-device retention overrides. Every field is optional; an unset or `0`
7552
7573
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7594,6 +7615,12 @@ var RecordingConfigSchema = object({
7594
7615
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7595
7616
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7596
7617
  mode: RecordingStorageModeSchema.optional(),
7618
+ /**
7619
+ * Which assigned broker slots to record. Absent / empty = {@link
7620
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7621
+ * camera's currently assigned slots — never `mid` unless the operator
7622
+ * picks it, and never a slot the broker has not assigned.
7623
+ */
7597
7624
  profiles: array(CamProfileSchema).optional(),
7598
7625
  segmentSeconds: number().int().positive().optional(),
7599
7626
  /**
@@ -7674,7 +7701,11 @@ var RelocateFootageInputSchema = object({
7674
7701
  profiles: array(string()).optional(),
7675
7702
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7676
7703
  * never allowed to starve live writers. */
7677
- throttleMbps: number().min(1).max(1e3).optional()
7704
+ throttleMbps: number().min(1).max(1e3).optional(),
7705
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7706
+ * pile. Used when a full drain is too expensive and the operator only
7707
+ * wants the recent window on the new disk. */
7708
+ sinceMs: number().int().optional()
7678
7709
  });
7679
7710
  /** Internal, lease-scoped participant operation. It is intentionally separate
7680
7711
  * from persistent recording settings: a migration never changes
@@ -14292,6 +14323,7 @@ var NcSystemEventKindSchema = _enum([
14292
14323
  "node-offline",
14293
14324
  "node-inference-unavailable",
14294
14325
  "detection-blind",
14326
+ "addon-crash-loop",
14295
14327
  "addon-update-available",
14296
14328
  "server-update-available",
14297
14329
  "alarm-triggered",
@@ -14299,6 +14331,9 @@ var NcSystemEventKindSchema = _enum([
14299
14331
  "alarm-disarmed",
14300
14332
  "alarm-arming",
14301
14333
  "alarm-arm-refused",
14334
+ "addon-updated",
14335
+ "server-updated",
14336
+ "export-completed",
14302
14337
  "camera-online",
14303
14338
  "camera-offline",
14304
14339
  "camera-disabled",
@@ -16192,13 +16227,19 @@ var RetrainStatusSchema = _enum([
16192
16227
  * "never marked" from "already trained" must read `retrainStatus`.
16193
16228
  *
16194
16229
  * `debug` does NOT pin; it is attention, not durability.
16230
+ *
16231
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16232
+ * A favourited track is skipped by retention the same way `staging` is, but
16233
+ * it does not enter `none|staging|trained` and has no staging budget.
16195
16234
  */
16196
16235
  var TrackFlagFields = {
16197
16236
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16198
16237
  * `'staging'`. */
16199
16238
  markForTrain: boolean().optional(),
16200
16239
  /** Operator marked this track for diagnostic attention. */
16201
- debug: boolean().optional()
16240
+ debug: boolean().optional(),
16241
+ /** Operator favourited this track. Pins it against pruning. */
16242
+ favourited: boolean().optional()
16202
16243
  };
16203
16244
  /**
16204
16245
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16223,6 +16264,7 @@ var TrackFlagsSchema = object({
16223
16264
  trackId: string(),
16224
16265
  markForTrain: boolean(),
16225
16266
  debug: boolean(),
16267
+ favourited: boolean(),
16226
16268
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16227
16269
  * a track row) because this shape is only ever produced by the write body,
16228
16270
  * which always knows it — and a surface that has just written needs to render
@@ -16855,6 +16897,12 @@ var TrackCascadeCountsSchema = object({
16855
16897
  /** Per-track CLIP search vectors removed (best-effort). */
16856
16898
  embeddings: number().int()
16857
16899
  });
16900
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
16901
+ var DiskReconcileCountsSchema = object({
16902
+ mediaDropped: number().int(),
16903
+ tracks: number().int(),
16904
+ events: number().int()
16905
+ });
16858
16906
  /** Event-store footprint for one camera. */
16859
16907
  var EventStoreDeviceFootprintSchema = object({
16860
16908
  deviceId: number(),
@@ -17031,6 +17079,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17031
17079
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17032
17080
  kind: "mutation",
17033
17081
  auth: "admin"
17082
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17083
+ kind: "mutation",
17084
+ auth: "admin"
17034
17085
  }), method(object({
17035
17086
  deviceId: number(),
17036
17087
  trackIds: array(string()).min(1)
@@ -18541,6 +18592,24 @@ var CameraStatusDegradationSchema = object({
18541
18592
  *
18542
18593
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18543
18594
  */
18595
+ var DiskReconcileJobSchema = object({
18596
+ state: _enum([
18597
+ "idle",
18598
+ "running",
18599
+ "done",
18600
+ "error"
18601
+ ]),
18602
+ total: number().int().nonnegative(),
18603
+ completed: number().int().nonnegative(),
18604
+ currentDeviceId: number().int().nullable(),
18605
+ failed: array(number().int()).readonly(),
18606
+ mediaDropped: number().int().nonnegative(),
18607
+ tracks: number().int().nonnegative(),
18608
+ events: number().int().nonnegative(),
18609
+ startedAtMs: number().int().nullable(),
18610
+ finishedAtMs: number().int().nullable(),
18611
+ error: string().nullable()
18612
+ });
18544
18613
  var CameraStatusSchema = object({
18545
18614
  deviceId: number(),
18546
18615
  assignment: CameraAssignmentStatusSchema,
@@ -18772,7 +18841,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18772
18841
  }), CameraSwitchGroupSchema, {
18773
18842
  kind: "mutation",
18774
18843
  auth: "admin"
18775
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
18844
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
18845
+ kind: "mutation",
18846
+ auth: "admin"
18847
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
18776
18848
  name: string(),
18777
18849
  description: string().optional(),
18778
18850
  config: CameraPipelineConfigSchema
@@ -19949,20 +20021,6 @@ var VectorStatsResultSchema = object({
19949
20021
  exact: boolean()
19950
20022
  });
19951
20023
  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);
19952
- /**
19953
- * `videoclips` — the unified, navigable-clip surface for a camera.
19954
- *
19955
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
19956
- * provider per device, substitutable. The DEFAULT provider (registered by
19957
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
19958
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
19959
- * is a time-WINDOW over existing footage, never a separate file. A camera that
19960
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
19961
- * wrapper provider for its device and serve its own clip catalog + URLs.
19962
- *
19963
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
19964
- * temporal overlap, so the API never decides `continuous` vs `events`.
19965
- */
19966
20024
  var ClipSchema = object({
19967
20025
  /** Opaque, provider-namespaced id. The default provider encodes the time
19968
20026
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -19979,8 +20037,57 @@ var ClipSchema = object({
19979
20037
  startMs: number(),
19980
20038
  endMs: number()
19981
20039
  }),
19982
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
19983
- thumbnail: string().optional()
20040
+ /**
20041
+ * Lazy thumbnail URL, never inlined.
20042
+ *
20043
+ * Recording-derived clips (events-mode keep-window, and the prepared
20044
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20045
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20046
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20047
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20048
+ * mint their own stills.
20049
+ *
20050
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20051
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20052
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20053
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20054
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20055
+ * A read that FAILS drops the claim; it never invents it.
20056
+ */
20057
+ thumbnail: string().optional(),
20058
+ /**
20059
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20060
+ * can be decoded. Present whenever the visit came from recorded availability;
20061
+ * absent on a per-event padded window (there is no footage to promise).
20062
+ *
20063
+ * This is not a thumbnail and not a second byte path: it is the argument to
20064
+ * the recorder's existing still route. The surface — never the provider —
20065
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20066
+ * contiguous range, not of the visit: a visit spans its holes by
20067
+ * construction, so a naive midpoint lands in dead air.
20068
+ */
20069
+ stillAtMs: number().optional(),
20070
+ /**
20071
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20072
+ * first within kind (object → motion → audio), capped at
20073
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20074
+ *
20075
+ * Bounded because it is not a payload the surface pages through: one visit on
20076
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20077
+ * camera-day. Read {@link eventCount} for the true total.
20078
+ */
20079
+ eventIds: array(string()).optional(),
20080
+ /** How many analytics events actually overlap this visit. Differs from
20081
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20082
+ * list is never mistaken for a quiet visit. */
20083
+ eventCount: number().int().nonnegative().optional(),
20084
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20085
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20086
+ * bar keeps showing them via `recording.getAvailability`. */
20087
+ holes: array(object({
20088
+ startMs: number(),
20089
+ endMs: number()
20090
+ })).optional()
19984
20091
  });
19985
20092
  var ClipPlaybackSchema = object({
19986
20093
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20444,7 +20551,14 @@ var SearchResultSchema = object({
20444
20551
  });
20445
20552
  var AutoUpdateSettingsSchema = object({
20446
20553
  channel: ChannelSchema,
20447
- intervalSeconds: number()
20554
+ intervalSeconds: number(),
20555
+ /**
20556
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20557
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20558
+ * about a publish and installing it are different decisions. Clamped
20559
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20560
+ */
20561
+ updateCheckIntervalSeconds: number()
20448
20562
  });
20449
20563
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20450
20564
  var RestartAddonResultSchema = unknown();
@@ -20585,7 +20699,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20585
20699
  auth: "admin"
20586
20700
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20587
20701
  channel: ChannelSchema,
20588
- intervalSeconds: number().min(300).max(86400).optional()
20702
+ intervalSeconds: number().min(300).max(86400).optional(),
20703
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20704
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20589
20705
  }), unknown(), {
20590
20706
  kind: "mutation",
20591
20707
  auth: "admin"
@@ -24620,7 +24736,9 @@ var ExportOptionsSchema = object({
24620
24736
  includeAudio: boolean(),
24621
24737
  maxLifeMs: number().int().positive(),
24622
24738
  deleteAfterDownload: boolean(),
24623
- title: string().max(200).optional()
24739
+ title: string().max(200).optional(),
24740
+ /** Notification-output target ids to ping when this export becomes ready. */
24741
+ notifyTargetIds: array(string().min(1)).max(20).optional()
24624
24742
  }).superRefine((v, ctx) => {
24625
24743
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
24626
24744
  code: ZodIssueCode.custom,
@@ -24679,10 +24797,18 @@ var ExportBytesSchema = object({
24679
24797
  });
24680
24798
  method(object({
24681
24799
  deviceId: number(),
24682
- profile: string(),
24800
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
24801
+ profile: string().optional(),
24802
+ profiles: array(string()).min(1).optional(),
24683
24803
  fromMs: number(),
24684
24804
  toMs: number(),
24685
24805
  options: ExportOptionsSchema
24806
+ }).superRefine((v, ctx) => {
24807
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
24808
+ code: ZodIssueCode.custom,
24809
+ message: "pass profiles[] (min 1) or legacy profile",
24810
+ path: ["profiles"]
24811
+ });
24686
24812
  }), ExportRecordSchema, {
24687
24813
  kind: "mutation",
24688
24814
  auth: "protected"
@@ -26299,15 +26425,6 @@ var BaseDeviceProvider = class extends BaseAddon {
26299
26425
  labels: ["probe not implemented"]
26300
26426
  };
26301
26427
  }
26302
- /**
26303
- * Top-level devices restored at once in {@link onRestoreDevices}.
26304
- *
26305
- * Four covers the fleets this ships to without turning a boot into a burst a
26306
- * camera NVR answers with a refusal. A provider whose upstream is a single
26307
- * session with a serial command channel (a Baichuan hub, an NVR that
26308
- * serialises ISAPI) should lower it; nothing needs to raise it.
26309
- */
26310
- restoreConcurrency = 4;
26311
26428
  async restoreDevices(savedDevices) {
26312
26429
  await this.onRestoreDevices(savedDevices);
26313
26430
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -26362,14 +26479,7 @@ var BaseDeviceProvider = class extends BaseAddon {
26362
26479
  });
26363
26480
  }
26364
26481
  };
26365
- let nextTopLevel = 0;
26366
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
26367
- for (;;) {
26368
- const saved = topLevel[nextTopLevel++];
26369
- if (saved === void 0) return;
26370
- await restoreOne(saved);
26371
- }
26372
- }));
26482
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
26373
26483
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
26374
26484
  for (const saved of childRows) {
26375
26485
  const Class = this.deviceClasses[saved.type];
@@ -29708,6 +29818,12 @@ Object.freeze({
29708
29818
  addonId: null,
29709
29819
  access: "create"
29710
29820
  },
29821
+ "pipelineAnalytics.reconcileFromDisk": {
29822
+ capName: "pipeline-analytics",
29823
+ capScope: "device",
29824
+ addonId: null,
29825
+ access: "create"
29826
+ },
29711
29827
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
29712
29828
  capName: "pipeline-analytics",
29713
29829
  capScope: "device",
@@ -30110,6 +30226,12 @@ Object.freeze({
30110
30226
  addonId: null,
30111
30227
  access: "view"
30112
30228
  },
30229
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
30230
+ capName: "pipeline-orchestrator",
30231
+ capScope: "system",
30232
+ addonId: null,
30233
+ access: "view"
30234
+ },
30113
30235
  "pipelineOrchestrator.listAgentSettings": {
30114
30236
  capName: "pipeline-orchestrator",
30115
30237
  capScope: "system",
@@ -30134,6 +30256,12 @@ Object.freeze({
30134
30256
  addonId: null,
30135
30257
  access: "create"
30136
30258
  },
30259
+ "pipelineOrchestrator.reconcileFromDisk": {
30260
+ capName: "pipeline-orchestrator",
30261
+ capScope: "system",
30262
+ addonId: null,
30263
+ access: "create"
30264
+ },
30137
30265
  "pipelineOrchestrator.removeAgentSettings": {
30138
30266
  capName: "pipeline-orchestrator",
30139
30267
  capScope: "system",
@@ -33125,6 +33253,11 @@ Object.freeze({
33125
33253
  form: "single",
33126
33254
  optional: true
33127
33255
  }],
33256
+ "pipelineAnalytics.reconcileFromDisk": [{
33257
+ name: "deviceId",
33258
+ form: "single",
33259
+ optional: false
33260
+ }],
33128
33261
  "pipelineAnalytics.restageRetrainTrack": [{
33129
33262
  name: "deviceId",
33130
33263
  form: "single",
@@ -34190,6 +34323,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
34190
34323
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
34191
34324
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
34192
34325
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
34326
+ var MB = 1024 * 1024;
34327
+ 1024 * MB, 3072 * MB;
34193
34328
  //#endregion
34194
34329
  //#region src/onvif-camera.ts
34195
34330
  var onvifCameraSchema = object({
package/dist/addon.mjs CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
3
3
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
4
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
5
  //#endregion
6
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
6
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
7
7
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
8
8
  EventCategory["SystemBoot"] = "system.boot";
9
9
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -20,9 +20,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
20
20
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
21
21
  /**
22
22
  * A newer addon or server-root package version was found by the
23
- * authoritative registry check. Emitted once per
24
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
25
- * polling of the same result is deduplicated by the checker.
23
+ * authoritative registry check. Emitted once when any observed
24
+ * `latestVersion` changes (or a package/node first appears behind);
25
+ * the payload carries the full currently-available list. Repeated
26
+ * polling of the same latests is silent.
26
27
  */
27
28
  EventCategory["UpdateAvailable"] = "update.available";
28
29
  /**
@@ -41,6 +42,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
41
42
  EventCategory["AddonInstalled"] = "addon.installed";
42
43
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
43
44
  EventCategory["AddonCrashed"] = "addon.crashed";
45
+ /**
46
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
47
+ *
48
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
49
+ * respawned"); this is the one that never resolves itself. Emitted exactly
50
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
51
+ * addons it hosted and the crash count that tripped the breaker.
52
+ *
53
+ * It exists because a runner marked terminally `failed` used to be SILENT:
54
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
55
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
56
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
57
+ * operator's phone told him. The Notification Center's system-event intake
58
+ * consumes this category and maps it to the `addon-crash-loop` kind.
59
+ */
60
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
44
61
  EventCategory["AddonError"] = "addon.error";
45
62
  EventCategory["AddonPageReady"] = "addon.page-ready";
46
63
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7548,6 +7565,10 @@ var RecordingBandSchema = object({
7548
7565
  preBufferSec: number().min(0).optional(),
7549
7566
  postBufferSec: number().min(0).optional()
7550
7567
  });
7568
+ ({
7569
+ preBufferSec: 10,
7570
+ postBufferSec: 30
7571
+ }).postBufferSec * 1e3;
7551
7572
  /**
7552
7573
  * Per-device retention overrides. Every field is optional; an unset or `0`
7553
7574
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7595,6 +7616,12 @@ var RecordingConfigSchema = object({
7595
7616
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7596
7617
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7597
7618
  mode: RecordingStorageModeSchema.optional(),
7619
+ /**
7620
+ * Which assigned broker slots to record. Absent / empty = {@link
7621
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7622
+ * camera's currently assigned slots — never `mid` unless the operator
7623
+ * picks it, and never a slot the broker has not assigned.
7624
+ */
7598
7625
  profiles: array(CamProfileSchema).optional(),
7599
7626
  segmentSeconds: number().int().positive().optional(),
7600
7627
  /**
@@ -7675,7 +7702,11 @@ var RelocateFootageInputSchema = object({
7675
7702
  profiles: array(string()).optional(),
7676
7703
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7677
7704
  * never allowed to starve live writers. */
7678
- throttleMbps: number().min(1).max(1e3).optional()
7705
+ throttleMbps: number().min(1).max(1e3).optional(),
7706
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7707
+ * pile. Used when a full drain is too expensive and the operator only
7708
+ * wants the recent window on the new disk. */
7709
+ sinceMs: number().int().optional()
7679
7710
  });
7680
7711
  /** Internal, lease-scoped participant operation. It is intentionally separate
7681
7712
  * from persistent recording settings: a migration never changes
@@ -14293,6 +14324,7 @@ var NcSystemEventKindSchema = _enum([
14293
14324
  "node-offline",
14294
14325
  "node-inference-unavailable",
14295
14326
  "detection-blind",
14327
+ "addon-crash-loop",
14296
14328
  "addon-update-available",
14297
14329
  "server-update-available",
14298
14330
  "alarm-triggered",
@@ -14300,6 +14332,9 @@ var NcSystemEventKindSchema = _enum([
14300
14332
  "alarm-disarmed",
14301
14333
  "alarm-arming",
14302
14334
  "alarm-arm-refused",
14335
+ "addon-updated",
14336
+ "server-updated",
14337
+ "export-completed",
14303
14338
  "camera-online",
14304
14339
  "camera-offline",
14305
14340
  "camera-disabled",
@@ -16193,13 +16228,19 @@ var RetrainStatusSchema = _enum([
16193
16228
  * "never marked" from "already trained" must read `retrainStatus`.
16194
16229
  *
16195
16230
  * `debug` does NOT pin; it is attention, not durability.
16231
+ *
16232
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16233
+ * A favourited track is skipped by retention the same way `staging` is, but
16234
+ * it does not enter `none|staging|trained` and has no staging budget.
16196
16235
  */
16197
16236
  var TrackFlagFields = {
16198
16237
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16199
16238
  * `'staging'`. */
16200
16239
  markForTrain: boolean().optional(),
16201
16240
  /** Operator marked this track for diagnostic attention. */
16202
- debug: boolean().optional()
16241
+ debug: boolean().optional(),
16242
+ /** Operator favourited this track. Pins it against pruning. */
16243
+ favourited: boolean().optional()
16203
16244
  };
16204
16245
  /**
16205
16246
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16224,6 +16265,7 @@ var TrackFlagsSchema = object({
16224
16265
  trackId: string(),
16225
16266
  markForTrain: boolean(),
16226
16267
  debug: boolean(),
16268
+ favourited: boolean(),
16227
16269
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16228
16270
  * a track row) because this shape is only ever produced by the write body,
16229
16271
  * which always knows it — and a surface that has just written needs to render
@@ -16856,6 +16898,12 @@ var TrackCascadeCountsSchema = object({
16856
16898
  /** Per-track CLIP search vectors removed (best-effort). */
16857
16899
  embeddings: number().int()
16858
16900
  });
16901
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
16902
+ var DiskReconcileCountsSchema = object({
16903
+ mediaDropped: number().int(),
16904
+ tracks: number().int(),
16905
+ events: number().int()
16906
+ });
16859
16907
  /** Event-store footprint for one camera. */
16860
16908
  var EventStoreDeviceFootprintSchema = object({
16861
16909
  deviceId: number(),
@@ -17032,6 +17080,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17032
17080
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17033
17081
  kind: "mutation",
17034
17082
  auth: "admin"
17083
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17084
+ kind: "mutation",
17085
+ auth: "admin"
17035
17086
  }), method(object({
17036
17087
  deviceId: number(),
17037
17088
  trackIds: array(string()).min(1)
@@ -18542,6 +18593,24 @@ var CameraStatusDegradationSchema = object({
18542
18593
  *
18543
18594
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18544
18595
  */
18596
+ var DiskReconcileJobSchema = object({
18597
+ state: _enum([
18598
+ "idle",
18599
+ "running",
18600
+ "done",
18601
+ "error"
18602
+ ]),
18603
+ total: number().int().nonnegative(),
18604
+ completed: number().int().nonnegative(),
18605
+ currentDeviceId: number().int().nullable(),
18606
+ failed: array(number().int()).readonly(),
18607
+ mediaDropped: number().int().nonnegative(),
18608
+ tracks: number().int().nonnegative(),
18609
+ events: number().int().nonnegative(),
18610
+ startedAtMs: number().int().nullable(),
18611
+ finishedAtMs: number().int().nullable(),
18612
+ error: string().nullable()
18613
+ });
18545
18614
  var CameraStatusSchema = object({
18546
18615
  deviceId: number(),
18547
18616
  assignment: CameraAssignmentStatusSchema,
@@ -18773,7 +18842,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18773
18842
  }), CameraSwitchGroupSchema, {
18774
18843
  kind: "mutation",
18775
18844
  auth: "admin"
18776
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
18845
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
18846
+ kind: "mutation",
18847
+ auth: "admin"
18848
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
18777
18849
  name: string(),
18778
18850
  description: string().optional(),
18779
18851
  config: CameraPipelineConfigSchema
@@ -19950,20 +20022,6 @@ var VectorStatsResultSchema = object({
19950
20022
  exact: boolean()
19951
20023
  });
19952
20024
  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);
19953
- /**
19954
- * `videoclips` — the unified, navigable-clip surface for a camera.
19955
- *
19956
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
19957
- * provider per device, substitutable. The DEFAULT provider (registered by
19958
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
19959
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
19960
- * is a time-WINDOW over existing footage, never a separate file. A camera that
19961
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
19962
- * wrapper provider for its device and serve its own clip catalog + URLs.
19963
- *
19964
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
19965
- * temporal overlap, so the API never decides `continuous` vs `events`.
19966
- */
19967
20025
  var ClipSchema = object({
19968
20026
  /** Opaque, provider-namespaced id. The default provider encodes the time
19969
20027
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -19980,8 +20038,57 @@ var ClipSchema = object({
19980
20038
  startMs: number(),
19981
20039
  endMs: number()
19982
20040
  }),
19983
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
19984
- thumbnail: string().optional()
20041
+ /**
20042
+ * Lazy thumbnail URL, never inlined.
20043
+ *
20044
+ * Recording-derived clips (events-mode keep-window, and the prepared
20045
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20046
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20047
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20048
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20049
+ * mint their own stills.
20050
+ *
20051
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20052
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20053
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20054
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20055
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20056
+ * A read that FAILS drops the claim; it never invents it.
20057
+ */
20058
+ thumbnail: string().optional(),
20059
+ /**
20060
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20061
+ * can be decoded. Present whenever the visit came from recorded availability;
20062
+ * absent on a per-event padded window (there is no footage to promise).
20063
+ *
20064
+ * This is not a thumbnail and not a second byte path: it is the argument to
20065
+ * the recorder's existing still route. The surface — never the provider —
20066
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20067
+ * contiguous range, not of the visit: a visit spans its holes by
20068
+ * construction, so a naive midpoint lands in dead air.
20069
+ */
20070
+ stillAtMs: number().optional(),
20071
+ /**
20072
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20073
+ * first within kind (object → motion → audio), capped at
20074
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20075
+ *
20076
+ * Bounded because it is not a payload the surface pages through: one visit on
20077
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20078
+ * camera-day. Read {@link eventCount} for the true total.
20079
+ */
20080
+ eventIds: array(string()).optional(),
20081
+ /** How many analytics events actually overlap this visit. Differs from
20082
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20083
+ * list is never mistaken for a quiet visit. */
20084
+ eventCount: number().int().nonnegative().optional(),
20085
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20086
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20087
+ * bar keeps showing them via `recording.getAvailability`. */
20088
+ holes: array(object({
20089
+ startMs: number(),
20090
+ endMs: number()
20091
+ })).optional()
19985
20092
  });
19986
20093
  var ClipPlaybackSchema = object({
19987
20094
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20445,7 +20552,14 @@ var SearchResultSchema = object({
20445
20552
  });
20446
20553
  var AutoUpdateSettingsSchema = object({
20447
20554
  channel: ChannelSchema,
20448
- intervalSeconds: number()
20555
+ intervalSeconds: number(),
20556
+ /**
20557
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20558
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20559
+ * about a publish and installing it are different decisions. Clamped
20560
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20561
+ */
20562
+ updateCheckIntervalSeconds: number()
20449
20563
  });
20450
20564
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20451
20565
  var RestartAddonResultSchema = unknown();
@@ -20586,7 +20700,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20586
20700
  auth: "admin"
20587
20701
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20588
20702
  channel: ChannelSchema,
20589
- intervalSeconds: number().min(300).max(86400).optional()
20703
+ intervalSeconds: number().min(300).max(86400).optional(),
20704
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20705
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20590
20706
  }), unknown(), {
20591
20707
  kind: "mutation",
20592
20708
  auth: "admin"
@@ -24621,7 +24737,9 @@ var ExportOptionsSchema = object({
24621
24737
  includeAudio: boolean(),
24622
24738
  maxLifeMs: number().int().positive(),
24623
24739
  deleteAfterDownload: boolean(),
24624
- title: string().max(200).optional()
24740
+ title: string().max(200).optional(),
24741
+ /** Notification-output target ids to ping when this export becomes ready. */
24742
+ notifyTargetIds: array(string().min(1)).max(20).optional()
24625
24743
  }).superRefine((v, ctx) => {
24626
24744
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
24627
24745
  code: ZodIssueCode.custom,
@@ -24680,10 +24798,18 @@ var ExportBytesSchema = object({
24680
24798
  });
24681
24799
  method(object({
24682
24800
  deviceId: number(),
24683
- profile: string(),
24801
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
24802
+ profile: string().optional(),
24803
+ profiles: array(string()).min(1).optional(),
24684
24804
  fromMs: number(),
24685
24805
  toMs: number(),
24686
24806
  options: ExportOptionsSchema
24807
+ }).superRefine((v, ctx) => {
24808
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
24809
+ code: ZodIssueCode.custom,
24810
+ message: "pass profiles[] (min 1) or legacy profile",
24811
+ path: ["profiles"]
24812
+ });
24687
24813
  }), ExportRecordSchema, {
24688
24814
  kind: "mutation",
24689
24815
  auth: "protected"
@@ -26300,15 +26426,6 @@ var BaseDeviceProvider = class extends BaseAddon {
26300
26426
  labels: ["probe not implemented"]
26301
26427
  };
26302
26428
  }
26303
- /**
26304
- * Top-level devices restored at once in {@link onRestoreDevices}.
26305
- *
26306
- * Four covers the fleets this ships to without turning a boot into a burst a
26307
- * camera NVR answers with a refusal. A provider whose upstream is a single
26308
- * session with a serial command channel (a Baichuan hub, an NVR that
26309
- * serialises ISAPI) should lower it; nothing needs to raise it.
26310
- */
26311
- restoreConcurrency = 4;
26312
26429
  async restoreDevices(savedDevices) {
26313
26430
  await this.onRestoreDevices(savedDevices);
26314
26431
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -26363,14 +26480,7 @@ var BaseDeviceProvider = class extends BaseAddon {
26363
26480
  });
26364
26481
  }
26365
26482
  };
26366
- let nextTopLevel = 0;
26367
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
26368
- for (;;) {
26369
- const saved = topLevel[nextTopLevel++];
26370
- if (saved === void 0) return;
26371
- await restoreOne(saved);
26372
- }
26373
- }));
26483
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
26374
26484
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
26375
26485
  for (const saved of childRows) {
26376
26486
  const Class = this.deviceClasses[saved.type];
@@ -29709,6 +29819,12 @@ Object.freeze({
29709
29819
  addonId: null,
29710
29820
  access: "create"
29711
29821
  },
29822
+ "pipelineAnalytics.reconcileFromDisk": {
29823
+ capName: "pipeline-analytics",
29824
+ capScope: "device",
29825
+ addonId: null,
29826
+ access: "create"
29827
+ },
29712
29828
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
29713
29829
  capName: "pipeline-analytics",
29714
29830
  capScope: "device",
@@ -30111,6 +30227,12 @@ Object.freeze({
30111
30227
  addonId: null,
30112
30228
  access: "view"
30113
30229
  },
30230
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
30231
+ capName: "pipeline-orchestrator",
30232
+ capScope: "system",
30233
+ addonId: null,
30234
+ access: "view"
30235
+ },
30114
30236
  "pipelineOrchestrator.listAgentSettings": {
30115
30237
  capName: "pipeline-orchestrator",
30116
30238
  capScope: "system",
@@ -30135,6 +30257,12 @@ Object.freeze({
30135
30257
  addonId: null,
30136
30258
  access: "create"
30137
30259
  },
30260
+ "pipelineOrchestrator.reconcileFromDisk": {
30261
+ capName: "pipeline-orchestrator",
30262
+ capScope: "system",
30263
+ addonId: null,
30264
+ access: "create"
30265
+ },
30138
30266
  "pipelineOrchestrator.removeAgentSettings": {
30139
30267
  capName: "pipeline-orchestrator",
30140
30268
  capScope: "system",
@@ -33126,6 +33254,11 @@ Object.freeze({
33126
33254
  form: "single",
33127
33255
  optional: true
33128
33256
  }],
33257
+ "pipelineAnalytics.reconcileFromDisk": [{
33258
+ name: "deviceId",
33259
+ form: "single",
33260
+ optional: false
33261
+ }],
33129
33262
  "pipelineAnalytics.restageRetrainTrack": [{
33130
33263
  name: "deviceId",
33131
33264
  form: "single",
@@ -34191,6 +34324,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
34191
34324
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
34192
34325
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
34193
34326
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
34327
+ var MB = 1024 * 1024;
34328
+ 1024 * MB, 3072 * MB;
34194
34329
  //#endregion
34195
34330
  //#region src/onvif-camera.ts
34196
34331
  var onvifCameraSchema = object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.2.19",
3
+ "version": "1.2.20",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",