@camstack/addon-mqtt-broker 1.1.27 → 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.
@@ -7108,6 +7108,17 @@ var ModelCatalogEntrySchema = object({
7108
7108
  "imagenet",
7109
7109
  "none"
7110
7110
  ]).optional(),
7111
+ /**
7112
+ * The model already applies softmax IN-GRAPH — its raw output is a
7113
+ * probability distribution, not logits. When set, the `softmax`
7114
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7115
+ * probability vector collapses it toward uniform (top-1 score craters far
7116
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7117
+ * the output is raw logits and the postprocessor applies softmax (the normal
7118
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7119
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7120
+ */
7121
+ outputProbabilities: boolean().optional(),
7111
7122
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7112
7123
  /**
7113
7124
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7667,6 +7678,160 @@ var EncodeProfileSchema = object({
7667
7678
  */
7668
7679
  outputArgs: array(string()).optional()
7669
7680
  });
7681
+ var COCO_TO_MACRO = {
7682
+ mapping: {
7683
+ person: "person",
7684
+ bicycle: "vehicle",
7685
+ car: "vehicle",
7686
+ motorcycle: "vehicle",
7687
+ airplane: "vehicle",
7688
+ bus: "vehicle",
7689
+ train: "vehicle",
7690
+ truck: "vehicle",
7691
+ boat: "vehicle",
7692
+ bird: "animal",
7693
+ cat: "animal",
7694
+ dog: "animal",
7695
+ horse: "animal",
7696
+ sheep: "animal",
7697
+ cow: "animal",
7698
+ elephant: "animal",
7699
+ bear: "animal",
7700
+ zebra: "animal",
7701
+ giraffe: "animal",
7702
+ suitcase: "package",
7703
+ backpack: "package",
7704
+ handbag: "package"
7705
+ },
7706
+ preserveOriginal: false
7707
+ };
7708
+ var AUDIO_MACRO_LABELS = [
7709
+ {
7710
+ id: "speech",
7711
+ name: "Speech",
7712
+ icon: "🗣️"
7713
+ },
7714
+ {
7715
+ id: "scream",
7716
+ name: "Scream / Shout",
7717
+ icon: "😱"
7718
+ },
7719
+ {
7720
+ id: "crying",
7721
+ name: "Crying / Baby",
7722
+ icon: "😢"
7723
+ },
7724
+ {
7725
+ id: "laughter",
7726
+ name: "Laughter",
7727
+ icon: "😂"
7728
+ },
7729
+ {
7730
+ id: "music",
7731
+ name: "Music",
7732
+ icon: "🎵"
7733
+ },
7734
+ {
7735
+ id: "dog",
7736
+ name: "Dog",
7737
+ icon: "🐕"
7738
+ },
7739
+ {
7740
+ id: "cat",
7741
+ name: "Cat",
7742
+ icon: "🐈"
7743
+ },
7744
+ {
7745
+ id: "bird",
7746
+ name: "Bird",
7747
+ icon: "🐦"
7748
+ },
7749
+ {
7750
+ id: "animal",
7751
+ name: "Animal (other)",
7752
+ icon: "🐾"
7753
+ },
7754
+ {
7755
+ id: "alarm",
7756
+ name: "Alarm / Siren",
7757
+ icon: "🚨"
7758
+ },
7759
+ {
7760
+ id: "doorbell",
7761
+ name: "Doorbell / Knock",
7762
+ icon: "🔔"
7763
+ },
7764
+ {
7765
+ id: "glass_breaking",
7766
+ name: "Glass Breaking",
7767
+ icon: "💥"
7768
+ },
7769
+ {
7770
+ id: "gunshot",
7771
+ name: "Gunshot / Explosion",
7772
+ icon: "💣"
7773
+ },
7774
+ {
7775
+ id: "vehicle",
7776
+ name: "Vehicle",
7777
+ icon: "🚗"
7778
+ },
7779
+ {
7780
+ id: "siren",
7781
+ name: "Emergency Siren",
7782
+ icon: "🚑"
7783
+ },
7784
+ {
7785
+ id: "fire",
7786
+ name: "Fire / Smoke",
7787
+ icon: "🔥"
7788
+ },
7789
+ {
7790
+ id: "water",
7791
+ name: "Water",
7792
+ icon: "💧"
7793
+ },
7794
+ {
7795
+ id: "wind",
7796
+ name: "Wind / Weather",
7797
+ icon: "🌬️"
7798
+ },
7799
+ {
7800
+ id: "door",
7801
+ name: "Door",
7802
+ icon: "🚪"
7803
+ },
7804
+ {
7805
+ id: "footsteps",
7806
+ name: "Footsteps",
7807
+ icon: "👣"
7808
+ },
7809
+ {
7810
+ id: "crowd",
7811
+ name: "Crowd / Chatter",
7812
+ icon: "👥"
7813
+ },
7814
+ {
7815
+ id: "telephone",
7816
+ name: "Telephone",
7817
+ icon: "📞"
7818
+ },
7819
+ {
7820
+ id: "engine",
7821
+ name: "Engine / Motor",
7822
+ icon: "⚙️"
7823
+ },
7824
+ {
7825
+ id: "tools",
7826
+ name: "Tools / Construction",
7827
+ icon: "🔨"
7828
+ },
7829
+ {
7830
+ id: "silence",
7831
+ name: "Silence",
7832
+ icon: "🤫"
7833
+ }
7834
+ ];
7670
7835
  var YAMNET_TO_MACRO = {
7671
7836
  mapping: {
7672
7837
  Speech: "speech",
@@ -7933,6 +8098,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7933
8098
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7934
8099
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7935
8100
  /**
8101
+ * Unified event-kind taxonomy — THE single source of truth for
8102
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8103
+ * icon }`.
8104
+ *
8105
+ * This dictionary folds together what used to be scattered across four
8106
+ * copies:
8107
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8108
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8109
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8110
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8111
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8112
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8113
+ *
8114
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8115
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8116
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8117
+ * color or an icon: they read this dictionary (server descriptors carry the
8118
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8119
+ *
8120
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8121
+ */
8122
+ var TAXONOMY_COLORS = {
8123
+ motion: "#f59e0b",
8124
+ audio: "#06b6d4",
8125
+ person: "#22c55e",
8126
+ vehicle: "#3b82f6",
8127
+ animal: "#f97316",
8128
+ package: "#a855f7",
8129
+ sensor: "#8b5cf6",
8130
+ control: "#10b981",
8131
+ genericDetection: "#64748b"
8132
+ };
8133
+ var DETECTION_SUB_COLORS = {
8134
+ car: "#f59e0b",
8135
+ truck: "#d97706",
8136
+ bus: "#b45309",
8137
+ motorcycle: "#eab308",
8138
+ bicycle: "#ca8a04",
8139
+ airplane: "#60a5fa",
8140
+ boat: "#2563eb",
8141
+ train: "#1d4ed8",
8142
+ bird: "#14b8a6",
8143
+ dog: "#84cc16",
8144
+ cat: "#f97316",
8145
+ horse: "#a16207",
8146
+ sheep: "#a3a3a3",
8147
+ cow: "#78716c",
8148
+ elephant: "#6b7280",
8149
+ bear: "#7c2d12",
8150
+ zebra: "#404040",
8151
+ giraffe: "#d4a373"
8152
+ };
8153
+ function titleCase(id) {
8154
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8155
+ }
8156
+ var entries = /* @__PURE__ */ new Map();
8157
+ function macro(kind, category, color, iconId, label) {
8158
+ entries.set(kind, {
8159
+ kind,
8160
+ parentKind: null,
8161
+ level: "macro",
8162
+ category,
8163
+ color,
8164
+ iconId,
8165
+ labelKey: `eventKind.${kind}`,
8166
+ label
8167
+ });
8168
+ }
8169
+ function sub(kind, parentKind, category, color, iconId, label) {
8170
+ entries.set(kind, {
8171
+ kind,
8172
+ parentKind,
8173
+ level: "sub",
8174
+ category,
8175
+ color,
8176
+ iconId,
8177
+ labelKey: `eventKind.${kind}`,
8178
+ label
8179
+ });
8180
+ }
8181
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8182
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8183
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8184
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8185
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8186
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8187
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8188
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8189
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8190
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8191
+ if (entries.has(cocoClass)) continue;
8192
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8193
+ }
8194
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8195
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8196
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8197
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8198
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8199
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8200
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8201
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8202
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8203
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8204
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8205
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8206
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8207
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8208
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8209
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8210
+ sub("button", "control", "control", "#10b981", "button", "Button");
8211
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8212
+ for (const l of AUDIO_MACRO_LABELS) {
8213
+ const kind = `audio-${l.id}`;
8214
+ if (entries.has(kind)) continue;
8215
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8216
+ }
8217
+ /** The complete taxonomy dictionary, keyed by kind. */
8218
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8219
+ /**
7936
8220
  * Error types for the safe expression engine. Two distinct classes so callers
7937
8221
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7938
8222
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10848,10 +11132,7 @@ var ConfigUISchemaNullableBridge = custom();
10848
11132
  var InferenceCapabilitiesBridge = custom();
10849
11133
  var ModelAvailabilityListBridge = custom();
10850
11134
  var PipelineRunResultBridge = custom();
10851
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10852
- kind: "mutation",
10853
- auth: "admin"
10854
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11135
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10855
11136
  modelId: string(),
10856
11137
  settings: record(string(), unknown()).readonly()
10857
11138
  }))), method(object({ steps: record(string(), object({
@@ -10911,13 +11192,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10911
11192
  * (inputClasses ≠ null) are skipped and served per-track via
10912
11193
  * pipelineRunner.runDetailSubtree (two-plane design).
10913
11194
  */
10914
- plane: _enum(["full", "frame"]).optional()
11195
+ plane: _enum(["full", "frame"]).optional(),
11196
+ /**
11197
+ * Inference-device selector (Phase 2 multi-device). Format
11198
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11199
+ * Omitted ⇒ the runner's default device (current single-engine
11200
+ * behaviour). Selects WHICH device pool of the node runs the call.
11201
+ */
11202
+ deviceKey: string().optional()
10915
11203
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10916
11204
  engine: PipelineEngineChoiceSchema.optional(),
10917
11205
  steps: array(PipelineStepInputSchema).min(1),
10918
11206
  frames: array(FrameInputSchema).min(1).max(255),
10919
11207
  deviceId: number().optional(),
10920
- sessionId: string().optional()
11208
+ sessionId: string().optional(),
11209
+ /**
11210
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11211
+ * the batch to the Python pool's bench preprocess cache
11212
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11213
+ * preprocessed ONCE and every later inference is a pure-inference cache
11214
+ * hit — the sustained-throughput run measures inference, not
11215
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11216
+ * full preprocess every call, correct). Fresh per sustained run;
11217
+ * released via `uncacheFrame`.
11218
+ */
11219
+ frameId: number().int().nonnegative().optional(),
11220
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11221
+ deviceKey: string().optional()
10921
11222
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10922
11223
  data: _instanceof(Uint8Array),
10923
11224
  width: number().int().positive(),
@@ -10949,8 +11250,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10949
11250
  * - `runtime` — main camera-serving engine (no idle TTL).
10950
11251
  * - `warm-override` — benchmark/test override held in the warm
10951
11252
  * cache; auto-disposed after the idle TTL.
11253
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11254
+ * multi-device, keyed by `deviceKey`) resolved
11255
+ * via `resolveDeviceFactory`. Runs alongside the
11256
+ * `runtime` engine on a DIFFERENT accelerator
11257
+ * (NPU / iGPU / Coral) — this is how the
11258
+ * Engines tab shows all pools running at once.
10952
11259
  */
