@camstack/addon-matter-broker 0.1.24 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +560 -104
  2. package/dist/addon.mjs +560 -104
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7112,6 +7112,17 @@ var ModelCatalogEntrySchema = object({
7112
7112
  "imagenet",
7113
7113
  "none"
7114
7114
  ]).optional(),
7115
+ /**
7116
+ * The model already applies softmax IN-GRAPH — its raw output is a
7117
+ * probability distribution, not logits. When set, the `softmax`
7118
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7119
+ * probability vector collapses it toward uniform (top-1 score craters far
7120
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7121
+ * the output is raw logits and the postprocessor applies softmax (the normal
7122
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7123
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7124
+ */
7125
+ outputProbabilities: boolean().optional(),
7115
7126
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7116
7127
  /**
7117
7128
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7671,6 +7682,160 @@ var EncodeProfileSchema = object({
7671
7682
  */
7672
7683
  outputArgs: array(string$2()).optional()
7673
7684
  });
7685
+ var COCO_TO_MACRO = {
7686
+ mapping: {
7687
+ person: "person",
7688
+ bicycle: "vehicle",
7689
+ car: "vehicle",
7690
+ motorcycle: "vehicle",
7691
+ airplane: "vehicle",
7692
+ bus: "vehicle",
7693
+ train: "vehicle",
7694
+ truck: "vehicle",
7695
+ boat: "vehicle",
7696
+ bird: "animal",
7697
+ cat: "animal",
7698
+ dog: "animal",
7699
+ horse: "animal",
7700
+ sheep: "animal",
7701
+ cow: "animal",
7702
+ elephant: "animal",
7703
+ bear: "animal",
7704
+ zebra: "animal",
7705
+ giraffe: "animal",
7706
+ suitcase: "package",
7707
+ backpack: "package",
7708
+ handbag: "package"
7709
+ },
7710
+ preserveOriginal: false
7711
+ };
7712
+ var AUDIO_MACRO_LABELS = [
7713
+ {
7714
+ id: "speech",
7715
+ name: "Speech",
7716
+ icon: "🗣️"
7717
+ },
7718
+ {
7719
+ id: "scream",
7720
+ name: "Scream / Shout",
7721
+ icon: "😱"
7722
+ },
7723
+ {
7724
+ id: "crying",
7725
+ name: "Crying / Baby",
7726
+ icon: "😢"
7727
+ },
7728
+ {
7729
+ id: "laughter",
7730
+ name: "Laughter",
7731
+ icon: "😂"
7732
+ },
7733
+ {
7734
+ id: "music",
7735
+ name: "Music",
7736
+ icon: "🎵"
7737
+ },
7738
+ {
7739
+ id: "dog",
7740
+ name: "Dog",
7741
+ icon: "🐕"
7742
+ },
7743
+ {
7744
+ id: "cat",
7745
+ name: "Cat",
7746
+ icon: "🐈"
7747
+ },
7748
+ {
7749
+ id: "bird",
7750
+ name: "Bird",
7751
+ icon: "🐦"
7752
+ },
7753
+ {
7754
+ id: "animal",
7755
+ name: "Animal (other)",
7756
+ icon: "🐾"
7757
+ },
7758
+ {
7759
+ id: "alarm",
7760
+ name: "Alarm / Siren",
7761
+ icon: "🚨"
7762
+ },
7763
+ {
7764
+ id: "doorbell",
7765
+ name: "Doorbell / Knock",
7766
+ icon: "🔔"
7767
+ },
7768
+ {
7769
+ id: "glass_breaking",
7770
+ name: "Glass Breaking",
7771
+ icon: "💥"
7772
+ },
7773
+ {
7774
+ id: "gunshot",
7775
+ name: "Gunshot / Explosion",
7776
+ icon: "💣"
7777
+ },
7778
+ {
7779
+ id: "vehicle",
7780
+ name: "Vehicle",
7781
+ icon: "🚗"
7782
+ },
7783
+ {
7784
+ id: "siren",
7785
+ name: "Emergency Siren",
7786
+ icon: "🚑"
7787
+ },
7788
+ {
7789
+ id: "fire",
7790
+ name: "Fire / Smoke",
7791
+ icon: "🔥"
7792
+ },
7793
+ {
7794
+ id: "water",
7795
+ name: "Water",
7796
+ icon: "💧"
7797
+ },
7798
+ {
7799
+ id: "wind",
7800
+ name: "Wind / Weather",
7801
+ icon: "🌬️"
7802
+ },
7803
+ {
7804
+ id: "door",
7805
+ name: "Door",
7806
+ icon: "🚪"
7807
+ },
7808
+ {
7809
+ id: "footsteps",
7810
+ name: "Footsteps",
7811
+ icon: "👣"
7812
+ },
7813
+ {
7814
+ id: "crowd",
7815
+ name: "Crowd / Chatter",
7816
+ icon: "👥"
7817
+ },
7818
+ {
7819
+ id: "telephone",
7820
+ name: "Telephone",
7821
+ icon: "📞"
7822
+ },
7823
+ {
7824
+ id: "engine",
7825
+ name: "Engine / Motor",
7826
+ icon: "⚙️"
7827
+ },
7828
+ {
7829
+ id: "tools",
7830
+ name: "Tools / Construction",
7831
+ icon: "🔨"
7832
+ },
7833
+ {
7834
+ id: "silence",
7835
+ name: "Silence",
7836
+ icon: "🤫"
7837
+ }
7838
+ ];
7674
7839
  var YAMNET_TO_MACRO = {
7675
7840
  mapping: {
7676
7841
  Speech: "speech",
@@ -7937,6 +8102,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7937
8102
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7938
8103
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7939
8104
  /**
8105
+ * Unified event-kind taxonomy — THE single source of truth for
8106
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8107
+ * icon }`.
8108
+ *
8109
+ * This dictionary folds together what used to be scattered across four
8110
+ * copies:
8111
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8112
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8113
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8114
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8115
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8116
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8117
+ *
8118
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8119
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8120
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8121
+ * color or an icon: they read this dictionary (server descriptors carry the
8122
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8123
+ *
8124
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8125
+ */
8126
+ var TAXONOMY_COLORS = {
8127
+ motion: "#f59e0b",
8128
+ audio: "#06b6d4",
8129
+ person: "#22c55e",
8130
+ vehicle: "#3b82f6",
8131
+ animal: "#f97316",
8132
+ package: "#a855f7",
8133
+ sensor: "#8b5cf6",
8134
+ control: "#10b981",
8135
+ genericDetection: "#64748b"
8136
+ };
8137
+ var DETECTION_SUB_COLORS = {
8138
+ car: "#f59e0b",
8139
+ truck: "#d97706",
8140
+ bus: "#b45309",
8141
+ motorcycle: "#eab308",
8142
+ bicycle: "#ca8a04",
8143
+ airplane: "#60a5fa",
8144
+ boat: "#2563eb",
8145
+ train: "#1d4ed8",
8146
+ bird: "#14b8a6",
8147
+ dog: "#84cc16",
8148
+ cat: "#f97316",
8149
+ horse: "#a16207",
8150
+ sheep: "#a3a3a3",
8151
+ cow: "#78716c",
8152
+ elephant: "#6b7280",
8153
+ bear: "#7c2d12",
8154
+ zebra: "#404040",
8155
+ giraffe: "#d4a373"
8156
+ };
8157
+ function titleCase(id) {
8158
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8159
+ }
8160
+ var entries = /* @__PURE__ */ new Map();
8161
+ function macro(kind, category, color, iconId, label) {
8162
+ entries.set(kind, {
8163
+ kind,
8164
+ parentKind: null,
8165
+ level: "macro",
8166
+ category,
8167
+ color,
8168
+ iconId,
8169
+ labelKey: `eventKind.${kind}`,
8170
+ label
8171
+ });
8172
+ }
8173
+ function sub(kind, parentKind, category, color, iconId, label) {
8174
+ entries.set(kind, {
8175
+ kind,
8176
+ parentKind,
8177
+ level: "sub",
8178
+ category,
8179
+ color,
8180
+ iconId,
8181
+ labelKey: `eventKind.${kind}`,
8182
+ label
8183
+ });
8184
+ }
8185
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8186
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8187
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8188
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8189
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8190
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8191
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8192
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8193
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8194
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8195
+ if (entries.has(cocoClass)) continue;
8196
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8197
+ }
8198
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8199
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8200
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8201
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8202
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8203
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8204
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8205
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8206
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8207
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8208
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8209
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8210
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8211
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8212
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8213
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8214
+ sub("button", "control", "control", "#10b981", "button", "Button");
8215
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8216
+ for (const l of AUDIO_MACRO_LABELS) {
8217
+ const kind = `audio-${l.id}`;
8218
+ if (entries.has(kind)) continue;
8219
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8220
+ }
8221
+ /** The complete taxonomy dictionary, keyed by kind. */
8222
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8223
+ /**
7940
8224
  * Error types for the safe expression engine. Two distinct classes so callers
7941
8225
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7942
8226
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12129,10 +12413,7 @@ var ConfigUISchemaNullableBridge = custom();
12129
12413
  var InferenceCapabilitiesBridge = custom();
12130
12414
  var ModelAvailabilityListBridge = custom();
12131
12415
  var PipelineRunResultBridge = custom();
12132
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12133
- kind: "mutation",
12134
- auth: "admin"
12135
- }), method(object({ nodeId: string$2() }), EngineProvisioningSchema), method(_void(), record(string$2(), object({
12416
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string$2() }), EngineProvisioningSchema), method(_void(), record(string$2(), object({
12136
12417
  modelId: string$2(),
12137
12418
  settings: record(string$2(), unknown()).readonly()
12138
12419
  }))), method(object({ steps: record(string$2(), object({
@@ -12192,13 +12473,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12192
12473
  * (inputClasses ≠ null) are skipped and served per-track via
12193
12474
  * pipelineRunner.runDetailSubtree (two-plane design).
12194
12475
  */
12195
- plane: _enum(["full", "frame"]).optional()
12476
+ plane: _enum(["full", "frame"]).optional(),
12477
+ /**
12478
+ * Inference-device selector (Phase 2 multi-device). Format
12479
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12480
+ * Omitted ⇒ the runner's default device (current single-engine
12481
+ * behaviour). Selects WHICH device pool of the node runs the call.
12482
+ */
12483
+ deviceKey: string$2().optional()
12196
12484
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12197
12485
  engine: PipelineEngineChoiceSchema.optional(),
12198
12486
  steps: array(PipelineStepInputSchema).min(1),
12199
12487
  frames: array(FrameInputSchema).min(1).max(255),
12200
12488
  deviceId: number().optional(),
12201
- sessionId: string$2().optional()
12489
+ sessionId: string$2().optional(),
12490
+ /**
12491
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12492
+ * the batch to the Python pool's bench preprocess cache
12493
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12494
+ * preprocessed ONCE and every later inference is a pure-inference cache
12495
+ * hit — the sustained-throughput run measures inference, not
12496
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12497
+ * full preprocess every call, correct). Fresh per sustained run;
12498
+ * released via `uncacheFrame`.
12499
+ */
12500
+ frameId: number().int().nonnegative().optional(),
12501
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12502
+ deviceKey: string$2().optional()
12202
12503
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12203
12504
  data: _instanceof(Uint8Array),
12204
12505
  width: number().int().positive(),
@@ -12230,8 +12531,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12230
12531
  * - `runtime` — main camera-serving engine (no idle TTL).
12231
12532
  * - `warm-override` — benchmark/test override held in the warm
12232
12533
  * cache; auto-disposed after the idle TTL.
12534
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12535
+ * multi-device, keyed by `deviceKey`) resolved
12536
+ * via `resolveDeviceFactory`. Runs alongside the
12537
+ * `runtime` engine on a DIFFERENT accelerator
12538
+ * (NPU / iGPU / Coral) — this is how the
12539
+ * Engines tab shows all pools running at once.
12233
12540
  */
