@camstack/addon-provider-dreo 0.1.22 → 0.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 +561 -105
  2. package/dist/addon.mjs +561 -105
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7120,6 +7120,17 @@ var ModelCatalogEntrySchema = object({
7120
7120
  "imagenet",
7121
7121
  "none"
7122
7122
  ]).optional(),
7123
+ /**
7124
+ * The model already applies softmax IN-GRAPH — its raw output is a
7125
+ * probability distribution, not logits. When set, the `softmax`
7126
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7127
+ * probability vector collapses it toward uniform (top-1 score craters far
7128
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7129
+ * the output is raw logits and the postprocessor applies softmax (the normal
7130
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7131
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7132
+ */
7133
+ outputProbabilities: boolean().optional(),
7123
7134
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7124
7135
  /**
7125
7136
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7679,6 +7690,160 @@ var EncodeProfileSchema = object({
7679
7690
  */
7680
7691
  outputArgs: array(string()).optional()
7681
7692
  });
7693
+ var COCO_TO_MACRO = {
7694
+ mapping: {
7695
+ person: "person",
7696
+ bicycle: "vehicle",
7697
+ car: "vehicle",
7698
+ motorcycle: "vehicle",
7699
+ airplane: "vehicle",
7700
+ bus: "vehicle",
7701
+ train: "vehicle",
7702
+ truck: "vehicle",
7703
+ boat: "vehicle",
7704
+ bird: "animal",
7705
+ cat: "animal",
7706
+ dog: "animal",
7707
+ horse: "animal",
7708
+ sheep: "animal",
7709
+ cow: "animal",
7710
+ elephant: "animal",
7711
+ bear: "animal",
7712
+ zebra: "animal",
7713
+ giraffe: "animal",
7714
+ suitcase: "package",
7715
+ backpack: "package",
7716
+ handbag: "package"
7717
+ },
7718
+ preserveOriginal: false
7719
+ };
7720
+ var AUDIO_MACRO_LABELS = [
7721
+ {
7722
+ id: "speech",
7723
+ name: "Speech",
7724
+ icon: "🗣️"
7725
+ },
7726
+ {
7727
+ id: "scream",
7728
+ name: "Scream / Shout",
7729
+ icon: "😱"
7730
+ },
7731
+ {
7732
+ id: "crying",
7733
+ name: "Crying / Baby",
7734
+ icon: "😢"
7735
+ },
7736
+ {
7737
+ id: "laughter",
7738
+ name: "Laughter",
7739
+ icon: "😂"
7740
+ },
7741
+ {
7742
+ id: "music",
7743
+ name: "Music",
7744
+ icon: "🎵"
7745
+ },
7746
+ {
7747
+ id: "dog",
7748
+ name: "Dog",
7749
+ icon: "🐕"
7750
+ },
7751
+ {
7752
+ id: "cat",
7753
+ name: "Cat",
7754
+ icon: "🐈"
7755
+ },
7756
+ {
7757
+ id: "bird",
7758
+ name: "Bird",
7759
+ icon: "🐦"
7760
+ },
7761
+ {
7762
+ id: "animal",
7763
+ name: "Animal (other)",
7764
+ icon: "🐾"
7765
+ },
7766
+ {
7767
+ id: "alarm",
7768
+ name: "Alarm / Siren",
7769
+ icon: "🚨"
7770
+ },
7771
+ {
7772
+ id: "doorbell",
7773
+ name: "Doorbell / Knock",
7774
+ icon: "🔔"
7775
+ },
7776
+ {
7777
+ id: "glass_breaking",
7778
+ name: "Glass Breaking",
7779
+ icon: "💥"
7780
+ },
7781
+ {
7782
+ id: "gunshot",
7783
+ name: "Gunshot / Explosion",
7784
+ icon: "💣"
7785
+ },
7786
+ {
7787
+ id: "vehicle",
7788
+ name: "Vehicle",
7789
+ icon: "🚗"
7790
+ },
7791
+ {
7792
+ id: "siren",
7793
+ name: "Emergency Siren",
7794
+ icon: "🚑"
7795
+ },
7796
+ {
7797
+ id: "fire",
7798
+ name: "Fire / Smoke",
7799
+ icon: "🔥"
7800
+ },
7801
+ {
7802
+ id: "water",
7803
+ name: "Water",
7804
+ icon: "💧"
7805
+ },
7806
+ {
7807
+ id: "wind",
7808
+ name: "Wind / Weather",
7809
+ icon: "🌬️"
7810
+ },
7811
+ {
7812
+ id: "door",
7813
+ name: "Door",
7814
+ icon: "🚪"
7815
+ },
7816
+ {
7817
+ id: "footsteps",
7818
+ name: "Footsteps",
7819
+ icon: "👣"
7820
+ },
7821
+ {
7822
+ id: "crowd",
7823
+ name: "Crowd / Chatter",
7824
+ icon: "👥"
7825
+ },
7826
+ {
7827
+ id: "telephone",
7828
+ name: "Telephone",
7829
+ icon: "📞"
7830
+ },
7831
+ {
7832
+ id: "engine",
7833
+ name: "Engine / Motor",
7834
+ icon: "⚙️"
7835
+ },
7836
+ {
7837
+ id: "tools",
7838
+ name: "Tools / Construction",
7839
+ icon: "🔨"
7840
+ },
7841
+ {
7842
+ id: "silence",
7843
+ name: "Silence",
7844
+ icon: "🤫"
7845
+ }
7846
+ ];
7682
7847
  var YAMNET_TO_MACRO = {
7683
7848
  mapping: {
7684
7849
  Speech: "speech",
@@ -7945,6 +8110,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7945
8110
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7946
8111
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7947
8112
  /**
8113
+ * Unified event-kind taxonomy — THE single source of truth for
8114
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8115
+ * icon }`.
8116
+ *
8117
+ * This dictionary folds together what used to be scattered across four
8118
+ * copies:
8119
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8120
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8121
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8122
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8123
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8124
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8125
+ *
8126
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8127
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8128
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8129
+ * color or an icon: they read this dictionary (server descriptors carry the
8130
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8131
+ *
8132
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8133
+ */
8134
+ var TAXONOMY_COLORS = {
8135
+ motion: "#f59e0b",
8136
+ audio: "#06b6d4",
8137
+ person: "#22c55e",
8138
+ vehicle: "#3b82f6",
8139
+ animal: "#f97316",
8140
+ package: "#a855f7",
8141
+ sensor: "#8b5cf6",
8142
+ control: "#10b981",
8143
+ genericDetection: "#64748b"
8144
+ };
8145
+ var DETECTION_SUB_COLORS = {
8146
+ car: "#f59e0b",
8147
+ truck: "#d97706",
8148
+ bus: "#b45309",
8149
+ motorcycle: "#eab308",
8150
+ bicycle: "#ca8a04",
8151
+ airplane: "#60a5fa",
8152
+ boat: "#2563eb",
8153
+ train: "#1d4ed8",
8154
+ bird: "#14b8a6",
8155
+ dog: "#84cc16",
8156
+ cat: "#f97316",
8157
+ horse: "#a16207",
8158
+ sheep: "#a3a3a3",
8159
+ cow: "#78716c",
8160
+ elephant: "#6b7280",
8161
+ bear: "#7c2d12",
8162
+ zebra: "#404040",
8163
+ giraffe: "#d4a373"
8164
+ };
8165
+ function titleCase(id) {
8166
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8167
+ }
8168
+ var entries = /* @__PURE__ */ new Map();
8169
+ function macro(kind, category, color, iconId, label) {
8170
+ entries.set(kind, {
8171
+ kind,
8172
+ parentKind: null,
8173
+ level: "macro",
8174
+ category,
8175
+ color,
8176
+ iconId,
8177
+ labelKey: `eventKind.${kind}`,
8178
+ label
8179
+ });
8180
+ }
8181
+ function sub(kind, parentKind, category, color, iconId, label) {
8182
+ entries.set(kind, {
8183
+ kind,
8184
+ parentKind,
8185
+ level: "sub",
8186
+ category,
8187
+ color,
8188
+ iconId,
8189
+ labelKey: `eventKind.${kind}`,
8190
+ label
8191
+ });
8192
+ }
8193
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8194
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8195
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8196
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8197
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8198
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8199
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8200
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8201
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8202
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8203
+ if (entries.has(cocoClass)) continue;
8204
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8205
+ }
8206
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8207
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8208
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8209
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8210
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8211
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8212
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8213
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8214
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8215
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8216
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8217
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8218
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8219
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8220
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8221
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8222
+ sub("button", "control", "control", "#10b981", "button", "Button");
8223
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8224
+ for (const l of AUDIO_MACRO_LABELS) {
8225
+ const kind = `audio-${l.id}`;
8226
+ if (entries.has(kind)) continue;
8227
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8228
+ }
8229
+ /** The complete taxonomy dictionary, keyed by kind. */
8230
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8231
+ /**
7948
8232
  * Error types for the safe expression engine. Two distinct classes so callers
7949
8233
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7950
8234
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12137,10 +12421,7 @@ var ConfigUISchemaNullableBridge = custom();
12137
12421
  var InferenceCapabilitiesBridge = custom();
12138
12422
  var ModelAvailabilityListBridge = custom();
12139
12423
  var PipelineRunResultBridge = custom();
12140
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12141
- kind: "mutation",
12142
- auth: "admin"
12143
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12424
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12144
12425
  modelId: string(),
12145
12426
  settings: record(string(), unknown()).readonly()
12146
12427
  }))), method(object({ steps: record(string(), object({
@@ -12200,13 +12481,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12200
12481
  * (inputClasses ≠ null) are skipped and served per-track via
12201
12482
  * pipelineRunner.runDetailSubtree (two-plane design).
12202
12483
  */
12203
- plane: _enum(["full", "frame"]).optional()
12484
+ plane: _enum(["full", "frame"]).optional(),
12485
+ /**
12486
+ * Inference-device selector (Phase 2 multi-device). Format
12487
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12488
+ * Omitted ⇒ the runner's default device (current single-engine
12489
+ * behaviour). Selects WHICH device pool of the node runs the call.
12490
+ */
12491
+ deviceKey: string().optional()
12204
12492
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12205
12493
  engine: PipelineEngineChoiceSchema.optional(),
12206
12494
  steps: array(PipelineStepInputSchema).min(1),
12207
12495
  frames: array(FrameInputSchema).min(1).max(255),
12208
12496
  deviceId: number().optional(),
12209
- sessionId: string().optional()
12497
+ sessionId: string().optional(),
12498
+ /**
12499
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12500
+ * the batch to the Python pool's bench preprocess cache
12501
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12502
+ * preprocessed ONCE and every later inference is a pure-inference cache
12503
+ * hit — the sustained-throughput run measures inference, not
12504
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12505
+ * full preprocess every call, correct). Fresh per sustained run;
12506
+ * released via `uncacheFrame`.
12507
+ */
12508
+ frameId: number().int().nonnegative().optional(),
12509
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12510
+ deviceKey: string().optional()
12210
12511
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12211
12512
  data: _instanceof(Uint8Array),
12212
12513
  width: number().int().positive(),
@@ -12238,8 +12539,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12238
12539
  * - `runtime` — main camera-serving engine (no idle TTL).
12239
12540
  * - `warm-override` — benchmark/test override held in the warm
12240
12541
  * cache; auto-disposed after the idle TTL.
12542
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12543
+ * multi-device, keyed by `deviceKey`) resolved
12544
+ * via `resolveDeviceFactory`. Runs alongside the
12545
+ * `runtime` engine on a DIFFERENT accelerator
12546
+ * (NPU / iGPU / Coral) — this is how the
12547
+ * Engines tab shows all pools running at once.
12241
12548
  */
