@camstack/addon-static-turn 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.
@@ -7067,6 +7067,17 @@ var ModelCatalogEntrySchema = object({
7067
7067
  "imagenet",
7068
7068
  "none"
7069
7069
  ]).optional(),
7070
+ /**
7071
+ * The model already applies softmax IN-GRAPH — its raw output is a
7072
+ * probability distribution, not logits. When set, the `softmax`
7073
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7074
+ * probability vector collapses it toward uniform (top-1 score craters far
7075
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7076
+ * the output is raw logits and the postprocessor applies softmax (the normal
7077
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7078
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7079
+ */
7080
+ outputProbabilities: boolean().optional(),
7070
7081
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7071
7082
  /**
7072
7083
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7626,6 +7637,160 @@ var EncodeProfileSchema = object({
7626
7637
  */
7627
7638
  outputArgs: array(string()).optional()
7628
7639
  });
7640
+ var COCO_TO_MACRO = {
7641
+ mapping: {
7642
+ person: "person",
7643
+ bicycle: "vehicle",
7644
+ car: "vehicle",
7645
+ motorcycle: "vehicle",
7646
+ airplane: "vehicle",
7647
+ bus: "vehicle",
7648
+ train: "vehicle",
7649
+ truck: "vehicle",
7650
+ boat: "vehicle",
7651
+ bird: "animal",
7652
+ cat: "animal",
7653
+ dog: "animal",
7654
+ horse: "animal",
7655
+ sheep: "animal",
7656
+ cow: "animal",
7657
+ elephant: "animal",
7658
+ bear: "animal",
7659
+ zebra: "animal",
7660
+ giraffe: "animal",
7661
+ suitcase: "package",
7662
+ backpack: "package",
7663
+ handbag: "package"
7664
+ },
7665
+ preserveOriginal: false
7666
+ };
7667
+ var AUDIO_MACRO_LABELS = [
7668
+ {
7669
+ id: "speech",
7670
+ name: "Speech",
7671
+ icon: "🗣️"
7672
+ },
7673
+ {
7674
+ id: "scream",
7675
+ name: "Scream / Shout",
7676
+ icon: "😱"
7677
+ },
7678
+ {
7679
+ id: "crying",
7680
+ name: "Crying / Baby",
7681
+ icon: "😢"
7682
+ },
7683
+ {
7684
+ id: "laughter",
7685
+ name: "Laughter",
7686
+ icon: "😂"
7687
+ },
7688
+ {
7689
+ id: "music",
7690
+ name: "Music",
7691
+ icon: "🎵"
7692
+ },
7693
+ {
7694
+ id: "dog",
7695
+ name: "Dog",
7696
+ icon: "🐕"
7697
+ },
7698
+ {
7699
+ id: "cat",
7700
+ name: "Cat",
7701
+ icon: "🐈"
7702
+ },
7703
+ {
7704
+ id: "bird",
7705
+ name: "Bird",
7706
+ icon: "🐦"
7707
+ },
7708
+ {
7709
+ id: "animal",
7710
+ name: "Animal (other)",
7711
+ icon: "🐾"
7712
+ },
7713
+ {
7714
+ id: "alarm",
7715
+ name: "Alarm / Siren",
7716
+ icon: "🚨"
7717
+ },
7718
+ {
7719
+ id: "doorbell",
7720
+ name: "Doorbell / Knock",
7721
+ icon: "🔔"
7722
+ },
7723
+ {
7724
+ id: "glass_breaking",
7725
+ name: "Glass Breaking",
7726
+ icon: "💥"
7727
+ },
7728
+ {
7729
+ id: "gunshot",
7730
+ name: "Gunshot / Explosion",
7731
+ icon: "💣"
7732
+ },
7733
+ {
7734
+ id: "vehicle",
7735
+ name: "Vehicle",
7736
+ icon: "🚗"
7737
+ },
7738
+ {
7739
+ id: "siren",
7740
+ name: "Emergency Siren",
7741
+ icon: "🚑"
7742
+ },
7743
+ {
7744
+ id: "fire",
7745
+ name: "Fire / Smoke",
7746
+ icon: "🔥"
7747
+ },
7748
+ {
7749
+ id: "water",
7750
+ name: "Water",
7751
+ icon: "💧"
7752
+ },
7753
+ {
7754
+ id: "wind",
7755
+ name: "Wind / Weather",
7756
+ icon: "🌬️"
7757
+ },
7758
+ {
7759
+ id: "door",
7760
+ name: "Door",
7761
+ icon: "🚪"
7762
+ },
7763
+ {
7764
+ id: "footsteps",
7765
+ name: "Footsteps",
7766
+ icon: "👣"
7767
+ },
7768
+ {
7769
+ id: "crowd",
7770
+ name: "Crowd / Chatter",
7771
+ icon: "👥"
7772
+ },
7773
+ {
7774
+ id: "telephone",
7775
+ name: "Telephone",
7776
+ icon: "📞"
7777
+ },
7778
+ {
7779
+ id: "engine",
7780
+ name: "Engine / Motor",
7781
+ icon: "⚙️"
7782
+ },
7783
+ {
7784
+ id: "tools",
7785
+ name: "Tools / Construction",
7786
+ icon: "🔨"
7787
+ },
7788
+ {
7789
+ id: "silence",
7790
+ name: "Silence",
7791
+ icon: "🤫"
7792
+ }
7793
+ ];
7629
7794
  var YAMNET_TO_MACRO = {
7630
7795
  mapping: {
7631
7796
  Speech: "speech",
@@ -7892,6 +8057,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7892
8057
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7893
8058
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7894
8059
  /**
8060
+ * Unified event-kind taxonomy — THE single source of truth for
8061
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8062
+ * icon }`.
8063
+ *
8064
+ * This dictionary folds together what used to be scattered across four
8065
+ * copies:
8066
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8067
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8068
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8069
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8070
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8071
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8072
+ *
8073
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8074
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8075
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8076
+ * color or an icon: they read this dictionary (server descriptors carry the
8077
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8078
+ *
8079
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8080
+ */
8081
+ var TAXONOMY_COLORS = {
8082
+ motion: "#f59e0b",
8083
+ audio: "#06b6d4",
8084
+ person: "#22c55e",
8085
+ vehicle: "#3b82f6",
8086
+ animal: "#f97316",
8087
+ package: "#a855f7",
8088
+ sensor: "#8b5cf6",
8089
+ control: "#10b981",
8090
+ genericDetection: "#64748b"
8091
+ };
8092
+ var DETECTION_SUB_COLORS = {
8093
+ car: "#f59e0b",
8094
+ truck: "#d97706",
8095
+ bus: "#b45309",
8096
+ motorcycle: "#eab308",
8097
+ bicycle: "#ca8a04",
8098
+ airplane: "#60a5fa",
8099
+ boat: "#2563eb",
8100
+ train: "#1d4ed8",
8101
+ bird: "#14b8a6",
8102
+ dog: "#84cc16",
8103
+ cat: "#f97316",
8104
+ horse: "#a16207",
8105
+ sheep: "#a3a3a3",
8106
+ cow: "#78716c",
8107
+ elephant: "#6b7280",
8108
+ bear: "#7c2d12",
8109
+ zebra: "#404040",
8110
+ giraffe: "#d4a373"
8111
+ };
8112
+ function titleCase(id) {
8113
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8114
+ }
8115
+ var entries = /* @__PURE__ */ new Map();
8116
+ function macro(kind, category, color, iconId, label) {
8117
+ entries.set(kind, {
8118
+ kind,
8119
+ parentKind: null,
8120
+ level: "macro",
8121
+ category,
8122
+ color,
8123
+ iconId,
8124
+ labelKey: `eventKind.${kind}`,
8125
+ label
8126
+ });
8127
+ }
8128
+ function sub(kind, parentKind, category, color, iconId, label) {
8129
+ entries.set(kind, {
8130
+ kind,
8131
+ parentKind,
8132
+ level: "sub",
8133
+ category,
8134
+ color,
8135
+ iconId,
8136
+ labelKey: `eventKind.${kind}`,
8137
+ label
8138
+ });
8139
+ }
8140
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8141
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8142
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8143
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8144
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8145
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8146
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8147
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8148
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8149
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8150
+ if (entries.has(cocoClass)) continue;
8151
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8152
+ }
8153
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8154
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8155
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8156
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8157
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8158
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8159
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8160
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8161
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8162
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8163
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8164
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8165
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8166
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8167
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8168
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8169
+ sub("button", "control", "control", "#10b981", "button", "Button");
8170
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8171
+ for (const l of AUDIO_MACRO_LABELS) {
8172
+ const kind = `audio-${l.id}`;
8173
+ if (entries.has(kind)) continue;
8174
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8175
+ }
8176
+ /** The complete taxonomy dictionary, keyed by kind. */
8177
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8178
+ /**
7895
8179
  * Error types for the safe expression engine. Two distinct classes so callers
7896
8180
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7897
8181
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10807,10 +11091,7 @@ var ConfigUISchemaNullableBridge = custom();
10807
11091
  var InferenceCapabilitiesBridge = custom();
10808
11092
  var ModelAvailabilityListBridge = custom();
10809
11093
  var PipelineRunResultBridge = custom();
10810
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10811
- kind: "mutation",
10812
- auth: "admin"
10813
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11094
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10814
11095
  modelId: string(),
10815
11096
  settings: record(string(), unknown()).readonly()
10816
11097
  }))), method(object({ steps: record(string(), object({
@@ -10870,13 +11151,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10870
11151
  * (inputClasses ≠ null) are skipped and served per-track via
10871
11152
  * pipelineRunner.runDetailSubtree (two-plane design).
10872
11153
  */
10873
- plane: _enum(["full", "frame"]).optional()
11154
+ plane: _enum(["full", "frame"]).optional(),
11155
+ /**
11156
+ * Inference-device selector (Phase 2 multi-device). Format
11157
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11158
+ * Omitted ⇒ the runner's default device (current single-engine
11159
+ * behaviour). Selects WHICH device pool of the node runs the call.
11160
+ */
11161
+ deviceKey: string().optional()
10874
11162
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10875
11163
  engine: PipelineEngineChoiceSchema.optional(),
10876
11164
  steps: array(PipelineStepInputSchema).min(1),
10877
11165
  frames: array(FrameInputSchema).min(1).max(255),
10878
11166
  deviceId: number().optional(),
10879
- sessionId: string().optional()
11167
+ sessionId: string().optional(),
11168
+ /**
11169
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11170
+ * the batch to the Python pool's bench preprocess cache
11171
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11172
+ * preprocessed ONCE and every later inference is a pure-inference cache
11173
+ * hit — the sustained-throughput run measures inference, not
11174
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11175
+ * full preprocess every call, correct). Fresh per sustained run;
11176
+ * released via `uncacheFrame`.
11177
+ */
11178
+ frameId: number().int().nonnegative().optional(),
11179
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11180
+ deviceKey: string().optional()
10880
11181
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10881
11182
  data: _instanceof(Uint8Array),
10882
11183
  width: number().int().positive(),
@@ -10908,8 +11209,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10908
11209
  * - `runtime` — main camera-serving engine (no idle TTL).
10909
11210
  * - `warm-override` — benchmark/test override held in the warm
10910
11211
  * cache; auto-disposed after the idle TTL.
11212
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11213
+ * multi-device, keyed by `deviceKey`) resolved
11214
+ * via `resolveDeviceFactory`. Runs alongside the
11215
+ * `runtime` engine on a DIFFERENT accelerator
11216
+ * (NPU / iGPU / Coral) — this is how the
11217
+ * Engines tab shows all pools running at once.
10911
11218
  */
