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