@camstack/addon-provider-tuya 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
@@ -7101,6 +7101,17 @@ var ModelCatalogEntrySchema = object({
7101
7101
  "imagenet",
7102
7102
  "none"
7103
7103
  ]).optional(),
7104
+ /**
7105
+ * The model already applies softmax IN-GRAPH — its raw output is a
7106
+ * probability distribution, not logits. When set, the `softmax`
7107
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7108
+ * probability vector collapses it toward uniform (top-1 score craters far
7109
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7110
+ * the output is raw logits and the postprocessor applies softmax (the normal
7111
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7112
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7113
+ */
7114
+ outputProbabilities: boolean().optional(),
7104
7115
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7105
7116
  /**
7106
7117
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7660,6 +7671,160 @@ var EncodeProfileSchema = object({
7660
7671
  */
7661
7672
  outputArgs: array(string()).optional()
7662
7673
  });
7674
+ var COCO_TO_MACRO = {
7675
+ mapping: {
7676
+ person: "person",
7677
+ bicycle: "vehicle",
7678
+ car: "vehicle",
7679
+ motorcycle: "vehicle",
7680
+ airplane: "vehicle",
7681
+ bus: "vehicle",
7682
+ train: "vehicle",
7683
+ truck: "vehicle",
7684
+ boat: "vehicle",
7685
+ bird: "animal",
7686
+ cat: "animal",
7687
+ dog: "animal",
7688
+ horse: "animal",
7689
+ sheep: "animal",
7690
+ cow: "animal",
7691
+ elephant: "animal",
7692
+ bear: "animal",
7693
+ zebra: "animal",
7694
+ giraffe: "animal",
7695
+ suitcase: "package",
7696
+ backpack: "package",
7697
+ handbag: "package"
7698
+ },
7699
+ preserveOriginal: false
7700
+ };
7701
+ var AUDIO_MACRO_LABELS = [
7702
+ {
7703
+ id: "speech",
7704
+ name: "Speech",
7705
+ icon: "🗣️"
7706
+ },
7707
+ {
7708
+ id: "scream",
7709
+ name: "Scream / Shout",
7710
+ icon: "😱"
7711
+ },
7712
+ {
7713
+ id: "crying",
7714
+ name: "Crying / Baby",
7715
+ icon: "😢"
7716
+ },
7717
+ {
7718
+ id: "laughter",
7719
+ name: "Laughter",
7720
+ icon: "😂"
7721
+ },
7722
+ {
7723
+ id: "music",
7724
+ name: "Music",
7725
+ icon: "🎵"
7726
+ },
7727
+ {
7728
+ id: "dog",
7729
+ name: "Dog",
7730
+ icon: "🐕"
7731
+ },
7732
+ {
7733
+ id: "cat",
7734
+ name: "Cat",
7735
+ icon: "🐈"
7736
+ },
7737
+ {
7738
+ id: "bird",
7739
+ name: "Bird",
7740
+ icon: "🐦"
7741
+ },
7742
+ {
7743
+ id: "animal",
7744
+ name: "Animal (other)",
7745
+ icon: "🐾"
7746
+ },
7747
+ {
7748
+ id: "alarm",
7749
+ name: "Alarm / Siren",
7750
+ icon: "🚨"
7751
+ },
7752
+ {
7753
+ id: "doorbell",
7754
+ name: "Doorbell / Knock",
7755
+ icon: "🔔"
7756
+ },
7757
+ {
7758
+ id: "glass_breaking",
7759
+ name: "Glass Breaking",
7760
+ icon: "💥"
7761
+ },
7762
+ {
7763
+ id: "gunshot",
7764
+ name: "Gunshot / Explosion",
7765
+ icon: "💣"
7766
+ },
7767
+ {
7768
+ id: "vehicle",
7769
+ name: "Vehicle",
7770
+ icon: "🚗"
7771
+ },
7772
+ {
7773
+ id: "siren",
7774
+ name: "Emergency Siren",
7775
+ icon: "🚑"
7776
+ },
7777
+ {
7778
+ id: "fire",
7779
+ name: "Fire / Smoke",
7780
+ icon: "🔥"
7781
+ },
7782
+ {
7783
+ id: "water",
7784
+ name: "Water",
7785
+ icon: "💧"
7786
+ },
7787
+ {
7788
+ id: "wind",
7789
+ name: "Wind / Weather",
7790
+ icon: "🌬️"
7791
+ },
7792
+ {
7793
+ id: "door",
7794
+ name: "Door",
7795
+ icon: "🚪"
7796
+ },
7797
+ {
7798
+ id: "footsteps",
7799
+ name: "Footsteps",
7800
+ icon: "👣"
7801
+ },
7802
+ {
7803
+ id: "crowd",
7804
+ name: "Crowd / Chatter",
7805
+ icon: "👥"
7806
+ },
7807
+ {
7808
+ id: "telephone",
7809
+ name: "Telephone",
7810
+ icon: "📞"
7811
+ },
7812
+ {
7813
+ id: "engine",
7814
+ name: "Engine / Motor",
7815
+ icon: "⚙️"
7816
+ },
7817
+ {
7818
+ id: "tools",
7819
+ name: "Tools / Construction",
7820
+ icon: "🔨"
7821
+ },
7822
+ {
7823
+ id: "silence",
7824
+ name: "Silence",
7825
+ icon: "🤫"
7826
+ }
7827
+ ];
7663
7828
  var YAMNET_TO_MACRO = {
7664
7829
  mapping: {
7665
7830
  Speech: "speech",
@@ -7926,6 +8091,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7926
8091
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7927
8092
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7928
8093
  /**
8094
+ * Unified event-kind taxonomy — THE single source of truth for
8095
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8096
+ * icon }`.
8097
+ *
8098
+ * This dictionary folds together what used to be scattered across four
8099
+ * copies:
8100
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8101
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8102
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8103
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8104
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8105
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8106
+ *
8107
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8108
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8109
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8110
+ * color or an icon: they read this dictionary (server descriptors carry the
8111
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8112
+ *
8113
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8114
+ */
8115
+ var TAXONOMY_COLORS = {
8116
+ motion: "#f59e0b",
8117
+ audio: "#06b6d4",
8118
+ person: "#22c55e",
8119
+ vehicle: "#3b82f6",
8120
+ animal: "#f97316",
8121
+ package: "#a855f7",
8122
+ sensor: "#8b5cf6",
8123
+ control: "#10b981",
8124
+ genericDetection: "#64748b"
8125
+ };
8126
+ var DETECTION_SUB_COLORS = {
8127
+ car: "#f59e0b",
8128
+ truck: "#d97706",
8129
+ bus: "#b45309",
8130
+ motorcycle: "#eab308",
8131
+ bicycle: "#ca8a04",
8132
+ airplane: "#60a5fa",
8133
+ boat: "#2563eb",
8134
+ train: "#1d4ed8",
8135
+ bird: "#14b8a6",
8136
+ dog: "#84cc16",
8137
+ cat: "#f97316",
8138
+ horse: "#a16207",
8139
+ sheep: "#a3a3a3",
8140
+ cow: "#78716c",
8141
+ elephant: "#6b7280",
8142
+ bear: "#7c2d12",
8143
+ zebra: "#404040",
8144
+ giraffe: "#d4a373"
8145
+ };
8146
+ function titleCase(id) {
8147
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8148
+ }
8149
+ var entries = /* @__PURE__ */ new Map();
8150
+ function macro(kind, category, color, iconId, label) {
8151
+ entries.set(kind, {
8152
+ kind,
8153
+ parentKind: null,
8154
+ level: "macro",
8155
+ category,
8156
+ color,
8157
+ iconId,
8158
+ labelKey: `eventKind.${kind}`,
8159
+ label
8160
+ });
8161
+ }
8162
+ function sub(kind, parentKind, category, color, iconId, label) {
8163
+ entries.set(kind, {
8164
+ kind,
8165
+ parentKind,
8166
+ level: "sub",
8167
+ category,
8168
+ color,
8169
+ iconId,
8170
+ labelKey: `eventKind.${kind}`,
8171
+ label
8172
+ });
8173
+ }
8174
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8175
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8176
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8177
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8178
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8179
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8180
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8181
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8182
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8183
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8184
+ if (entries.has(cocoClass)) continue;
8185
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8186
+ }
8187
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8188
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8189
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8190
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8191
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8192
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8193
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8194
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8195
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8196
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8197
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8198
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8199
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8200
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8201
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8202
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8203
+ sub("button", "control", "control", "#10b981", "button", "Button");
8204
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8205
+ for (const l of AUDIO_MACRO_LABELS) {
8206
+ const kind = `audio-${l.id}`;
8207
+ if (entries.has(kind)) continue;
8208
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8209
+ }
8210
+ /** The complete taxonomy dictionary, keyed by kind. */
8211
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8212
+ /**
7929
8213
  * Error types for the safe expression engine. Two distinct classes so callers
7930
8214
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7931
8215
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12118,10 +12402,7 @@ var ConfigUISchemaNullableBridge = custom();
12118
12402
  var InferenceCapabilitiesBridge = custom();
12119
12403
  var ModelAvailabilityListBridge = custom();
12120
12404
  var PipelineRunResultBridge = custom();
12121
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12122
- kind: "mutation",
12123
- auth: "admin"
12124
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12405
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12125
12406
  modelId: string(),
12126
12407
  settings: record(string(), unknown()).readonly()
12127
12408
  }))), method(object({ steps: record(string(), object({
@@ -12181,13 +12462,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12181
12462
  * (inputClasses ≠ null) are skipped and served per-track via
12182
12463
  * pipelineRunner.runDetailSubtree (two-plane design).
12183
12464
  */
12184
- plane: _enum(["full", "frame"]).optional()
12465
+ plane: _enum(["full", "frame"]).optional(),
12466
+ /**
12467
+ * Inference-device selector (Phase 2 multi-device). Format
12468
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12469
+ * Omitted ⇒ the runner's default device (current single-engine
12470
+ * behaviour). Selects WHICH device pool of the node runs the call.
12471
+ */
12472
+ deviceKey: string().optional()
12185
12473
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12186
12474
  engine: PipelineEngineChoiceSchema.optional(),
12187
12475
  steps: array(PipelineStepInputSchema).min(1),
12188
12476
  frames: array(FrameInputSchema).min(1).max(255),
12189
12477
  deviceId: number().optional(),
12190
- sessionId: string().optional()
12478
+ sessionId: string().optional(),
12479
+ /**
12480
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12481
+ * the batch to the Python pool's bench preprocess cache
12482
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12483
+ * preprocessed ONCE and every later inference is a pure-inference cache
12484
+ * hit — the sustained-throughput run measures inference, not
12485
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12486
+ * full preprocess every call, correct). Fresh per sustained run;
12487
+ * released via `uncacheFrame`.
12488
+ */
12489
+ frameId: number().int().nonnegative().optional(),
12490
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12491
+ deviceKey: string().optional()
12191
12492
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12192
12493
  data: _instanceof(Uint8Array),
12193
12494
  width: number().int().positive(),
@@ -12219,8 +12520,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12219
12520
  * - `runtime` — main camera-serving engine (no idle TTL).
12220
12521
  * - `warm-override` — benchmark/test override held in the warm
12221
12522
  * cache; auto-disposed after the idle TTL.
12523
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12524
+ * multi-device, keyed by `deviceKey`) resolved
12525
+ * via `resolveDeviceFactory`. Runs alongside the
12526
+ * `runtime` engine on a DIFFERENT accelerator
12527
+ * (NPU / iGPU / Coral) — this is how the
12528
+ * Engines tab shows all pools running at once.
12222
12529
  */