12234
- kind: _enum(["runtime", "warm-override"]),
12541
+ kind: _enum([
12542
+ "runtime",
12543
+ "warm-override",
12544
+ "device-pool"
12545
+ ]),
12235
12546
  /** Native pid of the underlying Python pool (null when no pool). */
12236
12547
  poolPid: number().nullable(),
12237
12548
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12606,7 +12917,14 @@ var RunnerCameraConfigSchema = object({
12606
12917
  * camera's detect node differs from its source-owner (P2d, gated by the
12607
12918
  * `remoteSourcingNodes` rollout setting).
12608
12919
  */
12609
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12920
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12921
+ /**
12922
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12923
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12924
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12925
+ * this only selects WHICH device pool of that node runs the session.
12926
+ */
12927
+ deviceKey: string$2().optional()
12610
12928
  });
12611
12929
  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;
12612
12930
  /**
@@ -12627,6 +12945,19 @@ var RunnerLocalLoadSchema = object({
12627
12945
  avgInferenceTimeMs: number(),
12628
12946
  /** Total queue depth across motion + detection queues. */
12629
12947
  queueDepthTotal: number(),
12948
+ /**
12949
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12950
+ * this runner currently has attached cameras on, so the orchestrator's second
12951
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12952
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12953
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12954
+ */
12955
+ devices: array(object({
12956
+ deviceKey: string$2(),
12957
+ backend: string$2(),
12958
+ attachedCameras: number(),
12959
+ queueDepthTotal: number()
12960
+ })).default([]),
12630
12961
  /** Hardware capability flags reported by this node. */
