@camstack/addon-provider-homeassistant 1.1.31 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +560 -104
  2. package/dist/addon.mjs +560 -104
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -7085,6 +7085,17 @@ var ModelCatalogEntrySchema = object({
7085
7085
  "imagenet",
7086
7086
  "none"
7087
7087
  ]).optional(),
7088
+ /**
7089
+ * The model already applies softmax IN-GRAPH — its raw output is a
7090
+ * probability distribution, not logits. When set, the `softmax`
7091
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7092
+ * probability vector collapses it toward uniform (top-1 score craters far
7093
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7094
+ * the output is raw logits and the postprocessor applies softmax (the normal
7095
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7096
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7097
+ */
7098
+ outputProbabilities: boolean().optional(),
7088
7099
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7089
7100
  /**
7090
7101
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7761,6 +7772,160 @@ var EncodeProfileSchema = object({
7761
7772
  */
7762
7773
  outputArgs: array(string()).optional()
7763
7774
  });
7775
+ var COCO_TO_MACRO = {
7776
+ mapping: {
7777
+ person: "person",
7778
+ bicycle: "vehicle",
7779
+ car: "vehicle",
7780
+ motorcycle: "vehicle",
7781
+ airplane: "vehicle",
7782
+ bus: "vehicle",
7783
+ train: "vehicle",
7784
+ truck: "vehicle",
7785
+ boat: "vehicle",
7786
+ bird: "animal",
7787
+ cat: "animal",
7788
+ dog: "animal",
7789
+ horse: "animal",
7790
+ sheep: "animal",
7791
+ cow: "animal",
7792
+ elephant: "animal",
7793
+ bear: "animal",
7794
+ zebra: "animal",
7795
+ giraffe: "animal",
7796
+ suitcase: "package",
7797
+ backpack: "package",
7798
+ handbag: "package"
7799
+ },
7800
+ preserveOriginal: false
7801
+ };
7802
+ var AUDIO_MACRO_LABELS = [
7803
+ {
7804
+ id: "speech",
7805
+ name: "Speech",
7806
+ icon: "🗣️"
7807
+ },
7808
+ {
7809
+ id: "scream",
7810
+ name: "Scream / Shout",
7811
+ icon: "😱"
7812
+ },
7813
+ {
7814
+ id: "crying",
7815
+ name: "Crying / Baby",
7816
+ icon: "😢"
7817
+ },
7818
+ {
7819
+ id: "laughter",
7820
+ name: "Laughter",
7821
+ icon: "😂"
7822
+ },
7823
+ {
7824
+ id: "music",
7825
+ name: "Music",
7826
+ icon: "🎵"
7827
+ },
7828
+ {
7829
+ id: "dog",
7830
+ name: "Dog",
7831
+ icon: "🐕"
7832
+ },
7833
+ {
7834
+ id: "cat",
7835
+ name: "Cat",
7836
+ icon: "🐈"
7837
+ },
7838
+ {
7839
+ id: "bird",
7840
+ name: "Bird",
7841
+ icon: "🐦"
7842
+ },
7843
+ {
7844
+ id: "animal",
7845
+ name: "Animal (other)",
7846
+ icon: "🐾"
7847
+ },
7848
+ {
7849
+ id: "alarm",
7850
+ name: "Alarm / Siren",
7851
+ icon: "🚨"
7852
+ },
7853
+ {
7854
+ id: "doorbell",
7855
+ name: "Doorbell / Knock",
7856
+ icon: "🔔"
7857
+ },
7858
+ {
7859
+ id: "glass_breaking",
7860
+ name: "Glass Breaking",
7861
+ icon: "💥"
7862
+ },
7863
+ {
7864
+ id: "gunshot",
7865
+ name: "Gunshot / Explosion",
7866
+ icon: "💣"
7867
+ },
7868
+ {
7869
+ id: "vehicle",
7870
+ name: "Vehicle",
7871
+ icon: "🚗"
7872
+ },
7873
+ {
7874
+ id: "siren",
7875
+ name: "Emergency Siren",
7876
+ icon: "🚑"
7877
+ },
7878
+ {
7879
+ id: "fire",
7880
+ name: "Fire / Smoke",
7881
+ icon: "🔥"
7882
+ },
7883
+ {
7884
+ id: "water",
7885
+ name: "Water",
7886
+ icon: "💧"
7887
+ },
7888
+ {
7889
+ id: "wind",
7890
+ name: "Wind / Weather",
7891
+ icon: "🌬️"
7892
+ },
7893
+ {
7894
+ id: "door",
7895
+ name: "Door",
7896
+ icon: "🚪"
7897
+ },
7898
+ {
7899
+ id: "footsteps",
7900
+ name: "Footsteps",
7901
+ icon: "👣"
7902
+ },
7903
+ {
7904
+ id: "crowd",
7905
+ name: "Crowd / Chatter",
7906
+ icon: "👥"
7907
+ },
7908
+ {
7909
+ id: "telephone",
7910
+ name: "Telephone",
7911
+ icon: "📞"
7912
+ },
7913
+ {
7914
+ id: "engine",
7915
+ name: "Engine / Motor",
7916
+ icon: "⚙️"
7917
+ },
7918
+ {
7919
+ id: "tools",
7920
+ name: "Tools / Construction",
7921
+ icon: "🔨"
7922
+ },
7923
+ {
7924
+ id: "silence",
7925
+ name: "Silence",
7926
+ icon: "🤫"
7927
+ }
7928
+ ];
7764
7929
  var YAMNET_TO_MACRO = {
7765
7930
  mapping: {
7766
7931
  Speech: "speech",
@@ -8027,6 +8192,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8027
8192
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8028
8193
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8029
8194
  /**
8195
+ * Unified event-kind taxonomy — THE single source of truth for
8196
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8197
+ * icon }`.
8198
+ *
8199
+ * This dictionary folds together what used to be scattered across four
8200
+ * copies:
8201
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8202
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8203
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8204
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8205
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8206
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8207
+ *
8208
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8209
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8210
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8211
+ * color or an icon: they read this dictionary (server descriptors carry the
8212
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8213
+ *
8214
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8215
+ */
8216
+ var TAXONOMY_COLORS = {
8217
+ motion: "#f59e0b",
8218
+ audio: "#06b6d4",
8219
+ person: "#22c55e",
8220
+ vehicle: "#3b82f6",
8221
+ animal: "#f97316",
8222
+ package: "#a855f7",
8223
+ sensor: "#8b5cf6",
8224
+ control: "#10b981",
8225
+ genericDetection: "#64748b"
8226
+ };
8227
+ var DETECTION_SUB_COLORS = {
8228
+ car: "#f59e0b",
8229
+ truck: "#d97706",
8230
+ bus: "#b45309",
8231
+ motorcycle: "#eab308",
8232
+ bicycle: "#ca8a04",
8233
+ airplane: "#60a5fa",
8234
+ boat: "#2563eb",
8235
+ train: "#1d4ed8",
8236
+ bird: "#14b8a6",
8237
+ dog: "#84cc16",
8238
+ cat: "#f97316",
8239
+ horse: "#a16207",
8240
+ sheep: "#a3a3a3",
8241
+ cow: "#78716c",
8242
+ elephant: "#6b7280",
8243
+ bear: "#7c2d12",
8244
+ zebra: "#404040",
8245
+ giraffe: "#d4a373"
8246
+ };
8247
+ function titleCase(id) {
8248
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8249
+ }
8250
+ var entries = /* @__PURE__ */ new Map();
8251
+ function macro(kind, category, color, iconId, label) {
8252
+ entries.set(kind, {
8253
+ kind,
8254
+ parentKind: null,
8255
+ level: "macro",
8256
+ category,
8257
+ color,
8258
+ iconId,
8259
+ labelKey: `eventKind.${kind}`,
8260
+ label
8261
+ });
8262
+ }
8263
+ function sub(kind, parentKind, category, color, iconId, label) {
8264
+ entries.set(kind, {
8265
+ kind,
8266
+ parentKind,
8267
+ level: "sub",
8268
+ category,
8269
+ color,
8270
+ iconId,
8271
+ labelKey: `eventKind.${kind}`,
8272
+ label
8273
+ });
8274
+ }
8275
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8276
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8277
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8278
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8279
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8280
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8281
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8282
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8283
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8284
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8285
+ if (entries.has(cocoClass)) continue;
8286
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8287
+ }
8288
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8289
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8290
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8291
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8292
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8293
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8294
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8295
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8296
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8297
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8298
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8299
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8300
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8301
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8302
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8303
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8304
+ sub("button", "control", "control", "#10b981", "button", "Button");
8305
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8306
+ for (const l of AUDIO_MACRO_LABELS) {
8307
+ const kind = `audio-${l.id}`;
8308
+ if (entries.has(kind)) continue;
8309
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8310
+ }
8311
+ /** The complete taxonomy dictionary, keyed by kind. */
8312
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8313
+ /**
8030
8314
  * Error types for the safe expression engine. Two distinct classes so callers
8031
8315
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8032
8316
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12457,10 +12741,7 @@ var ConfigUISchemaNullableBridge = custom();
12457
12741
  var InferenceCapabilitiesBridge = custom();
12458
12742
  var ModelAvailabilityListBridge = custom();
12459
12743
  var PipelineRunResultBridge = custom();
12460
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12461
- kind: "mutation",
12462
- auth: "admin"
12463
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12744
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12464
12745
  modelId: string(),
12465
12746
  settings: record(string(), unknown()).readonly()
12466
12747
  }))), method(object({ steps: record(string(), object({
@@ -12520,13 +12801,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12520
12801
  * (inputClasses ≠ null) are skipped and served per-track via
12521
12802
  * pipelineRunner.runDetailSubtree (two-plane design).
12522
12803
  */
12523
- plane: _enum(["full", "frame"]).optional()
12804
+ plane: _enum(["full", "frame"]).optional(),
12805
+ /**
12806
+ * Inference-device selector (Phase 2 multi-device). Format
12807
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12808
+ * Omitted ⇒ the runner's default device (current single-engine
12809
+ * behaviour). Selects WHICH device pool of the node runs the call.
12810
+ */
12811
+ deviceKey: string().optional()
12524
12812
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12525
12813
  engine: PipelineEngineChoiceSchema.optional(),
12526
12814
  steps: array(PipelineStepInputSchema).min(1),
12527
12815
  frames: array(FrameInputSchema).min(1).max(255),
12528
12816
  deviceId: number().optional(),
12529
- sessionId: string().optional()
12817
+ sessionId: string().optional(),
12818
+ /**
12819
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12820
+ * the batch to the Python pool's bench preprocess cache
12821
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12822
+ * preprocessed ONCE and every later inference is a pure-inference cache
12823
+ * hit — the sustained-throughput run measures inference, not
12824
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12825
+ * full preprocess every call, correct). Fresh per sustained run;
12826
+ * released via `uncacheFrame`.
12827
+ */
12828
+ frameId: number().int().nonnegative().optional(),
12829
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12830
+ deviceKey: string().optional()
12530
12831
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12531
12832
  data: _instanceof(Uint8Array),
12532
12833
  width: number().int().positive(),
@@ -12558,8 +12859,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12558
12859
  * - `runtime` — main camera-serving engine (no idle TTL).
12559
12860
  * - `warm-override` — benchmark/test override held in the warm
12560
12861
  * cache; auto-disposed after the idle TTL.
12862
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12863
+ * multi-device, keyed by `deviceKey`) resolved
12864
+ * via `resolveDeviceFactory`. Runs alongside the
12865
+ * `runtime` engine on a DIFFERENT accelerator
12866
+ * (NPU / iGPU / Coral) — this is how the
12867
+ * Engines tab shows all pools running at once.
12561
12868
  */
