@camstack/addon-provider-rtsp 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.
Files changed (3) hide show
  1. package/dist/addon.js +560 -104
  2. package/dist/addon.mjs +560 -104
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -7086,6 +7086,17 @@ var ModelCatalogEntrySchema = object({
7086
7086
  "imagenet",
7087
7087
  "none"
7088
7088
  ]).optional(),
7089
+ /**
7090
+ * The model already applies softmax IN-GRAPH — its raw output is a
7091
+ * probability distribution, not logits. When set, the `softmax`
7092
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7093
+ * probability vector collapses it toward uniform (top-1 score craters far
7094
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7095
+ * the output is raw logits and the postprocessor applies softmax (the normal
7096
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7097
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7098
+ */
7099
+ outputProbabilities: boolean().optional(),
7089
7100
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7090
7101
  /**
7091
7102
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7677,6 +7688,160 @@ var EncodeProfileSchema = object({
7677
7688
  */
7678
7689
  outputArgs: array(string()).optional()
7679
7690
  });
7691
+ var COCO_TO_MACRO = {
7692
+ mapping: {
7693
+ person: "person",
7694
+ bicycle: "vehicle",
7695
+ car: "vehicle",
7696
+ motorcycle: "vehicle",
7697
+ airplane: "vehicle",
7698
+ bus: "vehicle",
7699
+ train: "vehicle",
7700
+ truck: "vehicle",
7701
+ boat: "vehicle",
7702
+ bird: "animal",
7703
+ cat: "animal",
7704
+ dog: "animal",
7705
+ horse: "animal",
7706
+ sheep: "animal",
7707
+ cow: "animal",
7708
+ elephant: "animal",
7709
+ bear: "animal",
7710
+ zebra: "animal",
7711
+ giraffe: "animal",
7712
+ suitcase: "package",
7713
+ backpack: "package",
7714
+ handbag: "package"
7715
+ },
7716
+ preserveOriginal: false
7717
+ };
7718
+ var AUDIO_MACRO_LABELS = [
7719
+ {
7720
+ id: "speech",
7721
+ name: "Speech",
7722
+ icon: "🗣️"
7723
+ },
7724
+ {
7725
+ id: "scream",
7726
+ name: "Scream / Shout",
7727
+ icon: "😱"
7728
+ },
7729
+ {
7730
+ id: "crying",
7731
+ name: "Crying / Baby",
7732
+ icon: "😢"
7733
+ },
7734
+ {
7735
+ id: "laughter",
7736
+ name: "Laughter",
7737
+ icon: "😂"
7738
+ },
7739
+ {
7740
+ id: "music",
7741
+ name: "Music",
7742
+ icon: "🎵"
7743
+ },
7744
+ {
7745
+ id: "dog",
7746
+ name: "Dog",
7747
+ icon: "🐕"
7748
+ },
7749
+ {
7750
+ id: "cat",
7751
+ name: "Cat",
7752
+ icon: "🐈"
7753
+ },
7754
+ {
7755
+ id: "bird",
7756
+ name: "Bird",
7757
+ icon: "🐦"
7758
+ },
7759
+ {
7760
+ id: "animal",
7761
+ name: "Animal (other)",
7762
+ icon: "🐾"
7763
+ },
7764
+ {
7765
+ id: "alarm",
7766
+ name: "Alarm / Siren",
7767
+ icon: "🚨"
7768
+ },
7769
+ {
7770
+ id: "doorbell",
7771
+ name: "Doorbell / Knock",
7772
+ icon: "🔔"
7773
+ },
7774
+ {
7775
+ id: "glass_breaking",
7776
+ name: "Glass Breaking",
7777
+ icon: "💥"
7778
+ },
7779
+ {
7780
+ id: "gunshot",
7781
+ name: "Gunshot / Explosion",
7782
+ icon: "💣"
7783
+ },
7784
+ {
7785
+ id: "vehicle",
7786
+ name: "Vehicle",
7787
+ icon: "🚗"
7788
+ },
7789
+ {
7790
+ id: "siren",
7791
+ name: "Emergency Siren",
7792
+ icon: "🚑"
7793
+ },
7794
+ {
7795
+ id: "fire",
7796
+ name: "Fire / Smoke",
7797
+ icon: "🔥"
7798
+ },
7799
+ {
7800
+ id: "water",
7801
+ name: "Water",
7802
+ icon: "💧"
7803
+ },
7804
+ {
7805
+ id: "wind",
7806
+ name: "Wind / Weather",
7807
+ icon: "🌬️"
7808
+ },
7809
+ {
7810
+ id: "door",
7811
+ name: "Door",
7812
+ icon: "🚪"
7813
+ },
7814
+ {
7815
+ id: "footsteps",
7816
+ name: "Footsteps",
7817
+ icon: "👣"
7818
+ },
7819
+ {
7820
+ id: "crowd",
7821
+ name: "Crowd / Chatter",
7822
+ icon: "👥"
7823
+ },
7824
+ {
7825
+ id: "telephone",
7826
+ name: "Telephone",
7827
+ icon: "📞"
7828
+ },
7829
+ {
7830
+ id: "engine",
7831
+ name: "Engine / Motor",
7832
+ icon: "⚙️"
7833
+ },
7834
+ {
7835
+ id: "tools",
7836
+ name: "Tools / Construction",
7837
+ icon: "🔨"
7838
+ },
7839
+ {
7840
+ id: "silence",
7841
+ name: "Silence",
7842
+ icon: "🤫"
7843
+ }
7844
+ ];
7680
7845
  var YAMNET_TO_MACRO = {
7681
7846
  mapping: {
7682
7847
  Speech: "speech",
@@ -7943,6 +8108,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7943
8108
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7944
8109
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7945
8110
  /**
8111
+ * Unified event-kind taxonomy — THE single source of truth for
8112
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8113
+ * icon }`.
8114
+ *
8115
+ * This dictionary folds together what used to be scattered across four
8116
+ * copies:
8117
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8118
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8119
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8120
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8121
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8122
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8123
+ *
8124
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8125
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8126
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8127
+ * color or an icon: they read this dictionary (server descriptors carry the
8128
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8129
+ *
8130
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8131
+ */
8132
+ var TAXONOMY_COLORS = {
8133
+ motion: "#f59e0b",
8134
+ audio: "#06b6d4",
8135
+ person: "#22c55e",
8136
+ vehicle: "#3b82f6",
8137
+ animal: "#f97316",
8138
+ package: "#a855f7",
8139
+ sensor: "#8b5cf6",
8140
+ control: "#10b981",
8141
+ genericDetection: "#64748b"
8142
+ };
8143
+ var DETECTION_SUB_COLORS = {
8144
+ car: "#f59e0b",
8145
+ truck: "#d97706",
8146
+ bus: "#b45309",
8147
+ motorcycle: "#eab308",
8148
+ bicycle: "#ca8a04",
8149
+ airplane: "#60a5fa",
8150
+ boat: "#2563eb",
8151
+ train: "#1d4ed8",
8152
+ bird: "#14b8a6",
8153
+ dog: "#84cc16",
8154
+ cat: "#f97316",
8155
+ horse: "#a16207",
8156
+ sheep: "#a3a3a3",
8157
+ cow: "#78716c",
8158
+ elephant: "#6b7280",
8159
+ bear: "#7c2d12",
8160
+ zebra: "#404040",
8161
+ giraffe: "#d4a373"
8162
+ };
8163
+ function titleCase(id) {
8164
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8165
+ }
8166
+ var entries = /* @__PURE__ */ new Map();
8167
+ function macro(kind, category, color, iconId, label) {
8168
+ entries.set(kind, {
8169
+ kind,
8170
+ parentKind: null,
8171
+ level: "macro",
8172
+ category,
8173
+ color,
8174
+ iconId,
8175
+ labelKey: `eventKind.${kind}`,
8176
+ label
8177
+ });
8178
+ }
8179
+ function sub(kind, parentKind, category, color, iconId, label) {
8180
+ entries.set(kind, {
8181
+ kind,
8182
+ parentKind,
8183
+ level: "sub",
8184
+ category,
8185
+ color,
8186
+ iconId,
8187
+ labelKey: `eventKind.${kind}`,
8188
+ label
8189
+ });
8190
+ }
8191
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8192
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8193
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8194
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8195
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8196
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8197
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8198
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8199
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8200
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8201
+ if (entries.has(cocoClass)) continue;
8202
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8203
+ }
8204
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8205
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8206
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8207
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8208
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8209
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8210
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8211
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8212
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8213
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8214
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8215
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8216
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8217
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8218
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8219
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8220
+ sub("button", "control", "control", "#10b981", "button", "Button");
8221
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8222
+ for (const l of AUDIO_MACRO_LABELS) {
8223
+ const kind = `audio-${l.id}`;
8224
+ if (entries.has(kind)) continue;
8225
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8226
+ }
8227
+ /** The complete taxonomy dictionary, keyed by kind. */
8228
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8229
+ /**
7946
8230
  * Error types for the safe expression engine. Two distinct classes so callers
7947
8231
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7948
8232
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12201,10 +12485,7 @@ var ConfigUISchemaNullableBridge = custom();
12201
12485
  var InferenceCapabilitiesBridge = custom();
12202
12486
  var ModelAvailabilityListBridge = custom();
12203
12487
  var PipelineRunResultBridge = custom();
12204
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12205
- kind: "mutation",
12206
- auth: "admin"
12207
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12488
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12208
12489
  modelId: string(),
12209
12490
  settings: record(string(), unknown()).readonly()
12210
12491
  }))), method(object({ steps: record(string(), object({
@@ -12264,13 +12545,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12264
12545
  * (inputClasses ≠ null) are skipped and served per-track via
12265
12546
  * pipelineRunner.runDetailSubtree (two-plane design).
12266
12547
  */
12267
- plane: _enum(["full", "frame"]).optional()
12548
+ plane: _enum(["full", "frame"]).optional(),
12549
+ /**
12550
+ * Inference-device selector (Phase 2 multi-device). Format
12551
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12552
+ * Omitted ⇒ the runner's default device (current single-engine
12553
+ * behaviour). Selects WHICH device pool of the node runs the call.
12554
+ */
12555
+ deviceKey: string().optional()
12268
12556
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12269
12557
  engine: PipelineEngineChoiceSchema.optional(),
12270
12558
  steps: array(PipelineStepInputSchema).min(1),
12271
12559
  frames: array(FrameInputSchema).min(1).max(255),
12272
12560
  deviceId: number().optional(),
12273
- sessionId: string().optional()
12561
+ sessionId: string().optional(),
12562
+ /**
12563
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12564
+ * the batch to the Python pool's bench preprocess cache
12565
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12566
+ * preprocessed ONCE and every later inference is a pure-inference cache
12567
+ * hit — the sustained-throughput run measures inference, not
12568
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12569
+ * full preprocess every call, correct). Fresh per sustained run;
12570
+ * released via `uncacheFrame`.
12571
+ */
12572
+ frameId: number().int().nonnegative().optional(),
12573
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12574
+ deviceKey: string().optional()
12274
12575
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12275
12576
  data: _instanceof(Uint8Array),
12276
12577
  width: number().int().positive(),
@@ -12302,8 +12603,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12302
12603
  * - `runtime` — main camera-serving engine (no idle TTL).
12303
12604
  * - `warm-override` — benchmark/test override held in the warm
12304
12605
  * cache; auto-disposed after the idle TTL.
12606
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12607
+ * multi-device, keyed by `deviceKey`) resolved
12608
+ * via `resolveDeviceFactory`. Runs alongside the
12609
+ * `runtime` engine on a DIFFERENT accelerator
12610
+ * (NPU / iGPU / Coral) — this is how the
12611
+ * Engines tab shows all pools running at once.
12305
12612
  */