10912
- kind: _enum(["runtime", "warm-override"]),
11219
+ kind: _enum([
11220
+ "runtime",
11221
+ "warm-override",
11222
+ "device-pool"
11223
+ ]),
10913
11224
  /** Native pid of the underlying Python pool (null when no pool). */
10914
11225
  poolPid: number().nullable(),
10915
11226
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11251,7 +11562,14 @@ var RunnerCameraConfigSchema = object({
11251
11562
  * camera's detect node differs from its source-owner (P2d, gated by the
11252
11563
  * `remoteSourcingNodes` rollout setting).
11253
11564
  */
11254
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11565
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11566
+ /**
11567
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11568
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11569
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11570
+ * this only selects WHICH device pool of that node runs the session.
11571
+ */
11572
+ deviceKey: string().optional()
11255
11573
  });
11256
11574
  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;
11257
11575
  /**
@@ -11272,6 +11590,19 @@ var RunnerLocalLoadSchema = object({
11272
11590
  avgInferenceTimeMs: number(),
11273
11591
  /** Total queue depth across motion + detection queues. */
11274
11592
  queueDepthTotal: number(),
11593
+ /**
11594
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11595
+ * this runner currently has attached cameras on, so the orchestrator's second
11596
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11597
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11598
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11599
+ */
11600
+ devices: array(object({
11601
+ deviceKey: string(),
11602
+ backend: string(),
11603
+ attachedCameras: number(),
11604
+ queueDepthTotal: number()
11605
+ })).default([]),
11275
11606
  /** Hardware capability flags reported by this node. */
