@camstack/addon-decoder-nodeav 1.1.17 → 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/index.js +560 -104
  2. package/dist/index.mjs +560 -104
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7084,6 +7084,17 @@ var ModelCatalogEntrySchema = object({
7084
7084
  "imagenet",
7085
7085
  "none"
7086
7086
  ]).optional(),
7087
+ /**
7088
+ * The model already applies softmax IN-GRAPH — its raw output is a
7089
+ * probability distribution, not logits. When set, the `softmax`
7090
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7091
+ * probability vector collapses it toward uniform (top-1 score craters far
7092
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7093
+ * the output is raw logits and the postprocessor applies softmax (the normal
7094
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7095
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7096
+ */
7097
+ outputProbabilities: boolean().optional(),
7087
7098
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7088
7099
  /**
7089
7100
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7643,6 +7654,160 @@ var EncodeProfileSchema = object({
7643
7654
  */
7644
7655
  outputArgs: array(string()).optional()
7645
7656
  });
7657
+ var COCO_TO_MACRO = {
7658
+ mapping: {
7659
+ person: "person",
7660
+ bicycle: "vehicle",
7661
+ car: "vehicle",
7662
+ motorcycle: "vehicle",
7663
+ airplane: "vehicle",
7664
+ bus: "vehicle",
7665
+ train: "vehicle",
7666
+ truck: "vehicle",
7667
+ boat: "vehicle",
7668
+ bird: "animal",
7669
+ cat: "animal",
7670
+ dog: "animal",
7671
+ horse: "animal",
7672
+ sheep: "animal",
7673
+ cow: "animal",
7674
+ elephant: "animal",
7675
+ bear: "animal",
7676
+ zebra: "animal",
7677
+ giraffe: "animal",
7678
+ suitcase: "package",
7679
+ backpack: "package",
7680
+ handbag: "package"
7681
+ },
7682
+ preserveOriginal: false
7683
+ };
7684
+ var AUDIO_MACRO_LABELS = [
7685
+ {
7686
+ id: "speech",
7687
+ name: "Speech",
7688
+ icon: "🗣️"
7689
+ },
7690
+ {
7691
+ id: "scream",
7692
+ name: "Scream / Shout",
7693
+ icon: "😱"
7694
+ },
7695
+ {
7696
+ id: "crying",
7697
+ name: "Crying / Baby",
7698
+ icon: "😢"
7699
+ },
7700
+ {
7701
+ id: "laughter",
7702
+ name: "Laughter",
7703
+ icon: "😂"
7704
+ },
7705
+ {
7706
+ id: "music",
7707
+ name: "Music",
7708
+ icon: "🎵"
7709
+ },
7710
+ {
7711
+ id: "dog",
7712
+ name: "Dog",
7713
+ icon: "🐕"
7714
+ },
7715
+ {
7716
+ id: "cat",
7717
+ name: "Cat",
7718
+ icon: "🐈"
7719
+ },
7720
+ {
7721
+ id: "bird",
7722
+ name: "Bird",
7723
+ icon: "🐦"
7724
+ },
7725
+ {
7726
+ id: "animal",
7727
+ name: "Animal (other)",
7728
+ icon: "🐾"
7729
+ },
7730
+ {
7731
+ id: "alarm",
7732
+ name: "Alarm / Siren",
7733
+ icon: "🚨"
7734
+ },
7735
+ {
7736
+ id: "doorbell",
7737
+ name: "Doorbell / Knock",
7738
+ icon: "🔔"
7739
+ },
7740
+ {
7741
+ id: "glass_breaking",
7742
+ name: "Glass Breaking",
7743
+ icon: "💥"
7744
+ },
7745
+ {
7746
+ id: "gunshot",
7747
+ name: "Gunshot / Explosion",
7748
+ icon: "💣"
7749
+ },
7750
+ {
7751
+ id: "vehicle",
7752
+ name: "Vehicle",
7753
+ icon: "🚗"
7754
+ },
7755
+ {
7756
+ id: "siren",
7757
+ name: "Emergency Siren",
7758
+ icon: "🚑"
7759
+ },
7760
+ {
7761
+ id: "fire",
7762
+ name: "Fire / Smoke",
7763
+ icon: "🔥"
7764
+ },
7765
+ {
7766
+ id: "water",
7767
+ name: "Water",
7768
+ icon: "💧"
7769
+ },
7770
+ {
7771
+ id: "wind",
7772
+ name: "Wind / Weather",
7773
+ icon: "🌬️"
7774
+ },
7775
+ {
7776
+ id: "door",
7777
+ name: "Door",
7778
+ icon: "🚪"
7779
+ },
7780
+ {
7781
+ id: "footsteps",
7782
+ name: "Footsteps",
7783
+ icon: "👣"
7784
+ },
7785
+ {
7786
+ id: "crowd",
7787
+ name: "Crowd / Chatter",
7788
+ icon: "👥"
7789
+ },
7790
+ {
7791
+ id: "telephone",
7792
+ name: "Telephone",
7793
+ icon: "📞"
7794
+ },
7795
+ {
7796
+ id: "engine",
7797
+ name: "Engine / Motor",
7798
+ icon: "⚙️"
7799
+ },
7800
+ {
7801
+ id: "tools",
7802
+ name: "Tools / Construction",
7803
+ icon: "🔨"
7804
+ },
7805
+ {
7806
+ id: "silence",
7807
+ name: "Silence",
7808
+ icon: "🤫"
7809
+ }
7810
+ ];
7646
7811
  var YAMNET_TO_MACRO = {
7647
7812
  mapping: {
7648
7813
  Speech: "speech",
@@ -7909,6 +8074,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7909
8074
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7910
8075
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7911
8076
  /**
8077
+ * Unified event-kind taxonomy — THE single source of truth for
8078
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8079
+ * icon }`.
8080
+ *
8081
+ * This dictionary folds together what used to be scattered across four
8082
+ * copies:
8083
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8084
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8085
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8086
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8087
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8088
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8089
+ *
8090
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8091
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8092
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8093
+ * color or an icon: they read this dictionary (server descriptors carry the
8094
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8095
+ *
8096
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8097
+ */
8098
+ var TAXONOMY_COLORS = {
8099
+ motion: "#f59e0b",
8100
+ audio: "#06b6d4",
8101
+ person: "#22c55e",
8102
+ vehicle: "#3b82f6",
8103
+ animal: "#f97316",
8104
+ package: "#a855f7",
8105
+ sensor: "#8b5cf6",
8106
+ control: "#10b981",
8107
+ genericDetection: "#64748b"
8108
+ };
8109
+ var DETECTION_SUB_COLORS = {
8110
+ car: "#f59e0b",
8111
+ truck: "#d97706",
8112
+ bus: "#b45309",
8113
+ motorcycle: "#eab308",
8114
+ bicycle: "#ca8a04",
8115
+ airplane: "#60a5fa",
8116
+ boat: "#2563eb",
8117
+ train: "#1d4ed8",
8118
+ bird: "#14b8a6",
8119
+ dog: "#84cc16",
8120
+ cat: "#f97316",
8121
+ horse: "#a16207",
8122
+ sheep: "#a3a3a3",
8123
+ cow: "#78716c",
8124
+ elephant: "#6b7280",
8125
+ bear: "#7c2d12",
8126
+ zebra: "#404040",
8127
+ giraffe: "#d4a373"
8128
+ };
8129
+ function titleCase(id) {
8130
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8131
+ }
8132
+ var entries = /* @__PURE__ */ new Map();
8133
+ function macro(kind, category, color, iconId, label) {
8134
+ entries.set(kind, {
8135
+ kind,
8136
+ parentKind: null,
8137
+ level: "macro",
8138
+ category,
8139
+ color,
8140
+ iconId,
8141
+ labelKey: `eventKind.${kind}`,
8142
+ label
8143
+ });
8144
+ }
8145
+ function sub(kind, parentKind, category, color, iconId, label) {
8146
+ entries.set(kind, {
8147
+ kind,
8148
+ parentKind,
8149
+ level: "sub",
8150
+ category,
8151
+ color,
8152
+ iconId,
8153
+ labelKey: `eventKind.${kind}`,
8154
+ label
8155
+ });
8156
+ }
8157
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8158
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8159
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8160
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8161
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8162
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8163
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8164
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8165
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8166
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8167
+ if (entries.has(cocoClass)) continue;
8168
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8169
+ }
8170
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8171
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8172
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8173
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8174
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8175
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8176
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8177
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8178
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8179
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8180
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8181
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8182
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8183
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8184
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8185
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8186
+ sub("button", "control", "control", "#10b981", "button", "Button");
8187
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8188
+ for (const l of AUDIO_MACRO_LABELS) {
8189
+ const kind = `audio-${l.id}`;
8190
+ if (entries.has(kind)) continue;
8191
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8192
+ }
8193
+ /** The complete taxonomy dictionary, keyed by kind. */
8194
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8195
+ /**
7912
8196
  * Error types for the safe expression engine. Two distinct classes so callers
7913
8197
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7914
8198
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10824,10 +11108,7 @@ var ConfigUISchemaNullableBridge = custom();
10824
11108
  var InferenceCapabilitiesBridge = custom();
10825
11109
  var ModelAvailabilityListBridge = custom();
10826
11110
  var PipelineRunResultBridge = custom();
10827
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10828
- kind: "mutation",
10829
- auth: "admin"
10830
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11111
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10831
11112
  modelId: string(),
10832
11113
  settings: record(string(), unknown()).readonly()
10833
11114
  }))), method(object({ steps: record(string(), object({
@@ -10887,13 +11168,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10887
11168
  * (inputClasses ≠ null) are skipped and served per-track via
10888
11169
  * pipelineRunner.runDetailSubtree (two-plane design).
10889
11170
  */
10890
- plane: _enum(["full", "frame"]).optional()
11171
+ plane: _enum(["full", "frame"]).optional(),
11172
+ /**
11173
+ * Inference-device selector (Phase 2 multi-device). Format
11174
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11175
+ * Omitted ⇒ the runner's default device (current single-engine
11176
+ * behaviour). Selects WHICH device pool of the node runs the call.
11177
+ */
11178
+ deviceKey: string().optional()
10891
11179
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10892
11180
  engine: PipelineEngineChoiceSchema.optional(),
10893
11181
  steps: array(PipelineStepInputSchema).min(1),
10894
11182
  frames: array(FrameInputSchema).min(1).max(255),
10895
11183
  deviceId: number().optional(),
10896
- sessionId: string().optional()
11184
+ sessionId: string().optional(),
11185
+ /**
11186
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11187
+ * the batch to the Python pool's bench preprocess cache
11188
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11189
+ * preprocessed ONCE and every later inference is a pure-inference cache
11190
+ * hit — the sustained-throughput run measures inference, not
11191
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11192
+ * full preprocess every call, correct). Fresh per sustained run;
11193
+ * released via `uncacheFrame`.
11194
+ */
11195
+ frameId: number().int().nonnegative().optional(),
11196
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11197
+ deviceKey: string().optional()
10897
11198
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10898
11199
  data: _instanceof(Uint8Array),
10899
11200
  width: number().int().positive(),
@@ -10925,8 +11226,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10925
11226
  * - `runtime` — main camera-serving engine (no idle TTL).
10926
11227
  * - `warm-override` — benchmark/test override held in the warm
10927
11228
  * cache; auto-disposed after the idle TTL.
11229
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11230
+ * multi-device, keyed by `deviceKey`) resolved
11231
+ * via `resolveDeviceFactory`. Runs alongside the
11232
+ * `runtime` engine on a DIFFERENT accelerator
11233
+ * (NPU / iGPU / Coral) — this is how the
11234
+ * Engines tab shows all pools running at once.
10928
11235
  */
