@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.js CHANGED
@@ -7110,6 +7110,17 @@ var ModelCatalogEntrySchema = object({
7110
7110
  "imagenet",
7111
7111
  "none"
7112
7112
  ]).optional(),
7113
+ /**
7114
+ * The model already applies softmax IN-GRAPH — its raw output is a
7115
+ * probability distribution, not logits. When set, the `softmax`
7116
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7117
+ * probability vector collapses it toward uniform (top-1 score craters far
7118
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7119
+ * the output is raw logits and the postprocessor applies softmax (the normal
7120
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7121
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7122
+ */
7123
+ outputProbabilities: boolean().optional(),
7113
7124
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7114
7125
  /**
7115
7126
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7701,6 +7712,160 @@ var EncodeProfileSchema = object({
7701
7712
  */
7702
7713
  outputArgs: array(string()).optional()
7703
7714
  });
7715
+ var COCO_TO_MACRO = {
7716
+ mapping: {
7717
+ person: "person",
7718
+ bicycle: "vehicle",
7719
+ car: "vehicle",
7720
+ motorcycle: "vehicle",
7721
+ airplane: "vehicle",
7722
+ bus: "vehicle",
7723
+ train: "vehicle",
7724
+ truck: "vehicle",
7725
+ boat: "vehicle",
7726
+ bird: "animal",
7727
+ cat: "animal",
7728
+ dog: "animal",
7729
+ horse: "animal",
7730
+ sheep: "animal",
7731
+ cow: "animal",
7732
+ elephant: "animal",
7733
+ bear: "animal",
7734
+ zebra: "animal",
7735
+ giraffe: "animal",
7736
+ suitcase: "package",
7737
+ backpack: "package",
7738
+ handbag: "package"
7739
+ },
7740
+ preserveOriginal: false
7741
+ };
7742
+ var AUDIO_MACRO_LABELS = [
7743
+ {
7744
+ id: "speech",
7745
+ name: "Speech",
7746
+ icon: "🗣️"
7747
+ },
7748
+ {
7749
+ id: "scream",
7750
+ name: "Scream / Shout",
7751
+ icon: "😱"
7752
+ },
7753
+ {
7754
+ id: "crying",
7755
+ name: "Crying / Baby",
7756
+ icon: "😢"
7757
+ },
7758
+ {
7759
+ id: "laughter",
7760
+ name: "Laughter",
7761
+ icon: "😂"
7762
+ },
7763
+ {
7764
+ id: "music",
7765
+ name: "Music",
7766
+ icon: "🎵"
7767
+ },
7768
+ {
7769
+ id: "dog",
7770
+ name: "Dog",
7771
+ icon: "🐕"
7772
+ },
7773
+ {
7774
+ id: "cat",
7775
+ name: "Cat",
7776
+ icon: "🐈"
7777
+ },
7778
+ {
7779
+ id: "bird",
7780
+ name: "Bird",
7781
+ icon: "🐦"
7782
+ },
7783
+ {
7784
+ id: "animal",
7785
+ name: "Animal (other)",
7786
+ icon: "🐾"
7787
+ },
7788
+ {
7789
+ id: "alarm",
7790
+ name: "Alarm / Siren",
7791
+ icon: "🚨"
7792
+ },
7793
+ {
7794
+ id: "doorbell",
7795
+ name: "Doorbell / Knock",
7796
+ icon: "🔔"
7797
+ },
7798
+ {
7799
+ id: "glass_breaking",
7800
+ name: "Glass Breaking",
7801
+ icon: "💥"
7802
+ },
7803
+ {
7804
+ id: "gunshot",
7805
+ name: "Gunshot / Explosion",
7806
+ icon: "💣"
7807
+ },
7808
+ {
7809
+ id: "vehicle",
7810
+ name: "Vehicle",
7811
+ icon: "🚗"
7812
+ },
7813
+ {
7814
+ id: "siren",
7815
+ name: "Emergency Siren",
7816
+ icon: "🚑"
7817
+ },
7818
+ {
7819
+ id: "fire",
7820
+ name: "Fire / Smoke",
7821
+ icon: "🔥"
7822
+ },
7823
+ {
7824
+ id: "water",
7825
+ name: "Water",
7826
+ icon: "💧"
7827
+ },
7828
+ {
7829
+ id: "wind",
7830
+ name: "Wind / Weather",
7831
+ icon: "🌬️"
7832
+ },
7833
+ {
7834
+ id: "door",
7835
+ name: "Door",
7836
+ icon: "🚪"
7837
+ },
7838
+ {
7839
+ id: "footsteps",
7840
+ name: "Footsteps",
7841
+ icon: "👣"
7842
+ },
7843
+ {
7844
+ id: "crowd",
7845
+ name: "Crowd / Chatter",
7846
+ icon: "👥"
7847
+ },
7848
+ {
7849
+ id: "telephone",
7850
+ name: "Telephone",
7851
+ icon: "📞"
7852
+ },
7853
+ {
7854
+ id: "engine",
7855
+ name: "Engine / Motor",
7856
+ icon: "⚙️"
7857
+ },
7858
+ {
7859
+ id: "tools",
7860
+ name: "Tools / Construction",
7861
+ icon: "🔨"
7862
+ },
7863
+ {
7864
+ id: "silence",
7865
+ name: "Silence",
7866
+ icon: "🤫"
7867
+ }
7868
+ ];
7704
7869
  var YAMNET_TO_MACRO = {
7705
7870
  mapping: {
7706
7871
  Speech: "speech",
@@ -7967,6 +8132,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7967
8132
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7968
8133
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7969
8134
  /**
8135
+ * Unified event-kind taxonomy — THE single source of truth for
8136
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8137
+ * icon }`.
8138
+ *
8139
+ * This dictionary folds together what used to be scattered across four
8140
+ * copies:
8141
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8142
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8143
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8144
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8145
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8146
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8147
+ *
8148
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8149
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8150
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8151
+ * color or an icon: they read this dictionary (server descriptors carry the
8152
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8153
+ *
8154
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8155
+ */
8156
+ var TAXONOMY_COLORS = {
8157
+ motion: "#f59e0b",
8158
+ audio: "#06b6d4",
8159
+ person: "#22c55e",
8160
+ vehicle: "#3b82f6",
8161
+ animal: "#f97316",
8162
+ package: "#a855f7",
8163
+ sensor: "#8b5cf6",
8164
+ control: "#10b981",
8165
+ genericDetection: "#64748b"
8166
+ };
8167
+ var DETECTION_SUB_COLORS = {
8168
+ car: "#f59e0b",
8169
+ truck: "#d97706",
8170
+ bus: "#b45309",
8171
+ motorcycle: "#eab308",
8172
+ bicycle: "#ca8a04",
8173
+ airplane: "#60a5fa",
8174
+ boat: "#2563eb",
8175
+ train: "#1d4ed8",
8176
+ bird: "#14b8a6",
8177
+ dog: "#84cc16",
8178
+ cat: "#f97316",
8179
+ horse: "#a16207",
8180
+ sheep: "#a3a3a3",
8181
+ cow: "#78716c",
8182
+ elephant: "#6b7280",
8183
+ bear: "#7c2d12",
8184
+ zebra: "#404040",
8185
+ giraffe: "#d4a373"
8186
+ };
8187
+ function titleCase(id) {
8188
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8189
+ }
8190
+ var entries = /* @__PURE__ */ new Map();
8191
+ function macro(kind, category, color, iconId, label) {
8192
+ entries.set(kind, {
8193
+ kind,
8194
+ parentKind: null,
8195
+ level: "macro",
8196
+ category,
8197
+ color,
8198
+ iconId,
8199
+ labelKey: `eventKind.${kind}`,
8200
+ label
8201
+ });
8202
+ }
8203
+ function sub(kind, parentKind, category, color, iconId, label) {
8204
+ entries.set(kind, {
8205
+ kind,
8206
+ parentKind,
8207
+ level: "sub",
8208
+ category,
8209
+ color,
8210
+ iconId,
8211
+ labelKey: `eventKind.${kind}`,
8212
+ label
8213
+ });
8214
+ }
8215
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8216
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8217
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8218
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8219
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8220
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8221
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8222
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8223
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8224
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8225
+ if (entries.has(cocoClass)) continue;
8226
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8227
+ }
8228
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8229
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8230
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8231
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8232
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8233
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8234
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8235
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8236
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8237
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8238
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8239
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8240
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8241
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8242
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8243
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8244
+ sub("button", "control", "control", "#10b981", "button", "Button");
8245
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8246
+ for (const l of AUDIO_MACRO_LABELS) {
8247
+ const kind = `audio-${l.id}`;
8248
+ if (entries.has(kind)) continue;
8249
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8250
+ }
8251
+ /** The complete taxonomy dictionary, keyed by kind. */
8252
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8253
+ /**
7970
8254
  * Error types for the safe expression engine. Two distinct classes so callers
7971
8255
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7972
8256
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12225,10 +12509,7 @@ var ConfigUISchemaNullableBridge = custom();
12225
12509
  var InferenceCapabilitiesBridge = custom();
12226
12510
  var ModelAvailabilityListBridge = custom();
12227
12511
  var PipelineRunResultBridge = custom();
12228
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12229
- kind: "mutation",
12230
- auth: "admin"
12231
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12512
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12232
12513
  modelId: string(),
12233
12514
  settings: record(string(), unknown()).readonly()
12234
12515
  }))), method(object({ steps: record(string(), object({
@@ -12288,13 +12569,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12288
12569
  * (inputClasses ≠ null) are skipped and served per-track via
12289
12570
  * pipelineRunner.runDetailSubtree (two-plane design).
12290
12571
  */
12291
- plane: _enum(["full", "frame"]).optional()
12572
+ plane: _enum(["full", "frame"]).optional(),
12573
+ /**
12574
+ * Inference-device selector (Phase 2 multi-device). Format
12575
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12576
+ * Omitted ⇒ the runner's default device (current single-engine
12577
+ * behaviour). Selects WHICH device pool of the node runs the call.
12578
+ */
12579
+ deviceKey: string().optional()
12292
12580
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12293
12581
  engine: PipelineEngineChoiceSchema.optional(),
12294
12582
  steps: array(PipelineStepInputSchema).min(1),
12295
12583
  frames: array(FrameInputSchema).min(1).max(255),
12296
12584
  deviceId: number().optional(),
12297
- sessionId: string().optional()
12585
+ sessionId: string().optional(),
12586
+ /**
12587
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12588
+ * the batch to the Python pool's bench preprocess cache
12589
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12590
+ * preprocessed ONCE and every later inference is a pure-inference cache
12591
+ * hit — the sustained-throughput run measures inference, not
12592
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12593
+ * full preprocess every call, correct). Fresh per sustained run;
12594
+ * released via `uncacheFrame`.
12595
+ */
12596
+ frameId: number().int().nonnegative().optional(),
12597
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12598
+ deviceKey: string().optional()
12298
12599
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12299
12600
  data: _instanceof(Uint8Array),
12300
12601
  width: number().int().positive(),
@@ -12326,8 +12627,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12326
12627
  * - `runtime` — main camera-serving engine (no idle TTL).
12327
12628
  * - `warm-override` — benchmark/test override held in the warm
12328
12629
  * cache; auto-disposed after the idle TTL.
12630
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12631
+ * multi-device, keyed by `deviceKey`) resolved
12632
+ * via `resolveDeviceFactory`. Runs alongside the
12633
+ * `runtime` engine on a DIFFERENT accelerator
12634
+ * (NPU / iGPU / Coral) — this is how the
12635
+ * Engines tab shows all pools running at once.
12329
12636
  */
