@camstack/addon-import-alexa 0.2.19 → 0.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +179 -44
  2. package/dist/addon.mjs +179 -44
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -38,7 +38,7 @@ let node_os = require("node:os");
38
38
  let node_fs = require("node:fs");
39
39
  let node_path = require("node:path");
40
40
  node_path = __toESM(node_path);
41
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
41
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
42
42
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
43
43
  EventCategory["SystemBoot"] = "system.boot";
44
44
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -55,9 +55,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
55
55
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
56
56
  /**
57
57
  * A newer addon or server-root package version was found by the
58
- * authoritative registry check. Emitted once per
59
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
60
- * polling of the same result is deduplicated by the checker.
58
+ * authoritative registry check. Emitted once when any observed
59
+ * `latestVersion` changes (or a package/node first appears behind);
60
+ * the payload carries the full currently-available list. Repeated
61
+ * polling of the same latests is silent.
61
62
  */
62
63
  EventCategory["UpdateAvailable"] = "update.available";
63
64
  /**
@@ -76,6 +77,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
76
77
  EventCategory["AddonInstalled"] = "addon.installed";
77
78
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
78
79
  EventCategory["AddonCrashed"] = "addon.crashed";
80
+ /**
81
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
82
+ *
83
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
84
+ * respawned"); this is the one that never resolves itself. Emitted exactly
85
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
86
+ * addons it hosted and the crash count that tripped the breaker.
87
+ *
88
+ * It exists because a runner marked terminally `failed` used to be SILENT:
89
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
90
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
91
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
92
+ * operator's phone told him. The Notification Center's system-event intake
93
+ * consumes this category and maps it to the `addon-crash-loop` kind.
94
+ */
95
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
79
96
  EventCategory["AddonError"] = "addon.error";
80
97
  EventCategory["AddonPageReady"] = "addon.page-ready";
81
98
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7706,6 +7723,10 @@ var RecordingBandSchema = object({
7706
7723
  preBufferSec: number().min(0).optional(),
7707
7724
  postBufferSec: number().min(0).optional()
7708
7725
  });
7726
+ ({
7727
+ preBufferSec: 10,
7728
+ postBufferSec: 30
7729
+ }).postBufferSec * 1e3;
7709
7730
  /**
7710
7731
  * Per-device retention overrides. Every field is optional; an unset or `0`
7711
7732
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7753,6 +7774,12 @@ var RecordingConfigSchema = object({
7753
7774
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7754
7775
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7755
7776
  mode: RecordingStorageModeSchema.optional(),
7777
+ /**
7778
+ * Which assigned broker slots to record. Absent / empty = {@link
7779
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7780
+ * camera's currently assigned slots — never `mid` unless the operator
7781
+ * picks it, and never a slot the broker has not assigned.
7782
+ */
7756
7783
  profiles: array(CamProfileSchema).optional(),
7757
7784
  segmentSeconds: number().int().positive().optional(),
7758
7785
  /**
@@ -7833,7 +7860,11 @@ var RelocateFootageInputSchema = object({
7833
7860
  profiles: array(string()).optional(),
7834
7861
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7835
7862
  * never allowed to starve live writers. */
7836
- throttleMbps: number().min(1).max(1e3).optional()
7863
+ throttleMbps: number().min(1).max(1e3).optional(),
7864
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7865
+ * pile. Used when a full drain is too expensive and the operator only
7866
+ * wants the recent window on the new disk. */
7867
+ sinceMs: number().int().optional()
7837
7868
  });
7838
7869
  /** Internal, lease-scoped participant operation. It is intentionally separate
7839
7870
  * from persistent recording settings: a migration never changes
@@ -14783,6 +14814,7 @@ var NcSystemEventKindSchema = _enum([
14783
14814
  "node-offline",
14784
14815
  "node-inference-unavailable",
14785
14816
  "detection-blind",
14817
+ "addon-crash-loop",
14786
14818
  "addon-update-available",
14787
14819
  "server-update-available",
14788
14820
  "alarm-triggered",
@@ -14790,6 +14822,9 @@ var NcSystemEventKindSchema = _enum([
14790
14822
  "alarm-disarmed",
14791
14823
  "alarm-arming",
14792
14824
  "alarm-arm-refused",
14825
+ "addon-updated",
14826
+ "server-updated",
14827
+ "export-completed",
14793
14828
  "camera-online",
14794
14829
  "camera-offline",
14795
14830
  "camera-disabled",
@@ -16683,13 +16718,19 @@ var RetrainStatusSchema = _enum([
16683
16718
  * "never marked" from "already trained" must read `retrainStatus`.
16684
16719
  *
16685
16720
  * `debug` does NOT pin; it is attention, not durability.
16721
+ *
16722
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16723
+ * A favourited track is skipped by retention the same way `staging` is, but
16724
+ * it does not enter `none|staging|trained` and has no staging budget.
16686
16725
  */