10929
- kind: _enum(["runtime", "warm-override"]),
11236
+ kind: _enum([
11237
+ "runtime",
11238
+ "warm-override",
11239
+ "device-pool"
11240
+ ]),
10930
11241
  /** Native pid of the underlying Python pool (null when no pool). */
10931
11242
  poolPid: number().nullable(),
10932
11243
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11268,7 +11579,14 @@ var RunnerCameraConfigSchema = object({
11268
11579
  * camera's detect node differs from its source-owner (P2d, gated by the
11269
11580
  * `remoteSourcingNodes` rollout setting).
11270
11581
  */
11271
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11582
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11583
+ /**
11584
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11585
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11586
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11587
+ * this only selects WHICH device pool of that node runs the session.
11588
+ */
11589
+ deviceKey: string().optional()
11272
11590
  });
11273
11591
  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;
11274
11592
  /**
@@ -11289,6 +11607,19 @@ var RunnerLocalLoadSchema = object({
11289
11607
  avgInferenceTimeMs: number(),
11290
11608
  /** Total queue depth across motion + detection queues. */
11291
11609
  queueDepthTotal: number(),
11610
+ /**
11611
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11612
+ * this runner currently has attached cameras on, so the orchestrator's second
11613
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11614
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11615
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11616
+ */
11617
+ devices: array(object({
11618
+ deviceKey: string(),
11619
+ backend: string(),
11620
+ attachedCameras: number(),
11621
+ queueDepthTotal: number()
11622
+ })).default([]),
11292
11623
  /** Hardware capability flags reported by this node. */
