@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.
@@ -7104,6 +7104,17 @@ var ModelCatalogEntrySchema = object({
7104
7104
  "imagenet",
7105
7105
  "none"
7106
7106
  ]).optional(),
7107
+ /**
7108
+ * The model already applies softmax IN-GRAPH — its raw output is a
7109
+ * probability distribution, not logits. When set, the `softmax`
7110
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7111
+ * probability vector collapses it toward uniform (top-1 score craters far
7112
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7113
+ * the output is raw logits and the postprocessor applies softmax (the normal
7114
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7115
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7116
+ */
7117
+ outputProbabilities: boolean().optional(),
7107
7118
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7108
7119
  /**
7109
7120
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7717,6 +7728,160 @@ function pickClosestResolution(entries, target) {
7717
7728
  }
7718
7729
  return bestAbove?.entry ?? bestBelow?.entry;
7719
7730
  }
7731
+ var COCO_TO_MACRO = {
7732
+ mapping: {
7733
+ person: "person",
7734
+ bicycle: "vehicle",
7735
+ car: "vehicle",
7736
+ motorcycle: "vehicle",
7737
+ airplane: "vehicle",
7738
+ bus: "vehicle",
7739
+ train: "vehicle",
7740
+ truck: "vehicle",
7741
+ boat: "vehicle",
7742
+ bird: "animal",
7743
+ cat: "animal",
7744
+ dog: "animal",
7745
+ horse: "animal",
7746
+ sheep: "animal",
7747
+ cow: "animal",
7748
+ elephant: "animal",
7749
+ bear: "animal",
7750
+ zebra: "animal",
7751
+ giraffe: "animal",
7752
+ suitcase: "package",
7753
+ backpack: "package",
7754
+ handbag: "package"
7755
+ },
7756
+ preserveOriginal: false
7757
+ };
7758
+ var AUDIO_MACRO_LABELS = [
7759
+ {
7760
+ id: "speech",
7761
+ name: "Speech",
7762
+ icon: "🗣️"
7763
+ },
7764
+ {
7765
+ id: "scream",
7766
+ name: "Scream / Shout",
7767
+ icon: "😱"
7768
+ },
7769
+ {
7770
+ id: "crying",
7771
+ name: "Crying / Baby",
7772
+ icon: "😢"
7773
+ },
7774
+ {
7775
+ id: "laughter",
7776
+ name: "Laughter",
7777
+ icon: "😂"
7778
+ },
7779
+ {
7780
+ id: "music",
7781
+ name: "Music",
7782
+ icon: "🎵"
7783
+ },
7784
+ {
7785
+ id: "dog",
7786
+ name: "Dog",
7787
+ icon: "🐕"
7788
+ },
7789
+ {
7790
+ id: "cat",
7791
+ name: "Cat",
7792
+ icon: "🐈"
7793
+ },
7794
+ {
7795
+ id: "bird",
7796
+ name: "Bird",
7797
+ icon: "🐦"
7798
+ },
7799
+ {
7800
+ id: "animal",
7801
+ name: "Animal (other)",
7802
+ icon: "🐾"
7803
+ },
7804
+ {
7805
+ id: "alarm",
7806
+ name: "Alarm / Siren",
7807
+ icon: "🚨"
7808
+ },
7809
+ {
7810
+ id: "doorbell",
7811
+ name: "Doorbell / Knock",
7812
+ icon: "🔔"
7813
+ },
7814
+ {
7815
+ id: "glass_breaking",
7816
+ name: "Glass Breaking",
7817
+ icon: "💥"
7818
+ },
7819
+ {
7820
+ id: "gunshot",
7821
+ name: "Gunshot / Explosion",
7822
+ icon: "💣"
7823
+ },
7824
+ {
7825
+ id: "vehicle",
7826
+ name: "Vehicle",
7827
+ icon: "🚗"
7828
+ },
7829
+ {
7830
+ id: "siren",
7831
+ name: "Emergency Siren",
7832
+ icon: "🚑"
7833
+ },
7834
+ {
7835
+ id: "fire",
7836
+ name: "Fire / Smoke",
7837
+ icon: "🔥"
7838
+ },
7839
+ {
7840
+ id: "water",
7841
+ name: "Water",
7842
+ icon: "💧"
7843
+ },
7844
+ {
7845
+ id: "wind",
7846
+ name: "Wind / Weather",
7847
+ icon: "🌬️"
7848
+ },
7849
+ {
7850
+ id: "door",
7851
+ name: "Door",
7852
+ icon: "🚪"
7853
+ },
7854
+ {
7855
+ id: "footsteps",
7856
+ name: "Footsteps",
7857
+ icon: "👣"
7858
+ },
7859
+ {
7860
+ id: "crowd",
7861
+ name: "Crowd / Chatter",
7862
+ icon: "👥"
7863
+ },
7864
+ {
7865
+ id: "telephone",
7866
+ name: "Telephone",
7867
+ icon: "📞"
7868
+ },
7869
+ {
7870
+ id: "engine",
7871
+ name: "Engine / Motor",
7872
+ icon: "⚙️"
7873
+ },
7874
+ {
7875
+ id: "tools",
7876
+ name: "Tools / Construction",
7877
+ icon: "🔨"
7878
+ },
7879
+ {
7880
+ id: "silence",
7881
+ name: "Silence",
7882
+ icon: "🤫"
7883
+ }
7884
+ ];
7720
7885
  var YAMNET_TO_MACRO = {
7721
7886
  mapping: {
7722
7887
  Speech: "speech",
@@ -7983,6 +8148,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7983
8148
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7984
8149
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7985
8150
  /**
8151
+ * Unified event-kind taxonomy — THE single source of truth for
8152
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8153
+ * icon }`.
8154
+ *
8155
+ * This dictionary folds together what used to be scattered across four
8156
+ * copies:
8157
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8158
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8159
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8160
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8161
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8162
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8163
+ *
8164
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8165
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8166
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8167
+ * color or an icon: they read this dictionary (server descriptors carry the
8168
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8169
+ *
8170
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8171
+ */
8172
+ var TAXONOMY_COLORS = {
8173
+ motion: "#f59e0b",
8174
+ audio: "#06b6d4",
8175
+ person: "#22c55e",
8176
+ vehicle: "#3b82f6",
8177
+ animal: "#f97316",
8178
+ package: "#a855f7",
8179
+ sensor: "#8b5cf6",
8180
+ control: "#10b981",
8181
+ genericDetection: "#64748b"
8182
+ };
8183
+ var DETECTION_SUB_COLORS = {
8184
+ car: "#f59e0b",
8185
+ truck: "#d97706",
8186
+ bus: "#b45309",
8187
+ motorcycle: "#eab308",
8188
+ bicycle: "#ca8a04",
8189
+ airplane: "#60a5fa",
8190
+ boat: "#2563eb",
8191
+ train: "#1d4ed8",
8192
+ bird: "#14b8a6",
8193
+ dog: "#84cc16",
8194
+ cat: "#f97316",
8195
+ horse: "#a16207",
8196
+ sheep: "#a3a3a3",
8197
+ cow: "#78716c",
8198
+ elephant: "#6b7280",
8199
+ bear: "#7c2d12",
8200
+ zebra: "#404040",
8201
+ giraffe: "#d4a373"
8202
+ };
8203
+ function titleCase(id) {
8204
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8205
+ }
8206
+ var entries = /* @__PURE__ */ new Map();
8207
+ function macro(kind, category, color, iconId, label) {
8208
+ entries.set(kind, {
8209
+ kind,
8210
+ parentKind: null,
8211
+ level: "macro",
8212
+ category,
8213
+ color,
8214
+ iconId,
8215
+ labelKey: `eventKind.${kind}`,
8216
+ label
8217
+ });
8218
+ }
8219
+ function sub(kind, parentKind, category, color, iconId, label) {
8220
+ entries.set(kind, {
8221
+ kind,
8222
+ parentKind,
8223
+ level: "sub",
8224
+ category,
8225
+ color,
8226
+ iconId,
8227
+ labelKey: `eventKind.${kind}`,
8228
+ label
8229
+ });
8230
+ }
8231
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8232
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8233
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8234
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8235
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8236
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8237
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8238
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8239
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8240
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8241
+ if (entries.has(cocoClass)) continue;
8242
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8243
+ }
8244
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8245
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8246
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8247
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8248
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8249
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8250
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8251
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8252
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8253
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8254
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8255
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8256
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8257
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8258
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8259
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8260
+ sub("button", "control", "control", "#10b981", "button", "Button");
8261
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8262
+ for (const l of AUDIO_MACRO_LABELS) {
8263
+ const kind = `audio-${l.id}`;
8264
+ if (entries.has(kind)) continue;
8265
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8266
+ }
8267
+ /** The complete taxonomy dictionary, keyed by kind. */
8268
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8269
+ /**
7986
8270
  * Error types for the safe expression engine. Two distinct classes so callers
7987
8271
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7988
8272
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10898,10 +11182,7 @@ var ConfigUISchemaNullableBridge = custom();
10898
11182
  var InferenceCapabilitiesBridge = custom();
10899
11183
  var ModelAvailabilityListBridge = custom();
10900
11184
  var PipelineRunResultBridge = custom();
10901
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10902
- kind: "mutation",
10903
- auth: "admin"
10904
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11185
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10905
11186
  modelId: string(),
10906
11187
  settings: record(string(), unknown()).readonly()
10907
11188
  }))), method(object({ steps: record(string(), object({
@@ -10961,13 +11242,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10961
11242
  * (inputClasses ≠ null) are skipped and served per-track via
10962
11243
  * pipelineRunner.runDetailSubtree (two-plane design).
10963
11244
  */
