@camstack/addon-decoder-ffmpeg 1.1.9 → 1.1.10

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 +490 -525
  2. package/dist/index.mjs +488 -523
  3. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { FrameRingReaderCache, FrameRingWriter, MIN_RING_SLOTS, computeSegmentSize, computeSlotByteLength, createSegment, deriveSlotCount, unlinkSegment } from "@camstack/shm-ring";
2
+ import { DecoderFrameRingSink, FrameRingReaderCache, RING_BUDGET_MB, SEGMENT_NAME_PREFIX, unlinkSegment } from "@camstack/shm-ring";
3
3
  import { spawn } from "node:child_process";
4
4
  import { readdirSync } from "node:fs";
5
5
  //#region ../../node_modules/zod/v4/core/core.js
@@ -4631,7 +4631,7 @@ function _instanceof(cls, params = {}) {
4631
4631
  return inst;
4632
4632
  }
4633
4633
  //#endregion
4634
- //#region ../types/dist/sleep-CZDdRBua.mjs
4634
+ //#region ../types/dist/sleep-DJaTV2D7.mjs
4635
4635
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4636
4636
  EventCategory["SystemBoot"] = "system.boot";
4637
4637
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -4817,6 +4817,18 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
4817
4817
  */
4818
4818
  EventCategory["PipelineCameraUpdated"] = "pipeline.camera-updated";
