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