@camstack/addon-decoder-ffmpeg 1.1.9 → 1.1.11

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/index.js +675 -530
  2. package/dist/index.mjs +673 -528
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4635,7 +4635,7 @@ function _instanceof(cls, params = {}) {
4635
4635
  return inst;
4636
4636
  }
4637
4637
  //#endregion
4638
- //#region ../types/dist/sleep-CZDdRBua.mjs
4638
+ //#region ../types/dist/sleep-BC9Yqte7.mjs
4639
4639
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4640
4640
  EventCategory["SystemBoot"] = "system.boot";
4641
4641
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -4821,6 +4821,18 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
4821
4821
  */
4822
4822
  EventCategory["PipelineCameraUpdated"] = "pipeline.camera-updated";
4823
4823
  /**
4824
+ * The cluster camera-source OWNER changed (`clusterRoles.ingestNode`).
4825
+ * Emitted by addon-pipeline-orchestrator whenever it (re)derives node
4826
+ * capabilities — at boot, on agent online/offline, and on an ingest-node
4827
+ * flip. Carries the resolved `ownerNodeId`. The stream-broker consumes it to
4828
+ * keep its ingest-owner-gate decision current WITHOUT a per-`ensureBroker`
4829
+ * cross-process `getIngestOwner` query (push the authority's decision instead
4830
+ * of polling it on the hot path). Idempotent state — re-emitted on every
4831
+ * topology change, so a dropped event self-heals on the next one (plus the
4832
+ * broker's long backstop reconcile query).
4833
+ */
4834
+ EventCategory["PipelineIngestOwnerChanged"] = "pipeline.ingest-owner-changed";
4835
+ /**
4824
4836
  * Periodic snapshot of per-node pipeline-runner load
4825
4837
  * (`RunnerLocalLoad`). Emitted ~1Hz by every runner so UI dashboards
4826
4838
  * subscribe instead of polling `pipelineRunner.getLocalLoad`.
@@ -5344,10 +5356,6 @@ function hydrateField(field, values) {
5344
5356
  };
5345
5357
  }
5346
5358
  const rawValue = storedValue !== void 0 ? storedValue : defaultValue !== void 0 ? defaultValue : null;
5347
- if (field.type === "password") return {
5348
- ...field,
5349
- value: ""
5350
- };
5351
5359
  const value = field.type === "textarea" && field.isJson && rawValue !== null && typeof rawValue === "object" ? JSON.stringify(rawValue, null, 2) : rawValue;
5352
5360
  return {
5353
5361
  ...field,
@@ -6731,6 +6739,21 @@ function method(input, output, options) {
6731
6739
  timeoutMs: options?.timeoutMs
6732
6740
  };
6733
6741
  }
6742
+ /**
6743
+ * A wrapper/system-only method: served exclusively by the cap's system-level
6744
+ * provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
6745
+ * driver natives don't stub out a wrapper concern (e.g. a cross-device cache
6746
+ * overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
6747
+ */
6748
+ function systemMethod(input, output, options) {
6749
+ return {
6750
+ ...method(input, output, options),
6751
+ systemOnly: true
6752
+ };
6753
+ }
6754
+ var StaticDirOutputSchema$1 = object({ staticDir: string() });
6755
+ var VersionOutputSchema$1 = object({ version: string() });
6756
+ method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6734
6757
  var StaticDirOutputSchema = object({ staticDir: string() });
6735
6758
  var VersionOutputSchema = object({ version: string() });
6736
6759
  method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
@@ -6912,6 +6935,36 @@ var ModelFormatsSchema = object({
6912
6935
  tflite: ModelFormatEntrySchema.optional(),
6913
6936
  pt: ModelFormatEntrySchema.optional()
6914
6937
  });
