@camstack/addon-provider-vesync 0.2.20 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +179 -44
  2. package/dist/addon.mjs +179 -44
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -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,57 @@ 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
+ * Lazy thumbnail URL, never inlined.
20226
+ *
20227
+ * Recording-derived clips (events-mode keep-window, and the prepared
20228
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20229
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20230
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20231
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20232
+ * mint their own stills.
20233
+ *
20234
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20235
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20236
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20237
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20238
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20239
+ * A read that FAILS drops the claim; it never invents it.
20240
+ */
20241
+ thumbnail: string().optional(),
20242
+ /**
20243
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20244
+ * can be decoded. Present whenever the visit came from recorded availability;
20245
+ * absent on a per-event padded window (there is no footage to promise).
20246
+ *
20247
+ * This is not a thumbnail and not a second byte path: it is the argument to
20248
+ * the recorder's existing still route. The surface — never the provider —
20249
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20250
+ * contiguous range, not of the visit: a visit spans its holes by
20251
+ * construction, so a naive midpoint lands in dead air.
20252
+ */
20253
+ stillAtMs: number().optional(),
20254
+ /**
20255
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20256
+ * first within kind (object → motion → audio), capped at
20257
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20258
+ *
20259
+ * Bounded because it is not a payload the surface pages through: one visit on
20260
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20261
+ * camera-day. Read {@link eventCount} for the true total.
20262
+ */
20263
+ eventIds: array(string()).optional(),
20264
+ /** How many analytics events actually overlap this visit. Differs from
20265
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20266
+ * list is never mistaken for a quiet visit. */
20267
+ eventCount: number().int().nonnegative().optional(),
20268
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20269
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20270
+ * bar keeps showing them via `recording.getAvailability`. */
20271
+ holes: array(object({
20272
+ startMs: number(),
20273
+ endMs: number()
20274
+ })).optional()
20168
20275
  });
20169
20276
  var ClipPlaybackSchema = object({
20170
20277
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20628,7 +20735,14 @@ var SearchResultSchema = object({
20628
20735
  });
20629
20736
  var AutoUpdateSettingsSchema = object({
20630
20737
  channel: ChannelSchema,
20631
- intervalSeconds: number()
20738
+ intervalSeconds: number(),
20739
+ /**
20740
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20741
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20742
+ * about a publish and installing it are different decisions. Clamped
20743
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20744
+ */
20745
+ updateCheckIntervalSeconds: number()
20632
20746
  });
20633
20747
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20634
20748
  var RestartAddonResultSchema = unknown();
@@ -20769,7 +20883,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20769
20883
  auth: "admin"
20770
20884
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20771
20885
  channel: ChannelSchema,
20772
- intervalSeconds: number().min(300).max(86400).optional()
20886
+ intervalSeconds: number().min(300).max(86400).optional(),
20887
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20888
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20773
20889
  }), unknown(), {
20774
20890
  kind: "mutation",
20775
20891
  auth: "admin"
@@ -26450,7 +26566,9 @@ var ExportOptionsSchema = object({
26450
26566
  includeAudio: boolean(),
26451
26567
  maxLifeMs: number().int().positive(),
26452
26568
  deleteAfterDownload: boolean(),
26453
- title: string().max(200).optional()
26569
+ title: string().max(200).optional(),
26570
+ /** Notification-output target ids to ping when this export becomes ready. */
26571
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26454
26572
  }).superRefine((v, ctx) => {
26455
26573
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26456
26574
  code: ZodIssueCode.custom,
@@ -26509,10 +26627,18 @@ var ExportBytesSchema = object({
26509
26627
  });
26510
26628
  method(object({
26511
26629
  deviceId: number(),
26512
- profile: string(),
26630
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26631
+ profile: string().optional(),
26632
+ profiles: array(string()).min(1).optional(),
26513
26633
  fromMs: number(),
26514
26634
  toMs: number(),
26515
26635
  options: ExportOptionsSchema
26636
+ }).superRefine((v, ctx) => {
26637
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26638
+ code: ZodIssueCode.custom,
26639
+ message: "pass profiles[] (min 1) or legacy profile",
26640
+ path: ["profiles"]
26641
+ });
26516
26642
  }), ExportRecordSchema, {
26517
26643
  kind: "mutation",
26518
26644
  auth: "protected"
@@ -29454,15 +29580,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29454
29580
  labels: ["probe not implemented"]
29455
29581
  };
29456
29582
  }
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
29583
  async restoreDevices(savedDevices) {
29467
29584
  await this.onRestoreDevices(savedDevices);
29468
29585
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29517,14 +29634,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29517
29634
  });
29518
29635
  }
