@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.
@@ -7078,6 +7078,17 @@ var ModelCatalogEntrySchema = object({
7078
7078
  "imagenet",
7079
7079
  "none"
7080
7080
  ]).optional(),
7081
+ /**
7082
+ * The model already applies softmax IN-GRAPH — its raw output is a
7083
+ * probability distribution, not logits. When set, the `softmax`
7084
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7085
+ * probability vector collapses it toward uniform (top-1 score craters far
7086
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7087
+ * the output is raw logits and the postprocessor applies softmax (the normal
7088
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7089
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7090
+ */
7091
+ outputProbabilities: boolean().optional(),
7081
7092
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7082
7093
  /**
7083
7094
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7668,6 +7679,160 @@ var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
7668
7679
  function nodePin(nodeId) {
7669
7680
  return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: nodeId } };
7670
7681
  }
7682
+ var COCO_TO_MACRO = {
7683
+ mapping: {
7684
+ person: "person",
7685
+ bicycle: "vehicle",
7686
+ car: "vehicle",
7687
+ motorcycle: "vehicle",
7688
+ airplane: "vehicle",
7689
+ bus: "vehicle",
7690
+ train: "vehicle",
7691
+ truck: "vehicle",
7692
+ boat: "vehicle",
7693
+ bird: "animal",
7694
+ cat: "animal",
7695
+ dog: "animal",
7696
+ horse: "animal",
7697
+ sheep: "animal",
7698
+ cow: "animal",
7699
+ elephant: "animal",
7700
+ bear: "animal",
7701
+ zebra: "animal",
7702
+ giraffe: "animal",
7703
+ suitcase: "package",
7704
+ backpack: "package",
7705
+ handbag: "package"
7706
+ },
7707
+ preserveOriginal: false
7708
+ };
7709
+ var AUDIO_MACRO_LABELS = [
7710
+ {
7711
+ id: "speech",
7712
+ name: "Speech",
7713
+ icon: "🗣️"
7714
+ },
7715
+ {
7716
+ id: "scream",
7717
+ name: "Scream / Shout",
7718
+ icon: "😱"
7719
+ },
7720
+ {
7721
+ id: "crying",
7722
+ name: "Crying / Baby",
7723
+ icon: "😢"
7724
+ },
7725
+ {
7726
+ id: "laughter",
7727
+ name: "Laughter",
7728
+ icon: "😂"
7729
+ },
7730
+ {
7731
+ id: "music",
7732
+ name: "Music",
7733
+ icon: "🎵"
7734
+ },
7735
+ {
7736
+ id: "dog",
7737
+ name: "Dog",
7738
+ icon: "🐕"
7739
+ },
7740
+ {
7741
+ id: "cat",
7742
+ name: "Cat",
7743
+ icon: "🐈"
7744
+ },
7745
+ {
7746
+ id: "bird",
7747
+ name: "Bird",
7748
+ icon: "🐦"
7749
+ },
7750
+ {
7751
+ id: "animal",
7752
+ name: "Animal (other)",
7753
+ icon: "🐾"
7754
+ },
7755
+ {
7756
+ id: "alarm",
7757
+ name: "Alarm / Siren",
7758
+ icon: "🚨"
7759
+ },
7760
+ {
7761
+ id: "doorbell",
7762
+ name: "Doorbell / Knock",
7763
+ icon: "🔔"
7764
+ },
7765
+ {
7766
+ id: "glass_breaking",
7767
+ name: "Glass Breaking",
7768
+ icon: "💥"
7769
+ },
7770
+ {
7771
+ id: "gunshot",
7772
+ name: "Gunshot / Explosion",
7773
+ icon: "💣"
7774
+ },
7775
+ {
7776
+ id: "vehicle",
7777
+ name: "Vehicle",
7778
+ icon: "🚗"
7779
+ },
7780
+ {
7781
+ id: "siren",
7782
+ name: "Emergency Siren",
7783
+ icon: "🚑"
7784
+ },
7785
+ {
7786
+ id: "fire",
7787
+ name: "Fire / Smoke",
7788
+ icon: "🔥"
7789
+ },
7790
+ {
7791
+ id: "water",
7792
+ name: "Water",
7793
+ icon: "💧"
7794
+ },
7795
+ {
7796
+ id: "wind",
7797
+ name: "Wind / Weather",
7798
+ icon: "🌬️"
7799
+ },
7800
+ {
7801
+ id: "door",
7802
+ name: "Door",
7803
+ icon: "🚪"
7804
+ },
7805
+ {
7806
+ id: "footsteps",
7807
+ name: "Footsteps",
7808
+ icon: "👣"
7809
+ },
7810
+ {
7811
+ id: "crowd",
7812
+ name: "Crowd / Chatter",
7813
+ icon: "👥"
7814
+ },
7815
+ {
7816
+ id: "telephone",
7817
+ name: "Telephone",
7818
+ icon: "📞"
7819
+ },
7820
+ {
7821
+ id: "engine",
7822
+ name: "Engine / Motor",
7823
+ icon: "⚙️"
7824
+ },
7825
+ {
7826
+ id: "tools",
7827
+ name: "Tools / Construction",
7828
+ icon: "🔨"
7829
+ },
7830
+ {
7831
+ id: "silence",
7832
+ name: "Silence",
7833
+ icon: "🤫"
7834
+ }
7835
+ ];
7671
7836
  var YAMNET_TO_MACRO = {
7672
7837
  mapping: {
7673
7838
  Speech: "speech",
@@ -7934,6 +8099,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7934
8099
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7935
8100
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7936
8101
  /**
8102
+ * Unified event-kind taxonomy — THE single source of truth for
8103
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8104
+ * icon }`.
8105
+ *
8106
+ * This dictionary folds together what used to be scattered across four
8107
+ * copies:
8108
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8109
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8110
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8111
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8112
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8113
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8114
+ *
8115
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8116
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8117
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8118
+ * color or an icon: they read this dictionary (server descriptors carry the
8119
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8120
+ *
8121
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8122
+ */
8123
+ var TAXONOMY_COLORS = {
8124
+ motion: "#f59e0b",
8125
+ audio: "#06b6d4",
8126
+ person: "#22c55e",
8127
+ vehicle: "#3b82f6",
8128
+ animal: "#f97316",
8129
+ package: "#a855f7",
8130
+ sensor: "#8b5cf6",
8131
+ control: "#10b981",
8132
+ genericDetection: "#64748b"
8133
+ };
8134
+ var DETECTION_SUB_COLORS = {
8135
+ car: "#f59e0b",
8136
+ truck: "#d97706",
8137
+ bus: "#b45309",
8138
+ motorcycle: "#eab308",
8139
+ bicycle: "#ca8a04",
8140
+ airplane: "#60a5fa",
8141
+ boat: "#2563eb",
8142
+ train: "#1d4ed8",
8143
+ bird: "#14b8a6",
8144
+ dog: "#84cc16",
8145
+ cat: "#f97316",
8146
+ horse: "#a16207",
8147
+ sheep: "#a3a3a3",
8148
+ cow: "#78716c",
8149
+ elephant: "#6b7280",
8150
+ bear: "#7c2d12",
8151
+ zebra: "#404040",
8152
+ giraffe: "#d4a373"
8153
+ };
8154
+ function titleCase(id) {
8155
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8156
+ }
8157
+ var entries = /* @__PURE__ */ new Map();
8158
+ function macro(kind, category, color, iconId, label) {
8159
+ entries.set(kind, {
8160
+ kind,
8161
+ parentKind: null,
8162
+ level: "macro",
8163
+ category,
8164
+ color,
8165
+ iconId,
8166
+ labelKey: `eventKind.${kind}`,
8167
+ label
8168
+ });
8169
+ }
8170
+ function sub(kind, parentKind, category, color, iconId, label) {
8171
+ entries.set(kind, {
8172
+ kind,
8173
+ parentKind,
8174
+ level: "sub",
8175
+ category,
8176
+ color,
8177
+ iconId,
8178
+ labelKey: `eventKind.${kind}`,
8179
+ label
8180
+ });
8181
+ }
8182
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8183
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8184
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8185
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8186
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8187
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8188
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8189
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8190
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8191
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8192
+ if (entries.has(cocoClass)) continue;
8193
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8194
+ }
8195
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8196
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8197
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8198
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8199
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8200
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8201
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8202
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8203
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8204
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8205
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8206
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8207
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8208
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8209
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8210
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8211
+ sub("button", "control", "control", "#10b981", "button", "Button");
8212
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8213
+ for (const l of AUDIO_MACRO_LABELS) {
8214
+ const kind = `audio-${l.id}`;
8215
+ if (entries.has(kind)) continue;
8216
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8217
+ }
8218
+ /** The complete taxonomy dictionary, keyed by kind. */
8219
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8220
+ /**
7937
8221
  * Error types for the safe expression engine. Two distinct classes so callers
7938
8222
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7939
8223
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10849,10 +11133,7 @@ var ConfigUISchemaNullableBridge = custom();
10849
11133
  var InferenceCapabilitiesBridge = custom();
10850
11134
  var ModelAvailabilityListBridge = custom();
10851
11135
  var PipelineRunResultBridge = custom();
10852
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10853
- kind: "mutation",
10854
- auth: "admin"
10855
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11136
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10856
11137
  modelId: string(),
10857
11138
  settings: record(string(), unknown()).readonly()
10858
11139
  }))), method(object({ steps: record(string(), object({
@@ -10912,13 +11193,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10912
11193
  * (inputClasses ≠ null) are skipped and served per-track via
10913
11194
  * pipelineRunner.runDetailSubtree (two-plane design).
10914
11195
  */
