@camstack/addon-provider-homematic 1.1.26 → 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.js CHANGED
@@ -7107,6 +7107,17 @@ var ModelCatalogEntrySchema = object({
7107
7107
  "imagenet",
7108
7108
  "none"
7109
7109
  ]).optional(),
7110
+ /**
7111
+ * The model already applies softmax IN-GRAPH — its raw output is a
7112
+ * probability distribution, not logits. When set, the `softmax`
7113
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7114
+ * probability vector collapses it toward uniform (top-1 score craters far
7115
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7116
+ * the output is raw logits and the postprocessor applies softmax (the normal
7117
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7118
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7119
+ */
7120
+ outputProbabilities: boolean().optional(),
7110
7121
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7111
7122
  /**
7112
7123
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7666,6 +7677,160 @@ var EncodeProfileSchema = object({
7666
7677
  */
7667
7678
  outputArgs: array(string()).optional()
7668
7679
  });
7680
+ var COCO_TO_MACRO = {
7681
+ mapping: {
7682
+ person: "person",
7683
+ bicycle: "vehicle",
7684
+ car: "vehicle",
7685
+ motorcycle: "vehicle",
7686
+ airplane: "vehicle",
7687
+ bus: "vehicle",
7688
+ train: "vehicle",
7689
+ truck: "vehicle",
7690
+ boat: "vehicle",
7691
+ bird: "animal",
7692
+ cat: "animal",
7693
+ dog: "animal",
7694
+ horse: "animal",
7695
+ sheep: "animal",
7696
+ cow: "animal",
7697
+ elephant: "animal",
7698
+ bear: "animal",
7699
+ zebra: "animal",
7700
+ giraffe: "animal",
7701
+ suitcase: "package",
7702
+ backpack: "package",
7703
+ handbag: "package"
7704
+ },
7705
+ preserveOriginal: false
7706
+ };
7707
+ var AUDIO_MACRO_LABELS = [
7708
+ {
7709
+ id: "speech",
7710
+ name: "Speech",
7711
+ icon: "🗣️"
7712
+ },
7713
+ {
7714
+ id: "scream",
7715
+ name: "Scream / Shout",
7716
+ icon: "😱"
7717
+ },
7718
+ {
7719
+ id: "crying",
7720
+ name: "Crying / Baby",
7721
+ icon: "😢"
7722
+ },
7723
+ {
7724
+ id: "laughter",
7725
+ name: "Laughter",
7726
+ icon: "😂"
7727
+ },
7728
+ {
7729
+ id: "music",
7730
+ name: "Music",
7731
+ icon: "🎵"
7732
+ },
7733
+ {
7734
+ id: "dog",
7735
+ name: "Dog",
7736
+ icon: "🐕"
7737
+ },
7738
+ {
7739
+ id: "cat",
7740
+ name: "Cat",
7741
+ icon: "🐈"
7742
+ },
7743
+ {
7744
+ id: "bird",
7745
+ name: "Bird",
7746
+ icon: "🐦"
7747
+ },
7748
+ {
7749
+ id: "animal",
7750
+ name: "Animal (other)",
7751
+ icon: "🐾"
7752
+ },
7753
+ {
7754
+ id: "alarm",
7755
+ name: "Alarm / Siren",
7756
+ icon: "🚨"
7757
+ },
7758
+ {
7759
+ id: "doorbell",
7760
+ name: "Doorbell / Knock",
7761
+ icon: "🔔"
7762
+ },
7763
+ {
7764
+ id: "glass_breaking",
7765
+ name: "Glass Breaking",
7766
+ icon: "💥"
7767
+ },
7768
+ {
7769
+ id: "gunshot",
7770
+ name: "Gunshot / Explosion",
7771
+ icon: "💣"
7772
+ },
7773
+ {
7774
+ id: "vehicle",
7775
+ name: "Vehicle",
7776
+ icon: "🚗"
7777
+ },
7778
+ {
7779
+ id: "siren",
7780
+ name: "Emergency Siren",
7781
+ icon: "🚑"
7782
+ },
7783
+ {
7784
+ id: "fire",
7785
+ name: "Fire / Smoke",
7786
+ icon: "🔥"
7787
+ },
7788
+ {
7789
+ id: "water",
7790
+ name: "Water",
7791
+ icon: "💧"
7792
+ },
7793
+ {
7794
+ id: "wind",
7795
+ name: "Wind / Weather",
7796
+ icon: "🌬️"
7797
+ },
7798
+ {
7799
+ id: "door",
7800
+ name: "Door",
7801
+ icon: "🚪"
7802
+ },
7803
+ {
7804
+ id: "footsteps",
7805
+ name: "Footsteps",
7806
+ icon: "👣"
7807
+ },
7808
+ {
7809
+ id: "crowd",
7810
+ name: "Crowd / Chatter",
7811
+ icon: "👥"
7812
+ },
7813
+ {
7814
+ id: "telephone",
7815
+ name: "Telephone",
7816
+ icon: "📞"
7817
+ },
7818
+ {
7819
+ id: "engine",
7820
+ name: "Engine / Motor",
7821
+ icon: "⚙️"
7822
+ },
7823
+ {
7824
+ id: "tools",
7825
+ name: "Tools / Construction",
7826
+ icon: "🔨"
7827
+ },
7828
+ {
7829
+ id: "silence",
7830
+ name: "Silence",
7831
+ icon: "🤫"
7832
+ }
7833
+ ];
7669
7834
  var YAMNET_TO_MACRO = {
7670
7835
  mapping: {
7671
7836
  Speech: "speech",
@@ -7932,6 +8097,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7932
8097
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7933
8098
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7934
8099
  /**
8100
+ * Unified event-kind taxonomy — THE single source of truth for
8101
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8102
+ * icon }`.
8103
+ *
8104
+ * This dictionary folds together what used to be scattered across four
8105
+ * copies:
8106
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8107
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8108
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8109
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8110
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8111
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8112
+ *
8113
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8114
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8115
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8116
+ * color or an icon: they read this dictionary (server descriptors carry the
8117
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8118
+ *
8119
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8120
+ */
8121
+ var TAXONOMY_COLORS = {
8122
+ motion: "#f59e0b",
8123
+ audio: "#06b6d4",
8124
+ person: "#22c55e",
8125
+ vehicle: "#3b82f6",
8126
+ animal: "#f97316",
8127
+ package: "#a855f7",
8128
+ sensor: "#8b5cf6",
8129
+ control: "#10b981",
8130
+ genericDetection: "#64748b"
8131
+ };
8132
+ var DETECTION_SUB_COLORS = {
8133
+ car: "#f59e0b",
8134
+ truck: "#d97706",
8135
+ bus: "#b45309",
8136
+ motorcycle: "#eab308",
8137
+ bicycle: "#ca8a04",
8138
+ airplane: "#60a5fa",
8139
+ boat: "#2563eb",
8140
+ train: "#1d4ed8",
8141
+ bird: "#14b8a6",
8142
+ dog: "#84cc16",
8143
+ cat: "#f97316",
8144
+ horse: "#a16207",
8145
+ sheep: "#a3a3a3",
8146
+ cow: "#78716c",
8147
+ elephant: "#6b7280",
8148
+ bear: "#7c2d12",
8149
+ zebra: "#404040",
8150
+ giraffe: "#d4a373"
8151
+ };
8152
+ function titleCase(id) {
8153
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8154
+ }
8155
+ var entries = /* @__PURE__ */ new Map();
8156
+ function macro(kind, category, color, iconId, label) {
8157
+ entries.set(kind, {
8158
+ kind,
8159
+ parentKind: null,
8160
+ level: "macro",
8161
+ category,
8162
+ color,
8163
+ iconId,
8164
+ labelKey: `eventKind.${kind}`,
8165
+ label
8166
+ });
8167
+ }
8168
+ function sub(kind, parentKind, category, color, iconId, label) {
8169
+ entries.set(kind, {
8170
+ kind,
8171
+ parentKind,
8172
+ level: "sub",
8173
+ category,
8174
+ color,
8175
+ iconId,
8176
+ labelKey: `eventKind.${kind}`,
8177
+ label
8178
+ });
8179
+ }
8180
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8181
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8182
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8183
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8184
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8185
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8186
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8187
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8188
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8189
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8190
+ if (entries.has(cocoClass)) continue;
8191
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8192
+ }
8193
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8194
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8195
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8196
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8197
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8198
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8199
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8200
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8201
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8202
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8203
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8204
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8205
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8206
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8207
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8208
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8209
+ sub("button", "control", "control", "#10b981", "button", "Button");
8210
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8211
+ for (const l of AUDIO_MACRO_LABELS) {
8212
+ const kind = `audio-${l.id}`;
8213
+ if (entries.has(kind)) continue;
8214
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8215
+ }
8216
+ /** The complete taxonomy dictionary, keyed by kind. */
8217
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8218
+ /**
7935
8219
  * Error types for the safe expression engine. Two distinct classes so callers
7936
8220
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7937
8221
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12124,10 +12408,7 @@ var ConfigUISchemaNullableBridge = custom();
12124
12408
  var InferenceCapabilitiesBridge = custom();
12125
12409
  var ModelAvailabilityListBridge = custom();
12126
12410
  var PipelineRunResultBridge = custom();
12127
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12128
- kind: "mutation",
12129
- auth: "admin"
12130
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12411
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12131
12412
  modelId: string(),
12132
12413
  settings: record(string(), unknown()).readonly()
12133
12414
  }))), method(object({ steps: record(string(), object({
@@ -12187,13 +12468,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12187
12468
  * (inputClasses ≠ null) are skipped and served per-track via
12188
12469
  * pipelineRunner.runDetailSubtree (two-plane design).
12189
12470
  */
12190
- plane: _enum(["full", "frame"]).optional()
12471
+ plane: _enum(["full", "frame"]).optional(),
12472
+ /**
12473
+ * Inference-device selector (Phase 2 multi-device). Format
12474
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12475
+ * Omitted ⇒ the runner's default device (current single-engine
12476
+ * behaviour). Selects WHICH device pool of the node runs the call.
12477
+ */
12478
+ deviceKey: string().optional()
12191
12479
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12192
12480
  engine: PipelineEngineChoiceSchema.optional(),
12193
12481
  steps: array(PipelineStepInputSchema).min(1),
12194
12482
  frames: array(FrameInputSchema).min(1).max(255),
12195
12483
  deviceId: number().optional(),
12196
- sessionId: string().optional()
12484
+ sessionId: string().optional(),
12485
+ /**
12486
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12487
+ * the batch to the Python pool's bench preprocess cache
12488
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12489
+ * preprocessed ONCE and every later inference is a pure-inference cache
12490
+ * hit — the sustained-throughput run measures inference, not
12491
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12492
+ * full preprocess every call, correct). Fresh per sustained run;
12493
+ * released via `uncacheFrame`.
12494
+ */
12495
+ frameId: number().int().nonnegative().optional(),
12496
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12497
+ deviceKey: string().optional()
12197
12498
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12198
12499
  data: _instanceof(Uint8Array),
12199
12500
  width: number().int().positive(),
@@ -12225,8 +12526,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12225
12526
  * - `runtime` — main camera-serving engine (no idle TTL).
12226
12527
  * - `warm-override` — benchmark/test override held in the warm
12227
12528
  * cache; auto-disposed after the idle TTL.
12529
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12530
+ * multi-device, keyed by `deviceKey`) resolved
12531
+ * via `resolveDeviceFactory`. Runs alongside the
12532
+ * `runtime` engine on a DIFFERENT accelerator
12533
+ * (NPU / iGPU / Coral) — this is how the
12534
+ * Engines tab shows all pools running at once.
12228
12535
  */
