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