12631
12962
  hardware: object({
12632
12963
  hasGpu: boolean(),
@@ -15775,6 +16106,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15775
16106
  return toDeviceSummary(device, this.addonId);
15776
16107
  }
15777
16108
  };
16109
+ 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;
16110
+ new Set(Object.values(DeviceType));
15778
16111
  /**
15779
16112
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15780
16113
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18935,17 +19268,30 @@ var EventKindCategorySchema = _enum([
18935
19268
  "audio",
18936
19269
  "detection",
18937
19270
  "sensor",
19271
+ "control",
18938
19272
  "custom",
18939
19273
  "package"
18940
19274
  ]);
19275
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19276
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18941
19277
  var EventKindDescriptorSchema = object({
18942
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19278
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18943
19279
  kind: string$2(),
19280
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19281
+ labelKey: string$2(),
19282
+ /** English fallback label (kept for clients that don't translate). */
18944
19283
  label: string$2(),
18945
19284
  /** Hex color for timeline/legend rendering. */
18946
19285
  color: string$2(),
19286
+ /** Dictionary id → lucide component on the UI side. */
19287
+ iconId: string$2(),
19288
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18947
19289
  icon: EventKindIconSchema,
18948
19290
  category: EventKindCategorySchema,
19291
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19292
+ parentKind: string$2().nullable(),
19293
+ /** Derived from `parentKind`, explicit for the client tree. */
19294
+ level: EventKindLevelSchema,
18949
19295
  /** Which cap + device contributes this kind. For built-ins the camera
18950
19296
  * itself; for sensor kinds the LINKED source device. */