12229
- kind: _enum(["runtime", "warm-override"]),
12536
+ kind: _enum([
12537
+ "runtime",
12538
+ "warm-override",
12539
+ "device-pool"
12540
+ ]),
12230
12541
  /** Native pid of the underlying Python pool (null when no pool). */
12231
12542
  poolPid: number().nullable(),
12232
12543
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12601,7 +12912,14 @@ var RunnerCameraConfigSchema = object({
12601
12912
  * camera's detect node differs from its source-owner (P2d, gated by the
12602
12913
  * `remoteSourcingNodes` rollout setting).
12603
12914
  */
12604
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12915
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12916
+ /**
12917
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12918
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12919
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12920
+ * this only selects WHICH device pool of that node runs the session.
12921
+ */
12922
+ deviceKey: string().optional()
12605
12923
  });
12606
12924
  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;
12607
12925
  /**
@@ -12622,6 +12940,19 @@ var RunnerLocalLoadSchema = object({
12622
12940
  avgInferenceTimeMs: number(),
12623
12941
  /** Total queue depth across motion + detection queues. */
12624
12942
  queueDepthTotal: number(),
12943
+ /**
12944
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12945
+ * this runner currently has attached cameras on, so the orchestrator's second
12946
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12947
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12948
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12949
+ */
12950
+ devices: array(object({
12951
+ deviceKey: string(),
12952
+ backend: string(),
12953
+ attachedCameras: number(),
12954
+ queueDepthTotal: number()
12955
+ })).default([]),
12625
12956
  /** Hardware capability flags reported by this node. */