12223
- kind: _enum(["runtime", "warm-override"]),
12530
+ kind: _enum([
12531
+ "runtime",
12532
+ "warm-override",
12533
+ "device-pool"
12534
+ ]),
12224
12535
  /** Native pid of the underlying Python pool (null when no pool). */
12225
12536
  poolPid: number().nullable(),
12226
12537
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12595,7 +12906,14 @@ var RunnerCameraConfigSchema = object({
12595
12906
  * camera's detect node differs from its source-owner (P2d, gated by the
12596
12907
  * `remoteSourcingNodes` rollout setting).
12597
12908
  */
12598
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12909
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12910
+ /**
12911
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12912
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12913
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12914
+ * this only selects WHICH device pool of that node runs the session.
12915
+ */
12916
+ deviceKey: string().optional()
12599
12917
  });
12600
12918
  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;
12601
12919
  /**
@@ -12616,6 +12934,19 @@ var RunnerLocalLoadSchema = object({
12616
12934
  avgInferenceTimeMs: number(),
12617
12935
  /** Total queue depth across motion + detection queues. */
12618
12936
  queueDepthTotal: number(),
12937
+ /**
12938
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12939
+ * this runner currently has attached cameras on, so the orchestrator's second
12940
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12941
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12942
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12943
+ */
12944
+ devices: array(object({
12945
+ deviceKey: string(),
12946
+ backend: string(),
12947
+ attachedCameras: number(),
12948
+ queueDepthTotal: number()
12949
+ })).default([]),
12619
12950
  /** Hardware capability flags reported by this node. */
