@camstack/addon-remote-storage 1.1.28 → 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.
@@ -7092,6 +7092,17 @@ var ModelCatalogEntrySchema = object({
7092
7092
  "imagenet",
7093
7093
  "none"
7094
7094
  ]).optional(),
7095
+ /**
7096
+ * The model already applies softmax IN-GRAPH — its raw output is a
7097
+ * probability distribution, not logits. When set, the `softmax`
7098
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7099
+ * probability vector collapses it toward uniform (top-1 score craters far
7100
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7101
+ * the output is raw logits and the postprocessor applies softmax (the normal
7102
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7103
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7104
+ */
7105
+ outputProbabilities: boolean().optional(),
7095
7106
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7096
7107
  /**
7097
7108
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7651,6 +7662,160 @@ var EncodeProfileSchema = object({
7651
7662
  */
7652
7663
  outputArgs: array(string()).optional()
7653
7664
  });
7665
+ var COCO_TO_MACRO = {
7666
+ mapping: {
7667
+ person: "person",
7668
+ bicycle: "vehicle",
7669
+ car: "vehicle",
7670
+ motorcycle: "vehicle",
7671
+ airplane: "vehicle",
7672
+ bus: "vehicle",
7673
+ train: "vehicle",
7674
+ truck: "vehicle",
7675
+ boat: "vehicle",
7676
+ bird: "animal",
7677
+ cat: "animal",
7678
+ dog: "animal",
7679
+ horse: "animal",
7680
+ sheep: "animal",
7681
+ cow: "animal",
7682
+ elephant: "animal",
7683
+ bear: "animal",
7684
+ zebra: "animal",
7685
+ giraffe: "animal",
7686
+ suitcase: "package",
7687
+ backpack: "package",
7688
+ handbag: "package"
7689
+ },
7690
+ preserveOriginal: false
7691
+ };
7692
+ var AUDIO_MACRO_LABELS = [
7693
+ {
7694
+ id: "speech",
7695
+ name: "Speech",
7696
+ icon: "🗣️"
7697
+ },
7698
+ {
7699
+ id: "scream",
7700
+ name: "Scream / Shout",
7701
+ icon: "😱"
7702
+ },
7703
+ {
7704
+ id: "crying",
7705
+ name: "Crying / Baby",
7706
+ icon: "😢"
7707
+ },
7708
+ {
7709
+ id: "laughter",
7710
+ name: "Laughter",
7711
+ icon: "😂"
7712
+ },
7713
+ {
7714
+ id: "music",
7715
+ name: "Music",
7716
+ icon: "🎵"
7717
+ },
7718
+ {
7719
+ id: "dog",
7720
+ name: "Dog",
7721
+ icon: "🐕"
7722
+ },
7723
+ {
7724
+ id: "cat",
7725
+ name: "Cat",
7726
+ icon: "🐈"
7727
+ },
7728
+ {
7729
+ id: "bird",
7730
+ name: "Bird",
7731
+ icon: "🐦"
7732
+ },
7733
+ {
7734
+ id: "animal",
7735
+ name: "Animal (other)",
7736
+ icon: "🐾"
7737
+ },
7738
+ {
7739
+ id: "alarm",
7740
+ name: "Alarm / Siren",
7741
+ icon: "🚨"
7742
+ },
7743
+ {
7744
+ id: "doorbell",
7745
+ name: "Doorbell / Knock",
7746
+ icon: "🔔"
7747
+ },
7748
+ {
7749
+ id: "glass_breaking",
7750
+ name: "Glass Breaking",
7751
+ icon: "💥"
7752
+ },
7753
+ {
7754
+ id: "gunshot",
7755
+ name: "Gunshot / Explosion",
7756
+ icon: "💣"
7757
+ },
7758
+ {
7759
+ id: "vehicle",
7760
+ name: "Vehicle",
7761
+ icon: "🚗"
7762
+ },
7763
+ {
7764
+ id: "siren",
7765
+ name: "Emergency Siren",
7766
+ icon: "🚑"
7767
+ },
7768
+ {
7769
+ id: "fire",
7770
+ name: "Fire / Smoke",
7771
+ icon: "🔥"
7772
+ },
7773
+ {
7774
+ id: "water",
7775
+ name: "Water",
7776
+ icon: "💧"
7777
+ },
7778
+ {
7779
+ id: "wind",
7780
+ name: "Wind / Weather",
7781
+ icon: "🌬️"
7782
+ },
7783
+ {
7784
+ id: "door",
7785
+ name: "Door",
7786
+ icon: "🚪"
7787
+ },
7788
+ {
7789
+ id: "footsteps",
7790
+ name: "Footsteps",
7791
+ icon: "👣"
7792
+ },
7793
+ {
7794
+ id: "crowd",
7795
+ name: "Crowd / Chatter",
7796
+ icon: "👥"
7797
+ },
7798
+ {
7799
+ id: "telephone",
7800
+ name: "Telephone",
7801
+ icon: "📞"
7802
+ },
7803
+ {
7804
+ id: "engine",
7805
+ name: "Engine / Motor",
7806
+ icon: "⚙️"
7807
+ },
7808
+ {
7809
+ id: "tools",
7810
+ name: "Tools / Construction",
7811
+ icon: "🔨"
7812
+ },
7813
+ {
7814
+ id: "silence",
7815
+ name: "Silence",
7816
+ icon: "🤫"
7817
+ }
7818
+ ];
7654
7819
  var YAMNET_TO_MACRO = {
7655
7820
  mapping: {
7656
7821
  Speech: "speech",
@@ -7917,6 +8082,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7917
8082
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7918
8083
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7919
8084
  /**
8085
+ * Unified event-kind taxonomy — THE single source of truth for
8086
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8087
+ * icon }`.
8088
+ *
8089
+ * This dictionary folds together what used to be scattered across four
8090
+ * copies:
8091
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8092
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8093
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8094
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8095
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8096
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8097
+ *
8098
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8099
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8100
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8101
+ * color or an icon: they read this dictionary (server descriptors carry the
8102
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8103
+ *
8104
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8105
+ */
8106
+ var TAXONOMY_COLORS = {
8107
+ motion: "#f59e0b",
8108
+ audio: "#06b6d4",
8109
+ person: "#22c55e",
8110
+ vehicle: "#3b82f6",
8111
+ animal: "#f97316",
8112
+ package: "#a855f7",
8113
+ sensor: "#8b5cf6",
8114
+ control: "#10b981",
8115
+ genericDetection: "#64748b"
8116
+ };
8117
+ var DETECTION_SUB_COLORS = {
8118
+ car: "#f59e0b",
8119
+ truck: "#d97706",
8120
+ bus: "#b45309",
8121
+ motorcycle: "#eab308",
8122
+ bicycle: "#ca8a04",
8123
+ airplane: "#60a5fa",
8124
+ boat: "#2563eb",
8125
+ train: "#1d4ed8",
8126
+ bird: "#14b8a6",
8127
+ dog: "#84cc16",
8128
+ cat: "#f97316",
8129
+ horse: "#a16207",
8130
+ sheep: "#a3a3a3",
8131
+ cow: "#78716c",
8132
+ elephant: "#6b7280",
8133
+ bear: "#7c2d12",
8134
+ zebra: "#404040",
8135
+ giraffe: "#d4a373"
8136
+ };
8137
+ function titleCase(id) {
8138
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8139
+ }
8140
+ var entries = /* @__PURE__ */ new Map();
8141
+ function macro(kind, category, color, iconId, label) {
8142
+ entries.set(kind, {
8143
+ kind,
8144
+ parentKind: null,
8145
+ level: "macro",
8146
+ category,
8147
+ color,
8148
+ iconId,
8149
+ labelKey: `eventKind.${kind}`,
8150
+ label
8151
+ });
8152
+ }
8153
+ function sub(kind, parentKind, category, color, iconId, label) {
8154
+ entries.set(kind, {
8155
+ kind,
8156
+ parentKind,
8157
+ level: "sub",
8158
+ category,
8159
+ color,
8160
+ iconId,
8161
+ labelKey: `eventKind.${kind}`,
8162
+ label
8163
+ });
8164
+ }
8165
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8166
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8167
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8168
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8169
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8170
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8171
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8172
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8173
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8174
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8175
+ if (entries.has(cocoClass)) continue;
8176
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8177
+ }
8178
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8179
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8180
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8181
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8182
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8183
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8184
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8185
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8186
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8187
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8188
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8189
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8190
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8191
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8192
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8193
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8194
+ sub("button", "control", "control", "#10b981", "button", "Button");
8195
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8196
+ for (const l of AUDIO_MACRO_LABELS) {
8197
+ const kind = `audio-${l.id}`;
8198
+ if (entries.has(kind)) continue;
8199
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8200
+ }
8201
+ /** The complete taxonomy dictionary, keyed by kind. */
8202
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8203
+ /**
7920
8204
  * Error types for the safe expression engine. Two distinct classes so callers
7921
8205
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7922
8206
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10832,10 +11116,7 @@ var ConfigUISchemaNullableBridge = custom();
10832
11116
  var InferenceCapabilitiesBridge = custom();
10833
11117
  var ModelAvailabilityListBridge = custom();
10834
11118
  var PipelineRunResultBridge = custom();
10835
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10836
- kind: "mutation",
10837
- auth: "admin"
10838
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11119
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10839
11120
  modelId: string(),
10840
11121
  settings: record(string(), unknown()).readonly()
10841
11122
  }))), method(object({ steps: record(string(), object({
@@ -10895,13 +11176,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10895
11176
  * (inputClasses ≠ null) are skipped and served per-track via
10896
11177
  * pipelineRunner.runDetailSubtree (two-plane design).
10897
11178
  */
10898
- plane: _enum(["full", "frame"]).optional()
11179
+ plane: _enum(["full", "frame"]).optional(),
11180
+ /**
11181
+ * Inference-device selector (Phase 2 multi-device). Format
11182
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11183
+ * Omitted ⇒ the runner's default device (current single-engine
11184
+ * behaviour). Selects WHICH device pool of the node runs the call.
11185
+ */
11186
+ deviceKey: string().optional()
10899
11187
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10900
11188
  engine: PipelineEngineChoiceSchema.optional(),
10901
11189
  steps: array(PipelineStepInputSchema).min(1),
10902
11190
  frames: array(FrameInputSchema).min(1).max(255),
10903
11191
  deviceId: number().optional(),
10904
- sessionId: string().optional()
11192
+ sessionId: string().optional(),
11193
+ /**
11194
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11195
+ * the batch to the Python pool's bench preprocess cache
11196
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11197
+ * preprocessed ONCE and every later inference is a pure-inference cache
11198
+ * hit — the sustained-throughput run measures inference, not
11199
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11200
+ * full preprocess every call, correct). Fresh per sustained run;
11201
+ * released via `uncacheFrame`.
11202
+ */
11203
+ frameId: number().int().nonnegative().optional(),
11204
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11205
+ deviceKey: string().optional()
10905
11206
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10906
11207
  data: _instanceof(Uint8Array),
10907
11208
  width: number().int().positive(),
@@ -10933,8 +11234,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10933
11234
  * - `runtime` — main camera-serving engine (no idle TTL).
10934
11235
  * - `warm-override` — benchmark/test override held in the warm
10935
11236
  * cache; auto-disposed after the idle TTL.
11237
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11238
+ * multi-device, keyed by `deviceKey`) resolved
11239
+ * via `resolveDeviceFactory`. Runs alongside the
11240
+ * `runtime` engine on a DIFFERENT accelerator
11241
+ * (NPU / iGPU / Coral) — this is how the
11242
+ * Engines tab shows all pools running at once.
10936
11243
  */
