@camstack/addon-provider-hikvision 1.1.28 → 1.2.0

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 +560 -104
  2. package/dist/addon.mjs +560 -104
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7079,6 +7079,17 @@ var ModelCatalogEntrySchema = object({
7079
7079
  "imagenet",
7080
7080
  "none"
7081
7081
  ]).optional(),
7082
+ /**
7083
+ * The model already applies softmax IN-GRAPH — its raw output is a
7084
+ * probability distribution, not logits. When set, the `softmax`
7085
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7086
+ * probability vector collapses it toward uniform (top-1 score craters far
7087
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7088
+ * the output is raw logits and the postprocessor applies softmax (the normal
7089
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7090
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7091
+ */
7092
+ outputProbabilities: boolean().optional(),
7082
7093
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7083
7094
  /**
7084
7095
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7813,6 +7824,160 @@ var EncodeProfileSchema = object({
7813
7824
  */
7814
7825
  outputArgs: array(string()).optional()
7815
7826
  });
7827
+ var COCO_TO_MACRO = {
7828
+ mapping: {
7829
+ person: "person",
7830
+ bicycle: "vehicle",
7831
+ car: "vehicle",
7832
+ motorcycle: "vehicle",
7833
+ airplane: "vehicle",
7834
+ bus: "vehicle",
7835
+ train: "vehicle",
7836
+ truck: "vehicle",
7837
+ boat: "vehicle",
7838
+ bird: "animal",
7839
+ cat: "animal",
7840
+ dog: "animal",
7841
+ horse: "animal",
7842
+ sheep: "animal",
7843
+ cow: "animal",
7844
+ elephant: "animal",
7845
+ bear: "animal",
7846
+ zebra: "animal",
7847
+ giraffe: "animal",
7848
+ suitcase: "package",
7849
+ backpack: "package",
7850
+ handbag: "package"
7851
+ },
7852
+ preserveOriginal: false
7853
+ };
7854
+ var AUDIO_MACRO_LABELS = [
7855
+ {
7856
+ id: "speech",
7857
+ name: "Speech",
7858
+ icon: "🗣️"
7859
+ },
7860
+ {
7861
+ id: "scream",
7862
+ name: "Scream / Shout",
7863
+ icon: "😱"
7864
+ },
7865
+ {
7866
+ id: "crying",
7867
+ name: "Crying / Baby",
7868
+ icon: "😢"
7869
+ },
7870
+ {
7871
+ id: "laughter",
7872
+ name: "Laughter",
7873
+ icon: "😂"
7874
+ },
7875
+ {
7876
+ id: "music",
7877
+ name: "Music",
7878
+ icon: "🎵"
7879
+ },
7880
+ {
7881
+ id: "dog",
7882
+ name: "Dog",
7883
+ icon: "🐕"
7884
+ },
7885
+ {
7886
+ id: "cat",
7887
+ name: "Cat",
7888
+ icon: "🐈"
7889
+ },
7890
+ {
7891
+ id: "bird",
7892
+ name: "Bird",
7893
+ icon: "🐦"
7894
+ },
7895
+ {
7896
+ id: "animal",
7897
+ name: "Animal (other)",
7898
+ icon: "🐾"
7899
+ },
7900
+ {
7901
+ id: "alarm",
7902
+ name: "Alarm / Siren",
7903
+ icon: "🚨"
7904
+ },
7905
+ {
7906
+ id: "doorbell",
7907
+ name: "Doorbell / Knock",
7908
+ icon: "🔔"
7909
+ },
7910
+ {
7911
+ id: "glass_breaking",
7912
+ name: "Glass Breaking",
7913
+ icon: "💥"
7914
+ },
7915
+ {
7916
+ id: "gunshot",
7917
+ name: "Gunshot / Explosion",
7918
+ icon: "💣"
7919
+ },
7920
+ {
7921
+ id: "vehicle",
7922
+ name: "Vehicle",
7923
+ icon: "🚗"
7924
+ },
7925
+ {
7926
+ id: "siren",
7927
+ name: "Emergency Siren",
7928
+ icon: "🚑"
7929
+ },
7930
+ {
7931
+ id: "fire",
7932
+ name: "Fire / Smoke",
7933
+ icon: "🔥"
7934
+ },
7935
+ {
7936
+ id: "water",
7937
+ name: "Water",
7938
+ icon: "💧"
7939
+ },
7940
+ {
7941
+ id: "wind",
7942
+ name: "Wind / Weather",
7943
+ icon: "🌬️"
7944
+ },
7945
+ {
7946
+ id: "door",
7947
+ name: "Door",
7948
+ icon: "🚪"
7949
+ },
7950
+ {
7951
+ id: "footsteps",
7952
+ name: "Footsteps",
7953
+ icon: "👣"
7954
+ },
7955
+ {
7956
+ id: "crowd",
7957
+ name: "Crowd / Chatter",
7958
+ icon: "👥"
7959
+ },
7960
+ {
7961
+ id: "telephone",
7962
+ name: "Telephone",
7963
+ icon: "📞"
7964
+ },
7965
+ {
7966
+ id: "engine",
7967
+ name: "Engine / Motor",
7968
+ icon: "⚙️"
7969
+ },
7970
+ {
7971
+ id: "tools",
7972
+ name: "Tools / Construction",
7973
+ icon: "🔨"
7974
+ },
7975
+ {
7976
+ id: "silence",
7977
+ name: "Silence",
7978
+ icon: "🤫"
7979
+ }
7980
+ ];
7816
7981
  var YAMNET_TO_MACRO = {
7817
7982
  mapping: {
7818
7983
  Speech: "speech",
@@ -8079,6 +8244,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8079
8244
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8080
8245
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8081
8246
  /**
8247
+ * Unified event-kind taxonomy — THE single source of truth for
8248
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8249
+ * icon }`.
8250
+ *
8251
+ * This dictionary folds together what used to be scattered across four
8252
+ * copies:
8253
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8254
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8255
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8256
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8257
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8258
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8259
+ *
8260
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8261
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8262
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8263
+ * color or an icon: they read this dictionary (server descriptors carry the
8264
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8265
+ *
8266
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8267
+ */
8268
+ var TAXONOMY_COLORS = {
8269
+ motion: "#f59e0b",
8270
+ audio: "#06b6d4",
8271
+ person: "#22c55e",
8272
+ vehicle: "#3b82f6",
8273
+ animal: "#f97316",
8274
+ package: "#a855f7",
8275
+ sensor: "#8b5cf6",
8276
+ control: "#10b981",
8277
+ genericDetection: "#64748b"
8278
+ };
8279
+ var DETECTION_SUB_COLORS = {
8280
+ car: "#f59e0b",
8281
+ truck: "#d97706",
8282
+ bus: "#b45309",
8283
+ motorcycle: "#eab308",
8284
+ bicycle: "#ca8a04",
8285
+ airplane: "#60a5fa",
8286
+ boat: "#2563eb",
8287
+ train: "#1d4ed8",
8288
+ bird: "#14b8a6",
8289
+ dog: "#84cc16",
8290
+ cat: "#f97316",
8291
+ horse: "#a16207",
8292
+ sheep: "#a3a3a3",
8293
+ cow: "#78716c",
8294
+ elephant: "#6b7280",
8295
+ bear: "#7c2d12",
8296
+ zebra: "#404040",
8297
+ giraffe: "#d4a373"
8298
+ };
8299
+ function titleCase(id) {
8300
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8301
+ }
8302
+ var entries = /* @__PURE__ */ new Map();
8303
+ function macro(kind, category, color, iconId, label) {
8304
+ entries.set(kind, {
8305
+ kind,
8306
+ parentKind: null,
8307
+ level: "macro",
8308
+ category,
8309
+ color,
8310
+ iconId,
8311
+ labelKey: `eventKind.${kind}`,
8312
+ label
8313
+ });
8314
+ }
8315
+ function sub(kind, parentKind, category, color, iconId, label) {
8316
+ entries.set(kind, {
8317
+ kind,
8318
+ parentKind,
8319
+ level: "sub",
8320
+ category,
8321
+ color,
8322
+ iconId,
8323
+ labelKey: `eventKind.${kind}`,
8324
+ label
8325
+ });
8326
+ }
8327
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8328
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8329
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8330
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8331
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8332
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8333
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8334
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8335
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8336
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8337
+ if (entries.has(cocoClass)) continue;
8338
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8339
+ }
8340
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8341
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8342
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8343
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8344
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8345
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8346
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8347
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8348
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8349
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8350
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8351
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8352
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8353
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8354
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8355
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8356
+ sub("button", "control", "control", "#10b981", "button", "Button");
8357
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8358
+ for (const l of AUDIO_MACRO_LABELS) {
8359
+ const kind = `audio-${l.id}`;
8360
+ if (entries.has(kind)) continue;
8361
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8362
+ }
8363
+ /** The complete taxonomy dictionary, keyed by kind. */
8364
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8365
+ /**
8082
8366
  * Error types for the safe expression engine. Two distinct classes so callers
8083
8367
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8084
8368
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12376,10 +12660,7 @@ var ConfigUISchemaNullableBridge = custom();
12376
12660
  var InferenceCapabilitiesBridge = custom();
12377
12661
  var ModelAvailabilityListBridge = custom();
12378
12662
  var PipelineRunResultBridge = custom();
12379
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12380
- kind: "mutation",
12381
- auth: "admin"
12382
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12663
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12383
12664
  modelId: string(),
12384
12665
  settings: record(string(), unknown()).readonly()
12385
12666
  }))), method(object({ steps: record(string(), object({
@@ -12439,13 +12720,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12439
12720
  * (inputClasses ≠ null) are skipped and served per-track via
12440
12721
  * pipelineRunner.runDetailSubtree (two-plane design).
12441
12722
  */
12442
- plane: _enum(["full", "frame"]).optional()
12723
+ plane: _enum(["full", "frame"]).optional(),
12724
+ /**
12725
+ * Inference-device selector (Phase 2 multi-device). Format
12726
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12727
+ * Omitted ⇒ the runner's default device (current single-engine
12728
+ * behaviour). Selects WHICH device pool of the node runs the call.
12729
+ */
12730
+ deviceKey: string().optional()
12443
12731
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12444
12732
  engine: PipelineEngineChoiceSchema.optional(),
12445
12733
  steps: array(PipelineStepInputSchema).min(1),
12446
12734
  frames: array(FrameInputSchema).min(1).max(255),
12447
12735
  deviceId: number().optional(),
12448
- sessionId: string().optional()
12736
+ sessionId: string().optional(),
12737
+ /**
12738
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12739
+ * the batch to the Python pool's bench preprocess cache
12740
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12741
+ * preprocessed ONCE and every later inference is a pure-inference cache
12742
+ * hit — the sustained-throughput run measures inference, not
12743
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12744
+ * full preprocess every call, correct). Fresh per sustained run;
12745
+ * released via `uncacheFrame`.
12746
+ */
12747
+ frameId: number().int().nonnegative().optional(),
12748
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12749
+ deviceKey: string().optional()
12449
12750
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12450
12751
  data: _instanceof(Uint8Array),
12451
12752
  width: number().int().positive(),
@@ -12477,8 +12778,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12477
12778
  * - `runtime` — main camera-serving engine (no idle TTL).
12478
12779
  * - `warm-override` — benchmark/test override held in the warm
12479
12780
  * cache; auto-disposed after the idle TTL.
12781
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12782
+ * multi-device, keyed by `deviceKey`) resolved
12783
+ * via `resolveDeviceFactory`. Runs alongside the
12784
+ * `runtime` engine on a DIFFERENT accelerator
12785
+ * (NPU / iGPU / Coral) — this is how the
12786
+ * Engines tab shows all pools running at once.
12480
12787
  */