12330
- kind: _enum(["runtime", "warm-override"]),
12637
+ kind: _enum([
12638
+ "runtime",
12639
+ "warm-override",
12640
+ "device-pool"
12641
+ ]),
12331
12642
  /** Native pid of the underlying Python pool (null when no pool). */
12332
12643
  poolPid: number().nullable(),
12333
12644
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12702,7 +13013,14 @@ var RunnerCameraConfigSchema = object({
12702
13013
  * camera's detect node differs from its source-owner (P2d, gated by the
12703
13014
  * `remoteSourcingNodes` rollout setting).
12704
13015
  */
12705
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
13016
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
13017
+ /**
13018
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
13019
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
13020
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
13021
+ * this only selects WHICH device pool of that node runs the session.
13022
+ */
13023
+ deviceKey: string().optional()
12706
13024
  });
12707
13025
  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;
12708
13026
  /**
@@ -12723,6 +13041,19 @@ var RunnerLocalLoadSchema = object({
12723
13041
  avgInferenceTimeMs: number(),
12724
13042
  /** Total queue depth across motion + detection queues. */
12725
13043
  queueDepthTotal: number(),
13044
+ /**
13045
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
13046
+ * this runner currently has attached cameras on, so the orchestrator's second
13047
+ * `balance()` pass (over a node's devices) weights on real per-pool session
13048
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
13049
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
13050
+ */
13051
+ devices: array(object({
13052
+ deviceKey: string(),
13053
+ backend: string(),
13054
+ attachedCameras: number(),
13055
+ queueDepthTotal: number()
13056
+ })).default([]),
12726
13057
  /** Hardware capability flags reported by this node. */