10964
- plane: _enum(["full", "frame"]).optional()
11245
+ plane: _enum(["full", "frame"]).optional(),
11246
+ /**
11247
+ * Inference-device selector (Phase 2 multi-device). Format
11248
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11249
+ * Omitted ⇒ the runner's default device (current single-engine
11250
+ * behaviour). Selects WHICH device pool of the node runs the call.
11251
+ */
11252
+ deviceKey: string().optional()
10965
11253
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10966
11254
  engine: PipelineEngineChoiceSchema.optional(),
10967
11255
  steps: array(PipelineStepInputSchema).min(1),
10968
11256
  frames: array(FrameInputSchema).min(1).max(255),
10969
11257
  deviceId: number().optional(),
10970
- sessionId: string().optional()
11258
+ sessionId: string().optional(),
11259
+ /**
11260
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11261
+ * the batch to the Python pool's bench preprocess cache
11262
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11263
+ * preprocessed ONCE and every later inference is a pure-inference cache
11264
+ * hit — the sustained-throughput run measures inference, not
11265
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11266
+ * full preprocess every call, correct). Fresh per sustained run;
11267
+ * released via `uncacheFrame`.
11268
+ */
11269
+ frameId: number().int().nonnegative().optional(),
11270
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11271
+ deviceKey: string().optional()
10971
11272
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10972
11273
  data: _instanceof(Uint8Array),