16687
16726
  var TrackFlagFields = {
16688
16727
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16689
16728
  * `'staging'`. */
16690
16729
  markForTrain: boolean().optional(),
16691
16730
  /** Operator marked this track for diagnostic attention. */
16692
- debug: boolean().optional()
16731
+ debug: boolean().optional(),
16732
+ /** Operator favourited this track. Pins it against pruning. */
16733
+ favourited: boolean().optional()
16693
16734
  };
16694
16735
  /**
16695
16736
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16714,6 +16755,7 @@ var TrackFlagsSchema = object({
16714
16755
  trackId: string(),
16715
16756
  markForTrain: boolean(),
16716
16757
  debug: boolean(),
16758
+ favourited: boolean(),
16717
16759
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16718
16760
  * a track row) because this shape is only ever produced by the write body,
16719
16761
  * which always knows it — and a surface that has just written needs to render
@@ -17346,6 +17388,12 @@ var TrackCascadeCountsSchema = object({
17346
17388
  /** Per-track CLIP search vectors removed (best-effort). */
17347
17389
  embeddings: number().int()
17348
17390
  });
17391
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17392
+ var DiskReconcileCountsSchema = object({
17393
+ mediaDropped: number().int(),
17394
+ tracks: number().int(),
17395
+ events: number().int()
17396
+ });
17349
17397
  /** Event-store footprint for one camera. */