18951
19297
  source: object({
@@ -19018,11 +19364,21 @@ var TrackAudioLabelSchema = object({
19018
19364
  firstAt: number(),
19019
19365
  lastAt: number()
19020
19366
  });
19367
+ /**
19368
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19369
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19370
+ * linked sensor/control state change (no positions; carries a snapshot). The
19371
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19372
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19373
+ */
19374
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19021
19375
  var TrackSchema = object({
19022
19376
  trackId: string$2(),
19023
19377
  deviceId: number(),
19024
19378
  className: string$2(),
19025
19379
  label: string$2().optional(),
19380
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19381
+ source: TrackSourceSchema.optional(),
19026
19382
  firstSeen: number(),
19027
19383
  lastSeen: number(),
19028
19384
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19399,6 +19755,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19399
19755
  eventId: string$2(),
19400
19756
  timestamp: number()
19401
19757
  });
19758
+ /**
19759
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19760
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19761
+ * caps into per-camera event-kind descriptors.
19762
+ *
19763
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19764
+ * is NOT duplicated here — every entry is derived from the single
19765
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19766
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19767
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19768
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19769
+ * eventful cap is missing.
19770
+ */
19771
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19772
+ var LEGACY_ICON = {
19773
+ motion: "motion",
19774
+ audio: "audio",
19775
+ person: "person",
19776
+ vehicle: "vehicle",
19777
+ animal: "animal",
19778
+ package: "package",
19779
+ door: "door",
19780
+ pir: "pir",
19781
+ smoke: "smoke",
19782
+ water: "water",
19783
+ button: "button",
19784
+ generic: "generic",
19785
+ gas: "smoke",
19786
+ vibration: "generic",
19787
+ tamper: "generic",
19788
+ presence: "person",
19789
+ lock: "generic",
19790
+ siren: "generic",
19791
+ switch: "generic",
19792
+ doorbell: "button"
19793
+ };
19794
+ function legacyIcon(iconId) {
19795
+ return LEGACY_ICON[iconId] ?? "generic";
19796
+ }
19797
+ /**
19798
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19799
+ * The anti-drift guard cross-checks this against the eventful caps declared
19800
+ * in `packages/types/src/capabilities/*.cap.ts`.
19801
+ */
19802
+ var CAP_TO_KIND = {
19803
+ contact: "contact",
19804
+ motion: "motion-sensor",
19805
+ smoke: "smoke",
19806
+ flood: "flood",
19807
+ gas: "gas",
19808
+ "carbon-monoxide": "carbon-monoxide",
19809
+ vibration: "vibration",
19810
+ tamper: "tamper",
19811
+ presence: "presence",
19812
+ "enum-sensor": "enum-sensor",
19813
+ "event-emitter": "device-event",
19814
+ "lock-control": "lock",
19815
+ switch: "switch",
19816
+ button: "button",
19817
+ doorbell: "doorbell"
19818
+ };
19819
+ function buildDescriptor(capName, kind) {
19820
+ const t = EVENT_TAXONOMY[kind];
19821
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19822
+ return {
19823
+ ...t,
19824
+ icon: legacyIcon(t.iconId)
19825
+ };
19826
+ }
19827
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19402
19828
  var CameraPipelineConfigSchema = object({
19403
19829
  engine: PipelineEngineChoiceSchema.optional(),
19404
19830
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19417,13 +19843,11 @@ var PipelineTemplateSchema = object({
19417
19843
  createdAt: string$2(),
19418
19844
  updatedAt: string$2()
19419
19845
  });
19420
- var AgentAddonConfigSchema = object({
19421
- enabled: boolean(),
19846
+ var DeviceStepConfigSchema = object({
19422
19847
  modelId: string$2().optional(),
19423
- settings: record(string$2(), unknown()).readonly()
19848
+ settings: record(string$2(), unknown()).optional()
19424
19849
  });
19425
19850
  var AgentPipelineSettingsSchema = object({
19426
- addonDefaults: record(string$2(), AgentAddonConfigSchema).readonly(),
19427
19851
  maxCameras: number().int().nonnegative().nullable().default(null),
19428
19852
  /** Per-node detection weight (relative share for the quota balancer). */
19429
19853
  detectWeight: number().positive().optional(),
@@ -19447,7 +19871,22 @@ var AgentPipelineSettingsSchema = object({
19447
19871
  * it already uses to reach the hub). Set this only when the auto-detected
19448
19872
  * address is wrong (multi-homed host, NAT, custom interface).
19449
19873
  */
19450
- reachableHost: string$2().optional()
19874
+ reachableHost: string$2().optional(),
19875
+ /**
19876
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19877
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19878
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19879
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19880
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19881
+ * the default model/settings for every camera landing on that accelerator;
19882
+ * a stepId absent ⇒ the step uses that device's format default.
19883
+ */
19884
+ inferenceDevices: record(string$2(), object({
19885
+ enabled: boolean(),
19886
+ weight: number().positive().optional(),
19887
+ maxSessions: number().int().positive().optional(),
19888
+ steps: record(string$2(), DeviceStepConfigSchema).optional()
19889
+ })).optional()
19451
19890
  });
19452
19891
  var CameraPipelineForAgentSchema = object({
19453
19892
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19457,14 +19896,13 @@ var CameraPipelineForAgentSchema = object({
19457
19896
  }).nullable()
19458
19897
  });
19459
19898
  var CameraStepOverridePatchSchema = object({
19460
- enabled: boolean().optional(),
19461
19899
  modelId: string$2().optional(),
19462
19900
  settings: record(string$2(), unknown()).readonly().optional()
19463
19901
  });
19464
19902
  var CameraPipelineSettingsSchema = object({
19465
19903
  pinnedAgentNodeId: string$2().optional(),
19466
19904
  stepToggles: record(string$2(), boolean()).optional(),
19467
- stepOverridesByAgent: record(string$2(), record(string$2(), CameraStepOverridePatchSchema)).optional(),
19905
+ stepOverridesByDevice: record(string$2(), record(string$2(), record(string$2(), CameraStepOverridePatchSchema))).optional(),
19468
19906
  pipelineByAgent: record(string$2(), CameraPipelineForAgentSchema).optional()
19469
19907
  });
19470
19908
  /**
@@ -19678,6 +20116,44 @@ var CameraStatusSchema = object({
19678
20116
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19679
20117
  fetchedAt: number()
19680
20118
  });
20119
+ var NodeInferenceDeviceSchema = object({
20120
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20121
+ key: string$2(),
20122
+ backend: string$2(),
20123
+ device: string$2(),
20124
+ format: _enum(MODEL_FORMATS),
20125
+ /** Whether the node's live probe reports the device as usable right now. */
20126
+ available: boolean(),
20127
+ /**
20128
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20129
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20130
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20131
+ * not a balanced target). An explicit stored value always wins; a stored-only
20132
+ * (unavailable) key keeps its stored value.
20133
+ */
20134
+ enabled: boolean(),
20135
+ /** Relative balancer weight for the enabled device (default 1). */
20136
+ weight: number(),
20137
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20138
+ maxSessions: number().nullable(),
20139
+ /** Object-detection model the executor defaults to for this deviceKey. */
20140
+ defaultModelId: string$2(),
20141
+ /**
20142
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20143
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20144
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20145
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20146
+ * available per format; this is the stored selection that becomes the
20147
+ * default for EVERY camera landing on this accelerator.
20148
+ */
20149
+ steps: record(string$2(), DeviceStepConfigSchema).optional()
20150
+ });
20151
+ var NodeInferenceDevicesSchema = object({
20152
+ nodeId: string$2(),
20153
+ /** False when the node's platform-probe was unreachable (no live device set). */
20154
+ reachable: boolean(),
20155
+ devices: array(NodeInferenceDeviceSchema).readonly()
20156
+ });
19681
20157
  method(object({
19682
20158
  deviceId: number(),
19683
20159
  agentNodeId: string$2()
@@ -19687,7 +20163,13 @@ method(object({
19687
20163
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19688
20164
  kind: "mutation",
19689
20165
  auth: "admin"
19690
- }), method(_void(), object({ migrated: number() }), {
20166
+ }), method(object({
20167
+ deviceId: number(),
20168
+ deviceKey: string$2()
20169
+ }), object({ success: literal(true) }), {
20170
+ kind: "mutation",
20171
+ auth: "admin"
20172
+ }), method(object({ deviceId: number() }), object({ deviceKey: string$2().nullable() })), method(_void(), object({ migrated: number() }), {
19691
20173
  kind: "mutation",
19692
20174
  auth: "admin"
19693
20175
  }), 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$2() }), CapabilityBindingsSchema), method(object({
@@ -19721,13 +20203,7 @@ method(object({
19721
20203
  }))), method(object({ agentNodeId: string$2() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19722
20204
  nodeId: string$2(),
19723
20205
  settings: AgentPipelineSettingsSchema
19724
- })).readonly()), method(object({
19725
- agentNodeId: string$2(),
19726
- defaults: record(string$2(), AgentAddonConfigSchema)
19727
- }), object({ success: literal(true) }), {
19728
- kind: "mutation",
19729
- auth: "admin"
19730
- }), method(object({ agentNodeId: string$2() }), object({
20206
+ })).readonly()), method(object({ agentNodeId: string$2() }), object({
19731
20207
  success: boolean(),
19732
20208
  removed: boolean()
19733
20209
  }), {
@@ -19759,7 +20235,18 @@ method(object({
19759
20235
  }), object({ success: literal(true) }), {
19760
20236
  kind: "mutation",
19761
20237
  auth: "admin"
19762
- }), method(object({ agentNodeId: string$2() }), object({
20238
+ }), method(object({
20239
+ agentNodeId: string$2(),
20240
+ inferenceDevices: record(string$2(), object({
20241
+ enabled: boolean(),
20242
+ weight: number().positive().optional(),
20243
+ maxSessions: number().int().positive().optional(),
20244
+ steps: record(string$2(), DeviceStepConfigSchema).optional()
20245
+ }))
20246
+ }), object({ success: literal(true) }), {
20247
+ kind: "mutation",
20248
+ auth: "admin"
20249
+ }), method(object({ nodeId: string$2() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string$2() }), object({
19763
20250
  success: literal(true),
19764
20251
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19765
20252
  effectiveModelId: string$2().nullable(),
@@ -19775,9 +20262,10 @@ method(object({
19775
20262
  }), object({ success: literal(true) }), {
19776
20263
  kind: "mutation",
19777
20264
  auth: "admin"
19778
- }), method(object({ deviceId: number() }), record(string$2(), record(string$2(), CameraStepOverridePatchSchema)).nullable()), method(object({
20265
+ }), method(object({ deviceId: number() }), record(string$2(), record(string$2(), record(string$2(), CameraStepOverridePatchSchema))).nullable()), method(object({
19779
20266
  deviceId: number(),
19780
20267
  agentNodeId: string$2(),
20268
+ deviceKey: string$2(),
19781
20269
  addonId: string$2(),
19782
20270
  patch: CameraStepOverridePatchSchema.nullable()
19783
20271
  }), object({ success: literal(true) }), {
@@ -19814,14 +20302,13 @@ method(object({
19814
20302
  });
19815
20303
  /**
19816
20304
  * server-management — per-NODE singleton capability for a node's ROOT
19817
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19818
- * agents).
20305
+ * package lifecycle (runtime-updatable node packages).
19819
20306
  *
19820
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19821
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19822
- * version describes the node. Updates install into
19823
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19824
- * starter (probation boot + auto-rollback to N-1).
20307
+ * Every node role runs the SAME root package (`@camstack/server`), which
20308
+ * carries the whole software stack in its npm dep tree, so ONE version
20309
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20310
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20311
+ * no auto-rollback).
19825
20312
  *
19826
20313
  * Providers:
19827
20314
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19929,7 +20416,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19929
20416
  /** Explicit target version; omitted = latest from the registry. */
19930
20417
  version: string$2().optional() }), ServerUpdateActionResultSchema, {
19931
20418
  kind: "mutation",
19932
- auth: "admin"
20419
+ auth: "admin",
20420
+ timeoutMs: 16 * 6e4
19933
20421
  }), method(_void(), ServerUpdateActionResultSchema, {
19934
20422
  kind: "mutation",
19935
20423
  auth: "admin"
@@ -20973,22 +21461,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20973
21461
  var RestartAddonResultSchema = unknown();
20974
21462
  var InstallPackageResultSchema = unknown();
20975
21463
  var ReloadPackagesResultSchema = unknown();
20976
- /**
20977
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20978
- * server restarts so the admin UI can react to the `restartingAt`
20979
- * timestamp (shows reconnect overlay). The transition from
20980
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20981
- * `system.restart-completed` event after the new process boots.
20982
- *
20983
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20984
- */
20985
- var UpdateFrameworkPackageResultSchema = object({
20986
- packageName: string$2(),
20987
- fromVersion: string$2(),
20988
- toVersion: string$2(),
20989
- /** Ms-epoch the server scheduled its self-restart. */
20990
- restartingAt: number()
20991
- });
20992
21464
  var BulkUpdateItemStatusSchema = _enum([
20993
21465
  "queued",
20994
21466
  "updating",
@@ -21116,13 +21588,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21116
21588
  }), object({ success: literal(true) }), {
21117
21589
  kind: "mutation",
21118
21590
  auth: "admin"
21119
- }), method(object({
21120
- packageName: string$2().min(1),
21121
- version: string$2().optional(),
21122
- deferRestart: boolean().optional()
21123
- }), UpdateFrameworkPackageResultSchema, {
21124
- kind: "mutation",
21125
- auth: "admin"
21126
21591
  }), method(object({ name: string$2() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string$2() }), RestartAddonResultSchema, {
21127
21592
  kind: "mutation",
21128
21593
  auth: "admin"
@@ -22005,10 +22470,10 @@ var TopologyCategorySchema = object({
22005
22470
  addons: array(TopologyCategoryAddonSchema).readonly()
22006
22471
  });
22007
22472
  /**
22008
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
22009
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
22010
- * version visibility for the Server management surface. Nullable: offline
22011
- * rows and pre-phase-2 nodes report none.
22473
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22474
+ * root package for every node role) as reported by its `registerNode`
22475
+ * manifest — version visibility for the Server management surface. Nullable:
22476
+ * offline rows and nodes that never reported one.
22012
22477
  */
22013
22478
  var TopologyRootPackageSchema = object({
22014
22479
  name: string$2(),
@@ -22396,17 +22861,28 @@ var PlatformScoreSchema = object({
22396
22861
  format: _enum([
22397
22862
  "onnx",
22398
22863
  "coreml",
22399
- "openvino"
22864
+ "openvino",
22865
+ "tflite"
22400
22866
  ]),
22401
22867
  score: number(),
22402
22868
  reason: string$2(),
22403
22869
  available: boolean()
22404
22870
  });
22871
+ var InferenceDeviceDescriptorSchema = object({
22872
+ key: string$2(),
22873
+ backend: string$2(),
22874
+ device: string$2(),
22875
+ format: ModelFormatSchema,
22876
+ runtime: literal("python"),
22877
+ score: number(),
22878
+ available: boolean()
22879
+ });
22405
22880
  var PlatformCapabilitiesSchema = object({
22406
22881
  hardware: HardwareInfoSchema,
22407
22882
  scores: array(PlatformScoreSchema).readonly(),
22408
22883
  bestScore: PlatformScoreSchema,
22409
- pythonPath: string$2().nullable()
22884
+ pythonPath: string$2().nullable(),
22885
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22410
22886
  });
22411
22887
  var ModelRequirementSchema = object({
22412
22888
  modelId: string$2(),
@@ -23285,12 +23761,6 @@ Object.freeze({
23285
23761
  addonId: null,
23286
23762
  access: "delete"
23287
23763
  },
23288
- "addons.updateFrameworkPackage": {
23289
- capName: "addons",
23290
- capScope: "system",
23291
- addonId: null,
23292
- access: "create"
23293
- },
23294
23764
  "addons.updatePackage": {
23295
23765
  capName: "addons",
23296
23766
  capScope: "system",
@@ -26063,12 +26533,6 @@ Object.freeze({
26063
26533
  addonId: null,
26064
26534
  access: "view"
26065
26535
  },
26066
- "pipelineExecutor.reprobeEngine": {
26067
- capName: "pipeline-executor",
26068
- capScope: "system",
26069
- addonId: null,
26070
- access: "create"
26071
- },
26072
26536
  "pipelineExecutor.runAudioTest": {
26073
26537
  capName: "pipeline-executor",
26074
26538
  capScope: "system",
@@ -26219,6 +26683,12 @@ Object.freeze({
26219
26683
  addonId: null,
26220
26684
  access: "view"
26221
26685
  },
26686
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26687
+ capName: "pipeline-orchestrator",
26688
+ capScope: "system",
26689
+ addonId: null,
26690
+ access: "view"
26691
+ },
26222
26692
  "pipelineOrchestrator.getPipelineAssignment": {
26223
26693
  capName: "pipeline-orchestrator",
26224
26694
  capScope: "system",
@@ -26231,6 +26701,12 @@ Object.freeze({
26231
26701
  addonId: null,
26232
26702
  access: "view"
26233
26703
  },
26704
+ "pipelineOrchestrator.getPipelineDevicePin": {
26705
+ capName: "pipeline-orchestrator",
26706
+ capScope: "system",
26707
+ addonId: null,
26708
+ access: "view"
26709
+ },
26234
26710
  "pipelineOrchestrator.listAgentSettings": {
26235
26711
  capName: "pipeline-orchestrator",
26236
26712
  capScope: "system",
@@ -26273,19 +26749,19 @@ Object.freeze({
26273
26749
  addonId: null,
26274
26750
  access: "create"
26275
26751
  },
26276
- "pipelineOrchestrator.setAgentAddonDefaults": {
26752
+ "pipelineOrchestrator.setAgentCapabilities": {
26277
26753
  capName: "pipeline-orchestrator",
26278
26754
  capScope: "system",
26279
26755
  addonId: null,
26280
26756
  access: "create"
26281
26757
  },
26282
- "pipelineOrchestrator.setAgentCapabilities": {
26758
+ "pipelineOrchestrator.setAgentDetectWeight": {
26283
26759
  capName: "pipeline-orchestrator",
26284
26760
  capScope: "system",
26285
26761
  addonId: null,
26286
26762
  access: "create"
26287
26763
  },
26288
- "pipelineOrchestrator.setAgentDetectWeight": {
26764
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26289
26765
  capName: "pipeline-orchestrator",
26290
26766
  capScope: "system",
26291
26767
  addonId: null,
@@ -26327,6 +26803,12 @@ Object.freeze({
26327
26803
  addonId: null,
26328
26804
  access: "create"
26329
26805
  },
26806
+ "pipelineOrchestrator.setPipelineDevicePin": {
26807
+ capName: "pipeline-orchestrator",
26808
+ capScope: "system",
26809
+ addonId: null,
26810
+ access: "create"
26811
+ },
26330
26812
  "pipelineOrchestrator.unassignAudio": {
26331
26813
  capName: "pipeline-orchestrator",
26332
26814
  capScope: "system",
@@ -27879,32 +28361,6 @@ Object.freeze({
27879
28361
  "network-access": "ingress",
27880
28362
  "smtp-provider": "email"
27881
28363
  });
27882
- var frameworkSwapPackageSchema = object({
27883
- name: string$2(),
27884
- stagedPath: string$2(),
27885
- backupPath: string$2(),
27886
- toVersion: string$2(),
27887
- fromVersion: string$2().nullable()
27888
- });
27889
- object({
27890
- jobId: string$2(),
27891
- taskId: string$2(),
27892
- packages: array(frameworkSwapPackageSchema),
27893
- requestedAtMs: number(),
27894
- schemaVersion: literal(1)
27895
- });
27896
- object({
27897
- jobId: string$2(),
27898
- taskId: string$2(),
27899
- backups: array(object({
27900
- name: string$2(),
27901
- backupPath: string$2(),
27902
- livePath: string$2()
27903
- })),
27904
- appliedAtMs: number(),
27905
- bootAttempts: number(),
27906
- schemaVersion: literal(1)
27907
- });
27908
28364
  //#endregion
27909
28365
  //#region ../../node_modules/@matter/general/dist/esm/net/tcp/TcpConnection.js
27910
28366
  /**