@camstack/addon-provider-dreame 0.1.33 → 0.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
@@ -7136,6 +7136,17 @@ var ModelCatalogEntrySchema = object({
7136
7136
  "imagenet",
7137
7137
  "none"
7138
7138
  ]).optional(),
7139
+ /**
7140
+ * The model already applies softmax IN-GRAPH — its raw output is a
7141
+ * probability distribution, not logits. When set, the `softmax`
7142
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7143
+ * probability vector collapses it toward uniform (top-1 score craters far
7144
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7145
+ * the output is raw logits and the postprocessor applies softmax (the normal
7146
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7147
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7148
+ */
7149
+ outputProbabilities: boolean().optional(),
7139
7150
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7140
7151
  /**
7141
7152
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7695,6 +7706,160 @@ var EncodeProfileSchema = object({
7695
7706
  */
7696
7707
  outputArgs: array(string()).optional()
7697
7708
  });
7709
+ var COCO_TO_MACRO = {
7710
+ mapping: {
7711
+ person: "person",
7712
+ bicycle: "vehicle",
7713
+ car: "vehicle",
7714
+ motorcycle: "vehicle",
7715
+ airplane: "vehicle",
7716
+ bus: "vehicle",
7717
+ train: "vehicle",
7718
+ truck: "vehicle",
7719
+ boat: "vehicle",
7720
+ bird: "animal",
7721
+ cat: "animal",
7722
+ dog: "animal",
7723
+ horse: "animal",
7724
+ sheep: "animal",
7725
+ cow: "animal",
7726
+ elephant: "animal",
7727
+ bear: "animal",
7728
+ zebra: "animal",
7729
+ giraffe: "animal",
7730
+ suitcase: "package",
7731
+ backpack: "package",
7732
+ handbag: "package"
7733
+ },
7734
+ preserveOriginal: false
7735
+ };
7736
+ var AUDIO_MACRO_LABELS = [
7737
+ {
7738
+ id: "speech",
7739
+ name: "Speech",
7740
+ icon: "🗣️"
7741
+ },
7742
+ {
7743
+ id: "scream",
7744
+ name: "Scream / Shout",
7745
+ icon: "😱"
7746
+ },
7747
+ {
7748
+ id: "crying",
7749
+ name: "Crying / Baby",
7750
+ icon: "😢"
7751
+ },
7752
+ {
7753
+ id: "laughter",
7754
+ name: "Laughter",
7755
+ icon: "😂"
7756
+ },
7757
+ {
7758
+ id: "music",
7759
+ name: "Music",
7760
+ icon: "🎵"
7761
+ },
7762
+ {
7763
+ id: "dog",
7764
+ name: "Dog",
7765
+ icon: "🐕"
7766
+ },
7767
+ {
7768
+ id: "cat",
7769
+ name: "Cat",
7770
+ icon: "🐈"
7771
+ },
7772
+ {
7773
+ id: "bird",
7774
+ name: "Bird",
7775
+ icon: "🐦"
7776
+ },
7777
+ {
7778
+ id: "animal",
7779
+ name: "Animal (other)",
7780
+ icon: "🐾"
7781
+ },
7782
+ {
7783
+ id: "alarm",
7784
+ name: "Alarm / Siren",
7785
+ icon: "🚨"
7786
+ },
7787
+ {
7788
+ id: "doorbell",
7789
+ name: "Doorbell / Knock",
7790
+ icon: "🔔"
7791
+ },
7792
+ {
7793
+ id: "glass_breaking",
7794
+ name: "Glass Breaking",
7795
+ icon: "💥"
7796
+ },
7797
+ {
7798
+ id: "gunshot",
7799
+ name: "Gunshot / Explosion",
7800
+ icon: "💣"
7801
+ },
7802
+ {
7803
+ id: "vehicle",
7804
+ name: "Vehicle",
7805
+ icon: "🚗"
7806
+ },
7807
+ {
7808
+ id: "siren",
7809
+ name: "Emergency Siren",
7810
+ icon: "🚑"
7811
+ },
7812
+ {
7813
+ id: "fire",
7814
+ name: "Fire / Smoke",
7815
+ icon: "🔥"
7816
+ },
7817
+ {
7818
+ id: "water",
7819
+ name: "Water",
7820
+ icon: "💧"
7821
+ },
7822
+ {
7823
+ id: "wind",
7824
+ name: "Wind / Weather",
7825
+ icon: "🌬️"
7826
+ },
7827
+ {
7828
+ id: "door",
7829
+ name: "Door",
7830
+ icon: "🚪"
7831
+ },
7832
+ {
7833
+ id: "footsteps",
7834
+ name: "Footsteps",
7835
+ icon: "👣"
7836
+ },
7837
+ {
7838
+ id: "crowd",
7839
+ name: "Crowd / Chatter",
7840
+ icon: "👥"
7841
+ },
7842
+ {
7843
+ id: "telephone",
7844
+ name: "Telephone",
7845
+ icon: "📞"
7846
+ },
7847
+ {
7848
+ id: "engine",
7849
+ name: "Engine / Motor",
7850
+ icon: "⚙️"
7851
+ },
7852
+ {
7853
+ id: "tools",
7854
+ name: "Tools / Construction",
7855
+ icon: "🔨"
7856
+ },
7857
+ {
7858
+ id: "silence",
7859
+ name: "Silence",
7860
+ icon: "🤫"
7861
+ }
7862
+ ];
7698
7863
  var YAMNET_TO_MACRO = {
7699
7864
  mapping: {
7700
7865
  Speech: "speech",
@@ -7961,6 +8126,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7961
8126
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7962
8127
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7963
8128
  /**
8129
+ * Unified event-kind taxonomy — THE single source of truth for
8130
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8131
+ * icon }`.
8132
+ *
8133
+ * This dictionary folds together what used to be scattered across four
8134
+ * copies:
8135
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8136
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8137
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8138
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8139
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8140
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8141
+ *
8142
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8143
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8144
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8145
+ * color or an icon: they read this dictionary (server descriptors carry the
8146
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8147
+ *
8148
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8149
+ */
8150
+ var TAXONOMY_COLORS = {
8151
+ motion: "#f59e0b",
8152
+ audio: "#06b6d4",
8153
+ person: "#22c55e",
8154
+ vehicle: "#3b82f6",
8155
+ animal: "#f97316",
8156
+ package: "#a855f7",
8157
+ sensor: "#8b5cf6",
8158
+ control: "#10b981",
8159
+ genericDetection: "#64748b"
8160
+ };
8161
+ var DETECTION_SUB_COLORS = {
8162
+ car: "#f59e0b",
8163
+ truck: "#d97706",
8164
+ bus: "#b45309",
8165
+ motorcycle: "#eab308",
8166
+ bicycle: "#ca8a04",
8167
+ airplane: "#60a5fa",
8168
+ boat: "#2563eb",
8169
+ train: "#1d4ed8",
8170
+ bird: "#14b8a6",
8171
+ dog: "#84cc16",
8172
+ cat: "#f97316",
8173
+ horse: "#a16207",
8174
+ sheep: "#a3a3a3",
8175
+ cow: "#78716c",
8176
+ elephant: "#6b7280",
8177
+ bear: "#7c2d12",
8178
+ zebra: "#404040",
8179
+ giraffe: "#d4a373"
8180
+ };
8181
+ function titleCase(id) {
8182
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8183
+ }
8184
+ var entries = /* @__PURE__ */ new Map();
8185
+ function macro(kind, category, color, iconId, label) {
8186
+ entries.set(kind, {
8187
+ kind,
8188
+ parentKind: null,
8189
+ level: "macro",
8190
+ category,
8191
+ color,
8192
+ iconId,
8193
+ labelKey: `eventKind.${kind}`,
8194
+ label
8195
+ });
8196
+ }
8197
+ function sub(kind, parentKind, category, color, iconId, label) {
8198
+ entries.set(kind, {
8199
+ kind,
8200
+ parentKind,
8201
+ level: "sub",
8202
+ category,
8203
+ color,
8204
+ iconId,
8205
+ labelKey: `eventKind.${kind}`,
8206
+ label
8207
+ });
8208
+ }
8209
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8210
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8211
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8212
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8213
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8214
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8215
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8216
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8217
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8218
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8219
+ if (entries.has(cocoClass)) continue;
8220
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8221
+ }
8222
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8223
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8224
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8225
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8226
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8227
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8228
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8229
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8230
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8231
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8232
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8233
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8234
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8235
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8236
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8237
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8238
+ sub("button", "control", "control", "#10b981", "button", "Button");
8239
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8240
+ for (const l of AUDIO_MACRO_LABELS) {
8241
+ const kind = `audio-${l.id}`;
8242
+ if (entries.has(kind)) continue;
8243
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8244
+ }
8245
+ /** The complete taxonomy dictionary, keyed by kind. */
8246
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8247
+ /**
7964
8248
  * Error types for the safe expression engine. Two distinct classes so callers
7965
8249
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7966
8250
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12153,10 +12437,7 @@ var ConfigUISchemaNullableBridge = custom();
12153
12437
  var InferenceCapabilitiesBridge = custom();
12154
12438
  var ModelAvailabilityListBridge = custom();
12155
12439
  var PipelineRunResultBridge = custom();
12156
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12157
- kind: "mutation",
12158
- auth: "admin"
12159
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12440
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12160
12441
  modelId: string(),
12161
12442
  settings: record(string(), unknown()).readonly()
12162
12443
  }))), method(object({ steps: record(string(), object({
@@ -12216,13 +12497,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12216
12497
  * (inputClasses ≠ null) are skipped and served per-track via
12217
12498
  * pipelineRunner.runDetailSubtree (two-plane design).
12218
12499
  */
12219
- plane: _enum(["full", "frame"]).optional()
12500
+ plane: _enum(["full", "frame"]).optional(),
12501
+ /**
12502
+ * Inference-device selector (Phase 2 multi-device). Format
12503
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12504
+ * Omitted ⇒ the runner's default device (current single-engine
12505
+ * behaviour). Selects WHICH device pool of the node runs the call.
12506
+ */
12507
+ deviceKey: string().optional()
12220
12508
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12221
12509
  engine: PipelineEngineChoiceSchema.optional(),
12222
12510
  steps: array(PipelineStepInputSchema).min(1),
12223
12511
  frames: array(FrameInputSchema).min(1).max(255),
12224
12512
  deviceId: number().optional(),
12225
- sessionId: string().optional()
12513
+ sessionId: string().optional(),
12514
+ /**
12515
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12516
+ * the batch to the Python pool's bench preprocess cache
12517
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12518
+ * preprocessed ONCE and every later inference is a pure-inference cache
12519
+ * hit — the sustained-throughput run measures inference, not
12520
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12521
+ * full preprocess every call, correct). Fresh per sustained run;
12522
+ * released via `uncacheFrame`.
12523
+ */
12524
+ frameId: number().int().nonnegative().optional(),
12525
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12526
+ deviceKey: string().optional()
12226
12527
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12227
12528
  data: _instanceof(Uint8Array),
12228
12529
  width: number().int().positive(),
@@ -12254,8 +12555,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12254
12555
  * - `runtime` — main camera-serving engine (no idle TTL).
12255
12556
  * - `warm-override` — benchmark/test override held in the warm
12256
12557
  * cache; auto-disposed after the idle TTL.
12558
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12559
+ * multi-device, keyed by `deviceKey`) resolved
12560
+ * via `resolveDeviceFactory`. Runs alongside the
12561
+ * `runtime` engine on a DIFFERENT accelerator
12562
+ * (NPU / iGPU / Coral) — this is how the
12563
+ * Engines tab shows all pools running at once.
12257
12564
  */