10915
- plane: _enum(["full", "frame"]).optional()
11196
+ plane: _enum(["full", "frame"]).optional(),
11197
+ /**
11198
+ * Inference-device selector (Phase 2 multi-device). Format
11199
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11200
+ * Omitted ⇒ the runner's default device (current single-engine
11201
+ * behaviour). Selects WHICH device pool of the node runs the call.
11202
+ */
11203
+ deviceKey: string().optional()
10916
11204
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10917
11205
  engine: PipelineEngineChoiceSchema.optional(),
10918
11206
  steps: array(PipelineStepInputSchema).min(1),
10919
11207
  frames: array(FrameInputSchema).min(1).max(255),
10920
11208
  deviceId: number().optional(),
10921
- sessionId: string().optional()
11209
+ sessionId: string().optional(),
11210
+ /**
11211
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11212
+ * the batch to the Python pool's bench preprocess cache
11213
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11214
+ * preprocessed ONCE and every later inference is a pure-inference cache
11215
+ * hit — the sustained-throughput run measures inference, not
11216
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11217
+ * full preprocess every call, correct). Fresh per sustained run;
11218
+ * released via `uncacheFrame`.
11219
+ */
11220
+ frameId: number().int().nonnegative().optional(),
11221
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11222
+ deviceKey: string().optional()
10922
11223
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10923
11224
  data: _instanceof(Uint8Array),
