@camstack/addon-provider-petkit 0.2.20 → 0.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +187 -44
  2. package/dist/addon.mjs +187 -44
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -1101,7 +1101,7 @@ var Nodepetkit = class {
1101
1101
  }
1102
1102
  };
1103
1103
  //#endregion
1104
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
1104
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
1105
1105
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
1106
1106
  EventCategory["SystemBoot"] = "system.boot";
1107
1107
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1118,9 +1118,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1118
1118
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
1119
1119
  /**
1120
1120
  * A newer addon or server-root package version was found by the
1121
- * authoritative registry check. Emitted once per
1122
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
1123
- * polling of the same result is deduplicated by the checker.
1121
+ * authoritative registry check. Emitted once when any observed
1122
+ * `latestVersion` changes (or a package/node first appears behind);
1123
+ * the payload carries the full currently-available list. Repeated
1124
+ * polling of the same latests is silent.
1124
1125
  */
1125
1126
  EventCategory["UpdateAvailable"] = "update.available";
1126
1127
  /**
@@ -1139,6 +1140,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1139
1140
  EventCategory["AddonInstalled"] = "addon.installed";
1140
1141
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
1141
1142
  EventCategory["AddonCrashed"] = "addon.crashed";
1143
+ /**
1144
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
1145
+ *
1146
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
1147
+ * respawned"); this is the one that never resolves itself. Emitted exactly
1148
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
1149
+ * addons it hosted and the crash count that tripped the breaker.
1150
+ *
1151
+ * It exists because a runner marked terminally `failed` used to be SILENT:
1152
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
1153
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
1154
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
1155
+ * operator's phone told him. The Notification Center's system-event intake
1156
+ * consumes this category and maps it to the `addon-crash-loop` kind.
1157
+ */
1158
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
1142
1159
  EventCategory["AddonError"] = "addon.error";
1143
1160
  EventCategory["AddonPageReady"] = "addon.page-ready";
1144
1161
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -8650,6 +8667,10 @@ var RecordingBandSchema = object({
8650
8667
  preBufferSec: number().min(0).optional(),
8651
8668
  postBufferSec: number().min(0).optional()
8652
8669
  });
8670
+ ({
8671
+ preBufferSec: 10,
8672
+ postBufferSec: 30
8673
+ }).postBufferSec * 1e3;
8653
8674
  /**
8654
8675
  * Per-device retention overrides. Every field is optional; an unset or `0`
8655
8676
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -8697,6 +8718,12 @@ var RecordingConfigSchema = object({
8697
8718
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
8698
8719
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
8699
8720
  mode: RecordingStorageModeSchema.optional(),
8721
+ /**
8722
+ * Which assigned broker slots to record. Absent / empty = {@link
8723
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
8724
+ * camera's currently assigned slots — never `mid` unless the operator
8725
+ * picks it, and never a slot the broker has not assigned.
8726
+ */
8700
8727
  profiles: array(CamProfileSchema).optional(),
8701
8728
  segmentSeconds: number().int().positive().optional(),
8702
8729
  /**
@@ -8777,7 +8804,11 @@ var RelocateFootageInputSchema = object({
8777
8804
  profiles: array(string()).optional(),
8778
8805
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
8779
8806
  * never allowed to starve live writers. */
8780
- throttleMbps: number().min(1).max(1e3).optional()
8807
+ throttleMbps: number().min(1).max(1e3).optional(),
8808
+ /** Move only segments whose startMs is >= this. Absent = the whole source
8809
+ * pile. Used when a full drain is too expensive and the operator only
8810
+ * wants the recent window on the new disk. */
8811
+ sinceMs: number().int().optional()
8781
8812
  });
8782
8813
  /** Internal, lease-scoped participant operation. It is intentionally separate
8783
8814
  * from persistent recording settings: a migration never changes
@@ -15659,6 +15690,7 @@ var NcSystemEventKindSchema = _enum([
15659
15690
  "node-offline",
15660
15691
  "node-inference-unavailable",
15661
15692
  "detection-blind",
15693
+ "addon-crash-loop",
15662
15694
  "addon-update-available",
15663
15695
  "server-update-available",
15664
15696
  "alarm-triggered",
@@ -15666,6 +15698,9 @@ var NcSystemEventKindSchema = _enum([
15666
15698
  "alarm-disarmed",
15667
15699
  "alarm-arming",
15668
15700
  "alarm-arm-refused",
15701
+ "addon-updated",
15702
+ "server-updated",
15703
+ "export-completed",
15669
15704
  "camera-online",
15670
15705
  "camera-offline",
15671
15706
  "camera-disabled",
@@ -17559,13 +17594,19 @@ var RetrainStatusSchema = _enum([
17559
17594
  * "never marked" from "already trained" must read `retrainStatus`.
17560
17595
  *
17561
17596
  * `debug` does NOT pin; it is attention, not durability.
17597
+ *
17598
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17599
+ * A favourited track is skipped by retention the same way `staging` is, but
17600
+ * it does not enter `none|staging|trained` and has no staging budget.
17562
17601
  */
