@camstack/addon-mqtt-broker 1.2.19 → 1.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.
@@ -44,7 +44,7 @@ let crypto$10 = __toESM(crypto$1, 1);
44
44
  crypto$1 = __toESM(crypto$1);
45
45
  let node_fs = require("node:fs");
46
46
  let node_path = require("node:path");
47
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
47
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
48
48
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
49
49
  EventCategory["SystemBoot"] = "system.boot";
50
50
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -61,9 +61,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
61
61
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
62
62
  /**
63
63
  * A newer addon or server-root package version was found by the
64
- * authoritative registry check. Emitted once per
65
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
66
- * polling of the same result is deduplicated by the checker.
64
+ * authoritative registry check. Emitted once when any observed
65
+ * `latestVersion` changes (or a package/node first appears behind);
66
+ * the payload carries the full currently-available list. Repeated
67
+ * polling of the same latests is silent.
67
68
  */
68
69
  EventCategory["UpdateAvailable"] = "update.available";
69
70
  /**
@@ -82,6 +83,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
82
83
  EventCategory["AddonInstalled"] = "addon.installed";
83
84
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
84
85
  EventCategory["AddonCrashed"] = "addon.crashed";
86
+ /**
87
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
88
+ *
89
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
90
+ * respawned"); this is the one that never resolves itself. Emitted exactly
91
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
92
+ * addons it hosted and the crash count that tripped the breaker.
93
+ *
94
+ * It exists because a runner marked terminally `failed` used to be SILENT:
95
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
96
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
97
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
98
+ * operator's phone told him. The Notification Center's system-event intake
99
+ * consumes this category and maps it to the `addon-crash-loop` kind.
100
+ */
101
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
85
102
  EventCategory["AddonError"] = "addon.error";
86
103
  EventCategory["AddonPageReady"] = "addon.page-ready";
87
104
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7577,6 +7594,10 @@ var RecordingBandSchema = object({
7577
7594
  preBufferSec: number().min(0).optional(),
7578
7595
  postBufferSec: number().min(0).optional()
7579
7596
  });
7597
+ ({
7598
+ preBufferSec: 10,
7599
+ postBufferSec: 30
7600
+ }).postBufferSec * 1e3;
7580
7601
  /**
7581
7602
  * Per-device retention overrides. Every field is optional; an unset or `0`
7582
7603
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7624,6 +7645,12 @@ var RecordingConfigSchema = object({
7624
7645
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7625
7646
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7626
7647
  mode: RecordingStorageModeSchema.optional(),
7648
+ /**
7649
+ * Which assigned broker slots to record. Absent / empty = {@link
7650
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7651
+ * camera's currently assigned slots — never `mid` unless the operator
7652
+ * picks it, and never a slot the broker has not assigned.
7653
+ */
7627
7654
  profiles: array(CamProfileSchema).optional(),
7628
7655
  segmentSeconds: number().int().positive().optional(),
7629
7656
  /**
@@ -7704,7 +7731,11 @@ var RelocateFootageInputSchema = object({
7704
7731
  profiles: array(string()).optional(),
7705
7732
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7706
7733
  * never allowed to starve live writers. */
7707
- throttleMbps: number().min(1).max(1e3).optional()
7734
+ throttleMbps: number().min(1).max(1e3).optional(),
7735
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7736
+ * pile. Used when a full drain is too expensive and the operator only
7737
+ * wants the recent window on the new disk. */
7738
+ sinceMs: number().int().optional()
7708
7739
  });
7709
7740
  /** Internal, lease-scoped participant operation. It is intentionally separate
7710
7741
  * from persistent recording settings: a migration never changes
@@ -14335,6 +14366,7 @@ var NcSystemEventKindSchema = _enum([
14335
14366
  "node-offline",
14336
14367
  "node-inference-unavailable",
14337
14368
  "detection-blind",
14369
+ "addon-crash-loop",
14338
14370
  "addon-update-available",
14339
14371
  "server-update-available",
14340
14372
  "alarm-triggered",
@@ -14342,6 +14374,9 @@ var NcSystemEventKindSchema = _enum([
14342
14374
  "alarm-disarmed",
14343
14375
  "alarm-arming",
14344
14376
  "alarm-arm-refused",
14377
+ "addon-updated",
14378
+ "server-updated",
14379
+ "export-completed",
14345
14380
  "camera-online",
14346
14381
  "camera-offline",
14347
14382
  "camera-disabled",
@@ -16235,13 +16270,19 @@ var RetrainStatusSchema = _enum([
16235
16270
  * "never marked" from "already trained" must read `retrainStatus`.
16236
16271
  *
16237
16272
  * `debug` does NOT pin; it is attention, not durability.
16273
+ *
16274
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16275
+ * A favourited track is skipped by retention the same way `staging` is, but
16276
+ * it does not enter `none|staging|trained` and has no staging budget.
16238
16277
  */