10924
11225
  width: number().int().positive(),
@@ -10950,8 +11251,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10950
11251
  * - `runtime` — main camera-serving engine (no idle TTL).
10951
11252
  * - `warm-override` — benchmark/test override held in the warm
10952
11253
  * cache; auto-disposed after the idle TTL.
11254
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11255
+ * multi-device, keyed by `deviceKey`) resolved
11256
+ * via `resolveDeviceFactory`. Runs alongside the
11257
+ * `runtime` engine on a DIFFERENT accelerator
11258
+ * (NPU / iGPU / Coral) — this is how the
11259
+ * Engines tab shows all pools running at once.
10953
11260
  */
10954
- kind: _enum(["runtime", "warm-override"]),
11261
+ kind: _enum([
11262
+ "runtime",
11263
+ "warm-override",
11264
+ "device-pool"
11265
+ ]),
10955
11266
  /** Native pid of the underlying Python pool (null when no pool). */
10956
11267
  poolPid: number().nullable(),
10957
11268
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11293,7 +11604,14 @@ var RunnerCameraConfigSchema = object({
11293
11604
  * camera's detect node differs from its source-owner (P2d, gated by the
11294
11605
  * `remoteSourcingNodes` rollout setting).
11295
11606
  */
11296
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11607
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11608
+ /**
11609
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11610
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11611
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11612
+ * this only selects WHICH device pool of that node runs the session.
11613
+ */
11614
+ deviceKey: string().optional()
11297
11615
  });
11298
11616
  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;
11299
11617
  /**
@@ -11314,6 +11632,19 @@ var RunnerLocalLoadSchema = object({
11314
11632
  avgInferenceTimeMs: number(),
11315
11633
  /** Total queue depth across motion + detection queues. */
