@camstack/system 1.2.102 → 1.2.104

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 (62) hide show
  1. package/dist/addon-runner.js +15 -1
  2. package/dist/addon-runner.mjs +15 -1
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  19. package/dist/builtins/hub-forwarder/index.js +1 -1
  20. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  25. package/dist/builtins/local-network/local-network.addon.js +1 -1
  26. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  27. package/dist/builtins/loki-logging/index.js +1 -1
  28. package/dist/builtins/loki-logging/index.mjs +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  31. package/dist/builtins/platform-probe/index.js +1 -1
  32. package/dist/builtins/platform-probe/index.mjs +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  35. package/dist/builtins/snapshot/index.js +150 -22
  36. package/dist/builtins/snapshot/index.mjs +150 -22
  37. package/dist/builtins/snapshot/snapshot-cache.d.ts +63 -0
  38. package/dist/builtins/snapshot/snapshot-resize.d.ts +33 -1
  39. package/dist/builtins/snapshot/snapshot.addon.d.ts +6 -0
  40. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  41. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  43. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  45. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  46. package/dist/builtins/system-config/system-config.addon.js +1 -1
  47. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  48. package/dist/builtins/winston-logging/index.js +1 -1
  49. package/dist/builtins/winston-logging/index.mjs +1 -1
  50. package/dist/{dist-3wh5LCad.mjs → dist-CAzHQ03i.mjs} +144 -21
  51. package/dist/{dist-9sC0wZw6.js → dist-DR1VmGz6.js} +144 -21
  52. package/dist/index.d.ts +2 -2
  53. package/dist/index.js +243 -328
  54. package/dist/index.mjs +233 -319
  55. package/dist/kernel/config-schema.d.ts +14 -10
  56. package/dist/kernel/heap-watch.d.ts +106 -7
  57. package/dist/kernel/moleculer/process-service.d.ts +34 -0
  58. package/dist/logging/log-manager.d.ts +7 -5
  59. package/dist/logging/partitioned-log-buffer.d.ts +95 -16
  60. package/dist/{manifest-python-deps-Bt_J04b0.mjs → manifest-python-deps-5ei2xVUh.mjs} +355 -1
  61. package/dist/{manifest-python-deps-BtVjvfvj.js → manifest-python-deps-GejnH--L.js} +422 -0
  62. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- //#region ../types/dist/event-category-C0lyLd5U.mjs
2
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -38,6 +38,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
38
38
  EventCategory["AddonInstalled"] = "addon.installed";
39
39
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
40
40
  EventCategory["AddonCrashed"] = "addon.crashed";
41
+ /**
42
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
43
+ *
44
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
45
+ * respawned"); this is the one that never resolves itself. Emitted exactly
46
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
47
+ * addons it hosted and the crash count that tripped the breaker.
48
+ *
49
+ * It exists because a runner marked terminally `failed` used to be SILENT:
50
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
51
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
52
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
53
+ * operator's phone told him. The Notification Center's system-event intake
54
+ * consumes this category and maps it to the `addon-crash-loop` kind.
55
+ */
56
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
41
57
  EventCategory["AddonError"] = "addon.error";
42
58
  EventCategory["AddonPageReady"] = "addon.page-ready";
43
59
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -3703,6 +3719,12 @@ var RecordingConfigSchema = z.object({
3703
3719
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
3704
3720
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
3705
3721
  mode: RecordingStorageModeSchema.optional(),
3722
+ /**
3723
+ * Which assigned broker slots to record. Absent / empty = {@link
3724
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
3725
+ * camera's currently assigned slots — never `mid` unless the operator
3726
+ * picks it, and never a slot the broker has not assigned.
3727
+ */
3706
3728
  profiles: z.array(CamProfileSchema).optional(),
3707
3729
  segmentSeconds: z.number().int().positive().optional(),
3708
3730
  /**
@@ -3783,7 +3805,11 @@ var RelocateFootageInputSchema = z.object({
3783
3805
  profiles: z.array(z.string()).optional(),
3784
3806
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
3785
3807
  * never allowed to starve live writers. */
3786
- throttleMbps: z.number().min(1).max(1e3).optional()
3808
+ throttleMbps: z.number().min(1).max(1e3).optional(),
3809
+ /** Move only segments whose startMs is >= this. Absent = the whole source
3810
+ * pile. Used when a full drain is too expensive and the operator only
3811
+ * wants the recent window on the new disk. */
3812
+ sinceMs: z.number().int().optional()
3787
3813
  });
