@camstack/addon-provider-onvif 1.1.29 → 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
@@ -7084,6 +7084,17 @@ var ModelCatalogEntrySchema = object({
7084
7084
  "imagenet",
7085
7085
  "none"
7086
7086
  ]).optional(),
7087
+ /**
7088
+ * The model already applies softmax IN-GRAPH — its raw output is a
7089
+ * probability distribution, not logits. When set, the `softmax`
7090
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7091
+ * probability vector collapses it toward uniform (top-1 score craters far
7092
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7093
+ * the output is raw logits and the postprocessor applies softmax (the normal
7094
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7095
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7096
+ */
7097
+ outputProbabilities: boolean().optional(),
7087
7098
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7088
7099
  /**
7089
7100
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7643,6 +7654,160 @@ var EncodeProfileSchema = object({
7643
7654
  */
7644
7655
  outputArgs: array(string()).optional()
7645
7656
  });
7657
+ var COCO_TO_MACRO = {
7658
+ mapping: {
7659
+ person: "person",
7660
+ bicycle: "vehicle",
7661
+ car: "vehicle",
7662
+ motorcycle: "vehicle",
7663
+ airplane: "vehicle",
7664
+ bus: "vehicle",
7665
+ train: "vehicle",
7666
+ truck: "vehicle",
7667
+ boat: "vehicle",
7668
+ bird: "animal",
7669
+ cat: "animal",
7670
+ dog: "animal",
7671
+ horse: "animal",
7672
+ sheep: "animal",
7673
+ cow: "animal",
7674
+ elephant: "animal",
7675
+ bear: "animal",
7676
+ zebra: "animal",
7677
+ giraffe: "animal",
7678
+ suitcase: "package",
7679
+ backpack: "package",
7680
+ handbag: "package"
7681
+ },
7682
+ preserveOriginal: false
7683
+ };
7684
+ var AUDIO_MACRO_LABELS = [
7685
+ {
7686
+ id: "speech",
7687
+ name: "Speech",
7688
+ icon: "🗣️"
7689
+ },
7690
+ {
7691
+ id: "scream",
7692
+ name: "Scream / Shout",
7693
+ icon: "😱"
7694
+ },
7695
+ {
7696
+ id: "crying",
7697
+ name: "Crying / Baby",
7698
+ icon: "😢"
7699
+ },
7700
+ {
7701
+ id: "laughter",
7702
+ name: "Laughter",
7703
+ icon: "😂"
7704
+ },
7705
+ {
7706
+ id: "music",
7707
+ name: "Music",
7708
+ icon: "🎵"
7709
+ },
7710
+ {
7711
+ id: "dog",
7712
+ name: "Dog",
7713
+ icon: "🐕"
7714
+ },
7715
+ {
7716
+ id: "cat",
7717
+ name: "Cat",
7718
+ icon: "🐈"
7719
+ },
7720
+ {
7721
+ id: "bird",
7722
+ name: "Bird",
7723
+ icon: "🐦"
7724
+ },
7725
+ {
7726
+ id: "animal",
7727
+ name: "Animal (other)",
7728
+ icon: "🐾"
7729
+ },
7730
+ {
7731
+ id: "alarm",
7732
+ name: "Alarm / Siren",
7733
+ icon: "🚨"
7734
+ },
7735
+ {
7736
+ id: "doorbell",
7737
+ name: "Doorbell / Knock",
7738
+ icon: "🔔"
7739
+ },
7740
+ {
7741
+ id: "glass_breaking",
7742
+ name: "Glass Breaking",
7743
+ icon: "💥"
7744
+ },
7745
+ {
7746
+ id: "gunshot",
7747
+ name: "Gunshot / Explosion",
7748
+ icon: "💣"
7749
+ },
7750
+ {
7751
+ id: "vehicle",
7752
+ name: "Vehicle",
7753
+ icon: "🚗"
7754
+ },
7755
+ {
7756
+ id: "siren",
7757
+ name: "Emergency Siren",
7758
+ icon: "🚑"
7759
+ },
7760
+ {
7761
+ id: "fire",
7762
+ name: "Fire / Smoke",
7763
+ icon: "🔥"
7764
+ },
7765
+ {
7766
+ id: "water",
7767
+ name: "Water",
7768
+ icon: "💧"
7769
+ },
7770
+ {
7771
+ id: "wind",
7772
+ name: "Wind / Weather",
7773
+ icon: "🌬️"
7774
+ },
7775
+ {
7776
+ id: "door",
7777
+ name: "Door",
7778
+ icon: "🚪"
7779
+ },
7780
+ {
7781
+ id: "footsteps",
7782
+ name: "Footsteps",
7783
+ icon: "👣"
7784
+ },
7785
+ {
7786
+ id: "crowd",
7787
+ name: "Crowd / Chatter",
7788
+ icon: "👥"
7789
+ },
7790
+ {
7791
+ id: "telephone",
7792
+ name: "Telephone",
7793
+ icon: "📞"
7794
+ },
7795
+ {
7796
+ id: "engine",
7797
+ name: "Engine / Motor",
7798
+ icon: "⚙️"
7799
+ },
7800
+ {
7801
+ id: "tools",
7802
+ name: "Tools / Construction",
7803
+ icon: "🔨"
7804
+ },
7805
+ {
7806
+ id: "silence",
7807
+ name: "Silence",
7808
+ icon: "🤫"
7809
+ }
7810
+ ];
7646
7811
  var YAMNET_TO_MACRO = {
7647
7812
  mapping: {
7648
7813
  Speech: "speech",
@@ -7909,6 +8074,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7909
8074
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7910
8075
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7911
8076
  /**
8077
+ * Unified event-kind taxonomy — THE single source of truth for
8078
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8079
+ * icon }`.
8080
+ *
8081
+ * This dictionary folds together what used to be scattered across four
8082
+ * copies:
8083
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8084
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8085
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8086
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8087
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8088
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8089
+ *
8090
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8091
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8092
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8093
+ * color or an icon: they read this dictionary (server descriptors carry the
8094
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8095
+ *
8096
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8097
+ */
8098
+ var TAXONOMY_COLORS = {
8099
+ motion: "#f59e0b",
8100
+ audio: "#06b6d4",
8101
+ person: "#22c55e",
8102
+ vehicle: "#3b82f6",
8103
+ animal: "#f97316",
8104
+ package: "#a855f7",
8105
+ sensor: "#8b5cf6",
8106
+ control: "#10b981",
8107
+ genericDetection: "#64748b"
8108
+ };
8109
+ var DETECTION_SUB_COLORS = {
8110
+ car: "#f59e0b",
8111
+ truck: "#d97706",
8112
+ bus: "#b45309",
8113
+ motorcycle: "#eab308",
8114
+ bicycle: "#ca8a04",
8115
+ airplane: "#60a5fa",
8116
+ boat: "#2563eb",
8117
+ train: "#1d4ed8",
8118
+ bird: "#14b8a6",
8119
+ dog: "#84cc16",
8120
+ cat: "#f97316",
8121
+ horse: "#a16207",
8122
+ sheep: "#a3a3a3",
8123
+ cow: "#78716c",
8124
+ elephant: "#6b7280",
8125
+ bear: "#7c2d12",
8126
+ zebra: "#404040",
8127
+ giraffe: "#d4a373"
8128
+ };
8129
+ function titleCase(id) {
8130
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8131
+ }
8132
+ var entries = /* @__PURE__ */ new Map();
8133
+ function macro(kind, category, color, iconId, label) {
8134
+ entries.set(kind, {
8135
+ kind,
8136
+ parentKind: null,
8137
+ level: "macro",
8138
+ category,
8139
+ color,
8140
+ iconId,
8141
+ labelKey: `eventKind.${kind}`,
8142
+ label
8143
+ });
8144
+ }
8145
+ function sub(kind, parentKind, category, color, iconId, label) {
8146
+ entries.set(kind, {
8147
+ kind,
8148
+ parentKind,
8149
+ level: "sub",
8150
+ category,
8151
+ color,
8152
+ iconId,
8153
+ labelKey: `eventKind.${kind}`,
8154
+ label
8155
+ });
8156
+ }
8157
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8158
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8159
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8160
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8161
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8162
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8163
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8164
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8165
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8166
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8167
+ if (entries.has(cocoClass)) continue;
8168
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8169
+ }
8170
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8171
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8172
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8173
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8174
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8175
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8176
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8177
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8178
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8179
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8180
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8181
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8182
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8183
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8184
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8185
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8186
+ sub("button", "control", "control", "#10b981", "button", "Button");
8187
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8188
+ for (const l of AUDIO_MACRO_LABELS) {
8189
+ const kind = `audio-${l.id}`;
8190
+ if (entries.has(kind)) continue;
8191
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8192
+ }
8193
+ /** The complete taxonomy dictionary, keyed by kind. */
8194
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8195
+ /**
7912
8196
  * Error types for the safe expression engine. Two distinct classes so callers
7913
8197
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7914
8198
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10994,10 +11278,7 @@ var ConfigUISchemaNullableBridge = custom();
10994
11278
  var InferenceCapabilitiesBridge = custom();
10995
11279
  var ModelAvailabilityListBridge = custom();
10996
11280
  var PipelineRunResultBridge = custom();
10997
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10998
- kind: "mutation",
10999
- auth: "admin"
11000
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11281
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11001
11282
  modelId: string(),
11002
11283
  settings: record(string(), unknown()).readonly()
11003
11284
  }))), method(object({ steps: record(string(), object({
@@ -11057,13 +11338,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11057
11338
  * (inputClasses ≠ null) are skipped and served per-track via
11058
11339
  * pipelineRunner.runDetailSubtree (two-plane design).
11059
11340
  */
11060
- plane: _enum(["full", "frame"]).optional()
11341
+ plane: _enum(["full", "frame"]).optional(),
11342
+ /**
11343
+ * Inference-device selector (Phase 2 multi-device). Format
11344
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11345
+ * Omitted ⇒ the runner's default device (current single-engine
11346
+ * behaviour). Selects WHICH device pool of the node runs the call.
11347
+ */
11348
+ deviceKey: string().optional()
11061
11349
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
11062
11350
  engine: PipelineEngineChoiceSchema.optional(),
11063
11351
  steps: array(PipelineStepInputSchema).min(1),
11064
11352
  frames: array(FrameInputSchema).min(1).max(255),
11065
11353
  deviceId: number().optional(),
11066
- sessionId: string().optional()
11354
+ sessionId: string().optional(),
11355
+ /**
11356
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11357
+ * the batch to the Python pool's bench preprocess cache
11358
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11359
+ * preprocessed ONCE and every later inference is a pure-inference cache
11360
+ * hit — the sustained-throughput run measures inference, not
11361
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11362
+ * full preprocess every call, correct). Fresh per sustained run;
11363
+ * released via `uncacheFrame`.
11364
+ */
11365
+ frameId: number().int().nonnegative().optional(),
11366
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11367
+ deviceKey: string().optional()
11067
11368
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
11068
11369
  data: _instanceof(Uint8Array),
11069
11370
  width: number().int().positive(),
@@ -11095,8 +11396,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11095
11396
  * - `runtime` — main camera-serving engine (no idle TTL).
11096
11397
  * - `warm-override` — benchmark/test override held in the warm
11097
11398
  * cache; auto-disposed after the idle TTL.
11399
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11400
+ * multi-device, keyed by `deviceKey`) resolved
11401
+ * via `resolveDeviceFactory`. Runs alongside the
11402
+ * `runtime` engine on a DIFFERENT accelerator
11403
+ * (NPU / iGPU / Coral) — this is how the
11404
+ * Engines tab shows all pools running at once.
11098
11405
  */
