@camstack/addon-provider-dreame 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
@@ -50504,7 +50504,7 @@ objectType({
50504
50504
  })
50505
50505
  });
50506
50506
  //#endregion
50507
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
50507
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
50508
50508
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
50509
50509
  EventCategory["SystemBoot"] = "system.boot";
50510
50510
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -50521,9 +50521,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
50521
50521
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
50522
50522
  /**
50523
50523
  * A newer addon or server-root package version was found by the
50524
- * authoritative registry check. Emitted once per
50525
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
50526
- * polling of the same result is deduplicated by the checker.
50524
+ * authoritative registry check. Emitted once when any observed
50525
+ * `latestVersion` changes (or a package/node first appears behind);
50526
+ * the payload carries the full currently-available list. Repeated
50527
+ * polling of the same latests is silent.
50527
50528
  */
50528
50529
  EventCategory["UpdateAvailable"] = "update.available";
50529
50530
  /**
@@ -50542,6 +50543,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
50542
50543
  EventCategory["AddonInstalled"] = "addon.installed";
50543
50544
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
50544
50545
  EventCategory["AddonCrashed"] = "addon.crashed";
50546
+ /**
50547
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
50548
+ *
50549
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
50550
+ * respawned"); this is the one that never resolves itself. Emitted exactly
50551
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
50552
+ * addons it hosted and the crash count that tripped the breaker.
50553
+ *
50554
+ * It exists because a runner marked terminally `failed` used to be SILENT:
50555
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
50556
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
50557
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
50558
+ * operator's phone told him. The Notification Center's system-event intake
50559
+ * consumes this category and maps it to the `addon-crash-loop` kind.
50560
+ */
50561
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
50545
50562
  EventCategory["AddonError"] = "addon.error";
50546
50563
  EventCategory["AddonPageReady"] = "addon.page-ready";
50547
50564
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -58053,6 +58070,10 @@ var RecordingBandSchema = object({
58053
58070
  preBufferSec: number().min(0).optional(),
58054
58071
  postBufferSec: number().min(0).optional()
58055
58072
  });
58073
+ ({
58074
+ preBufferSec: 10,
58075
+ postBufferSec: 30
58076
+ }).postBufferSec * 1e3;
58056
58077
  /**
58057
58078
  * Per-device retention overrides. Every field is optional; an unset or `0`
58058
58079
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -58100,6 +58121,12 @@ var RecordingConfigSchema = object({
58100
58121
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
58101
58122
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
58102
58123
  mode: RecordingStorageModeSchema.optional(),
58124
+ /**
58125
+ * Which assigned broker slots to record. Absent / empty = {@link
58126
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
58127
+ * camera's currently assigned slots — never `mid` unless the operator
58128
+ * picks it, and never a slot the broker has not assigned.
58129
+ */
58103
58130
  profiles: array(CamProfileSchema).optional(),
58104
58131
  segmentSeconds: number().int().positive().optional(),
58105
58132
  /**
@@ -58180,7 +58207,11 @@ var RelocateFootageInputSchema = object({
58180
58207
  profiles: array(string()).optional(),
58181
58208
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
58182
58209
  * never allowed to starve live writers. */
58183
- throttleMbps: number().min(1).max(1e3).optional()
58210
+ throttleMbps: number().min(1).max(1e3).optional(),
58211
+ /** Move only segments whose startMs is >= this. Absent = the whole source
58212
+ * pile. Used when a full drain is too expensive and the operator only
58213
+ * wants the recent window on the new disk. */
58214
+ sinceMs: number().int().optional()
58184
58215
  });
58185
58216
  /** Internal, lease-scoped participant operation. It is intentionally separate
58186
58217
  * from persistent recording settings: a migration never changes
@@ -65062,6 +65093,7 @@ var NcSystemEventKindSchema = _enum([
65062
65093
  "node-offline",
65063
65094
  "node-inference-unavailable",
65064
65095
  "detection-blind",
65096
+ "addon-crash-loop",
65065
65097
  "addon-update-available",
65066
65098
  "server-update-available",
65067
65099
  "alarm-triggered",
@@ -65069,6 +65101,9 @@ var NcSystemEventKindSchema = _enum([
65069
65101
  "alarm-disarmed",
65070
65102
  "alarm-arming",
65071
65103
  "alarm-arm-refused",
65104
+ "addon-updated",
65105
+ "server-updated",
65106
+ "export-completed",
65072
65107
  "camera-online",
65073
65108
  "camera-offline",
65074
65109
  "camera-disabled",
@@ -66962,13 +66997,19 @@ var RetrainStatusSchema = _enum([
66962
66997
  * "never marked" from "already trained" must read `retrainStatus`.
66963
66998
  *
66964
66999
  * `debug` does NOT pin; it is attention, not durability.
67000
+ *
67001
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
67002
+ * A favourited track is skipped by retention the same way `staging` is, but
67003
+ * it does not enter `none|staging|trained` and has no staging budget.
66965
67004
  */
