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