12258
- kind: _enum(["runtime", "warm-override"]),
12565
+ kind: _enum([
12566
+ "runtime",
12567
+ "warm-override",
12568
+ "device-pool"
12569
+ ]),
12259
12570
  /** Native pid of the underlying Python pool (null when no pool). */
12260
12571
  poolPid: number().nullable(),
12261
12572
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12630,7 +12941,14 @@ var RunnerCameraConfigSchema = object({
12630
12941
  * camera's detect node differs from its source-owner (P2d, gated by the
12631
12942
  * `remoteSourcingNodes` rollout setting).
12632
12943
  */
12633
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12944
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12945
+ /**
12946
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12947
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12948
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12949
+ * this only selects WHICH device pool of that node runs the session.
12950
+ */
12951
+ deviceKey: string().optional()
12634
12952
  });
12635
12953
  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;
12636
12954
  /**
@@ -12651,6 +12969,19 @@ var RunnerLocalLoadSchema = object({
12651
12969
  avgInferenceTimeMs: number(),
12652
12970
  /** Total queue depth across motion + detection queues. */
12653
12971
  queueDepthTotal: number(),
12972
+ /**
12973
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12974
+ * this runner currently has attached cameras on, so the orchestrator's second
12975
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12976
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12977
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12978
+ */
12979
+ devices: array(object({
12980
+ deviceKey: string(),
12981
+ backend: string(),
12982
+ attachedCameras: number(),
12983
+ queueDepthTotal: number()
12984
+ })).default([]),
12654
12985
  /** Hardware capability flags reported by this node. */