16239
16278
  var TrackFlagFields = {
16240
16279
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16241
16280
  * `'staging'`. */
16242
16281
  markForTrain: boolean().optional(),
16243
16282
  /** Operator marked this track for diagnostic attention. */
16244
- debug: boolean().optional()
16283
+ debug: boolean().optional(),
16284
+ /** Operator favourited this track. Pins it against pruning. */
16285
+ favourited: boolean().optional()
16245
16286
  };
16246
16287
  /**
16247
16288
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16266,6 +16307,7 @@ var TrackFlagsSchema = object({
16266
16307
  trackId: string(),
16267
16308
  markForTrain: boolean(),
16268
16309
  debug: boolean(),
16310
+ favourited: boolean(),
16269
16311
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16270
16312
  * a track row) because this shape is only ever produced by the write body,
16271
16313
  * which always knows it — and a surface that has just written needs to render
@@ -16898,6 +16940,12 @@ var TrackCascadeCountsSchema = object({
16898
16940
  /** Per-track CLIP search vectors removed (best-effort). */
16899
16941
  embeddings: number().int()
16900
16942
  });
16943
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
16944
+ var DiskReconcileCountsSchema = object({
16945
+ mediaDropped: number().int(),
16946
+ tracks: number().int(),
16947
+ events: number().int()
16948
+ });
16901
16949
  /** Event-store footprint for one camera. */
