@camstack/addon-cloudflare 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.
@@ -7067,6 +7067,17 @@ var ModelCatalogEntrySchema = object({
7067
7067
  "imagenet",
7068
7068
  "none"
7069
7069
  ]).optional(),
7070
+ /**
7071
+ * The model already applies softmax IN-GRAPH — its raw output is a
7072
+ * probability distribution, not logits. When set, the `softmax`
7073
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7074
+ * probability vector collapses it toward uniform (top-1 score craters far
7075
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7076
+ * the output is raw logits and the postprocessor applies softmax (the normal
7077
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7078
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7079
+ */
7080
+ outputProbabilities: boolean().optional(),
7070
7081
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7071
7082
  /**
7072
7083
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7626,6 +7637,160 @@ var EncodeProfileSchema = object({
7626
7637
  */
7627
7638
  outputArgs: array(string()).optional()
7628
7639
  });
7640
+ var COCO_TO_MACRO = {
7641
+ mapping: {
7642
+ person: "person",
7643
+ bicycle: "vehicle",
7644
+ car: "vehicle",
7645
+ motorcycle: "vehicle",
7646
+ airplane: "vehicle",
7647
+ bus: "vehicle",
7648
+ train: "vehicle",
7649
+ truck: "vehicle",
7650
+ boat: "vehicle",
7651
+ bird: "animal",
7652
+ cat: "animal",
7653
+ dog: "animal",
7654
+ horse: "animal",
7655
+ sheep: "animal",
7656
+ cow: "animal",
7657
+ elephant: "animal",
7658
+ bear: "animal",
7659
+ zebra: "animal",
7660
+ giraffe: "animal",
7661
+ suitcase: "package",
7662
+ backpack: "package",
7663
+ handbag: "package"
7664
+ },
7665
+ preserveOriginal: false
7666
+ };
7667
+ var AUDIO_MACRO_LABELS = [
7668
+ {
7669
+ id: "speech",
7670
+ name: "Speech",
7671
+ icon: "🗣️"
7672
+ },
7673
+ {
7674
+ id: "scream",
7675
+ name: "Scream / Shout",
7676
+ icon: "😱"
7677
+ },
7678
+ {
7679
+ id: "crying",
7680
+ name: "Crying / Baby",
7681
+ icon: "😢"
7682
+ },
7683
+ {
7684
+ id: "laughter",
7685
+ name: "Laughter",
7686
+ icon: "😂"
7687
+ },
7688
+ {
7689
+ id: "music",
7690
+ name: "Music",
7691
+ icon: "🎵"
7692
+ },
7693
+ {
7694
+ id: "dog",
7695
+ name: "Dog",
7696
+ icon: "🐕"
7697
+ },
7698
+ {
7699
+ id: "cat",
7700
+ name: "Cat",
7701
+ icon: "🐈"
7702
+ },
7703
+ {
7704
+ id: "bird",
7705
+ name: "Bird",
7706
+ icon: "🐦"
7707
+ },
7708
+ {
7709
+ id: "animal",
7710
+ name: "Animal (other)",
7711
+ icon: "🐾"
7712
+ },
7713
+ {
7714
+ id: "alarm",
7715
+ name: "Alarm / Siren",
7716
+ icon: "🚨"
7717
+ },
7718
+ {
7719
+ id: "doorbell",
7720
+ name: "Doorbell / Knock",
7721
+ icon: "🔔"
7722
+ },
7723
+ {
7724
+ id: "glass_breaking",
7725
+ name: "Glass Breaking",
7726
+ icon: "💥"
7727
+ },
7728
+ {
7729
+ id: "gunshot",
7730
+ name: "Gunshot / Explosion",
7731
+ icon: "💣"
7732
+ },
7733
+ {
7734
+ id: "vehicle",
7735
+ name: "Vehicle",
7736
+ icon: "🚗"
7737
+ },
7738
+ {
7739
+ id: "siren",
7740
+ name: "Emergency Siren",
7741
+ icon: "🚑"
7742
+ },
7743
+ {
7744
+ id: "fire",
7745
+ name: "Fire / Smoke",
7746
+ icon: "🔥"
7747
+ },
7748
+ {
7749
+ id: "water",
7750
+ name: "Water",
7751
+ icon: "💧"
7752
+ },
7753
+ {
7754
+ id: "wind",
7755
+ name: "Wind / Weather",
7756
+ icon: "🌬️"
7757
+ },
7758
+ {
7759
+ id: "door",
7760
+ name: "Door",
7761
+ icon: "🚪"
7762
+ },
7763
+ {
7764
+ id: "footsteps",
7765
+ name: "Footsteps",
7766
+ icon: "👣"
7767
+ },
7768
+ {
7769
+ id: "crowd",
7770
+ name: "Crowd / Chatter",
7771
+ icon: "👥"
7772
+ },
7773
+ {
7774
+ id: "telephone",
7775
+ name: "Telephone",
7776
+ icon: "📞"
7777
+ },
7778
+ {
7779
+ id: "engine",
7780
+ name: "Engine / Motor",
7781
+ icon: "⚙️"
7782
+ },
7783
+ {
7784
+ id: "tools",
7785
+ name: "Tools / Construction",
7786
+ icon: "🔨"
7787
+ },
7788
+ {
7789
+ id: "silence",
7790
+ name: "Silence",
7791
+ icon: "🤫"
7792
+ }
7793
+ ];
7629
7794
  var YAMNET_TO_MACRO = {
7630
7795
  mapping: {
7631
7796
  Speech: "speech",
@@ -7892,6 +8057,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7892
8057
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7893
8058
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7894
8059
  /**
8060
+ * Unified event-kind taxonomy — THE single source of truth for
8061
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8062
+ * icon }`.
8063
+ *
8064
+ * This dictionary folds together what used to be scattered across four
8065
+ * copies:
8066
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8067
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8068
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8069
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8070
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8071
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8072
+ *
8073
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8074
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8075
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8076
+ * color or an icon: they read this dictionary (server descriptors carry the
8077
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8078
+ *
8079
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8080
+ */
8081
+ var TAXONOMY_COLORS = {
8082
+ motion: "#f59e0b",
8083
+ audio: "#06b6d4",
8084
+ person: "#22c55e",
8085
+ vehicle: "#3b82f6",
8086
+ animal: "#f97316",
8087
+ package: "#a855f7",
8088
+ sensor: "#8b5cf6",
8089
+ control: "#10b981",
8090
+ genericDetection: "#64748b"
8091
+ };
8092
+ var DETECTION_SUB_COLORS = {
8093
+ car: "#f59e0b",
8094
+ truck: "#d97706",
8095
+ bus: "#b45309",
8096
+ motorcycle: "#eab308",
8097
+ bicycle: "#ca8a04",
8098
+ airplane: "#60a5fa",
8099
+ boat: "#2563eb",
8100
+ train: "#1d4ed8",
8101
+ bird: "#14b8a6",
8102
+ dog: "#84cc16",
8103
+ cat: "#f97316",
8104
+ horse: "#a16207",
8105
+ sheep: "#a3a3a3",
8106
+ cow: "#78716c",
8107
+ elephant: "#6b7280",
8108
+ bear: "#7c2d12",
8109
+ zebra: "#404040",
8110
+ giraffe: "#d4a373"
8111
+ };
8112
+ function titleCase(id) {
8113
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8114
+ }
8115
+ var entries = /* @__PURE__ */ new Map();
8116
+ function macro(kind, category, color, iconId, label) {
8117
+ entries.set(kind, {
8118
+ kind,
8119
+ parentKind: null,
8120
+ level: "macro",
8121
+ category,
8122
+ color,
8123
+ iconId,
8124
+ labelKey: `eventKind.${kind}`,
8125
+ label
8126
+ });
8127
+ }
8128
+ function sub(kind, parentKind, category, color, iconId, label) {
8129
+ entries.set(kind, {
8130
+ kind,
8131
+ parentKind,
8132
+ level: "sub",
8133
+ category,
8134
+ color,
8135
+ iconId,
8136
+ labelKey: `eventKind.${kind}`,
8137
+ label
8138
+ });
8139
+ }
8140
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8141
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8142
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8143
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8144
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8145
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8146
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8147
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8148
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8149
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8150
+ if (entries.has(cocoClass)) continue;
8151
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8152
+ }
8153
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8154
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8155
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8156
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8157
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8158
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8159
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8160
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8161
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8162
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8163
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8164
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8165
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8166
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8167
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8168
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8169
+ sub("button", "control", "control", "#10b981", "button", "Button");
8170
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8171
+ for (const l of AUDIO_MACRO_LABELS) {
8172
+ const kind = `audio-${l.id}`;
8173
+ if (entries.has(kind)) continue;
8174
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8175
+ }
8176
+ /** The complete taxonomy dictionary, keyed by kind. */
8177
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8178
+ /**
7895
8179
  * Error types for the safe expression engine. Two distinct classes so callers
7896
8180
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7897
8181
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10807,10 +11091,7 @@ var ConfigUISchemaNullableBridge = custom();
10807
11091
  var InferenceCapabilitiesBridge = custom();
10808
11092
  var ModelAvailabilityListBridge = custom();
10809
11093
  var PipelineRunResultBridge = custom();
10810
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10811
- kind: "mutation",
10812
- auth: "admin"
10813
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11094
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10814
11095
  modelId: string(),
10815
11096
  settings: record(string(), unknown()).readonly()
10816
11097
  }))), method(object({ steps: record(string(), object({
@@ -10870,13 +11151,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10870
11151
  * (inputClasses ≠ null) are skipped and served per-track via
10871
11152
  * pipelineRunner.runDetailSubtree (two-plane design).
10872
11153
  */
10873
- plane: _enum(["full", "frame"]).optional()
11154
+ plane: _enum(["full", "frame"]).optional(),
11155
+ /**
11156
+ * Inference-device selector (Phase 2 multi-device). Format
11157
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11158
+ * Omitted ⇒ the runner's default device (current single-engine
11159
+ * behaviour). Selects WHICH device pool of the node runs the call.
11160
+ */
11161
+ deviceKey: string().optional()
10874
11162
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
10875
11163
  engine: PipelineEngineChoiceSchema.optional(),
10876
11164
  steps: array(PipelineStepInputSchema).min(1),
10877
11165
  frames: array(FrameInputSchema).min(1).max(255),
10878
11166
  deviceId: number().optional(),
10879
- sessionId: string().optional()
11167
+ sessionId: string().optional(),
11168
+ /**
11169
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11170
+ * the batch to the Python pool's bench preprocess cache
11171
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11172
+ * preprocessed ONCE and every later inference is a pure-inference cache
11173
+ * hit — the sustained-throughput run measures inference, not
11174
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11175
+ * full preprocess every call, correct). Fresh per sustained run;
11176
+ * released via `uncacheFrame`.
11177
+ */
11178
+ frameId: number().int().nonnegative().optional(),
11179
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11180
+ deviceKey: string().optional()
10880
11181
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
10881
11182
  data: _instanceof(Uint8Array),
10882
11183
  width: number().int().positive(),
@@ -10908,8 +11209,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10908
11209
  * - `runtime` — main camera-serving engine (no idle TTL).
10909
11210
  * - `warm-override` — benchmark/test override held in the warm
10910
11211
  * cache; auto-disposed after the idle TTL.
11212
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11213
+ * multi-device, keyed by `deviceKey`) resolved
11214
+ * via `resolveDeviceFactory`. Runs alongside the
11215
+ * `runtime` engine on a DIFFERENT accelerator
11216
+ * (NPU / iGPU / Coral) — this is how the
11217
+ * Engines tab shows all pools running at once.
10911
11218
  */