12655
12986
  hardware: object({
12656
12987
  hasGpu: boolean(),
@@ -15799,6 +16130,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15799
16130
  return toDeviceSummary(device, this.addonId);
15800
16131
  }
15801
16132
  };
16133
+ 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;
16134
+ new Set(Object.values(DeviceType));
15802
16135
  /**
15803
16136
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15804
16137
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18910,17 +19243,30 @@ var EventKindCategorySchema = _enum([
18910
19243
  "audio",
18911
19244
  "detection",
18912
19245
  "sensor",
19246
+ "control",
18913
19247
  "custom",
18914
19248
  "package"
18915
19249
  ]);
19250
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19251
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18916
19252
  var EventKindDescriptorSchema = object({
18917
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19253
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18918
19254
  kind: string(),
19255
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19256
+ labelKey: string(),
19257
+ /** English fallback label (kept for clients that don't translate). */
18919
19258
  label: string(),
18920
19259
  /** Hex color for timeline/legend rendering. */
18921
19260
  color: string(),
19261
+ /** Dictionary id → lucide component on the UI side. */
19262
+ iconId: string(),
19263
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18922
19264
  icon: EventKindIconSchema,
18923
19265
  category: EventKindCategorySchema,
19266
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19267
+ parentKind: string().nullable(),
19268
+ /** Derived from `parentKind`, explicit for the client tree. */
19269
+ level: EventKindLevelSchema,
18924
19270
  /** Which cap + device contributes this kind. For built-ins the camera
18925
19271
  * itself; for sensor kinds the LINKED source device. */
