@camstack/addon-provider-petkit 0.2.20 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +179 -44
  2. package/dist/addon.mjs +179 -44
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -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,57 @@ 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
+ * Lazy thumbnail URL, never inlined.
21345
+ *
21346
+ * Recording-derived clips (events-mode keep-window, and the prepared
21347
+ * continuous event+fragment visit) MUST use the snapshot of the **main
21348
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
21349
+ * of the event that owns `kind` (object > motion > audio). Do not extract
21350
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
21351
+ * mint their own stills.
21352
+ *
21353
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
21354
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
21355
+ * Absent is meaningful — "this visit has no event still" — never "we did not
21356
+ * look". Stamping it from a URL template made 35% of one camera's clips point
21357
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
21358
+ * A read that FAILS drops the claim; it never invents it.
21359
+ */
21360
+ thumbnail: string().optional(),
21361
+ /**
21362
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
21363
+ * can be decoded. Present whenever the visit came from recorded availability;
21364
+ * absent on a per-event padded window (there is no footage to promise).
21365
+ *
21366
+ * This is not a thumbnail and not a second byte path: it is the argument to
21367
+ * the recorder's existing still route. The surface — never the provider —
21368
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
21369
+ * contiguous range, not of the visit: a visit spans its holes by
21370
+ * construction, so a naive midpoint lands in dead air.
21371
+ */
21372
+ stillAtMs: number().optional(),
21373
+ /**
21374
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
21375
+ * first within kind (object → motion → audio), capped at
21376
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
21377
+ *
21378
+ * Bounded because it is not a payload the surface pages through: one visit on
21379
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
21380
+ * camera-day. Read {@link eventCount} for the true total.
21381
+ */
21382
+ eventIds: array(string()).optional(),
21383
+ /** How many analytics events actually overlap this visit. Differs from
21384
+ * `eventIds.length` exactly when the sample was capped — so a truncated
21385
+ * list is never mistaken for a quiet visit. */
21386
+ eventCount: number().int().nonnegative().optional(),
21387
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
21388
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
21389
+ * bar keeps showing them via `recording.getAvailability`. */
21390
+ holes: array(object({
21391
+ startMs: number(),
21392
+ endMs: number()
21393
+ })).optional()
21287
21394
  });