12306
- kind: _enum(["runtime", "warm-override"]),
12613
+ kind: _enum([
12614
+ "runtime",
12615
+ "warm-override",
12616
+ "device-pool"
12617
+ ]),
12307
12618
  /** Native pid of the underlying Python pool (null when no pool). */
12308
12619
  poolPid: number().nullable(),
12309
12620
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12678,7 +12989,14 @@ var RunnerCameraConfigSchema = object({
12678
12989
  * camera's detect node differs from its source-owner (P2d, gated by the
12679
12990
  * `remoteSourcingNodes` rollout setting).
12680
12991
  */
12681
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12992
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12993
+ /**
12994
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12995
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12996
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12997
+ * this only selects WHICH device pool of that node runs the session.
12998
+ */
12999
+ deviceKey: string().optional()
12682
13000
  });
12683
13001
  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;
12684
13002
  /**
@@ -12699,6 +13017,19 @@ var RunnerLocalLoadSchema = object({
12699
13017
  avgInferenceTimeMs: number(),
12700
13018
  /** Total queue depth across motion + detection queues. */
12701
13019
  queueDepthTotal: number(),
13020
+ /**
13021
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
13022
+ * this runner currently has attached cameras on, so the orchestrator's second
13023
+ * `balance()` pass (over a node's devices) weights on real per-pool session
13024
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
13025
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
13026
+ */
13027
+ devices: array(object({
13028
+ deviceKey: string(),
13029
+ backend: string(),
13030
+ attachedCameras: number(),
13031
+ queueDepthTotal: number()
13032
+ })).default([]),
12702
13033
  /** Hardware capability flags reported by this node. */
