@camstack/addon-provider-wyze 0.2.19 → 0.2.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 +369 -55
  2. package/dist/addon.mjs +369 -55
  3. package/package.json +4 -1
package/dist/addon.mjs CHANGED
@@ -6,10 +6,11 @@ import * as dgram from "dgram";
6
6
  import { EventEmitter } from "events";
7
7
  import * as net from "net";
8
8
  import { spawn } from "node:child_process";
9
+ import { getCACertificates, setDefaultCACertificates } from "node:tls";
9
10
  //#region \0rolldown/runtime.js
10
11
  var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
11
12
  //#endregion
12
- //#region ../types/dist/event-category-Bxo5yJjt.mjs
13
+ //#region ../types/dist/event-category-XfKNtfCc.mjs
13
14
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
14
15
  EventCategory["SystemBoot"] = "system.boot";
15
16
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -26,9 +27,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
26
27
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
27
28
  /**
28
29
  * A newer addon or server-root package version was found by the
29
- * authoritative registry check. Emitted once per
30
- * `(target, packageName, currentVersion, latestVersion)` transition; repeated
31
- * polling of the same result is deduplicated by the checker.
30
+ * authoritative registry check. Emitted once when any observed
31
+ * `latestVersion` changes (or a package/node first appears behind);
32
+ * the payload carries the full currently-available list. Repeated
33
+ * polling of the same latests is silent.
32
34
  */
33
35
  EventCategory["UpdateAvailable"] = "update.available";
34
36
  /**
@@ -47,6 +49,22 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
47
49
  EventCategory["AddonInstalled"] = "addon.installed";
48
50
  EventCategory["AddonUninstalled"] = "addon.uninstalled";
49
51
  EventCategory["AddonCrashed"] = "addon.crashed";
52
+ /**
53
+ * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
54
+ *
55
+ * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
56
+ * respawned"); this is the one that never resolves itself. Emitted exactly
57
+ * once per trip, by `process-service.ts`, carrying the node, the runner, the
58
+ * addons it hosted and the crash count that tripped the breaker.
59
+ *
60
+ * It exists because a runner marked terminally `failed` used to be SILENT:
61
+ * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
62
+ * errors, the breaker stopped respawning it (correctly), `/health` kept
63
+ * returning 200, and fleet-wide recording was gone for 3h15 before the
64
+ * operator's phone told him. The Notification Center's system-event intake
65
+ * consumes this category and maps it to the `addon-crash-loop` kind.
66
+ */
67
+ EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
50
68
  EventCategory["AddonError"] = "addon.error";
51
69
  EventCategory["AddonPageReady"] = "addon.page-ready";
52
70
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -7558,6 +7576,10 @@ var RecordingBandSchema = object({
7558
7576
  preBufferSec: number().min(0).optional(),
7559
7577
  postBufferSec: number().min(0).optional()
7560
7578
  });
7579
+ ({
7580
+ preBufferSec: 10,
7581
+ postBufferSec: 30
7582
+ }).postBufferSec * 1e3;
7561
7583
  /**
7562
7584
  * Per-device retention overrides. Every field is optional; an unset or `0`
7563
7585
  * value inherits the node-wide recorder default. Only footage-lifetime limits
@@ -7605,6 +7627,12 @@ var RecordingConfigSchema = object({
7605
7627
  /** DERIVED summary of `bands`, stamped by the recorder on every save.
7606
7628
  * Authoring it has no effect — see {@link RecordingStorageModeSchema}. */
7607
7629
  mode: RecordingStorageModeSchema.optional(),
7630
+ /**
7631
+ * Which assigned broker slots to record. Absent / empty = {@link
7632
+ * DEFAULT_RECORDING_PROFILES} (`high`+`low`) intersected with the
7633
+ * camera's currently assigned slots — never `mid` unless the operator
7634
+ * picks it, and never a slot the broker has not assigned.
7635
+ */
7608
7636
  profiles: array(CamProfileSchema).optional(),
7609
7637
  segmentSeconds: number().int().positive().optional(),
7610
7638
  /**
@@ -7685,7 +7713,11 @@ var RelocateFootageInputSchema = object({
7685
7713
  profiles: array(string()).optional(),
7686
7714
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
7687
7715
  * never allowed to starve live writers. */
7688
- throttleMbps: number().min(1).max(1e3).optional()
7716
+ throttleMbps: number().min(1).max(1e3).optional(),
7717
+ /** Move only segments whose startMs is >= this. Absent = the whole source
7718
+ * pile. Used when a full drain is too expensive and the operator only
7719
+ * wants the recent window on the new disk. */
7720
+ sinceMs: number().int().optional()
7689
7721
  });