10953
- kind: _enum(["runtime", "warm-override"]),
11260
+ kind: _enum([
11261
+ "runtime",
11262
+ "warm-override",
11263
+ "device-pool"
11264
+ ]),
10954
11265
  /** Native pid of the underlying Python pool (null when no pool). */
10955
11266
  poolPid: number().nullable(),
10956
11267
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11292,7 +11603,14 @@ var RunnerCameraConfigSchema = object({
11292
11603
  * camera's detect node differs from its source-owner (P2d, gated by the
11293
11604
  * `remoteSourcingNodes` rollout setting).
11294
11605
  */
11295
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11606
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11607
+ /**
11608
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11609
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11610
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11611
+ * this only selects WHICH device pool of that node runs the session.
11612
+ */
11613
+ deviceKey: string().optional()
11296
11614
  });
11297
11615
  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;
11298
11616
  /**
@@ -11313,6 +11631,19 @@ var RunnerLocalLoadSchema = object({
11313
11631
  avgInferenceTimeMs: number(),
11314
11632
  /** Total queue depth across motion + detection queues. */
11315
11633
  queueDepthTotal: number(),
11634
+ /**
11635
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11636
+ * this runner currently has attached cameras on, so the orchestrator's second
11637
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11638
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11639
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11640
+ */
11641
+ devices: array(object({
11642
+ deviceKey: string(),
11643
+ backend: string(),
11644
+ attachedCameras: number(),
11645
+ queueDepthTotal: number()
11646
+ })).default([]),
11316
11647
  /** Hardware capability flags reported by this node. */