12562
- kind: _enum(["runtime", "warm-override"]),
12869
+ kind: _enum([
12870
+ "runtime",
12871
+ "warm-override",
12872
+ "device-pool"
12873
+ ]),
12563
12874
  /** Native pid of the underlying Python pool (null when no pool). */
12564
12875
  poolPid: number().nullable(),
12565
12876
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12934,7 +13245,14 @@ var RunnerCameraConfigSchema = object({
12934
13245
  * camera's detect node differs from its source-owner (P2d, gated by the
12935
13246
  * `remoteSourcingNodes` rollout setting).
12936
13247
  */
12937
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
13248
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
13249
+ /**
13250
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
13251
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
13252
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
13253
+ * this only selects WHICH device pool of that node runs the session.
13254
+ */
13255
+ deviceKey: string().optional()
12938
13256
  });
12939
13257
  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;
12940
13258
  /**
@@ -12955,6 +13273,19 @@ var RunnerLocalLoadSchema = object({
12955
13273
  avgInferenceTimeMs: number(),
12956
13274
  /** Total queue depth across motion + detection queues. */
12957
13275
  queueDepthTotal: number(),
13276
+ /**
13277
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
13278
+ * this runner currently has attached cameras on, so the orchestrator's second
13279
+ * `balance()` pass (over a node's devices) weights on real per-pool session
13280
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
13281
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
13282
+ */
13283
+ devices: array(object({
13284
+ deviceKey: string(),
13285
+ backend: string(),
13286
+ attachedCameras: number(),
13287
+ queueDepthTotal: number()
13288
+ })).default([]),
12958
13289
  /** Hardware capability flags reported by this node. */