10937
- kind: _enum(["runtime", "warm-override"]),
11244
+ kind: _enum([
11245
+ "runtime",
11246
+ "warm-override",
11247
+ "device-pool"
11248
+ ]),
10938
11249
  /** Native pid of the underlying Python pool (null when no pool). */
10939
11250
  poolPid: number().nullable(),
10940
11251
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11276,7 +11587,14 @@ var RunnerCameraConfigSchema = object({
11276
11587
  * camera's detect node differs from its source-owner (P2d, gated by the
11277
11588
  * `remoteSourcingNodes` rollout setting).
11278
11589
  */
11279
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11590
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11591
+ /**
11592
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11593
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11594
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11595
+ * this only selects WHICH device pool of that node runs the session.
11596
+ */
11597
+ deviceKey: string().optional()
11280
11598
  });
11281
11599
  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;
11282
11600
  /**
@@ -11297,6 +11615,19 @@ var RunnerLocalLoadSchema = object({
11297
11615
  avgInferenceTimeMs: number(),
11298
11616
  /** Total queue depth across motion + detection queues. */
11299
11617
  queueDepthTotal: number(),
11618
+ /**
11619
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11620
+ * this runner currently has attached cameras on, so the orchestrator's second
11621
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11622
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11623
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11624
+ */
11625
+ devices: array(object({
11626
+ deviceKey: string(),
11627
+ backend: string(),
11628
+ attachedCameras: number(),
11629
+ queueDepthTotal: number()
11630
+ })).default([]),
11300
11631
  /** Hardware capability flags reported by this node. */
