@camstack/addon-provider-rademacher 0.2.19 → 0.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +179 -44
  2. package/dist/addon.mjs +179 -44
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -984,7 +984,7 @@ var Rademacher = class {
984
984
  }
985
985
  };
986
986
  //#endregion
987
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
987
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
988
988
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
989
989
  EventCategory["SystemBoot"] = "system.boot";
990
990
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1001,9 +1001,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1001
1001
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
1002
1002
  /**
1003
1003
  * A newer addon or server-root package version was found by the
1004
- * authoritative registry check. Emitted once per
1005
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
1006
- * polling of the same result is deduplicated by the checker.
1004
+ * authoritative registry check. Emitted once when any observed
1005
+ * `latestVersion` changes (or a package/node first appears behind);
1006
+ * the payload carries the full currently-available list. Repeated
1007
+ * polling of the same latests is silent.
1007
1008
  */
1008
1009
  EventCategory["UpdateAvailable"] = "update.available";
1009
1010
  /**
@@ -1022,6 +1023,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1022
1023
  EventCategory["AddonInstalled"] = "addon.installed";
1023
1024
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
1024
1025
  EventCategory["AddonCrashed"] = "addon.crashed";
1026
+ /**
1027
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
1028
+ *
1029
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
1030
+ * respawned"); this is the one that never resolves itself. Emitted exactly
1031
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
1032
+ * addons it hosted and the crash count that tripped the breaker.
1033
+ *
1034
+ * It exists because a runner marked terminally `failed` used to be SILENT:
1035
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
1036
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
1037
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
1038
+ * operator's phone told him. The Notification Center's system-event intake
1039
+ * consumes this category and maps it to the `addon-crash-loop` kind.
1040
+ */
1041
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
1025
1042
  EventCategory["AddonError"] = "addon.error";
1026
1043
  EventCategory["AddonPageReady"] = "addon.page-ready";
1027
1044
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -8533,6 +8550,10 @@ var RecordingBandSchema = object({
8533
8550
  preBufferSec: number().min(0).optional(),
8534
8551
  postBufferSec: number().min(0).optional()
8535
8552
  });
8553
+ ({
8554
+ preBufferSec: 10,
8555
+ postBufferSec: 30
8556
+ }).postBufferSec * 1e3;
8536
8557
  /**
8537
8558
  * Per-device retention overrides. Every field is optional; an unset or `0`
8538
8559
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -8580,6 +8601,12 @@ var RecordingConfigSchema = object({
8580
8601
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
8581
8602
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
8582
8603
  mode: RecordingStorageModeSchema.optional(),
8604
+ /**
8605
+ * Which assigned broker slots to record. Absent / empty = {@link
8606
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
8607
+ * camera's currently assigned slots — never `mid` unless the operator
8608
+ * picks it, and never a slot the broker has not assigned.
8609
+ */
8583
8610
  profiles: array(CamProfileSchema).optional(),
8584
8611
  segmentSeconds: number().int().positive().optional(),
8585
8612
  /**
@@ -8660,7 +8687,11 @@ var RelocateFootageInputSchema = object({
8660
8687
  profiles: array(string()).optional(),
8661
8688
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
8662
8689
  * never allowed to starve live writers. */
8663
- throttleMbps: number().min(1).max(1e3).optional()
8690
+ throttleMbps: number().min(1).max(1e3).optional(),
8691
+ /** Move only segments whose startMs is >= this. Absent = the whole source
8692
+ * pile. Used when a full drain is too expensive and the operator only
8693
+ * wants the recent window on the new disk. */
8694
+ sinceMs: number().int().optional()
8664
8695
  });
8665
8696
  /** Internal, lease-scoped participant operation. It is intentionally separate
8666
8697
  * from persistent recording settings: a migration never changes
@@ -15525,6 +15556,7 @@ var NcSystemEventKindSchema = _enum([
15525
15556
  "node-offline",
15526
15557
  "node-inference-unavailable",
15527
15558
  "detection-blind",
15559
+ "addon-crash-loop",
15528
15560
  "addon-update-available",
15529
15561
  "server-update-available",
15530
15562
  "alarm-triggered",
@@ -15532,6 +15564,9 @@ var NcSystemEventKindSchema = _enum([
15532
15564
  "alarm-disarmed",
15533
15565
  "alarm-arming",
15534
15566
  "alarm-arm-refused",
15567
+ "addon-updated",
15568
+ "server-updated",
15569
+ "export-completed",
15535
15570
  "camera-online",
15536
15571
  "camera-offline",
15537
15572
  "camera-disabled",
@@ -17425,13 +17460,19 @@ var RetrainStatusSchema = _enum([
17425
17460
  * "never marked" from "already trained" must read `retrainStatus`.
17426
17461
  *
17427
17462
  * `debug` does NOT pin; it is attention, not durability.
17463
+ *
17464
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17465
+ * A favourited track is skipped by retention the same way `staging` is, but
17466
+ * it does not enter `none|staging|trained` and has no staging budget.
17428
17467
  */
