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