11276
11607
  hardware: object({
11277
11608
  hasGpu: boolean(),
@@ -12747,6 +13078,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12747
13078
  kind: "mutation",
12748
13079
  auth: "admin"
12749
13080
  });
13081
+ 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;
13082
+ new Set(Object.values(DeviceType));
12750
13083
  /**
12751
13084
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12752
13085
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15841,17 +16174,30 @@ var EventKindCategorySchema = _enum([
15841
16174
  "audio",
15842
16175
  "detection",
15843
16176
  "sensor",
16177
+ "control",
15844
16178
  "custom",
15845
16179
  "package"
15846
16180
  ]);
16181
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16182
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15847
16183
  var EventKindDescriptorSchema = object({
15848
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16184
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15849
16185
  kind: string(),
16186
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16187
+ labelKey: string(),
16188
+ /** English fallback label (kept for clients that don't translate). */
15850
16189
  label: string(),
15851
16190
  /** Hex color for timeline/legend rendering. */
15852
16191
  color: string(),
16192
+ /** Dictionary id → lucide component on the UI side. */
16193
+ iconId: string(),
16194
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15853
16195
  icon: EventKindIconSchema,
15854
16196
  category: EventKindCategorySchema,
16197
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16198
+ parentKind: string().nullable(),
16199
+ /** Derived from `parentKind`, explicit for the client tree. */
16200
+ level: EventKindLevelSchema,
15855
16201
  /** Which cap + device contributes this kind. For built-ins the camera
15856
16202
  * itself; for sensor kinds the LINKED source device. */
