@camstack/addon-notifiers 1.1.29 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +560 -104
  2. package/dist/addon.mjs +560 -104
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7072,6 +7072,17 @@ var ModelCatalogEntrySchema = object({
7072
7072
  "imagenet",
7073
7073
  "none"
7074
7074
  ]).optional(),
7075
+ /**
7076
+ * The model already applies softmax IN-GRAPH — its raw output is a
7077
+ * probability distribution, not logits. When set, the `softmax`
7078
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7079
+ * probability vector collapses it toward uniform (top-1 score craters far
7080
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7081
+ * the output is raw logits and the postprocessor applies softmax (the normal
7082
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7083
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7084
+ */
7085
+ outputProbabilities: boolean().optional(),
7075
7086
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7076
7087
  /**
7077
7088
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7748,6 +7759,160 @@ var EncodeProfileSchema = object({
7748
7759
  */
7749
7760
  outputArgs: array(string()).optional()
7750
7761
  });
7762
+ var COCO_TO_MACRO = {
7763
+ mapping: {
7764
+ person: "person",
7765
+ bicycle: "vehicle",
7766
+ car: "vehicle",
7767
+ motorcycle: "vehicle",
7768
+ airplane: "vehicle",
7769
+ bus: "vehicle",
7770
+ train: "vehicle",
7771
+ truck: "vehicle",
7772
+ boat: "vehicle",
7773
+ bird: "animal",
7774
+ cat: "animal",
7775
+ dog: "animal",
7776
+ horse: "animal",
7777
+ sheep: "animal",
7778
+ cow: "animal",
7779
+ elephant: "animal",
7780
+ bear: "animal",
7781
+ zebra: "animal",
7782
+ giraffe: "animal",
7783
+ suitcase: "package",
7784
+ backpack: "package",
7785
+ handbag: "package"
7786
+ },
7787
+ preserveOriginal: false
7788
+ };
7789
+ var AUDIO_MACRO_LABELS = [
7790
+ {
7791
+ id: "speech",
7792
+ name: "Speech",
7793
+ icon: "🗣️"
7794
+ },
7795
+ {
7796
+ id: "scream",
7797
+ name: "Scream / Shout",
7798
+ icon: "😱"
7799
+ },
7800
+ {
7801
+ id: "crying",
7802
+ name: "Crying / Baby",
7803
+ icon: "😢"
7804
+ },
7805
+ {
7806
+ id: "laughter",
7807
+ name: "Laughter",
7808
+ icon: "😂"
7809
+ },
7810
+ {
7811
+ id: "music",
7812
+ name: "Music",
7813
+ icon: "🎵"
7814
+ },
7815
+ {
7816
+ id: "dog",
7817
+ name: "Dog",
7818
+ icon: "🐕"
7819
+ },
7820
+ {
7821
+ id: "cat",
7822
+ name: "Cat",
7823
+ icon: "🐈"
7824
+ },
7825
+ {
7826
+ id: "bird",
7827
+ name: "Bird",
7828
+ icon: "🐦"
7829
+ },
7830
+ {
7831
+ id: "animal",
7832
+ name: "Animal (other)",
7833
+ icon: "🐾"
7834
+ },
7835
+ {
7836
+ id: "alarm",
7837
+ name: "Alarm / Siren",
7838
+ icon: "🚨"
7839
+ },
7840
+ {
7841
+ id: "doorbell",
7842
+ name: "Doorbell / Knock",
7843
+ icon: "🔔"
7844
+ },
7845
+ {
7846
+ id: "glass_breaking",
7847
+ name: "Glass Breaking",
7848
+ icon: "💥"
7849
+ },
7850
+ {
7851
+ id: "gunshot",
7852
+ name: "Gunshot / Explosion",
7853
+ icon: "💣"
7854
+ },
7855
+ {
7856
+ id: "vehicle",
7857
+ name: "Vehicle",
7858
+ icon: "🚗"
7859
+ },
7860
+ {
7861
+ id: "siren",
7862
+ name: "Emergency Siren",
7863
+ icon: "🚑"
7864
+ },
7865
+ {
7866
+ id: "fire",
7867
+ name: "Fire / Smoke",
7868
+ icon: "🔥"
7869
+ },
7870
+ {
7871
+ id: "water",
7872
+ name: "Water",
7873
+ icon: "💧"
7874
+ },
7875
+ {
7876
+ id: "wind",
7877
+ name: "Wind / Weather",
7878
+ icon: "🌬️"
7879
+ },
7880
+ {
7881
+ id: "door",
7882
+ name: "Door",
7883
+ icon: "🚪"
7884
+ },
7885
+ {
7886
+ id: "footsteps",
7887
+ name: "Footsteps",
7888
+ icon: "👣"
7889
+ },
7890
+ {
7891
+ id: "crowd",
7892
+ name: "Crowd / Chatter",
7893
+ icon: "👥"
7894
+ },
7895
+ {
7896
+ id: "telephone",
7897
+ name: "Telephone",
7898
+ icon: "📞"
7899
+ },
7900
+ {
7901
+ id: "engine",
7902
+ name: "Engine / Motor",
7903
+ icon: "⚙️"
7904
+ },
7905
+ {
7906
+ id: "tools",
7907
+ name: "Tools / Construction",
7908
+ icon: "🔨"
7909
+ },
7910
+ {
7911
+ id: "silence",
7912
+ name: "Silence",
7913
+ icon: "🤫"
7914
+ }
7915
+ ];
7751
7916
  var YAMNET_TO_MACRO = {
7752
7917
  mapping: {
7753
7918
  Speech: "speech",
@@ -8014,6 +8179,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8014
8179
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8015
8180
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8016
8181
  /**
8182
+ * Unified event-kind taxonomy — THE single source of truth for
8183
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8184
+ * icon }`.
8185
+ *
8186
+ * This dictionary folds together what used to be scattered across four
8187
+ * copies:
8188
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8189
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8190
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8191
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8192
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8193
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8194
+ *
8195
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8196
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8197
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8198
+ * color or an icon: they read this dictionary (server descriptors carry the
8199
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8200
+ *
8201
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8202
+ */
8203
+ var TAXONOMY_COLORS = {
8204
+ motion: "#f59e0b",
8205
+ audio: "#06b6d4",
8206
+ person: "#22c55e",
8207
+ vehicle: "#3b82f6",
8208
+ animal: "#f97316",
8209
+ package: "#a855f7",
8210
+ sensor: "#8b5cf6",
8211
+ control: "#10b981",
8212
+ genericDetection: "#64748b"
8213
+ };
8214
+ var DETECTION_SUB_COLORS = {
8215
+ car: "#f59e0b",
8216
+ truck: "#d97706",
8217
+ bus: "#b45309",
8218
+ motorcycle: "#eab308",
8219
+ bicycle: "#ca8a04",
8220
+ airplane: "#60a5fa",
8221
+ boat: "#2563eb",
8222
+ train: "#1d4ed8",
8223
+ bird: "#14b8a6",
8224
+ dog: "#84cc16",
8225
+ cat: "#f97316",
8226
+ horse: "#a16207",
8227
+ sheep: "#a3a3a3",
8228
+ cow: "#78716c",
8229
+ elephant: "#6b7280",
8230
+ bear: "#7c2d12",
8231
+ zebra: "#404040",
8232
+ giraffe: "#d4a373"
8233
+ };
8234
+ function titleCase(id) {
8235
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8236
+ }
8237
+ var entries = /* @__PURE__ */ new Map();
8238
+ function macro(kind, category, color, iconId, label) {
8239
+ entries.set(kind, {
8240
+ kind,
8241
+ parentKind: null,
8242
+ level: "macro",
8243
+ category,
8244
+ color,
8245
+ iconId,
8246
+ labelKey: `eventKind.${kind}`,
8247
+ label
8248
+ });
8249
+ }
8250
+ function sub(kind, parentKind, category, color, iconId, label) {
8251
+ entries.set(kind, {
8252
+ kind,
8253
+ parentKind,
8254
+ level: "sub",
8255
+ category,
8256
+ color,
8257
+ iconId,
8258
+ labelKey: `eventKind.${kind}`,
8259
+ label
8260
+ });
8261
+ }
8262
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8263
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8264
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8265
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8266
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8267
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8268
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8269
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8270
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8271
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8272
+ if (entries.has(cocoClass)) continue;
8273
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8274
+ }
8275
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8276
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8277
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8278
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8279
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8280
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8281
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8282
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8283
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8284
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8285
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8286
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8287
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8288
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8289
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8290
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8291
+ sub("button", "control", "control", "#10b981", "button", "Button");
8292
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8293
+ for (const l of AUDIO_MACRO_LABELS) {
8294
+ const kind = `audio-${l.id}`;
8295
+ if (entries.has(kind)) continue;
8296
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8297
+ }
8298
+ /** The complete taxonomy dictionary, keyed by kind. */
8299
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8300
+ /**
8017
8301
  * Error types for the safe expression engine. Two distinct classes so callers
8018
8302
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8019
8303
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -11122,10 +11406,7 @@ var ConfigUISchemaNullableBridge = custom();
11122
11406
  var InferenceCapabilitiesBridge = custom();
11123
11407
  var ModelAvailabilityListBridge = custom();
11124
11408
  var PipelineRunResultBridge = custom();
11125
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
11126
- kind: "mutation",
11127
- auth: "admin"
11128
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11409
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11129
11410
  modelId: string(),
11130
11411
  settings: record(string(), unknown()).readonly()
11131
11412
  }))), method(object({ steps: record(string(), object({
@@ -11185,13 +11466,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11185
11466
  * (inputClasses ≠ null) are skipped and served per-track via
11186
11467
  * pipelineRunner.runDetailSubtree (two-plane design).
11187
11468
  */
11188
- plane: _enum(["full", "frame"]).optional()
11469
+ plane: _enum(["full", "frame"]).optional(),
11470
+ /**
11471
+ * Inference-device selector (Phase 2 multi-device). Format
11472
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11473
+ * Omitted ⇒ the runner's default device (current single-engine
11474
+ * behaviour). Selects WHICH device pool of the node runs the call.
11475
+ */
11476
+ deviceKey: string().optional()
11189
11477
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
11190
11478
  engine: PipelineEngineChoiceSchema.optional(),
11191
11479
  steps: array(PipelineStepInputSchema).min(1),
11192
11480
  frames: array(FrameInputSchema).min(1).max(255),
11193
11481
  deviceId: number().optional(),
11194
- sessionId: string().optional()
11482
+ sessionId: string().optional(),
11483
+ /**
11484
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11485
+ * the batch to the Python pool's bench preprocess cache
11486
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11487
+ * preprocessed ONCE and every later inference is a pure-inference cache
11488
+ * hit — the sustained-throughput run measures inference, not
11489
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11490
+ * full preprocess every call, correct). Fresh per sustained run;
11491
+ * released via `uncacheFrame`.
11492
+ */
11493
+ frameId: number().int().nonnegative().optional(),
11494
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11495
+ deviceKey: string().optional()
11195
11496
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
11196
11497
  data: _instanceof(Uint8Array),
11197
11498
  width: number().int().positive(),
@@ -11223,8 +11524,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11223
11524
  * - `runtime` — main camera-serving engine (no idle TTL).
11224
11525
  * - `warm-override` — benchmark/test override held in the warm
11225
11526
  * cache; auto-disposed after the idle TTL.
11527
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11528
+ * multi-device, keyed by `deviceKey`) resolved
11529
+ * via `resolveDeviceFactory`. Runs alongside the
11530
+ * `runtime` engine on a DIFFERENT accelerator
11531
+ * (NPU / iGPU / Coral) — this is how the
11532
+ * Engines tab shows all pools running at once.
11226
11533
  */