12727
13058
  hardware: object({
12728
13059
  hasGpu: boolean(),
@@ -15871,6 +16202,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15871
16202
  return toDeviceSummary(device, this.addonId);
15872
16203
  }
15873
16204
  };
16205
+ 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;
16206
+ new Set(Object.values(DeviceType));
15874
16207
  /**
15875
16208
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15876
16209
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18965,17 +19298,30 @@ var EventKindCategorySchema = _enum([
18965
19298
  "audio",
18966
19299
  "detection",
18967
19300
  "sensor",
19301
+ "control",
18968
19302
  "custom",
18969
19303
  "package"
18970
19304
  ]);
19305
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19306
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18971
19307
  var EventKindDescriptorSchema = object({
18972
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19308
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18973
19309
  kind: string(),
19310
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19311
+ labelKey: string(),
19312
+ /** English fallback label (kept for clients that don't translate). */
18974
19313
  label: string(),
18975
19314
  /** Hex color for timeline/legend rendering. */
18976
19315
  color: string(),
19316
+ /** Dictionary id → lucide component on the UI side. */
19317
+ iconId: string(),
19318
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18977
19319
  icon: EventKindIconSchema,
18978
19320
  category: EventKindCategorySchema,
19321
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19322
+ parentKind: string().nullable(),
19323
+ /** Derived from `parentKind`, explicit for the client tree. */
19324
+ level: EventKindLevelSchema,
18979
19325
  /** Which cap + device contributes this kind. For built-ins the camera
18980
19326
  * itself; for sensor kinds the LINKED source device. */
