@camstack/addon-model-studio 1.0.27 → 1.1.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.
@@ -7101,6 +7101,17 @@ var ModelCatalogEntrySchema = object({
7101
7101
  "imagenet",
7102
7102
  "none"
7103
7103
  ]).optional(),
7104
+ /**
7105
+ * The model already applies softmax IN-GRAPH — its raw output is a
7106
+ * probability distribution, not logits. When set, the `softmax`
7107
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7108
+ * probability vector collapses it toward uniform (top-1 score craters far
7109
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7110
+ * the output is raw logits and the postprocessor applies softmax (the normal
7111
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7112
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7113
+ */
7114
+ outputProbabilities: boolean().optional(),
7104
7115
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7105
7116
  /**
7106
7117
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7691,6 +7702,160 @@ var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
7691
7702
  function nodePin(nodeId) {
7692
7703
  return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: nodeId } };
7693
7704
  }
7705
+ var COCO_TO_MACRO = {
7706
+ mapping: {
7707
+ person: "person",
7708
+ bicycle: "vehicle",
7709
+ car: "vehicle",
7710
+ motorcycle: "vehicle",
7711
+ airplane: "vehicle",
7712
+ bus: "vehicle",
7713
+ train: "vehicle",
7714
+ truck: "vehicle",
7715
+ boat: "vehicle",
7716
+ bird: "animal",
7717
+ cat: "animal",
7718
+ dog: "animal",
7719
+ horse: "animal",
7720
+ sheep: "animal",
7721
+ cow: "animal",
7722
+ elephant: "animal",
7723
+ bear: "animal",
7724
+ zebra: "animal",
7725
+ giraffe: "animal",
7726
+ suitcase: "package",
7727
+ backpack: "package",
7728
+ handbag: "package"
7729
+ },
7730
+ preserveOriginal: false
7731
+ };
7732
+ var AUDIO_MACRO_LABELS = [
7733
+ {
7734
+ id: "speech",
7735
+ name: "Speech",
7736
+ icon: "🗣️"
7737
+ },
7738
+ {
7739
+ id: "scream",
7740
+ name: "Scream / Shout",
7741
+ icon: "😱"
7742
+ },
7743
+ {
7744
+ id: "crying",
7745
+ name: "Crying / Baby",
7746
+ icon: "😢"
7747
+ },
7748
+ {
7749
+ id: "laughter",
7750
+ name: "Laughter",
7751
+ icon: "😂"
7752
+ },
7753
+ {
7754
+ id: "music",
7755
+ name: "Music",
7756
+ icon: "🎵"
7757
+ },
7758
+ {
7759
+ id: "dog",
7760
+ name: "Dog",
7761
+ icon: "🐕"
7762
+ },
7763
+ {
7764
+ id: "cat",
7765
+ name: "Cat",
7766
+ icon: "🐈"
7767
+ },
7768
+ {
7769
+ id: "bird",
7770
+ name: "Bird",
7771
+ icon: "🐦"
7772
+ },
7773
+ {
7774
+ id: "animal",
7775
+ name: "Animal (other)",
7776
+ icon: "🐾"
7777
+ },
7778
+ {
7779
+ id: "alarm",
7780
+ name: "Alarm / Siren",
7781
+ icon: "🚨"
7782
+ },
7783
+ {
7784
+ id: "doorbell",
7785
+ name: "Doorbell / Knock",
7786
+ icon: "🔔"
7787
+ },
7788
+ {
7789
+ id: "glass_breaking",
7790
+ name: "Glass Breaking",
7791
+ icon: "💥"
7792
+ },
7793
+ {
7794
+ id: "gunshot",
7795
+ name: "Gunshot / Explosion",
7796
+ icon: "💣"
7797
+ },
7798
+ {
7799
+ id: "vehicle",
7800
+ name: "Vehicle",
7801
+ icon: "🚗"
7802
+ },
7803
+ {
7804
+ id: "siren",
7805
+ name: "Emergency Siren",
7806
+ icon: "🚑"
7807
+ },
7808
+ {
7809
+ id: "fire",
7810
+ name: "Fire / Smoke",
7811
+ icon: "🔥"
7812
+ },
7813
+ {
7814
+ id: "water",
7815
+ name: "Water",
7816
+ icon: "💧"
7817
+ },
7818
+ {
7819
+ id: "wind",
7820
+ name: "Wind / Weather",
7821
+ icon: "🌬️"
7822
+ },
7823
+ {
7824
+ id: "door",
7825
+ name: "Door",
7826
+ icon: "🚪"
7827
+ },
7828
+ {
7829
+ id: "footsteps",
7830
+ name: "Footsteps",
7831
+ icon: "👣"
7832
+ },
7833
+ {
7834
+ id: "crowd",
7835
+ name: "Crowd / Chatter",
7836
+ icon: "👥"
7837
+ },
7838
+ {
7839
+ id: "telephone",
7840
+ name: "Telephone",
7841
+ icon: "📞"
7842
+ },
7843
+ {
7844
+ id: "engine",
7845
+ name: "Engine / Motor",
7846
+ icon: "⚙️"
7847
+ },
7848
+ {
7849
+ id: "tools",
7850
+ name: "Tools / Construction",
7851
+ icon: "🔨"
7852
+ },
7853
+ {
7854
+ id: "silence",
7855
+ name: "Silence",
7856
+ icon: "🤫"
7857
+ }
7858
+ ];
7694
7859
  var YAMNET_TO_MACRO = {
7695
7860
  mapping: {
7696
7861
  Speech: "speech",
@@ -7957,6 +8122,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7957
8122
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7958
8123
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7959
8124
  /**
8125
+ * Unified event-kind taxonomy — THE single source of truth for
8126
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8127
+ * icon }`.
8128
+ *
8129
+ * This dictionary folds together what used to be scattered across four
8130
+ * copies:
8131
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8132
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8133
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8134
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8135
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8136
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8137
+ *
8138
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8139
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8140
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8141
+ * color or an icon: they read this dictionary (server descriptors carry the
8142
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8143
+ *
8144
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8145
+ */
8146
+ var TAXONOMY_COLORS = {
8147
+ motion: "#f59e0b",
8148
+ audio: "#06b6d4",
8149
+ person: "#22c55e",
8150
+ vehicle: "#3b82f6",
8151
+ animal: "#f97316",
8152
+ package: "#a855f7",
8153
+ sensor: "#8b5cf6",
8154
+ control: "#10b981",
8155
+ genericDetection: "#64748b"
8156
+ };
8157
+ var DETECTION_SUB_COLORS = {
8158
+ car: "#f59e0b",
8159
+ truck: "#d97706",
8160
+ bus: "#b45309",
8161
+ motorcycle: "#eab308",
8162
+ bicycle: "#ca8a04",
8163
+ airplane: "#60a5fa",
8164
+ boat: "#2563eb",
8165
+ train: "#1d4ed8",
8166
+ bird: "#14b8a6",
8167
+ dog: "#84cc16",
8168
+ cat: "#f97316",
8169
+ horse: "#a16207",
8170
+ sheep: "#a3a3a3",
8171
+ cow: "#78716c",
8172
+ elephant: "#6b7280",
8173
+ bear: "#7c2d12",
8174
+ zebra: "#404040",
8175
+ giraffe: "#d4a373"
8176
+ };
8177
+ function titleCase(id) {
8178
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8179
+ }
8180
+ var entries = /* @__PURE__ */ new Map();
8181
+ function macro(kind, category, color, iconId, label) {
8182
+ entries.set(kind, {
8183
+ kind,
8184
+ parentKind: null,
8185
+ level: "macro",
8186
+ category,
8187
+ color,
8188
+ iconId,
8189
+ labelKey: `eventKind.${kind}`,
8190
+ label
8191
+ });
8192
+ }
8193
+ function sub(kind, parentKind, category, color, iconId, label) {
8194
+ entries.set(kind, {
8195
+ kind,
8196
+ parentKind,
8197
+ level: "sub",
8198
+ category,
8199
+ color,
8200
+ iconId,
8201
+ labelKey: `eventKind.${kind}`,
8202
+ label
8203
+ });
8204
+ }
8205
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8206
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8207
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8208
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8209
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8210
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8211
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8212
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8213
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8214
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8215
+ if (entries.has(cocoClass)) continue;
8216
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8217
+ }
8218
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8219
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8220
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8221
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8222
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8223
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8224
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8225
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8226
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8227
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8228
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8229
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8230
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8231
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8232
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8233
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8234
+ sub("button", "control", "control", "#10b981", "button", "Button");
8235
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8236
+ for (const l of AUDIO_MACRO_LABELS) {
8237
+ const kind = `audio-${l.id}`;
8238
+ if (entries.has(kind)) continue;
8239
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8240
+ }
8241
+ /** The complete taxonomy dictionary, keyed by kind. */
8242
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8243
+ /**
7960
8244
  * Error types for the safe expression engine. Two distinct classes so callers
7961
8245
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7962
8246
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10872,10 +11156,7 @@ var ConfigUISchemaNullableBridge = custom();
10872
11156
  var InferenceCapabilitiesBridge = custom();
10873
11157
  var ModelAvailabilityListBridge = custom();
10874
11158
  var PipelineRunResultBridge = custom();
10875
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10876
- kind: "mutation",
10877
- auth: "admin"
10878
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11159
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10879
11160
  modelId: string(),
10880
11161
  settings: record(string(), unknown()).readonly()
10881
11162
  }))), method(object({ steps: record(string(), object({
@@ -10935,13 +11216,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10935
11216
  * (inputClasses ≠ null) are skipped and served per-track via
10936
11217
  * pipelineRunner.runDetailSubtree (two-plane design).
10937
11218
  */
