@camstack/addon-terminal 0.1.23 → 0.1.24

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 +178 -27
  2. package/dist/addon.mjs +178 -27
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -31,7 +31,7 @@ let node_module = require("node:module");
31
31
  let sharp = require("sharp");
32
32
  sharp = __toESM(sharp);
33
33
  let node_http = require("node:http");
34
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
34
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
35
35
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
36
36
  EventCategory["SystemBoot"] = "system.boot";
37
37
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -48,9 +48,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
48
48
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
49
49
  /**
50
50
  * A newer addon or server-root package version was found by the
51
- * authoritative registry check. Emitted once per
52
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
53
- * polling of the same result is deduplicated by the checker.
51
+ * authoritative registry check. Emitted once when any observed
52
+ * `latestVersion` changes (or a package/node first appears behind);
53
+ * the payload carries the full currently-available list. Repeated
54
+ * polling of the same latests is silent.
54
55
  */
55
56
  EventCategory["UpdateAvailable"] = "update.available";
56
57
  /**
@@ -69,6 +70,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
69
70
  EventCategory["AddonInstalled"] = "addon.installed";
70
71
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
71
72
  EventCategory["AddonCrashed"] = "addon.crashed";
73
+ /**
74
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
75
+ *
76
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
77
+ * respawned"); this is the one that never resolves itself. Emitted exactly
78
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
79
+ * addons it hosted and the crash count that tripped the breaker.
80
+ *
81
+ * It exists because a runner marked terminally `failed` used to be SILENT:
82
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
83
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
84
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
85
+ * operator's phone told him. The Notification Center's system-event intake
86
+ * consumes this category and maps it to the `addon-crash-loop` kind.
87
+ */
88
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
72
89
  EventCategory["AddonError"] = "addon.error";
73
90
  EventCategory["AddonPageReady"] = "addon.page-ready";
74
91
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7647,6 +7664,10 @@ var RecordingBandSchema = object({
7647
7664
  preBufferSec: number().min(0).optional(),
7648
7665
  postBufferSec: number().min(0).optional()
7649
7666
  });
7667
+ ({
7668
+ preBufferSec: 10,
7669
+ postBufferSec: 30
7670
+ }).postBufferSec * 1e3;
7650
7671
  /**
7651
7672
  * Per-device retention overrides. Every field is optional; an unset or `0`
7652
7673
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7694,6 +7715,12 @@ var RecordingConfigSchema = object({
7694
7715
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7695
7716
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7696
7717
  mode: RecordingStorageModeSchema.optional(),
7718
+ /**
7719
+ * Which assigned broker slots to record. Absent / empty = {@link
7720
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7721
+ * camera's currently assigned slots — never `mid` unless the operator
7722
+ * picks it, and never a slot the broker has not assigned.
7723
+ */
7697
7724
  profiles: array(CamProfileSchema).optional(),
7698
7725
  segmentSeconds: number().int().positive().optional(),
7699
7726
  /**
@@ -7774,7 +7801,11 @@ var RelocateFootageInputSchema = object({
7774
7801
  profiles: array(string()).optional(),
7775
7802
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7776
7803
  * never allowed to starve live writers. */
7777
- throttleMbps: number().min(1).max(1e3).optional()
7804
+ throttleMbps: number().min(1).max(1e3).optional(),
7805
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7806
+ * pile. Used when a full drain is too expensive and the operator only
7807
+ * wants the recent window on the new disk. */
7808
+ sinceMs: number().int().optional()
7778
7809
  });