21288
21395
  var ClipPlaybackSchema = object({
21289
21396
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -21747,7 +21854,14 @@ var SearchResultSchema = object({
21747
21854
  });
21748
21855
  var AutoUpdateSettingsSchema = object({
21749
21856
  channel: ChannelSchema,
21750
- intervalSeconds: number()
21857
+ intervalSeconds: number(),
21858
+ /**
21859
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
21860
+ * `channel`: the poller runs while auto-apply is `off`, because being told
21861
+ * about a publish and installing it are different decisions. Clamped
21862
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
21863
+ */
21864
+ updateCheckIntervalSeconds: number()
21751
21865
  });
21752
21866
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21753
21867
  var RestartAddonResultSchema = unknown();
@@ -21888,7 +22002,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21888
22002
  auth: "admin"
21889
22003
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21890
22004
  channel: ChannelSchema,
21891
- intervalSeconds: number().min(300).max(86400).optional()
22005
+ intervalSeconds: number().min(300).max(86400).optional(),
22006
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
22007
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21892
22008
  }), unknown(), {
21893
22009
  kind: "mutation",
21894
22010
  auth: "admin"
@@ -27577,7 +27693,9 @@ var ExportOptionsSchema = object({
27577
27693
  includeAudio: boolean(),
27578
27694
  maxLifeMs: number().int().positive(),
27579
27695
  deleteAfterDownload: boolean(),
27580
- title: string().max(200).optional()
27696
+ title: string().max(200).optional(),
27697
+ /** Notification-output target ids to ping when this export becomes ready. */
27698
+ notifyTargetIds: array(string().min(1)).max(20).optional()
27581
27699
  }).superRefine((v, ctx) => {
27582
27700
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
27583
27701
  code: ZodIssueCode.custom,
@@ -27636,10 +27754,18 @@ var ExportBytesSchema = object({
27636
27754
  });
27637
27755
  method(object({
27638
27756
  deviceId: number(),
27639
- profile: string(),
27757
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
27758
+ profile: string().optional(),
27759
+ profiles: array(string()).min(1).optional(),
27640
27760
  fromMs: number(),
27641
27761
  toMs: number(),
27642
27762
  options: ExportOptionsSchema
27763
+ }).superRefine((v, ctx) => {
27764
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
27765
+ code: ZodIssueCode.custom,
27766
+ message: "pass profiles[] (min 1) or legacy profile",
27767
+ path: ["profiles"]
27768
+ });
27643
27769
  }), ExportRecordSchema, {
27644
27770
  kind: "mutation",
27645
27771
  auth: "protected"
@@ -30581,15 +30707,6 @@ var BaseDeviceProvider = class extends BaseAddon {
30581
30707
  labels: ["probe not implemented"]
30582
30708
  };
30583
30709
  }
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
30710
  async restoreDevices(savedDevices) {
30594
30711
  await this.onRestoreDevices(savedDevices);
30595
30712
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -30644,14 +30761,7 @@ var BaseDeviceProvider = class extends BaseAddon {
30644
30761
  });
30645
30762
  }
30646
30763
  };
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
- }));
30764
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
30655
30765
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
30656
30766
  for (const saved of childRows) {
30657
30767
  const Class = this.deviceClasses[saved.type];
@@ -33924,6 +34034,12 @@ Object.freeze({
33924
34034
  addonId: null,
33925
34035
  access: "create"
33926
34036
  },
34037
+ "pipelineAnalytics.reconcileFromDisk": {
34038
+ capName: "pipeline-analytics",
34039
+ capScope: "device",
34040
+ addonId: null,
34041
+ access: "create"
34042
+ },
33927
34043
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33928
34044
  capName: "pipeline-analytics",
33929
34045
  capScope: "device",
@@ -34326,6 +34442,12 @@ Object.freeze({
34326
34442
  addonId: null,
34327
34443
  access: "view"
34328
34444
  },
34445
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
34446
+ capName: "pipeline-orchestrator",
34447
+ capScope: "system",
34448
+ addonId: null,
34449
+ access: "view"
34450
+ },
34329
34451
  "pipelineOrchestrator.listAgentSettings": {
34330
34452
  capName: "pipeline-orchestrator",
34331
34453
  capScope: "system",
@@ -34350,6 +34472,12 @@ Object.freeze({
34350
34472
  addonId: null,
34351
34473
  access: "create"
34352
34474
  },
34475
+ "pipelineOrchestrator.reconcileFromDisk": {
34476
+ capName: "pipeline-orchestrator",
34477
+ capScope: "system",
34478
+ addonId: null,
34479
+ access: "create"
34480
+ },
34353
34481
  "pipelineOrchestrator.removeAgentSettings": {
34354
34482
  capName: "pipeline-orchestrator",
34355
34483
  capScope: "system",
@@ -37341,6 +37469,11 @@ Object.freeze({
37341
37469
  form: "single",
37342
37470
  optional: true
37343
37471
  }],
37472
+ "pipelineAnalytics.reconcileFromDisk": [{
37473
+ name: "deviceId",
37474
+ form: "single",
37475
+ optional: false
37476
+ }],
37344
37477
  "pipelineAnalytics.restageRetrainTrack": [{
37345
37478
  name: "deviceId",
37346
37479
  form: "single",
@@ -38406,6 +38539,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38406
38539
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38407
38540
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38408
38541
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38542
+ var MB = 1024 * 1024;
38543
+ 1024 * MB, 3072 * MB;
38409
38544
  //#endregion
38410
38545
  //#region src/config.ts
38411
38546
  /**
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,57 @@ 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
+ * Lazy thumbnail URL, never inlined.
21344
+ *
21345
+ * Recording-derived clips (events-mode keep-window, and the prepared
21346
+ * continuous event+fragment visit) MUST use the snapshot of the **main
21347
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
21348
+ * of the event that owns `kind` (object > motion > audio). Do not extract
21349
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
21350
+ * mint their own stills.
21351
+ *
21352
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
21353
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
21354
+ * Absent is meaningful — "this visit has no event still" — never "we did not
21355
+ * look". Stamping it from a URL template made 35% of one camera's clips point
21356
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
21357
+ * A read that FAILS drops the claim; it never invents it.
21358
+ */
21359
+ thumbnail: string().optional(),
21360
+ /**
21361
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
21362
+ * can be decoded. Present whenever the visit came from recorded availability;
21363
+ * absent on a per-event padded window (there is no footage to promise).
21364
+ *
21365
+ * This is not a thumbnail and not a second byte path: it is the argument to
21366
+ * the recorder's existing still route. The surface — never the provider —
21367
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
21368
+ * contiguous range, not of the visit: a visit spans its holes by
21369
+ * construction, so a naive midpoint lands in dead air.
21370
+ */
21371
+ stillAtMs: number().optional(),
21372
+ /**
21373
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
21374
+ * first within kind (object → motion → audio), capped at
21375
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
21376
+ *
21377
+ * Bounded because it is not a payload the surface pages through: one visit on
21378
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
21379
+ * camera-day. Read {@link eventCount} for the true total.
21380
+ */
21381
+ eventIds: array(string()).optional(),
21382
+ /** How many analytics events actually overlap this visit. Differs from
21383
+ * `eventIds.length` exactly when the sample was capped — so a truncated
21384
+ * list is never mistaken for a quiet visit. */
21385
+ eventCount: number().int().nonnegative().optional(),
21386
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
21387
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
21388
+ * bar keeps showing them via `recording.getAvailability`. */
21389
+ holes: array(object({
21390
+ startMs: number(),
21391
+ endMs: number()
21392
+ })).optional()
21286
21393
  });
21287
21394
  var ClipPlaybackSchema = object({
21288
21395
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -21746,7 +21853,14 @@ var SearchResultSchema = object({
21746
21853
  });
21747
21854
  var AutoUpdateSettingsSchema = object({
21748
21855
  channel: ChannelSchema,
21749
- intervalSeconds: number()
21856
+ intervalSeconds: number(),
21857
+ /**
21858
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
21859
+ * `channel`: the poller runs while auto-apply is `off`, because being told
21860
+ * about a publish and installing it are different decisions. Clamped
21861
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
21862
+ */
21863
+ updateCheckIntervalSeconds: number()
21750
21864
  });
21751
21865
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21752
21866
  var RestartAddonResultSchema = unknown();
@@ -21887,7 +22001,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21887
22001
  auth: "admin"
21888
22002
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21889
22003
  channel: ChannelSchema,
21890
- intervalSeconds: number().min(300).max(86400).optional()
22004
+ intervalSeconds: number().min(300).max(86400).optional(),
22005
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
22006
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21891
22007
  }), unknown(), {
21892
22008
  kind: "mutation",
21893
22009
  auth: "admin"
@@ -27576,7 +27692,9 @@ var ExportOptionsSchema = object({
27576
27692
  includeAudio: boolean(),
27577
27693
  maxLifeMs: number().int().positive(),
27578
27694
  deleteAfterDownload: boolean(),
27579
- title: string().max(200).optional()
27695
+ title: string().max(200).optional(),
27696
+ /** Notification-output target ids to ping when this export becomes ready. */
27697
+ notifyTargetIds: array(string().min(1)).max(20).optional()
27580
27698
  }).superRefine((v, ctx) => {
27581
27699
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
27582
27700
  code: ZodIssueCode.custom,
@@ -27635,10 +27753,18 @@ var ExportBytesSchema = object({
27635
27753
  });
27636
27754
  method(object({
27637
27755
  deviceId: number(),
27638
- profile: string(),
27756
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
27757
+ profile: string().optional(),
27758
+ profiles: array(string()).min(1).optional(),
27639
27759
  fromMs: number(),
27640
27760
  toMs: number(),
27641
27761
  options: ExportOptionsSchema
27762
+ }).superRefine((v, ctx) => {
27763
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
27764
+ code: ZodIssueCode.custom,
27765
+ message: "pass profiles[] (min 1) or legacy profile",
27766
+ path: ["profiles"]
27767
+ });
27642
27768
  }), ExportRecordSchema, {
27643
27769
  kind: "mutation",
27644
27770
  auth: "protected"
@@ -30580,15 +30706,6 @@ var BaseDeviceProvider = class extends BaseAddon {
30580
30706
  labels: ["probe not implemented"]
30581
30707
  };
30582
30708
  }
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
30709
  async restoreDevices(savedDevices) {
30593
30710
  await this.onRestoreDevices(savedDevices);
30594
30711
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -30643,14 +30760,7 @@ var BaseDeviceProvider = class extends BaseAddon {
30643
30760
  });
30644
30761
  }
30645
30762
  };
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
- }));
30763
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
30654
30764
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
30655
30765
  for (const saved of childRows) {
30656
30766
  const Class = this.deviceClasses[saved.type];
@@ -33923,6 +34033,12 @@ Object.freeze({
33923
34033
  addonId: null,
33924
34034
  access: "create"
33925
34035
  },
34036
+ "pipelineAnalytics.reconcileFromDisk": {
34037
+ capName: "pipeline-analytics",
34038
+ capScope: "device",
34039
+ addonId: null,
34040
+ access: "create"
34041
+ },
33926
34042
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33927
34043
  capName: "pipeline-analytics",
33928
34044
  capScope: "device",
@@ -34325,6 +34441,12 @@ Object.freeze({
34325
34441
  addonId: null,
34326
34442
  access: "view"
34327
34443
  },
34444
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
34445
+ capName: "pipeline-orchestrator",
34446
+ capScope: "system",
34447
+ addonId: null,
34448
+ access: "view"
34449
+ },
34328
34450
  "pipelineOrchestrator.listAgentSettings": {
34329
34451
  capName: "pipeline-orchestrator",
34330
34452
  capScope: "system",
@@ -34349,6 +34471,12 @@ Object.freeze({
34349
34471
  addonId: null,
34350
34472
  access: "create"
34351
34473
  },
34474
+ "pipelineOrchestrator.reconcileFromDisk": {
34475
+ capName: "pipeline-orchestrator",
34476
+ capScope: "system",
34477
+ addonId: null,
34478
+ access: "create"
34479
+ },
34352
34480
  "pipelineOrchestrator.removeAgentSettings": {
34353
34481
  capName: "pipeline-orchestrator",
34354
34482
  capScope: "system",
@@ -37340,6 +37468,11 @@ Object.freeze({
37340
37468
  form: "single",
37341
37469
  optional: true
37342
37470
  }],
37471
+ "pipelineAnalytics.reconcileFromDisk": [{
37472
+ name: "deviceId",
37473
+ form: "single",
37474
+ optional: false
37475
+ }],
37343
37476
  "pipelineAnalytics.restageRetrainTrack": [{
37344
37477
  name: "deviceId",
37345
37478
  form: "single",
@@ -38405,6 +38538,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
38405
38538
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
38406
38539
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
38407
38540
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
38541
+ var MB = 1024 * 1024;
38542
+ 1024 * MB, 3072 * MB;
38408
38543
  //#endregion
38409
38544
  //#region src/config.ts
38410
38545
  /**
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.21",
4
4
  "description": "PetKit smart-feeder device-provider addon for CamStack — wraps the @apocaliss92/nodepetkit PetKit cloud client",
5
5
  "keywords": [
6
6
  "camstack",