7690
7722
  /** Internal, lease-scoped participant operation. It is intentionally separate
7691
7723
  * from persistent recording settings: a migration never changes
@@ -14567,6 +14599,7 @@ var NcSystemEventKindSchema = _enum([
14567
14599
  "node-offline",
14568
14600
  "node-inference-unavailable",
14569
14601
  "detection-blind",
14602
+ "addon-crash-loop",
14570
14603
  "addon-update-available",
14571
14604
  "server-update-available",
14572
14605
  "alarm-triggered",
@@ -14574,6 +14607,9 @@ var NcSystemEventKindSchema = _enum([
14574
14607
  "alarm-disarmed",
14575
14608
  "alarm-arming",
14576
14609
  "alarm-arm-refused",
14610
+ "addon-updated",
14611
+ "server-updated",
14612
+ "export-completed",
14577
14613
  "camera-online",
14578
14614
  "camera-offline",
14579
14615
  "camera-disabled",
@@ -16467,13 +16503,19 @@ var RetrainStatusSchema = _enum([
16467
16503
  * "never marked" from "already trained" must read `retrainStatus`.
16468
16504
  *
16469
16505
  * `debug` does NOT pin; it is attention, not durability.
16506
+ *
16507
+ * `favourited` IS a BOOLEAN pin (durability bit), not a retrain lifecycle.
16508
+ * A favourited track is skipped by retention the same way `staging` is, but
16509
+ * it does not enter `none|staging|trained` and has no staging budget.
16470
16510
  */
16471
16511
  var TrackFlagFields = {
16472
16512
  /** Operator marked this track as training material — i.e. `retrainStatus` is
16473
16513
  * `'staging'`. */
16474
16514
  markForTrain: boolean().optional(),
16475
16515
  /** Operator marked this track for diagnostic attention. */
16476
- debug: boolean().optional()
16516
+ debug: boolean().optional(),
16517
+ /** Operator favourited this track. Pins it against pruning. */
16518
+ favourited: boolean().optional()
16477
16519
  };
16478
16520
  /**
16479
16521
  * The lifecycle field itself, on the READ surfaces only (`Track`, `KeyEvent`).
@@ -16498,6 +16540,7 @@ var TrackFlagsSchema = object({
16498
16540
  trackId: string(),
16499
16541
  markForTrain: boolean(),
16500
16542
  debug: boolean(),
16543
+ favourited: boolean(),
16501
16544
  /** The lifecycle state the boolean was derived from. Required here (unlike on
16502
16545
  * a track row) because this shape is only ever produced by the write body,
16503
16546
  * which always knows it — and a surface that has just written needs to render
@@ -17130,6 +17173,12 @@ var TrackCascadeCountsSchema = object({
17130
17173
  /** Per-track CLIP search vectors removed (best-effort). */
17131
17174
  embeddings: number().int()
17132
17175
  });
17176
+ /** Disk-wins reconcile: media rows whose blobs are gone, then empty tracks. */
17177
+ var DiskReconcileCountsSchema = object({
17178
+ mediaDropped: number().int(),
17179
+ tracks: number().int(),
17180
+ events: number().int()
17181
+ });
17133
17182
  /** Event-store footprint for one camera. */
