@camstack/addon-agent-ui 1.1.28 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -7078,6 +7078,17 @@ var ModelCatalogEntrySchema = object({
7078
7078
  "imagenet",
7079
7079
  "none"
7080
7080
  ]).optional(),
7081
+ /**
7082
+ * The model already applies softmax IN-GRAPH — its raw output is a
7083
+ * probability distribution, not logits. When set, the `softmax`
7084
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7085
+ * probability vector collapses it toward uniform (top-1 score craters far
7086
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7087
+ * the output is raw logits and the postprocessor applies softmax (the normal
7088
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7089
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7090
+ */
7091
+ outputProbabilities: boolean().optional(),
7081
7092
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7082
7093
  /**
7083
7094
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7637,6 +7648,160 @@ var EncodeProfileSchema = object({
7637
7648
  */
7638
7649
  outputArgs: array(string()).optional()
7639
7650
  });
7651
+ var COCO_TO_MACRO = {
7652
+ mapping: {
7653
+ person: "person",
7654
+ bicycle: "vehicle",
7655
+ car: "vehicle",
7656
+ motorcycle: "vehicle",
7657
+ airplane: "vehicle",
7658
+ bus: "vehicle",
7659
+ train: "vehicle",
7660
+ truck: "vehicle",
7661
+ boat: "vehicle",
7662
+ bird: "animal",
7663
+ cat: "animal",
7664
+ dog: "animal",
7665
+ horse: "animal",
7666
+ sheep: "animal",
7667
+ cow: "animal",
7668
+ elephant: "animal",
7669
+ bear: "animal",
7670
+ zebra: "animal",
7671
+ giraffe: "animal",
7672
+ suitcase: "package",
7673
+ backpack: "package",
7674
+ handbag: "package"
7675
+ },
7676
+ preserveOriginal: false
7677
+ };
7678
+ var AUDIO_MACRO_LABELS = [
7679
+ {
7680
+ id: "speech",
7681
+ name: "Speech",
7682
+ icon: "🗣️"
7683
+ },
7684
+ {
7685
+ id: "scream",
7686
+ name: "Scream / Shout",
7687
+ icon: "😱"
7688
+ },
7689
+ {
7690
+ id: "crying",
7691
+ name: "Crying / Baby",
7692
+ icon: "😢"
7693
+ },
7694
+ {
7695
+ id: "laughter",
7696
+ name: "Laughter",
7697
+ icon: "😂"
7698
+ },
7699
+ {
7700
+ id: "music",
7701
+ name: "Music",
7702
+ icon: "🎵"
7703
+ },
7704
+ {
7705
+ id: "dog",
7706
+ name: "Dog",
7707
+ icon: "🐕"
7708
+ },
7709
+ {
7710
+ id: "cat",
7711
+ name: "Cat",
7712
+ icon: "🐈"
7713
+ },
7714
+ {
7715
+ id: "bird",
7716
+ name: "Bird",
7717
+ icon: "🐦"
7718
+ },
7719
+ {
7720
+ id: "animal",
7721
+ name: "Animal (other)",
7722
+ icon: "🐾"
7723
+ },
7724
+ {
7725
+ id: "alarm",
7726
+ name: "Alarm / Siren",
7727
+ icon: "🚨"
7728
+ },
7729
+ {
7730
+ id: "doorbell",
7731
+ name: "Doorbell / Knock",
7732
+ icon: "🔔"
7733
+ },
7734
+ {
7735
+ id: "glass_breaking",
7736
+ name: "Glass Breaking",
7737
+ icon: "💥"
7738
+ },
7739
+ {
7740
+ id: "gunshot",
7741
+ name: "Gunshot / Explosion",
7742
+ icon: "💣"
7743
+ },
7744
+ {
7745
+ id: "vehicle",
7746
+ name: "Vehicle",
7747
+ icon: "🚗"
7748
+ },
7749
+ {
7750
+ id: "siren",
7751
+ name: "Emergency Siren",
7752
+ icon: "🚑"
7753
+ },
7754
+ {
7755
+ id: "fire",
7756
+ name: "Fire / Smoke",
7757
+ icon: "🔥"
7758
+ },
7759
+ {
7760
+ id: "water",
7761
+ name: "Water",
7762
+ icon: "💧"
7763
+ },
7764
+ {
7765
+ id: "wind",
7766
+ name: "Wind / Weather",
7767
+ icon: "🌬️"
7768
+ },
7769
+ {
7770
+ id: "door",
7771
+ name: "Door",
7772
+ icon: "🚪"
7773
+ },
7774
+ {
7775
+ id: "footsteps",
7776
+ name: "Footsteps",
7777
+ icon: "👣"
7778
+ },
7779
+ {
7780
+ id: "crowd",
7781
+ name: "Crowd / Chatter",
7782
+ icon: "👥"
7783
+ },
7784
+ {
7785
+ id: "telephone",
7786
+ name: "Telephone",
7787
+ icon: "📞"
7788
+ },
7789
+ {
7790
+ id: "engine",
7791
+ name: "Engine / Motor",
7792
+ icon: "⚙️"
7793
+ },
7794
+ {
7795
+ id: "tools",
7796
+ name: "Tools / Construction",
7797
+ icon: "🔨"
7798
+ },
7799
+ {
7800
+ id: "silence",
7801
+ name: "Silence",
7802
+ icon: "🤫"
7803
+ }
7804
+ ];
7640
7805
  var YAMNET_TO_MACRO = {
7641
7806
  mapping: {
7642
7807
  Speech: "speech",
@@ -7903,6 +8068,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7903
8068
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7904
8069
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7905
8070
  /**
8071
+ * Unified event-kind taxonomy — THE single source of truth for
8072
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8073
+ * icon }`.
8074
+ *
8075
+ * This dictionary folds together what used to be scattered across four
8076
+ * copies:
8077
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8078
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8079
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8080
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8081
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8082
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8083
+ *
8084
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8085
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8086
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8087
+ * color or an icon: they read this dictionary (server descriptors carry the
8088
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8089
+ *
8090
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8091
+ */
8092
+ var TAXONOMY_COLORS = {
8093
+ motion: "#f59e0b",
8094
+ audio: "#06b6d4",
8095
+ person: "#22c55e",
8096
+ vehicle: "#3b82f6",
8097
+ animal: "#f97316",
8098
+ package: "#a855f7",
8099
+ sensor: "#8b5cf6",
8100
+ control: "#10b981",
8101
+ genericDetection: "#64748b"
8102
+ };
8103
+ var DETECTION_SUB_COLORS = {
8104
+ car: "#f59e0b",
8105
+ truck: "#d97706",
8106
+ bus: "#b45309",
8107
+ motorcycle: "#eab308",
8108
+ bicycle: "#ca8a04",
8109
+ airplane: "#60a5fa",
8110
+ boat: "#2563eb",
8111
+ train: "#1d4ed8",
8112
+ bird: "#14b8a6",
8113
+ dog: "#84cc16",
8114
+ cat: "#f97316",
8115
+ horse: "#a16207",
8116
+ sheep: "#a3a3a3",
8117
+ cow: "#78716c",
8118
+ elephant: "#6b7280",
8119
+ bear: "#7c2d12",
8120
+ zebra: "#404040",
8121
+ giraffe: "#d4a373"
8122
+ };
8123
+ function titleCase(id) {
8124
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8125
+ }
8126
+ var entries = /* @__PURE__ */ new Map();
8127
+ function macro(kind, category, color, iconId, label) {
8128
+ entries.set(kind, {
8129
+ kind,
8130
+ parentKind: null,
8131
+ level: "macro",
8132
+ category,
8133
+ color,
8134
+ iconId,
8135
+ labelKey: `eventKind.${kind}`,
8136
+ label
8137
+ });
8138
+ }
8139
+ function sub(kind, parentKind, category, color, iconId, label) {
8140
+ entries.set(kind, {
8141
+ kind,
8142
+ parentKind,
8143
+ level: "sub",
8144
+ category,
8145
+ color,
8146
+ iconId,
8147
+ labelKey: `eventKind.${kind}`,
8148
+ label
8149
+ });
8150
+ }
8151
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8152
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8153
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8154
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8155
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8156
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8157
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8158
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8159
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8160
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8161
+ if (entries.has(cocoClass)) continue;
8162
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8163
+ }
8164
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8165
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8166
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8167
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8168
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8169
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8170
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8171
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8172
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8173
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8174
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8175
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8176
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8177
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8178
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8179
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8180
+ sub("button", "control", "control", "#10b981", "button", "Button");
8181
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8182
+ for (const l of AUDIO_MACRO_LABELS) {
8183
+ const kind = `audio-${l.id}`;
8184
+ if (entries.has(kind)) continue;
8185
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8186
+ }
8187
+ /** The complete taxonomy dictionary, keyed by kind. */
8188
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8189
+ /**
7906
8190
  * Error types for the safe expression engine. Two distinct classes so callers
7907
8191
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7908
8192
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10818,10 +11102,7 @@ var ConfigUISchemaNullableBridge = custom();
10818
11102
  var InferenceCapabilitiesBridge = custom();
10819
11103
  var ModelAvailabilityListBridge = custom();
10820
11104
  var PipelineRunResultBridge = custom();
10821
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10822
- kind: "mutation",
10823
- auth: "admin"
10824
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11105
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10825
11106
  modelId: string(),
10826
11107
  settings: record(string(), unknown()).readonly()
10827
11108
  }))), method(object({ steps: record(string(), object({
@@ -10881,13 +11162,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10881
11162
  * (inputClasses ≠ null) are skipped and served per-track via
10882
11163
  * pipelineRunner.runDetailSubtree (two-plane design).
10883
11164
  */
10884
- plane: _enum(["full", "frame"]).optional()
11165
+ plane: _enum(["full", "frame"]).optional(),
11166
+ /**
11167
+ * Inference-device selector (Phase 2 multi-device). Format
11168
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11169
+ * Omitted ⇒ the runner's default device (current single-engine
11170
+ * behaviour). Selects WHICH device pool of the node runs the call.
11171
+ */
11172
+ deviceKey: string().optional()
10885
11173
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10886
11174
  engine: PipelineEngineChoiceSchema.optional(),
10887
11175
  steps: array(PipelineStepInputSchema).min(1),
10888
11176
  frames: array(FrameInputSchema).min(1).max(255),
10889
11177
  deviceId: number().optional(),
10890
- sessionId: string().optional()
11178
+ sessionId: string().optional(),
11179
+ /**
11180
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11181
+ * the batch to the Python pool's bench preprocess cache
11182
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11183
+ * preprocessed ONCE and every later inference is a pure-inference cache
11184
+ * hit — the sustained-throughput run measures inference, not
11185
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11186
+ * full preprocess every call, correct). Fresh per sustained run;
11187
+ * released via `uncacheFrame`.
11188
+ */
11189
+ frameId: number().int().nonnegative().optional(),
11190
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11191
+ deviceKey: string().optional()
10891
11192
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10892
11193
  data: _instanceof(Uint8Array),
10893
11194
  width: number().int().positive(),
@@ -10919,8 +11220,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10919
11220
  * - `runtime` — main camera-serving engine (no idle TTL).
10920
11221
  * - `warm-override` — benchmark/test override held in the warm
10921
11222
  * cache; auto-disposed after the idle TTL.
11223
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11224
+ * multi-device, keyed by `deviceKey`) resolved
11225
+ * via `resolveDeviceFactory`. Runs alongside the
11226
+ * `runtime` engine on a DIFFERENT accelerator
11227
+ * (NPU / iGPU / Coral) — this is how the
11228
+ * Engines tab shows all pools running at once.
10922
11229
  */