12242
- kind: _enum(["runtime", "warm-override"]),
12549
+ kind: _enum([
12550
+ "runtime",
12551
+ "warm-override",
12552
+ "device-pool"
12553
+ ]),
12243
12554
  /** Native pid of the underlying Python pool (null when no pool). */
12244
12555
  poolPid: number().nullable(),
12245
12556
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12614,7 +12925,14 @@ var RunnerCameraConfigSchema = object({
12614
12925
  * camera's detect node differs from its source-owner (P2d, gated by the
12615
12926
  * `remoteSourcingNodes` rollout setting).
12616
12927
  */
12617
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12928
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12929
+ /**
12930
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12931
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12932
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12933
+ * this only selects WHICH device pool of that node runs the session.
12934
+ */
12935
+ deviceKey: string().optional()
12618
12936
  });
12619
12937
  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;
12620
12938
  /**
@@ -12635,6 +12953,19 @@ var RunnerLocalLoadSchema = object({
12635
12953
  avgInferenceTimeMs: number(),
12636
12954
  /** Total queue depth across motion + detection queues. */
12637
12955
  queueDepthTotal: number(),
12956
+ /**
12957
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12958
+ * this runner currently has attached cameras on, so the orchestrator's second
12959
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12960
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12961
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12962
+ */
12963
+ devices: array(object({
12964
+ deviceKey: string(),
12965
+ backend: string(),
12966
+ attachedCameras: number(),
12967
+ queueDepthTotal: number()
12968
+ })).default([]),
12638
12969
  /** Hardware capability flags reported by this node. */