12959
13290
  hardware: object({
12960
13291
  hasGpu: boolean(),
@@ -16103,6 +16434,8 @@ var BaseDeviceProvider = class extends BaseAddon {
16103
16434
  return toDeviceSummary(device, this.addonId);
16104
16435
  }
16105
16436
  };
16437
+ 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;
16438
+ new Set(Object.values(DeviceType));
16106
16439
  /**
16107
16440
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
16108
16441
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -19296,17 +19629,30 @@ var EventKindCategorySchema = _enum([
19296
19629
  "audio",
19297
19630
  "detection",
19298
19631
  "sensor",
19632
+ "control",
19299
19633
  "custom",
19300
19634
  "package"
19301
19635
  ]);
19636
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19637
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
19302
19638
  var EventKindDescriptorSchema = object({
19303
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19639
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
19304
19640
  kind: string(),
19641
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19642
+ labelKey: string(),
19643
+ /** English fallback label (kept for clients that don't translate). */
19305
19644
  label: string(),
19306
19645
  /** Hex color for timeline/legend rendering. */
19307
19646
  color: string(),
19647
+ /** Dictionary id → lucide component on the UI side. */
19648
+ iconId: string(),
19649
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
19308
19650
  icon: EventKindIconSchema,
19309
19651
  category: EventKindCategorySchema,
19652
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19653
+ parentKind: string().nullable(),
19654
+ /** Derived from `parentKind`, explicit for the client tree. */
19655
+ level: EventKindLevelSchema,
19310
19656
  /** Which cap + device contributes this kind. For built-ins the camera
19311
19657
  * itself; for sensor kinds the LINKED source device. */
19312
19658
  source: object({
@@ -19379,11 +19725,21 @@ var TrackAudioLabelSchema = object({
19379
19725
  firstAt: number(),
19380
19726
  lastAt: number()
19381
19727
  });
19728
+ /**
19729
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19730
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19731
+ * linked sensor/control state change (no positions; carries a snapshot). The
19732
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19733
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19734
+ */
19735
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19382
19736
  var TrackSchema = object({
19383
19737
  trackId: string(),
19384
19738
  deviceId: number(),
19385
19739
  className: string(),
19386
19740
  label: string().optional(),
19741
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19742
+ source: TrackSourceSchema.optional(),
19387
19743
  firstSeen: number(),
19388
19744
  lastSeen: number(),
19389
19745
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19760,6 +20116,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19760
20116
  eventId: string(),
19761
20117
  timestamp: number()
19762
20118
  });
20119
+ /**
20120
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
20121
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
20122
+ * caps into per-camera event-kind descriptors.
20123
+ *
20124
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
20125
+ * is NOT duplicated here — every entry is derived from the single
20126
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
20127
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
20128
+ * control cap means adding one line here (and a taxonomy entry); the anti-
20129
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
20130
+ * eventful cap is missing.
20131
+ */
20132
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
20133
+ var LEGACY_ICON = {
20134
+ motion: "motion",
20135
+ audio: "audio",
20136
+ person: "person",
20137
+ vehicle: "vehicle",
20138
+ animal: "animal",
20139
+ package: "package",
20140
+ door: "door",
20141
+ pir: "pir",
20142
+ smoke: "smoke",
20143
+ water: "water",
20144
+ button: "button",
20145
+ generic: "generic",
20146
+ gas: "smoke",
20147
+ vibration: "generic",
20148
+ tamper: "generic",
20149
+ presence: "person",
20150
+ lock: "generic",
20151
+ siren: "generic",
20152
+ switch: "generic",
20153
+ doorbell: "button"
20154
+ };
20155
+ function legacyIcon(iconId) {
20156
+ return LEGACY_ICON[iconId] ?? "generic";
20157
+ }
20158
+ /**
20159
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
20160
+ * The anti-drift guard cross-checks this against the eventful caps declared
20161
+ * in `packages/types/src/capabilities/*.cap.ts`.
20162
+ */
20163
+ var CAP_TO_KIND = {
20164
+ contact: "contact",
20165
+ motion: "motion-sensor",
20166
+ smoke: "smoke",
20167
+ flood: "flood",
20168
+ gas: "gas",
20169
+ "carbon-monoxide": "carbon-monoxide",
20170
+ vibration: "vibration",
20171
+ tamper: "tamper",
20172
+ presence: "presence",
20173
+ "enum-sensor": "enum-sensor",
20174
+ "event-emitter": "device-event",
20175
+ "lock-control": "lock",
20176
+ switch: "switch",
20177
+ button: "button",
20178
+ doorbell: "doorbell"
20179
+ };
20180
+ function buildDescriptor(capName, kind) {
20181
+ const t = EVENT_TAXONOMY[kind];
20182
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
20183
+ return {
20184
+ ...t,
20185
+ icon: legacyIcon(t.iconId)
20186
+ };
20187
+ }
20188
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19763
20189
  var CameraPipelineConfigSchema = object({
19764
20190
  engine: PipelineEngineChoiceSchema.optional(),
19765
20191
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19778,13 +20204,11 @@ var PipelineTemplateSchema = object({
19778
20204
  createdAt: string(),
19779
20205
  updatedAt: string()
19780
20206
  });
19781
- var AgentAddonConfigSchema = object({
19782
- enabled: boolean(),
20207
+ var DeviceStepConfigSchema = object({
19783
20208
  modelId: string().optional(),
19784
- settings: record(string(), unknown()).readonly()
20209
+ settings: record(string(), unknown()).optional()
19785
20210
  });
19786
20211
  var AgentPipelineSettingsSchema = object({
19787
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19788
20212
  maxCameras: number().int().nonnegative().nullable().default(null),
19789
20213
  /** Per-node detection weight (relative share for the quota balancer). */
19790
20214
  detectWeight: number().positive().optional(),
@@ -19808,7 +20232,22 @@ var AgentPipelineSettingsSchema = object({
19808
20232
  * it already uses to reach the hub). Set this only when the auto-detected
19809
20233
  * address is wrong (multi-homed host, NAT, custom interface).
19810
20234
  */
19811
- reachableHost: string().optional()
20235
+ reachableHost: string().optional(),
20236
+ /**
20237
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
20238
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
20239
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
20240
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
20241
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
20242
+ * the default model/settings for every camera landing on that accelerator;
20243
+ * a stepId absent ⇒ the step uses that device's format default.
20244
+ */
20245
+ inferenceDevices: record(string(), object({
20246
+ enabled: boolean(),
20247
+ weight: number().positive().optional(),
20248
+ maxSessions: number().int().positive().optional(),
20249
+ steps: record(string(), DeviceStepConfigSchema).optional()
20250
+ })).optional()
19812
20251
  });
19813
20252
  var CameraPipelineForAgentSchema = object({
19814
20253
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19818,14 +20257,13 @@ var CameraPipelineForAgentSchema = object({
19818
20257
  }).nullable()
19819
20258
  });
19820
20259
  var CameraStepOverridePatchSchema = object({
19821
- enabled: boolean().optional(),
19822
20260
  modelId: string().optional(),
19823
20261
  settings: record(string(), unknown()).readonly().optional()
19824
20262
  });
19825
20263
  var CameraPipelineSettingsSchema = object({
19826
20264
  pinnedAgentNodeId: string().optional(),
19827
20265
  stepToggles: record(string(), boolean()).optional(),
19828
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
20266
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19829
20267
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19830
20268
  });
19831
20269
  /**
@@ -20039,6 +20477,44 @@ var CameraStatusSchema = object({
20039
20477
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
20040
20478
  fetchedAt: number()
20041
20479
  });
20480
+ var NodeInferenceDeviceSchema = object({
20481
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20482
+ key: string(),
20483
+ backend: string(),
20484
+ device: string(),
20485
+ format: _enum(MODEL_FORMATS),
20486
+ /** Whether the node's live probe reports the device as usable right now. */
20487
+ available: boolean(),
20488
+ /**
20489
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20490
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20491
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20492
+ * not a balanced target). An explicit stored value always wins; a stored-only
20493
+ * (unavailable) key keeps its stored value.
20494
+ */
20495
+ enabled: boolean(),
20496
+ /** Relative balancer weight for the enabled device (default 1). */
20497
+ weight: number(),
20498
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20499
+ maxSessions: number().nullable(),
20500
+ /** Object-detection model the executor defaults to for this deviceKey. */
20501
+ defaultModelId: string(),
20502
+ /**
20503
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20504
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20505
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20506
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20507
+ * available per format; this is the stored selection that becomes the
20508
+ * default for EVERY camera landing on this accelerator.
20509
+ */
20510
+ steps: record(string(), DeviceStepConfigSchema).optional()
20511
+ });
20512
+ var NodeInferenceDevicesSchema = object({
20513
+ nodeId: string(),
20514
+ /** False when the node's platform-probe was unreachable (no live device set). */
20515
+ reachable: boolean(),
20516
+ devices: array(NodeInferenceDeviceSchema).readonly()
20517
+ });
20042
20518
  method(object({
20043
20519
  deviceId: number(),
20044
20520
  agentNodeId: string()
@@ -20048,7 +20524,13 @@ method(object({
20048
20524
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
20049
20525
  kind: "mutation",
20050
20526
  auth: "admin"
20051
- }), method(_void(), object({ migrated: number() }), {
20527
+ }), method(object({
20528
+ deviceId: number(),
20529
+ deviceKey: string()
20530
+ }), object({ success: literal(true) }), {
20531
+ kind: "mutation",
20532
+ auth: "admin"
20533
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
20052
20534
  kind: "mutation",
20053
20535
  auth: "admin"
20054
20536
  }), 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({
@@ -20082,13 +20564,7 @@ method(object({
20082
20564
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
20083
20565
  nodeId: string(),
20084
20566
  settings: AgentPipelineSettingsSchema
20085
- })).readonly()), method(object({
20086
- agentNodeId: string(),
20087
- defaults: record(string(), AgentAddonConfigSchema)
20088
- }), object({ success: literal(true) }), {
20089
- kind: "mutation",
20090
- auth: "admin"
20091
- }), method(object({ agentNodeId: string() }), object({
20567
+ })).readonly()), method(object({ agentNodeId: string() }), object({
20092
20568
  success: boolean(),
20093
20569
  removed: boolean()
20094
20570
  }), {
@@ -20120,7 +20596,18 @@ method(object({
20120
20596
  }), object({ success: literal(true) }), {
20121
20597
  kind: "mutation",
20122
20598
  auth: "admin"
20123
- }), method(object({ agentNodeId: string() }), object({
20599
+ }), method(object({
20600
+ agentNodeId: string(),
20601
+ inferenceDevices: record(string(), object({
20602
+ enabled: boolean(),
20603
+ weight: number().positive().optional(),
20604
+ maxSessions: number().int().positive().optional(),
20605
+ steps: record(string(), DeviceStepConfigSchema).optional()
20606
+ }))
20607
+ }), object({ success: literal(true) }), {
20608
+ kind: "mutation",
20609
+ auth: "admin"
20610
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
20124
20611
  success: literal(true),
20125
20612
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
20126
20613
  effectiveModelId: string().nullable(),
@@ -20136,9 +20623,10 @@ method(object({
20136
20623
  }), object({ success: literal(true) }), {
20137
20624
  kind: "mutation",
20138
20625
  auth: "admin"
20139
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20626
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
20140
20627
  deviceId: number(),
20141
20628
  agentNodeId: string(),
20629
+ deviceKey: string(),
20142
20630
  addonId: string(),
20143
20631
  patch: CameraStepOverridePatchSchema.nullable()
20144
20632
  }), object({ success: literal(true) }), {
@@ -20175,14 +20663,13 @@ method(object({
20175
20663
  });
20176
20664
  /**
20177
20665
  * server-management — per-NODE singleton capability for a node's ROOT
20178
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
20179
- * agents).
20666
+ * package lifecycle (runtime-updatable node packages).
20180
20667
  *
20181
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
20182
- * on agents) carries the whole software stack in its npm dep tree, so ONE
20183
- * version describes the node. Updates install into
20184
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
20185
- * starter (probation boot + auto-rollback to N-1).
20668
+ * Every node role runs the SAME root package (`@camstack/server`), which
20669
+ * carries the whole software stack in its npm dep tree, so ONE version
20670
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20671
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20672
+ * no auto-rollback).
20186
20673
  *
20187
20674
  * Providers:
20188
20675
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -20290,7 +20777,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
20290
20777
  /** Explicit target version; omitted = latest from the registry. */
20291
20778
  version: string().optional() }), ServerUpdateActionResultSchema, {
20292
20779
  kind: "mutation",
20293
- auth: "admin"
20780
+ auth: "admin",
20781
+ timeoutMs: 16 * 6e4
20294
20782
  }), method(_void(), ServerUpdateActionResultSchema, {
20295
20783
  kind: "mutation",
20296
20784
  auth: "admin"
@@ -21406,22 +21894,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21406
21894
  var RestartAddonResultSchema = unknown();
21407
21895
  var InstallPackageResultSchema = unknown();
21408
21896
  var ReloadPackagesResultSchema = unknown();
21409
- /**
21410
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
21411
- * server restarts so the admin UI can react to the `restartingAt`
21412
- * timestamp (shows reconnect overlay). The transition from
21413
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
21414
- * `system.restart-completed` event after the new process boots.
21415
- *
21416
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
21417
- */
21418
- var UpdateFrameworkPackageResultSchema = object({
21419
- packageName: string(),
21420
- fromVersion: string(),
21421
- toVersion: string(),
21422
- /** Ms-epoch the server scheduled its self-restart. */
21423
- restartingAt: number()
21424
- });
21425
21897
  var BulkUpdateItemStatusSchema = _enum([
21426
21898
  "queued",
21427
21899
  "updating",
@@ -21549,13 +22021,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21549
22021
  }), object({ success: literal(true) }), {
21550
22022
  kind: "mutation",
21551
22023
  auth: "admin"
21552
- }), method(object({
21553
- packageName: string().min(1),
21554
- version: string().optional(),
21555
- deferRestart: boolean().optional()
21556
- }), UpdateFrameworkPackageResultSchema, {
21557
- kind: "mutation",
21558
- auth: "admin"
21559
22024
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21560
22025
  kind: "mutation",
21561
22026
  auth: "admin"
@@ -22438,10 +22903,10 @@ var TopologyCategorySchema = object({
22438
22903
  addons: array(TopologyCategoryAddonSchema).readonly()
22439
22904
  });
22440
22905
  /**
22441
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
22442
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
22443
- * version visibility for the Server management surface. Nullable: offline
22444
- * rows and pre-phase-2 nodes report none.
22906
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22907
+ * root package for every node role) as reported by its `registerNode`
22908
+ * manifest — version visibility for the Server management surface. Nullable:
22909
+ * offline rows and nodes that never reported one.
22445
22910
  */
22446
22911
  var TopologyRootPackageSchema = object({
22447
22912
  name: string(),
@@ -22829,17 +23294,28 @@ var PlatformScoreSchema = object({
22829
23294
  format: _enum([
22830
23295
  "onnx",
22831
23296
  "coreml",
22832
- "openvino"
23297
+ "openvino",
23298
+ "tflite"
22833
23299
  ]),
22834
23300
  score: number(),
22835
23301
  reason: string(),
22836
23302
  available: boolean()
22837
23303
  });
23304
+ var InferenceDeviceDescriptorSchema = object({
23305
+ key: string(),
23306
+ backend: string(),
23307
+ device: string(),
23308
+ format: ModelFormatSchema,
23309
+ runtime: literal("python"),
23310
+ score: number(),
23311
+ available: boolean()
23312
+ });
22838
23313
  var PlatformCapabilitiesSchema = object({
22839
23314
  hardware: HardwareInfoSchema,
22840
23315
  scores: array(PlatformScoreSchema).readonly(),
22841
23316
  bestScore: PlatformScoreSchema,
22842
- pythonPath: string().nullable()
23317
+ pythonPath: string().nullable(),
23318
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22843
23319
  });
22844
23320
  var ModelRequirementSchema = object({
22845
23321
  modelId: string(),
@@ -23718,12 +24194,6 @@ Object.freeze({
23718
24194
  addonId: null,
23719
24195
  access: "delete"
23720
24196
  },
23721
- "addons.updateFrameworkPackage": {
23722
- capName: "addons",
23723
- capScope: "system",
23724
- addonId: null,
23725
- access: "create"
23726
- },
23727
24197
  "addons.updatePackage": {
23728
24198
  capName: "addons",
23729
24199
  capScope: "system",
@@ -26496,12 +26966,6 @@ Object.freeze({
26496
26966
  addonId: null,
26497
26967
  access: "view"
26498
26968
  },
26499
- "pipelineExecutor.reprobeEngine": {
26500
- capName: "pipeline-executor",
26501
- capScope: "system",
26502
- addonId: null,
26503
- access: "create"
26504
- },
26505
26969
  "pipelineExecutor.runAudioTest": {
26506
26970
  capName: "pipeline-executor",
26507
26971
  capScope: "system",
@@ -26652,6 +27116,12 @@ Object.freeze({
26652
27116
  addonId: null,
26653
27117
  access: "view"
26654
27118
  },
27119
+ "pipelineOrchestrator.getNodeInferenceDevices": {
27120
+ capName: "pipeline-orchestrator",
27121
+ capScope: "system",
27122
+ addonId: null,
27123
+ access: "view"
27124
+ },
26655
27125
  "pipelineOrchestrator.getPipelineAssignment": {
26656
27126
  capName: "pipeline-orchestrator",
26657
27127
  capScope: "system",
@@ -26664,6 +27134,12 @@ Object.freeze({
26664
27134
  addonId: null,
26665
27135
  access: "view"
26666
27136
  },
27137
+ "pipelineOrchestrator.getPipelineDevicePin": {
27138
+ capName: "pipeline-orchestrator",
27139
+ capScope: "system",
27140
+ addonId: null,
27141
+ access: "view"
27142
+ },
26667
27143
  "pipelineOrchestrator.listAgentSettings": {
26668
27144
  capName: "pipeline-orchestrator",
26669
27145
  capScope: "system",
@@ -26706,19 +27182,19 @@ Object.freeze({
26706
27182
  addonId: null,
26707
27183
  access: "create"
26708
27184
  },
26709
- "pipelineOrchestrator.setAgentAddonDefaults": {
27185
+ "pipelineOrchestrator.setAgentCapabilities": {
26710
27186
  capName: "pipeline-orchestrator",
26711
27187
  capScope: "system",
26712
27188
  addonId: null,
26713
27189
  access: "create"
26714
27190
  },
26715
- "pipelineOrchestrator.setAgentCapabilities": {
27191
+ "pipelineOrchestrator.setAgentDetectWeight": {
26716
27192
  capName: "pipeline-orchestrator",
26717
27193
  capScope: "system",
26718
27194
  addonId: null,
26719
27195
  access: "create"
26720
27196
  },
26721
- "pipelineOrchestrator.setAgentDetectWeight": {
27197
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26722
27198
  capName: "pipeline-orchestrator",
26723
27199
  capScope: "system",
26724
27200
  addonId: null,
@@ -26760,6 +27236,12 @@ Object.freeze({
26760
27236
  addonId: null,
26761
27237
  access: "create"
26762
27238
  },
27239
+ "pipelineOrchestrator.setPipelineDevicePin": {
27240
+ capName: "pipeline-orchestrator",
27241
+ capScope: "system",
27242
+ addonId: null,
27243
+ access: "create"
27244
+ },
26763
27245
  "pipelineOrchestrator.unassignAudio": {
26764
27246
  capName: "pipeline-orchestrator",
26765
27247
  capScope: "system",
@@ -28312,32 +28794,6 @@ Object.freeze({
28312
28794
  "network-access": "ingress",
28313
28795
  "smtp-provider": "email"
28314
28796
  });
28315
- var frameworkSwapPackageSchema = object({
28316
- name: string(),
28317
- stagedPath: string(),
28318
- backupPath: string(),
28319
- toVersion: string(),
28320
- fromVersion: string().nullable()
28321
- });
28322
- object({
28323
- jobId: string(),
28324
- taskId: string(),
28325
- packages: array(frameworkSwapPackageSchema),
28326
- requestedAtMs: number(),
28327
- schemaVersion: literal(1)
28328
- });
28329
- object({
28330
- jobId: string(),
28331
- taskId: string(),
28332
- backups: array(object({
28333
- name: string(),
28334
- backupPath: string(),
28335
- livePath: string()
28336
- })),
28337
- appliedAtMs: number(),
28338
- bootAttempts: number(),
28339
- schemaVersion: literal(1)
28340
- });
28341
28797
  /**
28342
28798
  * Pure fuzzy matcher for adoption location import. Normalized
28343
28799
  * case-insensitive Levenshtein similarity, used to reuse an existing