12626
12957
  hardware: object({
12627
12958
  hasGpu: boolean(),
@@ -15770,6 +16101,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15770
16101
  return toDeviceSummary(device, this.addonId);
15771
16102
  }
15772
16103
  };
16104
+ 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;
16105
+ new Set(Object.values(DeviceType));
15773
16106
  /**
15774
16107
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15775
16108
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18930,17 +19263,30 @@ var EventKindCategorySchema = _enum([
18930
19263
  "audio",
18931
19264
  "detection",
18932
19265
  "sensor",
19266
+ "control",
18933
19267
  "custom",
18934
19268
  "package"
18935
19269
  ]);
19270
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19271
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18936
19272
  var EventKindDescriptorSchema = object({
18937
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19273
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18938
19274
  kind: string(),
19275
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19276
+ labelKey: string(),
19277
+ /** English fallback label (kept for clients that don't translate). */
18939
19278
  label: string(),
18940
19279
  /** Hex color for timeline/legend rendering. */
18941
19280
  color: string(),
19281
+ /** Dictionary id → lucide component on the UI side. */
19282
+ iconId: string(),
19283
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18942
19284
  icon: EventKindIconSchema,
18943
19285
  category: EventKindCategorySchema,
19286
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19287
+ parentKind: string().nullable(),
19288
+ /** Derived from `parentKind`, explicit for the client tree. */
19289
+ level: EventKindLevelSchema,
18944
19290
  /** Which cap + device contributes this kind. For built-ins the camera
18945
19291
  * itself; for sensor kinds the LINKED source device. */