10973
11274
  width: number().int().positive(),
@@ -10999,8 +11300,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10999
11300
  * - `runtime` — main camera-serving engine (no idle TTL).
11000
11301
  * - `warm-override` — benchmark/test override held in the warm
11001
11302
  * cache; auto-disposed after the idle TTL.
11303
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11304
+ * multi-device, keyed by `deviceKey`) resolved
11305
+ * via `resolveDeviceFactory`. Runs alongside the
11306
+ * `runtime` engine on a DIFFERENT accelerator
11307
+ * (NPU / iGPU / Coral) — this is how the
11308
+ * Engines tab shows all pools running at once.
11002
11309
  */
11003
- kind: _enum(["runtime", "warm-override"]),
11310
+ kind: _enum([
11311
+ "runtime",
11312
+ "warm-override",
11313
+ "device-pool"
11314
+ ]),
11004
11315
  /** Native pid of the underlying Python pool (null when no pool). */
11005
11316
  poolPid: number().nullable(),
11006
11317
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11342,7 +11653,14 @@ var RunnerCameraConfigSchema = object({
11342
11653
  * camera's detect node differs from its source-owner (P2d, gated by the
11343
11654
  * `remoteSourcingNodes` rollout setting).
11344
11655
  */
11345
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11656
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11657
+ /**
11658
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11659
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11660
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11661
+ * this only selects WHICH device pool of that node runs the session.
11662
+ */
11663
+ deviceKey: string().optional()
11346
11664
  });
11347
11665
  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;
11348
11666
  /**
@@ -11363,6 +11681,19 @@ var RunnerLocalLoadSchema = object({
11363
11681
  avgInferenceTimeMs: number(),
11364
11682
  /** Total queue depth across motion + detection queues. */