12639
12970
  hardware: object({
12640
12971
  hasGpu: boolean(),
@@ -15783,6 +16114,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15783
16114
  return toDeviceSummary(device, this.addonId);
15784
16115
  }
15785
16116
  };
16117
+ 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;
16118
+ new Set(Object.values(DeviceType));
15786
16119
  /**
15787
16120
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15788
16121
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18894,17 +19227,30 @@ var EventKindCategorySchema = _enum([
18894
19227
  "audio",
18895
19228
  "detection",
18896
19229
  "sensor",
19230
+ "control",
18897
19231
  "custom",
18898
19232
  "package"
18899
19233
  ]);
19234
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19235
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18900
19236
  var EventKindDescriptorSchema = object({
18901
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19237
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18902
19238
  kind: string(),
19239
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19240
+ labelKey: string(),
19241
+ /** English fallback label (kept for clients that don't translate). */
18903
19242
  label: string(),
18904
19243
  /** Hex color for timeline/legend rendering. */
18905
19244
  color: string(),
19245
+ /** Dictionary id → lucide component on the UI side. */
19246
+ iconId: string(),
19247
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18906
19248
  icon: EventKindIconSchema,
18907
19249
  category: EventKindCategorySchema,
19250
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19251
+ parentKind: string().nullable(),
19252
+ /** Derived from `parentKind`, explicit for the client tree. */
19253
+ level: EventKindLevelSchema,
18908
19254
  /** Which cap + device contributes this kind. For built-ins the camera
18909
19255
  * itself; for sensor kinds the LINKED source device. */
