@camstack/addon-provider-onvif 1.1.20 → 1.1.22

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 +413 -83
  2. package/dist/addon.mjs +413 -83
  3. package/package.json +4 -1
package/dist/addon.js CHANGED
@@ -4631,7 +4631,7 @@ function _instanceof(cls, params = {}) {
4631
4631
  return inst;
4632
4632
  }
4633
4633
  //#endregion
4634
- //#region ../types/dist/sleep-Cc14_yxc.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";
@@ -5352,10 +5352,6 @@ function hydrateField(field, values) {
5352
5352
  };
5353
5353
  }
5354
5354
  const rawValue = storedValue !== void 0 ? storedValue : defaultValue !== void 0 ? defaultValue : null;
5355
- if (field.type === "password") return {
5356
- ...field,
5357
- value: ""
5358
- };
5359
5355
  const value = field.type === "textarea" && field.isJson && rawValue !== null && typeof rawValue === "object" ? JSON.stringify(rawValue, null, 2) : rawValue;
5360
5356
  return {
5361
5357
  ...field,
@@ -6739,6 +6735,9 @@ function method(input, output, options) {
6739
6735
  timeoutMs: options?.timeoutMs
6740
6736
  };
6741
6737
  }
6738
+ var StaticDirOutputSchema$1 = object({ staticDir: string() });
6739
+ var VersionOutputSchema$1 = object({ version: string() });
6740
+ method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6742
6741
  var StaticDirOutputSchema = object({ staticDir: string() });
6743
6742
  var VersionOutputSchema = object({ version: string() });
6744
6743
  method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
@@ -6937,10 +6936,18 @@ var ModelVariantGroupSchema = object({
6937
6936
  precision: _enum(["fp32", "int8"]).optional(),
6938
6937
  /**
6939
6938
  * Speed-optimization axis. Omit ⇒ the standard build. `fast` marks a
6940
- * latency-optimized export (e.g. ReLU-activation / reduced-input variant)
6941
- * — the slot the future performance variants plug into.
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.
6942
6949
  */
6943
- optimization: _enum(["standard", "fast"]).optional()
6950
+ resolution: number().int().positive().optional()
6944
6951
  });
6945
6952
  var ModelCatalogEntrySchema = object({
6946
6953
  id: string(),
@@ -8430,6 +8437,72 @@ var DeviceConfig = class DeviceConfig {
8430
8437
  }));
8431
8438
  }
8432
8439
  };