11293
11624
  hardware: object({
11294
11625
  hasGpu: boolean(),
@@ -12764,6 +13095,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12764
13095
  kind: "mutation",
12765
13096
  auth: "admin"
12766
13097
  });
13098
+ 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;
13099
+ new Set(Object.values(DeviceType));
12767
13100
  /**
12768
13101
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12769
13102
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15988,17 +16321,30 @@ var EventKindCategorySchema = _enum([
15988
16321
  "audio",
15989
16322
  "detection",
15990
16323
  "sensor",
16324
+ "control",
15991
16325
  "custom",
15992
16326
  "package"
15993
16327
  ]);
16328
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16329
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15994
16330
  var EventKindDescriptorSchema = object({
15995
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16331
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15996
16332
  kind: string(),
16333
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16334
+ labelKey: string(),
16335
+ /** English fallback label (kept for clients that don't translate). */
15997
16336
  label: string(),
15998
16337
  /** Hex color for timeline/legend rendering. */
15999
16338
  color: string(),
16339
+ /** Dictionary id → lucide component on the UI side. */
16340
+ iconId: string(),
16341
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16000
16342
  icon: EventKindIconSchema,
16001
16343
  category: EventKindCategorySchema,
16344
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16345
+ parentKind: string().nullable(),
16346
+ /** Derived from `parentKind`, explicit for the client tree. */
16347
+ level: EventKindLevelSchema,
16002
16348
  /** Which cap + device contributes this kind. For built-ins the camera
16003
16349
  * itself; for sensor kinds the LINKED source device. */