11099
- kind: _enum(["runtime", "warm-override"]),
11406
+ kind: _enum([
11407
+ "runtime",
11408
+ "warm-override",
11409
+ "device-pool"
11410
+ ]),
11100
11411
  /** Native pid of the underlying Python pool (null when no pool). */
11101
11412
  poolPid: number().nullable(),
11102
11413
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11438,7 +11749,14 @@ var RunnerCameraConfigSchema = object({
11438
11749
  * camera's detect node differs from its source-owner (P2d, gated by the
11439
11750
  * `remoteSourcingNodes` rollout setting).
11440
11751
  */
11441
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11752
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11753
+ /**
11754
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11755
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11756
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11757
+ * this only selects WHICH device pool of that node runs the session.
11758
+ */
11759
+ deviceKey: string().optional()
11442
11760
  });
11443
11761
  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;
11444
11762
  /**
@@ -11459,6 +11777,19 @@ var RunnerLocalLoadSchema = object({
11459
11777
  avgInferenceTimeMs: number(),
11460
11778
  /** Total queue depth across motion + detection queues. */
11461
11779
  queueDepthTotal: number(),
11780
+ /**
11781
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11782
+ * this runner currently has attached cameras on, so the orchestrator's second
11783
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11784
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11785
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11786
+ */
11787
+ devices: array(object({
11788
+ deviceKey: string(),
11789
+ backend: string(),
11790
+ attachedCameras: number(),
11791
+ queueDepthTotal: number()
11792
+ })).default([]),
11462
11793
  /** Hardware capability flags reported by this node. */