11227
- kind: _enum(["runtime", "warm-override"]),
11534
+ kind: _enum([
11535
+ "runtime",
11536
+ "warm-override",
11537
+ "device-pool"
11538
+ ]),
11228
11539
  /** Native pid of the underlying Python pool (null when no pool). */
11229
11540
  poolPid: number().nullable(),
11230
11541
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11566,7 +11877,14 @@ var RunnerCameraConfigSchema = object({
11566
11877
  * camera's detect node differs from its source-owner (P2d, gated by the
11567
11878
  * `remoteSourcingNodes` rollout setting).
11568
11879
  */
11569
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11880
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11881
+ /**
11882
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11883
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11884
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11885
+ * this only selects WHICH device pool of that node runs the session.
11886
+ */
11887
+ deviceKey: string().optional()
11570
11888
  });
11571
11889
  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;
11572
11890
  /**
@@ -11587,6 +11905,19 @@ var RunnerLocalLoadSchema = object({
11587
11905
  avgInferenceTimeMs: number(),
11588
11906
  /** Total queue depth across motion + detection queues. */
11589
11907
  queueDepthTotal: number(),
11908
+ /**
11909
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11910
+ * this runner currently has attached cameras on, so the orchestrator's second
11911
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11912
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11913
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11914
+ */
11915
+ devices: array(object({
11916
+ deviceKey: string(),
11917
+ backend: string(),
11918
+ attachedCameras: number(),
11919
+ queueDepthTotal: number()
11920
+ })).default([]),
11590
11921
  /** Hardware capability flags reported by this node. */