10923
- kind: _enum(["runtime", "warm-override"]),
11230
+ kind: _enum([
11231
+ "runtime",
11232
+ "warm-override",
11233
+ "device-pool"
11234
+ ]),
10924
11235
  /** Native pid of the underlying Python pool (null when no pool). */
10925
11236
  poolPid: number().nullable(),
10926
11237
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11262,7 +11573,14 @@ var RunnerCameraConfigSchema = object({
11262
11573
  * camera's detect node differs from its source-owner (P2d, gated by the
11263
11574
  * `remoteSourcingNodes` rollout setting).
11264
11575
  */
11265
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11576
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11577
+ /**
11578
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11579
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11580
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11581
+ * this only selects WHICH device pool of that node runs the session.
11582
+ */
11583
+ deviceKey: string().optional()
11266
11584
  });
11267
11585
  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;
11268
11586
  /**
@@ -11283,6 +11601,19 @@ var RunnerLocalLoadSchema = object({
11283
11601
  avgInferenceTimeMs: number(),
11284
11602
  /** Total queue depth across motion + detection queues. */
11285
11603
  queueDepthTotal: number(),
11604
+ /**
11605
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11606
+ * this runner currently has attached cameras on, so the orchestrator's second
11607
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11608
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11609
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11610
+ */
11611
+ devices: array(object({
11612
+ deviceKey: string(),
11613
+ backend: string(),
11614
+ attachedCameras: number(),
11615
+ queueDepthTotal: number()
11616
+ })).default([]),
11286
11617
  /** Hardware capability flags reported by this node. */