10938
- plane: _enum(["full", "frame"]).optional()
11219
+ plane: _enum(["full", "frame"]).optional(),
11220
+ /**
11221
+ * Inference-device selector (Phase 2 multi-device). Format
11222
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11223
+ * Omitted ⇒ the runner's default device (current single-engine
11224
+ * behaviour). Selects WHICH device pool of the node runs the call.
11225
+ */
11226
+ deviceKey: string().optional()
10939
11227
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10940
11228
  engine: PipelineEngineChoiceSchema.optional(),
10941
11229
  steps: array(PipelineStepInputSchema).min(1),
10942
11230
  frames: array(FrameInputSchema).min(1).max(255),
10943
11231
  deviceId: number().optional(),
10944
- sessionId: string().optional()
11232
+ sessionId: string().optional(),
11233
+ /**
11234
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11235
+ * the batch to the Python pool's bench preprocess cache
11236
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11237
+ * preprocessed ONCE and every later inference is a pure-inference cache
11238
+ * hit — the sustained-throughput run measures inference, not
11239
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11240
+ * full preprocess every call, correct). Fresh per sustained run;
11241
+ * released via `uncacheFrame`.
11242
+ */
11243
+ frameId: number().int().nonnegative().optional(),
11244
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11245
+ deviceKey: string().optional()
10945
11246
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10946
11247
  data: _instanceof(Uint8Array),
