@camstack/addon-provider-unraid 0.2.20 → 0.2.22

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 +187 -44
  2. package/dist/addon.mjs +187 -44
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
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";
@@ -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
@@ -14540,6 +14571,7 @@ var NcSystemEventKindSchema = _enum([
14540
14571
  "node-offline",
14541
14572
  "node-inference-unavailable",
14542
14573
  "detection-blind",
14574
+ "addon-crash-loop",
14543
14575
  "addon-update-available",
14544
14576
  "server-update-available",
14545
14577
  "alarm-triggered",
@@ -14547,6 +14579,9 @@ var NcSystemEventKindSchema = _enum([
14547
14579
  "alarm-disarmed",
14548
14580
  "alarm-arming",
14549
14581
  "alarm-arm-refused",
14582
+ "addon-updated",
14583
+ "server-updated",
14584
+ "export-completed",
14550
14585
  "camera-online",
14551
14586
  "camera-offline",
14552
14587
  "camera-disabled",
@@ -16440,13 +16475,19 @@ var RetrainStatusSchema = _enum([
16440
16475
  * "never marked" from "already trained" must read `retrainStatus`.
16441
16476
  *
16442
16477
  * `debug` does NOT pin; it is attention, not durability.
16478
+ *
16479
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16480
+ * A favourited track is skipped by retention the same way `staging` is, but
16481
+ * it does not enter `none|staging|trained` and has no staging budget.
16443
16482
  */
16444
16483
  var TrackFlagFields = {
16445
16484
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16446
16485
  * `'staging'`. */
16447
16486
  markForTrain: boolean().optional(),
16448
16487
  /** Operator marked this track for diagnostic attention. */
16449
- debug: boolean().optional()
16488
+ debug: boolean().optional(),
16489
+ /** Operator favourited this track. Pins it against pruning. */
16490
+ favourited: boolean().optional()
16450
16491
  };
16451
16492
  /**
16452
16493
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16471,6 +16512,7 @@ var TrackFlagsSchema = object({
16471
16512
  trackId: string(),
16472
16513
  markForTrain: boolean(),
16473
16514
  debug: boolean(),
16515
+ favourited: boolean(),
16474
16516
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16475
16517
  * a track row) because this shape is only ever produced by the write body,
16476
16518
  * which always knows it — and a surface that has just written needs to render
@@ -17103,6 +17145,12 @@ var TrackCascadeCountsSchema = object({
17103
17145
  /** Per-track CLIP search vectors removed (best-effort). */
17104
17146
  embeddings: number().int()
17105
17147
  });
17148
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17149
+ var DiskReconcileCountsSchema = object({
17150
+ mediaDropped: number().int(),
17151
+ tracks: number().int(),
17152
+ events: number().int()
17153
+ });
17106
17154
  /** Event-store footprint for one camera. */
17107
17155
  var EventStoreDeviceFootprintSchema = object({
17108
17156
  deviceId: number(),
@@ -17279,6 +17327,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17279
17327
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17280
17328
  kind: "mutation",
17281
17329
  auth: "admin"
17330
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17331
+ kind: "mutation",
17332
+ auth: "admin"
17282
17333
  }), method(object({
17283
17334
  deviceId: number(),
17284
17335
  trackIds: array(string()).min(1)
@@ -18829,6 +18880,24 @@ var CameraStatusDegradationSchema = object({
18829
18880
  *
18830
18881
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18831
18882
  */
18883
+ var DiskReconcileJobSchema = object({
18884
+ state: _enum([
18885
+ "idle",
18886
+ "running",
18887
+ "done",
18888
+ "error"
18889
+ ]),
18890
+ total: number().int().nonnegative(),
18891
+ completed: number().int().nonnegative(),
18892
+ currentDeviceId: number().int().nullable(),
18893
+ failed: array(number().int()).readonly(),
18894
+ mediaDropped: number().int().nonnegative(),
18895
+ tracks: number().int().nonnegative(),
18896
+ events: number().int().nonnegative(),
18897
+ startedAtMs: number().int().nullable(),
18898
+ finishedAtMs: number().int().nullable(),
18899
+ error: string().nullable()
18900
+ });
18832
18901
  var CameraStatusSchema = object({
18833
18902
  deviceId: number(),
18834
18903
  assignment: CameraAssignmentStatusSchema,
@@ -19060,7 +19129,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19060
19129
  }), CameraSwitchGroupSchema, {
19061
19130
  kind: "mutation",
19062
19131
  auth: "admin"
19063
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19132
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19133
+ kind: "mutation",
19134
+ auth: "admin"
19135
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19064
19136
  name: string(),
19065
19137
  description: string().optional(),
19066
19138
  config: CameraPipelineConfigSchema
@@ -20133,20 +20205,6 @@ var VectorStatsResultSchema = object({
20133
20205
  exact: boolean()
20134
20206
  });
20135
20207
  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);
20136
- /**
20137
- * `videoclips` — the unified, navigable-clip surface for a camera.
20138
- *
20139
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20140
- * provider per device, substitutable. The DEFAULT provider (registered by
20141
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20142
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20143
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20144
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20145
- * wrapper provider for its device and serve its own clip catalog + URLs.
20146
- *
20147
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20148
- * temporal overlap, so the API never decides `continuous` vs `events`.
20149
- */
20150
20208
  var ClipSchema = object({
20151
20209
  /** Opaque, provider-namespaced id. The default provider encodes the time
20152
20210
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20163,8 +20221,65 @@ var ClipSchema = object({
20163
20221
  startMs: number(),
20164
20222
  endMs: number()
20165
20223
  }),
20166
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20167
- thumbnail: string().optional()
20224
+ /**
20225
+ * Distinct object classes attached to this visit (`person`, `car`, …),
20226
+ * dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
20227
+ * instead of the bare kind — "Object" tells the operator nothing a colour bar
20228
+ * did not. Absent (never empty) when the visit attached no classified object
20229
+ * event, so a motion/audio-only visit keeps its kind label.
20230
+ */
20231
+ labels: array(string()).max(3).optional(),
20232
+ /**
20233
+ * Lazy thumbnail URL, never inlined.
20234
+ *
20235
+ * Recording-derived clips (events-mode keep-window, and the prepared
20236
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20237
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20238
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20239
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20240
+ * mint their own stills.
20241
+ *
20242
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20243
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20244
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20245
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20246
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20247
+ * A read that FAILS drops the claim; it never invents it.
20248
+ */
20249
+ thumbnail: string().optional(),
20250
+ /**
20251
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20252
+ * can be decoded. Present whenever the visit came from recorded availability;
20253
+ * absent on a per-event padded window (there is no footage to promise).
20254
+ *
20255
+ * This is not a thumbnail and not a second byte path: it is the argument to
20256
+ * the recorder's existing still route. The surface — never the provider —
20257
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20258
+ * contiguous range, not of the visit: a visit spans its holes by
20259
+ * construction, so a naive midpoint lands in dead air.
20260
+ */
20261
+ stillAtMs: number().optional(),
20262
+ /**
20263
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20264
+ * first within kind (object → motion → audio), capped at
20265
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20266
+ *
20267
+ * Bounded because it is not a payload the surface pages through: one visit on
20268
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20269
+ * camera-day. Read {@link eventCount} for the true total.
20270
+ */
20271
+ eventIds: array(string()).optional(),
20272
+ /** How many analytics events actually overlap this visit. Differs from
20273
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20274
+ * list is never mistaken for a quiet visit. */
20275
+ eventCount: number().int().nonnegative().optional(),
20276
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20277
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20278
+ * bar keeps showing them via `recording.getAvailability`. */
20279
+ holes: array(object({
20280
+ startMs: number(),
20281
+ endMs: number()
20282
+ })).optional()
20168
20283
  });
20169
20284
  var ClipPlaybackSchema = object({
20170
20285
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20628,7 +20743,14 @@ var SearchResultSchema = object({
20628
20743
  });
20629
20744
  var AutoUpdateSettingsSchema = object({
20630
20745
  channel: ChannelSchema,
20631
- intervalSeconds: number()
20746
+ intervalSeconds: number(),
20747
+ /**
20748
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20749
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20750
+ * about a publish and installing it are different decisions. Clamped
20751
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20752
+ */
20753
+ updateCheckIntervalSeconds: number()
20632
20754
  });
20633
20755
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20634
20756
  var RestartAddonResultSchema = unknown();
@@ -20769,7 +20891,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20769
20891
  auth: "admin"
20770
20892
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20771
20893
  channel: ChannelSchema,
20772
- intervalSeconds: number().min(300).max(86400).optional()
20894
+ intervalSeconds: number().min(300).max(86400).optional(),
20895
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20896
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20773
20897
  }), unknown(), {
20774
20898
  kind: "mutation",
20775
20899
  auth: "admin"
@@ -26467,7 +26591,9 @@ var ExportOptionsSchema = object({
26467
26591
  includeAudio: boolean(),
26468
26592
  maxLifeMs: number().int().positive(),
26469
26593
  deleteAfterDownload: boolean(),
26470
- title: string().max(200).optional()
26594
+ title: string().max(200).optional(),
26595
+ /** Notification-output target ids to ping when this export becomes ready. */
26596
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26471
26597
  }).superRefine((v, ctx) => {
26472
26598
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26473
26599
  code: ZodIssueCode.custom,
@@ -26526,10 +26652,18 @@ var ExportBytesSchema = object({
26526
26652
  });
26527
26653
  method(object({
26528
26654
  deviceId: number(),
26529
- profile: string(),
26655
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26656
+ profile: string().optional(),
26657
+ profiles: array(string()).min(1).optional(),
26530
26658
  fromMs: number(),
26531
26659
  toMs: number(),
26532
26660
  options: ExportOptionsSchema
26661
+ }).superRefine((v, ctx) => {
26662
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26663
+ code: ZodIssueCode.custom,
26664
+ message: "pass profiles[] (min 1) or legacy profile",
26665
+ path: ["profiles"]
26666
+ });
26533
26667
  }), ExportRecordSchema, {
26534
26668
  kind: "mutation",
26535
26669
  auth: "protected"
@@ -29471,15 +29605,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29471
29605
  labels: ["probe not implemented"]
29472
29606
  };
29473
29607
  }
29474
- /**
29475
- * Top-level devices restored at once in {@link onRestoreDevices}.
29476
- *
29477
- * Four covers the fleets this ships to without turning a boot into a burst a
29478
- * camera NVR answers with a refusal. A provider whose upstream is a single
29479
- * session with a serial command channel (a Baichuan hub, an NVR that
29480
- * serialises ISAPI) should lower it; nothing needs to raise it.
29481
- */
29482
- restoreConcurrency = 4;
29483
29608
  async restoreDevices(savedDevices) {
29484
29609
  await this.onRestoreDevices(savedDevices);
29485
29610
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29534,14 +29659,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29534
29659
  });
29535
29660
  }
29536
29661
  };
29537
- let nextTopLevel = 0;
29538
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29539
- for (;;) {
29540
- const saved = topLevel[nextTopLevel++];
29541
- if (saved === void 0) return;
29542
- await restoreOne(saved);
29543
- }
29544
- }));
29662
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29545
29663
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29546
29664
  for (const saved of childRows) {
29547
29665
  const Class = this.deviceClasses[saved.type];
@@ -32814,6 +32932,12 @@ Object.freeze({
32814
32932
  addonId: null,
32815
32933
  access: "create"
32816
32934
  },
32935
+ "pipelineAnalytics.reconcileFromDisk": {
32936
+ capName: "pipeline-analytics",
32937
+ capScope: "device",
32938
+ addonId: null,
32939
+ access: "create"
32940
+ },
32817
32941
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32818
32942
  capName: "pipeline-analytics",
32819
32943
  capScope: "device",
@@ -33216,6 +33340,12 @@ Object.freeze({
33216
33340
  addonId: null,
33217
33341
  access: "view"
33218
33342
  },
33343
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33344
+ capName: "pipeline-orchestrator",
33345
+ capScope: "system",
33346
+ addonId: null,
33347
+ access: "view"
33348
+ },
33219
33349
  "pipelineOrchestrator.listAgentSettings": {
33220
33350
  capName: "pipeline-orchestrator",
33221
33351
  capScope: "system",
@@ -33240,6 +33370,12 @@ Object.freeze({
33240
33370
  addonId: null,
33241
33371
  access: "create"
33242
33372
  },
33373
+ "pipelineOrchestrator.reconcileFromDisk": {
33374
+ capName: "pipeline-orchestrator",
33375
+ capScope: "system",
33376
+ addonId: null,
33377
+ access: "create"
33378
+ },
33243
33379
  "pipelineOrchestrator.removeAgentSettings": {
33244
33380
  capName: "pipeline-orchestrator",
33245
33381
  capScope: "system",
@@ -36231,6 +36367,11 @@ Object.freeze({
36231
36367
  form: "single",
36232
36368
  optional: true
36233
36369
  }],
36370
+ "pipelineAnalytics.reconcileFromDisk": [{
36371
+ name: "deviceId",
36372
+ form: "single",
36373
+ optional: false
36374
+ }],
36234
36375
  "pipelineAnalytics.restageRetrainTrack": [{
36235
36376
  name: "deviceId",
36236
36377
  form: "single",
@@ -37296,6 +37437,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37296
37437
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37297
37438
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37298
37439
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37440
+ var MB = 1024 * 1024;
37441
+ 1024 * MB, 3072 * MB;
37299
37442
  //#endregion
37300
37443
  //#region src/config.ts
37301
37444
  /**
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
1
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
2
2
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
3
3
  EventCategory["SystemBoot"] = "system.boot";
4
4
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -15,9 +15,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
15
15
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
16
16
  /**
17
17
  * A newer addon or server-root package version was found by the
18
- * authoritative registry check. Emitted once per
19
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
20
- * polling of the same result is deduplicated by the checker.
18
+ * authoritative registry check. Emitted once when any observed
19
+ * `latestVersion` changes (or a package/node first appears behind);
20
+ * the payload carries the full currently-available list. Repeated
21
+ * polling of the same latests is silent.
21
22
  */
22
23
  EventCategory["UpdateAvailable"] = "update.available";
23
24
  /**
@@ -36,6 +37,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
36
37
  EventCategory["AddonInstalled"] = "addon.installed";
37
38
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
38
39
  EventCategory["AddonCrashed"] = "addon.crashed";
40
+ /**
41
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
42
+ *
43
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
44
+ * respawned"); this is the one that never resolves itself. Emitted exactly
45
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
46
+ * addons it hosted and the crash count that tripped the breaker.
47
+ *
48
+ * It exists because a runner marked terminally `failed` used to be SILENT:
49
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
50
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
51
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
52
+ * operator's phone told him. The Notification Center's system-event intake
53
+ * consumes this category and maps it to the `addon-crash-loop` kind.
54
+ */
55
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
39
56
  EventCategory["AddonError"] = "addon.error";
40
57
  EventCategory["AddonPageReady"] = "addon.page-ready";
41
58
  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
@@ -14539,6 +14570,7 @@ var NcSystemEventKindSchema = _enum([
14539
14570
  "node-offline",
14540
14571
  "node-inference-unavailable",
14541
14572
  "detection-blind",
14573
+ "addon-crash-loop",
14542
14574
  "addon-update-available",
14543
14575
  "server-update-available",
14544
14576
  "alarm-triggered",
@@ -14546,6 +14578,9 @@ var NcSystemEventKindSchema = _enum([
14546
14578
  "alarm-disarmed",
14547
14579
  "alarm-arming",
14548
14580
  "alarm-arm-refused",
14581
+ "addon-updated",
14582
+ "server-updated",
14583
+ "export-completed",
14549
14584
  "camera-online",
14550
14585
  "camera-offline",
14551
14586
  "camera-disabled",
@@ -16439,13 +16474,19 @@ var RetrainStatusSchema = _enum([
16439
16474
  * "never marked" from "already trained" must read `retrainStatus`.
16440
16475
  *
16441
16476
  * `debug` does NOT pin; it is attention, not durability.
16477
+ *
16478
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16479
+ * A favourited track is skipped by retention the same way `staging` is, but
16480
+ * it does not enter `none|staging|trained` and has no staging budget.
16442
16481
  */
16443
16482
  var TrackFlagFields = {
16444
16483
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16445
16484
  * `'staging'`. */
16446
16485
  markForTrain: boolean().optional(),
16447
16486
  /** Operator marked this track for diagnostic attention. */
16448
- debug: boolean().optional()
16487
+ debug: boolean().optional(),
16488
+ /** Operator favourited this track. Pins it against pruning. */
16489
+ favourited: boolean().optional()
16449
16490
  };
16450
16491
  /**
16451
16492
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16470,6 +16511,7 @@ var TrackFlagsSchema = object({
16470
16511
  trackId: string(),
16471
16512
  markForTrain: boolean(),
16472
16513
  debug: boolean(),
16514
+ favourited: boolean(),
16473
16515
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16474
16516
  * a track row) because this shape is only ever produced by the write body,
16475
16517
  * which always knows it — and a surface that has just written needs to render
@@ -17102,6 +17144,12 @@ var TrackCascadeCountsSchema = object({
17102
17144
  /** Per-track CLIP search vectors removed (best-effort). */
17103
17145
  embeddings: number().int()
17104
17146
  });
17147
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17148
+ var DiskReconcileCountsSchema = object({
17149
+ mediaDropped: number().int(),
17150
+ tracks: number().int(),
17151
+ events: number().int()
17152
+ });
17105
17153
  /** Event-store footprint for one camera. */
17106
17154
  var EventStoreDeviceFootprintSchema = object({
17107
17155
  deviceId: number(),
@@ -17278,6 +17326,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17278
17326
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17279
17327
  kind: "mutation",
17280
17328
  auth: "admin"
17329
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17330
+ kind: "mutation",
17331
+ auth: "admin"
17281
17332
  }), method(object({
17282
17333
  deviceId: number(),
17283
17334
  trackIds: array(string()).min(1)
@@ -18828,6 +18879,24 @@ var CameraStatusDegradationSchema = object({
18828
18879
  *
18829
18880
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18830
18881
  */
18882
+ var DiskReconcileJobSchema = object({
18883
+ state: _enum([
18884
+ "idle",
18885
+ "running",
18886
+ "done",
18887
+ "error"
18888
+ ]),
18889
+ total: number().int().nonnegative(),
18890
+ completed: number().int().nonnegative(),
18891
+ currentDeviceId: number().int().nullable(),
18892
+ failed: array(number().int()).readonly(),
18893
+ mediaDropped: number().int().nonnegative(),
18894
+ tracks: number().int().nonnegative(),
18895
+ events: number().int().nonnegative(),
18896
+ startedAtMs: number().int().nullable(),
18897
+ finishedAtMs: number().int().nullable(),
18898
+ error: string().nullable()
18899
+ });
18831
18900
  var CameraStatusSchema = object({
18832
18901
  deviceId: number(),
18833
18902
  assignment: CameraAssignmentStatusSchema,
@@ -19059,7 +19128,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19059
19128
  }), CameraSwitchGroupSchema, {
19060
19129
  kind: "mutation",
19061
19130
  auth: "admin"
19062
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19131
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19132
+ kind: "mutation",
19133
+ auth: "admin"
19134
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19063
19135
  name: string(),
19064
19136
  description: string().optional(),
19065
19137
  config: CameraPipelineConfigSchema
@@ -20132,20 +20204,6 @@ var VectorStatsResultSchema = object({
20132
20204
  exact: boolean()
20133
20205
  });
20134
20206
  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);
20135
- /**
20136
- * `videoclips` — the unified, navigable-clip surface for a camera.
20137
- *
20138
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20139
- * provider per device, substitutable. The DEFAULT provider (registered by
20140
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20141
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20142
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20143
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20144
- * wrapper provider for its device and serve its own clip catalog + URLs.
20145
- *
20146
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20147
- * temporal overlap, so the API never decides `continuous` vs `events`.
20148
- */
20149
20207
  var ClipSchema = object({
20150
20208
  /** Opaque, provider-namespaced id. The default provider encodes the time
20151
20209
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20162,8 +20220,65 @@ var ClipSchema = object({
20162
20220
  startMs: number(),
20163
20221
  endMs: number()
20164
20222
  }),
20165
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20166
- thumbnail: string().optional()
20223
+ /**
20224
+ * Distinct object classes attached to this visit (`person`, `car`, …),
20225
+ * dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
20226
+ * instead of the bare kind — "Object" tells the operator nothing a colour bar
20227
+ * did not. Absent (never empty) when the visit attached no classified object
20228
+ * event, so a motion/audio-only visit keeps its kind label.
20229
+ */
20230
+ labels: array(string()).max(3).optional(),
20231
+ /**
20232
+ * Lazy thumbnail URL, never inlined.
20233
+ *
20234
+ * Recording-derived clips (events-mode keep-window, and the prepared
20235
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20236
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20237
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20238
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20239
+ * mint their own stills.
20240
+ *
20241
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20242
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20243
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20244
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20245
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20246
+ * A read that FAILS drops the claim; it never invents it.
20247
+ */
20248
+ thumbnail: string().optional(),
20249
+ /**
20250
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20251
+ * can be decoded. Present whenever the visit came from recorded availability;
20252
+ * absent on a per-event padded window (there is no footage to promise).
20253
+ *
20254
+ * This is not a thumbnail and not a second byte path: it is the argument to
20255
+ * the recorder's existing still route. The surface — never the provider —
20256
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20257
+ * contiguous range, not of the visit: a visit spans its holes by
20258
+ * construction, so a naive midpoint lands in dead air.
20259
+ */
20260
+ stillAtMs: number().optional(),
20261
+ /**
20262
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20263
+ * first within kind (object → motion → audio), capped at
20264
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20265
+ *
20266
+ * Bounded because it is not a payload the surface pages through: one visit on
20267
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20268
+ * camera-day. Read {@link eventCount} for the true total.
20269
+ */
20270
+ eventIds: array(string()).optional(),
20271
+ /** How many analytics events actually overlap this visit. Differs from
20272
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20273
+ * list is never mistaken for a quiet visit. */
20274
+ eventCount: number().int().nonnegative().optional(),
20275
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20276
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20277
+ * bar keeps showing them via `recording.getAvailability`. */
20278
+ holes: array(object({
20279
+ startMs: number(),
20280
+ endMs: number()
20281
+ })).optional()
20167
20282
  });
20168
20283
  var ClipPlaybackSchema = object({
20169
20284
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20627,7 +20742,14 @@ var SearchResultSchema = object({
20627
20742
  });
20628
20743
  var AutoUpdateSettingsSchema = object({
20629
20744
  channel: ChannelSchema,
20630
- intervalSeconds: number()
20745
+ intervalSeconds: number(),
20746
+ /**
20747
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20748
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20749
+ * about a publish and installing it are different decisions. Clamped
20750
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20751
+ */
20752
+ updateCheckIntervalSeconds: number()
20631
20753
  });
20632
20754
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20633
20755
  var RestartAddonResultSchema = unknown();
@@ -20768,7 +20890,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20768
20890
  auth: "admin"
20769
20891
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20770
20892
  channel: ChannelSchema,
20771
- intervalSeconds: number().min(300).max(86400).optional()
20893
+ intervalSeconds: number().min(300).max(86400).optional(),
20894
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20895
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20772
20896
  }), unknown(), {
20773
20897
  kind: "mutation",
20774
20898
  auth: "admin"
@@ -26466,7 +26590,9 @@ var ExportOptionsSchema = object({
26466
26590
  includeAudio: boolean(),
26467
26591
  maxLifeMs: number().int().positive(),
26468
26592
  deleteAfterDownload: boolean(),
26469
- title: string().max(200).optional()
26593
+ title: string().max(200).optional(),
26594
+ /** Notification-output target ids to ping when this export becomes ready. */
26595
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26470
26596
  }).superRefine((v, ctx) => {
26471
26597
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26472
26598
  code: ZodIssueCode.custom,
@@ -26525,10 +26651,18 @@ var ExportBytesSchema = object({
26525
26651
  });
26526
26652
  method(object({
26527
26653
  deviceId: number(),
26528
- profile: string(),
26654
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26655
+ profile: string().optional(),
26656
+ profiles: array(string()).min(1).optional(),
26529
26657
  fromMs: number(),
26530
26658
  toMs: number(),
26531
26659
  options: ExportOptionsSchema
26660
+ }).superRefine((v, ctx) => {
26661
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26662
+ code: ZodIssueCode.custom,
26663
+ message: "pass profiles[] (min 1) or legacy profile",
26664
+ path: ["profiles"]
26665
+ });
26532
26666
  }), ExportRecordSchema, {
26533
26667
  kind: "mutation",
26534
26668
  auth: "protected"
@@ -29470,15 +29604,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29470
29604
  labels: ["probe not implemented"]
29471
29605
  };
29472
29606
  }
29473
- /**
29474
- * Top-level devices restored at once in {@link onRestoreDevices}.
29475
- *
29476
- * Four covers the fleets this ships to without turning a boot into a burst a
29477
- * camera NVR answers with a refusal. A provider whose upstream is a single
29478
- * session with a serial command channel (a Baichuan hub, an NVR that
29479
- * serialises ISAPI) should lower it; nothing needs to raise it.
29480
- */
29481
- restoreConcurrency = 4;
29482
29607
  async restoreDevices(savedDevices) {
29483
29608
  await this.onRestoreDevices(savedDevices);
29484
29609
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29533,14 +29658,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29533
29658
  });
29534
29659
  }
29535
29660
  };
29536
- let nextTopLevel = 0;
29537
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29538
- for (;;) {
29539
- const saved = topLevel[nextTopLevel++];
29540
- if (saved === void 0) return;
29541
- await restoreOne(saved);
29542
- }
29543
- }));
29661
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29544
29662
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29545
29663
  for (const saved of childRows) {
29546
29664
  const Class = this.deviceClasses[saved.type];
@@ -32813,6 +32931,12 @@ Object.freeze({
32813
32931
  addonId: null,
32814
32932
  access: "create"
32815
32933
  },
32934
+ "pipelineAnalytics.reconcileFromDisk": {
32935
+ capName: "pipeline-analytics",
32936
+ capScope: "device",
32937
+ addonId: null,
32938
+ access: "create"
32939
+ },
32816
32940
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32817
32941
  capName: "pipeline-analytics",
32818
32942
  capScope: "device",
@@ -33215,6 +33339,12 @@ Object.freeze({
33215
33339
  addonId: null,
33216
33340
  access: "view"
33217
33341
  },
33342
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33343
+ capName: "pipeline-orchestrator",
33344
+ capScope: "system",
33345
+ addonId: null,
33346
+ access: "view"
33347
+ },
33218
33348
  "pipelineOrchestrator.listAgentSettings": {
33219
33349
  capName: "pipeline-orchestrator",
33220
33350
  capScope: "system",
@@ -33239,6 +33369,12 @@ Object.freeze({
33239
33369
  addonId: null,
33240
33370
  access: "create"
33241
33371
  },
33372
+ "pipelineOrchestrator.reconcileFromDisk": {
33373
+ capName: "pipeline-orchestrator",
33374
+ capScope: "system",
33375
+ addonId: null,
33376
+ access: "create"
33377
+ },
33242
33378
  "pipelineOrchestrator.removeAgentSettings": {
33243
33379
  capName: "pipeline-orchestrator",
33244
33380
  capScope: "system",
@@ -36230,6 +36366,11 @@ Object.freeze({
36230
36366
  form: "single",
36231
36367
  optional: true
36232
36368
  }],
36369
+ "pipelineAnalytics.reconcileFromDisk": [{
36370
+ name: "deviceId",
36371
+ form: "single",
36372
+ optional: false
36373
+ }],
36233
36374
  "pipelineAnalytics.restageRetrainTrack": [{
36234
36375
  name: "deviceId",
36235
36376
  form: "single",
@@ -37295,6 +37436,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37295
37436
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37296
37437
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37297
37438
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37439
+ var MB = 1024 * 1024;
37440
+ 1024 * MB, 3072 * MB;
37298
37441
  //#endregion
37299
37442
  //#region src/config.ts
37300
37443
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-unraid",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "Unraid device-provider addon for CamStack — one Container per Unraid instance fanning out array, disk, docker and notification entities",
5
5
  "keywords": [
6
6
  "camstack",