11317
11648
  hardware: object({
11318
11649
  hasGpu: boolean(),
@@ -12788,6 +13119,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12788
13119
  kind: "mutation",
12789
13120
  auth: "admin"
12790
13121
  });
13122
+ 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;
13123
+ new Set(Object.values(DeviceType));
12791
13124
  /**
12792
13125
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12793
13126
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15950,17 +16283,30 @@ var EventKindCategorySchema = _enum([
15950
16283
  "audio",
15951
16284
  "detection",
15952
16285
  "sensor",
16286
+ "control",
15953
16287
  "custom",
15954
16288
  "package"
15955
16289
  ]);
16290
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16291
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15956
16292
  var EventKindDescriptorSchema = object({
15957
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16293
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15958
16294
  kind: string(),
16295
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16296
+ labelKey: string(),
16297
+ /** English fallback label (kept for clients that don't translate). */
15959
16298
  label: string(),
15960
16299
  /** Hex color for timeline/legend rendering. */
15961
16300
  color: string(),
16301
+ /** Dictionary id → lucide component on the UI side. */
16302
+ iconId: string(),
16303
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15962
16304
  icon: EventKindIconSchema,
15963
16305
  category: EventKindCategorySchema,
16306
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16307
+ parentKind: string().nullable(),
16308
+ /** Derived from `parentKind`, explicit for the client tree. */
16309
+ level: EventKindLevelSchema,
15964
16310
  /** Which cap + device contributes this kind. For built-ins the camera
15965
16311
  * itself; for sensor kinds the LINKED source device. */
