@camstack/addon-provider-vesync 0.1.13 → 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
@@ -7097,6 +7097,17 @@ var ModelCatalogEntrySchema = object({
7097
7097
  "imagenet",
7098
7098
  "none"
7099
7099
  ]).optional(),
7100
+ /**
7101
+ * The model already applies softmax IN-GRAPH — its raw output is a
7102
+ * probability distribution, not logits. When set, the `softmax`
7103
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7104
+ * probability vector collapses it toward uniform (top-1 score craters far
7105
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7106
+ * the output is raw logits and the postprocessor applies softmax (the normal
7107
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7108
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7109
+ */
7110
+ outputProbabilities: boolean().optional(),
7100
7111
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7101
7112
  /**
7102
7113
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7656,6 +7667,160 @@ var EncodeProfileSchema = object({
7656
7667
  */
7657
7668
  outputArgs: array(string()).optional()
7658
7669
  });
7670
+ var COCO_TO_MACRO = {
7671
+ mapping: {
7672
+ person: "person",
7673
+ bicycle: "vehicle",
7674
+ car: "vehicle",
7675
+ motorcycle: "vehicle",
7676
+ airplane: "vehicle",
7677
+ bus: "vehicle",
7678
+ train: "vehicle",
7679
+ truck: "vehicle",
7680
+ boat: "vehicle",
7681
+ bird: "animal",
7682
+ cat: "animal",
7683
+ dog: "animal",
7684
+ horse: "animal",
7685
+ sheep: "animal",
7686
+ cow: "animal",
7687
+ elephant: "animal",
7688
+ bear: "animal",
7689
+ zebra: "animal",
7690
+ giraffe: "animal",
7691
+ suitcase: "package",
7692
+ backpack: "package",
7693
+ handbag: "package"
7694
+ },
7695
+ preserveOriginal: false
7696
+ };
7697
+ var AUDIO_MACRO_LABELS = [
7698
+ {
7699
+ id: "speech",
7700
+ name: "Speech",
7701
+ icon: "🗣️"
7702
+ },
7703
+ {
7704
+ id: "scream",
7705
+ name: "Scream / Shout",
7706
+ icon: "😱"
7707
+ },
7708
+ {
7709
+ id: "crying",
7710
+ name: "Crying / Baby",
7711
+ icon: "😢"
7712
+ },
7713
+ {
7714
+ id: "laughter",
7715
+ name: "Laughter",
7716
+ icon: "😂"
7717
+ },
7718
+ {
7719
+ id: "music",
7720
+ name: "Music",
7721
+ icon: "🎵"
7722
+ },
7723
+ {
7724
+ id: "dog",
7725
+ name: "Dog",
7726
+ icon: "🐕"
7727
+ },
7728
+ {
7729
+ id: "cat",
7730
+ name: "Cat",
7731
+ icon: "🐈"
7732
+ },
7733
+ {
7734
+ id: "bird",
7735
+ name: "Bird",
7736
+ icon: "🐦"
7737
+ },
7738
+ {
7739
+ id: "animal",
7740
+ name: "Animal (other)",
7741
+ icon: "🐾"
7742
+ },
7743
+ {
7744
+ id: "alarm",
7745
+ name: "Alarm / Siren",
7746
+ icon: "🚨"
7747
+ },
7748
+ {
7749
+ id: "doorbell",
7750
+ name: "Doorbell / Knock",
7751
+ icon: "🔔"
7752
+ },
7753
+ {
7754
+ id: "glass_breaking",
7755
+ name: "Glass Breaking",
7756
+ icon: "💥"
7757
+ },
7758
+ {
7759
+ id: "gunshot",
7760
+ name: "Gunshot / Explosion",
7761
+ icon: "💣"
7762
+ },
7763
+ {
7764
+ id: "vehicle",
7765
+ name: "Vehicle",
7766
+ icon: "🚗"
7767
+ },
7768
+ {
7769
+ id: "siren",
7770
+ name: "Emergency Siren",
7771
+ icon: "🚑"
7772
+ },
7773
+ {
7774
+ id: "fire",
7775
+ name: "Fire / Smoke",
7776
+ icon: "🔥"
7777
+ },
7778
+ {
7779
+ id: "water",
7780
+ name: "Water",
7781
+ icon: "💧"
7782
+ },
7783
+ {
7784
+ id: "wind",
7785
+ name: "Wind / Weather",
7786
+ icon: "🌬️"
7787
+ },
7788
+ {
7789
+ id: "door",
7790
+ name: "Door",
7791
+ icon: "🚪"
7792
+ },
7793
+ {
7794
+ id: "footsteps",
7795
+ name: "Footsteps",
7796
+ icon: "👣"
7797
+ },
7798
+ {
7799
+ id: "crowd",
7800
+ name: "Crowd / Chatter",
7801
+ icon: "👥"
7802
+ },
7803
+ {
7804
+ id: "telephone",
7805
+ name: "Telephone",
7806
+ icon: "📞"
7807
+ },
7808
+ {
7809
+ id: "engine",
7810
+ name: "Engine / Motor",
7811
+ icon: "⚙️"
7812
+ },
7813
+ {
7814
+ id: "tools",
7815
+ name: "Tools / Construction",
7816
+ icon: "🔨"
7817
+ },
7818
+ {
7819
+ id: "silence",
7820
+ name: "Silence",
7821
+ icon: "🤫"
7822
+ }
7823
+ ];
7659
7824
  var YAMNET_TO_MACRO = {
7660
7825
  mapping: {
7661
7826
  Speech: "speech",
@@ -7922,6 +8087,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7922
8087
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7923
8088
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7924
8089
  /**
8090
+ * Unified event-kind taxonomy — THE single source of truth for
8091
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8092
+ * icon }`.
8093
+ *
8094
+ * This dictionary folds together what used to be scattered across four
8095
+ * copies:
8096
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8097
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8098
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8099
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8100
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8101
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8102
+ *
8103
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8104
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8105
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8106
+ * color or an icon: they read this dictionary (server descriptors carry the
8107
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8108
+ *
8109
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8110
+ */
8111
+ var TAXONOMY_COLORS = {
8112
+ motion: "#f59e0b",
8113
+ audio: "#06b6d4",
8114
+ person: "#22c55e",
8115
+ vehicle: "#3b82f6",
8116
+ animal: "#f97316",
8117
+ package: "#a855f7",
8118
+ sensor: "#8b5cf6",
8119
+ control: "#10b981",
8120
+ genericDetection: "#64748b"
8121
+ };
8122
+ var DETECTION_SUB_COLORS = {
8123
+ car: "#f59e0b",
8124
+ truck: "#d97706",
8125
+ bus: "#b45309",
8126
+ motorcycle: "#eab308",
8127
+ bicycle: "#ca8a04",
8128
+ airplane: "#60a5fa",
8129
+ boat: "#2563eb",
8130
+ train: "#1d4ed8",
8131
+ bird: "#14b8a6",
8132
+ dog: "#84cc16",
8133
+ cat: "#f97316",
8134
+ horse: "#a16207",
8135
+ sheep: "#a3a3a3",
8136
+ cow: "#78716c",
8137
+ elephant: "#6b7280",
8138
+ bear: "#7c2d12",
8139
+ zebra: "#404040",
8140
+ giraffe: "#d4a373"
8141
+ };
8142
+ function titleCase(id) {
8143
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8144
+ }
8145
+ var entries = /* @__PURE__ */ new Map();
8146
+ function macro(kind, category, color, iconId, label) {
8147
+ entries.set(kind, {
8148
+ kind,
8149
+ parentKind: null,
8150
+ level: "macro",
8151
+ category,
8152
+ color,
8153
+ iconId,
8154
+ labelKey: `eventKind.${kind}`,
8155
+ label
8156
+ });
8157
+ }
8158
+ function sub(kind, parentKind, category, color, iconId, label) {
8159
+ entries.set(kind, {
8160
+ kind,
8161
+ parentKind,
8162
+ level: "sub",
8163
+ category,
8164
+ color,
8165
+ iconId,
8166
+ labelKey: `eventKind.${kind}`,
8167
+ label
8168
+ });
8169
+ }
8170
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8171
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8172
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8173
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8174
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8175
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8176
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8177
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8178
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8179
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8180
+ if (entries.has(cocoClass)) continue;
8181
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8182
+ }
8183
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8184
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8185
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8186
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8187
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8188
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8189
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8190
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8191
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8192
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8193
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8194
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8195
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8196
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8197
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8198
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8199
+ sub("button", "control", "control", "#10b981", "button", "Button");
8200
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8201
+ for (const l of AUDIO_MACRO_LABELS) {
8202
+ const kind = `audio-${l.id}`;
8203
+ if (entries.has(kind)) continue;
8204
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8205
+ }
8206
+ /** The complete taxonomy dictionary, keyed by kind. */
8207
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8208
+ /**
7925
8209
  * Error types for the safe expression engine. Two distinct classes so callers
7926
8210
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7927
8211
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12114,10 +12398,7 @@ var ConfigUISchemaNullableBridge = custom();
12114
12398
  var InferenceCapabilitiesBridge = custom();
12115
12399
  var ModelAvailabilityListBridge = custom();
12116
12400
  var PipelineRunResultBridge = custom();
12117
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12118
- kind: "mutation",
12119
- auth: "admin"
12120
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12401
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12121
12402
  modelId: string(),
12122
12403
  settings: record(string(), unknown()).readonly()
12123
12404
  }))), method(object({ steps: record(string(), object({
@@ -12177,13 +12458,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12177
12458
  * (inputClasses ≠ null) are skipped and served per-track via
12178
12459
  * pipelineRunner.runDetailSubtree (two-plane design).
12179
12460
  */
12180
- plane: _enum(["full", "frame"]).optional()
12461
+ plane: _enum(["full", "frame"]).optional(),
12462
+ /**
12463
+ * Inference-device selector (Phase 2 multi-device). Format
12464
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12465
+ * Omitted ⇒ the runner's default device (current single-engine
12466
+ * behaviour). Selects WHICH device pool of the node runs the call.
12467
+ */
12468
+ deviceKey: string().optional()
12181
12469
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12182
12470
  engine: PipelineEngineChoiceSchema.optional(),
12183
12471
  steps: array(PipelineStepInputSchema).min(1),
12184
12472
  frames: array(FrameInputSchema).min(1).max(255),
12185
12473
  deviceId: number().optional(),
12186
- sessionId: string().optional()
12474
+ sessionId: string().optional(),
12475
+ /**
12476
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12477
+ * the batch to the Python pool's bench preprocess cache
12478
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12479
+ * preprocessed ONCE and every later inference is a pure-inference cache
12480
+ * hit — the sustained-throughput run measures inference, not
12481
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12482
+ * full preprocess every call, correct). Fresh per sustained run;
12483
+ * released via `uncacheFrame`.
12484
+ */
12485
+ frameId: number().int().nonnegative().optional(),
12486
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12487
+ deviceKey: string().optional()
12187
12488
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12188
12489
  data: _instanceof(Uint8Array),
12189
12490
  width: number().int().positive(),
@@ -12215,8 +12516,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12215
12516
  * - `runtime` — main camera-serving engine (no idle TTL).
12216
12517
  * - `warm-override` — benchmark/test override held in the warm
12217
12518
  * cache; auto-disposed after the idle TTL.
12519
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12520
+ * multi-device, keyed by `deviceKey`) resolved
12521
+ * via `resolveDeviceFactory`. Runs alongside the
12522
+ * `runtime` engine on a DIFFERENT accelerator
12523
+ * (NPU / iGPU / Coral) — this is how the
12524
+ * Engines tab shows all pools running at once.
12218
12525
  */
