@camstack/addon-import-alexa 0.2.19 → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +187 -44
  2. package/dist/addon.mjs +187 -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,65 @@ 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
+ * Distinct object classes attached to this visit (`person`, `car`, …),
20469
+ * dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
20470
+ * instead of the bare kind — "Object" tells the operator nothing a colour bar
20471
+ * did not. Absent (never empty) when the visit attached no classified object
20472
+ * event, so a motion/audio-only visit keeps its kind label.
20473
+ */
20474
+ labels: array(string()).max(3).optional(),
20475
+ /**
20476
+ * Lazy thumbnail URL, never inlined.
20477
+ *
20478
+ * Recording-derived clips (events-mode keep-window, and the prepared
20479
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20480
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20481
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20482
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20483
+ * mint their own stills.
20484
+ *
20485
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20486
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20487
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20488
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20489
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20490
+ * A read that FAILS drops the claim; it never invents it.
20491
+ */
20492
+ thumbnail: string().optional(),
20493
+ /**
20494
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20495
+ * can be decoded. Present whenever the visit came from recorded availability;
20496
+ * absent on a per-event padded window (there is no footage to promise).
20497
+ *
20498
+ * This is not a thumbnail and not a second byte path: it is the argument to
20499
+ * the recorder's existing still route. The surface — never the provider —
20500
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20501
+ * contiguous range, not of the visit: a visit spans its holes by
20502
+ * construction, so a naive midpoint lands in dead air.
20503
+ */
20504
+ stillAtMs: number().optional(),
20505
+ /**
20506
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20507
+ * first within kind (object → motion → audio), capped at
20508
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20509
+ *
20510
+ * Bounded because it is not a payload the surface pages through: one visit on
20511
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20512
+ * camera-day. Read {@link eventCount} for the true total.
20513
+ */
20514
+ eventIds: array(string()).optional(),
20515
+ /** How many analytics events actually overlap this visit. Differs from
20516
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20517
+ * list is never mistaken for a quiet visit. */
20518
+ eventCount: number().int().nonnegative().optional(),
20519
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20520
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20521
+ * bar keeps showing them via `recording.getAvailability`. */
20522
+ holes: array(object({
20523
+ startMs: number(),
20524
+ endMs: number()
20525
+ })).optional()
20411
20526
  });
20412
20527
  var ClipPlaybackSchema = object({
20413
20528
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20871,7 +20986,14 @@ var SearchResultSchema = object({
20871
20986
  });
20872
20987
  var AutoUpdateSettingsSchema = object({
20873
20988
  channel: ChannelSchema,
20874
- intervalSeconds: number()
20989
+ intervalSeconds: number(),
20990
+ /**
20991
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20992
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20993
+ * about a publish and installing it are different decisions. Clamped
20994
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20995
+ */
20996
+ updateCheckIntervalSeconds: number()
20875
20997
  });
20876
20998
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20877
20999
  var RestartAddonResultSchema = unknown();
@@ -21012,7 +21134,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21012
21134
  auth: "admin"
21013
21135
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21014
21136
  channel: ChannelSchema,
21015
- intervalSeconds: number().min(300).max(86400).optional()
21137
+ intervalSeconds: number().min(300).max(86400).optional(),
21138
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21139
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21016
21140
  }), unknown(), {
21017
21141
  kind: "mutation",
21018
21142
  auth: "admin"
@@ -26710,7 +26834,9 @@ var ExportOptionsSchema = object({
26710
26834
  includeAudio: boolean(),
26711
26835
  maxLifeMs: number().int().positive(),
26712
26836
  deleteAfterDownload: boolean(),
26713
- title: string().max(200).optional()
26837
+ title: string().max(200).optional(),
26838
+ /** Notification-output target ids to ping when this export becomes ready. */
26839
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26714
26840
  }).superRefine((v, ctx) => {
26715
26841
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26716
26842
  code: ZodIssueCode.custom,
@@ -26769,10 +26895,18 @@ var ExportBytesSchema = object({
26769
26895
  });
26770
26896
  method(object({
26771
26897
  deviceId: number(),
26772
- profile: string(),
26898
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26899
+ profile: string().optional(),
26900
+ profiles: array(string()).min(1).optional(),
26773
26901
  fromMs: number(),
26774
26902
  toMs: number(),
26775
26903
  options: ExportOptionsSchema
26904
+ }).superRefine((v, ctx) => {
26905
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26906
+ code: ZodIssueCode.custom,
26907
+ message: "pass profiles[] (min 1) or legacy profile",
26908
+ path: ["profiles"]
26909
+ });
26776
26910
  }), ExportRecordSchema, {
26777
26911
  kind: "mutation",
26778
26912
  auth: "protected"
@@ -29714,15 +29848,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29714
29848
  labels: ["probe not implemented"]
29715
29849
  };
29716
29850
  }
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
29851
  async restoreDevices(savedDevices) {
29727
29852
  await this.onRestoreDevices(savedDevices);
29728
29853
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29777,14 +29902,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29777
29902
  });