11316
11634
  queueDepthTotal: number(),
11635
+ /**
11636
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11637
+ * this runner currently has attached cameras on, so the orchestrator's second
11638
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11639
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11640
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11641
+ */
11642
+ devices: array(object({
11643
+ deviceKey: string(),
11644
+ backend: string(),
11645
+ attachedCameras: number(),
11646
+ queueDepthTotal: number()
11647
+ })).default([]),
11317
11648
  /** Hardware capability flags reported by this node. */
11318
11649
  hardware: object({
11319
11650
  hasGpu: boolean(),
@@ -12789,6 +13120,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12789
13120
  kind: "mutation",
12790
13121
  auth: "admin"
12791
13122
  });
13123
+ 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;
13124
+ new Set(Object.values(DeviceType));
12792
13125
  /**
12793
13126
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12794
13127
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15922,17 +16255,30 @@ var EventKindCategorySchema = _enum([
15922
16255
  "audio",
15923
16256
  "detection",
15924
16257
  "sensor",
16258
+ "control",
15925
16259
  "custom",
15926
16260
  "package"
15927
16261
  ]);
16262
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16263
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15928
16264
  var EventKindDescriptorSchema = object({
15929
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16265
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15930
16266
  kind: string(),
16267
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16268
+ labelKey: string(),
16269
+ /** English fallback label (kept for clients that don't translate). */
15931
16270
  label: string(),
15932
16271
  /** Hex color for timeline/legend rendering. */
15933
16272
  color: string(),
16273
+ /** Dictionary id → lucide component on the UI side. */
16274
+ iconId: string(),
16275
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15934
16276
  icon: EventKindIconSchema,
15935
16277
  category: EventKindCategorySchema,
16278
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16279
+ parentKind: string().nullable(),
16280
+ /** Derived from `parentKind`, explicit for the client tree. */
16281
+ level: EventKindLevelSchema,
15936
16282
  /** Which cap + device contributes this kind. For built-ins the camera
15937
16283
  * itself; for sensor kinds the LINKED source device. */