10947
11248
  width: number().int().positive(),
@@ -10973,8 +11274,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10973
11274
  * - `runtime` — main camera-serving engine (no idle TTL).
10974
11275
  * - `warm-override` — benchmark/test override held in the warm
10975
11276
  * cache; auto-disposed after the idle TTL.
11277
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11278
+ * multi-device, keyed by `deviceKey`) resolved
11279
+ * via `resolveDeviceFactory`. Runs alongside the
11280
+ * `runtime` engine on a DIFFERENT accelerator
11281
+ * (NPU / iGPU / Coral) — this is how the
11282
+ * Engines tab shows all pools running at once.
10976
11283
  */
10977
- kind: _enum(["runtime", "warm-override"]),
11284
+ kind: _enum([
11285
+ "runtime",
11286
+ "warm-override",
11287
+ "device-pool"
11288
+ ]),
10978
11289
  /** Native pid of the underlying Python pool (null when no pool). */
10979
11290
  poolPid: number().nullable(),
10980
11291
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11316,7 +11627,14 @@ var RunnerCameraConfigSchema = object({
11316
11627
  * camera's detect node differs from its source-owner (P2d, gated by the
11317
11628
  * `remoteSourcingNodes` rollout setting).
11318
11629
  */
11319
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11630
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11631
+ /**
11632
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11633
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11634
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11635
+ * this only selects WHICH device pool of that node runs the session.
11636
+ */
11637
+ deviceKey: string().optional()
11320
11638
  });
11321
11639
  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;
11322
11640
  /**
@@ -11337,6 +11655,19 @@ var RunnerLocalLoadSchema = object({
11337
11655
  avgInferenceTimeMs: number(),
11338
11656
  /** Total queue depth across motion + detection queues. */