17134
17183
  var EventStoreDeviceFootprintSchema = object({
17135
17184
  deviceId: number(),
@@ -17306,6 +17355,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
17306
17355
  }), method(object({ deviceId: number() }), TrackCascadeCountsSchema, {
17307
17356
  kind: "mutation",
17308
17357
  auth: "admin"
17358
+ }), method(object({ deviceId: number() }), DiskReconcileCountsSchema, {
17359
+ kind: "mutation",
17360
+ auth: "admin"
17309
17361
  }), method(object({
17310
17362
  deviceId: number(),
17311
17363
  trackIds: array(string()).min(1)
@@ -18856,6 +18908,24 @@ var CameraStatusDegradationSchema = object({
18856
18908
  *
18857
18909
  * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
18858
18910
  */
18911
+ var DiskReconcileJobSchema = object({
18912
+ state: _enum([
18913
+ "idle",
18914
+ "running",
18915
+ "done",
18916
+ "error"
18917
+ ]),
18918
+ total: number().int().nonnegative(),
18919
+ completed: number().int().nonnegative(),
18920
+ currentDeviceId: number().int().nullable(),
18921
+ failed: array(number().int()).readonly(),
18922
+ mediaDropped: number().int().nonnegative(),
18923
+ tracks: number().int().nonnegative(),
18924
+ events: number().int().nonnegative(),
18925
+ startedAtMs: number().int().nullable(),
18926
+ finishedAtMs: number().int().nullable(),
18927
+ error: string().nullable()
18928
+ });
18859
18929
  var CameraStatusSchema = object({
18860
18930
  deviceId: number(),
18861
18931
  assignment: CameraAssignmentStatusSchema,
@@ -19087,7 +19157,10 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
19087
19157
  }), CameraSwitchGroupSchema, {
19088
19158
  kind: "mutation",
19089
19159
  auth: "admin"
19090
- }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19160
+ }), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), DiskReconcileJobSchema, {
19161
+ kind: "mutation",
19162
+ auth: "admin"
19163
+ }), method(_void(), DiskReconcileJobSchema, { auth: "admin" }), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
19091
19164
  name: string(),
19092
19165
  description: string().optional(),
19093
19166
  config: CameraPipelineConfigSchema
@@ -20264,20 +20337,6 @@ var VectorStatsResultSchema = object({
20264
20337
  exact: boolean()
20265
20338
  });
20266
20339
  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);
20267
- /**
20268
- * `videoclips` — the unified, navigable-clip surface for a camera.
20269
- *
20270
- * A device-scoped WRAPPER cap (like `pipeline-analytics`): exactly one active
20271
- * provider per device, substitutable. The DEFAULT provider (registered by
20272
- * `addon-post-analysis`, `defaultActive: true`) composes the analytics event
20273
- * log (markers + thumbnails) with the recorder's `getPlaybackManifest` — a clip
20274
- * is a time-WINDOW over existing footage, never a separate file. A camera that
20275
- * exposes NATIVE onboard clips (Reolink/Hikvision NVR) can later substitute the
20276
- * wrapper provider for its device and serve its own clip catalog + URLs.
20277
- *
20278
- * A `Clip` is purely time-based (subtree-blind): playback resolves segments by
20279
- * temporal overlap, so the API never decides `continuous` vs `events`.
20280
- */
20281
20340
  var ClipSchema = object({
20282
20341
  /** Opaque, provider-namespaced id. The default provider encodes the time
20283
20342
  * window so `getClipPlayback` is self-contained (no event re-query). */
@@ -20294,8 +20353,57 @@ var ClipSchema = object({
20294
20353
  startMs: number(),
20295
20354
  endMs: number()
20296
20355
  }),
20297
- /** Thumbnail URL (lazy; e.g. analytics `getEventMedia`). Never inlined. */
20298
- thumbnail: string().optional()
20356
+ /**
20357
+ * Lazy thumbnail URL, never inlined.
20358
+ *
20359
+ * Recording-derived clips (events-mode keep-window, and the prepared
20360
+ * continuous event+fragment visit) MUST use the snapshot of the **main
20361
+ * event of the interval** — `getEventMedia({ eventId, kind: 'snapshot' })`
20362
+ * of the event that owns `kind` (object > motion > audio). Do not extract
20363
+ * a keyframe from the recorded segments. Other providers (onboard, HKSV)
20364
+ * mint their own stills.
20365
+ *
20366
+ * **VOUCHED, never fabricated.** A provider emits this only for an event it
20367
+ * has CONFIRMED owns at least one media row (its own, or its owning track's).
20368
+ * Absent is meaningful — "this visit has no event still" — never "we did not
20369
+ * look". Stamping it from a URL template made 35% of one camera's clips point
20370
+ * at a 404 (device 3836, 2026-08-17: 64 of 179 clips dead, 63 of them motion).
20371
+ * A read that FAILS drops the claim; it never invents it.
20372
+ */
20373
+ thumbnail: string().optional(),
20374
+ /**
20375
+ * An instant INSIDE this visit's footage, hole-safe, where a recorded still
20376
+ * can be decoded. Present whenever the visit came from recorded availability;
20377
+ * absent on a per-event padded window (there is no footage to promise).
20378
+ *
20379
+ * This is not a thumbnail and not a second byte path: it is the argument to
20380
+ * the recorder's existing still route. The surface — never the provider —
20381
+ * decides whether to use it. It is the midpoint of the visit's LONGEST
20382
+ * contiguous range, not of the visit: a visit spans its holes by
20383
+ * construction, so a naive midpoint lands in dead air.
20384
+ */
20385
+ stillAtMs: number().optional(),
20386
+ /**
20387
+ * Analytics event ids that overlap this visit — a BOUNDED sample, newest
20388
+ * first within kind (object → motion → audio), capped at
20389
+ * {@link MAX_CLIP_EVENT_IDS}. Empty on footage-only clips.
20390
+ *
20391
+ * Bounded because it is not a payload the surface pages through: one visit on
20392
+ * device 615 carried 2 345 ids, and `eventIds` was 99% of a 153 KB
20393
+ * camera-day. Read {@link eventCount} for the true total.
20394
+ */
20395
+ eventIds: array(string()).optional(),
20396
+ /** How many analytics events actually overlap this visit. Differs from
20397
+ * `eventIds.length` exactly when the sample was capped — so a truncated
20398
+ * list is never mistaken for a quiet visit. */
20399
+ eventCount: number().int().nonnegative().optional(),
20400
+ /** Intra-visit footage holes (GOP rolls, discarded segments) still shorter
20401
+ * than `VISIT_MERGE_GAP_MS`. Playback concatenates around them; the timeline
20402
+ * bar keeps showing them via `recording.getAvailability`. */
20403
+ holes: array(object({
20404
+ startMs: number(),
20405
+ endMs: number()
20406
+ })).optional()
20299
20407
  });