29778
29903
  }
29779
29904
  };
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
- }));
29905
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29788
29906
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29789
29907
  for (const saved of childRows) {
29790
29908
  const Class = this.deviceClasses[saved.type];
@@ -33057,6 +33175,12 @@ Object.freeze({
33057
33175
  addonId: null,
33058
33176
  access: "create"
33059
33177
  },
33178
+ "pipelineAnalytics.reconcileFromDisk": {
33179
+ capName: "pipeline-analytics",
33180
+ capScope: "device",
33181
+ addonId: null,
33182
+ access: "create"
33183
+ },
33060
33184
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33061
33185
  capName: "pipeline-analytics",
33062
33186
  capScope: "device",
@@ -33459,6 +33583,12 @@ Object.freeze({
33459
33583
  addonId: null,
33460
33584
  access: "view"
33461
33585
  },
33586
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33587
+ capName: "pipeline-orchestrator",
33588
+ capScope: "system",
33589
+ addonId: null,
33590
+ access: "view"
33591
+ },
33462
33592
  "pipelineOrchestrator.listAgentSettings": {
33463
33593
  capName: "pipeline-orchestrator",
33464
33594
  capScope: "system",
@@ -33483,6 +33613,12 @@ Object.freeze({
33483
33613
  addonId: null,
33484
33614
  access: "create"
33485
33615
  },
33616
+ "pipelineOrchestrator.reconcileFromDisk": {
33617
+ capName: "pipeline-orchestrator",
33618
+ capScope: "system",
33619
+ addonId: null,
33620
+ access: "create"
33621
+ },
33486
33622
  "pipelineOrchestrator.removeAgentSettings": {
33487
33623
  capName: "pipeline-orchestrator",
33488
33624
  capScope: "system",
@@ -36474,6 +36610,11 @@ Object.freeze({
36474
36610
  form: "single",
36475
36611
  optional: true
36476
36612
  }],
36613
+ "pipelineAnalytics.reconcileFromDisk": [{
36614
+ name: "deviceId",
36615
+ form: "single",
36616
+ optional: false
36617
+ }],
36477
36618
  "pipelineAnalytics.restageRetrainTrack": [{
36478
36619
  name: "deviceId",
36479
36620
  form: "single",
@@ -37539,6 +37680,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37539
37680
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37540
37681
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37541
37682
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37683
+ var MB = 1024 * 1024;
37684
+ 1024 * MB, 3072 * MB;
37542
37685
  //#endregion
37543
37686
  //#region src/config.ts
37544
37687
  /**
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,65 @@ 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
+ * Distinct object classes attached to this visit (`person`, `car`, …),
20469
+ * dominant first, capped at {@link MAX_CLIP_LABELS}. The ribbon renders these
20470
+ * instead of the bare kind — "Object" tells the operator nothing a colour bar
20471
+ * did not. Absent (never empty) when the visit attached no classified object
20472
+ * event, so a motion/audio-only visit keeps its kind label.
20473
+ */
20474
+ labels: array(string()).max(3).optional(),
20475
+ /**
20476
+ * Lazy thumbnail URL, never inlined.
20477
+ *
20478
+ * Recording-derived clips (events-mode keep-window, and the prepared
20479
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20480
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20481
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20482
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20483
+ * mint their own stills.
20484
+ *
20485
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20486
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20487
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20488
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20489
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20490
+ * A read that FAILS drops the claim; it never invents it.
20491
+ */
20492
+ thumbnail: string().optional(),
20493
+ /**
20494
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20495
+ * can be decoded. Present whenever the visit came from recorded availability;
20496
+ * absent on a per-event padded window (there is no footage to promise).
20497
+ *
20498
+ * This is not a thumbnail and not a second byte path: it is the argument to
20499
+ * the recorder's existing still route. The surface — never the provider —
20500
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20501
+ * contiguous range, not of the visit: a visit spans its holes by
20502
+ * construction, so a naive midpoint lands in dead air.
20503
+ */
20504
+ stillAtMs: number().optional(),
20505
+ /**
20506
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20507
+ * first within kind (object → motion → audio), capped at
20508
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20509
+ *
20510
+ * Bounded because it is not a payload the surface pages through: one visit on
20511
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20512
+ * camera-day. Read {@link eventCount} for the true total.
20513
+ */
20514
+ eventIds: array(string()).optional(),
20515
+ /** How many analytics events actually overlap this visit. Differs from
20516
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20517
+ * list is never mistaken for a quiet visit. */
20518
+ eventCount: number().int().nonnegative().optional(),
20519
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20520
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20521
+ * bar keeps showing them via `recording.getAvailability`. */
20522
+ holes: array(object({
20523
+ startMs: number(),
20524
+ endMs: number()
20525
+ })).optional()
20411
20526
  });
20412
20527
  var ClipPlaybackSchema = object({
20413
20528
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20871,7 +20986,14 @@ var SearchResultSchema = object({
20871
20986
  });
20872
20987
  var AutoUpdateSettingsSchema = object({
20873
20988
  channel: ChannelSchema,
20874
- intervalSeconds: number()
20989
+ intervalSeconds: number(),
20990
+ /**
20991
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20992
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20993
+ * about a publish and installing it are different decisions. Clamped
20994
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20995
+ */
20996
+ updateCheckIntervalSeconds: number()
20875
20997
  });
20876
20998
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20877
20999
  var RestartAddonResultSchema = unknown();
@@ -21012,7 +21134,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21012
21134
  auth: "admin"
21013
21135
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
21014
21136
  channel: ChannelSchema,
21015
- intervalSeconds: number().min(300).max(86400).optional()
21137
+ intervalSeconds: number().min(300).max(86400).optional(),
21138
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21139
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
21016
21140
  }), unknown(), {
21017
21141
  kind: "mutation",
21018
21142
  auth: "admin"
@@ -26710,7 +26834,9 @@ var ExportOptionsSchema = object({
26710
26834
  includeAudio: boolean(),
26711
26835
  maxLifeMs: number().int().positive(),
26712
26836
  deleteAfterDownload: boolean(),
26713
- title: string().max(200).optional()
26837
+ title: string().max(200).optional(),
26838
+ /** Notification-output target ids to ping when this export becomes ready. */
26839
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26714
26840
  }).superRefine((v, ctx) => {
26715
26841
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26716
26842
  code: ZodIssueCode.custom,
@@ -26769,10 +26895,18 @@ var ExportBytesSchema = object({
26769
26895
  });
26770
26896
  method(object({
26771
26897
  deviceId: number(),
26772
- profile: string(),
26898
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26899
+ profile: string().optional(),
26900
+ profiles: array(string()).min(1).optional(),
26773
26901
  fromMs: number(),
26774
26902
  toMs: number(),
26775
26903
  options: ExportOptionsSchema
26904
+ }).superRefine((v, ctx) => {
26905
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26906
+ code: ZodIssueCode.custom,
26907
+ message: "pass profiles[] (min 1) or legacy profile",
26908
+ path: ["profiles"]
26909
+ });
26776
26910
  }), ExportRecordSchema, {
26777
26911
  kind: "mutation",
26778
26912
  auth: "protected"
@@ -29714,15 +29848,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29714
29848
  labels: ["probe not implemented"]
29715
29849
  };
29716
29850
  }
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
29851
  async restoreDevices(savedDevices) {
29727
29852
  await this.onRestoreDevices(savedDevices);
29728
29853
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29777,14 +29902,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29777
29902
  });
29778
29903
  }
29779
29904
  };
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
- }));
29905
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29788
29906
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29789
29907
  for (const saved of childRows) {
29790
29908
  const Class = this.deviceClasses[saved.type];
@@ -33057,6 +33175,12 @@ Object.freeze({
33057
33175
  addonId: null,
33058
33176
  access: "create"
33059
33177
  },
33178
+ "pipelineAnalytics.reconcileFromDisk": {
33179
+ capName: "pipeline-analytics",
33180
+ capScope: "device",
33181
+ addonId: null,
33182
+ access: "create"
33183
+ },
33060
33184
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
33061
33185
  capName: "pipeline-analytics",
33062
33186
  capScope: "device",
@@ -33459,6 +33583,12 @@ Object.freeze({
33459
33583
  addonId: null,
33460
33584
  access: "view"
33461
33585
  },
33586
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33587
+ capName: "pipeline-orchestrator",
33588
+ capScope: "system",
33589
+ addonId: null,
33590
+ access: "view"
33591
+ },
33462
33592
  "pipelineOrchestrator.listAgentSettings": {
33463
33593
  capName: "pipeline-orchestrator",
33464
33594
  capScope: "system",
@@ -33483,6 +33613,12 @@ Object.freeze({
33483
33613
  addonId: null,
33484
33614
  access: "create"
33485
33615
  },
33616
+ "pipelineOrchestrator.reconcileFromDisk": {
33617
+ capName: "pipeline-orchestrator",
33618
+ capScope: "system",
33619
+ addonId: null,
33620
+ access: "create"
33621
+ },
33486
33622
  "pipelineOrchestrator.removeAgentSettings": {
33487
33623
  capName: "pipeline-orchestrator",
33488
33624
  capScope: "system",
@@ -36474,6 +36610,11 @@ Object.freeze({
36474
36610
  form: "single",
36475
36611
  optional: true
36476
36612
  }],
36613
+ "pipelineAnalytics.reconcileFromDisk": [{
36614
+ name: "deviceId",
36615
+ form: "single",
36616
+ optional: false
36617
+ }],
36477
36618
  "pipelineAnalytics.restageRetrainTrack": [{
36478
36619
  name: "deviceId",
36479
36620
  form: "single",
@@ -37539,6 +37680,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37539
37680
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37540
37681
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37541
37682
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37683
+ var MB = 1024 * 1024;
37684
+ 1024 * MB, 3072 * MB;
37542
37685
  //#endregion
37543
37686
  //#region src/config.ts
37544
37687
  /**
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.21",
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",