11339
11657
  queueDepthTotal: number(),
11658
+ /**
11659
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11660
+ * this runner currently has attached cameras on, so the orchestrator's second
11661
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11662
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11663
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11664
+ */
11665
+ devices: array(object({
11666
+ deviceKey: string(),
11667
+ backend: string(),
11668
+ attachedCameras: number(),
11669
+ queueDepthTotal: number()
11670
+ })).default([]),
11340
11671
  /** Hardware capability flags reported by this node. */
11341
11672
  hardware: object({
11342
11673
  hasGpu: boolean(),
@@ -12812,6 +13143,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12812
13143
  kind: "mutation",
12813
13144
  auth: "admin"
12814
13145
  });
13146
+ 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;
13147
+ new Set(Object.values(DeviceType));
12815
13148
  /**
12816
13149
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12817
13150
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15945,17 +16278,30 @@ var EventKindCategorySchema = _enum([
15945
16278
  "audio",
15946
16279
  "detection",
15947
16280
  "sensor",
16281
+ "control",
15948
16282
  "custom",
15949
16283
  "package"
15950
16284
  ]);
16285
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16286
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15951
16287
  var EventKindDescriptorSchema = object({
15952
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16288
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15953
16289
  kind: string(),
16290
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16291
+ labelKey: string(),
16292
+ /** English fallback label (kept for clients that don't translate). */
15954
16293
  label: string(),
15955
16294
  /** Hex color for timeline/legend rendering. */
15956
16295
  color: string(),
16296
+ /** Dictionary id → lucide component on the UI side. */
16297
+ iconId: string(),
16298
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15957
16299
  icon: EventKindIconSchema,
15958
16300
  category: EventKindCategorySchema,
16301
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16302
+ parentKind: string().nullable(),
16303
+ /** Derived from `parentKind`, explicit for the client tree. */
16304
+ level: EventKindLevelSchema,
15959
16305
  /** Which cap + device contributes this kind. For built-ins the camera
15960
16306
  * itself; for sensor kinds the LINKED source device. */