18910
19256
  source: object({
@@ -18977,11 +19323,21 @@ var TrackAudioLabelSchema = object({
18977
19323
  firstAt: number(),
18978
19324
  lastAt: number()
18979
19325
  });
19326
+ /**
19327
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19328
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19329
+ * linked sensor/control state change (no positions; carries a snapshot). The
19330
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19331
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19332
+ */
19333
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18980
19334
  var TrackSchema = object({
18981
19335
  trackId: string(),
18982
19336
  deviceId: number(),
18983
19337
  className: string(),
18984
19338
  label: string().optional(),
19339
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19340
+ source: TrackSourceSchema.optional(),
18985
19341
  firstSeen: number(),
18986
19342
  lastSeen: number(),
18987
19343
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19358,6 +19714,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19358
19714
  eventId: string(),
19359
19715
  timestamp: number()
19360
19716
  });
19717
+ /**
19718
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19719
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19720
+ * caps into per-camera event-kind descriptors.
19721
+ *
19722
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19723
+ * is NOT duplicated here — every entry is derived from the single
19724
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19725
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19726
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19727
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19728
+ * eventful cap is missing.
19729
+ */
19730
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19731
+ var LEGACY_ICON = {
19732
+ motion: "motion",
19733
+ audio: "audio",
19734
+ person: "person",
19735
+ vehicle: "vehicle",
19736
+ animal: "animal",
19737
+ package: "package",
19738
+ door: "door",
19739
+ pir: "pir",
19740
+ smoke: "smoke",
19741
+ water: "water",
19742
+ button: "button",
19743
+ generic: "generic",
19744
+ gas: "smoke",
19745
+ vibration: "generic",
19746
+ tamper: "generic",
19747
+ presence: "person",
19748
+ lock: "generic",
19749
+ siren: "generic",
19750
+ switch: "generic",
19751
+ doorbell: "button"
19752
+ };
19753
+ function legacyIcon(iconId) {
19754
+ return LEGACY_ICON[iconId] ?? "generic";
19755
+ }
19756
+ /**
19757
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19758
+ * The anti-drift guard cross-checks this against the eventful caps declared
19759
+ * in `packages/types/src/capabilities/*.cap.ts`.
19760
+ */
19761
+ var CAP_TO_KIND = {
19762
+ contact: "contact",
19763
+ motion: "motion-sensor",
19764
+ smoke: "smoke",
19765
+ flood: "flood",
19766
+ gas: "gas",
19767
+ "carbon-monoxide": "carbon-monoxide",
19768
+ vibration: "vibration",
19769
+ tamper: "tamper",
19770
+ presence: "presence",
19771
+ "enum-sensor": "enum-sensor",
19772
+ "event-emitter": "device-event",
19773
+ "lock-control": "lock",
19774
+ switch: "switch",
19775
+ button: "button",
19776
+ doorbell: "doorbell"
19777
+ };
19778
+ function buildDescriptor(capName, kind) {
19779
+ const t = EVENT_TAXONOMY[kind];
19780
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19781
+ return {
19782
+ ...t,
19783
+ icon: legacyIcon(t.iconId)
19784
+ };
19785
+ }
19786
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19361
19787
  var CameraPipelineConfigSchema = object({
19362
19788
  engine: PipelineEngineChoiceSchema.optional(),
19363
19789
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19376,13 +19802,11 @@ var PipelineTemplateSchema = object({
19376
19802
  createdAt: string(),
19377
19803
  updatedAt: string()
19378
19804
  });
19379
- var AgentAddonConfigSchema = object({
19380
- enabled: boolean(),
19805
+ var DeviceStepConfigSchema = object({
19381
19806
  modelId: string().optional(),
19382
- settings: record(string(), unknown()).readonly()
19807
+ settings: record(string(), unknown()).optional()
19383
19808
  });
19384
19809
  var AgentPipelineSettingsSchema = object({
19385
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19386
19810
  maxCameras: number().int().nonnegative().nullable().default(null),
19387
19811
  /** Per-node detection weight (relative share for the quota balancer). */
19388
19812
  detectWeight: number().positive().optional(),
@@ -19406,7 +19830,22 @@ var AgentPipelineSettingsSchema = object({
19406
19830
  * it already uses to reach the hub). Set this only when the auto-detected
19407
19831
  * address is wrong (multi-homed host, NAT, custom interface).
19408
19832
  */
19409
- reachableHost: string().optional()
19833
+ reachableHost: string().optional(),
19834
+ /**
19835
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19836
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19837
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19838
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19839
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19840
+ * the default model/settings for every camera landing on that accelerator;
19841
+ * a stepId absent ⇒ the step uses that device's format default.
19842
+ */
19843
+ inferenceDevices: record(string(), object({
19844
+ enabled: boolean(),
19845
+ weight: number().positive().optional(),
19846
+ maxSessions: number().int().positive().optional(),
19847
+ steps: record(string(), DeviceStepConfigSchema).optional()
19848
+ })).optional()
19410
19849
  });
19411
19850
  var CameraPipelineForAgentSchema = object({
19412
19851
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19416,14 +19855,13 @@ var CameraPipelineForAgentSchema = object({
19416
19855
  }).nullable()
19417
19856
  });
19418
19857
  var CameraStepOverridePatchSchema = object({
19419
- enabled: boolean().optional(),
19420
19858
  modelId: string().optional(),
19421
19859
  settings: record(string(), unknown()).readonly().optional()
19422
19860
  });
19423
19861
  var CameraPipelineSettingsSchema = object({
19424
19862
  pinnedAgentNodeId: string().optional(),
19425
19863
  stepToggles: record(string(), boolean()).optional(),
19426
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19864
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19427
19865
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19428
19866
  });
19429
19867
  /**
@@ -19637,6 +20075,44 @@ var CameraStatusSchema = object({
19637
20075
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19638
20076
  fetchedAt: number()
19639
20077
  });
20078
+ var NodeInferenceDeviceSchema = object({
20079
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20080
+ key: string(),
20081
+ backend: string(),
20082
+ device: string(),
20083
+ format: _enum(MODEL_FORMATS),
20084
+ /** Whether the node's live probe reports the device as usable right now. */
20085
+ available: boolean(),
20086
+ /**
20087
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20088
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20089
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20090
+ * not a balanced target). An explicit stored value always wins; a stored-only
20091
+ * (unavailable) key keeps its stored value.
20092
+ */
20093
+ enabled: boolean(),
20094
+ /** Relative balancer weight for the enabled device (default 1). */
20095
+ weight: number(),
20096
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20097
+ maxSessions: number().nullable(),
20098
+ /** Object-detection model the executor defaults to for this deviceKey. */
20099
+ defaultModelId: string(),
20100
+ /**
20101
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20102
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20103
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20104
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20105
+ * available per format; this is the stored selection that becomes the
20106
+ * default for EVERY camera landing on this accelerator.
20107
+ */
20108
+ steps: record(string(), DeviceStepConfigSchema).optional()
20109
+ });
20110
+ var NodeInferenceDevicesSchema = object({
20111
+ nodeId: string(),
20112
+ /** False when the node's platform-probe was unreachable (no live device set). */
20113
+ reachable: boolean(),
20114
+ devices: array(NodeInferenceDeviceSchema).readonly()
20115
+ });
19640
20116
  method(object({
19641
20117
  deviceId: number(),
19642
20118
  agentNodeId: string()
@@ -19646,7 +20122,13 @@ method(object({
19646
20122
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19647
20123
  kind: "mutation",
19648
20124
  auth: "admin"
19649
- }), method(_void(), object({ migrated: number() }), {
20125
+ }), method(object({
20126
+ deviceId: number(),
20127
+ deviceKey: string()
20128
+ }), object({ success: literal(true) }), {
20129
+ kind: "mutation",
20130
+ auth: "admin"
20131
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19650
20132
  kind: "mutation",
19651
20133
  auth: "admin"
19652
20134
  }), 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({
@@ -19680,13 +20162,7 @@ method(object({
19680
20162
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19681
20163
  nodeId: string(),
19682
20164
  settings: AgentPipelineSettingsSchema
19683
- })).readonly()), method(object({
19684
- agentNodeId: string(),
19685
- defaults: record(string(), AgentAddonConfigSchema)
19686
- }), object({ success: literal(true) }), {
19687
- kind: "mutation",
19688
- auth: "admin"
19689
- }), method(object({ agentNodeId: string() }), object({
20165
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19690
20166
  success: boolean(),
19691
20167
  removed: boolean()
19692
20168
  }), {
@@ -19718,7 +20194,18 @@ method(object({
19718
20194
  }), object({ success: literal(true) }), {
19719
20195
  kind: "mutation",
19720
20196
  auth: "admin"
19721
- }), method(object({ agentNodeId: string() }), object({
20197
+ }), method(object({
20198
+ agentNodeId: string(),
20199
+ inferenceDevices: record(string(), object({
20200
+ enabled: boolean(),
20201
+ weight: number().positive().optional(),
20202
+ maxSessions: number().int().positive().optional(),
20203
+ steps: record(string(), DeviceStepConfigSchema).optional()
20204
+ }))
20205
+ }), object({ success: literal(true) }), {
20206
+ kind: "mutation",
20207
+ auth: "admin"
20208
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19722
20209
  success: literal(true),
19723
20210
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19724
20211
  effectiveModelId: string().nullable(),
@@ -19734,9 +20221,10 @@ method(object({
19734
20221
  }), object({ success: literal(true) }), {
19735
20222
  kind: "mutation",
19736
20223
  auth: "admin"
19737
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20224
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19738
20225
  deviceId: number(),
19739
20226
  agentNodeId: string(),
20227
+ deviceKey: string(),
19740
20228
  addonId: string(),
19741
20229
  patch: CameraStepOverridePatchSchema.nullable()
19742
20230
  }), object({ success: literal(true) }), {
@@ -19773,14 +20261,13 @@ method(object({
19773
20261
  });
19774
20262
  /**
19775
20263
  * server-management — per-NODE singleton capability for a node's ROOT
19776
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19777
- * agents).
20264
+ * package lifecycle (runtime-updatable node packages).
19778
20265
  *
19779
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19780
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19781
- * version describes the node. Updates install into
19782
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19783
- * starter (probation boot + auto-rollback to N-1).
20266
+ * Every node role runs the SAME root package (`@camstack/server`), which
20267
+ * carries the whole software stack in its npm dep tree, so ONE version
20268
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20269
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20270
+ * no auto-rollback).
19784
20271
  *
19785
20272
  * Providers:
19786
20273
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19888,7 +20375,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19888
20375
  /** Explicit target version; omitted = latest from the registry. */
19889
20376
  version: string().optional() }), ServerUpdateActionResultSchema, {
19890
20377
  kind: "mutation",
19891
- auth: "admin"
20378
+ auth: "admin",
20379
+ timeoutMs: 16 * 6e4
19892
20380
  }), method(_void(), ServerUpdateActionResultSchema, {
19893
20381
  kind: "mutation",
19894
20382
  auth: "admin"
@@ -20932,22 +21420,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20932
21420
  var RestartAddonResultSchema = unknown();
20933
21421
  var InstallPackageResultSchema = unknown();
20934
21422
  var ReloadPackagesResultSchema = unknown();
20935
- /**
20936
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20937
- * server restarts so the admin UI can react to the `restartingAt`
20938
- * timestamp (shows reconnect overlay). The transition from
20939
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20940
- * `system.restart-completed` event after the new process boots.
20941
- *
20942
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20943
- */
20944
- var UpdateFrameworkPackageResultSchema = object({
20945
- packageName: string(),
20946
- fromVersion: string(),
20947
- toVersion: string(),
20948
- /** Ms-epoch the server scheduled its self-restart. */
20949
- restartingAt: number()
20950
- });
20951
21423
  var BulkUpdateItemStatusSchema = _enum([
20952
21424
  "queued",
20953
21425
  "updating",
@@ -21075,13 +21547,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21075
21547
  }), object({ success: literal(true) }), {
21076
21548
  kind: "mutation",
21077
21549
  auth: "admin"
21078
- }), method(object({
21079
- packageName: string().min(1),
21080
- version: string().optional(),
21081
- deferRestart: boolean().optional()
21082
- }), UpdateFrameworkPackageResultSchema, {
21083
- kind: "mutation",
21084
- auth: "admin"
21085
21550
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21086
21551
  kind: "mutation",
21087
21552
  auth: "admin"
@@ -21947,10 +22412,10 @@ var TopologyCategorySchema = object({
21947
22412
  addons: array(TopologyCategoryAddonSchema).readonly()
21948
22413
  });
21949
22414
  /**
21950
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21951
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21952
- * version visibility for the Server management surface. Nullable: offline
21953
- * rows and pre-phase-2 nodes report none.
22415
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22416
+ * root package for every node role) as reported by its `registerNode`
22417
+ * manifest — version visibility for the Server management surface. Nullable:
22418
+ * offline rows and nodes that never reported one.
21954
22419
  */
21955
22420
  var TopologyRootPackageSchema = object({
21956
22421
  name: string(),
@@ -22338,17 +22803,28 @@ var PlatformScoreSchema = object({
22338
22803
  format: _enum([
22339
22804
  "onnx",
22340
22805
  "coreml",
22341
- "openvino"
22806
+ "openvino",
22807
+ "tflite"
22342
22808
  ]),
22343
22809
  score: number(),
22344
22810
  reason: string(),
22345
22811
  available: boolean()
22346
22812
  });
22813
+ var InferenceDeviceDescriptorSchema = object({
22814
+ key: string(),
22815
+ backend: string(),
22816
+ device: string(),
22817
+ format: ModelFormatSchema,
22818
+ runtime: literal("python"),
22819
+ score: number(),
22820
+ available: boolean()
22821
+ });
22347
22822
  var PlatformCapabilitiesSchema = object({
22348
22823
  hardware: HardwareInfoSchema,
22349
22824
  scores: array(PlatformScoreSchema).readonly(),
22350
22825
  bestScore: PlatformScoreSchema,
22351
- pythonPath: string().nullable()
22826
+ pythonPath: string().nullable(),
22827
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22352
22828
  });
22353
22829
  var ModelRequirementSchema = object({
22354
22830
  modelId: string(),
@@ -23227,12 +23703,6 @@ Object.freeze({
23227
23703
  addonId: null,
23228
23704
  access: "delete"
23229
23705
  },
23230
- "addons.updateFrameworkPackage": {
23231
- capName: "addons",
23232
- capScope: "system",
23233
- addonId: null,
23234
- access: "create"
23235
- },
23236
23706
  "addons.updatePackage": {
23237
23707
  capName: "addons",
23238
23708
  capScope: "system",
@@ -26005,12 +26475,6 @@ Object.freeze({
26005
26475
  addonId: null,
26006
26476
  access: "view"
26007
26477
  },
26008
- "pipelineExecutor.reprobeEngine": {
26009
- capName: "pipeline-executor",
26010
- capScope: "system",
26011
- addonId: null,
26012
- access: "create"
26013
- },
26014
26478
  "pipelineExecutor.runAudioTest": {
26015
26479
  capName: "pipeline-executor",
26016
26480
  capScope: "system",
@@ -26161,6 +26625,12 @@ Object.freeze({
26161
26625
  addonId: null,
26162
26626
  access: "view"
26163
26627
  },
26628
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26629
+ capName: "pipeline-orchestrator",
26630
+ capScope: "system",
26631
+ addonId: null,
26632
+ access: "view"
26633
+ },
26164
26634
  "pipelineOrchestrator.getPipelineAssignment": {
26165
26635
  capName: "pipeline-orchestrator",
26166
26636
  capScope: "system",
@@ -26173,6 +26643,12 @@ Object.freeze({
26173
26643
  addonId: null,
26174
26644
  access: "view"
26175
26645
  },
26646
+ "pipelineOrchestrator.getPipelineDevicePin": {
26647
+ capName: "pipeline-orchestrator",
26648
+ capScope: "system",
26649
+ addonId: null,
26650
+ access: "view"
26651
+ },
26176
26652
  "pipelineOrchestrator.listAgentSettings": {
26177
26653
  capName: "pipeline-orchestrator",
26178
26654
  capScope: "system",
@@ -26215,19 +26691,19 @@ Object.freeze({
26215
26691
  addonId: null,
26216
26692
  access: "create"
26217
26693
  },
26218
- "pipelineOrchestrator.setAgentAddonDefaults": {
26694
+ "pipelineOrchestrator.setAgentCapabilities": {
26219
26695
  capName: "pipeline-orchestrator",
26220
26696
  capScope: "system",
26221
26697
  addonId: null,
26222
26698
  access: "create"
26223
26699
  },
26224
- "pipelineOrchestrator.setAgentCapabilities": {
26700
+ "pipelineOrchestrator.setAgentDetectWeight": {
26225
26701
  capName: "pipeline-orchestrator",
26226
26702
  capScope: "system",
26227
26703
  addonId: null,
26228
26704
  access: "create"
26229
26705
  },
26230
- "pipelineOrchestrator.setAgentDetectWeight": {
26706
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26231
26707
  capName: "pipeline-orchestrator",
26232
26708
  capScope: "system",
26233
26709
  addonId: null,
@@ -26269,6 +26745,12 @@ Object.freeze({
26269
26745
  addonId: null,
26270
26746
  access: "create"
26271
26747
  },
26748
+ "pipelineOrchestrator.setPipelineDevicePin": {
26749
+ capName: "pipeline-orchestrator",
26750
+ capScope: "system",
26751
+ addonId: null,
26752
+ access: "create"
26753
+ },
26272
26754
  "pipelineOrchestrator.unassignAudio": {
26273
26755
  capName: "pipeline-orchestrator",
26274
26756
  capScope: "system",
@@ -27821,32 +28303,6 @@ Object.freeze({
27821
28303
  "network-access": "ingress",
27822
28304
  "smtp-provider": "email"
27823
28305
  });
27824
- var frameworkSwapPackageSchema = object({
27825
- name: string(),
27826
- stagedPath: string(),
27827
- backupPath: string(),
27828
- toVersion: string(),
27829
- fromVersion: string().nullable()
27830
- });
27831
- object({
27832
- jobId: string(),
27833
- taskId: string(),
27834
- packages: array(frameworkSwapPackageSchema),
27835
- requestedAtMs: number(),
27836
- schemaVersion: literal(1)
27837
- });
27838
- object({
27839
- jobId: string(),
27840
- taskId: string(),
27841
- backups: array(object({
27842
- name: string(),
27843
- backupPath: string(),
27844
- livePath: string()
27845
- })),
27846
- appliedAtMs: number(),
27847
- bootAttempts: number(),
27848
- schemaVersion: literal(1)
27849
- });
27850
28306
  //#endregion
27851
28307
  //#region src/config.ts
27852
28308
  /**
@@ -31522,7 +31978,7 @@ var import_websocket = /* @__PURE__ */ __toESM(require_websocket(), 1);
31522
31978
  require_websocket_server();
31523
31979
  var wrapper_default = import_websocket.default;
31524
31980
  //#endregion
31525
- //#region node_modules/@apocaliss92/nodedreo/dist/index.js
31981
+ //#region ../../node_modules/@apocaliss92/nodedreo/dist/index.js
31526
31982
  var DreoError = class extends Error {
31527
31983
  constructor(message) {
31528
31984
  super(message);