@camstack/addon-provider-vesync 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"
@@ -26450,7 +26574,9 @@ var ExportOptionsSchema = object({
26450
26574
  includeAudio: boolean(),
26451
26575
  maxLifeMs: number().int().positive(),
26452
26576
  deleteAfterDownload: boolean(),
26453
- title: string().max(200).optional()
26577
+ title: string().max(200).optional(),
26578
+ /** Notification-output target ids to ping when this export becomes ready. */
26579
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26454
26580
  }).superRefine((v, ctx) => {
26455
26581
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26456
26582
  code: ZodIssueCode.custom,
@@ -26509,10 +26635,18 @@ var ExportBytesSchema = object({
26509
26635
  });
26510
26636
  method(object({
26511
26637
  deviceId: number(),
26512
- profile: string(),
26638
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26639
+ profile: string().optional(),
26640
+ profiles: array(string()).min(1).optional(),
26513
26641
  fromMs: number(),
26514
26642
  toMs: number(),
26515
26643
  options: ExportOptionsSchema
26644
+ }).superRefine((v, ctx) => {
26645
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26646
+ code: ZodIssueCode.custom,
26647
+ message: "pass profiles[] (min 1) or legacy profile",
26648
+ path: ["profiles"]
26649
+ });
26516
26650
  }), ExportRecordSchema, {
26517
26651
  kind: "mutation",
26518
26652
  auth: "protected"
@@ -29454,15 +29588,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29454
29588
  labels: ["probe not implemented"]
29455
29589
  };
29456
29590
  }
29457
- /**
29458
- * Top-level devices restored at once in {@link onRestoreDevices}.
29459
- *
29460
- * Four covers the fleets this ships to without turning a boot into a burst a
29461
- * camera NVR answers with a refusal. A provider whose upstream is a single
29462
- * session with a serial command channel (a Baichuan hub, an NVR that
29463
- * serialises ISAPI) should lower it; nothing needs to raise it.
29464
- */
29465
- restoreConcurrency = 4;
29466
29591
  async restoreDevices(savedDevices) {
29467
29592
  await this.onRestoreDevices(savedDevices);
29468
29593
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29517,14 +29642,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29517
29642
  });
29518
29643
  }
29519
29644
  };