4819
4819
  /**
4820
+ * The cluster camera-source OWNER changed (`clusterRoles.ingestNode`).
4821
+ * Emitted by addon-pipeline-orchestrator whenever it (re)derives node
4822
+ * capabilities — at boot, on agent online/offline, and on an ingest-node
4823
+ * flip. Carries the resolved `ownerNodeId`. The stream-broker consumes it to
4824
+ * keep its ingest-owner-gate decision current WITHOUT a per-`ensureBroker`
4825
+ * cross-process `getIngestOwner` query (push the authority's decision instead
4826
+ * of polling it on the hot path). Idempotent state — re-emitted on every
4827
+ * topology change, so a dropped event self-heals on the next one (plus the
4828
+ * broker's long backstop reconcile query).
4829
+ */
4830
+ EventCategory["PipelineIngestOwnerChanged"] = "pipeline.ingest-owner-changed";
4831
+ /**
4820
4832
  * Periodic snapshot of per-node pipeline-runner load
4821
4833
  * (`RunnerLocalLoad`). Emitted ~1Hz by every runner so UI dashboards
4822
4834
  * subscribe instead of polling `pipelineRunner.getLocalLoad`.
@@ -5340,10 +5352,6 @@ function hydrateField(field, values) {
5340
5352
  };
5341
5353
  }
5342
5354
  const rawValue = storedValue !== void 0 ? storedValue : defaultValue !== void 0 ? defaultValue : null;
5343
- if (field.type === "password") return {
5344
- ...field,
5345
- value: ""
5346
- };
5347
5355
  const value = field.type === "textarea" && field.isJson && rawValue !== null && typeof rawValue === "object" ? JSON.stringify(rawValue, null, 2) : rawValue;
5348
5356
  return {
5349
5357
  ...field,
@@ -6727,6 +6735,9 @@ function method(input, output, options) {
6727
6735
  timeoutMs: options?.timeoutMs
6728
6736
  };
6729
6737
  }
6738
+ var StaticDirOutputSchema$1 = object({ staticDir: string() });
6739
+ var VersionOutputSchema$1 = object({ version: string() });
6740
+ method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6730
6741
  var StaticDirOutputSchema = object({ staticDir: string() });
6731
6742
  var VersionOutputSchema = object({ version: string() });
6732
6743
  method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
@@ -6908,6 +6919,36 @@ var ModelFormatsSchema = object({
6908
6919
  tflite: ModelFormatEntrySchema.optional(),
6909
6920
  pt: ModelFormatEntrySchema.optional()
6910
6921
  });
6922
+ /**
6923
+ * Variant-selector grouping axes. Shared by the full `ModelCatalogEntry` and by
6924
+ * the reduced `PipelineModelOption` returned in `pipeline.getSchema()` so the
6925
+ * grouped Family→Tier→Variant picker renders identically in the config UI and
6926
+ * in the pipeline/device steppers. The flat `id` stays the source of truth for
6927
+ * resolution/download/persistence; this is a presentation overlay resolved back
6928
+ * to an `id`.
6929
+ */
6930
+ var ModelVariantGroupSchema = object({
6931
+ /** Top-level family, e.g. `yolo26` (later `d-fine`, `rf-detr`). */
6932
+ family: string(),
6933
+ /** Size within the family, e.g. `n` | `s` | `m` | `l`. */
6934
+ tier: string(),
6935
+ /** Quantization axis. Omit ⇒ the fp32 base build. */
6936
+ precision: _enum(["fp32", "int8"]).optional(),
6937
+ /**
6938
+ * Speed-optimization axis. Omit ⇒ the standard build. `fast` marks a
6939
+ * latency-optimized export (e.g. ReLU-activation variant) — the slot the
6940
+ * future performance variants plug into.
6941
+ */
6942
+ optimization: _enum(["standard", "fast"]).optional(),
6943
+ /**
6944
+ * Input-resolution axis (square input side, px). Omit ⇒ the family's native
6945
+ * resolution (640 for yolo26). Reduced-input builds (320 / 256) are a big,
6946
+ * cheap latency lever — especially on Apple ANE and the Intel N100 — at a
6947
+ * small-object accuracy cost. Mirrors the model's `inputSize` but lifted onto
6948
+ * the group so the selector can offer it as a variant axis.
6949
+ */
6950
+ resolution: number().int().positive().optional()
6951
+ });
6911
6952
  var ModelCatalogEntrySchema = object({
6912
6953
  id: string(),
6913
6954
  name: string(),
@@ -6937,7 +6978,43 @@ var ModelCatalogEntrySchema = object({
6937
6978
  * Auxiliary files required at runtime (labels JSON, charset dict, etc.).
6938
6979
  * Downloaded into the same modelsDir alongside the model file.
6939
6980
  */
6940
- extraFiles: array(ModelExtraFileSchema).readonly().optional()
6981
+ extraFiles: array(ModelExtraFileSchema).readonly().optional(),
6982
+ /**
6983
+ * LEGACY entry — retained in the catalog so a persisted operator selection
6984
+ * still RESOLVES (and can be re-activated), but hidden from the selectable
6985
+ * model list and excluded from the auto format-default pick. Set on the
6986
+ * superseded / consolidated models (older lineages, redundant fp16 IRs) so
6987
+ * the active lineup stays the coherent curated ladder without deleting a
6988
+ * model anyone may still be pinned to. `resolveModelForFormat` keeps honoring
6989
+ * an explicit legacy id that has a build for the node's format.
6990
+ */
6991
+ legacy: boolean().optional(),
6992
+ /**
6993
+ * Measured quality/latency metadata — populated from the benchmark addon on
6994
+ * the real node classes. Absent = not yet measured (most entries today; the
6995
+ * catalog historically carried only `sizeMB`, a poor cross-architecture
6996
+ * speed proxy). `p95LatencyMs` is keyed by node class (e.g. `n100`, `mac`).
6997
+ */
6998
+ metrics: object({
6999
+ map50: number().optional(),
7000
+ p95LatencyMs: record(string(), number()).optional()
7001
+ }).optional(),
7002
+ /**
7003
+ * SPDX-ish license id of the model weights (e.g. `AGPL-3.0` for Ultralytics
7004
+ * YOLO26, `GPL-3.0` for YOLOv9, `Apache-2.0` for D-FINE/RF-DETR). Matters for
7005
+ * the retraining addon and any future commercial distribution.
7006
+ */
7007
+ license: string().optional(),
7008
+ /**
7009
+ * Variant-selector grouping. The UI groups models by `family` + `tier` and
7010
+ * offers `precision` / `optimization` as variant axes WITHIN a tier — so all
7011
+ * of a family's sizes and quantizations collapse into one grouped picker
7012
+ * instead of a flat list of `yolo26s`, `yolo26s-int8`, … Absent ⇒ ungrouped
7013
+ * (legacy / custom models) — never shown in the grouped selector. The flat
7014
+ * `id` stays the source of truth for resolution/download/persistence; grouping
7015
+ * is a presentation overlay resolved back to an `id`.
7016
+ */
7017
+ group: ModelVariantGroupSchema.optional()
6941
7018
  });
6942
7019
  var ConvertTargetSchema = discriminatedUnion("format", [object({
6943
7020
  format: literal("openvino"),
@@ -6998,8 +7075,8 @@ var RecordingModeSchema = _enum([
6998
7075
  "onAudioThreshold"
6999
7076
  ]);
7000
7077
  /**
7001
- * First-class, authoritative per-camera storage mode — the netta choice the UI
7002
- * reads directly (never inferred from `rules`):
7078
+ * First-class, authoritative per-camera storage mode — the explicit choice the
7079
+ * UI reads directly (never inferred from `rules`):
7003
7080
  * - `off` — not recording.
7004
7081
  * - `events` — record only around triggers (motion / audio threshold),
7005
7082
  * with pre/post-buffer.
@@ -8647,26 +8724,13 @@ DeviceType.Light, method(object({
8647
8724
  percentage: number().min(0).max(100),
8648
8725
  lastChangedAt: number()
8649
8726
  });
8727
+ /** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
8650
8728
  var StreamFormatSchema = _enum([
8651
8729
  "webrtc",
8652
8730
  "hls",
8653
8731
  "mjpeg",
8654
8732
  "rtsp"
8655
8733
  ]);
8656
- var StreamInfoSchema = object({
8657
- streamId: string(),
8658
- format: StreamFormatSchema,
8659
- url: string().nullable(),
8660
- active: boolean()
8661
- });
8662
- method(object({
8663
- streamId: string(),
8664
- sourceUrl: string(),
8665
- codec: string().optional()
8666
- }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), _void(), { kind: "mutation" }), method(object({
8667
- streamId: string(),
8668
- format: StreamFormatSchema
8669
- }), string().nullable()), method(_void(), array(StreamInfoSchema));
8670
8734
  var RtspRestreamEntrySchema = object({
8671
8735
  brokerId: string(),
8672
8736
  url: string(),
@@ -9331,7 +9395,7 @@ var ConsumablesStatusSchema = object({
9331
9395
  })),
9332
9396
  lastChangedAt: number()
9333
9397
  });
9334
- 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({
9398
+ Object.values(DeviceType), method(object({
9335
9399
  deviceId: number().int().nonnegative(),
9336
9400
  key: string().min(1)
9337
9401
  }), _void(), {
@@ -10246,7 +10310,7 @@ var BoundingBoxSchema = object({
10246
10310
  w: number(),
10247
10311
  h: number()
10248
10312
  });
10249
- var SpatialDetectionSchema = object({
10313
+ object({
10250
10314
  class: string(),
10251
10315
  originalClass: string(),
10252
10316
  score: number(),
@@ -10381,7 +10445,6 @@ var PipelineDefaultStepSchema = lazy(() => object({
10381
10445
  enabled: boolean(),
10382
10446
  modelId: string(),
10383
10447
  children: array(PipelineDefaultStepSchema).readonly(),
10384
- engine: PipelineEngineChoiceSchema.optional(),
10385
10448
  group: string().optional(),
10386
10449
  settings: record(string(), unknown()).optional()
10387
10450
  }));
@@ -10406,7 +10469,9 @@ var PipelineModelOptionSchema = object({
10406
10469
  formats: record(string(), object({
10407
10470
  downloaded: boolean(),
10408
10471
  sizeMB: number()
10409
- }))
10472
+ })),
10473
+ group: ModelVariantGroupSchema.optional(),
10474
+ legacy: boolean().optional()
10410
10475
  });
10411
10476
  var ConfigFieldBridge = custom();
10412
10477
  var PipelineAddonSchemaSchema = object({
@@ -10436,11 +10501,6 @@ var PipelineSchemaSchema = object({
10436
10501
  selectedEngine: PipelineEngineChoiceSchema,
10437
10502
  slots: array(PipelineSlotSchemaSchema).readonly()
10438
10503
  });
10439
- var DetectorOutputSchema = object({
10440
- detections: array(SpatialDetectionSchema).readonly(),
10441
- inferenceMs: number(),
10442
- modelId: string()
10443
- });
10444
10504
  var EngineProvisioningSchema = object({
10445
10505
  runtimeId: _enum([
10446
10506
  "onnx",
@@ -10457,15 +10517,42 @@ var EngineProvisioningSchema = object({
10457
10517
  ]),
10458
10518
  progress: number().optional(),
10459
10519
  error: string().optional(),
10460
- nextRetryAt: number().optional()
10520
+ nextRetryAt: number().optional(),
10521
+ /**
10522
+ * Gate A (config-correctness gate at engine change): human-readable
10523
+ * config issues surfaced EAGERLY when the node's engine changes — model
10524
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
10525
+ * has a <format> build"). Additive/optional: informational only, never
10526
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
10527
+ * Absent/empty when the node-default tree resolves cleanly.
10528
+ */
10529
+ configIssues: array(string()).optional()
10461
10530
  });
10462
10531
  var PipelineStepInputSchema = lazy(() => object({
10463
10532
  addonId: string(),
10464
- modelId: string(),
10533
+ modelId: string().optional(),
10465
10534
  enabled: boolean().default(true),
10466
10535
  children: array(PipelineStepInputSchema).optional(),
10467
10536
  settings: record(string(), unknown()).optional()
10468
10537
  }));
10538
+ var ModelSubstitutionSchema = object({
10539
+ addonId: string(),
10540
+ chosen: string(),
10541
+ running: string(),
10542
+ format: string()
10543
+ });
10544
+ var PipelineValidationIssueSchema = object({
10545
+ addonId: string(),
10546
+ kind: _enum(["unknown-addon", "no-format-build"]),
10547
+ detail: string()
10548
+ });
10549
+ var PipelineValidationResultSchema = object({
10550
+ ok: boolean(),
10551
+ issues: array(PipelineValidationIssueSchema).readonly(),
10552
+ substitutions: array(ModelSubstitutionSchema).readonly(),
10553
+ /** The node's `currentEngine.format` this validation ran against. */
10554
+ format: string()
10555
+ });
10469
10556
  var ReferenceImageEntrySchema = object({
10470
10557
  filename: string(),
10471
10558
  stepIds: array(string()).readonly().optional()
@@ -10536,7 +10623,13 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10536
10623
  })) }), object({ success: literal(true) }), {
10537
10624
  kind: "mutation",
10538
10625
  auth: "admin"
10539
- }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
10626
+ }), method(object({ nodeId: string() }), object({
10627
+ success: literal(true),
10628
+ clearedDevices: number()
10629
+ }), {
10630
+ kind: "mutation",
10631
+ auth: "admin"
10632
+ }), 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({
10540
10633
  name: string(),
10541
10634
  steps: array(PipelineTemplateStepSchema).readonly(),
10542
10635
  engine: PipelineEngineChoiceSchema
@@ -10553,10 +10646,6 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10553
10646
  modelId: string(),
10554
10647
  format: ModelFormatSchema$1
10555
10648
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
10556
- addonId: string(),
10557
- frame: FrameInputSchema,
10558
- config: record(string(), unknown()).optional()
10559
- }), DetectorOutputSchema), method(object({
10560
10649
  engine: PipelineEngineChoiceSchema.optional(),
10561
10650
  steps: array(PipelineStepInputSchema).min(1),
10562
10651
  frame: FrameInputSchema.optional(),
@@ -10796,6 +10885,13 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
10796
10885
  kind: literal("remote-restream"),
10797
10886
  /** The camera's source-owner node (slice 1: always the hub). */
10798
10887
  ownerNodeId: string(),
10888
+ /**
10889
+ * The owner's LAN-reachable host, resolved by the orchestrator from the
10890
+ * per-node `reachableHost` override (Cluster UI). When present the runner
10891
+ * dials THIS host for the owner's restream, in preference to the
10892
+ * `CAMSTACK_HUB_URL`-derived default. Absent → auto-detect fallback.
10893
+ */
10894
+ ownerReachableHost: string().optional(),
10799
10895
  /** Operator override for the owner host the runner dials. */
10800
10896
  hubHostnameOverride: string().optional()
10801
10897
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
@@ -10804,13 +10900,11 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
10804
10900
  * specific runner instance via `attachCamera`. Carries everything the
10805
10901
  * runner needs to subscribe to the local broker and execute inference.
10806
10902
  *
10807
- * Stateless-pipeline model: the full pipeline content (`engine`, `steps`,
10808
- * optional `audio`) travels with the attach payload. The runner keeps it
10809
- * in RAM for the lifetime of the attach — on rebalance, edit, or
10810
- * restart the orchestrator re-sends the latest snapshot.
10811
- *
10812
- * `engine`/`steps`/`audio` are optional during the additive migration
10813
- * window; once orchestrator + UI are migrated they become required.
10903
+ * Stateless-pipeline model: the pipeline content (`steps`, optional
10904
+ * `audio`) travels with the attach payload. The runner keeps it in RAM
10905
+ * for the lifetime of the attach — on rebalance, edit, or restart the
10906
+ * orchestrator re-sends the latest snapshot. Engine is NOT carried: it is
10907
+ * node-local, resolved by the executing runner at dispatch time.
10814
10908
  */
10815
10909
  var RunnerCameraConfigSchema = object({
10816
10910
  deviceId: number(),
@@ -10861,14 +10955,11 @@ var RunnerCameraConfigSchema = object({
10861
10955
  */
10862
10956
  motionSources: MotionSourcesSchema.default(["analyzer"]),
10863
10957
  pipelineEnabled: boolean().default(true),
10864
- /** Engine choice for video steps (runtime+backend+format). */
10865
- engine: PipelineEngineChoiceSchema.optional(),
10866
10958
  /** Ordered tree of video steps. Absent → runner skips video detection. */
10867
10959
  steps: array(PipelineStepInputSchema).readonly().optional(),
10868
10960
  /** Audio classification branch. `enabled:false` disables, null skips. */
10869
10961
  audio: object({
10870
- engine: PipelineEngineChoiceSchema,
10871
- modelId: string(),
10962
+ modelId: string().optional(),
10872
10963
  enabled: boolean()
10873
10964
  }).nullable().optional(),
10874
10965
  /**
@@ -12249,7 +12340,9 @@ var AddonPageDeclarationSchema$1 = object({
12249
12340
  icon: string(),
12250
12341
  path: string(),
12251
12342
  remoteName: string(),
12252
- bundle: string()
12343
+ bundle: string(),
12344
+ section: string().optional(),
12345
+ sectionLabel: string().optional()
12253
12346
  });
12254
12347
  var AddonPageInfoSchema = object({
12255
12348
  addonId: string(),
@@ -12289,7 +12382,18 @@ var AddonPageDeclarationSchema = object({
12289
12382
  * the static-file route can compute an mtime-based cache-buster URL
12290
12383
  * without a separate filesystem stat.
12291
12384
  */
12292
- bundle: string()
12385
+ bundle: string(),
12386
+ /**
12387
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
12388
+ * `'cluster'`, `'administration'` — the page renders inside that group.
12389
+ * Any OTHER string creates (or joins) a custom section rendered after
12390
+ * the built-in groups; its label comes from `sectionLabel` (first
12391
+ * declaration wins), falling back to the id. Absent → the legacy
12392
+ * "Addon Pages" group.
12393
+ */
12394
+ section: string().optional(),
12395
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
12396
+ sectionLabel: string().optional()
12293
12397
  });
12294
12398
  method(_void(), array(AddonPageDeclarationSchema).readonly());
12295
12399
  var AddonHttpRouteSchema = object({
@@ -12505,6 +12609,17 @@ var WidgetMetadataSchema = object({
12505
12609
  deviceContext: boolean().default(false),
12506
12610
  integrationContext: boolean().default(false)
12507
12611
  }),
12612
+ /**
12613
+ * Loadable BEFORE authentication. The normal widget registry listing
12614
+ * (`addon-widgets.listWidgets`) is auth-gated, so a pre-auth surface
12615
+ * (the login page) cannot discover a widget through it. A widget that
12616
+ * declares `preAuth: true` marks itself as safe to mount on a pre-auth
12617
+ * screen — it is surfaced through the PUBLIC `auth.listLoginMethods`
12618
+ * login-method contribution channel (see `login-method.cap.ts`) rather
12619
+ * than the authenticated registry, and its bundle is served by the
12620
+ * public `/api/addon-widgets/:addonId/*` static route. Defaults false.
12621
+ */
12622
+ preAuth: boolean().optional().default(false),
12508
12623
  /** Dashboard placement HINTS (operator can override per instance). */
12509
12624
  defaultSize: WidgetSizeEnum.default("md"),
12510
12625
  allowedSizes: array(WidgetSizeEnum).readonly().default([
@@ -12843,6 +12958,66 @@ method(object({
12843
12958
  password: string()
12844
12959
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
12845
12960
  /**
12961
+ * `login-method` — collection cap through which auth addons contribute
12962
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
12963
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
12964
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
12965
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
12966
+ * procedure aggregates them for the unauthenticated login page.
12967
+ *
12968
+ * A contribution is a discriminated union on `kind`:
12969
+ *
12970
+ * - `redirect` — a declarative button. The login page renders a generic
12971
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
12972
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
12973
+ * ZERO shell-side JS. A future SSO addon plugs in the same way — the
12974
+ * login page needs NO change.
12975
+ *
12976
+ * - `widget` — a Module-Federation widget the login page mounts (via
12977
+ * `loadRemoteBundle`) for an in-page ceremony. Covers the passkey
12978
+ * login ceremony, which must run `@simplewebauthn/browser` INSIDE the
12979
+ * addon bundle. The referenced widget also declares `preAuth: true` in
12980
+ * its `addon-widgets-source` catalog entry. `auth.listLoginMethods`
12981
+ * stamps a public `bundleUrl` from `addonId` + `bundle`.
12982
+ *
12983
+ * Every contribution carries a `stage`:
12984
+ * - `primary` — shown on the first credentials screen (OIDC /
12985
+ * magic-link buttons; a future usernameless passkey).
12986
+ * - `second-factor` — shown AFTER the password leg, gated on the
12987
+ * returned `factors` (passkey-as-2FA today).
12988
+ *
12989
+ * `mount: skip` — the cap is read server-side by the core auth router
12990
+ * (`registry.getCollection('login-method')`), never mounted as its own
12991
+ * tRPC router.
12992
+ */
12993
+ /** When a login method renders in the two-phase login flow. */
12994
+ var LoginStageEnum = _enum(["primary", "second-factor"]);
12995
+ /** One login-method contribution — redirect button OR pre-auth widget. */
12996
+ var LoginMethodContributionSchema = discriminatedUnion("kind", [object({
12997
+ kind: literal("redirect"),
12998
+ /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
12999
+ id: string(),
13000
+ /** Operator-facing button label. */
13001
+ label: string(),
13002
+ /** lucide-react icon name. */
13003
+ icon: string().optional(),
13004
+ /** Addon-owned HTTP route the button navigates to (GET). */
13005
+ startUrl: string(),
13006
+ stage: LoginStageEnum
13007
+ }), object({
13008
+ kind: literal("widget"),
13009
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
13010
+ id: string(),
13011
+ /** Owning addon id — drives the public bundle URL + the MF namespace. */
13012
+ addonId: string(),
13013
+ /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
13014
+ bundle: string(),
13015
+ /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
13016
+ remote: WidgetRemoteSchema,
13017
+ stage: LoginStageEnum
13018
+ })]);
13019
+ method(_void(), array(LoginMethodContributionSchema).readonly());
13020
+ /**
12846
13021
  * Orchestrator-side destination metadata. The orchestrator computes
12847
13022
  * `id = <addonId>:<subId>` from its provider lookup so consumers
12848
13023
  * (admin UI, restore flow) see one canonical key.
@@ -15224,11 +15399,11 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
15224
15399
  timestamp: number()
15225
15400
  });
15226
15401
  var CameraPipelineConfigSchema = object({
15227
- engine: PipelineEngineChoiceSchema,
15402
+ engine: PipelineEngineChoiceSchema.optional(),
15228
15403
  steps: array(PipelineStepInputSchema).readonly(),
15229
15404
  audio: object({
15230
- engine: PipelineEngineChoiceSchema,
15231
- modelId: string(),
15405
+ engine: PipelineEngineChoiceSchema.optional(),
15406
+ modelId: string().optional(),
15232
15407
  enabled: boolean(),
15233
15408
  settings: record(string(), unknown()).readonly().optional()
15234
15409
  }).nullable().optional()
@@ -15243,7 +15418,7 @@ var PipelineTemplateSchema = object({
15243
15418
  });
15244
15419
  var AgentAddonConfigSchema = object({
15245
15420
  enabled: boolean(),
15246
- modelId: string(),
15421
+ modelId: string().optional(),
15247
15422
  settings: record(string(), unknown()).readonly()
15248
15423
  });
15249
15424
  var AgentPipelineSettingsSchema = object({
@@ -15253,12 +15428,25 @@ var AgentPipelineSettingsSchema = object({
15253
15428
  detectWeight: number().positive().optional(),
15254
15429
  /** Node is eligible to run the detection pipeline (decode + inference). */
15255
15430
  detect: boolean().optional(),
15256
- /** Node is eligible to host decoder sessions. */
15431
+ /**
15432
+ * DEPRECATED AND IGNORED. Decode is always co-located with its frame
15433
+ * consumer, so decode eligibility IS detect eligibility. Kept optional in
15434
+ * the schema ONLY so persisted stores written before the removal still
15435
+ * parse — no code reads it and no write path emits it.
15436
+ */
15257
15437
  decode: boolean().optional(),
15258
15438
  /** Node is eligible to run audio-analyzer sessions. */
15259
15439
  audio: boolean().optional(),
15260
15440
  /** Node is eligible to be the ingest / source-owner (serve the restream). */
15261
- ingest: boolean().optional()
15441
+ ingest: boolean().optional(),
15442
+ /**
15443
+ * Operator override for the LAN host a cross-node decoder dials to reach
15444
+ * THIS node's restream (Cluster UI). Absent → auto-detect: a remote runner
15445
+ * falls back to its `CAMSTACK_HUB_URL`-derived host (the Moleculer address
15446
+ * it already uses to reach the hub). Set this only when the auto-detected
15447
+ * address is wrong (multi-homed host, NAT, custom interface).
15448
+ */
15449
+ reachableHost: string().optional()
15262
15450
  });
15263
15451
  var CameraPipelineForAgentSchema = object({
15264
15452
  steps: array(PipelineStepInputSchema).readonly(),
@@ -15306,25 +15494,6 @@ var PipelineAssignmentSchema = object({
15306
15494
  assignedAt: number()
15307
15495
  });
15308
15496
  /**
15309
- * Decoder placement record. Symmetric to `PipelineAssignmentSchema` but for
15310
- * the decoder-node placement domain (`balanceDecoder` decision: manual pin
15311
- * → co-located with pipeline → capacity).
15312
- */
15313
- var DecoderAssignmentSchema = object({
15314
- deviceId: number(),
15315
- /** Moleculer node id of the decoder provider currently responsible for this camera. */
15316
- decoderNodeId: string(),
15317
- /** True when the assignment was set manually via `assignDecoder`, false when chosen by the balancer. */
15318
- pinned: boolean(),
15319
- /** Why this assignment was made — useful for debugging the decoder balancer. */
15320
- reason: _enum([
15321
- "manual",
15322
- "co-located",
15323
- "capacity",
15324
- "hardware-affinity"
15325
- ])
15326
- });
15327
- /**
15328
15497
  * Per-agent load summary surfaced to the load balancer + dashboards.
15329
15498
  * Aggregated from each runner's `getLocalLoad` cap call.
15330
15499
  */
@@ -15364,6 +15533,15 @@ var GlobalMetricsSchema = object({
15364
15533
  * capability providers.
15365
15534
  */
15366
15535
  var CapabilityBindingsSchema = record(string(), string());
15536
+ /**
15537
+ * The cluster's single camera-source owner (`clusterRoles.ingestNode`) plus
15538
+ * its LAN-reachable host, if one is registered. See `getIngestOwner`.
15539
+ */
15540
+ var IngestOwnerSchema = object({
15541
+ ownerNodeId: string(),
15542
+ reachableHost: string().optional(),
15543
+ configIssue: string().optional()
15544
+ });
15367
15545
  /** Source block — always present; derives from the stream catalog. */
15368
15546
  var CameraSourceStatusSchema = object({ streams: array(object({
15369
15547
  camStreamId: string(),
@@ -15378,6 +15556,14 @@ var CameraAssignmentStatusSchema = object({
15378
15556
  detectionNodeId: string().nullable(),
15379
15557
  decoderNodeId: string().nullable(),
15380
15558
  audioNodeId: string().nullable(),
15559
+ /**
15560
+ * The node that OWNS this camera's physical source pull (dials the RTSP and
15561
+ * hosts the broker/restream) — the cluster ingest owner today
15562
+ * (`clusterRoles.ingestNode`), per-camera once source assignment lands. Lets
15563
+ * the UI show WHERE a camera is sourced without SSH/logs, and is the node the
15564
+ * broker block below was read from (pinned). Nullable only pre-wiring.
15565
+ */
15566
+ sourceNodeId: string().nullable(),
15381
15567
  pinned: object({
15382
15568
  detection: boolean(),
15383
15569
  decoder: boolean(),
@@ -15510,16 +15696,7 @@ method(object({
15510
15696
  }), object({ success: literal(true) }), {
15511
15697
  kind: "mutation",
15512
15698
  auth: "admin"
15513
- }), method(object({
15514
- deviceId: number(),
15515
- nodeId: string()
15516
- }), _void(), {
15517
- kind: "mutation",
15518
- auth: "admin"
15519
- }), method(object({ deviceId: number() }), _void(), {
15520
- kind: "mutation",
15521
- auth: "admin"
15522
- }), method(_void(), array(DecoderAssignmentSchema).readonly()), method(object({
15699
+ }), method(_void(), IngestOwnerSchema), method(object({
15523
15700
  deviceId: number(),
15524
15701
  nodeId: string()
15525
15702
  }), object({ success: literal(true) }), {
@@ -15540,10 +15717,7 @@ method(object({
15540
15717
  nodeId: string(),
15541
15718
  pinned: boolean(),
15542
15719
  assignedAt: number()
15543
- }))), method(object({
15544
- deviceId: number(),
15545
- pipelineNodeId: string().optional()
15546
- }), DecoderAssignmentSchema), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
15720
+ }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
15547
15721
  nodeId: string(),
15548
15722
  settings: AgentPipelineSettingsSchema
15549
15723
  })).readonly()), method(object({
@@ -15573,12 +15747,26 @@ method(object({
15573
15747
  }), method(object({
15574
15748
  agentNodeId: string(),
15575
15749
  detect: boolean().nullable().optional(),
15576
- decode: boolean().nullable().optional(),
15577
15750
  audio: boolean().nullable().optional(),
15578
15751
  ingest: boolean().nullable().optional()
15579
15752
  }), object({ success: literal(true) }), {
15580
15753
  kind: "mutation",
15581
15754
  auth: "admin"
15755
+ }), method(object({
15756
+ agentNodeId: string(),
15757
+ reachableHost: string().nullable()
15758
+ }), object({ success: literal(true) }), {
15759
+ kind: "mutation",
15760
+ auth: "admin"
15761
+ }), method(object({ agentNodeId: string() }), object({
15762
+ success: literal(true),
15763
+ /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
15764
+ effectiveModelId: string().nullable(),
15765
+ /** Number of cameras whose node-scoped overrides were cleared. */
15766
+ clearedCameraOverrides: number()
15767
+ }), {
15768
+ kind: "mutation",
15769
+ auth: "admin"
15582
15770
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
15583
15771
  deviceId: number(),
15584
15772
  addonId: string(),
@@ -15623,22 +15811,131 @@ method(object({
15623
15811
  kind: "mutation",
15624
15812
  auth: "admin"
15625
15813
  });
15626
- var RegisteredStreamSchema = object({
15627
- streamId: string(),
15628
- label: string().optional(),
15629
- codec: string(),
15630
- type: _enum(["video", "audio"]),
15631
- sourceUrl: string()
15814
+ /**
15815
+ * server-management — per-NODE singleton capability for a node's ROOT
15816
+ * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
15817
+ * agents).
15818
+ *
15819
+ * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
15820
+ * on agents) carries the whole software stack in its npm dep tree, so ONE
15821
+ * version describes the node. Updates install into
15822
+ * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
15823
+ * starter (probation boot + auto-rollback to N-1).
15824
+ *
15825
+ * Providers:
15826
+ * - HUB: `ServerUpdateService` behind the `server-provided` mount
15827
+ * (`buildServerProviders` in trpc.router.ts) — the default target for
15828
+ * unpinned calls.
15829
+ * - AGENT: `AgentUpdateService` registered by the agent bootstrap under
15830
+ * the synthetic `agent-runtime` addonId and declared in the agent's
15831
+ * `$hub.registerNode` manifest.
15832
+ *
15833
+ * Node routing: singleton caps get the codegen/runtime-builder `nodeId`
15834
+ * injection on every method — `input.nodeId` (or `nodePin(nodeId)` from the
15835
+ * SDK) routes the call to that node's provider via the standard remote
15836
+ * proxy (`createCapabilityProxy` → `$agent-cap-fwd` → the agent's
15837
+ * in-process provider lookup). No `nodeId` → the hub's own provider.
15838
+ *
15839
+ * Spec: docs/superpowers/specs/2026-07-12-runtime-updatable-node-packages-design.md
15840
+ */
15841
+ /**
15842
+ * Where the running hub's code was loaded from:
15843
+ * - `workspace` — dev checkout (tsx / workspace dist); the starter defers to
15844
+ * plain resolution and runtime updates are refused.
15845
+ * - `baked` — the immutable image seed closure (no data-dir root active).
15846
+ * - `data-root` — the runtime-updatable `<dataDir>/server-root` closure.
15847
+ */
15848
+ var ServerBootModeSchema = _enum([
15849
+ "workspace",
15850
+ "baked",
15851
+ "data-root"
15852
+ ]);
15853
+ /**
15854
+ * Update lifecycle state:
15855
+ * - `idle` / `checking` / `staging` — steady / in-flight registry work.
15856
+ * - `pending-restart` — a version is staged and the node has NOT yet
15857
+ * restarted onto it (still running the OLD version).
15858
+ * - `awaiting-confirmation` — the node HAS restarted onto the staged version
15859
+ * (it is the active probation boot) and is waiting to confirm boot-health.
15860
+ * Apply/rollback are refused in this state and the node must NOT be
15861
+ * manually restarted, or the probation boot auto-rolls-back.
15862
+ */
15863
+ var ServerUpdateStateSchema = _enum([
15864
+ "idle",
15865
+ "checking",
15866
+ "staging",
15867
+ "pending-restart",
15868
+ "awaiting-confirmation"
15869
+ ]);
15870
+ var ServerRollbackInfoSchema = object({
15871
+ /** The version that failed (or was manually rolled back). */
15872
+ fromVersion: string(),
15873
+ /** The version rolled back to; null = the baked seed. */
15874
+ toVersion: string().nullable(),
15875
+ atMs: number(),
15876
+ reason: string()
15632
15877
  });
15633
- var ExposedResourceSchema = object({
15634
- streamId: string(),
15635
- format: string(),
15636
- value: string()
15878
+ var ServerPackageStatusSchema = object({
15879
+ /** Root package name (`@camstack/server` on the hub). */
15880
+ packageName: string(),
15881
+ /** Version of the code the running process ACTUALLY loaded. */
15882
+ runningVersion: string().nullable(),
15883
+ /** Node.js runtime version the node's process runs on (`process.versions.node`). */
15884
+ nodeRuntimeVersion: string().nullable(),
15885
+ /** Active data-dir root version; null when booted from seed/workspace. */
15886
+ activeVersion: string().nullable(),
15887
+ /** N-1 version kept for rollback; null when no previous version exists. */
15888
+ previousVersion: string().nullable(),
15889
+ /** Version of the immutable baked seed closure (image fallback). */
15890
+ seedVersion: string().nullable(),
15891
+ /** Latest registry version from the most recent check (null = never checked). */
15892
+ latestVersion: string().nullable(),
15893
+ updateAvailable: boolean(),
15894
+ bootMode: ServerBootModeSchema,
15895
+ updateState: ServerUpdateStateSchema,
15896
+ /** Version staged + awaiting its probation boot, when one is pending. */
15897
+ pendingVersion: string().nullable(),
15898
+ /** Set when the last freshly-activated version failed its boot health-check. */
15899
+ rolledBack: ServerRollbackInfoSchema.nullable(),
15900
+ /**
15901
+ * True when `server-root/state.json` EXISTS but is unreadable/corrupt — the
15902
+ * hub is running from the baked seed (or workspace) while installed data-dir
15903
+ * versions are being IGNORED. Surfaced as a warning in the UI.
15904
+ */
15905
+ stateFileCorrupt: boolean(),
15906
+ lastCheckedAtMs: number().nullable()
15907
+ });
15908
+ var ServerUpdateCheckResultSchema = object({
15909
+ packageName: string(),
15910
+ runningVersion: string().nullable(),
15911
+ latestVersion: string().nullable(),
15912
+ updateAvailable: boolean(),
15913
+ checkedAtMs: number(),
15914
+ /** Non-null when the registry lookup failed (offline, bad registry, …). */
15915
+ error: string().nullable()
15916
+ });
15917
+ var ServerUpdateActionResultSchema = object({
15918
+ accepted: boolean(),
15919
+ targetVersion: string().nullable(),
15920
+ /** True when a graceful restart was scheduled to apply the change. */
15921
+ restarting: boolean(),
15922
+ message: string()
15923
+ });
15924
+ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
15925
+ kind: "mutation",
15926
+ auth: "admin"
15927
+ }), method(object({
15928
+ /** Explicit target version; omitted = latest from the registry. */
15929
+ version: string().optional() }), ServerUpdateActionResultSchema, {
15930
+ kind: "mutation",
15931
+ auth: "admin"
15932
+ }), method(_void(), ServerUpdateActionResultSchema, {
15933
+ kind: "mutation",
15934
+ auth: "admin"
15935
+ }), method(_void(), ServerUpdateActionResultSchema, {
15936
+ kind: "mutation",
15937
+ auth: "admin"
15637
15938
  });
15638
- method(object({
15639
- deviceId: number(),
15640
- streams: array(RegisteredStreamSchema).readonly()
15641
- }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), array(ExposedResourceSchema).readonly());
15642
15939
  /**
15643
15940
  * Query filter for settings-store collections.
15644
15941
  */
@@ -15791,9 +16088,9 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
15791
16088
  /**
15792
16089
  * A single device snapshot returned as base64 JPEG/PNG.
15793
16090
  *
15794
- * Shared with the `snapshot-provider` collection cap the orchestrator
15795
- * receives the same shape from each native provider and from the
15796
- * broker-based fallback.
16091
+ * The `SnapshotAddon` wrapper returns this shape whether the frame came from
16092
+ * the device-native provider (onboard capture) or from the stream-broker
16093
+ * prebuffer fallback.
15797
16094
  */
15798
16095
  var SnapshotImageSchema = object({
15799
16096
  base64: string(),
@@ -15825,10 +16122,6 @@ DeviceType.Camera, method(object({
15825
16122
  kind: "mutation",
15826
16123
  auth: "admin"
15827
16124
  });
15828
- method(object({ deviceId: number() }), boolean()), method(object({
15829
- deviceId: number(),
15830
- streamId: string().optional()
15831
- }), SnapshotImageSchema.nullable());
15832
16125
  /**
15833
16126
  * `sso-bridge` — internal hub-only cap that lets SSO-style auth
15834
16127
  * providers (OIDC, SAML, magic-link, …) mint an HMAC-signed token
@@ -16189,9 +16482,10 @@ method(object({
16189
16482
  auth: "admin"
16190
16483
  });
16191
16484
  /**
16192
- * Optional client-side hints sent at session creation to help the
16193
- * provider pick the best native source. All fields are optional —
16194
- * a viewer that knows nothing still gets a sane default.
16485
+ * Optional client-side hints sent at session creation to help the provider
16486
+ * pick the best native source. All fields optional — a viewer that knows
16487
+ * nothing still gets a sane default. (Relocated from the retired `webrtc`
16488
+ * collection cap; this `webrtc-session` cap is the live signaling surface.)
16195
16489
  */
16196
16490
  var webrtcClientHintsSchema = object({
16197
16491
  viewportWidth: number().int().positive().optional(),
@@ -16202,22 +16496,6 @@ var webrtcClientHintsSchema = object({
16202
16496
  /** Hard tier override; takes precedence over scoring when registered. */
16203
16497
  prefersTier: string().optional()
16204
16498
  }).partial();
16205
- method(object({
16206
- streamId: string(),
16207
- sdpOffer: string()
16208
- }), string(), { kind: "mutation" }), method(object({ streamId: string() }), boolean()), method(object({
16209
- streamId: string(),
16210
- codec: string()
16211
- }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), _void(), { kind: "mutation" }), method(object({
16212
- streamId: string(),
16213
- hints: webrtcClientHintsSchema.optional()
16214
- }), object({
16215
- sessionId: string(),
16216
- sdpOffer: string()
16217
- }), { kind: "mutation" }), method(object({
16218
- sessionId: string(),
16219
- sdpAnswer: string()
16220
- }), _void(), { kind: "mutation" }), method(object({ sessionId: string() }), _void(), { kind: "mutation" }), method(object({ streamId: string() }), boolean());
16221
16499
  /**
16222
16500
  * Discriminated target for a WebRTC session. The client sends this
16223
16501
  * structured object instead of building / parsing brokerId strings;
@@ -17645,6 +17923,16 @@ var TopologyCategorySchema = object({
17645
17923
  healthy: number(),
17646
17924
  addons: array(TopologyCategoryAddonSchema).readonly()
17647
17925
  });
17926
+ /**
17927
+ * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
17928
+ * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
17929
+ * version visibility for the Server management surface. Nullable: offline
17930
+ * rows and pre-phase-2 nodes report none.
17931
+ */
17932
+ var TopologyRootPackageSchema = object({
17933
+ name: string(),
17934
+ version: string()
17935
+ });
17648
17936
  var TopologyNodeSchema = object({
17649
17937
  id: string(),
17650
17938
  name: string(),
@@ -17668,7 +17956,8 @@ var TopologyNodeSchema = object({
17668
17956
  status: string()
17669
17957
  })).readonly(),
17670
17958
  processes: array(TopologyProcessSchema).readonly(),
17671
- categories: array(TopologyCategorySchema).readonly()
17959
+ categories: array(TopologyCategorySchema).readonly(),
17960
+ rootPackage: TopologyRootPackageSchema.nullable()
17672
17961
  });
17673
17962
  var CapUsageEdgeSchema = object({
17674
17963
  callerAddonId: string(),
@@ -20468,6 +20757,12 @@ Object.freeze({
20468
20757
  addonId: null,
20469
20758
  access: "create"
20470
20759
  },
20760
+ "loginMethod.getLoginMethods": {
20761
+ capName: "login-method",
20762
+ capScope: "system",
20763
+ addonId: null,
20764
+ access: "view"
20765
+ },
20471
20766
  "mediaPlayer.next": {
20472
20767
  capName: "media-player",
20473
20768
  capScope: "device",
@@ -21098,23 +21393,23 @@ Object.freeze({
21098
21393
  addonId: null,
21099
21394
  access: "create"
21100
21395
  },
21101
- "pipelineExecutor.deleteModel": {
21396
+ "pipelineExecutor.clearDeviceOverrides": {
21102
21397
  capName: "pipeline-executor",
21103
21398
  capScope: "system",
21104
21399
  addonId: null,
21105
21400
  access: "delete"
21106
21401
  },
21107
- "pipelineExecutor.deleteTemplate": {
21402
+ "pipelineExecutor.deleteModel": {
21108
21403
  capName: "pipeline-executor",
21109
21404
  capScope: "system",
21110
21405
  addonId: null,
21111
21406
  access: "delete"
21112
21407
  },
21113
- "pipelineExecutor.detect": {
21408
+ "pipelineExecutor.deleteTemplate": {
21114
21409
  capName: "pipeline-executor",
21115
21410
  capScope: "system",
21116
21411
  addonId: null,
21117
- access: "view"
21412
+ access: "delete"
21118
21413
  },
21119
21414
  "pipelineExecutor.downloadModel": {
21120
21415
  capName: "pipeline-executor",
@@ -21308,13 +21603,13 @@ Object.freeze({
21308
21603
  addonId: null,
21309
21604
  access: "create"
21310
21605
  },
21311
- "pipelineOrchestrator.assignAudio": {
21312
- capName: "pipeline-orchestrator",
21606
+ "pipelineExecutor.validatePipeline": {
21607
+ capName: "pipeline-executor",
21313
21608
  capScope: "system",
21314
21609
  addonId: null,
21315
- access: "create"
21610
+ access: "view"
21316
21611
  },
21317
- "pipelineOrchestrator.assignDecoder": {
21612
+ "pipelineOrchestrator.assignAudio": {
21318
21613
  capName: "pipeline-orchestrator",
21319
21614
  capScope: "system",
21320
21615
  addonId: null,
@@ -21398,19 +21693,13 @@ Object.freeze({
21398
21693
  addonId: null,
21399
21694
  access: "view"
21400
21695
  },
21401
- "pipelineOrchestrator.getDecoderAssignment": {
21402
- capName: "pipeline-orchestrator",
21403
- capScope: "system",
21404
- addonId: null,
21405
- access: "view"
21406
- },
21407
- "pipelineOrchestrator.getDecoderAssignments": {
21696
+ "pipelineOrchestrator.getGlobalMetrics": {
21408
21697
  capName: "pipeline-orchestrator",
21409
21698
  capScope: "system",
21410
21699
  addonId: null,
21411
21700
  access: "view"
21412
21701
  },
21413
- "pipelineOrchestrator.getGlobalMetrics": {
21702
+ "pipelineOrchestrator.getIngestOwner": {
21414
21703
  capName: "pipeline-orchestrator",
21415
21704
  capScope: "system",
21416
21705
  addonId: null,
@@ -21452,6 +21741,12 @@ Object.freeze({
21452
21741
  addonId: null,
21453
21742
  access: "delete"
21454
21743
  },
21744
+ "pipelineOrchestrator.resetNodePipelineDefaults": {
21745
+ capName: "pipeline-orchestrator",
21746
+ capScope: "system",
21747
+ addonId: null,
21748
+ access: "delete"
21749
+ },
21455
21750
  "pipelineOrchestrator.resolvePipeline": {
21456
21751
  capName: "pipeline-orchestrator",
21457
21752
  capScope: "system",
@@ -21488,37 +21783,37 @@ Object.freeze({
21488
21783
  addonId: null,
21489
21784
  access: "create"
21490
21785
  },
21491
- "pipelineOrchestrator.setCameraPipelineForAgent": {
21786
+ "pipelineOrchestrator.setAgentReachableHost": {
21492
21787
  capName: "pipeline-orchestrator",
21493
21788
  capScope: "system",
21494
21789
  addonId: null,
21495
21790
  access: "create"
21496
21791
  },
21497
- "pipelineOrchestrator.setCameraStepOverride": {
21792
+ "pipelineOrchestrator.setCameraPipelineForAgent": {
21498
21793
  capName: "pipeline-orchestrator",
21499
21794
  capScope: "system",
21500
21795
  addonId: null,
21501
21796
  access: "create"
21502
21797
  },
21503
- "pipelineOrchestrator.setCameraStepToggle": {
21798
+ "pipelineOrchestrator.setCameraStepOverride": {
21504
21799
  capName: "pipeline-orchestrator",
21505
21800
  capScope: "system",
21506
21801
  addonId: null,
21507
21802
  access: "create"
21508
21803
  },
21509
- "pipelineOrchestrator.setCapabilityBinding": {
21804
+ "pipelineOrchestrator.setCameraStepToggle": {
21510
21805
  capName: "pipeline-orchestrator",
21511
21806
  capScope: "system",
21512
21807
  addonId: null,
21513
21808
  access: "create"
21514
21809
  },
21515
- "pipelineOrchestrator.unassignAudio": {
21810
+ "pipelineOrchestrator.setCapabilityBinding": {
21516
21811
  capName: "pipeline-orchestrator",
21517
21812
  capScope: "system",
21518
21813
  addonId: null,
21519
21814
  access: "create"
21520
21815
  },
21521
- "pipelineOrchestrator.unassignDecoder": {
21816
+ "pipelineOrchestrator.unassignAudio": {
21522
21817
  capName: "pipeline-orchestrator",
21523
21818
  capScope: "system",
21524
21819
  addonId: null,
@@ -21818,33 +22113,45 @@ Object.freeze({
21818
22113
  addonId: null,
21819
22114
  access: "create"
21820
22115
  },
21821
- "restreamer.getExposedResources": {
21822
- capName: "restreamer",
22116
+ "scriptRunner.run": {
22117
+ capName: "script-runner",
22118
+ capScope: "device",
22119
+ addonId: null,
22120
+ access: "create"
22121
+ },
22122
+ "scriptRunner.stop": {
22123
+ capName: "script-runner",
22124
+ capScope: "device",
22125
+ addonId: null,
22126
+ access: "create"
22127
+ },
22128
+ "serverManagement.applyServerUpdate": {
22129
+ capName: "server-management",
21823
22130
  capScope: "system",
21824
22131
  addonId: null,
21825
- access: "view"
22132
+ access: "create"
21826
22133
  },
21827
- "restreamer.registerDevice": {
21828
- capName: "restreamer",
22134
+ "serverManagement.checkServerUpdate": {
22135
+ capName: "server-management",
21829
22136
  capScope: "system",
21830
22137
  addonId: null,
21831
22138
  access: "create"
21832
22139
  },
21833
- "restreamer.unregisterDevice": {
21834
- capName: "restreamer",
22140
+ "serverManagement.getServerPackageStatus": {
22141
+ capName: "server-management",
21835
22142
  capScope: "system",
21836
22143
  addonId: null,
21837
- access: "delete"
22144
+ access: "view"
21838
22145
  },
21839
- "scriptRunner.run": {
21840
- capName: "script-runner",
21841
- capScope: "device",
22146
+ "serverManagement.restartServer": {
22147
+ capName: "server-management",
22148
+ capScope: "system",
21842
22149
  addonId: null,
21843
22150
  access: "create"
21844
22151
  },
21845
- "scriptRunner.stop": {
21846
- capName: "script-runner",
21847
- capScope: "device",
22152
+ "serverManagement.rollbackServerUpdate": {
22153
+ capName: "server-management",
22154
+ capScope: "system",
21848
22155
  addonId: null,
21849
22156
  access: "create"
21850
22157
  },
@@ -21938,18 +22245,6 @@ Object.freeze({
21938
22245
  addonId: null,
21939
22246
  access: "create"
21940
22247
  },
21941
- "snapshotProvider.getSnapshot": {
21942
- capName: "snapshot-provider",
21943
- capScope: "system",
21944
- addonId: null,
21945
- access: "view"
21946
- },
21947
- "snapshotProvider.supportsDevice": {
21948
- capName: "snapshot-provider",
21949
- capScope: "system",
21950
- addonId: null,
21951
- access: "view"
21952
- },
21953
22248
  "ssoBridge.signBridgeToken": {
21954
22249
  capName: "sso-bridge",
21955
22250
  capScope: "system",
@@ -22376,30 +22671,6 @@ Object.freeze({
22376
22671
  addonId: null,
22377
22672
  access: "view"
22378
22673
  },
22379
- "streamingEngine.getStreamUrl": {
22380
- capName: "streaming-engine",
22381
- capScope: "system",
22382
- addonId: null,
22383
- access: "view"
22384
- },
22385
- "streamingEngine.listStreams": {
22386
- capName: "streaming-engine",
22387
- capScope: "system",
22388
- addonId: null,
22389
- access: "view"
22390
- },
22391
- "streamingEngine.registerStream": {
22392
- capName: "streaming-engine",
22393
- capScope: "system",
22394
- addonId: null,
22395
- access: "create"
22396
- },
22397
- "streamingEngine.unregisterStream": {
22398
- capName: "streaming-engine",
22399
- capScope: "system",
22400
- addonId: null,
22401
- access: "delete"
22402
- },
22403
22674
  "streamParams.getConfigSchema": {
22404
22675
  capName: "stream-params",
22405
22676
  capScope: "device",
@@ -22748,6 +23019,18 @@ Object.freeze({
22748
23019
  addonId: null,
22749
23020
  access: "view"
22750
23021
  },
23022
+ "viewerUi.getStaticDir": {
23023
+ capName: "viewer-ui",
23024
+ capScope: "system",
23025
+ addonId: null,
23026
+ access: "view"
23027
+ },
23028
+ "viewerUi.getVersion": {
23029
+ capName: "viewer-ui",
23030
+ capScope: "system",
23031
+ addonId: null,
23032
+ access: "view"
23033
+ },
22751
23034
  "waterHeater.setAway": {
22752
23035
  capName: "water-heater",
22753
23036
  capScope: "device",
@@ -22766,54 +23049,6 @@ Object.freeze({
22766
23049
  addonId: null,
22767
23050
  access: "create"
22768
23051
  },
22769
- "webrtc.closeSession": {
22770
- capName: "webrtc",
22771
- capScope: "system",
22772
- addonId: null,
22773
- access: "create"
22774
- },
22775
- "webrtc.createSession": {
22776
- capName: "webrtc",
22777
- capScope: "system",
22778
- addonId: null,
22779
- access: "create"
22780
- },
22781
- "webrtc.handleAnswer": {
22782
- capName: "webrtc",
22783
- capScope: "system",
22784
- addonId: null,
22785
- access: "create"
22786
- },
22787
- "webrtc.handleOffer": {
22788
- capName: "webrtc",
22789
- capScope: "system",
22790
- addonId: null,
22791
- access: "create"
22792
- },
22793
- "webrtc.hasAdaptiveBitrate": {
22794
- capName: "webrtc",
22795
- capScope: "system",
22796
- addonId: null,
22797
- access: "view"
22798
- },
22799
- "webrtc.registerStream": {
22800
- capName: "webrtc",
22801
- capScope: "system",
22802
- addonId: null,
22803
- access: "create"
22804
- },
22805
- "webrtc.supportsStream": {
22806
- capName: "webrtc",
22807
- capScope: "system",
22808
- addonId: null,
22809
- access: "view"
22810
- },
22811
- "webrtc.unregisterStream": {
22812
- capName: "webrtc",
22813
- capScope: "system",
22814
- addonId: null,
22815
- access: "delete"
22816
- },
22817
23052
  "webrtcSession.addIceCandidate": {
22818
23053
  capName: "webrtc-session",
22819
23054
  capScope: "device",
@@ -23511,276 +23746,6 @@ var FrameDropper = class {
23511
23746
  }
23512
23747
  };
23513
23748
  //#endregion
23514
- //#region src/frame-ring-sink.ts
23515
- /**
23516
- * `DecoderFrameRingSink` — the decoder's shared-memory write side (Phase 5 / D9).
23517
- *
23518
- * When a decoder session is configured with `frameSink: 'shm'`, the decoder
23519
- * **owns** the shared-memory ring segment for that stream: it creates the
23520
- * segment on the first decoded frame (when the output geometry is known),
23521
- * writes every subsequent decoded frame into the ring via a `FrameRingWriter`,
23522
- * and closes + unlinks the segment when the session is destroyed.
23523
- *
23524
- * What leaves the decoder is no longer the pixel `Buffer` — it is a tiny,
23525
- * serialisable `FrameHandle` (`FrameRingWriter.writeFrame`'s return value).
23526
- * Same-host consumers (motion, detection, the WebRTC encoder) open the same
23527
- * segment with a `FrameRingReader` and read the pixels zero-copy.
23528
- *
23529
- * ## Lazy segment creation
23530
- *
23531
- * The segment cannot be sized until the first frame: `slotByteLength` is
23532
- * `width × height × bytesPerPixel`, and the output dimensions are only known
23533
- * once the scaler has produced its first `dstFrame`. So `writeFrame` is a
23534
- * no-op-until-armed: the first call sizes + creates the segment, every later
23535
- * call writes into it.
23536
- *
23537
- * ## Resolution-change decision
23538
- *
23539
- * A live camera stream can change resolution mid-stream (the decoder's scaler
23540
- * is rebuilt on a config toggle, or the source renegotiates). The slot is
23541
- * sized for the **first** frame's geometry. A later frame that no longer fits
23542
- * the slot triggers a **segment re-create**: the old segment is closed +
23543
- * unlinked and a fresh, larger segment is created under a new generation-tagged
23544
- * name. This is simpler and leak-free versus over-allocating slots for a
23545
- * worst-case 4K frame on every stream; resolution changes on a live camera are
23546
- * rare, and a brief gap while consumers re-open the segment is acceptable
23547
- * (latest-wins — a missed frame is correct behaviour).
23548
- */
23549
- /**
23550
- * Per-ring shared-memory budget (MB) — the slot count is derived per-resolution
23551
- * from this budget via {@link deriveSlotCount}, so a 360p stream gets many
23552
- * slots and a 4K stream a few, both inside the same memory footprint.
23553
- *
23554
- * Read ONCE at module load from `CAMSTACK_SHM_RING_BUDGET_MB`; a non-finite or
23555
- * non-positive value falls back to the 16 MB default.
23556
- *
23557
- * The default is deliberately small (16 MB) so many concurrent per-camera rings
23558
- * fit inside a bounded `/dev/shm`. The decoder output is capped at 640px wide, so
23559
- * a slot is ≤ ~920 KB and 16 MB still yields ~17–70 latest-wins slots. A ring
23560
- * segment larger than the container's `/dev/shm` tmpfs backing (Docker default is
23561
- * only 64 MB) faults an **uncatchable SIGBUS** on write past `st_size` — the old
23562
- * 128 MB default overflowed a 64 MB `/dev/shm` and crashed the decoder on 8MP
23563
- * streams. Pair this with a `--shm-size` that scales with concurrent-decode load.
23564
- */
23565
- var RING_BUDGET_MB = (() => {
23566
- const raw = Number(process.env["CAMSTACK_SHM_RING_BUDGET_MB"]);
23567
- return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 16;
23568
- })();
23569
- /** {@link RING_BUDGET_MB} in bytes — the budget passed to `deriveSlotCount`. */
23570
- var RING_BUDGET_BYTES = RING_BUDGET_MB * 1024 * 1024;
23571
- /** A unique, stable shared-memory segment name for a decoder stream.
23572
- *
23573
- * macOS POSIX shm names are capped at ~31 characters (`PSHMNAMLEN`). A
23574
- * `camstack.frames.<deviceId>.<streamId>` scheme overflows that for realistic
23575
- * ids, so the sink uses a short, collision-resistant scheme instead:
23576
- * `csf.<base36 hash>.<gen>`. The hash folds the device id, the session tag
23577
- * and a per-process random salt; the generation suffix makes a re-created
23578
- * segment (resolution change) a distinct name so a stale consumer mapping is
23579
- * never silently reused.
23580
- */
23581
- /**
23582
- * Shared prefix for every decoder shm segment name. Startup orphan reclamation
23583
- * (`purgeOrphanSegments`) keys off this to find segments left behind by a
23584
- * crashed prior instance.
23585
- */
23586
- var SEGMENT_NAME_PREFIX = "csf.";
23587
- function makeSegmentName(seed, generation) {
23588
- let hash = 5381;
23589
- for (let i = 0; i < seed.length; i += 1) hash = (hash << 5) + hash + seed.charCodeAt(i) | 0;
23590
- return `${SEGMENT_NAME_PREFIX}${(hash >>> 0).toString(36)}.${generation}`;
23591
- }
23592
- /**
23593
- * The decoder-side owner of one stream's shared-memory frame ring.
23594
- *
23595
- * Not constructed until a session actually uses the shm sink; the segment
23596
- * itself is created lazily on the first `writeFrame`.
23597
- */
23598
- var DecoderFrameRingSink = class {
23599
- seed;
23600
- logger;
23601
- nodeId;
23602
- segment = null;
23603
- writer = null;
23604
- segmentName = null;
23605
- slotByteLength = 0;
23606
- generation = 0;
23607
- destroyed = false;
23608
- /** Frames committed into the ring across this sink's lifetime (all generations). */
23609
- framesWritten = 0;
23610
- constructor(options) {
23611
- const salt = Math.random().toString(36).slice(2, 8);
23612
- this.seed = `${options.seed}.${salt}`;
23613
- this.logger = options.logger;
23614
- this.nodeId = options.nodeId;
23615
- }
23616
- /** Whether a segment has been created (i.e. at least one frame written). */
23617
- get isArmed() {
23618
- return this.writer !== null;
23619
- }
23620
- /** The current segment name, or `null` before the first frame. */
23621
- get currentSegmentName() {
23622
- return this.segmentName;
23623
- }
23624
- /**
23625
- * Write one decoded frame into the ring and return its `FrameHandle`.
23626
- *
23627
- * On the first call (or after a geometry change that overflows the current
23628
- * slot) the segment is created / re-created sized for this frame. Returns
23629
- * `null` only when the sink has been destroyed.
23630
- *
23631
- * This is the copy-in convenience form (it copies `pixels` into the slot).
23632
- * The decoder's hot path uses the zero-copy {@link beginFrame} /
23633
- * {@link commitFrame} scatter-write pair instead — the scaler produces its
23634
- * packed output directly into the slot, eliminating the write-side memcpy.
23635
- */
23636
- writeFrame(pixels, meta) {
23637
- if (this.destroyed) return null;
23638
- if (this.writer === null || computeSlotByteLength(meta.width, meta.height, meta.format) > this.slotByteLength) this.recreateSegment(computeSlotByteLength(meta.width, meta.height, meta.format));
23639
- const writer = this.writer;
23640
- if (writer === null) return null;
23641
- const handle = writer.writeFrame(pixels, meta);
23642
- this.framesWritten += 1;
23643
- return handle;
23644
- }
23645
- /**
23646
- * Reserve a ring slot for a frame of the given geometry — the **zero-copy**
23647
- * scatter-write entry point (Phase 5 / D9 Task 7c).
23648
- *
23649
- * The segment is created / re-created here if this is the first frame or the
23650
- * geometry overflows the current slot capacity, so the slot is correctly
23651
- * sized before the caller fills it. The returned `buffer` is a writable view
23652
- * **directly over the mapped segment** — the node-av scaler scatters its
23653
- * packed output straight into it, with no intermediate copy. The caller MUST
23654
- * call {@link commitFrame} with the returned `slot` once the slot is filled.
23655
- *
23656
- * Returns `null` when the sink is destroyed or the segment cannot be created.
23657
- */
23658
- beginFrame(width, height, format) {
23659
- if (this.destroyed) return null;
23660
- const requiredSlotBytes = computeSlotByteLength(width, height, format);
23661
- if (this.writer === null || requiredSlotBytes > this.slotByteLength) this.recreateSegment(requiredSlotBytes);
23662
- const writer = this.writer;
23663
- if (writer === null) return null;
23664
- const { slot, buffer } = writer.beginFrame();
23665
- return {
23666
- slot,
23667
- buffer
23668
- };
23669
- }
23670
- /**
23671
- * Publish the frame whose slot was reserved by {@link beginFrame} and filled
23672
- * in place by the caller. `slot` MUST be the value from the matching
23673
- * `beginFrame`. Returns the published `FrameHandle`, or `null` if the sink
23674
- * was destroyed (or the segment lost) between begin and commit.
23675
- */
23676
- commitFrame(slot, meta) {
23677
- if (this.destroyed) return null;
23678
- const writer = this.writer;
23679
- if (writer === null) return null;
23680
- const handle = writer.commitFrame(slot, meta);
23681
- this.framesWritten += 1;
23682
- return handle;
23683
- }
23684
- /**
23685
- * Current shm ring usage — `null` until the first frame arms the segment.
23686
- * Surfaced through `decoder.getShmStats` so a downstream consumer can
23687
- * observe ring pressure (slot depth, byte budget, frames written).
23688
- */
23689
- getShmStats() {
23690
- if (this.writer === null) return null;
23691
- return {
23692
- slotCount: this.writer.slotCount,
23693
- slotByteLength: this.slotByteLength,
23694
- segmentBytes: computeSegmentSize(this.writer.slotCount, this.slotByteLength),
23695
- framesWritten: this.framesWritten
23696
- };
23697
- }
23698
- /**
23699
- * Abandon a slot reserved by {@link beginFrame} **without publishing it** —
23700
- * the degenerate-path counterpart of {@link commitFrame}.
23701
- *
23702
- * A caller that reserved a slot but then could not produce valid pixels (no
23703
- * decoded source planes, or the scaler threw) MUST call this instead of
23704
- * `commitFrame`: it closes the open seqlock without advancing `writeIndex`,
23705
- * so no reader ever sees the slot's uninitialised bytes as a real frame, and
23706
- * no `FrameHandle` is handed downstream. `slot` MUST be the value from the
23707
- * matching `beginFrame`. A no-op if the sink was destroyed (or the segment
23708
- * lost) between begin and abort.
23709
- */
23710
- abortFrame(slot) {
23711
- if (this.destroyed) return;
23712
- const writer = this.writer;
23713
- if (writer === null) return;
23714
- writer.abortFrame(slot);
23715
- }
23716
- /** Close + unlink the segment. Idempotent. */
23717
- destroy() {
23718
- if (this.destroyed) return;
23719
- this.destroyed = true;
23720
- this.releaseSegment();
23721
- }
23722
- /**
23723
- * Create a fresh segment sized for at least `slotByteLength` bytes per slot,
23724
- * replacing any prior one. A re-create bumps the generation so the new
23725
- * segment has a distinct name — a consumer holding the old mapping is never
23726
- * silently handed a resized segment.
23727
- */
23728
- recreateSegment(slotByteLength) {
23729
- this.releaseSegment();
23730
- this.generation += 1;
23731
- const name = makeSegmentName(this.seed, this.generation);
23732
- const slotCount = deriveSlotCount(RING_BUDGET_BYTES, slotByteLength);
23733
- if (slotCount === MIN_RING_SLOTS && MIN_RING_SLOTS * slotByteLength > RING_BUDGET_BYTES) this.logger.warn("decoder shm ring: budget too small for resolution — using MIN slots", { meta: {
23734
- slotByteLength,
23735
- budgetMb: RING_BUDGET_MB
23736
- } });
23737
- const totalBytes = computeSegmentSize(slotCount, slotByteLength);
23738
- try {
23739
- const segment = createSegment(name, totalBytes);
23740
- this.segment = segment;
23741
- this.segmentName = name;
23742
- this.slotByteLength = slotByteLength;
23743
- this.writer = new FrameRingWriter(segment.buffer, name, slotCount, slotByteLength, this.nodeId);
23744
- this.logger.info("decoder shm ring: segment created", { meta: {
23745
- segment: name,
23746
- slotCount,
23747
- slotByteLength,
23748
- totalBytes,
23749
- generation: this.generation
23750
- } });
23751
- } catch (err) {
23752
- this.segment = null;
23753
- this.writer = null;
23754
- this.segmentName = null;
23755
- this.slotByteLength = 0;
23756
- this.logger.error("decoder shm ring: segment create failed", { meta: {
23757
- segment: name,
23758
- slotByteLength,
23759
- error: err instanceof Error ? err.message : String(err)
23760
- } });
23761
- }
23762
- }
23763
- /** Unmap + unlink the current segment, if any. */
23764
- releaseSegment() {
23765
- const segment = this.segment;
23766
- if (segment === null) return;
23767
- this.segment = null;
23768
- this.writer = null;
23769
- const name = this.segmentName;
23770
- this.segmentName = null;
23771
- try {
23772
- segment.close();
23773
- segment.unlink();
23774
- this.logger.info("decoder shm ring: segment released", { meta: { segment: name } });
23775
- } catch (err) {
23776
- this.logger.warn("decoder shm ring: segment release failed", { meta: {
23777
- segment: name,
23778
- error: err instanceof Error ? err.message : String(err)
23779
- } });
23780
- }
23781
- }
23782
- };
23783
- //#endregion
23784
23749
  //#region src/frame-stream-splitter.ts
23785
23750
  var FrameStreamSplitter = class {
23786
23751
  frameSize;