@camstack/addon-provider-rademacher 0.2.19 → 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 +187 -44
  2. package/dist/addon.mjs +187 -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,65 @@ 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
+ * Distinct object classes attached to this visit (`person`, `car`, …),
21211
+ * dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
21212
+ * instead of the bare kind — "Object" tells the operator nothing a colour bar
21213
+ * did not. Absent (never empty) when the visit attached no classified object
21214
+ * event, so a motion/audio-only visit keeps its kind label.
21215
+ */
21216
+ labels: array(string()).max(3).optional(),
21217
+ /**
21218
+ * Lazy thumbnail URL, never inlined.
21219
+ *
21220
+ * Recording-derived clips (events-mode keep-window, and the prepared
21221
+ * continuous event+fragment visit) MUST use the snapshot of the **main
21222
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
21223
+ * of the event that owns `kind` (object > motion > audio). Do not extract
21224
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
21225
+ * mint their own stills.
21226
+ *
21227
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
21228
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
21229
+ * Absent is meaningful — "this visit has no event still" — never "we did not
21230
+ * look". Stamping it from a URL template made 35% of one camera's clips point
21231
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
21232
+ * A read that FAILS drops the claim; it never invents it.
21233
+ */
21234
+ thumbnail: string().optional(),
21235
+ /**
21236
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
21237
+ * can be decoded. Present whenever the visit came from recorded availability;
21238
+ * absent on a per-event padded window (there is no footage to promise).
21239
+ *
21240
+ * This is not a thumbnail and not a second byte path: it is the argument to
21241
+ * the recorder's existing still route. The surface — never the provider —
21242
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
21243
+ * contiguous range, not of the visit: a visit spans its holes by
21244
+ * construction, so a naive midpoint lands in dead air.
21245
+ */
21246
+ stillAtMs: number().optional(),
21247
+ /**
21248
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
21249
+ * first within kind (object → motion → audio), capped at
21250
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
21251
+ *
21252
+ * Bounded because it is not a payload the surface pages through: one visit on
21253
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
21254
+ * camera-day. Read {@link eventCount} for the true total.
21255
+ */
21256
+ eventIds: array(string()).optional(),
21257
+ /** How many analytics events actually overlap this visit. Differs from
21258
+ * `eventIds.length` exactly when the sample was capped — so a truncated
21259
+ * list is never mistaken for a quiet visit. */
21260
+ eventCount: number().int().nonnegative().optional(),
21261
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
21262
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
21263
+ * bar keeps showing them via `recording.getAvailability`. */
21264
+ holes: array(object({
21265
+ startMs: number(),
21266
+ endMs: number()
21267
+ })).optional()
21153
21268
  });