15938
16284
  source: object({
@@ -16005,11 +16351,21 @@ var TrackAudioLabelSchema = object({
16005
16351
  firstAt: number(),
16006
16352
  lastAt: number()
16007
16353
  });
16354
+ /**
16355
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16356
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16357
+ * linked sensor/control state change (no positions; carries a snapshot). The
16358
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16359
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16360
+ */
16361
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16008
16362
  var TrackSchema = object({
16009
16363
  trackId: string(),
16010
16364
  deviceId: number(),
16011
16365
  className: string(),
16012
16366
  label: string().optional(),
16367
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16368
+ source: TrackSourceSchema.optional(),
16013
16369
  firstSeen: number(),
16014
16370
  lastSeen: number(),
16015
16371
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16386,6 +16742,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16386
16742
  eventId: string(),
16387
16743
  timestamp: number()
16388
16744
  });
16745
+ /**
16746
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16747
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16748
+ * caps into per-camera event-kind descriptors.
16749
+ *
16750
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16751
+ * is NOT duplicated here — every entry is derived from the single
16752
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16753
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16754
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16755
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16756
+ * eventful cap is missing.
16757
+ */
16758
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16759
+ var LEGACY_ICON = {
16760
+ motion: "motion",
16761
+ audio: "audio",
16762
+ person: "person",
16763
+ vehicle: "vehicle",
16764
+ animal: "animal",
16765
+ package: "package",
16766
+ door: "door",
16767
+ pir: "pir",
16768
+ smoke: "smoke",
16769
+ water: "water",
16770
+ button: "button",
16771
+ generic: "generic",
16772
+ gas: "smoke",
16773
+ vibration: "generic",
16774
+ tamper: "generic",
16775
+ presence: "person",
16776
+ lock: "generic",
16777
+ siren: "generic",
16778
+ switch: "generic",
16779
+ doorbell: "button"
16780
+ };
16781
+ function legacyIcon(iconId) {
16782
+ return LEGACY_ICON[iconId] ?? "generic";
16783
+ }
16784
+ /**
16785
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16786
+ * The anti-drift guard cross-checks this against the eventful caps declared
16787
+ * in `packages/types/src/capabilities/*.cap.ts`.
16788
+ */
16789
+ var CAP_TO_KIND = {
16790
+ contact: "contact",
16791
+ motion: "motion-sensor",
16792
+ smoke: "smoke",
16793
+ flood: "flood",
16794
+ gas: "gas",
16795
+ "carbon-monoxide": "carbon-monoxide",
16796
+ vibration: "vibration",
16797
+ tamper: "tamper",
16798
+ presence: "presence",
16799
+ "enum-sensor": "enum-sensor",
16800
+ "event-emitter": "device-event",
16801
+ "lock-control": "lock",
16802
+ switch: "switch",
16803
+ button: "button",
16804
+ doorbell: "doorbell"
16805
+ };
16806
+ function buildDescriptor(capName, kind) {
16807
+ const t = EVENT_TAXONOMY[kind];
16808
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16809
+ return {
16810
+ ...t,
16811
+ icon: legacyIcon(t.iconId)
16812
+ };
16813
+ }
16814
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16389
16815
  var CameraPipelineConfigSchema = object({
16390
16816
  engine: PipelineEngineChoiceSchema.optional(),
16391
16817
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16404,13 +16830,11 @@ var PipelineTemplateSchema = object({
16404
16830
  createdAt: string(),
16405
16831
  updatedAt: string()
16406
16832
  });
16407
- var AgentAddonConfigSchema = object({
16408
- enabled: boolean(),
16833
+ var DeviceStepConfigSchema = object({
16409
16834
  modelId: string().optional(),
16410
- settings: record(string(), unknown()).readonly()
16835
+ settings: record(string(), unknown()).optional()
16411
16836
  });
16412
16837
  var AgentPipelineSettingsSchema = object({
16413
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16414
16838
  maxCameras: number().int().nonnegative().nullable().default(null),
16415
16839
  /** Per-node detection weight (relative share for the quota balancer). */
16416
16840
  detectWeight: number().positive().optional(),
@@ -16434,7 +16858,22 @@ var AgentPipelineSettingsSchema = object({
16434
16858
  * it already uses to reach the hub). Set this only when the auto-detected
16435
16859
  * address is wrong (multi-homed host, NAT, custom interface).
16436
16860
  */
16437
- reachableHost: string().optional()
16861
+ reachableHost: string().optional(),
16862
+ /**
16863
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16864
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16865
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16866
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16867
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16868
+ * the default model/settings for every camera landing on that accelerator;
16869
+ * a stepId absent ⇒ the step uses that device's format default.
16870
+ */
16871
+ inferenceDevices: record(string(), object({
16872
+ enabled: boolean(),
16873
+ weight: number().positive().optional(),
16874
+ maxSessions: number().int().positive().optional(),
16875
+ steps: record(string(), DeviceStepConfigSchema).optional()
16876
+ })).optional()
16438
16877
  });
16439
16878
  var CameraPipelineForAgentSchema = object({
16440
16879
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16444,14 +16883,13 @@ var CameraPipelineForAgentSchema = object({
16444
16883
  }).nullable()
16445
16884
  });
16446
16885
  var CameraStepOverridePatchSchema = object({
16447
- enabled: boolean().optional(),
16448
16886
  modelId: string().optional(),
16449
16887
  settings: record(string(), unknown()).readonly().optional()
16450
16888
  });
16451
16889
  var CameraPipelineSettingsSchema = object({
16452
16890
  pinnedAgentNodeId: string().optional(),
16453
16891
  stepToggles: record(string(), boolean()).optional(),
16454
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16892
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16455
16893
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16456
16894
  });
16457
16895
  /**
@@ -16665,6 +17103,44 @@ var CameraStatusSchema = object({
16665
17103
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16666
17104
  fetchedAt: number()
16667
17105
  });
17106
+ var NodeInferenceDeviceSchema = object({
17107
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17108
+ key: string(),
17109
+ backend: string(),
17110
+ device: string(),
17111
+ format: _enum(MODEL_FORMATS),
17112
+ /** Whether the node's live probe reports the device as usable right now. */
17113
+ available: boolean(),
17114
+ /**
17115
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17116
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17117
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17118
+ * not a balanced target). An explicit stored value always wins; a stored-only
17119
+ * (unavailable) key keeps its stored value.
17120
+ */
17121
+ enabled: boolean(),
17122
+ /** Relative balancer weight for the enabled device (default 1). */
17123
+ weight: number(),
17124
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17125
+ maxSessions: number().nullable(),
17126
+ /** Object-detection model the executor defaults to for this deviceKey. */
17127
+ defaultModelId: string(),
17128
+ /**
17129
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17130
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17131
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17132
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17133
+ * available per format; this is the stored selection that becomes the
17134
+ * default for EVERY camera landing on this accelerator.
17135
+ */
17136
+ steps: record(string(), DeviceStepConfigSchema).optional()
17137
+ });
17138
+ var NodeInferenceDevicesSchema = object({
17139
+ nodeId: string(),
17140
+ /** False when the node's platform-probe was unreachable (no live device set). */
17141
+ reachable: boolean(),
17142
+ devices: array(NodeInferenceDeviceSchema).readonly()
17143
+ });
16668
17144
  method(object({
16669
17145
  deviceId: number(),
16670
17146
  agentNodeId: string()
@@ -16674,7 +17150,13 @@ method(object({
16674
17150
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16675
17151
  kind: "mutation",
16676
17152
  auth: "admin"
16677
- }), method(_void(), object({ migrated: number() }), {
17153
+ }), method(object({
17154
+ deviceId: number(),
17155
+ deviceKey: string()
17156
+ }), object({ success: literal(true) }), {
17157
+ kind: "mutation",
17158
+ auth: "admin"
17159
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16678
17160
  kind: "mutation",
16679
17161
  auth: "admin"
16680
17162
  }), 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({
@@ -16708,13 +17190,7 @@ method(object({
16708
17190
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16709
17191
  nodeId: string(),
16710
17192
  settings: AgentPipelineSettingsSchema
16711
- })).readonly()), method(object({
16712
- agentNodeId: string(),
16713
- defaults: record(string(), AgentAddonConfigSchema)
16714
- }), object({ success: literal(true) }), {
16715
- kind: "mutation",
16716
- auth: "admin"
16717
- }), method(object({ agentNodeId: string() }), object({
17193
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16718
17194
  success: boolean(),
16719
17195
  removed: boolean()
16720
17196
  }), {
@@ -16746,7 +17222,18 @@ method(object({
16746
17222
  }), object({ success: literal(true) }), {
16747
17223
  kind: "mutation",
16748
17224
  auth: "admin"
16749
- }), method(object({ agentNodeId: string() }), object({
17225
+ }), method(object({
17226
+ agentNodeId: string(),
17227
+ inferenceDevices: record(string(), object({
17228
+ enabled: boolean(),
17229
+ weight: number().positive().optional(),
17230
+ maxSessions: number().int().positive().optional(),
17231
+ steps: record(string(), DeviceStepConfigSchema).optional()
17232
+ }))
17233
+ }), object({ success: literal(true) }), {
17234
+ kind: "mutation",
17235
+ auth: "admin"
17236
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16750
17237
  success: literal(true),
16751
17238
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16752
17239
  effectiveModelId: string().nullable(),
@@ -16762,9 +17249,10 @@ method(object({
16762
17249
  }), object({ success: literal(true) }), {
16763
17250
  kind: "mutation",
16764
17251
  auth: "admin"
16765
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17252
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16766
17253
  deviceId: number(),
16767
17254
  agentNodeId: string(),
17255
+ deviceKey: string(),
16768
17256
  addonId: string(),
16769
17257
  patch: CameraStepOverridePatchSchema.nullable()
16770
17258
  }), object({ success: literal(true) }), {
@@ -16801,14 +17289,13 @@ method(object({
16801
17289
  });
16802
17290
  /**
16803
17291
  * server-management — per-NODE singleton capability for a node's ROOT
16804
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16805
- * agents).
17292
+ * package lifecycle (runtime-updatable node packages).
16806
17293
  *
16807
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16808
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16809
- * version describes the node. Updates install into
16810
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16811
- * starter (probation boot + auto-rollback to N-1).
17294
+ * Every node role runs the SAME root package (`@camstack/server`), which
17295
+ * carries the whole software stack in its npm dep tree, so ONE version
17296
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17297
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17298
+ * no auto-rollback).
16812
17299
  *
16813
17300
  * Providers:
16814
17301
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16916,7 +17403,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16916
17403
  /** Explicit target version; omitted = latest from the registry. */
16917
17404
  version: string().optional() }), ServerUpdateActionResultSchema, {
16918
17405
  kind: "mutation",
16919
- auth: "admin"
17406
+ auth: "admin",
17407
+ timeoutMs: 16 * 6e4
16920
17408
  }), method(_void(), ServerUpdateActionResultSchema, {
16921
17409
  kind: "mutation",
16922
17410
  auth: "admin"
@@ -17960,22 +18448,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17960
18448
  var RestartAddonResultSchema = unknown();
17961
18449
  var InstallPackageResultSchema = unknown();
17962
18450
  var ReloadPackagesResultSchema = unknown();
17963
- /**
17964
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
17965
- * server restarts so the admin UI can react to the `restartingAt`
17966
- * timestamp (shows reconnect overlay). The transition from
17967
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
17968
- * `system.restart-completed` event after the new process boots.
17969
- *
17970
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
17971
- */
17972
- var UpdateFrameworkPackageResultSchema = object({
17973
- packageName: string(),
17974
- fromVersion: string(),
17975
- toVersion: string(),
17976
- /** Ms-epoch the server scheduled its self-restart. */
17977
- restartingAt: number()
17978
- });
17979
18451
  var BulkUpdateItemStatusSchema = _enum([
17980
18452
  "queued",
17981
18453
  "updating",
@@ -18103,13 +18575,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18103
18575
  }), object({ success: literal(true) }), {
18104
18576
  kind: "mutation",
18105
18577
  auth: "admin"
18106
- }), method(object({
18107
- packageName: string().min(1),
18108
- version: string().optional(),
18109
- deferRestart: boolean().optional()
18110
- }), UpdateFrameworkPackageResultSchema, {
18111
- kind: "mutation",
18112
- auth: "admin"
18113
18578
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18114
18579
  kind: "mutation",
18115
18580
  auth: "admin"
@@ -18975,10 +19440,10 @@ var TopologyCategorySchema = object({
18975
19440
  addons: array(TopologyCategoryAddonSchema).readonly()
18976
19441
  });
18977
19442
  /**
18978
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
18979
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
18980
- * version visibility for the Server management surface. Nullable: offline
18981
- * rows and pre-phase-2 nodes report none.
19443
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19444
+ * root package for every node role) as reported by its `registerNode`
19445
+ * manifest — version visibility for the Server management surface. Nullable:
19446
+ * offline rows and nodes that never reported one.
18982
19447
  */
18983
19448
  var TopologyRootPackageSchema = object({
18984
19449
  name: string(),
@@ -19366,17 +19831,28 @@ var PlatformScoreSchema = object({
19366
19831
  format: _enum([
19367
19832
  "onnx",
19368
19833
  "coreml",
19369
- "openvino"
19834
+ "openvino",
19835
+ "tflite"
19370
19836
  ]),
19371
19837
  score: number(),
19372
19838
  reason: string(),
19373
19839
  available: boolean()
19374
19840
  });
19841
+ var InferenceDeviceDescriptorSchema = object({
19842
+ key: string(),
19843
+ backend: string(),
19844
+ device: string(),
19845
+ format: ModelFormatSchema,
19846
+ runtime: literal("python"),
19847
+ score: number(),
19848
+ available: boolean()
19849
+ });
19375
19850
  var PlatformCapabilitiesSchema = object({
19376
19851
  hardware: HardwareInfoSchema,
19377
19852
  scores: array(PlatformScoreSchema).readonly(),
19378
19853
  bestScore: PlatformScoreSchema,
19379
- pythonPath: string().nullable()
19854
+ pythonPath: string().nullable(),
19855
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19380
19856
  });
19381
19857
  var ModelRequirementSchema = object({
19382
19858
  modelId: string(),
@@ -20255,12 +20731,6 @@ Object.freeze({
20255
20731
  addonId: null,
20256
20732
  access: "delete"
20257
20733
  },
20258
- "addons.updateFrameworkPackage": {
20259
- capName: "addons",
20260
- capScope: "system",
20261
- addonId: null,
20262
- access: "create"
20263
- },
20264
20734
  "addons.updatePackage": {
20265
20735
  capName: "addons",
20266
20736
  capScope: "system",
@@ -23033,12 +23503,6 @@ Object.freeze({
23033
23503
  addonId: null,
23034
23504
  access: "view"
23035
23505
  },
23036
- "pipelineExecutor.reprobeEngine": {
23037
- capName: "pipeline-executor",
23038
- capScope: "system",
23039
- addonId: null,
23040
- access: "create"
23041
- },
23042
23506
  "pipelineExecutor.runAudioTest": {
23043
23507
  capName: "pipeline-executor",
23044
23508
  capScope: "system",
@@ -23189,6 +23653,12 @@ Object.freeze({
23189
23653
  addonId: null,
23190
23654
  access: "view"
23191
23655
  },
23656
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23657
+ capName: "pipeline-orchestrator",
23658
+ capScope: "system",
23659
+ addonId: null,
23660
+ access: "view"
23661
+ },
23192
23662
  "pipelineOrchestrator.getPipelineAssignment": {
23193
23663
  capName: "pipeline-orchestrator",
23194
23664
  capScope: "system",
@@ -23201,6 +23671,12 @@ Object.freeze({
23201
23671
  addonId: null,
23202
23672
  access: "view"
23203
23673
  },
23674
+ "pipelineOrchestrator.getPipelineDevicePin": {
23675
+ capName: "pipeline-orchestrator",
23676
+ capScope: "system",
23677
+ addonId: null,
23678
+ access: "view"
23679
+ },
23204
23680
  "pipelineOrchestrator.listAgentSettings": {
23205
23681
  capName: "pipeline-orchestrator",
23206
23682
  capScope: "system",
@@ -23243,19 +23719,19 @@ Object.freeze({
23243
23719
  addonId: null,
23244
23720
  access: "create"
23245
23721
  },
23246
- "pipelineOrchestrator.setAgentAddonDefaults": {
23722
+ "pipelineOrchestrator.setAgentCapabilities": {
23247
23723
  capName: "pipeline-orchestrator",
23248
23724
  capScope: "system",
23249
23725
  addonId: null,
23250
23726
  access: "create"
23251
23727
  },
23252
- "pipelineOrchestrator.setAgentCapabilities": {
23728
+ "pipelineOrchestrator.setAgentDetectWeight": {
23253
23729
  capName: "pipeline-orchestrator",
23254
23730
  capScope: "system",
23255
23731
  addonId: null,
23256
23732
  access: "create"
23257
23733
  },
23258
- "pipelineOrchestrator.setAgentDetectWeight": {
23734
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23259
23735
  capName: "pipeline-orchestrator",
23260
23736
  capScope: "system",
23261
23737
  addonId: null,
@@ -23297,6 +23773,12 @@ Object.freeze({
23297
23773
  addonId: null,
23298
23774
  access: "create"
23299
23775
  },
23776
+ "pipelineOrchestrator.setPipelineDevicePin": {
23777
+ capName: "pipeline-orchestrator",
23778
+ capScope: "system",
23779
+ addonId: null,
23780
+ access: "create"
23781
+ },
23300
23782
  "pipelineOrchestrator.unassignAudio": {
23301
23783
  capName: "pipeline-orchestrator",
23302
23784
  capScope: "system",
@@ -24849,32 +25331,6 @@ Object.freeze({
24849
25331
  "network-access": "ingress",
24850
25332
  "smtp-provider": "email"
24851
25333
  });
24852
- var frameworkSwapPackageSchema = object({
24853
- name: string(),
24854
- stagedPath: string(),
24855
- backupPath: string(),
24856
- toVersion: string(),
24857
- fromVersion: string().nullable()
24858
- });
24859
- object({
24860
- jobId: string(),
24861
- taskId: string(),
24862
- packages: array(frameworkSwapPackageSchema),
24863
- requestedAtMs: number(),
24864
- schemaVersion: literal(1)
24865
- });
24866
- object({
24867
- jobId: string(),
24868
- taskId: string(),
24869
- backups: array(object({
24870
- name: string(),
24871
- backupPath: string(),
24872
- livePath: string()
24873
- })),
24874
- appliedAtMs: number(),
24875
- bootAttempts: number(),
24876
- schemaVersion: literal(1)
24877
- });
24878
25334
  //#endregion
24879
25335
  //#region ../system/dist/model-download-service-Cp9f4dk6.mjs
24880
25336
  /** Build fetch headers, including HF auth token for huggingface.co URLs */