12219
- kind: _enum(["runtime", "warm-override"]),
12526
+ kind: _enum([
12527
+ "runtime",
12528
+ "warm-override",
12529
+ "device-pool"
12530
+ ]),
12220
12531
  /** Native pid of the underlying Python pool (null when no pool). */
12221
12532
  poolPid: number().nullable(),
12222
12533
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12591,7 +12902,14 @@ var RunnerCameraConfigSchema = object({
12591
12902
  * camera's detect node differs from its source-owner (P2d, gated by the
12592
12903
  * `remoteSourcingNodes` rollout setting).
12593
12904
  */
12594
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12905
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12906
+ /**
12907
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12908
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12909
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12910
+ * this only selects WHICH device pool of that node runs the session.
12911
+ */
12912
+ deviceKey: string().optional()
12595
12913
  });
12596
12914
  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;
12597
12915
  /**
@@ -12612,6 +12930,19 @@ var RunnerLocalLoadSchema = object({
12612
12930
  avgInferenceTimeMs: number(),
12613
12931
  /** Total queue depth across motion + detection queues. */
12614
12932
  queueDepthTotal: number(),
12933
+ /**
12934
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12935
+ * this runner currently has attached cameras on, so the orchestrator's second
12936
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12937
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12938
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12939
+ */
12940
+ devices: array(object({
12941
+ deviceKey: string(),
12942
+ backend: string(),
12943
+ attachedCameras: number(),
12944
+ queueDepthTotal: number()
12945
+ })).default([]),
12615
12946
  /** Hardware capability flags reported by this node. */