12481
- kind: _enum(["runtime", "warm-override"]),
12788
+ kind: _enum([
12789
+ "runtime",
12790
+ "warm-override",
12791
+ "device-pool"
12792
+ ]),
12482
12793
  /** Native pid of the underlying Python pool (null when no pool). */
12483
12794
  poolPid: number().nullable(),
12484
12795
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12853,7 +13164,14 @@ var RunnerCameraConfigSchema = object({
12853
13164
  * camera's detect node differs from its source-owner (P2d, gated by the
12854
13165
  * `remoteSourcingNodes` rollout setting).
12855
13166
  */
12856
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
13167
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
13168
+ /**
13169
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
13170
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
13171
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
13172
+ * this only selects WHICH device pool of that node runs the session.
13173
+ */
13174
+ deviceKey: string().optional()
12857
13175
  });
12858
13176
  motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
12859
13177
  /**
@@ -12874,6 +13192,19 @@ var RunnerLocalLoadSchema = object({
12874
13192
  avgInferenceTimeMs: number(),
12875
13193
  /** Total queue depth across motion + detection queues. */
12876
13194
  queueDepthTotal: number(),
13195
+ /**
13196
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
13197
+ * this runner currently has attached cameras on, so the orchestrator's second
13198
+ * `balance()` pass (over a node's devices) weights on real per-pool session
13199
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
13200
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
13201
+ */
13202
+ devices: array(object({
13203
+ deviceKey: string(),
13204
+ backend: string(),
13205
+ attachedCameras: number(),
13206
+ queueDepthTotal: number()
13207
+ })).default([]),
12877
13208
  /** Hardware capability flags reported by this node. */