11287
11618
  hardware: object({
11288
11619
  hasGpu: boolean(),
@@ -12758,6 +13089,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12758
13089
  kind: "mutation",
12759
13090
  auth: "admin"
12760
13091
  });
13092
+ 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;
13093
+ new Set(Object.values(DeviceType));
12761
13094
  /**
12762
13095
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12763
13096
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15852,17 +16185,30 @@ var EventKindCategorySchema = _enum([
15852
16185
  "audio",
15853
16186
  "detection",
15854
16187
  "sensor",
16188
+ "control",
15855
16189
  "custom",
15856
16190
  "package"
15857
16191
  ]);
16192
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16193
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15858
16194
  var EventKindDescriptorSchema = object({
15859
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16195
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15860
16196
  kind: string(),
16197
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16198
+ labelKey: string(),
16199
+ /** English fallback label (kept for clients that don't translate). */
15861
16200
  label: string(),
15862
16201
  /** Hex color for timeline/legend rendering. */
15863
16202
  color: string(),
16203
+ /** Dictionary id → lucide component on the UI side. */
16204
+ iconId: string(),
16205
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15864
16206
  icon: EventKindIconSchema,
15865
16207
  category: EventKindCategorySchema,
16208
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16209
+ parentKind: string().nullable(),
16210
+ /** Derived from `parentKind`, explicit for the client tree. */
16211
+ level: EventKindLevelSchema,
15866
16212
  /** Which cap + device contributes this kind. For built-ins the camera
15867
16213
  * itself; for sensor kinds the LINKED source device. */