12703
13034
  hardware: object({
12704
13035
  hasGpu: boolean(),
@@ -15847,6 +16178,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15847
16178
  return toDeviceSummary(device, this.addonId);
15848
16179
  }
15849
16180
  };
16181
+ 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;
16182
+ new Set(Object.values(DeviceType));
15850
16183
  /**
15851
16184
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15852
16185
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18941,17 +19274,30 @@ var EventKindCategorySchema = _enum([
18941
19274
  "audio",
18942
19275
  "detection",
18943
19276
  "sensor",
19277
+ "control",
18944
19278
  "custom",
18945
19279
  "package"
18946
19280
  ]);
19281
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19282
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18947
19283
  var EventKindDescriptorSchema = object({
18948
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19284
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18949
19285
  kind: string(),
19286
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19287
+ labelKey: string(),
19288
+ /** English fallback label (kept for clients that don't translate). */
18950
19289
  label: string(),
18951
19290
  /** Hex color for timeline/legend rendering. */
18952
19291
  color: string(),
19292
+ /** Dictionary id → lucide component on the UI side. */
19293
+ iconId: string(),
19294
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18953
19295
  icon: EventKindIconSchema,
18954
19296
  category: EventKindCategorySchema,
19297
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19298
+ parentKind: string().nullable(),
19299
+ /** Derived from `parentKind`, explicit for the client tree. */
19300
+ level: EventKindLevelSchema,
18955
19301
  /** Which cap + device contributes this kind. For built-ins the camera
18956
19302
  * itself; for sensor kinds the LINKED source device. */