21154
21269
  var ClipPlaybackSchema = object({
21155
21270
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -21613,7 +21728,14 @@ var SearchResultSchema = object({
21613
21728
  });
21614
21729
  var AutoUpdateSettingsSchema = object({
21615
21730
  channel: ChannelSchema,
21616
- intervalSeconds: number()
21731
+ intervalSeconds: number(),
21732
+ /**
21733
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
21734
+ * `channel`: the poller runs while auto-apply is `off`, because being told
21735
+ * about a publish and installing it are different decisions. Clamped
21736
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
21737
+ */
21738
+ updateCheckIntervalSeconds: number()
21617
21739
  });
21618
21740
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21619
21741
  var RestartAddonResultSchema = unknown();
@@ -21754,7 +21876,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21754
21876
  auth: "admin"
21755
21877
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21756
21878
  channel: ChannelSchema,
21757
- intervalSeconds: number().min(300).max(86400).optional()
21879
+ intervalSeconds: number().min(300).max(86400).optional(),
21880
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21881
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21758
21882
  }), unknown(), {
21759
21883
  kind: "mutation",
21760
21884
  auth: "admin"
@@ -27435,7 +27559,9 @@ var ExportOptionsSchema = object({
27435
27559
  includeAudio: boolean(),
27436
27560
  maxLifeMs: number().int().positive(),
27437
27561
  deleteAfterDownload: boolean(),
27438
- title: string().max(200).optional()
27562
+ title: string().max(200).optional(),
27563
+ /** Notification-output target ids to ping when this export becomes ready. */
27564
+ notifyTargetIds: array(string().min(1)).max(20).optional()
27439
27565
  }).superRefine((v, ctx) => {
27440
27566
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
27441
27567
  code: ZodIssueCode.custom,
@@ -27494,10 +27620,18 @@ var ExportBytesSchema = object({
27494
27620
  });
27495
27621
  method(object({
27496
27622
  deviceId: number(),
27497
- profile: string(),
27623
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
27624
+ profile: string().optional(),
27625
+ profiles: array(string()).min(1).optional(),
27498
27626
  fromMs: number(),
27499
27627
  toMs: number(),
27500
27628
  options: ExportOptionsSchema
27629
+ }).superRefine((v, ctx) => {
27630
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
27631
+ code: ZodIssueCode.custom,
27632
+ message: "pass profiles[] (min 1) or legacy profile",
27633
+ path: ["profiles"]
27634
+ });
27501
27635
  }), ExportRecordSchema, {
27502
27636
  kind: "mutation",
27503
27637
  auth: "protected"
@@ -30439,15 +30573,6 @@ var BaseDeviceProvider = class extends BaseAddon {
30439
30573
  labels: ["probe not implemented"]
30440
30574
  };
30441
30575
  }
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
30576
  async restoreDevices(savedDevices) {
30452
30577
  await this.onRestoreDevices(savedDevices);
30453
30578
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -30502,14 +30627,7 @@ var BaseDeviceProvider = class extends BaseAddon {
30502
30627
  });
30503
30628
  }
30504
30629
  };
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
- }));
30630
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
30513
30631
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
30514
30632
  for (const saved of childRows) {
30515
30633
  const Class = this.deviceClasses[saved.type];
@@ -33782,6 +33900,12 @@ Object.freeze({
33782
33900
  addonId: null,
33783
33901
  access: "create"
33784
33902
  },
33903
+ "pipelineAnalytics.reconcileFromDisk": {
33904
+ capName: "pipeline-analytics",
33905
+ capScope: "device",
33906
+ addonId: null,
33907
+ access: "create"
33908
+ },
33785
33909
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33786
33910
  capName: "pipeline-analytics",
33787
33911
  capScope: "device",
@@ -34184,6 +34308,12 @@ Object.freeze({
34184
34308
  addonId: null,
34185
34309
  access: "view"
34186
34310
  },
34311
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
34312
+ capName: "pipeline-orchestrator",
34313
+ capScope: "system",
34314
+ addonId: null,
34315
+ access: "view"
34316
+ },
34187
34317
  "pipelineOrchestrator.listAgentSettings": {
34188
34318
  capName: "pipeline-orchestrator",
34189
34319
  capScope: "system",
@@ -34208,6 +34338,12 @@ Object.freeze({
34208
34338
  addonId: null,
34209
34339
  access: "create"
34210
34340
  },
34341
+ "pipelineOrchestrator.reconcileFromDisk": {
34342
+ capName: "pipeline-orchestrator",
34343
+ capScope: "system",
34344
+ addonId: null,
34345
+ access: "create"
34346
+ },
34211
34347
  "pipelineOrchestrator.removeAgentSettings": {
34212
34348
  capName: "pipeline-orchestrator",
34213
34349
  capScope: "system",
@@ -37199,6 +37335,11 @@ Object.freeze({
37199
37335
  form: "single",
37200
37336
  optional: true
37201
37337
  }],
37338
+ "pipelineAnalytics.reconcileFromDisk": [{
37339
+ name: "deviceId",
37340
+ form: "single",
37341
+ optional: false
37342
+ }],
37202
37343
  "pipelineAnalytics.restageRetrainTrack": [{
37203
37344
  name: "deviceId",
37204
37345
  form: "single",
@@ -38264,6 +38405,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38264
38405
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38265
38406
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38266
38407
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38408
+ var MB = 1024 * 1024;
38409
+ 1024 * MB, 3072 * MB;
38267
38410
  //#endregion
38268
38411
  //#region src/config.ts
38269
38412
  /**
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,65 @@ 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
+ * Distinct object classes attached to this visit (`person`, `car`, …),
21210
+ * dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
21211
+ * instead of the bare kind — "Object" tells the operator nothing a colour bar
21212
+ * did not. Absent (never empty) when the visit attached no classified object
21213
+ * event, so a motion/audio-only visit keeps its kind label.
21214
+ */
21215
+ labels: array(string()).max(3).optional(),
21216
+ /**
21217
+ * Lazy thumbnail URL, never inlined.
21218
+ *
21219
+ * Recording-derived clips (events-mode keep-window, and the prepared
21220
+ * continuous event+fragment visit) MUST use the snapshot of the **main
21221
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
21222
+ * of the event that owns `kind` (object > motion > audio). Do not extract
21223
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
21224
+ * mint their own stills.
21225
+ *
21226
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
21227
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
21228
+ * Absent is meaningful — "this visit has no event still" — never "we did not
21229
+ * look". Stamping it from a URL template made 35% of one camera's clips point
21230
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
21231
+ * A read that FAILS drops the claim; it never invents it.
21232
+ */
21233
+ thumbnail: string().optional(),
21234
+ /**
21235
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
21236
+ * can be decoded. Present whenever the visit came from recorded availability;
21237
+ * absent on a per-event padded window (there is no footage to promise).
21238
+ *
21239
+ * This is not a thumbnail and not a second byte path: it is the argument to
21240
+ * the recorder's existing still route. The surface — never the provider —
21241
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
21242
+ * contiguous range, not of the visit: a visit spans its holes by
21243
+ * construction, so a naive midpoint lands in dead air.
21244
+ */
21245
+ stillAtMs: number().optional(),
21246
+ /**
21247
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
21248
+ * first within kind (object → motion → audio), capped at
21249
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
21250
+ *
21251
+ * Bounded because it is not a payload the surface pages through: one visit on
21252
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
21253
+ * camera-day. Read {@link eventCount} for the true total.
21254
+ */
21255
+ eventIds: array(string()).optional(),
21256
+ /** How many analytics events actually overlap this visit. Differs from
21257
+ * `eventIds.length` exactly when the sample was capped — so a truncated
21258
+ * list is never mistaken for a quiet visit. */
21259
+ eventCount: number().int().nonnegative().optional(),
21260
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
21261
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
21262
+ * bar keeps showing them via `recording.getAvailability`. */
21263
+ holes: array(object({
21264
+ startMs: number(),
21265
+ endMs: number()
21266
+ })).optional()
21152
21267
  });
21153
21268
  var ClipPlaybackSchema = object({
21154
21269
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -21612,7 +21727,14 @@ var SearchResultSchema = object({
21612
21727
  });
21613
21728
  var AutoUpdateSettingsSchema = object({
21614
21729
  channel: ChannelSchema,
21615
- intervalSeconds: number()
21730
+ intervalSeconds: number(),
21731
+ /**
21732
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
21733
+ * `channel`: the poller runs while auto-apply is `off`, because being told
21734
+ * about a publish and installing it are different decisions. Clamped
21735
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
21736
+ */
21737
+ updateCheckIntervalSeconds: number()
21616
21738
  });
21617
21739
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21618
21740
  var RestartAddonResultSchema = unknown();
@@ -21753,7 +21875,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21753
21875
  auth: "admin"
21754
21876
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21755
21877
  channel: ChannelSchema,
21756
- intervalSeconds: number().min(300).max(86400).optional()
21878
+ intervalSeconds: number().min(300).max(86400).optional(),
21879
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21880
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21757
21881
  }), unknown(), {
21758
21882
  kind: "mutation",
21759
21883
  auth: "admin"
@@ -27434,7 +27558,9 @@ var ExportOptionsSchema = object({
27434
27558
  includeAudio: boolean(),
27435
27559
  maxLifeMs: number().int().positive(),
27436
27560
  deleteAfterDownload: boolean(),
27437
- title: string().max(200).optional()
27561
+ title: string().max(200).optional(),
27562
+ /** Notification-output target ids to ping when this export becomes ready. */
27563
+ notifyTargetIds: array(string().min(1)).max(20).optional()
27438
27564
  }).superRefine((v, ctx) => {
27439
27565
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
27440
27566
  code: ZodIssueCode.custom,
@@ -27493,10 +27619,18 @@ var ExportBytesSchema = object({
27493
27619
  });
27494
27620
  method(object({
27495
27621
  deviceId: number(),
27496
- profile: string(),
27622
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
27623
+ profile: string().optional(),
27624
+ profiles: array(string()).min(1).optional(),
27497
27625
  fromMs: number(),
27498
27626
  toMs: number(),
27499
27627
  options: ExportOptionsSchema
27628
+ }).superRefine((v, ctx) => {
27629
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
27630
+ code: ZodIssueCode.custom,
27631
+ message: "pass profiles[] (min 1) or legacy profile",
27632
+ path: ["profiles"]
27633
+ });
27500
27634
  }), ExportRecordSchema, {
27501
27635
  kind: "mutation",
27502
27636
  auth: "protected"
@@ -30438,15 +30572,6 @@ var BaseDeviceProvider = class extends BaseAddon {
30438
30572
  labels: ["probe not implemented"]
30439
30573
  };
30440
30574
  }
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
30575
  async restoreDevices(savedDevices) {
30451
30576
  await this.onRestoreDevices(savedDevices);
30452
30577
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -30501,14 +30626,7 @@ var BaseDeviceProvider = class extends BaseAddon {
30501
30626
  });
30502
30627
  }
30503
30628
  };
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
- }));
30629
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
30512
30630
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
30513
30631
  for (const saved of childRows) {
30514
30632
  const Class = this.deviceClasses[saved.type];
@@ -33781,6 +33899,12 @@ Object.freeze({
33781
33899
  addonId: null,
33782
33900
  access: "create"
33783
33901
  },
33902
+ "pipelineAnalytics.reconcileFromDisk": {
33903
+ capName: "pipeline-analytics",
33904
+ capScope: "device",
33905
+ addonId: null,
33906
+ access: "create"
33907
+ },
33784
33908
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33785
33909
  capName: "pipeline-analytics",
33786
33910
  capScope: "device",
@@ -34183,6 +34307,12 @@ Object.freeze({
34183
34307
  addonId: null,
34184
34308
  access: "view"
34185
34309
  },
34310
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
34311
+ capName: "pipeline-orchestrator",
34312
+ capScope: "system",
34313
+ addonId: null,
34314
+ access: "view"
34315
+ },
34186
34316
  "pipelineOrchestrator.listAgentSettings": {
34187
34317
  capName: "pipeline-orchestrator",
34188
34318
  capScope: "system",
@@ -34207,6 +34337,12 @@ Object.freeze({
34207
34337
  addonId: null,
34208
34338
  access: "create"
34209
34339
  },
34340
+ "pipelineOrchestrator.reconcileFromDisk": {
34341
+ capName: "pipeline-orchestrator",
34342
+ capScope: "system",
34343
+ addonId: null,
34344
+ access: "create"
34345
+ },
34210
34346
  "pipelineOrchestrator.removeAgentSettings": {
34211
34347
  capName: "pipeline-orchestrator",
34212
34348
  capScope: "system",
@@ -37198,6 +37334,11 @@ Object.freeze({
37198
37334
  form: "single",
37199
37335
  optional: true
37200
37336
  }],
37337
+ "pipelineAnalytics.reconcileFromDisk": [{
37338
+ name: "deviceId",
37339
+ form: "single",
37340
+ optional: false
37341
+ }],
37201
37342
  "pipelineAnalytics.restageRetrainTrack": [{
37202
37343
  name: "deviceId",
37203
37344
  form: "single",
@@ -38263,6 +38404,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38263
38404
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38264
38405
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38265
38406
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38407
+ var MB = 1024 * 1024;
38408
+ 1024 * MB, 3072 * MB;
38266
38409
  //#endregion
38267
38410
  //#region src/config.ts
38268
38411
  /**
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.21",
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",