11591
11922
  hardware: object({
11592
11923
  hasGpu: boolean(),
@@ -13062,6 +13393,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
13062
13393
  kind: "mutation",
13063
13394
  auth: "admin"
13064
13395
  });
13396
+ 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;
13397
+ new Set(Object.values(DeviceType));
13065
13398
  /**
13066
13399
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
13067
13400
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -16189,17 +16522,30 @@ var EventKindCategorySchema = _enum([
16189
16522
  "audio",
16190
16523
  "detection",
16191
16524
  "sensor",
16525
+ "control",
16192
16526
  "custom",
16193
16527
  "package"
16194
16528
  ]);
16529
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16530
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16195
16531
  var EventKindDescriptorSchema = object({
16196
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16532
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16197
16533
  kind: string(),
16534
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16535
+ labelKey: string(),
16536
+ /** English fallback label (kept for clients that don't translate). */
16198
16537
  label: string(),
16199
16538
  /** Hex color for timeline/legend rendering. */
16200
16539
  color: string(),
16540
+ /** Dictionary id → lucide component on the UI side. */
16541
+ iconId: string(),
16542
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16201
16543
  icon: EventKindIconSchema,
16202
16544
  category: EventKindCategorySchema,
16545
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16546
+ parentKind: string().nullable(),
16547
+ /** Derived from `parentKind`, explicit for the client tree. */
16548
+ level: EventKindLevelSchema,
16203
16549
  /** Which cap + device contributes this kind. For built-ins the camera
16204
16550
  * itself; for sensor kinds the LINKED source device. */