15961
16307
  source: object({
@@ -16028,11 +16374,21 @@ var TrackAudioLabelSchema = object({
16028
16374
  firstAt: number(),
16029
16375
  lastAt: number()
16030
16376
  });
16377
+ /**
16378
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16379
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16380
+ * linked sensor/control state change (no positions; carries a snapshot). The
16381
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16382
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16383
+ */
16384
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16031
16385
  var TrackSchema = object({
16032
16386
  trackId: string(),
16033
16387
  deviceId: number(),
16034
16388
  className: string(),
16035
16389
  label: string().optional(),
16390
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16391
+ source: TrackSourceSchema.optional(),
16036
16392
  firstSeen: number(),
16037
16393
  lastSeen: number(),
16038
16394
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16409,6 +16765,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16409
16765
  eventId: string(),
16410
16766
  timestamp: number()
16411
16767
  });
16768
+ /**
16769
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16770
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16771
+ * caps into per-camera event-kind descriptors.
16772
+ *
16773
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16774
+ * is NOT duplicated here — every entry is derived from the single
16775
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16776
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16777
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16778
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16779
+ * eventful cap is missing.
16780
+ */
16781
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16782
+ var LEGACY_ICON = {
16783
+ motion: "motion",
16784
+ audio: "audio",
16785
+ person: "person",
16786
+ vehicle: "vehicle",
16787
+ animal: "animal",
16788
+ package: "package",
16789
+ door: "door",
16790
+ pir: "pir",
16791
+ smoke: "smoke",
16792
+ water: "water",
16793
+ button: "button",
16794
+ generic: "generic",
16795
+ gas: "smoke",
16796
+ vibration: "generic",
16797
+ tamper: "generic",
16798
+ presence: "person",
16799
+ lock: "generic",
16800
+ siren: "generic",
16801
+ switch: "generic",
16802
+ doorbell: "button"
16803
+ };
16804
+ function legacyIcon(iconId) {
16805
+ return LEGACY_ICON[iconId] ?? "generic";
16806
+ }
16807
+ /**
16808
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16809
+ * The anti-drift guard cross-checks this against the eventful caps declared
16810
+ * in `packages/types/src/capabilities/*.cap.ts`.
16811
+ */
16812
+ var CAP_TO_KIND = {
16813
+ contact: "contact",
16814
+ motion: "motion-sensor",
16815
+ smoke: "smoke",
16816
+ flood: "flood",
16817
+ gas: "gas",
16818
+ "carbon-monoxide": "carbon-monoxide",
16819
+ vibration: "vibration",
16820
+ tamper: "tamper",
16821
+ presence: "presence",
16822
+ "enum-sensor": "enum-sensor",
16823
+ "event-emitter": "device-event",
16824
+ "lock-control": "lock",
16825
+ switch: "switch",
16826
+ button: "button",
16827
+ doorbell: "doorbell"
16828
+ };
16829
+ function buildDescriptor(capName, kind) {
16830
+ const t = EVENT_TAXONOMY[kind];
16831
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16832
+ return {
16833
+ ...t,
16834
+ icon: legacyIcon(t.iconId)
16835
+ };
16836
+ }
16837
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16412
16838
  var CameraPipelineConfigSchema = object({
16413
16839
  engine: PipelineEngineChoiceSchema.optional(),
16414
16840
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16427,13 +16853,11 @@ var PipelineTemplateSchema = object({
16427
16853
  createdAt: string(),
16428
16854
  updatedAt: string()
16429
16855
  });
16430
- var AgentAddonConfigSchema = object({
16431
- enabled: boolean(),
16856
+ var DeviceStepConfigSchema = object({
16432
16857
  modelId: string().optional(),
16433
- settings: record(string(), unknown()).readonly()
16858
+ settings: record(string(), unknown()).optional()
16434
16859
  });
16435
16860
  var AgentPipelineSettingsSchema = object({
16436
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16437
16861
  maxCameras: number().int().nonnegative().nullable().default(null),
16438
16862
  /** Per-node detection weight (relative share for the quota balancer). */
16439
16863
  detectWeight: number().positive().optional(),
@@ -16457,7 +16881,22 @@ var AgentPipelineSettingsSchema = object({
16457
16881
  * it already uses to reach the hub). Set this only when the auto-detected
16458
16882
  * address is wrong (multi-homed host, NAT, custom interface).
16459
16883
  */
16460
- reachableHost: string().optional()
16884
+ reachableHost: string().optional(),
16885
+ /**
16886
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16887
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16888
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16889
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16890
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16891
+ * the default model/settings for every camera landing on that accelerator;
16892
+ * a stepId absent ⇒ the step uses that device's format default.
16893
+ */
16894
+ inferenceDevices: record(string(), object({
16895
+ enabled: boolean(),
16896
+ weight: number().positive().optional(),
16897
+ maxSessions: number().int().positive().optional(),
16898
+ steps: record(string(), DeviceStepConfigSchema).optional()
16899
+ })).optional()
16461
16900
  });
16462
16901
  var CameraPipelineForAgentSchema = object({
16463
16902
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16467,14 +16906,13 @@ var CameraPipelineForAgentSchema = object({
16467
16906
  }).nullable()
16468
16907
  });
16469
16908
  var CameraStepOverridePatchSchema = object({
16470
- enabled: boolean().optional(),
16471
16909
  modelId: string().optional(),
16472
16910
  settings: record(string(), unknown()).readonly().optional()
16473
16911
  });
16474
16912
  var CameraPipelineSettingsSchema = object({
16475
16913
  pinnedAgentNodeId: string().optional(),
16476
16914
  stepToggles: record(string(), boolean()).optional(),
16477
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16915
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16478
16916
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16479
16917
  });
16480
16918
  /**
@@ -16688,6 +17126,44 @@ var CameraStatusSchema = object({
16688
17126
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16689
17127
  fetchedAt: number()
16690
17128
  });
17129
+ var NodeInferenceDeviceSchema = object({
17130
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17131
+ key: string(),
17132
+ backend: string(),
17133
+ device: string(),
17134
+ format: _enum(MODEL_FORMATS),
17135
+ /** Whether the node's live probe reports the device as usable right now. */
17136
+ available: boolean(),
17137
+ /**
17138
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17139
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17140
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17141
+ * not a balanced target). An explicit stored value always wins; a stored-only
17142
+ * (unavailable) key keeps its stored value.
17143
+ */
17144
+ enabled: boolean(),
17145
+ /** Relative balancer weight for the enabled device (default 1). */
17146
+ weight: number(),
17147
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17148
+ maxSessions: number().nullable(),
17149
+ /** Object-detection model the executor defaults to for this deviceKey. */
17150
+ defaultModelId: string(),
17151
+ /**
17152
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17153
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17154
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17155
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17156
+ * available per format; this is the stored selection that becomes the
17157
+ * default for EVERY camera landing on this accelerator.
17158
+ */
17159
+ steps: record(string(), DeviceStepConfigSchema).optional()
17160
+ });
17161
+ var NodeInferenceDevicesSchema = object({
17162
+ nodeId: string(),
17163
+ /** False when the node's platform-probe was unreachable (no live device set). */
17164
+ reachable: boolean(),
17165
+ devices: array(NodeInferenceDeviceSchema).readonly()
17166
+ });
16691
17167
  method(object({
16692
17168
  deviceId: number(),
16693
17169
  agentNodeId: string()
@@ -16697,7 +17173,13 @@ method(object({
16697
17173
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16698
17174
  kind: "mutation",
16699
17175
  auth: "admin"
16700
- }), method(_void(), object({ migrated: number() }), {
17176
+ }), method(object({
17177
+ deviceId: number(),
17178
+ deviceKey: string()
17179
+ }), object({ success: literal(true) }), {
17180
+ kind: "mutation",
17181
+ auth: "admin"
17182
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16701
17183
  kind: "mutation",
16702
17184
  auth: "admin"
16703
17185
  }), 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({
@@ -16731,13 +17213,7 @@ method(object({
16731
17213
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16732
17214
  nodeId: string(),
16733
17215
  settings: AgentPipelineSettingsSchema
16734
- })).readonly()), method(object({
16735
- agentNodeId: string(),
16736
- defaults: record(string(), AgentAddonConfigSchema)
16737
- }), object({ success: literal(true) }), {
16738
- kind: "mutation",
16739
- auth: "admin"
16740
- }), method(object({ agentNodeId: string() }), object({
17216
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16741
17217
  success: boolean(),
16742
17218
  removed: boolean()
16743
17219
  }), {
@@ -16769,7 +17245,18 @@ method(object({
16769
17245
  }), object({ success: literal(true) }), {
16770
17246
  kind: "mutation",
16771
17247
  auth: "admin"
16772
- }), method(object({ agentNodeId: string() }), object({
17248
+ }), method(object({
17249
+ agentNodeId: string(),
17250
+ inferenceDevices: record(string(), object({
17251
+ enabled: boolean(),
17252
+ weight: number().positive().optional(),
17253
+ maxSessions: number().int().positive().optional(),
17254
+ steps: record(string(), DeviceStepConfigSchema).optional()
17255
+ }))
17256
+ }), object({ success: literal(true) }), {
17257
+ kind: "mutation",
17258
+ auth: "admin"
17259
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16773
17260
  success: literal(true),
16774
17261
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16775
17262
  effectiveModelId: string().nullable(),
@@ -16785,9 +17272,10 @@ method(object({
16785
17272
  }), object({ success: literal(true) }), {
16786
17273
  kind: "mutation",
16787
17274
  auth: "admin"
16788
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17275
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16789
17276
  deviceId: number(),
16790
17277
  agentNodeId: string(),
17278
+ deviceKey: string(),
16791
17279
  addonId: string(),
16792
17280
  patch: CameraStepOverridePatchSchema.nullable()
16793
17281
  }), object({ success: literal(true) }), {
@@ -16824,14 +17312,13 @@ method(object({
16824
17312
  });
16825
17313
  /**
16826
17314
  * server-management — per-NODE singleton capability for a node's ROOT
16827
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16828
- * agents).
17315
+ * package lifecycle (runtime-updatable node packages).
16829
17316
  *
16830
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16831
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16832
- * version describes the node. Updates install into
16833
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16834
- * starter (probation boot + auto-rollback to N-1).
17317
+ * Every node role runs the SAME root package (`@camstack/server`), which
17318
+ * carries the whole software stack in its npm dep tree, so ONE version
17319
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17320
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17321
+ * no auto-rollback).
16835
17322
  *
16836
17323
  * Providers:
16837
17324
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16939,7 +17426,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16939
17426
  /** Explicit target version; omitted = latest from the registry. */
16940
17427
  version: string().optional() }), ServerUpdateActionResultSchema, {
16941
17428
  kind: "mutation",
16942
- auth: "admin"
17429
+ auth: "admin",
17430
+ timeoutMs: 16 * 6e4
16943
17431
  }), method(_void(), ServerUpdateActionResultSchema, {
16944
17432
  kind: "mutation",
16945
17433
  auth: "admin"
@@ -17983,22 +18471,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17983
18471
  var RestartAddonResultSchema = unknown();
17984
18472
  var InstallPackageResultSchema = unknown();
17985
18473
  var ReloadPackagesResultSchema = unknown();
17986
- /**
17987
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
17988
- * server restarts so the admin UI can react to the `restartingAt`
17989
- * timestamp (shows reconnect overlay). The transition from
17990
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
17991
- * `system.restart-completed` event after the new process boots.
17992
- *
17993
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
17994
- */
17995
- var UpdateFrameworkPackageResultSchema = object({
17996
- packageName: string(),
17997
- fromVersion: string(),
17998
- toVersion: string(),
17999
- /** Ms-epoch the server scheduled its self-restart. */
18000
- restartingAt: number()
18001
- });
18002
18474
  var BulkUpdateItemStatusSchema = _enum([
18003
18475
  "queued",
18004
18476
  "updating",
@@ -18126,13 +18598,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18126
18598
  }), object({ success: literal(true) }), {
18127
18599
  kind: "mutation",
18128
18600
  auth: "admin"
18129
- }), method(object({
18130
- packageName: string().min(1),
18131
- version: string().optional(),
18132
- deferRestart: boolean().optional()
18133
- }), UpdateFrameworkPackageResultSchema, {
18134
- kind: "mutation",
18135
- auth: "admin"
18136
18601
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18137
18602
  kind: "mutation",
18138
18603
  auth: "admin"
@@ -18998,10 +19463,10 @@ var TopologyCategorySchema = object({
18998
19463
  addons: array(TopologyCategoryAddonSchema).readonly()
18999
19464
  });
19000
19465
  /**
19001
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
19002
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
19003
- * version visibility for the Server management surface. Nullable: offline
19004
- * rows and pre-phase-2 nodes report none.
19466
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19467
+ * root package for every node role) as reported by its `registerNode`
19468
+ * manifest — version visibility for the Server management surface. Nullable:
19469
+ * offline rows and nodes that never reported one.
19005
19470
  */
19006
19471
  var TopologyRootPackageSchema = object({
19007
19472
  name: string(),
@@ -19389,17 +19854,28 @@ var PlatformScoreSchema = object({
19389
19854
  format: _enum([
19390
19855
  "onnx",
19391
19856
  "coreml",
19392
- "openvino"
19857
+ "openvino",
19858
+ "tflite"
19393
19859
  ]),
19394
19860
  score: number(),
19395
19861
  reason: string(),
19396
19862
  available: boolean()
19397
19863
  });
19864
+ var InferenceDeviceDescriptorSchema = object({
19865
+ key: string(),
19866
+ backend: string(),
19867
+ device: string(),
19868
+ format: ModelFormatSchema,
19869
+ runtime: literal("python"),
19870
+ score: number(),
19871
+ available: boolean()
19872
+ });
19398
19873
  var PlatformCapabilitiesSchema = object({
19399
19874
  hardware: HardwareInfoSchema,
19400
19875
  scores: array(PlatformScoreSchema).readonly(),
19401
19876
  bestScore: PlatformScoreSchema,
19402
- pythonPath: string().nullable()
19877
+ pythonPath: string().nullable(),
19878
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19403
19879
  });
19404
19880
  var ModelRequirementSchema = object({
19405
19881
  modelId: string(),
@@ -20278,12 +20754,6 @@ Object.freeze({
20278
20754
  addonId: null,
20279
20755
  access: "delete"
20280
20756
  },
20281
- "addons.updateFrameworkPackage": {
20282
- capName: "addons",
20283
- capScope: "system",
20284
- addonId: null,
20285
- access: "create"
20286
- },
20287
20757
  "addons.updatePackage": {
20288
20758
  capName: "addons",
20289
20759
  capScope: "system",
@@ -23056,12 +23526,6 @@ Object.freeze({
23056
23526
  addonId: null,
23057
23527
  access: "view"
23058
23528
  },
23059
- "pipelineExecutor.reprobeEngine": {
23060
- capName: "pipeline-executor",
23061
- capScope: "system",
23062
- addonId: null,
23063
- access: "create"
23064
- },
23065
23529
  "pipelineExecutor.runAudioTest": {
23066
23530
  capName: "pipeline-executor",
23067
23531
  capScope: "system",
@@ -23212,6 +23676,12 @@ Object.freeze({
23212
23676
  addonId: null,
23213
23677
  access: "view"
23214
23678
  },
23679
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23680
+ capName: "pipeline-orchestrator",
23681
+ capScope: "system",
23682
+ addonId: null,
23683
+ access: "view"
23684
+ },
23215
23685
  "pipelineOrchestrator.getPipelineAssignment": {
23216
23686
  capName: "pipeline-orchestrator",
23217
23687
  capScope: "system",
@@ -23224,6 +23694,12 @@ Object.freeze({
23224
23694
  addonId: null,
23225
23695
  access: "view"
23226
23696
  },
23697
+ "pipelineOrchestrator.getPipelineDevicePin": {
23698
+ capName: "pipeline-orchestrator",
23699
+ capScope: "system",
23700
+ addonId: null,
23701
+ access: "view"
23702
+ },
23227
23703
  "pipelineOrchestrator.listAgentSettings": {
23228
23704
  capName: "pipeline-orchestrator",
23229
23705
  capScope: "system",
@@ -23266,19 +23742,19 @@ Object.freeze({
23266
23742
  addonId: null,
23267
23743
  access: "create"
23268
23744
  },
23269
- "pipelineOrchestrator.setAgentAddonDefaults": {
23745
+ "pipelineOrchestrator.setAgentCapabilities": {
23270
23746
  capName: "pipeline-orchestrator",
23271
23747
  capScope: "system",
23272
23748
  addonId: null,
23273
23749
  access: "create"
23274
23750
  },
23275
- "pipelineOrchestrator.setAgentCapabilities": {
23751
+ "pipelineOrchestrator.setAgentDetectWeight": {
23276
23752
  capName: "pipeline-orchestrator",
23277
23753
  capScope: "system",
23278
23754
  addonId: null,
23279
23755
  access: "create"
23280
23756
  },
23281
- "pipelineOrchestrator.setAgentDetectWeight": {
23757
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23282
23758
  capName: "pipeline-orchestrator",
23283
23759
  capScope: "system",
23284
23760
  addonId: null,
@@ -23320,6 +23796,12 @@ Object.freeze({
23320
23796
  addonId: null,
23321
23797
  access: "create"
23322
23798
  },
23799
+ "pipelineOrchestrator.setPipelineDevicePin": {
23800
+ capName: "pipeline-orchestrator",
23801
+ capScope: "system",
23802
+ addonId: null,
23803
+ access: "create"
23804
+ },
23323
23805
  "pipelineOrchestrator.unassignAudio": {
23324
23806
  capName: "pipeline-orchestrator",
23325
23807
  capScope: "system",
@@ -24872,32 +25354,6 @@ Object.freeze({
24872
25354
  "network-access": "ingress",
24873
25355
  "smtp-provider": "email"
24874
25356
  });
24875
- var frameworkSwapPackageSchema = object({
24876
- name: string(),
24877
- stagedPath: string(),
24878
- backupPath: string(),
24879
- toVersion: string(),
24880
- fromVersion: string().nullable()
24881
- });
24882
- object({
24883
- jobId: string(),
24884
- taskId: string(),
24885
- packages: array(frameworkSwapPackageSchema),
24886
- requestedAtMs: number(),
24887
- schemaVersion: literal(1)
24888
- });
24889
- object({
24890
- jobId: string(),
24891
- taskId: string(),
24892
- backups: array(object({
24893
- name: string(),
24894
- backupPath: string(),
24895
- livePath: string()
24896
- })),
24897
- appliedAtMs: number(),
24898
- bootAttempts: number(),
24899
- schemaVersion: literal(1)
24900
- });
24901
25357
  //#endregion
24902
25358
  //#region ../system/dist/model-download-service-Cp9f4dk6.mjs
24903
25359
  /** Build fetch headers, including HF auth token for huggingface.co URLs */