66966
67005
  var TrackFlagFields = {
66967
67006
  /** Operator marked this track as training material — i.e. `retrainStatus` is
66968
67007
  * `'staging'`. */
66969
67008
  markForTrain: boolean().optional(),
66970
67009
  /** Operator marked this track for diagnostic attention. */
66971
- debug: boolean().optional()
67010
+ debug: boolean().optional(),
67011
+ /** Operator favourited this track. Pins it against pruning. */
67012
+ favourited: boolean().optional()
66972
67013
  };
66973
67014
  /**
66974
67015
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -66993,6 +67034,7 @@ var TrackFlagsSchema = object({
66993
67034
  trackId: string(),
66994
67035
  markForTrain: boolean(),
66995
67036
  debug: boolean(),
67037
+ favourited: boolean(),
66996
67038
  /** The lifecycle state the boolean was derived from. Required here (unlike on
66997
67039
  * a track row) because this shape is only ever produced by the write body,
66998
67040
  * which always knows it — and a surface that has just written needs to render
@@ -67625,6 +67667,12 @@ var TrackCascadeCountsSchema = object({
67625
67667
  /** Per-track CLIP search vectors removed (best-effort). */
67626
67668
  embeddings: number().int()
67627
67669
  });
67670
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
67671
+ var DiskReconcileCountsSchema = object({
67672
+ mediaDropped: number().int(),
67673
+ tracks: number().int(),
67674
+ events: number().int()
67675
+ });
67628
67676
  /** Event-store footprint for one camera. */