15868
16214
  source: object({
@@ -15935,11 +16281,21 @@ var TrackAudioLabelSchema = object({
15935
16281
  firstAt: number(),
15936
16282
  lastAt: number()
15937
16283
  });
16284
+ /**
16285
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16286
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16287
+ * linked sensor/control state change (no positions; carries a snapshot). The
16288
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16289
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16290
+ */
16291
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
15938
16292
  var TrackSchema = object({
15939
16293
  trackId: string(),
15940
16294
  deviceId: number(),
15941
16295
  className: string(),
15942
16296
  label: string().optional(),
16297
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16298
+ source: TrackSourceSchema.optional(),
15943
16299
  firstSeen: number(),
15944
16300
  lastSeen: number(),
15945
16301
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16316,6 +16672,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16316
16672
  eventId: string(),
16317
16673
  timestamp: number()
16318
16674
  });
16675
+ /**
16676
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16677
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16678
+ * caps into per-camera event-kind descriptors.
16679
+ *
16680
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16681
+ * is NOT duplicated here — every entry is derived from the single
16682
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16683
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16684
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16685
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16686
+ * eventful cap is missing.
16687
+ */
16688
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16689
+ var LEGACY_ICON = {
16690
+ motion: "motion",
16691
+ audio: "audio",
16692
+ person: "person",
16693
+ vehicle: "vehicle",
16694
+ animal: "animal",
16695
+ package: "package",
16696
+ door: "door",
16697
+ pir: "pir",
16698
+ smoke: "smoke",
16699
+ water: "water",
16700
+ button: "button",
16701
+ generic: "generic",
16702
+ gas: "smoke",
16703
+ vibration: "generic",
16704
+ tamper: "generic",
16705
+ presence: "person",
16706
+ lock: "generic",
16707
+ siren: "generic",
16708
+ switch: "generic",
16709
+ doorbell: "button"
16710
+ };
16711
+ function legacyIcon(iconId) {
16712
+ return LEGACY_ICON[iconId] ?? "generic";
16713
+ }
16714
+ /**
16715
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16716
+ * The anti-drift guard cross-checks this against the eventful caps declared
16717
+ * in `packages/types/src/capabilities/*.cap.ts`.
16718
+ */
16719
+ var CAP_TO_KIND = {
16720
+ contact: "contact",
16721
+ motion: "motion-sensor",
16722
+ smoke: "smoke",
16723
+ flood: "flood",
16724
+ gas: "gas",
16725
+ "carbon-monoxide": "carbon-monoxide",
16726
+ vibration: "vibration",
16727
+ tamper: "tamper",
16728
+ presence: "presence",
16729
+ "enum-sensor": "enum-sensor",
16730
+ "event-emitter": "device-event",
16731
+ "lock-control": "lock",
16732
+ switch: "switch",
16733
+ button: "button",
16734
+ doorbell: "doorbell"
16735
+ };
16736
+ function buildDescriptor(capName, kind) {
16737
+ const t = EVENT_TAXONOMY[kind];
16738
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16739
+ return {
16740
+ ...t,
16741
+ icon: legacyIcon(t.iconId)
16742
+ };
16743
+ }
16744
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16319
16745
  var CameraPipelineConfigSchema = object({
16320
16746
  engine: PipelineEngineChoiceSchema.optional(),
16321
16747
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16334,13 +16760,11 @@ var PipelineTemplateSchema = object({
16334
16760
  createdAt: string(),
16335
16761
  updatedAt: string()
16336
16762
  });
16337
- var AgentAddonConfigSchema = object({
16338
- enabled: boolean(),
16763
+ var DeviceStepConfigSchema = object({
16339
16764
  modelId: string().optional(),
16340
- settings: record(string(), unknown()).readonly()
16765
+ settings: record(string(), unknown()).optional()
16341
16766
  });
16342
16767
  var AgentPipelineSettingsSchema = object({
16343
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16344
16768
  maxCameras: number().int().nonnegative().nullable().default(null),
16345
16769
  /** Per-node detection weight (relative share for the quota balancer). */
16346
16770
  detectWeight: number().positive().optional(),
@@ -16364,7 +16788,22 @@ var AgentPipelineSettingsSchema = object({
16364
16788
  * it already uses to reach the hub). Set this only when the auto-detected
16365
16789
  * address is wrong (multi-homed host, NAT, custom interface).
16366
16790
  */
16367
- reachableHost: string().optional()
16791
+ reachableHost: string().optional(),
16792
+ /**
16793
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16794
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16795
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16796
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16797
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16798
+ * the default model/settings for every camera landing on that accelerator;
16799
+ * a stepId absent ⇒ the step uses that device's format default.
16800
+ */
16801
+ inferenceDevices: record(string(), object({
16802
+ enabled: boolean(),
16803
+ weight: number().positive().optional(),
16804
+ maxSessions: number().int().positive().optional(),
16805
+ steps: record(string(), DeviceStepConfigSchema).optional()
16806
+ })).optional()
16368
16807
  });
16369
16808
  var CameraPipelineForAgentSchema = object({
16370
16809
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16374,14 +16813,13 @@ var CameraPipelineForAgentSchema = object({
16374
16813
  }).nullable()
16375
16814
  });
16376
16815
  var CameraStepOverridePatchSchema = object({
16377
- enabled: boolean().optional(),
16378
16816
  modelId: string().optional(),
16379
16817
  settings: record(string(), unknown()).readonly().optional()
16380
16818
  });
16381
16819
  var CameraPipelineSettingsSchema = object({
16382
16820
  pinnedAgentNodeId: string().optional(),
16383
16821
  stepToggles: record(string(), boolean()).optional(),
16384
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16822
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16385
16823
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16386
16824
  });
16387
16825
  /**
@@ -16595,6 +17033,44 @@ var CameraStatusSchema = object({
16595
17033
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16596
17034
  fetchedAt: number()
16597
17035
  });
17036
+ var NodeInferenceDeviceSchema = object({
17037
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17038
+ key: string(),
17039
+ backend: string(),
17040
+ device: string(),
17041
+ format: _enum(MODEL_FORMATS),
17042
+ /** Whether the node's live probe reports the device as usable right now. */
17043
+ available: boolean(),
17044
+ /**
17045
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17046
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17047
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17048
+ * not a balanced target). An explicit stored value always wins; a stored-only
17049
+ * (unavailable) key keeps its stored value.
17050
+ */
17051
+ enabled: boolean(),
17052
+ /** Relative balancer weight for the enabled device (default 1). */
17053
+ weight: number(),
17054
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17055
+ maxSessions: number().nullable(),
17056
+ /** Object-detection model the executor defaults to for this deviceKey. */
17057
+ defaultModelId: string(),
17058
+ /**
17059
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17060
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17061
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17062
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17063
+ * available per format; this is the stored selection that becomes the
17064
+ * default for EVERY camera landing on this accelerator.
17065
+ */
17066
+ steps: record(string(), DeviceStepConfigSchema).optional()
17067
+ });
17068
+ var NodeInferenceDevicesSchema = object({
17069
+ nodeId: string(),
17070
+ /** False when the node's platform-probe was unreachable (no live device set). */
17071
+ reachable: boolean(),
17072
+ devices: array(NodeInferenceDeviceSchema).readonly()
17073
+ });
16598
17074
  method(object({
16599
17075
  deviceId: number(),
16600
17076
  agentNodeId: string()
@@ -16604,7 +17080,13 @@ method(object({
16604
17080
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16605
17081
  kind: "mutation",
16606
17082
  auth: "admin"
16607
- }), method(_void(), object({ migrated: number() }), {
17083
+ }), method(object({
17084
+ deviceId: number(),
17085
+ deviceKey: string()
17086
+ }), object({ success: literal(true) }), {
17087
+ kind: "mutation",
17088
+ auth: "admin"
17089
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16608
17090
  kind: "mutation",
16609
17091
  auth: "admin"
16610
17092
  }), 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({
@@ -16638,13 +17120,7 @@ method(object({
16638
17120
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16639
17121
  nodeId: string(),
16640
17122
  settings: AgentPipelineSettingsSchema
16641
- })).readonly()), method(object({
16642
- agentNodeId: string(),
16643
- defaults: record(string(), AgentAddonConfigSchema)
16644
- }), object({ success: literal(true) }), {
16645
- kind: "mutation",
16646
- auth: "admin"
16647
- }), method(object({ agentNodeId: string() }), object({
17123
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16648
17124
  success: boolean(),
16649
17125
  removed: boolean()
16650
17126
  }), {
@@ -16676,7 +17152,18 @@ method(object({
16676
17152
  }), object({ success: literal(true) }), {
16677
17153
  kind: "mutation",
16678
17154
  auth: "admin"
16679
- }), method(object({ agentNodeId: string() }), object({
17155
+ }), method(object({
17156
+ agentNodeId: string(),
17157
+ inferenceDevices: record(string(), object({
17158
+ enabled: boolean(),
17159
+ weight: number().positive().optional(),
17160
+ maxSessions: number().int().positive().optional(),
17161
+ steps: record(string(), DeviceStepConfigSchema).optional()
17162
+ }))
17163
+ }), object({ success: literal(true) }), {
17164
+ kind: "mutation",
17165
+ auth: "admin"
17166
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16680
17167
  success: literal(true),
16681
17168
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16682
17169
  effectiveModelId: string().nullable(),
@@ -16692,9 +17179,10 @@ method(object({
16692
17179
  }), object({ success: literal(true) }), {
16693
17180
  kind: "mutation",
16694
17181
  auth: "admin"
16695
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17182
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16696
17183
  deviceId: number(),
16697
17184
  agentNodeId: string(),
17185
+ deviceKey: string(),
16698
17186
  addonId: string(),
16699
17187
  patch: CameraStepOverridePatchSchema.nullable()
16700
17188
  }), object({ success: literal(true) }), {
@@ -16731,14 +17219,13 @@ method(object({
16731
17219
  });
16732
17220
  /**
16733
17221
  * server-management — per-NODE singleton capability for a node's ROOT
16734
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16735
- * agents).
17222
+ * package lifecycle (runtime-updatable node packages).
16736
17223
  *
16737
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16738
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16739
- * version describes the node. Updates install into
16740
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16741
- * starter (probation boot + auto-rollback to N-1).
17224
+ * Every node role runs the SAME root package (`@camstack/server`), which
17225
+ * carries the whole software stack in its npm dep tree, so ONE version
17226
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17227
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17228
+ * no auto-rollback).
16742
17229
  *
16743
17230
  * Providers:
16744
17231
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16846,7 +17333,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16846
17333
  /** Explicit target version; omitted = latest from the registry. */
16847
17334
  version: string().optional() }), ServerUpdateActionResultSchema, {
16848
17335
  kind: "mutation",
16849
- auth: "admin"
17336
+ auth: "admin",
17337
+ timeoutMs: 16 * 6e4
16850
17338
  }), method(_void(), ServerUpdateActionResultSchema, {
16851
17339
  kind: "mutation",
16852
17340
  auth: "admin"
@@ -17890,22 +18378,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17890
18378
  var RestartAddonResultSchema = unknown();
17891
18379
  var InstallPackageResultSchema = unknown();
17892
18380
  var ReloadPackagesResultSchema = unknown();
17893
- /**
17894
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
17895
- * server restarts so the admin UI can react to the `restartingAt`
17896
- * timestamp (shows reconnect overlay). The transition from
17897
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
17898
- * `system.restart-completed` event after the new process boots.
17899
- *
17900
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
17901
- */
17902
- var UpdateFrameworkPackageResultSchema = object({
17903
- packageName: string(),
17904
- fromVersion: string(),
17905
- toVersion: string(),
17906
- /** Ms-epoch the server scheduled its self-restart. */
17907
- restartingAt: number()
17908
- });
17909
18381
  var BulkUpdateItemStatusSchema = _enum([
17910
18382
  "queued",
17911
18383
  "updating",
@@ -18033,13 +18505,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18033
18505
  }), object({ success: literal(true) }), {
18034
18506
  kind: "mutation",
18035
18507
  auth: "admin"
18036
- }), method(object({
18037
- packageName: string().min(1),
18038
- version: string().optional(),
18039
- deferRestart: boolean().optional()
18040
- }), UpdateFrameworkPackageResultSchema, {
18041
- kind: "mutation",
18042
- auth: "admin"
18043
18508
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18044
18509
  kind: "mutation",
18045
18510
  auth: "admin"
@@ -18905,10 +19370,10 @@ var TopologyCategorySchema = object({
18905
19370
  addons: array(TopologyCategoryAddonSchema).readonly()
18906
19371
  });
18907
19372
  /**
18908
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
18909
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
18910
- * version visibility for the Server management surface. Nullable: offline
18911
- * rows and pre-phase-2 nodes report none.
19373
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19374
+ * root package for every node role) as reported by its `registerNode`
19375
+ * manifest — version visibility for the Server management surface. Nullable:
19376
+ * offline rows and nodes that never reported one.
18912
19377
  */
18913
19378
  var TopologyRootPackageSchema = object({
18914
19379
  name: string(),
@@ -19296,17 +19761,28 @@ var PlatformScoreSchema = object({
19296
19761
  format: _enum([
19297
19762
  "onnx",
19298
19763
  "coreml",
19299
- "openvino"
19764
+ "openvino",
19765
+ "tflite"
19300
19766
  ]),
19301
19767
  score: number(),
19302
19768
  reason: string(),
19303
19769
  available: boolean()
19304
19770
  });
19771
+ var InferenceDeviceDescriptorSchema = object({
19772
+ key: string(),
19773
+ backend: string(),
19774
+ device: string(),
19775
+ format: ModelFormatSchema,
19776
+ runtime: literal("python"),
19777
+ score: number(),
19778
+ available: boolean()
19779
+ });
19305
19780
  var PlatformCapabilitiesSchema = object({
19306
19781
  hardware: HardwareInfoSchema,
19307
19782
  scores: array(PlatformScoreSchema).readonly(),
19308
19783
  bestScore: PlatformScoreSchema,
19309
- pythonPath: string().nullable()
19784
+ pythonPath: string().nullable(),
19785
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19310
19786
  });
19311
19787
  var ModelRequirementSchema = object({
19312
19788
  modelId: string(),
@@ -20185,12 +20661,6 @@ Object.freeze({
20185
20661
  addonId: null,
20186
20662
  access: "delete"
20187
20663
  },
20188
- "addons.updateFrameworkPackage": {
20189
- capName: "addons",
20190
- capScope: "system",
20191
- addonId: null,
20192
- access: "create"
20193
- },
20194
20664
  "addons.updatePackage": {
20195
20665
  capName: "addons",
20196
20666
  capScope: "system",
@@ -22963,12 +23433,6 @@ Object.freeze({
22963
23433
  addonId: null,
22964
23434
  access: "view"
22965
23435
  },
22966
- "pipelineExecutor.reprobeEngine": {
22967
- capName: "pipeline-executor",
22968
- capScope: "system",
22969
- addonId: null,
22970
- access: "create"
22971
- },
22972
23436
  "pipelineExecutor.runAudioTest": {
22973
23437
  capName: "pipeline-executor",
22974
23438
  capScope: "system",
@@ -23119,6 +23583,12 @@ Object.freeze({
23119
23583
  addonId: null,
23120
23584
  access: "view"
23121
23585
  },
23586
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23587
+ capName: "pipeline-orchestrator",
23588
+ capScope: "system",
23589
+ addonId: null,
23590
+ access: "view"
23591
+ },
23122
23592
  "pipelineOrchestrator.getPipelineAssignment": {
23123
23593
  capName: "pipeline-orchestrator",
23124
23594
  capScope: "system",
@@ -23131,6 +23601,12 @@ Object.freeze({
23131
23601
  addonId: null,
23132
23602
  access: "view"
23133
23603
  },
23604
+ "pipelineOrchestrator.getPipelineDevicePin": {
23605
+ capName: "pipeline-orchestrator",
23606
+ capScope: "system",
23607
+ addonId: null,
23608
+ access: "view"
23609
+ },
23134
23610
  "pipelineOrchestrator.listAgentSettings": {
23135
23611
  capName: "pipeline-orchestrator",
23136
23612
  capScope: "system",
@@ -23173,19 +23649,19 @@ Object.freeze({
23173
23649
  addonId: null,
23174
23650
  access: "create"
23175
23651
  },
23176
- "pipelineOrchestrator.setAgentAddonDefaults": {
23652
+ "pipelineOrchestrator.setAgentCapabilities": {
23177
23653
  capName: "pipeline-orchestrator",
23178
23654
  capScope: "system",
23179
23655
  addonId: null,
23180
23656
  access: "create"
23181
23657
  },
23182
- "pipelineOrchestrator.setAgentCapabilities": {
23658
+ "pipelineOrchestrator.setAgentDetectWeight": {
23183
23659
  capName: "pipeline-orchestrator",
23184
23660
  capScope: "system",
23185
23661
  addonId: null,
23186
23662
  access: "create"
23187
23663
  },
23188
- "pipelineOrchestrator.setAgentDetectWeight": {
23664
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23189
23665
  capName: "pipeline-orchestrator",
23190
23666
  capScope: "system",
23191
23667
  addonId: null,
@@ -23227,6 +23703,12 @@ Object.freeze({
23227
23703
  addonId: null,
23228
23704
  access: "create"
23229
23705
  },
23706
+ "pipelineOrchestrator.setPipelineDevicePin": {
23707
+ capName: "pipeline-orchestrator",
23708
+ capScope: "system",
23709
+ addonId: null,
23710
+ access: "create"
23711
+ },
23230
23712
  "pipelineOrchestrator.unassignAudio": {
23231
23713
  capName: "pipeline-orchestrator",
23232
23714
  capScope: "system",
@@ -24779,32 +25261,6 @@ Object.freeze({
24779
25261
  "network-access": "ingress",
24780
25262
  "smtp-provider": "email"
24781
25263
  });
24782
- var frameworkSwapPackageSchema = object({
24783
- name: string(),
24784
- stagedPath: string(),
24785
- backupPath: string(),
24786
- toVersion: string(),
24787
- fromVersion: string().nullable()
24788
- });
24789
- object({
24790
- jobId: string(),
24791
- taskId: string(),
24792
- packages: array(frameworkSwapPackageSchema),
24793
- requestedAtMs: number(),
24794
- schemaVersion: literal(1)
24795
- });
24796
- object({
24797
- jobId: string(),
24798
- taskId: string(),
24799
- backups: array(object({
24800
- name: string(),
24801
- backupPath: string(),
24802
- livePath: string()
24803
- })),
24804
- appliedAtMs: number(),
24805
- bootAttempts: number(),
24806
- schemaVersion: literal(1)
24807
- });
24808
25264
  //#endregion
24809
25265
  //#region src/addon.ts
24810
25266
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -24826,7 +25282,7 @@ var AgentUIAddon = class extends BaseAddon {
24826
25282
  capability: adminUiCapability,
24827
25283
  provider: {
24828
25284
  getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
24829
- getVersion: async () => ({ version: "1.1.28" })
25285
+ getVersion: async () => ({ version: "1.2.0" })
24830
25286
  }
24831
25287
  }];
24832
25288
  }