11463
11794
  hardware: object({
11464
11795
  hasGpu: boolean(),
@@ -13228,6 +13559,8 @@ var BaseDeviceProvider = class extends BaseAddon {
13228
13559
  return toDeviceSummary(device, this.addonId);
13229
13560
  }
13230
13561
  };
13562
+ 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;
13563
+ new Set(Object.values(DeviceType));
13231
13564
  /**
13232
13565
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
13233
13566
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -16322,17 +16655,30 @@ var EventKindCategorySchema = _enum([
16322
16655
  "audio",
16323
16656
  "detection",
16324
16657
  "sensor",
16658
+ "control",
16325
16659
  "custom",
16326
16660
  "package"
16327
16661
  ]);
16662
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16663
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16328
16664
  var EventKindDescriptorSchema = object({
16329
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16665
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16330
16666
  kind: string(),
16667
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16668
+ labelKey: string(),
16669
+ /** English fallback label (kept for clients that don't translate). */
16331
16670
  label: string(),
16332
16671
  /** Hex color for timeline/legend rendering. */
16333
16672
  color: string(),
16673
+ /** Dictionary id → lucide component on the UI side. */
16674
+ iconId: string(),
16675
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16334
16676
  icon: EventKindIconSchema,
16335
16677
  category: EventKindCategorySchema,
16678
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16679
+ parentKind: string().nullable(),
16680
+ /** Derived from `parentKind`, explicit for the client tree. */
16681
+ level: EventKindLevelSchema,
16336
16682
  /** Which cap + device contributes this kind. For built-ins the camera
16337
16683
  * itself; for sensor kinds the LINKED source device. */
16338
16684
  source: object({
@@ -16405,11 +16751,21 @@ var TrackAudioLabelSchema = object({
16405
16751
  firstAt: number(),
16406
16752
  lastAt: number()
16407
16753
  });
16754
+ /**
16755
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16756
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16757
+ * linked sensor/control state change (no positions; carries a snapshot). The
16758
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16759
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16760
+ */
16761
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16408
16762
  var TrackSchema = object({
16409
16763
  trackId: string(),
16410
16764
  deviceId: number(),
16411
16765
  className: string(),
16412
16766
  label: string().optional(),
16767
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16768
+ source: TrackSourceSchema.optional(),
16413
16769
  firstSeen: number(),
16414
16770
  lastSeen: number(),
16415
16771
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16786,6 +17142,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16786
17142
  eventId: string(),
16787
17143
  timestamp: number()
16788
17144
  });
17145
+ /**
17146
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
17147
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
17148
+ * caps into per-camera event-kind descriptors.
17149
+ *
17150
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
17151
+ * is NOT duplicated here — every entry is derived from the single
17152
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
17153
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
17154
+ * control cap means adding one line here (and a taxonomy entry); the anti-
17155
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
17156
+ * eventful cap is missing.
17157
+ */
17158
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
17159
+ var LEGACY_ICON = {
17160
+ motion: "motion",
17161
+ audio: "audio",
17162
+ person: "person",
17163
+ vehicle: "vehicle",
17164
+ animal: "animal",
17165
+ package: "package",
17166
+ door: "door",
17167
+ pir: "pir",
17168
+ smoke: "smoke",
17169
+ water: "water",
17170
+ button: "button",
17171
+ generic: "generic",
17172
+ gas: "smoke",
17173
+ vibration: "generic",
17174
+ tamper: "generic",
17175
+ presence: "person",
17176
+ lock: "generic",
17177
+ siren: "generic",
17178
+ switch: "generic",
17179
+ doorbell: "button"
17180
+ };
17181
+ function legacyIcon(iconId) {
17182
+ return LEGACY_ICON[iconId] ?? "generic";
17183
+ }
17184
+ /**
17185
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
17186
+ * The anti-drift guard cross-checks this against the eventful caps declared
17187
+ * in `packages/types/src/capabilities/*.cap.ts`.
17188
+ */
17189
+ var CAP_TO_KIND = {
17190
+ contact: "contact",
17191
+ motion: "motion-sensor",
17192
+ smoke: "smoke",
17193
+ flood: "flood",
17194
+ gas: "gas",
17195
+ "carbon-monoxide": "carbon-monoxide",
17196
+ vibration: "vibration",
17197
+ tamper: "tamper",
17198
+ presence: "presence",
17199
+ "enum-sensor": "enum-sensor",
17200
+ "event-emitter": "device-event",
17201
+ "lock-control": "lock",
17202
+ switch: "switch",
17203
+ button: "button",
17204
+ doorbell: "doorbell"
17205
+ };
17206
+ function buildDescriptor(capName, kind) {
17207
+ const t = EVENT_TAXONOMY[kind];
17208
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
17209
+ return {
17210
+ ...t,
17211
+ icon: legacyIcon(t.iconId)
17212
+ };
17213
+ }
17214
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16789
17215
  var CameraPipelineConfigSchema = object({
16790
17216
  engine: PipelineEngineChoiceSchema.optional(),
16791
17217
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16804,13 +17230,11 @@ var PipelineTemplateSchema = object({
16804
17230
  createdAt: string(),
16805
17231
  updatedAt: string()
16806
17232
  });
16807
- var AgentAddonConfigSchema = object({
16808
- enabled: boolean(),
17233
+ var DeviceStepConfigSchema = object({
16809
17234
  modelId: string().optional(),
16810
- settings: record(string(), unknown()).readonly()
17235
+ settings: record(string(), unknown()).optional()
16811
17236
  });
16812
17237
  var AgentPipelineSettingsSchema = object({
16813
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16814
17238
  maxCameras: number().int().nonnegative().nullable().default(null),
16815
17239
  /** Per-node detection weight (relative share for the quota balancer). */
16816
17240
  detectWeight: number().positive().optional(),
@@ -16834,7 +17258,22 @@ var AgentPipelineSettingsSchema = object({
16834
17258
  * it already uses to reach the hub). Set this only when the auto-detected
16835
17259
  * address is wrong (multi-homed host, NAT, custom interface).
16836
17260
  */
16837
- reachableHost: string().optional()
17261
+ reachableHost: string().optional(),
17262
+ /**
17263
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
17264
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
17265
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
17266
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
17267
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
17268
+ * the default model/settings for every camera landing on that accelerator;
17269
+ * a stepId absent ⇒ the step uses that device's format default.
17270
+ */
17271
+ inferenceDevices: record(string(), object({
17272
+ enabled: boolean(),
17273
+ weight: number().positive().optional(),
17274
+ maxSessions: number().int().positive().optional(),
17275
+ steps: record(string(), DeviceStepConfigSchema).optional()
17276
+ })).optional()
16838
17277
  });
16839
17278
  var CameraPipelineForAgentSchema = object({
16840
17279
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16844,14 +17283,13 @@ var CameraPipelineForAgentSchema = object({
16844
17283
  }).nullable()
16845
17284
  });
16846
17285
  var CameraStepOverridePatchSchema = object({
16847
- enabled: boolean().optional(),
16848
17286
  modelId: string().optional(),
16849
17287
  settings: record(string(), unknown()).readonly().optional()
16850
17288
  });
16851
17289
  var CameraPipelineSettingsSchema = object({
16852
17290
  pinnedAgentNodeId: string().optional(),
16853
17291
  stepToggles: record(string(), boolean()).optional(),
16854
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
17292
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16855
17293
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16856
17294
  });
16857
17295
  /**
@@ -17065,6 +17503,44 @@ var CameraStatusSchema = object({
17065
17503
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
17066
17504
  fetchedAt: number()
17067
17505
  });
17506
+ var NodeInferenceDeviceSchema = object({
17507
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17508
+ key: string(),
17509
+ backend: string(),
17510
+ device: string(),
17511
+ format: _enum(MODEL_FORMATS),
17512
+ /** Whether the node's live probe reports the device as usable right now. */
17513
+ available: boolean(),
17514
+ /**
17515
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17516
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17517
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17518
+ * not a balanced target). An explicit stored value always wins; a stored-only
17519
+ * (unavailable) key keeps its stored value.
17520
+ */
17521
+ enabled: boolean(),
17522
+ /** Relative balancer weight for the enabled device (default 1). */
17523
+ weight: number(),
17524
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17525
+ maxSessions: number().nullable(),
17526
+ /** Object-detection model the executor defaults to for this deviceKey. */
17527
+ defaultModelId: string(),
17528
+ /**
17529
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17530
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17531
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17532
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17533
+ * available per format; this is the stored selection that becomes the
17534
+ * default for EVERY camera landing on this accelerator.
17535
+ */
17536
+ steps: record(string(), DeviceStepConfigSchema).optional()
17537
+ });
17538
+ var NodeInferenceDevicesSchema = object({
17539
+ nodeId: string(),
17540
+ /** False when the node's platform-probe was unreachable (no live device set). */
17541
+ reachable: boolean(),
17542
+ devices: array(NodeInferenceDeviceSchema).readonly()
17543
+ });
17068
17544
  method(object({
17069
17545
  deviceId: number(),
17070
17546
  agentNodeId: string()
@@ -17074,7 +17550,13 @@ method(object({
17074
17550
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
17075
17551
  kind: "mutation",
17076
17552
  auth: "admin"
17077
- }), method(_void(), object({ migrated: number() }), {
17553
+ }), method(object({
17554
+ deviceId: number(),
17555
+ deviceKey: string()
17556
+ }), object({ success: literal(true) }), {
17557
+ kind: "mutation",
17558
+ auth: "admin"
17559
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
17078
17560
  kind: "mutation",
17079
17561
  auth: "admin"
17080
17562
  }), 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({
@@ -17108,13 +17590,7 @@ method(object({
17108
17590
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
17109
17591
  nodeId: string(),
17110
17592
  settings: AgentPipelineSettingsSchema
17111
- })).readonly()), method(object({
17112
- agentNodeId: string(),
17113
- defaults: record(string(), AgentAddonConfigSchema)
17114
- }), object({ success: literal(true) }), {
17115
- kind: "mutation",
17116
- auth: "admin"
17117
- }), method(object({ agentNodeId: string() }), object({
17593
+ })).readonly()), method(object({ agentNodeId: string() }), object({
17118
17594
  success: boolean(),
17119
17595
  removed: boolean()
17120
17596
  }), {
@@ -17146,7 +17622,18 @@ method(object({
17146
17622
  }), object({ success: literal(true) }), {
17147
17623
  kind: "mutation",
17148
17624
  auth: "admin"
17149
- }), method(object({ agentNodeId: string() }), object({
17625
+ }), method(object({
17626
+ agentNodeId: string(),
17627
+ inferenceDevices: record(string(), object({
17628
+ enabled: boolean(),
17629
+ weight: number().positive().optional(),
17630
+ maxSessions: number().int().positive().optional(),
17631
+ steps: record(string(), DeviceStepConfigSchema).optional()
17632
+ }))
17633
+ }), object({ success: literal(true) }), {
17634
+ kind: "mutation",
17635
+ auth: "admin"
17636
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
17150
17637
  success: literal(true),
17151
17638
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
17152
17639
  effectiveModelId: string().nullable(),
@@ -17162,9 +17649,10 @@ method(object({
17162
17649
  }), object({ success: literal(true) }), {
17163
17650
  kind: "mutation",
17164
17651
  auth: "admin"
17165
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17652
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
17166
17653
  deviceId: number(),
17167
17654
  agentNodeId: string(),
17655
+ deviceKey: string(),
17168
17656
  addonId: string(),
17169
17657
  patch: CameraStepOverridePatchSchema.nullable()
17170
17658
  }), object({ success: literal(true) }), {
@@ -17201,14 +17689,13 @@ method(object({
17201
17689
  });
17202
17690
  /**
17203
17691
  * server-management — per-NODE singleton capability for a node's ROOT
17204
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
17205
- * agents).
17692
+ * package lifecycle (runtime-updatable node packages).
17206
17693
  *
17207
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
17208
- * on agents) carries the whole software stack in its npm dep tree, so ONE
17209
- * version describes the node. Updates install into
17210
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
17211
- * starter (probation boot + auto-rollback to N-1).
17694
+ * Every node role runs the SAME root package (`@camstack/server`), which
17695
+ * carries the whole software stack in its npm dep tree, so ONE version
17696
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17697
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17698
+ * no auto-rollback).
17212
17699
  *
17213
17700
  * Providers:
17214
17701
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -17316,7 +17803,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
17316
17803
  /** Explicit target version; omitted = latest from the registry. */
17317
17804
  version: string().optional() }), ServerUpdateActionResultSchema, {
17318
17805
  kind: "mutation",
17319
- auth: "admin"
17806
+ auth: "admin",
17807
+ timeoutMs: 16 * 6e4
17320
17808
  }), method(_void(), ServerUpdateActionResultSchema, {
17321
17809
  kind: "mutation",
17322
17810
  auth: "admin"
@@ -18411,22 +18899,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
18411
18899
  var RestartAddonResultSchema = unknown();
18412
18900
  var InstallPackageResultSchema = unknown();
18413
18901
  var ReloadPackagesResultSchema = unknown();
18414
- /**
18415
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
18416
- * server restarts so the admin UI can react to the `restartingAt`
18417
- * timestamp (shows reconnect overlay). The transition from
18418
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
18419
- * `system.restart-completed` event after the new process boots.
18420
- *
18421
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
18422
- */
18423
- var UpdateFrameworkPackageResultSchema = object({
18424
- packageName: string(),
18425
- fromVersion: string(),
18426
- toVersion: string(),
18427
- /** Ms-epoch the server scheduled its self-restart. */
18428
- restartingAt: number()
18429
- });
18430
18902
  var BulkUpdateItemStatusSchema = _enum([
18431
18903
  "queued",
18432
18904
  "updating",
@@ -18554,13 +19026,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18554
19026
  }), object({ success: literal(true) }), {
18555
19027
  kind: "mutation",
18556
19028
  auth: "admin"
18557
- }), method(object({
18558
- packageName: string().min(1),
18559
- version: string().optional(),
18560
- deferRestart: boolean().optional()
18561
- }), UpdateFrameworkPackageResultSchema, {
18562
- kind: "mutation",
18563
- auth: "admin"
18564
19029
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18565
19030
  kind: "mutation",
18566
19031
  auth: "admin"
@@ -19426,10 +19891,10 @@ var TopologyCategorySchema = object({
19426
19891
  addons: array(TopologyCategoryAddonSchema).readonly()
19427
19892
  });
19428
19893
  /**
19429
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
19430
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
19431
- * version visibility for the Server management surface. Nullable: offline
19432
- * rows and pre-phase-2 nodes report none.
19894
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19895
+ * root package for every node role) as reported by its `registerNode`
19896
+ * manifest — version visibility for the Server management surface. Nullable:
19897
+ * offline rows and nodes that never reported one.
19433
19898
  */
19434
19899
  var TopologyRootPackageSchema = object({
19435
19900
  name: string(),
@@ -19817,17 +20282,28 @@ var PlatformScoreSchema = object({
19817
20282
  format: _enum([
19818
20283
  "onnx",
19819
20284
  "coreml",
19820
- "openvino"
20285
+ "openvino",
20286
+ "tflite"
19821
20287
  ]),
19822
20288
  score: number(),
19823
20289
  reason: string(),
19824
20290
  available: boolean()
19825
20291
  });
20292
+ var InferenceDeviceDescriptorSchema = object({
20293
+ key: string(),
20294
+ backend: string(),
20295
+ device: string(),
20296
+ format: ModelFormatSchema,
20297
+ runtime: literal("python"),
20298
+ score: number(),
20299
+ available: boolean()
20300
+ });
19826
20301
  var PlatformCapabilitiesSchema = object({
19827
20302
  hardware: HardwareInfoSchema,
19828
20303
  scores: array(PlatformScoreSchema).readonly(),
19829
20304
  bestScore: PlatformScoreSchema,
19830
- pythonPath: string().nullable()
20305
+ pythonPath: string().nullable(),
20306
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19831
20307
  });
19832
20308
  var ModelRequirementSchema = object({
19833
20309
  modelId: string(),
@@ -20748,12 +21224,6 @@ Object.freeze({
20748
21224
  addonId: null,
20749
21225
  access: "delete"
20750
21226
  },
20751
- "addons.updateFrameworkPackage": {
20752
- capName: "addons",
20753
- capScope: "system",
20754
- addonId: null,
20755
- access: "create"
20756
- },
20757
21227
  "addons.updatePackage": {
20758
21228
  capName: "addons",
20759
21229
  capScope: "system",
@@ -23526,12 +23996,6 @@ Object.freeze({
23526
23996
  addonId: null,
23527
23997
  access: "view"
23528
23998
  },
23529
- "pipelineExecutor.reprobeEngine": {
23530
- capName: "pipeline-executor",
23531
- capScope: "system",
23532
- addonId: null,
23533
- access: "create"
23534
- },
23535
23999
  "pipelineExecutor.runAudioTest": {
23536
24000
  capName: "pipeline-executor",
23537
24001
  capScope: "system",
@@ -23682,6 +24146,12 @@ Object.freeze({
23682
24146
  addonId: null,
23683
24147
  access: "view"
23684
24148
  },
24149
+ "pipelineOrchestrator.getNodeInferenceDevices": {
24150
+ capName: "pipeline-orchestrator",
24151
+ capScope: "system",
24152
+ addonId: null,
24153
+ access: "view"
24154
+ },
23685
24155
  "pipelineOrchestrator.getPipelineAssignment": {
23686
24156
  capName: "pipeline-orchestrator",
23687
24157
  capScope: "system",
@@ -23694,6 +24164,12 @@ Object.freeze({
23694
24164
  addonId: null,
23695
24165
  access: "view"
23696
24166
  },
24167
+ "pipelineOrchestrator.getPipelineDevicePin": {
24168
+ capName: "pipeline-orchestrator",
24169
+ capScope: "system",
24170
+ addonId: null,
24171
+ access: "view"
24172
+ },
23697
24173
  "pipelineOrchestrator.listAgentSettings": {
23698
24174
  capName: "pipeline-orchestrator",
23699
24175
  capScope: "system",
@@ -23736,19 +24212,19 @@ Object.freeze({
23736
24212
  addonId: null,
23737
24213
  access: "create"
23738
24214
  },
23739
- "pipelineOrchestrator.setAgentAddonDefaults": {
24215
+ "pipelineOrchestrator.setAgentCapabilities": {
23740
24216
  capName: "pipeline-orchestrator",
23741
24217
  capScope: "system",
23742
24218
  addonId: null,
23743
24219
  access: "create"
23744
24220
  },
23745
- "pipelineOrchestrator.setAgentCapabilities": {
24221
+ "pipelineOrchestrator.setAgentDetectWeight": {
23746
24222
  capName: "pipeline-orchestrator",
23747
24223
  capScope: "system",
23748
24224
  addonId: null,
23749
24225
  access: "create"
23750
24226
  },
23751
- "pipelineOrchestrator.setAgentDetectWeight": {
24227
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23752
24228
  capName: "pipeline-orchestrator",
23753
24229
  capScope: "system",
23754
24230
  addonId: null,
@@ -23790,6 +24266,12 @@ Object.freeze({
23790
24266
  addonId: null,
23791
24267
  access: "create"
23792
24268
  },
24269
+ "pipelineOrchestrator.setPipelineDevicePin": {
24270
+ capName: "pipeline-orchestrator",
24271
+ capScope: "system",
24272
+ addonId: null,
24273
+ access: "create"
24274
+ },
23793
24275
  "pipelineOrchestrator.unassignAudio": {
23794
24276
  capName: "pipeline-orchestrator",
23795
24277
  capScope: "system",
@@ -25342,32 +25824,6 @@ Object.freeze({
25342
25824
  "network-access": "ingress",
25343
25825
  "smtp-provider": "email"
25344
25826
  });
25345
- var frameworkSwapPackageSchema = object({
25346
- name: string(),
25347
- stagedPath: string(),
25348
- backupPath: string(),
25349
- toVersion: string(),
25350
- fromVersion: string().nullable()
25351
- });
25352
- object({
25353
- jobId: string(),
25354
- taskId: string(),
25355
- packages: array(frameworkSwapPackageSchema),
25356
- requestedAtMs: number(),
25357
- schemaVersion: literal(1)
25358
- });
25359
- object({
25360
- jobId: string(),
25361
- taskId: string(),
25362
- backups: array(object({
25363
- name: string(),
25364
- backupPath: string(),
25365
- livePath: string()
25366
- })),
25367
- appliedAtMs: number(),
25368
- bootAttempts: number(),
25369
- schemaVersion: literal(1)
25370
- });
25371
25827
  //#endregion
25372
25828
  //#region src/onvif-camera.ts
25373
25829
  var onvifCameraSchema = object({