20300
20408
  var ClipPlaybackSchema = object({
20301
20409
  /** HLS master URL through the hub data-plane (Range + token in path). */
@@ -20759,7 +20867,14 @@ var SearchResultSchema = object({
20759
20867
  });
20760
20868
  var AutoUpdateSettingsSchema = object({
20761
20869
  channel: ChannelSchema,
20762
- intervalSeconds: number()
20870
+ intervalSeconds: number(),
20871
+ /**
20872
+ * Cadence of the "an update exists" POLLER, in seconds. Independent of
20873
+ * `channel`: the poller runs while auto-apply is `off`, because being told
20874
+ * about a publish and installing it are different decisions. Clamped
20875
+ * server-side to 900 s … 604800 s; defaults to 21600 s (6 h).
20876
+ */
20877
+ updateCheckIntervalSeconds: number()
20763
20878
  });
20764
20879
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20765
20880
  var RestartAddonResultSchema = unknown();
@@ -20900,7 +21015,9 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
20900
21015
  auth: "admin"
20901
21016
  }), method(_void(), AutoUpdateSettingsSchema, { auth: "admin" }), method(object({
20902
21017
  channel: ChannelSchema,
20903
- intervalSeconds: number().min(300).max(86400).optional()
21018
+ intervalSeconds: number().min(300).max(86400).optional(),
21019
+ /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
21020
+ updateCheckIntervalSeconds: number().min(900).max(604800).optional()
20904
21021
  }), unknown(), {
20905
21022
  kind: "mutation",
20906
21023
  auth: "admin"
@@ -21870,10 +21987,18 @@ settings: record(string(), unknown()) });
21870
21987
  * descriptive — it never changes routing.
21871
21988
  */
21872
21989
  var ConnectionTestDescriptorSchema = object({ label: string() });
