@camstack/addon-provider-rtsp 1.1.19 → 1.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +870 -304
  2. package/dist/addon.mjs +847 -304
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -1,4 +1,28 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ let node_net = require("node:net");
25
+ node_net = __toESM(node_net);
2
26
  //#region ../../node_modules/zod/v4/core/core.js
3
27
  var _a$1;
4
28
  function $constructor(name, initializer, params) {
@@ -4642,7 +4666,7 @@ function preprocess(fn, schema) {
4642
4666
  });
4643
4667
  }
4644
4668
  //#endregion
4645
- //#region ../types/dist/sleep-CZDdRBua.mjs
4669
+ //#region ../types/dist/sleep-BC9Yqte7.mjs
4646
4670
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4647
4671
  EventCategory["SystemBoot"] = "system.boot";
4648
4672
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -4828,6 +4852,18 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
4828
4852
  */
4829
4853
  EventCategory["PipelineCameraUpdated"] = "pipeline.camera-updated";
4830
4854
  /**
4855
+ * The cluster camera-source OWNER changed (`clusterRoles.ingestNode`).
4856
+ * Emitted by addon-pipeline-orchestrator whenever it (re)derives node
4857
+ * capabilities — at boot, on agent online/offline, and on an ingest-node
4858
+ * flip. Carries the resolved `ownerNodeId`. The stream-broker consumes it to
4859
+ * keep its ingest-owner-gate decision current WITHOUT a per-`ensureBroker`
4860
+ * cross-process `getIngestOwner` query (push the authority's decision instead
4861
+ * of polling it on the hot path). Idempotent state — re-emitted on every
4862
+ * topology change, so a dropped event self-heals on the next one (plus the
4863
+ * broker's long backstop reconcile query).
4864
+ */
4865
+ EventCategory["PipelineIngestOwnerChanged"] = "pipeline.ingest-owner-changed";
4866
+ /**
4831
4867
  * Periodic snapshot of per-node pipeline-runner load
4832
4868
  * (`RunnerLocalLoad`). Emitted ~1Hz by every runner so UI dashboards
4833
4869
  * subscribe instead of polling `pipelineRunner.getLocalLoad`.
@@ -5351,10 +5387,6 @@ function hydrateField(field, values) {
5351
5387
  };
5352
5388
  }
5353
5389
  const rawValue = storedValue !== void 0 ? storedValue : defaultValue !== void 0 ? defaultValue : null;
5354
- if (field.type === "password") return {
5355
- ...field,
5356
- value: ""
5357
- };
5358
5390
  const value = field.type === "textarea" && field.isJson && rawValue !== null && typeof rawValue === "object" ? JSON.stringify(rawValue, null, 2) : rawValue;
5359
5391
  return {
5360
5392
  ...field,
@@ -6738,10 +6770,25 @@ function method(input, output, options) {
6738
6770
  timeoutMs: options?.timeoutMs
6739
6771
  };
6740
6772
  }
6773
+ /**
6774
+ * A wrapper/system-only method: served exclusively by the cap's system-level
6775
+ * provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
6776
+ * driver natives don't stub out a wrapper concern (e.g. a cross-device cache
6777
+ * overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
6778
+ */
6779
+ function systemMethod(input, output, options) {
6780
+ return {
6781
+ ...method(input, output, options),
6782
+ systemOnly: true
6783
+ };
6784
+ }
6741
6785
  /** Shorthand to define an event schema */
6742
6786
  function event(data) {
6743
6787
  return { data };
6744
6788
  }
6789
+ var StaticDirOutputSchema$1 = object({ staticDir: string() });
6790
+ var VersionOutputSchema$1 = object({ version: string() });
6791
+ method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6745
6792
  var StaticDirOutputSchema = object({ staticDir: string() });
6746
6793
  var VersionOutputSchema = object({ version: string() });
6747
6794
  method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
@@ -6911,6 +6958,36 @@ var ModelFormatsSchema = object({
6911
6958
  tflite: ModelFormatEntrySchema.optional(),
6912
6959
  pt: ModelFormatEntrySchema.optional()
6913
6960
  });