18957
19303
  source: object({
@@ -19024,11 +19370,21 @@ var TrackAudioLabelSchema = object({
19024
19370
  firstAt: number(),
19025
19371
  lastAt: number()
19026
19372
  });
19373
+ /**
19374
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19375
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19376
+ * linked sensor/control state change (no positions; carries a snapshot). The
19377
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19378
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19379
+ */
19380
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19027
19381
  var TrackSchema = object({
19028
19382
  trackId: string(),
19029
19383
  deviceId: number(),
19030
19384
  className: string(),
19031
19385
  label: string().optional(),
19386
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19387
+ source: TrackSourceSchema.optional(),
19032
19388
  firstSeen: number(),
19033
19389
  lastSeen: number(),
19034
19390
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19405,6 +19761,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19405
19761
  eventId: string(),
19406
19762
  timestamp: number()
19407
19763
  });
19764
+ /**
19765
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19766
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19767
+ * caps into per-camera event-kind descriptors.
19768
+ *
19769
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19770
+ * is NOT duplicated here — every entry is derived from the single
19771
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19772
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19773
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19774
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19775
+ * eventful cap is missing.
19776
+ */
19777
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19778
+ var LEGACY_ICON = {
19779
+ motion: "motion",
19780
+ audio: "audio",
19781
+ person: "person",
19782
+ vehicle: "vehicle",
19783
+ animal: "animal",
19784
+ package: "package",
19785
+ door: "door",
19786
+ pir: "pir",
19787
+ smoke: "smoke",
19788
+ water: "water",
19789
+ button: "button",
19790
+ generic: "generic",
19791
+ gas: "smoke",
19792
+ vibration: "generic",
19793
+ tamper: "generic",
19794
+ presence: "person",
19795
+ lock: "generic",
19796
+ siren: "generic",
19797
+ switch: "generic",
19798
+ doorbell: "button"
19799
+ };
19800
+ function legacyIcon(iconId) {
19801
+ return LEGACY_ICON[iconId] ?? "generic";
19802
+ }
19803
+ /**
19804
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19805
+ * The anti-drift guard cross-checks this against the eventful caps declared
19806
+ * in `packages/types/src/capabilities/*.cap.ts`.
19807
+ */
19808
+ var CAP_TO_KIND = {
19809
+ contact: "contact",
19810
+ motion: "motion-sensor",
19811
+ smoke: "smoke",
19812
+ flood: "flood",
19813
+ gas: "gas",
19814
+ "carbon-monoxide": "carbon-monoxide",
19815
+ vibration: "vibration",
19816
+ tamper: "tamper",
19817
+ presence: "presence",
19818
+ "enum-sensor": "enum-sensor",
19819
+ "event-emitter": "device-event",
19820
+ "lock-control": "lock",
19821
+ switch: "switch",
19822
+ button: "button",
19823
+ doorbell: "doorbell"
19824
+ };
19825
+ function buildDescriptor(capName, kind) {
19826
+ const t = EVENT_TAXONOMY[kind];
19827
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19828
+ return {
19829
+ ...t,
19830
+ icon: legacyIcon(t.iconId)
19831
+ };
19832
+ }
19833
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19408
19834
  var CameraPipelineConfigSchema = object({
19409
19835
  engine: PipelineEngineChoiceSchema.optional(),
19410
19836
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19423,13 +19849,11 @@ var PipelineTemplateSchema = object({
19423
19849
  createdAt: string(),
19424
19850
  updatedAt: string()
19425
19851
  });
19426
- var AgentAddonConfigSchema = object({
19427
- enabled: boolean(),
19852
+ var DeviceStepConfigSchema = object({
19428
19853
  modelId: string().optional(),
19429
- settings: record(string(), unknown()).readonly()
19854
+ settings: record(string(), unknown()).optional()
19430
19855
  });
19431
19856
  var AgentPipelineSettingsSchema = object({
19432
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19433
19857
  maxCameras: number().int().nonnegative().nullable().default(null),
19434
19858
  /** Per-node detection weight (relative share for the quota balancer). */
19435
19859
  detectWeight: number().positive().optional(),
@@ -19453,7 +19877,22 @@ var AgentPipelineSettingsSchema = object({
19453
19877
  * it already uses to reach the hub). Set this only when the auto-detected
19454
19878
  * address is wrong (multi-homed host, NAT, custom interface).
19455
19879
  */
19456
- reachableHost: string().optional()
19880
+ reachableHost: string().optional(),
19881
+ /**
19882
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19883
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19884
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19885
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19886
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19887
+ * the default model/settings for every camera landing on that accelerator;
19888
+ * a stepId absent ⇒ the step uses that device's format default.
19889
+ */
19890
+ inferenceDevices: record(string(), object({
19891
+ enabled: boolean(),
19892
+ weight: number().positive().optional(),
19893
+ maxSessions: number().int().positive().optional(),
19894
+ steps: record(string(), DeviceStepConfigSchema).optional()
19895
+ })).optional()
19457
19896
  });
19458
19897
  var CameraPipelineForAgentSchema = object({
19459
19898
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19463,14 +19902,13 @@ var CameraPipelineForAgentSchema = object({
19463
19902
  }).nullable()
19464
19903
  });
19465
19904
  var CameraStepOverridePatchSchema = object({
19466
- enabled: boolean().optional(),
19467
19905
  modelId: string().optional(),
19468
19906
  settings: record(string(), unknown()).readonly().optional()
19469
19907
  });
19470
19908
  var CameraPipelineSettingsSchema = object({
19471
19909
  pinnedAgentNodeId: string().optional(),
19472
19910
  stepToggles: record(string(), boolean()).optional(),
19473
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19911
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19474
19912
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19475
19913
  });
19476
19914
  /**
@@ -19684,6 +20122,44 @@ var CameraStatusSchema = object({
19684
20122
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19685
20123
  fetchedAt: number()
19686
20124
  });
20125
+ var NodeInferenceDeviceSchema = object({
20126
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20127
+ key: string(),
20128
+ backend: string(),
20129
+ device: string(),
20130
+ format: _enum(MODEL_FORMATS),
20131
+ /** Whether the node's live probe reports the device as usable right now. */
20132
+ available: boolean(),
20133
+ /**
20134
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20135
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20136
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20137
+ * not a balanced target). An explicit stored value always wins; a stored-only
20138
+ * (unavailable) key keeps its stored value.
20139
+ */
20140
+ enabled: boolean(),
20141
+ /** Relative balancer weight for the enabled device (default 1). */
20142
+ weight: number(),
20143
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20144
+ maxSessions: number().nullable(),
20145
+ /** Object-detection model the executor defaults to for this deviceKey. */
20146
+ defaultModelId: string(),
20147
+ /**
20148
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20149
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20150
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20151
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20152
+ * available per format; this is the stored selection that becomes the
20153
+ * default for EVERY camera landing on this accelerator.
20154
+ */
20155
+ steps: record(string(), DeviceStepConfigSchema).optional()
20156
+ });
20157
+ var NodeInferenceDevicesSchema = object({
20158
+ nodeId: string(),
20159
+ /** False when the node's platform-probe was unreachable (no live device set). */
20160
+ reachable: boolean(),
20161
+ devices: array(NodeInferenceDeviceSchema).readonly()
20162
+ });
19687
20163
  method(object({
19688
20164
  deviceId: number(),
19689
20165
  agentNodeId: string()
@@ -19693,7 +20169,13 @@ method(object({
19693
20169
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19694
20170
  kind: "mutation",
19695
20171
  auth: "admin"
19696
- }), method(_void(), object({ migrated: number() }), {
20172
+ }), method(object({
20173
+ deviceId: number(),
20174
+ deviceKey: string()
20175
+ }), object({ success: literal(true) }), {
20176
+ kind: "mutation",
20177
+ auth: "admin"
20178
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19697
20179
  kind: "mutation",
19698
20180
  auth: "admin"
19699
20181
  }), 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({
@@ -19727,13 +20209,7 @@ method(object({
19727
20209
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19728
20210
  nodeId: string(),
19729
20211
  settings: AgentPipelineSettingsSchema
19730
- })).readonly()), method(object({
19731
- agentNodeId: string(),
19732
- defaults: record(string(), AgentAddonConfigSchema)
19733
- }), object({ success: literal(true) }), {
19734
- kind: "mutation",
19735
- auth: "admin"
19736
- }), method(object({ agentNodeId: string() }), object({
20212
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19737
20213
  success: boolean(),
19738
20214
  removed: boolean()
19739
20215
  }), {
@@ -19765,7 +20241,18 @@ method(object({
19765
20241
  }), object({ success: literal(true) }), {
19766
20242
  kind: "mutation",
19767
20243
  auth: "admin"
19768
- }), method(object({ agentNodeId: string() }), object({
20244
+ }), method(object({
20245
+ agentNodeId: string(),
20246
+ inferenceDevices: record(string(), object({
20247
+ enabled: boolean(),
20248
+ weight: number().positive().optional(),
20249
+ maxSessions: number().int().positive().optional(),
20250
+ steps: record(string(), DeviceStepConfigSchema).optional()
20251
+ }))
20252
+ }), object({ success: literal(true) }), {
20253
+ kind: "mutation",
20254
+ auth: "admin"
20255
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19769
20256
  success: literal(true),
19770
20257
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19771
20258
  effectiveModelId: string().nullable(),
@@ -19781,9 +20268,10 @@ method(object({
19781
20268
  }), object({ success: literal(true) }), {
19782
20269
  kind: "mutation",
19783
20270
  auth: "admin"
19784
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20271
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19785
20272
  deviceId: number(),
19786
20273
  agentNodeId: string(),
20274
+ deviceKey: string(),
19787
20275
  addonId: string(),
19788
20276
  patch: CameraStepOverridePatchSchema.nullable()
19789
20277
  }), object({ success: literal(true) }), {
@@ -19820,14 +20308,13 @@ method(object({
19820
20308
  });
19821
20309
  /**
19822
20310
  * server-management — per-NODE singleton capability for a node's ROOT
19823
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19824
- * agents).
20311
+ * package lifecycle (runtime-updatable node packages).
19825
20312
  *
19826
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19827
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19828
- * version describes the node. Updates install into
19829
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19830
- * starter (probation boot + auto-rollback to N-1).
20313
+ * Every node role runs the SAME root package (`@camstack/server`), which
20314
+ * carries the whole software stack in its npm dep tree, so ONE version
20315
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20316
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20317
+ * no auto-rollback).
19831
20318
  *
19832
20319
  * Providers:
19833
20320
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19935,7 +20422,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19935
20422
  /** Explicit target version; omitted = latest from the registry. */
19936
20423
  version: string().optional() }), ServerUpdateActionResultSchema, {
19937
20424
  kind: "mutation",
19938
- auth: "admin"
20425
+ auth: "admin",
20426
+ timeoutMs: 16 * 6e4
19939
20427
  }), method(_void(), ServerUpdateActionResultSchema, {
19940
20428
  kind: "mutation",
19941
20429
  auth: "admin"
@@ -21030,22 +21518,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21030
21518
  var RestartAddonResultSchema = unknown();
21031
21519
  var InstallPackageResultSchema = unknown();
21032
21520
  var ReloadPackagesResultSchema = unknown();
21033
- /**
21034
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
21035
- * server restarts so the admin UI can react to the `restartingAt`
21036
- * timestamp (shows reconnect overlay). The transition from
21037
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
21038
- * `system.restart-completed` event after the new process boots.
21039
- *
21040
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
21041
- */
21042
- var UpdateFrameworkPackageResultSchema = object({
21043
- packageName: string(),
21044
- fromVersion: string(),
21045
- toVersion: string(),
21046
- /** Ms-epoch the server scheduled its self-restart. */
21047
- restartingAt: number()
21048
- });
21049
21521
  var BulkUpdateItemStatusSchema = _enum([
21050
21522
  "queued",
21051
21523
  "updating",
@@ -21173,13 +21645,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21173
21645
  }), object({ success: literal(true) }), {
21174
21646
  kind: "mutation",
21175
21647
  auth: "admin"
21176
- }), method(object({
21177
- packageName: string().min(1),
21178
- version: string().optional(),
21179
- deferRestart: boolean().optional()
21180
- }), UpdateFrameworkPackageResultSchema, {
21181
- kind: "mutation",
21182
- auth: "admin"
21183
21648
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21184
21649
  kind: "mutation",
21185
21650
  auth: "admin"
@@ -22045,10 +22510,10 @@ var TopologyCategorySchema = object({
22045
22510
  addons: array(TopologyCategoryAddonSchema).readonly()
22046
22511
  });
22047
22512
  /**
22048
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
22049
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
22050
- * version visibility for the Server management surface. Nullable: offline
22051
- * rows and pre-phase-2 nodes report none.
22513
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22514
+ * root package for every node role) as reported by its `registerNode`
22515
+ * manifest — version visibility for the Server management surface. Nullable:
22516
+ * offline rows and nodes that never reported one.
22052
22517
  */
22053
22518
  var TopologyRootPackageSchema = object({
22054
22519
  name: string(),
@@ -22436,17 +22901,28 @@ var PlatformScoreSchema = object({
22436
22901
  format: _enum([
22437
22902
  "onnx",
22438
22903
  "coreml",
22439
- "openvino"
22904
+ "openvino",
22905
+ "tflite"
22440
22906
  ]),
22441
22907
  score: number(),
22442
22908
  reason: string(),
22443
22909
  available: boolean()
22444
22910
  });
22911
+ var InferenceDeviceDescriptorSchema = object({
22912
+ key: string(),
22913
+ backend: string(),
22914
+ device: string(),
22915
+ format: ModelFormatSchema,
22916
+ runtime: literal("python"),
22917
+ score: number(),
22918
+ available: boolean()
22919
+ });
22445
22920
  var PlatformCapabilitiesSchema = object({
22446
22921
  hardware: HardwareInfoSchema,
22447
22922
  scores: array(PlatformScoreSchema).readonly(),
22448
22923
  bestScore: PlatformScoreSchema,
22449
- pythonPath: string().nullable()
22924
+ pythonPath: string().nullable(),
22925
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22450
22926
  });
22451
22927
  var ModelRequirementSchema = object({
22452
22928
  modelId: string(),
@@ -23338,12 +23814,6 @@ Object.freeze({
23338
23814
  addonId: null,
23339
23815
  access: "delete"
23340
23816
  },
23341
- "addons.updateFrameworkPackage": {
23342
- capName: "addons",
23343
- capScope: "system",
23344
- addonId: null,
23345
- access: "create"
23346
- },
23347
23817
  "addons.updatePackage": {
23348
23818
  capName: "addons",
23349
23819
  capScope: "system",
@@ -26116,12 +26586,6 @@ Object.freeze({
26116
26586
  addonId: null,
26117
26587
  access: "view"
26118
26588
  },
26119
- "pipelineExecutor.reprobeEngine": {
26120
- capName: "pipeline-executor",
26121
- capScope: "system",
26122
- addonId: null,
26123
- access: "create"
26124
- },
26125
26589
  "pipelineExecutor.runAudioTest": {
26126
26590
  capName: "pipeline-executor",
26127
26591
  capScope: "system",
@@ -26272,6 +26736,12 @@ Object.freeze({
26272
26736
  addonId: null,
26273
26737
  access: "view"
26274
26738
  },
26739
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26740
+ capName: "pipeline-orchestrator",
26741
+ capScope: "system",
26742
+ addonId: null,
26743
+ access: "view"
26744
+ },
26275
26745
  "pipelineOrchestrator.getPipelineAssignment": {
26276
26746
  capName: "pipeline-orchestrator",
26277
26747
  capScope: "system",
@@ -26284,6 +26754,12 @@ Object.freeze({
26284
26754
  addonId: null,
26285
26755
  access: "view"
26286
26756
  },
26757
+ "pipelineOrchestrator.getPipelineDevicePin": {
26758
+ capName: "pipeline-orchestrator",
26759
+ capScope: "system",
26760
+ addonId: null,
26761
+ access: "view"
26762
+ },
26287
26763
  "pipelineOrchestrator.listAgentSettings": {
26288
26764
  capName: "pipeline-orchestrator",
26289
26765
  capScope: "system",
@@ -26326,19 +26802,19 @@ Object.freeze({
26326
26802
  addonId: null,
26327
26803
  access: "create"
26328
26804
  },
26329
- "pipelineOrchestrator.setAgentAddonDefaults": {
26805
+ "pipelineOrchestrator.setAgentCapabilities": {
26330
26806
  capName: "pipeline-orchestrator",
26331
26807
  capScope: "system",
26332
26808
  addonId: null,
26333
26809
  access: "create"
26334
26810
  },
26335
- "pipelineOrchestrator.setAgentCapabilities": {
26811
+ "pipelineOrchestrator.setAgentDetectWeight": {
26336
26812
  capName: "pipeline-orchestrator",
26337
26813
  capScope: "system",
26338
26814
  addonId: null,
26339
26815
  access: "create"
26340
26816
  },
26341
- "pipelineOrchestrator.setAgentDetectWeight": {
26817
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26342
26818
  capName: "pipeline-orchestrator",
26343
26819
  capScope: "system",
26344
26820
  addonId: null,
@@ -26380,6 +26856,12 @@ Object.freeze({
26380
26856
  addonId: null,
26381
26857
  access: "create"
26382
26858
  },
26859
+ "pipelineOrchestrator.setPipelineDevicePin": {
26860
+ capName: "pipeline-orchestrator",
26861
+ capScope: "system",
26862
+ addonId: null,
26863
+ access: "create"
26864
+ },
26383
26865
  "pipelineOrchestrator.unassignAudio": {
26384
26866
  capName: "pipeline-orchestrator",
26385
26867
  capScope: "system",
@@ -27932,32 +28414,6 @@ Object.freeze({
27932
28414
  "network-access": "ingress",
27933
28415
  "smtp-provider": "email"
27934
28416
  });
27935
- var frameworkSwapPackageSchema = object({
27936
- name: string(),
27937
- stagedPath: string(),
27938
- backupPath: string(),
27939
- toVersion: string(),
27940
- fromVersion: string().nullable()
27941
- });
27942
- object({
27943
- jobId: string(),
27944
- taskId: string(),
27945
- packages: array(frameworkSwapPackageSchema),
27946
- requestedAtMs: number(),
27947
- schemaVersion: literal(1)
27948
- });
27949
- object({
27950
- jobId: string(),
27951
- taskId: string(),
27952
- backups: array(object({
27953
- name: string(),
27954
- backupPath: string(),
27955
- livePath: string()
27956
- })),
27957
- appliedAtMs: number(),
27958
- bootAttempts: number(),
27959
- schemaVersion: literal(1)
27960
- });
27961
28417
  /**
27962
28418
  * Names that, when used as URL query parameters, almost certainly carry
27963
28419
  * a secret. Matching is case-insensitive and anchored to the full param