@camstack/addon-export-hap 1.1.27 → 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.
@@ -7079,6 +7079,17 @@ var ModelCatalogEntrySchema = object({
7079
7079
  "imagenet",
7080
7080
  "none"
7081
7081
  ]).optional(),
7082
+ /**
7083
+ * The model already applies softmax IN-GRAPH — its raw output is a
7084
+ * probability distribution, not logits. When set, the `softmax`
7085
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7086
+ * probability vector collapses it toward uniform (top-1 score craters far
7087
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7088
+ * the output is raw logits and the postprocessor applies softmax (the normal
7089
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7090
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7091
+ */
7092
+ outputProbabilities: boolean().optional(),
7082
7093
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7083
7094
  /**
7084
7095
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7692,6 +7703,160 @@ function pickClosestResolution(entries, target) {
7692
7703
  }
7693
7704
  return bestAbove?.entry ?? bestBelow?.entry;
7694
7705
  }
7706
+ var COCO_TO_MACRO = {
7707
+ mapping: {
7708
+ person: "person",
7709
+ bicycle: "vehicle",
7710
+ car: "vehicle",
7711
+ motorcycle: "vehicle",
7712
+ airplane: "vehicle",
7713
+ bus: "vehicle",
7714
+ train: "vehicle",
7715
+ truck: "vehicle",
7716
+ boat: "vehicle",
7717
+ bird: "animal",
7718
+ cat: "animal",
7719
+ dog: "animal",
7720
+ horse: "animal",
7721
+ sheep: "animal",
7722
+ cow: "animal",
7723
+ elephant: "animal",
7724
+ bear: "animal",
7725
+ zebra: "animal",
7726
+ giraffe: "animal",
7727
+ suitcase: "package",
7728
+ backpack: "package",
7729
+ handbag: "package"
7730
+ },
7731
+ preserveOriginal: false
7732
+ };
7733
+ var AUDIO_MACRO_LABELS = [
7734
+ {
7735
+ id: "speech",
7736
+ name: "Speech",
7737
+ icon: "🗣️"
7738
+ },
7739
+ {
7740
+ id: "scream",
7741
+ name: "Scream / Shout",
7742
+ icon: "😱"
7743
+ },
7744
+ {
7745
+ id: "crying",
7746
+ name: "Crying / Baby",
7747
+ icon: "😢"
7748
+ },
7749
+ {
7750
+ id: "laughter",
7751
+ name: "Laughter",
7752
+ icon: "😂"
7753
+ },
7754
+ {
7755
+ id: "music",
7756
+ name: "Music",
7757
+ icon: "🎵"
7758
+ },
7759
+ {
7760
+ id: "dog",
7761
+ name: "Dog",
7762
+ icon: "🐕"
7763
+ },
7764
+ {
7765
+ id: "cat",
7766
+ name: "Cat",
7767
+ icon: "🐈"
7768
+ },
7769
+ {
7770
+ id: "bird",
7771
+ name: "Bird",
7772
+ icon: "🐦"
7773
+ },
7774
+ {
7775
+ id: "animal",
7776
+ name: "Animal (other)",
7777
+ icon: "🐾"
7778
+ },
7779
+ {
7780
+ id: "alarm",
7781
+ name: "Alarm / Siren",
7782
+ icon: "🚨"
7783
+ },
7784
+ {
7785
+ id: "doorbell",
7786
+ name: "Doorbell / Knock",
7787
+ icon: "🔔"
7788
+ },
7789
+ {
7790
+ id: "glass_breaking",
7791
+ name: "Glass Breaking",
7792
+ icon: "💥"
7793
+ },
7794
+ {
7795
+ id: "gunshot",
7796
+ name: "Gunshot / Explosion",
7797
+ icon: "💣"
7798
+ },
7799
+ {
7800
+ id: "vehicle",
7801
+ name: "Vehicle",
7802
+ icon: "🚗"
7803
+ },
7804
+ {
7805
+ id: "siren",
7806
+ name: "Emergency Siren",
7807
+ icon: "🚑"
7808
+ },
7809
+ {
7810
+ id: "fire",
7811
+ name: "Fire / Smoke",
7812
+ icon: "🔥"
7813
+ },
7814
+ {
7815
+ id: "water",
7816
+ name: "Water",
7817
+ icon: "💧"
7818
+ },
7819
+ {
7820
+ id: "wind",
7821
+ name: "Wind / Weather",
7822
+ icon: "🌬️"
7823
+ },
7824
+ {
7825
+ id: "door",
7826
+ name: "Door",
7827
+ icon: "🚪"
7828
+ },
7829
+ {
7830
+ id: "footsteps",
7831
+ name: "Footsteps",
7832
+ icon: "👣"
7833
+ },
7834
+ {
7835
+ id: "crowd",
7836
+ name: "Crowd / Chatter",
7837
+ icon: "👥"
7838
+ },
7839
+ {
7840
+ id: "telephone",
7841
+ name: "Telephone",
7842
+ icon: "📞"
7843
+ },
7844
+ {
7845
+ id: "engine",
7846
+ name: "Engine / Motor",
7847
+ icon: "⚙️"
7848
+ },
7849
+ {
7850
+ id: "tools",
7851
+ name: "Tools / Construction",
7852
+ icon: "🔨"
7853
+ },
7854
+ {
7855
+ id: "silence",
7856
+ name: "Silence",
7857
+ icon: "🤫"
7858
+ }
7859
+ ];
7695
7860
  var YAMNET_TO_MACRO = {
7696
7861
  mapping: {
7697
7862
  Speech: "speech",
@@ -7958,6 +8123,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7958
8123
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7959
8124
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7960
8125
  /**
8126
+ * Unified event-kind taxonomy — THE single source of truth for
8127
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8128
+ * icon }`.
8129
+ *
8130
+ * This dictionary folds together what used to be scattered across four
8131
+ * copies:
8132
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8133
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8134
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8135
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8136
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8137
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8138
+ *
8139
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8140
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8141
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8142
+ * color or an icon: they read this dictionary (server descriptors carry the
8143
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8144
+ *
8145
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8146
+ */
8147
+ var TAXONOMY_COLORS = {
8148
+ motion: "#f59e0b",
8149
+ audio: "#06b6d4",
8150
+ person: "#22c55e",
8151
+ vehicle: "#3b82f6",
8152
+ animal: "#f97316",
8153
+ package: "#a855f7",
8154
+ sensor: "#8b5cf6",
8155
+ control: "#10b981",
8156
+ genericDetection: "#64748b"
8157
+ };
8158
+ var DETECTION_SUB_COLORS = {
8159
+ car: "#f59e0b",
8160
+ truck: "#d97706",
8161
+ bus: "#b45309",
8162
+ motorcycle: "#eab308",
8163
+ bicycle: "#ca8a04",
8164
+ airplane: "#60a5fa",
8165
+ boat: "#2563eb",
8166
+ train: "#1d4ed8",
8167
+ bird: "#14b8a6",
8168
+ dog: "#84cc16",
8169
+ cat: "#f97316",
8170
+ horse: "#a16207",
8171
+ sheep: "#a3a3a3",
8172
+ cow: "#78716c",
8173
+ elephant: "#6b7280",
8174
+ bear: "#7c2d12",
8175
+ zebra: "#404040",
8176
+ giraffe: "#d4a373"
8177
+ };
8178
+ function titleCase(id) {
8179
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8180
+ }
8181
+ var entries = /* @__PURE__ */ new Map();
8182
+ function macro(kind, category, color, iconId, label) {
8183
+ entries.set(kind, {
8184
+ kind,
8185
+ parentKind: null,
8186
+ level: "macro",
8187
+ category,
8188
+ color,
8189
+ iconId,
8190
+ labelKey: `eventKind.${kind}`,
8191
+ label
8192
+ });
8193
+ }
8194
+ function sub(kind, parentKind, category, color, iconId, label) {
8195
+ entries.set(kind, {
8196
+ kind,
8197
+ parentKind,
8198
+ level: "sub",
8199
+ category,
8200
+ color,
8201
+ iconId,
8202
+ labelKey: `eventKind.${kind}`,
8203
+ label
8204
+ });
8205
+ }
8206
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8207
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8208
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8209
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8210
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8211
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8212
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8213
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8214
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8215
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8216
+ if (entries.has(cocoClass)) continue;
8217
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8218
+ }
8219
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8220
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8221
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8222
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8223
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8224
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8225
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8226
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8227
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8228
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8229
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8230
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8231
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8232
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8233
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8234
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8235
+ sub("button", "control", "control", "#10b981", "button", "Button");
8236
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8237
+ for (const l of AUDIO_MACRO_LABELS) {
8238
+ const kind = `audio-${l.id}`;
8239
+ if (entries.has(kind)) continue;
8240
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8241
+ }
8242
+ /** The complete taxonomy dictionary, keyed by kind. */
8243
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8244
+ /**
7961
8245
  * Error types for the safe expression engine. Two distinct classes so callers
7962
8246
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7963
8247
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10873,10 +11157,7 @@ var ConfigUISchemaNullableBridge = custom();
10873
11157
  var InferenceCapabilitiesBridge = custom();
10874
11158
  var ModelAvailabilityListBridge = custom();
10875
11159
  var PipelineRunResultBridge = custom();
10876
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10877
- kind: "mutation",
10878
- auth: "admin"
10879
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11160
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10880
11161
  modelId: string(),
10881
11162
  settings: record(string(), unknown()).readonly()
10882
11163
  }))), method(object({ steps: record(string(), object({
@@ -10936,13 +11217,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10936
11217
  * (inputClasses ≠ null) are skipped and served per-track via
10937
11218
  * pipelineRunner.runDetailSubtree (two-plane design).
10938
11219
  */
