@camstack/addon-provider-amcrest 0.1.5 → 0.1.7

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 +411 -98
  2. package/dist/addon.mjs +411 -98
  3. package/package.json +4 -1
package/dist/addon.js CHANGED
@@ -4633,7 +4633,7 @@ function _instanceof(cls, params = {}) {
4633
4633
  return inst;
4634
4634
  }
4635
4635
  //#endregion
4636
- //#region ../types/dist/sleep-Cc14_yxc.mjs
4636
+ //#region ../types/dist/sleep-DJaTV2D7.mjs
4637
4637
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4638
4638
  EventCategory["SystemBoot"] = "system.boot";
4639
4639
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5354,10 +5354,6 @@ function hydrateField(field, values) {
5354
5354
  };
5355
5355
  }
5356
5356
  const rawValue = storedValue !== void 0 ? storedValue : defaultValue !== void 0 ? defaultValue : null;
5357
- if (field.type === "password") return {
5358
- ...field,
5359
- value: ""
5360
- };
5361
5357
  const value = field.type === "textarea" && field.isJson && rawValue !== null && typeof rawValue === "object" ? JSON.stringify(rawValue, null, 2) : rawValue;
5362
5358
  return {
5363
5359
  ...field,
@@ -6745,6 +6741,9 @@ function method(input, output, options) {
6745
6741
  function event(data) {
6746
6742
  return { data };
6747
6743
  }
6744
+ var StaticDirOutputSchema$1 = object({ staticDir: string() });
6745
+ var VersionOutputSchema$1 = object({ version: string() });
6746
+ method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6748
6747
  var StaticDirOutputSchema = object({ staticDir: string() });
6749
6748
  var VersionOutputSchema = object({ version: string() });
6750
6749
  method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
@@ -6931,10 +6930,18 @@ var ModelVariantGroupSchema = object({
6931
6930
  precision: _enum(["fp32", "int8"]).optional(),
6932
6931
  /**
6933
6932
  * Speed-optimization axis. Omit ⇒ the standard build. `fast` marks a
6934
- * latency-optimized export (e.g. ReLU-activation / reduced-input variant)
6935
- * — the slot the future performance variants plug into.
6933
+ * latency-optimized export (e.g. ReLU-activation variant) the slot the
6934
+ * future performance variants plug into.
6935
+ */
6936
+ optimization: _enum(["standard", "fast"]).optional(),
6937
+ /**
6938
+ * Input-resolution axis (square input side, px). Omit ⇒ the family's native
6939
+ * resolution (640 for yolo26). Reduced-input builds (320 / 256) are a big,
6940
+ * cheap latency lever — especially on Apple ANE and the Intel N100 — at a
6941
+ * small-object accuracy cost. Mirrors the model's `inputSize` but lifted onto
6942
+ * the group so the selector can offer it as a variant axis.
6936
6943
  */
6937
- optimization: _enum(["standard", "fast"]).optional()
6944
+ resolution: number().int().positive().optional()
6938
6945
  });
6939
6946
  var ModelCatalogEntrySchema = object({
6940
6947
  id: string(),
@@ -8587,6 +8594,72 @@ function createRuntimeStateBridge(params) {
8587
8594
  getStatus
8588
8595
  };
8589
8596
  }
8597
+ /** Reject after `ms`; always clears its own timer. */
8598
+ async function withTimeout(promise, ms, label) {
8599
+ let timer;
8600
+ const timeout = new Promise((_resolve, reject) => {
8601
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${label} timed out after ${String(ms)}ms`)), ms);
8602
+ });
8603
+ try {
8604
+ return await Promise.race([promise, timeout]);
8605
+ } finally {
8606
+ if (timer !== void 0) clearTimeout(timer);
8607
+ }
8608
+ }
8609
+ /**
8610
+ * Start the reachability poll loop. Returns a handle whose `stop()` clears the
8611
+ * timer and prevents any further ticks. Start on device activation, stop on
8612
+ * device teardown (`removeDevice`) so no timer leaks.
8613
+ */
8614
+ function startReachabilityPoll(options) {
8615
+ const intervalMs = options.intervalMs ?? 3e4;
8616
+ const failuresToOffline = options.failuresToOffline ?? 3;
8617
+ const probeTimeoutMs = options.probeTimeoutMs ?? 1e4;
8618
+ const runImmediately = options.runImmediately ?? true;
8619
+ let stopped = false;
8620
+ let running = false;
8621
+ let consecutiveFailures = 0;
8622
+ let timer;
8623
+ const tick = async () => {
8624
+ if (stopped) return;
8625
+ if (running) return;
8626
+ if (options.isEnabled && !options.isEnabled()) return;
8627
+ running = true;
8628
+ try {
8629
+ const reachable = await withTimeout(Promise.resolve().then(options.probe), probeTimeoutMs, "reachability probe");
8630
+ if (stopped) return;
8631
+ if (reachable) {
8632
+ consecutiveFailures = 0;
8633
+ options.setOnline(true);
8634
+ } else registerFailure("probe resolved unreachable");
8635
+ } catch (error) {
8636
+ if (stopped) return;
8637
+ registerFailure(error instanceof Error ? error.message : "probe threw");
8638
+ } finally {
8639
+ running = false;
8640
+ }
8641
+ };
8642
+ const registerFailure = (reason) => {
8643
+ consecutiveFailures += 1;
8644
+ options.logger?.debug("reachability probe failed", {
8645
+ reason,
8646
+ consecutiveFailures,
8647
+ failuresToOffline
8648
+ });
8649
+ if (consecutiveFailures >= failuresToOffline) options.setOnline(false);
8650
+ };
8651
+ timer = setInterval(() => {
8652
+ tick();
8653
+ }, intervalMs);
8654
+ if (typeof timer === "object" && timer !== null && "unref" in timer) timer.unref();
8655
+ if (runImmediately) tick();
8656
+ return { stop: () => {
8657
+ if (stopped) return;
8658
+ stopped = true;
8659
+ if (timer !== void 0) clearInterval(timer);
8660
+ timer = void 0;
8661
+ } };
8662
+ }
8590
8663
  /**
8591
8664
  * Generic device-level status snapshot. Auto-registered by `BaseDevice`
8592
8665
  * for every device, regardless of provider — the kernel needs a uniform
@@ -11582,7 +11655,7 @@ var BoundingBoxSchema = object({
11582
11655
  w: number(),
11583
11656
  h: number()
11584
11657
  });
11585
- var SpatialDetectionSchema = object({
11658
+ object({
11586
11659
  class: string(),
11587
11660
  originalClass: string(),
11588
11661
  score: number(),
@@ -11773,11 +11846,6 @@ var PipelineSchemaSchema = object({
11773
11846
  selectedEngine: PipelineEngineChoiceSchema,
11774
11847
  slots: array(PipelineSlotSchemaSchema).readonly()
11775
11848
  });
11776
- var DetectorOutputSchema = object({
11777
- detections: array(SpatialDetectionSchema).readonly(),
11778
- inferenceMs: number(),
11779
- modelId: string()
11780
- });
11781
11849
  var EngineProvisioningSchema = object({
11782
11850
  runtimeId: _enum([
11783
11851
  "onnx",
@@ -11900,6 +11968,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11900
11968
  })) }), object({ success: literal(true) }), {
11901
11969
  kind: "mutation",
11902
11970
  auth: "admin"
11971
+ }), method(object({ nodeId: string() }), object({
11972
+ success: literal(true),
11973
+ clearedDevices: number()
11974
+ }), {
11975
+ kind: "mutation",
11976
+ auth: "admin"
11903
11977
  }), 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({
11904
11978
  name: string(),
11905
11979
  steps: array(PipelineTemplateStepSchema).readonly(),
@@ -11917,10 +11991,6 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11917
11991
  modelId: string(),
11918
11992
  format: ModelFormatSchema$1
11919
11993
  }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
11920
- addonId: string(),
11921
- frame: FrameInputSchema,
11922
- config: record(string(), unknown()).optional()
11923
- }), DetectorOutputSchema), method(object({
11924
11994
  engine: PipelineEngineChoiceSchema.optional(),
11925
11995
  steps: array(PipelineStepInputSchema).min(1),
11926
11996
  frame: FrameInputSchema.optional(),
@@ -15285,7 +15355,9 @@ var AddonPageDeclarationSchema$1 = object({
15285
15355
  icon: string(),
15286
15356
  path: string(),
15287
15357
  remoteName: string(),
15288
- bundle: string()
15358
+ bundle: string(),
15359
+ section: string().optional(),
15360
+ sectionLabel: string().optional()
15289
15361
  });
15290
15362
  var AddonPageInfoSchema = object({
15291
15363
  addonId: string(),
@@ -15325,7 +15397,18 @@ var AddonPageDeclarationSchema = object({
15325
15397
  * the static-file route can compute an mtime-based cache-buster URL
15326
15398
  * without a separate filesystem stat.
15327
15399
  */
15328
- bundle: string()
15400
+ bundle: string(),
15401
+ /**
15402
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
15403
+ * `'cluster'`, `'administration'` — the page renders inside that group.
15404
+ * Any OTHER string creates (or joins) a custom section rendered after
15405
+ * the built-in groups; its label comes from `sectionLabel` (first
15406
+ * declaration wins), falling back to the id. Absent → the legacy
15407
+ * "Addon Pages" group.
15408
+ */
15409
+ section: string().optional(),
15410
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
15411
+ sectionLabel: string().optional()
15329
15412
  });
15330
15413
  method(_void(), array(AddonPageDeclarationSchema).readonly());
15331
15414
  var AddonHttpRouteSchema = object({
@@ -15541,6 +15624,17 @@ var WidgetMetadataSchema = object({
15541
15624
  deviceContext: boolean().default(false),
15542
15625
  integrationContext: boolean().default(false)
15543
15626
  }),
15627
+ /**
15628
+ * Loadable BEFORE authentication. The normal widget registry listing
15629
+ * (`addon-widgets.listWidgets`) is auth-gated, so a pre-auth surface
15630
+ * (the login page) cannot discover a widget through it. A widget that
15631
+ * declares `preAuth: true` marks itself as safe to mount on a pre-auth
15632
+ * screen — it is surfaced through the PUBLIC `auth.listLoginMethods`
15633
+ * login-method contribution channel (see `login-method.cap.ts`) rather
15634
+ * than the authenticated registry, and its bundle is served by the
15635
+ * public `/api/addon-widgets/:addonId/*` static route. Defaults false.
15636
+ */
15637
+ preAuth: boolean().optional().default(false),
15544
15638
  /** Dashboard placement HINTS (operator can override per instance). */
15545
15639
  defaultSize: WidgetSizeEnum.default("md"),
15546
15640
  allowedSizes: array(WidgetSizeEnum).readonly().default([
@@ -15842,6 +15936,66 @@ method(object({
15842
15936
  password: string()
15843
15937
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
15844
15938
  /**
15939
+ * `login-method` — collection cap through which auth addons contribute
15940
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
15941
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
15942
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
15943
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
15944
+ * procedure aggregates them for the unauthenticated login page.
15945
+ *
15946
+ * A contribution is a discriminated union on `kind`:
15947
+ *
15948
+ * - `redirect` — a declarative button. The login page renders a generic
15949
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
15950
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
15951
+ * ZERO shell-side JS. A future SSO addon plugs in the same way — the
15952
+ * login page needs NO change.
15953
+ *
15954
+ * - `widget` — a Module-Federation widget the login page mounts (via
15955
+ * `loadRemoteBundle`) for an in-page ceremony. Covers the passkey
15956
+ * login ceremony, which must run `@simplewebauthn/browser` INSIDE the
15957
+ * addon bundle. The referenced widget also declares `preAuth: true` in
15958
+ * its `addon-widgets-source` catalog entry. `auth.listLoginMethods`
15959
+ * stamps a public `bundleUrl` from `addonId` + `bundle`.
15960
+ *
15961
+ * Every contribution carries a `stage`:
15962
+ * - `primary` — shown on the first credentials screen (OIDC /
15963
+ * magic-link buttons; a future usernameless passkey).
15964
+ * - `second-factor` — shown AFTER the password leg, gated on the
15965
+ * returned `factors` (passkey-as-2FA today).
15966
+ *
15967
+ * `mount: skip` — the cap is read server-side by the core auth router
15968
+ * (`registry.getCollection('login-method')`), never mounted as its own
15969
+ * tRPC router.
15970
+ */
15971
+ /** When a login method renders in the two-phase login flow. */
15972
+ var LoginStageEnum = _enum(["primary", "second-factor"]);
15973
+ /** One login-method contribution — redirect button OR pre-auth widget. */
15974
+ var LoginMethodContributionSchema = discriminatedUnion("kind", [object({
15975
+ kind: literal("redirect"),
15976
+ /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
15977
+ id: string(),
15978
+ /** Operator-facing button label. */
15979
+ label: string(),
15980
+ /** lucide-react icon name. */
15981
+ icon: string().optional(),
15982
+ /** Addon-owned HTTP route the button navigates to (GET). */
15983
+ startUrl: string(),
15984
+ stage: LoginStageEnum
15985
+ }), object({
15986
+ kind: literal("widget"),
15987
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
15988
+ id: string(),
15989
+ /** Owning addon id — drives the public bundle URL + the MF namespace. */
15990
+ addonId: string(),
15991
+ /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
15992
+ bundle: string(),
15993
+ /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
15994
+ remote: WidgetRemoteSchema,
15995
+ stage: LoginStageEnum
15996
+ })]);
15997
+ method(_void(), array(LoginMethodContributionSchema).readonly());
15998
+ /**
15845
15999
  * Orchestrator-side destination metadata. The orchestrator computes
15846
16000
  * `id = <addonId>:<subId>` from its provider lookup so consumers
15847
16001
  * (admin UI, restore flow) see one canonical key.
@@ -18159,7 +18313,12 @@ var AgentPipelineSettingsSchema = object({
18159
18313
  detectWeight: number().positive().optional(),
18160
18314
  /** Node is eligible to run the detection pipeline (decode + inference). */
18161
18315
  detect: boolean().optional(),
18162
- /** Node is eligible to host decoder sessions. */
18316
+ /**
18317
+ * DEPRECATED AND IGNORED. Decode is always co-located with its frame
18318
+ * consumer, so decode eligibility IS detect eligibility. Kept optional in
18319
+ * the schema ONLY so persisted stores written before the removal still
18320
+ * parse — no code reads it and no write path emits it.
18321
+ */
18163
18322
  decode: boolean().optional(),
18164
18323
  /** Node is eligible to run audio-analyzer sessions. */
18165
18324
  audio: boolean().optional(),
@@ -18220,25 +18379,6 @@ var PipelineAssignmentSchema = object({
18220
18379
  assignedAt: number()
18221
18380
  });
18222
18381
  /**
18223
- * Decoder placement record. Symmetric to `PipelineAssignmentSchema` but for
18224
- * the decoder-node placement domain (`balanceDecoder` decision: manual pin
18225
- * → co-located with pipeline → capacity).
18226
- */
18227
- var DecoderAssignmentSchema = object({
18228
- deviceId: number(),
18229
- /** Moleculer node id of the decoder provider currently responsible for this camera. */
18230
- decoderNodeId: string(),
18231
- /** True when the assignment was set manually via `assignDecoder`, false when chosen by the balancer. */
18232
- pinned: boolean(),
18233
- /** Why this assignment was made — useful for debugging the decoder balancer. */
18234
- reason: _enum([
18235
- "manual",
18236
- "co-located",
18237
- "capacity",
18238
- "hardware-affinity"
18239
- ])
18240
- });
18241
- /**
18242
18382
  * Per-agent load summary surfaced to the load balancer + dashboards.
18243
18383
  * Aggregated from each runner's `getLocalLoad` cap call.
18244
18384
  */
@@ -18444,15 +18584,6 @@ method(object({
18444
18584
  }), method(_void(), IngestOwnerSchema), method(object({
18445
18585
  deviceId: number(),
18446
18586
  nodeId: string()
18447
- }), _void(), {
18448
- kind: "mutation",
18449
- auth: "admin"
18450
- }), method(object({ deviceId: number() }), _void(), {
18451
- kind: "mutation",
18452
- auth: "admin"
18453
- }), method(_void(), array(DecoderAssignmentSchema).readonly()), method(object({
18454
- deviceId: number(),
18455
- nodeId: string()
18456
18587
  }), object({ success: literal(true) }), {
18457
18588
  kind: "mutation",
18458
18589
  auth: "admin"
@@ -18471,10 +18602,7 @@ method(object({
18471
18602
  nodeId: string(),
18472
18603
  pinned: boolean(),
18473
18604
  assignedAt: number()
18474
- }))), method(object({
18475
- deviceId: number(),
18476
- pipelineNodeId: string().optional()
18477
- }), DecoderAssignmentSchema), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
18605
+ }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
18478
18606
  nodeId: string(),
18479
18607
  settings: AgentPipelineSettingsSchema
18480
18608
  })).readonly()), method(object({
@@ -18504,7 +18632,6 @@ method(object({
18504
18632
  }), method(object({
18505
18633
  agentNodeId: string(),
18506
18634
  detect: boolean().nullable().optional(),
18507
- decode: boolean().nullable().optional(),
18508
18635
  audio: boolean().nullable().optional(),
18509
18636
  ingest: boolean().nullable().optional()
18510
18637
  }), object({ success: literal(true) }), {
@@ -18516,6 +18643,15 @@ method(object({
18516
18643
  }), object({ success: literal(true) }), {
18517
18644
  kind: "mutation",
18518
18645
  auth: "admin"
18646
+ }), method(object({ agentNodeId: string() }), object({
18647
+ success: literal(true),
18648
+ /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
18649
+ effectiveModelId: string().nullable(),
18650
+ /** Number of cameras whose node-scoped overrides were cleared. */
18651
+ clearedCameraOverrides: number()
18652
+ }), {
18653
+ kind: "mutation",
18654
+ auth: "admin"
18519
18655
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
18520
18656
  deviceId: number(),
18521
18657
  addonId: string(),
@@ -18561,6 +18697,131 @@ method(object({
18561
18697
  auth: "admin"
18562
18698
  });
18563
18699
  /**
18700
+ * server-management — per-NODE singleton capability for a node's ROOT
18701
+ * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
18702
+ * agents).
18703
+ *
18704
+ * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
18705
+ * on agents) carries the whole software stack in its npm dep tree, so ONE
18706
+ * version describes the node. Updates install into
18707
+ * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
18708
+ * starter (probation boot + auto-rollback to N-1).
18709
+ *
18710
+ * Providers:
18711
+ * - HUB: `ServerUpdateService` behind the `server-provided` mount
18712
+ * (`buildServerProviders` in trpc.router.ts) — the default target for
18713
+ * unpinned calls.
18714
+ * - AGENT: `AgentUpdateService` registered by the agent bootstrap under
18715
+ * the synthetic `agent-runtime` addonId and declared in the agent's
18716
+ * `$hub.registerNode` manifest.
18717
+ *
18718
+ * Node routing: singleton caps get the codegen/runtime-builder `nodeId`
18719
+ * injection on every method — `input.nodeId` (or `nodePin(nodeId)` from the
18720
+ * SDK) routes the call to that node's provider via the standard remote
18721
+ * proxy (`createCapabilityProxy` → `$agent-cap-fwd` → the agent's
18722
+ * in-process provider lookup). No `nodeId` → the hub's own provider.
18723
+ *
18724
+ * Spec: docs/superpowers/specs/2026-07-12-runtime-updatable-node-packages-design.md
18725
+ */
18726
+ /**
18727
+ * Where the running hub's code was loaded from:
18728
+ * - `workspace` — dev checkout (tsx / workspace dist); the starter defers to
18729
+ * plain resolution and runtime updates are refused.
18730
+ * - `baked` — the immutable image seed closure (no data-dir root active).
18731
+ * - `data-root` — the runtime-updatable `<dataDir>/server-root` closure.
18732
+ */
18733
+ var ServerBootModeSchema = _enum([
18734
+ "workspace",
18735
+ "baked",
18736
+ "data-root"
18737
+ ]);
18738
+ /**
18739
+ * Update lifecycle state:
18740
+ * - `idle` / `checking` / `staging` — steady / in-flight registry work.
18741
+ * - `pending-restart` — a version is staged and the node has NOT yet
18742
+ * restarted onto it (still running the OLD version).
18743
+ * - `awaiting-confirmation` — the node HAS restarted onto the staged version
18744
+ * (it is the active probation boot) and is waiting to confirm boot-health.
18745
+ * Apply/rollback are refused in this state and the node must NOT be
18746
+ * manually restarted, or the probation boot auto-rolls-back.
18747
+ */
18748
+ var ServerUpdateStateSchema = _enum([
18749
+ "idle",
18750
+ "checking",
18751
+ "staging",
18752
+ "pending-restart",
18753
+ "awaiting-confirmation"
18754
+ ]);
18755
+ var ServerRollbackInfoSchema = object({
18756
+ /** The version that failed (or was manually rolled back). */
18757
+ fromVersion: string(),
18758
+ /** The version rolled back to; null = the baked seed. */
18759
+ toVersion: string().nullable(),
18760
+ atMs: number(),
18761
+ reason: string()
18762
+ });
18763
+ var ServerPackageStatusSchema = object({
18764
+ /** Root package name (`@camstack/server` on the hub). */
18765
+ packageName: string(),
18766
+ /** Version of the code the running process ACTUALLY loaded. */
18767
+ runningVersion: string().nullable(),
18768
+ /** Node.js runtime version the node's process runs on (`process.versions.node`). */
18769
+ nodeRuntimeVersion: string().nullable(),
18770
+ /** Active data-dir root version; null when booted from seed/workspace. */
18771
+ activeVersion: string().nullable(),
18772
+ /** N-1 version kept for rollback; null when no previous version exists. */
18773
+ previousVersion: string().nullable(),
18774
+ /** Version of the immutable baked seed closure (image fallback). */
18775
+ seedVersion: string().nullable(),
18776
+ /** Latest registry version from the most recent check (null = never checked). */
18777
+ latestVersion: string().nullable(),
18778
+ updateAvailable: boolean(),
18779
+ bootMode: ServerBootModeSchema,
18780
+ updateState: ServerUpdateStateSchema,
18781
+ /** Version staged + awaiting its probation boot, when one is pending. */
18782
+ pendingVersion: string().nullable(),
18783
+ /** Set when the last freshly-activated version failed its boot health-check. */
18784
+ rolledBack: ServerRollbackInfoSchema.nullable(),
18785
+ /**
18786
+ * True when `server-root/state.json` EXISTS but is unreadable/corrupt — the
18787
+ * hub is running from the baked seed (or workspace) while installed data-dir
18788
+ * versions are being IGNORED. Surfaced as a warning in the UI.
18789
+ */
18790
+ stateFileCorrupt: boolean(),
18791
+ lastCheckedAtMs: number().nullable()
18792
+ });
18793
+ var ServerUpdateCheckResultSchema = object({
18794
+ packageName: string(),
18795
+ runningVersion: string().nullable(),
18796
+ latestVersion: string().nullable(),
18797
+ updateAvailable: boolean(),
18798
+ checkedAtMs: number(),
18799
+ /** Non-null when the registry lookup failed (offline, bad registry, …). */
18800
+ error: string().nullable()
18801
+ });
18802
+ var ServerUpdateActionResultSchema = object({
18803
+ accepted: boolean(),
18804
+ targetVersion: string().nullable(),
18805
+ /** True when a graceful restart was scheduled to apply the change. */
18806
+ restarting: boolean(),
18807
+ message: string()
18808
+ });
18809
+ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
18810
+ kind: "mutation",
18811
+ auth: "admin"
18812
+ }), method(object({
18813
+ /** Explicit target version; omitted = latest from the registry. */
18814
+ version: string().optional() }), ServerUpdateActionResultSchema, {
18815
+ kind: "mutation",
18816
+ auth: "admin"
18817
+ }), method(_void(), ServerUpdateActionResultSchema, {
18818
+ kind: "mutation",
18819
+ auth: "admin"
18820
+ }), method(_void(), ServerUpdateActionResultSchema, {
18821
+ kind: "mutation",
18822
+ auth: "admin"
18823
+ });
18824
+ /**
18564
18825
  * Query filter for settings-store collections.
18565
18826
  */
18566
18827
  var QueryFilterSchema = object({
@@ -20590,6 +20851,16 @@ var TopologyCategorySchema = object({
20590
20851
  healthy: number(),
20591
20852
  addons: array(TopologyCategoryAddonSchema).readonly()
20592
20853
  });
20854
+ /**
20855
+ * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
20856
+ * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
20857
+ * version visibility for the Server management surface. Nullable: offline
20858
+ * rows and pre-phase-2 nodes report none.
20859
+ */
20860
+ var TopologyRootPackageSchema = object({
20861
+ name: string(),
20862
+ version: string()
20863
+ });
20593
20864
  var TopologyNodeSchema = object({
20594
20865
  id: string(),
20595
20866
  name: string(),
@@ -20613,7 +20884,8 @@ var TopologyNodeSchema = object({
20613
20884
  status: string()
20614
20885
  })).readonly(),
20615
20886
  processes: array(TopologyProcessSchema).readonly(),
20616
- categories: array(TopologyCategorySchema).readonly()
20887
+ categories: array(TopologyCategorySchema).readonly(),
20888
+ rootPackage: TopologyRootPackageSchema.nullable()
20617
20889
  });
20618
20890
  var CapUsageEdgeSchema = object({
20619
20891
  callerAddonId: string(),
@@ -23712,6 +23984,12 @@ Object.freeze({
23712
23984
  addonId: null,
23713
23985
  access: "create"
23714
23986
  },
23987
+ "loginMethod.getLoginMethods": {
23988
+ capName: "login-method",
23989
+ capScope: "system",
23990
+ addonId: null,
23991
+ access: "view"
23992
+ },
23715
23993
  "mediaPlayer.next": {
23716
23994
  capName: "media-player",
23717
23995
  capScope: "device",
@@ -24342,23 +24620,23 @@ Object.freeze({
24342
24620
  addonId: null,
24343
24621
  access: "create"
24344
24622
  },
24345
- "pipelineExecutor.deleteModel": {
24623
+ "pipelineExecutor.clearDeviceOverrides": {
24346
24624
  capName: "pipeline-executor",
24347
24625
  capScope: "system",
24348
24626
  addonId: null,
24349
24627
  access: "delete"
24350
24628
  },
24351
- "pipelineExecutor.deleteTemplate": {
24629
+ "pipelineExecutor.deleteModel": {
24352
24630
  capName: "pipeline-executor",
24353
24631
  capScope: "system",
24354
24632
  addonId: null,
24355
24633
  access: "delete"
24356
24634
  },
24357
- "pipelineExecutor.detect": {
24635
+ "pipelineExecutor.deleteTemplate": {
24358
24636
  capName: "pipeline-executor",
24359
24637
  capScope: "system",
24360
24638
  addonId: null,
24361
- access: "view"
24639
+ access: "delete"
24362
24640
  },
24363
24641
  "pipelineExecutor.downloadModel": {
24364
24642
  capName: "pipeline-executor",
@@ -24564,12 +24842,6 @@ Object.freeze({
24564
24842
  addonId: null,
24565
24843
  access: "create"
24566
24844
  },
24567
- "pipelineOrchestrator.assignDecoder": {
24568
- capName: "pipeline-orchestrator",
24569
- capScope: "system",
24570
- addonId: null,
24571
- access: "create"
24572
- },
24573
24845
  "pipelineOrchestrator.assignPipeline": {
24574
24846
  capName: "pipeline-orchestrator",
24575
24847
  capScope: "system",
@@ -24648,18 +24920,6 @@ Object.freeze({
24648
24920
  addonId: null,
24649
24921
  access: "view"
24650
24922
  },
24651
- "pipelineOrchestrator.getDecoderAssignment": {
24652
- capName: "pipeline-orchestrator",
24653
- capScope: "system",
24654
- addonId: null,
24655
- access: "view"
24656
- },
24657
- "pipelineOrchestrator.getDecoderAssignments": {
24658
- capName: "pipeline-orchestrator",
24659
- capScope: "system",
24660
- addonId: null,
24661
- access: "view"
24662
- },
24663
24923
  "pipelineOrchestrator.getGlobalMetrics": {
24664
24924
  capName: "pipeline-orchestrator",
24665
24925
  capScope: "system",
@@ -24708,6 +24968,12 @@ Object.freeze({
24708
24968
  addonId: null,
24709
24969
  access: "delete"
24710
24970
  },
24971
+ "pipelineOrchestrator.resetNodePipelineDefaults": {
24972
+ capName: "pipeline-orchestrator",
24973
+ capScope: "system",
24974
+ addonId: null,
24975
+ access: "delete"
24976
+ },
24711
24977
  "pipelineOrchestrator.resolvePipeline": {
24712
24978
  capName: "pipeline-orchestrator",
24713
24979
  capScope: "system",
@@ -24780,12 +25046,6 @@ Object.freeze({
24780
25046
  addonId: null,
24781
25047
  access: "create"
24782
25048
  },
24783
- "pipelineOrchestrator.unassignDecoder": {
24784
- capName: "pipeline-orchestrator",
24785
- capScope: "system",
24786
- addonId: null,
24787
- access: "create"
24788
- },
24789
25049
  "pipelineOrchestrator.unassignPipeline": {
24790
25050
  capName: "pipeline-orchestrator",
24791
25051
  capScope: "system",
@@ -25092,6 +25352,36 @@ Object.freeze({
25092
25352
  addonId: null,
25093
25353
  access: "create"
25094
25354
  },
25355
+ "serverManagement.applyServerUpdate": {
25356
+ capName: "server-management",
25357
+ capScope: "system",
25358
+ addonId: null,
25359
+ access: "create"
25360
+ },
25361
+ "serverManagement.checkServerUpdate": {
25362
+ capName: "server-management",
25363
+ capScope: "system",
25364
+ addonId: null,
25365
+ access: "create"
25366
+ },
25367
+ "serverManagement.getServerPackageStatus": {
25368
+ capName: "server-management",
25369
+ capScope: "system",
25370
+ addonId: null,
25371
+ access: "view"
25372
+ },
25373
+ "serverManagement.restartServer": {
25374
+ capName: "server-management",
25375
+ capScope: "system",
25376
+ addonId: null,
25377
+ access: "create"
25378
+ },
25379
+ "serverManagement.rollbackServerUpdate": {
25380
+ capName: "server-management",
25381
+ capScope: "system",
25382
+ addonId: null,
25383
+ access: "create"
25384
+ },
25095
25385
  "settingsStore.count": {
25096
25386
  capName: "settings-store",
25097
25387
  capScope: "system",
@@ -25956,6 +26246,18 @@ Object.freeze({
25956
26246
  addonId: null,
25957
26247
  access: "view"
25958
26248
  },
26249
+ "viewerUi.getStaticDir": {
26250
+ capName: "viewer-ui",
26251
+ capScope: "system",
26252
+ addonId: null,
26253
+ access: "view"
26254
+ },
26255
+ "viewerUi.getVersion": {
26256
+ capName: "viewer-ui",
26257
+ capScope: "system",
26258
+ addonId: null,
26259
+ access: "view"
26260
+ },
25959
26261
  "waterHeater.setAway": {
25960
26262
  capName: "water-heater",
25961
26263
  capScope: "device",
@@ -26725,6 +27027,10 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
26725
27027
  motionActive = false;
26726
27028
  /** Keepalive re-emit timer for a sustained motion window. */
26727
27029
  motionKeepaliveTimer = null;
27030
+ /** Control-plane reachability poll — drives `device.online` from Dahua CGI
27031
+ * `getDeviceInfo` liveness, decoupled from stream-broker video health.
27032
+ * Started in `onActivate`, stopped in `removeDevice`. */
27033
+ reachabilityPoll = null;
26728
27034
  /** Single-flight guard for the `stream-params` camera refresh. */
26729
27035
  streamParamsRefreshInFlight = null;
26730
27036
  /** Single-flight guard for the `motion-zones` camera refresh. */
@@ -26897,12 +27203,33 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
26897
27203
  /** Phase 5 — device is live: open the onboard-motion event stream. */
26898
27204
  async onActivate() {
26899
27205
  this.ensureEventSubscription();
27206
+ this.startReachabilityPolling();
27207
+ }
27208
+ /** Start the control-plane reachability poll: a Dahua CGI `getDeviceInfo`
27209
+ * round-trip every 30s drives `device.online`, with hysteresis. Replaces
27210
+ * the old stream-health→online mirror so an on-demand (idle) but reachable
27211
+ * camera still reports ONLINE. Idempotent. */
27212
+ startReachabilityPolling() {
27213
+ if (this.reachabilityPoll) return;
27214
+ this.reachabilityPoll = startReachabilityPoll({
27215
+ probe: async () => {
27216
+ await this.ensureClient().getDeviceInfo();
27217
+ return true;
27218
+ },
27219
+ setOnline: (online) => {
27220
+ this.markOnline(online);
27221
+ },
27222
+ isEnabled: () => !this.disabled,
27223
+ logger: this.ctx.logger
27224
+ });
26900
27225
  }
26901
27226
  /** Teardown — stop the stream + motion timers, drop the client. */
26902
27227
  async removeDevice() {
26903
27228
  this.ctx.logger.info("Removing Amcrest camera", { tags: { deviceId: this.id } });
26904
27229
  this.teardownEventSubscription();
26905
27230
  this.clearPtzAutoStop();
27231
+ this.reachabilityPoll?.stop();
27232
+ this.reachabilityPoll = null;
26906
27233
  this.client = null;
26907
27234
  }
26908
27235
  registerStreamCatalogProvider() {
@@ -36923,21 +37250,7 @@ var AmcrestProviderAddon = class extends BaseDeviceProvider {
36923
37250
  throw new Error(`Amcrest: probe on ${host || "(unknown host)"} resolved neither mac nor host address — cannot persist a stable row key. Verify network reachability + credentials, then retry.`);
36924
37251
  }
36925
37252
  async onInitialize() {
36926
- const regs = await super.onInitialize();
36927
- this.subscribe({ category: EventCategory.DeviceStateChanged }, (event) => {
36928
- const data = event.data;
36929
- if (data.capName !== "camera-streams") return;
36930
- const deviceId = data.deviceId;
36931
- if (typeof deviceId !== "number") return;
36932
- const registry = this.ctx.kernel.deviceRegistry;
36933
- if (!registry) return;
36934
- if (registry.getAddonId(deviceId) !== this.addonId) return;
36935
- const device = registry.getById(deviceId);
36936
- if (!device) return;
36937
- const online = data.slice?.online === true;
36938
- if (device.online !== online) device.online = online;
36939
- });
36940
- return regs;
37253
+ return await super.onInitialize();
36941
37254
  }
36942
37255
  async supportsDiscovery() {
36943
37256
  return true;