11301
11632
  hardware: object({
11302
11633
  hasGpu: boolean(),
@@ -12772,6 +13103,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12772
13103
  kind: "mutation",
12773
13104
  auth: "admin"
12774
13105
  });
13106
+ 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;
13107
+ new Set(Object.values(DeviceType));
12775
13108
  /**
12776
13109
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12777
13110
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15866,17 +16199,30 @@ var EventKindCategorySchema = _enum([
15866
16199
  "audio",
15867
16200
  "detection",
15868
16201
  "sensor",
16202
+ "control",
15869
16203
  "custom",
15870
16204
  "package"
15871
16205
  ]);
16206
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16207
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15872
16208
  var EventKindDescriptorSchema = object({
15873
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16209
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15874
16210
  kind: string(),
16211
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16212
+ labelKey: string(),
16213
+ /** English fallback label (kept for clients that don't translate). */
15875
16214
  label: string(),
15876
16215
  /** Hex color for timeline/legend rendering. */
15877
16216
  color: string(),
16217
+ /** Dictionary id → lucide component on the UI side. */
16218
+ iconId: string(),
16219
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15878
16220
  icon: EventKindIconSchema,
15879
16221
  category: EventKindCategorySchema,
16222
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16223
+ parentKind: string().nullable(),
16224
+ /** Derived from `parentKind`, explicit for the client tree. */
16225
+ level: EventKindLevelSchema,
15880
16226
  /** Which cap + device contributes this kind. For built-ins the camera
15881
16227
  * itself; for sensor kinds the LINKED source device. */