8440
+ /** Reject after `ms`; always clears its own timer. */
8441
+ async function withTimeout(promise, ms, label) {
8442
+ let timer;
8443
+ const timeout = new Promise((_resolve, reject) => {
8444
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${label} timed out after ${String(ms)}ms`)), ms);
8445
+ });
8446
+ try {
8447
+ return await Promise.race([promise, timeout]);
8448
+ } finally {
8449
+ if (timer !== void 0) clearTimeout(timer);
8450
+ }
8451
+ }
8452
+ /**
8453
+ * Start the reachability poll loop. Returns a handle whose `stop()` clears the
8454
+ * timer and prevents any further ticks. Start on device activation, stop on
8455
+ * device teardown (`removeDevice`) so no timer leaks.
8456
+ */
8457
+ function startReachabilityPoll(options) {
8458
+ const intervalMs = options.intervalMs ?? 3e4;
8459
+ const failuresToOffline = options.failuresToOffline ?? 3;
8460
+ const probeTimeoutMs = options.probeTimeoutMs ?? 1e4;
8461
+ const runImmediately = options.runImmediately ?? true;
8462
+ let stopped = false;
8463
+ let running = false;
8464
+ let consecutiveFailures = 0;
8465
+ let timer;
8466
+ const tick = async () => {
8467
+ if (stopped) return;
8468
+ if (running) return;
8469
+ if (options.isEnabled && !options.isEnabled()) return;
8470
+ running = true;
8471
+ try {
8472
+ const reachable = await withTimeout(Promise.resolve().then(options.probe), probeTimeoutMs, "reachability probe");
8473
+ if (stopped) return;
8474
+ if (reachable) {
8475
+ consecutiveFailures = 0;
8476
+ options.setOnline(true);
8477
+ } else registerFailure("probe resolved unreachable");
8478
+ } catch (error) {
8479
+ if (stopped) return;
8480
+ registerFailure(error instanceof Error ? error.message : "probe threw");
8481
+ } finally {
8482
+ running = false;
8483
+ }
8484
+ };
8485
+ const registerFailure = (reason) => {
8486
+ consecutiveFailures += 1;
8487
+ options.logger?.debug("reachability probe failed", {
8488
+ reason,
8489
+ consecutiveFailures,
8490
+ failuresToOffline
8491
+ });
8492
+ if (consecutiveFailures >= failuresToOffline) options.setOnline(false);
8493
+ };
8494
+ timer = setInterval(() => {
8495
+ tick();
8496
+ }, intervalMs);
8497
+ if (typeof timer === "object" && timer !== null && "unref" in timer) timer.unref();
8498
+ if (runImmediately) tick();
8499
+ return { stop: () => {
8500
+ if (stopped) return;
8501
+ stopped = true;
8502
+ if (timer !== void 0) clearInterval(timer);
8503
+ timer = void 0;
8504
+ } };
8505
+ }
8433
8506
  /**
8434
8507
  * Generic device-level status snapshot. Auto-registered by `BaseDevice`
8435
8508
  * for every device, regardless of provider — the kernel needs a uniform
@@ -10407,7 +10480,7 @@ var BoundingBoxSchema = object({
10407
10480
  w: number(),
10408
10481
  h: number()
10409
10482
  });
10410
- var SpatialDetectionSchema = object({
10483
+ object({
10411
10484
  class: string(),
10412
10485
  originalClass: string(),
10413
10486
  score: number(),
@@ -10598,11 +10671,6 @@ var PipelineSchemaSchema = object({
10598
10671
  selectedEngine: PipelineEngineChoiceSchema,
10599
10672
  slots: array(PipelineSlotSchemaSchema).readonly()
10600
10673
  });
10601
- var DetectorOutputSchema = object({
10602
- detections: array(SpatialDetectionSchema).readonly(),
10603
- inferenceMs: number(),
10604
- modelId: string()
10605
- });
10606
10674
  var EngineProvisioningSchema = object({
10607
10675
  runtimeId: _enum([
10608
10676
  "onnx",
@@ -10725,6 +10793,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10725
10793
  })) }), object({ success: literal(true) }), {
10726
10794
  kind: "mutation",
10727
10795
  auth: "admin"
10796
+ }), method(object({ nodeId: string() }), object({
10797
+ success: literal(true),
10798
+ clearedDevices: number()
10799
+ }), {
10800
+ kind: "mutation",
10801
+ auth: "admin"
10728
10802
  }), 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({
10729
10803
  name: string(),
10730
10804
  steps: array(PipelineTemplateStepSchema).readonly(),
@@ -10742,10 +10816,6 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10742
10816
  modelId: string(),
10743
10817
  format: ModelFormatSchema$1
10744
10818
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
10745
- addonId: string(),
10746
- frame: FrameInputSchema,
10747
- config: record(string(), unknown()).optional()
10748
- }), DetectorOutputSchema), method(object({
10749
10819
  engine: PipelineEngineChoiceSchema.optional(),
10750
10820
  steps: array(PipelineStepInputSchema).min(1),
10751
10821
  frame: FrameInputSchema.optional(),
@@ -12734,7 +12804,9 @@ var AddonPageDeclarationSchema$1 = object({
12734
12804
  icon: string(),
12735
12805
  path: string(),
12736
12806
  remoteName: string(),
12737
- bundle: string()
12807
+ bundle: string(),
12808
+ section: string().optional(),
12809
+ sectionLabel: string().optional()
12738
12810
  });
12739
12811
  var AddonPageInfoSchema = object({
12740
12812
  addonId: string(),
@@ -12774,7 +12846,18 @@ var AddonPageDeclarationSchema = object({
12774
12846
  * the static-file route can compute an mtime-based cache-buster URL
12775
12847
  * without a separate filesystem stat.
12776
12848
  */
12777
- bundle: string()
12849
+ bundle: string(),
12850
+ /**
12851
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
12852
+ * `'cluster'`, `'administration'` — the page renders inside that group.
12853
+ * Any OTHER string creates (or joins) a custom section rendered after
12854
+ * the built-in groups; its label comes from `sectionLabel` (first
12855
+ * declaration wins), falling back to the id. Absent → the legacy
12856
+ * "Addon Pages" group.
12857
+ */
12858
+ section: string().optional(),
12859
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
12860
+ sectionLabel: string().optional()
12778
12861
  });
12779
12862
  method(_void(), array(AddonPageDeclarationSchema).readonly());
12780
12863
  var AddonHttpRouteSchema = object({
@@ -12990,6 +13073,17 @@ var WidgetMetadataSchema = object({
12990
13073
  deviceContext: boolean().default(false),
12991
13074
  integrationContext: boolean().default(false)
12992
13075
  }),
13076
+ /**
13077
+ * Loadable BEFORE authentication. The normal widget registry listing
13078
+ * (`addon-widgets.listWidgets`) is auth-gated, so a pre-auth surface
13079
+ * (the login page) cannot discover a widget through it. A widget that
13080
+ * declares `preAuth: true` marks itself as safe to mount on a pre-auth
13081
+ * screen — it is surfaced through the PUBLIC `auth.listLoginMethods`
13082
+ * login-method contribution channel (see `login-method.cap.ts`) rather
13083
+ * than the authenticated registry, and its bundle is served by the
13084
+ * public `/api/addon-widgets/:addonId/*` static route. Defaults false.
13085
+ */
13086
+ preAuth: boolean().optional().default(false),
12993
13087
  /** Dashboard placement HINTS (operator can override per instance). */
12994
13088
  defaultSize: WidgetSizeEnum.default("md"),
12995
13089
  allowedSizes: array(WidgetSizeEnum).readonly().default([
@@ -13291,6 +13385,66 @@ method(object({
13291
13385
  password: string()
13292
13386
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
13293
13387
  /**
13388
+ * `login-method` — collection cap through which auth addons contribute
13389
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
13390
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
13391
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
13392
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
13393
+ * procedure aggregates them for the unauthenticated login page.
13394
+ *
13395
+ * A contribution is a discriminated union on `kind`:
13396
+ *
13397
+ * - `redirect` — a declarative button. The login page renders a generic
13398
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
13399
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
13400
+ * ZERO shell-side JS. A future SSO addon plugs in the same way — the
13401
+ * login page needs NO change.
13402
+ *
13403
+ * - `widget` — a Module-Federation widget the login page mounts (via
13404
+ * `loadRemoteBundle`) for an in-page ceremony. Covers the passkey
13405
+ * login ceremony, which must run `@simplewebauthn/browser` INSIDE the
13406
+ * addon bundle. The referenced widget also declares `preAuth: true` in
13407
+ * its `addon-widgets-source` catalog entry. `auth.listLoginMethods`
13408
+ * stamps a public `bundleUrl` from `addonId` + `bundle`.
13409
+ *
13410
+ * Every contribution carries a `stage`:
13411
+ * - `primary` — shown on the first credentials screen (OIDC /
13412
+ * magic-link buttons; a future usernameless passkey).
13413
+ * - `second-factor` — shown AFTER the password leg, gated on the
13414
+ * returned `factors` (passkey-as-2FA today).
13415
+ *
13416
+ * `mount: skip` — the cap is read server-side by the core auth router
13417
+ * (`registry.getCollection('login-method')`), never mounted as its own
13418
+ * tRPC router.
13419
+ */
13420
+ /** When a login method renders in the two-phase login flow. */
13421
+ var LoginStageEnum = _enum(["primary", "second-factor"]);
13422
+ /** One login-method contribution — redirect button OR pre-auth widget. */
13423
+ var LoginMethodContributionSchema = discriminatedUnion("kind", [object({
13424
+ kind: literal("redirect"),
13425
+ /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
13426
+ id: string(),
13427
+ /** Operator-facing button label. */
13428
+ label: string(),
13429
+ /** lucide-react icon name. */
13430
+ icon: string().optional(),
13431
+ /** Addon-owned HTTP route the button navigates to (GET). */
13432
+ startUrl: string(),
13433
+ stage: LoginStageEnum
13434
+ }), object({
13435
+ kind: literal("widget"),
13436
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
13437
+ id: string(),
13438
+ /** Owning addon id — drives the public bundle URL + the MF namespace. */
13439
+ addonId: string(),
13440
+ /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
13441
+ bundle: string(),
13442
+ /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
13443
+ remote: WidgetRemoteSchema,
13444
+ stage: LoginStageEnum
13445
+ })]);
13446
+ method(_void(), array(LoginMethodContributionSchema).readonly());
13447
+ /**
13294
13448
  * Orchestrator-side destination metadata. The orchestrator computes
13295
13449
  * `id = <addonId>:<subId>` from its provider lookup so consumers
13296
13450
  * (admin UI, restore flow) see one canonical key.
@@ -15608,7 +15762,12 @@ var AgentPipelineSettingsSchema = object({
15608
15762
  detectWeight: number().positive().optional(),
15609
15763
  /** Node is eligible to run the detection pipeline (decode + inference). */
15610
15764
  detect: boolean().optional(),
15611
- /** Node is eligible to host decoder sessions. */
15765
+ /**
15766
+ * DEPRECATED AND IGNORED. Decode is always co-located with its frame
15767
+ * consumer, so decode eligibility IS detect eligibility. Kept optional in
15768
+ * the schema ONLY so persisted stores written before the removal still
15769
+ * parse — no code reads it and no write path emits it.
15770
+ */
15612
15771
  decode: boolean().optional(),
15613
15772
  /** Node is eligible to run audio-analyzer sessions. */
15614
15773
  audio: boolean().optional(),
@@ -15669,25 +15828,6 @@ var PipelineAssignmentSchema = object({
15669
15828
  assignedAt: number()
15670
15829
  });
15671
15830
  /**
15672
- * Decoder placement record. Symmetric to `PipelineAssignmentSchema` but for
15673
- * the decoder-node placement domain (`balanceDecoder` decision: manual pin
15674
- * → co-located with pipeline → capacity).
15675
- */
15676
- var DecoderAssignmentSchema = object({
15677
- deviceId: number(),
15678
- /** Moleculer node id of the decoder provider currently responsible for this camera. */
15679
- decoderNodeId: string(),
15680
- /** True when the assignment was set manually via `assignDecoder`, false when chosen by the balancer. */
15681
- pinned: boolean(),
15682
- /** Why this assignment was made — useful for debugging the decoder balancer. */
15683
- reason: _enum([
15684
- "manual",
15685
- "co-located",
15686
- "capacity",
15687
- "hardware-affinity"
15688
- ])
15689
- });
15690
- /**
15691
15831
  * Per-agent load summary surfaced to the load balancer + dashboards.
15692
15832
  * Aggregated from each runner's `getLocalLoad` cap call.
15693
15833
  */
@@ -15893,15 +16033,6 @@ method(object({
15893
16033
  }), method(_void(), IngestOwnerSchema), method(object({
15894
16034
  deviceId: number(),
15895
16035
  nodeId: string()
15896
- }), _void(), {
15897
- kind: "mutation",
15898
- auth: "admin"
15899
- }), method(object({ deviceId: number() }), _void(), {
15900
- kind: "mutation",
15901
- auth: "admin"
15902
- }), method(_void(), array(DecoderAssignmentSchema).readonly()), method(object({
15903
- deviceId: number(),
15904
- nodeId: string()
15905
16036
  }), object({ success: literal(true) }), {
15906
16037
  kind: "mutation",
15907
16038
  auth: "admin"
@@ -15920,10 +16051,7 @@ method(object({
15920
16051
  nodeId: string(),
15921
16052
  pinned: boolean(),
15922
16053
  assignedAt: number()
15923
- }))), method(object({
15924
- deviceId: number(),
15925
- pipelineNodeId: string().optional()
15926
- }), DecoderAssignmentSchema), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16054
+ }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
15927
16055
  nodeId: string(),
15928
16056
  settings: AgentPipelineSettingsSchema
15929
16057
  })).readonly()), method(object({
@@ -15953,7 +16081,6 @@ method(object({
15953
16081
  }), method(object({
15954
16082
  agentNodeId: string(),
15955
16083
  detect: boolean().nullable().optional(),
15956
- decode: boolean().nullable().optional(),
15957
16084
  audio: boolean().nullable().optional(),
15958
16085
  ingest: boolean().nullable().optional()
15959
16086
  }), object({ success: literal(true) }), {
@@ -15965,6 +16092,15 @@ method(object({
15965
16092
  }), object({ success: literal(true) }), {
15966
16093
  kind: "mutation",
15967
16094
  auth: "admin"
16095
+ }), method(object({ agentNodeId: string() }), object({
16096
+ success: literal(true),
16097
+ /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16098
+ effectiveModelId: string().nullable(),
16099
+ /** Number of cameras whose node-scoped overrides were cleared. */
16100
+ clearedCameraOverrides: number()
16101
+ }), {
16102
+ kind: "mutation",
16103
+ auth: "admin"
15968
16104
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
15969
16105
  deviceId: number(),
15970
16106
  addonId: string(),
@@ -16010,6 +16146,131 @@ method(object({
16010
16146
  auth: "admin"
16011
16147
  });
16012
16148
  /**
16149
+ * server-management — per-NODE singleton capability for a node's ROOT
16150
+ * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16151
+ * agents).
16152
+ *
16153
+ * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16154
+ * on agents) carries the whole software stack in its npm dep tree, so ONE
16155
+ * version describes the node. Updates install into
16156
+ * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16157
+ * starter (probation boot + auto-rollback to N-1).
16158
+ *
16159
+ * Providers:
16160
+ * - HUB: `ServerUpdateService` behind the `server-provided` mount
16161
+ * (`buildServerProviders` in trpc.router.ts) — the default target for
16162
+ * unpinned calls.
16163
+ * - AGENT: `AgentUpdateService` registered by the agent bootstrap under
16164
+ * the synthetic `agent-runtime` addonId and declared in the agent's
16165
+ * `$hub.registerNode` manifest.
16166
+ *
16167
+ * Node routing: singleton caps get the codegen/runtime-builder `nodeId`
16168
+ * injection on every method — `input.nodeId` (or `nodePin(nodeId)` from the
16169
+ * SDK) routes the call to that node's provider via the standard remote
16170
+ * proxy (`createCapabilityProxy` → `$agent-cap-fwd` → the agent's
16171
+ * in-process provider lookup). No `nodeId` → the hub's own provider.
16172
+ *
16173
+ * Spec: docs/superpowers/specs/2026-07-12-runtime-updatable-node-packages-design.md
16174
+ */
16175
+ /**
16176
+ * Where the running hub's code was loaded from:
16177
+ * - `workspace` — dev checkout (tsx / workspace dist); the starter defers to
16178
+ * plain resolution and runtime updates are refused.
16179
+ * - `baked` — the immutable image seed closure (no data-dir root active).
16180
+ * - `data-root` — the runtime-updatable `<dataDir>/server-root` closure.
16181
+ */
16182
+ var ServerBootModeSchema = _enum([
16183
+ "workspace",
16184
+ "baked",
16185
+ "data-root"
16186
+ ]);
16187
+ /**
16188
+ * Update lifecycle state:
16189
+ * - `idle` / `checking` / `staging` — steady / in-flight registry work.
16190
+ * - `pending-restart` — a version is staged and the node has NOT yet
16191
+ * restarted onto it (still running the OLD version).
16192
+ * - `awaiting-confirmation` — the node HAS restarted onto the staged version
16193
+ * (it is the active probation boot) and is waiting to confirm boot-health.
16194
+ * Apply/rollback are refused in this state and the node must NOT be
16195
+ * manually restarted, or the probation boot auto-rolls-back.
16196
+ */
16197
+ var ServerUpdateStateSchema = _enum([
16198
+ "idle",
16199
+ "checking",
16200
+ "staging",
16201
+ "pending-restart",
16202
+ "awaiting-confirmation"
16203
+ ]);
16204
+ var ServerRollbackInfoSchema = object({
16205
+ /** The version that failed (or was manually rolled back). */
16206
+ fromVersion: string(),
16207
+ /** The version rolled back to; null = the baked seed. */
16208
+ toVersion: string().nullable(),
16209
+ atMs: number(),
16210
+ reason: string()
16211
+ });
16212
+ var ServerPackageStatusSchema = object({
16213
+ /** Root package name (`@camstack/server` on the hub). */
16214
+ packageName: string(),
16215
+ /** Version of the code the running process ACTUALLY loaded. */
16216
+ runningVersion: string().nullable(),
16217
+ /** Node.js runtime version the node's process runs on (`process.versions.node`). */
16218
+ nodeRuntimeVersion: string().nullable(),
16219
+ /** Active data-dir root version; null when booted from seed/workspace. */
16220
+ activeVersion: string().nullable(),
16221
+ /** N-1 version kept for rollback; null when no previous version exists. */
16222
+ previousVersion: string().nullable(),
16223
+ /** Version of the immutable baked seed closure (image fallback). */
16224
+ seedVersion: string().nullable(),
16225
+ /** Latest registry version from the most recent check (null = never checked). */
16226
+ latestVersion: string().nullable(),
16227
+ updateAvailable: boolean(),
16228
+ bootMode: ServerBootModeSchema,
16229
+ updateState: ServerUpdateStateSchema,
16230
+ /** Version staged + awaiting its probation boot, when one is pending. */
16231
+ pendingVersion: string().nullable(),
16232
+ /** Set when the last freshly-activated version failed its boot health-check. */
16233
+ rolledBack: ServerRollbackInfoSchema.nullable(),
16234
+ /**
16235
+ * True when `server-root/state.json` EXISTS but is unreadable/corrupt — the
16236
+ * hub is running from the baked seed (or workspace) while installed data-dir
16237
+ * versions are being IGNORED. Surfaced as a warning in the UI.
16238
+ */
16239
+ stateFileCorrupt: boolean(),
16240
+ lastCheckedAtMs: number().nullable()
16241
+ });
16242
+ var ServerUpdateCheckResultSchema = object({
16243
+ packageName: string(),
16244
+ runningVersion: string().nullable(),
16245
+ latestVersion: string().nullable(),
16246
+ updateAvailable: boolean(),
16247
+ checkedAtMs: number(),
16248
+ /** Non-null when the registry lookup failed (offline, bad registry, …). */
16249
+ error: string().nullable()
16250
+ });
16251
+ var ServerUpdateActionResultSchema = object({
16252
+ accepted: boolean(),
16253
+ targetVersion: string().nullable(),
16254
+ /** True when a graceful restart was scheduled to apply the change. */
16255
+ restarting: boolean(),
16256
+ message: string()
16257
+ });
16258
+ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
16259
+ kind: "mutation",
16260
+ auth: "admin"
16261
+ }), method(object({
16262
+ /** Explicit target version; omitted = latest from the registry. */
16263
+ version: string().optional() }), ServerUpdateActionResultSchema, {
16264
+ kind: "mutation",
16265
+ auth: "admin"
16266
+ }), method(_void(), ServerUpdateActionResultSchema, {
16267
+ kind: "mutation",
16268
+ auth: "admin"
16269
+ }), method(_void(), ServerUpdateActionResultSchema, {
16270
+ kind: "mutation",
16271
+ auth: "admin"
16272
+ });
16273
+ /**
16013
16274
  * Query filter for settings-store collections.
16014
16275
  */
16015
16276
  var QueryFilterSchema = object({
@@ -18039,6 +18300,16 @@ var TopologyCategorySchema = object({
18039
18300
  healthy: number(),
18040
18301
  addons: array(TopologyCategoryAddonSchema).readonly()
18041
18302
  });
18303
+ /**
18304
+ * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
18305
+ * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
18306
+ * version visibility for the Server management surface. Nullable: offline
18307
+ * rows and pre-phase-2 nodes report none.
18308
+ */
18309
+ var TopologyRootPackageSchema = object({
18310
+ name: string(),
18311
+ version: string()
18312
+ });
18042
18313
  var TopologyNodeSchema = object({
18043
18314
  id: string(),
18044
18315
  name: string(),
@@ -18062,7 +18333,8 @@ var TopologyNodeSchema = object({
18062
18333
  status: string()
18063
18334
  })).readonly(),
18064
18335
  processes: array(TopologyProcessSchema).readonly(),
18065
- categories: array(TopologyCategorySchema).readonly()
18336
+ categories: array(TopologyCategorySchema).readonly(),
18337
+ rootPackage: TopologyRootPackageSchema.nullable()
18066
18338
  });
18067
18339
  var CapUsageEdgeSchema = object({
18068
18340
  callerAddonId: string(),
@@ -20904,6 +21176,12 @@ Object.freeze({
20904
21176
  addonId: null,
20905
21177
  access: "create"
20906
21178
  },
21179
+ "loginMethod.getLoginMethods": {
21180
+ capName: "login-method",
21181
+ capScope: "system",
21182
+ addonId: null,
21183
+ access: "view"
21184
+ },
20907
21185
  "mediaPlayer.next": {
20908
21186
  capName: "media-player",
20909
21187
  capScope: "device",
@@ -21534,23 +21812,23 @@ Object.freeze({
21534
21812
  addonId: null,
21535
21813
  access: "create"
21536
21814
  },
21537
- "pipelineExecutor.deleteModel": {
21815
+ "pipelineExecutor.clearDeviceOverrides": {
21538
21816
  capName: "pipeline-executor",
21539
21817
  capScope: "system",
21540
21818
  addonId: null,
21541
21819
  access: "delete"
21542
21820
  },
21543
- "pipelineExecutor.deleteTemplate": {
21821
+ "pipelineExecutor.deleteModel": {
21544
21822
  capName: "pipeline-executor",
21545
21823
  capScope: "system",
21546
21824
  addonId: null,
21547
21825
  access: "delete"
21548
21826
  },
21549
- "pipelineExecutor.detect": {
21827
+ "pipelineExecutor.deleteTemplate": {
21550
21828
  capName: "pipeline-executor",
21551
21829
  capScope: "system",
21552
21830
  addonId: null,
21553
- access: "view"
21831
+ access: "delete"
21554
21832
  },
21555
21833
  "pipelineExecutor.downloadModel": {
21556
21834
  capName: "pipeline-executor",
@@ -21756,12 +22034,6 @@ Object.freeze({
21756
22034
  addonId: null,
21757
22035
  access: "create"
21758
22036
  },
21759
- "pipelineOrchestrator.assignDecoder": {
21760
- capName: "pipeline-orchestrator",
21761
- capScope: "system",
21762
- addonId: null,
21763
- access: "create"
21764
- },
21765
22037
  "pipelineOrchestrator.assignPipeline": {
21766
22038
  capName: "pipeline-orchestrator",
21767
22039
  capScope: "system",
@@ -21840,18 +22112,6 @@ Object.freeze({
21840
22112
  addonId: null,
21841
22113
  access: "view"
21842
22114
  },
21843
- "pipelineOrchestrator.getDecoderAssignment": {
21844
- capName: "pipeline-orchestrator",
21845
- capScope: "system",
21846
- addonId: null,
21847
- access: "view"
21848
- },
21849
- "pipelineOrchestrator.getDecoderAssignments": {
21850
- capName: "pipeline-orchestrator",
21851
- capScope: "system",
21852
- addonId: null,
21853
- access: "view"
21854
- },
21855
22115
  "pipelineOrchestrator.getGlobalMetrics": {
21856
22116
  capName: "pipeline-orchestrator",
21857
22117
  capScope: "system",
@@ -21900,6 +22160,12 @@ Object.freeze({
21900
22160
  addonId: null,
21901
22161
  access: "delete"
21902
22162
  },
22163
+ "pipelineOrchestrator.resetNodePipelineDefaults": {
22164
+ capName: "pipeline-orchestrator",
22165
+ capScope: "system",
22166
+ addonId: null,
22167
+ access: "delete"
22168
+ },
21903
22169
  "pipelineOrchestrator.resolvePipeline": {
21904
22170
  capName: "pipeline-orchestrator",
21905
22171
  capScope: "system",
@@ -21972,12 +22238,6 @@ Object.freeze({
21972
22238
  addonId: null,
21973
22239
  access: "create"
21974
22240
  },
21975
- "pipelineOrchestrator.unassignDecoder": {
21976
- capName: "pipeline-orchestrator",
21977
- capScope: "system",
21978
- addonId: null,
21979
- access: "create"
21980
- },
21981
22241
  "pipelineOrchestrator.unassignPipeline": {
21982
22242
  capName: "pipeline-orchestrator",
21983
22243
  capScope: "system",
@@ -22284,6 +22544,36 @@ Object.freeze({
22284
22544
  addonId: null,
22285
22545
  access: "create"
22286
22546
  },
22547
+ "serverManagement.applyServerUpdate": {
22548
+ capName: "server-management",
22549
+ capScope: "system",
22550
+ addonId: null,
22551
+ access: "create"
22552
+ },
22553
+ "serverManagement.checkServerUpdate": {
22554
+ capName: "server-management",
22555
+ capScope: "system",
22556
+ addonId: null,
22557
+ access: "create"
22558
+ },
22559
+ "serverManagement.getServerPackageStatus": {
22560
+ capName: "server-management",
22561
+ capScope: "system",
22562
+ addonId: null,
22563
+ access: "view"
22564
+ },
22565
+ "serverManagement.restartServer": {
22566
+ capName: "server-management",
22567
+ capScope: "system",
22568
+ addonId: null,
22569
+ access: "create"
22570
+ },
22571
+ "serverManagement.rollbackServerUpdate": {
22572
+ capName: "server-management",
22573
+ capScope: "system",
22574
+ addonId: null,
22575
+ access: "create"
22576
+ },
22287
22577
  "settingsStore.count": {
22288
22578
  capName: "settings-store",
22289
22579
  capScope: "system",
@@ -23148,6 +23438,18 @@ Object.freeze({
23148
23438
  addonId: null,
23149
23439
  access: "view"
23150
23440
  },
23441
+ "viewerUi.getStaticDir": {
23442
+ capName: "viewer-ui",
23443
+ capScope: "system",
23444
+ addonId: null,
23445
+ access: "view"
23446
+ },
23447
+ "viewerUi.getVersion": {
23448
+ capName: "viewer-ui",
23449
+ capScope: "system",
23450
+ addonId: null,
23451
+ access: "view"
23452
+ },
23151
23453
  "waterHeater.setAway": {
23152
23454
  capName: "water-heater",
23153
23455
  capScope: "device",
@@ -23378,6 +23680,10 @@ var OnvifCamera = class {
23378
23680
  * `null` when the camera is being restored from DB without a live connection.
23379
23681
  */
23380
23682
  client;
23683
+ /** Control-plane reachability poll — drives `online` from ONVIF
23684
+ * `getDeviceInformation` liveness, decoupled from stream-broker video
23685
+ * health. Started on `attachClient`, stopped on `removeDevice`. */
23686
+ reachabilityPoll = null;
23381
23687
  constructor(ctx, initialData, client = null) {
23382
23688
  this.ctx = ctx;
23383
23689
  this.id = ctx.id;
@@ -23562,8 +23868,32 @@ var OnvifCamera = class {
23562
23868
  attachClient(client) {
23563
23869
  this.client = client;
23564
23870
  this.online = true;
23871
+ this.startReachabilityPolling();
23872
+ }
23873
+ /** Start the control-plane reachability poll: an ONVIF
23874
+ * `getDeviceInformation` round-trip every 30s drives `online`, with
23875
+ * hysteresis. Replaces the old stream-health→online coupling so a
23876
+ * reachable on-demand camera still reports ONLINE. Re-armed on each
23877
+ * `attachClient` (reconnect) — the prior poll is stopped first. */
23878
+ startReachabilityPolling() {
23879
+ this.reachabilityPoll?.stop();
23880
+ this.reachabilityPoll = startReachabilityPoll({
23881
+ probe: async () => {
23882
+ const client = this.client;
23883
+ if (!client) return false;
23884
+ await client.getDeviceInfo();
23885
+ return true;
23886
+ },
23887
+ setOnline: (online) => {
23888
+ this.markOnline(online);
23889
+ },
23890
+ isEnabled: () => !this.disabled && this.client !== null,
23891
+ logger: this.ctx.logger
23892
+ });
23565
23893
  }
23566
23894
  async removeDevice() {
23895
+ this.reachabilityPoll?.stop();
23896
+ this.reachabilityPoll = null;
23567
23897
  this.client?.disconnect();
23568
23898
  this.client = null;
23569
23899
  this.online = false;