12616
12947
  hardware: object({
12617
12948
  hasGpu: boolean(),
@@ -15760,6 +16091,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15760
16091
  return toDeviceSummary(device, this.addonId);
15761
16092
  }
15762
16093
  };
16094
+ 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;
16095
+ new Set(Object.values(DeviceType));
15763
16096
  /**
15764
16097
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15765
16098
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18854,17 +19187,30 @@ var EventKindCategorySchema = _enum([
18854
19187
  "audio",
18855
19188
  "detection",
18856
19189
  "sensor",
19190
+ "control",
18857
19191
  "custom",
18858
19192
  "package"
18859
19193
  ]);
19194
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19195
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18860
19196
  var EventKindDescriptorSchema = object({
18861
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19197
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18862
19198
  kind: string(),
19199
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19200
+ labelKey: string(),
19201
+ /** English fallback label (kept for clients that don't translate). */
18863
19202
  label: string(),
18864
19203
  /** Hex color for timeline/legend rendering. */
18865
19204
  color: string(),
19205
+ /** Dictionary id → lucide component on the UI side. */
19206
+ iconId: string(),
19207
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18866
19208
  icon: EventKindIconSchema,
18867
19209
  category: EventKindCategorySchema,
19210
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19211
+ parentKind: string().nullable(),
19212
+ /** Derived from `parentKind`, explicit for the client tree. */
19213
+ level: EventKindLevelSchema,
18868
19214
  /** Which cap + device contributes this kind. For built-ins the camera
18869
19215
  * itself; for sensor kinds the LINKED source device. */