10939
- plane: _enum(["full", "frame"]).optional()
11220
+ plane: _enum(["full", "frame"]).optional(),
11221
+ /**
11222
+ * Inference-device selector (Phase 2 multi-device). Format
11223
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11224
+ * Omitted ⇒ the runner's default device (current single-engine
11225
+ * behaviour). Selects WHICH device pool of the node runs the call.
11226
+ */
11227
+ deviceKey: string().optional()
10940
11228
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10941
11229
  engine: PipelineEngineChoiceSchema.optional(),
10942
11230
  steps: array(PipelineStepInputSchema).min(1),
10943
11231
  frames: array(FrameInputSchema).min(1).max(255),
10944
11232
  deviceId: number().optional(),
10945
- sessionId: string().optional()
11233
+ sessionId: string().optional(),
11234
+ /**
11235
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11236
+ * the batch to the Python pool's bench preprocess cache
11237
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11238
+ * preprocessed ONCE and every later inference is a pure-inference cache
11239
+ * hit — the sustained-throughput run measures inference, not
11240
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11241
+ * full preprocess every call, correct). Fresh per sustained run;
11242
+ * released via `uncacheFrame`.
11243
+ */
11244
+ frameId: number().int().nonnegative().optional(),
11245
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11246
+ deviceKey: string().optional()
10946
11247
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10947
11248
  data: _instanceof(Uint8Array),