10912
- kind: _enum(["runtime", "warm-override"]),
11219
+ kind: _enum([
11220
+ "runtime",
11221
+ "warm-override",
11222
+ "device-pool"
11223
+ ]),
10913
11224
  /** Native pid of the underlying Python pool (null when no pool). */
10914
11225
  poolPid: number().nullable(),
10915
11226
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11251,7 +11562,14 @@ var RunnerCameraConfigSchema = object({
11251
11562
  * camera's detect node differs from its source-owner (P2d, gated by the
11252
11563
  * `remoteSourcingNodes` rollout setting).
11253
11564
  */
11254
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11565
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11566
+ /**
11567
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11568
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11569
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11570
+ * this only selects WHICH device pool of that node runs the session.
11571
+ */
11572
+ deviceKey: string().optional()
11255
11573
  });
11256
11574
  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;
11257
11575
  /**
@@ -11272,6 +11590,19 @@ var RunnerLocalLoadSchema = object({
11272
11590
  avgInferenceTimeMs: number(),
11273
11591
  /** Total queue depth across motion + detection queues. */
11274
11592
  queueDepthTotal: number(),
11593
+ /**
11594
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11595
+ * this runner currently has attached cameras on, so the orchestrator's second
11596
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11597
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11598
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11599
+ */
11600
+ devices: array(object({
11601
+ deviceKey: string(),
11602
+ backend: string(),
11603
+ attachedCameras: number(),
11604
+ queueDepthTotal: number()
11605
+ })).default([]),
11275
11606
  /** Hardware capability flags reported by this node. */