7779
7810
  /** Internal, lease-scoped participant operation. It is intentionally separate
7780
7811
  * from persistent recording settings: a migration never changes
@@ -14584,6 +14615,7 @@ var NcSystemEventKindSchema = _enum([
14584
14615
  "node-offline",
14585
14616
  "node-inference-unavailable",
14586
14617
  "detection-blind",
14618
+ "addon-crash-loop",
14587
14619
  "addon-update-available",
14588
14620
  "server-update-available",
14589
14621
  "alarm-triggered",
@@ -14591,6 +14623,9 @@ var NcSystemEventKindSchema = _enum([
14591
14623
  "alarm-disarmed",
14592
14624
  "alarm-arming",
14593
14625
  "alarm-arm-refused",
14626
+ "addon-updated",
14627
+ "server-updated",
14628
+ "export-completed",
14594
14629
  "camera-online",
14595
14630
  "camera-offline",
14596
14631
  "camera-disabled",
@@ -16484,13 +16519,19 @@ var RetrainStatusSchema = _enum([
16484
16519
  * "never marked" from "already trained" must read `retrainStatus`.
16485
16520
  *
16486
16521
  * `debug` does NOT pin; it is attention, not durability.
16522
+ *
16523
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16524
+ * A favourited track is skipped by retention the same way `staging` is, but
16525
+ * it does not enter `none|staging|trained` and has no staging budget.
16487
16526
  */
16488
16527
  var TrackFlagFields = {
16489
16528
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16490
16529
  * `'staging'`. */
16491
16530
  markForTrain: boolean().optional(),
16492
16531
  /** Operator marked this track for diagnostic attention. */
16493
- debug: boolean().optional()
16532
+ debug: boolean().optional(),
16533
+ /** Operator favourited this track. Pins it against pruning. */
16534
+ favourited: boolean().optional()
16494
16535
  };
16495
16536
  /**
16496
16537
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16515,6 +16556,7 @@ var TrackFlagsSchema = object({
16515
16556
  trackId: string(),
16516
16557
  markForTrain: boolean(),
16517
16558
  debug: boolean(),
16559
+ favourited: boolean(),
16518
16560
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16519
16561
  * a track row) because this shape is only ever produced by the write body,
16520
16562
  * which always knows it — and a surface that has just written needs to render
@@ -17147,6 +17189,12 @@ var TrackCascadeCountsSchema = object({
17147
17189
  /** Per-track CLIP search vectors removed (best-effort). */
17148
17190
  embeddings: number().int()
17149
17191
  });
17192
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17193
+ var DiskReconcileCountsSchema = object({
17194
+ mediaDropped: number().int(),
17195
+ tracks: number().int(),
17196
+ events: number().int()
17197
+ });
17150
17198
  /** Event-store footprint for one camera. */