6961
+ /**
6962
+ * Variant-selector grouping axes. Shared by the full `ModelCatalogEntry` and by
6963
+ * the reduced `PipelineModelOption` returned in `pipeline.getSchema()` so the
6964
+ * grouped Family→Tier→Variant picker renders identically in the config UI and
6965
+ * in the pipeline/device steppers. The flat `id` stays the source of truth for
6966
+ * resolution/download/persistence; this is a presentation overlay resolved back
6967
+ * to an `id`.
6968
+ */
6969
+ var ModelVariantGroupSchema = object({
6970
+ /** Top-level family, e.g. `yolo26` (later `d-fine`, `rf-detr`). */
6971
+ family: string(),
6972
+ /** Size within the family, e.g. `n` | `s` | `m` | `l`. */
6973
+ tier: string(),
6974
+ /** Quantization axis. Omit ⇒ the fp32 base build. */
6975
+ precision: _enum(["fp32", "int8"]).optional(),
6976
+ /**
6977
+ * Speed-optimization axis. Omit ⇒ the standard build. `fast` marks a
6978
+ * latency-optimized export (e.g. ReLU-activation variant) — the slot the
6979
+ * future performance variants plug into.
6980
+ */
6981
+ optimization: _enum(["standard", "fast"]).optional(),
6982
+ /**
6983
+ * Input-resolution axis (square input side, px). Omit ⇒ the family's native
6984
+ * resolution (640 for yolo26). Reduced-input builds (320 / 256) are a big,
6985
+ * cheap latency lever — especially on Apple ANE and the Intel N100 — at a
6986
+ * small-object accuracy cost. Mirrors the model's `inputSize` but lifted onto
6987
+ * the group so the selector can offer it as a variant axis.
6988
+ */
6989
+ resolution: number().int().positive().optional()
6990
+ });
6914
6991
  var ModelCatalogEntrySchema = object({
6915
6992
  id: string(),
6916
6993
  name: string(),
@@ -6940,7 +7017,43 @@ var ModelCatalogEntrySchema = object({
6940
7017
  * Auxiliary files required at runtime (labels JSON, charset dict, etc.).
6941
7018
  * Downloaded into the same modelsDir alongside the model file.
6942
7019
  */
6943
- extraFiles: array(ModelExtraFileSchema).readonly().optional()
7020
+ extraFiles: array(ModelExtraFileSchema).readonly().optional(),
7021
+ /**
7022
+ * LEGACY entry — retained in the catalog so a persisted operator selection
7023
+ * still RESOLVES (and can be re-activated), but hidden from the selectable
7024
+ * model list and excluded from the auto format-default pick. Set on the
7025
+ * superseded / consolidated models (older lineages, redundant fp16 IRs) so
7026
+ * the active lineup stays the coherent curated ladder without deleting a
7027
+ * model anyone may still be pinned to. `resolveModelForFormat` keeps honoring
7028
+ * an explicit legacy id that has a build for the node's format.
7029
+ */
7030
+ legacy: boolean().optional(),
7031
+ /**
7032
+ * Measured quality/latency metadata — populated from the benchmark addon on
7033
+ * the real node classes. Absent = not yet measured (most entries today; the
7034
+ * catalog historically carried only `sizeMB`, a poor cross-architecture
7035
+ * speed proxy). `p95LatencyMs` is keyed by node class (e.g. `n100`, `mac`).
7036
+ */
7037
+ metrics: object({
7038
+ map50: number().optional(),
7039
+ p95LatencyMs: record(string(), number()).optional()
7040
+ }).optional(),
7041
+ /**
7042
+ * SPDX-ish license id of the model weights (e.g. `AGPL-3.0` for Ultralytics
7043
+ * YOLO26, `GPL-3.0` for YOLOv9, `Apache-2.0` for D-FINE/RF-DETR). Matters for
7044
+ * the retraining addon and any future commercial distribution.
7045
+ */
7046
+ license: string().optional(),
7047
+ /**
7048
+ * Variant-selector grouping. The UI groups models by `family` + `tier` and
7049
+ * offers `precision` / `optimization` as variant axes WITHIN a tier — so all
7050
+ * of a family's sizes and quantizations collapse into one grouped picker
7051
+ * instead of a flat list of `yolo26s`, `yolo26s-int8`, … Absent ⇒ ungrouped
7052
+ * (legacy / custom models) — never shown in the grouped selector. The flat
7053
+ * `id` stays the source of truth for resolution/download/persistence; grouping
7054
+ * is a presentation overlay resolved back to an `id`.
7055
+ */
7056
+ group: ModelVariantGroupSchema.optional()
6944
7057
  });
6945
7058
  var ConvertTargetSchema = discriminatedUnion("format", [object({
6946
7059
  format: literal("openvino"),
@@ -7001,8 +7114,8 @@ var RecordingModeSchema = _enum([
7001
7114
  "onAudioThreshold"
7002
7115
  ]);
7003
7116
  /**
7004
- * First-class, authoritative per-camera storage mode — the netta choice the UI
7005
- * reads directly (never inferred from `rules`):
7117
+ * First-class, authoritative per-camera storage mode — the explicit choice the
7118
+ * UI reads directly (never inferred from `rules`):
7006
7119
  * - `off` — not recording.
7007
7120
  * - `events` — record only around triggers (motion / audio threshold),
7008
7121
  * with pre/post-buffer.
@@ -8534,6 +8647,72 @@ function shallowEqual(a, b) {
8534
8647
  for (const k of ak) if (a[k] !== b[k]) return false;
8535
8648
  return true;
8536
8649
  }
8650
+ /** Reject after `ms`; always clears its own timer. */
8651
+ async function withTimeout(promise, ms, label) {
8652
+ let timer;
8653
+ const timeout = new Promise((_resolve, reject) => {
8654
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${label} timed out after ${String(ms)}ms`)), ms);
8655
+ });
8656
+ try {
8657
+ return await Promise.race([promise, timeout]);
8658
+ } finally {
8659
+ if (timer !== void 0) clearTimeout(timer);
8660
+ }
8661
+ }
8662
+ /**
8663
+ * Start the reachability poll loop. Returns a handle whose `stop()` clears the
8664
+ * timer and prevents any further ticks. Start on device activation, stop on
8665
+ * device teardown (`removeDevice`) so no timer leaks.
8666
+ */
8667
+ function startReachabilityPoll(options) {
8668
+ const intervalMs = options.intervalMs ?? 3e4;
8669
+ const failuresToOffline = options.failuresToOffline ?? 3;
8670
+ const probeTimeoutMs = options.probeTimeoutMs ?? 1e4;
8671
+ const runImmediately = options.runImmediately ?? true;
8672
+ let stopped = false;
8673
+ let running = false;
8674
+ let consecutiveFailures = 0;
8675
+ let timer;
8676
+ const tick = async () => {
8677
+ if (stopped) return;
8678
+ if (running) return;
8679
+ if (options.isEnabled && !options.isEnabled()) return;
8680
+ running = true;
8681
+ try {
8682
+ const reachable = await withTimeout(Promise.resolve().then(options.probe), probeTimeoutMs, "reachability probe");
8683
+ if (stopped) return;
8684
+ if (reachable) {
8685
+ consecutiveFailures = 0;
8686
+ options.setOnline(true);
8687
+ } else registerFailure("probe resolved unreachable");
8688
+ } catch (error) {
8689
+ if (stopped) return;
8690
+ registerFailure(error instanceof Error ? error.message : "probe threw");
8691
+ } finally {
8692
+ running = false;
8693
+ }
8694
+ };
8695
+ const registerFailure = (reason) => {
8696
+ consecutiveFailures += 1;
8697
+ options.logger?.debug("reachability probe failed", {
8698
+ reason,
8699
+ consecutiveFailures,
8700
+ failuresToOffline
8701
+ });
8702
+ if (consecutiveFailures >= failuresToOffline) options.setOnline(false);
8703
+ };
8704
+ timer = setInterval(() => {
8705
+ tick();
8706
+ }, intervalMs);
8707
+ if (typeof timer === "object" && timer !== null && "unref" in timer) timer.unref();
8708
+ if (runImmediately) tick();
8709
+ return { stop: () => {
8710
+ if (stopped) return;
8711
+ stopped = true;
8712
+ if (timer !== void 0) clearInterval(timer);
8713
+ timer = void 0;
8714
+ } };
8715
+ }
8537
8716
  /**
8538
8717
  * Generic device-level status snapshot. Auto-registered by `BaseDevice`
8539
8718
  * for every device, regardless of provider — the kernel needs a uniform
@@ -9197,26 +9376,13 @@ onBrightnessChanged: { data: object({
9197
9376
  */
9198
9377
  runtimeState: BrightnessStatusSchema
9199
9378
  };
9379
+ /** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
9200
9380
  var StreamFormatSchema = _enum([
9201
9381
  "webrtc",
9202
9382
  "hls",
9203
9383
  "mjpeg",
9204
9384
  "rtsp"
9205
9385
  ]);
9206
- var StreamInfoSchema = object({
9207
- streamId: string(),
9208
- format: StreamFormatSchema,
9209
- url: string().nullable(),
9210
- active: boolean()
9211
- });
9212
- method(object({
9213
- streamId: string(),
9214
- sourceUrl: string(),
9215
- codec: string().optional()
9216
- }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), _void(), { kind: "mutation" }), method(object({
9217
- streamId: string(),
9218
- format: StreamFormatSchema
9219
- }), string().nullable()), method(_void(), array(StreamInfoSchema));
9220
9386
  var RtspRestreamEntrySchema = object({
9221
9387
  brokerId: string(),
9222
9388
  url: string(),
@@ -10084,37 +10250,7 @@ var consumablesCapability = {
10084
10250
  scope: "device",
10085
10251
  deviceNative: true,
10086
10252
  mode: "singleton",
10087
- deviceTypes: [
10088
- DeviceType.Camera,
10089
- DeviceType.Hub,
10090
- DeviceType.Light,
10091
- DeviceType.Siren,
10092
- DeviceType.Switch,
10093
- DeviceType.Sensor,
10094
- DeviceType.Thermostat,
10095
- DeviceType.Button,
10096
- DeviceType.EventEmitter,
10097
- DeviceType.Update,
10098
- DeviceType.Generic,
10099
- DeviceType.Notifier,
10100
- DeviceType.Script,
10101
- DeviceType.Automation,
10102
- DeviceType.Lock,
10103
- DeviceType.Cover,
10104
- DeviceType.Valve,
10105
- DeviceType.Humidifier,
10106
- DeviceType.WaterHeater,
10107
- DeviceType.Fan,
10108
- DeviceType.MediaPlayer,
10109
- DeviceType.AlarmPanel,
10110
- DeviceType.Control,
10111
- DeviceType.Presence,
10112
- DeviceType.Weather,
10113
- DeviceType.Vacuum,
10114
- DeviceType.LawnMower,
10115
- DeviceType.Container,
10116
- DeviceType.Image
10117
- ],
10253
+ deviceTypes: Object.values(DeviceType),
10118
10254
  deviceConfig: { ui: {
10119
10255
  kind: "widget",
10120
10256
  widgetId: "host/consumables-panel",
@@ -11572,7 +11708,7 @@ var BoundingBoxSchema = object({
11572
11708
  w: number(),
11573
11709
  h: number()
11574
11710
  });
11575
- var SpatialDetectionSchema = object({
11711
+ object({
11576
11712
  class: string(),
11577
11713
  originalClass: string(),
11578
11714
  score: number(),
@@ -11707,7 +11843,6 @@ var PipelineDefaultStepSchema = lazy(() => object({
11707
11843
  enabled: boolean(),
11708
11844
  modelId: string(),
11709
11845
  children: array(PipelineDefaultStepSchema).readonly(),
11710
- engine: PipelineEngineChoiceSchema.optional(),
11711
11846
  group: string().optional(),
11712
11847
  settings: record(string(), unknown()).optional()
11713
11848
  }));
@@ -11732,7 +11867,9 @@ var PipelineModelOptionSchema = object({
11732
11867
  formats: record(string(), object({
11733
11868
  downloaded: boolean(),
11734
11869
  sizeMB: number()
11735
- }))
11870
+ })),
11871
+ group: ModelVariantGroupSchema.optional(),
11872
+ legacy: boolean().optional()
11736
11873
  });
11737
11874
  var ConfigFieldBridge = custom();
11738
11875
  var PipelineAddonSchemaSchema = object({
@@ -11746,6 +11883,7 @@ var PipelineAddonSchemaSchema = object({
11746
11883
  defaultModelId: string(),
11747
11884
  defaultModelIdByFormat: record(string(), string()).optional(),
11748
11885
  enabledByDefault: boolean().optional(),
11886
+ backfillIntoExistingOverrides: boolean().optional(),
11749
11887
  defaultConfidence: number(),
11750
11888
  group: string().optional(),
11751
11889
  configSchema: array(ConfigFieldBridge).readonly().optional()
@@ -11762,11 +11900,6 @@ var PipelineSchemaSchema = object({
11762
11900
  selectedEngine: PipelineEngineChoiceSchema,
11763
11901
  slots: array(PipelineSlotSchemaSchema).readonly()
11764
11902
  });
11765
- var DetectorOutputSchema = object({
11766
- detections: array(SpatialDetectionSchema).readonly(),
11767
- inferenceMs: number(),
11768
- modelId: string()
11769
- });
11770
11903
  var EngineProvisioningSchema = object({
11771
11904
  runtimeId: _enum([
11772
11905
  "onnx",
@@ -11783,15 +11916,42 @@ var EngineProvisioningSchema = object({
11783
11916
  ]),
11784
11917
  progress: number().optional(),
11785
11918
  error: string().optional(),
11786
- nextRetryAt: number().optional()
11919
+ nextRetryAt: number().optional(),
11920
+ /**
11921
+ * Gate A (config-correctness gate at engine change): human-readable
11922
+ * config issues surfaced EAGERLY when the node's engine changes — model
11923
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
11924
+ * has a <format> build"). Additive/optional: informational only, never
11925
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
11926
+ * Absent/empty when the node-default tree resolves cleanly.
11927
+ */
11928
+ configIssues: array(string()).optional()
11787
11929
  });
11788
11930
  var PipelineStepInputSchema = lazy(() => object({
11789
11931
  addonId: string(),
11790
- modelId: string(),
11932
+ modelId: string().optional(),
11791
11933
  enabled: boolean().default(true),
11792
11934
  children: array(PipelineStepInputSchema).optional(),
11793
11935
  settings: record(string(), unknown()).optional()
11794
11936
  }));
11937
+ var ModelSubstitutionSchema = object({
11938
+ addonId: string(),
11939
+ chosen: string(),
11940
+ running: string(),
11941
+ format: string()
11942
+ });
11943
+ var PipelineValidationIssueSchema = object({
11944
+ addonId: string(),
11945
+ kind: _enum(["unknown-addon", "no-format-build"]),
11946
+ detail: string()
11947
+ });
11948
+ var PipelineValidationResultSchema = object({
11949
+ ok: boolean(),
11950
+ issues: array(PipelineValidationIssueSchema).readonly(),
11951
+ substitutions: array(ModelSubstitutionSchema).readonly(),
11952
+ /** The node's `currentEngine.format` this validation ran against. */
11953
+ format: string()
11954
+ });
11795
11955
  var ReferenceImageEntrySchema = object({
11796
11956
  filename: string(),
11797
11957
  stepIds: array(string()).readonly().optional()
@@ -11862,7 +12022,13 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11862
12022
  })) }), object({ success: literal(true) }), {
11863
12023
  kind: "mutation",
11864
12024
  auth: "admin"
11865
- }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
12025
+ }), method(object({ nodeId: string() }), object({
12026
+ success: literal(true),
12027
+ clearedDevices: number()
12028
+ }), {
12029
+ kind: "mutation",
12030
+ auth: "admin"
12031
+ }), 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({
11866
12032
  name: string(),
11867
12033
  steps: array(PipelineTemplateStepSchema).readonly(),
11868
12034
  engine: PipelineEngineChoiceSchema
@@ -11879,10 +12045,6 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11879
12045
  modelId: string(),
11880
12046
  format: ModelFormatSchema$1
11881
12047
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
11882
- addonId: string(),
11883
- frame: FrameInputSchema,
11884
- config: record(string(), unknown()).optional()
11885
- }), DetectorOutputSchema), method(object({
11886
12048
  engine: PipelineEngineChoiceSchema.optional(),
11887
12049
  steps: array(PipelineStepInputSchema).min(1),
11888
12050
  frame: FrameInputSchema.optional(),
@@ -12061,6 +12223,25 @@ var zonesCapability = {
12061
12223
  runtimeState: object({ zones: array(ZoneSchema).readonly() })
12062
12224
  };
12063
12225
  /**
12226
+ * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
12227
+ * decode worker resolves it against the RETAINED native frame's real pixel dims,
12228
+ * so the caller supplies only the detection-res bbox divided by the detection
12229
+ * dims — no native resolution to plumb.
12230
+ */
12231
+ var NativeCropBboxSchema = object({
12232
+ x: number(),
12233
+ y: number(),
12234
+ w: number(),
12235
+ h: number()
12236
+ });
12237
+ /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
12238
+ var NativeCropResultSchema = object({
12239
+ /** Packed rgb (24-bit) pixels of the crop. */
12240
+ bytes: _instanceof(Uint8Array),
12241
+ width: number().int().positive(),
12242
+ height: number().int().positive()
12243
+ });
12244
+ /**
12064
12245
  * Per-camera tunable ranges + defaults. Single source of truth used
12065
12246
  * by both the Zod data schema (validation + default fallback) and
12066
12247
  * the device settings UI (slider min/max/step). Touch one place and
@@ -12155,6 +12336,13 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
12155
12336
  kind: literal("remote-restream"),
12156
12337
  /** The camera's source-owner node (slice 1: always the hub). */
12157
12338
  ownerNodeId: string(),
12339
+ /**
12340
+ * The owner's LAN-reachable host, resolved by the orchestrator from the
12341
+ * per-node `reachableHost` override (Cluster UI). When present the runner
12342
+ * dials THIS host for the owner's restream, in preference to the
12343
+ * `CAMSTACK_HUB_URL`-derived default. Absent → auto-detect fallback.
12344
+ */
12345
+ ownerReachableHost: string().optional(),
12158
12346
  /** Operator override for the owner host the runner dials. */
12159
12347
  hubHostnameOverride: string().optional()
12160
12348
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
@@ -12163,13 +12351,11 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
12163
12351
  * specific runner instance via `attachCamera`. Carries everything the
12164
12352
  * runner needs to subscribe to the local broker and execute inference.
12165
12353
  *
12166
- * Stateless-pipeline model: the full pipeline content (`engine`, `steps`,
12167
- * optional `audio`) travels with the attach payload. The runner keeps it
12168
- * in RAM for the lifetime of the attach — on rebalance, edit, or
12169
- * restart the orchestrator re-sends the latest snapshot.
12170
- *
12171
- * `engine`/`steps`/`audio` are optional during the additive migration
12172
- * window; once orchestrator + UI are migrated they become required.
12354
+ * Stateless-pipeline model: the pipeline content (`steps`, optional
12355
+ * `audio`) travels with the attach payload. The runner keeps it in RAM
12356
+ * for the lifetime of the attach — on rebalance, edit, or restart the
12357
+ * orchestrator re-sends the latest snapshot. Engine is NOT carried: it is
12358
+ * node-local, resolved by the executing runner at dispatch time.
12173
12359
  */
12174
12360
  var RunnerCameraConfigSchema = object({
12175
12361
  deviceId: number(),
@@ -12220,14 +12406,11 @@ var RunnerCameraConfigSchema = object({
12220
12406
  */
12221
12407
  motionSources: MotionSourcesSchema.default(["analyzer"]),
12222
12408
  pipelineEnabled: boolean().default(true),
12223
- /** Engine choice for video steps (runtime+backend+format). */
12224
- engine: PipelineEngineChoiceSchema.optional(),
12225
12409
  /** Ordered tree of video steps. Absent → runner skips video detection. */
12226
12410
  steps: array(PipelineStepInputSchema).readonly().optional(),
12227
12411
  /** Audio classification branch. `enabled:false` disables, null skips. */
12228
12412
  audio: object({
12229
- engine: PipelineEngineChoiceSchema,
12230
- modelId: string(),
12413
+ modelId: string().optional(),
12231
12414
  enabled: boolean()
12232
12415
  }).nullable().optional(),
12233
12416
  /**
@@ -12314,7 +12497,11 @@ var RunnerLocalMetricsSchema = object({
12314
12497
  avgInferenceTimeMs: number(),
12315
12498
  queueDepth: number()
12316
12499
  });
12317
- 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());
12500
+ 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({
12501
+ handle: FrameHandleSchema,
12502
+ bbox: NativeCropBboxSchema,
12503
+ maxWidth: number().int().positive().optional()
12504
+ }), NativeCropResultSchema.nullable());
12318
12505
  /**
12319
12506
  * Hardware / firmware motion sensor cap — binary detected state plus
12320
12507
  * a timestamp of the last observation. Distinct from
@@ -15245,7 +15432,9 @@ var AddonPageDeclarationSchema$1 = object({
15245
15432
  icon: string(),
15246
15433
  path: string(),
15247
15434
  remoteName: string(),
15248
- bundle: string()
15435
+ bundle: string(),
15436
+ section: string().optional(),
15437
+ sectionLabel: string().optional()
15249
15438
  });
15250
15439
  var AddonPageInfoSchema = object({
15251
15440
  addonId: string(),
@@ -15285,7 +15474,18 @@ var AddonPageDeclarationSchema = object({
15285
15474
  * the static-file route can compute an mtime-based cache-buster URL
15286
15475
  * without a separate filesystem stat.
15287
15476
  */
15288
- bundle: string()
15477
+ bundle: string(),
15478
+ /**
15479
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
15480
+ * `'cluster'`, `'administration'` — the page renders inside that group.
15481
+ * Any OTHER string creates (or joins) a custom section rendered after
15482
+ * the built-in groups; its label comes from `sectionLabel` (first
15483
+ * declaration wins), falling back to the id. Absent → the legacy
15484
+ * "Addon Pages" group.
15485
+ */
15486
+ section: string().optional(),
15487
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
15488
+ sectionLabel: string().optional()
15289
15489
  });
15290
15490
  method(_void(), array(AddonPageDeclarationSchema).readonly());
15291
15491
  var AddonHttpRouteSchema = object({
@@ -15501,6 +15701,17 @@ var WidgetMetadataSchema = object({
15501
15701
  deviceContext: boolean().default(false),
15502
15702
  integrationContext: boolean().default(false)
15503
15703
  }),
15704
+ /**
15705
+ * Loadable BEFORE authentication. The normal widget registry listing
15706
+ * (`addon-widgets.listWidgets`) is auth-gated, so a pre-auth surface
15707
+ * (the login page) cannot discover a widget through it. A widget that
15708
+ * declares `preAuth: true` marks itself as safe to mount on a pre-auth
15709
+ * screen — it is surfaced through the PUBLIC `auth.listLoginMethods`
15710
+ * login-method contribution channel (see `login-method.cap.ts`) rather
15711
+ * than the authenticated registry, and its bundle is served by the
15712
+ * public `/api/addon-widgets/:addonId/*` static route. Defaults false.
15713
+ */
15714
+ preAuth: boolean().optional().default(false),
15504
15715
  /** Dashboard placement HINTS (operator can override per instance). */
15505
15716
  defaultSize: WidgetSizeEnum.default("md"),
15506
15717
  allowedSizes: array(WidgetSizeEnum).readonly().default([
@@ -15802,6 +16013,66 @@ method(object({
15802
16013
  password: string()
15803
16014
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
15804
16015
  /**
16016
+ * `login-method` — collection cap through which auth addons contribute
16017
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
16018
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
16019
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
16020
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
16021
+ * procedure aggregates them for the unauthenticated login page.
16022
+ *
16023
+ * A contribution is a discriminated union on `kind`:
16024
+ *
16025
+ * - `redirect` — a declarative button. The login page renders a generic
16026
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
16027
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
16028
+ * ZERO shell-side JS. A future SSO addon plugs in the same way — the
16029
+ * login page needs NO change.
16030
+ *
16031
+ * - `widget` — a Module-Federation widget the login page mounts (via
16032
+ * `loadRemoteBundle`) for an in-page ceremony. Covers the passkey
16033
+ * login ceremony, which must run `@simplewebauthn/browser` INSIDE the
16034
+ * addon bundle. The referenced widget also declares `preAuth: true` in
16035
+ * its `addon-widgets-source` catalog entry. `auth.listLoginMethods`
16036
+ * stamps a public `bundleUrl` from `addonId` + `bundle`.
16037
+ *
16038
+ * Every contribution carries a `stage`:
16039
+ * - `primary` — shown on the first credentials screen (OIDC /
16040
+ * magic-link buttons; a future usernameless passkey).
16041
+ * - `second-factor` — shown AFTER the password leg, gated on the
16042
+ * returned `factors` (passkey-as-2FA today).
16043
+ *
16044
+ * `mount: skip` — the cap is read server-side by the core auth router
16045
+ * (`registry.getCollection('login-method')`), never mounted as its own
16046
+ * tRPC router.
16047
+ */
16048
+ /** When a login method renders in the two-phase login flow. */
16049
+ var LoginStageEnum = _enum(["primary", "second-factor"]);
16050
+ /** One login-method contribution — redirect button OR pre-auth widget. */
16051
+ var LoginMethodContributionSchema = discriminatedUnion("kind", [object({
16052
+ kind: literal("redirect"),
16053
+ /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
16054
+ id: string(),
16055
+ /** Operator-facing button label. */
16056
+ label: string(),
16057
+ /** lucide-react icon name. */
16058
+ icon: string().optional(),
16059
+ /** Addon-owned HTTP route the button navigates to (GET). */
16060
+ startUrl: string(),
16061
+ stage: LoginStageEnum
16062
+ }), object({
16063
+ kind: literal("widget"),
16064
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
16065
+ id: string(),
16066
+ /** Owning addon id — drives the public bundle URL + the MF namespace. */
16067
+ addonId: string(),
16068
+ /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
16069
+ bundle: string(),
16070
+ /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
16071
+ remote: WidgetRemoteSchema,
16072
+ stage: LoginStageEnum
16073
+ })]);
16074
+ method(_void(), array(LoginMethodContributionSchema).readonly());
16075
+ /**
15805
16076
  * Orchestrator-side destination metadata. The orchestrator computes
15806
16077
  * `id = <addonId>:<subId>` from its provider lookup so consumers
15807
16078
  * (admin UI, restore flow) see one canonical key.
@@ -17905,7 +18176,17 @@ var TrackSchema = object({
17905
18176
  /** Cumulative normalized distance travelled (0..1 units = full frame width). */
17906
18177
  totalDistance: number(),
17907
18178
  state: TrackStateSchema,
17908
- active: boolean()
18179
+ active: boolean(),
18180
+ /** Deterministic key-event importance score in [0,1] (server-computed at
18181
+ * track expiry, recomputed on late label). Absent on legacy rows written
18182
+ * before scoring shipped — consumers degrade to absence / compute-on-read. */
18183
+ importance: number().optional(),
18184
+ /** Id of the track's highest-confidence ObjectEvent (its representative
18185
+ * "best" frame). Absent when the track produced no object events. */
18186
+ bestEventId: string().optional(),
18187
+ /** Tag of the importance sub-signal that dominated the score
18188
+ * (identity|dwell|proximity|class|confidence|travel|zone). */
18189
+ importanceReason: string().optional()
17909
18190
  });
17910
18191
  var BaseEventFields = {
17911
18192
  id: string(),
@@ -17970,8 +18251,18 @@ var ObjectEventSchema = object({
17970
18251
  frameHeight: number().optional(),
17971
18252
  /** MediaStore key for the crop attached to this event (if any). */
17972
18253
  mediaKey: string().optional(),
18254
+ /** Design B: MediaStore key of the track's native-resolution key frame (the
18255
+ * best-detection full frame). Resolve via the event-media data-plane
18256
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`) for a detail view that
18257
+ * draws `bbox` over the native frame. Absent on legacy rows / non-decoded
18258
+ * sources — consumers fall back to `mediaKey` (the tight crop). */
18259
+ keyFrameMediaKey: string().optional(),
17973
18260
  /** Populated by B5 (recording playback URL for this event). */
17974
- mediaUrl: string().optional()
18261
+ mediaUrl: string().optional(),
18262
+ /** The parent track's key-event importance [0,1], propagated to every object
18263
+ * event of the track (so an event row can be sorted by importance without a
18264
+ * track join). Absent on legacy rows / before the track was scored. */
18265
+ importance: number().optional()
17975
18266
  });
17976
18267
  var AudioEventSchema = object({
17977
18268
  ...BaseEventFields,
@@ -17995,7 +18286,8 @@ var MediaFileKindEnum = _enum([
17995
18286
  "fullFrame",
17996
18287
  "fullFrameBoxed",
17997
18288
  "faceCrop",
17998
- "plateCrop"
18289
+ "plateCrop",
18290
+ "keyFrame"
17999
18291
  ]);
18000
18292
  var MediaFileSchema = object({
18001
18293
  key: string(),
@@ -18016,6 +18308,32 @@ var DeviceEventQueryInput = object({
18016
18308
  projection: _enum(["full", "slim"]).optional()
18017
18309
  });
18018
18310
  var ObjectEventQueryInput = DeviceEventQueryInput.extend({ classFilter: string().optional() });
18311
+ var KeyEventQueryInput = object({
18312
+ deviceId: number(),
18313
+ /** Window lower bound (track firstSeen ≥ since). */
18314
+ since: number(),
18315
+ /** Window upper bound (track firstSeen ≤ until). */
18316
+ until: number(),
18317
+ limit: number().int().min(1).max(200).default(50),
18318
+ /** Drop tracks scoring below this importance. */
18319
+ minImportance: number().min(0).max(1).optional(),
18320
+ /** Restrict to a single class (e.g. 'person'). */
18321
+ classFilter: string().optional()
18322
+ });
18323
+ var KeyEventSchema = object({
18324
+ /** The representative event id (the track's best ObjectEvent, else its trackId). */
18325
+ id: string(),
18326
+ trackId: string(),
18327
+ /** Track start time (firstSeen). */
18328
+ timestamp: number(),
18329
+ className: string(),
18330
+ label: string().optional(),
18331
+ importance: number(),
18332
+ /** Highest-confidence ObjectEvent id for the track (empty when none). */
18333
+ bestEventId: string(),
18334
+ /** Track lifetime in ms (lastSeen - firstSeen). */
18335
+ windowMs: number().optional()
18336
+ });
18019
18337
  var TrackedDetectionSchema = object({
18020
18338
  trackId: string(),
18021
18339
  className: string(),
@@ -18045,7 +18363,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18045
18363
  }), array(TrackSchema).readonly()), method(object({ deviceId: number() }), _void(), {
18046
18364
  kind: "mutation",
18047
18365
  auth: "admin"
18048
- }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(object({
18366
+ }), method(DeviceEventQueryInput, array(MotionEventSchema).readonly()), method(ObjectEventQueryInput, array(ObjectEventSchema).readonly()), method(DeviceEventQueryInput, array(AudioEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
18049
18367
  deviceId: number(),
18050
18368
  since: number(),
18051
18369
  until: number(),
@@ -18090,11 +18408,11 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18090
18408
  timestamp: number()
18091
18409
  });
18092
18410
  var CameraPipelineConfigSchema = object({
18093
- engine: PipelineEngineChoiceSchema,
18411
+ engine: PipelineEngineChoiceSchema.optional(),
18094
18412
  steps: array(PipelineStepInputSchema).readonly(),
18095
18413
  audio: object({
18096
- engine: PipelineEngineChoiceSchema,
18097
- modelId: string(),
18414
+ engine: PipelineEngineChoiceSchema.optional(),
18415
+ modelId: string().optional(),
18098
18416
  enabled: boolean(),
18099
18417
  settings: record(string(), unknown()).readonly().optional()
18100
18418
  }).nullable().optional()
@@ -18109,7 +18427,7 @@ var PipelineTemplateSchema = object({
18109
18427
  });
18110
18428
  var AgentAddonConfigSchema = object({
18111
18429
  enabled: boolean(),
18112
- modelId: string(),
18430
+ modelId: string().optional(),
18113
18431
  settings: record(string(), unknown()).readonly()
18114
18432
  });
18115
18433
  var AgentPipelineSettingsSchema = object({
@@ -18119,12 +18437,25 @@ var AgentPipelineSettingsSchema = object({
18119
18437
  detectWeight: number().positive().optional(),
18120
18438
  /** Node is eligible to run the detection pipeline (decode + inference). */
18121
18439
  detect: boolean().optional(),
18122
- /** Node is eligible to host decoder sessions. */
18440
+ /**
18441
+ * DEPRECATED AND IGNORED. Decode is always co-located with its frame
18442
+ * consumer, so decode eligibility IS detect eligibility. Kept optional in
18443
+ * the schema ONLY so persisted stores written before the removal still
18444
+ * parse — no code reads it and no write path emits it.
18445
+ */
18123
18446
  decode: boolean().optional(),
18124
18447
  /** Node is eligible to run audio-analyzer sessions. */
18125
18448
  audio: boolean().optional(),
18126
18449
  /** Node is eligible to be the ingest / source-owner (serve the restream). */
18127
- ingest: boolean().optional()
18450
+ ingest: boolean().optional(),
18451
+ /**
18452
+ * Operator override for the LAN host a cross-node decoder dials to reach
18453
+ * THIS node's restream (Cluster UI). Absent → auto-detect: a remote runner
18454
+ * falls back to its `CAMSTACK_HUB_URL`-derived host (the Moleculer address
18455
+ * it already uses to reach the hub). Set this only when the auto-detected
18456
+ * address is wrong (multi-homed host, NAT, custom interface).
18457
+ */
18458
+ reachableHost: string().optional()
18128
18459
  });
18129
18460
  var CameraPipelineForAgentSchema = object({
18130
18461
  steps: array(PipelineStepInputSchema).readonly(),
@@ -18172,25 +18503,6 @@ var PipelineAssignmentSchema = object({
18172
18503
  assignedAt: number()
18173
18504
  });
18174
18505
  /**
18175
- * Decoder placement record. Symmetric to `PipelineAssignmentSchema` but for
18176
- * the decoder-node placement domain (`balanceDecoder` decision: manual pin
18177
- * → co-located with pipeline → capacity).
18178
- */
18179
- var DecoderAssignmentSchema = object({
18180
- deviceId: number(),
18181
- /** Moleculer node id of the decoder provider currently responsible for this camera. */
18182
- decoderNodeId: string(),
18183
- /** True when the assignment was set manually via `assignDecoder`, false when chosen by the balancer. */
18184
- pinned: boolean(),
18185
- /** Why this assignment was made — useful for debugging the decoder balancer. */
18186
- reason: _enum([
18187
- "manual",
18188
- "co-located",
18189
- "capacity",
18190
- "hardware-affinity"
18191
- ])
18192
- });
18193
- /**
18194
18506
  * Per-agent load summary surfaced to the load balancer + dashboards.
18195
18507
  * Aggregated from each runner's `getLocalLoad` cap call.
18196
18508
  */
@@ -18230,6 +18542,15 @@ var GlobalMetricsSchema = object({
18230
18542
  * capability providers.
18231
18543
  */
18232
18544
  var CapabilityBindingsSchema = record(string(), string());
18545
+ /**
18546
+ * The cluster's single camera-source owner (`clusterRoles.ingestNode`) plus
18547
+ * its LAN-reachable host, if one is registered. See `getIngestOwner`.
18548
+ */
18549
+ var IngestOwnerSchema = object({
18550
+ ownerNodeId: string(),
18551
+ reachableHost: string().optional(),
18552
+ configIssue: string().optional()
18553
+ });
18233
18554
  /** Source block — always present; derives from the stream catalog. */
18234
18555
  var CameraSourceStatusSchema = object({ streams: array(object({
18235
18556
  camStreamId: string(),
@@ -18244,6 +18565,14 @@ var CameraAssignmentStatusSchema = object({
18244
18565
  detectionNodeId: string().nullable(),
18245
18566
  decoderNodeId: string().nullable(),
18246
18567
  audioNodeId: string().nullable(),
18568
+ /**
18569
+ * The node that OWNS this camera's physical source pull (dials the RTSP and
18570
+ * hosts the broker/restream) — the cluster ingest owner today
18571
+ * (`clusterRoles.ingestNode`), per-camera once source assignment lands. Lets
18572
+ * the UI show WHERE a camera is sourced without SSH/logs, and is the node the
18573
+ * broker block below was read from (pinned). Nullable only pre-wiring.
18574
+ */
18575
+ sourceNodeId: string().nullable(),
18247
18576
  pinned: object({
18248
18577
  detection: boolean(),
18249
18578
  decoder: boolean(),
@@ -18376,16 +18705,7 @@ method(object({
18376
18705
  }), object({ success: literal(true) }), {
18377
18706
  kind: "mutation",
18378
18707
  auth: "admin"
18379
- }), method(object({
18380
- deviceId: number(),
18381
- nodeId: string()
18382
- }), _void(), {
18383
- kind: "mutation",
18384
- auth: "admin"
18385
- }), method(object({ deviceId: number() }), _void(), {
18386
- kind: "mutation",
18387
- auth: "admin"
18388
- }), method(_void(), array(DecoderAssignmentSchema).readonly()), method(object({
18708
+ }), method(_void(), IngestOwnerSchema), method(object({
18389
18709
  deviceId: number(),
18390
18710
  nodeId: string()
18391
18711
  }), object({ success: literal(true) }), {
@@ -18406,10 +18726,7 @@ method(object({
18406
18726
  nodeId: string(),
18407
18727
  pinned: boolean(),
18408
18728
  assignedAt: number()
18409
- }))), method(object({
18410
- deviceId: number(),
18411
- pipelineNodeId: string().optional()
18412
- }), DecoderAssignmentSchema), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
18729
+ }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
18413
18730
  nodeId: string(),
18414
18731
  settings: AgentPipelineSettingsSchema
18415
18732
  })).readonly()), method(object({
@@ -18439,12 +18756,26 @@ method(object({
18439
18756
  }), method(object({
18440
18757
  agentNodeId: string(),
18441
18758
  detect: boolean().nullable().optional(),
18442
- decode: boolean().nullable().optional(),
18443
18759
  audio: boolean().nullable().optional(),
18444
18760
  ingest: boolean().nullable().optional()
18445
18761
  }), object({ success: literal(true) }), {
18446
18762
  kind: "mutation",
18447
18763
  auth: "admin"
18764
+ }), method(object({
18765
+ agentNodeId: string(),
18766
+ reachableHost: string().nullable()
18767
+ }), object({ success: literal(true) }), {
18768
+ kind: "mutation",
18769
+ auth: "admin"
18770
+ }), method(object({ agentNodeId: string() }), object({
18771
+ success: literal(true),
18772
+ /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
18773
+ effectiveModelId: string().nullable(),
18774
+ /** Number of cameras whose node-scoped overrides were cleared. */
18775
+ clearedCameraOverrides: number()
18776
+ }), {
18777
+ kind: "mutation",
18778
+ auth: "admin"
18448
18779
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
18449
18780
  deviceId: number(),
18450
18781
  addonId: string(),
@@ -18489,22 +18820,131 @@ method(object({
18489
18820
  kind: "mutation",
18490
18821
  auth: "admin"
18491
18822
  });
18492
- var RegisteredStreamSchema = object({
18493
- streamId: string(),
18494
- label: string().optional(),
18495
- codec: string(),
18496
- type: _enum(["video", "audio"]),
18497
- sourceUrl: string()
18823
+ /**
18824
+ * server-management — per-NODE singleton capability for a node's ROOT
18825
+ * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
18826
+ * agents).
18827
+ *
18828
+ * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
18829
+ * on agents) carries the whole software stack in its npm dep tree, so ONE
18830
+ * version describes the node. Updates install into
18831
+ * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
18832
+ * starter (probation boot + auto-rollback to N-1).
18833
+ *
18834
+ * Providers:
18835
+ * - HUB: `ServerUpdateService` behind the `server-provided` mount
18836
+ * (`buildServerProviders` in trpc.router.ts) — the default target for
18837
+ * unpinned calls.
18838
+ * - AGENT: `AgentUpdateService` registered by the agent bootstrap under
18839
+ * the synthetic `agent-runtime` addonId and declared in the agent's
18840
+ * `$hub.registerNode` manifest.
18841
+ *
18842
+ * Node routing: singleton caps get the codegen/runtime-builder `nodeId`
18843
+ * injection on every method — `input.nodeId` (or `nodePin(nodeId)` from the
18844
+ * SDK) routes the call to that node's provider via the standard remote
18845
+ * proxy (`createCapabilityProxy` → `$agent-cap-fwd` → the agent's
18846
+ * in-process provider lookup). No `nodeId` → the hub's own provider.
18847
+ *
18848
+ * Spec: docs/superpowers/specs/2026-07-12-runtime-updatable-node-packages-design.md
18849
+ */
18850
+ /**
18851
+ * Where the running hub's code was loaded from:
18852
+ * - `workspace` — dev checkout (tsx / workspace dist); the starter defers to
18853
+ * plain resolution and runtime updates are refused.
18854
+ * - `baked` — the immutable image seed closure (no data-dir root active).
18855
+ * - `data-root` — the runtime-updatable `<dataDir>/server-root` closure.
18856
+ */
18857
+ var ServerBootModeSchema = _enum([
18858
+ "workspace",
18859
+ "baked",
18860
+ "data-root"
18861
+ ]);
18862
+ /**
18863
+ * Update lifecycle state:
18864
+ * - `idle` / `checking` / `staging` — steady / in-flight registry work.
18865
+ * - `pending-restart` — a version is staged and the node has NOT yet
18866
+ * restarted onto it (still running the OLD version).
18867
+ * - `awaiting-confirmation` — the node HAS restarted onto the staged version
18868
+ * (it is the active probation boot) and is waiting to confirm boot-health.
18869
+ * Apply/rollback are refused in this state and the node must NOT be
18870
+ * manually restarted, or the probation boot auto-rolls-back.
18871
+ */
18872
+ var ServerUpdateStateSchema = _enum([
18873
+ "idle",
18874
+ "checking",
18875
+ "staging",
18876
+ "pending-restart",
18877
+ "awaiting-confirmation"
18878
+ ]);
18879
+ var ServerRollbackInfoSchema = object({
18880
+ /** The version that failed (or was manually rolled back). */
18881
+ fromVersion: string(),
18882
+ /** The version rolled back to; null = the baked seed. */
18883
+ toVersion: string().nullable(),
18884
+ atMs: number(),
18885
+ reason: string()
18498
18886
  });
18499
- var ExposedResourceSchema = object({
18500
- streamId: string(),
18501
- format: string(),
18502
- value: string()
18887
+ var ServerPackageStatusSchema = object({
18888
+ /** Root package name (`@camstack/server` on the hub). */
18889
+ packageName: string(),
18890
+ /** Version of the code the running process ACTUALLY loaded. */
18891
+ runningVersion: string().nullable(),
18892
+ /** Node.js runtime version the node's process runs on (`process.versions.node`). */
18893
+ nodeRuntimeVersion: string().nullable(),
18894
+ /** Active data-dir root version; null when booted from seed/workspace. */
18895
+ activeVersion: string().nullable(),
18896
+ /** N-1 version kept for rollback; null when no previous version exists. */
18897
+ previousVersion: string().nullable(),
18898
+ /** Version of the immutable baked seed closure (image fallback). */
18899
+ seedVersion: string().nullable(),
18900
+ /** Latest registry version from the most recent check (null = never checked). */
18901
+ latestVersion: string().nullable(),
18902
+ updateAvailable: boolean(),
18903
+ bootMode: ServerBootModeSchema,
18904
+ updateState: ServerUpdateStateSchema,
18905
+ /** Version staged + awaiting its probation boot, when one is pending. */
18906
+ pendingVersion: string().nullable(),
18907
+ /** Set when the last freshly-activated version failed its boot health-check. */
18908
+ rolledBack: ServerRollbackInfoSchema.nullable(),
18909
+ /**
18910
+ * True when `server-root/state.json` EXISTS but is unreadable/corrupt — the
18911
+ * hub is running from the baked seed (or workspace) while installed data-dir
18912
+ * versions are being IGNORED. Surfaced as a warning in the UI.
18913
+ */
18914
+ stateFileCorrupt: boolean(),
18915
+ lastCheckedAtMs: number().nullable()
18916
+ });
18917
+ var ServerUpdateCheckResultSchema = object({
18918
+ packageName: string(),
18919
+ runningVersion: string().nullable(),
18920
+ latestVersion: string().nullable(),
18921
+ updateAvailable: boolean(),
18922
+ checkedAtMs: number(),
18923
+ /** Non-null when the registry lookup failed (offline, bad registry, …). */
18924
+ error: string().nullable()
18925
+ });
18926
+ var ServerUpdateActionResultSchema = object({
18927
+ accepted: boolean(),
18928
+ targetVersion: string().nullable(),
18929
+ /** True when a graceful restart was scheduled to apply the change. */
18930
+ restarting: boolean(),
18931
+ message: string()
18932
+ });
18933
+ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
18934
+ kind: "mutation",
18935
+ auth: "admin"
18936
+ }), method(object({
18937
+ /** Explicit target version; omitted = latest from the registry. */
18938
+ version: string().optional() }), ServerUpdateActionResultSchema, {
18939
+ kind: "mutation",
18940
+ auth: "admin"
18941
+ }), method(_void(), ServerUpdateActionResultSchema, {
18942
+ kind: "mutation",
18943
+ auth: "admin"
18944
+ }), method(_void(), ServerUpdateActionResultSchema, {
18945
+ kind: "mutation",
18946
+ auth: "admin"
18503
18947
  });
18504
- method(object({
18505
- deviceId: number(),
18506
- streams: array(RegisteredStreamSchema).readonly()
18507
- }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), array(ExposedResourceSchema).readonly());
18508
18948
  /**
18509
18949
  * Query filter for settings-store collections.
18510
18950
  */
@@ -18657,9 +19097,9 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
18657
19097
  /**
18658
19098
  * A single device snapshot returned as base64 JPEG/PNG.
18659
19099
  *
18660
- * Shared with the `snapshot-provider` collection cap the orchestrator
18661
- * receives the same shape from each native provider and from the
18662
- * broker-based fallback.
19100
+ * The `SnapshotAddon` wrapper returns this shape whether the frame came from
19101
+ * the device-native provider (onboard capture) or from the stream-broker
19102
+ * prebuffer fallback.
18663
19103
  */
18664
19104
  var SnapshotImageSchema = object({
18665
19105
  base64: string(),
@@ -18727,17 +19167,26 @@ var snapshotCapability = {
18727
19167
  invalidateCache: method(object({ deviceId: number() }), _void(), {
18728
19168
  kind: "mutation",
18729
19169
  auth: "admin"
18730
- })
19170
+ }),
19171
+ /**
19172
+ * Cache-only batch overview — answers from the wrapper's in-memory cache in
19173
+ * O(n) and NEVER triggers a capture. Lets a grid skip requesting images for
19174
+ * devices that never produced a frame, and gives it an ETag per device for
19175
+ * conditional (304-able) image fetches. `lastCapturedAt`/`cacheAgeMs`/`etag`
19176
+ * are null for a device with no cached frame.
19177
+ */
19178
+ getSnapshotOverview: systemMethod(object({ deviceIds: array(number()).min(1).max(200) }), array(object({
19179
+ deviceId: number(),
19180
+ lastCapturedAt: number().nullable(),
19181
+ cacheAgeMs: number().nullable(),
19182
+ etag: string().nullable()
19183
+ })))
18731
19184
  },
18732
19185
  status: {
18733
19186
  schema: SnapshotStatusSchema,
18734
19187
  kind: "poll"
18735
19188
  }
18736
19189
  };
18737
- method(object({ deviceId: number() }), boolean()), method(object({
18738
- deviceId: number(),
18739
- streamId: string().optional()
18740
- }), SnapshotImageSchema.nullable());
18741
19190
  /**
18742
19191
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
18743
19192
  * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
@@ -18988,10 +19437,32 @@ method(_void(), array(TurnServerSchema).readonly());
18988
19437
  * b. `finishAuthentication({userId, response})` → server verifies
18989
19438
  * the assertion, bumps the credential counter, returns ok.
18990
19439
  *
19440
+ * 2b. Usernameless (discoverable-credential) authentication — the
19441
+ * passkey IS the primary factor, no password leg:
19442
+ * a. `beginDiscoverableAuthentication({})` → assertion options with
19443
+ * EMPTY `allowCredentials` (the browser offers every resident
19444
+ * passkey it holds for this RP) + `userVerification: 'required'`
19445
+ * (the passkey replaces both factors, so UV is mandatory).
19446
+ * The challenge is stored server-side, NOT bound to any user.
19447
+ * b. `finishDiscoverableAuthentication({response})` → the provider
19448
+ * resolves the credential by the response's credential id,
19449
+ * verifies the assertion against the stored challenge + that
19450
+ * credential's public key/counter, and returns the OWNING
19451
+ * `userId` — the caller (core auth router) mints the session.
19452
+ *
18991
19453
  * 3. Management:
18992
19454
  * - `listPasskeys({userId})` — enumerate user's enrolled credentials.
18993
19455
  * - `removePasskey({userId, credentialId})` — revoke one credential.
18994
19456
  *
19457
+ * 4. Second-factor preference (opt-in, default OFF):
19458
+ * Enrolling a passkey only enables passkey-FIRST sign-in. It is
19459
+ * demanded as a second factor after a password login ONLY when the
19460
+ * user explicitly opts in via `setSecondFactorPreference`.
19461
+ * - `getSecondFactorPreference({userId})` → `{ enabled }` (missing
19462
+ * row ⇒ `enabled: false`).
19463
+ * - `setSecondFactorPreference({userId, enabled})` — persisted by
19464
+ * the providing addon beside its credentials.
19465
+ *
18995
19466
  * Challenges are short-lived (5 min, in-memory). The cap is internal —
18996
19467
  * the admin-ui composes the begin/finish round-trip and never exposes
18997
19468
  * the cap to non-admins.
@@ -19034,6 +19505,17 @@ method(object({
19034
19505
  }), object({ verified: boolean() }), {
19035
19506
  kind: "mutation",
19036
19507
  access: "view"
19508
+ }), method(object({}), object({ optionsJSON: record(string(), unknown()) }), {
19509
+ kind: "mutation",
19510
+ access: "view"
19511
+ }), method(object({
19512
+ /** AuthenticationResponseJSON from the browser. */
19513
+ response: record(string(), unknown()) }), object({
19514
+ verified: boolean(),
19515
+ userId: string().nullable()
19516
+ }), {
19517
+ kind: "mutation",
19518
+ access: "view"
19037
19519
  }), method(object({ userId: string() }), array(PasskeySummarySchema), { auth: "admin" }), method(object({
19038
19520
  userId: string(),
19039
19521
  credentialId: string()
@@ -19041,6 +19523,13 @@ method(object({
19041
19523
  kind: "mutation",
19042
19524
  auth: "admin",
19043
19525
  access: "delete"
19526
+ }), method(object({ userId: string() }), object({ enabled: boolean() }), { auth: "admin" }), method(object({
19527
+ userId: string(),
19528
+ enabled: boolean()
19529
+ }), object({ success: literal(true) }), {
19530
+ kind: "mutation",
19531
+ auth: "admin",
19532
+ access: "create"
19044
19533
  });
19045
19534
  /**
19046
19535
  * `videoclips` — the unified, navigable-clip surface for a camera.
@@ -19098,9 +19587,10 @@ method(object({
19098
19587
  auth: "admin"
19099
19588
  });
19100
19589
  /**
19101
- * Optional client-side hints sent at session creation to help the
19102
- * provider pick the best native source. All fields are optional —
19103
- * a viewer that knows nothing still gets a sane default.
19590
+ * Optional client-side hints sent at session creation to help the provider
19591
+ * pick the best native source. All fields optional — a viewer that knows
19592
+ * nothing still gets a sane default. (Relocated from the retired `webrtc`
19593
+ * collection cap; this `webrtc-session` cap is the live signaling surface.)
19104
19594
  */
19105
19595
  var webrtcClientHintsSchema = object({
19106
19596
  viewportWidth: number().int().positive().optional(),
@@ -19111,22 +19601,6 @@ var webrtcClientHintsSchema = object({
19111
19601
  /** Hard tier override; takes precedence over scoring when registered. */
19112
19602
  prefersTier: string().optional()
19113
19603
  }).partial();
19114
- method(object({
19115
- streamId: string(),
19116
- sdpOffer: string()
19117
- }), string(), { kind: "mutation" }), method(object({ streamId: string() }), boolean()), method(object({
19118
- streamId: string(),
19119
- codec: string()
19120
- }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), _void(), { kind: "mutation" }), method(object({
19121
- streamId: string(),
19122
- hints: webrtcClientHintsSchema.optional()
19123
- }), object({
19124
- sessionId: string(),
19125
- sdpOffer: string()
19126
- }), { kind: "mutation" }), method(object({
19127
- sessionId: string(),
19128
- sdpAnswer: string()
19129
- }), _void(), { kind: "mutation" }), method(object({ sessionId: string() }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), boolean());
19130
19604
  /**
19131
19605
  * Discriminated target for a WebRTC session. The client sends this
19132
19606
  * structured object instead of building / parsing brokerId strings;
@@ -19857,7 +20331,17 @@ var FaceInfoSchema = object({
19857
20331
  recognizedIdentityId: string().optional(),
19858
20332
  identityName: string().optional(),
19859
20333
  assigned: boolean(),
19860
- base64: string().optional()
20334
+ base64: string().optional(),
20335
+ /** Design B: the face bbox (pixel space) on the key frame — lets a detail
20336
+ * view draw the box over the native `keyFrameMediaKey` frame. Absent on
20337
+ * legacy rows written before design B. */
20338
+ faceBbox: BoundingBoxSchema.optional(),
20339
+ /** Design B: MediaStore key of the track's native-resolution key frame.
20340
+ * Fetch the native JPEG via the event-media data-plane
20341
+ * (`/addon/<addonId>/event-media/<keyFrameMediaKey>`). Absent when the
20342
+ * track produced no key frame (e.g. native/onboard source) — the UI falls
20343
+ * back to the inline `base64` face crop. */
20344
+ keyFrameMediaKey: string().optional()
19861
20345
  });
19862
20346
  var FaceFilterEnum = _enum([
19863
20347
  "unassigned",
@@ -20554,6 +21038,16 @@ var TopologyCategorySchema = object({
20554
21038
  healthy: number(),
20555
21039
  addons: array(TopologyCategoryAddonSchema).readonly()
20556
21040
  });
21041
+ /**
21042
+ * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21043
+ * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21044
+ * version visibility for the Server management surface. Nullable: offline
21045
+ * rows and pre-phase-2 nodes report none.
21046
+ */
21047
+ var TopologyRootPackageSchema = object({
21048
+ name: string(),
21049
+ version: string()
21050
+ });
20557
21051
  var TopologyNodeSchema = object({
20558
21052
  id: string(),
20559
21053
  name: string(),
@@ -20577,7 +21071,8 @@ var TopologyNodeSchema = object({
20577
21071
  status: string()
20578
21072
  })).readonly(),
20579
21073
  processes: array(TopologyProcessSchema).readonly(),
20580
- categories: array(TopologyCategorySchema).readonly()
21074
+ categories: array(TopologyCategorySchema).readonly(),
21075
+ rootPackage: TopologyRootPackageSchema.nullable()
20581
21076
  });
20582
21077
  var CapUsageEdgeSchema = object({
20583
21078
  callerAddonId: string(),
@@ -23390,6 +23885,12 @@ Object.freeze({
23390
23885
  addonId: null,
23391
23886
  access: "create"
23392
23887
  },
23888
+ "loginMethod.getLoginMethods": {
23889
+ capName: "login-method",
23890
+ capScope: "system",
23891
+ addonId: null,
23892
+ access: "view"
23893
+ },
23393
23894
  "mediaPlayer.next": {
23394
23895
  capName: "media-player",
23395
23896
  capScope: "device",
@@ -23972,6 +24473,12 @@ Object.freeze({
23972
24473
  addonId: null,
23973
24474
  access: "view"
23974
24475
  },
24476
+ "pipelineAnalytics.getKeyEvents": {
24477
+ capName: "pipeline-analytics",
24478
+ capScope: "device",
24479
+ addonId: null,
24480
+ access: "view"
24481
+ },
23975
24482
  "pipelineAnalytics.getMotionEvents": {
23976
24483
  capName: "pipeline-analytics",
23977
24484
  capScope: "device",
@@ -24020,23 +24527,23 @@ Object.freeze({
24020
24527
  addonId: null,
24021
24528
  access: "create"
24022
24529
  },
24023
- "pipelineExecutor.deleteModel": {
24530
+ "pipelineExecutor.clearDeviceOverrides": {
24024
24531
  capName: "pipeline-executor",
24025
24532
  capScope: "system",
24026
24533
  addonId: null,
24027
24534
  access: "delete"
24028
24535
  },
24029
- "pipelineExecutor.deleteTemplate": {
24536
+ "pipelineExecutor.deleteModel": {
24030
24537
  capName: "pipeline-executor",
24031
24538
  capScope: "system",
24032
24539
  addonId: null,
24033
24540
  access: "delete"
24034
24541
  },
24035
- "pipelineExecutor.detect": {
24542
+ "pipelineExecutor.deleteTemplate": {
24036
24543
  capName: "pipeline-executor",
24037
24544
  capScope: "system",
24038
24545
  addonId: null,
24039
- access: "view"
24546
+ access: "delete"
24040
24547
  },
24041
24548
  "pipelineExecutor.downloadModel": {
24042
24549
  capName: "pipeline-executor",
@@ -24230,13 +24737,13 @@ Object.freeze({
24230
24737
  addonId: null,
24231
24738
  access: "create"
24232
24739
  },
24233
- "pipelineOrchestrator.assignAudio": {
24234
- capName: "pipeline-orchestrator",
24740
+ "pipelineExecutor.validatePipeline": {
24741
+ capName: "pipeline-executor",
24235
24742
  capScope: "system",
24236
24743
  addonId: null,
24237
- access: "create"
24744
+ access: "view"
24238
24745
  },
24239
- "pipelineOrchestrator.assignDecoder": {
24746
+ "pipelineOrchestrator.assignAudio": {
24240
24747
  capName: "pipeline-orchestrator",
24241
24748
  capScope: "system",
24242
24749
  addonId: null,
@@ -24320,19 +24827,13 @@ Object.freeze({
24320
24827
  addonId: null,
24321
24828
  access: "view"
24322
24829
  },
24323
- "pipelineOrchestrator.getDecoderAssignment": {
24324
- capName: "pipeline-orchestrator",
24325
- capScope: "system",
24326
- addonId: null,
24327
- access: "view"
24328
- },
24329
- "pipelineOrchestrator.getDecoderAssignments": {
24830
+ "pipelineOrchestrator.getGlobalMetrics": {
24330
24831
  capName: "pipeline-orchestrator",
24331
24832
  capScope: "system",
24332
24833
  addonId: null,
24333
24834
  access: "view"
24334
24835
  },
24335
- "pipelineOrchestrator.getGlobalMetrics": {
24836
+ "pipelineOrchestrator.getIngestOwner": {
24336
24837
  capName: "pipeline-orchestrator",
24337
24838
  capScope: "system",
24338
24839
  addonId: null,
@@ -24374,6 +24875,12 @@ Object.freeze({
24374
24875
  addonId: null,
24375
24876
  access: "delete"
24376
24877
  },
24878
+ "pipelineOrchestrator.resetNodePipelineDefaults": {
24879
+ capName: "pipeline-orchestrator",
24880
+ capScope: "system",
24881
+ addonId: null,
24882
+ access: "delete"
24883
+ },
24377
24884
  "pipelineOrchestrator.resolvePipeline": {
24378
24885
  capName: "pipeline-orchestrator",
24379
24886
  capScope: "system",
@@ -24410,37 +24917,37 @@ Object.freeze({
24410
24917
  addonId: null,
24411
24918
  access: "create"
24412
24919
  },
24413
- "pipelineOrchestrator.setCameraPipelineForAgent": {
24920
+ "pipelineOrchestrator.setAgentReachableHost": {
24414
24921
  capName: "pipeline-orchestrator",
24415
24922
  capScope: "system",
24416
24923
  addonId: null,
24417
24924
  access: "create"
24418
24925
  },
24419
- "pipelineOrchestrator.setCameraStepOverride": {
24926
+ "pipelineOrchestrator.setCameraPipelineForAgent": {
24420
24927
  capName: "pipeline-orchestrator",
24421
24928
  capScope: "system",
24422
24929
  addonId: null,
24423
24930
  access: "create"
24424
24931
  },
24425
- "pipelineOrchestrator.setCameraStepToggle": {
24932
+ "pipelineOrchestrator.setCameraStepOverride": {
24426
24933
  capName: "pipeline-orchestrator",
24427
24934
  capScope: "system",
24428
24935
  addonId: null,
24429
24936
  access: "create"
24430
24937
  },
24431
- "pipelineOrchestrator.setCapabilityBinding": {
24938
+ "pipelineOrchestrator.setCameraStepToggle": {
24432
24939
  capName: "pipeline-orchestrator",
24433
24940
  capScope: "system",
24434
24941
  addonId: null,
24435
24942
  access: "create"
24436
24943
  },
24437
- "pipelineOrchestrator.unassignAudio": {
24944
+ "pipelineOrchestrator.setCapabilityBinding": {
24438
24945
  capName: "pipeline-orchestrator",
24439
24946
  capScope: "system",
24440
24947
  addonId: null,
24441
24948
  access: "create"
24442
24949
  },
24443
- "pipelineOrchestrator.unassignDecoder": {
24950
+ "pipelineOrchestrator.unassignAudio": {
24444
24951
  capName: "pipeline-orchestrator",
24445
24952
  capScope: "system",
24446
24953
  addonId: null,
@@ -24500,6 +25007,12 @@ Object.freeze({
24500
25007
  addonId: null,
24501
25008
  access: "view"
24502
25009
  },
25010
+ "pipelineRunner.getNativeCrop": {
25011
+ capName: "pipeline-runner",
25012
+ capScope: "system",
25013
+ addonId: null,
25014
+ access: "view"
25015
+ },
24503
25016
  "pipelineRunner.reportMotion": {
24504
25017
  capName: "pipeline-runner",
24505
25018
  capScope: "system",
@@ -24740,33 +25253,45 @@ Object.freeze({
24740
25253
  addonId: null,
24741
25254
  access: "create"
24742
25255
  },
24743
- "restreamer.getExposedResources": {
24744
- capName: "restreamer",
25256
+ "scriptRunner.run": {
25257
+ capName: "script-runner",
25258
+ capScope: "device",
25259
+ addonId: null,
25260
+ access: "create"
25261
+ },
25262
+ "scriptRunner.stop": {
25263
+ capName: "script-runner",
25264
+ capScope: "device",
25265
+ addonId: null,
25266
+ access: "create"
25267
+ },
25268
+ "serverManagement.applyServerUpdate": {
25269
+ capName: "server-management",
24745
25270
  capScope: "system",
24746
25271
  addonId: null,
24747
- access: "view"
25272
+ access: "create"
24748
25273
  },
24749
- "restreamer.registerDevice": {
24750
- capName: "restreamer",
25274
+ "serverManagement.checkServerUpdate": {
25275
+ capName: "server-management",
24751
25276
  capScope: "system",
24752
25277
  addonId: null,
24753
25278
  access: "create"
24754
25279
  },
24755
- "restreamer.unregisterDevice": {
24756
- capName: "restreamer",
25280
+ "serverManagement.getServerPackageStatus": {
25281
+ capName: "server-management",
24757
25282
  capScope: "system",
24758
25283
  addonId: null,
24759
- access: "delete"
25284
+ access: "view"
24760
25285
  },
24761
- "scriptRunner.run": {
24762
- capName: "script-runner",
24763
- capScope: "device",
25286
+ "serverManagement.restartServer": {
25287
+ capName: "server-management",
25288
+ capScope: "system",
24764
25289
  addonId: null,
24765
25290
  access: "create"
24766
25291
  },
24767
- "scriptRunner.stop": {
24768
- capName: "script-runner",
24769
- capScope: "device",
25292
+ "serverManagement.rollbackServerUpdate": {
25293
+ capName: "server-management",
25294
+ capScope: "system",
24770
25295
  addonId: null,
24771
25296
  access: "create"
24772
25297
  },
@@ -24854,23 +25379,17 @@ Object.freeze({
24854
25379
  addonId: null,
24855
25380
  access: "view"
24856
25381
  },
24857
- "snapshot.invalidateCache": {
25382
+ "snapshot.getSnapshotOverview": {
24858
25383
  capName: "snapshot",
24859
25384
  capScope: "device",
24860
25385
  addonId: null,
24861
- access: "create"
24862
- },
24863
- "snapshotProvider.getSnapshot": {
24864
- capName: "snapshot-provider",
24865
- capScope: "system",
24866
- addonId: null,
24867
25386
  access: "view"
24868
25387
  },
24869
- "snapshotProvider.supportsDevice": {
24870
- capName: "snapshot-provider",
24871
- capScope: "system",
25388
+ "snapshot.invalidateCache": {
25389
+ capName: "snapshot",
25390
+ capScope: "device",
24872
25391
  addonId: null,
24873
- access: "view"
25392
+ access: "create"
24874
25393
  },
24875
25394
  "ssoBridge.signBridgeToken": {
24876
25395
  capName: "sso-bridge",
@@ -25298,30 +25817,6 @@ Object.freeze({
25298
25817
  addonId: null,
25299
25818
  access: "view"
25300
25819
  },
25301
- "streamingEngine.getStreamUrl": {
25302
- capName: "streaming-engine",
25303
- capScope: "system",
25304
- addonId: null,
25305
- access: "view"
25306
- },
25307
- "streamingEngine.listStreams": {
25308
- capName: "streaming-engine",
25309
- capScope: "system",
25310
- addonId: null,
25311
- access: "view"
25312
- },
25313
- "streamingEngine.registerStream": {
25314
- capName: "streaming-engine",
25315
- capScope: "system",
25316
- addonId: null,
25317
- access: "create"
25318
- },
25319
- "streamingEngine.unregisterStream": {
25320
- capName: "streaming-engine",
25321
- capScope: "system",
25322
- addonId: null,
25323
- access: "delete"
25324
- },
25325
25820
  "streamParams.getConfigSchema": {
25326
25821
  capName: "stream-params",
25327
25822
  capScope: "device",
@@ -25568,6 +26063,12 @@ Object.freeze({
25568
26063
  addonId: null,
25569
26064
  access: "view"
25570
26065
  },
26066
+ "userPasskeys.beginDiscoverableAuthentication": {
26067
+ capName: "user-passkeys",
26068
+ capScope: "system",
26069
+ addonId: null,
26070
+ access: "view"
26071
+ },
25571
26072
  "userPasskeys.beginRegistration": {
25572
26073
  capName: "user-passkeys",
25573
26074
  capScope: "system",
@@ -25580,12 +26081,24 @@ Object.freeze({
25580
26081
  addonId: null,
25581
26082
  access: "view"
25582
26083
  },
26084
+ "userPasskeys.finishDiscoverableAuthentication": {
26085
+ capName: "user-passkeys",
26086
+ capScope: "system",
26087
+ addonId: null,
26088
+ access: "view"
26089
+ },
25583
26090
  "userPasskeys.finishRegistration": {
25584
26091
  capName: "user-passkeys",
25585
26092
  capScope: "system",
25586
26093
  addonId: null,
25587
26094
  access: "create"
25588
26095
  },
26096
+ "userPasskeys.getSecondFactorPreference": {
26097
+ capName: "user-passkeys",
26098
+ capScope: "system",
26099
+ addonId: null,
26100
+ access: "view"
26101
+ },
25589
26102
  "userPasskeys.listPasskeys": {
25590
26103
  capName: "user-passkeys",
25591
26104
  capScope: "system",
@@ -25598,6 +26111,12 @@ Object.freeze({
25598
26111
  addonId: null,
25599
26112
  access: "delete"
25600
26113
  },
26114
+ "userPasskeys.setSecondFactorPreference": {
26115
+ capName: "user-passkeys",
26116
+ capScope: "system",
26117
+ addonId: null,
26118
+ access: "create"
26119
+ },
25601
26120
  "vacuumControl.locate": {
25602
26121
  capName: "vacuum-control",
25603
26122
  capScope: "device",
@@ -25670,6 +26189,18 @@ Object.freeze({
25670
26189
  addonId: null,
25671
26190
  access: "view"
25672
26191
  },
26192
+ "viewerUi.getStaticDir": {
26193
+ capName: "viewer-ui",
26194
+ capScope: "system",
26195
+ addonId: null,
26196
+ access: "view"
26197
+ },
26198
+ "viewerUi.getVersion": {
26199
+ capName: "viewer-ui",
26200
+ capScope: "system",
26201
+ addonId: null,
26202
+ access: "view"
26203
+ },
25673
26204
  "waterHeater.setAway": {
25674
26205
  capName: "water-heater",
25675
26206
  capScope: "device",
@@ -25688,54 +26219,6 @@ Object.freeze({
25688
26219
  addonId: null,
25689
26220
  access: "create"
25690
26221
  },
25691
- "webrtc.closeSession": {
25692
- capName: "webrtc",
25693
- capScope: "system",
25694
- addonId: null,
25695
- access: "create"
25696
- },
25697
- "webrtc.createSession": {
25698
- capName: "webrtc",
25699
- capScope: "system",
25700
- addonId: null,
25701
- access: "create"
25702
- },
25703
- "webrtc.handleAnswer": {
25704
- capName: "webrtc",
25705
- capScope: "system",
25706
- addonId: null,
25707
- access: "create"
25708
- },
25709
- "webrtc.handleOffer": {
25710
- capName: "webrtc",
25711
- capScope: "system",
25712
- addonId: null,
25713
- access: "create"
25714
- },
25715
- "webrtc.hasAdaptiveBitrate": {
25716
- capName: "webrtc",
25717
- capScope: "system",
25718
- addonId: null,
25719
- access: "view"
25720
- },
25721
- "webrtc.registerStream": {
25722
- capName: "webrtc",
25723
- capScope: "system",
25724
- addonId: null,
25725
- access: "create"
25726
- },
25727
- "webrtc.supportsStream": {
25728
- capName: "webrtc",
25729
- capScope: "system",
25730
- addonId: null,
25731
- access: "view"
25732
- },
25733
- "webrtc.unregisterStream": {
25734
- capName: "webrtc",
25735
- capScope: "system",
25736
- addonId: null,
25737
- access: "delete"
25738
- },
25739
26222
  "webrtcSession.addIceCandidate": {
25740
26223
  capName: "webrtc-session",
25741
26224
  capScope: "device",
@@ -25949,6 +26432,72 @@ function maskUrlCredentials(rawUrl) {
25949
26432
  return rawUrl;
25950
26433
  }
25951
26434
  }
26435
+ //#endregion
26436
+ //#region src/rtsp-reachability.ts
26437
+ /**
26438
+ * Control-plane reachability probe for a generic RTSP camera.
26439
+ *
26440
+ * Unlike Hikvision/Amcrest/ONVIF, an RTSP source exposes NO management API —
26441
+ * we only have an `rtsp://` URL. Reachability is therefore probed at the RTSP
26442
+ * control channel itself:
26443
+ *
26444
+ * 1. open a TCP connection to the RTSP `host:port` (default 554);
26445
+ * 2. best-effort send an RTSP `OPTIONS` request;
26446
+ * 3. treat an `RTSP/…` response OR a successful TCP handshake (even without
26447
+ * a response before the deadline) as REACHABLE.
26448
+ *
26449
+ * A successful TCP handshake already proves the camera's RTSP port is live —
26450
+ * the `OPTIONS` round-trip is a stronger confirmation when the server answers
26451
+ * promptly, but we deliberately fall back to the bare connect so a camera that
26452
+ * gates `OPTIONS` behind auth (or is simply slow to answer) is not wrongly
26453
+ * marked offline.
26454
+ *
26455
+ * The socket is always destroyed; the probe never throws and resolves within
26456
+ * `timeoutMs`.
26457
+ */
26458
+ var DEFAULT_RTSP_PORT = 554;
26459
+ /** Parse `host` + `port` out of an `rtsp://` URL. Credentials/path ignored. */
26460
+ function parseRtspTarget(url) {
26461
+ try {
26462
+ const parsed = new URL(url);
26463
+ if (!parsed.hostname) return null;
26464
+ const port = parsed.port ? Number.parseInt(parsed.port, 10) : DEFAULT_RTSP_PORT;
26465
+ if (!Number.isFinite(port) || port <= 0 || port > 65535) return null;
26466
+ return {
26467
+ host: parsed.hostname,
26468
+ port
26469
+ };
26470
+ } catch {
26471
+ return null;
26472
+ }
26473
+ }
26474
+ async function probeRtspReachable(url, timeoutMs) {
26475
+ const target = parseRtspTarget(url);
26476
+ if (!target) return false;
26477
+ return new Promise((resolve) => {
26478
+ let settled = false;
26479
+ let connected = false;
26480
+ const socket = new node_net.default.Socket();
26481
+ const finish = (reachable) => {
26482
+ if (settled) return;
26483
+ settled = true;
26484
+ socket.destroy();
26485
+ resolve(reachable);
26486
+ };
26487
+ socket.setTimeout(timeoutMs);
26488
+ socket.once("timeout", () => finish(connected));
26489
+ socket.once("error", () => finish(false));
26490
+ socket.once("connect", () => {
26491
+ connected = true;
26492
+ const request = `OPTIONS ${url} RTSP/1.0\r\nCSeq: 1\r\nUser-Agent: camstack-reachability\r\n\r\n`;
26493
+ socket.write(request, () => {});
26494
+ });
26495
+ socket.once("data", (buf) => {
26496
+ finish(buf.toString("latin1").startsWith("RTSP/") || connected);
26497
+ });
26498
+ socket.connect(target.port, target.host);
26499
+ });
26500
+ }
25952
26501
  var rtspCameraSchema = object({
25953
26502
  streams: preprocess((raw) => {
25954
26503
  if (!Array.isArray(raw)) return raw;
@@ -25986,15 +26535,44 @@ var legacyStreamSchema = object({
25986
26535
  label: CamProfileSchema,
25987
26536
  url: string()
25988
26537
  });
25989
- var RtspCamera = class extends BaseDevice {
26538
+ var RtspCamera = class RtspCamera extends BaseDevice {
25990
26539
  type = DeviceType.Camera;
25991
26540
  features = [];
26541
+ /** Control-plane reachability poll — an RTSP `OPTIONS`/TCP-connect probe to
26542
+ * the camera's RTSP port every 30s drives `device.online`, decoupled from
26543
+ * stream-broker video health. Started in `onActivate`, stopped in
26544
+ * `removeDevice`. */
26545
+ reachabilityPoll = null;
25992
26546
  constructor(ctx) {
25993
26547
  super(ctx, rtspCameraSchema, { type: DeviceType.Camera });
25994
26548
  this.migrateLegacyStreamsIfNeeded(ctx.persistedConfig ?? {});
25995
26549
  this.registerSnapshotProvider();
25996
26550
  this.registerStreamCatalogProvider();
25997
26551
  }
26552
+ /** Phase 5 — device is live: begin the control-plane reachability poll. */
26553
+ async onActivate() {
26554
+ this.startReachabilityPolling();
26555
+ }
26556
+ /** Start the RTSP reachability poll: a lightweight `OPTIONS`/TCP-connect
26557
+ * probe to the first configured stream's `host:port` every 30s drives
26558
+ * `device.online`, with hysteresis. Idempotent. */
26559
+ startReachabilityPolling() {
26560
+ if (this.reachabilityPoll) return;
26561
+ this.reachabilityPoll = startReachabilityPoll({
26562
+ probe: async () => {
26563
+ const url = this.config.get("streams")[0]?.url;
26564
+ if (!url) return false;
26565
+ return probeRtspReachable(url, RtspCamera.RTSP_PROBE_TIMEOUT_MS);
26566
+ },
26567
+ setOnline: (online) => {
26568
+ this.markOnline(online);
26569
+ },
26570
+ isEnabled: () => !this.disabled,
26571
+ logger: this.ctx.logger
26572
+ });
26573
+ }
26574
+ /** Per-probe TCP/RTSP round-trip budget — a dead host resolves as a miss. */
26575
+ static RTSP_PROBE_TIMEOUT_MS = 5e3;
25998
26576
  /**
25999
26577
  * Build this camera's pull-able stream catalog — the descriptors the
26000
26578
  * stream-broker needs to dial. Single source of truth feeding the
@@ -26085,6 +26663,8 @@ var RtspCamera = class extends BaseDevice {
26085
26663
  }
26086
26664
  async removeDevice() {
26087
26665
  this.ctx.logger.info("Removing RTSP camera", { meta: { stableId: this.stableId } });
26666
+ this.reachabilityPoll?.stop();
26667
+ this.reachabilityPoll = null;
26088
26668
  const streams = this.config.get("streams");
26089
26669
  await Promise.all(streams.map((s) => this.ctx.api.streamBroker.retractCameraStream.mutate({
26090
26670
  deviceId: this.id,
@@ -26362,21 +26942,7 @@ var RtspProviderAddon = class extends BaseDeviceProvider {
26362
26942
  super({});
26363
26943
  }
26364
26944
  async onInitialize() {
26365
- const regs = await super.onInitialize();
26366
- this.subscribe({ category: EventCategory.DeviceStateChanged }, (event) => {
26367
- const data = event.data;
26368
- if (data.capName !== "camera-streams") return;
26369
- const deviceId = data.deviceId;
26370
- if (typeof deviceId !== "number") return;
26371
- const registry = this.ctx.kernel.deviceRegistry;
26372
- if (!registry) return;
26373
- if (registry.getAddonId(deviceId) !== this.addonId) return;
26374
- const device = registry.getById(deviceId);
26375
- if (!device) return;
26376
- const online = data.slice?.online === true;
26377
- if (device.online !== online) device.online = online;
26378
- });
26379
- return regs;
26945
+ return await super.onInitialize();
26380
26946
  }
26381
26947
  async onGetCreationSchema(type) {
26382
26948
  if (type !== DeviceType.Camera) return null;