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