67629
67677
  var EventStoreDeviceFootprintSchema = object({
67630
67678
  deviceId: number(),
@@ -67801,6 +67849,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
67801
67849
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
67802
67850
  kind: "mutation",
67803
67851
  auth: "admin"
67852
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
67853
+ kind: "mutation",
67854
+ auth: "admin"
67804
67855
  }), method(object({
67805
67856
  deviceId: number(),
67806
67857
  trackIds: array(string()).min(1)
@@ -69351,6 +69402,24 @@ var CameraStatusDegradationSchema = object({
69351
69402
  *
69352
69403
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
69353
69404
  */
69405
+ var DiskReconcileJobSchema = object({
69406
+ state: _enum([
69407
+ "idle",
69408
+ "running",
69409
+ "done",
69410
+ "error"
69411
+ ]),
69412
+ total: number().int().nonnegative(),
69413
+ completed: number().int().nonnegative(),
69414
+ currentDeviceId: number().int().nullable(),
69415
+ failed: array(number().int()).readonly(),
69416
+ mediaDropped: number().int().nonnegative(),
69417
+ tracks: number().int().nonnegative(),
69418
+ events: number().int().nonnegative(),
69419
+ startedAtMs: number().int().nullable(),
69420
+ finishedAtMs: number().int().nullable(),
69421
+ error: string().nullable()
69422
+ });
69354
69423
  var CameraStatusSchema = object({
69355
69424
  deviceId: number(),
69356
69425
  assignment: CameraAssignmentStatusSchema,
@@ -69582,7 +69651,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
69582
69651
  }), CameraSwitchGroupSchema, {
69583
69652
  kind: "mutation",
69584
69653
  auth: "admin"
69585
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
69654
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
69655
+ kind: "mutation",
69656
+ auth: "admin"
69657
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
69586
69658
  name: string(),
69587
69659
  description: string().optional(),
69588
69660
  config: CameraPipelineConfigSchema
@@ -70655,20 +70727,6 @@ var VectorStatsResultSchema = object({
70655
70727
  exact: boolean()
70656
70728
  });
70657
70729
  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);
70658
- /**
70659
- * `videoclips` — the unified, navigable-clip surface for a camera.
70660
- *
70661
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
70662
- * provider per device, substitutable. The DEFAULT provider (registered by
70663
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
70664
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
70665
- * is a time-WINDOW over existing footage, never a separate file. A camera that
70666
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
70667
- * wrapper provider for its device and serve its own clip catalog + URLs.
70668
- *
70669
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
70670
- * temporal overlap, so the API never decides `continuous` vs `events`.
70671
- */
70672
70730
  var ClipSchema = object({
70673
70731
  /** Opaque, provider-namespaced id. The default provider encodes the time
70674
70732
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -70685,8 +70743,57 @@ var ClipSchema = object({
70685
70743
  startMs: number(),
70686
70744
  endMs: number()
70687
70745
  }),
70688
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
70689
- thumbnail: string().optional()
70746
+ /**
70747
+ * Lazy thumbnail URL, never inlined.
70748
+ *
70749
+ * Recording-derived clips (events-mode keep-window, and the prepared
70750
+ * continuous event+fragment visit) MUST use the snapshot of the **main
70751
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
70752
+ * of the event that owns `kind` (object > motion > audio). Do not extract
70753
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
70754
+ * mint their own stills.
70755
+ *
70756
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
70757
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
70758
+ * Absent is meaningful — "this visit has no event still" — never "we did not
70759
+ * look". Stamping it from a URL template made 35% of one camera's clips point
70760
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
70761
+ * A read that FAILS drops the claim; it never invents it.
70762
+ */
70763
+ thumbnail: string().optional(),
70764
+ /**
70765
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
70766
+ * can be decoded. Present whenever the visit came from recorded availability;
70767
+ * absent on a per-event padded window (there is no footage to promise).
70768
+ *
70769
+ * This is not a thumbnail and not a second byte path: it is the argument to
70770
+ * the recorder's existing still route. The surface — never the provider —
70771
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
70772
+ * contiguous range, not of the visit: a visit spans its holes by
70773
+ * construction, so a naive midpoint lands in dead air.
70774
+ */
70775
+ stillAtMs: number().optional(),
70776
+ /**
70777
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
70778
+ * first within kind (object → motion → audio), capped at
70779
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
70780
+ *
70781
+ * Bounded because it is not a payload the surface pages through: one visit on
70782
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
70783
+ * camera-day. Read {@link eventCount} for the true total.
70784
+ */
70785
+ eventIds: array(string()).optional(),
70786
+ /** How many analytics events actually overlap this visit. Differs from
70787
+ * `eventIds.length` exactly when the sample was capped — so a truncated
70788
+ * list is never mistaken for a quiet visit. */
70789
+ eventCount: number().int().nonnegative().optional(),
70790
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
70791
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
70792
+ * bar keeps showing them via `recording.getAvailability`. */
70793
+ holes: array(object({
70794
+ startMs: number(),
70795
+ endMs: number()
70796
+ })).optional()
70690
70797
  });
70691
70798
  var ClipPlaybackSchema = object({
70692
70799
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -71150,7 +71257,14 @@ var SearchResultSchema = object({
71150
71257
  });
71151
71258
  var AutoUpdateSettingsSchema = object({
71152
71259
  channel: ChannelSchema,
71153
- intervalSeconds: number()
71260
+ intervalSeconds: number(),
71261
+ /**
71262
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
71263
+ * `channel`: the poller runs while auto-apply is `off`, because being told
71264
+ * about a publish and installing it are different decisions. Clamped
71265
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
71266
+ */
71267
+ updateCheckIntervalSeconds: number()
71154
71268
  });
71155
71269
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
71156
71270
  var RestartAddonResultSchema = unknown();
@@ -71291,7 +71405,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
71291
71405
  auth: "admin"
71292
71406
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
71293
71407
  channel: ChannelSchema,
71294
- intervalSeconds: number().min(300).max(86400).optional()
71408
+ intervalSeconds: number().min(300).max(86400).optional(),
71409
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
71410
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
71295
71411
  }), unknown(), {
71296
71412
  kind: "mutation",
71297
71413
  auth: "admin"
@@ -76997,7 +77113,9 @@ var ExportOptionsSchema = object({
76997
77113
  includeAudio: boolean(),
76998
77114
  maxLifeMs: number().int().positive(),
76999
77115
  deleteAfterDownload: boolean(),
77000
- title: string().max(200).optional()
77116
+ title: string().max(200).optional(),
77117
+ /** Notification-output target ids to ping when this export becomes ready. */
77118
+ notifyTargetIds: array(string().min(1)).max(20).optional()
77001
77119
  }).superRefine((v, ctx) => {
77002
77120
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
77003
77121
  code: ZodIssueCode.custom,
@@ -77056,10 +77174,18 @@ var ExportBytesSchema = object({
77056
77174
  });
77057
77175
  method(object({
77058
77176
  deviceId: number(),
77059
- profile: string(),
77177
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
77178
+ profile: string().optional(),
77179
+ profiles: array(string()).min(1).optional(),
77060
77180
  fromMs: number(),
77061
77181
  toMs: number(),
77062
77182
  options: ExportOptionsSchema
77183
+ }).superRefine((v, ctx) => {
77184
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
77185
+ code: ZodIssueCode.custom,
77186
+ message: "pass profiles[] (min 1) or legacy profile",
77187
+ path: ["profiles"]
77188
+ });
77063
77189
  }), ExportRecordSchema, {
77064
77190
  kind: "mutation",
77065
77191
  auth: "protected"
@@ -80001,15 +80127,6 @@ var BaseDeviceProvider = class extends BaseAddon {
80001
80127
  labels: ["probe not implemented"]
80002
80128
  };
80003
80129
  }
80004
- /**
80005
- * Top-level devices restored at once in {@link onRestoreDevices}.
80006
- *
80007
- * Four covers the fleets this ships to without turning a boot into a burst a
80008
- * camera NVR answers with a refusal. A provider whose upstream is a single
80009
- * session with a serial command channel (a Baichuan hub, an NVR that
80010
- * serialises ISAPI) should lower it; nothing needs to raise it.
80011
- */
80012
- restoreConcurrency = 4;
80013
80130
  async restoreDevices(savedDevices) {
80014
80131
  await this.onRestoreDevices(savedDevices);
80015
80132
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -80064,14 +80181,7 @@ var BaseDeviceProvider = class extends BaseAddon {
80064
80181
  });
80065
80182
  }
80066
80183
  };
80067
- let nextTopLevel = 0;
80068
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
80069
- for (;;) {
80070
- const saved = topLevel[nextTopLevel++];
80071
- if (saved === void 0) return;
80072
- await restoreOne(saved);
80073
- }
80074
- }));
80184
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
80075
80185
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
80076
80186
  for (const saved of childRows) {
80077
80187
  const Class = this.deviceClasses[saved.type];
@@ -83344,6 +83454,12 @@ Object.freeze({
83344
83454
  addonId: null,
83345
83455
  access: "create"
83346
83456
  },
83457
+ "pipelineAnalytics.reconcileFromDisk": {
83458
+ capName: "pipeline-analytics",
83459
+ capScope: "device",
83460
+ addonId: null,
83461
+ access: "create"
83462
+ },
83347
83463
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
83348
83464
  capName: "pipeline-analytics",
83349
83465
  capScope: "device",
@@ -83746,6 +83862,12 @@ Object.freeze({
83746
83862
  addonId: null,
83747
83863
  access: "view"
83748
83864
  },
83865
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
83866
+ capName: "pipeline-orchestrator",
83867
+ capScope: "system",
83868
+ addonId: null,
83869
+ access: "view"
83870
+ },
83749
83871
  "pipelineOrchestrator.listAgentSettings": {
83750
83872
  capName: "pipeline-orchestrator",
83751
83873
  capScope: "system",
@@ -83770,6 +83892,12 @@ Object.freeze({
83770
83892
  addonId: null,
83771
83893
  access: "create"
83772
83894
  },
83895
+ "pipelineOrchestrator.reconcileFromDisk": {
83896
+ capName: "pipeline-orchestrator",
83897
+ capScope: "system",
83898
+ addonId: null,
83899
+ access: "create"
83900
+ },
83773
83901
  "pipelineOrchestrator.removeAgentSettings": {
83774
83902
  capName: "pipeline-orchestrator",
83775
83903
  capScope: "system",
@@ -86761,6 +86889,11 @@ Object.freeze({
86761
86889
  form: "single",
86762
86890
  optional: true
86763
86891
  }],
86892
+ "pipelineAnalytics.reconcileFromDisk": [{
86893
+ name: "deviceId",
86894
+ form: "single",
86895
+ optional: false
86896
+ }],
86764
86897
  "pipelineAnalytics.restageRetrainTrack": [{
86765
86898
  name: "deviceId",
86766
86899
  form: "single",
@@ -87826,6 +87959,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
87826
87959
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
87827
87960
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
87828
87961
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
87962
+ var MB = 1024 * 1024;
87963
+ 1024 * MB, 3072 * MB;
87829
87964
  //#endregion
87830
87965
  //#region src/config.ts
87831
87966
  /**
package/dist/addon.mjs CHANGED
@@ -50504,7 +50504,7 @@ objectType({
50504
50504
  })
50505
50505
  });
50506
50506
  //#endregion
50507
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
50507
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
50508
50508
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
50509
50509
  EventCategory["SystemBoot"] = "system.boot";
50510
50510
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -50521,9 +50521,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
50521
50521
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
50522
50522
  /**
50523
50523
  * A newer addon or server-root package version was found by the
50524
- * authoritative registry check. Emitted once per
50525
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
50526
- * polling of the same result is deduplicated by the checker.
50524
+ * authoritative registry check. Emitted once when any observed
50525
+ * `latestVersion` changes (or a package/node first appears behind);
50526
+ * the payload carries the full currently-available list. Repeated
50527
+ * polling of the same latests is silent.
50527
50528
  */
50528
50529
  EventCategory["UpdateAvailable"] = "update.available";
50529
50530
  /**
@@ -50542,6 +50543,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
50542
50543
  EventCategory["AddonInstalled"] = "addon.installed";
50543
50544
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
50544
50545
  EventCategory["AddonCrashed"] = "addon.crashed";
50546
+ /**
50547
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
50548
+ *
50549
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
50550
+ * respawned"); this is the one that never resolves itself. Emitted exactly
50551
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
50552
+ * addons it hosted and the crash count that tripped the breaker.
50553
+ *
50554
+ * It exists because a runner marked terminally `failed` used to be SILENT:
50555
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
50556
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
50557
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
50558
+ * operator's phone told him. The Notification Center's system-event intake
50559
+ * consumes this category and maps it to the `addon-crash-loop` kind.
50560
+ */
50561
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
50545
50562
  EventCategory["AddonError"] = "addon.error";
50546
50563
  EventCategory["AddonPageReady"] = "addon.page-ready";
50547
50564
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -58053,6 +58070,10 @@ var RecordingBandSchema = object({
58053
58070
  preBufferSec: number().min(0).optional(),
58054
58071
  postBufferSec: number().min(0).optional()
58055
58072
  });
58073
+ ({
58074
+ preBufferSec: 10,
58075
+ postBufferSec: 30
58076
+ }).postBufferSec * 1e3;
58056
58077
  /**
58057
58078
  * Per-device retention overrides. Every field is optional; an unset or `0`
58058
58079
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -58100,6 +58121,12 @@ var RecordingConfigSchema = object({
58100
58121
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
58101
58122
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
58102
58123
  mode: RecordingStorageModeSchema.optional(),
58124
+ /**
58125
+ * Which assigned broker slots to record. Absent / empty = {@link
58126
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
58127
+ * camera's currently assigned slots — never `mid` unless the operator
58128
+ * picks it, and never a slot the broker has not assigned.
58129
+ */
58103
58130
  profiles: array(CamProfileSchema).optional(),
58104
58131
  segmentSeconds: number().int().positive().optional(),
58105
58132
  /**
@@ -58180,7 +58207,11 @@ var RelocateFootageInputSchema = object({
58180
58207
  profiles: array(string()).optional(),
58181
58208
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
58182
58209
  * never allowed to starve live writers. */
58183
- throttleMbps: number().min(1).max(1e3).optional()
58210
+ throttleMbps: number().min(1).max(1e3).optional(),
58211
+ /** Move only segments whose startMs is >= this. Absent = the whole source
58212
+ * pile. Used when a full drain is too expensive and the operator only
58213
+ * wants the recent window on the new disk. */
58214
+ sinceMs: number().int().optional()
58184
58215
  });
58185
58216
  /** Internal, lease-scoped participant operation. It is intentionally separate
58186
58217
  * from persistent recording settings: a migration never changes
@@ -65062,6 +65093,7 @@ var NcSystemEventKindSchema = _enum([
65062
65093
  "node-offline",
65063
65094
  "node-inference-unavailable",
65064
65095
  "detection-blind",
65096
+ "addon-crash-loop",
65065
65097
  "addon-update-available",
65066
65098
  "server-update-available",
65067
65099
  "alarm-triggered",
@@ -65069,6 +65101,9 @@ var NcSystemEventKindSchema = _enum([
65069
65101
  "alarm-disarmed",
65070
65102
  "alarm-arming",
65071
65103
  "alarm-arm-refused",
65104
+ "addon-updated",
65105
+ "server-updated",
65106
+ "export-completed",
65072
65107
  "camera-online",
65073
65108
  "camera-offline",
65074
65109
  "camera-disabled",
@@ -66962,13 +66997,19 @@ var RetrainStatusSchema = _enum([
66962
66997
  * "never marked" from "already trained" must read `retrainStatus`.
66963
66998
  *
66964
66999
  * `debug` does NOT pin; it is attention, not durability.
67000
+ *
67001
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
67002
+ * A favourited track is skipped by retention the same way `staging` is, but
67003
+ * it does not enter `none|staging|trained` and has no staging budget.
66965
67004
  */
66966
67005
  var TrackFlagFields = {
66967
67006
  /** Operator marked this track as training material — i.e. `retrainStatus` is
66968
67007
  * `'staging'`. */
66969
67008
  markForTrain: boolean().optional(),
66970
67009
  /** Operator marked this track for diagnostic attention. */
66971
- debug: boolean().optional()
67010
+ debug: boolean().optional(),
67011
+ /** Operator favourited this track. Pins it against pruning. */
67012
+ favourited: boolean().optional()
66972
67013
  };
66973
67014
  /**
66974
67015
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -66993,6 +67034,7 @@ var TrackFlagsSchema = object({
66993
67034
  trackId: string(),
66994
67035
  markForTrain: boolean(),
66995
67036
  debug: boolean(),
67037
+ favourited: boolean(),
66996
67038
  /** The lifecycle state the boolean was derived from. Required here (unlike on
66997
67039
  * a track row) because this shape is only ever produced by the write body,
66998
67040
  * which always knows it — and a surface that has just written needs to render
@@ -67625,6 +67667,12 @@ var TrackCascadeCountsSchema = object({
67625
67667
  /** Per-track CLIP search vectors removed (best-effort). */
67626
67668
  embeddings: number().int()
67627
67669
  });
67670
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
67671
+ var DiskReconcileCountsSchema = object({
67672
+ mediaDropped: number().int(),
67673
+ tracks: number().int(),
67674
+ events: number().int()
67675
+ });
67628
67676
  /** Event-store footprint for one camera. */
67629
67677
  var EventStoreDeviceFootprintSchema = object({
67630
67678
  deviceId: number(),
@@ -67801,6 +67849,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
67801
67849
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
67802
67850
  kind: "mutation",
67803
67851
  auth: "admin"
67852
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
67853
+ kind: "mutation",
67854
+ auth: "admin"
67804
67855
  }), method(object({
67805
67856
  deviceId: number(),
67806
67857
  trackIds: array(string()).min(1)
@@ -69351,6 +69402,24 @@ var CameraStatusDegradationSchema = object({
69351
69402
  *
69352
69403
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
69353
69404
  */
69405
+ var DiskReconcileJobSchema = object({
69406
+ state: _enum([
69407
+ "idle",
69408
+ "running",
69409
+ "done",
69410
+ "error"
69411
+ ]),
69412
+ total: number().int().nonnegative(),
69413
+ completed: number().int().nonnegative(),
69414
+ currentDeviceId: number().int().nullable(),
69415
+ failed: array(number().int()).readonly(),
69416
+ mediaDropped: number().int().nonnegative(),
69417
+ tracks: number().int().nonnegative(),
69418
+ events: number().int().nonnegative(),
69419
+ startedAtMs: number().int().nullable(),
69420
+ finishedAtMs: number().int().nullable(),
69421
+ error: string().nullable()
69422
+ });
69354
69423
  var CameraStatusSchema = object({
69355
69424
  deviceId: number(),
69356
69425
  assignment: CameraAssignmentStatusSchema,
@@ -69582,7 +69651,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
69582
69651
  }), CameraSwitchGroupSchema, {
69583
69652
  kind: "mutation",
69584
69653
  auth: "admin"
69585
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
69654
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
69655
+ kind: "mutation",
69656
+ auth: "admin"
69657
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
69586
69658
  name: string(),
69587
69659
  description: string().optional(),
69588
69660
  config: CameraPipelineConfigSchema
@@ -70655,20 +70727,6 @@ var VectorStatsResultSchema = object({
70655
70727
  exact: boolean()
70656
70728
  });
70657
70729
  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);
70658
- /**
70659
- * `videoclips` — the unified, navigable-clip surface for a camera.
70660
- *
70661
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
70662
- * provider per device, substitutable. The DEFAULT provider (registered by
70663
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
70664
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
70665
- * is a time-WINDOW over existing footage, never a separate file. A camera that
70666
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
70667
- * wrapper provider for its device and serve its own clip catalog + URLs.
70668
- *
70669
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
70670
- * temporal overlap, so the API never decides `continuous` vs `events`.
70671
- */
70672
70730
  var ClipSchema = object({
70673
70731
  /** Opaque, provider-namespaced id. The default provider encodes the time
70674
70732
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -70685,8 +70743,57 @@ var ClipSchema = object({
70685
70743
  startMs: number(),
70686
70744
  endMs: number()
70687
70745
  }),
70688
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
70689
- thumbnail: string().optional()
70746
+ /**
70747
+ * Lazy thumbnail URL, never inlined.
70748
+ *
70749
+ * Recording-derived clips (events-mode keep-window, and the prepared
70750
+ * continuous event+fragment visit) MUST use the snapshot of the **main
70751
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
70752
+ * of the event that owns `kind` (object > motion > audio). Do not extract
70753
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
70754
+ * mint their own stills.
70755
+ *
70756
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
70757
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
70758
+ * Absent is meaningful — "this visit has no event still" — never "we did not
70759
+ * look". Stamping it from a URL template made 35% of one camera's clips point
70760
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
70761
+ * A read that FAILS drops the claim; it never invents it.
70762
+ */
70763
+ thumbnail: string().optional(),
70764
+ /**
70765
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
70766
+ * can be decoded. Present whenever the visit came from recorded availability;
70767
+ * absent on a per-event padded window (there is no footage to promise).
70768
+ *
70769
+ * This is not a thumbnail and not a second byte path: it is the argument to
70770
+ * the recorder's existing still route. The surface — never the provider —
70771
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
70772
+ * contiguous range, not of the visit: a visit spans its holes by
70773
+ * construction, so a naive midpoint lands in dead air.
70774
+ */
70775
+ stillAtMs: number().optional(),
70776
+ /**
70777
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
70778
+ * first within kind (object → motion → audio), capped at
70779
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
70780
+ *
70781
+ * Bounded because it is not a payload the surface pages through: one visit on
70782
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
70783
+ * camera-day. Read {@link eventCount} for the true total.
70784
+ */
70785
+ eventIds: array(string()).optional(),
70786
+ /** How many analytics events actually overlap this visit. Differs from
70787
+ * `eventIds.length` exactly when the sample was capped — so a truncated
70788
+ * list is never mistaken for a quiet visit. */
70789
+ eventCount: number().int().nonnegative().optional(),
70790
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
70791
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
70792
+ * bar keeps showing them via `recording.getAvailability`. */
70793
+ holes: array(object({
70794
+ startMs: number(),
70795
+ endMs: number()
70796
+ })).optional()
70690
70797
  });
70691
70798
  var ClipPlaybackSchema = object({
70692
70799
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -71150,7 +71257,14 @@ var SearchResultSchema = object({
71150
71257
  });
71151
71258
  var AutoUpdateSettingsSchema = object({
71152
71259
  channel: ChannelSchema,
71153
- intervalSeconds: number()
71260
+ intervalSeconds: number(),
71261
+ /**
71262
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
71263
+ * `channel`: the poller runs while auto-apply is `off`, because being told
71264
+ * about a publish and installing it are different decisions. Clamped
71265
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
71266
+ */
71267
+ updateCheckIntervalSeconds: number()
71154
71268
  });
71155
71269
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
71156
71270
  var RestartAddonResultSchema = unknown();
@@ -71291,7 +71405,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
71291
71405
  auth: "admin"
71292
71406
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
71293
71407
  channel: ChannelSchema,
71294
- intervalSeconds: number().min(300).max(86400).optional()
71408
+ intervalSeconds: number().min(300).max(86400).optional(),
71409
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
71410
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
71295
71411
  }), unknown(), {
71296
71412
  kind: "mutation",
71297
71413
  auth: "admin"
@@ -76997,7 +77113,9 @@ var ExportOptionsSchema = object({
76997
77113
  includeAudio: boolean(),
76998
77114
  maxLifeMs: number().int().positive(),
76999
77115
  deleteAfterDownload: boolean(),
77000
- title: string().max(200).optional()
77116
+ title: string().max(200).optional(),
77117
+ /** Notification-output target ids to ping when this export becomes ready. */
77118
+ notifyTargetIds: array(string().min(1)).max(20).optional()
77001
77119
  }).superRefine((v, ctx) => {
77002
77120
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
77003
77121
  code: ZodIssueCode.custom,
@@ -77056,10 +77174,18 @@ var ExportBytesSchema = object({
77056
77174
  });
77057
77175
  method(object({
77058
77176
  deviceId: number(),
77059
- profile: string(),
77177
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
77178
+ profile: string().optional(),
77179
+ profiles: array(string()).min(1).optional(),
77060
77180
  fromMs: number(),
77061
77181
  toMs: number(),
77062
77182
  options: ExportOptionsSchema
77183
+ }).superRefine((v, ctx) => {
77184
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
77185
+ code: ZodIssueCode.custom,
77186
+ message: "pass profiles[] (min 1) or legacy profile",
77187
+ path: ["profiles"]
77188
+ });
77063
77189
  }), ExportRecordSchema, {
77064
77190
  kind: "mutation",
77065
77191
  auth: "protected"
@@ -80001,15 +80127,6 @@ var BaseDeviceProvider = class extends BaseAddon {
80001
80127
  labels: ["probe not implemented"]
80002
80128
  };
80003
80129
  }
80004
- /**
80005
- * Top-level devices restored at once in {@link onRestoreDevices}.
80006
- *
80007
- * Four covers the fleets this ships to without turning a boot into a burst a
80008
- * camera NVR answers with a refusal. A provider whose upstream is a single
80009
- * session with a serial command channel (a Baichuan hub, an NVR that
80010
- * serialises ISAPI) should lower it; nothing needs to raise it.
80011
- */
80012
- restoreConcurrency = 4;
80013
80130
  async restoreDevices(savedDevices) {
80014
80131
  await this.onRestoreDevices(savedDevices);
80015
80132
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -80064,14 +80181,7 @@ var BaseDeviceProvider = class extends BaseAddon {
80064
80181
  });
80065
80182
  }
80066
80183
  };
80067
- let nextTopLevel = 0;
80068
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
80069
- for (;;) {
80070
- const saved = topLevel[nextTopLevel++];
80071
- if (saved === void 0) return;
80072
- await restoreOne(saved);
80073
- }
80074
- }));
80184
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
80075
80185
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
80076
80186
  for (const saved of childRows) {
80077
80187
  const Class = this.deviceClasses[saved.type];
@@ -83344,6 +83454,12 @@ Object.freeze({
83344
83454
  addonId: null,
83345
83455
  access: "create"
83346
83456
  },
83457
+ "pipelineAnalytics.reconcileFromDisk": {
83458
+ capName: "pipeline-analytics",
83459
+ capScope: "device",
83460
+ addonId: null,
83461
+ access: "create"
83462
+ },
83347
83463
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
83348
83464
  capName: "pipeline-analytics",
83349
83465
  capScope: "device",
@@ -83746,6 +83862,12 @@ Object.freeze({
83746
83862
  addonId: null,
83747
83863
  access: "view"
83748
83864
  },
83865
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
83866
+ capName: "pipeline-orchestrator",
83867
+ capScope: "system",
83868
+ addonId: null,
83869
+ access: "view"
83870
+ },
83749
83871
  "pipelineOrchestrator.listAgentSettings": {
83750
83872
  capName: "pipeline-orchestrator",
83751
83873
  capScope: "system",
@@ -83770,6 +83892,12 @@ Object.freeze({
83770
83892
  addonId: null,
83771
83893
  access: "create"
83772
83894
  },
83895
+ "pipelineOrchestrator.reconcileFromDisk": {
83896
+ capName: "pipeline-orchestrator",
83897
+ capScope: "system",
83898
+ addonId: null,
83899
+ access: "create"
83900
+ },
83773
83901
  "pipelineOrchestrator.removeAgentSettings": {
83774
83902
  capName: "pipeline-orchestrator",
83775
83903
  capScope: "system",
@@ -86761,6 +86889,11 @@ Object.freeze({
86761
86889
  form: "single",
86762
86890
  optional: true
86763
86891
  }],
86892
+ "pipelineAnalytics.reconcileFromDisk": [{
86893
+ name: "deviceId",
86894
+ form: "single",
86895
+ optional: false
86896
+ }],
86764
86897
  "pipelineAnalytics.restageRetrainTrack": [{
86765
86898
  name: "deviceId",
86766
86899
  form: "single",
@@ -87826,6 +87959,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
87826
87959
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
87827
87960
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
87828
87961
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
87962
+ var MB = 1024 * 1024;
87963
+ 1024 * MB, 3072 * MB;
87829
87964
  //#endregion
87830
87965
  //#region src/config.ts
87831
87966
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreame",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
5
5
  "keywords": [
6
6
  "camstack",