15857
16203
  source: object({
@@ -15924,11 +16270,21 @@ var TrackAudioLabelSchema = object({
15924
16270
  firstAt: number(),
15925
16271
  lastAt: number()
15926
16272
  });
16273
+ /**
16274
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16275
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16276
+ * linked sensor/control state change (no positions; carries a snapshot). The
16277
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16278
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16279
+ */
16280
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
15927
16281
  var TrackSchema = object({
15928
16282
  trackId: string(),
15929
16283
  deviceId: number(),
15930
16284
  className: string(),
15931
16285
  label: string().optional(),
16286
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16287
+ source: TrackSourceSchema.optional(),
15932
16288
  firstSeen: number(),
15933
16289
  lastSeen: number(),
15934
16290
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16305,6 +16661,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16305
16661
  eventId: string(),
16306
16662
  timestamp: number()
16307
16663
  });
16664
+ /**
16665
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16666
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16667
+ * caps into per-camera event-kind descriptors.
16668
+ *
16669
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16670
+ * is NOT duplicated here — every entry is derived from the single
16671
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16672
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16673
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16674
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16675
+ * eventful cap is missing.
16676
+ */
16677
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16678
+ var LEGACY_ICON = {
16679
+ motion: "motion",
16680
+ audio: "audio",
16681
+ person: "person",
16682
+ vehicle: "vehicle",
16683
+ animal: "animal",
16684
+ package: "package",
16685
+ door: "door",
16686
+ pir: "pir",
16687
+ smoke: "smoke",
16688
+ water: "water",
16689
+ button: "button",
16690
+ generic: "generic",
16691
+ gas: "smoke",
16692
+ vibration: "generic",
16693
+ tamper: "generic",
16694
+ presence: "person",
16695
+ lock: "generic",
16696
+ siren: "generic",
16697
+ switch: "generic",
16698
+ doorbell: "button"
16699
+ };
16700
+ function legacyIcon(iconId) {
16701
+ return LEGACY_ICON[iconId] ?? "generic";
16702
+ }
16703
+ /**
16704
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16705
+ * The anti-drift guard cross-checks this against the eventful caps declared
16706
+ * in `packages/types/src/capabilities/*.cap.ts`.
16707
+ */
16708
+ var CAP_TO_KIND = {
16709
+ contact: "contact",
16710
+ motion: "motion-sensor",
16711
+ smoke: "smoke",
16712
+ flood: "flood",
16713
+ gas: "gas",
16714
+ "carbon-monoxide": "carbon-monoxide",
16715
+ vibration: "vibration",
16716
+ tamper: "tamper",
16717
+ presence: "presence",
16718
+ "enum-sensor": "enum-sensor",
16719
+ "event-emitter": "device-event",
16720
+ "lock-control": "lock",
16721
+ switch: "switch",
16722
+ button: "button",
16723
+ doorbell: "doorbell"
16724
+ };
16725
+ function buildDescriptor(capName, kind) {
16726
+ const t = EVENT_TAXONOMY[kind];
16727
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16728
+ return {
16729
+ ...t,
16730
+ icon: legacyIcon(t.iconId)
16731
+ };
16732
+ }
16733
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16308
16734
  var CameraPipelineConfigSchema = object({
16309
16735
  engine: PipelineEngineChoiceSchema.optional(),
16310
16736
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16323,13 +16749,11 @@ var PipelineTemplateSchema = object({
16323
16749
  createdAt: string(),
16324
16750
  updatedAt: string()
16325
16751
  });
16326
- var AgentAddonConfigSchema = object({
16327
- enabled: boolean(),
16752
+ var DeviceStepConfigSchema = object({
16328
16753
  modelId: string().optional(),
16329
- settings: record(string(), unknown()).readonly()
16754
+ settings: record(string(), unknown()).optional()
16330
16755
  });
16331
16756
  var AgentPipelineSettingsSchema = object({
16332
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16333
16757
  maxCameras: number().int().nonnegative().nullable().default(null),
16334
16758
  /** Per-node detection weight (relative share for the quota balancer). */
16335
16759
  detectWeight: number().positive().optional(),
@@ -16353,7 +16777,22 @@ var AgentPipelineSettingsSchema = object({
16353
16777
  * it already uses to reach the hub). Set this only when the auto-detected
16354
16778
  * address is wrong (multi-homed host, NAT, custom interface).
16355
16779
  */
16356
- reachableHost: string().optional()
16780
+ reachableHost: string().optional(),
16781
+ /**
16782
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16783
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16784
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16785
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16786
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16787
+ * the default model/settings for every camera landing on that accelerator;
16788
+ * a stepId absent ⇒ the step uses that device's format default.
16789
+ */
16790
+ inferenceDevices: record(string(), object({
16791
+ enabled: boolean(),
16792
+ weight: number().positive().optional(),
16793
+ maxSessions: number().int().positive().optional(),
16794
+ steps: record(string(), DeviceStepConfigSchema).optional()
16795
+ })).optional()
16357
16796
  });
16358
16797
  var CameraPipelineForAgentSchema = object({
16359
16798
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16363,14 +16802,13 @@ var CameraPipelineForAgentSchema = object({
16363
16802
  }).nullable()
16364
16803
  });
16365
16804
  var CameraStepOverridePatchSchema = object({
16366
- enabled: boolean().optional(),
16367
16805
  modelId: string().optional(),
16368
16806
  settings: record(string(), unknown()).readonly().optional()
16369
16807
  });
16370
16808
  var CameraPipelineSettingsSchema = object({
16371
16809
  pinnedAgentNodeId: string().optional(),
16372
16810
  stepToggles: record(string(), boolean()).optional(),
16373
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16811
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16374
16812
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16375
16813
  });
16376
16814
  /**
@@ -16584,6 +17022,44 @@ var CameraStatusSchema = object({
16584
17022
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16585
17023
  fetchedAt: number()
16586
17024
  });
17025
+ var NodeInferenceDeviceSchema = object({
17026
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17027
+ key: string(),
17028
+ backend: string(),
17029
+ device: string(),
17030
+ format: _enum(MODEL_FORMATS),
17031
+ /** Whether the node's live probe reports the device as usable right now. */
17032
+ available: boolean(),
17033
+ /**
17034
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17035
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17036
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17037
+ * not a balanced target). An explicit stored value always wins; a stored-only
17038
+ * (unavailable) key keeps its stored value.
17039
+ */
17040
+ enabled: boolean(),
17041
+ /** Relative balancer weight for the enabled device (default 1). */
17042
+ weight: number(),
17043
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17044
+ maxSessions: number().nullable(),
17045
+ /** Object-detection model the executor defaults to for this deviceKey. */
17046
+ defaultModelId: string(),
17047
+ /**
17048
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17049
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17050
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17051
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17052
+ * available per format; this is the stored selection that becomes the
17053
+ * default for EVERY camera landing on this accelerator.
17054
+ */
17055
+ steps: record(string(), DeviceStepConfigSchema).optional()
17056
+ });
17057
+ var NodeInferenceDevicesSchema = object({
17058
+ nodeId: string(),
17059
+ /** False when the node's platform-probe was unreachable (no live device set). */
17060
+ reachable: boolean(),
17061
+ devices: array(NodeInferenceDeviceSchema).readonly()
17062
+ });
16587
17063
  method(object({
16588
17064
  deviceId: number(),
16589
17065
  agentNodeId: string()
@@ -16593,7 +17069,13 @@ method(object({
16593
17069
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16594
17070
  kind: "mutation",
16595
17071
  auth: "admin"
16596
- }), method(_void(), object({ migrated: number() }), {
17072
+ }), method(object({
17073
+ deviceId: number(),
17074
+ deviceKey: string()
17075
+ }), object({ success: literal(true) }), {
17076
+ kind: "mutation",
17077
+ auth: "admin"
17078
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16597
17079
  kind: "mutation",
16598
17080
  auth: "admin"
16599
17081
  }), 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({
@@ -16627,13 +17109,7 @@ method(object({
16627
17109
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16628
17110
  nodeId: string(),
16629
17111
  settings: AgentPipelineSettingsSchema
16630
- })).readonly()), method(object({
16631
- agentNodeId: string(),
16632
- defaults: record(string(), AgentAddonConfigSchema)
16633
- }), object({ success: literal(true) }), {
16634
- kind: "mutation",
16635
- auth: "admin"
16636
- }), method(object({ agentNodeId: string() }), object({
17112
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16637
17113
  success: boolean(),
16638
17114
  removed: boolean()
16639
17115
  }), {
@@ -16665,7 +17141,18 @@ method(object({
16665
17141
  }), object({ success: literal(true) }), {
16666
17142
  kind: "mutation",
16667
17143
  auth: "admin"
16668
- }), method(object({ agentNodeId: string() }), object({
17144
+ }), method(object({
17145
+ agentNodeId: string(),
17146
+ inferenceDevices: record(string(), object({
17147
+ enabled: boolean(),
17148
+ weight: number().positive().optional(),
17149
+ maxSessions: number().int().positive().optional(),
17150
+ steps: record(string(), DeviceStepConfigSchema).optional()
17151
+ }))
17152
+ }), object({ success: literal(true) }), {
17153
+ kind: "mutation",
17154
+ auth: "admin"
17155
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16669
17156
  success: literal(true),
16670
17157
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16671
17158
  effectiveModelId: string().nullable(),
@@ -16681,9 +17168,10 @@ method(object({
16681
17168
  }), object({ success: literal(true) }), {
16682
17169
  kind: "mutation",
16683
17170
  auth: "admin"
16684
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17171
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16685
17172
  deviceId: number(),
16686
17173
  agentNodeId: string(),
17174
+ deviceKey: string(),
16687
17175
  addonId: string(),
16688
17176
  patch: CameraStepOverridePatchSchema.nullable()
16689
17177
  }), object({ success: literal(true) }), {
@@ -16720,14 +17208,13 @@ method(object({
16720
17208
  });
16721
17209
  /**
16722
17210
  * server-management — per-NODE singleton capability for a node's ROOT
16723
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16724
- * agents).
17211
+ * package lifecycle (runtime-updatable node packages).
16725
17212
  *
16726
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16727
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16728
- * version describes the node. Updates install into
16729
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16730
- * starter (probation boot + auto-rollback to N-1).
17213
+ * Every node role runs the SAME root package (`@camstack/server`), which
17214
+ * carries the whole software stack in its npm dep tree, so ONE version
17215
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17216
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17217
+ * no auto-rollback).
16731
17218
  *
16732
17219
  * Providers:
16733
17220
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16835,7 +17322,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16835
17322
  /** Explicit target version; omitted = latest from the registry. */
16836
17323
  version: string().optional() }), ServerUpdateActionResultSchema, {
16837
17324
  kind: "mutation",
16838
- auth: "admin"
17325
+ auth: "admin",
17326
+ timeoutMs: 16 * 6e4
16839
17327
  }), method(_void(), ServerUpdateActionResultSchema, {
16840
17328
  kind: "mutation",
16841
17329
  auth: "admin"
@@ -17902,22 +18390,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17902
18390
  var RestartAddonResultSchema = unknown();
17903
18391
  var InstallPackageResultSchema = unknown();
17904
18392
  var ReloadPackagesResultSchema = unknown();
17905
- /**
17906
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
17907
- * server restarts so the admin UI can react to the `restartingAt`
17908
- * timestamp (shows reconnect overlay). The transition from
17909
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
17910
- * `system.restart-completed` event after the new process boots.
17911
- *
17912
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
17913
- */
17914
- var UpdateFrameworkPackageResultSchema = object({
17915
- packageName: string(),
17916
- fromVersion: string(),
17917
- toVersion: string(),
17918
- /** Ms-epoch the server scheduled its self-restart. */
17919
- restartingAt: number()
17920
- });
17921
18393
  var BulkUpdateItemStatusSchema = _enum([
17922
18394
  "queued",
17923
18395
  "updating",
@@ -18045,13 +18517,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18045
18517
  }), object({ success: literal(true) }), {
18046
18518
  kind: "mutation",
18047
18519
  auth: "admin"
18048
- }), method(object({
18049
- packageName: string().min(1),
18050
- version: string().optional(),
18051
- deferRestart: boolean().optional()
18052
- }), UpdateFrameworkPackageResultSchema, {
18053
- kind: "mutation",
18054
- auth: "admin"
18055
18520
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18056
18521
  kind: "mutation",
18057
18522
  auth: "admin"
@@ -18917,10 +19382,10 @@ var TopologyCategorySchema = object({
18917
19382
  addons: array(TopologyCategoryAddonSchema).readonly()
18918
19383
  });
18919
19384
  /**
18920
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
18921
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
18922
- * version visibility for the Server management surface. Nullable: offline
18923
- * rows and pre-phase-2 nodes report none.
19385
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19386
+ * root package for every node role) as reported by its `registerNode`
19387
+ * manifest — version visibility for the Server management surface. Nullable:
19388
+ * offline rows and nodes that never reported one.
18924
19389
  */
18925
19390
  var TopologyRootPackageSchema = object({
18926
19391
  name: string(),
@@ -19308,17 +19773,28 @@ var PlatformScoreSchema = object({
19308
19773
  format: _enum([
19309
19774
  "onnx",
19310
19775
  "coreml",
19311
- "openvino"
19776
+ "openvino",
19777
+ "tflite"
19312
19778
  ]),
19313
19779
  score: number(),
19314
19780
  reason: string(),
19315
19781
  available: boolean()
19316
19782
  });
19783
+ var InferenceDeviceDescriptorSchema = object({
19784
+ key: string(),
19785
+ backend: string(),
19786
+ device: string(),
19787
+ format: ModelFormatSchema,
19788
+ runtime: literal("python"),
19789
+ score: number(),
19790
+ available: boolean()
19791
+ });
19317
19792
  var PlatformCapabilitiesSchema = object({
19318
19793
  hardware: HardwareInfoSchema,
19319
19794
  scores: array(PlatformScoreSchema).readonly(),
19320
19795
  bestScore: PlatformScoreSchema,
19321
- pythonPath: string().nullable()
19796
+ pythonPath: string().nullable(),
19797
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19322
19798
  });
19323
19799
  var ModelRequirementSchema = object({
19324
19800
  modelId: string(),
@@ -20197,12 +20673,6 @@ Object.freeze({
20197
20673
  addonId: null,
20198
20674
  access: "delete"
20199
20675
  },
20200
- "addons.updateFrameworkPackage": {
20201
- capName: "addons",
20202
- capScope: "system",
20203
- addonId: null,
20204
- access: "create"
20205
- },
20206
20676
  "addons.updatePackage": {
20207
20677
  capName: "addons",
20208
20678
  capScope: "system",
@@ -22975,12 +23445,6 @@ Object.freeze({
22975
23445
  addonId: null,
22976
23446
  access: "view"
22977
23447
  },
22978
- "pipelineExecutor.reprobeEngine": {
22979
- capName: "pipeline-executor",
22980
- capScope: "system",
22981
- addonId: null,
22982
- access: "create"
22983
- },
22984
23448
  "pipelineExecutor.runAudioTest": {
22985
23449
  capName: "pipeline-executor",
22986
23450
  capScope: "system",
@@ -23131,6 +23595,12 @@ Object.freeze({
23131
23595
  addonId: null,
23132
23596
  access: "view"
23133
23597
  },
23598
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23599
+ capName: "pipeline-orchestrator",
23600
+ capScope: "system",
23601
+ addonId: null,
23602
+ access: "view"
23603
+ },
23134
23604
  "pipelineOrchestrator.getPipelineAssignment": {
23135
23605
  capName: "pipeline-orchestrator",
23136
23606
  capScope: "system",
@@ -23143,6 +23613,12 @@ Object.freeze({
23143
23613
  addonId: null,
23144
23614
  access: "view"
23145
23615
  },
23616
+ "pipelineOrchestrator.getPipelineDevicePin": {
23617
+ capName: "pipeline-orchestrator",
23618
+ capScope: "system",
23619
+ addonId: null,
23620
+ access: "view"
23621
+ },
23146
23622
  "pipelineOrchestrator.listAgentSettings": {
23147
23623
  capName: "pipeline-orchestrator",
23148
23624
  capScope: "system",
@@ -23185,19 +23661,19 @@ Object.freeze({
23185
23661
  addonId: null,
23186
23662
  access: "create"
23187
23663
  },
23188
- "pipelineOrchestrator.setAgentAddonDefaults": {
23664
+ "pipelineOrchestrator.setAgentCapabilities": {
23189
23665
  capName: "pipeline-orchestrator",
23190
23666
  capScope: "system",
23191
23667
  addonId: null,
23192
23668
  access: "create"
23193
23669
  },
23194
- "pipelineOrchestrator.setAgentCapabilities": {
23670
+ "pipelineOrchestrator.setAgentDetectWeight": {
23195
23671
  capName: "pipeline-orchestrator",
23196
23672
  capScope: "system",
23197
23673
  addonId: null,
23198
23674
  access: "create"
23199
23675
  },
23200
- "pipelineOrchestrator.setAgentDetectWeight": {
23676
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23201
23677
  capName: "pipeline-orchestrator",
23202
23678
  capScope: "system",
23203
23679
  addonId: null,
@@ -23239,6 +23715,12 @@ Object.freeze({
23239
23715
  addonId: null,
23240
23716
  access: "create"
23241
23717
  },
23718
+ "pipelineOrchestrator.setPipelineDevicePin": {
23719
+ capName: "pipeline-orchestrator",
23720
+ capScope: "system",
23721
+ addonId: null,
23722
+ access: "create"
23723
+ },
23242
23724
  "pipelineOrchestrator.unassignAudio": {
23243
23725
  capName: "pipeline-orchestrator",
23244
23726
  capScope: "system",
@@ -24791,32 +25273,6 @@ Object.freeze({
24791
25273
  "network-access": "ingress",
24792
25274
  "smtp-provider": "email"
24793
25275
  });
24794
- var frameworkSwapPackageSchema = object({
24795
- name: string(),
24796
- stagedPath: string(),
24797
- backupPath: string(),
24798
- toVersion: string(),
24799
- fromVersion: string().nullable()
24800
- });
24801
- object({
24802
- jobId: string(),
24803
- taskId: string(),
24804
- packages: array(frameworkSwapPackageSchema),
24805
- requestedAtMs: number(),
24806
- schemaVersion: literal(1)
24807
- });
24808
- object({
24809
- jobId: string(),
24810
- taskId: string(),
24811
- backups: array(object({
24812
- name: string(),
24813
- backupPath: string(),
24814
- livePath: string()
24815
- })),
24816
- appliedAtMs: number(),
24817
- bootAttempts: number(),
24818
- schemaVersion: literal(1)
24819
- });
24820
25276
  //#endregion
24821
25277
  //#region src/static-turn.addon.ts
24822
25278
  /**