21873
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
21874
- kind: "mutation",
21875
- auth: "admin"
21876
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
21990
+ var connectionTestCapability = {
21991
+ name: "connection-test",
21992
+ scope: "system",
21993
+ mode: "collection",
21994
+ methods: {
21995
+ testSettings: method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
21996
+ kind: "mutation",
21997
+ auth: "admin"
21998
+ }),
21999
+ describeTest: method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" })
22000
+ }
22001
+ };
21877
22002
  /**
21878
22003
  * Upstream-system connectivity sensor — distinct from `device-status`,
21879
22004
  * which is the kernel-managed online/offline flag for the device's
@@ -26581,7 +26706,9 @@ var ExportOptionsSchema = object({
26581
26706
  includeAudio: boolean(),
26582
26707
  maxLifeMs: number().int().positive(),
26583
26708
  deleteAfterDownload: boolean(),
26584
- title: string().max(200).optional()
26709
+ title: string().max(200).optional(),
26710
+ /** Notification-output target ids to ping when this export becomes ready. */
26711
+ notifyTargetIds: array(string().min(1)).max(20).optional()
26585
26712
  }).superRefine((v, ctx) => {
26586
26713
  if (v.speed !== void 0 && v.timelapse !== void 0) ctx.addIssue({
26587
26714
  code: ZodIssueCode.custom,
@@ -26640,10 +26767,18 @@ var ExportBytesSchema = object({
26640
26767
  });
26641
26768
  method(object({
26642
26769
  deviceId: number(),
26643
- profile: string(),
26770
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
26771
+ profile: string().optional(),
26772
+ profiles: array(string()).min(1).optional(),
26644
26773
  fromMs: number(),
26645
26774
  toMs: number(),
26646
26775
  options: ExportOptionsSchema
26776
+ }).superRefine((v, ctx) => {
26777
+ if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
26778
+ code: ZodIssueCode.custom,
26779
+ message: "pass profiles[] (min 1) or legacy profile",
26780
+ path: ["profiles"]
26781
+ });
26647
26782
  }), ExportRecordSchema, {
26648
26783
  kind: "mutation",
26649
26784
  auth: "protected"
@@ -29585,15 +29720,6 @@ var BaseDeviceProvider = class extends BaseAddon {
29585
29720
  labels: ["probe not implemented"]
29586
29721
  };
29587
29722
  }
29588
- /**
29589
- * Top-level devices restored at once in {@link onRestoreDevices}.
29590
- *
29591
- * Four covers the fleets this ships to without turning a boot into a burst a
29592
- * camera NVR answers with a refusal. A provider whose upstream is a single
29593
- * session with a serial command channel (a Baichuan hub, an NVR that
29594
- * serialises ISAPI) should lower it; nothing needs to raise it.
29595
- */
29596
- restoreConcurrency = 4;
29597
29723
  async restoreDevices(savedDevices) {
29598
29724
  await this.onRestoreDevices(savedDevices);
29599
29725
  if (savedDevices.length > 0) this.ctx.logger.info(`Restored ${savedDevices.length} ${this.providerName} device(s)`);
@@ -29648,14 +29774,7 @@ var BaseDeviceProvider = class extends BaseAddon {
29648
29774
  });
29649
29775
  }
29650
29776
  };
29651
- let nextTopLevel = 0;
29652
- await Promise.all(Array.from({ length: Math.min(Math.max(1, this.restoreConcurrency), topLevel.length) }, async () => {
29653
- for (;;) {
29654
- const saved = topLevel[nextTopLevel++];
29655
- if (saved === void 0) return;
29656
- await restoreOne(saved);
29657
- }
29658
- }));
29777
+ await Promise.all(topLevel.map((saved) => restoreOne(saved)));
29659
29778
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
29660
29779
  for (const saved of childRows) {
29661
29780
  const Class = this.deviceClasses[saved.type];
@@ -32928,6 +33047,12 @@ Object.freeze({
32928
33047
  addonId: null,
32929
33048
  access: "create"
32930
33049
  },
33050
+ "pipelineAnalytics.reconcileFromDisk": {
33051
+ capName: "pipeline-analytics",
33052
+ capScope: "device",
33053
+ addonId: null,
33054
+ access: "create"
33055
+ },
32931
33056
  "pipelineAnalytics.refreshStorageLocationsForMigration": {
32932
33057
  capName: "pipeline-analytics",
32933
33058
  capScope: "device",
@@ -33330,6 +33455,12 @@ Object.freeze({
33330
33455
  addonId: null,
33331
33456
  access: "view"
33332
33457
  },
33458
+ "pipelineOrchestrator.getReconcileFromDiskStatus": {
33459
+ capName: "pipeline-orchestrator",
33460
+ capScope: "system",
33461
+ addonId: null,
33462
+ access: "view"
33463
+ },
33333
33464
  "pipelineOrchestrator.listAgentSettings": {
33334
33465
  capName: "pipeline-orchestrator",
33335
33466
  capScope: "system",
@@ -33354,6 +33485,12 @@ Object.freeze({
33354
33485
  addonId: null,
33355
33486
  access: "create"
33356
33487
  },
33488
+ "pipelineOrchestrator.reconcileFromDisk": {
33489
+ capName: "pipeline-orchestrator",
33490
+ capScope: "system",
33491
+ addonId: null,
33492
+ access: "create"
33493
+ },
33357
33494
  "pipelineOrchestrator.removeAgentSettings": {
33358
33495
  capName: "pipeline-orchestrator",
33359
33496
  capScope: "system",
@@ -36345,6 +36482,11 @@ Object.freeze({
36345
36482
  form: "single",
36346
36483
  optional: true
36347
36484
  }],
36485
+ "pipelineAnalytics.reconcileFromDisk": [{
36486
+ name: "deviceId",
36487
+ form: "single",
36488
+ optional: false
36489
+ }],
36348
36490
  "pipelineAnalytics.restageRetrainTrack": [{
36349
36491
  name: "deviceId",
36350
36492
  form: "single",
@@ -37410,6 +37552,8 @@ DEFAULT_NATIVE_LEASE_SETTINGS.budgetMb;
37410
37552
  DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
37411
37553
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
37412
37554
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
37555
+ var MB = 1024 * 1024;
37556
+ 1024 * MB, 3072 * MB;
37413
37557
  //#endregion
37414
37558
  //#region ../../node_modules/@apocaliss92/wyze-bridge-js/dist/index.js
37415
37559
  var __require = /* @__PURE__ */ ((x) => typeof __require$1 !== "undefined" ? __require$1 : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof __require$1 !== "undefined" ? __require$1 : a)[b] }) : x)(function(x) {
@@ -40610,7 +40754,8 @@ var WyzeClientRegistry = class {
40610
40754
  credentials,
40611
40755
  cameraListCache: [],
40612
40756
  cameraListFetchedAt: 0,
40613
- cameraListInFlight: null
40757
+ cameraListInFlight: null,
40758
+ lastFetchError: null
40614
40759
  });
40615
40760
  }
40616
40761
  /** Drop the client for an integration that no longer exists / was disabled. */
@@ -40638,6 +40783,14 @@ var WyzeClientRegistry = class {
40638
40783
  this.#entries.clear();
40639
40784
  }
40640
40785
  /**
40786
+ * The last classified error from a `getCameraList` fetch failure for an
40787
+ * integration, or null when the last fetch succeeded (or no fetch has run
40788
+ * yet). Used by `getStatus` to surface the reason for an empty adoption list.
40789
+ */
40790
+ getLastFetchError(integrationId) {
40791
+ return this.#entries.get(integrationId)?.lastFetchError ?? null;
40792
+ }
40793
+ /**
40641
40794
  * Cloud camera list for ONE integration, cached + debounced + single-flight
40642
40795
  * to avoid auth rate-limits. Returns the last cache (possibly empty) when the
40643
40796
  * integration is unknown or the fetch fails.
@@ -40651,9 +40804,11 @@ var WyzeClientRegistry = class {
40651
40804
  const run = entry.client.getCameraList().then((cams) => {
40652
40805
  entry.cameraListCache = cams;
40653
40806
  entry.cameraListFetchedAt = Date.now();
40807
+ entry.lastFetchError = null;
40654
40808
  return cams;
40655
40809
  }).catch((err) => {
40656
40810
  const classified = classifyCloudError(err);
40811
+ entry.lastFetchError = classified;
40657
40812
  this.#deps.logger.error("Wyze getCameraList failed", { meta: {
40658
40813
  integrationId,
40659
40814
  kind: classified.kind,
@@ -41149,11 +41304,16 @@ function buildWyzeAdoptionProvider(deps) {
41149
41304
  let candidateCount = 0;
41150
41305
  for (const integrationId of listIntegrations()) candidateCount += (await candidatesForIntegration(integrationId)).length;
41151
41306
  const adoptedCount = (await listAdopted()).length;
41307
+ const fetchErrors = [];
41308
+ if (deps.getLastFetchError) for (const integrationId of listIntegrations()) {
41309
+ const err = deps.getLastFetchError(integrationId);
41310
+ if (err) fetchErrors.push(`[${integrationId}] ${err.message}`);
41311
+ }
41152
41312
  return {
41153
41313
  lastDiscoveryAt: Date.now(),
41154
41314
  candidateCount,
41155
41315
  adoptedCount,
41156
- lastError: null
41316
+ lastError: fetchErrors.length > 0 ? fetchErrors.join("; ") : null
41157
41317
  };
41158
41318
  } catch (err) {
41159
41319
  logger.warn("wyze adoption: getStatus failed", { meta: { error: errMsg(err) } });
@@ -41168,11 +41328,12 @@ function buildWyzeAdoptionProvider(deps) {
41168
41328
  refresh: async ({ integrationId }) => {
41169
41329
  const candidateCount = (await candidatesForIntegration(integrationId, true)).length;
41170
41330
  const adoptedCount = adoptedMapForIntegration(integrationId, await listAdopted()).size;
41331
+ const fetchErr = deps.getLastFetchError?.(integrationId);
41171
41332
  return {
41172
41333
  lastDiscoveryAt: Date.now(),
41173
41334
  candidateCount,
41174
41335
  adoptedCount,
41175
- lastError: null
41336
+ lastError: fetchErr ? fetchErr.message : null
41176
41337
  };
41177
41338
  },
41178
41339
  adopt: async ({ integrationId, childNativeIds, perCandidate }) => {
@@ -41904,6 +42065,139 @@ var WyzeCamera = class extends BaseDevice {
41904
42065
  static fromCloud = cameraConfigFromCloud;
41905
42066
  };
41906
42067
  //#endregion
42068
+ //#region src/wyze-connection-test.ts
42069
+ /**
42070
+ * Production default: creates a `WyzeCloud` with no-op session hooks so
42071
+ * `testSettings` never writes or reads `wyze-session.json`.
42072
+ */
42073
+ function defaultWyzeCloudFacadeFactory(credentials) {
42074
+ const cloud = new WyzeCloud({
42075
+ apiKey: credentials.apiKey,
42076
+ apiId: credentials.apiId,
42077
+ loadSession: () => null,
42078
+ saveSession: () => void 0,
42079
+ clearSession: () => void 0
42080
+ });
42081
+ return {
42082
+ ensureSession: (email, password) => cloud.ensureSession(email, password),
42083
+ getCameraList: () => cloud.getCameraList()
42084
+ };
42085
+ }
42086
+ var wyzeCredentialsSchema = object({
42087
+ email: string().min(1).describe("Wyze account email"),
42088
+ password: string().min(1).describe("Wyze account password"),
42089
+ apiKey: string().min(1).describe("Wyze developer API key"),
42090
+ apiId: string().min(1).describe("Wyze developer Key ID")
42091
+ });
42092
+ var TEST_LABEL = "Signs in to the Wyze cloud with these account credentials";
42093
+ function buildWyzeConnectionTestProvider(deps) {
42094
+ const { makeCloud, logger } = deps;
42095
+ return {
42096
+ describeTest: async () => ({ label: TEST_LABEL }),
42097
+ testSettings: async ({ settings }) => {
42098
+ const parsed = wyzeCredentialsSchema.safeParse(settings);
42099
+ if (!parsed.success) {
42100
+ const missing = parsed.error.issues.map((i) => i.path.join(".") || "(root)").join(", ");
42101
+ logger.warn("Wyze connection test: settings incomplete", { meta: { missing } });
42102
+ return {
42103
+ outcome: "rejected",
42104
+ error: `Wyze account settings are incomplete or invalid: ${missing}`
42105
+ };
42106
+ }
42107
+ const { email, password, apiKey, apiId } = parsed.data;
42108
+ const startedAt = Date.now();
42109
+ const cloud = makeCloud({
42110
+ email,
42111
+ password,
42112
+ apiKey,
42113
+ apiId
42114
+ });
42115
+ try {
42116
+ await cloud.ensureSession(email, password);
42117
+ let cameraCount = null;
42118
+ try {
42119
+ cameraCount = (await cloud.getCameraList()).length;
42120
+ } catch {}
42121
+ return {
42122
+ outcome: "validated",
42123
+ latencyMs: Date.now() - startedAt,
42124
+ ...cameraCount !== null ? { detail: `Found ${cameraCount} camera${cameraCount === 1 ? "" : "s"} on this account` } : {}
42125
+ };
42126
+ } catch (err) {
42127
+ const classified = classifyCloudError(err);
42128
+ if (classified.kind === "mfa") {
42129
+ logger.warn("Wyze connection test: MFA required", { meta: { email } });
42130
+ return {
42131
+ outcome: "rejected",
42132
+ error: classified.message
42133
+ };
42134
+ }
42135
+ if (classified.kind === "credentials") {
42136
+ logger.warn("Wyze connection test: credentials refused", { meta: { email } });
42137
+ return {
42138
+ outcome: "rejected",
42139
+ error: "Wyze refused these credentials — check the email, password, API Key and Key ID. " + classified.message
42140
+ };
42141
+ }
42142
+ logger.warn("Wyze connection test: could not complete", { meta: {
42143
+ email,
42144
+ kind: classified.kind,
42145
+ error: errMsg(err)
42146
+ } });
42147
+ return {
42148
+ outcome: "inconclusive",
42149
+ error: classified.kind === "rate-limited" ? `Could not verify credentials — rate-limited by the Wyze cloud. Retry in ~30 s. ${classified.message}` : `Could not reach the Wyze cloud to verify these credentials: ${errMsg(err)}`
42150
+ };
42151
+ }
42152
+ }
42153
+ };
42154
+ }
42155
+ //#endregion
42156
+ //#region src/wyze-tls-trust.ts
42157
+ /**
42158
+ * Ubuntu 24.04's `ca-certificates` (2026-06) dropped DigiCert Global Root CA
42159
+ * (the 2006 SHA-1-era root, still valid until 2031). Wyze's `*.wyzecam.com`
42160
+ * leaf is issued by "DigiCert TLS RSA SHA256 2020 CA1", which chains to that
42161
+ * root. Node fetch then fails with `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` and
42162
+ * the adoption panel shows an empty camera list.
42163
+ *
42164
+ * macOS still trusts this root in the system keychain, which is why the same
42165
+ * URL verifies on the developer Mac and fails inside the hub container.
42166
+ *
42167
+ * The PEM is DigiCert's public root (https://cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem).
42168
+ * Applied once per addon process via `tls.setDefaultCACertificates` — does
42169
+ * NOT disable verification, it only restores the missing root.
42170
+ */
42171
+ var DIGICERT_GLOBAL_ROOT_CA_PEM = `-----BEGIN CERTIFICATE-----
42172
+ MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
42173
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
42174
+ d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
42175
+ QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
42176
+ MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
42177
+ b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
42178
+ 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
42179
+ CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
42180
+ nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
42181
+ 43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
42182
+ T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
42183
+ gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
42184
+ BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
42185
+ TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
42186
+ DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
42187
+ hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
42188
+ 06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
42189
+ PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
42190
+ YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
42191
+ CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
42192
+ -----END CERTIFICATE-----
42193
+ `;
42194
+ var applied = false;
42195
+ function applyWyzeCloudTlsTrust() {
42196
+ if (applied) return;
42197
+ applied = true;
42198
+ setDefaultCACertificates([...getCACertificates(), DIGICERT_GLOBAL_ROOT_CA_PEM]);
42199
+ }
42200
+ //#endregion
41907
42201
  //#region src/addon.ts
41908
42202
  function getString(obj, key) {
41909
42203
  const v = obj[key];
@@ -41950,6 +42244,7 @@ var WyzeProviderAddon = class extends BaseDeviceProvider {
41950
42244
  super({});
41951
42245
  }
41952
42246
  async onInitialize() {
42247
+ applyWyzeCloudTlsTrust();
41953
42248
  const regs = await super.onInitialize();
41954
42249
  this.clients = new WyzeClientRegistry({
41955
42250
  dataDir: this.ctx.dataDir,
@@ -41971,10 +42266,17 @@ var WyzeProviderAddon = class extends BaseDeviceProvider {
41971
42266
  });
41972
42267
  await this.reconcileIntegrations();
41973
42268
  this.subscribeIntegrationLifecycle();
41974
- return [...regs, {
41975
- capability: deviceAdoptionCapability,
41976
- provider: this.buildAdoptionProvider()
41977
- }];
42269
+ return [
42270
+ ...regs,
42271
+ {
42272
+ capability: deviceAdoptionCapability,
42273
+ provider: this.buildAdoptionProvider()
42274
+ },
42275
+ {
42276
+ capability: connectionTestCapability,
42277
+ provider: this.buildConnectionTestProvider()
42278
+ }
42279
+ ];
41978
42280
  }
41979
42281
  async onShutdown() {
41980
42282
  this.clients?.clear();
@@ -42037,10 +42339,22 @@ var WyzeProviderAddon = class extends BaseDeviceProvider {
42037
42339
  this.wireCameraDeps(dev);
42038
42340
  await dev.materializeStreamSocket(camStreamId);
42039
42341
  }
42342
+ /**
42343
+ * Pre-creation credential check. Registered unconditionally — it must answer
42344
+ * BEFORE any integration for this addon exists, so it depends on nothing in
42345
+ * {@link WyzeClientRegistry} and opens its own throwaway session (no disk I/O).
42346
+ */
42347
+ buildConnectionTestProvider() {
42348
+ return buildWyzeConnectionTestProvider({
42349
+ makeCloud: defaultWyzeCloudFacadeFactory,
42350
+ logger: this.ctx.logger
42351
+ });
42352
+ }
42040
42353
  buildAdoptionProvider() {
42041
42354
  return buildWyzeAdoptionProvider({
42042
42355
  logger: this.ctx.logger,
42043
42356
  getCameraList: (integrationId, force) => this.requireClients().getCameraList(integrationId, force),
42357
+ getLastFetchError: (integrationId) => this.requireClients().getLastFetchError(integrationId),
42044
42358
  hasIntegration: (integrationId) => this.requireClients().has(integrationId),
42045
42359
  listIntegrations: () => this.requireClients().list(),
42046
42360
  listAdopted: async () => {