6938
+ /**
6939
+ * Variant-selector grouping axes. Shared by the full `ModelCatalogEntry` and by
6940
+ * the reduced `PipelineModelOption` returned in `pipeline.getSchema()` so the
6941
+ * grouped Family→Tier→Variant picker renders identically in the config UI and
6942
+ * in the pipeline/device steppers. The flat `id` stays the source of truth for
6943
+ * resolution/download/persistence; this is a presentation overlay resolved back
6944
+ * to an `id`.
6945
+ */
6946
+ var ModelVariantGroupSchema = object({
6947
+ /** Top-level family, e.g. `yolo26` (later `d-fine`, `rf-detr`). */
6948
+ family: string(),
6949
+ /** Size within the family, e.g. `n` | `s` | `m` | `l`. */
6950
+ tier: string(),
6951
+ /** Quantization axis. Omit ⇒ the fp32 base build. */
6952
+ precision: _enum(["fp32", "int8"]).optional(),
6953
+ /**
6954
+ * Speed-optimization axis. Omit ⇒ the standard build. `fast` marks a
6955
+ * latency-optimized export (e.g. ReLU-activation variant) — the slot the
6956
+ * future performance variants plug into.
6957
+ */
6958
+ optimization: _enum(["standard", "fast"]).optional(),
6959
+ /**
6960
+ * Input-resolution axis (square input side, px). Omit ⇒ the family's native
6961
+ * resolution (640 for yolo26). Reduced-input builds (320 / 256) are a big,
6962
+ * cheap latency lever — especially on Apple ANE and the Intel N100 — at a
6963
+ * small-object accuracy cost. Mirrors the model's `inputSize` but lifted onto
6964
+ * the group so the selector can offer it as a variant axis.
6965
+ */
6966
+ resolution: number().int().positive().optional()
6967
+ });
6915
6968
  var ModelCatalogEntrySchema = object({
6916
6969
  id: string(),
6917
6970
  name: string(),
@@ -6941,7 +6994,43 @@ var ModelCatalogEntrySchema = object({
6941
6994
  * Auxiliary files required at runtime (labels JSON, charset dict, etc.).
6942
6995
  * Downloaded into the same modelsDir alongside the model file.
6943
6996
  */
6944
- extraFiles: array(ModelExtraFileSchema).readonly().optional()
6997
+ extraFiles: array(ModelExtraFileSchema).readonly().optional(),
6998
+ /**
6999
+ * LEGACY entry — retained in the catalog so a persisted operator selection
7000
+ * still RESOLVES (and can be re-activated), but hidden from the selectable
7001
+ * model list and excluded from the auto format-default pick. Set on the
7002
+ * superseded / consolidated models (older lineages, redundant fp16 IRs) so
7003
+ * the active lineup stays the coherent curated ladder without deleting a
7004
+ * model anyone may still be pinned to. `resolveModelForFormat` keeps honoring
7005
+ * an explicit legacy id that has a build for the node's format.
7006
+ */
7007
+ legacy: boolean().optional(),
7008
+ /**
7009
+ * Measured quality/latency metadata — populated from the benchmark addon on
7010
+ * the real node classes. Absent = not yet measured (most entries today; the
7011
+ * catalog historically carried only `sizeMB`, a poor cross-architecture
7012
+ * speed proxy). `p95LatencyMs` is keyed by node class (e.g. `n100`, `mac`).
7013
+ */
7014
+ metrics: object({
7015
+ map50: number().optional(),
7016
+ p95LatencyMs: record(string(), number()).optional()
7017
+ }).optional(),
7018
+ /**
7019
+ * SPDX-ish license id of the model weights (e.g. `AGPL-3.0` for Ultralytics
7020
+ * YOLO26, `GPL-3.0` for YOLOv9, `Apache-2.0` for D-FINE/RF-DETR). Matters for
7021
+ * the retraining addon and any future commercial distribution.
7022
+ */
7023
+ license: string().optional(),
7024
+ /**
7025
+ * Variant-selector grouping. The UI groups models by `family` + `tier` and
7026
+ * offers `precision` / `optimization` as variant axes WITHIN a tier — so all
7027
+ * of a family's sizes and quantizations collapse into one grouped picker
7028
+ * instead of a flat list of `yolo26s`, `yolo26s-int8`, … Absent ⇒ ungrouped
7029
+ * (legacy / custom models) — never shown in the grouped selector. The flat
7030
+ * `id` stays the source of truth for resolution/download/persistence; grouping
7031
+ * is a presentation overlay resolved back to an `id`.
7032
+ */
7033
+ group: ModelVariantGroupSchema.optional()
6945
7034
  });
6946
7035
  var ConvertTargetSchema = discriminatedUnion("format", [object({
6947
7036
  format: literal("openvino"),
@@ -7002,8 +7091,8 @@ var RecordingModeSchema = _enum([
7002
7091
  "onAudioThreshold"
7003
7092
  ]);
7004
7093
  /**
7005
- * First-class, authoritative per-camera storage mode — the netta choice the UI
7006
- * reads directly (never inferred from `rules`):
7094
+ * First-class, authoritative per-camera storage mode — the explicit choice the
7095
+ * UI reads directly (never inferred from `rules`):
7007
7096
  * - `off` — not recording.
7008
7097
  * - `events` — record only around triggers (motion / audio threshold),
7009
7098
  * with pre/post-buffer.
@@ -8651,26 +8740,13 @@ DeviceType.Light, method(object({
8651
8740
  percentage: number().min(0).max(100),
8652
8741
  lastChangedAt: number()
8653
8742
  });
8743
+ /** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
8654
8744
  var StreamFormatSchema = _enum([
8655
8745
  "webrtc",
8656
8746
  "hls",
8657
8747
  "mjpeg",
8658
8748
  "rtsp"
8659
8749
  ]);
8660
- var StreamInfoSchema = object({
8661
- streamId: string(),
8662
- format: StreamFormatSchema,
8663
- url: string().nullable(),
8664
- active: boolean()
8665
- });
8666
- method(object({
8667
- streamId: string(),
8668
- sourceUrl: string(),
8669
- codec: string().optional()
8670
- }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), _void(), { kind: "mutation" }), method(object({
8671
- streamId: string(),
8672
- format: StreamFormatSchema
8673
- }), string().nullable()), method(_void(), array(StreamInfoSchema));
8674
8750
  var RtspRestreamEntrySchema = object({
8675
8751
  brokerId: string(),
8676
8752
  url: string(),
@@ -9335,7 +9411,7 @@ var ConsumablesStatusSchema = object({
9335
9411
  })),
9336
9412
  lastChangedAt: number()
9337
9413
  });
9338
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, method(object({
9414
+ Object.values(DeviceType), method(object({
9339
9415
  deviceId: number().int().nonnegative(),
9340
9416
  key: string().min(1)
9341
9417
  }), _void(), {
@@ -10250,7 +10326,7 @@ var BoundingBoxSchema = object({
10250
10326
  w: number(),
10251
10327
  h: number()
10252
10328
  });
10253
- var SpatialDetectionSchema = object({
10329
+ object({
10254
10330
  class: string(),
10255
10331
  originalClass: string(),
10256
10332
  score: number(),
@@ -10385,7 +10461,6 @@ var PipelineDefaultStepSchema = lazy(() => object({
10385
10461
  enabled: boolean(),
10386
10462
  modelId: string(),
10387
10463
  children: array(PipelineDefaultStepSchema).readonly(),
10388
- engine: PipelineEngineChoiceSchema.optional(),
10389
10464
  group: string().optional(),
10390
10465
  settings: record(string(), unknown()).optional()
10391
10466
  }));
@@ -10410,7 +10485,9 @@ var PipelineModelOptionSchema = object({
10410
10485
  formats: record(string(), object({
10411
10486
  downloaded: boolean(),
10412
10487
  sizeMB: number()
10413
- }))
10488
+ })),
10489
+ group: ModelVariantGroupSchema.optional(),
10490
+ legacy: boolean().optional()
10414
10491
  });
10415
10492
  var ConfigFieldBridge = custom();
10416
10493
  var PipelineAddonSchemaSchema = object({
@@ -10424,6 +10501,7 @@ var PipelineAddonSchemaSchema = object({
10424
10501
  defaultModelId: string(),
10425
10502
  defaultModelIdByFormat: record(string(), string()).optional(),
10426
10503
  enabledByDefault: boolean().optional(),
10504
+ backfillIntoExistingOverrides: boolean().optional(),
10427
10505
  defaultConfidence: number(),
10428
10506
  group: string().optional(),
10429
10507
  configSchema: array(ConfigFieldBridge).readonly().optional()
@@ -10440,11 +10518,6 @@ var PipelineSchemaSchema = object({
10440
10518
  selectedEngine: PipelineEngineChoiceSchema,
10441
10519
  slots: array(PipelineSlotSchemaSchema).readonly()
10442
10520
  });
10443
- var DetectorOutputSchema = object({
10444
- detections: array(SpatialDetectionSchema).readonly(),
10445
- inferenceMs: number(),
10446
- modelId: string()
10447
- });
10448
10521
  var EngineProvisioningSchema = object({
10449
10522
  runtimeId: _enum([
10450
10523
  "onnx",
@@ -10461,15 +10534,42 @@ var EngineProvisioningSchema = object({
10461
10534
  ]),
10462
10535
  progress: number().optional(),
10463
10536
  error: string().optional(),
10464
- nextRetryAt: number().optional()
10537
+ nextRetryAt: number().optional(),
10538
+ /**
10539
+ * Gate A (config-correctness gate at engine change): human-readable
10540
+ * config issues surfaced EAGERLY when the node's engine changes — model
10541
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
10542
+ * has a <format> build"). Additive/optional: informational only, never
10543
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
10544
+ * Absent/empty when the node-default tree resolves cleanly.
10545
+ */
10546
+ configIssues: array(string()).optional()
10465
10547
  });
10466
10548
  var PipelineStepInputSchema = lazy(() => object({
10467
10549
  addonId: string(),
10468
- modelId: string(),
10550
+ modelId: string().optional(),
10469
10551
  enabled: boolean().default(true),
10470
10552
  children: array(PipelineStepInputSchema).optional(),
10471
10553
  settings: record(string(), unknown()).optional()
10472
10554
  }));
10555
+ var ModelSubstitutionSchema = object({
10556
+ addonId: string(),
10557
+ chosen: string(),
10558
+ running: string(),
10559
+ format: string()
10560
+ });
10561
+ var PipelineValidationIssueSchema = object({
10562
+ addonId: string(),
10563
+ kind: _enum(["unknown-addon", "no-format-build"]),
10564
+ detail: string()
10565
+ });
10566
+ var PipelineValidationResultSchema = object({
10567
+ ok: boolean(),
10568
+ issues: array(PipelineValidationIssueSchema).readonly(),
10569
+ substitutions: array(ModelSubstitutionSchema).readonly(),
10570
+ /** The node's `currentEngine.format` this validation ran against. */
10571
+ format: string()
10572
+ });
10473
10573
  var ReferenceImageEntrySchema = object({
10474
10574
  filename: string(),
10475
10575
  stepIds: array(string()).readonly().optional()
@@ -10540,7 +10640,13 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10540
10640
  })) }), object({ success: literal(true) }), {
10541
10641
  kind: "mutation",
10542
10642
  auth: "admin"
10543
- }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
10643
+ }), method(object({ nodeId: string() }), object({
10644
+ success: literal(true),
10645
+ clearedDevices: number()
10646
+ }), {
10647
+ kind: "mutation",
10648
+ auth: "admin"
10649
+ }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({ steps: array(PipelineStepInputSchema) }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
10544
10650
  name: string(),
10545
10651
  steps: array(PipelineTemplateStepSchema).readonly(),
10546
10652
  engine: PipelineEngineChoiceSchema
@@ -10557,10 +10663,6 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10557
10663
  modelId: string(),
10558
10664
  format: ModelFormatSchema$1
10559
10665
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
10560
- addonId: string(),
10561
- frame: FrameInputSchema,
10562
- config: record(string(), unknown()).optional()
10563
- }), DetectorOutputSchema), method(object({
10564
10666
  engine: PipelineEngineChoiceSchema.optional(),
10565
10667
  steps: array(PipelineStepInputSchema).min(1),
10566
10668
  frame: FrameInputSchema.optional(),
@@ -10706,6 +10808,25 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(ZoneSchema).read
10706
10808
  auth: "admin"
10707
10809
  }), object({ zones: array(ZoneSchema).readonly() });
10708
10810
  /**
10811
+ * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
10812
+ * decode worker resolves it against the RETAINED native frame's real pixel dims,
10813
+ * so the caller supplies only the detection-res bbox divided by the detection
10814
+ * dims — no native resolution to plumb.
10815
+ */
10816
+ var NativeCropBboxSchema = object({
10817
+ x: number(),
10818
+ y: number(),
10819
+ w: number(),
10820
+ h: number()
10821
+ });
10822
+ /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
10823
+ var NativeCropResultSchema = object({
10824
+ /** Packed rgb (24-bit) pixels of the crop. */
10825
+ bytes: _instanceof(Uint8Array),
10826
+ width: number().int().positive(),
10827
+ height: number().int().positive()
10828
+ });
10829
+ /**
10709
10830
  * Per-camera tunable ranges + defaults. Single source of truth used
10710
10831
  * by both the Zod data schema (validation + default fallback) and
10711
10832
  * the device settings UI (slider min/max/step). Touch one place and
@@ -10800,6 +10921,13 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
10800
10921
  kind: literal("remote-restream"),
10801
10922
  /** The camera's source-owner node (slice 1: always the hub). */
10802
10923
  ownerNodeId: string(),
10924
+ /**
10925
+ * The owner's LAN-reachable host, resolved by the orchestrator from the
10926
+ * per-node `reachableHost` override (Cluster UI). When present the runner
10927
+ * dials THIS host for the owner's restream, in preference to the
10928
+ * `CAMSTACK_HUB_URL`-derived default. Absent → auto-detect fallback.
10929
+ */
10930
+ ownerReachableHost: string().optional(),
10803
10931
  /** Operator override for the owner host the runner dials. */
10804
10932
  hubHostnameOverride: string().optional()
10805
10933
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
@@ -10808,13 +10936,11 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
10808
10936
  * specific runner instance via `attachCamera`. Carries everything the
10809
10937
  * runner needs to subscribe to the local broker and execute inference.
10810
10938
  *
10811
- * Stateless-pipeline model: the full pipeline content (`engine`, `steps`,
10812
- * optional `audio`) travels with the attach payload. The runner keeps it
10813
- * in RAM for the lifetime of the attach — on rebalance, edit, or
10814
- * restart the orchestrator re-sends the latest snapshot.
10815
- *
10816
- * `engine`/`steps`/`audio` are optional during the additive migration
10817
- * window; once orchestrator + UI are migrated they become required.
10939
+ * Stateless-pipeline model: the pipeline content (`steps`, optional
10940
+ * `audio`) travels with the attach payload. The runner keeps it in RAM
10941
+ * for the lifetime of the attach — on rebalance, edit, or restart the
10942
+ * orchestrator re-sends the latest snapshot. Engine is NOT carried: it is
10943
+ * node-local, resolved by the executing runner at dispatch time.
10818
10944
  */
10819
10945
  var RunnerCameraConfigSchema = object({
10820
10946
  deviceId: number(),
@@ -10865,14 +10991,11 @@ var RunnerCameraConfigSchema = object({
10865
10991
  */
10866
10992
  motionSources: MotionSourcesSchema.default(["analyzer"]),
10867
10993
  pipelineEnabled: boolean().default(true),
10868
- /** Engine choice for video steps (runtime+backend+format). */
10869
- engine: PipelineEngineChoiceSchema.optional(),
10870
10994
  /** Ordered tree of video steps. Absent → runner skips video detection. */
10871
10995
  steps: array(PipelineStepInputSchema).readonly().optional(),
10872
10996
  /** Audio classification branch. `enabled:false` disables, null skips. */
10873
10997
  audio: object({
10874
- engine: PipelineEngineChoiceSchema,
10875
- modelId: string(),
10998
+ modelId: string().optional(),
10876
10999
  enabled: boolean()
10877
11000
  }).nullable().optional(),
10878
11001
  /**
@@ -10959,7 +11082,11 @@ var RunnerLocalMetricsSchema = object({
10959
11082
  avgInferenceTimeMs: number(),
10960
11083
  queueDepth: number()
10961
11084
  });
10962
- method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mutation" }), method(object({ deviceId: number() }), object({ success: literal(true) }), { kind: "mutation" }), method(ReportMotionInputSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), RunnerLocalLoadSchema), method(_void(), RunnerLocalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(_void(), array(CameraMetricsWithDeviceIdSchema).readonly()), method(_void(), array(number()).readonly());
11085
+ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mutation" }), method(object({ deviceId: number() }), object({ success: literal(true) }), { kind: "mutation" }), method(ReportMotionInputSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), RunnerLocalLoadSchema), method(_void(), RunnerLocalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(_void(), array(CameraMetricsWithDeviceIdSchema).readonly()), method(_void(), array(number()).readonly()), method(object({
11086
+ handle: FrameHandleSchema,
11087
+ bbox: NativeCropBboxSchema,
11088
+ maxWidth: number().int().positive().optional()
11089
+ }), NativeCropResultSchema.nullable());
10963
11090
  object({
10964
11091
  detected: boolean(),
10965
11092
  /** Ms epoch of the last detected-true observation. Null if never detected. */
@@ -12253,7 +12380,9 @@ var AddonPageDeclarationSchema$1 = object({
12253
12380
  icon: string(),
12254
12381
  path: string(),
12255
12382
  remoteName: string(),
12256
- bundle: string()
12383
+ bundle: string(),
12384
+ section: string().optional(),
12385
+ sectionLabel: string().optional()
12257
12386
  });
12258
12387
  var AddonPageInfoSchema = object({
12259
12388
  addonId: string(),
@@ -12293,7 +12422,18 @@ var AddonPageDeclarationSchema = object({
12293
12422
  * the static-file route can compute an mtime-based cache-buster URL
12294
12423
  * without a separate filesystem stat.
12295
12424
  */
12296
- bundle: string()
12425
+ bundle: string(),
12426
+ /**
12427
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
12428
+ * `'cluster'`, `'administration'` — the page renders inside that group.
12429
+ * Any OTHER string creates (or joins) a custom section rendered after
12430
+ * the built-in groups; its label comes from `sectionLabel` (first
12431
+ * declaration wins), falling back to the id. Absent → the legacy
12432
+ * "Addon Pages" group.
12433
+ */
12434
+ section: string().optional(),
12435
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
12436
+ sectionLabel: string().optional()
12297
12437
  });
12298
12438
  method(_void(), array(AddonPageDeclarationSchema).readonly());
12299
12439
  var AddonHttpRouteSchema = object({
@@ -12509,6 +12649,17 @@ var WidgetMetadataSchema = object({
12509
12649
  deviceContext: boolean().default(false),
12510
12650
  integrationContext: boolean().default(false)
12511
12651
  }),
12652
+ /**
12653
+ * Loadable BEFORE authentication. The normal widget registry listing
12654
+ * (`addon-widgets.listWidgets`) is auth-gated, so a pre-auth surface
12655
+ * (the login page) cannot discover a widget through it. A widget that
12656
+ * declares `preAuth: true` marks itself as safe to mount on a pre-auth
12657
+ * screen — it is surfaced through the PUBLIC `auth.listLoginMethods`
12658
+ * login-method contribution channel (see `login-method.cap.ts`) rather
12659
+ * than the authenticated registry, and its bundle is served by the
12660
+ * public `/api/addon-widgets/:addonId/*` static route. Defaults false.
12661
+ */
12662
+ preAuth: boolean().optional().default(false),
12512
12663
  /** Dashboard placement HINTS (operator can override per instance). */
12513
12664
  defaultSize: WidgetSizeEnum.default("md"),
12514
12665
  allowedSizes: array(WidgetSizeEnum).readonly().default([
@@ -12847,6 +12998,66 @@ method(object({
12847
12998
  password: string()
12848
12999
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
12849
13000
  /**
13001
+ * `login-method` — collection cap through which auth addons contribute
13002
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
13003
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
13004
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
13005
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
13006
+ * procedure aggregates them for the unauthenticated login page.
13007
+ *
13008
+ * A contribution is a discriminated union on `kind`:
13009
+ *
13010
+ * - `redirect` — a declarative button. The login page renders a generic
13011
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
13012
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
13013
+ * ZERO shell-side JS. A future SSO addon plugs in the same way — the
13014
+ * login page needs NO change.
13015
+ *
13016
+ * - `widget` — a Module-Federation widget the login page mounts (via
13017
+ * `loadRemoteBundle`) for an in-page ceremony. Covers the passkey
13018
+ * login ceremony, which must run `@simplewebauthn/browser` INSIDE the
13019
+ * addon bundle. The referenced widget also declares `preAuth: true` in
13020
+ * its `addon-widgets-source` catalog entry. `auth.listLoginMethods`
13021
+ * stamps a public `bundleUrl` from `addonId` + `bundle`.
13022
+ *
13023
+ * Every contribution carries a `stage`:
13024
+ * - `primary` — shown on the first credentials screen (OIDC /
13025
+ * magic-link buttons; a future usernameless passkey).
13026
+ * - `second-factor` — shown AFTER the password leg, gated on the
13027
+ * returned `factors` (passkey-as-2FA today).
13028
+ *
13029
+ * `mount: skip` — the cap is read server-side by the core auth router
13030
+ * (`registry.getCollection('login-method')`), never mounted as its own
13031
+ * tRPC router.
13032
+ */
13033
+ /** When a login method renders in the two-phase login flow. */
13034
+ var LoginStageEnum = _enum(["primary", "second-factor"]);
13035
+ /** One login-method contribution — redirect button OR pre-auth widget. */
13036
+ var LoginMethodContributionSchema = discriminatedUnion("kind", [object({
13037
+ kind: literal("redirect"),
13038
+ /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
13039
+ id: string(),
13040
+ /** Operator-facing button label. */
13041
+ label: string(),
13042
+ /** lucide-react icon name. */
13043
+ icon: string().optional(),
13044
+ /** Addon-owned HTTP route the button navigates to (GET). */
13045
+ startUrl: string(),
13046
+ stage: LoginStageEnum
13047
+ }), object({
13048
+ kind: literal("widget"),
13049
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
13050
+ id: string(),
13051
+ /** Owning addon id — drives the public bundle URL + the MF namespace. */
13052
+ addonId: string(),
13053
+ /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
13054
+ bundle: string(),
13055
+ /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
13056
+ remote: WidgetRemoteSchema,
13057
+ stage: LoginStageEnum
13058
+ })]);
13059
+ method(_void(), array(LoginMethodContributionSchema).readonly());
13060
+ /**
12850
13061
  * Orchestrator-side destination metadata. The orchestrator computes
12851
13062
  * `id = <addonId>:<subId>` from its provider lookup so consumers
12852
13063
  * (admin UI, restore flow) see one canonical key.
@@ -15043,7 +15254,17 @@ var TrackSchema = object({
15043
15254
  /** Cumulative normalized distance travelled (0..1 units = full frame width). */
15044
15255
  totalDistance: number(),
15045
15256
  state: TrackStateSchema,
15046
- active: boolean()
15257
+ active: boolean(),
15258
+ /** Deterministic key-event importance score in [0,1] (server-computed at
15259
+ * track expiry, recomputed on late label). Absent on legacy rows written
15260
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
15261
+ importance: number().optional(),
15262
+ /** Id of the track's highest-confidence ObjectEvent (its representative
15263
+ * "best" frame). Absent when the track produced no object events. */
15264
+ bestEventId: string().optional(),
15265
+ /** Tag of the importance sub-signal that dominated the score
15266
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
15267
+ importanceReason: string().optional()
15047
15268
  });
15048
15269
  var BaseEventFields = {
15049
15270
  id: string(),
@@ -15108,8 +15329,18 @@ var ObjectEventSchema = object({
15108
15329
  frameHeight: number().optional(),
15109
15330
  /** MediaStore key for the crop attached to this event (if any). */
15110
15331
  mediaKey: string().optional(),
15332
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
15333
+ * best-detection full frame). Resolve via the event-media data-plane
15334
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
15335
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
15336
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
15337
+ keyFrameMediaKey: string().optional(),
15111
15338
  /** Populated by B5 (recording playback URL for this event). */
15112
- mediaUrl: string().optional()
15339
+ mediaUrl: string().optional(),
15340
+ /** The parent track's key-event importance [0,1], propagated to every object
15341
+ * event of the track (so an event row can be sorted by importance without a
15342
+ * track join). Absent on legacy rows / before the track was scored. */
15343
+ importance: number().optional()
15113
15344
  });
15114
15345
  var AudioEventSchema = object({
15115
15346
  ...BaseEventFields,
@@ -15133,7 +15364,8 @@ var MediaFileKindEnum = _enum([
15133
15364
  "fullFrame",
15134
15365
  "fullFrameBoxed",
15135
15366
  "faceCrop",
15136
- "plateCrop"
15367
+ "plateCrop",
15368
+ "keyFrame"
15137
15369
  ]);
15138
15370
  var MediaFileSchema = object({
15139
15371
  key: string(),
@@ -15154,6 +15386,32 @@ var DeviceEventQueryInput = object({
15154
15386
  projection: _enum(["full", "slim"]).optional()
15155
15387
  });
15156
15388
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
15389
+ var KeyEventQueryInput = object({
15390
+ deviceId: number(),
15391
+ /** Window lower bound (track firstSeen ≥ since). */
15392
+ since: number(),
15393
+ /** Window upper bound (track firstSeen ≤ until). */
15394
+ until: number(),
15395
+ limit: number().int().min(1).max(200).default(50),
15396
+ /** Drop tracks scoring below this importance. */
15397
+ minImportance: number().min(0).max(1).optional(),
15398
+ /** Restrict to a single class (e.g. 'person'). */
15399
+ classFilter: string().optional()
15400
+ });
15401
+ var KeyEventSchema = object({
15402
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
15403
+ id: string(),
15404
+ trackId: string(),
15405
+ /** Track start time (firstSeen). */
15406
+ timestamp: number(),
15407
+ className: string(),
15408
+ label: string().optional(),
15409
+ importance: number(),
15410
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
15411
+ bestEventId: string(),
15412
+ /** Track lifetime in ms (lastSeen - firstSeen). */
15413
+ windowMs: number().optional()
15414
+ });
15157
15415
  var TrackedDetectionSchema = object({
15158
15416
  trackId: string(),
15159
15417
  className: string(),
@@ -15183,7 +15441,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
15183
15441
  }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
15184
15442
  kind: "mutation",
15185
15443
  auth: "admin"
15186
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({
15444
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
15187
15445
  deviceId: number(),
15188
15446
  since: number(),
15189
15447
  until: number(),
@@ -15228,11 +15486,11 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
15228
15486
  timestamp: number()
15229
15487
  });
15230
15488
  var CameraPipelineConfigSchema = object({
15231
- engine: PipelineEngineChoiceSchema,
15489
+ engine: PipelineEngineChoiceSchema.optional(),
15232
15490
  steps: array(PipelineStepInputSchema).readonly(),
15233
15491
  audio: object({
15234
- engine: PipelineEngineChoiceSchema,
15235
- modelId: string(),
15492
+ engine: PipelineEngineChoiceSchema.optional(),
15493
+ modelId: string().optional(),
15236
15494
  enabled: boolean(),
15237
15495
  settings: record(string(), unknown()).readonly().optional()
15238
15496
  }).nullable().optional()
@@ -15247,7 +15505,7 @@ var PipelineTemplateSchema = object({
15247
15505
  });
15248
15506
  var AgentAddonConfigSchema = object({
15249
15507
  enabled: boolean(),
15250
- modelId: string(),
15508
+ modelId: string().optional(),
15251
15509
  settings: record(string(), unknown()).readonly()
15252
15510
  });
15253
15511
  var AgentPipelineSettingsSchema = object({
@@ -15257,12 +15515,25 @@ var AgentPipelineSettingsSchema = object({
15257
15515
  detectWeight: number().positive().optional(),
15258
15516
  /** Node is eligible to run the detection pipeline (decode + inference). */
15259
15517
  detect: boolean().optional(),
15260
- /** Node is eligible to host decoder sessions. */
15518
+ /**
15519
+ * DEPRECATED AND IGNORED. Decode is always co-located with its frame
15520
+ * consumer, so decode eligibility IS detect eligibility. Kept optional in
15521
+ * the schema ONLY so persisted stores written before the removal still
15522
+ * parse — no code reads it and no write path emits it.
15523
+ */
15261
15524
  decode: boolean().optional(),
15262
15525
  /** Node is eligible to run audio-analyzer sessions. */
15263
15526
  audio: boolean().optional(),
15264
15527
  /** Node is eligible to be the ingest / source-owner (serve the restream). */
15265
- ingest: boolean().optional()
15528
+ ingest: boolean().optional(),
15529
+ /**
15530
+ * Operator override for the LAN host a cross-node decoder dials to reach
15531
+ * THIS node's restream (Cluster UI). Absent → auto-detect: a remote runner
15532
+ * falls back to its `CAMSTACK_HUB_URL`-derived host (the Moleculer address
15533
+ * it already uses to reach the hub). Set this only when the auto-detected
15534
+ * address is wrong (multi-homed host, NAT, custom interface).
15535
+ */
15536
+ reachableHost: string().optional()
15266
15537
  });
15267
15538
  var CameraPipelineForAgentSchema = object({
15268
15539
  steps: array(PipelineStepInputSchema).readonly(),
@@ -15310,25 +15581,6 @@ var PipelineAssignmentSchema = object({
15310
15581
  assignedAt: number()
15311
15582
  });
15312
15583
  /**
15313
- * Decoder placement record. Symmetric to `PipelineAssignmentSchema` but for
15314
- * the decoder-node placement domain (`balanceDecoder` decision: manual pin
15315
- * → co-located with pipeline → capacity).
15316
- */
15317
- var DecoderAssignmentSchema = object({
15318
- deviceId: number(),
15319
- /** Moleculer node id of the decoder provider currently responsible for this camera. */
15320
- decoderNodeId: string(),
15321
- /** True when the assignment was set manually via `assignDecoder`, false when chosen by the balancer. */
15322
- pinned: boolean(),
15323
- /** Why this assignment was made — useful for debugging the decoder balancer. */
15324
- reason: _enum([
15325
- "manual",
15326
- "co-located",
15327
- "capacity",
15328
- "hardware-affinity"
15329
- ])
15330
- });
15331
- /**
15332
15584
  * Per-agent load summary surfaced to the load balancer + dashboards.
15333
15585
  * Aggregated from each runner's `getLocalLoad` cap call.
15334
15586
  */
@@ -15368,6 +15620,15 @@ var GlobalMetricsSchema = object({
15368
15620
  * capability providers.
15369
15621
  */
15370
15622
  var CapabilityBindingsSchema = record(string(), string());
15623
+ /**
15624
+ * The cluster's single camera-source owner (`clusterRoles.ingestNode`) plus
15625
+ * its LAN-reachable host, if one is registered. See `getIngestOwner`.
15626
+ */
15627
+ var IngestOwnerSchema = object({
15628
+ ownerNodeId: string(),
15629
+ reachableHost: string().optional(),
15630
+ configIssue: string().optional()
15631
+ });
15371
15632
  /** Source block — always present; derives from the stream catalog. */
15372
15633
  var CameraSourceStatusSchema = object({ streams: array(object({
15373
15634
  camStreamId: string(),
@@ -15382,6 +15643,14 @@ var CameraAssignmentStatusSchema = object({
15382
15643
  detectionNodeId: string().nullable(),
15383
15644
  decoderNodeId: string().nullable(),
15384
15645
  audioNodeId: string().nullable(),
15646
+ /**
15647
+ * The node that OWNS this camera's physical source pull (dials the RTSP and
15648
+ * hosts the broker/restream) — the cluster ingest owner today
15649
+ * (`clusterRoles.ingestNode`), per-camera once source assignment lands. Lets
15650
+ * the UI show WHERE a camera is sourced without SSH/logs, and is the node the
15651
+ * broker block below was read from (pinned). Nullable only pre-wiring.
15652
+ */
15653
+ sourceNodeId: string().nullable(),
15385
15654
  pinned: object({
15386
15655
  detection: boolean(),
15387
15656
  decoder: boolean(),
@@ -15514,16 +15783,7 @@ method(object({
15514
15783
  }), object({ success: literal(true) }), {
15515
15784
  kind: "mutation",
15516
15785
  auth: "admin"
15517
- }), method(object({
15518
- deviceId: number(),
15519
- nodeId: string()
15520
- }), _void(), {
15521
- kind: "mutation",
15522
- auth: "admin"
15523
- }), method(object({ deviceId: number() }), _void(), {
15524
- kind: "mutation",
15525
- auth: "admin"
15526
- }), method(_void(), array(DecoderAssignmentSchema).readonly()), method(object({
15786
+ }), method(_void(), IngestOwnerSchema), method(object({
15527
15787
  deviceId: number(),
15528
15788
  nodeId: string()
15529
15789
  }), object({ success: literal(true) }), {
@@ -15544,10 +15804,7 @@ method(object({
15544
15804
  nodeId: string(),
15545
15805
  pinned: boolean(),
15546
15806
  assignedAt: number()
15547
- }))), method(object({
15548
- deviceId: number(),
15549
- pipelineNodeId: string().optional()
15550
- }), DecoderAssignmentSchema), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
15807
+ }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
15551
15808
  nodeId: string(),
15552
15809
  settings: AgentPipelineSettingsSchema
15553
15810
  })).readonly()), method(object({
@@ -15577,12 +15834,26 @@ method(object({
15577
15834
  }), method(object({
15578
15835
  agentNodeId: string(),
15579
15836
  detect: boolean().nullable().optional(),
15580
- decode: boolean().nullable().optional(),
15581
15837
  audio: boolean().nullable().optional(),
15582
15838
  ingest: boolean().nullable().optional()
15583
15839
  }), object({ success: literal(true) }), {
15584
15840
  kind: "mutation",
15585
15841
  auth: "admin"
15842
+ }), method(object({
15843
+ agentNodeId: string(),
15844
+ reachableHost: string().nullable()
15845
+ }), object({ success: literal(true) }), {
15846
+ kind: "mutation",
15847
+ auth: "admin"
15848
+ }), method(object({ agentNodeId: string() }), object({
15849
+ success: literal(true),
15850
+ /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
15851
+ effectiveModelId: string().nullable(),
15852
+ /** Number of cameras whose node-scoped overrides were cleared. */
15853
+ clearedCameraOverrides: number()
15854
+ }), {
15855
+ kind: "mutation",
15856
+ auth: "admin"
15586
15857
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
15587
15858
  deviceId: number(),
15588
15859
  addonId: string(),
@@ -15627,22 +15898,131 @@ method(object({
15627
15898
  kind: "mutation",
15628
15899
  auth: "admin"
15629
15900
  });
15630
- var RegisteredStreamSchema = object({
15631
- streamId: string(),
15632
- label: string().optional(),
15633
- codec: string(),
15634
- type: _enum(["video", "audio"]),
15635
- sourceUrl: string()
15901
+ /**
15902
+ * server-management — per-NODE singleton capability for a node's ROOT
15903
+ * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
15904
+ * agents).
15905
+ *
15906
+ * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
15907
+ * on agents) carries the whole software stack in its npm dep tree, so ONE
15908
+ * version describes the node. Updates install into
15909
+ * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
15910
+ * starter (probation boot + auto-rollback to N-1).
15911
+ *
15912
+ * Providers:
15913
+ * - HUB: `ServerUpdateService` behind the `server-provided` mount
15914
+ * (`buildServerProviders` in trpc.router.ts) — the default target for
15915
+ * unpinned calls.
15916
+ * - AGENT: `AgentUpdateService` registered by the agent bootstrap under
15917
+ * the synthetic `agent-runtime` addonId and declared in the agent's
15918
+ * `$hub.registerNode` manifest.
15919
+ *
15920
+ * Node routing: singleton caps get the codegen/runtime-builder `nodeId`
15921
+ * injection on every method — `input.nodeId` (or `nodePin(nodeId)` from the
15922
+ * SDK) routes the call to that node's provider via the standard remote
15923
+ * proxy (`createCapabilityProxy` → `$agent-cap-fwd` → the agent's
15924
+ * in-process provider lookup). No `nodeId` → the hub's own provider.
15925
+ *
15926
+ * Spec: docs/superpowers/specs/2026-07-12-runtime-updatable-node-packages-design.md
15927
+ */
15928
+ /**
15929
+ * Where the running hub's code was loaded from:
15930
+ * - `workspace` — dev checkout (tsx / workspace dist); the starter defers to
15931
+ * plain resolution and runtime updates are refused.
15932
+ * - `baked` — the immutable image seed closure (no data-dir root active).
15933
+ * - `data-root` — the runtime-updatable `<dataDir>/server-root` closure.
15934
+ */
15935
+ var ServerBootModeSchema = _enum([
15936
+ "workspace",
15937
+ "baked",
15938
+ "data-root"
15939
+ ]);
15940
+ /**
15941
+ * Update lifecycle state:
15942
+ * - `idle` / `checking` / `staging` — steady / in-flight registry work.
15943
+ * - `pending-restart` — a version is staged and the node has NOT yet
15944
+ * restarted onto it (still running the OLD version).
15945
+ * - `awaiting-confirmation` — the node HAS restarted onto the staged version
15946
+ * (it is the active probation boot) and is waiting to confirm boot-health.
15947
+ * Apply/rollback are refused in this state and the node must NOT be
15948
+ * manually restarted, or the probation boot auto-rolls-back.
15949
+ */
15950
+ var ServerUpdateStateSchema = _enum([
15951
+ "idle",
15952
+ "checking",
15953
+ "staging",
15954
+ "pending-restart",
15955
+ "awaiting-confirmation"
15956
+ ]);
15957
+ var ServerRollbackInfoSchema = object({
15958
+ /** The version that failed (or was manually rolled back). */
15959
+ fromVersion: string(),
15960
+ /** The version rolled back to; null = the baked seed. */
15961
+ toVersion: string().nullable(),
15962
+ atMs: number(),
15963
+ reason: string()
15636
15964
  });
15637
- var ExposedResourceSchema = object({
15638
- streamId: string(),
15639
- format: string(),
15640
- value: string()
15965
+ var ServerPackageStatusSchema = object({
15966
+ /** Root package name (`@camstack/server` on the hub). */
15967
+ packageName: string(),
15968
+ /** Version of the code the running process ACTUALLY loaded. */
15969
+ runningVersion: string().nullable(),
15970
+ /** Node.js runtime version the node's process runs on (`process.versions.node`). */
15971
+ nodeRuntimeVersion: string().nullable(),
15972
+ /** Active data-dir root version; null when booted from seed/workspace. */
15973
+ activeVersion: string().nullable(),
15974
+ /** N-1 version kept for rollback; null when no previous version exists. */
15975
+ previousVersion: string().nullable(),
15976
+ /** Version of the immutable baked seed closure (image fallback). */
15977
+ seedVersion: string().nullable(),
15978
+ /** Latest registry version from the most recent check (null = never checked). */
15979
+ latestVersion: string().nullable(),
15980
+ updateAvailable: boolean(),
15981
+ bootMode: ServerBootModeSchema,
15982
+ updateState: ServerUpdateStateSchema,
15983
+ /** Version staged + awaiting its probation boot, when one is pending. */
15984
+ pendingVersion: string().nullable(),
15985
+ /** Set when the last freshly-activated version failed its boot health-check. */
15986
+ rolledBack: ServerRollbackInfoSchema.nullable(),
15987
+ /**
15988
+ * True when `server-root/state.json` EXISTS but is unreadable/corrupt — the
15989
+ * hub is running from the baked seed (or workspace) while installed data-dir
15990
+ * versions are being IGNORED. Surfaced as a warning in the UI.
15991
+ */
15992
+ stateFileCorrupt: boolean(),
15993
+ lastCheckedAtMs: number().nullable()
15994
+ });
15995
+ var ServerUpdateCheckResultSchema = object({
15996
+ packageName: string(),
15997
+ runningVersion: string().nullable(),
15998
+ latestVersion: string().nullable(),
15999
+ updateAvailable: boolean(),
16000
+ checkedAtMs: number(),
16001
+ /** Non-null when the registry lookup failed (offline, bad registry, …). */
16002
+ error: string().nullable()
16003
+ });
16004
+ var ServerUpdateActionResultSchema = object({
16005
+ accepted: boolean(),
16006
+ targetVersion: string().nullable(),
16007
+ /** True when a graceful restart was scheduled to apply the change. */
16008
+ restarting: boolean(),
16009
+ message: string()
16010
+ });
16011
+ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
16012
+ kind: "mutation",
16013
+ auth: "admin"
16014
+ }), method(object({
16015
+ /** Explicit target version; omitted = latest from the registry. */
16016
+ version: string().optional() }), ServerUpdateActionResultSchema, {
16017
+ kind: "mutation",
16018
+ auth: "admin"
16019
+ }), method(_void(), ServerUpdateActionResultSchema, {
16020
+ kind: "mutation",
16021
+ auth: "admin"
16022
+ }), method(_void(), ServerUpdateActionResultSchema, {
16023
+ kind: "mutation",
16024
+ auth: "admin"
15641
16025
  });
15642
- method(object({
15643
- deviceId: number(),
15644
- streams: array(RegisteredStreamSchema).readonly()
15645
- }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), array(ExposedResourceSchema).readonly());
15646
16026
  /**
15647
16027
  * Query filter for settings-store collections.
15648
16028
  */
@@ -15795,9 +16175,9 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
15795
16175
  /**
15796
16176
  * A single device snapshot returned as base64 JPEG/PNG.
15797
16177
  *
15798
- * Shared with the `snapshot-provider` collection cap the orchestrator
15799
- * receives the same shape from each native provider and from the
15800
- * broker-based fallback.
16178
+ * The `SnapshotAddon` wrapper returns this shape whether the frame came from
16179
+ * the device-native provider (onboard capture) or from the stream-broker
16180
+ * prebuffer fallback.
15801
16181
  */
15802
16182
  var SnapshotImageSchema = object({
15803
16183
  base64: string(),
@@ -15828,11 +16208,12 @@ DeviceType.Camera, method(object({
15828
16208
  }), SnapshotImageSchema.nullable()), method(object({ deviceId: number() }), _void(), {
15829
16209
  kind: "mutation",
15830
16210
  auth: "admin"
15831
- });
15832
- method(object({ deviceId: number() }), boolean()), method(object({
16211
+ }), systemMethod(object({ deviceIds: array(number()).min(1).max(200) }), array(object({
15833
16212
  deviceId: number(),
15834
- streamId: string().optional()
15835
- }), SnapshotImageSchema.nullable());
16213
+ lastCapturedAt: number().nullable(),
16214
+ cacheAgeMs: number().nullable(),
16215
+ etag: string().nullable()
16216
+ })));
15836
16217
  /**
15837
16218
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
15838
16219
  * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
@@ -16083,10 +16464,32 @@ method(_void(), array(TurnServerSchema).readonly());
16083
16464
  * b. `finishAuthentication({userId, response})` → server verifies
16084
16465
  * the assertion, bumps the credential counter, returns ok.
16085
16466
  *
16467
+ * 2b. Usernameless (discoverable-credential) authentication — the
16468
+ * passkey IS the primary factor, no password leg:
16469
+ * a. `beginDiscoverableAuthentication({})` → assertion options with
16470
+ * EMPTY `allowCredentials` (the browser offers every resident
16471
+ * passkey it holds for this RP) + `userVerification: 'required'`
16472
+ * (the passkey replaces both factors, so UV is mandatory).
16473
+ * The challenge is stored server-side, NOT bound to any user.
16474
+ * b. `finishDiscoverableAuthentication({response})` → the provider
16475
+ * resolves the credential by the response's credential id,
16476
+ * verifies the assertion against the stored challenge + that
16477
+ * credential's public key/counter, and returns the OWNING
16478
+ * `userId` — the caller (core auth router) mints the session.
16479
+ *
16086
16480
  * 3. Management:
16087
16481
  * - `listPasskeys({userId})` — enumerate user's enrolled credentials.
16088
16482
  * - `removePasskey({userId, credentialId})` — revoke one credential.
16089
16483
  *
16484
+ * 4. Second-factor preference (opt-in, default OFF):
16485
+ * Enrolling a passkey only enables passkey-FIRST sign-in. It is
16486
+ * demanded as a second factor after a password login ONLY when the
16487
+ * user explicitly opts in via `setSecondFactorPreference`.
16488
+ * - `getSecondFactorPreference({userId})` → `{ enabled }` (missing
16489
+ * row ⇒ `enabled: false`).
16490
+ * - `setSecondFactorPreference({userId, enabled})` — persisted by
16491
+ * the providing addon beside its credentials.
16492
+ *
16090
16493
  * Challenges are short-lived (5 min, in-memory). The cap is internal —
16091
16494
  * the admin-ui composes the begin/finish round-trip and never exposes
16092
16495
  * the cap to non-admins.
@@ -16129,6 +16532,17 @@ method(object({
16129
16532
  }), object({ verified: boolean() }), {
16130
16533
  kind: "mutation",
16131
16534
  access: "view"
16535
+ }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
16536
+ kind: "mutation",
16537
+ access: "view"
16538
+ }), method(object({
16539
+ /** AuthenticationResponseJSON from the browser. */
16540
+ response: record(string(), unknown()) }), object({
16541
+ verified: boolean(),
16542
+ userId: string().nullable()
16543
+ }), {
16544
+ kind: "mutation",
16545
+ access: "view"
16132
16546
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
16133
16547
  userId: string(),
16134
16548
  credentialId: string()
@@ -16136,6 +16550,13 @@ method(object({
16136
16550
  kind: "mutation",
16137
16551
  auth: "admin",
16138
16552
  access: "delete"
16553
+ }), method(object({ userId: string() }), object({ enabled: boolean() }), { auth: "admin" }), method(object({
16554
+ userId: string(),
16555
+ enabled: boolean()
16556
+ }), object({ success: literal(true) }), {
16557
+ kind: "mutation",
16558
+ auth: "admin",
16559
+ access: "create"
16139
16560
  });
16140
16561
  /**
16141
16562
  * `videoclips` — the unified, navigable-clip surface for a camera.
@@ -16193,9 +16614,10 @@ method(object({
16193
16614
  auth: "admin"
16194
16615
  });
16195
16616
  /**
16196
- * Optional client-side hints sent at session creation to help the
16197
- * provider pick the best native source. All fields are optional —
16198
- * a viewer that knows nothing still gets a sane default.
16617
+ * Optional client-side hints sent at session creation to help the provider
16618
+ * pick the best native source. All fields optional — a viewer that knows
16619
+ * nothing still gets a sane default. (Relocated from the retired `webrtc`
16620
+ * collection cap; this `webrtc-session` cap is the live signaling surface.)
16199
16621
  */
16200
16622
  var webrtcClientHintsSchema = object({
16201
16623
  viewportWidth: number().int().positive().optional(),
@@ -16206,22 +16628,6 @@ var webrtcClientHintsSchema = object({
16206
16628
  /** Hard tier override; takes precedence over scoring when registered. */
16207
16629
  prefersTier: string().optional()
16208
16630
  }).partial();
16209
- method(object({
16210
- streamId: string(),
16211
- sdpOffer: string()
16212
- }), string(), { kind: "mutation" }), method(object({ streamId: string() }), boolean()), method(object({
16213
- streamId: string(),
16214
- codec: string()
16215
- }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), _void(), { kind: "mutation" }), method(object({
16216
- streamId: string(),
16217
- hints: webrtcClientHintsSchema.optional()
16218
- }), object({
16219
- sessionId: string(),
16220
- sdpOffer: string()
16221
- }), { kind: "mutation" }), method(object({
16222
- sessionId: string(),
16223
- sdpAnswer: string()
16224
- }), _void(), { kind: "mutation" }), method(object({ sessionId: string() }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), boolean());
16225
16631
  /**
16226
16632
  * Discriminated target for a WebRTC session. The client sends this
16227
16633
  * structured object instead of building / parsing brokerId strings;
@@ -16952,7 +17358,17 @@ var FaceInfoSchema = object({
16952
17358
  recognizedIdentityId: string().optional(),
16953
17359
  identityName: string().optional(),
16954
17360
  assigned: boolean(),
16955
- base64: string().optional()
17361
+ base64: string().optional(),
17362
+ /** Design B: the face bbox (pixel space) on the key frame — lets a detail
17363
+ * view draw the box over the native `keyFrameMediaKey` frame. Absent on
17364
+ * legacy rows written before design B. */
17365
+ faceBbox: BoundingBoxSchema.optional(),
17366
+ /** Design B: MediaStore key of the track's native-resolution key frame.
17367
+ * Fetch the native JPEG via the event-media data-plane
17368
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
17369
+ * track produced no key frame (e.g. native/onboard source) — the UI falls
17370
+ * back to the inline `base64` face crop. */
17371
+ keyFrameMediaKey: string().optional()
16956
17372
  });
16957
17373
  var FaceFilterEnum = _enum([
16958
17374
  "unassigned",
@@ -17649,6 +18065,16 @@ var TopologyCategorySchema = object({
17649
18065
  healthy: number(),
17650
18066
  addons: array(TopologyCategoryAddonSchema).readonly()
17651
18067
  });
18068
+ /**
18069
+ * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
18070
+ * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
18071
+ * version visibility for the Server management surface. Nullable: offline
18072
+ * rows and pre-phase-2 nodes report none.
18073
+ */
18074
+ var TopologyRootPackageSchema = object({
18075
+ name: string(),
18076
+ version: string()
18077
+ });
17652
18078
  var TopologyNodeSchema = object({
17653
18079
  id: string(),
17654
18080
  name: string(),
@@ -17672,7 +18098,8 @@ var TopologyNodeSchema = object({
17672
18098
  status: string()
17673
18099
  })).readonly(),
17674
18100
  processes: array(TopologyProcessSchema).readonly(),
17675
- categories: array(TopologyCategorySchema).readonly()
18101
+ categories: array(TopologyCategorySchema).readonly(),
18102
+ rootPackage: TopologyRootPackageSchema.nullable()
17676
18103
  });
17677
18104
  var CapUsageEdgeSchema = object({
17678
18105
  callerAddonId: string(),
@@ -20472,6 +20899,12 @@ Object.freeze({
20472
20899
  addonId: null,
20473
20900
  access: "create"
20474
20901
  },
20902
+ "loginMethod.getLoginMethods": {
20903
+ capName: "login-method",
20904
+ capScope: "system",
20905
+ addonId: null,
20906
+ access: "view"
20907
+ },
20475
20908
  "mediaPlayer.next": {
20476
20909
  capName: "media-player",
20477
20910
  capScope: "device",
@@ -21054,6 +21487,12 @@ Object.freeze({
21054
21487
  addonId: null,
21055
21488
  access: "view"
21056
21489
  },
21490
+ "pipelineAnalytics.getKeyEvents": {
21491
+ capName: "pipeline-analytics",
21492
+ capScope: "device",
21493
+ addonId: null,
21494
+ access: "view"
21495
+ },
21057
21496
  "pipelineAnalytics.getMotionEvents": {
21058
21497
  capName: "pipeline-analytics",
21059
21498
  capScope: "device",
@@ -21102,23 +21541,23 @@ Object.freeze({
21102
21541
  addonId: null,
21103
21542
  access: "create"
21104
21543
  },
21105
- "pipelineExecutor.deleteModel": {
21544
+ "pipelineExecutor.clearDeviceOverrides": {
21106
21545
  capName: "pipeline-executor",
21107
21546
  capScope: "system",
21108
21547
  addonId: null,
21109
21548
  access: "delete"
21110
21549
  },
21111
- "pipelineExecutor.deleteTemplate": {
21550
+ "pipelineExecutor.deleteModel": {
21112
21551
  capName: "pipeline-executor",
21113
21552
  capScope: "system",
21114
21553
  addonId: null,
21115
21554
  access: "delete"
21116
21555
  },
21117
- "pipelineExecutor.detect": {
21556
+ "pipelineExecutor.deleteTemplate": {
21118
21557
  capName: "pipeline-executor",
21119
21558
  capScope: "system",
21120
21559
  addonId: null,
21121
- access: "view"
21560
+ access: "delete"
21122
21561
  },
21123
21562
  "pipelineExecutor.downloadModel": {
21124
21563
  capName: "pipeline-executor",
@@ -21312,13 +21751,13 @@ Object.freeze({
21312
21751
  addonId: null,
21313
21752
  access: "create"
21314
21753
  },
21315
- "pipelineOrchestrator.assignAudio": {
21316
- capName: "pipeline-orchestrator",
21754
+ "pipelineExecutor.validatePipeline": {
21755
+ capName: "pipeline-executor",
21317
21756
  capScope: "system",
21318
21757
  addonId: null,
21319
- access: "create"
21758
+ access: "view"
21320
21759
  },
21321
- "pipelineOrchestrator.assignDecoder": {
21760
+ "pipelineOrchestrator.assignAudio": {
21322
21761
  capName: "pipeline-orchestrator",
21323
21762
  capScope: "system",
21324
21763
  addonId: null,
@@ -21402,19 +21841,13 @@ Object.freeze({
21402
21841
  addonId: null,
21403
21842
  access: "view"
21404
21843
  },
21405
- "pipelineOrchestrator.getDecoderAssignment": {
21406
- capName: "pipeline-orchestrator",
21407
- capScope: "system",
21408
- addonId: null,
21409
- access: "view"
21410
- },
21411
- "pipelineOrchestrator.getDecoderAssignments": {
21844
+ "pipelineOrchestrator.getGlobalMetrics": {
21412
21845
  capName: "pipeline-orchestrator",
21413
21846
  capScope: "system",
21414
21847
  addonId: null,
21415
21848
  access: "view"
21416
21849
  },
21417
- "pipelineOrchestrator.getGlobalMetrics": {
21850
+ "pipelineOrchestrator.getIngestOwner": {
21418
21851
  capName: "pipeline-orchestrator",
21419
21852
  capScope: "system",
21420
21853
  addonId: null,
@@ -21456,6 +21889,12 @@ Object.freeze({
21456
21889
  addonId: null,
21457
21890
  access: "delete"
21458
21891
  },
21892
+ "pipelineOrchestrator.resetNodePipelineDefaults": {
21893
+ capName: "pipeline-orchestrator",
21894
+ capScope: "system",
21895
+ addonId: null,
21896
+ access: "delete"
21897
+ },
21459
21898
  "pipelineOrchestrator.resolvePipeline": {
21460
21899
  capName: "pipeline-orchestrator",
21461
21900
  capScope: "system",
@@ -21492,37 +21931,37 @@ Object.freeze({
21492
21931
  addonId: null,
21493
21932
  access: "create"
21494
21933
  },
21495
- "pipelineOrchestrator.setCameraPipelineForAgent": {
21934
+ "pipelineOrchestrator.setAgentReachableHost": {
21496
21935
  capName: "pipeline-orchestrator",
21497
21936
  capScope: "system",
21498
21937
  addonId: null,
21499
21938
  access: "create"
21500
21939
  },
21501
- "pipelineOrchestrator.setCameraStepOverride": {
21940
+ "pipelineOrchestrator.setCameraPipelineForAgent": {
21502
21941
  capName: "pipeline-orchestrator",
21503
21942
  capScope: "system",
21504
21943
  addonId: null,
21505
21944
  access: "create"
21506
21945
  },
21507
- "pipelineOrchestrator.setCameraStepToggle": {
21946
+ "pipelineOrchestrator.setCameraStepOverride": {
21508
21947
  capName: "pipeline-orchestrator",
21509
21948
  capScope: "system",
21510
21949
  addonId: null,
21511
21950
  access: "create"
21512
21951
  },
21513
- "pipelineOrchestrator.setCapabilityBinding": {
21952
+ "pipelineOrchestrator.setCameraStepToggle": {
21514
21953
  capName: "pipeline-orchestrator",
21515
21954
  capScope: "system",
21516
21955
  addonId: null,
21517
21956
  access: "create"
21518
21957
  },
21519
- "pipelineOrchestrator.unassignAudio": {
21958
+ "pipelineOrchestrator.setCapabilityBinding": {
21520
21959
  capName: "pipeline-orchestrator",
21521
21960
  capScope: "system",
21522
21961
  addonId: null,
21523
21962
  access: "create"
21524
21963
  },
21525
- "pipelineOrchestrator.unassignDecoder": {
21964
+ "pipelineOrchestrator.unassignAudio": {
21526
21965
  capName: "pipeline-orchestrator",
21527
21966
  capScope: "system",
21528
21967
  addonId: null,
@@ -21582,6 +22021,12 @@ Object.freeze({
21582
22021
  addonId: null,
21583
22022
  access: "view"
21584
22023
  },
22024
+ "pipelineRunner.getNativeCrop": {
22025
+ capName: "pipeline-runner",
22026
+ capScope: "system",
22027
+ addonId: null,
22028
+ access: "view"
22029
+ },
21585
22030
  "pipelineRunner.reportMotion": {
21586
22031
  capName: "pipeline-runner",
21587
22032
  capScope: "system",
@@ -21822,33 +22267,45 @@ Object.freeze({
21822
22267
  addonId: null,
21823
22268
  access: "create"
21824
22269
  },
21825
- "restreamer.getExposedResources": {
21826
- capName: "restreamer",
22270
+ "scriptRunner.run": {
22271
+ capName: "script-runner",
22272
+ capScope: "device",
22273
+ addonId: null,
22274
+ access: "create"
22275
+ },
22276
+ "scriptRunner.stop": {
22277
+ capName: "script-runner",
22278
+ capScope: "device",
22279
+ addonId: null,
22280
+ access: "create"
22281
+ },
22282
+ "serverManagement.applyServerUpdate": {
22283
+ capName: "server-management",
21827
22284
  capScope: "system",
21828
22285
  addonId: null,
21829
- access: "view"
22286
+ access: "create"
21830
22287
  },
21831
- "restreamer.registerDevice": {
21832
- capName: "restreamer",
22288
+ "serverManagement.checkServerUpdate": {
22289
+ capName: "server-management",
21833
22290
  capScope: "system",
21834
22291
  addonId: null,
21835
22292
  access: "create"
21836
22293
  },
21837
- "restreamer.unregisterDevice": {
21838
- capName: "restreamer",
22294
+ "serverManagement.getServerPackageStatus": {
22295
+ capName: "server-management",
21839
22296
  capScope: "system",
21840
22297
  addonId: null,
21841
- access: "delete"
22298
+ access: "view"
21842
22299
  },
21843
- "scriptRunner.run": {
21844
- capName: "script-runner",
21845
- capScope: "device",
22300
+ "serverManagement.restartServer": {
22301
+ capName: "server-management",
22302
+ capScope: "system",
21846
22303
  addonId: null,
21847
22304
  access: "create"
21848
22305
  },
21849
- "scriptRunner.stop": {
21850
- capName: "script-runner",
21851
- capScope: "device",
22306
+ "serverManagement.rollbackServerUpdate": {
22307
+ capName: "server-management",
22308
+ capScope: "system",
21852
22309
  addonId: null,
21853
22310
  access: "create"
21854
22311
  },
@@ -21936,23 +22393,17 @@ Object.freeze({
21936
22393
  addonId: null,
21937
22394
  access: "view"
21938
22395
  },
21939
- "snapshot.invalidateCache": {
22396
+ "snapshot.getSnapshotOverview": {
21940
22397
  capName: "snapshot",
21941
22398
  capScope: "device",
21942
22399
  addonId: null,
21943
- access: "create"
21944
- },
21945
- "snapshotProvider.getSnapshot": {
21946
- capName: "snapshot-provider",
21947
- capScope: "system",
21948
- addonId: null,
21949
22400
  access: "view"
21950
22401
  },
21951
- "snapshotProvider.supportsDevice": {
21952
- capName: "snapshot-provider",
21953
- capScope: "system",
22402
+ "snapshot.invalidateCache": {
22403
+ capName: "snapshot",
22404
+ capScope: "device",
21954
22405
  addonId: null,
21955
- access: "view"
22406
+ access: "create"
21956
22407
  },
21957
22408
  "ssoBridge.signBridgeToken": {
21958
22409
  capName: "sso-bridge",
@@ -22380,30 +22831,6 @@ Object.freeze({
22380
22831
  addonId: null,
22381
22832
  access: "view"
22382
22833
  },
22383
- "streamingEngine.getStreamUrl": {
22384
- capName: "streaming-engine",
22385
- capScope: "system",
22386
- addonId: null,
22387
- access: "view"
22388
- },
22389
- "streamingEngine.listStreams": {
22390
- capName: "streaming-engine",
22391
- capScope: "system",
22392
- addonId: null,
22393
- access: "view"
22394
- },
22395
- "streamingEngine.registerStream": {
22396
- capName: "streaming-engine",
22397
- capScope: "system",
22398
- addonId: null,
22399
- access: "create"
22400
- },
22401
- "streamingEngine.unregisterStream": {
22402
- capName: "streaming-engine",
22403
- capScope: "system",
22404
- addonId: null,
22405
- access: "delete"
22406
- },
22407
22834
  "streamParams.getConfigSchema": {
22408
22835
  capName: "stream-params",
22409
22836
  capScope: "device",
@@ -22650,6 +23077,12 @@ Object.freeze({
22650
23077
  addonId: null,
22651
23078
  access: "view"
22652
23079
  },
23080
+ "userPasskeys.beginDiscoverableAuthentication": {
23081
+ capName: "user-passkeys",
23082
+ capScope: "system",
23083
+ addonId: null,
23084
+ access: "view"
23085
+ },
22653
23086
  "userPasskeys.beginRegistration": {
22654
23087
  capName: "user-passkeys",
22655
23088
  capScope: "system",
@@ -22662,12 +23095,24 @@ Object.freeze({
22662
23095
  addonId: null,
22663
23096
  access: "view"
22664
23097
  },
23098
+ "userPasskeys.finishDiscoverableAuthentication": {
23099
+ capName: "user-passkeys",
23100
+ capScope: "system",
23101
+ addonId: null,
23102
+ access: "view"
23103
+ },
22665
23104
  "userPasskeys.finishRegistration": {
22666
23105
  capName: "user-passkeys",
22667
23106
  capScope: "system",
22668
23107
  addonId: null,
22669
23108
  access: "create"
22670
23109
  },
23110
+ "userPasskeys.getSecondFactorPreference": {
23111
+ capName: "user-passkeys",
23112
+ capScope: "system",
23113
+ addonId: null,
23114
+ access: "view"
23115
+ },
22671
23116
  "userPasskeys.listPasskeys": {
22672
23117
  capName: "user-passkeys",
22673
23118
  capScope: "system",
@@ -22680,6 +23125,12 @@ Object.freeze({
22680
23125
  addonId: null,
22681
23126
  access: "delete"
22682
23127
  },
23128
+ "userPasskeys.setSecondFactorPreference": {
23129
+ capName: "user-passkeys",
23130
+ capScope: "system",
23131
+ addonId: null,
23132
+ access: "create"
23133
+ },
22683
23134
  "vacuumControl.locate": {
22684
23135
  capName: "vacuum-control",
22685
23136
  capScope: "device",
@@ -22752,6 +23203,18 @@ Object.freeze({
22752
23203
  addonId: null,
22753
23204
  access: "view"
22754
23205
  },
23206
+ "viewerUi.getStaticDir": {
23207
+ capName: "viewer-ui",
23208
+ capScope: "system",
23209
+ addonId: null,
23210
+ access: "view"
23211
+ },
23212
+ "viewerUi.getVersion": {
23213
+ capName: "viewer-ui",
23214
+ capScope: "system",
23215
+ addonId: null,
23216
+ access: "view"
23217
+ },
22755
23218
  "waterHeater.setAway": {
22756
23219
  capName: "water-heater",
22757
23220
  capScope: "device",
@@ -22770,54 +23233,6 @@ Object.freeze({
22770
23233
  addonId: null,
22771
23234
  access: "create"
22772
23235
  },
22773
- "webrtc.closeSession": {
22774
- capName: "webrtc",
22775
- capScope: "system",
22776
- addonId: null,
22777
- access: "create"
22778
- },
22779
- "webrtc.createSession": {
22780
- capName: "webrtc",
22781
- capScope: "system",
22782
- addonId: null,
22783
- access: "create"
22784
- },
22785
- "webrtc.handleAnswer": {
22786
- capName: "webrtc",
22787
- capScope: "system",
22788
- addonId: null,
22789
- access: "create"
22790
- },
22791
- "webrtc.handleOffer": {
22792
- capName: "webrtc",
22793
- capScope: "system",
22794
- addonId: null,
22795
- access: "create"
22796
- },
22797
- "webrtc.hasAdaptiveBitrate": {
22798
- capName: "webrtc",
22799
- capScope: "system",
22800
- addonId: null,
22801
- access: "view"
22802
- },
22803
- "webrtc.registerStream": {
22804
- capName: "webrtc",
22805
- capScope: "system",
22806
- addonId: null,
22807
- access: "create"
22808
- },
22809
- "webrtc.supportsStream": {
22810
- capName: "webrtc",
22811
- capScope: "system",
22812
- addonId: null,
22813
- access: "view"
22814
- },
22815
- "webrtc.unregisterStream": {
22816
- capName: "webrtc",
22817
- capScope: "system",
22818
- addonId: null,
22819
- access: "delete"
22820
- },
22821
23236
  "webrtcSession.addIceCandidate": {
22822
23237
  capName: "webrtc-session",
22823
23238
  capScope: "device",
@@ -23515,276 +23930,6 @@ var FrameDropper = class {
23515
23930
  }
23516
23931
  };
23517
23932
  //#endregion
23518
- //#region src/frame-ring-sink.ts
23519
- /**
23520
- * `DecoderFrameRingSink` — the decoder's shared-memory write side (Phase 5 / D9).
23521
- *
23522
- * When a decoder session is configured with `frameSink: 'shm'`, the decoder
23523
- * **owns** the shared-memory ring segment for that stream: it creates the
23524
- * segment on the first decoded frame (when the output geometry is known),
23525
- * writes every subsequent decoded frame into the ring via a `FrameRingWriter`,
23526
- * and closes + unlinks the segment when the session is destroyed.
23527
- *
23528
- * What leaves the decoder is no longer the pixel `Buffer` — it is a tiny,
23529
- * serialisable `FrameHandle` (`FrameRingWriter.writeFrame`'s return value).
23530
- * Same-host consumers (motion, detection, the WebRTC encoder) open the same
23531
- * segment with a `FrameRingReader` and read the pixels zero-copy.
23532
- *
23533
- * ## Lazy segment creation
23534
- *
23535
- * The segment cannot be sized until the first frame: `slotByteLength` is
23536
- * `width × height × bytesPerPixel`, and the output dimensions are only known
23537
- * once the scaler has produced its first `dstFrame`. So `writeFrame` is a
23538
- * no-op-until-armed: the first call sizes + creates the segment, every later
23539
- * call writes into it.
23540
- *
23541
- * ## Resolution-change decision
23542
- *
23543
- * A live camera stream can change resolution mid-stream (the decoder's scaler
23544
- * is rebuilt on a config toggle, or the source renegotiates). The slot is
23545
- * sized for the **first** frame's geometry. A later frame that no longer fits
23546
- * the slot triggers a **segment re-create**: the old segment is closed +
23547
- * unlinked and a fresh, larger segment is created under a new generation-tagged
23548
- * name. This is simpler and leak-free versus over-allocating slots for a
23549
- * worst-case 4K frame on every stream; resolution changes on a live camera are
23550
- * rare, and a brief gap while consumers re-open the segment is acceptable
23551
- * (latest-wins — a missed frame is correct behaviour).
23552
- */
23553
- /**
23554
- * Per-ring shared-memory budget (MB) — the slot count is derived per-resolution
23555
- * from this budget via {@link deriveSlotCount}, so a 360p stream gets many
23556
- * slots and a 4K stream a few, both inside the same memory footprint.
23557
- *
23558
- * Read ONCE at module load from `CAMSTACK_SHM_RING_BUDGET_MB`; a non-finite or
23559
- * non-positive value falls back to the 16 MB default.
23560
- *
23561
- * The default is deliberately small (16 MB) so many concurrent per-camera rings
23562
- * fit inside a bounded `/dev/shm`. The decoder output is capped at 640px wide, so
23563
- * a slot is ≤ ~920 KB and 16 MB still yields ~17–70 latest-wins slots. A ring
23564
- * segment larger than the container's `/dev/shm` tmpfs backing (Docker default is
23565
- * only 64 MB) faults an **uncatchable SIGBUS** on write past `st_size` — the old
23566
- * 128 MB default overflowed a 64 MB `/dev/shm` and crashed the decoder on 8MP
23567
- * streams. Pair this with a `--shm-size` that scales with concurrent-decode load.
23568
- */
23569
- var RING_BUDGET_MB = (() => {
23570
- const raw = Number(process.env["CAMSTACK_SHM_RING_BUDGET_MB"]);
23571
- return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 16;
23572
- })();
23573
- /** {@link RING_BUDGET_MB} in bytes — the budget passed to `deriveSlotCount`. */
23574
- var RING_BUDGET_BYTES = RING_BUDGET_MB * 1024 * 1024;
23575
- /** A unique, stable shared-memory segment name for a decoder stream.
23576
- *
23577
- * macOS POSIX shm names are capped at ~31 characters (`PSHMNAMLEN`). A
23578
- * `camstack.frames.<deviceId>.<streamId>` scheme overflows that for realistic
23579
- * ids, so the sink uses a short, collision-resistant scheme instead:
23580
- * `csf.<base36 hash>.<gen>`. The hash folds the device id, the session tag
23581
- * and a per-process random salt; the generation suffix makes a re-created
23582
- * segment (resolution change) a distinct name so a stale consumer mapping is
23583
- * never silently reused.
23584
- */
23585
- /**
23586
- * Shared prefix for every decoder shm segment name. Startup orphan reclamation
23587
- * (`purgeOrphanSegments`) keys off this to find segments left behind by a
23588
- * crashed prior instance.
23589
- */
23590
- var SEGMENT_NAME_PREFIX = "csf.";
23591
- function makeSegmentName(seed, generation) {
23592
- let hash = 5381;
23593
- for (let i = 0; i < seed.length; i += 1) hash = (hash << 5) + hash + seed.charCodeAt(i) | 0;
23594
- return `${SEGMENT_NAME_PREFIX}${(hash >>> 0).toString(36)}.${generation}`;
23595
- }
23596
- /**
23597
- * The decoder-side owner of one stream's shared-memory frame ring.
23598
- *
23599
- * Not constructed until a session actually uses the shm sink; the segment
23600
- * itself is created lazily on the first `writeFrame`.
23601
- */
23602
- var DecoderFrameRingSink = class {
23603
- seed;
23604
- logger;
23605
- nodeId;
23606
- segment = null;
23607
- writer = null;
23608
- segmentName = null;
23609
- slotByteLength = 0;
23610
- generation = 0;
23611
- destroyed = false;
23612
- /** Frames committed into the ring across this sink's lifetime (all generations). */
23613
- framesWritten = 0;
23614
- constructor(options) {
23615
- const salt = Math.random().toString(36).slice(2, 8);
23616
- this.seed = `${options.seed}.${salt}`;
23617
- this.logger = options.logger;
23618
- this.nodeId = options.nodeId;
23619
- }
23620
- /** Whether a segment has been created (i.e. at least one frame written). */
23621
- get isArmed() {
23622
- return this.writer !== null;
23623
- }
23624
- /** The current segment name, or `null` before the first frame. */
23625
- get currentSegmentName() {
23626
- return this.segmentName;
23627
- }
23628
- /**
23629
- * Write one decoded frame into the ring and return its `FrameHandle`.
23630
- *
23631
- * On the first call (or after a geometry change that overflows the current
23632
- * slot) the segment is created / re-created sized for this frame. Returns
23633
- * `null` only when the sink has been destroyed.
23634
- *
23635
- * This is the copy-in convenience form (it copies `pixels` into the slot).
23636
- * The decoder's hot path uses the zero-copy {@link beginFrame} /
23637
- * {@link commitFrame} scatter-write pair instead — the scaler produces its
23638
- * packed output directly into the slot, eliminating the write-side memcpy.
23639
- */
23640
- writeFrame(pixels, meta) {
23641
- if (this.destroyed) return null;
23642
- if (this.writer === null || (0, _camstack_shm_ring.computeSlotByteLength)(meta.width, meta.height, meta.format) > this.slotByteLength) this.recreateSegment((0, _camstack_shm_ring.computeSlotByteLength)(meta.width, meta.height, meta.format));
23643
- const writer = this.writer;
23644
- if (writer === null) return null;
23645
- const handle = writer.writeFrame(pixels, meta);
23646
- this.framesWritten += 1;
23647
- return handle;
23648
- }
23649
- /**
23650
- * Reserve a ring slot for a frame of the given geometry — the **zero-copy**
23651
- * scatter-write entry point (Phase 5 / D9 Task 7c).
23652
- *
23653
- * The segment is created / re-created here if this is the first frame or the
23654
- * geometry overflows the current slot capacity, so the slot is correctly
23655
- * sized before the caller fills it. The returned `buffer` is a writable view
23656
- * **directly over the mapped segment** — the node-av scaler scatters its
23657
- * packed output straight into it, with no intermediate copy. The caller MUST
23658
- * call {@link commitFrame} with the returned `slot` once the slot is filled.
23659
- *
23660
- * Returns `null` when the sink is destroyed or the segment cannot be created.
23661
- */
23662
- beginFrame(width, height, format) {
23663
- if (this.destroyed) return null;
23664
- const requiredSlotBytes = (0, _camstack_shm_ring.computeSlotByteLength)(width, height, format);
23665
- if (this.writer === null || requiredSlotBytes > this.slotByteLength) this.recreateSegment(requiredSlotBytes);
23666
- const writer = this.writer;
23667
- if (writer === null) return null;
23668
- const { slot, buffer } = writer.beginFrame();
23669
- return {
23670
- slot,
23671
- buffer
23672
- };
23673
- }
23674
- /**
23675
- * Publish the frame whose slot was reserved by {@link beginFrame} and filled
23676
- * in place by the caller. `slot` MUST be the value from the matching
23677
- * `beginFrame`. Returns the published `FrameHandle`, or `null` if the sink
23678
- * was destroyed (or the segment lost) between begin and commit.
23679
- */
23680
- commitFrame(slot, meta) {
23681
- if (this.destroyed) return null;
23682
- const writer = this.writer;
23683
- if (writer === null) return null;
23684
- const handle = writer.commitFrame(slot, meta);
23685
- this.framesWritten += 1;
23686
- return handle;
23687
- }
23688
- /**
23689
- * Current shm ring usage — `null` until the first frame arms the segment.
23690
- * Surfaced through `decoder.getShmStats` so a downstream consumer can
23691
- * observe ring pressure (slot depth, byte budget, frames written).
23692
- */
23693
- getShmStats() {
23694
- if (this.writer === null) return null;
23695
- return {
23696
- slotCount: this.writer.slotCount,
23697
- slotByteLength: this.slotByteLength,
23698
- segmentBytes: (0, _camstack_shm_ring.computeSegmentSize)(this.writer.slotCount, this.slotByteLength),
23699
- framesWritten: this.framesWritten
23700
- };
23701
- }
23702
- /**
23703
- * Abandon a slot reserved by {@link beginFrame} **without publishing it** —
23704
- * the degenerate-path counterpart of {@link commitFrame}.
23705
- *
23706
- * A caller that reserved a slot but then could not produce valid pixels (no
23707
- * decoded source planes, or the scaler threw) MUST call this instead of
23708
- * `commitFrame`: it closes the open seqlock without advancing `writeIndex`,
23709
- * so no reader ever sees the slot's uninitialised bytes as a real frame, and
23710
- * no `FrameHandle` is handed downstream. `slot` MUST be the value from the
23711
- * matching `beginFrame`. A no-op if the sink was destroyed (or the segment
23712
- * lost) between begin and abort.
23713
- */
23714
- abortFrame(slot) {
23715
- if (this.destroyed) return;
23716
- const writer = this.writer;
23717
- if (writer === null) return;
23718
- writer.abortFrame(slot);
23719
- }
23720
- /** Close + unlink the segment. Idempotent. */
23721
- destroy() {
23722
- if (this.destroyed) return;
23723
- this.destroyed = true;
23724
- this.releaseSegment();
23725
- }
23726
- /**
23727
- * Create a fresh segment sized for at least `slotByteLength` bytes per slot,
23728
- * replacing any prior one. A re-create bumps the generation so the new
23729
- * segment has a distinct name — a consumer holding the old mapping is never
23730
- * silently handed a resized segment.
23731
- */
23732
- recreateSegment(slotByteLength) {
23733
- this.releaseSegment();
23734
- this.generation += 1;
23735
- const name = makeSegmentName(this.seed, this.generation);
23736
- const slotCount = (0, _camstack_shm_ring.deriveSlotCount)(RING_BUDGET_BYTES, slotByteLength);
23737
- if (slotCount === _camstack_shm_ring.MIN_RING_SLOTS && _camstack_shm_ring.MIN_RING_SLOTS * slotByteLength > RING_BUDGET_BYTES) this.logger.warn("decoder shm ring: budget too small for resolution — using MIN slots", { meta: {
23738
- slotByteLength,
23739
- budgetMb: RING_BUDGET_MB
23740
- } });
23741
- const totalBytes = (0, _camstack_shm_ring.computeSegmentSize)(slotCount, slotByteLength);
23742
- try {
23743
- const segment = (0, _camstack_shm_ring.createSegment)(name, totalBytes);
23744
- this.segment = segment;
23745
- this.segmentName = name;
23746
- this.slotByteLength = slotByteLength;
23747
- this.writer = new _camstack_shm_ring.FrameRingWriter(segment.buffer, name, slotCount, slotByteLength, this.nodeId);
23748
- this.logger.info("decoder shm ring: segment created", { meta: {
23749
- segment: name,
23750
- slotCount,
23751
- slotByteLength,
23752
- totalBytes,
23753
- generation: this.generation
23754
- } });
23755
- } catch (err) {
23756
- this.segment = null;
23757
- this.writer = null;
23758
- this.segmentName = null;
23759
- this.slotByteLength = 0;
23760
- this.logger.error("decoder shm ring: segment create failed", { meta: {
23761
- segment: name,
23762
- slotByteLength,
23763
- error: err instanceof Error ? err.message : String(err)
23764
- } });
23765
- }
23766
- }
23767
- /** Unmap + unlink the current segment, if any. */
23768
- releaseSegment() {
23769
- const segment = this.segment;
23770
- if (segment === null) return;
23771
- this.segment = null;
23772
- this.writer = null;
23773
- const name = this.segmentName;
23774
- this.segmentName = null;
23775
- try {
23776
- segment.close();
23777
- segment.unlink();
23778
- this.logger.info("decoder shm ring: segment released", { meta: { segment: name } });
23779
- } catch (err) {
23780
- this.logger.warn("decoder shm ring: segment release failed", { meta: {
23781
- segment: name,
23782
- error: err instanceof Error ? err.message : String(err)
23783
- } });
23784
- }
23785
- }
23786
- };
23787
- //#endregion
23788
23933
  //#region src/frame-stream-splitter.ts
23789
23934
  var FrameStreamSplitter = class {
23790
23935
  frameSize;
@@ -24034,7 +24179,7 @@ var FfmpegDecoderSession = class {
24034
24179
  if (typeof this.config.deviceId === "number") seedParts.push(String(this.config.deviceId));
24035
24180
  if (typeof this.config.tag === "string" && this.config.tag.length > 0) seedParts.push(this.config.tag);
24036
24181
  const seed = seedParts.length > 0 ? seedParts.join(":") : "anon";
24037
- this.frameRingSink = new DecoderFrameRingSink({
24182
+ this.frameRingSink = new _camstack_shm_ring.DecoderFrameRingSink({
24038
24183
  seed,
24039
24184
  logger: this.logger,
24040
24185
  nodeId: this.nodeId
@@ -25755,7 +25900,7 @@ var DecoderFfmpegAddon = class extends BaseAddon {
25755
25900
  return registrations;
25756
25901
  }
25757
25902
  this.ctx.logger.info("ffmpeg decoder addon initialized", { meta: { selectedBackend: backend } });
25758
- const purged = purgeOrphanSegments(SEGMENT_NAME_PREFIX);
25903
+ const purged = purgeOrphanSegments(_camstack_shm_ring.SEGMENT_NAME_PREFIX);
25759
25904
  if (purged.removed > 0) this.ctx.logger.warn("ffmpeg decoder: reclaimed orphaned shm segments at startup", { meta: {
25760
25905
  removed: purged.removed,
25761
25906
  scanned: purged.scanned
@@ -26059,7 +26204,7 @@ var DecoderFfmpegAddon = class extends BaseAddon {
26059
26204
  return {
26060
26205
  sessionId: input.sessionId,
26061
26206
  ...stats,
26062
- budgetMb: RING_BUDGET_MB,
26207
+ budgetMb: _camstack_shm_ring.RING_BUDGET_MB,
26063
26208
  getFrameHits: this.getFrameHits,
26064
26209
  getFrameMisses: this.getFrameMisses
26065
26210
  };