29520
- let nextTopLevel = 0;
29521
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29522
- for (;;) {
29523
- const saved = topLevel[nextTopLevel++];
29524
- if (saved === void 0) return;
29525
- await restoreOne(saved);
29526
- }
29527
- }));
29645
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29528
29646
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29529
29647
  for (const saved of childRows) {
29530
29648
  const Class = this.deviceClasses[saved.type];
@@ -32797,6 +32915,12 @@ Object.freeze({
32797
32915
  addonId: null,
32798
32916
  access: "create"
32799
32917
  },
32918
+ "pipelineAnalytics.reconcileFromDisk": {
32919
+ capName: "pipeline-analytics",
32920
+ capScope: "device",
32921
+ addonId: null,
32922
+ access: "create"
32923
+ },
32800
32924
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32801
32925
  capName: "pipeline-analytics",
32802
32926
  capScope: "device",
@@ -33199,6 +33323,12 @@ Object.freeze({
33199
33323
  addonId: null,
33200
33324
  access: "view"
33201
33325
  },
33326
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33327
+ capName: "pipeline-orchestrator",
33328
+ capScope: "system",
33329
+ addonId: null,
33330
+ access: "view"
33331
+ },
33202
33332
  "pipelineOrchestrator.listAgentSettings": {
33203
33333
  capName: "pipeline-orchestrator",
33204
33334
  capScope: "system",
@@ -33223,6 +33353,12 @@ Object.freeze({
33223
33353
  addonId: null,
33224
33354
  access: "create"
33225
33355
  },
33356
+ "pipelineOrchestrator.reconcileFromDisk": {
33357
+ capName: "pipeline-orchestrator",
33358
+ capScope: "system",
33359
+ addonId: null,
33360
+ access: "create"
33361
+ },
33226
33362
  "pipelineOrchestrator.removeAgentSettings": {
33227
33363
  capName: "pipeline-orchestrator",
33228
33364
  capScope: "system",
@@ -36214,6 +36350,11 @@ Object.freeze({
36214
36350
  form: "single",
36215
36351
  optional: true
36216
36352
  }],
36353
+ "pipelineAnalytics.reconcileFromDisk": [{
36354
+ name: "deviceId",
36355
+ form: "single",
36356
+ optional: false
36357
+ }],
36217
36358
  "pipelineAnalytics.restageRetrainTrack": [{
36218
36359
  name: "deviceId",
36219
36360
  form: "single",
@@ -37279,6 +37420,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37279
37420
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37280
37421
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37281
37422
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37423
+ var MB = 1024 * 1024;
37424
+ 1024 * MB, 3072 * MB;
37282
37425
  //#endregion
37283
37426
  //#region src/config.ts
37284
37427
  /**
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"
@@ -26449,7 +26573,9 @@ var ExportOptionsSchema = object({
26449
26573
  includeAudio: boolean(),
26450
26574
  maxLifeMs: number().int().positive(),
26451
26575
  deleteAfterDownload: boolean(),
26452
- title: string().max(200).optional()
26576
+ title: string().max(200).optional(),
26577
+ /** Notification-output target ids to ping when this export becomes ready. */
26578
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26453
26579
  }).superRefine((v, ctx) => {
26454
26580
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26455
26581
  code: ZodIssueCode.custom,
@@ -26508,10 +26634,18 @@ var ExportBytesSchema = object({
26508
26634
  });
26509
26635
  method(object({
26510
26636
  deviceId: number(),
26511
- profile: string(),
26637
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26638
+ profile: string().optional(),
26639
+ profiles: array(string()).min(1).optional(),
26512
26640
  fromMs: number(),
26513
26641
  toMs: number(),
26514
26642
  options: ExportOptionsSchema
26643
+ }).superRefine((v, ctx) => {
26644
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26645
+ code: ZodIssueCode.custom,
26646
+ message: "pass profiles[] (min 1) or legacy profile",
26647
+ path: ["profiles"]
26648
+ });
26515
26649
  }), ExportRecordSchema, {
26516
26650
  kind: "mutation",
26517
26651
  auth: "protected"
@@ -29453,15 +29587,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29453
29587
  labels: ["probe not implemented"]
29454
29588
  };
29455
29589
  }
29456
- /**
29457
- * Top-level devices restored at once in {@link onRestoreDevices}.
29458
- *
29459
- * Four covers the fleets this ships to without turning a boot into a burst a
29460
- * camera NVR answers with a refusal. A provider whose upstream is a single
29461
- * session with a serial command channel (a Baichuan hub, an NVR that
29462
- * serialises ISAPI) should lower it; nothing needs to raise it.
29463
- */
29464
- restoreConcurrency = 4;
29465
29590
  async restoreDevices(savedDevices) {
29466
29591
  await this.onRestoreDevices(savedDevices);
29467
29592
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29516,14 +29641,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29516
29641
  });
29517
29642
  }
29518
29643
  };
29519
- let nextTopLevel = 0;
29520
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29521
- for (;;) {
29522
- const saved = topLevel[nextTopLevel++];
29523
- if (saved === void 0) return;
29524
- await restoreOne(saved);
29525
- }
29526
- }));
29644
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29527
29645
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29528
29646
  for (const saved of childRows) {
29529
29647
  const Class = this.deviceClasses[saved.type];
@@ -32796,6 +32914,12 @@ Object.freeze({
32796
32914
  addonId: null,
32797
32915
  access: "create"
32798
32916
  },
32917
+ "pipelineAnalytics.reconcileFromDisk": {
32918
+ capName: "pipeline-analytics",
32919
+ capScope: "device",
32920
+ addonId: null,
32921
+ access: "create"
32922
+ },
32799
32923
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32800
32924
  capName: "pipeline-analytics",
32801
32925
  capScope: "device",
@@ -33198,6 +33322,12 @@ Object.freeze({
33198
33322
  addonId: null,
33199
33323
  access: "view"
33200
33324
  },
33325
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33326
+ capName: "pipeline-orchestrator",
33327
+ capScope: "system",
33328
+ addonId: null,
33329
+ access: "view"
33330
+ },
33201
33331
  "pipelineOrchestrator.listAgentSettings": {
33202
33332
  capName: "pipeline-orchestrator",
33203
33333
  capScope: "system",
@@ -33222,6 +33352,12 @@ Object.freeze({
33222
33352
  addonId: null,
33223
33353
  access: "create"
33224
33354
  },
33355
+ "pipelineOrchestrator.reconcileFromDisk": {
33356
+ capName: "pipeline-orchestrator",
33357
+ capScope: "system",
33358
+ addonId: null,
33359
+ access: "create"
33360
+ },
33225
33361
  "pipelineOrchestrator.removeAgentSettings": {
33226
33362
  capName: "pipeline-orchestrator",
33227
33363
  capScope: "system",
@@ -36213,6 +36349,11 @@ Object.freeze({
36213
36349
  form: "single",
36214
36350
  optional: true
36215
36351
  }],
36352
+ "pipelineAnalytics.reconcileFromDisk": [{
36353
+ name: "deviceId",
36354
+ form: "single",
36355
+ optional: false
36356
+ }],
36216
36357
  "pipelineAnalytics.restageRetrainTrack": [{
36217
36358
  name: "deviceId",
36218
36359
  form: "single",
@@ -37278,6 +37419,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37278
37419
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37279
37420
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37280
37421
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37422
+ var MB = 1024 * 1024;
37423
+ 1024 * MB, 3072 * MB;
37281
37424
  //#endregion
37282
37425
  //#region src/config.ts
37283
37426
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-vesync",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "VeSync cloud-account device-provider addon for CamStack — Levoit / Cosori air purifiers as Fan devices (power, speed, preset, child-lock, display, air-quality + filter-life sensors)",
5
5
  "keywords": [
6
6
  "camstack",