17151
17199
  var EventStoreDeviceFootprintSchema = object({
17152
17200
  deviceId: number(),
@@ -17323,6 +17371,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17323
17371
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17324
17372
  kind: "mutation",
17325
17373
  auth: "admin"
17374
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17375
+ kind: "mutation",
17376
+ auth: "admin"
17326
17377
  }), method(object({
17327
17378
  deviceId: number(),
17328
17379
  trackIds: array(string()).min(1)
@@ -18873,6 +18924,24 @@ var CameraStatusDegradationSchema = object({
18873
18924
  *
18874
18925
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18875
18926
  */
18927
+ var DiskReconcileJobSchema = object({
18928
+ state: _enum([
18929
+ "idle",
18930
+ "running",
18931
+ "done",
18932
+ "error"
18933
+ ]),
18934
+ total: number().int().nonnegative(),
18935
+ completed: number().int().nonnegative(),
18936
+ currentDeviceId: number().int().nullable(),
18937
+ failed: array(number().int()).readonly(),
18938
+ mediaDropped: number().int().nonnegative(),
18939
+ tracks: number().int().nonnegative(),
18940
+ events: number().int().nonnegative(),
18941
+ startedAtMs: number().int().nullable(),
18942
+ finishedAtMs: number().int().nullable(),
18943
+ error: string().nullable()
18944
+ });
18876
18945
  var CameraStatusSchema = object({
18877
18946
  deviceId: number(),
18878
18947
  assignment: CameraAssignmentStatusSchema,
@@ -19104,7 +19173,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19104
19173
  }), CameraSwitchGroupSchema, {
19105
19174
  kind: "mutation",
19106
19175
  auth: "admin"
19107
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19176
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19177
+ kind: "mutation",
19178
+ auth: "admin"
19179
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19108
19180
  name: string(),
19109
19181
  description: string().optional(),
19110
19182
  config: CameraPipelineConfigSchema
@@ -20324,20 +20396,6 @@ var VectorStatsResultSchema = object({
20324
20396
  exact: boolean()
20325
20397
  });
20326
20398
  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);
20327
- /**
20328
- * `videoclips` — the unified, navigable-clip surface for a camera.
20329
- *
20330
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20331
- * provider per device, substitutable. The DEFAULT provider (registered by
20332
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20333
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20334
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20335
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20336
- * wrapper provider for its device and serve its own clip catalog + URLs.
20337
- *
20338
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20339
- * temporal overlap, so the API never decides `continuous` vs `events`.
20340
- */
20341
20399
  var ClipSchema = object({
20342
20400
  /** Opaque, provider-namespaced id. The default provider encodes the time
20343
20401
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20354,8 +20412,57 @@ var ClipSchema = object({
20354
20412
  startMs: number(),
20355
20413
  endMs: number()
20356
20414
  }),
20357
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20358
- thumbnail: string().optional()
20415
+ /**
20416
+ * Lazy thumbnail URL, never inlined.
20417
+ *
20418
+ * Recording-derived clips (events-mode keep-window, and the prepared
20419
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20420
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20421
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20422
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20423
+ * mint their own stills.
20424
+ *
20425
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20426
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20427
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20428
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20429
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20430
+ * A read that FAILS drops the claim; it never invents it.
20431
+ */
20432
+ thumbnail: string().optional(),
20433
+ /**
20434
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20435
+ * can be decoded. Present whenever the visit came from recorded availability;
20436
+ * absent on a per-event padded window (there is no footage to promise).
20437
+ *
20438
+ * This is not a thumbnail and not a second byte path: it is the argument to
20439
+ * the recorder's existing still route. The surface — never the provider —
20440
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20441
+ * contiguous range, not of the visit: a visit spans its holes by
20442
+ * construction, so a naive midpoint lands in dead air.
20443
+ */
20444
+ stillAtMs: number().optional(),
20445
+ /**
20446
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20447
+ * first within kind (object → motion → audio), capped at
20448
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20449
+ *
20450
+ * Bounded because it is not a payload the surface pages through: one visit on
20451
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20452
+ * camera-day. Read {@link eventCount} for the true total.
20453
+ */
20454
+ eventIds: array(string()).optional(),
20455
+ /** How many analytics events actually overlap this visit. Differs from
20456
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20457
+ * list is never mistaken for a quiet visit. */
20458
+ eventCount: number().int().nonnegative().optional(),
20459
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20460
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20461
+ * bar keeps showing them via `recording.getAvailability`. */
20462
+ holes: array(object({
20463
+ startMs: number(),
20464
+ endMs: number()
20465
+ })).optional()
20359
20466
  });
20360
20467
  var ClipPlaybackSchema = object({
20361
20468
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20819,7 +20926,14 @@ var SearchResultSchema = object({
20819
20926
  });
20820
20927
  var AutoUpdateSettingsSchema = object({
20821
20928
  channel: ChannelSchema,
20822
- intervalSeconds: number()
20929
+ intervalSeconds: number(),
20930
+ /**
20931
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20932
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20933
+ * about a publish and installing it are different decisions. Clamped
20934
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20935
+ */
20936
+ updateCheckIntervalSeconds: number()
20823
20937
  });
20824
20938
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20825
20939
  var RestartAddonResultSchema = unknown();
@@ -20960,7 +21074,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20960
21074
  auth: "admin"
20961
21075
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20962
21076
  channel: ChannelSchema,
20963
- intervalSeconds: number().min(300).max(86400).optional()
21077
+ intervalSeconds: number().min(300).max(86400).optional(),
21078
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21079
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20964
21080
  }), unknown(), {
20965
21081
  kind: "mutation",
20966
21082
  auth: "admin"
@@ -26641,7 +26757,9 @@ var ExportOptionsSchema = object({
26641
26757
  includeAudio: boolean(),
26642
26758
  maxLifeMs: number().int().positive(),
26643
26759
  deleteAfterDownload: boolean(),
26644
- title: string().max(200).optional()
26760
+ title: string().max(200).optional(),
26761
+ /** Notification-output target ids to ping when this export becomes ready. */
26762
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26645
26763
  }).superRefine((v, ctx) => {
26646
26764
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26647
26765
  code: ZodIssueCode.custom,
@@ -26700,10 +26818,18 @@ var ExportBytesSchema = object({
26700
26818
  });
26701
26819
  method(object({
26702
26820
  deviceId: number(),
26703
- profile: string(),
26821
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26822
+ profile: string().optional(),
26823
+ profiles: array(string()).min(1).optional(),
26704
26824
  fromMs: number(),
26705
26825
  toMs: number(),
26706
26826
  options: ExportOptionsSchema
26827
+ }).superRefine((v, ctx) => {
26828
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26829
+ code: ZodIssueCode.custom,
26830
+ message: "pass profiles[] (min 1) or legacy profile",
26831
+ path: ["profiles"]
26832
+ });
26707
26833
  }), ExportRecordSchema, {
26708
26834
  kind: "mutation",
26709
26835
  auth: "protected"
@@ -32970,6 +33096,12 @@ Object.freeze({
32970
33096
  addonId: null,
32971
33097
  access: "create"
32972
33098
  },
33099
+ "pipelineAnalytics.reconcileFromDisk": {
33100
+ capName: "pipeline-analytics",
33101
+ capScope: "device",
33102
+ addonId: null,
33103
+ access: "create"
33104
+ },
32973
33105
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32974
33106
  capName: "pipeline-analytics",
32975
33107
  capScope: "device",
@@ -33372,6 +33504,12 @@ Object.freeze({
33372
33504
  addonId: null,
33373
33505
  access: "view"
33374
33506
  },
33507
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33508
+ capName: "pipeline-orchestrator",
33509
+ capScope: "system",
33510
+ addonId: null,
33511
+ access: "view"
33512
+ },
33375
33513
  "pipelineOrchestrator.listAgentSettings": {
33376
33514
  capName: "pipeline-orchestrator",
33377
33515
  capScope: "system",
@@ -33396,6 +33534,12 @@ Object.freeze({
33396
33534
  addonId: null,
33397
33535
  access: "create"
33398
33536
  },
33537
+ "pipelineOrchestrator.reconcileFromDisk": {
33538
+ capName: "pipeline-orchestrator",
33539
+ capScope: "system",
33540
+ addonId: null,
33541
+ access: "create"
33542
+ },
33399
33543
  "pipelineOrchestrator.removeAgentSettings": {
33400
33544
  capName: "pipeline-orchestrator",
33401
33545
  capScope: "system",
@@ -36387,6 +36531,11 @@ Object.freeze({
36387
36531
  form: "single",
36388
36532
  optional: true
36389
36533
  }],
36534
+ "pipelineAnalytics.reconcileFromDisk": [{
36535
+ name: "deviceId",
36536
+ form: "single",
36537
+ optional: false
36538
+ }],
36390
36539
  "pipelineAnalytics.restageRetrainTrack": [{
36391
36540
  name: "deviceId",
36392
36541
  form: "single",
@@ -37452,6 +37601,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37452
37601
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37453
37602
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37454
37603
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37604
+ var MB = 1024 * 1024;
37605
+ 1024 * MB, 3072 * MB;
37455
37606
  //#endregion
37456
37607
  //#region src/curses-shim.ts
37457
37608
  /**
package/dist/addon.mjs CHANGED
@@ -8,7 +8,7 @@ import { createServer } from "node:http";
8
8
  //#region \0rolldown/runtime.js
9
9
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
10
  //#endregion
11
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
11
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
12
12
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
13
13
  EventCategory["SystemBoot"] = "system.boot";
14
14
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -25,9 +25,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
25
25
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
26
26
  /**
27
27
  * A newer addon or server-root package version was found by the
28
- * authoritative registry check. Emitted once per
29
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
30
- * polling of the same result is deduplicated by the checker.
28
+ * authoritative registry check. Emitted once when any observed
29
+ * `latestVersion` changes (or a package/node first appears behind);
30
+ * the payload carries the full currently-available list. Repeated
31
+ * polling of the same latests is silent.
31
32
  */
32
33
  EventCategory["UpdateAvailable"] = "update.available";
33
34
  /**
@@ -46,6 +47,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
46
47
  EventCategory["AddonInstalled"] = "addon.installed";
47
48
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
48
49
  EventCategory["AddonCrashed"] = "addon.crashed";
50
+ /**
51
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
52
+ *
53
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
54
+ * respawned"); this is the one that never resolves itself. Emitted exactly
55
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
56
+ * addons it hosted and the crash count that tripped the breaker.
57
+ *
58
+ * It exists because a runner marked terminally `failed` used to be SILENT:
59
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
60
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
61
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
62
+ * operator's phone told him. The Notification Center's system-event intake
63
+ * consumes this category and maps it to the `addon-crash-loop` kind.
64
+ */
65
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
49
66
  EventCategory["AddonError"] = "addon.error";
50
67
  EventCategory["AddonPageReady"] = "addon.page-ready";
51
68
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7624,6 +7641,10 @@ var RecordingBandSchema = object({
7624
7641
  preBufferSec: number().min(0).optional(),
7625
7642
  postBufferSec: number().min(0).optional()
7626
7643
  });
7644
+ ({
7645
+ preBufferSec: 10,
7646
+ postBufferSec: 30
7647
+ }).postBufferSec * 1e3;
7627
7648
  /**
7628
7649
  * Per-device retention overrides. Every field is optional; an unset or `0`
7629
7650
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7671,6 +7692,12 @@ var RecordingConfigSchema = object({
7671
7692
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7672
7693
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7673
7694
  mode: RecordingStorageModeSchema.optional(),
7695
+ /**
7696
+ * Which assigned broker slots to record. Absent / empty = {@link
7697
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7698
+ * camera's currently assigned slots — never `mid` unless the operator
7699
+ * picks it, and never a slot the broker has not assigned.
7700
+ */
7674
7701
  profiles: array(CamProfileSchema).optional(),
7675
7702
  segmentSeconds: number().int().positive().optional(),
7676
7703
  /**
@@ -7751,7 +7778,11 @@ var RelocateFootageInputSchema = object({
7751
7778
  profiles: array(string()).optional(),
7752
7779
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7753
7780
  * never allowed to starve live writers. */
7754
- throttleMbps: number().min(1).max(1e3).optional()
7781
+ throttleMbps: number().min(1).max(1e3).optional(),
7782
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7783
+ * pile. Used when a full drain is too expensive and the operator only
7784
+ * wants the recent window on the new disk. */
7785
+ sinceMs: number().int().optional()
7755
7786
  });
7756
7787
  /** Internal, lease-scoped participant operation. It is intentionally separate
7757
7788
  * from persistent recording settings: a migration never changes
@@ -14561,6 +14592,7 @@ var NcSystemEventKindSchema = _enum([
14561
14592
  "node-offline",
14562
14593
  "node-inference-unavailable",
14563
14594
  "detection-blind",
14595
+ "addon-crash-loop",
14564
14596
  "addon-update-available",
14565
14597
  "server-update-available",
14566
14598
  "alarm-triggered",
@@ -14568,6 +14600,9 @@ var NcSystemEventKindSchema = _enum([
14568
14600
  "alarm-disarmed",
14569
14601
  "alarm-arming",
14570
14602
  "alarm-arm-refused",
14603
+ "addon-updated",
14604
+ "server-updated",
14605
+ "export-completed",
14571
14606
  "camera-online",
14572
14607
  "camera-offline",
14573
14608
  "camera-disabled",
@@ -16461,13 +16496,19 @@ var RetrainStatusSchema = _enum([
16461
16496
  * "never marked" from "already trained" must read `retrainStatus`.
16462
16497
  *
16463
16498
  * `debug` does NOT pin; it is attention, not durability.
16499
+ *
16500
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16501
+ * A favourited track is skipped by retention the same way `staging` is, but
16502
+ * it does not enter `none|staging|trained` and has no staging budget.
16464
16503
  */
16465
16504
  var TrackFlagFields = {
16466
16505
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16467
16506
  * `'staging'`. */
16468
16507
  markForTrain: boolean().optional(),
16469
16508
  /** Operator marked this track for diagnostic attention. */
16470
- debug: boolean().optional()
16509
+ debug: boolean().optional(),
16510
+ /** Operator favourited this track. Pins it against pruning. */
16511
+ favourited: boolean().optional()
16471
16512
  };
16472
16513
  /**
16473
16514
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16492,6 +16533,7 @@ var TrackFlagsSchema = object({
16492
16533
  trackId: string(),
16493
16534
  markForTrain: boolean(),
16494
16535
  debug: boolean(),
16536
+ favourited: boolean(),
16495
16537
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16496
16538
  * a track row) because this shape is only ever produced by the write body,
16497
16539
  * which always knows it — and a surface that has just written needs to render
@@ -17124,6 +17166,12 @@ var TrackCascadeCountsSchema = object({
17124
17166
  /** Per-track CLIP search vectors removed (best-effort). */
17125
17167
  embeddings: number().int()
17126
17168
  });
17169
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17170
+ var DiskReconcileCountsSchema = object({
17171
+ mediaDropped: number().int(),
17172
+ tracks: number().int(),
17173
+ events: number().int()
17174
+ });
17127
17175
  /** Event-store footprint for one camera. */
17128
17176
  var EventStoreDeviceFootprintSchema = object({
17129
17177
  deviceId: number(),
@@ -17300,6 +17348,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17300
17348
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17301
17349
  kind: "mutation",
17302
17350
  auth: "admin"
17351
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17352
+ kind: "mutation",
17353
+ auth: "admin"
17303
17354
  }), method(object({
17304
17355
  deviceId: number(),
17305
17356
  trackIds: array(string()).min(1)
@@ -18850,6 +18901,24 @@ var CameraStatusDegradationSchema = object({
18850
18901
  *
18851
18902
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18852
18903
  */
18904
+ var DiskReconcileJobSchema = object({
18905
+ state: _enum([
18906
+ "idle",
18907
+ "running",
18908
+ "done",
18909
+ "error"
18910
+ ]),
18911
+ total: number().int().nonnegative(),
18912
+ completed: number().int().nonnegative(),
18913
+ currentDeviceId: number().int().nullable(),
18914
+ failed: array(number().int()).readonly(),
18915
+ mediaDropped: number().int().nonnegative(),
18916
+ tracks: number().int().nonnegative(),
18917
+ events: number().int().nonnegative(),
18918
+ startedAtMs: number().int().nullable(),
18919
+ finishedAtMs: number().int().nullable(),
18920
+ error: string().nullable()
18921
+ });
18853
18922
  var CameraStatusSchema = object({
18854
18923
  deviceId: number(),
18855
18924
  assignment: CameraAssignmentStatusSchema,
@@ -19081,7 +19150,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19081
19150
  }), CameraSwitchGroupSchema, {
19082
19151
  kind: "mutation",
19083
19152
  auth: "admin"
19084
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19153
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19154
+ kind: "mutation",
19155
+ auth: "admin"
19156
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19085
19157
  name: string(),
19086
19158
  description: string().optional(),
19087
19159
  config: CameraPipelineConfigSchema
@@ -20301,20 +20373,6 @@ var VectorStatsResultSchema = object({
20301
20373
  exact: boolean()
20302
20374
  });
20303
20375
  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);
20304
- /**
20305
- * `videoclips` — the unified, navigable-clip surface for a camera.
20306
- *
20307
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20308
- * provider per device, substitutable. The DEFAULT provider (registered by
20309
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20310
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20311
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20312
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20313
- * wrapper provider for its device and serve its own clip catalog + URLs.
20314
- *
20315
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20316
- * temporal overlap, so the API never decides `continuous` vs `events`.
20317
- */
20318
20376
  var ClipSchema = object({
20319
20377
  /** Opaque, provider-namespaced id. The default provider encodes the time
20320
20378
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20331,8 +20389,57 @@ var ClipSchema = object({
20331
20389
  startMs: number(),
20332
20390
  endMs: number()
20333
20391
  }),
20334
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20335
- thumbnail: string().optional()
20392
+ /**
20393
+ * Lazy thumbnail URL, never inlined.
20394
+ *
20395
+ * Recording-derived clips (events-mode keep-window, and the prepared
20396
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20397
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20398
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20399
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20400
+ * mint their own stills.
20401
+ *
20402
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20403
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20404
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20405
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20406
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20407
+ * A read that FAILS drops the claim; it never invents it.
20408
+ */
20409
+ thumbnail: string().optional(),
20410
+ /**
20411
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20412
+ * can be decoded. Present whenever the visit came from recorded availability;
20413
+ * absent on a per-event padded window (there is no footage to promise).
20414
+ *
20415
+ * This is not a thumbnail and not a second byte path: it is the argument to
20416
+ * the recorder's existing still route. The surface — never the provider —
20417
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20418
+ * contiguous range, not of the visit: a visit spans its holes by
20419
+ * construction, so a naive midpoint lands in dead air.
20420
+ */
20421
+ stillAtMs: number().optional(),
20422
+ /**
20423
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20424
+ * first within kind (object → motion → audio), capped at
20425
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20426
+ *
20427
+ * Bounded because it is not a payload the surface pages through: one visit on
20428
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20429
+ * camera-day. Read {@link eventCount} for the true total.
20430
+ */
20431
+ eventIds: array(string()).optional(),
20432
+ /** How many analytics events actually overlap this visit. Differs from
20433
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20434
+ * list is never mistaken for a quiet visit. */
20435
+ eventCount: number().int().nonnegative().optional(),
20436
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20437
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20438
+ * bar keeps showing them via `recording.getAvailability`. */
20439
+ holes: array(object({
20440
+ startMs: number(),
20441
+ endMs: number()
20442
+ })).optional()
20336
20443
  });
20337
20444
  var ClipPlaybackSchema = object({
20338
20445
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20796,7 +20903,14 @@ var SearchResultSchema = object({
20796
20903
  });
20797
20904
  var AutoUpdateSettingsSchema = object({
20798
20905
  channel: ChannelSchema,
20799
- intervalSeconds: number()
20906
+ intervalSeconds: number(),
20907
+ /**
20908
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20909
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20910
+ * about a publish and installing it are different decisions. Clamped
20911
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20912
+ */
20913
+ updateCheckIntervalSeconds: number()
20800
20914
  });
20801
20915
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20802
20916
  var RestartAddonResultSchema = unknown();
@@ -20937,7 +21051,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20937
21051
  auth: "admin"
20938
21052
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20939
21053
  channel: ChannelSchema,
20940
- intervalSeconds: number().min(300).max(86400).optional()
21054
+ intervalSeconds: number().min(300).max(86400).optional(),
21055
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21056
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20941
21057
  }), unknown(), {
20942
21058
  kind: "mutation",
20943
21059
  auth: "admin"
@@ -26618,7 +26734,9 @@ var ExportOptionsSchema = object({
26618
26734
  includeAudio: boolean(),
26619
26735
  maxLifeMs: number().int().positive(),
26620
26736
  deleteAfterDownload: boolean(),
26621
- title: string().max(200).optional()
26737
+ title: string().max(200).optional(),
26738
+ /** Notification-output target ids to ping when this export becomes ready. */
26739
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26622
26740
  }).superRefine((v, ctx) => {
26623
26741
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26624
26742
  code: ZodIssueCode.custom,
@@ -26677,10 +26795,18 @@ var ExportBytesSchema = object({
26677
26795
  });
26678
26796
  method(object({
26679
26797
  deviceId: number(),
26680
- profile: string(),
26798
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26799
+ profile: string().optional(),
26800
+ profiles: array(string()).min(1).optional(),
26681
26801
  fromMs: number(),
26682
26802
  toMs: number(),
26683
26803
  options: ExportOptionsSchema
26804
+ }).superRefine((v, ctx) => {
26805
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26806
+ code: ZodIssueCode.custom,
26807
+ message: "pass profiles[] (min 1) or legacy profile",
26808
+ path: ["profiles"]
26809
+ });
26684
26810
  }), ExportRecordSchema, {
26685
26811
  kind: "mutation",
26686
26812
  auth: "protected"
@@ -32947,6 +33073,12 @@ Object.freeze({
32947
33073
  addonId: null,
32948
33074
  access: "create"
32949
33075
  },
33076
+ "pipelineAnalytics.reconcileFromDisk": {
33077
+ capName: "pipeline-analytics",
33078
+ capScope: "device",
33079
+ addonId: null,
33080
+ access: "create"
33081
+ },
32950
33082
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32951
33083
  capName: "pipeline-analytics",
32952
33084
  capScope: "device",
@@ -33349,6 +33481,12 @@ Object.freeze({
33349
33481
  addonId: null,
33350
33482
  access: "view"
33351
33483
  },
33484
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33485
+ capName: "pipeline-orchestrator",
33486
+ capScope: "system",
33487
+ addonId: null,
33488
+ access: "view"
33489
+ },
33352
33490
  "pipelineOrchestrator.listAgentSettings": {
33353
33491
  capName: "pipeline-orchestrator",
33354
33492
  capScope: "system",
@@ -33373,6 +33511,12 @@ Object.freeze({
33373
33511
  addonId: null,
33374
33512
  access: "create"
33375
33513
  },
33514
+ "pipelineOrchestrator.reconcileFromDisk": {
33515
+ capName: "pipeline-orchestrator",
33516
+ capScope: "system",
33517
+ addonId: null,
33518
+ access: "create"
33519
+ },
33376
33520
  "pipelineOrchestrator.removeAgentSettings": {
33377
33521
  capName: "pipeline-orchestrator",
33378
33522
  capScope: "system",
@@ -36364,6 +36508,11 @@ Object.freeze({
36364
36508
  form: "single",
36365
36509
  optional: true
36366
36510
  }],
36511
+ "pipelineAnalytics.reconcileFromDisk": [{
36512
+ name: "deviceId",
36513
+ form: "single",
36514
+ optional: false
36515
+ }],
36367
36516
  "pipelineAnalytics.restageRetrainTrack": [{
36368
36517
  name: "deviceId",
36369
36518
  form: "single",
@@ -37429,6 +37578,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37429
37578
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37430
37579
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37431
37580
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37581
+ var MB = 1024 * 1024;
37582
+ 1024 * MB, 3072 * MB;
37432
37583
  //#endregion
37433
37584
  //#region src/curses-shim.ts
37434
37585
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-terminal",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "Interactive terminal sessions (pty + xterm) as a CamStack addon",
5
5
  "keywords": [
6
6
  "camstack",