18926
19272
  source: object({
@@ -18993,11 +19339,21 @@ var TrackAudioLabelSchema = object({
18993
19339
  firstAt: number(),
18994
19340
  lastAt: number()
18995
19341
  });
19342
+ /**
19343
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19344
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19345
+ * linked sensor/control state change (no positions; carries a snapshot). The
19346
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19347
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19348
+ */
19349
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18996
19350
  var TrackSchema = object({
18997
19351
  trackId: string(),
18998
19352
  deviceId: number(),
18999
19353
  className: string(),
19000
19354
  label: string().optional(),
19355
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19356
+ source: TrackSourceSchema.optional(),
19001
19357
  firstSeen: number(),
19002
19358
  lastSeen: number(),
19003
19359
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19374,6 +19730,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19374
19730
  eventId: string(),
19375
19731
  timestamp: number()
19376
19732
  });
19733
+ /**
19734
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19735
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19736
+ * caps into per-camera event-kind descriptors.
19737
+ *
19738
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19739
+ * is NOT duplicated here — every entry is derived from the single
19740
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19741
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19742
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19743
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19744
+ * eventful cap is missing.
19745
+ */
19746
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19747
+ var LEGACY_ICON = {
19748
+ motion: "motion",
19749
+ audio: "audio",
19750
+ person: "person",
19751
+ vehicle: "vehicle",
19752
+ animal: "animal",
19753
+ package: "package",
19754
+ door: "door",
19755
+ pir: "pir",
19756
+ smoke: "smoke",
19757
+ water: "water",
19758
+ button: "button",
19759
+ generic: "generic",
19760
+ gas: "smoke",
19761
+ vibration: "generic",
19762
+ tamper: "generic",
19763
+ presence: "person",
19764
+ lock: "generic",
19765
+ siren: "generic",
19766
+ switch: "generic",
19767
+ doorbell: "button"
19768
+ };
19769
+ function legacyIcon(iconId) {
19770
+ return LEGACY_ICON[iconId] ?? "generic";
19771
+ }
19772
+ /**
19773
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19774
+ * The anti-drift guard cross-checks this against the eventful caps declared
19775
+ * in `packages/types/src/capabilities/*.cap.ts`.
19776
+ */
19777
+ var CAP_TO_KIND = {
19778
+ contact: "contact",
19779
+ motion: "motion-sensor",
19780
+ smoke: "smoke",
19781
+ flood: "flood",
19782
+ gas: "gas",
19783
+ "carbon-monoxide": "carbon-monoxide",
19784
+ vibration: "vibration",
19785
+ tamper: "tamper",
19786
+ presence: "presence",
19787
+ "enum-sensor": "enum-sensor",
19788
+ "event-emitter": "device-event",
19789
+ "lock-control": "lock",
19790
+ switch: "switch",
19791
+ button: "button",
19792
+ doorbell: "doorbell"
19793
+ };
19794
+ function buildDescriptor(capName, kind) {
19795
+ const t = EVENT_TAXONOMY[kind];
19796
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19797
+ return {
19798
+ ...t,
19799
+ icon: legacyIcon(t.iconId)
19800
+ };
19801
+ }
19802
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19377
19803
  var CameraPipelineConfigSchema = object({
19378
19804
  engine: PipelineEngineChoiceSchema.optional(),
19379
19805
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19392,13 +19818,11 @@ var PipelineTemplateSchema = object({
19392
19818
  createdAt: string(),
19393
19819
  updatedAt: string()
19394
19820
  });
19395
- var AgentAddonConfigSchema = object({
19396
- enabled: boolean(),
19821
+ var DeviceStepConfigSchema = object({
19397
19822
  modelId: string().optional(),
19398
- settings: record(string(), unknown()).readonly()
19823
+ settings: record(string(), unknown()).optional()
19399
19824
  });
19400
19825
  var AgentPipelineSettingsSchema = object({
19401
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19402
19826
  maxCameras: number().int().nonnegative().nullable().default(null),
19403
19827
  /** Per-node detection weight (relative share for the quota balancer). */
19404
19828
  detectWeight: number().positive().optional(),
@@ -19422,7 +19846,22 @@ var AgentPipelineSettingsSchema = object({
19422
19846
  * it already uses to reach the hub). Set this only when the auto-detected
19423
19847
  * address is wrong (multi-homed host, NAT, custom interface).
19424
19848
  */
19425
- reachableHost: string().optional()
19849
+ reachableHost: string().optional(),
19850
+ /**
19851
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19852
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19853
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19854
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19855
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19856
+ * the default model/settings for every camera landing on that accelerator;
19857
+ * a stepId absent ⇒ the step uses that device's format default.
19858
+ */
19859
+ inferenceDevices: record(string(), object({
19860
+ enabled: boolean(),
19861
+ weight: number().positive().optional(),
19862
+ maxSessions: number().int().positive().optional(),
19863
+ steps: record(string(), DeviceStepConfigSchema).optional()
19864
+ })).optional()
19426
19865
  });
19427
19866
  var CameraPipelineForAgentSchema = object({
19428
19867
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19432,14 +19871,13 @@ var CameraPipelineForAgentSchema = object({
19432
19871
  }).nullable()
19433
19872
  });
19434
19873
  var CameraStepOverridePatchSchema = object({
19435
- enabled: boolean().optional(),
19436
19874
  modelId: string().optional(),
19437
19875
  settings: record(string(), unknown()).readonly().optional()
19438
19876
  });
19439
19877
  var CameraPipelineSettingsSchema = object({
19440
19878
  pinnedAgentNodeId: string().optional(),
19441
19879
  stepToggles: record(string(), boolean()).optional(),
19442
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19880
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19443
19881
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19444
19882
  });
19445
19883
  /**
@@ -19653,6 +20091,44 @@ var CameraStatusSchema = object({
19653
20091
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19654
20092
  fetchedAt: number()
19655
20093
  });
20094
+ var NodeInferenceDeviceSchema = object({
20095
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20096
+ key: string(),
20097
+ backend: string(),
20098
+ device: string(),
20099
+ format: _enum(MODEL_FORMATS),
20100
+ /** Whether the node's live probe reports the device as usable right now. */
20101
+ available: boolean(),
20102
+ /**
20103
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20104
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20105
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20106
+ * not a balanced target). An explicit stored value always wins; a stored-only
20107
+ * (unavailable) key keeps its stored value.
20108
+ */
20109
+ enabled: boolean(),
20110
+ /** Relative balancer weight for the enabled device (default 1). */
20111
+ weight: number(),
20112
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20113
+ maxSessions: number().nullable(),
20114
+ /** Object-detection model the executor defaults to for this deviceKey. */
20115
+ defaultModelId: string(),
20116
+ /**
20117
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20118
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20119
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20120
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20121
+ * available per format; this is the stored selection that becomes the
20122
+ * default for EVERY camera landing on this accelerator.
20123
+ */
20124
+ steps: record(string(), DeviceStepConfigSchema).optional()
20125
+ });
20126
+ var NodeInferenceDevicesSchema = object({
20127
+ nodeId: string(),
20128
+ /** False when the node's platform-probe was unreachable (no live device set). */
20129
+ reachable: boolean(),
20130
+ devices: array(NodeInferenceDeviceSchema).readonly()
20131
+ });
19656
20132
  method(object({
19657
20133
  deviceId: number(),
19658
20134
  agentNodeId: string()
@@ -19662,7 +20138,13 @@ method(object({
19662
20138
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19663
20139
  kind: "mutation",
19664
20140
  auth: "admin"
19665
- }), method(_void(), object({ migrated: number() }), {
20141
+ }), method(object({
20142
+ deviceId: number(),
20143
+ deviceKey: string()
20144
+ }), object({ success: literal(true) }), {
20145
+ kind: "mutation",
20146
+ auth: "admin"
20147
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19666
20148
  kind: "mutation",
19667
20149
  auth: "admin"
19668
20150
  }), 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({
@@ -19696,13 +20178,7 @@ method(object({
19696
20178
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19697
20179
  nodeId: string(),
19698
20180
  settings: AgentPipelineSettingsSchema
19699
- })).readonly()), method(object({
19700
- agentNodeId: string(),
19701
- defaults: record(string(), AgentAddonConfigSchema)
19702
- }), object({ success: literal(true) }), {
19703
- kind: "mutation",
19704
- auth: "admin"
19705
- }), method(object({ agentNodeId: string() }), object({
20181
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19706
20182
  success: boolean(),
19707
20183
  removed: boolean()
19708
20184
  }), {
@@ -19734,7 +20210,18 @@ method(object({
19734
20210
  }), object({ success: literal(true) }), {
19735
20211
  kind: "mutation",
19736
20212
  auth: "admin"
19737
- }), method(object({ agentNodeId: string() }), object({
20213
+ }), method(object({
20214
+ agentNodeId: string(),
20215
+ inferenceDevices: record(string(), object({
20216
+ enabled: boolean(),
20217
+ weight: number().positive().optional(),
20218
+ maxSessions: number().int().positive().optional(),
20219
+ steps: record(string(), DeviceStepConfigSchema).optional()
20220
+ }))
20221
+ }), object({ success: literal(true) }), {
20222
+ kind: "mutation",
20223
+ auth: "admin"
20224
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19738
20225
  success: literal(true),
19739
20226
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19740
20227
  effectiveModelId: string().nullable(),
@@ -19750,9 +20237,10 @@ method(object({
19750
20237
  }), object({ success: literal(true) }), {
19751
20238
  kind: "mutation",
19752
20239
  auth: "admin"
19753
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20240
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19754
20241
  deviceId: number(),
19755
20242
  agentNodeId: string(),
20243
+ deviceKey: string(),
19756
20244
  addonId: string(),
19757
20245
  patch: CameraStepOverridePatchSchema.nullable()
19758
20246
  }), object({ success: literal(true) }), {
@@ -19789,14 +20277,13 @@ method(object({
19789
20277
  });
19790
20278
  /**
19791
20279
  * server-management — per-NODE singleton capability for a node's ROOT
19792
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19793
- * agents).
20280
+ * package lifecycle (runtime-updatable node packages).
19794
20281
  *
19795
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19796
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19797
- * version describes the node. Updates install into
19798
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19799
- * starter (probation boot + auto-rollback to N-1).
20282
+ * Every node role runs the SAME root package (`@camstack/server`), which
20283
+ * carries the whole software stack in its npm dep tree, so ONE version
20284
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20285
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20286
+ * no auto-rollback).
19800
20287
  *
19801
20288
  * Providers:
19802
20289
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19904,7 +20391,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19904
20391
  /** Explicit target version; omitted = latest from the registry. */
19905
20392
  version: string().optional() }), ServerUpdateActionResultSchema, {
19906
20393
  kind: "mutation",
19907
- auth: "admin"
20394
+ auth: "admin",
20395
+ timeoutMs: 16 * 6e4
19908
20396
  }), method(_void(), ServerUpdateActionResultSchema, {
19909
20397
  kind: "mutation",
19910
20398
  auth: "admin"
@@ -20948,22 +21436,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20948
21436
  var RestartAddonResultSchema = unknown();
20949
21437
  var InstallPackageResultSchema = unknown();
20950
21438
  var ReloadPackagesResultSchema = unknown();
20951
- /**
20952
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20953
- * server restarts so the admin UI can react to the `restartingAt`
20954
- * timestamp (shows reconnect overlay). The transition from
20955
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20956
- * `system.restart-completed` event after the new process boots.
20957
- *
20958
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20959
- */
20960
- var UpdateFrameworkPackageResultSchema = object({
20961
- packageName: string(),
20962
- fromVersion: string(),
20963
- toVersion: string(),
20964
- /** Ms-epoch the server scheduled its self-restart. */
20965
- restartingAt: number()
20966
- });
20967
21439
  var BulkUpdateItemStatusSchema = _enum([
20968
21440
  "queued",
20969
21441
  "updating",
@@ -21091,13 +21563,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21091
21563
  }), object({ success: literal(true) }), {
21092
21564
  kind: "mutation",
21093
21565
  auth: "admin"
21094
- }), method(object({
21095
- packageName: string().min(1),
21096
- version: string().optional(),
21097
- deferRestart: boolean().optional()
21098
- }), UpdateFrameworkPackageResultSchema, {
21099
- kind: "mutation",
21100
- auth: "admin"
21101
21566
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21102
21567
  kind: "mutation",
21103
21568
  auth: "admin"
@@ -21980,10 +22445,10 @@ var TopologyCategorySchema = object({
21980
22445
  addons: array(TopologyCategoryAddonSchema).readonly()
21981
22446
  });
21982
22447
  /**
21983
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21984
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21985
- * version visibility for the Server management surface. Nullable: offline
21986
- * rows and pre-phase-2 nodes report none.
22448
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22449
+ * root package for every node role) as reported by its `registerNode`
22450
+ * manifest — version visibility for the Server management surface. Nullable:
22451
+ * offline rows and nodes that never reported one.
21987
22452
  */
21988
22453
  var TopologyRootPackageSchema = object({
21989
22454
  name: string(),
@@ -22371,17 +22836,28 @@ var PlatformScoreSchema = object({
22371
22836
  format: _enum([
22372
22837
  "onnx",
22373
22838
  "coreml",
22374
- "openvino"
22839
+ "openvino",
22840
+ "tflite"
22375
22841
  ]),
22376
22842
  score: number(),
22377
22843
  reason: string(),
22378
22844
  available: boolean()
22379
22845
  });
22846
+ var InferenceDeviceDescriptorSchema = object({
22847
+ key: string(),
22848
+ backend: string(),
22849
+ device: string(),
22850
+ format: ModelFormatSchema,
22851
+ runtime: literal("python"),
22852
+ score: number(),
22853
+ available: boolean()
22854
+ });
22380
22855
  var PlatformCapabilitiesSchema = object({
22381
22856
  hardware: HardwareInfoSchema,
22382
22857
  scores: array(PlatformScoreSchema).readonly(),
22383
22858
  bestScore: PlatformScoreSchema,
22384
- pythonPath: string().nullable()
22859
+ pythonPath: string().nullable(),
22860
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22385
22861
  });
22386
22862
  var ModelRequirementSchema = object({
22387
22863
  modelId: string(),
@@ -23260,12 +23736,6 @@ Object.freeze({
23260
23736
  addonId: null,
23261
23737
  access: "delete"
23262
23738
  },
23263
- "addons.updateFrameworkPackage": {
23264
- capName: "addons",
23265
- capScope: "system",
23266
- addonId: null,
23267
- access: "create"
23268
- },
23269
23739
  "addons.updatePackage": {
23270
23740
  capName: "addons",
23271
23741
  capScope: "system",
@@ -26038,12 +26508,6 @@ Object.freeze({
26038
26508
  addonId: null,
26039
26509
  access: "view"
26040
26510
  },
26041
- "pipelineExecutor.reprobeEngine": {
26042
- capName: "pipeline-executor",
26043
- capScope: "system",
26044
- addonId: null,
26045
- access: "create"
26046
- },
26047
26511
  "pipelineExecutor.runAudioTest": {
26048
26512
  capName: "pipeline-executor",
26049
26513
  capScope: "system",
@@ -26194,6 +26658,12 @@ Object.freeze({
26194
26658
  addonId: null,
26195
26659
  access: "view"
26196
26660
  },
26661
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26662
+ capName: "pipeline-orchestrator",
26663
+ capScope: "system",
26664
+ addonId: null,
26665
+ access: "view"
26666
+ },
26197
26667
  "pipelineOrchestrator.getPipelineAssignment": {
26198
26668
  capName: "pipeline-orchestrator",
26199
26669
  capScope: "system",
@@ -26206,6 +26676,12 @@ Object.freeze({
26206
26676
  addonId: null,
26207
26677
  access: "view"
26208
26678
  },
26679
+ "pipelineOrchestrator.getPipelineDevicePin": {
26680
+ capName: "pipeline-orchestrator",
26681
+ capScope: "system",
26682
+ addonId: null,
26683
+ access: "view"
26684
+ },
26209
26685
  "pipelineOrchestrator.listAgentSettings": {
26210
26686
  capName: "pipeline-orchestrator",
26211
26687
  capScope: "system",
@@ -26248,19 +26724,19 @@ Object.freeze({
26248
26724
  addonId: null,
26249
26725
  access: "create"
26250
26726
  },
26251
- "pipelineOrchestrator.setAgentAddonDefaults": {
26727
+ "pipelineOrchestrator.setAgentCapabilities": {
26252
26728
  capName: "pipeline-orchestrator",
26253
26729
  capScope: "system",
26254
26730
  addonId: null,
26255
26731
  access: "create"
26256
26732
  },
26257
- "pipelineOrchestrator.setAgentCapabilities": {
26733
+ "pipelineOrchestrator.setAgentDetectWeight": {
26258
26734
  capName: "pipeline-orchestrator",
26259
26735
  capScope: "system",
26260
26736
  addonId: null,
26261
26737
  access: "create"
26262
26738
  },
26263
- "pipelineOrchestrator.setAgentDetectWeight": {
26739
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26264
26740
  capName: "pipeline-orchestrator",
26265
26741
  capScope: "system",
26266
26742
  addonId: null,
@@ -26302,6 +26778,12 @@ Object.freeze({
26302
26778
  addonId: null,
26303
26779
  access: "create"
26304
26780
  },
26781
+ "pipelineOrchestrator.setPipelineDevicePin": {
26782
+ capName: "pipeline-orchestrator",
26783
+ capScope: "system",
26784
+ addonId: null,
26785
+ access: "create"
26786
+ },
26305
26787
  "pipelineOrchestrator.unassignAudio": {
26306
26788
  capName: "pipeline-orchestrator",
26307
26789
  capScope: "system",
@@ -27854,32 +28336,6 @@ Object.freeze({
27854
28336
  "network-access": "ingress",
27855
28337
  "smtp-provider": "email"
27856
28338
  });
27857
- var frameworkSwapPackageSchema = object({
27858
- name: string(),
27859
- stagedPath: string(),
27860
- backupPath: string(),
27861
- toVersion: string(),
27862
- fromVersion: string().nullable()
27863
- });
27864
- object({
27865
- jobId: string(),
27866
- taskId: string(),
27867
- packages: array(frameworkSwapPackageSchema),
27868
- requestedAtMs: number(),
27869
- schemaVersion: literal(1)
27870
- });
27871
- object({
27872
- jobId: string(),
27873
- taskId: string(),
27874
- backups: array(object({
27875
- name: string(),
27876
- backupPath: string(),
27877
- livePath: string()
27878
- })),
27879
- appliedAtMs: number(),
27880
- bootAttempts: number(),
27881
- schemaVersion: literal(1)
27882
- });
27883
28339
  //#endregion
27884
28340
  //#region src/config.ts
27885
28341
  /**