12878
13209
  hardware: object({
12879
13210
  hasGpu: boolean(),
@@ -16022,6 +16353,8 @@ var BaseDeviceProvider = class extends BaseAddon {
16022
16353
  return toDeviceSummary(device, this.addonId);
16023
16354
  }
16024
16355
  };
16356
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
16357
+ new Set(Object.values(DeviceType));
16025
16358
  /**
16026
16359
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
16027
16360
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -19128,17 +19461,30 @@ var EventKindCategorySchema = _enum([
19128
19461
  "audio",
19129
19462
  "detection",
19130
19463
  "sensor",
19464
+ "control",
19131
19465
  "custom",
19132
19466
  "package"
19133
19467
  ]);
19468
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19469
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
19134
19470
  var EventKindDescriptorSchema = object({
19135
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19471
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
19136
19472
  kind: string(),
19473
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19474
+ labelKey: string(),
19475
+ /** English fallback label (kept for clients that don't translate). */
19137
19476
  label: string(),
19138
19477
  /** Hex color for timeline/legend rendering. */
19139
19478
  color: string(),
19479
+ /** Dictionary id → lucide component on the UI side. */
19480
+ iconId: string(),
19481
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
19140
19482
  icon: EventKindIconSchema,
19141
19483
  category: EventKindCategorySchema,
19484
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19485
+ parentKind: string().nullable(),
19486
+ /** Derived from `parentKind`, explicit for the client tree. */
19487
+ level: EventKindLevelSchema,
19142
19488
  /** Which cap + device contributes this kind. For built-ins the camera
19143
19489
  * itself; for sensor kinds the LINKED source device. */
19144
19490
  source: object({
@@ -19211,11 +19557,21 @@ var TrackAudioLabelSchema = object({
19211
19557
  firstAt: number(),
19212
19558
  lastAt: number()
19213
19559
  });
19560
+ /**
19561
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19562
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19563
+ * linked sensor/control state change (no positions; carries a snapshot). The
19564
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19565
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19566
+ */
19567
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19214
19568
  var TrackSchema = object({
19215
19569
  trackId: string(),
19216
19570
  deviceId: number(),
19217
19571
  className: string(),
19218
19572
  label: string().optional(),
19573
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19574
+ source: TrackSourceSchema.optional(),
19219
19575
  firstSeen: number(),
19220
19576
  lastSeen: number(),
19221
19577
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19592,6 +19948,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19592
19948
  eventId: string(),
19593
19949
  timestamp: number()
19594
19950
  });
19951
+ /**
19952
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19953
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19954
+ * caps into per-camera event-kind descriptors.
19955
+ *
19956
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19957
+ * is NOT duplicated here — every entry is derived from the single
19958
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19959
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19960
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19961
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19962
+ * eventful cap is missing.
19963
+ */
19964
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19965
+ var LEGACY_ICON = {
19966
+ motion: "motion",
19967
+ audio: "audio",
19968
+ person: "person",
19969
+ vehicle: "vehicle",
19970
+ animal: "animal",
19971
+ package: "package",
19972
+ door: "door",
19973
+ pir: "pir",
19974
+ smoke: "smoke",
19975
+ water: "water",
19976
+ button: "button",
19977
+ generic: "generic",
19978
+ gas: "smoke",
19979
+ vibration: "generic",
19980
+ tamper: "generic",
19981
+ presence: "person",
19982
+ lock: "generic",
19983
+ siren: "generic",
19984
+ switch: "generic",
19985
+ doorbell: "button"
19986
+ };
19987
+ function legacyIcon(iconId) {
19988
+ return LEGACY_ICON[iconId] ?? "generic";
19989
+ }
19990
+ /**
19991
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19992
+ * The anti-drift guard cross-checks this against the eventful caps declared
19993
+ * in `packages/types/src/capabilities/*.cap.ts`.
19994
+ */
19995
+ var CAP_TO_KIND = {
19996
+ contact: "contact",
19997
+ motion: "motion-sensor",
19998
+ smoke: "smoke",
19999
+ flood: "flood",
20000
+ gas: "gas",
20001
+ "carbon-monoxide": "carbon-monoxide",
20002
+ vibration: "vibration",
20003
+ tamper: "tamper",
20004
+ presence: "presence",
20005
+ "enum-sensor": "enum-sensor",
20006
+ "event-emitter": "device-event",
20007
+ "lock-control": "lock",
20008
+ switch: "switch",
20009
+ button: "button",
20010
+ doorbell: "doorbell"
20011
+ };
20012
+ function buildDescriptor(capName, kind) {
20013
+ const t = EVENT_TAXONOMY[kind];
20014
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
20015
+ return {
20016
+ ...t,
20017
+ icon: legacyIcon(t.iconId)
20018
+ };
20019
+ }
20020
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19595
20021
  var CameraPipelineConfigSchema = object({
19596
20022
  engine: PipelineEngineChoiceSchema.optional(),
19597
20023
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19610,13 +20036,11 @@ var PipelineTemplateSchema = object({
19610
20036
  createdAt: string(),
19611
20037
  updatedAt: string()
19612
20038
  });
19613
- var AgentAddonConfigSchema = object({
19614
- enabled: boolean(),
20039
+ var DeviceStepConfigSchema = object({
19615
20040
  modelId: string().optional(),
19616
- settings: record(string(), unknown()).readonly()
20041
+ settings: record(string(), unknown()).optional()
19617
20042
  });
19618
20043
  var AgentPipelineSettingsSchema = object({
19619
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19620
20044
  maxCameras: number().int().nonnegative().nullable().default(null),
19621
20045
  /** Per-node detection weight (relative share for the quota balancer). */
19622
20046
  detectWeight: number().positive().optional(),
@@ -19640,7 +20064,22 @@ var AgentPipelineSettingsSchema = object({
19640
20064
  * it already uses to reach the hub). Set this only when the auto-detected
19641
20065
  * address is wrong (multi-homed host, NAT, custom interface).
19642
20066
  */
19643
- reachableHost: string().optional()
20067
+ reachableHost: string().optional(),
20068
+ /**
20069
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
20070
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
20071
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
20072
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
20073
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
20074
+ * the default model/settings for every camera landing on that accelerator;
20075
+ * a stepId absent ⇒ the step uses that device's format default.
20076
+ */
20077
+ inferenceDevices: record(string(), object({
20078
+ enabled: boolean(),
20079
+ weight: number().positive().optional(),
20080
+ maxSessions: number().int().positive().optional(),
20081
+ steps: record(string(), DeviceStepConfigSchema).optional()
20082
+ })).optional()
19644
20083
  });
19645
20084
  var CameraPipelineForAgentSchema = object({
19646
20085
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19650,14 +20089,13 @@ var CameraPipelineForAgentSchema = object({
19650
20089
  }).nullable()
19651
20090
  });
19652
20091
  var CameraStepOverridePatchSchema = object({
19653
- enabled: boolean().optional(),
19654
20092
  modelId: string().optional(),
19655
20093
  settings: record(string(), unknown()).readonly().optional()
19656
20094
  });
19657
20095
  var CameraPipelineSettingsSchema = object({
19658
20096
  pinnedAgentNodeId: string().optional(),
19659
20097
  stepToggles: record(string(), boolean()).optional(),
19660
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
20098
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19661
20099
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19662
20100
  });
19663
20101
  /**
@@ -19871,6 +20309,44 @@ var CameraStatusSchema = object({
19871
20309
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19872
20310
  fetchedAt: number()
19873
20311
  });
20312
+ var NodeInferenceDeviceSchema = object({
20313
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20314
+ key: string(),
20315
+ backend: string(),
20316
+ device: string(),
20317
+ format: _enum(MODEL_FORMATS),
20318
+ /** Whether the node's live probe reports the device as usable right now. */
20319
+ available: boolean(),
20320
+ /**
20321
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20322
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20323
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20324
+ * not a balanced target). An explicit stored value always wins; a stored-only
20325
+ * (unavailable) key keeps its stored value.
20326
+ */
20327
+ enabled: boolean(),
20328
+ /** Relative balancer weight for the enabled device (default 1). */
20329
+ weight: number(),
20330
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20331
+ maxSessions: number().nullable(),
20332
+ /** Object-detection model the executor defaults to for this deviceKey. */
20333
+ defaultModelId: string(),
20334
+ /**
20335
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20336
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20337
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20338
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20339
+ * available per format; this is the stored selection that becomes the
20340
+ * default for EVERY camera landing on this accelerator.
20341
+ */
20342
+ steps: record(string(), DeviceStepConfigSchema).optional()
20343
+ });
20344
+ var NodeInferenceDevicesSchema = object({
20345
+ nodeId: string(),
20346
+ /** False when the node's platform-probe was unreachable (no live device set). */
20347
+ reachable: boolean(),
20348
+ devices: array(NodeInferenceDeviceSchema).readonly()
20349
+ });
19874
20350
  method(object({
19875
20351
  deviceId: number(),
19876
20352
  agentNodeId: string()
@@ -19880,7 +20356,13 @@ method(object({
19880
20356
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19881
20357
  kind: "mutation",
19882
20358
  auth: "admin"
19883
- }), method(_void(), object({ migrated: number() }), {
20359
+ }), method(object({
20360
+ deviceId: number(),
20361
+ deviceKey: string()
20362
+ }), object({ success: literal(true) }), {
20363
+ kind: "mutation",
20364
+ auth: "admin"
20365
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19884
20366
  kind: "mutation",
19885
20367
  auth: "admin"
19886
20368
  }), method(_void(), array(PipelineAssignmentSchema).readonly()), method(object({ deviceId: number() }), PipelineAssignmentSchema.nullable()), method(_void(), array(AgentLoadSummarySchema).readonly()), method(_void(), GlobalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(object({ nodeId: string() }), CapabilityBindingsSchema), method(object({
@@ -19914,13 +20396,7 @@ method(object({
19914
20396
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19915
20397
  nodeId: string(),
19916
20398
  settings: AgentPipelineSettingsSchema
19917
- })).readonly()), method(object({
19918
- agentNodeId: string(),
19919
- defaults: record(string(), AgentAddonConfigSchema)
19920
- }), object({ success: literal(true) }), {
19921
- kind: "mutation",
19922
- auth: "admin"
19923
- }), method(object({ agentNodeId: string() }), object({
20399
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19924
20400
  success: boolean(),
19925
20401
  removed: boolean()
19926
20402
  }), {
@@ -19952,7 +20428,18 @@ method(object({
19952
20428
  }), object({ success: literal(true) }), {
19953
20429
  kind: "mutation",
19954
20430
  auth: "admin"
19955
- }), method(object({ agentNodeId: string() }), object({
20431
+ }), method(object({
20432
+ agentNodeId: string(),
20433
+ inferenceDevices: record(string(), object({
20434
+ enabled: boolean(),
20435
+ weight: number().positive().optional(),
20436
+ maxSessions: number().int().positive().optional(),
20437
+ steps: record(string(), DeviceStepConfigSchema).optional()
20438
+ }))
20439
+ }), object({ success: literal(true) }), {
20440
+ kind: "mutation",
20441
+ auth: "admin"
20442
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19956
20443
  success: literal(true),
19957
20444
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19958
20445
  effectiveModelId: string().nullable(),
@@ -19968,9 +20455,10 @@ method(object({
19968
20455
  }), object({ success: literal(true) }), {
19969
20456
  kind: "mutation",
19970
20457
  auth: "admin"
19971
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20458
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19972
20459
  deviceId: number(),
19973
20460
  agentNodeId: string(),
20461
+ deviceKey: string(),
19974
20462
  addonId: string(),
19975
20463
  patch: CameraStepOverridePatchSchema.nullable()
19976
20464
  }), object({ success: literal(true) }), {
@@ -20007,14 +20495,13 @@ method(object({
20007
20495
  });
20008
20496
  /**
20009
20497
  * server-management — per-NODE singleton capability for a node's ROOT
20010
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
20011
- * agents).
20498
+ * package lifecycle (runtime-updatable node packages).
20012
20499
  *
20013
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
20014
- * on agents) carries the whole software stack in its npm dep tree, so ONE
20015
- * version describes the node. Updates install into
20016
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
20017
- * starter (probation boot + auto-rollback to N-1).
20500
+ * Every node role runs the SAME root package (`@camstack/server`), which
20501
+ * carries the whole software stack in its npm dep tree, so ONE version
20502
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20503
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20504
+ * no auto-rollback).
20018
20505
  *
20019
20506
  * Providers:
20020
20507
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -20122,7 +20609,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
20122
20609
  /** Explicit target version; omitted = latest from the registry. */
20123
20610
  version: string().optional() }), ServerUpdateActionResultSchema, {
20124
20611
  kind: "mutation",
20125
- auth: "admin"
20612
+ auth: "admin",
20613
+ timeoutMs: 16 * 6e4
20126
20614
  }), method(_void(), ServerUpdateActionResultSchema, {
20127
20615
  kind: "mutation",
20128
20616
  auth: "admin"
@@ -21217,22 +21705,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21217
21705
  var RestartAddonResultSchema = unknown();
21218
21706
  var InstallPackageResultSchema = unknown();
21219
21707
  var ReloadPackagesResultSchema = unknown();
21220
- /**
21221
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
21222
- * server restarts so the admin UI can react to the `restartingAt`
21223
- * timestamp (shows reconnect overlay). The transition from
21224
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
21225
- * `system.restart-completed` event after the new process boots.
21226
- *
21227
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
21228
- */
21229
- var UpdateFrameworkPackageResultSchema = object({
21230
- packageName: string(),
21231
- fromVersion: string(),
21232
- toVersion: string(),
21233
- /** Ms-epoch the server scheduled its self-restart. */
21234
- restartingAt: number()
21235
- });
21236
21708
  var BulkUpdateItemStatusSchema = _enum([
21237
21709
  "queued",
21238
21710
  "updating",
@@ -21360,13 +21832,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21360
21832
  }), object({ success: literal(true) }), {
21361
21833
  kind: "mutation",
21362
21834
  auth: "admin"
21363
- }), method(object({
21364
- packageName: string().min(1),
21365
- version: string().optional(),
21366
- deferRestart: boolean().optional()
21367
- }), UpdateFrameworkPackageResultSchema, {
21368
- kind: "mutation",
21369
- auth: "admin"
21370
21835
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21371
21836
  kind: "mutation",
21372
21837
  auth: "admin"
@@ -22283,10 +22748,10 @@ var TopologyCategorySchema = object({
22283
22748
  addons: array(TopologyCategoryAddonSchema).readonly()
22284
22749
  });
22285
22750
  /**
22286
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
22287
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
22288
- * version visibility for the Server management surface. Nullable: offline
22289
- * rows and pre-phase-2 nodes report none.
22751
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22752
+ * root package for every node role) as reported by its `registerNode`
22753
+ * manifest — version visibility for the Server management surface. Nullable:
22754
+ * offline rows and nodes that never reported one.
22290
22755
  */
22291
22756
  var TopologyRootPackageSchema = object({
22292
22757
  name: string(),
@@ -22720,17 +23185,28 @@ var PlatformScoreSchema = object({
22720
23185
  format: _enum([
22721
23186
  "onnx",
22722
23187
  "coreml",
22723
- "openvino"
23188
+ "openvino",
23189
+ "tflite"
22724
23190
  ]),
22725
23191
  score: number(),
22726
23192
  reason: string(),
22727
23193
  available: boolean()
22728
23194
  });
23195
+ var InferenceDeviceDescriptorSchema = object({
23196
+ key: string(),
23197
+ backend: string(),
23198
+ device: string(),
23199
+ format: ModelFormatSchema,
23200
+ runtime: literal("python"),
23201
+ score: number(),
23202
+ available: boolean()
23203
+ });
22729
23204
  var PlatformCapabilitiesSchema = object({
22730
23205
  hardware: HardwareInfoSchema,
22731
23206
  scores: array(PlatformScoreSchema).readonly(),
22732
23207
  bestScore: PlatformScoreSchema,
22733
- pythonPath: string().nullable()
23208
+ pythonPath: string().nullable(),
23209
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22734
23210
  });
22735
23211
  var ModelRequirementSchema = object({
22736
23212
  modelId: string(),
@@ -23887,12 +24363,6 @@ Object.freeze({
23887
24363
  addonId: null,
23888
24364
  access: "delete"
23889
24365
  },
23890
- "addons.updateFrameworkPackage": {
23891
- capName: "addons",
23892
- capScope: "system",
23893
- addonId: null,
23894
- access: "create"
23895
- },
23896
24366
  "addons.updatePackage": {
23897
24367
  capName: "addons",
23898
24368
  capScope: "system",
@@ -26665,12 +27135,6 @@ Object.freeze({
26665
27135
  addonId: null,
26666
27136
  access: "view"
26667
27137
  },
26668
- "pipelineExecutor.reprobeEngine": {
26669
- capName: "pipeline-executor",
26670
- capScope: "system",
26671
- addonId: null,
26672
- access: "create"
26673
- },
26674
27138
  "pipelineExecutor.runAudioTest": {
26675
27139
  capName: "pipeline-executor",
26676
27140
  capScope: "system",
@@ -26821,6 +27285,12 @@ Object.freeze({
26821
27285
  addonId: null,
26822
27286
  access: "view"
26823
27287
  },
27288
+ "pipelineOrchestrator.getNodeInferenceDevices": {
27289
+ capName: "pipeline-orchestrator",
27290
+ capScope: "system",
27291
+ addonId: null,
27292
+ access: "view"
27293
+ },
26824
27294
  "pipelineOrchestrator.getPipelineAssignment": {
26825
27295
  capName: "pipeline-orchestrator",
26826
27296
  capScope: "system",
@@ -26833,6 +27303,12 @@ Object.freeze({
26833
27303
  addonId: null,
26834
27304
  access: "view"
26835
27305
  },
27306
+ "pipelineOrchestrator.getPipelineDevicePin": {
27307
+ capName: "pipeline-orchestrator",
27308
+ capScope: "system",
27309
+ addonId: null,
27310
+ access: "view"
27311
+ },
26836
27312
  "pipelineOrchestrator.listAgentSettings": {
26837
27313
  capName: "pipeline-orchestrator",
26838
27314
  capScope: "system",
@@ -26875,19 +27351,19 @@ Object.freeze({
26875
27351
  addonId: null,
26876
27352
  access: "create"
26877
27353
  },
26878
- "pipelineOrchestrator.setAgentAddonDefaults": {
27354
+ "pipelineOrchestrator.setAgentCapabilities": {
26879
27355
  capName: "pipeline-orchestrator",
26880
27356
  capScope: "system",
26881
27357
  addonId: null,
26882
27358
  access: "create"
26883
27359
  },
26884
- "pipelineOrchestrator.setAgentCapabilities": {
27360
+ "pipelineOrchestrator.setAgentDetectWeight": {
26885
27361
  capName: "pipeline-orchestrator",
26886
27362
  capScope: "system",
26887
27363
  addonId: null,
26888
27364
  access: "create"
26889
27365
  },
26890
- "pipelineOrchestrator.setAgentDetectWeight": {
27366
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26891
27367
  capName: "pipeline-orchestrator",
26892
27368
  capScope: "system",
26893
27369
  addonId: null,
@@ -26929,6 +27405,12 @@ Object.freeze({
26929
27405
  addonId: null,
26930
27406
  access: "create"
26931
27407
  },
27408
+ "pipelineOrchestrator.setPipelineDevicePin": {
27409
+ capName: "pipeline-orchestrator",
27410
+ capScope: "system",
27411
+ addonId: null,
27412
+ access: "create"
27413
+ },
26932
27414
  "pipelineOrchestrator.unassignAudio": {
26933
27415
  capName: "pipeline-orchestrator",
26934
27416
  capScope: "system",
@@ -28481,32 +28963,6 @@ Object.freeze({
28481
28963
  "network-access": "ingress",
28482
28964
  "smtp-provider": "email"
28483
28965
  });
28484
- var frameworkSwapPackageSchema = object({
28485
- name: string(),
28486
- stagedPath: string(),
28487
- backupPath: string(),
28488
- toVersion: string(),
28489
- fromVersion: string().nullable()
28490
- });
28491
- object({
28492
- jobId: string(),
28493
- taskId: string(),
28494
- packages: array(frameworkSwapPackageSchema),
28495
- requestedAtMs: number(),
28496
- schemaVersion: literal(1)
28497
- });
28498
- object({
28499
- jobId: string(),
28500
- taskId: string(),
28501
- backups: array(object({
28502
- name: string(),
28503
- backupPath: string(),
28504
- livePath: string()
28505
- })),
28506
- appliedAtMs: number(),
28507
- bootAttempts: number(),
28508
- schemaVersion: literal(1)
28509
- });
28510
28966
  //#endregion
28511
28967
  //#region src/schema.ts
28512
28968
  /**