10948
11249
  width: number().int().positive(),
@@ -10974,8 +11275,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10974
11275
  * - `runtime` — main camera-serving engine (no idle TTL).
10975
11276
  * - `warm-override` — benchmark/test override held in the warm
10976
11277
  * cache; auto-disposed after the idle TTL.
11278
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11279
+ * multi-device, keyed by `deviceKey`) resolved
11280
+ * via `resolveDeviceFactory`. Runs alongside the
11281
+ * `runtime` engine on a DIFFERENT accelerator
11282
+ * (NPU / iGPU / Coral) — this is how the
11283
+ * Engines tab shows all pools running at once.
10977
11284
  */
10978
- kind: _enum(["runtime", "warm-override"]),
11285
+ kind: _enum([
11286
+ "runtime",
11287
+ "warm-override",
11288
+ "device-pool"
11289
+ ]),
10979
11290
  /** Native pid of the underlying Python pool (null when no pool). */
10980
11291
  poolPid: number().nullable(),
10981
11292
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11317,7 +11628,14 @@ var RunnerCameraConfigSchema = object({
11317
11628
  * camera's detect node differs from its source-owner (P2d, gated by the
11318
11629
  * `remoteSourcingNodes` rollout setting).
11319
11630
  */
11320
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11631
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11632
+ /**
11633
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11634
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11635
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11636
+ * this only selects WHICH device pool of that node runs the session.
11637
+ */
11638
+ deviceKey: string().optional()
11321
11639
  });
11322
11640
  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;
11323
11641
  /**
@@ -11338,6 +11656,19 @@ var RunnerLocalLoadSchema = object({
11338
11656
  avgInferenceTimeMs: number(),
11339
11657
  /** Total queue depth across motion + detection queues. */