11276
11607
  hardware: object({
11277
11608
  hasGpu: boolean(),
@@ -12747,6 +13078,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12747
13078
  kind: "mutation",
12748
13079
  auth: "admin"
12749
13080
  });
13081
+ 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;
13082
+ new Set(Object.values(DeviceType));
12750
13083
  /**
12751
13084
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12752
13085
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -15879,17 +16212,30 @@ var EventKindCategorySchema = _enum([
15879
16212
  "audio",
15880
16213
  "detection",
15881
16214
  "sensor",
16215
+ "control",
15882
16216
  "custom",
15883
16217
  "package"
15884
16218
  ]);
16219
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16220
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15885
16221
  var EventKindDescriptorSchema = object({
15886
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16222
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15887
16223
  kind: string(),
16224
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16225
+ labelKey: string(),
16226
+ /** English fallback label (kept for clients that don't translate). */
15888
16227
  label: string(),
15889
16228
  /** Hex color for timeline/legend rendering. */
15890
16229
  color: string(),
16230
+ /** Dictionary id → lucide component on the UI side. */
16231
+ iconId: string(),
16232
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15891
16233
  icon: EventKindIconSchema,
15892
16234
  category: EventKindCategorySchema,
16235
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16236
+ parentKind: string().nullable(),
16237
+ /** Derived from `parentKind`, explicit for the client tree. */
16238
+ level: EventKindLevelSchema,
15893
16239
  /** Which cap + device contributes this kind. For built-ins the camera
15894
16240
  * itself; for sensor kinds the LINKED source device. */