16902
16950
  var EventStoreDeviceFootprintSchema = object({
16903
16951
  deviceId: number(),
@@ -17074,6 +17122,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17074
17122
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17075
17123
  kind: "mutation",
17076
17124
  auth: "admin"
17125
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17126
+ kind: "mutation",
17127
+ auth: "admin"
17077
17128
  }), method(object({
17078
17129
  deviceId: number(),
17079
17130
  trackIds: array(string()).min(1)
@@ -18584,6 +18635,24 @@ var CameraStatusDegradationSchema = object({
18584
18635
  *
18585
18636
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18586
18637
  */
18638
+ var DiskReconcileJobSchema = object({
18639
+ state: _enum([
18640
+ "idle",
18641
+ "running",
18642
+ "done",
18643
+ "error"
18644
+ ]),
18645
+ total: number().int().nonnegative(),
18646
+ completed: number().int().nonnegative(),
18647
+ currentDeviceId: number().int().nullable(),
18648
+ failed: array(number().int()).readonly(),
18649
+ mediaDropped: number().int().nonnegative(),
18650
+ tracks: number().int().nonnegative(),
18651
+ events: number().int().nonnegative(),
18652
+ startedAtMs: number().int().nullable(),
18653
+ finishedAtMs: number().int().nullable(),
18654
+ error: string().nullable()
18655
+ });
18587
18656
  var CameraStatusSchema = object({
18588
18657
  deviceId: number(),
18589
18658
  assignment: CameraAssignmentStatusSchema,
@@ -18815,7 +18884,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18815
18884
  }), CameraSwitchGroupSchema, {
18816
18885
  kind: "mutation",
18817
18886
  auth: "admin"
18818
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
18887
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
18888
+ kind: "mutation",
18889
+ auth: "admin"
18890
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
18819
18891
  name: string(),
18820
18892
  description: string().optional(),
18821
18893
  config: CameraPipelineConfigSchema
@@ -19220,7 +19292,14 @@ targets: array(object({
19220
19292
  "sleeping",
19221
19293
  "unreachable",
19222
19294
  "waking"
19223
- ]).nullable()
19295
+ ]).nullable(),
19296
+ /** A battery camera (whatever its current state). An AWAKE battery
19297
+ * camera is deliberately NOT recaptured on the poll cadence — every
19298
+ * capture is a camera hit that would keep it out of sleep — so its
19299
+ * cached frame legitimately ages past the currency ceiling while
19300
+ * nothing is streaming. A surface must keep painting it (a fresh
19301
+ * frame is captured at each wake), not blank to "unavailable". */
19302
+ battery: boolean()
19224
19303
  })));
19225
19304
  /**
19226
19305
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
@@ -19881,20 +19960,6 @@ var VectorStatsResultSchema = object({
19881
19960
  exact: boolean()
19882
19961
  });
19883
19962
  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);
19884
- /**
19885
- * `videoclips` — the unified, navigable-clip surface for a camera.
19886
- *
19887
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
19888
- * provider per device, substitutable. The DEFAULT provider (registered by
19889
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
19890
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
19891
- * is a time-WINDOW over existing footage, never a separate file. A camera that
19892
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
19893
- * wrapper provider for its device and serve its own clip catalog + URLs.
19894
- *
19895
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
19896
- * temporal overlap, so the API never decides `continuous` vs `events`.
19897
- */
19898
19963
  var ClipSchema = object({
19899
19964
  /** Opaque, provider-namespaced id. The default provider encodes the time
19900
19965
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -19911,8 +19976,57 @@ var ClipSchema = object({
19911
19976
  startMs: number(),
19912
19977
  endMs: number()
19913
19978
  }),
19914
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
19915
- thumbnail: string().optional()
19979
+ /**
19980
+ * Lazy thumbnail URL, never inlined.
19981
+ *
19982
+ * Recording-derived clips (events-mode keep-window, and the prepared
19983
+ * continuous event+fragment visit) MUST use the snapshot of the **main
19984
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
19985
+ * of the event that owns `kind` (object > motion > audio). Do not extract
19986
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
19987
+ * mint their own stills.
19988
+ *
19989
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
19990
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
19991
+ * Absent is meaningful — "this visit has no event still" — never "we did not
19992
+ * look". Stamping it from a URL template made 35% of one camera's clips point
19993
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
19994
+ * A read that FAILS drops the claim; it never invents it.
19995
+ */
19996
+ thumbnail: string().optional(),
19997
+ /**
19998
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
19999
+ * can be decoded. Present whenever the visit came from recorded availability;
20000
+ * absent on a per-event padded window (there is no footage to promise).
20001
+ *
20002
+ * This is not a thumbnail and not a second byte path: it is the argument to
20003
+ * the recorder's existing still route. The surface — never the provider —
20004
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20005
+ * contiguous range, not of the visit: a visit spans its holes by
20006
+ * construction, so a naive midpoint lands in dead air.
20007
+ */
20008
+ stillAtMs: number().optional(),
20009
+ /**
20010
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20011
+ * first within kind (object → motion → audio), capped at
20012
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20013
+ *
20014
+ * Bounded because it is not a payload the surface pages through: one visit on
20015
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20016
+ * camera-day. Read {@link eventCount} for the true total.
20017
+ */
20018
+ eventIds: array(string()).optional(),
20019
+ /** How many analytics events actually overlap this visit. Differs from
20020
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20021
+ * list is never mistaken for a quiet visit. */
20022
+ eventCount: number().int().nonnegative().optional(),
20023
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20024
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20025
+ * bar keeps showing them via `recording.getAvailability`. */
20026
+ holes: array(object({
20027
+ startMs: number(),
20028
+ endMs: number()
20029
+ })).optional()
19916
20030
  });
19917
20031
  var ClipPlaybackSchema = object({
19918
20032
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20376,7 +20490,14 @@ var SearchResultSchema = object({
20376
20490
  });
20377
20491
  var AutoUpdateSettingsSchema = object({
20378
20492
  channel: ChannelSchema,
20379
- intervalSeconds: number()
20493
+ intervalSeconds: number(),
20494
+ /**
20495
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20496
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20497
+ * about a publish and installing it are different decisions. Clamped
20498
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20499
+ */
20500
+ updateCheckIntervalSeconds: number()
20380
20501
  });
20381
20502
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20382
20503
  var RestartAddonResultSchema = unknown();
@@ -20517,7 +20638,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20517
20638
  auth: "admin"
20518
20639
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20519
20640
  channel: ChannelSchema,
20520
- intervalSeconds: number().min(300).max(86400).optional()
20641
+ intervalSeconds: number().min(300).max(86400).optional(),
20642
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20643
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20521
20644
  }), unknown(), {
20522
20645
  kind: "mutation",
20523
20646
  auth: "admin"
@@ -24510,7 +24633,9 @@ var ExportOptionsSchema = object({
24510
24633
  includeAudio: boolean(),
24511
24634
  maxLifeMs: number().int().positive(),
24512
24635
  deleteAfterDownload: boolean(),
24513
- title: string().max(200).optional()
24636
+ title: string().max(200).optional(),
24637
+ /** Notification-output target ids to ping when this export becomes ready. */
24638
+ notifyTargetIds: array(string().min(1)).max(20).optional()
24514
24639
  }).superRefine((v, ctx) => {
24515
24640
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
24516
24641
  code: ZodIssueCode.custom,
@@ -24569,10 +24694,18 @@ var ExportBytesSchema = object({
24569
24694
  });
24570
24695
  method(object({
24571
24696
  deviceId: number(),
24572
- profile: string(),
24697
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
24698
+ profile: string().optional(),
24699
+ profiles: array(string()).min(1).optional(),
24573
24700
  fromMs: number(),
24574
24701
  toMs: number(),
24575
24702
  options: ExportOptionsSchema
24703
+ }).superRefine((v, ctx) => {
24704
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
24705
+ code: ZodIssueCode.custom,
24706
+ message: "pass profiles[] (min 1) or legacy profile",
24707
+ path: ["profiles"]
24708
+ });
24576
24709
  }), ExportRecordSchema, {
24577
24710
  kind: "mutation",
24578
24711
  auth: "protected"
@@ -29172,6 +29305,12 @@ Object.freeze({
29172
29305
  addonId: null,
29173
29306
  access: "create"
29174
29307
  },
29308
+ "pipelineAnalytics.reconcileFromDisk": {
29309
+ capName: "pipeline-analytics",
29310
+ capScope: "device",
29311
+ addonId: null,
29312
+ access: "create"
29313
+ },
29175
29314
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
29176
29315
  capName: "pipeline-analytics",
29177
29316
  capScope: "device",
@@ -29574,6 +29713,12 @@ Object.freeze({
29574
29713
  addonId: null,
29575
29714
  access: "view"
29576
29715
  },
29716
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
29717
+ capName: "pipeline-orchestrator",
29718
+ capScope: "system",
29719
+ addonId: null,
29720
+ access: "view"
29721
+ },
29577
29722
  "pipelineOrchestrator.listAgentSettings": {
29578
29723
  capName: "pipeline-orchestrator",
29579
29724
  capScope: "system",
@@ -29598,6 +29743,12 @@ Object.freeze({
29598
29743
  addonId: null,
29599
29744
  access: "create"
29600
29745
  },
29746
+ "pipelineOrchestrator.reconcileFromDisk": {
29747
+ capName: "pipeline-orchestrator",
29748
+ capScope: "system",
29749
+ addonId: null,
29750
+ access: "create"
29751
+ },
29601
29752
  "pipelineOrchestrator.removeAgentSettings": {
29602
29753
  capName: "pipeline-orchestrator",
29603
29754
  capScope: "system",
@@ -32589,6 +32740,11 @@ Object.freeze({
32589
32740
  form: "single",
32590
32741
  optional: true
32591
32742
  }],
32743
+ "pipelineAnalytics.reconcileFromDisk": [{
32744
+ name: "deviceId",
32745
+ form: "single",
32746
+ optional: false
32747
+ }],
32592
32748
  "pipelineAnalytics.restageRetrainTrack": [{
32593
32749
  name: "deviceId",
32594
32750
  form: "single",
@@ -33654,6 +33810,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
33654
33810
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
33655
33811
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
33656
33812
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
33813
+ var MB = 1024 * 1024;
33814
+ 1024 * MB, 3072 * MB;
33657
33815
  //#endregion
33658
33816
  //#region ../../node_modules/xtend/immutable.js
33659
33817
  var require_immutable = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -39,7 +39,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
39
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
40
40
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
41
41
  //#endregion
42
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
42
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
43
43
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
44
44
  EventCategory["SystemBoot"] = "system.boot";
45
45
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -56,9 +56,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
56
56
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
57
57
  /**
58
58
  * A newer addon or server-root package version was found by the
59
- * authoritative registry check. Emitted once per
60
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
61
- * polling of the same result is deduplicated by the checker.
59
+ * authoritative registry check. Emitted once when any observed
60
+ * `latestVersion` changes (or a package/node first appears behind);
61
+ * the payload carries the full currently-available list. Repeated
62
+ * polling of the same latests is silent.
62
63
  */
63
64
  EventCategory["UpdateAvailable"] = "update.available";
64
65
  /**
@@ -77,6 +78,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
77
78
  EventCategory["AddonInstalled"] = "addon.installed";
78
79
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
79
80
  EventCategory["AddonCrashed"] = "addon.crashed";
81
+ /**
82
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
83
+ *
84
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
85
+ * respawned"); this is the one that never resolves itself. Emitted exactly
86
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
87
+ * addons it hosted and the crash count that tripped the breaker.
88
+ *
89
+ * It exists because a runner marked terminally `failed` used to be SILENT:
90
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
91
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
92
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
93
+ * operator's phone told him. The Notification Center's system-event intake
94
+ * consumes this category and maps it to the `addon-crash-loop` kind.
95
+ */
96
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
80
97
  EventCategory["AddonError"] = "addon.error";
81
98
  EventCategory["AddonPageReady"] = "addon.page-ready";
82
99
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7572,6 +7589,10 @@ var RecordingBandSchema = object({
7572
7589
  preBufferSec: number().min(0).optional(),
7573
7590
  postBufferSec: number().min(0).optional()
7574
7591
  });
7592
+ ({
7593
+ preBufferSec: 10,
7594
+ postBufferSec: 30
7595
+ }).postBufferSec * 1e3;
7575
7596
  /**
7576
7597
  * Per-device retention overrides. Every field is optional; an unset or `0`
7577
7598
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7619,6 +7640,12 @@ var RecordingConfigSchema = object({
7619
7640
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7620
7641
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7621
7642
  mode: RecordingStorageModeSchema.optional(),
7643
+ /**
7644
+ * Which assigned broker slots to record. Absent / empty = {@link
7645
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7646
+ * camera's currently assigned slots — never `mid` unless the operator
7647
+ * picks it, and never a slot the broker has not assigned.
7648
+ */
7622
7649
  profiles: array(CamProfileSchema).optional(),
7623
7650
  segmentSeconds: number().int().positive().optional(),
7624
7651
  /**
@@ -7699,7 +7726,11 @@ var RelocateFootageInputSchema = object({
7699
7726
  profiles: array(string()).optional(),
7700
7727
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7701
7728
  * never allowed to starve live writers. */
7702
- throttleMbps: number().min(1).max(1e3).optional()
7729
+ throttleMbps: number().min(1).max(1e3).optional(),
7730
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7731
+ * pile. Used when a full drain is too expensive and the operator only
7732
+ * wants the recent window on the new disk. */
7733
+ sinceMs: number().int().optional()
7703
7734
  });
7704
7735
  /** Internal, lease-scoped participant operation. It is intentionally separate
7705
7736
  * from persistent recording settings: a migration never changes
@@ -14330,6 +14361,7 @@ var NcSystemEventKindSchema = _enum([
14330
14361
  "node-offline",
14331
14362
  "node-inference-unavailable",
14332
14363
  "detection-blind",
14364
+ "addon-crash-loop",
14333
14365
  "addon-update-available",
14334
14366
  "server-update-available",
14335
14367
  "alarm-triggered",
@@ -14337,6 +14369,9 @@ var NcSystemEventKindSchema = _enum([
14337
14369
  "alarm-disarmed",
14338
14370
  "alarm-arming",
14339
14371
  "alarm-arm-refused",
14372
+ "addon-updated",
14373
+ "server-updated",
14374
+ "export-completed",
14340
14375
  "camera-online",
14341
14376
  "camera-offline",
14342
14377
  "camera-disabled",
@@ -16230,13 +16265,19 @@ var RetrainStatusSchema = _enum([
16230
16265
  * "never marked" from "already trained" must read `retrainStatus`.
16231
16266
  *
16232
16267
  * `debug` does NOT pin; it is attention, not durability.
16268
+ *
16269
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16270
+ * A favourited track is skipped by retention the same way `staging` is, but
16271
+ * it does not enter `none|staging|trained` and has no staging budget.
16233
16272
  */
16234
16273
  var TrackFlagFields = {
16235
16274
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16236
16275
  * `'staging'`. */
16237
16276
  markForTrain: boolean().optional(),
16238
16277
  /** Operator marked this track for diagnostic attention. */
16239
- debug: boolean().optional()
16278
+ debug: boolean().optional(),
16279
+ /** Operator favourited this track. Pins it against pruning. */
16280
+ favourited: boolean().optional()
16240
16281
  };
16241
16282
  /**
16242
16283
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16261,6 +16302,7 @@ var TrackFlagsSchema = object({
16261
16302
  trackId: string(),
16262
16303
  markForTrain: boolean(),
16263
16304
  debug: boolean(),
16305
+ favourited: boolean(),
16264
16306
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16265
16307
  * a track row) because this shape is only ever produced by the write body,
16266
16308
  * which always knows it — and a surface that has just written needs to render
@@ -16893,6 +16935,12 @@ var TrackCascadeCountsSchema = object({
16893
16935
  /** Per-track CLIP search vectors removed (best-effort). */
16894
16936
  embeddings: number().int()
16895
16937
  });
16938
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
16939
+ var DiskReconcileCountsSchema = object({
16940
+ mediaDropped: number().int(),
16941
+ tracks: number().int(),
16942
+ events: number().int()
16943
+ });
16896
16944
  /** Event-store footprint for one camera. */
16897
16945
  var EventStoreDeviceFootprintSchema = object({
16898
16946
  deviceId: number(),
@@ -17069,6 +17117,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17069
17117
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17070
17118
  kind: "mutation",
17071
17119
  auth: "admin"
17120
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17121
+ kind: "mutation",
17122
+ auth: "admin"
17072
17123
  }), method(object({
17073
17124
  deviceId: number(),
17074
17125
  trackIds: array(string()).min(1)
@@ -18579,6 +18630,24 @@ var CameraStatusDegradationSchema = object({
18579
18630
  *
18580
18631
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18581
18632
  */
18633
+ var DiskReconcileJobSchema = object({
18634
+ state: _enum([
18635
+ "idle",
18636
+ "running",
18637
+ "done",
18638
+ "error"
18639
+ ]),
18640
+ total: number().int().nonnegative(),
18641
+ completed: number().int().nonnegative(),
18642
+ currentDeviceId: number().int().nullable(),
18643
+ failed: array(number().int()).readonly(),
18644
+ mediaDropped: number().int().nonnegative(),
18645
+ tracks: number().int().nonnegative(),
18646
+ events: number().int().nonnegative(),
18647
+ startedAtMs: number().int().nullable(),
18648
+ finishedAtMs: number().int().nullable(),
18649
+ error: string().nullable()
18650
+ });
18582
18651
  var CameraStatusSchema = object({
18583
18652
  deviceId: number(),
18584
18653
  assignment: CameraAssignmentStatusSchema,
@@ -18810,7 +18879,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
18810
18879
  }), CameraSwitchGroupSchema, {
18811
18880
  kind: "mutation",
18812
18881
  auth: "admin"
18813
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
18882
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
18883
+ kind: "mutation",
18884
+ auth: "admin"
18885
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
18814
18886
  name: string(),
18815
18887
  description: string().optional(),
18816
18888
  config: CameraPipelineConfigSchema
@@ -19215,7 +19287,14 @@ targets: array(object({
19215
19287
  "sleeping",
19216
19288
  "unreachable",
19217
19289
  "waking"
19218
- ]).nullable()
19290
+ ]).nullable(),
19291
+ /** A battery camera (whatever its current state). An AWAKE battery
19292
+ * camera is deliberately NOT recaptured on the poll cadence — every
19293
+ * capture is a camera hit that would keep it out of sleep — so its
19294
+ * cached frame legitimately ages past the currency ceiling while
19295
+ * nothing is streaming. A surface must keep painting it (a fresh
19296
+ * frame is captured at each wake), not blank to "unavailable". */
19297
+ battery: boolean()
19219
19298
  })));
19220
19299
  /**
19221
19300
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
@@ -19876,20 +19955,6 @@ var VectorStatsResultSchema = object({
19876
19955
  exact: boolean()
19877
19956
  });
19878
19957
  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);
19879
- /**
19880
- * `videoclips` — the unified, navigable-clip surface for a camera.
19881
- *
19882
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
19883
- * provider per device, substitutable. The DEFAULT provider (registered by
19884
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
19885
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
19886
- * is a time-WINDOW over existing footage, never a separate file. A camera that
19887
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
19888
- * wrapper provider for its device and serve its own clip catalog + URLs.
19889
- *
19890
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
19891
- * temporal overlap, so the API never decides `continuous` vs `events`.
19892
- */
19893
19958
  var ClipSchema = object({
19894
19959
  /** Opaque, provider-namespaced id. The default provider encodes the time
19895
19960
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -19906,8 +19971,57 @@ var ClipSchema = object({
19906
19971
  startMs: number(),
19907
19972
  endMs: number()
19908
19973
  }),
19909
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
19910
- thumbnail: string().optional()
19974
+ /**
19975
+ * Lazy thumbnail URL, never inlined.
19976
+ *
19977
+ * Recording-derived clips (events-mode keep-window, and the prepared
19978
+ * continuous event+fragment visit) MUST use the snapshot of the **main
19979
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
19980
+ * of the event that owns `kind` (object > motion > audio). Do not extract
19981
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
19982
+ * mint their own stills.
19983
+ *
19984
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
19985
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
19986
+ * Absent is meaningful — "this visit has no event still" — never "we did not
19987
+ * look". Stamping it from a URL template made 35% of one camera's clips point
19988
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
19989
+ * A read that FAILS drops the claim; it never invents it.
19990
+ */
19991
+ thumbnail: string().optional(),
19992
+ /**
19993
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
19994
+ * can be decoded. Present whenever the visit came from recorded availability;
19995
+ * absent on a per-event padded window (there is no footage to promise).
19996
+ *
19997
+ * This is not a thumbnail and not a second byte path: it is the argument to
19998
+ * the recorder's existing still route. The surface — never the provider —
19999
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20000
+ * contiguous range, not of the visit: a visit spans its holes by
20001
+ * construction, so a naive midpoint lands in dead air.
20002
+ */
20003
+ stillAtMs: number().optional(),
20004
+ /**
20005
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20006
+ * first within kind (object → motion → audio), capped at
20007
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20008
+ *
20009
+ * Bounded because it is not a payload the surface pages through: one visit on
20010
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20011
+ * camera-day. Read {@link eventCount} for the true total.
20012
+ */
20013
+ eventIds: array(string()).optional(),
20014
+ /** How many analytics events actually overlap this visit. Differs from
20015
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20016
+ * list is never mistaken for a quiet visit. */
20017
+ eventCount: number().int().nonnegative().optional(),
20018
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20019
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20020
+ * bar keeps showing them via `recording.getAvailability`. */
20021
+ holes: array(object({
20022
+ startMs: number(),
20023
+ endMs: number()
20024
+ })).optional()
19911
20025
  });
19912
20026
  var ClipPlaybackSchema = object({
19913
20027
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20371,7 +20485,14 @@ var SearchResultSchema = object({
20371
20485
  });
20372
20486
  var AutoUpdateSettingsSchema = object({
20373
20487
  channel: ChannelSchema,
20374
- intervalSeconds: number()
20488
+ intervalSeconds: number(),
20489
+ /**
20490
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20491
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20492
+ * about a publish and installing it are different decisions. Clamped
20493
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20494
+ */
20495
+ updateCheckIntervalSeconds: number()
20375
20496
  });
20376
20497
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20377
20498
  var RestartAddonResultSchema = unknown();
@@ -20512,7 +20633,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20512
20633
  auth: "admin"
20513
20634
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20514
20635
  channel: ChannelSchema,
20515
- intervalSeconds: number().min(300).max(86400).optional()
20636
+ intervalSeconds: number().min(300).max(86400).optional(),
20637
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20638
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20516
20639
  }), unknown(), {
20517
20640
  kind: "mutation",
20518
20641
  auth: "admin"
@@ -24505,7 +24628,9 @@ var ExportOptionsSchema = object({
24505
24628
  includeAudio: boolean(),
24506
24629
  maxLifeMs: number().int().positive(),
24507
24630
  deleteAfterDownload: boolean(),
24508
- title: string().max(200).optional()
24631
+ title: string().max(200).optional(),
24632
+ /** Notification-output target ids to ping when this export becomes ready. */
24633
+ notifyTargetIds: array(string().min(1)).max(20).optional()
24509
24634
  }).superRefine((v, ctx) => {
24510
24635
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
24511
24636
  code: ZodIssueCode.custom,
@@ -24564,10 +24689,18 @@ var ExportBytesSchema = object({
24564
24689
  });
24565
24690
  method(object({
24566
24691
  deviceId: number(),
24567
- profile: string(),
24692
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
24693
+ profile: string().optional(),
24694
+ profiles: array(string()).min(1).optional(),
24568
24695
  fromMs: number(),
24569
24696
  toMs: number(),
24570
24697
  options: ExportOptionsSchema
24698
+ }).superRefine((v, ctx) => {
24699
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
24700
+ code: ZodIssueCode.custom,
24701
+ message: "pass profiles[] (min 1) or legacy profile",
24702
+ path: ["profiles"]
24703
+ });
24571
24704
  }), ExportRecordSchema, {
24572
24705
  kind: "mutation",
24573
24706
  auth: "protected"
@@ -29167,6 +29300,12 @@ Object.freeze({
29167
29300
  addonId: null,
29168
29301
  access: "create"
29169
29302
  },
29303
+ "pipelineAnalytics.reconcileFromDisk": {
29304
+ capName: "pipeline-analytics",
29305
+ capScope: "device",
29306
+ addonId: null,
29307
+ access: "create"
29308
+ },
29170
29309
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
29171
29310
  capName: "pipeline-analytics",
29172
29311
  capScope: "device",
@@ -29569,6 +29708,12 @@ Object.freeze({
29569
29708
  addonId: null,
29570
29709
  access: "view"
29571
29710
  },
29711
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
29712
+ capName: "pipeline-orchestrator",
29713
+ capScope: "system",
29714
+ addonId: null,
29715
+ access: "view"
29716
+ },
29572
29717
  "pipelineOrchestrator.listAgentSettings": {
29573
29718
  capName: "pipeline-orchestrator",
29574
29719
  capScope: "system",
@@ -29593,6 +29738,12 @@ Object.freeze({
29593
29738
  addonId: null,
29594
29739
  access: "create"
29595
29740
  },
29741
+ "pipelineOrchestrator.reconcileFromDisk": {
29742
+ capName: "pipeline-orchestrator",
29743
+ capScope: "system",
29744
+ addonId: null,
29745
+ access: "create"
29746
+ },
29596
29747
  "pipelineOrchestrator.removeAgentSettings": {
29597
29748
  capName: "pipeline-orchestrator",
29598
29749
  capScope: "system",
@@ -32584,6 +32735,11 @@ Object.freeze({
32584
32735
  form: "single",
32585
32736
  optional: true
32586
32737
  }],
32738
+ "pipelineAnalytics.reconcileFromDisk": [{
32739
+ name: "deviceId",
32740
+ form: "single",
32741
+ optional: false
32742
+ }],
32587
32743
  "pipelineAnalytics.restageRetrainTrack": [{
32588
32744
  name: "deviceId",
32589
32745
  form: "single",
@@ -33649,6 +33805,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
33649
33805
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
33650
33806
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
33651
33807
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
33808
+ var MB = 1024 * 1024;
33809
+ 1024 * MB, 3072 * MB;
33652
33810
  //#endregion
33653
33811
  //#region ../../node_modules/xtend/immutable.js
33654
33812
  var require_immutable = /* @__PURE__ */ __commonJSMin(((exports, module) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-mqtt-broker",
3
- "version": "1.2.19",
3
+ "version": "1.2.21",
4
4
  "description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
5
5
  "keywords": [
6
6
  "camstack",