11340
11658
  queueDepthTotal: number(),
11659
+ /**
11660
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11661
+ * this runner currently has attached cameras on, so the orchestrator's second
11662
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11663
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11664
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11665
+ */
11666
+ devices: array(object({
11667
+ deviceKey: string(),
11668
+ backend: string(),
11669
+ attachedCameras: number(),
11670
+ queueDepthTotal: number()
11671
+ })).default([]),
11341
11672
  /** Hardware capability flags reported by this node. */
11342
11673
  hardware: object({
11343
11674
  hasGpu: boolean(),
@@ -12813,6 +13144,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12813
13144
  kind: "mutation",
12814
13145
  auth: "admin"
12815
13146
  });
13147
+ 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;
13148
+ new Set(Object.values(DeviceType));
12816
13149
  /**
12817
13150
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12818
13151
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15932,17 +16265,30 @@ var EventKindCategorySchema = _enum([
15932
16265
  "audio",
15933
16266
  "detection",
15934
16267
  "sensor",
16268
+ "control",
15935
16269
  "custom",
15936
16270
  "package"
15937
16271
  ]);
16272
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16273
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15938
16274
  var EventKindDescriptorSchema = object({
15939
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16275
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15940
16276
  kind: string(),
16277
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16278
+ labelKey: string(),
16279
+ /** English fallback label (kept for clients that don't translate). */
15941
16280
  label: string(),
15942
16281
  /** Hex color for timeline/legend rendering. */
15943
16282
  color: string(),
16283
+ /** Dictionary id → lucide component on the UI side. */
16284
+ iconId: string(),
16285
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15944
16286
  icon: EventKindIconSchema,
15945
16287
  category: EventKindCategorySchema,
16288
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16289
+ parentKind: string().nullable(),
16290
+ /** Derived from `parentKind`, explicit for the client tree. */
16291
+ level: EventKindLevelSchema,
15946
16292
  /** Which cap + device contributes this kind. For built-ins the camera
15947
16293
  * itself; for sensor kinds the LINKED source device. */