16205
16551
  source: object({
@@ -16272,11 +16618,21 @@ var TrackAudioLabelSchema = object({
16272
16618
  firstAt: number(),
16273
16619
  lastAt: number()
16274
16620
  });
16621
+ /**
16622
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16623
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16624
+ * linked sensor/control state change (no positions; carries a snapshot). The
16625
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16626
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16627
+ */
16628
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16275
16629
  var TrackSchema = object({
16276
16630
  trackId: string(),
16277
16631
  deviceId: number(),
16278
16632
  className: string(),
16279
16633
  label: string().optional(),
16634
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16635
+ source: TrackSourceSchema.optional(),
16280
16636
  firstSeen: number(),
16281
16637
  lastSeen: number(),
16282
16638
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16653,6 +17009,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16653
17009
  eventId: string(),
16654
17010
  timestamp: number()
16655
17011
  });
17012
+ /**
17013
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
17014
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
17015
+ * caps into per-camera event-kind descriptors.
17016
+ *
17017
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
17018
+ * is NOT duplicated here — every entry is derived from the single
17019
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
17020
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
17021
+ * control cap means adding one line here (and a taxonomy entry); the anti-
17022
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
17023
+ * eventful cap is missing.
17024
+ */
17025
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
17026
+ var LEGACY_ICON = {
17027
+ motion: "motion",
17028
+ audio: "audio",
17029
+ person: "person",
17030
+ vehicle: "vehicle",
17031
+ animal: "animal",
17032
+ package: "package",
17033
+ door: "door",
17034
+ pir: "pir",
17035
+ smoke: "smoke",
17036
+ water: "water",
17037
+ button: "button",
17038
+ generic: "generic",
17039
+ gas: "smoke",
17040
+ vibration: "generic",
17041
+ tamper: "generic",
17042
+ presence: "person",
17043
+ lock: "generic",
17044
+ siren: "generic",
17045
+ switch: "generic",
17046
+ doorbell: "button"
17047
+ };
17048
+ function legacyIcon(iconId) {
17049
+ return LEGACY_ICON[iconId] ?? "generic";
17050
+ }
17051
+ /**
17052
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
17053
+ * The anti-drift guard cross-checks this against the eventful caps declared
17054
+ * in `packages/types/src/capabilities/*.cap.ts`.
17055
+ */
17056
+ var CAP_TO_KIND = {
17057
+ contact: "contact",
17058
+ motion: "motion-sensor",
17059
+ smoke: "smoke",
17060
+ flood: "flood",
17061
+ gas: "gas",
17062
+ "carbon-monoxide": "carbon-monoxide",
17063
+ vibration: "vibration",
17064
+ tamper: "tamper",
17065
+ presence: "presence",
17066
+ "enum-sensor": "enum-sensor",
17067
+ "event-emitter": "device-event",
17068
+ "lock-control": "lock",
17069
+ switch: "switch",
17070
+ button: "button",
17071
+ doorbell: "doorbell"
17072
+ };
17073
+ function buildDescriptor(capName, kind) {
17074
+ const t = EVENT_TAXONOMY[kind];
17075
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
17076
+ return {
17077
+ ...t,
17078
+ icon: legacyIcon(t.iconId)
17079
+ };
17080
+ }
17081
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16656
17082
  var CameraPipelineConfigSchema = object({
16657
17083
  engine: PipelineEngineChoiceSchema.optional(),
16658
17084
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16671,13 +17097,11 @@ var PipelineTemplateSchema = object({
16671
17097
  createdAt: string(),
16672
17098
  updatedAt: string()
16673
17099
  });
16674
- var AgentAddonConfigSchema = object({
16675
- enabled: boolean(),
17100
+ var DeviceStepConfigSchema = object({
16676
17101
  modelId: string().optional(),
16677
- settings: record(string(), unknown()).readonly()
17102
+ settings: record(string(), unknown()).optional()
16678
17103
  });
16679
17104
  var AgentPipelineSettingsSchema = object({
16680
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16681
17105
  maxCameras: number().int().nonnegative().nullable().default(null),
16682
17106
  /** Per-node detection weight (relative share for the quota balancer). */
16683
17107
  detectWeight: number().positive().optional(),
@@ -16701,7 +17125,22 @@ var AgentPipelineSettingsSchema = object({
16701
17125
  * it already uses to reach the hub). Set this only when the auto-detected
16702
17126
  * address is wrong (multi-homed host, NAT, custom interface).
16703
17127
  */
16704
- reachableHost: string().optional()
17128
+ reachableHost: string().optional(),
17129
+ /**
17130
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
17131
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
17132
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
17133
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
17134
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
17135
+ * the default model/settings for every camera landing on that accelerator;
17136
+ * a stepId absent ⇒ the step uses that device's format default.
17137
+ */
17138
+ inferenceDevices: record(string(), object({
17139
+ enabled: boolean(),
17140
+ weight: number().positive().optional(),
17141
+ maxSessions: number().int().positive().optional(),
17142
+ steps: record(string(), DeviceStepConfigSchema).optional()
17143
+ })).optional()
16705
17144
  });
16706
17145
  var CameraPipelineForAgentSchema = object({
16707
17146
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16711,14 +17150,13 @@ var CameraPipelineForAgentSchema = object({
16711
17150
  }).nullable()
16712
17151
  });
16713
17152
  var CameraStepOverridePatchSchema = object({
16714
- enabled: boolean().optional(),
16715
17153
  modelId: string().optional(),
16716
17154
  settings: record(string(), unknown()).readonly().optional()
16717
17155
  });
16718
17156
  var CameraPipelineSettingsSchema = object({
16719
17157
  pinnedAgentNodeId: string().optional(),
16720
17158
  stepToggles: record(string(), boolean()).optional(),
16721
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
17159
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16722
17160
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16723
17161
  });
16724
17162
  /**
@@ -16932,6 +17370,44 @@ var CameraStatusSchema = object({
16932
17370
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16933
17371
  fetchedAt: number()
16934
17372
  });
17373
+ var NodeInferenceDeviceSchema = object({
17374
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17375
+ key: string(),
17376
+ backend: string(),
17377
+ device: string(),
17378
+ format: _enum(MODEL_FORMATS),
17379
+ /** Whether the node's live probe reports the device as usable right now. */
17380
+ available: boolean(),
17381
+ /**
17382
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17383
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17384
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17385
+ * not a balanced target). An explicit stored value always wins; a stored-only
17386
+ * (unavailable) key keeps its stored value.
17387
+ */
17388
+ enabled: boolean(),
17389
+ /** Relative balancer weight for the enabled device (default 1). */
17390
+ weight: number(),
17391
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17392
+ maxSessions: number().nullable(),
17393
+ /** Object-detection model the executor defaults to for this deviceKey. */
17394
+ defaultModelId: string(),
17395
+ /**
17396
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17397
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17398
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17399
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17400
+ * available per format; this is the stored selection that becomes the
17401
+ * default for EVERY camera landing on this accelerator.
17402
+ */
17403
+ steps: record(string(), DeviceStepConfigSchema).optional()
17404
+ });
17405
+ var NodeInferenceDevicesSchema = object({
17406
+ nodeId: string(),
17407
+ /** False when the node's platform-probe was unreachable (no live device set). */
17408
+ reachable: boolean(),
17409
+ devices: array(NodeInferenceDeviceSchema).readonly()
17410
+ });
16935
17411
  method(object({
16936
17412
  deviceId: number(),
16937
17413
  agentNodeId: string()
@@ -16941,7 +17417,13 @@ method(object({
16941
17417
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16942
17418
  kind: "mutation",
16943
17419
  auth: "admin"
16944
- }), method(_void(), object({ migrated: number() }), {
17420
+ }), method(object({
17421
+ deviceId: number(),
17422
+ deviceKey: string()
17423
+ }), object({ success: literal(true) }), {
17424
+ kind: "mutation",
17425
+ auth: "admin"
17426
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16945
17427
  kind: "mutation",
16946
17428
  auth: "admin"
16947
17429
  }), 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({
@@ -16975,13 +17457,7 @@ method(object({
16975
17457
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16976
17458
  nodeId: string(),
16977
17459
  settings: AgentPipelineSettingsSchema
16978
- })).readonly()), method(object({
16979
- agentNodeId: string(),
16980
- defaults: record(string(), AgentAddonConfigSchema)
16981
- }), object({ success: literal(true) }), {
16982
- kind: "mutation",
16983
- auth: "admin"
16984
- }), method(object({ agentNodeId: string() }), object({
17460
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16985
17461
  success: boolean(),
16986
17462
  removed: boolean()
16987
17463
  }), {
@@ -17013,7 +17489,18 @@ method(object({
17013
17489
  }), object({ success: literal(true) }), {
17014
17490
  kind: "mutation",
17015
17491
  auth: "admin"
17016
- }), method(object({ agentNodeId: string() }), object({
17492
+ }), method(object({
17493
+ agentNodeId: string(),
17494
+ inferenceDevices: record(string(), object({
17495
+ enabled: boolean(),
17496
+ weight: number().positive().optional(),
17497
+ maxSessions: number().int().positive().optional(),
17498
+ steps: record(string(), DeviceStepConfigSchema).optional()
17499
+ }))
17500
+ }), object({ success: literal(true) }), {
17501
+ kind: "mutation",
17502
+ auth: "admin"
17503
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
17017
17504
  success: literal(true),
17018
17505
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
17019
17506
  effectiveModelId: string().nullable(),
@@ -17029,9 +17516,10 @@ method(object({
17029
17516
  }), object({ success: literal(true) }), {
17030
17517
  kind: "mutation",
17031
17518
  auth: "admin"
17032
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17519
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
17033
17520
  deviceId: number(),
17034
17521
  agentNodeId: string(),
17522
+ deviceKey: string(),
17035
17523
  addonId: string(),
17036
17524
  patch: CameraStepOverridePatchSchema.nullable()
17037
17525
  }), object({ success: literal(true) }), {
@@ -17068,14 +17556,13 @@ method(object({
17068
17556
  });
17069
17557
  /**
17070
17558
  * server-management — per-NODE singleton capability for a node's ROOT
17071
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
17072
- * agents).
17559
+ * package lifecycle (runtime-updatable node packages).
17073
17560
  *
17074
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
17075
- * on agents) carries the whole software stack in its npm dep tree, so ONE
17076
- * version describes the node. Updates install into
17077
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
17078
- * starter (probation boot + auto-rollback to N-1).
17561
+ * Every node role runs the SAME root package (`@camstack/server`), which
17562
+ * carries the whole software stack in its npm dep tree, so ONE version
17563
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17564
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17565
+ * no auto-rollback).
17079
17566
  *
17080
17567
  * Providers:
17081
17568
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -17183,7 +17670,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
17183
17670
  /** Explicit target version; omitted = latest from the registry. */
17184
17671
  version: string().optional() }), ServerUpdateActionResultSchema, {
17185
17672
  kind: "mutation",
17186
- auth: "admin"
17673
+ auth: "admin",
17674
+ timeoutMs: 16 * 6e4
17187
17675
  }), method(_void(), ServerUpdateActionResultSchema, {
17188
17676
  kind: "mutation",
17189
17677
  auth: "admin"
@@ -18227,22 +18715,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
18227
18715
  var RestartAddonResultSchema = unknown();
18228
18716
  var InstallPackageResultSchema = unknown();
18229
18717
  var ReloadPackagesResultSchema = unknown();
18230
- /**
18231
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
18232
- * server restarts so the admin UI can react to the `restartingAt`
18233
- * timestamp (shows reconnect overlay). The transition from
18234
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
18235
- * `system.restart-completed` event after the new process boots.
18236
- *
18237
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
18238
- */
18239
- var UpdateFrameworkPackageResultSchema = object({
18240
- packageName: string(),
18241
- fromVersion: string(),
18242
- toVersion: string(),
18243
- /** Ms-epoch the server scheduled its self-restart. */
18244
- restartingAt: number()
18245
- });
18246
18718
  var BulkUpdateItemStatusSchema = _enum([
18247
18719
  "queued",
18248
18720
  "updating",
@@ -18370,13 +18842,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18370
18842
  }), object({ success: literal(true) }), {
18371
18843
  kind: "mutation",
18372
18844
  auth: "admin"
18373
- }), method(object({
18374
- packageName: string().min(1),
18375
- version: string().optional(),
18376
- deferRestart: boolean().optional()
18377
- }), UpdateFrameworkPackageResultSchema, {
18378
- kind: "mutation",
18379
- auth: "admin"
18380
18845
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18381
18846
  kind: "mutation",
18382
18847
  auth: "admin"
@@ -19242,10 +19707,10 @@ var TopologyCategorySchema = object({
19242
19707
  addons: array(TopologyCategoryAddonSchema).readonly()
19243
19708
  });
19244
19709
  /**
19245
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
19246
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
19247
- * version visibility for the Server management surface. Nullable: offline
19248
- * rows and pre-phase-2 nodes report none.
19710
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19711
+ * root package for every node role) as reported by its `registerNode`
19712
+ * manifest — version visibility for the Server management surface. Nullable:
19713
+ * offline rows and nodes that never reported one.
19249
19714
  */
19250
19715
  var TopologyRootPackageSchema = object({
19251
19716
  name: string(),
@@ -19633,17 +20098,28 @@ var PlatformScoreSchema = object({
19633
20098
  format: _enum([
19634
20099
  "onnx",
19635
20100
  "coreml",
19636
- "openvino"
20101
+ "openvino",
20102
+ "tflite"
19637
20103
  ]),
19638
20104
  score: number(),
19639
20105
  reason: string(),
19640
20106
  available: boolean()
19641
20107
  });
20108
+ var InferenceDeviceDescriptorSchema = object({
20109
+ key: string(),
20110
+ backend: string(),
20111
+ device: string(),
20112
+ format: ModelFormatSchema,
20113
+ runtime: literal("python"),
20114
+ score: number(),
20115
+ available: boolean()
20116
+ });
19642
20117
  var PlatformCapabilitiesSchema = object({
19643
20118
  hardware: HardwareInfoSchema,
19644
20119
  scores: array(PlatformScoreSchema).readonly(),
19645
20120
  bestScore: PlatformScoreSchema,
19646
- pythonPath: string().nullable()
20121
+ pythonPath: string().nullable(),
20122
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19647
20123
  });
19648
20124
  var ModelRequirementSchema = object({
19649
20125
  modelId: string(),
@@ -20522,12 +20998,6 @@ Object.freeze({
20522
20998
  addonId: null,
20523
20999
  access: "delete"
20524
21000
  },
20525
- "addons.updateFrameworkPackage": {
20526
- capName: "addons",
20527
- capScope: "system",
20528
- addonId: null,
20529
- access: "create"
20530
- },
20531
21001
  "addons.updatePackage": {
20532
21002
  capName: "addons",
20533
21003
  capScope: "system",
@@ -23300,12 +23770,6 @@ Object.freeze({
23300
23770
  addonId: null,
23301
23771
  access: "view"
23302
23772
  },
23303
- "pipelineExecutor.reprobeEngine": {
23304
- capName: "pipeline-executor",
23305
- capScope: "system",
23306
- addonId: null,
23307
- access: "create"
23308
- },
23309
23773
  "pipelineExecutor.runAudioTest": {
23310
23774
  capName: "pipeline-executor",
23311
23775
  capScope: "system",
@@ -23456,6 +23920,12 @@ Object.freeze({
23456
23920
  addonId: null,
23457
23921
  access: "view"
23458
23922
  },
23923
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23924
+ capName: "pipeline-orchestrator",
23925
+ capScope: "system",
23926
+ addonId: null,
23927
+ access: "view"
23928
+ },
23459
23929
  "pipelineOrchestrator.getPipelineAssignment": {
23460
23930
  capName: "pipeline-orchestrator",
23461
23931
  capScope: "system",
@@ -23468,6 +23938,12 @@ Object.freeze({
23468
23938
  addonId: null,
23469
23939
  access: "view"
23470
23940
  },
23941
+ "pipelineOrchestrator.getPipelineDevicePin": {
23942
+ capName: "pipeline-orchestrator",
23943
+ capScope: "system",
23944
+ addonId: null,
23945
+ access: "view"
23946
+ },
23471
23947
  "pipelineOrchestrator.listAgentSettings": {
23472
23948
  capName: "pipeline-orchestrator",
23473
23949
  capScope: "system",
@@ -23510,19 +23986,19 @@ Object.freeze({
23510
23986
  addonId: null,
23511
23987
  access: "create"
23512
23988
  },
23513
- "pipelineOrchestrator.setAgentAddonDefaults": {
23989
+ "pipelineOrchestrator.setAgentCapabilities": {
23514
23990
  capName: "pipeline-orchestrator",
23515
23991
  capScope: "system",
23516
23992
  addonId: null,
23517
23993
  access: "create"
23518
23994
  },
23519
- "pipelineOrchestrator.setAgentCapabilities": {
23995
+ "pipelineOrchestrator.setAgentDetectWeight": {
23520
23996
  capName: "pipeline-orchestrator",
23521
23997
  capScope: "system",
23522
23998
  addonId: null,
23523
23999
  access: "create"
23524
24000
  },
23525
- "pipelineOrchestrator.setAgentDetectWeight": {
24001
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23526
24002
  capName: "pipeline-orchestrator",
23527
24003
  capScope: "system",
23528
24004
  addonId: null,
@@ -23564,6 +24040,12 @@ Object.freeze({
23564
24040
  addonId: null,
23565
24041
  access: "create"
23566
24042
  },
24043
+ "pipelineOrchestrator.setPipelineDevicePin": {
24044
+ capName: "pipeline-orchestrator",
24045
+ capScope: "system",
24046
+ addonId: null,
24047
+ access: "create"
24048
+ },
23567
24049
  "pipelineOrchestrator.unassignAudio": {
23568
24050
  capName: "pipeline-orchestrator",
23569
24051
  capScope: "system",
@@ -25116,32 +25598,6 @@ Object.freeze({
25116
25598
  "network-access": "ingress",
25117
25599
  "smtp-provider": "email"
25118
25600
  });
25119
- var frameworkSwapPackageSchema = object({
25120
- name: string(),
25121
- stagedPath: string(),
25122
- backupPath: string(),
25123
- toVersion: string(),
25124
- fromVersion: string().nullable()
25125
- });
25126
- object({
25127
- jobId: string(),
25128
- taskId: string(),
25129
- packages: array(frameworkSwapPackageSchema),
25130
- requestedAtMs: number(),
25131
- schemaVersion: literal(1)
25132
- });
25133
- object({
25134
- jobId: string(),
25135
- taskId: string(),
25136
- backups: array(object({
25137
- name: string(),
25138
- backupPath: string(),
25139
- livePath: string()
25140
- })),
25141
- appliedAtMs: number(),
25142
- bootAttempts: number(),
25143
- schemaVersion: literal(1)
25144
- });
25145
25601
  var NOTIFIER_ICONS = {
25146
25602
  telegram: {
25147
25603
  contentType: "image/svg+xml",