17429
17468
  var TrackFlagFields = {
17430
17469
  /** Operator marked this track as training material — i.e. `retrainStatus` is
17431
17470
  * `'staging'`. */
17432
17471
  markForTrain: boolean().optional(),
17433
17472
  /** Operator marked this track for diagnostic attention. */
17434
- debug: boolean().optional()
17473
+ debug: boolean().optional(),
17474
+ /** Operator favourited this track. Pins it against pruning. */
17475
+ favourited: boolean().optional()
17435
17476
  };
17436
17477
  /**
17437
17478
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -17456,6 +17497,7 @@ var TrackFlagsSchema = object({
17456
17497
  trackId: string(),
17457
17498
  markForTrain: boolean(),
17458
17499
  debug: boolean(),
17500
+ favourited: boolean(),
17459
17501
  /** The lifecycle state the boolean was derived from. Required here (unlike on
17460
17502
  * a track row) because this shape is only ever produced by the write body,
17461
17503
  * which always knows it — and a surface that has just written needs to render
@@ -18088,6 +18130,12 @@ var TrackCascadeCountsSchema = object({
18088
18130
  /** Per-track CLIP search vectors removed (best-effort). */
18089
18131
  embeddings: number().int()
18090
18132
  });
18133
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
18134
+ var DiskReconcileCountsSchema = object({
18135
+ mediaDropped: number().int(),
18136
+ tracks: number().int(),
18137
+ events: number().int()
18138
+ });
18091
18139
  /** Event-store footprint for one camera. */