11365
11683
  queueDepthTotal: number(),
11684
+ /**
11685
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11686
+ * this runner currently has attached cameras on, so the orchestrator's second
11687
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11688
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11689
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11690
+ */
11691
+ devices: array(object({
11692
+ deviceKey: string(),
11693
+ backend: string(),
11694
+ attachedCameras: number(),
11695
+ queueDepthTotal: number()
11696
+ })).default([]),
11366
11697
  /** Hardware capability flags reported by this node. */
11367
11698
  hardware: object({
11368
11699
  hasGpu: boolean(),
@@ -12838,6 +13169,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12838
13169
  kind: "mutation",
12839
13170
  auth: "admin"
12840
13171
  });
13172
+ 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;
13173
+ new Set(Object.values(DeviceType));
12841
13174
  /**
12842
13175
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12843
13176
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15957,17 +16290,30 @@ var EventKindCategorySchema = _enum([
15957
16290
  "audio",
15958
16291
  "detection",
15959
16292
  "sensor",
16293
+ "control",
15960
16294
  "custom",
15961
16295
  "package"
15962
16296
  ]);
16297
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16298
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15963
16299
  var EventKindDescriptorSchema = object({
15964
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16300
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15965
16301
  kind: string(),
16302
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16303
+ labelKey: string(),
16304
+ /** English fallback label (kept for clients that don't translate). */
15966
16305
  label: string(),
15967
16306
  /** Hex color for timeline/legend rendering. */
15968
16307
  color: string(),
16308
+ /** Dictionary id → lucide component on the UI side. */
16309
+ iconId: string(),
16310
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15969
16311
  icon: EventKindIconSchema,
15970
16312
  category: EventKindCategorySchema,
16313
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16314
+ parentKind: string().nullable(),
16315
+ /** Derived from `parentKind`, explicit for the client tree. */
16316
+ level: EventKindLevelSchema,
15971
16317
  /** Which cap + device contributes this kind. For built-ins the camera
15972
16318
  * itself; for sensor kinds the LINKED source device. */