18981
19327
  source: object({
@@ -19048,11 +19394,21 @@ var TrackAudioLabelSchema = object({
19048
19394
  firstAt: number(),
19049
19395
  lastAt: number()
19050
19396
  });
19397
+ /**
19398
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19399
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19400
+ * linked sensor/control state change (no positions; carries a snapshot). The
19401
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19402
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19403
+ */
19404
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19051
19405
  var TrackSchema = object({
19052
19406
  trackId: string(),
19053
19407
  deviceId: number(),
19054
19408
  className: string(),
19055
19409
  label: string().optional(),
19410
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19411
+ source: TrackSourceSchema.optional(),
19056
19412
  firstSeen: number(),
19057
19413
  lastSeen: number(),
19058
19414
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19429,6 +19785,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19429
19785
  eventId: string(),
19430
19786
  timestamp: number()
19431
19787
  });
19788
+ /**
19789
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19790
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19791
+ * caps into per-camera event-kind descriptors.
19792
+ *
19793
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19794
+ * is NOT duplicated here — every entry is derived from the single
19795
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19796
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19797
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19798
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19799
+ * eventful cap is missing.
19800
+ */
19801
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19802
+ var LEGACY_ICON = {
19803
+ motion: "motion",
19804
+ audio: "audio",
19805
+ person: "person",
19806
+ vehicle: "vehicle",
19807
+ animal: "animal",
19808
+ package: "package",
19809
+ door: "door",
19810
+ pir: "pir",
19811
+ smoke: "smoke",
19812
+ water: "water",
19813
+ button: "button",
19814
+ generic: "generic",
19815
+ gas: "smoke",
19816
+ vibration: "generic",
19817
+ tamper: "generic",
19818
+ presence: "person",
19819
+ lock: "generic",
19820
+ siren: "generic",
19821
+ switch: "generic",
19822
+ doorbell: "button"
19823
+ };
19824
+ function legacyIcon(iconId) {
19825
+ return LEGACY_ICON[iconId] ?? "generic";
19826
+ }
19827
+ /**
19828
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19829
+ * The anti-drift guard cross-checks this against the eventful caps declared
19830
+ * in `packages/types/src/capabilities/*.cap.ts`.
19831
+ */
19832
+ var CAP_TO_KIND = {
19833
+ contact: "contact",
19834
+ motion: "motion-sensor",
19835
+ smoke: "smoke",
19836
+ flood: "flood",
19837
+ gas: "gas",
19838
+ "carbon-monoxide": "carbon-monoxide",
19839
+ vibration: "vibration",
19840
+ tamper: "tamper",
19841
+ presence: "presence",
19842
+ "enum-sensor": "enum-sensor",
19843
+ "event-emitter": "device-event",
19844
+ "lock-control": "lock",
19845
+ switch: "switch",
19846
+ button: "button",
19847
+ doorbell: "doorbell"
19848
+ };
19849
+ function buildDescriptor(capName, kind) {
19850
+ const t = EVENT_TAXONOMY[kind];
19851
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19852
+ return {
19853
+ ...t,
19854
+ icon: legacyIcon(t.iconId)
19855
+ };
19856
+ }
19857
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19432
19858
  var CameraPipelineConfigSchema = object({
19433
19859
  engine: PipelineEngineChoiceSchema.optional(),
19434
19860
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19447,13 +19873,11 @@ var PipelineTemplateSchema = object({
19447
19873
  createdAt: string(),
19448
19874
  updatedAt: string()
19449
19875
  });
19450
- var AgentAddonConfigSchema = object({
19451
- enabled: boolean(),
19876
+ var DeviceStepConfigSchema = object({
19452
19877
  modelId: string().optional(),
19453
- settings: record(string(), unknown()).readonly()
19878
+ settings: record(string(), unknown()).optional()
19454
19879
  });
19455
19880
  var AgentPipelineSettingsSchema = object({
19456
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19457
19881
  maxCameras: number().int().nonnegative().nullable().default(null),
19458
19882
  /** Per-node detection weight (relative share for the quota balancer). */
19459
19883
  detectWeight: number().positive().optional(),
@@ -19477,7 +19901,22 @@ var AgentPipelineSettingsSchema = object({
19477
19901
  * it already uses to reach the hub). Set this only when the auto-detected
19478
19902
  * address is wrong (multi-homed host, NAT, custom interface).
19479
19903
  */
19480
- reachableHost: string().optional()
19904
+ reachableHost: string().optional(),
19905
+ /**
19906
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19907
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19908
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19909
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19910
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19911
+ * the default model/settings for every camera landing on that accelerator;
19912
+ * a stepId absent ⇒ the step uses that device's format default.
19913
+ */
19914
+ inferenceDevices: record(string(), object({
19915
+ enabled: boolean(),
19916
+ weight: number().positive().optional(),
19917
+ maxSessions: number().int().positive().optional(),
19918
+ steps: record(string(), DeviceStepConfigSchema).optional()
19919
+ })).optional()
19481
19920
  });
19482
19921
  var CameraPipelineForAgentSchema = object({
19483
19922
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19487,14 +19926,13 @@ var CameraPipelineForAgentSchema = object({
19487
19926
  }).nullable()
19488
19927
  });
19489
19928
  var CameraStepOverridePatchSchema = object({
19490
- enabled: boolean().optional(),
19491
19929
  modelId: string().optional(),
19492
19930
  settings: record(string(), unknown()).readonly().optional()
19493
19931
  });
19494
19932
  var CameraPipelineSettingsSchema = object({
19495
19933
  pinnedAgentNodeId: string().optional(),
19496
19934
  stepToggles: record(string(), boolean()).optional(),
19497
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19935
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19498
19936
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19499
19937
  });
19500
19938
  /**
@@ -19708,6 +20146,44 @@ var CameraStatusSchema = object({
19708
20146
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19709
20147
  fetchedAt: number()
19710
20148
  });
20149
+ var NodeInferenceDeviceSchema = object({
20150
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20151
+ key: string(),
20152
+ backend: string(),
20153
+ device: string(),
20154
+ format: _enum(MODEL_FORMATS),
20155
+ /** Whether the node's live probe reports the device as usable right now. */
20156
+ available: boolean(),
20157
+ /**
20158
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20159
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20160
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20161
+ * not a balanced target). An explicit stored value always wins; a stored-only
20162
+ * (unavailable) key keeps its stored value.
20163
+ */
20164
+ enabled: boolean(),
20165
+ /** Relative balancer weight for the enabled device (default 1). */
20166
+ weight: number(),
20167
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20168
+ maxSessions: number().nullable(),
20169
+ /** Object-detection model the executor defaults to for this deviceKey. */
20170
+ defaultModelId: string(),
20171
+ /**
20172
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20173
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20174
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20175
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20176
+ * available per format; this is the stored selection that becomes the
20177
+ * default for EVERY camera landing on this accelerator.
20178
+ */
20179
+ steps: record(string(), DeviceStepConfigSchema).optional()
20180
+ });
20181
+ var NodeInferenceDevicesSchema = object({
20182
+ nodeId: string(),
20183
+ /** False when the node's platform-probe was unreachable (no live device set). */
20184
+ reachable: boolean(),
20185
+ devices: array(NodeInferenceDeviceSchema).readonly()
20186
+ });
19711
20187
  method(object({
19712
20188
  deviceId: number(),
19713
20189
  agentNodeId: string()
@@ -19717,7 +20193,13 @@ method(object({
19717
20193
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19718
20194
  kind: "mutation",
19719
20195
  auth: "admin"
19720
- }), method(_void(), object({ migrated: number() }), {
20196
+ }), method(object({
20197
+ deviceId: number(),
20198
+ deviceKey: string()
20199
+ }), object({ success: literal(true) }), {
20200
+ kind: "mutation",
20201
+ auth: "admin"
20202
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19721
20203
  kind: "mutation",
19722
20204
  auth: "admin"
19723
20205
  }), 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({
@@ -19751,13 +20233,7 @@ method(object({
19751
20233
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19752
20234
  nodeId: string(),
19753
20235
  settings: AgentPipelineSettingsSchema
19754
- })).readonly()), method(object({
19755
- agentNodeId: string(),
19756
- defaults: record(string(), AgentAddonConfigSchema)
19757
- }), object({ success: literal(true) }), {
19758
- kind: "mutation",
19759
- auth: "admin"
19760
- }), method(object({ agentNodeId: string() }), object({
20236
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19761
20237
  success: boolean(),
19762
20238
  removed: boolean()
19763
20239
  }), {
@@ -19789,7 +20265,18 @@ method(object({
19789
20265
  }), object({ success: literal(true) }), {
19790
20266
  kind: "mutation",
19791
20267
  auth: "admin"
19792
- }), method(object({ agentNodeId: string() }), object({
20268
+ }), method(object({
20269
+ agentNodeId: string(),
20270
+ inferenceDevices: record(string(), object({
20271
+ enabled: boolean(),
20272
+ weight: number().positive().optional(),
20273
+ maxSessions: number().int().positive().optional(),
20274
+ steps: record(string(), DeviceStepConfigSchema).optional()
20275
+ }))
20276
+ }), object({ success: literal(true) }), {
20277
+ kind: "mutation",
20278
+ auth: "admin"
20279
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19793
20280
  success: literal(true),
19794
20281
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19795
20282
  effectiveModelId: string().nullable(),
@@ -19805,9 +20292,10 @@ method(object({
19805
20292
  }), object({ success: literal(true) }), {
19806
20293
  kind: "mutation",
19807
20294
  auth: "admin"
19808
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20295
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19809
20296
  deviceId: number(),
19810
20297
  agentNodeId: string(),
20298
+ deviceKey: string(),
19811
20299
  addonId: string(),
19812
20300
  patch: CameraStepOverridePatchSchema.nullable()
19813
20301
  }), object({ success: literal(true) }), {
@@ -19844,14 +20332,13 @@ method(object({
19844
20332
  });
19845
20333
  /**
19846
20334
  * server-management — per-NODE singleton capability for a node's ROOT
19847
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19848
- * agents).
20335
+ * package lifecycle (runtime-updatable node packages).
19849
20336
  *
19850
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19851
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19852
- * version describes the node. Updates install into
19853
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19854
- * starter (probation boot + auto-rollback to N-1).
20337
+ * Every node role runs the SAME root package (`@camstack/server`), which
20338
+ * carries the whole software stack in its npm dep tree, so ONE version
20339
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20340
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20341
+ * no auto-rollback).
19855
20342
  *
19856
20343
  * Providers:
19857
20344
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19959,7 +20446,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19959
20446
  /** Explicit target version; omitted = latest from the registry. */
19960
20447
  version: string().optional() }), ServerUpdateActionResultSchema, {
19961
20448
  kind: "mutation",
19962
- auth: "admin"
20449
+ auth: "admin",
20450
+ timeoutMs: 16 * 6e4
19963
20451
  }), method(_void(), ServerUpdateActionResultSchema, {
19964
20452
  kind: "mutation",
19965
20453
  auth: "admin"
@@ -21054,22 +21542,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21054
21542
  var RestartAddonResultSchema = unknown();
21055
21543
  var InstallPackageResultSchema = unknown();
21056
21544
  var ReloadPackagesResultSchema = unknown();
21057
- /**
21058
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
21059
- * server restarts so the admin UI can react to the `restartingAt`
21060
- * timestamp (shows reconnect overlay). The transition from
21061
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
21062
- * `system.restart-completed` event after the new process boots.
21063
- *
21064
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
21065
- */
21066
- var UpdateFrameworkPackageResultSchema = object({
21067
- packageName: string(),
21068
- fromVersion: string(),
21069
- toVersion: string(),
21070
- /** Ms-epoch the server scheduled its self-restart. */
21071
- restartingAt: number()
21072
- });
21073
21545
  var BulkUpdateItemStatusSchema = _enum([
21074
21546
  "queued",
21075
21547
  "updating",
@@ -21197,13 +21669,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21197
21669
  }), object({ success: literal(true) }), {
21198
21670
  kind: "mutation",
21199
21671
  auth: "admin"
21200
- }), method(object({
21201
- packageName: string().min(1),
21202
- version: string().optional(),
21203
- deferRestart: boolean().optional()
21204
- }), UpdateFrameworkPackageResultSchema, {
21205
- kind: "mutation",
21206
- auth: "admin"
21207
21672
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21208
21673
  kind: "mutation",
21209
21674
  auth: "admin"
@@ -22069,10 +22534,10 @@ var TopologyCategorySchema = object({
22069
22534
  addons: array(TopologyCategoryAddonSchema).readonly()
22070
22535
  });
22071
22536
  /**
22072
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
22073
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
22074
- * version visibility for the Server management surface. Nullable: offline
22075
- * rows and pre-phase-2 nodes report none.
22537
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22538
+ * root package for every node role) as reported by its `registerNode`
22539
+ * manifest — version visibility for the Server management surface. Nullable:
22540
+ * offline rows and nodes that never reported one.
22076
22541
  */
22077
22542
  var TopologyRootPackageSchema = object({
22078
22543
  name: string(),
@@ -22460,17 +22925,28 @@ var PlatformScoreSchema = object({
22460
22925
  format: _enum([
22461
22926
  "onnx",
22462
22927
  "coreml",
22463
- "openvino"
22928
+ "openvino",
22929
+ "tflite"
22464
22930
  ]),
22465
22931
  score: number(),
22466
22932
  reason: string(),
22467
22933
  available: boolean()
22468
22934
  });
22935
+ var InferenceDeviceDescriptorSchema = object({
22936
+ key: string(),
22937
+ backend: string(),
22938
+ device: string(),
22939
+ format: ModelFormatSchema,
22940
+ runtime: literal("python"),
22941
+ score: number(),
22942
+ available: boolean()
22943
+ });
22469
22944
  var PlatformCapabilitiesSchema = object({
22470
22945
  hardware: HardwareInfoSchema,
22471
22946
  scores: array(PlatformScoreSchema).readonly(),
22472
22947
  bestScore: PlatformScoreSchema,
22473
- pythonPath: string().nullable()
22948
+ pythonPath: string().nullable(),
22949
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22474
22950
  });
22475
22951
  var ModelRequirementSchema = object({
22476
22952
  modelId: string(),
@@ -23362,12 +23838,6 @@ Object.freeze({
23362
23838
  addonId: null,
23363
23839
  access: "delete"
23364
23840
  },
23365
- "addons.updateFrameworkPackage": {
23366
- capName: "addons",
23367
- capScope: "system",
23368
- addonId: null,
23369
- access: "create"
23370
- },
23371
23841
  "addons.updatePackage": {
23372
23842
  capName: "addons",
23373
23843
  capScope: "system",
@@ -26140,12 +26610,6 @@ Object.freeze({
26140
26610
  addonId: null,
26141
26611
  access: "view"
26142
26612
  },
26143
- "pipelineExecutor.reprobeEngine": {
26144
- capName: "pipeline-executor",
26145
- capScope: "system",
26146
- addonId: null,
26147
- access: "create"
26148
- },
26149
26613
  "pipelineExecutor.runAudioTest": {
26150
26614
  capName: "pipeline-executor",
26151
26615
  capScope: "system",
@@ -26296,6 +26760,12 @@ Object.freeze({
26296
26760
  addonId: null,
26297
26761
  access: "view"
26298
26762
  },
26763
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26764
+ capName: "pipeline-orchestrator",
26765
+ capScope: "system",
26766
+ addonId: null,
26767
+ access: "view"
26768
+ },
26299
26769
  "pipelineOrchestrator.getPipelineAssignment": {
26300
26770
  capName: "pipeline-orchestrator",
26301
26771
  capScope: "system",
@@ -26308,6 +26778,12 @@ Object.freeze({
26308
26778
  addonId: null,
26309
26779
  access: "view"
26310
26780
  },
26781
+ "pipelineOrchestrator.getPipelineDevicePin": {
26782
+ capName: "pipeline-orchestrator",
26783
+ capScope: "system",
26784
+ addonId: null,
26785
+ access: "view"
26786
+ },
26311
26787
  "pipelineOrchestrator.listAgentSettings": {
26312
26788
  capName: "pipeline-orchestrator",
26313
26789
  capScope: "system",
@@ -26350,19 +26826,19 @@ Object.freeze({
26350
26826
  addonId: null,
26351
26827
  access: "create"
26352
26828
  },
26353
- "pipelineOrchestrator.setAgentAddonDefaults": {
26829
+ "pipelineOrchestrator.setAgentCapabilities": {
26354
26830
  capName: "pipeline-orchestrator",
26355
26831
  capScope: "system",
26356
26832
  addonId: null,
26357
26833
  access: "create"
26358
26834
  },
26359
- "pipelineOrchestrator.setAgentCapabilities": {
26835
+ "pipelineOrchestrator.setAgentDetectWeight": {
26360
26836
  capName: "pipeline-orchestrator",
26361
26837
  capScope: "system",
26362
26838
  addonId: null,
26363
26839
  access: "create"
26364
26840
  },
26365
- "pipelineOrchestrator.setAgentDetectWeight": {
26841
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26366
26842
  capName: "pipeline-orchestrator",
26367
26843
  capScope: "system",
26368
26844
  addonId: null,
@@ -26404,6 +26880,12 @@ Object.freeze({
26404
26880
  addonId: null,
26405
26881
  access: "create"
26406
26882
  },
26883
+ "pipelineOrchestrator.setPipelineDevicePin": {
26884
+ capName: "pipeline-orchestrator",
26885
+ capScope: "system",
26886
+ addonId: null,
26887
+ access: "create"
26888
+ },
26407
26889
  "pipelineOrchestrator.unassignAudio": {
26408
26890
  capName: "pipeline-orchestrator",
26409
26891
  capScope: "system",
@@ -27956,32 +28438,6 @@ Object.freeze({
27956
28438
  "network-access": "ingress",
27957
28439
  "smtp-provider": "email"
27958
28440
  });
27959
- var frameworkSwapPackageSchema = object({
27960
- name: string(),
27961
- stagedPath: string(),
27962
- backupPath: string(),
27963
- toVersion: string(),
27964
- fromVersion: string().nullable()
27965
- });
27966
- object({
27967
- jobId: string(),
27968
- taskId: string(),
27969
- packages: array(frameworkSwapPackageSchema),
27970
- requestedAtMs: number(),
27971
- schemaVersion: literal(1)
27972
- });
27973
- object({
27974
- jobId: string(),
27975
- taskId: string(),
27976
- backups: array(object({
27977
- name: string(),
27978
- backupPath: string(),
27979
- livePath: string()
27980
- })),
27981
- appliedAtMs: number(),
27982
- bootAttempts: number(),
27983
- schemaVersion: literal(1)
27984
- });
27985
28441
  /**
27986
28442
  * Names that, when used as URL query parameters, almost certainly carry
27987
28443
  * a secret. Matching is case-insensitive and anchored to the full param