15882
16228
  source: object({
@@ -15949,11 +16295,21 @@ var TrackAudioLabelSchema = object({
15949
16295
  firstAt: number(),
15950
16296
  lastAt: number()
15951
16297
  });
16298
+ /**
16299
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16300
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16301
+ * linked sensor/control state change (no positions; carries a snapshot). The
16302
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16303
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16304
+ */
16305
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
15952
16306
  var TrackSchema = object({
15953
16307
  trackId: string(),
15954
16308
  deviceId: number(),
15955
16309
  className: string(),
15956
16310
  label: string().optional(),
16311
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16312
+ source: TrackSourceSchema.optional(),
15957
16313
  firstSeen: number(),
15958
16314
  lastSeen: number(),
15959
16315
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16330,6 +16686,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16330
16686
  eventId: string(),
16331
16687
  timestamp: number()
16332
16688
  });
16689
+ /**
16690
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16691
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16692
+ * caps into per-camera event-kind descriptors.
16693
+ *
16694
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16695
+ * is NOT duplicated here — every entry is derived from the single
16696
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16697
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16698
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16699
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16700
+ * eventful cap is missing.
16701
+ */
16702
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16703
+ var LEGACY_ICON = {
16704
+ motion: "motion",
16705
+ audio: "audio",
16706
+ person: "person",
16707
+ vehicle: "vehicle",
16708
+ animal: "animal",
16709
+ package: "package",
16710
+ door: "door",
16711
+ pir: "pir",
16712
+ smoke: "smoke",
16713
+ water: "water",
16714
+ button: "button",
16715
+ generic: "generic",
16716
+ gas: "smoke",
16717
+ vibration: "generic",
16718
+ tamper: "generic",
16719
+ presence: "person",
16720
+ lock: "generic",
16721
+ siren: "generic",
16722
+ switch: "generic",
16723
+ doorbell: "button"
16724
+ };
16725
+ function legacyIcon(iconId) {
16726
+ return LEGACY_ICON[iconId] ?? "generic";
16727
+ }
16728
+ /**
16729
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16730
+ * The anti-drift guard cross-checks this against the eventful caps declared
16731
+ * in `packages/types/src/capabilities/*.cap.ts`.
16732
+ */
16733
+ var CAP_TO_KIND = {
16734
+ contact: "contact",
16735
+ motion: "motion-sensor",
16736
+ smoke: "smoke",
16737
+ flood: "flood",
16738
+ gas: "gas",
16739
+ "carbon-monoxide": "carbon-monoxide",
16740
+ vibration: "vibration",
16741
+ tamper: "tamper",
16742
+ presence: "presence",
16743
+ "enum-sensor": "enum-sensor",
16744
+ "event-emitter": "device-event",
16745
+ "lock-control": "lock",
16746
+ switch: "switch",
16747
+ button: "button",
16748
+ doorbell: "doorbell"
16749
+ };
16750
+ function buildDescriptor(capName, kind) {
16751
+ const t = EVENT_TAXONOMY[kind];
16752
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16753
+ return {
16754
+ ...t,
16755
+ icon: legacyIcon(t.iconId)
16756
+ };
16757
+ }
16758
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16333
16759
  var CameraPipelineConfigSchema = object({
16334
16760
  engine: PipelineEngineChoiceSchema.optional(),
16335
16761
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16348,13 +16774,11 @@ var PipelineTemplateSchema = object({
16348
16774
  createdAt: string(),
16349
16775
  updatedAt: string()
16350
16776
  });
16351
- var AgentAddonConfigSchema = object({
16352
- enabled: boolean(),
16777
+ var DeviceStepConfigSchema = object({
16353
16778
  modelId: string().optional(),
16354
- settings: record(string(), unknown()).readonly()
16779
+ settings: record(string(), unknown()).optional()
16355
16780
  });
16356
16781
  var AgentPipelineSettingsSchema = object({
16357
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16358
16782
  maxCameras: number().int().nonnegative().nullable().default(null),
16359
16783
  /** Per-node detection weight (relative share for the quota balancer). */
16360
16784
  detectWeight: number().positive().optional(),
@@ -16378,7 +16802,22 @@ var AgentPipelineSettingsSchema = object({
16378
16802
  * it already uses to reach the hub). Set this only when the auto-detected
16379
16803
  * address is wrong (multi-homed host, NAT, custom interface).
16380
16804
  */
16381
- reachableHost: string().optional()
16805
+ reachableHost: string().optional(),
16806
+ /**
16807
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16808
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16809
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16810
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16811
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16812
+ * the default model/settings for every camera landing on that accelerator;
16813
+ * a stepId absent ⇒ the step uses that device's format default.
16814
+ */
16815
+ inferenceDevices: record(string(), object({
16816
+ enabled: boolean(),
16817
+ weight: number().positive().optional(),
16818
+ maxSessions: number().int().positive().optional(),
16819
+ steps: record(string(), DeviceStepConfigSchema).optional()
16820
+ })).optional()
16382
16821
  });
16383
16822
  var CameraPipelineForAgentSchema = object({
16384
16823
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16388,14 +16827,13 @@ var CameraPipelineForAgentSchema = object({
16388
16827
  }).nullable()
16389
16828
  });
16390
16829
  var CameraStepOverridePatchSchema = object({
16391
- enabled: boolean().optional(),
16392
16830
  modelId: string().optional(),
16393
16831
  settings: record(string(), unknown()).readonly().optional()
16394
16832
  });
16395
16833
  var CameraPipelineSettingsSchema = object({
16396
16834
  pinnedAgentNodeId: string().optional(),
16397
16835
  stepToggles: record(string(), boolean()).optional(),
16398
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16836
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16399
16837
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16400
16838
  });
16401
16839
  /**
@@ -16609,6 +17047,44 @@ var CameraStatusSchema = object({
16609
17047
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16610
17048
  fetchedAt: number()
16611
17049
  });
17050
+ var NodeInferenceDeviceSchema = object({
17051
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17052
+ key: string(),
17053
+ backend: string(),
17054
+ device: string(),
17055
+ format: _enum(MODEL_FORMATS),
17056
+ /** Whether the node's live probe reports the device as usable right now. */
17057
+ available: boolean(),
17058
+ /**
17059
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17060
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17061
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17062
+ * not a balanced target). An explicit stored value always wins; a stored-only
17063
+ * (unavailable) key keeps its stored value.
17064
+ */
17065
+ enabled: boolean(),
17066
+ /** Relative balancer weight for the enabled device (default 1). */
17067
+ weight: number(),
17068
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17069
+ maxSessions: number().nullable(),
17070
+ /** Object-detection model the executor defaults to for this deviceKey. */
17071
+ defaultModelId: string(),
17072
+ /**
17073
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17074
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17075
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17076
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17077
+ * available per format; this is the stored selection that becomes the
17078
+ * default for EVERY camera landing on this accelerator.
17079
+ */
17080
+ steps: record(string(), DeviceStepConfigSchema).optional()
17081
+ });
17082
+ var NodeInferenceDevicesSchema = object({
17083
+ nodeId: string(),
17084
+ /** False when the node's platform-probe was unreachable (no live device set). */
17085
+ reachable: boolean(),
17086
+ devices: array(NodeInferenceDeviceSchema).readonly()
17087
+ });
16612
17088
  method(object({
16613
17089
  deviceId: number(),
16614
17090
  agentNodeId: string()
@@ -16618,7 +17094,13 @@ method(object({
16618
17094
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16619
17095
  kind: "mutation",
16620
17096
  auth: "admin"
16621
- }), method(_void(), object({ migrated: number() }), {
17097
+ }), method(object({
17098
+ deviceId: number(),
17099
+ deviceKey: string()
17100
+ }), object({ success: literal(true) }), {
17101
+ kind: "mutation",
17102
+ auth: "admin"
17103
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16622
17104
  kind: "mutation",
16623
17105
  auth: "admin"
16624
17106
  }), 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({
@@ -16652,13 +17134,7 @@ method(object({
16652
17134
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16653
17135
  nodeId: string(),
16654
17136
  settings: AgentPipelineSettingsSchema
16655
- })).readonly()), method(object({
16656
- agentNodeId: string(),
16657
- defaults: record(string(), AgentAddonConfigSchema)
16658
- }), object({ success: literal(true) }), {
16659
- kind: "mutation",
16660
- auth: "admin"
16661
- }), method(object({ agentNodeId: string() }), object({
17137
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16662
17138
  success: boolean(),
16663
17139
  removed: boolean()
16664
17140
  }), {
@@ -16690,7 +17166,18 @@ method(object({
16690
17166
  }), object({ success: literal(true) }), {
16691
17167
  kind: "mutation",
16692
17168
  auth: "admin"
16693
- }), method(object({ agentNodeId: string() }), object({
17169
+ }), method(object({
17170
+ agentNodeId: string(),
17171
+ inferenceDevices: record(string(), object({
17172
+ enabled: boolean(),
17173
+ weight: number().positive().optional(),
17174
+ maxSessions: number().int().positive().optional(),
17175
+ steps: record(string(), DeviceStepConfigSchema).optional()
17176
+ }))
17177
+ }), object({ success: literal(true) }), {
17178
+ kind: "mutation",
17179
+ auth: "admin"
17180
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16694
17181
  success: literal(true),
16695
17182
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16696
17183
  effectiveModelId: string().nullable(),
@@ -16706,9 +17193,10 @@ method(object({
16706
17193
  }), object({ success: literal(true) }), {
16707
17194
  kind: "mutation",
16708
17195
  auth: "admin"
16709
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17196
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16710
17197
  deviceId: number(),
16711
17198
  agentNodeId: string(),
17199
+ deviceKey: string(),
16712
17200
  addonId: string(),
16713
17201
  patch: CameraStepOverridePatchSchema.nullable()
16714
17202
  }), object({ success: literal(true) }), {
@@ -16745,14 +17233,13 @@ method(object({
16745
17233
  });
16746
17234
  /**
16747
17235
  * server-management — per-NODE singleton capability for a node's ROOT
16748
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16749
- * agents).
17236
+ * package lifecycle (runtime-updatable node packages).
16750
17237
  *
16751
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16752
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16753
- * version describes the node. Updates install into
16754
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16755
- * starter (probation boot + auto-rollback to N-1).
17238
+ * Every node role runs the SAME root package (`@camstack/server`), which
17239
+ * carries the whole software stack in its npm dep tree, so ONE version
17240
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17241
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17242
+ * no auto-rollback).
16756
17243
  *
16757
17244
  * Providers:
16758
17245
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16860,7 +17347,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16860
17347
  /** Explicit target version; omitted = latest from the registry. */
16861
17348
  version: string().optional() }), ServerUpdateActionResultSchema, {
16862
17349
  kind: "mutation",
16863
- auth: "admin"
17350
+ auth: "admin",
17351
+ timeoutMs: 16 * 6e4
16864
17352
  }), method(_void(), ServerUpdateActionResultSchema, {
16865
17353
  kind: "mutation",
16866
17354
  auth: "admin"
@@ -17949,22 +18437,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17949
18437
  var RestartAddonResultSchema = unknown();
17950
18438
  var InstallPackageResultSchema = unknown();
17951
18439
  var ReloadPackagesResultSchema = unknown();
17952
- /**
17953
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
17954
- * server restarts so the admin UI can react to the `restartingAt`
17955
- * timestamp (shows reconnect overlay). The transition from
17956
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
17957
- * `system.restart-completed` event after the new process boots.
17958
- *
17959
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
17960
- */
17961
- var UpdateFrameworkPackageResultSchema = object({
17962
- packageName: string(),
17963
- fromVersion: string(),
17964
- toVersion: string(),
17965
- /** Ms-epoch the server scheduled its self-restart. */
17966
- restartingAt: number()
17967
- });
17968
18440
  var BulkUpdateItemStatusSchema = _enum([
17969
18441
  "queued",
17970
18442
  "updating",
@@ -18092,13 +18564,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18092
18564
  }), object({ success: literal(true) }), {
18093
18565
  kind: "mutation",
18094
18566
  auth: "admin"
18095
- }), method(object({
18096
- packageName: string().min(1),
18097
- version: string().optional(),
18098
- deferRestart: boolean().optional()
18099
- }), UpdateFrameworkPackageResultSchema, {
18100
- kind: "mutation",
18101
- auth: "admin"
18102
18567
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18103
18568
  kind: "mutation",
18104
18569
  auth: "admin"
@@ -18964,10 +19429,10 @@ var TopologyCategorySchema = object({
18964
19429
  addons: array(TopologyCategoryAddonSchema).readonly()
18965
19430
  });
18966
19431
  /**
18967
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
18968
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
18969
- * version visibility for the Server management surface. Nullable: offline
18970
- * rows and pre-phase-2 nodes report none.
19432
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19433
+ * root package for every node role) as reported by its `registerNode`
19434
+ * manifest — version visibility for the Server management surface. Nullable:
19435
+ * offline rows and nodes that never reported one.
18971
19436
  */
18972
19437
  var TopologyRootPackageSchema = object({
18973
19438
  name: string(),
@@ -19355,17 +19820,28 @@ var PlatformScoreSchema = object({
19355
19820
  format: _enum([
19356
19821
  "onnx",
19357
19822
  "coreml",
19358
- "openvino"
19823
+ "openvino",
19824
+ "tflite"
19359
19825
  ]),
19360
19826
  score: number(),
19361
19827
  reason: string(),
19362
19828
  available: boolean()
19363
19829
  });
19830
+ var InferenceDeviceDescriptorSchema = object({
19831
+ key: string(),
19832
+ backend: string(),
19833
+ device: string(),
19834
+ format: ModelFormatSchema,
19835
+ runtime: literal("python"),
19836
+ score: number(),
19837
+ available: boolean()
19838
+ });
19364
19839
  var PlatformCapabilitiesSchema = object({
19365
19840
  hardware: HardwareInfoSchema,
19366
19841
  scores: array(PlatformScoreSchema).readonly(),
19367
19842
  bestScore: PlatformScoreSchema,
19368
- pythonPath: string().nullable()
19843
+ pythonPath: string().nullable(),
19844
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19369
19845
  });
19370
19846
  var ModelRequirementSchema = object({
19371
19847
  modelId: string(),
@@ -20244,12 +20720,6 @@ Object.freeze({
20244
20720
  addonId: null,
20245
20721
  access: "delete"
20246
20722
  },
20247
- "addons.updateFrameworkPackage": {
20248
- capName: "addons",
20249
- capScope: "system",
20250
- addonId: null,
20251
- access: "create"
20252
- },
20253
20723
  "addons.updatePackage": {
20254
20724
  capName: "addons",
20255
20725
  capScope: "system",
@@ -23022,12 +23492,6 @@ Object.freeze({
23022
23492
  addonId: null,
23023
23493
  access: "view"
23024
23494
  },
23025
- "pipelineExecutor.reprobeEngine": {
23026
- capName: "pipeline-executor",
23027
- capScope: "system",
23028
- addonId: null,
23029
- access: "create"
23030
- },
23031
23495
  "pipelineExecutor.runAudioTest": {
23032
23496
  capName: "pipeline-executor",
23033
23497
  capScope: "system",
@@ -23178,6 +23642,12 @@ Object.freeze({
23178
23642
  addonId: null,
23179
23643
  access: "view"
23180
23644
  },
23645
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23646
+ capName: "pipeline-orchestrator",
23647
+ capScope: "system",
23648
+ addonId: null,
23649
+ access: "view"
23650
+ },
23181
23651
  "pipelineOrchestrator.getPipelineAssignment": {
23182
23652
  capName: "pipeline-orchestrator",
23183
23653
  capScope: "system",
@@ -23190,6 +23660,12 @@ Object.freeze({
23190
23660
  addonId: null,
23191
23661
  access: "view"
23192
23662
  },
23663
+ "pipelineOrchestrator.getPipelineDevicePin": {
23664
+ capName: "pipeline-orchestrator",
23665
+ capScope: "system",
23666
+ addonId: null,
23667
+ access: "view"
23668
+ },
23193
23669
  "pipelineOrchestrator.listAgentSettings": {
23194
23670
  capName: "pipeline-orchestrator",
23195
23671
  capScope: "system",
@@ -23232,19 +23708,19 @@ Object.freeze({
23232
23708
  addonId: null,
23233
23709
  access: "create"
23234
23710
  },
23235
- "pipelineOrchestrator.setAgentAddonDefaults": {
23711
+ "pipelineOrchestrator.setAgentCapabilities": {
23236
23712
  capName: "pipeline-orchestrator",
23237
23713
  capScope: "system",
23238
23714
  addonId: null,
23239
23715
  access: "create"
23240
23716
  },
23241
- "pipelineOrchestrator.setAgentCapabilities": {
23717
+ "pipelineOrchestrator.setAgentDetectWeight": {
23242
23718
  capName: "pipeline-orchestrator",
23243
23719
  capScope: "system",
23244
23720
  addonId: null,
23245
23721
  access: "create"
23246
23722
  },
23247
- "pipelineOrchestrator.setAgentDetectWeight": {
23723
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23248
23724
  capName: "pipeline-orchestrator",
23249
23725
  capScope: "system",
23250
23726
  addonId: null,
@@ -23286,6 +23762,12 @@ Object.freeze({
23286
23762
  addonId: null,
23287
23763
  access: "create"
23288
23764
  },
23765
+ "pipelineOrchestrator.setPipelineDevicePin": {
23766
+ capName: "pipeline-orchestrator",
23767
+ capScope: "system",
23768
+ addonId: null,
23769
+ access: "create"
23770
+ },
23289
23771
  "pipelineOrchestrator.unassignAudio": {
23290
23772
  capName: "pipeline-orchestrator",
23291
23773
  capScope: "system",
@@ -24838,32 +25320,6 @@ Object.freeze({
24838
25320
  "network-access": "ingress",
24839
25321
  "smtp-provider": "email"
24840
25322
  });
24841
- var frameworkSwapPackageSchema = object({
24842
- name: string(),
24843
- stagedPath: string(),
24844
- backupPath: string(),
24845
- toVersion: string(),
24846
- fromVersion: string().nullable()
24847
- });
24848
- object({
24849
- jobId: string(),
24850
- taskId: string(),
24851
- packages: array(frameworkSwapPackageSchema),
24852
- requestedAtMs: number(),
24853
- schemaVersion: literal(1)
24854
- });
24855
- object({
24856
- jobId: string(),
24857
- taskId: string(),
24858
- backups: array(object({
24859
- name: string(),
24860
- backupPath: string(),
24861
- livePath: string()
24862
- })),
24863
- appliedAtMs: number(),
24864
- bootAttempts: number(),
24865
- schemaVersion: literal(1)
24866
- });
24867
25323
  //#endregion
24868
25324
  //#region src/shared.ts
24869
25325
  /**