@camstack/addon-provider-rademacher 0.1.13 → 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 +560 -104
  2. package/dist/addon.mjs +560 -104
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8083,6 +8083,17 @@ var ModelCatalogEntrySchema = object({
8083
8083
  "imagenet",
8084
8084
  "none"
8085
8085
  ]).optional(),
8086
+ /**
8087
+ * The model already applies softmax IN-GRAPH — its raw output is a
8088
+ * probability distribution, not logits. When set, the `softmax`
8089
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
8090
+ * probability vector collapses it toward uniform (top-1 score craters far
8091
+ * below its true value, making every confidence gate meaningless). Absent ⇒
8092
+ * the output is raw logits and the postprocessor applies softmax (the normal
8093
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
8094
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
8095
+ */
8096
+ outputProbabilities: boolean().optional(),
8086
8097
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
8087
8098
  /**
8088
8099
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -8642,6 +8653,160 @@ var EncodeProfileSchema = object({
8642
8653
  */
8643
8654
  outputArgs: array(string()).optional()
8644
8655
  });
8656
+ var COCO_TO_MACRO = {
8657
+ mapping: {
8658
+ person: "person",
8659
+ bicycle: "vehicle",
8660
+ car: "vehicle",
8661
+ motorcycle: "vehicle",
8662
+ airplane: "vehicle",
8663
+ bus: "vehicle",
8664
+ train: "vehicle",
8665
+ truck: "vehicle",
8666
+ boat: "vehicle",
8667
+ bird: "animal",
8668
+ cat: "animal",
8669
+ dog: "animal",
8670
+ horse: "animal",
8671
+ sheep: "animal",
8672
+ cow: "animal",
8673
+ elephant: "animal",
8674
+ bear: "animal",
8675
+ zebra: "animal",
8676
+ giraffe: "animal",
8677
+ suitcase: "package",
8678
+ backpack: "package",
8679
+ handbag: "package"
8680
+ },
8681
+ preserveOriginal: false
8682
+ };
8683
+ var AUDIO_MACRO_LABELS = [
8684
+ {
8685
+ id: "speech",
8686
+ name: "Speech",
8687
+ icon: "🗣️"
8688
+ },
8689
+ {
8690
+ id: "scream",
8691
+ name: "Scream / Shout",
8692
+ icon: "😱"
8693
+ },
8694
+ {
8695
+ id: "crying",
8696
+ name: "Crying / Baby",
8697
+ icon: "😢"
8698
+ },
8699
+ {
8700
+ id: "laughter",
8701
+ name: "Laughter",
8702
+ icon: "😂"
8703
+ },
8704
+ {
8705
+ id: "music",
8706
+ name: "Music",
8707
+ icon: "🎵"
8708
+ },
8709
+ {
8710
+ id: "dog",
8711
+ name: "Dog",
8712
+ icon: "🐕"
8713
+ },
8714
+ {
8715
+ id: "cat",
8716
+ name: "Cat",
8717
+ icon: "🐈"
8718
+ },
8719
+ {
8720
+ id: "bird",
8721
+ name: "Bird",
8722
+ icon: "🐦"
8723
+ },
8724
+ {
8725
+ id: "animal",
8726
+ name: "Animal (other)",
8727
+ icon: "🐾"
8728
+ },
8729
+ {
8730
+ id: "alarm",
8731
+ name: "Alarm / Siren",
8732
+ icon: "🚨"
8733
+ },
8734
+ {
8735
+ id: "doorbell",
8736
+ name: "Doorbell / Knock",
8737
+ icon: "🔔"
8738
+ },
8739
+ {
8740
+ id: "glass_breaking",
8741
+ name: "Glass Breaking",
8742
+ icon: "💥"
8743
+ },
8744
+ {
8745
+ id: "gunshot",
8746
+ name: "Gunshot / Explosion",
8747
+ icon: "💣"
8748
+ },
8749
+ {
8750
+ id: "vehicle",
8751
+ name: "Vehicle",
8752
+ icon: "🚗"
8753
+ },
8754
+ {
8755
+ id: "siren",
8756
+ name: "Emergency Siren",
8757
+ icon: "🚑"
8758
+ },
8759
+ {
8760
+ id: "fire",
8761
+ name: "Fire / Smoke",
8762
+ icon: "🔥"
8763
+ },
8764
+ {
8765
+ id: "water",
8766
+ name: "Water",
8767
+ icon: "💧"
8768
+ },
8769
+ {
8770
+ id: "wind",
8771
+ name: "Wind / Weather",
8772
+ icon: "🌬️"
8773
+ },
8774
+ {
8775
+ id: "door",
8776
+ name: "Door",
8777
+ icon: "🚪"
8778
+ },
8779
+ {
8780
+ id: "footsteps",
8781
+ name: "Footsteps",
8782
+ icon: "👣"
8783
+ },
8784
+ {
8785
+ id: "crowd",
8786
+ name: "Crowd / Chatter",
8787
+ icon: "👥"
8788
+ },
8789
+ {
8790
+ id: "telephone",
8791
+ name: "Telephone",
8792
+ icon: "📞"
8793
+ },
8794
+ {
8795
+ id: "engine",
8796
+ name: "Engine / Motor",
8797
+ icon: "⚙️"
8798
+ },
8799
+ {
8800
+ id: "tools",
8801
+ name: "Tools / Construction",
8802
+ icon: "🔨"
8803
+ },
8804
+ {
8805
+ id: "silence",
8806
+ name: "Silence",
8807
+ icon: "🤫"
8808
+ }
8809
+ ];
8645
8810
  var YAMNET_TO_MACRO = {
8646
8811
  mapping: {
8647
8812
  Speech: "speech",
@@ -8908,6 +9073,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8908
9073
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8909
9074
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8910
9075
  /**
9076
+ * Unified event-kind taxonomy — THE single source of truth for
9077
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
9078
+ * icon }`.
9079
+ *
9080
+ * This dictionary folds together what used to be scattered across four
9081
+ * copies:
9082
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
9083
+ * - `addon-post-analysis/.../services/event-kinds.ts`
9084
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
9085
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
9086
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
9087
+ * - the COCO / audio class maps (macro ↔ sub relationships)
9088
+ *
9089
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
9090
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
9091
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
9092
+ * color or an icon: they read this dictionary (server descriptors carry the
9093
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
9094
+ *
9095
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
9096
+ */
9097
+ var TAXONOMY_COLORS = {
9098
+ motion: "#f59e0b",
9099
+ audio: "#06b6d4",
9100
+ person: "#22c55e",
9101
+ vehicle: "#3b82f6",
9102
+ animal: "#f97316",
9103
+ package: "#a855f7",
9104
+ sensor: "#8b5cf6",
9105
+ control: "#10b981",
9106
+ genericDetection: "#64748b"
9107
+ };
9108
+ var DETECTION_SUB_COLORS = {
9109
+ car: "#f59e0b",
9110
+ truck: "#d97706",
9111
+ bus: "#b45309",
9112
+ motorcycle: "#eab308",
9113
+ bicycle: "#ca8a04",
9114
+ airplane: "#60a5fa",
9115
+ boat: "#2563eb",
9116
+ train: "#1d4ed8",
9117
+ bird: "#14b8a6",
9118
+ dog: "#84cc16",
9119
+ cat: "#f97316",
9120
+ horse: "#a16207",
9121
+ sheep: "#a3a3a3",
9122
+ cow: "#78716c",
9123
+ elephant: "#6b7280",
9124
+ bear: "#7c2d12",
9125
+ zebra: "#404040",
9126
+ giraffe: "#d4a373"
9127
+ };
9128
+ function titleCase(id) {
9129
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
9130
+ }
9131
+ var entries = /* @__PURE__ */ new Map();
9132
+ function macro(kind, category, color, iconId, label) {
9133
+ entries.set(kind, {
9134
+ kind,
9135
+ parentKind: null,
9136
+ level: "macro",
9137
+ category,
9138
+ color,
9139
+ iconId,
9140
+ labelKey: `eventKind.${kind}`,
9141
+ label
9142
+ });
9143
+ }
9144
+ function sub(kind, parentKind, category, color, iconId, label) {
9145
+ entries.set(kind, {
9146
+ kind,
9147
+ parentKind,
9148
+ level: "sub",
9149
+ category,
9150
+ color,
9151
+ iconId,
9152
+ labelKey: `eventKind.${kind}`,
9153
+ label
9154
+ });
9155
+ }
9156
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
9157
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
9158
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
9159
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
9160
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
9161
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
9162
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
9163
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
9164
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
9165
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
9166
+ if (entries.has(cocoClass)) continue;
9167
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
9168
+ }
9169
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
9170
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
9171
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
9172
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
9173
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
9174
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
9175
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
9176
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
9177
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
9178
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
9179
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
9180
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
9181
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
9182
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
9183
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
9184
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
9185
+ sub("button", "control", "control", "#10b981", "button", "Button");
9186
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
9187
+ for (const l of AUDIO_MACRO_LABELS) {
9188
+ const kind = `audio-${l.id}`;
9189
+ if (entries.has(kind)) continue;
9190
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
9191
+ }
9192
+ /** The complete taxonomy dictionary, keyed by kind. */
9193
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
9194
+ /**
8911
9195
  * Error types for the safe expression engine. Two distinct classes so callers
8912
9196
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8913
9197
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -13100,10 +13384,7 @@ var ConfigUISchemaNullableBridge = custom();
13100
13384
  var InferenceCapabilitiesBridge = custom();
13101
13385
  var ModelAvailabilityListBridge = custom();
13102
13386
  var PipelineRunResultBridge = custom();
13103
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
13104
- kind: "mutation",
13105
- auth: "admin"
13106
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
13387
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
13107
13388
  modelId: string(),
13108
13389
  settings: record(string(), unknown()).readonly()
13109
13390
  }))), method(object({ steps: record(string(), object({
@@ -13163,13 +13444,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
13163
13444
  * (inputClasses ≠ null) are skipped and served per-track via
13164
13445
  * pipelineRunner.runDetailSubtree (two-plane design).
13165
13446
  */
13166
- plane: _enum(["full", "frame"]).optional()
13447
+ plane: _enum(["full", "frame"]).optional(),
13448
+ /**
13449
+ * Inference-device selector (Phase 2 multi-device). Format
13450
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
13451
+ * Omitted ⇒ the runner's default device (current single-engine
13452
+ * behaviour). Selects WHICH device pool of the node runs the call.
13453
+ */
13454
+ deviceKey: string().optional()
13167
13455
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
13168
13456
  engine: PipelineEngineChoiceSchema.optional(),
13169
13457
  steps: array(PipelineStepInputSchema).min(1),
13170
13458
  frames: array(FrameInputSchema).min(1).max(255),
13171
13459
  deviceId: number().optional(),
13172
- sessionId: string().optional()
13460
+ sessionId: string().optional(),
13461
+ /**
13462
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
13463
+ * the batch to the Python pool's bench preprocess cache
13464
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
13465
+ * preprocessed ONCE and every later inference is a pure-inference cache
13466
+ * hit — the sustained-throughput run measures inference, not
13467
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
13468
+ * full preprocess every call, correct). Fresh per sustained run;
13469
+ * released via `uncacheFrame`.
13470
+ */
13471
+ frameId: number().int().nonnegative().optional(),
13472
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
13473
+ deviceKey: string().optional()
13173
13474
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
13174
13475
  data: _instanceof(Uint8Array),
13175
13476
  width: number().int().positive(),
@@ -13201,8 +13502,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
13201
13502
  * - `runtime` — main camera-serving engine (no idle TTL).
13202
13503
  * - `warm-override` — benchmark/test override held in the warm
13203
13504
  * cache; auto-disposed after the idle TTL.
13505
+ * - `device-pool` — a concurrent per-device pool (Phase 2
13506
+ * multi-device, keyed by `deviceKey`) resolved
13507
+ * via `resolveDeviceFactory`. Runs alongside the
13508
+ * `runtime` engine on a DIFFERENT accelerator
13509
+ * (NPU / iGPU / Coral) — this is how the
13510
+ * Engines tab shows all pools running at once.
13204
13511
  */
13205
- kind: _enum(["runtime", "warm-override"]),
13512
+ kind: _enum([
13513
+ "runtime",
13514
+ "warm-override",
13515
+ "device-pool"
13516
+ ]),
13206
13517
  /** Native pid of the underlying Python pool (null when no pool). */
13207
13518
  poolPid: number().nullable(),
13208
13519
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -13577,7 +13888,14 @@ var RunnerCameraConfigSchema = object({
13577
13888
  * camera's detect node differs from its source-owner (P2d, gated by the
13578
13889
  * `remoteSourcingNodes` rollout setting).
13579
13890
  */
13580
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
13891
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
13892
+ /**
13893
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
13894
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
13895
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
13896
+ * this only selects WHICH device pool of that node runs the session.
13897
+ */
13898
+ deviceKey: string().optional()
13581
13899
  });