12620
12951
  hardware: object({
12621
12952
  hasGpu: boolean(),
@@ -15764,6 +16095,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15764
16095
  return toDeviceSummary(device, this.addonId);
15765
16096
  }
15766
16097
  };
16098
+ 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;
16099
+ new Set(Object.values(DeviceType));
15767
16100
  /**
15768
16101
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15769
16102
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18875,17 +19208,30 @@ var EventKindCategorySchema = _enum([
18875
19208
  "audio",
18876
19209
  "detection",
18877
19210
  "sensor",
19211
+ "control",
18878
19212
  "custom",
18879
19213
  "package"
18880
19214
  ]);
19215
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19216
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18881
19217
  var EventKindDescriptorSchema = object({
18882
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19218
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18883
19219
  kind: string(),
19220
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19221
+ labelKey: string(),
19222
+ /** English fallback label (kept for clients that don't translate). */
18884
19223
  label: string(),
18885
19224
  /** Hex color for timeline/legend rendering. */
18886
19225
  color: string(),
19226
+ /** Dictionary id → lucide component on the UI side. */
19227
+ iconId: string(),
19228
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18887
19229
  icon: EventKindIconSchema,
18888
19230
  category: EventKindCategorySchema,
19231
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19232
+ parentKind: string().nullable(),
19233
+ /** Derived from `parentKind`, explicit for the client tree. */
19234
+ level: EventKindLevelSchema,
18889
19235
  /** Which cap + device contributes this kind. For built-ins the camera
18890
19236
  * itself; for sensor kinds the LINKED source device. */