15895
16241
  source: object({
@@ -15962,11 +16308,21 @@ var TrackAudioLabelSchema = object({
15962
16308
  firstAt: number(),
15963
16309
  lastAt: number()
15964
16310
  });
16311
+ /**
16312
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16313
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16314
+ * linked sensor/control state change (no positions; carries a snapshot). The
16315
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16316
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16317
+ */
16318
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
15965
16319
  var TrackSchema = object({
15966
16320
  trackId: string(),
15967
16321
  deviceId: number(),
15968
16322
  className: string(),
15969
16323
  label: string().optional(),
16324
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16325
+ source: TrackSourceSchema.optional(),
15970
16326
  firstSeen: number(),
15971
16327
  lastSeen: number(),
15972
16328
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16343,6 +16699,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16343
16699
  eventId: string(),
16344
16700
  timestamp: number()
16345
16701
  });
16702
+ /**
16703
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16704
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16705
+ * caps into per-camera event-kind descriptors.
16706
+ *
16707
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16708
+ * is NOT duplicated here — every entry is derived from the single
16709
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16710
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16711
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16712
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16713
+ * eventful cap is missing.
16714
+ */
16715
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16716
+ var LEGACY_ICON = {
16717
+ motion: "motion",
16718
+ audio: "audio",
16719
+ person: "person",
16720
+ vehicle: "vehicle",
16721
+ animal: "animal",
16722
+ package: "package",
16723
+ door: "door",
16724
+ pir: "pir",
16725
+ smoke: "smoke",
16726
+ water: "water",
16727
+ button: "button",
16728
+ generic: "generic",
16729
+ gas: "smoke",
16730
+ vibration: "generic",
16731
+ tamper: "generic",
16732
+ presence: "person",
16733
+ lock: "generic",
16734
+ siren: "generic",
16735
+ switch: "generic",
16736
+ doorbell: "button"
16737
+ };
16738
+ function legacyIcon(iconId) {
16739
+ return LEGACY_ICON[iconId] ?? "generic";
16740
+ }
16741
+ /**
16742
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16743
+ * The anti-drift guard cross-checks this against the eventful caps declared
16744
+ * in `packages/types/src/capabilities/*.cap.ts`.
16745
+ */
16746
+ var CAP_TO_KIND = {
16747
+ contact: "contact",
16748
+ motion: "motion-sensor",
16749
+ smoke: "smoke",
16750
+ flood: "flood",
16751
+ gas: "gas",
16752
+ "carbon-monoxide": "carbon-monoxide",
16753
+ vibration: "vibration",
16754
+ tamper: "tamper",
16755
+ presence: "presence",
16756
+ "enum-sensor": "enum-sensor",
16757
+ "event-emitter": "device-event",
16758
+ "lock-control": "lock",
16759
+ switch: "switch",
16760
+ button: "button",
16761
+ doorbell: "doorbell"
16762
+ };
16763
+ function buildDescriptor(capName, kind) {
16764
+ const t = EVENT_TAXONOMY[kind];
16765
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16766
+ return {
16767
+ ...t,
16768
+ icon: legacyIcon(t.iconId)
16769
+ };
16770
+ }
16771
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16346
16772
  var CameraPipelineConfigSchema = object({
16347
16773
  engine: PipelineEngineChoiceSchema.optional(),
16348
16774
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16361,13 +16787,11 @@ var PipelineTemplateSchema = object({
16361
16787
  createdAt: string(),
16362
16788
  updatedAt: string()
16363
16789
  });
16364
- var AgentAddonConfigSchema = object({
16365
- enabled: boolean(),
16790
+ var DeviceStepConfigSchema = object({
16366
16791
  modelId: string().optional(),
16367
- settings: record(string(), unknown()).readonly()
16792
+ settings: record(string(), unknown()).optional()
16368
16793
  });
16369
16794
  var AgentPipelineSettingsSchema = object({
16370
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16371
16795
  maxCameras: number().int().nonnegative().nullable().default(null),
16372
16796
  /** Per-node detection weight (relative share for the quota balancer). */
16373
16797
  detectWeight: number().positive().optional(),
@@ -16391,7 +16815,22 @@ var AgentPipelineSettingsSchema = object({
16391
16815
  * it already uses to reach the hub). Set this only when the auto-detected
16392
16816
  * address is wrong (multi-homed host, NAT, custom interface).
16393
16817
  */
16394
- reachableHost: string().optional()
16818
+ reachableHost: string().optional(),
16819
+ /**
16820
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16821
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16822
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16823
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16824
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16825
+ * the default model/settings for every camera landing on that accelerator;
16826
+ * a stepId absent ⇒ the step uses that device's format default.
16827
+ */
16828
+ inferenceDevices: record(string(), object({
16829
+ enabled: boolean(),
16830
+ weight: number().positive().optional(),
16831
+ maxSessions: number().int().positive().optional(),
16832
+ steps: record(string(), DeviceStepConfigSchema).optional()
16833
+ })).optional()
16395
16834
  });
16396
16835
  var CameraPipelineForAgentSchema = object({
16397
16836
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16401,14 +16840,13 @@ var CameraPipelineForAgentSchema = object({
16401
16840
  }).nullable()
16402
16841
  });
16403
16842
  var CameraStepOverridePatchSchema = object({
16404
- enabled: boolean().optional(),
16405
16843
  modelId: string().optional(),
16406
16844
  settings: record(string(), unknown()).readonly().optional()
16407
16845
  });
16408
16846
  var CameraPipelineSettingsSchema = object({
16409
16847
  pinnedAgentNodeId: string().optional(),
16410
16848
  stepToggles: record(string(), boolean()).optional(),
16411
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16849
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16412
16850
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16413
16851
  });
16414
16852
  /**
@@ -16622,6 +17060,44 @@ var CameraStatusSchema = object({
16622
17060
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16623
17061
  fetchedAt: number()
16624
17062
  });
17063
+ var NodeInferenceDeviceSchema = object({
17064
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17065
+ key: string(),
17066
+ backend: string(),
17067
+ device: string(),
17068
+ format: _enum(MODEL_FORMATS),
17069
+ /** Whether the node's live probe reports the device as usable right now. */
17070
+ available: boolean(),
17071
+ /**
17072
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17073
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17074
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17075
+ * not a balanced target). An explicit stored value always wins; a stored-only
17076
+ * (unavailable) key keeps its stored value.
17077
+ */
17078
+ enabled: boolean(),
17079
+ /** Relative balancer weight for the enabled device (default 1). */
17080
+ weight: number(),
17081
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17082
+ maxSessions: number().nullable(),
17083
+ /** Object-detection model the executor defaults to for this deviceKey. */
17084
+ defaultModelId: string(),
17085
+ /**
17086
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17087
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17088
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17089
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17090
+ * available per format; this is the stored selection that becomes the
17091
+ * default for EVERY camera landing on this accelerator.
17092
+ */
17093
+ steps: record(string(), DeviceStepConfigSchema).optional()
17094
+ });
17095
+ var NodeInferenceDevicesSchema = object({
17096
+ nodeId: string(),
17097
+ /** False when the node's platform-probe was unreachable (no live device set). */
17098
+ reachable: boolean(),
17099
+ devices: array(NodeInferenceDeviceSchema).readonly()
17100
+ });
16625
17101
  method(object({
16626
17102
  deviceId: number(),
16627
17103
  agentNodeId: string()
@@ -16631,7 +17107,13 @@ method(object({
16631
17107
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16632
17108
  kind: "mutation",
16633
17109
  auth: "admin"
16634
- }), method(_void(), object({ migrated: number() }), {
17110
+ }), method(object({
17111
+ deviceId: number(),
17112
+ deviceKey: string()
17113
+ }), object({ success: literal(true) }), {
17114
+ kind: "mutation",
17115
+ auth: "admin"
17116
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16635
17117
  kind: "mutation",
16636
17118
  auth: "admin"
16637
17119
  }), 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({
@@ -16665,13 +17147,7 @@ method(object({
16665
17147
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16666
17148
  nodeId: string(),
16667
17149
  settings: AgentPipelineSettingsSchema
16668
- })).readonly()), method(object({
16669
- agentNodeId: string(),
16670
- defaults: record(string(), AgentAddonConfigSchema)
16671
- }), object({ success: literal(true) }), {
16672
- kind: "mutation",
16673
- auth: "admin"
16674
- }), method(object({ agentNodeId: string() }), object({
17150
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16675
17151
  success: boolean(),
16676
17152
  removed: boolean()
16677
17153
  }), {
@@ -16703,7 +17179,18 @@ method(object({
16703
17179
  }), object({ success: literal(true) }), {
16704
17180
  kind: "mutation",
16705
17181
  auth: "admin"
16706
- }), method(object({ agentNodeId: string() }), object({
17182
+ }), method(object({
17183
+ agentNodeId: string(),
17184
+ inferenceDevices: record(string(), object({
17185
+ enabled: boolean(),
17186
+ weight: number().positive().optional(),
17187
+ maxSessions: number().int().positive().optional(),
17188
+ steps: record(string(), DeviceStepConfigSchema).optional()
17189
+ }))
17190
+ }), object({ success: literal(true) }), {
17191
+ kind: "mutation",
17192
+ auth: "admin"
17193
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16707
17194
  success: literal(true),
16708
17195
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16709
17196
  effectiveModelId: string().nullable(),
@@ -16719,9 +17206,10 @@ method(object({
16719
17206
  }), object({ success: literal(true) }), {
16720
17207
  kind: "mutation",
16721
17208
  auth: "admin"
16722
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17209
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16723
17210
  deviceId: number(),
16724
17211
  agentNodeId: string(),
17212
+ deviceKey: string(),
16725
17213
  addonId: string(),
16726
17214
  patch: CameraStepOverridePatchSchema.nullable()
16727
17215
  }), object({ success: literal(true) }), {
@@ -16758,14 +17246,13 @@ method(object({
16758
17246
  });
16759
17247
  /**
16760
17248
  * server-management — per-NODE singleton capability for a node's ROOT
16761
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16762
- * agents).
17249
+ * package lifecycle (runtime-updatable node packages).
16763
17250
  *
16764
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16765
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16766
- * version describes the node. Updates install into
16767
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16768
- * starter (probation boot + auto-rollback to N-1).
17251
+ * Every node role runs the SAME root package (`@camstack/server`), which
17252
+ * carries the whole software stack in its npm dep tree, so ONE version
17253
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17254
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17255
+ * no auto-rollback).
16769
17256
  *
16770
17257
  * Providers:
16771
17258
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -16873,7 +17360,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
16873
17360
  /** Explicit target version; omitted = latest from the registry. */
16874
17361
  version: string().optional() }), ServerUpdateActionResultSchema, {
16875
17362
  kind: "mutation",
16876
- auth: "admin"
17363
+ auth: "admin",
17364
+ timeoutMs: 16 * 6e4
16877
17365
  }), method(_void(), ServerUpdateActionResultSchema, {
16878
17366
  kind: "mutation",
16879
17367
  auth: "admin"
@@ -17940,22 +18428,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
17940
18428
  var RestartAddonResultSchema = unknown();
17941
18429
  var InstallPackageResultSchema = unknown();
17942
18430
  var ReloadPackagesResultSchema = unknown();
17943
- /**
17944
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
17945
- * server restarts so the admin UI can react to the `restartingAt`
17946
- * timestamp (shows reconnect overlay). The transition from
17947
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
17948
- * `system.restart-completed` event after the new process boots.
17949
- *
17950
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
17951
- */
17952
- var UpdateFrameworkPackageResultSchema = object({
17953
- packageName: string(),
17954
- fromVersion: string(),
17955
- toVersion: string(),
17956
- /** Ms-epoch the server scheduled its self-restart. */
17957
- restartingAt: number()
17958
- });
17959
18431
  var BulkUpdateItemStatusSchema = _enum([
17960
18432
  "queued",
17961
18433
  "updating",
@@ -18083,13 +18555,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18083
18555
  }), object({ success: literal(true) }), {
18084
18556
  kind: "mutation",
18085
18557
  auth: "admin"
18086
- }), method(object({
18087
- packageName: string().min(1),
18088
- version: string().optional(),
18089
- deferRestart: boolean().optional()
18090
- }), UpdateFrameworkPackageResultSchema, {
18091
- kind: "mutation",
18092
- auth: "admin"
18093
18558
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18094
18559
  kind: "mutation",
18095
18560
  auth: "admin"
@@ -18955,10 +19420,10 @@ var TopologyCategorySchema = object({
18955
19420
  addons: array(TopologyCategoryAddonSchema).readonly()
18956
19421
  });
18957
19422
  /**
18958
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
18959
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
18960
- * version visibility for the Server management surface. Nullable: offline
18961
- * rows and pre-phase-2 nodes report none.
19423
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19424
+ * root package for every node role) as reported by its `registerNode`
19425
+ * manifest — version visibility for the Server management surface. Nullable:
19426
+ * offline rows and nodes that never reported one.
18962
19427
  */
18963
19428
  var TopologyRootPackageSchema = object({
18964
19429
  name: string(),
@@ -19346,17 +19811,28 @@ var PlatformScoreSchema = object({
19346
19811
  format: _enum([
19347
19812
  "onnx",
19348
19813
  "coreml",
19349
- "openvino"
19814
+ "openvino",
19815
+ "tflite"
19350
19816
  ]),
19351
19817
  score: number(),
19352
19818
  reason: string(),
19353
19819
  available: boolean()
19354
19820
  });
19821
+ var InferenceDeviceDescriptorSchema = object({
19822
+ key: string(),
19823
+ backend: string(),
19824
+ device: string(),
19825
+ format: ModelFormatSchema,
19826
+ runtime: literal("python"),
19827
+ score: number(),
19828
+ available: boolean()
19829
+ });
19355
19830
  var PlatformCapabilitiesSchema = object({
19356
19831
  hardware: HardwareInfoSchema,
19357
19832
  scores: array(PlatformScoreSchema).readonly(),
19358
19833
  bestScore: PlatformScoreSchema,
19359
- pythonPath: string().nullable()
19834
+ pythonPath: string().nullable(),
19835
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19360
19836
  });
19361
19837
  var ModelRequirementSchema = object({
19362
19838
  modelId: string(),
@@ -20235,12 +20711,6 @@ Object.freeze({
20235
20711
  addonId: null,
20236
20712
  access: "delete"
20237
20713
  },
20238
- "addons.updateFrameworkPackage": {
20239
- capName: "addons",
20240
- capScope: "system",
20241
- addonId: null,
20242
- access: "create"
20243
- },
20244
20714
  "addons.updatePackage": {
20245
20715
  capName: "addons",
20246
20716
  capScope: "system",
@@ -23013,12 +23483,6 @@ Object.freeze({
23013
23483
  addonId: null,
23014
23484
  access: "view"
23015
23485
  },
23016
- "pipelineExecutor.reprobeEngine": {
23017
- capName: "pipeline-executor",
23018
- capScope: "system",
23019
- addonId: null,
23020
- access: "create"
23021
- },
23022
23486
  "pipelineExecutor.runAudioTest": {
23023
23487
  capName: "pipeline-executor",
23024
23488
  capScope: "system",
@@ -23169,6 +23633,12 @@ Object.freeze({
23169
23633
  addonId: null,
23170
23634
  access: "view"
23171
23635
  },
23636
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23637
+ capName: "pipeline-orchestrator",
23638
+ capScope: "system",
23639
+ addonId: null,
23640
+ access: "view"
23641
+ },
23172
23642
  "pipelineOrchestrator.getPipelineAssignment": {
23173
23643
  capName: "pipeline-orchestrator",
23174
23644
  capScope: "system",
@@ -23181,6 +23651,12 @@ Object.freeze({
23181
23651
  addonId: null,
23182
23652
  access: "view"
23183
23653
  },
23654
+ "pipelineOrchestrator.getPipelineDevicePin": {
23655
+ capName: "pipeline-orchestrator",
23656
+ capScope: "system",
23657
+ addonId: null,
23658
+ access: "view"
23659
+ },
23184
23660
  "pipelineOrchestrator.listAgentSettings": {
23185
23661
  capName: "pipeline-orchestrator",
23186
23662
  capScope: "system",
@@ -23223,19 +23699,19 @@ Object.freeze({
23223
23699
  addonId: null,
23224
23700
  access: "create"
23225
23701
  },
23226
- "pipelineOrchestrator.setAgentAddonDefaults": {
23702
+ "pipelineOrchestrator.setAgentCapabilities": {
23227
23703
  capName: "pipeline-orchestrator",
23228
23704
  capScope: "system",
23229
23705
  addonId: null,
23230
23706
  access: "create"
23231
23707
  },
23232
- "pipelineOrchestrator.setAgentCapabilities": {
23708
+ "pipelineOrchestrator.setAgentDetectWeight": {
23233
23709
  capName: "pipeline-orchestrator",
23234
23710
  capScope: "system",
23235
23711
  addonId: null,
23236
23712
  access: "create"
23237
23713
  },
23238
- "pipelineOrchestrator.setAgentDetectWeight": {
23714
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23239
23715
  capName: "pipeline-orchestrator",
23240
23716
  capScope: "system",
23241
23717
  addonId: null,
@@ -23277,6 +23753,12 @@ Object.freeze({
23277
23753
  addonId: null,
23278
23754
  access: "create"
23279
23755
  },
23756
+ "pipelineOrchestrator.setPipelineDevicePin": {
23757
+ capName: "pipeline-orchestrator",
23758
+ capScope: "system",
23759
+ addonId: null,
23760
+ access: "create"
23761
+ },
23280
23762
  "pipelineOrchestrator.unassignAudio": {
23281
23763
  capName: "pipeline-orchestrator",
23282
23764
  capScope: "system",
@@ -24829,32 +25311,6 @@ Object.freeze({
24829
25311
  "network-access": "ingress",
24830
25312
  "smtp-provider": "email"
24831
25313
  });
24832
- var frameworkSwapPackageSchema = object({
24833
- name: string(),
24834
- stagedPath: string(),
24835
- backupPath: string(),
24836
- toVersion: string(),
24837
- fromVersion: string().nullable()
24838
- });
24839
- object({
24840
- jobId: string(),
24841
- taskId: string(),
24842
- packages: array(frameworkSwapPackageSchema),
24843
- requestedAtMs: number(),
24844
- schemaVersion: literal(1)
24845
- });
24846
- object({
24847
- jobId: string(),
24848
- taskId: string(),
24849
- backups: array(object({
24850
- name: string(),
24851
- backupPath: string(),
24852
- livePath: string()
24853
- })),
24854
- appliedAtMs: number(),
24855
- bootAttempts: number(),
24856
- schemaVersion: literal(1)
24857
- });
24858
25314
  //#endregion
24859
25315
  Object.defineProperty(exports, "BaseAddon", {
24860
25316
  enumerable: true,