13582
13900
  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;
13583
13901
  /**
@@ -13598,6 +13916,19 @@ var RunnerLocalLoadSchema = object({
13598
13916
  avgInferenceTimeMs: number(),
13599
13917
  /** Total queue depth across motion + detection queues. */
13600
13918
  queueDepthTotal: number(),
13919
+ /**
13920
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
13921
+ * this runner currently has attached cameras on, so the orchestrator's second
13922
+ * `balance()` pass (over a node's devices) weights on real per-pool session
13923
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
13924
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
13925
+ */
13926
+ devices: array(object({
13927
+ deviceKey: string(),
13928
+ backend: string(),
13929
+ attachedCameras: number(),
13930
+ queueDepthTotal: number()
13931
+ })).default([]),
13601
13932
  /** Hardware capability flags reported by this node. */
13602
13933
  hardware: object({
13603
13934
  hasGpu: boolean(),
@@ -16746,6 +17077,8 @@ var BaseDeviceProvider = class extends BaseAddon {
16746
17077
  return toDeviceSummary(device, this.addonId);
16747
17078
  }
16748
17079
  };
17080
+ 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;
17081
+ new Set(Object.values(DeviceType));
16749
17082
  /**
16750
17083
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
16751
17084
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -19840,17 +20173,30 @@ var EventKindCategorySchema = _enum([
19840
20173
  "audio",
19841
20174
  "detection",
19842
20175
  "sensor",
20176
+ "control",
19843
20177
  "custom",
19844
20178
  "package"
19845
20179
  ]);
20180
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
20181
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
19846
20182
  var EventKindDescriptorSchema = object({
19847
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
20183
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
19848
20184
  kind: string(),
20185
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
20186
+ labelKey: string(),
20187
+ /** English fallback label (kept for clients that don't translate). */
19849
20188
  label: string(),
19850
20189
  /** Hex color for timeline/legend rendering. */
19851
20190
  color: string(),
20191
+ /** Dictionary id → lucide component on the UI side. */
20192
+ iconId: string(),
20193
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
19852
20194
  icon: EventKindIconSchema,
19853
20195
  category: EventKindCategorySchema,
20196
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
20197
+ parentKind: string().nullable(),
20198
+ /** Derived from `parentKind`, explicit for the client tree. */
20199
+ level: EventKindLevelSchema,
19854
20200
  /** Which cap + device contributes this kind. For built-ins the camera
19855
20201
  * itself; for sensor kinds the LINKED source device. */
19856
20202
  source: object({
@@ -19923,11 +20269,21 @@ var TrackAudioLabelSchema = object({
19923
20269
  firstAt: number(),
19924
20270
  lastAt: number()
19925
20271
  });
20272
+ /**
20273
+ * How a track was produced. `pipeline` (default / absent) = the spatial
20274
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
20275
+ * linked sensor/control state change (no positions; carries a snapshot). The
20276
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
20277
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
20278
+ */
20279
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19926
20280
  var TrackSchema = object({
19927
20281
  trackId: string(),
19928
20282
  deviceId: number(),
19929
20283
  className: string(),
19930
20284
  label: string().optional(),
20285
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
20286
+ source: TrackSourceSchema.optional(),
19931
20287
  firstSeen: number(),
19932
20288
  lastSeen: number(),
19933
20289
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -20304,6 +20660,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20304
20660
  eventId: string(),
20305
20661
  timestamp: number()
20306
20662
  });
20663
+ /**
20664
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
20665
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
20666
+ * caps into per-camera event-kind descriptors.
20667
+ *
20668
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
20669
+ * is NOT duplicated here — every entry is derived from the single
20670
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
20671
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
20672
+ * control cap means adding one line here (and a taxonomy entry); the anti-
20673
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
20674
+ * eventful cap is missing.
20675
+ */
20676
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
20677
+ var LEGACY_ICON = {
20678
+ motion: "motion",
20679
+ audio: "audio",
20680
+ person: "person",
20681
+ vehicle: "vehicle",
20682
+ animal: "animal",
20683
+ package: "package",
20684
+ door: "door",
20685
+ pir: "pir",
20686
+ smoke: "smoke",
20687
+ water: "water",
20688
+ button: "button",
20689
+ generic: "generic",
20690
+ gas: "smoke",
20691
+ vibration: "generic",
20692
+ tamper: "generic",
20693
+ presence: "person",
20694
+ lock: "generic",
20695
+ siren: "generic",
20696
+ switch: "generic",
20697
+ doorbell: "button"
20698
+ };
20699
+ function legacyIcon(iconId) {
20700
+ return LEGACY_ICON[iconId] ?? "generic";
20701
+ }
20702
+ /**
20703
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
20704
+ * The anti-drift guard cross-checks this against the eventful caps declared
20705
+ * in `packages/types/src/capabilities/*.cap.ts`.
20706
+ */
20707
+ var CAP_TO_KIND = {
20708
+ contact: "contact",
20709
+ motion: "motion-sensor",
20710
+ smoke: "smoke",
20711
+ flood: "flood",
20712
+ gas: "gas",
20713
+ "carbon-monoxide": "carbon-monoxide",
20714
+ vibration: "vibration",
20715
+ tamper: "tamper",
20716
+ presence: "presence",
20717
+ "enum-sensor": "enum-sensor",
20718
+ "event-emitter": "device-event",
20719
+ "lock-control": "lock",
20720
+ switch: "switch",
20721
+ button: "button",
20722
+ doorbell: "doorbell"
20723
+ };
20724
+ function buildDescriptor(capName, kind) {
20725
+ const t = EVENT_TAXONOMY[kind];
20726
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
20727
+ return {
20728
+ ...t,
20729
+ icon: legacyIcon(t.iconId)
20730
+ };
20731
+ }
20732
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
20307
20733
  var CameraPipelineConfigSchema = object({
20308
20734
  engine: PipelineEngineChoiceSchema.optional(),
20309
20735
  steps: array(PipelineStepInputSchema).readonly(),
@@ -20322,13 +20748,11 @@ var PipelineTemplateSchema = object({
20322
20748
  createdAt: string(),
20323
20749
  updatedAt: string()
20324
20750
  });
20325
- var AgentAddonConfigSchema = object({
20326
- enabled: boolean(),
20751
+ var DeviceStepConfigSchema = object({
20327
20752
  modelId: string().optional(),
20328
- settings: record(string(), unknown()).readonly()
20753
+ settings: record(string(), unknown()).optional()
20329
20754
  });
20330
20755
  var AgentPipelineSettingsSchema = object({
20331
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
20332
20756
  maxCameras: number().int().nonnegative().nullable().default(null),
20333
20757
  /** Per-node detection weight (relative share for the quota balancer). */
20334
20758
  detectWeight: number().positive().optional(),
@@ -20352,7 +20776,22 @@ var AgentPipelineSettingsSchema = object({
20352
20776
  * it already uses to reach the hub). Set this only when the auto-detected
20353
20777
  * address is wrong (multi-homed host, NAT, custom interface).
20354
20778
  */
20355
- reachableHost: string().optional()
20779
+ reachableHost: string().optional(),
20780
+ /**
20781
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
20782
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
20783
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
20784
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
20785
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
20786
+ * the default model/settings for every camera landing on that accelerator;
20787
+ * a stepId absent ⇒ the step uses that device's format default.
20788
+ */
20789
+ inferenceDevices: record(string(), object({
20790
+ enabled: boolean(),
20791
+ weight: number().positive().optional(),
20792
+ maxSessions: number().int().positive().optional(),
20793
+ steps: record(string(), DeviceStepConfigSchema).optional()
20794
+ })).optional()
20356
20795
  });
20357
20796
  var CameraPipelineForAgentSchema = object({
20358
20797
  steps: array(PipelineStepInputSchema).readonly(),
@@ -20362,14 +20801,13 @@ var CameraPipelineForAgentSchema = object({
20362
20801
  }).nullable()
20363
20802
  });
20364
20803
  var CameraStepOverridePatchSchema = object({
20365
- enabled: boolean().optional(),
20366
20804
  modelId: string().optional(),
20367
20805
  settings: record(string(), unknown()).readonly().optional()
20368
20806
  });
20369
20807
  var CameraPipelineSettingsSchema = object({
20370
20808
  pinnedAgentNodeId: string().optional(),
20371
20809
  stepToggles: record(string(), boolean()).optional(),
20372
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
20810
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
20373
20811
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
20374
20812
  });
20375
20813
  /**
@@ -20583,6 +21021,44 @@ var CameraStatusSchema = object({
20583
21021
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
20584
21022
  fetchedAt: number()
20585
21023
  });
21024
+ var NodeInferenceDeviceSchema = object({
21025
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
21026
+ key: string(),
21027
+ backend: string(),
21028
+ device: string(),
21029
+ format: _enum(MODEL_FORMATS),
21030
+ /** Whether the node's live probe reports the device as usable right now. */
21031
+ available: boolean(),
21032
+ /**
21033
+ * Whether this device participates in dispatch. AUTO default (spec C2):
21034
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
21035
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
21036
+ * not a balanced target). An explicit stored value always wins; a stored-only
21037
+ * (unavailable) key keeps its stored value.
21038
+ */
21039
+ enabled: boolean(),
21040
+ /** Relative balancer weight for the enabled device (default 1). */
21041
+ weight: number(),
21042
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
21043
+ maxSessions: number().nullable(),
21044
+ /** Object-detection model the executor defaults to for this deviceKey. */
21045
+ defaultModelId: string(),
21046
+ /**
21047
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
21048
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
21049
+ * Absent/empty ⇒ no base (every step uses its device format default). The
21050
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
21051
+ * available per format; this is the stored selection that becomes the
21052
+ * default for EVERY camera landing on this accelerator.
21053
+ */
21054
+ steps: record(string(), DeviceStepConfigSchema).optional()
21055
+ });
21056
+ var NodeInferenceDevicesSchema = object({
21057
+ nodeId: string(),
21058
+ /** False when the node's platform-probe was unreachable (no live device set). */
21059
+ reachable: boolean(),
21060
+ devices: array(NodeInferenceDeviceSchema).readonly()
21061
+ });
20586
21062
  method(object({
20587
21063
  deviceId: number(),
20588
21064
  agentNodeId: string()
@@ -20592,7 +21068,13 @@ method(object({
20592
21068
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
20593
21069
  kind: "mutation",
20594
21070
  auth: "admin"
20595
- }), method(_void(), object({ migrated: number() }), {
21071
+ }), method(object({
21072
+ deviceId: number(),
21073
+ deviceKey: string()
21074
+ }), object({ success: literal(true) }), {
21075
+ kind: "mutation",
21076
+ auth: "admin"
21077
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
20596
21078
  kind: "mutation",
20597
21079
  auth: "admin"
20598
21080
  }), 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({
@@ -20626,13 +21108,7 @@ method(object({
20626
21108
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
20627
21109
  nodeId: string(),
20628
21110
  settings: AgentPipelineSettingsSchema
20629
- })).readonly()), method(object({
20630
- agentNodeId: string(),
20631
- defaults: record(string(), AgentAddonConfigSchema)
20632
- }), object({ success: literal(true) }), {
20633
- kind: "mutation",
20634
- auth: "admin"
20635
- }), method(object({ agentNodeId: string() }), object({
21111
+ })).readonly()), method(object({ agentNodeId: string() }), object({
20636
21112
  success: boolean(),
20637
21113
  removed: boolean()
20638
21114
  }), {
@@ -20664,7 +21140,18 @@ method(object({
20664
21140
  }), object({ success: literal(true) }), {
20665
21141
  kind: "mutation",
20666
21142
  auth: "admin"
20667
- }), method(object({ agentNodeId: string() }), object({
21143
+ }), method(object({
21144
+ agentNodeId: string(),
21145
+ inferenceDevices: record(string(), object({
21146
+ enabled: boolean(),
21147
+ weight: number().positive().optional(),
21148
+ maxSessions: number().int().positive().optional(),
21149
+ steps: record(string(), DeviceStepConfigSchema).optional()
21150
+ }))
21151
+ }), object({ success: literal(true) }), {
21152
+ kind: "mutation",
21153
+ auth: "admin"
21154
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
20668
21155
  success: literal(true),
20669
21156
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
20670
21157
  effectiveModelId: string().nullable(),
@@ -20680,9 +21167,10 @@ method(object({
20680
21167
  }), object({ success: literal(true) }), {
20681
21168
  kind: "mutation",
20682
21169
  auth: "admin"
20683
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
21170
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
20684
21171
  deviceId: number(),
20685
21172
  agentNodeId: string(),
21173
+ deviceKey: string(),
20686
21174
  addonId: string(),
20687
21175
  patch: CameraStepOverridePatchSchema.nullable()
20688
21176
  }), object({ success: literal(true) }), {
@@ -20719,14 +21207,13 @@ method(object({
20719
21207
  });
20720
21208
  /**
20721
21209
  * server-management — per-NODE singleton capability for a node's ROOT
20722
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
20723
- * agents).
21210
+ * package lifecycle (runtime-updatable node packages).
20724
21211
  *
20725
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
20726
- * on agents) carries the whole software stack in its npm dep tree, so ONE
20727
- * version describes the node. Updates install into
20728
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
20729
- * starter (probation boot + auto-rollback to N-1).
21212
+ * Every node role runs the SAME root package (`@camstack/server`), which
21213
+ * carries the whole software stack in its npm dep tree, so ONE version
21214
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
21215
+ * on restart via the baked starter (single-copy in-place swap — no probation,
21216
+ * no auto-rollback).
20730
21217
  *
20731
21218
  * Providers:
20732
21219
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -20834,7 +21321,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
20834
21321
  /** Explicit target version; omitted = latest from the registry. */
20835
21322
  version: string().optional() }), ServerUpdateActionResultSchema, {
20836
21323
  kind: "mutation",
20837
- auth: "admin"
21324
+ auth: "admin",
21325
+ timeoutMs: 16 * 6e4
20838
21326
  }), method(_void(), ServerUpdateActionResultSchema, {
20839
21327
  kind: "mutation",
20840
21328
  auth: "admin"
@@ -21878,22 +22366,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21878
22366
  var RestartAddonResultSchema = unknown();
21879
22367
  var InstallPackageResultSchema = unknown();
21880
22368
  var ReloadPackagesResultSchema = unknown();
21881
- /**
21882
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
21883
- * server restarts so the admin UI can react to the `restartingAt`
21884
- * timestamp (shows reconnect overlay). The transition from
21885
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
21886
- * `system.restart-completed` event after the new process boots.
21887
- *
21888
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
21889
- */
21890
- var UpdateFrameworkPackageResultSchema = object({
21891
- packageName: string(),
21892
- fromVersion: string(),
21893
- toVersion: string(),
21894
- /** Ms-epoch the server scheduled its self-restart. */
21895
- restartingAt: number()
21896
- });
21897
22369
  var BulkUpdateItemStatusSchema = _enum([
21898
22370
  "queued",
21899
22371
  "updating",
@@ -22021,13 +22493,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
22021
22493
  }), object({ success: literal(true) }), {
22022
22494
  kind: "mutation",
22023
22495
  auth: "admin"
22024
- }), method(object({
22025
- packageName: string().min(1),
22026
- version: string().optional(),
22027
- deferRestart: boolean().optional()
22028
- }), UpdateFrameworkPackageResultSchema, {
22029
- kind: "mutation",
22030
- auth: "admin"
22031
22496
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
22032
22497
  kind: "mutation",
22033
22498
  auth: "admin"
@@ -22893,10 +23358,10 @@ var TopologyCategorySchema = object({
22893
23358
  addons: array(TopologyCategoryAddonSchema).readonly()
22894
23359
  });
22895
23360
  /**
22896
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
22897
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
22898
- * version visibility for the Server management surface. Nullable: offline
22899
- * rows and pre-phase-2 nodes report none.
23361
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
23362
+ * root package for every node role) as reported by its `registerNode`
23363
+ * manifest — version visibility for the Server management surface. Nullable:
23364
+ * offline rows and nodes that never reported one.
22900
23365
  */
22901
23366
  var TopologyRootPackageSchema = object({
22902
23367
  name: string(),
@@ -23284,17 +23749,28 @@ var PlatformScoreSchema = object({
23284
23749
  format: _enum([
23285
23750
  "onnx",
23286
23751
  "coreml",
23287
- "openvino"
23752
+ "openvino",
23753
+ "tflite"
23288
23754
  ]),
23289
23755
  score: number(),
23290
23756
  reason: string(),
23291
23757
  available: boolean()
23292
23758
  });
23759
+ var InferenceDeviceDescriptorSchema = object({
23760
+ key: string(),
23761
+ backend: string(),
23762
+ device: string(),
23763
+ format: ModelFormatSchema,
23764
+ runtime: literal("python"),
23765
+ score: number(),
23766
+ available: boolean()
23767
+ });
23293
23768
  var PlatformCapabilitiesSchema = object({
23294
23769
  hardware: HardwareInfoSchema,
23295
23770
  scores: array(PlatformScoreSchema).readonly(),
23296
23771
  bestScore: PlatformScoreSchema,
23297
- pythonPath: string().nullable()
23772
+ pythonPath: string().nullable(),
23773
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
23298
23774
  });
23299
23775
  var ModelRequirementSchema = object({
23300
23776
  modelId: string(),
@@ -24173,12 +24649,6 @@ Object.freeze({
24173
24649
  addonId: null,
24174
24650
  access: "delete"
24175
24651
  },
24176
- "addons.updateFrameworkPackage": {
24177
- capName: "addons",
24178
- capScope: "system",
24179
- addonId: null,
24180
- access: "create"
24181
- },
24182
24652
  "addons.updatePackage": {
24183
24653
  capName: "addons",
24184
24654
  capScope: "system",
@@ -26951,12 +27421,6 @@ Object.freeze({
26951
27421
  addonId: null,
26952
27422
  access: "view"
26953
27423
  },
26954
- "pipelineExecutor.reprobeEngine": {
26955
- capName: "pipeline-executor",
26956
- capScope: "system",
26957
- addonId: null,
26958
- access: "create"
26959
- },
26960
27424
  "pipelineExecutor.runAudioTest": {
26961
27425
  capName: "pipeline-executor",
26962
27426
  capScope: "system",
@@ -27107,6 +27571,12 @@ Object.freeze({
27107
27571
  addonId: null,
27108
27572
  access: "view"
27109
27573
  },
27574
+ "pipelineOrchestrator.getNodeInferenceDevices": {
27575
+ capName: "pipeline-orchestrator",
27576
+ capScope: "system",
27577
+ addonId: null,
27578
+ access: "view"
27579
+ },
27110
27580
  "pipelineOrchestrator.getPipelineAssignment": {
27111
27581
  capName: "pipeline-orchestrator",
27112
27582
  capScope: "system",
@@ -27119,6 +27589,12 @@ Object.freeze({
27119
27589
  addonId: null,
27120
27590
  access: "view"
27121
27591
  },
27592
+ "pipelineOrchestrator.getPipelineDevicePin": {
27593
+ capName: "pipeline-orchestrator",
27594
+ capScope: "system",
27595
+ addonId: null,
27596
+ access: "view"
27597
+ },
27122
27598
  "pipelineOrchestrator.listAgentSettings": {
27123
27599
  capName: "pipeline-orchestrator",
27124
27600
  capScope: "system",
@@ -27161,19 +27637,19 @@ Object.freeze({
27161
27637
  addonId: null,
27162
27638
  access: "create"
27163
27639
  },
27164
- "pipelineOrchestrator.setAgentAddonDefaults": {
27640
+ "pipelineOrchestrator.setAgentCapabilities": {
27165
27641
  capName: "pipeline-orchestrator",
27166
27642
  capScope: "system",
27167
27643
  addonId: null,
27168
27644
  access: "create"
27169
27645
  },
27170
- "pipelineOrchestrator.setAgentCapabilities": {
27646
+ "pipelineOrchestrator.setAgentDetectWeight": {
27171
27647
  capName: "pipeline-orchestrator",
27172
27648
  capScope: "system",
27173
27649
  addonId: null,
27174
27650
  access: "create"
27175
27651
  },
27176
- "pipelineOrchestrator.setAgentDetectWeight": {
27652
+ "pipelineOrchestrator.setAgentInferenceDevices": {
27177
27653
  capName: "pipeline-orchestrator",
27178
27654
  capScope: "system",
27179
27655
  addonId: null,
@@ -27215,6 +27691,12 @@ Object.freeze({
27215
27691
  addonId: null,
27216
27692
  access: "create"
27217
27693
  },
27694
+ "pipelineOrchestrator.setPipelineDevicePin": {
27695
+ capName: "pipeline-orchestrator",
27696
+ capScope: "system",
27697
+ addonId: null,
27698
+ access: "create"
27699
+ },
27218
27700
  "pipelineOrchestrator.unassignAudio": {
27219
27701
  capName: "pipeline-orchestrator",
27220
27702
  capScope: "system",
@@ -28767,32 +29249,6 @@ Object.freeze({
28767
29249
  "network-access": "ingress",
28768
29250
  "smtp-provider": "email"
28769
29251
  });
28770
- var frameworkSwapPackageSchema = object({
28771
- name: string(),
28772
- stagedPath: string(),
28773
- backupPath: string(),
28774
- toVersion: string(),
28775
- fromVersion: string().nullable()
28776
- });
28777
- object({
28778
- jobId: string(),
28779
- taskId: string(),
28780
- packages: array(frameworkSwapPackageSchema),
28781
- requestedAtMs: number(),
28782
- schemaVersion: literal(1)
28783
- });
28784
- object({
28785
- jobId: string(),
28786
- taskId: string(),
28787
- backups: array(object({
28788
- name: string(),
28789
- backupPath: string(),
28790
- livePath: string()
28791
- })),
28792
- appliedAtMs: number(),
28793
- bootAttempts: number(),
28794
- schemaVersion: literal(1)
28795
- });
28796
29252
  //#endregion
28797
29253
  //#region src/config.ts
28798
29254
  /**