18891
19237
  source: object({
@@ -18958,11 +19304,21 @@ var TrackAudioLabelSchema = object({
18958
19304
  firstAt: number(),
18959
19305
  lastAt: number()
18960
19306
  });
19307
+ /**
19308
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19309
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19310
+ * linked sensor/control state change (no positions; carries a snapshot). The
19311
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19312
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19313
+ */
19314
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18961
19315
  var TrackSchema = object({
18962
19316
  trackId: string(),
18963
19317
  deviceId: number(),
18964
19318
  className: string(),
18965
19319
  label: string().optional(),
19320
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19321
+ source: TrackSourceSchema.optional(),
18966
19322
  firstSeen: number(),
18967
19323
  lastSeen: number(),
18968
19324
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19339,6 +19695,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19339
19695
  eventId: string(),
19340
19696
  timestamp: number()
19341
19697
  });
19698
+ /**
19699
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19700
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19701
+ * caps into per-camera event-kind descriptors.
19702
+ *
19703
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19704
+ * is NOT duplicated here — every entry is derived from the single
19705
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19706
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19707
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19708
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19709
+ * eventful cap is missing.
19710
+ */
19711
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19712
+ var LEGACY_ICON = {
19713
+ motion: "motion",
19714
+ audio: "audio",
19715
+ person: "person",
19716
+ vehicle: "vehicle",
19717
+ animal: "animal",
19718
+ package: "package",
19719
+ door: "door",
19720
+ pir: "pir",
19721
+ smoke: "smoke",
19722
+ water: "water",
19723
+ button: "button",
19724
+ generic: "generic",
19725
+ gas: "smoke",
19726
+ vibration: "generic",
19727
+ tamper: "generic",
19728
+ presence: "person",
19729
+ lock: "generic",
19730
+ siren: "generic",
19731
+ switch: "generic",
19732
+ doorbell: "button"
19733
+ };
19734
+ function legacyIcon(iconId) {
19735
+ return LEGACY_ICON[iconId] ?? "generic";
19736
+ }
19737
+ /**
19738
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19739
+ * The anti-drift guard cross-checks this against the eventful caps declared
19740
+ * in `packages/types/src/capabilities/*.cap.ts`.
19741
+ */
19742
+ var CAP_TO_KIND = {
19743
+ contact: "contact",
19744
+ motion: "motion-sensor",
19745
+ smoke: "smoke",
19746
+ flood: "flood",
19747
+ gas: "gas",
19748
+ "carbon-monoxide": "carbon-monoxide",
19749
+ vibration: "vibration",
19750
+ tamper: "tamper",
19751
+ presence: "presence",
19752
+ "enum-sensor": "enum-sensor",
19753
+ "event-emitter": "device-event",
19754
+ "lock-control": "lock",
19755
+ switch: "switch",
19756
+ button: "button",
19757
+ doorbell: "doorbell"
19758
+ };
19759
+ function buildDescriptor(capName, kind) {
19760
+ const t = EVENT_TAXONOMY[kind];
19761
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19762
+ return {
19763
+ ...t,
19764
+ icon: legacyIcon(t.iconId)
19765
+ };
19766
+ }
19767
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19342
19768
  var CameraPipelineConfigSchema = object({
19343
19769
  engine: PipelineEngineChoiceSchema.optional(),
19344
19770
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19357,13 +19783,11 @@ var PipelineTemplateSchema = object({
19357
19783
  createdAt: string(),
19358
19784
  updatedAt: string()
19359
19785
  });
19360
- var AgentAddonConfigSchema = object({
19361
- enabled: boolean(),
19786
+ var DeviceStepConfigSchema = object({
19362
19787
  modelId: string().optional(),
19363
- settings: record(string(), unknown()).readonly()
19788
+ settings: record(string(), unknown()).optional()
19364
19789
  });
19365
19790
  var AgentPipelineSettingsSchema = object({
19366
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19367
19791
  maxCameras: number().int().nonnegative().nullable().default(null),
19368
19792
  /** Per-node detection weight (relative share for the quota balancer). */
19369
19793
  detectWeight: number().positive().optional(),
@@ -19387,7 +19811,22 @@ var AgentPipelineSettingsSchema = object({
19387
19811
  * it already uses to reach the hub). Set this only when the auto-detected
19388
19812
  * address is wrong (multi-homed host, NAT, custom interface).
19389
19813
  */
19390
- reachableHost: string().optional()
19814
+ reachableHost: string().optional(),
19815
+ /**
19816
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19817
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19818
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19819
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19820
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19821
+ * the default model/settings for every camera landing on that accelerator;
19822
+ * a stepId absent ⇒ the step uses that device's format default.
19823
+ */
19824
+ inferenceDevices: record(string(), object({
19825
+ enabled: boolean(),
19826
+ weight: number().positive().optional(),
19827
+ maxSessions: number().int().positive().optional(),
19828
+ steps: record(string(), DeviceStepConfigSchema).optional()
19829
+ })).optional()
19391
19830
  });
19392
19831
  var CameraPipelineForAgentSchema = object({
19393
19832
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19397,14 +19836,13 @@ var CameraPipelineForAgentSchema = object({
19397
19836
  }).nullable()
19398
19837
  });
19399
19838
  var CameraStepOverridePatchSchema = object({
19400
- enabled: boolean().optional(),
19401
19839
  modelId: string().optional(),
19402
19840
  settings: record(string(), unknown()).readonly().optional()
19403
19841
  });
19404
19842
  var CameraPipelineSettingsSchema = object({
19405
19843
  pinnedAgentNodeId: string().optional(),
19406
19844
  stepToggles: record(string(), boolean()).optional(),
19407
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19845
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19408
19846
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19409
19847
  });
19410
19848
  /**
@@ -19618,6 +20056,44 @@ var CameraStatusSchema = object({
19618
20056
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19619
20057
  fetchedAt: number()
19620
20058
  });
20059
+ var NodeInferenceDeviceSchema = object({
20060
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20061
+ key: string(),
20062
+ backend: string(),
20063
+ device: string(),
20064
+ format: _enum(MODEL_FORMATS),
20065
+ /** Whether the node's live probe reports the device as usable right now. */
20066
+ available: boolean(),
20067
+ /**
20068
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20069
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20070
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20071
+ * not a balanced target). An explicit stored value always wins; a stored-only
20072
+ * (unavailable) key keeps its stored value.
20073
+ */
20074
+ enabled: boolean(),
20075
+ /** Relative balancer weight for the enabled device (default 1). */
20076
+ weight: number(),
20077
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20078
+ maxSessions: number().nullable(),
20079
+ /** Object-detection model the executor defaults to for this deviceKey. */
20080
+ defaultModelId: string(),
20081
+ /**
20082
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20083
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20084
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20085
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20086
+ * available per format; this is the stored selection that becomes the
20087
+ * default for EVERY camera landing on this accelerator.
20088
+ */
20089
+ steps: record(string(), DeviceStepConfigSchema).optional()
20090
+ });
20091
+ var NodeInferenceDevicesSchema = object({
20092
+ nodeId: string(),
20093
+ /** False when the node's platform-probe was unreachable (no live device set). */
20094
+ reachable: boolean(),
20095
+ devices: array(NodeInferenceDeviceSchema).readonly()
20096
+ });
19621
20097
  method(object({
19622
20098
  deviceId: number(),
19623
20099
  agentNodeId: string()
@@ -19627,7 +20103,13 @@ method(object({
19627
20103
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19628
20104
  kind: "mutation",
19629
20105
  auth: "admin"
19630
- }), method(_void(), object({ migrated: number() }), {
20106
+ }), method(object({
20107
+ deviceId: number(),
20108
+ deviceKey: string()
20109
+ }), object({ success: literal(true) }), {
20110
+ kind: "mutation",
20111
+ auth: "admin"
20112
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19631
20113
  kind: "mutation",
19632
20114
  auth: "admin"
19633
20115
  }), 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({
@@ -19661,13 +20143,7 @@ method(object({
19661
20143
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19662
20144
  nodeId: string(),
19663
20145
  settings: AgentPipelineSettingsSchema
19664
- })).readonly()), method(object({
19665
- agentNodeId: string(),
19666
- defaults: record(string(), AgentAddonConfigSchema)
19667
- }), object({ success: literal(true) }), {
19668
- kind: "mutation",
19669
- auth: "admin"
19670
- }), method(object({ agentNodeId: string() }), object({
20146
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19671
20147
  success: boolean(),
19672
20148
  removed: boolean()
19673
20149
  }), {
@@ -19699,7 +20175,18 @@ method(object({
19699
20175
  }), object({ success: literal(true) }), {
19700
20176
  kind: "mutation",
19701
20177
  auth: "admin"
19702
- }), method(object({ agentNodeId: string() }), object({
20178
+ }), method(object({
20179
+ agentNodeId: string(),
20180
+ inferenceDevices: record(string(), object({
20181
+ enabled: boolean(),
20182
+ weight: number().positive().optional(),
20183
+ maxSessions: number().int().positive().optional(),
20184
+ steps: record(string(), DeviceStepConfigSchema).optional()
20185
+ }))
20186
+ }), object({ success: literal(true) }), {
20187
+ kind: "mutation",
20188
+ auth: "admin"
20189
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19703
20190
  success: literal(true),
19704
20191
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19705
20192
  effectiveModelId: string().nullable(),
@@ -19715,9 +20202,10 @@ method(object({
19715
20202
  }), object({ success: literal(true) }), {
19716
20203
  kind: "mutation",
19717
20204
  auth: "admin"
19718
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20205
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19719
20206
  deviceId: number(),
19720
20207
  agentNodeId: string(),
20208
+ deviceKey: string(),
19721
20209
  addonId: string(),
19722
20210
  patch: CameraStepOverridePatchSchema.nullable()
19723
20211
  }), object({ success: literal(true) }), {
@@ -19754,14 +20242,13 @@ method(object({
19754
20242
  });
19755
20243
  /**
19756
20244
  * server-management — per-NODE singleton capability for a node's ROOT
19757
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19758
- * agents).
20245
+ * package lifecycle (runtime-updatable node packages).
19759
20246
  *
19760
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19761
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19762
- * version describes the node. Updates install into
19763
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19764
- * starter (probation boot + auto-rollback to N-1).
20247
+ * Every node role runs the SAME root package (`@camstack/server`), which
20248
+ * carries the whole software stack in its npm dep tree, so ONE version
20249
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20250
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20251
+ * no auto-rollback).
19765
20252
  *
19766
20253
  * Providers:
19767
20254
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19869,7 +20356,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19869
20356
  /** Explicit target version; omitted = latest from the registry. */
19870
20357
  version: string().optional() }), ServerUpdateActionResultSchema, {
19871
20358
  kind: "mutation",
19872
- auth: "admin"
20359
+ auth: "admin",
20360
+ timeoutMs: 16 * 6e4
19873
20361
  }), method(_void(), ServerUpdateActionResultSchema, {
19874
20362
  kind: "mutation",
19875
20363
  auth: "admin"
@@ -20913,22 +21401,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20913
21401
  var RestartAddonResultSchema = unknown();
20914
21402
  var InstallPackageResultSchema = unknown();
20915
21403
  var ReloadPackagesResultSchema = unknown();
20916
- /**
20917
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20918
- * server restarts so the admin UI can react to the `restartingAt`
20919
- * timestamp (shows reconnect overlay). The transition from
20920
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20921
- * `system.restart-completed` event after the new process boots.
20922
- *
20923
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20924
- */
20925
- var UpdateFrameworkPackageResultSchema = object({
20926
- packageName: string(),
20927
- fromVersion: string(),
20928
- toVersion: string(),
20929
- /** Ms-epoch the server scheduled its self-restart. */
20930
- restartingAt: number()
20931
- });
20932
21404
  var BulkUpdateItemStatusSchema = _enum([
20933
21405
  "queued",
20934
21406
  "updating",
@@ -21056,13 +21528,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21056
21528
  }), object({ success: literal(true) }), {
21057
21529
  kind: "mutation",
21058
21530
  auth: "admin"
21059
- }), method(object({
21060
- packageName: string().min(1),
21061
- version: string().optional(),
21062
- deferRestart: boolean().optional()
21063
- }), UpdateFrameworkPackageResultSchema, {
21064
- kind: "mutation",
21065
- auth: "admin"
21066
21531
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21067
21532
  kind: "mutation",
21068
21533
  auth: "admin"
@@ -21928,10 +22393,10 @@ var TopologyCategorySchema = object({
21928
22393
  addons: array(TopologyCategoryAddonSchema).readonly()
21929
22394
  });
21930
22395
  /**
21931
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21932
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21933
- * version visibility for the Server management surface. Nullable: offline
21934
- * rows and pre-phase-2 nodes report none.
22396
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22397
+ * root package for every node role) as reported by its `registerNode`
22398
+ * manifest — version visibility for the Server management surface. Nullable:
22399
+ * offline rows and nodes that never reported one.
21935
22400
  */
21936
22401
  var TopologyRootPackageSchema = object({
21937
22402
  name: string(),
@@ -22319,17 +22784,28 @@ var PlatformScoreSchema = object({
22319
22784
  format: _enum([
22320
22785
  "onnx",
22321
22786
  "coreml",
22322
- "openvino"
22787
+ "openvino",
22788
+ "tflite"
22323
22789
  ]),
22324
22790
  score: number(),
22325
22791
  reason: string(),
22326
22792
  available: boolean()
22327
22793
  });
22794
+ var InferenceDeviceDescriptorSchema = object({
22795
+ key: string(),
22796
+ backend: string(),
22797
+ device: string(),
22798
+ format: ModelFormatSchema,
22799
+ runtime: literal("python"),
22800
+ score: number(),
22801
+ available: boolean()
22802
+ });
22328
22803
  var PlatformCapabilitiesSchema = object({
22329
22804
  hardware: HardwareInfoSchema,
22330
22805
  scores: array(PlatformScoreSchema).readonly(),
22331
22806
  bestScore: PlatformScoreSchema,
22332
- pythonPath: string().nullable()
22807
+ pythonPath: string().nullable(),
22808
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22333
22809
  });
22334
22810
  var ModelRequirementSchema = object({
22335
22811
  modelId: string(),
@@ -23208,12 +23684,6 @@ Object.freeze({
23208
23684
  addonId: null,
23209
23685
  access: "delete"
23210
23686
  },
23211
- "addons.updateFrameworkPackage": {
23212
- capName: "addons",
23213
- capScope: "system",
23214
- addonId: null,
23215
- access: "create"
23216
- },
23217
23687
  "addons.updatePackage": {
23218
23688
  capName: "addons",
23219
23689
  capScope: "system",
@@ -25986,12 +26456,6 @@ Object.freeze({
25986
26456
  addonId: null,
25987
26457
  access: "view"
25988
26458
  },
25989
- "pipelineExecutor.reprobeEngine": {
25990
- capName: "pipeline-executor",
25991
- capScope: "system",
25992
- addonId: null,
25993
- access: "create"
25994
- },
25995
26459
  "pipelineExecutor.runAudioTest": {
25996
26460
  capName: "pipeline-executor",
25997
26461
  capScope: "system",
@@ -26142,6 +26606,12 @@ Object.freeze({
26142
26606
  addonId: null,
26143
26607
  access: "view"
26144
26608
  },
26609
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26610
+ capName: "pipeline-orchestrator",
26611
+ capScope: "system",
26612
+ addonId: null,
26613
+ access: "view"
26614
+ },
26145
26615
  "pipelineOrchestrator.getPipelineAssignment": {
26146
26616
  capName: "pipeline-orchestrator",
26147
26617
  capScope: "system",
@@ -26154,6 +26624,12 @@ Object.freeze({
26154
26624
  addonId: null,
26155
26625
  access: "view"
26156
26626
  },
26627
+ "pipelineOrchestrator.getPipelineDevicePin": {
26628
+ capName: "pipeline-orchestrator",
26629
+ capScope: "system",
26630
+ addonId: null,
26631
+ access: "view"
26632
+ },
26157
26633
  "pipelineOrchestrator.listAgentSettings": {
26158
26634
  capName: "pipeline-orchestrator",
26159
26635
  capScope: "system",
@@ -26196,19 +26672,19 @@ Object.freeze({
26196
26672
  addonId: null,
26197
26673
  access: "create"
26198
26674
  },
26199
- "pipelineOrchestrator.setAgentAddonDefaults": {
26675
+ "pipelineOrchestrator.setAgentCapabilities": {
26200
26676
  capName: "pipeline-orchestrator",
26201
26677
  capScope: "system",
26202
26678
  addonId: null,
26203
26679
  access: "create"
26204
26680
  },
26205
- "pipelineOrchestrator.setAgentCapabilities": {
26681
+ "pipelineOrchestrator.setAgentDetectWeight": {
26206
26682
  capName: "pipeline-orchestrator",
26207
26683
  capScope: "system",
26208
26684
  addonId: null,
26209
26685
  access: "create"
26210
26686
  },
26211
- "pipelineOrchestrator.setAgentDetectWeight": {
26687
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26212
26688
  capName: "pipeline-orchestrator",
26213
26689
  capScope: "system",
26214
26690
  addonId: null,
@@ -26250,6 +26726,12 @@ Object.freeze({
26250
26726
  addonId: null,
26251
26727
  access: "create"
26252
26728
  },
26729
+ "pipelineOrchestrator.setPipelineDevicePin": {
26730
+ capName: "pipeline-orchestrator",
26731
+ capScope: "system",
26732
+ addonId: null,
26733
+ access: "create"
26734
+ },
26253
26735
  "pipelineOrchestrator.unassignAudio": {
26254
26736
  capName: "pipeline-orchestrator",
26255
26737
  capScope: "system",
@@ -27802,32 +28284,6 @@ Object.freeze({
27802
28284
  "network-access": "ingress",
27803
28285
  "smtp-provider": "email"
27804
28286
  });
27805
- var frameworkSwapPackageSchema = object({
27806
- name: string(),
27807
- stagedPath: string(),
27808
- backupPath: string(),
27809
- toVersion: string(),
27810
- fromVersion: string().nullable()
27811
- });
27812
- object({
27813
- jobId: string(),
27814
- taskId: string(),
27815
- packages: array(frameworkSwapPackageSchema),
27816
- requestedAtMs: number(),
27817
- schemaVersion: literal(1)
27818
- });
27819
- object({
27820
- jobId: string(),
27821
- taskId: string(),
27822
- backups: array(object({
27823
- name: string(),
27824
- backupPath: string(),
27825
- livePath: string()
27826
- })),
27827
- appliedAtMs: number(),
27828
- bootAttempts: number(),
27829
- schemaVersion: literal(1)
27830
- });
27831
28287
  //#endregion
27832
28288
  //#region src/config.ts
27833
28289
  /**