16004
16350
  source: object({
@@ -16071,11 +16417,21 @@ var TrackAudioLabelSchema = object({
16071
16417
  firstAt: number(),
16072
16418
  lastAt: number()
16073
16419
  });
16420
+ /**
16421
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16422
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16423
+ * linked sensor/control state change (no positions; carries a snapshot). The
16424
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16425
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16426
+ */
16427
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16074
16428
  var TrackSchema = object({
16075
16429
  trackId: string(),
16076
16430
  deviceId: number(),
16077
16431
  className: string(),
16078
16432
  label: string().optional(),
16433
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16434
+ source: TrackSourceSchema.optional(),
16079
16435
  firstSeen: number(),
16080
16436
  lastSeen: number(),
16081
16437
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16452,6 +16808,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16452
16808
  eventId: string(),
16453
16809
  timestamp: number()
16454
16810
  });
16811
+ /**
16812
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16813
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16814
+ * caps into per-camera event-kind descriptors.
16815
+ *
16816
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16817
+ * is NOT duplicated here — every entry is derived from the single
16818
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16819
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16820
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16821
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16822
+ * eventful cap is missing.
16823
+ */
16824
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16825
+ var LEGACY_ICON = {
16826
+ motion: "motion",
16827
+ audio: "audio",
16828
+ person: "person",
16829
+ vehicle: "vehicle",
16830
+ animal: "animal",
16831
+ package: "package",
16832
+ door: "door",
16833
+ pir: "pir",
16834
+ smoke: "smoke",
16835
+ water: "water",
16836
+ button: "button",
16837
+ generic: "generic",
16838
+ gas: "smoke",
16839
+ vibration: "generic",
16840
+ tamper: "generic",
16841
+ presence: "person",
16842
+ lock: "generic",
16843
+ siren: "generic",
16844
+ switch: "generic",
16845
+ doorbell: "button"
16846
+ };
16847
+ function legacyIcon(iconId) {
16848
+ return LEGACY_ICON[iconId] ?? "generic";
16849
+ }
16850
+ /**
16851
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16852
+ * The anti-drift guard cross-checks this against the eventful caps declared
16853
+ * in `packages/types/src/capabilities/*.cap.ts`.
16854
+ */
16855
+ var CAP_TO_KIND = {
16856
+ contact: "contact",
16857
+ motion: "motion-sensor",
16858
+ smoke: "smoke",
16859
+ flood: "flood",
16860
+ gas: "gas",
16861
+ "carbon-monoxide": "carbon-monoxide",
16862
+ vibration: "vibration",
16863
+ tamper: "tamper",
16864
+ presence: "presence",
16865
+ "enum-sensor": "enum-sensor",
16866
+ "event-emitter": "device-event",
16867
+ "lock-control": "lock",
16868
+ switch: "switch",
16869
+ button: "button",
16870
+ doorbell: "doorbell"
16871
+ };
16872
+ function buildDescriptor(capName, kind) {
16873
+ const t = EVENT_TAXONOMY[kind];
16874
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16875
+ return {
16876
+ ...t,
16877
+ icon: legacyIcon(t.iconId)
16878
+ };
16879
+ }
16880
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16455
16881
  var CameraPipelineConfigSchema = object({
16456
16882
  engine: PipelineEngineChoiceSchema.optional(),
16457
16883
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16470,13 +16896,11 @@ var PipelineTemplateSchema = object({
16470
16896
  createdAt: string(),
16471
16897
  updatedAt: string()
16472
16898
  });
16473
- var AgentAddonConfigSchema = object({
16474
- enabled: boolean(),
16899
+ var DeviceStepConfigSchema = object({
16475
16900
  modelId: string().optional(),
16476
- settings: record(string(), unknown()).readonly()
16901
+ settings: record(string(), unknown()).optional()
16477
16902
  });
16478
16903
  var AgentPipelineSettingsSchema = object({
16479
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16480
16904
  maxCameras: number().int().nonnegative().nullable().default(null),
16481
16905
  /** Per-node detection weight (relative share for the quota balancer). */
16482
16906
  detectWeight: number().positive().optional(),
@@ -16500,7 +16924,22 @@ var AgentPipelineSettingsSchema = object({
16500
16924
  * it already uses to reach the hub). Set this only when the auto-detected
16501
16925
  * address is wrong (multi-homed host, NAT, custom interface).
16502
16926
  */
16503
- reachableHost: string().optional()
16927
+ reachableHost: string().optional(),
16928
+ /**
16929
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16930
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16931
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16932
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16933
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16934
+ * the default model/settings for every camera landing on that accelerator;
16935
+ * a stepId absent ⇒ the step uses that device's format default.
16936
+ */
16937
+ inferenceDevices: record(string(), object({
16938
+ enabled: boolean(),
16939
+ weight: number().positive().optional(),
16940
+ maxSessions: number().int().positive().optional(),
16941
+ steps: record(string(), DeviceStepConfigSchema).optional()
16942
+ })).optional()
16504
16943
  });
16505
16944
  var CameraPipelineForAgentSchema = object({
16506
16945
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16510,14 +16949,13 @@ var CameraPipelineForAgentSchema = object({
16510
16949
  }).nullable()
16511
16950
  });
16512
16951
  var CameraStepOverridePatchSchema = object({
16513
- enabled: boolean().optional(),
16514
16952
  modelId: string().optional(),
16515
16953
  settings: record(string(), unknown()).readonly().optional()
16516
16954
  });
16517
16955
  var CameraPipelineSettingsSchema = object({
16518
16956
  pinnedAgentNodeId: string().optional(),
16519
16957
  stepToggles: record(string(), boolean()).optional(),
16520
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16958
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16521
16959
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16522
16960
  });
16523
16961
  /**
@@ -16731,6 +17169,44 @@ var CameraStatusSchema = object({
16731
17169
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16732
17170
  fetchedAt: number()
16733
17171
  });
17172
+ var NodeInferenceDeviceSchema = object({
17173
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17174
+ key: string(),
17175
+ backend: string(),
17176
+ device: string(),
17177
+ format: _enum(MODEL_FORMATS),
17178
+ /** Whether the node's live probe reports the device as usable right now. */
17179
+ available: boolean(),
17180
+ /**
17181
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17182
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17183
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17184
+ * not a balanced target). An explicit stored value always wins; a stored-only
17185
+ * (unavailable) key keeps its stored value.
17186
+ */
17187
+ enabled: boolean(),
17188
+ /** Relative balancer weight for the enabled device (default 1). */
17189
+ weight: number(),
17190
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17191
+ maxSessions: number().nullable(),
17192
+ /** Object-detection model the executor defaults to for this deviceKey. */
17193
+ defaultModelId: string(),
17194
+ /**
17195
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17196
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17197
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17198
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17199
+ * available per format; this is the stored selection that becomes the
17200
+ * default for EVERY camera landing on this accelerator.
17201
+ */
17202
+ steps: record(string(), DeviceStepConfigSchema).optional()
17203
+ });
17204
+ var NodeInferenceDevicesSchema = object({
17205
+ nodeId: string(),
17206
+ /** False when the node's platform-probe was unreachable (no live device set). */
17207
+ reachable: boolean(),
17208
+ devices: array(NodeInferenceDeviceSchema).readonly()
17209
+ });
16734
17210
  method(object({
16735
17211
  deviceId: number(),
16736
17212
  agentNodeId: string()
@@ -16740,7 +17216,13 @@ method(object({
16740
17216
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16741
17217
  kind: "mutation",
16742
17218
  auth: "admin"
16743
- }), method(_void(), object({ migrated: number() }), {
17219
+ }), method(object({
17220
+ deviceId: number(),
17221
+ deviceKey: string()
17222
+ }), object({ success: literal(true) }), {
17223
+ kind: "mutation",
17224
+ auth: "admin"
17225
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16744
17226
  kind: "mutation",
16745
17227
  auth: "admin"
16746
17228
  }), 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({
@@ -16774,13 +17256,7 @@ method(object({
16774
17256
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16775
17257
  nodeId: string(),
16776
17258
  settings: AgentPipelineSettingsSchema
16777
- })).readonly()), method(object({
16778
- agentNodeId: string(),
16779
- defaults: record(string(), AgentAddonConfigSchema)
16780
- }), object({ success: literal(true) }), {
16781
- kind: "mutation",
16782
- auth: "admin"
16783
- }), method(object({ agentNodeId: string() }), object({
17259
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16784
17260
  success: boolean(),
16785
17261
  removed: boolean()
16786
17262
  }), {
@@ -16812,7 +17288,18 @@ method(object({
16812
17288
  }), object({ success: literal(true) }), {
16813
17289
  kind: "mutation",
16814
17290
  auth: "admin"
16815
- }), method(object({ agentNodeId: string() }), object({
17291
+ }), method(object({
17292
+ agentNodeId: string(),
17293
+ inferenceDevices: record(string(), object({
17294
+ enabled: boolean(),
17295
+ weight: number().positive().optional(),
17296
+ maxSessions: number().int().positive().optional(),
17297
+ steps: record(string(), DeviceStepConfigSchema).optional()
17298
+ }))
17299
+ }), object({ success: literal(true) }), {
17300
+ kind: "mutation",
17301
+ auth: "admin"
17302
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16816
17303
  success: literal(true),
16817
17304
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16818
17305
  effectiveModelId: string().nullable(),
@@ -16828,9 +17315,10 @@ method(object({
16828
17315
  }), object({ success: literal(true) }), {
16829
17316
  kind: "mutation",
16830
17317
  auth: "admin"
16831
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17318
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16832
17319
  deviceId: number(),
16833
17320
  agentNodeId: string(),
17321
+ deviceKey: string(),
16834
17322
  addonId: string(),
16835
17323
  patch: CameraStepOverridePatchSchema.nullable()
16836
17324
  }), object({ success: literal(true) }), {
@@ -16867,14 +17355,13 @@ method(object({
16867
17355
  });
16868
17356
  /**
16869
17357
  * server-management — per-NODE singleton capability for a node's ROOT
16870
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16871
- * agents).
17358
+ * package lifecycle (runtime-updatable node packages).
16872
17359
  *
16873
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16874
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16875
- * version describes the node. Updates install into
16876
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16877
- * starter (probation boot + auto-rollback to N-1).
17360
+ * Every node role runs the SAME root package (`@camstack/server`), which
17361
+ * carries the whole software stack in its npm dep tree, so ONE version
17362
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17363
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17364
+ * no auto-rollback).
16878
17365
  *
16879
17366
  * Providers:
16880
17367
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16982,7 +17469,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16982
17469
  /** Explicit target version; omitted = latest from the registry. */
16983
17470
  version: string().optional() }), ServerUpdateActionResultSchema, {
16984
17471
  kind: "mutation",
16985
- auth: "admin"
17472
+ auth: "admin",
17473
+ timeoutMs: 16 * 6e4
16986
17474
  }), method(_void(), ServerUpdateActionResultSchema, {
16987
17475
  kind: "mutation",
16988
17476
  auth: "admin"
@@ -18026,22 +18514,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
18026
18514
  var RestartAddonResultSchema = unknown();
18027
18515
  var InstallPackageResultSchema = unknown();
18028
18516
  var ReloadPackagesResultSchema = unknown();
18029
- /**
18030
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
18031
- * server restarts so the admin UI can react to the `restartingAt`
18032
- * timestamp (shows reconnect overlay). The transition from
18033
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
18034
- * `system.restart-completed` event after the new process boots.
18035
- *
18036
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
18037
- */
18038
- var UpdateFrameworkPackageResultSchema = object({
18039
- packageName: string(),
18040
- fromVersion: string(),
18041
- toVersion: string(),
18042
- /** Ms-epoch the server scheduled its self-restart. */
18043
- restartingAt: number()
18044
- });
18045
18517
  var BulkUpdateItemStatusSchema = _enum([
18046
18518
  "queued",
18047
18519
  "updating",
@@ -18169,13 +18641,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18169
18641
  }), object({ success: literal(true) }), {
18170
18642
  kind: "mutation",
18171
18643
  auth: "admin"
18172
- }), method(object({
18173
- packageName: string().min(1),
18174
- version: string().optional(),
18175
- deferRestart: boolean().optional()
18176
- }), UpdateFrameworkPackageResultSchema, {
18177
- kind: "mutation",
18178
- auth: "admin"
18179
18644
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18180
18645
  kind: "mutation",
18181
18646
  auth: "admin"
@@ -19041,10 +19506,10 @@ var TopologyCategorySchema = object({
19041
19506
  addons: array(TopologyCategoryAddonSchema).readonly()
19042
19507
  });
19043
19508
  /**
19044
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
19045
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
19046
- * version visibility for the Server management surface. Nullable: offline
19047
- * rows and pre-phase-2 nodes report none.
19509
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19510
+ * root package for every node role) as reported by its `registerNode`
19511
+ * manifest — version visibility for the Server management surface. Nullable:
19512
+ * offline rows and nodes that never reported one.
19048
19513
  */
19049
19514
  var TopologyRootPackageSchema = object({
19050
19515
  name: string(),
@@ -19432,17 +19897,28 @@ var PlatformScoreSchema = object({
19432
19897
  format: _enum([
19433
19898
  "onnx",
19434
19899
  "coreml",
19435
- "openvino"
19900
+ "openvino",
19901
+ "tflite"
19436
19902
  ]),
19437
19903
  score: number(),
19438
19904
  reason: string(),
19439
19905
  available: boolean()
19440
19906
  });
19907
+ var InferenceDeviceDescriptorSchema = object({
19908
+ key: string(),
19909
+ backend: string(),
19910
+ device: string(),
19911
+ format: ModelFormatSchema,
19912
+ runtime: literal("python"),
19913
+ score: number(),
19914
+ available: boolean()
19915
+ });
19441
19916
  var PlatformCapabilitiesSchema = object({
19442
19917
  hardware: HardwareInfoSchema,
19443
19918
  scores: array(PlatformScoreSchema).readonly(),
19444
19919
  bestScore: PlatformScoreSchema,
19445
- pythonPath: string().nullable()
19920
+ pythonPath: string().nullable(),
19921
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19446
19922
  });
19447
19923
  var ModelRequirementSchema = object({
19448
19924
  modelId: string(),
@@ -20321,12 +20797,6 @@ Object.freeze({
20321
20797
  addonId: null,
20322
20798
  access: "delete"
20323
20799
  },
20324
- "addons.updateFrameworkPackage": {
20325
- capName: "addons",
20326
- capScope: "system",
20327
- addonId: null,
20328
- access: "create"
20329
- },
20330
20800
  "addons.updatePackage": {
20331
20801
  capName: "addons",
20332
20802
  capScope: "system",
@@ -23099,12 +23569,6 @@ Object.freeze({
23099
23569
  addonId: null,
23100
23570
  access: "view"
23101
23571
  },
23102
- "pipelineExecutor.reprobeEngine": {
23103
- capName: "pipeline-executor",
23104
- capScope: "system",
23105
- addonId: null,
23106
- access: "create"
23107
- },
23108
23572
  "pipelineExecutor.runAudioTest": {
23109
23573
  capName: "pipeline-executor",
23110
23574
  capScope: "system",
@@ -23255,6 +23719,12 @@ Object.freeze({
23255
23719
  addonId: null,
23256
23720
  access: "view"
23257
23721
  },
23722
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23723
+ capName: "pipeline-orchestrator",
23724
+ capScope: "system",
23725
+ addonId: null,
23726
+ access: "view"
23727
+ },
23258
23728
  "pipelineOrchestrator.getPipelineAssignment": {
23259
23729
  capName: "pipeline-orchestrator",
23260
23730
  capScope: "system",
@@ -23267,6 +23737,12 @@ Object.freeze({
23267
23737
  addonId: null,
23268
23738
  access: "view"
23269
23739
  },
23740
+ "pipelineOrchestrator.getPipelineDevicePin": {
23741
+ capName: "pipeline-orchestrator",
23742
+ capScope: "system",
23743
+ addonId: null,
23744
+ access: "view"
23745
+ },
23270
23746
  "pipelineOrchestrator.listAgentSettings": {
23271
23747
  capName: "pipeline-orchestrator",
23272
23748
  capScope: "system",
@@ -23309,19 +23785,19 @@ Object.freeze({
23309
23785
  addonId: null,
23310
23786
  access: "create"
23311
23787
  },
23312
- "pipelineOrchestrator.setAgentAddonDefaults": {
23788
+ "pipelineOrchestrator.setAgentCapabilities": {
23313
23789
  capName: "pipeline-orchestrator",
23314
23790
  capScope: "system",
23315
23791
  addonId: null,
23316
23792
  access: "create"
23317
23793
  },
23318
- "pipelineOrchestrator.setAgentCapabilities": {
23794
+ "pipelineOrchestrator.setAgentDetectWeight": {
23319
23795
  capName: "pipeline-orchestrator",
23320
23796
  capScope: "system",
23321
23797
  addonId: null,
23322
23798
  access: "create"
23323
23799
  },
23324
- "pipelineOrchestrator.setAgentDetectWeight": {
23800
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23325
23801
  capName: "pipeline-orchestrator",
23326
23802
  capScope: "system",
23327
23803
  addonId: null,
@@ -23363,6 +23839,12 @@ Object.freeze({
23363
23839
  addonId: null,
23364
23840
  access: "create"
23365
23841
  },
23842
+ "pipelineOrchestrator.setPipelineDevicePin": {
23843
+ capName: "pipeline-orchestrator",
23844
+ capScope: "system",
23845
+ addonId: null,
23846
+ access: "create"
23847
+ },
23366
23848
  "pipelineOrchestrator.unassignAudio": {
23367
23849
  capName: "pipeline-orchestrator",
23368
23850
  capScope: "system",
@@ -24915,32 +25397,6 @@ Object.freeze({
24915
25397
  "network-access": "ingress",
24916
25398
  "smtp-provider": "email"
24917
25399
  });
24918
- var frameworkSwapPackageSchema = object({
24919
- name: string(),
24920
- stagedPath: string(),
24921
- backupPath: string(),
24922
- toVersion: string(),
24923
- fromVersion: string().nullable()
24924
- });
24925
- object({
24926
- jobId: string(),
24927
- taskId: string(),
24928
- packages: array(frameworkSwapPackageSchema),
24929
- requestedAtMs: number(),
24930
- schemaVersion: literal(1)
24931
- });
24932
- object({
24933
- jobId: string(),
24934
- taskId: string(),
24935
- backups: array(object({
24936
- name: string(),
24937
- backupPath: string(),
24938
- livePath: string()
24939
- })),
24940
- appliedAtMs: number(),
24941
- bootAttempts: number(),
24942
- schemaVersion: literal(1)
24943
- });
24944
25400
  /**
24945
25401
  * Fixed-capacity ring buffer. When full, push() overwrites the oldest entry.
24946
25402
  * drain() returns up to maxCount items in FIFO order and removes them.