15948
16294
  source: object({
@@ -16015,11 +16361,21 @@ var TrackAudioLabelSchema = object({
16015
16361
  firstAt: number(),
16016
16362
  lastAt: number()
16017
16363
  });
16364
+ /**
16365
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16366
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16367
+ * linked sensor/control state change (no positions; carries a snapshot). The
16368
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16369
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16370
+ */
16371
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16018
16372
  var TrackSchema = object({
16019
16373
  trackId: string(),
16020
16374
  deviceId: number(),
16021
16375
  className: string(),
16022
16376
  label: string().optional(),
16377
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16378
+ source: TrackSourceSchema.optional(),
16023
16379
  firstSeen: number(),
16024
16380
  lastSeen: number(),
16025
16381
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16396,6 +16752,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16396
16752
  eventId: string(),
16397
16753
  timestamp: number()
16398
16754
  });
16755
+ /**
16756
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16757
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16758
+ * caps into per-camera event-kind descriptors.
16759
+ *
16760
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16761
+ * is NOT duplicated here — every entry is derived from the single
16762
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16763
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16764
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16765
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16766
+ * eventful cap is missing.
16767
+ */
16768
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16769
+ var LEGACY_ICON = {
16770
+ motion: "motion",
16771
+ audio: "audio",
16772
+ person: "person",
16773
+ vehicle: "vehicle",
16774
+ animal: "animal",
16775
+ package: "package",
16776
+ door: "door",
16777
+ pir: "pir",
16778
+ smoke: "smoke",
16779
+ water: "water",
16780
+ button: "button",
16781
+ generic: "generic",
16782
+ gas: "smoke",
16783
+ vibration: "generic",
16784
+ tamper: "generic",
16785
+ presence: "person",
16786
+ lock: "generic",
16787
+ siren: "generic",
16788
+ switch: "generic",
16789
+ doorbell: "button"
16790
+ };
16791
+ function legacyIcon(iconId) {
16792
+ return LEGACY_ICON[iconId] ?? "generic";
16793
+ }
16794
+ /**
16795
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16796
+ * The anti-drift guard cross-checks this against the eventful caps declared
16797
+ * in `packages/types/src/capabilities/*.cap.ts`.
16798
+ */
16799
+ var CAP_TO_KIND = {
16800
+ contact: "contact",
16801
+ motion: "motion-sensor",
16802
+ smoke: "smoke",
16803
+ flood: "flood",
16804
+ gas: "gas",
16805
+ "carbon-monoxide": "carbon-monoxide",
16806
+ vibration: "vibration",
16807
+ tamper: "tamper",
16808
+ presence: "presence",
16809
+ "enum-sensor": "enum-sensor",
16810
+ "event-emitter": "device-event",
16811
+ "lock-control": "lock",
16812
+ switch: "switch",
16813
+ button: "button",
16814
+ doorbell: "doorbell"
16815
+ };
16816
+ function buildDescriptor(capName, kind) {
16817
+ const t = EVENT_TAXONOMY[kind];
16818
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16819
+ return {
16820
+ ...t,
16821
+ icon: legacyIcon(t.iconId)
16822
+ };
16823
+ }
16824
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16399
16825
  var CameraPipelineConfigSchema = object({
16400
16826
  engine: PipelineEngineChoiceSchema.optional(),
16401
16827
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16414,13 +16840,11 @@ var PipelineTemplateSchema = object({
16414
16840
  createdAt: string(),
16415
16841
  updatedAt: string()
16416
16842
  });
16417
- var AgentAddonConfigSchema = object({
16418
- enabled: boolean(),
16843
+ var DeviceStepConfigSchema = object({
16419
16844
  modelId: string().optional(),
16420
- settings: record(string(), unknown()).readonly()
16845
+ settings: record(string(), unknown()).optional()
16421
16846
  });
16422
16847
  var AgentPipelineSettingsSchema = object({
16423
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16424
16848
  maxCameras: number().int().nonnegative().nullable().default(null),
16425
16849
  /** Per-node detection weight (relative share for the quota balancer). */
16426
16850
  detectWeight: number().positive().optional(),
@@ -16444,7 +16868,22 @@ var AgentPipelineSettingsSchema = object({
16444
16868
  * it already uses to reach the hub). Set this only when the auto-detected
16445
16869
  * address is wrong (multi-homed host, NAT, custom interface).
16446
16870
  */
16447
- reachableHost: string().optional()
16871
+ reachableHost: string().optional(),
16872
+ /**
16873
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16874
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16875
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16876
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16877
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16878
+ * the default model/settings for every camera landing on that accelerator;
16879
+ * a stepId absent ⇒ the step uses that device's format default.
16880
+ */
16881
+ inferenceDevices: record(string(), object({
16882
+ enabled: boolean(),
16883
+ weight: number().positive().optional(),
16884
+ maxSessions: number().int().positive().optional(),
16885
+ steps: record(string(), DeviceStepConfigSchema).optional()
16886
+ })).optional()
16448
16887
  });
16449
16888
  var CameraPipelineForAgentSchema = object({
16450
16889
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16454,14 +16893,13 @@ var CameraPipelineForAgentSchema = object({
16454
16893
  }).nullable()
16455
16894
  });
16456
16895
  var CameraStepOverridePatchSchema = object({
16457
- enabled: boolean().optional(),
16458
16896
  modelId: string().optional(),
16459
16897
  settings: record(string(), unknown()).readonly().optional()
16460
16898
  });
16461
16899
  var CameraPipelineSettingsSchema = object({
16462
16900
  pinnedAgentNodeId: string().optional(),
16463
16901
  stepToggles: record(string(), boolean()).optional(),
16464
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16902
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16465
16903
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16466
16904
  });
16467
16905
  /**
@@ -16675,6 +17113,44 @@ var CameraStatusSchema = object({
16675
17113
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16676
17114
  fetchedAt: number()
16677
17115
  });
17116
+ var NodeInferenceDeviceSchema = object({
17117
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17118
+ key: string(),
17119
+ backend: string(),
17120
+ device: string(),
17121
+ format: _enum(MODEL_FORMATS),
17122
+ /** Whether the node's live probe reports the device as usable right now. */
17123
+ available: boolean(),
17124
+ /**
17125
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17126
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17127
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17128
+ * not a balanced target). An explicit stored value always wins; a stored-only
17129
+ * (unavailable) key keeps its stored value.
17130
+ */
17131
+ enabled: boolean(),
17132
+ /** Relative balancer weight for the enabled device (default 1). */
17133
+ weight: number(),
17134
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17135
+ maxSessions: number().nullable(),
17136
+ /** Object-detection model the executor defaults to for this deviceKey. */
17137
+ defaultModelId: string(),
17138
+ /**
17139
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17140
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17141
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17142
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17143
+ * available per format; this is the stored selection that becomes the
17144
+ * default for EVERY camera landing on this accelerator.
17145
+ */
17146
+ steps: record(string(), DeviceStepConfigSchema).optional()
17147
+ });
17148
+ var NodeInferenceDevicesSchema = object({
17149
+ nodeId: string(),
17150
+ /** False when the node's platform-probe was unreachable (no live device set). */
17151
+ reachable: boolean(),
17152
+ devices: array(NodeInferenceDeviceSchema).readonly()
17153
+ });
16678
17154
  method(object({
16679
17155
  deviceId: number(),
16680
17156
  agentNodeId: string()
@@ -16684,7 +17160,13 @@ method(object({
16684
17160
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16685
17161
  kind: "mutation",
16686
17162
  auth: "admin"
16687
- }), method(_void(), object({ migrated: number() }), {
17163
+ }), method(object({
17164
+ deviceId: number(),
17165
+ deviceKey: string()
17166
+ }), object({ success: literal(true) }), {
17167
+ kind: "mutation",
17168
+ auth: "admin"
17169
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16688
17170
  kind: "mutation",
16689
17171
  auth: "admin"
16690
17172
  }), 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({
@@ -16718,13 +17200,7 @@ method(object({
16718
17200
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16719
17201
  nodeId: string(),
16720
17202
  settings: AgentPipelineSettingsSchema
16721
- })).readonly()), method(object({
16722
- agentNodeId: string(),
16723
- defaults: record(string(), AgentAddonConfigSchema)
16724
- }), object({ success: literal(true) }), {
16725
- kind: "mutation",
16726
- auth: "admin"
16727
- }), method(object({ agentNodeId: string() }), object({
17203
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16728
17204
  success: boolean(),
16729
17205
  removed: boolean()
16730
17206
  }), {
@@ -16756,7 +17232,18 @@ method(object({
16756
17232
  }), object({ success: literal(true) }), {
16757
17233
  kind: "mutation",
16758
17234
  auth: "admin"
16759
- }), method(object({ agentNodeId: string() }), object({
17235
+ }), method(object({
17236
+ agentNodeId: string(),
17237
+ inferenceDevices: record(string(), object({
17238
+ enabled: boolean(),
17239
+ weight: number().positive().optional(),
17240
+ maxSessions: number().int().positive().optional(),
17241
+ steps: record(string(), DeviceStepConfigSchema).optional()
17242
+ }))
17243
+ }), object({ success: literal(true) }), {
17244
+ kind: "mutation",
17245
+ auth: "admin"
17246
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16760
17247
  success: literal(true),
16761
17248
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16762
17249
  effectiveModelId: string().nullable(),
@@ -16772,9 +17259,10 @@ method(object({
16772
17259
  }), object({ success: literal(true) }), {
16773
17260
  kind: "mutation",
16774
17261
  auth: "admin"
16775
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17262
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16776
17263
  deviceId: number(),
16777
17264
  agentNodeId: string(),
17265
+ deviceKey: string(),
16778
17266
  addonId: string(),
16779
17267
  patch: CameraStepOverridePatchSchema.nullable()
16780
17268
  }), object({ success: literal(true) }), {
@@ -16811,14 +17299,13 @@ method(object({
16811
17299
  });
16812
17300
  /**
16813
17301
  * server-management — per-NODE singleton capability for a node's ROOT
16814
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16815
- * agents).
17302
+ * package lifecycle (runtime-updatable node packages).
16816
17303
  *
16817
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16818
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16819
- * version describes the node. Updates install into
16820
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16821
- * starter (probation boot + auto-rollback to N-1).
17304
+ * Every node role runs the SAME root package (`@camstack/server`), which
17305
+ * carries the whole software stack in its npm dep tree, so ONE version
17306
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17307
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17308
+ * no auto-rollback).
16822
17309
  *
16823
17310
  * Providers:
16824
17311
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16926,7 +17413,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16926
17413
  /** Explicit target version; omitted = latest from the registry. */
16927
17414
  version: string().optional() }), ServerUpdateActionResultSchema, {
16928
17415
  kind: "mutation",
16929
- auth: "admin"
17416
+ auth: "admin",
17417
+ timeoutMs: 16 * 6e4
16930
17418
  }), method(_void(), ServerUpdateActionResultSchema, {
16931
17419
  kind: "mutation",
16932
17420
  auth: "admin"
@@ -17970,22 +18458,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17970
18458
  var RestartAddonResultSchema = unknown();
17971
18459
  var InstallPackageResultSchema = unknown();
17972
18460
  var ReloadPackagesResultSchema = unknown();
17973
- /**
17974
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
17975
- * server restarts so the admin UI can react to the `restartingAt`
17976
- * timestamp (shows reconnect overlay). The transition from
17977
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
17978
- * `system.restart-completed` event after the new process boots.
17979
- *
17980
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
17981
- */
17982
- var UpdateFrameworkPackageResultSchema = object({
17983
- packageName: string(),
17984
- fromVersion: string(),
17985
- toVersion: string(),
17986
- /** Ms-epoch the server scheduled its self-restart. */
17987
- restartingAt: number()
17988
- });
17989
18461
  var BulkUpdateItemStatusSchema = _enum([
17990
18462
  "queued",
17991
18463
  "updating",
@@ -18113,13 +18585,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18113
18585
  }), object({ success: literal(true) }), {
18114
18586
  kind: "mutation",
18115
18587
  auth: "admin"
18116
- }), method(object({
18117
- packageName: string().min(1),
18118
- version: string().optional(),
18119
- deferRestart: boolean().optional()
18120
- }), UpdateFrameworkPackageResultSchema, {
18121
- kind: "mutation",
18122
- auth: "admin"
18123
18588
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18124
18589
  kind: "mutation",
18125
18590
  auth: "admin"
@@ -18985,10 +19450,10 @@ var TopologyCategorySchema = object({
18985
19450
  addons: array(TopologyCategoryAddonSchema).readonly()
18986
19451
  });
18987
19452
  /**
18988
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
18989
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
18990
- * version visibility for the Server management surface. Nullable: offline
18991
- * rows and pre-phase-2 nodes report none.
19453
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19454
+ * root package for every node role) as reported by its `registerNode`
19455
+ * manifest — version visibility for the Server management surface. Nullable:
19456
+ * offline rows and nodes that never reported one.
18992
19457
  */
18993
19458
  var TopologyRootPackageSchema = object({
18994
19459
  name: string(),
@@ -19376,17 +19841,28 @@ var PlatformScoreSchema = object({
19376
19841
  format: _enum([
19377
19842
  "onnx",
19378
19843
  "coreml",
19379
- "openvino"
19844
+ "openvino",
19845
+ "tflite"
19380
19846
  ]),
19381
19847
  score: number(),
19382
19848
  reason: string(),
19383
19849
  available: boolean()
19384
19850
  });
19851
+ var InferenceDeviceDescriptorSchema = object({
19852
+ key: string(),
19853
+ backend: string(),
19854
+ device: string(),
19855
+ format: ModelFormatSchema,
19856
+ runtime: literal("python"),
19857
+ score: number(),
19858
+ available: boolean()
19859
+ });
19385
19860
  var PlatformCapabilitiesSchema = object({
19386
19861
  hardware: HardwareInfoSchema,
19387
19862
  scores: array(PlatformScoreSchema).readonly(),
19388
19863
  bestScore: PlatformScoreSchema,
19389
- pythonPath: string().nullable()
19864
+ pythonPath: string().nullable(),
19865
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19390
19866
  });
19391
19867
  var ModelRequirementSchema = object({
19392
19868
  modelId: string(),
@@ -20265,12 +20741,6 @@ Object.freeze({
20265
20741
  addonId: null,
20266
20742
  access: "delete"
20267
20743
  },
20268
- "addons.updateFrameworkPackage": {
20269
- capName: "addons",
20270
- capScope: "system",
20271
- addonId: null,
20272
- access: "create"
20273
- },
20274
20744
  "addons.updatePackage": {
20275
20745
  capName: "addons",
20276
20746
  capScope: "system",
@@ -23043,12 +23513,6 @@ Object.freeze({
23043
23513
  addonId: null,
23044
23514
  access: "view"
23045
23515
  },
23046
- "pipelineExecutor.reprobeEngine": {
23047
- capName: "pipeline-executor",
23048
- capScope: "system",
23049
- addonId: null,
23050
- access: "create"
23051
- },
23052
23516
  "pipelineExecutor.runAudioTest": {
23053
23517
  capName: "pipeline-executor",
23054
23518
  capScope: "system",
@@ -23199,6 +23663,12 @@ Object.freeze({
23199
23663
  addonId: null,
23200
23664
  access: "view"
23201
23665
  },
23666
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23667
+ capName: "pipeline-orchestrator",
23668
+ capScope: "system",
23669
+ addonId: null,
23670
+ access: "view"
23671
+ },
23202
23672
  "pipelineOrchestrator.getPipelineAssignment": {
23203
23673
  capName: "pipeline-orchestrator",
23204
23674
  capScope: "system",
@@ -23211,6 +23681,12 @@ Object.freeze({
23211
23681
  addonId: null,
23212
23682
  access: "view"
23213
23683
  },
23684
+ "pipelineOrchestrator.getPipelineDevicePin": {
23685
+ capName: "pipeline-orchestrator",
23686
+ capScope: "system",
23687
+ addonId: null,
23688
+ access: "view"
23689
+ },
23214
23690
  "pipelineOrchestrator.listAgentSettings": {
23215
23691
  capName: "pipeline-orchestrator",
23216
23692
  capScope: "system",
@@ -23253,19 +23729,19 @@ Object.freeze({
23253
23729
  addonId: null,
23254
23730
  access: "create"
23255
23731
  },
23256
- "pipelineOrchestrator.setAgentAddonDefaults": {
23732
+ "pipelineOrchestrator.setAgentCapabilities": {
23257
23733
  capName: "pipeline-orchestrator",
23258
23734
  capScope: "system",
23259
23735
  addonId: null,
23260
23736
  access: "create"
23261
23737
  },
23262
- "pipelineOrchestrator.setAgentCapabilities": {
23738
+ "pipelineOrchestrator.setAgentDetectWeight": {
23263
23739
  capName: "pipeline-orchestrator",
23264
23740
  capScope: "system",
23265
23741
  addonId: null,
23266
23742
  access: "create"
23267
23743
  },
23268
- "pipelineOrchestrator.setAgentDetectWeight": {
23744
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23269
23745
  capName: "pipeline-orchestrator",
23270
23746
  capScope: "system",
23271
23747
  addonId: null,
@@ -23307,6 +23783,12 @@ Object.freeze({
23307
23783
  addonId: null,
23308
23784
  access: "create"
23309
23785
  },
23786
+ "pipelineOrchestrator.setPipelineDevicePin": {
23787
+ capName: "pipeline-orchestrator",
23788
+ capScope: "system",
23789
+ addonId: null,
23790
+ access: "create"
23791
+ },
23310
23792
  "pipelineOrchestrator.unassignAudio": {
23311
23793
  capName: "pipeline-orchestrator",
23312
23794
  capScope: "system",
@@ -24859,32 +25341,6 @@ Object.freeze({
24859
25341
  "network-access": "ingress",
24860
25342
  "smtp-provider": "email"
24861
25343
  });
24862
- var frameworkSwapPackageSchema = object({
24863
- name: string(),
24864
- stagedPath: string(),
24865
- backupPath: string(),
24866
- toVersion: string(),
24867
- fromVersion: string().nullable()
24868
- });
24869
- object({
24870
- jobId: string(),
24871
- taskId: string(),
24872
- packages: array(frameworkSwapPackageSchema),
24873
- requestedAtMs: number(),
24874
- schemaVersion: literal(1)
24875
- });
24876
- object({
24877
- jobId: string(),
24878
- taskId: string(),
24879
- backups: array(object({
24880
- name: string(),
24881
- backupPath: string(),
24882
- livePath: string()
24883
- })),
24884
- appliedAtMs: number(),
24885
- bootAttempts: number(),
24886
- schemaVersion: literal(1)
24887
- });
24888
25344
  /**
24889
25345
  * Deterministic SHA-256 hash of an arbitrary serialisable value. The
24890
25346
  * canonical form sorts object keys alphabetically at every depth so two