17350
17398
  var EventStoreDeviceFootprintSchema = object({
17351
17399
  deviceId: number(),
@@ -17522,6 +17570,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17522
17570
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17523
17571
  kind: "mutation",
17524
17572
  auth: "admin"
17573
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17574
+ kind: "mutation",
17575
+ auth: "admin"
17525
17576
  }), method(object({
17526
17577
  deviceId: number(),
17527
17578
  trackIds: array(string()).min(1)
@@ -19072,6 +19123,24 @@ var CameraStatusDegradationSchema = object({
19072
19123
  *
19073
19124
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
19074
19125
  */
19126
+ var DiskReconcileJobSchema = object({
19127
+ state: _enum([
19128
+ "idle",
19129
+ "running",
19130
+ "done",
19131
+ "error"
19132
+ ]),
19133
+ total: number().int().nonnegative(),
19134
+ completed: number().int().nonnegative(),
19135
+ currentDeviceId: number().int().nullable(),
19136
+ failed: array(number().int()).readonly(),
19137
+ mediaDropped: number().int().nonnegative(),
19138
+ tracks: number().int().nonnegative(),
19139
+ events: number().int().nonnegative(),
19140
+ startedAtMs: number().int().nullable(),
19141
+ finishedAtMs: number().int().nullable(),
19142
+ error: string().nullable()
19143
+ });
19075
19144
  var CameraStatusSchema = object({
19076
19145
  deviceId: number(),
19077
19146
  assignment: CameraAssignmentStatusSchema,
@@ -19303,7 +19372,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19303
19372
  }), CameraSwitchGroupSchema, {
19304
19373
  kind: "mutation",
19305
19374
  auth: "admin"
19306
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19375
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19376
+ kind: "mutation",
19377
+ auth: "admin"
19378
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19307
19379
  name: string(),
19308
19380
  description: string().optional(),
19309
19381
  config: CameraPipelineConfigSchema
@@ -20376,20 +20448,6 @@ var VectorStatsResultSchema = object({
20376
20448
  exact: boolean()
20377
20449
  });
20378
20450
  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);
20379
- /**
20380
- * `videoclips` — the unified, navigable-clip surface for a camera.
20381
- *
20382
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20383
- * provider per device, substitutable. The DEFAULT provider (registered by
20384
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20385
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20386
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20387
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20388
- * wrapper provider for its device and serve its own clip catalog + URLs.
20389
- *
20390
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20391
- * temporal overlap, so the API never decides `continuous` vs `events`.
20392
- */
20393
20451
  var ClipSchema = object({
20394
20452
  /** Opaque, provider-namespaced id. The default provider encodes the time
20395
20453
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20406,8 +20464,57 @@ var ClipSchema = object({
20406
20464
  startMs: number(),
20407
20465
  endMs: number()
20408
20466
  }),
20409
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20410
- thumbnail: string().optional()
20467
+ /**
20468
+ * Lazy thumbnail URL, never inlined.
20469
+ *
20470
+ * Recording-derived clips (events-mode keep-window, and the prepared
20471
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20472
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20473
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20474
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20475
+ * mint their own stills.
20476
+ *
20477
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20478
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20479
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20480
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20481
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20482
+ * A read that FAILS drops the claim; it never invents it.
20483
+ */
20484
+ thumbnail: string().optional(),
20485
+ /**
20486
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20487
+ * can be decoded. Present whenever the visit came from recorded availability;
20488
+ * absent on a per-event padded window (there is no footage to promise).
20489
+ *
20490
+ * This is not a thumbnail and not a second byte path: it is the argument to
20491
+ * the recorder's existing still route. The surface — never the provider —
20492
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20493
+ * contiguous range, not of the visit: a visit spans its holes by
20494
+ * construction, so a naive midpoint lands in dead air.
20495
+ */
20496
+ stillAtMs: number().optional(),
20497
+ /**
20498
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20499
+ * first within kind (object → motion → audio), capped at
20500
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20501
+ *
20502
+ * Bounded because it is not a payload the surface pages through: one visit on
20503
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20504
+ * camera-day. Read {@link eventCount} for the true total.
20505
+ */
20506
+ eventIds: array(string()).optional(),
20507
+ /** How many analytics events actually overlap this visit. Differs from
20508
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20509
+ * list is never mistaken for a quiet visit. */
20510
+ eventCount: number().int().nonnegative().optional(),
20511
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20512
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20513
+ * bar keeps showing them via `recording.getAvailability`. */
20514
+ holes: array(object({
20515
+ startMs: number(),
20516
+ endMs: number()
20517
+ })).optional()
20411
20518
  });
20412
20519
  var ClipPlaybackSchema = object({
20413
20520
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20871,7 +20978,14 @@ var SearchResultSchema = object({
20871
20978
  });
20872
20979
  var AutoUpdateSettingsSchema = object({
20873
20980
  channel: ChannelSchema,
20874
- intervalSeconds: number()
20981
+ intervalSeconds: number(),
20982
+ /**
20983
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20984
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20985
+ * about a publish and installing it are different decisions. Clamped
20986
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20987
+ */
20988
+ updateCheckIntervalSeconds: number()
20875
20989
  });
20876
20990
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20877
20991
  var RestartAddonResultSchema = unknown();
@@ -21012,7 +21126,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21012
21126
  auth: "admin"
21013
21127
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21014
21128
  channel: ChannelSchema,
21015
- intervalSeconds: number().min(300).max(86400).optional()
21129
+ intervalSeconds: number().min(300).max(86400).optional(),
21130
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21131
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21016
21132
  }), unknown(), {
21017
21133
  kind: "mutation",
21018
21134
  auth: "admin"
@@ -26710,7 +26826,9 @@ var ExportOptionsSchema = object({
26710
26826
  includeAudio: boolean(),
26711
26827
  maxLifeMs: number().int().positive(),
26712
26828
  deleteAfterDownload: boolean(),
26713
- title: string().max(200).optional()
26829
+ title: string().max(200).optional(),
26830
+ /** Notification-output target ids to ping when this export becomes ready. */
26831
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26714
26832
  }).superRefine((v, ctx) => {
26715
26833
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26716
26834
  code: ZodIssueCode.custom,
@@ -26769,10 +26887,18 @@ var ExportBytesSchema = object({
26769
26887
  });
26770
26888
  method(object({
26771
26889
  deviceId: number(),
26772
- profile: string(),
26890
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26891
+ profile: string().optional(),
26892
+ profiles: array(string()).min(1).optional(),
26773
26893
  fromMs: number(),
26774
26894
  toMs: number(),
26775
26895
  options: ExportOptionsSchema
26896
+ }).superRefine((v, ctx) => {
26897
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26898
+ code: ZodIssueCode.custom,
26899
+ message: "pass profiles[] (min 1) or legacy profile",
26900
+ path: ["profiles"]
26901
+ });
26776
26902
  }), ExportRecordSchema, {
26777
26903
  kind: "mutation",
26778
26904
  auth: "protected"
@@ -29714,15 +29840,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29714
29840
  labels: ["probe not implemented"]
29715
29841
  };
29716
29842
  }
29717
- /**
29718
- * Top-level devices restored at once in {@link onRestoreDevices}.
29719
- *
29720
- * Four covers the fleets this ships to without turning a boot into a burst a
29721
- * camera NVR answers with a refusal. A provider whose upstream is a single
29722
- * session with a serial command channel (a Baichuan hub, an NVR that
29723
- * serialises ISAPI) should lower it; nothing needs to raise it.
29724
- */
29725
- restoreConcurrency = 4;
29726
29843
  async restoreDevices(savedDevices) {
29727
29844
  await this.onRestoreDevices(savedDevices);
29728
29845
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29777,14 +29894,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29777
29894
  });
29778
29895
  }
29779
29896
  };
29780
- let nextTopLevel = 0;
29781
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29782
- for (;;) {
29783
- const saved = topLevel[nextTopLevel++];
29784
- if (saved === void 0) return;
29785
- await restoreOne(saved);
29786
- }
29787
- }));
29897
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29788
29898
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29789
29899
  for (const saved of childRows) {
29790
29900
  const Class = this.deviceClasses[saved.type];
@@ -33057,6 +33167,12 @@ Object.freeze({
33057
33167
  addonId: null,
33058
33168
  access: "create"
33059
33169
  },
33170
+ "pipelineAnalytics.reconcileFromDisk": {
33171
+ capName: "pipeline-analytics",
33172
+ capScope: "device",
33173
+ addonId: null,
33174
+ access: "create"
33175
+ },
33060
33176
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33061
33177
  capName: "pipeline-analytics",
33062
33178
  capScope: "device",
@@ -33459,6 +33575,12 @@ Object.freeze({
33459
33575
  addonId: null,
33460
33576
  access: "view"
33461
33577
  },
33578
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33579
+ capName: "pipeline-orchestrator",
33580
+ capScope: "system",
33581
+ addonId: null,
33582
+ access: "view"
33583
+ },
33462
33584
  "pipelineOrchestrator.listAgentSettings": {
33463
33585
  capName: "pipeline-orchestrator",
33464
33586
  capScope: "system",
@@ -33483,6 +33605,12 @@ Object.freeze({
33483
33605
  addonId: null,
33484
33606
  access: "create"
33485
33607
  },
33608
+ "pipelineOrchestrator.reconcileFromDisk": {
33609
+ capName: "pipeline-orchestrator",
33610
+ capScope: "system",
33611
+ addonId: null,
33612
+ access: "create"
33613
+ },
33486
33614
  "pipelineOrchestrator.removeAgentSettings": {
33487
33615
  capName: "pipeline-orchestrator",
33488
33616
  capScope: "system",
@@ -36474,6 +36602,11 @@ Object.freeze({
36474
36602
  form: "single",
36475
36603
  optional: true
36476
36604
  }],
36605
+ "pipelineAnalytics.reconcileFromDisk": [{
36606
+ name: "deviceId",
36607
+ form: "single",
36608
+ optional: false
36609
+ }],
36477
36610
  "pipelineAnalytics.restageRetrainTrack": [{
36478
36611
  name: "deviceId",
36479
36612
  form: "single",
@@ -37539,6 +37672,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37539
37672
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37540
37673
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37541
37674
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37675
+ var MB = 1024 * 1024;
37676
+ 1024 * MB, 3072 * MB;
37542
37677
  //#endregion
37543
37678
  //#region src/config.ts
37544
37679
  /**
package/dist/addon.mjs CHANGED
@@ -38,7 +38,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
38
38
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
39
39
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
40
40
  //#endregion
41
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
41
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
42
42
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
43
43
  EventCategory["SystemBoot"] = "system.boot";
44
44
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -55,9 +55,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
55
55
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
56
56
  /**
57
57
  * A newer addon or server-root package version was found by the
58
- * authoritative registry check. Emitted once per
59
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
60
- * polling of the same result is deduplicated by the checker.
58
+ * authoritative registry check. Emitted once when any observed
59
+ * `latestVersion` changes (or a package/node first appears behind);
60
+ * the payload carries the full currently-available list. Repeated
61
+ * polling of the same latests is silent.
61
62
  */
62
63
  EventCategory["UpdateAvailable"] = "update.available";
63
64
  /**
@@ -76,6 +77,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
76
77
  EventCategory["AddonInstalled"] = "addon.installed";
77
78
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
78
79
  EventCategory["AddonCrashed"] = "addon.crashed";
80
+ /**
81
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
82
+ *
83
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
84
+ * respawned"); this is the one that never resolves itself. Emitted exactly
85
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
86
+ * addons it hosted and the crash count that tripped the breaker.
87
+ *
88
+ * It exists because a runner marked terminally `failed` used to be SILENT:
89
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
90
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
91
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
92
+ * operator's phone told him. The Notification Center's system-event intake
93
+ * consumes this category and maps it to the `addon-crash-loop` kind.
94
+ */
95
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
79
96
  EventCategory["AddonError"] = "addon.error";
80
97
  EventCategory["AddonPageReady"] = "addon.page-ready";
81
98
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7706,6 +7723,10 @@ var RecordingBandSchema = object({
7706
7723
  preBufferSec: number().min(0).optional(),
7707
7724
  postBufferSec: number().min(0).optional()
7708
7725
  });
7726
+ ({
7727
+ preBufferSec: 10,
7728
+ postBufferSec: 30
7729
+ }).postBufferSec * 1e3;
7709
7730
  /**
7710
7731
  * Per-device retention overrides. Every field is optional; an unset or `0`
7711
7732
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7753,6 +7774,12 @@ var RecordingConfigSchema = object({
7753
7774
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7754
7775
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7755
7776
  mode: RecordingStorageModeSchema.optional(),
7777
+ /**
7778
+ * Which assigned broker slots to record. Absent / empty = {@link
7779
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7780
+ * camera's currently assigned slots — never `mid` unless the operator
7781
+ * picks it, and never a slot the broker has not assigned.
7782
+ */
7756
7783
  profiles: array(CamProfileSchema).optional(),
7757
7784
  segmentSeconds: number().int().positive().optional(),
7758
7785
  /**
@@ -7833,7 +7860,11 @@ var RelocateFootageInputSchema = object({
7833
7860
  profiles: array(string()).optional(),
7834
7861
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7835
7862
  * never allowed to starve live writers. */
7836
- throttleMbps: number().min(1).max(1e3).optional()
7863
+ throttleMbps: number().min(1).max(1e3).optional(),
7864
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7865
+ * pile. Used when a full drain is too expensive and the operator only
7866
+ * wants the recent window on the new disk. */
7867
+ sinceMs: number().int().optional()
7837
7868
  });
7838
7869
  /** Internal, lease-scoped participant operation. It is intentionally separate
7839
7870
  * from persistent recording settings: a migration never changes
@@ -14783,6 +14814,7 @@ var NcSystemEventKindSchema = _enum([
14783
14814
  "node-offline",
14784
14815
  "node-inference-unavailable",
14785
14816
  "detection-blind",
14817
+ "addon-crash-loop",
14786
14818
  "addon-update-available",
14787
14819
  "server-update-available",
14788
14820
  "alarm-triggered",
@@ -14790,6 +14822,9 @@ var NcSystemEventKindSchema = _enum([
14790
14822
  "alarm-disarmed",
14791
14823
  "alarm-arming",
14792
14824
  "alarm-arm-refused",
14825
+ "addon-updated",
14826
+ "server-updated",
14827
+ "export-completed",
14793
14828
  "camera-online",
14794
14829
  "camera-offline",
14795
14830
  "camera-disabled",
@@ -16683,13 +16718,19 @@ var RetrainStatusSchema = _enum([
16683
16718
  * "never marked" from "already trained" must read `retrainStatus`.
16684
16719
  *
16685
16720
  * `debug` does NOT pin; it is attention, not durability.
16721
+ *
16722
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16723
+ * A favourited track is skipped by retention the same way `staging` is, but
16724
+ * it does not enter `none|staging|trained` and has no staging budget.
16686
16725
  */
16687
16726
  var TrackFlagFields = {
16688
16727
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16689
16728
  * `'staging'`. */
16690
16729
  markForTrain: boolean().optional(),
16691
16730
  /** Operator marked this track for diagnostic attention. */
16692
- debug: boolean().optional()
16731
+ debug: boolean().optional(),
16732
+ /** Operator favourited this track. Pins it against pruning. */
16733
+ favourited: boolean().optional()
16693
16734
  };
16694
16735
  /**
16695
16736
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16714,6 +16755,7 @@ var TrackFlagsSchema = object({
16714
16755
  trackId: string(),
16715
16756
  markForTrain: boolean(),
16716
16757
  debug: boolean(),
16758
+ favourited: boolean(),
16717
16759
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16718
16760
  * a track row) because this shape is only ever produced by the write body,
16719
16761
  * which always knows it — and a surface that has just written needs to render
@@ -17346,6 +17388,12 @@ var TrackCascadeCountsSchema = object({
17346
17388
  /** Per-track CLIP search vectors removed (best-effort). */
17347
17389
  embeddings: number().int()
17348
17390
  });
17391
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17392
+ var DiskReconcileCountsSchema = object({
17393
+ mediaDropped: number().int(),
17394
+ tracks: number().int(),
17395
+ events: number().int()
17396
+ });
17349
17397
  /** Event-store footprint for one camera. */
17350
17398
  var EventStoreDeviceFootprintSchema = object({
17351
17399
  deviceId: number(),
@@ -17522,6 +17570,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17522
17570
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17523
17571
  kind: "mutation",
17524
17572
  auth: "admin"
17573
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17574
+ kind: "mutation",
17575
+ auth: "admin"
17525
17576
  }), method(object({
17526
17577
  deviceId: number(),
17527
17578
  trackIds: array(string()).min(1)
@@ -19072,6 +19123,24 @@ var CameraStatusDegradationSchema = object({
19072
19123
  *
19073
19124
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
19074
19125
  */
19126
+ var DiskReconcileJobSchema = object({
19127
+ state: _enum([
19128
+ "idle",
19129
+ "running",
19130
+ "done",
19131
+ "error"
19132
+ ]),
19133
+ total: number().int().nonnegative(),
19134
+ completed: number().int().nonnegative(),
19135
+ currentDeviceId: number().int().nullable(),
19136
+ failed: array(number().int()).readonly(),
19137
+ mediaDropped: number().int().nonnegative(),
19138
+ tracks: number().int().nonnegative(),
19139
+ events: number().int().nonnegative(),
19140
+ startedAtMs: number().int().nullable(),
19141
+ finishedAtMs: number().int().nullable(),
19142
+ error: string().nullable()
19143
+ });
19075
19144
  var CameraStatusSchema = object({
19076
19145
  deviceId: number(),
19077
19146
  assignment: CameraAssignmentStatusSchema,
@@ -19303,7 +19372,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19303
19372
  }), CameraSwitchGroupSchema, {
19304
19373
  kind: "mutation",
19305
19374
  auth: "admin"
19306
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19375
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19376
+ kind: "mutation",
19377
+ auth: "admin"
19378
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19307
19379
  name: string(),
19308
19380
  description: string().optional(),
19309
19381
  config: CameraPipelineConfigSchema
@@ -20376,20 +20448,6 @@ var VectorStatsResultSchema = object({
20376
20448
  exact: boolean()
20377
20449
  });
20378
20450
  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);
20379
- /**
20380
- * `videoclips` — the unified, navigable-clip surface for a camera.
20381
- *
20382
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20383
- * provider per device, substitutable. The DEFAULT provider (registered by
20384
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20385
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20386
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20387
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20388
- * wrapper provider for its device and serve its own clip catalog + URLs.
20389
- *
20390
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20391
- * temporal overlap, so the API never decides `continuous` vs `events`.
20392
- */
20393
20451
  var ClipSchema = object({
20394
20452
  /** Opaque, provider-namespaced id. The default provider encodes the time
20395
20453
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20406,8 +20464,57 @@ var ClipSchema = object({
20406
20464
  startMs: number(),
20407
20465
  endMs: number()
20408
20466
  }),
20409
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20410
- thumbnail: string().optional()
20467
+ /**
20468
+ * Lazy thumbnail URL, never inlined.
20469
+ *
20470
+ * Recording-derived clips (events-mode keep-window, and the prepared
20471
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20472
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20473
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20474
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20475
+ * mint their own stills.
20476
+ *
20477
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20478
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20479
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20480
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20481
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20482
+ * A read that FAILS drops the claim; it never invents it.
20483
+ */
20484
+ thumbnail: string().optional(),
20485
+ /**
20486
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20487
+ * can be decoded. Present whenever the visit came from recorded availability;
20488
+ * absent on a per-event padded window (there is no footage to promise).
20489
+ *
20490
+ * This is not a thumbnail and not a second byte path: it is the argument to
20491
+ * the recorder's existing still route. The surface — never the provider —
20492
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20493
+ * contiguous range, not of the visit: a visit spans its holes by
20494
+ * construction, so a naive midpoint lands in dead air.
20495
+ */
20496
+ stillAtMs: number().optional(),
20497
+ /**
20498
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20499
+ * first within kind (object → motion → audio), capped at
20500
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20501
+ *
20502
+ * Bounded because it is not a payload the surface pages through: one visit on
20503
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20504
+ * camera-day. Read {@link eventCount} for the true total.
20505
+ */
20506
+ eventIds: array(string()).optional(),
20507
+ /** How many analytics events actually overlap this visit. Differs from
20508
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20509
+ * list is never mistaken for a quiet visit. */
20510
+ eventCount: number().int().nonnegative().optional(),
20511
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20512
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20513
+ * bar keeps showing them via `recording.getAvailability`. */
20514
+ holes: array(object({
20515
+ startMs: number(),
20516
+ endMs: number()
20517
+ })).optional()
20411
20518
  });
20412
20519
  var ClipPlaybackSchema = object({
20413
20520
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20871,7 +20978,14 @@ var SearchResultSchema = object({
20871
20978
  });
20872
20979
  var AutoUpdateSettingsSchema = object({
20873
20980
  channel: ChannelSchema,
20874
- intervalSeconds: number()
20981
+ intervalSeconds: number(),
20982
+ /**
20983
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20984
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20985
+ * about a publish and installing it are different decisions. Clamped
20986
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20987
+ */
20988
+ updateCheckIntervalSeconds: number()
20875
20989
  });
20876
20990
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20877
20991
  var RestartAddonResultSchema = unknown();
@@ -21012,7 +21126,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21012
21126
  auth: "admin"
21013
21127
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21014
21128
  channel: ChannelSchema,
21015
- intervalSeconds: number().min(300).max(86400).optional()
21129
+ intervalSeconds: number().min(300).max(86400).optional(),
21130
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21131
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21016
21132
  }), unknown(), {
21017
21133
  kind: "mutation",
21018
21134
  auth: "admin"
@@ -26710,7 +26826,9 @@ var ExportOptionsSchema = object({
26710
26826
  includeAudio: boolean(),
26711
26827
  maxLifeMs: number().int().positive(),
26712
26828
  deleteAfterDownload: boolean(),
26713
- title: string().max(200).optional()
26829
+ title: string().max(200).optional(),
26830
+ /** Notification-output target ids to ping when this export becomes ready. */
26831
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26714
26832
  }).superRefine((v, ctx) => {
26715
26833
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26716
26834
  code: ZodIssueCode.custom,
@@ -26769,10 +26887,18 @@ var ExportBytesSchema = object({
26769
26887
  });
26770
26888
  method(object({
26771
26889
  deviceId: number(),
26772
- profile: string(),
26890
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26891
+ profile: string().optional(),
26892
+ profiles: array(string()).min(1).optional(),
26773
26893
  fromMs: number(),
26774
26894
  toMs: number(),
26775
26895
  options: ExportOptionsSchema
26896
+ }).superRefine((v, ctx) => {
26897
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26898
+ code: ZodIssueCode.custom,
26899
+ message: "pass profiles[] (min 1) or legacy profile",
26900
+ path: ["profiles"]
26901
+ });
26776
26902
  }), ExportRecordSchema, {
26777
26903
  kind: "mutation",
26778
26904
  auth: "protected"
@@ -29714,15 +29840,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29714
29840
  labels: ["probe not implemented"]
29715
29841
  };
29716
29842
  }
29717
- /**
29718
- * Top-level devices restored at once in {@link onRestoreDevices}.
29719
- *
29720
- * Four covers the fleets this ships to without turning a boot into a burst a
29721
- * camera NVR answers with a refusal. A provider whose upstream is a single
29722
- * session with a serial command channel (a Baichuan hub, an NVR that
29723
- * serialises ISAPI) should lower it; nothing needs to raise it.
29724
- */
29725
- restoreConcurrency = 4;
29726
29843
  async restoreDevices(savedDevices) {
29727
29844
  await this.onRestoreDevices(savedDevices);
29728
29845
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29777,14 +29894,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29777
29894
  });
29778
29895
  }
29779
29896
  };
29780
- let nextTopLevel = 0;
29781
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29782
- for (;;) {
29783
- const saved = topLevel[nextTopLevel++];
29784
- if (saved === void 0) return;
29785
- await restoreOne(saved);
29786
- }
29787
- }));
29897
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29788
29898
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29789
29899
  for (const saved of childRows) {
29790
29900
  const Class = this.deviceClasses[saved.type];
@@ -33057,6 +33167,12 @@ Object.freeze({
33057
33167
  addonId: null,
33058
33168
  access: "create"
33059
33169
  },
33170
+ "pipelineAnalytics.reconcileFromDisk": {
33171
+ capName: "pipeline-analytics",
33172
+ capScope: "device",
33173
+ addonId: null,
33174
+ access: "create"
33175
+ },
33060
33176
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33061
33177
  capName: "pipeline-analytics",
33062
33178
  capScope: "device",
@@ -33459,6 +33575,12 @@ Object.freeze({
33459
33575
  addonId: null,
33460
33576
  access: "view"
33461
33577
  },
33578
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33579
+ capName: "pipeline-orchestrator",
33580
+ capScope: "system",
33581
+ addonId: null,
33582
+ access: "view"
33583
+ },
33462
33584
  "pipelineOrchestrator.listAgentSettings": {
33463
33585
  capName: "pipeline-orchestrator",
33464
33586
  capScope: "system",
@@ -33483,6 +33605,12 @@ Object.freeze({
33483
33605
  addonId: null,
33484
33606
  access: "create"
33485
33607
  },
33608
+ "pipelineOrchestrator.reconcileFromDisk": {
33609
+ capName: "pipeline-orchestrator",
33610
+ capScope: "system",
33611
+ addonId: null,
33612
+ access: "create"
33613
+ },
33486
33614
  "pipelineOrchestrator.removeAgentSettings": {
33487
33615
  capName: "pipeline-orchestrator",
33488
33616
  capScope: "system",
@@ -36474,6 +36602,11 @@ Object.freeze({
36474
36602
  form: "single",
36475
36603
  optional: true
36476
36604
  }],
36605
+ "pipelineAnalytics.reconcileFromDisk": [{
36606
+ name: "deviceId",
36607
+ form: "single",
36608
+ optional: false
36609
+ }],
36477
36610
  "pipelineAnalytics.restageRetrainTrack": [{
36478
36611
  name: "deviceId",
36479
36612
  form: "single",
@@ -37539,6 +37672,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37539
37672
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37540
37673
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37541
37674
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37675
+ var MB = 1024 * 1024;
37676
+ 1024 * MB, 3072 * MB;
37542
37677
  //#endregion
37543
37678
  //#region src/config.ts
37544
37679
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-import-alexa",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
5
5
  "keywords": [
6
6
  "camstack",