18870
19216
  source: object({
@@ -18937,11 +19283,21 @@ var TrackAudioLabelSchema = object({
18937
19283
  firstAt: number(),
18938
19284
  lastAt: number()
18939
19285
  });
19286
+ /**
19287
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19288
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19289
+ * linked sensor/control state change (no positions; carries a snapshot). The
19290
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19291
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19292
+ */
19293
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18940
19294
  var TrackSchema = object({
18941
19295
  trackId: string(),
18942
19296
  deviceId: number(),
18943
19297
  className: string(),
18944
19298
  label: string().optional(),
19299
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19300
+ source: TrackSourceSchema.optional(),
18945
19301
  firstSeen: number(),
18946
19302
  lastSeen: number(),
18947
19303
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19318,6 +19674,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19318
19674
  eventId: string(),
19319
19675
  timestamp: number()
19320
19676
  });
19677
+ /**
19678
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19679
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19680
+ * caps into per-camera event-kind descriptors.
19681
+ *
19682
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19683
+ * is NOT duplicated here — every entry is derived from the single
19684
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19685
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19686
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19687
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19688
+ * eventful cap is missing.
19689
+ */
19690
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19691
+ var LEGACY_ICON = {
19692
+ motion: "motion",
19693
+ audio: "audio",
19694
+ person: "person",
19695
+ vehicle: "vehicle",
19696
+ animal: "animal",
19697
+ package: "package",
19698
+ door: "door",
19699
+ pir: "pir",
19700
+ smoke: "smoke",
19701
+ water: "water",
19702
+ button: "button",
19703
+ generic: "generic",
19704
+ gas: "smoke",
19705
+ vibration: "generic",
19706
+ tamper: "generic",
19707
+ presence: "person",
19708
+ lock: "generic",
19709
+ siren: "generic",
19710
+ switch: "generic",
19711
+ doorbell: "button"
19712
+ };
19713
+ function legacyIcon(iconId) {
19714
+ return LEGACY_ICON[iconId] ?? "generic";
19715
+ }
19716
+ /**
19717
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19718
+ * The anti-drift guard cross-checks this against the eventful caps declared
19719
+ * in `packages/types/src/capabilities/*.cap.ts`.
19720
+ */
19721
+ var CAP_TO_KIND = {
19722
+ contact: "contact",
19723
+ motion: "motion-sensor",
19724
+ smoke: "smoke",
19725
+ flood: "flood",
19726
+ gas: "gas",
19727
+ "carbon-monoxide": "carbon-monoxide",
19728
+ vibration: "vibration",
19729
+ tamper: "tamper",
19730
+ presence: "presence",
19731
+ "enum-sensor": "enum-sensor",
19732
+ "event-emitter": "device-event",
19733
+ "lock-control": "lock",
19734
+ switch: "switch",
19735
+ button: "button",
19736
+ doorbell: "doorbell"
19737
+ };
19738
+ function buildDescriptor(capName, kind) {
19739
+ const t = EVENT_TAXONOMY[kind];
19740
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19741
+ return {
19742
+ ...t,
19743
+ icon: legacyIcon(t.iconId)
19744
+ };
19745
+ }
19746
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19321
19747
  var CameraPipelineConfigSchema = object({
19322
19748
  engine: PipelineEngineChoiceSchema.optional(),
19323
19749
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19336,13 +19762,11 @@ var PipelineTemplateSchema = object({
19336
19762
  createdAt: string(),
19337
19763
  updatedAt: string()
19338
19764
  });
19339
- var AgentAddonConfigSchema = object({
19340
- enabled: boolean(),
19765
+ var DeviceStepConfigSchema = object({
19341
19766
  modelId: string().optional(),
19342
- settings: record(string(), unknown()).readonly()
19767
+ settings: record(string(), unknown()).optional()
19343
19768
  });
19344
19769
  var AgentPipelineSettingsSchema = object({
19345
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19346
19770
  maxCameras: number().int().nonnegative().nullable().default(null),
19347
19771
  /** Per-node detection weight (relative share for the quota balancer). */
19348
19772
  detectWeight: number().positive().optional(),
@@ -19366,7 +19790,22 @@ var AgentPipelineSettingsSchema = object({
19366
19790
  * it already uses to reach the hub). Set this only when the auto-detected
19367
19791
  * address is wrong (multi-homed host, NAT, custom interface).
19368
19792
  */
19369
- reachableHost: string().optional()
19793
+ reachableHost: string().optional(),
19794
+ /**
19795
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19796
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19797
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19798
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19799
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19800
+ * the default model/settings for every camera landing on that accelerator;
19801
+ * a stepId absent ⇒ the step uses that device's format default.
19802
+ */
19803
+ inferenceDevices: record(string(), object({
19804
+ enabled: boolean(),
19805
+ weight: number().positive().optional(),
19806
+ maxSessions: number().int().positive().optional(),
19807
+ steps: record(string(), DeviceStepConfigSchema).optional()
19808
+ })).optional()
19370
19809
  });
19371
19810
  var CameraPipelineForAgentSchema = object({
19372
19811
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19376,14 +19815,13 @@ var CameraPipelineForAgentSchema = object({
19376
19815
  }).nullable()
19377
19816
  });
19378
19817
  var CameraStepOverridePatchSchema = object({
19379
- enabled: boolean().optional(),
19380
19818
  modelId: string().optional(),
19381
19819
  settings: record(string(), unknown()).readonly().optional()
19382
19820
  });
19383
19821
  var CameraPipelineSettingsSchema = object({
19384
19822
  pinnedAgentNodeId: string().optional(),
19385
19823
  stepToggles: record(string(), boolean()).optional(),
19386
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19824
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19387
19825
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19388
19826
  });
19389
19827
  /**
@@ -19597,6 +20035,44 @@ var CameraStatusSchema = object({
19597
20035
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19598
20036
  fetchedAt: number()
19599
20037
  });
20038
+ var NodeInferenceDeviceSchema = object({
20039
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20040
+ key: string(),
20041
+ backend: string(),
20042
+ device: string(),
20043
+ format: _enum(MODEL_FORMATS),
20044
+ /** Whether the node's live probe reports the device as usable right now. */
20045
+ available: boolean(),
20046
+ /**
20047
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20048
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20049
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20050
+ * not a balanced target). An explicit stored value always wins; a stored-only
20051
+ * (unavailable) key keeps its stored value.
20052
+ */
20053
+ enabled: boolean(),
20054
+ /** Relative balancer weight for the enabled device (default 1). */
20055
+ weight: number(),
20056
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20057
+ maxSessions: number().nullable(),
20058
+ /** Object-detection model the executor defaults to for this deviceKey. */
20059
+ defaultModelId: string(),
20060
+ /**
20061
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20062
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20063
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20064
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20065
+ * available per format; this is the stored selection that becomes the
20066
+ * default for EVERY camera landing on this accelerator.
20067
+ */
20068
+ steps: record(string(), DeviceStepConfigSchema).optional()
20069
+ });
20070
+ var NodeInferenceDevicesSchema = object({
20071
+ nodeId: string(),
20072
+ /** False when the node's platform-probe was unreachable (no live device set). */
20073
+ reachable: boolean(),
20074
+ devices: array(NodeInferenceDeviceSchema).readonly()
20075
+ });
19600
20076
  method(object({
19601
20077
  deviceId: number(),
19602
20078
  agentNodeId: string()
@@ -19606,7 +20082,13 @@ method(object({
19606
20082
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19607
20083
  kind: "mutation",
19608
20084
  auth: "admin"
19609
- }), method(_void(), object({ migrated: number() }), {
20085
+ }), method(object({
20086
+ deviceId: number(),
20087
+ deviceKey: string()
20088
+ }), object({ success: literal(true) }), {
20089
+ kind: "mutation",
20090
+ auth: "admin"
20091
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19610
20092
  kind: "mutation",
19611
20093
  auth: "admin"
19612
20094
  }), 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({
@@ -19640,13 +20122,7 @@ method(object({
19640
20122
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19641
20123
  nodeId: string(),
19642
20124
  settings: AgentPipelineSettingsSchema
19643
- })).readonly()), method(object({
19644
- agentNodeId: string(),
19645
- defaults: record(string(), AgentAddonConfigSchema)
19646
- }), object({ success: literal(true) }), {
19647
- kind: "mutation",
19648
- auth: "admin"
19649
- }), method(object({ agentNodeId: string() }), object({
20125
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19650
20126
  success: boolean(),
19651
20127
  removed: boolean()
19652
20128
  }), {
@@ -19678,7 +20154,18 @@ method(object({
19678
20154
  }), object({ success: literal(true) }), {
19679
20155
  kind: "mutation",
19680
20156
  auth: "admin"
19681
- }), method(object({ agentNodeId: string() }), object({
20157
+ }), method(object({
20158
+ agentNodeId: string(),
20159
+ inferenceDevices: record(string(), object({
20160
+ enabled: boolean(),
20161
+ weight: number().positive().optional(),
20162
+ maxSessions: number().int().positive().optional(),
20163
+ steps: record(string(), DeviceStepConfigSchema).optional()
20164
+ }))
20165
+ }), object({ success: literal(true) }), {
20166
+ kind: "mutation",
20167
+ auth: "admin"
20168
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19682
20169
  success: literal(true),
19683
20170
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19684
20171
  effectiveModelId: string().nullable(),
@@ -19694,9 +20181,10 @@ method(object({
19694
20181
  }), object({ success: literal(true) }), {
19695
20182
  kind: "mutation",
19696
20183
  auth: "admin"
19697
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20184
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19698
20185
  deviceId: number(),
19699
20186
  agentNodeId: string(),
20187
+ deviceKey: string(),
19700
20188
  addonId: string(),
19701
20189
  patch: CameraStepOverridePatchSchema.nullable()
19702
20190
  }), object({ success: literal(true) }), {
@@ -19733,14 +20221,13 @@ method(object({
19733
20221
  });
19734
20222
  /**
19735
20223
  * server-management — per-NODE singleton capability for a node's ROOT
19736
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19737
- * agents).
20224
+ * package lifecycle (runtime-updatable node packages).
19738
20225
  *
19739
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19740
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19741
- * version describes the node. Updates install into
19742
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19743
- * starter (probation boot + auto-rollback to N-1).
20226
+ * Every node role runs the SAME root package (`@camstack/server`), which
20227
+ * carries the whole software stack in its npm dep tree, so ONE version
20228
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20229
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20230
+ * no auto-rollback).
19744
20231
  *
19745
20232
  * Providers:
19746
20233
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19848,7 +20335,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19848
20335
  /** Explicit target version; omitted = latest from the registry. */
19849
20336
  version: string().optional() }), ServerUpdateActionResultSchema, {
19850
20337
  kind: "mutation",
19851
- auth: "admin"
20338
+ auth: "admin",
20339
+ timeoutMs: 16 * 6e4
19852
20340
  }), method(_void(), ServerUpdateActionResultSchema, {
19853
20341
  kind: "mutation",
19854
20342
  auth: "admin"
@@ -20892,22 +21380,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20892
21380
  var RestartAddonResultSchema = unknown();
20893
21381
  var InstallPackageResultSchema = unknown();
20894
21382
  var ReloadPackagesResultSchema = unknown();
20895
- /**
20896
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20897
- * server restarts so the admin UI can react to the `restartingAt`
20898
- * timestamp (shows reconnect overlay). The transition from
20899
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20900
- * `system.restart-completed` event after the new process boots.
20901
- *
20902
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20903
- */
20904
- var UpdateFrameworkPackageResultSchema = object({
20905
- packageName: string(),
20906
- fromVersion: string(),
20907
- toVersion: string(),
20908
- /** Ms-epoch the server scheduled its self-restart. */
20909
- restartingAt: number()
20910
- });
20911
21383
  var BulkUpdateItemStatusSchema = _enum([
20912
21384
  "queued",
20913
21385
  "updating",
@@ -21035,13 +21507,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21035
21507
  }), object({ success: literal(true) }), {
21036
21508
  kind: "mutation",
21037
21509
  auth: "admin"
21038
- }), method(object({
21039
- packageName: string().min(1),
21040
- version: string().optional(),
21041
- deferRestart: boolean().optional()
21042
- }), UpdateFrameworkPackageResultSchema, {
21043
- kind: "mutation",
21044
- auth: "admin"
21045
21510
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21046
21511
  kind: "mutation",
21047
21512
  auth: "admin"
@@ -21907,10 +22372,10 @@ var TopologyCategorySchema = object({
21907
22372
  addons: array(TopologyCategoryAddonSchema).readonly()
21908
22373
  });
21909
22374
  /**
21910
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21911
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21912
- * version visibility for the Server management surface. Nullable: offline
21913
- * rows and pre-phase-2 nodes report none.
22375
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22376
+ * root package for every node role) as reported by its `registerNode`
22377
+ * manifest — version visibility for the Server management surface. Nullable:
22378
+ * offline rows and nodes that never reported one.
21914
22379
  */
21915
22380
  var TopologyRootPackageSchema = object({
21916
22381
  name: string(),
@@ -22298,17 +22763,28 @@ var PlatformScoreSchema = object({
22298
22763
  format: _enum([
22299
22764
  "onnx",
22300
22765
  "coreml",
22301
- "openvino"
22766
+ "openvino",
22767
+ "tflite"
22302
22768
  ]),
22303
22769
  score: number(),
22304
22770
  reason: string(),
22305
22771
  available: boolean()
22306
22772
  });
22773
+ var InferenceDeviceDescriptorSchema = object({
22774
+ key: string(),
22775
+ backend: string(),
22776
+ device: string(),
22777
+ format: ModelFormatSchema,
22778
+ runtime: literal("python"),
22779
+ score: number(),
22780
+ available: boolean()
22781
+ });
22307
22782
  var PlatformCapabilitiesSchema = object({
22308
22783
  hardware: HardwareInfoSchema,
22309
22784
  scores: array(PlatformScoreSchema).readonly(),
22310
22785
  bestScore: PlatformScoreSchema,
22311
- pythonPath: string().nullable()
22786
+ pythonPath: string().nullable(),
22787
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22312
22788
  });
22313
22789
  var ModelRequirementSchema = object({
22314
22790
  modelId: string(),
@@ -23187,12 +23663,6 @@ Object.freeze({
23187
23663
  addonId: null,
23188
23664
  access: "delete"
23189
23665
  },
23190
- "addons.updateFrameworkPackage": {
23191
- capName: "addons",
23192
- capScope: "system",
23193
- addonId: null,
23194
- access: "create"
23195
- },
23196
23666
  "addons.updatePackage": {
23197
23667
  capName: "addons",
23198
23668
  capScope: "system",
@@ -25965,12 +26435,6 @@ Object.freeze({
25965
26435
  addonId: null,
25966
26436
  access: "view"
25967
26437
  },
25968
- "pipelineExecutor.reprobeEngine": {
25969
- capName: "pipeline-executor",
25970
- capScope: "system",
25971
- addonId: null,
25972
- access: "create"
25973
- },
25974
26438
  "pipelineExecutor.runAudioTest": {
25975
26439
  capName: "pipeline-executor",
25976
26440
  capScope: "system",
@@ -26121,6 +26585,12 @@ Object.freeze({
26121
26585
  addonId: null,
26122
26586
  access: "view"
26123
26587
  },
26588
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26589
+ capName: "pipeline-orchestrator",
26590
+ capScope: "system",
26591
+ addonId: null,
26592
+ access: "view"
26593
+ },
26124
26594
  "pipelineOrchestrator.getPipelineAssignment": {
26125
26595
  capName: "pipeline-orchestrator",
26126
26596
  capScope: "system",
@@ -26133,6 +26603,12 @@ Object.freeze({
26133
26603
  addonId: null,
26134
26604
  access: "view"
26135
26605
  },
26606
+ "pipelineOrchestrator.getPipelineDevicePin": {
26607
+ capName: "pipeline-orchestrator",
26608
+ capScope: "system",
26609
+ addonId: null,
26610
+ access: "view"
26611
+ },
26136
26612
  "pipelineOrchestrator.listAgentSettings": {
26137
26613
  capName: "pipeline-orchestrator",
26138
26614
  capScope: "system",
@@ -26175,19 +26651,19 @@ Object.freeze({
26175
26651
  addonId: null,
26176
26652
  access: "create"
26177
26653
  },
26178
- "pipelineOrchestrator.setAgentAddonDefaults": {
26654
+ "pipelineOrchestrator.setAgentCapabilities": {
26179
26655
  capName: "pipeline-orchestrator",
26180
26656
  capScope: "system",
26181
26657
  addonId: null,
26182
26658
  access: "create"
26183
26659
  },
26184
- "pipelineOrchestrator.setAgentCapabilities": {
26660
+ "pipelineOrchestrator.setAgentDetectWeight": {
26185
26661
  capName: "pipeline-orchestrator",
26186
26662
  capScope: "system",
26187
26663
  addonId: null,
26188
26664
  access: "create"
26189
26665
  },
26190
- "pipelineOrchestrator.setAgentDetectWeight": {
26666
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26191
26667
  capName: "pipeline-orchestrator",
26192
26668
  capScope: "system",
26193
26669
  addonId: null,
@@ -26229,6 +26705,12 @@ Object.freeze({
26229
26705
  addonId: null,
26230
26706
  access: "create"
26231
26707
  },
26708
+ "pipelineOrchestrator.setPipelineDevicePin": {
26709
+ capName: "pipeline-orchestrator",
26710
+ capScope: "system",
26711
+ addonId: null,
26712
+ access: "create"
26713
+ },
26232
26714
  "pipelineOrchestrator.unassignAudio": {
26233
26715
  capName: "pipeline-orchestrator",
26234
26716
  capScope: "system",
@@ -27781,32 +28263,6 @@ Object.freeze({
27781
28263
  "network-access": "ingress",
27782
28264
  "smtp-provider": "email"
27783
28265
  });
27784
- var frameworkSwapPackageSchema = object({
27785
- name: string(),
27786
- stagedPath: string(),
27787
- backupPath: string(),
27788
- toVersion: string(),
27789
- fromVersion: string().nullable()
27790
- });
27791
- object({
27792
- jobId: string(),
27793
- taskId: string(),
27794
- packages: array(frameworkSwapPackageSchema),
27795
- requestedAtMs: number(),
27796
- schemaVersion: literal(1)
27797
- });
27798
- object({
27799
- jobId: string(),
27800
- taskId: string(),
27801
- backups: array(object({
27802
- name: string(),
27803
- backupPath: string(),
27804
- livePath: string()
27805
- })),
27806
- appliedAtMs: number(),
27807
- bootAttempts: number(),
27808
- schemaVersion: literal(1)
27809
- });
27810
28266
  //#endregion
27811
28267
  //#region src/config.ts
27812
28268
  /**