15973
16319
  source: object({
@@ -16040,11 +16386,21 @@ var TrackAudioLabelSchema = object({
16040
16386
  firstAt: number(),
16041
16387
  lastAt: number()
16042
16388
  });
16389
+ /**
16390
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16391
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16392
+ * linked sensor/control state change (no positions; carries a snapshot). The
16393
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16394
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16395
+ */
16396
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16043
16397
  var TrackSchema = object({
16044
16398
  trackId: string(),
16045
16399
  deviceId: number(),
16046
16400
  className: string(),
16047
16401
  label: string().optional(),
16402
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16403
+ source: TrackSourceSchema.optional(),
16048
16404
  firstSeen: number(),
16049
16405
  lastSeen: number(),
16050
16406
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16421,6 +16777,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16421
16777
  eventId: string(),
16422
16778
  timestamp: number()
16423
16779
  });
16780
+ /**
16781
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16782
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16783
+ * caps into per-camera event-kind descriptors.
16784
+ *
16785
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16786
+ * is NOT duplicated here — every entry is derived from the single
16787
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16788
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16789
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16790
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16791
+ * eventful cap is missing.
16792
+ */
16793
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16794
+ var LEGACY_ICON = {
16795
+ motion: "motion",
16796
+ audio: "audio",
16797
+ person: "person",
16798
+ vehicle: "vehicle",
16799
+ animal: "animal",
16800
+ package: "package",
16801
+ door: "door",
16802
+ pir: "pir",
16803
+ smoke: "smoke",
16804
+ water: "water",
16805
+ button: "button",
16806
+ generic: "generic",
16807
+ gas: "smoke",
16808
+ vibration: "generic",
16809
+ tamper: "generic",
16810
+ presence: "person",
16811
+ lock: "generic",
16812
+ siren: "generic",
16813
+ switch: "generic",
16814
+ doorbell: "button"
16815
+ };
16816
+ function legacyIcon(iconId) {
16817
+ return LEGACY_ICON[iconId] ?? "generic";
16818
+ }
16819
+ /**
16820
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16821
+ * The anti-drift guard cross-checks this against the eventful caps declared
16822
+ * in `packages/types/src/capabilities/*.cap.ts`.
16823
+ */
16824
+ var CAP_TO_KIND = {
16825
+ contact: "contact",
16826
+ motion: "motion-sensor",
16827
+ smoke: "smoke",
16828
+ flood: "flood",
16829
+ gas: "gas",
16830
+ "carbon-monoxide": "carbon-monoxide",
16831
+ vibration: "vibration",
16832
+ tamper: "tamper",
16833
+ presence: "presence",
16834
+ "enum-sensor": "enum-sensor",
16835
+ "event-emitter": "device-event",
16836
+ "lock-control": "lock",
16837
+ switch: "switch",
16838
+ button: "button",
16839
+ doorbell: "doorbell"
16840
+ };
16841
+ function buildDescriptor(capName, kind) {
16842
+ const t = EVENT_TAXONOMY[kind];
16843
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16844
+ return {
16845
+ ...t,
16846
+ icon: legacyIcon(t.iconId)
16847
+ };
16848
+ }
16849
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16424
16850
  var CameraPipelineConfigSchema = object({
16425
16851
  engine: PipelineEngineChoiceSchema.optional(),
16426
16852
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16439,13 +16865,11 @@ var PipelineTemplateSchema = object({
16439
16865
  createdAt: string(),
16440
16866
  updatedAt: string()
16441
16867
  });
16442
- var AgentAddonConfigSchema = object({
16443
- enabled: boolean(),
16868
+ var DeviceStepConfigSchema = object({
16444
16869
  modelId: string().optional(),
16445
- settings: record(string(), unknown()).readonly()
16870
+ settings: record(string(), unknown()).optional()
16446
16871
  });
16447
16872
  var AgentPipelineSettingsSchema = object({
16448
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16449
16873
  maxCameras: number().int().nonnegative().nullable().default(null),
16450
16874
  /** Per-node detection weight (relative share for the quota balancer). */
16451
16875
  detectWeight: number().positive().optional(),
@@ -16469,7 +16893,22 @@ var AgentPipelineSettingsSchema = object({
16469
16893
  * it already uses to reach the hub). Set this only when the auto-detected
16470
16894
  * address is wrong (multi-homed host, NAT, custom interface).
16471
16895
  */
16472
- reachableHost: string().optional()
16896
+ reachableHost: string().optional(),
16897
+ /**
16898
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16899
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16900
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16901
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16902
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16903
+ * the default model/settings for every camera landing on that accelerator;
16904
+ * a stepId absent ⇒ the step uses that device's format default.
16905
+ */
16906
+ inferenceDevices: record(string(), object({
16907
+ enabled: boolean(),
16908
+ weight: number().positive().optional(),
16909
+ maxSessions: number().int().positive().optional(),
16910
+ steps: record(string(), DeviceStepConfigSchema).optional()
16911
+ })).optional()
16473
16912
  });
16474
16913
  var CameraPipelineForAgentSchema = object({
16475
16914
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16479,14 +16918,13 @@ var CameraPipelineForAgentSchema = object({
16479
16918
  }).nullable()
16480
16919
  });
16481
16920
  var CameraStepOverridePatchSchema = object({
16482
- enabled: boolean().optional(),
16483
16921
  modelId: string().optional(),
16484
16922
  settings: record(string(), unknown()).readonly().optional()
16485
16923
  });
16486
16924
  var CameraPipelineSettingsSchema = object({
16487
16925
  pinnedAgentNodeId: string().optional(),
16488
16926
  stepToggles: record(string(), boolean()).optional(),
16489
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16927
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16490
16928
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16491
16929
  });
16492
16930
  /**
@@ -16700,6 +17138,44 @@ var CameraStatusSchema = object({
16700
17138
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16701
17139
  fetchedAt: number()
16702
17140
  });
17141
+ var NodeInferenceDeviceSchema = object({
17142
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17143
+ key: string(),
17144
+ backend: string(),
17145
+ device: string(),
17146
+ format: _enum(MODEL_FORMATS),
17147
+ /** Whether the node's live probe reports the device as usable right now. */
17148
+ available: boolean(),
17149
+ /**
17150
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17151
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17152
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17153
+ * not a balanced target). An explicit stored value always wins; a stored-only
17154
+ * (unavailable) key keeps its stored value.
17155
+ */
17156
+ enabled: boolean(),
17157
+ /** Relative balancer weight for the enabled device (default 1). */
17158
+ weight: number(),
17159
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17160
+ maxSessions: number().nullable(),
17161
+ /** Object-detection model the executor defaults to for this deviceKey. */
17162
+ defaultModelId: string(),
17163
+ /**
17164
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17165
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17166
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17167
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17168
+ * available per format; this is the stored selection that becomes the
17169
+ * default for EVERY camera landing on this accelerator.
17170
+ */
17171
+ steps: record(string(), DeviceStepConfigSchema).optional()
17172
+ });
17173
+ var NodeInferenceDevicesSchema = object({
17174
+ nodeId: string(),
17175
+ /** False when the node's platform-probe was unreachable (no live device set). */
17176
+ reachable: boolean(),
17177
+ devices: array(NodeInferenceDeviceSchema).readonly()
17178
+ });
16703
17179
  method(object({
16704
17180
  deviceId: number(),
16705
17181
  agentNodeId: string()
@@ -16709,7 +17185,13 @@ method(object({
16709
17185
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16710
17186
  kind: "mutation",
16711
17187
  auth: "admin"
16712
- }), method(_void(), object({ migrated: number() }), {
17188
+ }), method(object({
17189
+ deviceId: number(),
17190
+ deviceKey: string()
17191
+ }), object({ success: literal(true) }), {
17192
+ kind: "mutation",
17193
+ auth: "admin"
17194
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16713
17195
  kind: "mutation",
16714
17196
  auth: "admin"
16715
17197
  }), 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({
@@ -16743,13 +17225,7 @@ method(object({
16743
17225
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16744
17226
  nodeId: string(),
16745
17227
  settings: AgentPipelineSettingsSchema
16746
- })).readonly()), method(object({
16747
- agentNodeId: string(),
16748
- defaults: record(string(), AgentAddonConfigSchema)
16749
- }), object({ success: literal(true) }), {
16750
- kind: "mutation",
16751
- auth: "admin"
16752
- }), method(object({ agentNodeId: string() }), object({
17228
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16753
17229
  success: boolean(),
16754
17230
  removed: boolean()
16755
17231
  }), {
@@ -16781,7 +17257,18 @@ method(object({
16781
17257
  }), object({ success: literal(true) }), {
16782
17258
  kind: "mutation",
16783
17259
  auth: "admin"
16784
- }), method(object({ agentNodeId: string() }), object({
17260
+ }), method(object({
17261
+ agentNodeId: string(),
17262
+ inferenceDevices: record(string(), object({
17263
+ enabled: boolean(),
17264
+ weight: number().positive().optional(),
17265
+ maxSessions: number().int().positive().optional(),
17266
+ steps: record(string(), DeviceStepConfigSchema).optional()
17267
+ }))
17268
+ }), object({ success: literal(true) }), {
17269
+ kind: "mutation",
17270
+ auth: "admin"
17271
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16785
17272
  success: literal(true),
16786
17273
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16787
17274
  effectiveModelId: string().nullable(),
@@ -16797,9 +17284,10 @@ method(object({
16797
17284
  }), object({ success: literal(true) }), {
16798
17285
  kind: "mutation",
16799
17286
  auth: "admin"
16800
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17287
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16801
17288
  deviceId: number(),
16802
17289
  agentNodeId: string(),
17290
+ deviceKey: string(),
16803
17291
  addonId: string(),
16804
17292
  patch: CameraStepOverridePatchSchema.nullable()
16805
17293
  }), object({ success: literal(true) }), {
@@ -16836,14 +17324,13 @@ method(object({
16836
17324
  });
16837
17325
  /**
16838
17326
  * server-management — per-NODE singleton capability for a node's ROOT
16839
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16840
- * agents).
17327
+ * package lifecycle (runtime-updatable node packages).
16841
17328
  *
16842
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16843
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16844
- * version describes the node. Updates install into
16845
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16846
- * starter (probation boot + auto-rollback to N-1).
17329
+ * Every node role runs the SAME root package (`@camstack/server`), which
17330
+ * carries the whole software stack in its npm dep tree, so ONE version
17331
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17332
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17333
+ * no auto-rollback).
16847
17334
  *
16848
17335
  * Providers:
16849
17336
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16951,7 +17438,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16951
17438
  /** Explicit target version; omitted = latest from the registry. */
16952
17439
  version: string().optional() }), ServerUpdateActionResultSchema, {
16953
17440
  kind: "mutation",
16954
- auth: "admin"
17441
+ auth: "admin",
17442
+ timeoutMs: 16 * 6e4
16955
17443
  }), method(_void(), ServerUpdateActionResultSchema, {
16956
17444
  kind: "mutation",
16957
17445
  auth: "admin"
@@ -17995,22 +18483,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17995
18483
  var RestartAddonResultSchema = unknown();
17996
18484
  var InstallPackageResultSchema = unknown();
17997
18485
  var ReloadPackagesResultSchema = unknown();
17998
- /**
17999
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
18000
- * server restarts so the admin UI can react to the `restartingAt`
18001
- * timestamp (shows reconnect overlay). The transition from
18002
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
18003
- * `system.restart-completed` event after the new process boots.
18004
- *
18005
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
18006
- */
18007
- var UpdateFrameworkPackageResultSchema = object({
18008
- packageName: string(),
18009
- fromVersion: string(),
18010
- toVersion: string(),
18011
- /** Ms-epoch the server scheduled its self-restart. */
18012
- restartingAt: number()
18013
- });
18014
18486
  var BulkUpdateItemStatusSchema = _enum([
18015
18487
  "queued",
18016
18488
  "updating",
@@ -18138,13 +18610,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18138
18610
  }), object({ success: literal(true) }), {
18139
18611
  kind: "mutation",
18140
18612
  auth: "admin"
18141
- }), method(object({
18142
- packageName: string().min(1),
18143
- version: string().optional(),
18144
- deferRestart: boolean().optional()
18145
- }), UpdateFrameworkPackageResultSchema, {
18146
- kind: "mutation",
18147
- auth: "admin"
18148
18613
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18149
18614
  kind: "mutation",
18150
18615
  auth: "admin"
@@ -19010,10 +19475,10 @@ var TopologyCategorySchema = object({
19010
19475
  addons: array(TopologyCategoryAddonSchema).readonly()
19011
19476
  });
19012
19477
  /**
19013
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
19014
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
19015
- * version visibility for the Server management surface. Nullable: offline
19016
- * rows and pre-phase-2 nodes report none.
19478
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19479
+ * root package for every node role) as reported by its `registerNode`
19480
+ * manifest — version visibility for the Server management surface. Nullable:
19481
+ * offline rows and nodes that never reported one.
19017
19482
  */
19018
19483
  var TopologyRootPackageSchema = object({
19019
19484
  name: string(),
@@ -19401,17 +19866,28 @@ var PlatformScoreSchema = object({
19401
19866
  format: _enum([
19402
19867
  "onnx",
19403
19868
  "coreml",
19404
- "openvino"
19869
+ "openvino",
19870
+ "tflite"
19405
19871
  ]),
19406
19872
  score: number(),
19407
19873
  reason: string(),
19408
19874
  available: boolean()
19409
19875
  });
19876
+ var InferenceDeviceDescriptorSchema = object({
19877
+ key: string(),
19878
+ backend: string(),
19879
+ device: string(),
19880
+ format: ModelFormatSchema,
19881
+ runtime: literal("python"),
19882
+ score: number(),
19883
+ available: boolean()
19884
+ });
19410
19885
  var PlatformCapabilitiesSchema = object({
19411
19886
  hardware: HardwareInfoSchema,
19412
19887
  scores: array(PlatformScoreSchema).readonly(),
19413
19888
  bestScore: PlatformScoreSchema,
19414
- pythonPath: string().nullable()
19889
+ pythonPath: string().nullable(),
19890
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19415
19891
  });
19416
19892
  var ModelRequirementSchema = object({
19417
19893
  modelId: string(),
@@ -20290,12 +20766,6 @@ Object.freeze({
20290
20766
  addonId: null,
20291
20767
  access: "delete"
20292
20768
  },
20293
- "addons.updateFrameworkPackage": {
20294
- capName: "addons",
20295
- capScope: "system",
20296
- addonId: null,
20297
- access: "create"
20298
- },
20299
20769
  "addons.updatePackage": {
20300
20770
  capName: "addons",
20301
20771
  capScope: "system",
@@ -23068,12 +23538,6 @@ Object.freeze({
23068
23538
  addonId: null,
23069
23539
  access: "view"
23070
23540
  },
23071
- "pipelineExecutor.reprobeEngine": {
23072
- capName: "pipeline-executor",
23073
- capScope: "system",
23074
- addonId: null,
23075
- access: "create"
23076
- },
23077
23541
  "pipelineExecutor.runAudioTest": {
23078
23542
  capName: "pipeline-executor",
23079
23543
  capScope: "system",
@@ -23224,6 +23688,12 @@ Object.freeze({
23224
23688
  addonId: null,
23225
23689
  access: "view"
23226
23690
  },
23691
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23692
+ capName: "pipeline-orchestrator",
23693
+ capScope: "system",
23694
+ addonId: null,
23695
+ access: "view"
23696
+ },
23227
23697
  "pipelineOrchestrator.getPipelineAssignment": {
23228
23698
  capName: "pipeline-orchestrator",
23229
23699
  capScope: "system",
@@ -23236,6 +23706,12 @@ Object.freeze({
23236
23706
  addonId: null,
23237
23707
  access: "view"
23238
23708
  },
23709
+ "pipelineOrchestrator.getPipelineDevicePin": {
23710
+ capName: "pipeline-orchestrator",
23711
+ capScope: "system",
23712
+ addonId: null,
23713
+ access: "view"
23714
+ },
23239
23715
  "pipelineOrchestrator.listAgentSettings": {
23240
23716
  capName: "pipeline-orchestrator",
23241
23717
  capScope: "system",
@@ -23278,19 +23754,19 @@ Object.freeze({
23278
23754
  addonId: null,
23279
23755
  access: "create"
23280
23756
  },
23281
- "pipelineOrchestrator.setAgentAddonDefaults": {
23757
+ "pipelineOrchestrator.setAgentCapabilities": {
23282
23758
  capName: "pipeline-orchestrator",
23283
23759
  capScope: "system",
23284
23760
  addonId: null,
23285
23761
  access: "create"
23286
23762
  },
23287
- "pipelineOrchestrator.setAgentCapabilities": {
23763
+ "pipelineOrchestrator.setAgentDetectWeight": {
23288
23764
  capName: "pipeline-orchestrator",
23289
23765
  capScope: "system",
23290
23766
  addonId: null,
23291
23767
  access: "create"
23292
23768
  },
23293
- "pipelineOrchestrator.setAgentDetectWeight": {
23769
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23294
23770
  capName: "pipeline-orchestrator",
23295
23771
  capScope: "system",
23296
23772
  addonId: null,
@@ -23332,6 +23808,12 @@ Object.freeze({
23332
23808
  addonId: null,
23333
23809
  access: "create"
23334
23810
  },
23811
+ "pipelineOrchestrator.setPipelineDevicePin": {
23812
+ capName: "pipeline-orchestrator",
23813
+ capScope: "system",
23814
+ addonId: null,
23815
+ access: "create"
23816
+ },
23335
23817
  "pipelineOrchestrator.unassignAudio": {
23336
23818
  capName: "pipeline-orchestrator",
23337
23819
  capScope: "system",
@@ -24884,32 +25366,6 @@ Object.freeze({
24884
25366
  "network-access": "ingress",
24885
25367
  "smtp-provider": "email"
24886
25368
  });
24887
- var frameworkSwapPackageSchema = object({
24888
- name: string(),
24889
- stagedPath: string(),
24890
- backupPath: string(),
24891
- toVersion: string(),
24892
- fromVersion: string().nullable()
24893
- });
24894
- object({
24895
- jobId: string(),
24896
- taskId: string(),
24897
- packages: array(frameworkSwapPackageSchema),
24898
- requestedAtMs: number(),
24899
- schemaVersion: literal(1)
24900
- });
24901
- object({
24902
- jobId: string(),
24903
- taskId: string(),
24904
- backups: array(object({
24905
- name: string(),
24906
- backupPath: string(),
24907
- livePath: string()
24908
- })),
24909
- appliedAtMs: number(),
24910
- bootAttempts: number(),
24911
- schemaVersion: literal(1)
24912
- });
24913
25369
  /**
24914
25370
  * Deterministic SHA-256 hash of an arbitrary serialisable value. The
24915
25371
  * canonical form sorts object keys alphabetically at every depth so two