3788
3814
  /** Internal, lease-scoped participant operation. It is intentionally separate
3789
3815
  * from persistent recording settings: a migration never changes
@@ -12431,6 +12457,7 @@ var NcSystemEventKindSchema = z.enum([
12431
12457
  "node-offline",
12432
12458
  "node-inference-unavailable",
12433
12459
  "detection-blind",
12460
+ "addon-crash-loop",
12434
12461
  "addon-update-available",
12435
12462
  "server-update-available",
12436
12463
  "alarm-triggered",
@@ -15122,6 +15149,12 @@ var TrackCascadeCountsSchema = z.object({
15122
15149
  /** Per-track CLIP search vectors removed (best-effort). */
15123
15150
  embeddings: z.number().int()
15124
15151
  });
15152
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
15153
+ var DiskReconcileCountsSchema = z.object({
15154
+ mediaDropped: z.number().int(),
15155
+ tracks: z.number().int(),
15156
+ events: z.number().int()
15157
+ });
15125
15158
  /** Event-store footprint for one camera. */
15126
15159
  var EventStoreDeviceFootprintSchema = z.object({
15127
15160
  deviceId: z.number(),
@@ -15407,6 +15440,17 @@ var pipelineAnalyticsCapability = {
15407
15440
  auth: "admin"
15408
15441
  }),
15409
15442
  /**
15443
+ * Disk-wins reconcile for one camera. Drops media index rows whose blobs
15444
+ * are gone, then cascades tracks (including favourited and staging) that
15445
+ * have no remaining files. Enrolled identity/vehicle/scene media is never
15446
+ * probed. Trackless motion/audio events with no remaining file are dropped,
15447
+ * including snapshot-less rows.
15448
+ */
15449
+ reconcileFromDisk: method(z.object({ deviceId: z.number() }), DiskReconcileCountsSchema, {
15450
+ kind: "mutation",
15451
+ auth: "admin"
15452
+ }),
15453
+ /**
15410
15454
  * Delete whole tracks (object events) by id for the given device,
15411
15455
  * cascading their media in lockstep. Returns the number of tracks
15412
15456
  * actually deleted plus the ids that could not be removed.
@@ -17564,6 +17608,24 @@ var CameraStatusDegradationSchema = z.object({
17564
17608
  *
17565
17609
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
17566
17610
  */
17611
+ var DiskReconcileJobSchema = z.object({
17612
+ state: z.enum([
17613
+ "idle",
17614
+ "running",
17615
+ "done",
17616
+ "error"
17617
+ ]),
17618
+ total: z.number().int().nonnegative(),
17619
+ completed: z.number().int().nonnegative(),
17620
+ currentDeviceId: z.number().int().nullable(),
17621
+ failed: z.array(z.number().int()).readonly(),
17622
+ mediaDropped: z.number().int().nonnegative(),
17623
+ tracks: z.number().int().nonnegative(),
17624
+ events: z.number().int().nonnegative(),
17625
+ startedAtMs: z.number().int().nullable(),
17626
+ finishedAtMs: z.number().int().nullable(),
17627
+ error: z.string().nullable()
17628
+ });
17567
17629
  var CameraStatusSchema = z.object({
17568
17630
  deviceId: z.number(),
17569
17631
  assignment: CameraAssignmentStatusSchema,
@@ -18100,6 +18162,18 @@ var pipelineOrchestratorCapability = {
18100
18162
  * rail without issuing N parallel browser round-trips.
18101
18163
  */
18102
18164
  getCameraStatuses: method(z.object({ deviceIds: z.array(z.number()).optional() }), z.array(CameraStatusSchema).readonly()),
18165
+ /**
18166
+ * Disk-wins fleet reconcile after a recordings wipe. Starts the walk in
18167
+ * the addon process and returns immediately with the job snapshot — the
18168
+ * work outlives the tRPC/UDS 60s timeout. Poll `getReconcileFromDiskStatus`.
18169
+ * Admin-only. Idempotent while a job is already running.
18170
+ */
18171
+ reconcileFromDisk: method(z.void(), DiskReconcileJobSchema, {
18172
+ kind: "mutation",
18173
+ auth: "admin"
18174
+ }),
18175
+ /** Snapshot of the in-flight or last disk-wins fleet reconcile. */
18176
+ getReconcileFromDiskStatus: method(z.void(), DiskReconcileJobSchema, { auth: "admin" }),
18103
18177
  /** List every template the operator has saved. */
18104
18178
  listTemplates: method(z.void(), z.array(PipelineTemplateSchema).readonly()),
18105
18179
  /** Create a new named preset from a given CameraPipelineConfig. */
@@ -19572,20 +19646,6 @@ var vectorStoreCapability = {
19572
19646
  stats: method(VectorStatsInputSchema, VectorStatsResultSchema)
19573
19647
  }
19574
19648
  };
19575
- /**
19576
- * `videoclips` — the unified, navigable-clip surface for a camera.
19577
- *
19578
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
19579
- * provider per device, substitutable. The DEFAULT provider (registered by
19580
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
19581
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
19582
- * is a time-WINDOW over existing footage, never a separate file. A camera that
19583
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
19584
- * wrapper provider for its device and serve its own clip catalog + URLs.
19585
- *
19586
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
19587
- * temporal overlap, so the API never decides `continuous` vs `events`.
19588
- */
19589
19649
  var ClipSchema = z.object({
19590
19650
  /** Opaque, provider-namespaced id. The default provider encodes the time
19591
19651
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -19611,12 +19671,41 @@ var ClipSchema = z.object({
19611
19671
  * of the event that owns `kind` (object > motion > audio). Do not extract
19612
19672
  * a keyframe from the recorded segments. Other providers (onboard, HKSV)
19613
19673
  * mint their own stills.
19674
+ *
19675
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
19676
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
19677
+ * Absent is meaningful — "this visit has no event still" — never "we did not
19678
+ * look". Stamping it from a URL template made 35% of one camera's clips point
19679
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
19680
+ * A read that FAILS drops the claim; it never invents it.
19614
19681
  */
19615
19682
  thumbnail: z.string().optional(),
19616
- /** Analytics event ids that overlap this visit. Empty on footage-only clips.
19617
- * The default provider's visit grain puts many motion heartbeats on one clip
19618
- * instead of minting one clip per marker. */
19683
+ /**
19684
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
19685
+ * can be decoded. Present whenever the visit came from recorded availability;
19686
+ * absent on a per-event padded window (there is no footage to promise).
19687
+ *
19688
+ * This is not a thumbnail and not a second byte path: it is the argument to
19689
+ * the recorder's existing still route. The surface — never the provider —
19690
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
19691
+ * contiguous range, not of the visit: a visit spans its holes by
19692
+ * construction, so a naive midpoint lands in dead air.
19693
+ */
19694
+ stillAtMs: z.number().optional(),
19695
+ /**
19696
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
19697
+ * first within kind (object → motion → audio), capped at
19698
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
19699
+ *
19700
+ * Bounded because it is not a payload the surface pages through: one visit on
19701
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
19702
+ * camera-day. Read {@link eventCount} for the true total.
19703
+ */
19619
19704
  eventIds: z.array(z.string()).optional(),
19705
+ /** How many analytics events actually overlap this visit. Differs from
19706
+ * `eventIds.length` exactly when the sample was capped — so a truncated
19707
+ * list is never mistaken for a quiet visit. */
19708
+ eventCount: z.number().int().nonnegative().optional(),
19620
19709
  /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
19621
19710
  * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
19622
19711
  * bar keeps showing them via `recording.getAvailability`. */
@@ -20253,7 +20342,14 @@ var SearchResultSchema = z.object({
20253
20342
  });
20254
20343
  var AutoUpdateSettingsSchema = z.object({
20255
20344
  channel: ChannelSchema,
20256
- intervalSeconds: z.number()
20345
+ intervalSeconds: z.number(),
20346
+ /**
20347
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20348
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20349
+ * about a publish and installing it are different decisions. Clamped
20350
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20351
+ */
20352
+ updateCheckIntervalSeconds: z.number()
20257
20353
  });
20258
20354
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20259
20355
  var RestartAddonResultSchema = z.unknown();
@@ -20522,7 +20618,9 @@ var addonsCapability = {
20522
20618
  getAutoUpdateSettings: method(z.void(), AutoUpdateSettingsSchema, { auth: "admin" }),
20523
20619
  setAutoUpdateSettings: method(z.object({
20524
20620
  channel: ChannelSchema,
20525
- intervalSeconds: z.number().min(300).max(86400).optional()
20621
+ intervalSeconds: z.number().min(300).max(86400).optional(),
20622
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20623
+ updateCheckIntervalSeconds: z.number().min(900).max(604800).optional()
20526
20624
  }), z.unknown(), {
20527
20625
  kind: "mutation",
20528
20626
  auth: "admin"
@@ -33237,6 +33335,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33237
33335
  addonId: null,
33238
33336
  access: "create"
33239
33337
  },
33338
+ "pipelineAnalytics.reconcileFromDisk": {
33339
+ capName: "pipeline-analytics",
33340
+ capScope: "device",
33341
+ addonId: null,
33342
+ access: "create"
33343
+ },
33240
33344
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33241
33345
  capName: "pipeline-analytics",
33242
33346
  capScope: "device",
@@ -33639,6 +33743,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33639
33743
  addonId: null,
33640
33744
  access: "view"
33641
33745
  },
33746
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33747
+ capName: "pipeline-orchestrator",
33748
+ capScope: "system",
33749
+ addonId: null,
33750
+ access: "view"
33751
+ },
33642
33752
  "pipelineOrchestrator.listAgentSettings": {
33643
33753
  capName: "pipeline-orchestrator",
33644
33754
  capScope: "system",
@@ -33663,6 +33773,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33663
33773
  addonId: null,
33664
33774
  access: "create"
33665
33775
  },
33776
+ "pipelineOrchestrator.reconcileFromDisk": {
33777
+ capName: "pipeline-orchestrator",
33778
+ capScope: "system",
33779
+ addonId: null,
33780
+ access: "create"
33781
+ },
33666
33782
  "pipelineOrchestrator.removeAgentSettings": {
33667
33783
  capName: "pipeline-orchestrator",
33668
33784
  capScope: "system",
@@ -36654,6 +36770,11 @@ Object.freeze({
36654
36770
  form: "single",
36655
36771
  optional: true
36656
36772
  }],
36773
+ "pipelineAnalytics.reconcileFromDisk": [{
36774
+ name: "deviceId",
36775
+ form: "single",
36776
+ optional: false
36777
+ }],
36657
36778
  "pipelineAnalytics.restageRetrainTrack": [{
36658
36779
  name: "deviceId",
36659
36780
  form: "single",
@@ -38035,6 +38156,8 @@ function bareAddonId(id) {
38035
38156
  function isSameAddonId(a, b) {
38036
38157
  return bareAddonId(a) === bareAddonId(b);
38037
38158
  }
38159
+ var MB = 1024 * 1024;
38160
+ 1024 * MB, 3072 * MB;
38038
38161
  /**
38039
38162
  * Decode base64 little-endian Float32 back into a vector.
38040
38163
  *
@@ -1,5 +1,5 @@
1
1
  let zod = require("zod");
2
- //#region ../types/dist/event-category-C0lyLd5U.mjs
2
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -38,6 +38,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
38
38
  EventCategory["AddonInstalled"] = "addon.installed";
39
39
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
40
40
  EventCategory["AddonCrashed"] = "addon.crashed";
41
+ /**
42
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
43
+ *
44
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
45
+ * respawned"); this is the one that never resolves itself. Emitted exactly
46
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
47
+ * addons it hosted and the crash count that tripped the breaker.
48
+ *
49
+ * It exists because a runner marked terminally `failed` used to be SILENT:
50
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
51
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
52
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
53
+ * operator's phone told him. The Notification Center's system-event intake
54
+ * consumes this category and maps it to the `addon-crash-loop` kind.
55
+ */
56
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
41
57
  EventCategory["AddonError"] = "addon.error";
42
58
  EventCategory["AddonPageReady"] = "addon.page-ready";
43
59
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -3703,6 +3719,12 @@ var RecordingConfigSchema = zod.z.object({
3703
3719
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
3704
3720
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
3705
3721
  mode: RecordingStorageModeSchema.optional(),
3722
+ /**
3723
+ * Which assigned broker slots to record. Absent / empty = {@link
3724
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
3725
+ * camera's currently assigned slots — never `mid` unless the operator
3726
+ * picks it, and never a slot the broker has not assigned.
3727
+ */
3706
3728
  profiles: zod.z.array(CamProfileSchema).optional(),
3707
3729
  segmentSeconds: zod.z.number().int().positive().optional(),
3708
3730
  /**
@@ -3783,7 +3805,11 @@ var RelocateFootageInputSchema = zod.z.object({
3783
3805
  profiles: zod.z.array(zod.z.string()).optional(),
3784
3806
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
3785
3807
  * never allowed to starve live writers. */
3786
- throttleMbps: zod.z.number().min(1).max(1e3).optional()
3808
+ throttleMbps: zod.z.number().min(1).max(1e3).optional(),
3809
+ /** Move only segments whose startMs is >= this. Absent = the whole source
3810
+ * pile. Used when a full drain is too expensive and the operator only
3811
+ * wants the recent window on the new disk. */
3812
+ sinceMs: zod.z.number().int().optional()
3787
3813
  });
3788
3814
  /** Internal, lease-scoped participant operation. It is intentionally separate
3789
3815
  * from persistent recording settings: a migration never changes
@@ -12431,6 +12457,7 @@ var NcSystemEventKindSchema = zod.z.enum([
12431
12457
  "node-offline",
12432
12458
  "node-inference-unavailable",
12433
12459
  "detection-blind",
12460
+ "addon-crash-loop",
12434
12461
  "addon-update-available",
12435
12462
  "server-update-available",
12436
12463
  "alarm-triggered",
@@ -15122,6 +15149,12 @@ var TrackCascadeCountsSchema = zod.z.object({
15122
15149
  /** Per-track CLIP search vectors removed (best-effort). */
15123
15150
  embeddings: zod.z.number().int()
15124
15151
  });
15152
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
15153
+ var DiskReconcileCountsSchema = zod.z.object({
15154
+ mediaDropped: zod.z.number().int(),
15155
+ tracks: zod.z.number().int(),
15156
+ events: zod.z.number().int()
15157
+ });
15125
15158
  /** Event-store footprint for one camera. */
15126
15159
  var EventStoreDeviceFootprintSchema = zod.z.object({
15127
15160
  deviceId: zod.z.number(),
@@ -15407,6 +15440,17 @@ var pipelineAnalyticsCapability = {
15407
15440
  auth: "admin"
15408
15441
  }),
15409
15442
  /**
15443
+ * Disk-wins reconcile for one camera. Drops media index rows whose blobs
15444
+ * are gone, then cascades tracks (including favourited and staging) that
15445
+ * have no remaining files. Enrolled identity/vehicle/scene media is never
15446
+ * probed. Trackless motion/audio events with no remaining file are dropped,
15447
+ * including snapshot-less rows.
15448
+ */
15449
+ reconcileFromDisk: method(zod.z.object({ deviceId: zod.z.number() }), DiskReconcileCountsSchema, {
15450
+ kind: "mutation",
15451
+ auth: "admin"
15452
+ }),
15453
+ /**
15410
15454
  * Delete whole tracks (object events) by id for the given device,
15411
15455
  * cascading their media in lockstep. Returns the number of tracks
15412
15456
  * actually deleted plus the ids that could not be removed.
@@ -17564,6 +17608,24 @@ var CameraStatusDegradationSchema = zod.z.object({
17564
17608
  *
17565
17609
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
17566
17610
  */
17611
+ var DiskReconcileJobSchema = zod.z.object({
17612
+ state: zod.z.enum([
17613
+ "idle",
17614
+ "running",
17615
+ "done",
17616
+ "error"
17617
+ ]),
17618
+ total: zod.z.number().int().nonnegative(),
17619
+ completed: zod.z.number().int().nonnegative(),
17620
+ currentDeviceId: zod.z.number().int().nullable(),
17621
+ failed: zod.z.array(zod.z.number().int()).readonly(),
17622
+ mediaDropped: zod.z.number().int().nonnegative(),
17623
+ tracks: zod.z.number().int().nonnegative(),
17624
+ events: zod.z.number().int().nonnegative(),
17625
+ startedAtMs: zod.z.number().int().nullable(),
17626
+ finishedAtMs: zod.z.number().int().nullable(),
17627
+ error: zod.z.string().nullable()
17628
+ });
17567
17629
  var CameraStatusSchema = zod.z.object({
17568
17630
  deviceId: zod.z.number(),
17569
17631
  assignment: CameraAssignmentStatusSchema,
@@ -18100,6 +18162,18 @@ var pipelineOrchestratorCapability = {
18100
18162
  * rail without issuing N parallel browser round-trips.
18101
18163
  */
18102
18164
  getCameraStatuses: method(zod.z.object({ deviceIds: zod.z.array(zod.z.number()).optional() }), zod.z.array(CameraStatusSchema).readonly()),
18165
+ /**
18166
+ * Disk-wins fleet reconcile after a recordings wipe. Starts the walk in
18167
+ * the addon process and returns immediately with the job snapshot — the
18168
+ * work outlives the tRPC/UDS 60s timeout. Poll `getReconcileFromDiskStatus`.
18169
+ * Admin-only. Idempotent while a job is already running.
18170
+ */
18171
+ reconcileFromDisk: method(zod.z.void(), DiskReconcileJobSchema, {
18172
+ kind: "mutation",
18173
+ auth: "admin"
18174
+ }),
18175
+ /** Snapshot of the in-flight or last disk-wins fleet reconcile. */
18176
+ getReconcileFromDiskStatus: method(zod.z.void(), DiskReconcileJobSchema, { auth: "admin" }),
18103
18177
  /** List every template the operator has saved. */
18104
18178
  listTemplates: method(zod.z.void(), zod.z.array(PipelineTemplateSchema).readonly()),
18105
18179
  /** Create a new named preset from a given CameraPipelineConfig. */
@@ -19572,20 +19646,6 @@ var vectorStoreCapability = {
19572
19646
  stats: method(VectorStatsInputSchema, VectorStatsResultSchema)
19573
19647
  }
19574
19648
  };
19575
- /**
19576
- * `videoclips` — the unified, navigable-clip surface for a camera.
19577
- *
19578
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
19579
- * provider per device, substitutable. The DEFAULT provider (registered by
19580
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
19581
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
19582
- * is a time-WINDOW over existing footage, never a separate file. A camera that
19583
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
19584
- * wrapper provider for its device and serve its own clip catalog + URLs.
19585
- *
19586
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
19587
- * temporal overlap, so the API never decides `continuous` vs `events`.
19588
- */
19589
19649
  var ClipSchema = zod.z.object({
19590
19650
  /** Opaque, provider-namespaced id. The default provider encodes the time
19591
19651
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -19611,12 +19671,41 @@ var ClipSchema = zod.z.object({
19611
19671
  * of the event that owns `kind` (object > motion > audio). Do not extract
19612
19672
  * a keyframe from the recorded segments. Other providers (onboard, HKSV)
19613
19673
  * mint their own stills.
19674
+ *
19675
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
19676
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
19677
+ * Absent is meaningful — "this visit has no event still" — never "we did not
19678
+ * look". Stamping it from a URL template made 35% of one camera's clips point
19679
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
19680
+ * A read that FAILS drops the claim; it never invents it.
19614
19681
  */
19615
19682
  thumbnail: zod.z.string().optional(),
19616
- /** Analytics event ids that overlap this visit. Empty on footage-only clips.
19617
- * The default provider's visit grain puts many motion heartbeats on one clip
19618
- * instead of minting one clip per marker. */
19683
+ /**
19684
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
19685
+ * can be decoded. Present whenever the visit came from recorded availability;
19686
+ * absent on a per-event padded window (there is no footage to promise).
19687
+ *
19688
+ * This is not a thumbnail and not a second byte path: it is the argument to
19689
+ * the recorder's existing still route. The surface — never the provider —
19690
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
19691
+ * contiguous range, not of the visit: a visit spans its holes by
19692
+ * construction, so a naive midpoint lands in dead air.
19693
+ */
19694
+ stillAtMs: zod.z.number().optional(),
19695
+ /**
19696
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
19697
+ * first within kind (object → motion → audio), capped at
19698
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
19699
+ *
19700
+ * Bounded because it is not a payload the surface pages through: one visit on
19701
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
19702
+ * camera-day. Read {@link eventCount} for the true total.
19703
+ */
19619
19704
  eventIds: zod.z.array(zod.z.string()).optional(),
19705
+ /** How many analytics events actually overlap this visit. Differs from
19706
+ * `eventIds.length` exactly when the sample was capped — so a truncated
19707
+ * list is never mistaken for a quiet visit. */
19708
+ eventCount: zod.z.number().int().nonnegative().optional(),
19620
19709
  /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
19621
19710
  * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
19622
19711
  * bar keeps showing them via `recording.getAvailability`. */
@@ -20253,7 +20342,14 @@ var SearchResultSchema = zod.z.object({
20253
20342
  });
20254
20343
  var AutoUpdateSettingsSchema = zod.z.object({
20255
20344
  channel: ChannelSchema,
20256
- intervalSeconds: zod.z.number()
20345
+ intervalSeconds: zod.z.number(),
20346
+ /**
20347
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20348
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20349
+ * about a publish and installing it are different decisions. Clamped
20350
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20351
+ */
20352
+ updateCheckIntervalSeconds: zod.z.number()
20257
20353
  });
20258
20354
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20259
20355
  var RestartAddonResultSchema = zod.z.unknown();
@@ -20522,7 +20618,9 @@ var addonsCapability = {
20522
20618
  getAutoUpdateSettings: method(zod.z.void(), AutoUpdateSettingsSchema, { auth: "admin" }),
20523
20619
  setAutoUpdateSettings: method(zod.z.object({
20524
20620
  channel: ChannelSchema,
20525
- intervalSeconds: zod.z.number().min(300).max(86400).optional()
20621
+ intervalSeconds: zod.z.number().min(300).max(86400).optional(),
20622
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
20623
+ updateCheckIntervalSeconds: zod.z.number().min(900).max(604800).optional()
20526
20624
  }), zod.z.unknown(), {
20527
20625
  kind: "mutation",
20528
20626
  auth: "admin"
@@ -33237,6 +33335,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33237
33335
  addonId: null,
33238
33336
  access: "create"
33239
33337
  },
33338
+ "pipelineAnalytics.reconcileFromDisk": {
33339
+ capName: "pipeline-analytics",
33340
+ capScope: "device",
33341
+ addonId: null,
33342
+ access: "create"
33343
+ },
33240
33344
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33241
33345
  capName: "pipeline-analytics",
33242
33346
  capScope: "device",
@@ -33639,6 +33743,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33639
33743
  addonId: null,
33640
33744
  access: "view"
33641
33745
  },
33746
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33747
+ capName: "pipeline-orchestrator",
33748
+ capScope: "system",
33749
+ addonId: null,
33750
+ access: "view"
33751
+ },
33642
33752
  "pipelineOrchestrator.listAgentSettings": {
33643
33753
  capName: "pipeline-orchestrator",
33644
33754
  capScope: "system",
@@ -33663,6 +33773,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
33663
33773
  addonId: null,
33664
33774
  access: "create"
33665
33775
  },
33776
+ "pipelineOrchestrator.reconcileFromDisk": {
33777
+ capName: "pipeline-orchestrator",
33778
+ capScope: "system",
33779
+ addonId: null,
33780
+ access: "create"
33781
+ },
33666
33782
  "pipelineOrchestrator.removeAgentSettings": {
33667
33783
  capName: "pipeline-orchestrator",
33668
33784
  capScope: "system",
@@ -36654,6 +36770,11 @@ Object.freeze({
36654
36770
  form: "single",
36655
36771
  optional: true
36656
36772
  }],
36773
+ "pipelineAnalytics.reconcileFromDisk": [{
36774
+ name: "deviceId",
36775
+ form: "single",
36776
+ optional: false
36777
+ }],
36657
36778
  "pipelineAnalytics.restageRetrainTrack": [{
36658
36779
  name: "deviceId",
36659
36780
  form: "single",
@@ -38035,6 +38156,8 @@ function bareAddonId(id) {
38035
38156
  function isSameAddonId(a, b) {
38036
38157
  return bareAddonId(a) === bareAddonId(b);
38037
38158
  }
38159
+ var MB = 1024 * 1024;
38160
+ 1024 * MB, 3072 * MB;
38038
38161
  /**
38039
38162
  * Decode base64 little-endian Float32 back into a vector.
38040
38163
  *
package/dist/index.d.ts CHANGED
@@ -45,8 +45,8 @@ export type { FileDataPlaneOptions } from './http/file-data-plane.js';
45
45
  export { createFileDataPlaneHandler } from './http/file-data-plane.js';
46
46
  export type { ReverseProxyOptions } from './http/reverse-proxy.js';
47
47
  export { proxyToUpstream } from './http/reverse-proxy.js';
48
- export type { HeapReclaimer, HeapReclaimOptions, HeapSample, HeapWatchSink, } from './kernel/heap-watch.js';
49
- export { buildHeapSample, createV8Reclaimer, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, shouldReclaim, startHeapWatch, strandedMb, } from './kernel/heap-watch.js';
48
+ export type { HeapReclaimer, HeapReclaimOptions, HeapSample, HeapWatchSink, RunnerHeapWatchOptions, } from './kernel/heap-watch.js';
49
+ export { buildHeapSample, createV8Reclaimer, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, } from './kernel/heap-watch.js';
50
50
  export type { AddonDataPlaneFacility, DataPlaneSink, } from './kernel/moleculer/addon-data-plane-facility.js';
51
51
  export { createAddonDataPlaneFacility } from './kernel/moleculer/addon-data-plane-facility.js';
52
52
  export type { ElementState, ElementStatus, } from './lifecycle/lifecycle-state-machine.js';