18092
18140
  var EventStoreDeviceFootprintSchema = object({
18093
18141
  deviceId: number(),
@@ -18264,6 +18312,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18264
18312
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18265
18313
  kind: "mutation",
18266
18314
  auth: "admin"
18315
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18316
+ kind: "mutation",
18317
+ auth: "admin"
18267
18318
  }), method(object({
18268
18319
  deviceId: number(),
18269
18320
  trackIds: array(string()).min(1)
@@ -19814,6 +19865,24 @@ var CameraStatusDegradationSchema = object({
19814
19865
  *
19815
19866
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
19816
19867
  */
19868
+ var DiskReconcileJobSchema = object({
19869
+ state: _enum([
19870
+ "idle",
19871
+ "running",
19872
+ "done",
19873
+ "error"
19874
+ ]),
19875
+ total: number().int().nonnegative(),
19876
+ completed: number().int().nonnegative(),
19877
+ currentDeviceId: number().int().nullable(),
19878
+ failed: array(number().int()).readonly(),
19879
+ mediaDropped: number().int().nonnegative(),
19880
+ tracks: number().int().nonnegative(),
19881
+ events: number().int().nonnegative(),
19882
+ startedAtMs: number().int().nullable(),
19883
+ finishedAtMs: number().int().nullable(),
19884
+ error: string().nullable()
19885
+ });
19817
19886
  var CameraStatusSchema = object({
19818
19887
  deviceId: number(),
19819
19888
  assignment: CameraAssignmentStatusSchema,
@@ -20045,7 +20114,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
20045
20114
  }), CameraSwitchGroupSchema, {
20046
20115
  kind: "mutation",
20047
20116
  auth: "admin"
20048
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
20117
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
20118
+ kind: "mutation",
20119
+ auth: "admin"
20120
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
20049
20121
  name: string(),
20050
20122
  description: string().optional(),
20051
20123
  config: CameraPipelineConfigSchema
@@ -21118,20 +21190,6 @@ var VectorStatsResultSchema = object({
21118
21190
  exact: boolean()
21119
21191
  });
21120
21192
  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);
21121
- /**
21122
- * `videoclips` — the unified, navigable-clip surface for a camera.
21123
- *
21124
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
21125
- * provider per device, substitutable. The DEFAULT provider (registered by
21126
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
21127
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
21128
- * is a time-WINDOW over existing footage, never a separate file. A camera that
21129
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
21130
- * wrapper provider for its device and serve its own clip catalog + URLs.
21131
- *
21132
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
21133
- * temporal overlap, so the API never decides `continuous` vs `events`.
21134
- */
21135
21193
  var ClipSchema = object({
21136
21194
  /** Opaque, provider-namespaced id. The default provider encodes the time
21137
21195
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -21148,8 +21206,57 @@ var ClipSchema = object({
21148
21206
  startMs: number(),
21149
21207
  endMs: number()
21150
21208
  }),
21151
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
21152
- thumbnail: string().optional()
21209
+ /**
21210
+ * Lazy thumbnail URL, never inlined.
21211
+ *
21212
+ * Recording-derived clips (events-mode keep-window, and the prepared
21213
+ * continuous event+fragment visit) MUST use the snapshot of the **main
21214
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
21215
+ * of the event that owns `kind` (object > motion > audio). Do not extract
21216
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
21217
+ * mint their own stills.
21218
+ *
21219
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
21220
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
21221
+ * Absent is meaningful — "this visit has no event still" — never "we did not
21222
+ * look". Stamping it from a URL template made 35% of one camera's clips point
21223
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
21224
+ * A read that FAILS drops the claim; it never invents it.
21225
+ */
21226
+ thumbnail: string().optional(),
21227
+ /**
21228
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
21229
+ * can be decoded. Present whenever the visit came from recorded availability;
21230
+ * absent on a per-event padded window (there is no footage to promise).
21231
+ *
21232
+ * This is not a thumbnail and not a second byte path: it is the argument to
21233
+ * the recorder's existing still route. The surface — never the provider —
21234
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
21235
+ * contiguous range, not of the visit: a visit spans its holes by
21236
+ * construction, so a naive midpoint lands in dead air.
21237
+ */
21238
+ stillAtMs: number().optional(),
21239
+ /**
21240
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
21241
+ * first within kind (object → motion → audio), capped at
21242
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
21243
+ *
21244
+ * Bounded because it is not a payload the surface pages through: one visit on
21245
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
21246
+ * camera-day. Read {@link eventCount} for the true total.
21247
+ */
21248
+ eventIds: array(string()).optional(),
21249
+ /** How many analytics events actually overlap this visit. Differs from
21250
+ * `eventIds.length` exactly when the sample was capped — so a truncated
21251
+ * list is never mistaken for a quiet visit. */
21252
+ eventCount: number().int().nonnegative().optional(),
21253
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
21254
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
21255
+ * bar keeps showing them via `recording.getAvailability`. */
21256
+ holes: array(object({
21257
+ startMs: number(),
21258
+ endMs: number()
21259
+ })).optional()
21153
21260
  });
21154
21261
  var ClipPlaybackSchema = object({
21155
21262
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -21613,7 +21720,14 @@ var SearchResultSchema = object({
21613
21720
  });
21614
21721
  var AutoUpdateSettingsSchema = object({
21615
21722
  channel: ChannelSchema,
21616
- intervalSeconds: number()
21723
+ intervalSeconds: number(),
21724
+ /**
21725
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
21726
+ * `channel`: the poller runs while auto-apply is `off`, because being told
21727
+ * about a publish and installing it are different decisions. Clamped
21728
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
21729
+ */
21730
+ updateCheckIntervalSeconds: number()
21617
21731
  });
21618
21732
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21619
21733
  var RestartAddonResultSchema = unknown();
@@ -21754,7 +21868,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21754
21868
  auth: "admin"
21755
21869
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21756
21870
  channel: ChannelSchema,
21757
- intervalSeconds: number().min(300).max(86400).optional()
21871
+ intervalSeconds: number().min(300).max(86400).optional(),
21872
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21873
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21758
21874
  }), unknown(), {
21759
21875
  kind: "mutation",
21760
21876
  auth: "admin"
@@ -27435,7 +27551,9 @@ var ExportOptionsSchema = object({
27435
27551
  includeAudio: boolean(),
27436
27552
  maxLifeMs: number().int().positive(),
27437
27553
  deleteAfterDownload: boolean(),
27438
- title: string().max(200).optional()
27554
+ title: string().max(200).optional(),
27555
+ /** Notification-output target ids to ping when this export becomes ready. */
27556
+ notifyTargetIds: array(string().min(1)).max(20).optional()
27439
27557
  }).superRefine((v, ctx) => {
27440
27558
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
27441
27559
  code: ZodIssueCode.custom,
@@ -27494,10 +27612,18 @@ var ExportBytesSchema = object({
27494
27612
  });
27495
27613
  method(object({
27496
27614
  deviceId: number(),
27497
- profile: string(),
27615
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
27616
+ profile: string().optional(),
27617
+ profiles: array(string()).min(1).optional(),
27498
27618
  fromMs: number(),
27499
27619
  toMs: number(),
27500
27620
  options: ExportOptionsSchema
27621
+ }).superRefine((v, ctx) => {
27622
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
27623
+ code: ZodIssueCode.custom,
27624
+ message: "pass profiles[] (min 1) or legacy profile",
27625
+ path: ["profiles"]
27626
+ });
27501
27627
  }), ExportRecordSchema, {
27502
27628
  kind: "mutation",
27503
27629
  auth: "protected"
@@ -30439,15 +30565,6 @@ var BaseDeviceProvider = class extends BaseAddon {
30439
30565
  labels: ["probe not implemented"]
30440
30566
  };
30441
30567
  }
30442
- /**
30443
- * Top-level devices restored at once in {@link onRestoreDevices}.
30444
- *
30445
- * Four covers the fleets this ships to without turning a boot into a burst a
30446
- * camera NVR answers with a refusal. A provider whose upstream is a single
30447
- * session with a serial command channel (a Baichuan hub, an NVR that
30448
- * serialises ISAPI) should lower it; nothing needs to raise it.
30449
- */
30450
- restoreConcurrency = 4;
30451
30568
  async restoreDevices(savedDevices) {
30452
30569
  await this.onRestoreDevices(savedDevices);
30453
30570
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -30502,14 +30619,7 @@ var BaseDeviceProvider = class extends BaseAddon {
30502
30619
  });
30503
30620
  }
30504
30621
  };
30505
- let nextTopLevel = 0;
30506
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
30507
- for (;;) {
30508
- const saved = topLevel[nextTopLevel++];
30509
- if (saved === void 0) return;
30510
- await restoreOne(saved);
30511
- }
30512
- }));
30622
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
30513
30623
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
30514
30624
  for (const saved of childRows) {
30515
30625
  const Class = this.deviceClasses[saved.type];
@@ -33782,6 +33892,12 @@ Object.freeze({
33782
33892
  addonId: null,
33783
33893
  access: "create"
33784
33894
  },
33895
+ "pipelineAnalytics.reconcileFromDisk": {
33896
+ capName: "pipeline-analytics",
33897
+ capScope: "device",
33898
+ addonId: null,
33899
+ access: "create"
33900
+ },
33785
33901
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33786
33902
  capName: "pipeline-analytics",
33787
33903
  capScope: "device",
@@ -34184,6 +34300,12 @@ Object.freeze({
34184
34300
  addonId: null,
34185
34301
  access: "view"
34186
34302
  },
34303
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
34304
+ capName: "pipeline-orchestrator",
34305
+ capScope: "system",
34306
+ addonId: null,
34307
+ access: "view"
34308
+ },
34187
34309
  "pipelineOrchestrator.listAgentSettings": {
34188
34310
  capName: "pipeline-orchestrator",
34189
34311
  capScope: "system",
@@ -34208,6 +34330,12 @@ Object.freeze({
34208
34330
  addonId: null,
34209
34331
  access: "create"
34210
34332
  },
34333
+ "pipelineOrchestrator.reconcileFromDisk": {
34334
+ capName: "pipeline-orchestrator",
34335
+ capScope: "system",
34336
+ addonId: null,
34337
+ access: "create"
34338
+ },
34211
34339
  "pipelineOrchestrator.removeAgentSettings": {
34212
34340
  capName: "pipeline-orchestrator",
34213
34341
  capScope: "system",
@@ -37199,6 +37327,11 @@ Object.freeze({
37199
37327
  form: "single",
37200
37328
  optional: true
37201
37329
  }],
37330
+ "pipelineAnalytics.reconcileFromDisk": [{
37331
+ name: "deviceId",
37332
+ form: "single",
37333
+ optional: false
37334
+ }],
37202
37335
  "pipelineAnalytics.restageRetrainTrack": [{
37203
37336
  name: "deviceId",
37204
37337
  form: "single",
@@ -38264,6 +38397,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38264
38397
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38265
38398
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38266
38399
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38400
+ var MB = 1024 * 1024;
38401
+ 1024 * MB, 3072 * MB;
38267
38402
  //#endregion
38268
38403
  //#region src/config.ts
38269
38404
  /**
package/dist/addon.mjs CHANGED
@@ -983,7 +983,7 @@ var Rademacher = class {
983
983
  }
984
984
  };
985
985
  //#endregion
986
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
986
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
987
987
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
988
988
  EventCategory["SystemBoot"] = "system.boot";
989
989
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1000,9 +1000,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1000
1000
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
1001
1001
  /**
1002
1002
  * A newer addon or server-root package version was found by the
1003
- * authoritative registry check. Emitted once per
1004
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
1005
- * polling of the same result is deduplicated by the checker.
1003
+ * authoritative registry check. Emitted once when any observed
1004
+ * `latestVersion` changes (or a package/node first appears behind);
1005
+ * the payload carries the full currently-available list. Repeated
1006
+ * polling of the same latests is silent.
1006
1007
  */
1007
1008
  EventCategory["UpdateAvailable"] = "update.available";
1008
1009
  /**
@@ -1021,6 +1022,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1021
1022
  EventCategory["AddonInstalled"] = "addon.installed";
1022
1023
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
1023
1024
  EventCategory["AddonCrashed"] = "addon.crashed";
1025
+ /**
1026
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
1027
+ *
1028
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
1029
+ * respawned"); this is the one that never resolves itself. Emitted exactly
1030
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
1031
+ * addons it hosted and the crash count that tripped the breaker.
1032
+ *
1033
+ * It exists because a runner marked terminally `failed` used to be SILENT:
1034
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
1035
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
1036
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
1037
+ * operator's phone told him. The Notification Center's system-event intake
1038
+ * consumes this category and maps it to the `addon-crash-loop` kind.
1039
+ */
1040
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
1024
1041
  EventCategory["AddonError"] = "addon.error";
1025
1042
  EventCategory["AddonPageReady"] = "addon.page-ready";
1026
1043
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -8532,6 +8549,10 @@ var RecordingBandSchema = object({
8532
8549
  preBufferSec: number().min(0).optional(),
8533
8550
  postBufferSec: number().min(0).optional()
8534
8551
  });
8552
+ ({
8553
+ preBufferSec: 10,
8554
+ postBufferSec: 30
8555
+ }).postBufferSec * 1e3;
8535
8556
  /**
8536
8557
  * Per-device retention overrides. Every field is optional; an unset or `0`
8537
8558
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -8579,6 +8600,12 @@ var RecordingConfigSchema = object({
8579
8600
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
8580
8601
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
8581
8602
  mode: RecordingStorageModeSchema.optional(),
8603
+ /**
8604
+ * Which assigned broker slots to record. Absent / empty = {@link
8605
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
8606
+ * camera's currently assigned slots — never `mid` unless the operator
8607
+ * picks it, and never a slot the broker has not assigned.
8608
+ */
8582
8609
  profiles: array(CamProfileSchema).optional(),
8583
8610
  segmentSeconds: number().int().positive().optional(),
8584
8611
  /**
@@ -8659,7 +8686,11 @@ var RelocateFootageInputSchema = object({
8659
8686
  profiles: array(string()).optional(),
8660
8687
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
8661
8688
  * never allowed to starve live writers. */
8662
- throttleMbps: number().min(1).max(1e3).optional()
8689
+ throttleMbps: number().min(1).max(1e3).optional(),
8690
+ /** Move only segments whose startMs is >= this. Absent = the whole source
8691
+ * pile. Used when a full drain is too expensive and the operator only
8692
+ * wants the recent window on the new disk. */
8693
+ sinceMs: number().int().optional()
8663
8694
  });
8664
8695
  /** Internal, lease-scoped participant operation. It is intentionally separate
8665
8696
  * from persistent recording settings: a migration never changes
@@ -15524,6 +15555,7 @@ var NcSystemEventKindSchema = _enum([
15524
15555
  "node-offline",
15525
15556
  "node-inference-unavailable",
15526
15557
  "detection-blind",
15558
+ "addon-crash-loop",
15527
15559
  "addon-update-available",
15528
15560
  "server-update-available",
15529
15561
  "alarm-triggered",
@@ -15531,6 +15563,9 @@ var NcSystemEventKindSchema = _enum([
15531
15563
  "alarm-disarmed",
15532
15564
  "alarm-arming",
15533
15565
  "alarm-arm-refused",
15566
+ "addon-updated",
15567
+ "server-updated",
15568
+ "export-completed",
15534
15569
  "camera-online",
15535
15570
  "camera-offline",
15536
15571
  "camera-disabled",
@@ -17424,13 +17459,19 @@ var RetrainStatusSchema = _enum([
17424
17459
  * "never marked" from "already trained" must read `retrainStatus`.
17425
17460
  *
17426
17461
  * `debug` does NOT pin; it is attention, not durability.
17462
+ *
17463
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17464
+ * A favourited track is skipped by retention the same way `staging` is, but
17465
+ * it does not enter `none|staging|trained` and has no staging budget.
17427
17466
  */
17428
17467
  var TrackFlagFields = {
17429
17468
  /** Operator marked this track as training material — i.e. `retrainStatus` is
17430
17469
  * `'staging'`. */
17431
17470
  markForTrain: boolean().optional(),
17432
17471
  /** Operator marked this track for diagnostic attention. */
17433
- debug: boolean().optional()
17472
+ debug: boolean().optional(),
17473
+ /** Operator favourited this track. Pins it against pruning. */
17474
+ favourited: boolean().optional()
17434
17475
  };
17435
17476
  /**
17436
17477
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -17455,6 +17496,7 @@ var TrackFlagsSchema = object({
17455
17496
  trackId: string(),
17456
17497
  markForTrain: boolean(),
17457
17498
  debug: boolean(),
17499
+ favourited: boolean(),
17458
17500
  /** The lifecycle state the boolean was derived from. Required here (unlike on
17459
17501
  * a track row) because this shape is only ever produced by the write body,
17460
17502
  * which always knows it — and a surface that has just written needs to render
@@ -18087,6 +18129,12 @@ var TrackCascadeCountsSchema = object({
18087
18129
  /** Per-track CLIP search vectors removed (best-effort). */
18088
18130
  embeddings: number().int()
18089
18131
  });
18132
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
18133
+ var DiskReconcileCountsSchema = object({
18134
+ mediaDropped: number().int(),
18135
+ tracks: number().int(),
18136
+ events: number().int()
18137
+ });
18090
18138
  /** Event-store footprint for one camera. */
18091
18139
  var EventStoreDeviceFootprintSchema = object({
18092
18140
  deviceId: number(),
@@ -18263,6 +18311,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18263
18311
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18264
18312
  kind: "mutation",
18265
18313
  auth: "admin"
18314
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18315
+ kind: "mutation",
18316
+ auth: "admin"
18266
18317
  }), method(object({
18267
18318
  deviceId: number(),
18268
18319
  trackIds: array(string()).min(1)
@@ -19813,6 +19864,24 @@ var CameraStatusDegradationSchema = object({
19813
19864
  *
19814
19865
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
19815
19866
  */
19867
+ var DiskReconcileJobSchema = object({
19868
+ state: _enum([
19869
+ "idle",
19870
+ "running",
19871
+ "done",
19872
+ "error"
19873
+ ]),
19874
+ total: number().int().nonnegative(),
19875
+ completed: number().int().nonnegative(),
19876
+ currentDeviceId: number().int().nullable(),
19877
+ failed: array(number().int()).readonly(),
19878
+ mediaDropped: number().int().nonnegative(),
19879
+ tracks: number().int().nonnegative(),
19880
+ events: number().int().nonnegative(),
19881
+ startedAtMs: number().int().nullable(),
19882
+ finishedAtMs: number().int().nullable(),
19883
+ error: string().nullable()
19884
+ });
19816
19885
  var CameraStatusSchema = object({
19817
19886
  deviceId: number(),
19818
19887
  assignment: CameraAssignmentStatusSchema,
@@ -20044,7 +20113,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
20044
20113
  }), CameraSwitchGroupSchema, {
20045
20114
  kind: "mutation",
20046
20115
  auth: "admin"
20047
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
20116
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
20117
+ kind: "mutation",
20118
+ auth: "admin"
20119
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
20048
20120
  name: string(),
20049
20121
  description: string().optional(),
20050
20122
  config: CameraPipelineConfigSchema
@@ -21117,20 +21189,6 @@ var VectorStatsResultSchema = object({
21117
21189
  exact: boolean()
21118
21190
  });
21119
21191
  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);
21120
- /**
21121
- * `videoclips` — the unified, navigable-clip surface for a camera.
21122
- *
21123
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
21124
- * provider per device, substitutable. The DEFAULT provider (registered by
21125
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
21126
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
21127
- * is a time-WINDOW over existing footage, never a separate file. A camera that
21128
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
21129
- * wrapper provider for its device and serve its own clip catalog + URLs.
21130
- *
21131
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
21132
- * temporal overlap, so the API never decides `continuous` vs `events`.
21133
- */
21134
21192
  var ClipSchema = object({
21135
21193
  /** Opaque, provider-namespaced id. The default provider encodes the time
21136
21194
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -21147,8 +21205,57 @@ var ClipSchema = object({
21147
21205
  startMs: number(),
21148
21206
  endMs: number()
21149
21207
  }),
21150
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
21151
- thumbnail: string().optional()
21208
+ /**
21209
+ * Lazy thumbnail URL, never inlined.
21210
+ *
21211
+ * Recording-derived clips (events-mode keep-window, and the prepared
21212
+ * continuous event+fragment visit) MUST use the snapshot of the **main
21213
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
21214
+ * of the event that owns `kind` (object > motion > audio). Do not extract
21215
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
21216
+ * mint their own stills.
21217
+ *
21218
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
21219
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
21220
+ * Absent is meaningful — "this visit has no event still" — never "we did not
21221
+ * look". Stamping it from a URL template made 35% of one camera's clips point
21222
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
21223
+ * A read that FAILS drops the claim; it never invents it.
21224
+ */
21225
+ thumbnail: string().optional(),
21226
+ /**
21227
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
21228
+ * can be decoded. Present whenever the visit came from recorded availability;
21229
+ * absent on a per-event padded window (there is no footage to promise).
21230
+ *
21231
+ * This is not a thumbnail and not a second byte path: it is the argument to
21232
+ * the recorder's existing still route. The surface — never the provider —
21233
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
21234
+ * contiguous range, not of the visit: a visit spans its holes by
21235
+ * construction, so a naive midpoint lands in dead air.
21236
+ */
21237
+ stillAtMs: number().optional(),
21238
+ /**
21239
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
21240
+ * first within kind (object → motion → audio), capped at
21241
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
21242
+ *
21243
+ * Bounded because it is not a payload the surface pages through: one visit on
21244
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
21245
+ * camera-day. Read {@link eventCount} for the true total.
21246
+ */
21247
+ eventIds: array(string()).optional(),
21248
+ /** How many analytics events actually overlap this visit. Differs from
21249
+ * `eventIds.length` exactly when the sample was capped — so a truncated
21250
+ * list is never mistaken for a quiet visit. */
21251
+ eventCount: number().int().nonnegative().optional(),
21252
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
21253
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
21254
+ * bar keeps showing them via `recording.getAvailability`. */
21255
+ holes: array(object({
21256
+ startMs: number(),
21257
+ endMs: number()
21258
+ })).optional()
21152
21259
  });
21153
21260
  var ClipPlaybackSchema = object({
21154
21261
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -21612,7 +21719,14 @@ var SearchResultSchema = object({
21612
21719
  });
21613
21720
  var AutoUpdateSettingsSchema = object({
21614
21721
  channel: ChannelSchema,
21615
- intervalSeconds: number()
21722
+ intervalSeconds: number(),
21723
+ /**
21724
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
21725
+ * `channel`: the poller runs while auto-apply is `off`, because being told
21726
+ * about a publish and installing it are different decisions. Clamped
21727
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
21728
+ */
21729
+ updateCheckIntervalSeconds: number()
21616
21730
  });
21617
21731
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21618
21732
  var RestartAddonResultSchema = unknown();
@@ -21753,7 +21867,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21753
21867
  auth: "admin"
21754
21868
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21755
21869
  channel: ChannelSchema,
21756
- intervalSeconds: number().min(300).max(86400).optional()
21870
+ intervalSeconds: number().min(300).max(86400).optional(),
21871
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21872
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21757
21873
  }), unknown(), {
21758
21874
  kind: "mutation",
21759
21875
  auth: "admin"
@@ -27434,7 +27550,9 @@ var ExportOptionsSchema = object({
27434
27550
  includeAudio: boolean(),
27435
27551
  maxLifeMs: number().int().positive(),
27436
27552
  deleteAfterDownload: boolean(),
27437
- title: string().max(200).optional()
27553
+ title: string().max(200).optional(),
27554
+ /** Notification-output target ids to ping when this export becomes ready. */
27555
+ notifyTargetIds: array(string().min(1)).max(20).optional()
27438
27556
  }).superRefine((v, ctx) => {
27439
27557
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
27440
27558
  code: ZodIssueCode.custom,
@@ -27493,10 +27611,18 @@ var ExportBytesSchema = object({
27493
27611
  });
27494
27612
  method(object({
27495
27613
  deviceId: number(),
27496
- profile: string(),
27614
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
27615
+ profile: string().optional(),
27616
+ profiles: array(string()).min(1).optional(),
27497
27617
  fromMs: number(),
27498
27618
  toMs: number(),
27499
27619
  options: ExportOptionsSchema
27620
+ }).superRefine((v, ctx) => {
27621
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
27622
+ code: ZodIssueCode.custom,
27623
+ message: "pass profiles[] (min 1) or legacy profile",
27624
+ path: ["profiles"]
27625
+ });
27500
27626
  }), ExportRecordSchema, {
27501
27627
  kind: "mutation",
27502
27628
  auth: "protected"
@@ -30438,15 +30564,6 @@ var BaseDeviceProvider = class extends BaseAddon {
30438
30564
  labels: ["probe not implemented"]
30439
30565
  };
30440
30566
  }
30441
- /**
30442
- * Top-level devices restored at once in {@link onRestoreDevices}.
30443
- *
30444
- * Four covers the fleets this ships to without turning a boot into a burst a
30445
- * camera NVR answers with a refusal. A provider whose upstream is a single
30446
- * session with a serial command channel (a Baichuan hub, an NVR that
30447
- * serialises ISAPI) should lower it; nothing needs to raise it.
30448
- */
30449
- restoreConcurrency = 4;
30450
30567
  async restoreDevices(savedDevices) {
30451
30568
  await this.onRestoreDevices(savedDevices);
30452
30569
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -30501,14 +30618,7 @@ var BaseDeviceProvider = class extends BaseAddon {
30501
30618
  });
30502
30619
  }
30503
30620
  };
30504
- let nextTopLevel = 0;
30505
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
30506
- for (;;) {
30507
- const saved = topLevel[nextTopLevel++];
30508
- if (saved === void 0) return;
30509
- await restoreOne(saved);
30510
- }
30511
- }));
30621
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
30512
30622
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
30513
30623
  for (const saved of childRows) {
30514
30624
  const Class = this.deviceClasses[saved.type];
@@ -33781,6 +33891,12 @@ Object.freeze({
33781
33891
  addonId: null,
33782
33892
  access: "create"
33783
33893
  },
33894
+ "pipelineAnalytics.reconcileFromDisk": {
33895
+ capName: "pipeline-analytics",
33896
+ capScope: "device",
33897
+ addonId: null,
33898
+ access: "create"
33899
+ },
33784
33900
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33785
33901
  capName: "pipeline-analytics",
33786
33902
  capScope: "device",
@@ -34183,6 +34299,12 @@ Object.freeze({
34183
34299
  addonId: null,
34184
34300
  access: "view"
34185
34301
  },
34302
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
34303
+ capName: "pipeline-orchestrator",
34304
+ capScope: "system",
34305
+ addonId: null,
34306
+ access: "view"
34307
+ },
34186
34308
  "pipelineOrchestrator.listAgentSettings": {
34187
34309
  capName: "pipeline-orchestrator",
34188
34310
  capScope: "system",
@@ -34207,6 +34329,12 @@ Object.freeze({
34207
34329
  addonId: null,
34208
34330
  access: "create"
34209
34331
  },
34332
+ "pipelineOrchestrator.reconcileFromDisk": {
34333
+ capName: "pipeline-orchestrator",
34334
+ capScope: "system",
34335
+ addonId: null,
34336
+ access: "create"
34337
+ },
34210
34338
  "pipelineOrchestrator.removeAgentSettings": {
34211
34339
  capName: "pipeline-orchestrator",
34212
34340
  capScope: "system",
@@ -37198,6 +37326,11 @@ Object.freeze({
37198
37326
  form: "single",
37199
37327
  optional: true
37200
37328
  }],
37329
+ "pipelineAnalytics.reconcileFromDisk": [{
37330
+ name: "deviceId",
37331
+ form: "single",
37332
+ optional: false
37333
+ }],
37201
37334
  "pipelineAnalytics.restageRetrainTrack": [{
37202
37335
  name: "deviceId",
37203
37336
  form: "single",
@@ -38263,6 +38396,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38263
38396
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38264
38397
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38265
38398
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38399
+ var MB = 1024 * 1024;
38400
+ 1024 * MB, 3072 * MB;
38266
38401
  //#endregion
38267
38402
  //#region src/config.ts
38268
38403
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rademacher",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Rademacher HomePilot device-provider addon for CamStack — wraps the @apocaliss92/noderademacher local-hub client (roller shutters over the cover cap)",
5
5
  "keywords": [
6
6
  "camstack",