15966
16312
  source: object({
@@ -16033,11 +16379,21 @@ var TrackAudioLabelSchema = object({
16033
16379
  firstAt: number(),
16034
16380
  lastAt: number()
16035
16381
  });
16382
+ /**
16383
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16384
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16385
+ * linked sensor/control state change (no positions; carries a snapshot). The
16386
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16387
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16388
+ */
16389
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16036
16390
  var TrackSchema = object({
16037
16391
  trackId: string(),
16038
16392
  deviceId: number(),
16039
16393
  className: string(),
16040
16394
  label: string().optional(),
16395
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16396
+ source: TrackSourceSchema.optional(),
16041
16397
  firstSeen: number(),
16042
16398
  lastSeen: number(),
16043
16399
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16414,6 +16770,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16414
16770
  eventId: string(),
16415
16771
  timestamp: number()
16416
16772
  });
16773
+ /**
16774
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16775
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16776
+ * caps into per-camera event-kind descriptors.
16777
+ *
16778
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16779
+ * is NOT duplicated here — every entry is derived from the single
16780
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16781
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16782
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16783
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16784
+ * eventful cap is missing.
16785
+ */
16786
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16787
+ var LEGACY_ICON = {
16788
+ motion: "motion",
16789
+ audio: "audio",
16790
+ person: "person",
16791
+ vehicle: "vehicle",
16792
+ animal: "animal",
16793
+ package: "package",
16794
+ door: "door",
16795
+ pir: "pir",
16796
+ smoke: "smoke",
16797
+ water: "water",
16798
+ button: "button",
16799
+ generic: "generic",
16800
+ gas: "smoke",
16801
+ vibration: "generic",
16802
+ tamper: "generic",
16803
+ presence: "person",
16804
+ lock: "generic",
16805
+ siren: "generic",
16806
+ switch: "generic",
16807
+ doorbell: "button"
16808
+ };
16809
+ function legacyIcon(iconId) {
16810
+ return LEGACY_ICON[iconId] ?? "generic";
16811
+ }
16812
+ /**
16813
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16814
+ * The anti-drift guard cross-checks this against the eventful caps declared
16815
+ * in `packages/types/src/capabilities/*.cap.ts`.
16816
+ */
16817
+ var CAP_TO_KIND = {
16818
+ contact: "contact",
16819
+ motion: "motion-sensor",
16820
+ smoke: "smoke",
16821
+ flood: "flood",
16822
+ gas: "gas",
16823
+ "carbon-monoxide": "carbon-monoxide",
16824
+ vibration: "vibration",
16825
+ tamper: "tamper",
16826
+ presence: "presence",
16827
+ "enum-sensor": "enum-sensor",
16828
+ "event-emitter": "device-event",
16829
+ "lock-control": "lock",
16830
+ switch: "switch",
16831
+ button: "button",
16832
+ doorbell: "doorbell"
16833
+ };
16834
+ function buildDescriptor(capName, kind) {
16835
+ const t = EVENT_TAXONOMY[kind];
16836
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16837
+ return {
16838
+ ...t,
16839
+ icon: legacyIcon(t.iconId)
16840
+ };
16841
+ }
16842
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16417
16843
  var CameraPipelineConfigSchema = object({
16418
16844
  engine: PipelineEngineChoiceSchema.optional(),
16419
16845
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16432,13 +16858,11 @@ var PipelineTemplateSchema = object({
16432
16858
  createdAt: string(),
16433
16859
  updatedAt: string()
16434
16860
  });
16435
- var AgentAddonConfigSchema = object({
16436
- enabled: boolean(),
16861
+ var DeviceStepConfigSchema = object({
16437
16862
  modelId: string().optional(),
16438
- settings: record(string(), unknown()).readonly()
16863
+ settings: record(string(), unknown()).optional()
16439
16864
  });
16440
16865
  var AgentPipelineSettingsSchema = object({
16441
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16442
16866
  maxCameras: number().int().nonnegative().nullable().default(null),
16443
16867
  /** Per-node detection weight (relative share for the quota balancer). */
16444
16868
  detectWeight: number().positive().optional(),
@@ -16462,7 +16886,22 @@ var AgentPipelineSettingsSchema = object({
16462
16886
  * it already uses to reach the hub). Set this only when the auto-detected
16463
16887
  * address is wrong (multi-homed host, NAT, custom interface).
16464
16888
  */
16465
- reachableHost: string().optional()
16889
+ reachableHost: string().optional(),
16890
+ /**
16891
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16892
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16893
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16894
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16895
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16896
+ * the default model/settings for every camera landing on that accelerator;
16897
+ * a stepId absent ⇒ the step uses that device's format default.
16898
+ */
16899
+ inferenceDevices: record(string(), object({
16900
+ enabled: boolean(),
16901
+ weight: number().positive().optional(),
16902
+ maxSessions: number().int().positive().optional(),
16903
+ steps: record(string(), DeviceStepConfigSchema).optional()
16904
+ })).optional()
16466
16905
  });
16467
16906
  var CameraPipelineForAgentSchema = object({
16468
16907
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16472,14 +16911,13 @@ var CameraPipelineForAgentSchema = object({
16472
16911
  }).nullable()
16473
16912
  });
16474
16913
  var CameraStepOverridePatchSchema = object({
16475
- enabled: boolean().optional(),
16476
16914
  modelId: string().optional(),
16477
16915
  settings: record(string(), unknown()).readonly().optional()
16478
16916
  });
16479
16917
  var CameraPipelineSettingsSchema = object({
16480
16918
  pinnedAgentNodeId: string().optional(),
16481
16919
  stepToggles: record(string(), boolean()).optional(),
16482
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16920
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16483
16921
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16484
16922
  });
16485
16923
  /**
@@ -16693,6 +17131,44 @@ var CameraStatusSchema = object({
16693
17131
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16694
17132
  fetchedAt: number()
16695
17133
  });
17134
+ var NodeInferenceDeviceSchema = object({
17135
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17136
+ key: string(),
17137
+ backend: string(),
17138
+ device: string(),
17139
+ format: _enum(MODEL_FORMATS),
17140
+ /** Whether the node's live probe reports the device as usable right now. */
17141
+ available: boolean(),
17142
+ /**
17143
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17144
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17145
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17146
+ * not a balanced target). An explicit stored value always wins; a stored-only
17147
+ * (unavailable) key keeps its stored value.
17148
+ */
17149
+ enabled: boolean(),
17150
+ /** Relative balancer weight for the enabled device (default 1). */
17151
+ weight: number(),
17152
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17153
+ maxSessions: number().nullable(),
17154
+ /** Object-detection model the executor defaults to for this deviceKey. */
17155
+ defaultModelId: string(),
17156
+ /**
17157
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17158
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17159
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17160
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17161
+ * available per format; this is the stored selection that becomes the
17162
+ * default for EVERY camera landing on this accelerator.
17163
+ */
17164
+ steps: record(string(), DeviceStepConfigSchema).optional()
17165
+ });
17166
+ var NodeInferenceDevicesSchema = object({
17167
+ nodeId: string(),
17168
+ /** False when the node's platform-probe was unreachable (no live device set). */
17169
+ reachable: boolean(),
17170
+ devices: array(NodeInferenceDeviceSchema).readonly()
17171
+ });
16696
17172
  method(object({
16697
17173
  deviceId: number(),
16698
17174
  agentNodeId: string()
@@ -16702,7 +17178,13 @@ method(object({
16702
17178
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16703
17179
  kind: "mutation",
16704
17180
  auth: "admin"
16705
- }), method(_void(), object({ migrated: number() }), {
17181
+ }), method(object({
17182
+ deviceId: number(),
17183
+ deviceKey: string()
17184
+ }), object({ success: literal(true) }), {
17185
+ kind: "mutation",
17186
+ auth: "admin"
17187
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16706
17188
  kind: "mutation",
16707
17189
  auth: "admin"
16708
17190
  }), 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({
@@ -16736,13 +17218,7 @@ method(object({
16736
17218
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16737
17219
  nodeId: string(),
16738
17220
  settings: AgentPipelineSettingsSchema
16739
- })).readonly()), method(object({
16740
- agentNodeId: string(),
16741
- defaults: record(string(), AgentAddonConfigSchema)
16742
- }), object({ success: literal(true) }), {
16743
- kind: "mutation",
16744
- auth: "admin"
16745
- }), method(object({ agentNodeId: string() }), object({
17221
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16746
17222
  success: boolean(),
16747
17223
  removed: boolean()
16748
17224
  }), {
@@ -16774,7 +17250,18 @@ method(object({
16774
17250
  }), object({ success: literal(true) }), {
16775
17251
  kind: "mutation",
16776
17252
  auth: "admin"
16777
- }), method(object({ agentNodeId: string() }), object({
17253
+ }), method(object({
17254
+ agentNodeId: string(),
17255
+ inferenceDevices: record(string(), object({
17256
+ enabled: boolean(),
17257
+ weight: number().positive().optional(),
17258
+ maxSessions: number().int().positive().optional(),
17259
+ steps: record(string(), DeviceStepConfigSchema).optional()
17260
+ }))
17261
+ }), object({ success: literal(true) }), {
17262
+ kind: "mutation",
17263
+ auth: "admin"
17264
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16778
17265
  success: literal(true),
16779
17266
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16780
17267
  effectiveModelId: string().nullable(),
@@ -16790,9 +17277,10 @@ method(object({
16790
17277
  }), object({ success: literal(true) }), {
16791
17278
  kind: "mutation",
16792
17279
  auth: "admin"
16793
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17280
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16794
17281
  deviceId: number(),
16795
17282
  agentNodeId: string(),
17283
+ deviceKey: string(),
16796
17284
  addonId: string(),
16797
17285
  patch: CameraStepOverridePatchSchema.nullable()
16798
17286
  }), object({ success: literal(true) }), {
@@ -16829,14 +17317,13 @@ method(object({
16829
17317
  });
16830
17318
  /**
16831
17319
  * server-management — per-NODE singleton capability for a node's ROOT
16832
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16833
- * agents).
17320
+ * package lifecycle (runtime-updatable node packages).
16834
17321
  *
16835
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16836
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16837
- * version describes the node. Updates install into
16838
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16839
- * starter (probation boot + auto-rollback to N-1).
17322
+ * Every node role runs the SAME root package (`@camstack/server`), which
17323
+ * carries the whole software stack in its npm dep tree, so ONE version
17324
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17325
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17326
+ * no auto-rollback).
16840
17327
  *
16841
17328
  * Providers:
16842
17329
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16944,7 +17431,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16944
17431
  /** Explicit target version; omitted = latest from the registry. */
16945
17432
  version: string().optional() }), ServerUpdateActionResultSchema, {
16946
17433
  kind: "mutation",
16947
- auth: "admin"
17434
+ auth: "admin",
17435
+ timeoutMs: 16 * 6e4
16948
17436
  }), method(_void(), ServerUpdateActionResultSchema, {
16949
17437
  kind: "mutation",
16950
17438
  auth: "admin"
@@ -17988,22 +18476,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17988
18476
  var RestartAddonResultSchema = unknown();
17989
18477
  var InstallPackageResultSchema = unknown();
17990
18478
  var ReloadPackagesResultSchema = unknown();
17991
- /**
17992
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
17993
- * server restarts so the admin UI can react to the `restartingAt`
17994
- * timestamp (shows reconnect overlay). The transition from
17995
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
17996
- * `system.restart-completed` event after the new process boots.
17997
- *
17998
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
17999
- */
18000
- var UpdateFrameworkPackageResultSchema = object({
18001
- packageName: string(),
18002
- fromVersion: string(),
18003
- toVersion: string(),
18004
- /** Ms-epoch the server scheduled its self-restart. */
18005
- restartingAt: number()
18006
- });
18007
18479
  var BulkUpdateItemStatusSchema = _enum([
18008
18480
  "queued",
18009
18481
  "updating",
@@ -18131,13 +18603,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18131
18603
  }), object({ success: literal(true) }), {
18132
18604
  kind: "mutation",
18133
18605
  auth: "admin"
18134
- }), method(object({
18135
- packageName: string().min(1),
18136
- version: string().optional(),
18137
- deferRestart: boolean().optional()
18138
- }), UpdateFrameworkPackageResultSchema, {
18139
- kind: "mutation",
18140
- auth: "admin"
18141
18606
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18142
18607
  kind: "mutation",
18143
18608
  auth: "admin"
@@ -19003,10 +19468,10 @@ var TopologyCategorySchema = object({
19003
19468
  addons: array(TopologyCategoryAddonSchema).readonly()
19004
19469
  });
19005
19470
  /**
19006
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
19007
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
19008
- * version visibility for the Server management surface. Nullable: offline
19009
- * rows and pre-phase-2 nodes report none.
19471
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19472
+ * root package for every node role) as reported by its `registerNode`
19473
+ * manifest — version visibility for the Server management surface. Nullable:
19474
+ * offline rows and nodes that never reported one.
19010
19475
  */
19011
19476
  var TopologyRootPackageSchema = object({
19012
19477
  name: string(),
@@ -19394,17 +19859,28 @@ var PlatformScoreSchema = object({
19394
19859
  format: _enum([
19395
19860
  "onnx",
19396
19861
  "coreml",
19397
- "openvino"
19862
+ "openvino",
19863
+ "tflite"
19398
19864
  ]),
19399
19865
  score: number(),
19400
19866
  reason: string(),
19401
19867
  available: boolean()
19402
19868
  });
19869
+ var InferenceDeviceDescriptorSchema = object({
19870
+ key: string(),
19871
+ backend: string(),
19872
+ device: string(),
19873
+ format: ModelFormatSchema,
19874
+ runtime: literal("python"),
19875
+ score: number(),
19876
+ available: boolean()
19877
+ });
19403
19878
  var PlatformCapabilitiesSchema = object({
19404
19879
  hardware: HardwareInfoSchema,
19405
19880
  scores: array(PlatformScoreSchema).readonly(),
19406
19881
  bestScore: PlatformScoreSchema,
19407
- pythonPath: string().nullable()
19882
+ pythonPath: string().nullable(),
19883
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19408
19884
  });
19409
19885
  var ModelRequirementSchema = object({
19410
19886
  modelId: string(),
@@ -20283,12 +20759,6 @@ Object.freeze({
20283
20759
  addonId: null,
20284
20760
  access: "delete"
20285
20761
  },
20286
- "addons.updateFrameworkPackage": {
20287
- capName: "addons",
20288
- capScope: "system",
20289
- addonId: null,
20290
- access: "create"
20291
- },
20292
20762
  "addons.updatePackage": {
20293
20763
  capName: "addons",
20294
20764
  capScope: "system",
@@ -23061,12 +23531,6 @@ Object.freeze({
23061
23531
  addonId: null,
23062
23532
  access: "view"
23063
23533
  },
23064
- "pipelineExecutor.reprobeEngine": {
23065
- capName: "pipeline-executor",
23066
- capScope: "system",
23067
- addonId: null,
23068
- access: "create"
23069
- },
23070
23534
  "pipelineExecutor.runAudioTest": {
23071
23535
  capName: "pipeline-executor",
23072
23536
  capScope: "system",
@@ -23217,6 +23681,12 @@ Object.freeze({
23217
23681
  addonId: null,
23218
23682
  access: "view"
23219
23683
  },
23684
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23685
+ capName: "pipeline-orchestrator",
23686
+ capScope: "system",
23687
+ addonId: null,
23688
+ access: "view"
23689
+ },
23220
23690
  "pipelineOrchestrator.getPipelineAssignment": {
23221
23691
  capName: "pipeline-orchestrator",
23222
23692
  capScope: "system",
@@ -23229,6 +23699,12 @@ Object.freeze({
23229
23699
  addonId: null,
23230
23700
  access: "view"
23231
23701
  },
23702
+ "pipelineOrchestrator.getPipelineDevicePin": {
23703
+ capName: "pipeline-orchestrator",
23704
+ capScope: "system",
23705
+ addonId: null,
23706
+ access: "view"
23707
+ },
23232
23708
  "pipelineOrchestrator.listAgentSettings": {
23233
23709
  capName: "pipeline-orchestrator",
23234
23710
  capScope: "system",
@@ -23271,19 +23747,19 @@ Object.freeze({
23271
23747
  addonId: null,
23272
23748
  access: "create"
23273
23749
  },
23274
- "pipelineOrchestrator.setAgentAddonDefaults": {
23750
+ "pipelineOrchestrator.setAgentCapabilities": {
23275
23751
  capName: "pipeline-orchestrator",
23276
23752
  capScope: "system",
23277
23753
  addonId: null,
23278
23754
  access: "create"
23279
23755
  },
23280
- "pipelineOrchestrator.setAgentCapabilities": {
23756
+ "pipelineOrchestrator.setAgentDetectWeight": {
23281
23757
  capName: "pipeline-orchestrator",
23282
23758
  capScope: "system",
23283
23759
  addonId: null,
23284
23760
  access: "create"
23285
23761
  },
23286
- "pipelineOrchestrator.setAgentDetectWeight": {
23762
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23287
23763
  capName: "pipeline-orchestrator",
23288
23764
  capScope: "system",
23289
23765
  addonId: null,
@@ -23325,6 +23801,12 @@ Object.freeze({
23325
23801
  addonId: null,
23326
23802
  access: "create"
23327
23803
  },
23804
+ "pipelineOrchestrator.setPipelineDevicePin": {
23805
+ capName: "pipeline-orchestrator",
23806
+ capScope: "system",
23807
+ addonId: null,
23808
+ access: "create"
23809
+ },
23328
23810
  "pipelineOrchestrator.unassignAudio": {
23329
23811
  capName: "pipeline-orchestrator",
23330
23812
  capScope: "system",
@@ -24877,32 +25359,6 @@ Object.freeze({
24877
25359
  "network-access": "ingress",
24878
25360
  "smtp-provider": "email"
24879
25361
  });
24880
- var frameworkSwapPackageSchema = object({
24881
- name: string(),
24882
- stagedPath: string(),
24883
- backupPath: string(),
24884
- toVersion: string(),
24885
- fromVersion: string().nullable()
24886
- });
24887
- object({
24888
- jobId: string(),
24889
- taskId: string(),
24890
- packages: array(frameworkSwapPackageSchema),
24891
- requestedAtMs: number(),
24892
- schemaVersion: literal(1)
24893
- });
24894
- object({
24895
- jobId: string(),
24896
- taskId: string(),
24897
- backups: array(object({
24898
- name: string(),
24899
- backupPath: string(),
24900
- livePath: string()
24901
- })),
24902
- appliedAtMs: number(),
24903
- bootAttempts: number(),
24904
- schemaVersion: literal(1)
24905
- });
24906
25362
  //#endregion
24907
25363
  //#region ../../node_modules/xtend/immutable.js
24908
25364
  var require_immutable = /* @__PURE__ */ __commonJSMin(((exports, module) => {