29519
29636
  };
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
- }));
29637
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29528
29638
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29529
29639
  for (const saved of childRows) {
29530
29640
  const Class = this.deviceClasses[saved.type];
@@ -32797,6 +32907,12 @@ Object.freeze({
32797
32907
  addonId: null,
32798
32908
  access: "create"
32799
32909
  },
32910
+ "pipelineAnalytics.reconcileFromDisk": {
32911
+ capName: "pipeline-analytics",
32912
+ capScope: "device",
32913
+ addonId: null,
32914
+ access: "create"
32915
+ },
32800
32916
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32801
32917
  capName: "pipeline-analytics",
32802
32918
  capScope: "device",
@@ -33199,6 +33315,12 @@ Object.freeze({
33199
33315
  addonId: null,
33200
33316
  access: "view"
33201
33317
  },
33318
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33319
+ capName: "pipeline-orchestrator",
33320
+ capScope: "system",
33321
+ addonId: null,
33322
+ access: "view"
33323
+ },
33202
33324
  "pipelineOrchestrator.listAgentSettings": {
33203
33325
  capName: "pipeline-orchestrator",
33204
33326
  capScope: "system",
@@ -33223,6 +33345,12 @@ Object.freeze({
33223
33345
  addonId: null,
33224
33346
  access: "create"
33225
33347
  },
33348
+ "pipelineOrchestrator.reconcileFromDisk": {
33349
+ capName: "pipeline-orchestrator",
33350
+ capScope: "system",
33351
+ addonId: null,
33352
+ access: "create"
33353
+ },
33226
33354
  "pipelineOrchestrator.removeAgentSettings": {
33227
33355
  capName: "pipeline-orchestrator",
33228
33356
  capScope: "system",
@@ -36214,6 +36342,11 @@ Object.freeze({
36214
36342
  form: "single",
36215
36343
  optional: true
36216
36344
  }],
36345
+ "pipelineAnalytics.reconcileFromDisk": [{
36346
+ name: "deviceId",
36347
+ form: "single",
36348
+ optional: false
36349
+ }],
36217
36350
  "pipelineAnalytics.restageRetrainTrack": [{
36218
36351
  name: "deviceId",
36219
36352
  form: "single",
@@ -37279,6 +37412,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37279
37412
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37280
37413
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37281
37414
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37415
+ var MB = 1024 * 1024;
37416
+ 1024 * MB, 3072 * MB;
37282
37417
  //#endregion
37283
37418
  //#region src/config.ts
37284
37419
  /**
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,57 @@ 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
+ * Lazy thumbnail URL, never inlined.
20225
+ *
20226
+ * Recording-derived clips (events-mode keep-window, and the prepared
20227
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20228
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20229
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20230
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20231
+ * mint their own stills.
20232
+ *
20233
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20234
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20235
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20236
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20237
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20238
+ * A read that FAILS drops the claim; it never invents it.
20239
+ */
20240
+ thumbnail: string().optional(),
20241
+ /**
20242
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20243
+ * can be decoded. Present whenever the visit came from recorded availability;
20244
+ * absent on a per-event padded window (there is no footage to promise).
20245
+ *
20246
+ * This is not a thumbnail and not a second byte path: it is the argument to
20247
+ * the recorder's existing still route. The surface — never the provider —
20248
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20249
+ * contiguous range, not of the visit: a visit spans its holes by
20250
+ * construction, so a naive midpoint lands in dead air.
20251
+ */
20252
+ stillAtMs: number().optional(),
20253
+ /**
20254
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20255
+ * first within kind (object → motion → audio), capped at
20256
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20257
+ *
20258
+ * Bounded because it is not a payload the surface pages through: one visit on
20259
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20260
+ * camera-day. Read {@link eventCount} for the true total.
20261
+ */
20262
+ eventIds: array(string()).optional(),
20263
+ /** How many analytics events actually overlap this visit. Differs from
20264
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20265
+ * list is never mistaken for a quiet visit. */
20266
+ eventCount: number().int().nonnegative().optional(),
20267
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20268
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20269
+ * bar keeps showing them via `recording.getAvailability`. */
20270
+ holes: array(object({
20271
+ startMs: number(),
20272
+ endMs: number()
20273
+ })).optional()
20167
20274
  });
20168
20275
  var ClipPlaybackSchema = object({
20169
20276
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20627,7 +20734,14 @@ var SearchResultSchema = object({
20627
20734
  });
20628
20735
  var AutoUpdateSettingsSchema = object({
20629
20736
  channel: ChannelSchema,
20630
- intervalSeconds: number()
20737
+ intervalSeconds: number(),
20738
+ /**
20739
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20740
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20741
+ * about a publish and installing it are different decisions. Clamped
20742
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20743
+ */
20744
+ updateCheckIntervalSeconds: number()
20631
20745
  });
20632
20746
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20633
20747
  var RestartAddonResultSchema = unknown();
@@ -20768,7 +20882,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20768
20882
  auth: "admin"
20769
20883
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20770
20884
  channel: ChannelSchema,
20771
- intervalSeconds: number().min(300).max(86400).optional()
20885
+ intervalSeconds: number().min(300).max(86400).optional(),
20886
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20887
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20772
20888
  }), unknown(), {
20773
20889
  kind: "mutation",
20774
20890
  auth: "admin"
@@ -26449,7 +26565,9 @@ var ExportOptionsSchema = object({
26449
26565
  includeAudio: boolean(),
26450
26566
  maxLifeMs: number().int().positive(),
26451
26567
  deleteAfterDownload: boolean(),
26452
- title: string().max(200).optional()
26568
+ title: string().max(200).optional(),
26569
+ /** Notification-output target ids to ping when this export becomes ready. */
26570
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26453
26571
  }).superRefine((v, ctx) => {
26454
26572
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26455
26573
  code: ZodIssueCode.custom,
@@ -26508,10 +26626,18 @@ var ExportBytesSchema = object({
26508
26626
  });
26509
26627
  method(object({
26510
26628
  deviceId: number(),
26511
- profile: string(),
26629
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26630
+ profile: string().optional(),
26631
+ profiles: array(string()).min(1).optional(),
26512
26632
  fromMs: number(),
26513
26633
  toMs: number(),
26514
26634
  options: ExportOptionsSchema
26635
+ }).superRefine((v, ctx) => {
26636
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26637
+ code: ZodIssueCode.custom,
26638
+ message: "pass profiles[] (min 1) or legacy profile",
26639
+ path: ["profiles"]
26640
+ });
26515
26641
  }), ExportRecordSchema, {
26516
26642
  kind: "mutation",
26517
26643
  auth: "protected"
@@ -29453,15 +29579,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29453
29579
  labels: ["probe not implemented"]
29454
29580
  };
29455
29581
  }
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
29582
  async restoreDevices(savedDevices) {
29466
29583
  await this.onRestoreDevices(savedDevices);
29467
29584
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29516,14 +29633,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29516
29633
  });
29517
29634
  }
29518
29635
  };
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
- }));
29636
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29527
29637
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29528
29638
  for (const saved of childRows) {
29529
29639
  const Class = this.deviceClasses[saved.type];
@@ -32796,6 +32906,12 @@ Object.freeze({
32796
32906
  addonId: null,
32797
32907
  access: "create"
32798
32908
  },
32909
+ "pipelineAnalytics.reconcileFromDisk": {
32910
+ capName: "pipeline-analytics",
32911
+ capScope: "device",
32912
+ addonId: null,
32913
+ access: "create"
32914
+ },
32799
32915
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32800
32916
  capName: "pipeline-analytics",
32801
32917
  capScope: "device",
@@ -33198,6 +33314,12 @@ Object.freeze({
33198
33314
  addonId: null,
33199
33315
  access: "view"
33200
33316
  },
33317
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33318
+ capName: "pipeline-orchestrator",
33319
+ capScope: "system",
33320
+ addonId: null,
33321
+ access: "view"
33322
+ },
33201
33323
  "pipelineOrchestrator.listAgentSettings": {
33202
33324
  capName: "pipeline-orchestrator",
33203
33325
  capScope: "system",
@@ -33222,6 +33344,12 @@ Object.freeze({
33222
33344
  addonId: null,
33223
33345
  access: "create"
33224
33346
  },
33347
+ "pipelineOrchestrator.reconcileFromDisk": {
33348
+ capName: "pipeline-orchestrator",
33349
+ capScope: "system",
33350
+ addonId: null,
33351
+ access: "create"
33352
+ },
33225
33353
  "pipelineOrchestrator.removeAgentSettings": {
33226
33354
  capName: "pipeline-orchestrator",
33227
33355
  capScope: "system",
@@ -36213,6 +36341,11 @@ Object.freeze({
36213
36341
  form: "single",
36214
36342
  optional: true
36215
36343
  }],
36344
+ "pipelineAnalytics.reconcileFromDisk": [{
36345
+ name: "deviceId",
36346
+ form: "single",
36347
+ optional: false
36348
+ }],
36216
36349
  "pipelineAnalytics.restageRetrainTrack": [{
36217
36350
  name: "deviceId",
36218
36351
  form: "single",
@@ -37278,6 +37411,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37278
37411
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37279
37412
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37280
37413
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37414
+ var MB = 1024 * 1024;
37415
+ 1024 * MB, 3072 * MB;
37281
37416
  //#endregion
37282
37417
  //#region src/config.ts
37283
37418
  /**
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.21",
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",