18946
19292
  source: object({
@@ -19013,11 +19359,21 @@ var TrackAudioLabelSchema = object({
19013
19359
  firstAt: number(),
19014
19360
  lastAt: number()
19015
19361
  });
19362
+ /**
19363
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19364
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19365
+ * linked sensor/control state change (no positions; carries a snapshot). The
19366
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19367
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19368
+ */
19369
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19016
19370
  var TrackSchema = object({
19017
19371
  trackId: string(),
19018
19372
  deviceId: number(),
19019
19373
  className: string(),
19020
19374
  label: string().optional(),
19375
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19376
+ source: TrackSourceSchema.optional(),
19021
19377
  firstSeen: number(),
19022
19378
  lastSeen: number(),
19023
19379
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19394,6 +19750,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19394
19750
  eventId: string(),
19395
19751
  timestamp: number()
19396
19752
  });
19753
+ /**
19754
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19755
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19756
+ * caps into per-camera event-kind descriptors.
19757
+ *
19758
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19759
+ * is NOT duplicated here — every entry is derived from the single
19760
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19761
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19762
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19763
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19764
+ * eventful cap is missing.
19765
+ */
19766
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19767
+ var LEGACY_ICON = {
19768
+ motion: "motion",
19769
+ audio: "audio",
19770
+ person: "person",
19771
+ vehicle: "vehicle",
19772
+ animal: "animal",
19773
+ package: "package",
19774
+ door: "door",
19775
+ pir: "pir",
19776
+ smoke: "smoke",
19777
+ water: "water",
19778
+ button: "button",
19779
+ generic: "generic",
19780
+ gas: "smoke",
19781
+ vibration: "generic",
19782
+ tamper: "generic",
19783
+ presence: "person",
19784
+ lock: "generic",
19785
+ siren: "generic",
19786
+ switch: "generic",
19787
+ doorbell: "button"
19788
+ };
19789
+ function legacyIcon(iconId) {
19790
+ return LEGACY_ICON[iconId] ?? "generic";
19791
+ }
19792
+ /**
19793
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19794
+ * The anti-drift guard cross-checks this against the eventful caps declared
19795
+ * in `packages/types/src/capabilities/*.cap.ts`.
19796
+ */
19797
+ var CAP_TO_KIND = {
19798
+ contact: "contact",
19799
+ motion: "motion-sensor",
19800
+ smoke: "smoke",
19801
+ flood: "flood",
19802
+ gas: "gas",
19803
+ "carbon-monoxide": "carbon-monoxide",
19804
+ vibration: "vibration",
19805
+ tamper: "tamper",
19806
+ presence: "presence",
19807
+ "enum-sensor": "enum-sensor",
19808
+ "event-emitter": "device-event",
19809
+ "lock-control": "lock",
19810
+ switch: "switch",
19811
+ button: "button",
19812
+ doorbell: "doorbell"
19813
+ };
19814
+ function buildDescriptor(capName, kind) {
19815
+ const t = EVENT_TAXONOMY[kind];
19816
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19817
+ return {
19818
+ ...t,
19819
+ icon: legacyIcon(t.iconId)
19820
+ };
19821
+ }
19822
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19397
19823
  var CameraPipelineConfigSchema = object({
19398
19824
  engine: PipelineEngineChoiceSchema.optional(),
19399
19825
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19412,13 +19838,11 @@ var PipelineTemplateSchema = object({
19412
19838
  createdAt: string(),
19413
19839
  updatedAt: string()
19414
19840
  });
19415
- var AgentAddonConfigSchema = object({
19416
- enabled: boolean(),
19841
+ var DeviceStepConfigSchema = object({
19417
19842
  modelId: string().optional(),
19418
- settings: record(string(), unknown()).readonly()
19843
+ settings: record(string(), unknown()).optional()
19419
19844
  });
19420
19845
  var AgentPipelineSettingsSchema = object({
19421
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19422
19846
  maxCameras: number().int().nonnegative().nullable().default(null),
19423
19847
  /** Per-node detection weight (relative share for the quota balancer). */
19424
19848
  detectWeight: number().positive().optional(),
@@ -19442,7 +19866,22 @@ var AgentPipelineSettingsSchema = object({
19442
19866
  * it already uses to reach the hub). Set this only when the auto-detected
19443
19867
  * address is wrong (multi-homed host, NAT, custom interface).
19444
19868
  */
19445
- reachableHost: string().optional()
19869
+ reachableHost: string().optional(),
19870
+ /**
19871
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19872
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19873
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19874
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19875
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19876
+ * the default model/settings for every camera landing on that accelerator;
19877
+ * a stepId absent ⇒ the step uses that device's format default.
19878
+ */
19879
+ inferenceDevices: record(string(), object({
19880
+ enabled: boolean(),
19881
+ weight: number().positive().optional(),
19882
+ maxSessions: number().int().positive().optional(),
19883
+ steps: record(string(), DeviceStepConfigSchema).optional()
19884
+ })).optional()
19446
19885
  });
19447
19886
  var CameraPipelineForAgentSchema = object({
19448
19887
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19452,14 +19891,13 @@ var CameraPipelineForAgentSchema = object({
19452
19891
  }).nullable()
19453
19892
  });
19454
19893
  var CameraStepOverridePatchSchema = object({
19455
- enabled: boolean().optional(),
19456
19894
  modelId: string().optional(),
19457
19895
  settings: record(string(), unknown()).readonly().optional()
19458
19896
  });
19459
19897
  var CameraPipelineSettingsSchema = object({
19460
19898
  pinnedAgentNodeId: string().optional(),
19461
19899
  stepToggles: record(string(), boolean()).optional(),
19462
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19900
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19463
19901
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19464
19902
  });
19465
19903
  /**
@@ -19673,6 +20111,44 @@ var CameraStatusSchema = object({
19673
20111
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19674
20112
  fetchedAt: number()
19675
20113
  });
20114
+ var NodeInferenceDeviceSchema = object({
20115
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20116
+ key: string(),
20117
+ backend: string(),
20118
+ device: string(),
20119
+ format: _enum(MODEL_FORMATS),
20120
+ /** Whether the node's live probe reports the device as usable right now. */
20121
+ available: boolean(),
20122
+ /**
20123
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20124
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20125
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20126
+ * not a balanced target). An explicit stored value always wins; a stored-only
20127
+ * (unavailable) key keeps its stored value.
20128
+ */
20129
+ enabled: boolean(),
20130
+ /** Relative balancer weight for the enabled device (default 1). */
20131
+ weight: number(),
20132
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20133
+ maxSessions: number().nullable(),
20134
+ /** Object-detection model the executor defaults to for this deviceKey. */
20135
+ defaultModelId: string(),
20136
+ /**
20137
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20138
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20139
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20140
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20141
+ * available per format; this is the stored selection that becomes the
20142
+ * default for EVERY camera landing on this accelerator.
20143
+ */
20144
+ steps: record(string(), DeviceStepConfigSchema).optional()
20145
+ });
20146
+ var NodeInferenceDevicesSchema = object({
20147
+ nodeId: string(),
20148
+ /** False when the node's platform-probe was unreachable (no live device set). */
20149
+ reachable: boolean(),
20150
+ devices: array(NodeInferenceDeviceSchema).readonly()
20151
+ });
19676
20152
  method(object({
19677
20153
  deviceId: number(),
19678
20154
  agentNodeId: string()
@@ -19682,7 +20158,13 @@ method(object({
19682
20158
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19683
20159
  kind: "mutation",
19684
20160
  auth: "admin"
19685
- }), method(_void(), object({ migrated: number() }), {
20161
+ }), method(object({
20162
+ deviceId: number(),
20163
+ deviceKey: string()
20164
+ }), object({ success: literal(true) }), {
20165
+ kind: "mutation",
20166
+ auth: "admin"
20167
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19686
20168
  kind: "mutation",
19687
20169
  auth: "admin"
19688
20170
  }), 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({
@@ -19716,13 +20198,7 @@ method(object({
19716
20198
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19717
20199
  nodeId: string(),
19718
20200
  settings: AgentPipelineSettingsSchema
19719
- })).readonly()), method(object({
19720
- agentNodeId: string(),
19721
- defaults: record(string(), AgentAddonConfigSchema)
19722
- }), object({ success: literal(true) }), {
19723
- kind: "mutation",
19724
- auth: "admin"
19725
- }), method(object({ agentNodeId: string() }), object({
20201
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19726
20202
  success: boolean(),
19727
20203
  removed: boolean()
19728
20204
  }), {
@@ -19754,7 +20230,18 @@ method(object({
19754
20230
  }), object({ success: literal(true) }), {
19755
20231
  kind: "mutation",
19756
20232
  auth: "admin"
19757
- }), method(object({ agentNodeId: string() }), object({
20233
+ }), method(object({
20234
+ agentNodeId: string(),
20235
+ inferenceDevices: record(string(), object({
20236
+ enabled: boolean(),
20237
+ weight: number().positive().optional(),
20238
+ maxSessions: number().int().positive().optional(),
20239
+ steps: record(string(), DeviceStepConfigSchema).optional()
20240
+ }))
20241
+ }), object({ success: literal(true) }), {
20242
+ kind: "mutation",
20243
+ auth: "admin"
20244
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19758
20245
  success: literal(true),
19759
20246
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19760
20247
  effectiveModelId: string().nullable(),
@@ -19770,9 +20257,10 @@ method(object({
19770
20257
  }), object({ success: literal(true) }), {
19771
20258
  kind: "mutation",
19772
20259
  auth: "admin"
19773
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20260
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19774
20261
  deviceId: number(),
19775
20262
  agentNodeId: string(),
20263
+ deviceKey: string(),
19776
20264
  addonId: string(),
19777
20265
  patch: CameraStepOverridePatchSchema.nullable()
19778
20266
  }), object({ success: literal(true) }), {
@@ -19809,14 +20297,13 @@ method(object({
19809
20297
  });
19810
20298
  /**
19811
20299
  * server-management — per-NODE singleton capability for a node's ROOT
19812
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19813
- * agents).
20300
+ * package lifecycle (runtime-updatable node packages).
19814
20301
  *
19815
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19816
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19817
- * version describes the node. Updates install into
19818
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19819
- * starter (probation boot + auto-rollback to N-1).
20302
+ * Every node role runs the SAME root package (`@camstack/server`), which
20303
+ * carries the whole software stack in its npm dep tree, so ONE version
20304
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20305
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20306
+ * no auto-rollback).
19820
20307
  *
19821
20308
  * Providers:
19822
20309
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19924,7 +20411,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19924
20411
  /** Explicit target version; omitted = latest from the registry. */
19925
20412
  version: string().optional() }), ServerUpdateActionResultSchema, {
19926
20413
  kind: "mutation",
19927
- auth: "admin"
20414
+ auth: "admin",
20415
+ timeoutMs: 16 * 6e4
19928
20416
  }), method(_void(), ServerUpdateActionResultSchema, {
19929
20417
  kind: "mutation",
19930
20418
  auth: "admin"
@@ -20968,22 +21456,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20968
21456
  var RestartAddonResultSchema = unknown();
20969
21457
  var InstallPackageResultSchema = unknown();
20970
21458
  var ReloadPackagesResultSchema = unknown();
20971
- /**
20972
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20973
- * server restarts so the admin UI can react to the `restartingAt`
20974
- * timestamp (shows reconnect overlay). The transition from
20975
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20976
- * `system.restart-completed` event after the new process boots.
20977
- *
20978
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20979
- */
20980
- var UpdateFrameworkPackageResultSchema = object({
20981
- packageName: string(),
20982
- fromVersion: string(),
20983
- toVersion: string(),
20984
- /** Ms-epoch the server scheduled its self-restart. */
20985
- restartingAt: number()
20986
- });
20987
21459
  var BulkUpdateItemStatusSchema = _enum([
20988
21460
  "queued",
20989
21461
  "updating",
@@ -21111,13 +21583,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21111
21583
  }), object({ success: literal(true) }), {
21112
21584
  kind: "mutation",
21113
21585
  auth: "admin"
21114
- }), method(object({
21115
- packageName: string().min(1),
21116
- version: string().optional(),
21117
- deferRestart: boolean().optional()
21118
- }), UpdateFrameworkPackageResultSchema, {
21119
- kind: "mutation",
21120
- auth: "admin"
21121
21586
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21122
21587
  kind: "mutation",
21123
21588
  auth: "admin"
@@ -21983,10 +22448,10 @@ var TopologyCategorySchema = object({
21983
22448
  addons: array(TopologyCategoryAddonSchema).readonly()
21984
22449
  });
21985
22450
  /**
21986
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21987
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21988
- * version visibility for the Server management surface. Nullable: offline
21989
- * rows and pre-phase-2 nodes report none.
22451
+ * The node's runtime-updatable ROOT package (`@camstack/server` — the single
22452
+ * root package for every node role) as reported by its `registerNode`
22453
+ * manifest — version visibility for the Server management surface. Nullable:
22454
+ * offline rows and nodes that never reported one.
21990
22455
  */
21991
22456
  var TopologyRootPackageSchema = object({
21992
22457
  name: string(),
@@ -22374,17 +22839,28 @@ var PlatformScoreSchema = object({
22374
22839
  format: _enum([
22375
22840
  "onnx",
22376
22841
  "coreml",
22377
- "openvino"
22842
+ "openvino",
22843
+ "tflite"
22378
22844
  ]),
22379
22845
  score: number(),
22380
22846
  reason: string(),
22381
22847
  available: boolean()
22382
22848
  });
22849
+ var InferenceDeviceDescriptorSchema = object({
22850
+ key: string(),
22851
+ backend: string(),
22852
+ device: string(),
22853
+ format: ModelFormatSchema,
22854
+ runtime: literal("python"),
22855
+ score: number(),
22856
+ available: boolean()
22857
+ });
22383
22858
  var PlatformCapabilitiesSchema = object({
22384
22859
  hardware: HardwareInfoSchema,
22385
22860
  scores: array(PlatformScoreSchema).readonly(),
22386
22861
  bestScore: PlatformScoreSchema,
22387
- pythonPath: string().nullable()
22862
+ pythonPath: string().nullable(),
22863
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22388
22864
  });
22389
22865
  var ModelRequirementSchema = object({
22390
22866
  modelId: string(),
@@ -23263,12 +23739,6 @@ Object.freeze({
23263
23739
  addonId: null,
23264
23740
  access: "delete"
23265
23741
  },
23266
- "addons.updateFrameworkPackage": {
23267
- capName: "addons",
23268
- capScope: "system",
23269
- addonId: null,
23270
- access: "create"
23271
- },
23272
23742
  "addons.updatePackage": {
23273
23743
  capName: "addons",
23274
23744
  capScope: "system",
@@ -26041,12 +26511,6 @@ Object.freeze({
26041
26511
  addonId: null,
26042
26512
  access: "view"
26043
26513
  },
26044
- "pipelineExecutor.reprobeEngine": {
26045
- capName: "pipeline-executor",
26046
- capScope: "system",
26047
- addonId: null,
26048
- access: "create"
26049
- },
26050
26514
  "pipelineExecutor.runAudioTest": {
26051
26515
  capName: "pipeline-executor",
26052
26516
  capScope: "system",
@@ -26197,6 +26661,12 @@ Object.freeze({
26197
26661
  addonId: null,
26198
26662
  access: "view"
26199
26663
  },
26664
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26665
+ capName: "pipeline-orchestrator",
26666
+ capScope: "system",
26667
+ addonId: null,
26668
+ access: "view"
26669
+ },
26200
26670
  "pipelineOrchestrator.getPipelineAssignment": {
26201
26671
  capName: "pipeline-orchestrator",
26202
26672
  capScope: "system",
@@ -26209,6 +26679,12 @@ Object.freeze({
26209
26679
  addonId: null,
26210
26680
  access: "view"
26211
26681
  },
26682
+ "pipelineOrchestrator.getPipelineDevicePin": {
26683
+ capName: "pipeline-orchestrator",
26684
+ capScope: "system",
26685
+ addonId: null,
26686
+ access: "view"
26687
+ },
26212
26688
  "pipelineOrchestrator.listAgentSettings": {
26213
26689
  capName: "pipeline-orchestrator",
26214
26690
  capScope: "system",
@@ -26251,19 +26727,19 @@ Object.freeze({
26251
26727
  addonId: null,
26252
26728
  access: "create"
26253
26729
  },
26254
- "pipelineOrchestrator.setAgentAddonDefaults": {
26730
+ "pipelineOrchestrator.setAgentCapabilities": {
26255
26731
  capName: "pipeline-orchestrator",
26256
26732
  capScope: "system",
26257
26733
  addonId: null,
26258
26734
  access: "create"
26259
26735
  },
26260
- "pipelineOrchestrator.setAgentCapabilities": {
26736
+ "pipelineOrchestrator.setAgentDetectWeight": {
26261
26737
  capName: "pipeline-orchestrator",
26262
26738
  capScope: "system",
26263
26739
  addonId: null,
26264
26740
  access: "create"
26265
26741
  },
26266
- "pipelineOrchestrator.setAgentDetectWeight": {
26742
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26267
26743
  capName: "pipeline-orchestrator",
26268
26744
  capScope: "system",
26269
26745
  addonId: null,
@@ -26305,6 +26781,12 @@ Object.freeze({
26305
26781
  addonId: null,
26306
26782
  access: "create"
26307
26783
  },
26784
+ "pipelineOrchestrator.setPipelineDevicePin": {
26785
+ capName: "pipeline-orchestrator",
26786
+ capScope: "system",
26787
+ addonId: null,
26788
+ access: "create"
26789
+ },
26308
26790
  "pipelineOrchestrator.unassignAudio": {
26309
26791
  capName: "pipeline-orchestrator",
26310
26792
  capScope: "system",
@@ -27857,32 +28339,6 @@ Object.freeze({
27857
28339
  "network-access": "ingress",
27858
28340
  "smtp-provider": "email"
27859
28341
  });
27860
- var frameworkSwapPackageSchema = object({
27861
- name: string(),
27862
- stagedPath: string(),
27863
- backupPath: string(),
27864
- toVersion: string(),
27865
- fromVersion: string().nullable()
27866
- });
27867
- object({
27868
- jobId: string(),
27869
- taskId: string(),
27870
- packages: array(frameworkSwapPackageSchema),
27871
- requestedAtMs: number(),
27872
- schemaVersion: literal(1)
27873
- });
27874
- object({
27875
- jobId: string(),
27876
- taskId: string(),
27877
- backups: array(object({
27878
- name: string(),
27879
- backupPath: string(),
27880
- livePath: string()
27881
- })),
27882
- appliedAtMs: number(),
27883
- bootAttempts: number(),
27884
- schemaVersion: literal(1)
27885
- });
27886
28342
  /**
27887
28343
  * Pure fuzzy matcher for adoption location import. Normalized
27888
28344
  * case-insensitive Levenshtein similarity, used to reuse an existing