17563
17602
  var TrackFlagFields = {
17564
17603
  /** Operator marked this track as training material — i.e. `retrainStatus` is
17565
17604
  * `'staging'`. */
17566
17605
  markForTrain: boolean().optional(),
17567
17606
  /** Operator marked this track for diagnostic attention. */
17568
- debug: boolean().optional()
17607
+ debug: boolean().optional(),
17608
+ /** Operator favourited this track. Pins it against pruning. */
17609
+ favourited: boolean().optional()
17569
17610
  };
17570
17611
  /**
17571
17612
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -17590,6 +17631,7 @@ var TrackFlagsSchema = object({
17590
17631
  trackId: string(),
17591
17632
  markForTrain: boolean(),
17592
17633
  debug: boolean(),
17634
+ favourited: boolean(),
17593
17635
  /** The lifecycle state the boolean was derived from. Required here (unlike on
17594
17636
  * a track row) because this shape is only ever produced by the write body,
17595
17637
  * which always knows it — and a surface that has just written needs to render
@@ -18222,6 +18264,12 @@ var TrackCascadeCountsSchema = object({
18222
18264
  /** Per-track CLIP search vectors removed (best-effort). */
18223
18265
  embeddings: number().int()
18224
18266
  });
18267
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
18268
+ var DiskReconcileCountsSchema = object({
18269
+ mediaDropped: number().int(),
18270
+ tracks: number().int(),
18271
+ events: number().int()
18272
+ });
18225
18273
  /** Event-store footprint for one camera. */
18226
18274
  var EventStoreDeviceFootprintSchema = object({
18227
18275
  deviceId: number(),
@@ -18398,6 +18446,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18398
18446
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18399
18447
  kind: "mutation",
18400
18448
  auth: "admin"
18449
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18450
+ kind: "mutation",
18451
+ auth: "admin"
18401
18452
  }), method(object({
18402
18453
  deviceId: number(),
18403
18454
  trackIds: array(string()).min(1)
@@ -19948,6 +19999,24 @@ var CameraStatusDegradationSchema = object({
19948
19999
  *
19949
20000
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
19950
20001
  */
20002
+ var DiskReconcileJobSchema = object({
20003
+ state: _enum([
20004
+ "idle",
20005
+ "running",
20006
+ "done",
20007
+ "error"
20008
+ ]),
20009
+ total: number().int().nonnegative(),
20010
+ completed: number().int().nonnegative(),
20011
+ currentDeviceId: number().int().nullable(),
20012
+ failed: array(number().int()).readonly(),
20013
+ mediaDropped: number().int().nonnegative(),
20014
+ tracks: number().int().nonnegative(),
20015
+ events: number().int().nonnegative(),
20016
+ startedAtMs: number().int().nullable(),
20017
+ finishedAtMs: number().int().nullable(),
20018
+ error: string().nullable()
20019
+ });
19951
20020
  var CameraStatusSchema = object({
19952
20021
  deviceId: number(),
19953
20022
  assignment: CameraAssignmentStatusSchema,
@@ -20179,7 +20248,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
20179
20248
  }), CameraSwitchGroupSchema, {
20180
20249
  kind: "mutation",
20181
20250
  auth: "admin"
20182
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
20251
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
20252
+ kind: "mutation",
20253
+ auth: "admin"
20254
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
20183
20255
  name: string(),
20184
20256
  description: string().optional(),
20185
20257
  config: CameraPipelineConfigSchema
@@ -21252,20 +21324,6 @@ var VectorStatsResultSchema = object({
21252
21324
  exact: boolean()
21253
21325
  });
21254
21326
  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);
21255
- /**
21256
- * `videoclips` — the unified, navigable-clip surface for a camera.
21257
- *
21258
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
21259
- * provider per device, substitutable. The DEFAULT provider (registered by
21260
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
21261
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
21262
- * is a time-WINDOW over existing footage, never a separate file. A camera that
21263
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
21264
- * wrapper provider for its device and serve its own clip catalog + URLs.
21265
- *
21266
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
21267
- * temporal overlap, so the API never decides `continuous` vs `events`.
21268
- */
21269
21327
  var ClipSchema = object({
21270
21328
  /** Opaque, provider-namespaced id. The default provider encodes the time
21271
21329
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -21282,8 +21340,65 @@ var ClipSchema = object({
21282
21340
  startMs: number(),
21283
21341
  endMs: number()
21284
21342
  }),
21285
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
21286
- thumbnail: string().optional()
21343
+ /**
21344
+ * Distinct object classes attached to this visit (`person`, `car`, …),
21345
+ * dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
21346
+ * instead of the bare kind — "Object" tells the operator nothing a colour bar
21347
+ * did not. Absent (never empty) when the visit attached no classified object
21348
+ * event, so a motion/audio-only visit keeps its kind label.
21349
+ */
21350
+ labels: array(string()).max(3).optional(),
21351
+ /**
21352
+ * Lazy thumbnail URL, never inlined.
21353
+ *
21354
+ * Recording-derived clips (events-mode keep-window, and the prepared
21355
+ * continuous event+fragment visit) MUST use the snapshot of the **main
21356
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
21357
+ * of the event that owns `kind` (object > motion > audio). Do not extract
21358
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
21359
+ * mint their own stills.
21360
+ *
21361
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
21362
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
21363
+ * Absent is meaningful — "this visit has no event still" — never "we did not
21364
+ * look". Stamping it from a URL template made 35% of one camera's clips point
21365
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
21366
+ * A read that FAILS drops the claim; it never invents it.
21367
+ */
21368
+ thumbnail: string().optional(),
21369
+ /**
21370
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
21371
+ * can be decoded. Present whenever the visit came from recorded availability;
21372
+ * absent on a per-event padded window (there is no footage to promise).
21373
+ *
21374
+ * This is not a thumbnail and not a second byte path: it is the argument to
21375
+ * the recorder's existing still route. The surface — never the provider —
21376
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
21377
+ * contiguous range, not of the visit: a visit spans its holes by
21378
+ * construction, so a naive midpoint lands in dead air.
21379
+ */
21380
+ stillAtMs: number().optional(),
21381
+ /**
21382
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
21383
+ * first within kind (object → motion → audio), capped at
21384
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
21385
+ *
21386
+ * Bounded because it is not a payload the surface pages through: one visit on
21387
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
21388
+ * camera-day. Read {@link eventCount} for the true total.
21389
+ */
21390
+ eventIds: array(string()).optional(),
21391
+ /** How many analytics events actually overlap this visit. Differs from
21392
+ * `eventIds.length` exactly when the sample was capped — so a truncated
21393
+ * list is never mistaken for a quiet visit. */
21394
+ eventCount: number().int().nonnegative().optional(),
21395
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
21396
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
21397
+ * bar keeps showing them via `recording.getAvailability`. */
21398
+ holes: array(object({
21399
+ startMs: number(),
21400
+ endMs: number()
21401
+ })).optional()
21287
21402
  });
21288
21403
  var ClipPlaybackSchema = object({
21289
21404
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -21747,7 +21862,14 @@ var SearchResultSchema = object({
21747
21862
  });
21748
21863
  var AutoUpdateSettingsSchema = object({
21749
21864
  channel: ChannelSchema,
21750
- intervalSeconds: number()
21865
+ intervalSeconds: number(),
21866
+ /**
21867
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
21868
+ * `channel`: the poller runs while auto-apply is `off`, because being told
21869
+ * about a publish and installing it are different decisions. Clamped
21870
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
21871
+ */
21872
+ updateCheckIntervalSeconds: number()
21751
21873
  });
21752
21874
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21753
21875
  var RestartAddonResultSchema = unknown();
@@ -21888,7 +22010,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21888
22010
  auth: "admin"
21889
22011
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21890
22012
  channel: ChannelSchema,
21891
- intervalSeconds: number().min(300).max(86400).optional()
22013
+ intervalSeconds: number().min(300).max(86400).optional(),
22014
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
22015
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21892
22016
  }), unknown(), {
21893
22017
  kind: "mutation",
21894
22018
  auth: "admin"
@@ -27577,7 +27701,9 @@ var ExportOptionsSchema = object({
27577
27701
  includeAudio: boolean(),
27578
27702
  maxLifeMs: number().int().positive(),
27579
27703
  deleteAfterDownload: boolean(),
27580
- title: string().max(200).optional()
27704
+ title: string().max(200).optional(),
27705
+ /** Notification-output target ids to ping when this export becomes ready. */
27706
+ notifyTargetIds: array(string().min(1)).max(20).optional()
27581
27707
  }).superRefine((v, ctx) => {
27582
27708
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
27583
27709
  code: ZodIssueCode.custom,
@@ -27636,10 +27762,18 @@ var ExportBytesSchema = object({
27636
27762
  });
27637
27763
  method(object({
27638
27764
  deviceId: number(),
27639
- profile: string(),
27765
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
27766
+ profile: string().optional(),
27767
+ profiles: array(string()).min(1).optional(),
27640
27768
  fromMs: number(),
27641
27769
  toMs: number(),
27642
27770
  options: ExportOptionsSchema
27771
+ }).superRefine((v, ctx) => {
27772
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
27773
+ code: ZodIssueCode.custom,
27774
+ message: "pass profiles[] (min 1) or legacy profile",
27775
+ path: ["profiles"]
27776
+ });
27643
27777
  }), ExportRecordSchema, {
27644
27778
  kind: "mutation",
27645
27779
  auth: "protected"
@@ -30581,15 +30715,6 @@ var BaseDeviceProvider = class extends BaseAddon {
30581
30715
  labels: ["probe not implemented"]
30582
30716
  };
30583
30717
  }
30584
- /**
30585
- * Top-level devices restored at once in {@link onRestoreDevices}.
30586
- *
30587
- * Four covers the fleets this ships to without turning a boot into a burst a
30588
- * camera NVR answers with a refusal. A provider whose upstream is a single
30589
- * session with a serial command channel (a Baichuan hub, an NVR that
30590
- * serialises ISAPI) should lower it; nothing needs to raise it.
30591
- */
30592
- restoreConcurrency = 4;
30593
30718
  async restoreDevices(savedDevices) {
30594
30719
  await this.onRestoreDevices(savedDevices);
30595
30720
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -30644,14 +30769,7 @@ var BaseDeviceProvider = class extends BaseAddon {
30644
30769
  });
30645
30770
  }
30646
30771
  };
30647
- let nextTopLevel = 0;
30648
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
30649
- for (;;) {
30650
- const saved = topLevel[nextTopLevel++];
30651
- if (saved === void 0) return;
30652
- await restoreOne(saved);
30653
- }
30654
- }));
30772
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
30655
30773
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
30656
30774
  for (const saved of childRows) {
30657
30775
  const Class = this.deviceClasses[saved.type];
@@ -33924,6 +34042,12 @@ Object.freeze({
33924
34042
  addonId: null,
33925
34043
  access: "create"
33926
34044
  },
34045
+ "pipelineAnalytics.reconcileFromDisk": {
34046
+ capName: "pipeline-analytics",
34047
+ capScope: "device",
34048
+ addonId: null,
34049
+ access: "create"
34050
+ },
33927
34051
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33928
34052
  capName: "pipeline-analytics",
33929
34053
  capScope: "device",
@@ -34326,6 +34450,12 @@ Object.freeze({
34326
34450
  addonId: null,
34327
34451
  access: "view"
34328
34452
  },
34453
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
34454
+ capName: "pipeline-orchestrator",
34455
+ capScope: "system",
34456
+ addonId: null,
34457
+ access: "view"
34458
+ },
34329
34459
  "pipelineOrchestrator.listAgentSettings": {
34330
34460
  capName: "pipeline-orchestrator",
34331
34461
  capScope: "system",
@@ -34350,6 +34480,12 @@ Object.freeze({
34350
34480
  addonId: null,
34351
34481
  access: "create"
34352
34482
  },
34483
+ "pipelineOrchestrator.reconcileFromDisk": {
34484
+ capName: "pipeline-orchestrator",
34485
+ capScope: "system",
34486
+ addonId: null,
34487
+ access: "create"
34488
+ },
34353
34489
  "pipelineOrchestrator.removeAgentSettings": {
34354
34490
  capName: "pipeline-orchestrator",
34355
34491
  capScope: "system",
@@ -37341,6 +37477,11 @@ Object.freeze({
37341
37477
  form: "single",
37342
37478
  optional: true
37343
37479
  }],
37480
+ "pipelineAnalytics.reconcileFromDisk": [{
37481
+ name: "deviceId",
37482
+ form: "single",
37483
+ optional: false
37484
+ }],
37344
37485
  "pipelineAnalytics.restageRetrainTrack": [{
37345
37486
  name: "deviceId",
37346
37487
  form: "single",
@@ -38406,6 +38547,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38406
38547
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38407
38548
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38408
38549
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38550
+ var MB = 1024 * 1024;
38551
+ 1024 * MB, 3072 * MB;
38409
38552
  //#endregion
38410
38553
  //#region src/config.ts
38411
38554
  /**
package/dist/addon.mjs CHANGED
@@ -1100,7 +1100,7 @@ var Nodepetkit = class {
1100
1100
  }
1101
1101
  };
1102
1102
  //#endregion
1103
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
1103
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
1104
1104
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
1105
1105
  EventCategory["SystemBoot"] = "system.boot";
1106
1106
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1117,9 +1117,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1117
1117
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
1118
1118
  /**
1119
1119
  * A newer addon or server-root package version was found by the
1120
- * authoritative registry check. Emitted once per
1121
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
1122
- * polling of the same result is deduplicated by the checker.
1120
+ * authoritative registry check. Emitted once when any observed
1121
+ * `latestVersion` changes (or a package/node first appears behind);
1122
+ * the payload carries the full currently-available list. Repeated
1123
+ * polling of the same latests is silent.
1123
1124
  */
1124
1125
  EventCategory["UpdateAvailable"] = "update.available";
1125
1126
  /**
@@ -1138,6 +1139,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1138
1139
  EventCategory["AddonInstalled"] = "addon.installed";
1139
1140
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
1140
1141
  EventCategory["AddonCrashed"] = "addon.crashed";
1142
+ /**
1143
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
1144
+ *
1145
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
1146
+ * respawned"); this is the one that never resolves itself. Emitted exactly
1147
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
1148
+ * addons it hosted and the crash count that tripped the breaker.
1149
+ *
1150
+ * It exists because a runner marked terminally `failed` used to be SILENT:
1151
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
1152
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
1153
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
1154
+ * operator's phone told him. The Notification Center's system-event intake
1155
+ * consumes this category and maps it to the `addon-crash-loop` kind.
1156
+ */
1157
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
1141
1158
  EventCategory["AddonError"] = "addon.error";
1142
1159
  EventCategory["AddonPageReady"] = "addon.page-ready";
1143
1160
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -8649,6 +8666,10 @@ var RecordingBandSchema = object({
8649
8666
  preBufferSec: number().min(0).optional(),
8650
8667
  postBufferSec: number().min(0).optional()
8651
8668
  });
8669
+ ({
8670
+ preBufferSec: 10,
8671
+ postBufferSec: 30
8672
+ }).postBufferSec * 1e3;
8652
8673
  /**
8653
8674
  * Per-device retention overrides. Every field is optional; an unset or `0`
8654
8675
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -8696,6 +8717,12 @@ var RecordingConfigSchema = object({
8696
8717
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
8697
8718
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
8698
8719
  mode: RecordingStorageModeSchema.optional(),
8720
+ /**
8721
+ * Which assigned broker slots to record. Absent / empty = {@link
8722
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
8723
+ * camera's currently assigned slots — never `mid` unless the operator
8724
+ * picks it, and never a slot the broker has not assigned.
8725
+ */
8699
8726
  profiles: array(CamProfileSchema).optional(),
8700
8727
  segmentSeconds: number().int().positive().optional(),
8701
8728
  /**
@@ -8776,7 +8803,11 @@ var RelocateFootageInputSchema = object({
8776
8803
  profiles: array(string()).optional(),
8777
8804
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
8778
8805
  * never allowed to starve live writers. */
8779
- throttleMbps: number().min(1).max(1e3).optional()
8806
+ throttleMbps: number().min(1).max(1e3).optional(),
8807
+ /** Move only segments whose startMs is >= this. Absent = the whole source
8808
+ * pile. Used when a full drain is too expensive and the operator only
8809
+ * wants the recent window on the new disk. */
8810
+ sinceMs: number().int().optional()
8780
8811
  });
8781
8812
  /** Internal, lease-scoped participant operation. It is intentionally separate
8782
8813
  * from persistent recording settings: a migration never changes
@@ -15658,6 +15689,7 @@ var NcSystemEventKindSchema = _enum([
15658
15689
  "node-offline",
15659
15690
  "node-inference-unavailable",
15660
15691
  "detection-blind",
15692
+ "addon-crash-loop",
15661
15693
  "addon-update-available",
15662
15694
  "server-update-available",
15663
15695
  "alarm-triggered",
@@ -15665,6 +15697,9 @@ var NcSystemEventKindSchema = _enum([
15665
15697
  "alarm-disarmed",
15666
15698
  "alarm-arming",
15667
15699
  "alarm-arm-refused",
15700
+ "addon-updated",
15701
+ "server-updated",
15702
+ "export-completed",
15668
15703
  "camera-online",
15669
15704
  "camera-offline",
15670
15705
  "camera-disabled",
@@ -17558,13 +17593,19 @@ var RetrainStatusSchema = _enum([
17558
17593
  * "never marked" from "already trained" must read `retrainStatus`.
17559
17594
  *
17560
17595
  * `debug` does NOT pin; it is attention, not durability.
17596
+ *
17597
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
17598
+ * A favourited track is skipped by retention the same way `staging` is, but
17599
+ * it does not enter `none|staging|trained` and has no staging budget.
17561
17600
  */
17562
17601
  var TrackFlagFields = {
17563
17602
  /** Operator marked this track as training material — i.e. `retrainStatus` is
17564
17603
  * `'staging'`. */
17565
17604
  markForTrain: boolean().optional(),
17566
17605
  /** Operator marked this track for diagnostic attention. */
17567
- debug: boolean().optional()
17606
+ debug: boolean().optional(),
17607
+ /** Operator favourited this track. Pins it against pruning. */
17608
+ favourited: boolean().optional()
17568
17609
  };
17569
17610
  /**
17570
17611
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -17589,6 +17630,7 @@ var TrackFlagsSchema = object({
17589
17630
  trackId: string(),
17590
17631
  markForTrain: boolean(),
17591
17632
  debug: boolean(),
17633
+ favourited: boolean(),
17592
17634
  /** The lifecycle state the boolean was derived from. Required here (unlike on
17593
17635
  * a track row) because this shape is only ever produced by the write body,
17594
17636
  * which always knows it — and a surface that has just written needs to render
@@ -18221,6 +18263,12 @@ var TrackCascadeCountsSchema = object({
18221
18263
  /** Per-track CLIP search vectors removed (best-effort). */
18222
18264
  embeddings: number().int()
18223
18265
  });
18266
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
18267
+ var DiskReconcileCountsSchema = object({
18268
+ mediaDropped: number().int(),
18269
+ tracks: number().int(),
18270
+ events: number().int()
18271
+ });
18224
18272
  /** Event-store footprint for one camera. */
18225
18273
  var EventStoreDeviceFootprintSchema = object({
18226
18274
  deviceId: number(),
@@ -18397,6 +18445,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18397
18445
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
18398
18446
  kind: "mutation",
18399
18447
  auth: "admin"
18448
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
18449
+ kind: "mutation",
18450
+ auth: "admin"
18400
18451
  }), method(object({
18401
18452
  deviceId: number(),
18402
18453
  trackIds: array(string()).min(1)
@@ -19947,6 +19998,24 @@ var CameraStatusDegradationSchema = object({
19947
19998
  *
19948
19999
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
19949
20000
  */
20001
+ var DiskReconcileJobSchema = object({
20002
+ state: _enum([
20003
+ "idle",
20004
+ "running",
20005
+ "done",
20006
+ "error"
20007
+ ]),
20008
+ total: number().int().nonnegative(),
20009
+ completed: number().int().nonnegative(),
20010
+ currentDeviceId: number().int().nullable(),
20011
+ failed: array(number().int()).readonly(),
20012
+ mediaDropped: number().int().nonnegative(),
20013
+ tracks: number().int().nonnegative(),
20014
+ events: number().int().nonnegative(),
20015
+ startedAtMs: number().int().nullable(),
20016
+ finishedAtMs: number().int().nullable(),
20017
+ error: string().nullable()
20018
+ });
19950
20019
  var CameraStatusSchema = object({
19951
20020
  deviceId: number(),
19952
20021
  assignment: CameraAssignmentStatusSchema,
@@ -20178,7 +20247,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
20178
20247
  }), CameraSwitchGroupSchema, {
20179
20248
  kind: "mutation",
20180
20249
  auth: "admin"
20181
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
20250
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
20251
+ kind: "mutation",
20252
+ auth: "admin"
20253
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
20182
20254
  name: string(),
20183
20255
  description: string().optional(),
20184
20256
  config: CameraPipelineConfigSchema
@@ -21251,20 +21323,6 @@ var VectorStatsResultSchema = object({
21251
21323
  exact: boolean()
21252
21324
  });
21253
21325
  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);
21254
- /**
21255
- * `videoclips` — the unified, navigable-clip surface for a camera.
21256
- *
21257
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
21258
- * provider per device, substitutable. The DEFAULT provider (registered by
21259
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
21260
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
21261
- * is a time-WINDOW over existing footage, never a separate file. A camera that
21262
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
21263
- * wrapper provider for its device and serve its own clip catalog + URLs.
21264
- *
21265
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
21266
- * temporal overlap, so the API never decides `continuous` vs `events`.
21267
- */
21268
21326
  var ClipSchema = object({
21269
21327
  /** Opaque, provider-namespaced id. The default provider encodes the time
21270
21328
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -21281,8 +21339,65 @@ var ClipSchema = object({
21281
21339
  startMs: number(),
21282
21340
  endMs: number()
21283
21341
  }),
21284
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
21285
- thumbnail: string().optional()
21342
+ /**
21343
+ * Distinct object classes attached to this visit (`person`, `car`, …),
21344
+ * dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
21345
+ * instead of the bare kind — "Object" tells the operator nothing a colour bar
21346
+ * did not. Absent (never empty) when the visit attached no classified object
21347
+ * event, so a motion/audio-only visit keeps its kind label.
21348
+ */
21349
+ labels: array(string()).max(3).optional(),
21350
+ /**
21351
+ * Lazy thumbnail URL, never inlined.
21352
+ *
21353
+ * Recording-derived clips (events-mode keep-window, and the prepared
21354
+ * continuous event+fragment visit) MUST use the snapshot of the **main
21355
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
21356
+ * of the event that owns `kind` (object > motion > audio). Do not extract
21357
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
21358
+ * mint their own stills.
21359
+ *
21360
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
21361
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
21362
+ * Absent is meaningful — "this visit has no event still" — never "we did not
21363
+ * look". Stamping it from a URL template made 35% of one camera's clips point
21364
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
21365
+ * A read that FAILS drops the claim; it never invents it.
21366
+ */
21367
+ thumbnail: string().optional(),
21368
+ /**
21369
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
21370
+ * can be decoded. Present whenever the visit came from recorded availability;
21371
+ * absent on a per-event padded window (there is no footage to promise).
21372
+ *
21373
+ * This is not a thumbnail and not a second byte path: it is the argument to
21374
+ * the recorder's existing still route. The surface — never the provider —
21375
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
21376
+ * contiguous range, not of the visit: a visit spans its holes by
21377
+ * construction, so a naive midpoint lands in dead air.
21378
+ */
21379
+ stillAtMs: number().optional(),
21380
+ /**
21381
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
21382
+ * first within kind (object → motion → audio), capped at
21383
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
21384
+ *
21385
+ * Bounded because it is not a payload the surface pages through: one visit on
21386
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
21387
+ * camera-day. Read {@link eventCount} for the true total.
21388
+ */
21389
+ eventIds: array(string()).optional(),
21390
+ /** How many analytics events actually overlap this visit. Differs from
21391
+ * `eventIds.length` exactly when the sample was capped — so a truncated
21392
+ * list is never mistaken for a quiet visit. */
21393
+ eventCount: number().int().nonnegative().optional(),
21394
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
21395
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
21396
+ * bar keeps showing them via `recording.getAvailability`. */
21397
+ holes: array(object({
21398
+ startMs: number(),
21399
+ endMs: number()
21400
+ })).optional()
21286
21401
  });
21287
21402
  var ClipPlaybackSchema = object({
21288
21403
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -21746,7 +21861,14 @@ var SearchResultSchema = object({
21746
21861
  });
21747
21862
  var AutoUpdateSettingsSchema = object({
21748
21863
  channel: ChannelSchema,
21749
- intervalSeconds: number()
21864
+ intervalSeconds: number(),
21865
+ /**
21866
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
21867
+ * `channel`: the poller runs while auto-apply is `off`, because being told
21868
+ * about a publish and installing it are different decisions. Clamped
21869
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
21870
+ */
21871
+ updateCheckIntervalSeconds: number()
21750
21872
  });
21751
21873
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21752
21874
  var RestartAddonResultSchema = unknown();
@@ -21887,7 +22009,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21887
22009
  auth: "admin"
21888
22010
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21889
22011
  channel: ChannelSchema,
21890
- intervalSeconds: number().min(300).max(86400).optional()
22012
+ intervalSeconds: number().min(300).max(86400).optional(),
22013
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
22014
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21891
22015
  }), unknown(), {
21892
22016
  kind: "mutation",
21893
22017
  auth: "admin"
@@ -27576,7 +27700,9 @@ var ExportOptionsSchema = object({
27576
27700
  includeAudio: boolean(),
27577
27701
  maxLifeMs: number().int().positive(),
27578
27702
  deleteAfterDownload: boolean(),
27579
- title: string().max(200).optional()
27703
+ title: string().max(200).optional(),
27704
+ /** Notification-output target ids to ping when this export becomes ready. */
27705
+ notifyTargetIds: array(string().min(1)).max(20).optional()
27580
27706
  }).superRefine((v, ctx) => {
27581
27707
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
27582
27708
  code: ZodIssueCode.custom,
@@ -27635,10 +27761,18 @@ var ExportBytesSchema = object({
27635
27761
  });
27636
27762
  method(object({
27637
27763
  deviceId: number(),
27638
- profile: string(),
27764
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
27765
+ profile: string().optional(),
27766
+ profiles: array(string()).min(1).optional(),
27639
27767
  fromMs: number(),
27640
27768
  toMs: number(),
27641
27769
  options: ExportOptionsSchema
27770
+ }).superRefine((v, ctx) => {
27771
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
27772
+ code: ZodIssueCode.custom,
27773
+ message: "pass profiles[] (min 1) or legacy profile",
27774
+ path: ["profiles"]
27775
+ });
27642
27776
  }), ExportRecordSchema, {
27643
27777
  kind: "mutation",
27644
27778
  auth: "protected"
@@ -30580,15 +30714,6 @@ var BaseDeviceProvider = class extends BaseAddon {
30580
30714
  labels: ["probe not implemented"]
30581
30715
  };
30582
30716
  }
30583
- /**
30584
- * Top-level devices restored at once in {@link onRestoreDevices}.
30585
- *
30586
- * Four covers the fleets this ships to without turning a boot into a burst a
30587
- * camera NVR answers with a refusal. A provider whose upstream is a single
30588
- * session with a serial command channel (a Baichuan hub, an NVR that
30589
- * serialises ISAPI) should lower it; nothing needs to raise it.
30590
- */
30591
- restoreConcurrency = 4;
30592
30717
  async restoreDevices(savedDevices) {
30593
30718
  await this.onRestoreDevices(savedDevices);
30594
30719
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -30643,14 +30768,7 @@ var BaseDeviceProvider = class extends BaseAddon {
30643
30768
  });
30644
30769
  }
30645
30770
  };
30646
- let nextTopLevel = 0;
30647
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
30648
- for (;;) {
30649
- const saved = topLevel[nextTopLevel++];
30650
- if (saved === void 0) return;
30651
- await restoreOne(saved);
30652
- }
30653
- }));
30771
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
30654
30772
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
30655
30773
  for (const saved of childRows) {
30656
30774
  const Class = this.deviceClasses[saved.type];
@@ -33923,6 +34041,12 @@ Object.freeze({
33923
34041
  addonId: null,
33924
34042
  access: "create"
33925
34043
  },
34044
+ "pipelineAnalytics.reconcileFromDisk": {
34045
+ capName: "pipeline-analytics",
34046
+ capScope: "device",
34047
+ addonId: null,
34048
+ access: "create"
34049
+ },
33926
34050
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33927
34051
  capName: "pipeline-analytics",
33928
34052
  capScope: "device",
@@ -34325,6 +34449,12 @@ Object.freeze({
34325
34449
  addonId: null,
34326
34450
  access: "view"
34327
34451
  },
34452
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
34453
+ capName: "pipeline-orchestrator",
34454
+ capScope: "system",
34455
+ addonId: null,
34456
+ access: "view"
34457
+ },
34328
34458
  "pipelineOrchestrator.listAgentSettings": {
34329
34459
  capName: "pipeline-orchestrator",
34330
34460
  capScope: "system",
@@ -34349,6 +34479,12 @@ Object.freeze({
34349
34479
  addonId: null,
34350
34480
  access: "create"
34351
34481
  },
34482
+ "pipelineOrchestrator.reconcileFromDisk": {
34483
+ capName: "pipeline-orchestrator",
34484
+ capScope: "system",
34485
+ addonId: null,
34486
+ access: "create"
34487
+ },
34352
34488
  "pipelineOrchestrator.removeAgentSettings": {
34353
34489
  capName: "pipeline-orchestrator",
34354
34490
  capScope: "system",
@@ -37340,6 +37476,11 @@ Object.freeze({
37340
37476
  form: "single",
37341
37477
  optional: true
37342
37478
  }],
37479
+ "pipelineAnalytics.reconcileFromDisk": [{
37480
+ name: "deviceId",
37481
+ form: "single",
37482
+ optional: false
37483
+ }],
37343
37484
  "pipelineAnalytics.restageRetrainTrack": [{
37344
37485
  name: "deviceId",
37345
37486
  form: "single",
@@ -38405,6 +38546,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38405
38546
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38406
38547
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38407
38548
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38549
+ var MB = 1024 * 1024;
38550
+ 1024 * MB, 3072 * MB;
38408
38551
  //#endregion
38409
38552
  //#region src/config.ts
38410
38553
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-petkit",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "PetKit smart-feeder device-provider addon for CamStack — wraps the @apocaliss92/nodepetkit PetKit cloud client",
5
5
  "keywords": [
6
6
  "camstack",