@camstack/addon-provider-gree 0.1.25 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +560 -104
  2. package/dist/addon.mjs +560 -104
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -7100,6 +7100,17 @@ var ModelCatalogEntrySchema = object({
7100
7100
  "imagenet",
7101
7101
  "none"
7102
7102
  ]).optional(),
7103
+ /**
7104
+ * The model already applies softmax IN-GRAPH — its raw output is a
7105
+ * probability distribution, not logits. When set, the `softmax`
7106
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7107
+ * probability vector collapses it toward uniform (top-1 score craters far
7108
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7109
+ * the output is raw logits and the postprocessor applies softmax (the normal
7110
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7111
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7112
+ */
7113
+ outputProbabilities: boolean().optional(),
7103
7114
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7104
7115
  /**
7105
7116
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7659,6 +7670,160 @@ var EncodeProfileSchema = object({
7659
7670
  */
7660
7671
  outputArgs: array(string()).optional()
7661
7672
  });
7673
+ var COCO_TO_MACRO = {
7674
+ mapping: {
7675
+ person: "person",
7676
+ bicycle: "vehicle",
7677
+ car: "vehicle",
7678
+ motorcycle: "vehicle",
7679
+ airplane: "vehicle",
7680
+ bus: "vehicle",
7681
+ train: "vehicle",
7682
+ truck: "vehicle",
7683
+ boat: "vehicle",
7684
+ bird: "animal",
7685
+ cat: "animal",
7686
+ dog: "animal",
7687
+ horse: "animal",
7688
+ sheep: "animal",
7689
+ cow: "animal",
7690
+ elephant: "animal",
7691
+ bear: "animal",
7692
+ zebra: "animal",
7693
+ giraffe: "animal",
7694
+ suitcase: "package",
7695
+ backpack: "package",
7696
+ handbag: "package"
7697
+ },
7698
+ preserveOriginal: false
7699
+ };
7700
+ var AUDIO_MACRO_LABELS = [
7701
+ {
7702
+ id: "speech",
7703
+ name: "Speech",
7704
+ icon: "🗣️"
7705
+ },
7706
+ {
7707
+ id: "scream",
7708
+ name: "Scream / Shout",
7709
+ icon: "😱"
7710
+ },
7711
+ {
7712
+ id: "crying",
7713
+ name: "Crying / Baby",
7714
+ icon: "😢"
7715
+ },
7716
+ {
7717
+ id: "laughter",
7718
+ name: "Laughter",
7719
+ icon: "😂"
7720
+ },
7721
+ {
7722
+ id: "music",
7723
+ name: "Music",
7724
+ icon: "🎵"
7725
+ },
7726
+ {
7727
+ id: "dog",
7728
+ name: "Dog",
7729
+ icon: "🐕"
7730
+ },
7731
+ {
7732
+ id: "cat",
7733
+ name: "Cat",
7734
+ icon: "🐈"
7735
+ },
7736
+ {
7737
+ id: "bird",
7738
+ name: "Bird",
7739
+ icon: "🐦"
7740
+ },
7741
+ {
7742
+ id: "animal",
7743
+ name: "Animal (other)",
7744
+ icon: "🐾"
7745
+ },
7746
+ {
7747
+ id: "alarm",
7748
+ name: "Alarm / Siren",
7749
+ icon: "🚨"
7750
+ },
7751
+ {
7752
+ id: "doorbell",
7753
+ name: "Doorbell / Knock",
7754
+ icon: "🔔"
7755
+ },
7756
+ {
7757
+ id: "glass_breaking",
7758
+ name: "Glass Breaking",
7759
+ icon: "💥"
7760
+ },
7761
+ {
7762
+ id: "gunshot",
7763
+ name: "Gunshot / Explosion",
7764
+ icon: "💣"
7765
+ },
7766
+ {
7767
+ id: "vehicle",
7768
+ name: "Vehicle",
7769
+ icon: "🚗"
7770
+ },
7771
+ {
7772
+ id: "siren",
7773
+ name: "Emergency Siren",
7774
+ icon: "🚑"
7775
+ },
7776
+ {
7777
+ id: "fire",
7778
+ name: "Fire / Smoke",
7779
+ icon: "🔥"
7780
+ },
7781
+ {
7782
+ id: "water",
7783
+ name: "Water",
7784
+ icon: "💧"
7785
+ },
7786
+ {
7787
+ id: "wind",
7788
+ name: "Wind / Weather",
7789
+ icon: "🌬️"
7790
+ },
7791
+ {
7792
+ id: "door",
7793
+ name: "Door",
7794
+ icon: "🚪"
7795
+ },
7796
+ {
7797
+ id: "footsteps",
7798
+ name: "Footsteps",
7799
+ icon: "👣"
7800
+ },
7801
+ {
7802
+ id: "crowd",
7803
+ name: "Crowd / Chatter",
7804
+ icon: "👥"
7805
+ },
7806
+ {
7807
+ id: "telephone",
7808
+ name: "Telephone",
7809
+ icon: "📞"
7810
+ },
7811
+ {
7812
+ id: "engine",
7813
+ name: "Engine / Motor",
7814
+ icon: "⚙️"
7815
+ },
7816
+ {
7817
+ id: "tools",
7818
+ name: "Tools / Construction",
7819
+ icon: "🔨"
7820
+ },
7821
+ {
7822
+ id: "silence",
7823
+ name: "Silence",
7824
+ icon: "🤫"
7825
+ }
7826
+ ];
7662
7827
  var YAMNET_TO_MACRO = {
7663
7828
  mapping: {
7664
7829
  Speech: "speech",
@@ -7925,6 +8090,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7925
8090
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7926
8091
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7927
8092
  /**
8093
+ * Unified event-kind taxonomy — THE single source of truth for
8094
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8095
+ * icon }`.
8096
+ *
8097
+ * This dictionary folds together what used to be scattered across four
8098
+ * copies:
8099
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8100
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8101
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8102
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8103
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8104
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8105
+ *
8106
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8107
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8108
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8109
+ * color or an icon: they read this dictionary (server descriptors carry the
8110
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8111
+ *
8112
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8113
+ */
8114
+ var TAXONOMY_COLORS = {
8115
+ motion: "#f59e0b",
8116
+ audio: "#06b6d4",
8117
+ person: "#22c55e",
8118
+ vehicle: "#3b82f6",
8119
+ animal: "#f97316",
8120
+ package: "#a855f7",
8121
+ sensor: "#8b5cf6",
8122
+ control: "#10b981",
8123
+ genericDetection: "#64748b"
8124
+ };
8125
+ var DETECTION_SUB_COLORS = {
8126
+ car: "#f59e0b",
8127
+ truck: "#d97706",
8128
+ bus: "#b45309",
8129
+ motorcycle: "#eab308",
8130
+ bicycle: "#ca8a04",
8131
+ airplane: "#60a5fa",
8132
+ boat: "#2563eb",
8133
+ train: "#1d4ed8",
8134
+ bird: "#14b8a6",
8135
+ dog: "#84cc16",
8136
+ cat: "#f97316",
8137
+ horse: "#a16207",
8138
+ sheep: "#a3a3a3",
8139
+ cow: "#78716c",
8140
+ elephant: "#6b7280",
8141
+ bear: "#7c2d12",
8142
+ zebra: "#404040",
8143
+ giraffe: "#d4a373"
8144
+ };
8145
+ function titleCase$1(id) {
8146
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8147
+ }
8148
+ var entries = /* @__PURE__ */ new Map();
8149
+ function macro(kind, category, color, iconId, label) {
8150
+ entries.set(kind, {
8151
+ kind,
8152
+ parentKind: null,
8153
+ level: "macro",
8154
+ category,
8155
+ color,
8156
+ iconId,
8157
+ labelKey: `eventKind.${kind}`,
8158
+ label
8159
+ });
8160
+ }
8161
+ function sub(kind, parentKind, category, color, iconId, label) {
8162
+ entries.set(kind, {
8163
+ kind,
8164
+ parentKind,
8165
+ level: "sub",
8166
+ category,
8167
+ color,
8168
+ iconId,
8169
+ labelKey: `eventKind.${kind}`,
8170
+ label
8171
+ });
8172
+ }
8173
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8174
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8175
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8176
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8177
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8178
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8179
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8180
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8181
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8182
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8183
+ if (entries.has(cocoClass)) continue;
8184
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase$1(cocoClass));
8185
+ }
8186
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8187
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8188
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8189
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8190
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8191
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8192
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8193
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8194
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8195
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8196
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8197
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8198
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8199
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8200
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8201
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8202
+ sub("button", "control", "control", "#10b981", "button", "Button");
8203
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8204
+ for (const l of AUDIO_MACRO_LABELS) {
8205
+ const kind = `audio-${l.id}`;
8206
+ if (entries.has(kind)) continue;
8207
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8208
+ }
8209
+ /** The complete taxonomy dictionary, keyed by kind. */
8210
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8211
+ /**
7928
8212
  * Error types for the safe expression engine. Two distinct classes so callers
7929
8213
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7930
8214
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12117,10 +12401,7 @@ var ConfigUISchemaNullableBridge = custom();
12117
12401
  var InferenceCapabilitiesBridge = custom();
12118
12402
  var ModelAvailabilityListBridge = custom();
12119
12403
  var PipelineRunResultBridge = custom();
12120
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12121
- kind: "mutation",
12122
- auth: "admin"
12123
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12404
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12124
12405
  modelId: string(),
12125
12406
  settings: record(string(), unknown()).readonly()
12126
12407
  }))), method(object({ steps: record(string(), object({
@@ -12180,13 +12461,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12180
12461
  * (inputClasses ≠ null) are skipped and served per-track via
12181
12462
  * pipelineRunner.runDetailSubtree (two-plane design).
12182
12463
  */
12183
- plane: _enum(["full", "frame"]).optional()
12464
+ plane: _enum(["full", "frame"]).optional(),
12465
+ /**
12466
+ * Inference-device selector (Phase 2 multi-device). Format
12467
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12468
+ * Omitted ⇒ the runner's default device (current single-engine
12469
+ * behaviour). Selects WHICH device pool of the node runs the call.
12470
+ */
12471
+ deviceKey: string().optional()
12184
12472
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12185
12473
  engine: PipelineEngineChoiceSchema.optional(),
12186
12474
  steps: array(PipelineStepInputSchema).min(1),
12187
12475
  frames: array(FrameInputSchema).min(1).max(255),
12188
12476
  deviceId: number().optional(),
12189
- sessionId: string().optional()
12477
+ sessionId: string().optional(),
12478
+ /**
12479
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12480
+ * the batch to the Python pool's bench preprocess cache
12481
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12482
+ * preprocessed ONCE and every later inference is a pure-inference cache
12483
+ * hit — the sustained-throughput run measures inference, not
12484
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12485
+ * full preprocess every call, correct). Fresh per sustained run;
12486
+ * released via `uncacheFrame`.
12487
+ */
12488
+ frameId: number().int().nonnegative().optional(),
12489
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12490
+ deviceKey: string().optional()
12190
12491
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12191
12492
  data: _instanceof(Uint8Array),
12192
12493
  width: number().int().positive(),
@@ -12218,8 +12519,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12218
12519
  * - `runtime` — main camera-serving engine (no idle TTL).
12219
12520
  * - `warm-override` — benchmark/test override held in the warm
12220
12521
  * cache; auto-disposed after the idle TTL.
12522
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12523
+ * multi-device, keyed by `deviceKey`) resolved
12524
+ * via `resolveDeviceFactory`. Runs alongside the
12525
+ * `runtime` engine on a DIFFERENT accelerator
12526
+ * (NPU / iGPU / Coral) — this is how the
12527
+ * Engines tab shows all pools running at once.
12221
12528
  */
12222
- kind: _enum(["runtime", "warm-override"]),
12529
+ kind: _enum([
12530
+ "runtime",
12531
+ "warm-override",
12532
+ "device-pool"
12533
+ ]),
12223
12534
  /** Native pid of the underlying Python pool (null when no pool). */
12224
12535
  poolPid: number().nullable(),
12225
12536
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12594,7 +12905,14 @@ var RunnerCameraConfigSchema = object({
12594
12905
  * camera's detect node differs from its source-owner (P2d, gated by the
12595
12906
  * `remoteSourcingNodes` rollout setting).
12596
12907
  */
12597
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12908
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12909
+ /**
12910
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12911
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12912
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12913
+ * this only selects WHICH device pool of that node runs the session.
12914
+ */
12915
+ deviceKey: string().optional()
12598
12916
  });
12599
12917
  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;
12600
12918
  /**
@@ -12615,6 +12933,19 @@ var RunnerLocalLoadSchema = object({
12615
12933
  avgInferenceTimeMs: number(),
12616
12934
  /** Total queue depth across motion + detection queues. */
12617
12935
  queueDepthTotal: number(),
12936
+ /**
12937
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12938
+ * this runner currently has attached cameras on, so the orchestrator's second
12939
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12940
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12941
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12942
+ */
12943
+ devices: array(object({
12944
+ deviceKey: string(),
12945
+ backend: string(),
12946
+ attachedCameras: number(),
12947
+ queueDepthTotal: number()
12948
+ })).default([]),
12618
12949
  /** Hardware capability flags reported by this node. */
12619
12950
  hardware: object({
12620
12951
  hasGpu: boolean(),
@@ -15763,6 +16094,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15763
16094
  return toDeviceSummary(device, this.addonId);
15764
16095
  }
15765
16096
  };
16097
+ 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;
16098
+ new Set(Object.values(DeviceType));
15766
16099
  /**
15767
16100
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15768
16101
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18857,17 +19190,30 @@ var EventKindCategorySchema = _enum([
18857
19190
  "audio",
18858
19191
  "detection",
18859
19192
  "sensor",
19193
+ "control",
18860
19194
  "custom",
18861
19195
  "package"
18862
19196
  ]);
19197
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19198
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18863
19199
  var EventKindDescriptorSchema = object({
18864
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19200
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18865
19201
  kind: string(),
19202
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19203
+ labelKey: string(),
19204
+ /** English fallback label (kept for clients that don't translate). */
18866
19205
  label: string(),
18867
19206
  /** Hex color for timeline/legend rendering. */
18868
19207
  color: string(),
19208
+ /** Dictionary id → lucide component on the UI side. */
19209
+ iconId: string(),
19210
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18869
19211
  icon: EventKindIconSchema,
18870
19212
  category: EventKindCategorySchema,
19213
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19214
+ parentKind: string().nullable(),
19215
+ /** Derived from `parentKind`, explicit for the client tree. */
19216
+ level: EventKindLevelSchema,
18871
19217
  /** Which cap + device contributes this kind. For built-ins the camera
18872
19218
  * itself; for sensor kinds the LINKED source device. */
18873
19219
  source: object({
@@ -18940,11 +19286,21 @@ var TrackAudioLabelSchema = object({
18940
19286
  firstAt: number(),
18941
19287
  lastAt: number()
18942
19288
  });
19289
+ /**
19290
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19291
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19292
+ * linked sensor/control state change (no positions; carries a snapshot). The
19293
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19294
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19295
+ */
19296
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18943
19297
  var TrackSchema = object({
18944
19298
  trackId: string(),
18945
19299
  deviceId: number(),
18946
19300
  className: string(),
18947
19301
  label: string().optional(),
19302
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19303
+ source: TrackSourceSchema.optional(),
18948
19304
  firstSeen: number(),
18949
19305
  lastSeen: number(),
18950
19306
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19321,6 +19677,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19321
19677
  eventId: string(),
19322
19678
  timestamp: number()
19323
19679
  });
19680
+ /**
19681
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19682
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19683
+ * caps into per-camera event-kind descriptors.
19684
+ *
19685
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19686
+ * is NOT duplicated here — every entry is derived from the single
19687
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19688
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19689
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19690
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19691
+ * eventful cap is missing.
19692
+ */
19693
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19694
+ var LEGACY_ICON = {
19695
+ motion: "motion",
19696
+ audio: "audio",
19697
+ person: "person",
19698
+ vehicle: "vehicle",
19699
+ animal: "animal",
19700
+ package: "package",
19701
+ door: "door",
19702
+ pir: "pir",
19703
+ smoke: "smoke",
19704
+ water: "water",
19705
+ button: "button",
19706
+ generic: "generic",
19707
+ gas: "smoke",
19708
+ vibration: "generic",
19709
+ tamper: "generic",
19710
+ presence: "person",
19711
+ lock: "generic",
19712
+ siren: "generic",
19713
+ switch: "generic",
19714
+ doorbell: "button"
19715
+ };
19716
+ function legacyIcon(iconId) {
19717
+ return LEGACY_ICON[iconId] ?? "generic";
19718
+ }
19719
+ /**
19720
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19721
+ * The anti-drift guard cross-checks this against the eventful caps declared
19722
+ * in `packages/types/src/capabilities/*.cap.ts`.
19723
+ */
19724
+ var CAP_TO_KIND = {
19725
+ contact: "contact",
19726
+ motion: "motion-sensor",
19727
+ smoke: "smoke",
19728
+ flood: "flood",
19729
+ gas: "gas",
19730
+ "carbon-monoxide": "carbon-monoxide",
19731
+ vibration: "vibration",
19732
+ tamper: "tamper",
19733
+ presence: "presence",
19734
+ "enum-sensor": "enum-sensor",
19735
+ "event-emitter": "device-event",
19736
+ "lock-control": "lock",
19737
+ switch: "switch",
19738
+ button: "button",
19739
+ doorbell: "doorbell"
19740
+ };
19741
+ function buildDescriptor(capName, kind) {
19742
+ const t = EVENT_TAXONOMY[kind];
19743
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19744
+ return {
19745
+ ...t,
19746
+ icon: legacyIcon(t.iconId)
19747
+ };
19748
+ }
19749
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19324
19750
  var CameraPipelineConfigSchema = object({
19325
19751
  engine: PipelineEngineChoiceSchema.optional(),
19326
19752
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19339,13 +19765,11 @@ var PipelineTemplateSchema = object({
19339
19765
  createdAt: string(),
19340
19766
  updatedAt: string()
19341
19767
  });
19342
- var AgentAddonConfigSchema = object({
19343
- enabled: boolean(),
19768
+ var DeviceStepConfigSchema = object({
19344
19769
  modelId: string().optional(),
19345
- settings: record(string(), unknown()).readonly()
19770
+ settings: record(string(), unknown()).optional()
19346
19771
  });
19347
19772
  var AgentPipelineSettingsSchema = object({
19348
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19349
19773
  maxCameras: number().int().nonnegative().nullable().default(null),
19350
19774
  /** Per-node detection weight (relative share for the quota balancer). */
19351
19775
  detectWeight: number().positive().optional(),
@@ -19369,7 +19793,22 @@ var AgentPipelineSettingsSchema = object({
19369
19793
  * it already uses to reach the hub). Set this only when the auto-detected
19370
19794
  * address is wrong (multi-homed host, NAT, custom interface).
19371
19795
  */
19372
- reachableHost: string().optional()
19796
+ reachableHost: string().optional(),
19797
+ /**
19798
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19799
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19800
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19801
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19802
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19803
+ * the default model/settings for every camera landing on that accelerator;
19804
+ * a stepId absent ⇒ the step uses that device's format default.
19805
+ */
19806
+ inferenceDevices: record(string(), object({
19807
+ enabled: boolean(),
19808
+ weight: number().positive().optional(),
19809
+ maxSessions: number().int().positive().optional(),
19810
+ steps: record(string(), DeviceStepConfigSchema).optional()
19811
+ })).optional()
19373
19812
  });
19374
19813
  var CameraPipelineForAgentSchema = object({
19375
19814
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19379,14 +19818,13 @@ var CameraPipelineForAgentSchema = object({
19379
19818
  }).nullable()
19380
19819
  });
19381
19820
  var CameraStepOverridePatchSchema = object({
19382
- enabled: boolean().optional(),
19383
19821
  modelId: string().optional(),
19384
19822
  settings: record(string(), unknown()).readonly().optional()
19385
19823
  });
19386
19824
  var CameraPipelineSettingsSchema = object({
19387
19825
  pinnedAgentNodeId: string().optional(),
19388
19826
  stepToggles: record(string(), boolean()).optional(),
19389
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19827
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19390
19828
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19391
19829
  });
19392
19830
  /**
@@ -19600,6 +20038,44 @@ var CameraStatusSchema = object({
19600
20038
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19601
20039
  fetchedAt: number()
19602
20040
  });
20041
+ var NodeInferenceDeviceSchema = object({
20042
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20043
+ key: string(),
20044
+ backend: string(),
20045
+ device: string(),
20046
+ format: _enum(MODEL_FORMATS),
20047
+ /** Whether the node's live probe reports the device as usable right now. */
20048
+ available: boolean(),
20049
+ /**
20050
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20051
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20052
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20053
+ * not a balanced target). An explicit stored value always wins; a stored-only
20054
+ * (unavailable) key keeps its stored value.
20055
+ */
20056
+ enabled: boolean(),
20057
+ /** Relative balancer weight for the enabled device (default 1). */
20058
+ weight: number(),
20059
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20060
+ maxSessions: number().nullable(),
20061
+ /** Object-detection model the executor defaults to for this deviceKey. */
20062
+ defaultModelId: string(),
20063
+ /**
20064
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20065
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20066
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20067
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20068
+ * available per format; this is the stored selection that becomes the
20069
+ * default for EVERY camera landing on this accelerator.
20070
+ */
20071
+ steps: record(string(), DeviceStepConfigSchema).optional()
20072
+ });
20073
+ var NodeInferenceDevicesSchema = object({
20074
+ nodeId: string(),
20075
+ /** False when the node's platform-probe was unreachable (no live device set). */
20076
+ reachable: boolean(),
20077
+ devices: array(NodeInferenceDeviceSchema).readonly()
20078
+ });
19603
20079
  method(object({
19604
20080
  deviceId: number(),
19605
20081
  agentNodeId: string()
@@ -19609,7 +20085,13 @@ method(object({
19609
20085
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19610
20086
  kind: "mutation",
19611
20087
  auth: "admin"
19612
- }), method(_void(), object({ migrated: number() }), {
20088
+ }), method(object({
20089
+ deviceId: number(),
20090
+ deviceKey: string()
20091
+ }), object({ success: literal(true) }), {
20092
+ kind: "mutation",
20093
+ auth: "admin"
20094
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19613
20095
  kind: "mutation",
19614
20096
  auth: "admin"
19615
20097
  }), 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({
@@ -19643,13 +20125,7 @@ method(object({
19643
20125
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19644
20126
  nodeId: string(),
19645
20127
  settings: AgentPipelineSettingsSchema
19646
- })).readonly()), method(object({
19647
- agentNodeId: string(),
19648
- defaults: record(string(), AgentAddonConfigSchema)
19649
- }), object({ success: literal(true) }), {
19650
- kind: "mutation",
19651
- auth: "admin"
19652
- }), method(object({ agentNodeId: string() }), object({
20128
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19653
20129
  success: boolean(),
19654
20130
  removed: boolean()
19655
20131
  }), {
@@ -19681,7 +20157,18 @@ method(object({
19681
20157
  }), object({ success: literal(true) }), {
19682
20158
  kind: "mutation",
19683
20159
  auth: "admin"
19684
- }), method(object({ agentNodeId: string() }), object({
20160
+ }), method(object({
20161
+ agentNodeId: string(),
20162
+ inferenceDevices: record(string(), object({
20163
+ enabled: boolean(),
20164
+ weight: number().positive().optional(),
20165
+ maxSessions: number().int().positive().optional(),
20166
+ steps: record(string(), DeviceStepConfigSchema).optional()
20167
+ }))
20168
+ }), object({ success: literal(true) }), {
20169
+ kind: "mutation",
20170
+ auth: "admin"
20171
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19685
20172
  success: literal(true),
19686
20173
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19687
20174
  effectiveModelId: string().nullable(),
@@ -19697,9 +20184,10 @@ method(object({
19697
20184
  }), object({ success: literal(true) }), {
19698
20185
  kind: "mutation",
19699
20186
  auth: "admin"
19700
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20187
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19701
20188
  deviceId: number(),
19702
20189
  agentNodeId: string(),
20190
+ deviceKey: string(),
19703
20191
  addonId: string(),
19704
20192
  patch: CameraStepOverridePatchSchema.nullable()
19705
20193
  }), object({ success: literal(true) }), {
@@ -19736,14 +20224,13 @@ method(object({
19736
20224
  });
19737
20225
  /**
19738
20226
  * server-management — per-NODE singleton capability for a node's ROOT
19739
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19740
- * agents).
20227
+ * package lifecycle (runtime-updatable node packages).
19741
20228
  *
19742
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19743
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19744
- * version describes the node. Updates install into
19745
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19746
- * starter (probation boot + auto-rollback to N-1).
20229
+ * Every node role runs the SAME root package (`@camstack/server`), which
20230
+ * carries the whole software stack in its npm dep tree, so ONE version
20231
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20232
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20233
+ * no auto-rollback).
19747
20234
  *
19748
20235
  * Providers:
19749
20236
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19851,7 +20338,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19851
20338
  /** Explicit target version; omitted = latest from the registry. */
19852
20339
  version: string().optional() }), ServerUpdateActionResultSchema, {
19853
20340
  kind: "mutation",
19854
- auth: "admin"
20341
+ auth: "admin",
20342
+ timeoutMs: 16 * 6e4
19855
20343
  }), method(_void(), ServerUpdateActionResultSchema, {
19856
20344
  kind: "mutation",
19857
20345
  auth: "admin"
@@ -20895,22 +21383,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20895
21383
  var RestartAddonResultSchema = unknown();
20896
21384
  var InstallPackageResultSchema = unknown();
20897
21385
  var ReloadPackagesResultSchema = unknown();
20898
- /**
20899
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20900
- * server restarts so the admin UI can react to the `restartingAt`
20901
- * timestamp (shows reconnect overlay). The transition from
20902
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20903
- * `system.restart-completed` event after the new process boots.
20904
- *
20905
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20906
- */
20907
- var UpdateFrameworkPackageResultSchema = object({
20908
- packageName: string(),
20909
- fromVersion: string(),
20910
- toVersion: string(),
20911
- /** Ms-epoch the server scheduled its self-restart. */
20912
- restartingAt: number()
20913
- });
20914
21386
  var BulkUpdateItemStatusSchema = _enum([
20915
21387
  "queued",
20916
21388
  "updating",
@@ -21038,13 +21510,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21038
21510
  }), object({ success: literal(true) }), {
21039
21511
  kind: "mutation",
21040
21512
  auth: "admin"
21041
- }), method(object({
21042
- packageName: string().min(1),
21043
- version: string().optional(),
21044
- deferRestart: boolean().optional()
21045
- }), UpdateFrameworkPackageResultSchema, {
21046
- kind: "mutation",
21047
- auth: "admin"
21048
21513
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21049
21514
  kind: "mutation",
21050
21515
  auth: "admin"
@@ -21910,10 +22375,10 @@ var TopologyCategorySchema = object({
21910
22375
  addons: array(TopologyCategoryAddonSchema).readonly()
21911
22376
  });
21912
22377
  /**
21913
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21914
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21915
- * version visibility for the Server management surface. Nullable: offline
21916
- * rows and pre-phase-2 nodes report none.
22378
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22379
+ * root package for every node role) as reported by its `registerNode`
22380
+ * manifest — version visibility for the Server management surface. Nullable:
22381
+ * offline rows and nodes that never reported one.
21917
22382
  */
21918
22383
  var TopologyRootPackageSchema = object({
21919
22384
  name: string(),
@@ -22301,17 +22766,28 @@ var PlatformScoreSchema = object({
22301
22766
  format: _enum([
22302
22767
  "onnx",
22303
22768
  "coreml",
22304
- "openvino"
22769
+ "openvino",
22770
+ "tflite"
22305
22771
  ]),
22306
22772
  score: number(),
22307
22773
  reason: string(),
22308
22774
  available: boolean()
22309
22775
  });
22776
+ var InferenceDeviceDescriptorSchema = object({
22777
+ key: string(),
22778
+ backend: string(),
22779
+ device: string(),
22780
+ format: ModelFormatSchema,
22781
+ runtime: literal("python"),
22782
+ score: number(),
22783
+ available: boolean()
22784
+ });
22310
22785
  var PlatformCapabilitiesSchema = object({
22311
22786
  hardware: HardwareInfoSchema,
22312
22787
  scores: array(PlatformScoreSchema).readonly(),
22313
22788
  bestScore: PlatformScoreSchema,
22314
- pythonPath: string().nullable()
22789
+ pythonPath: string().nullable(),
22790
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22315
22791
  });
22316
22792
  var ModelRequirementSchema = object({
22317
22793
  modelId: string(),
@@ -23190,12 +23666,6 @@ Object.freeze({
23190
23666
  addonId: null,
23191
23667
  access: "delete"
23192
23668
  },
23193
- "addons.updateFrameworkPackage": {
23194
- capName: "addons",
23195
- capScope: "system",
23196
- addonId: null,
23197
- access: "create"
23198
- },
23199
23669
  "addons.updatePackage": {
23200
23670
  capName: "addons",
23201
23671
  capScope: "system",
@@ -25968,12 +26438,6 @@ Object.freeze({
25968
26438
  addonId: null,
25969
26439
  access: "view"
25970
26440
  },
25971
- "pipelineExecutor.reprobeEngine": {
25972
- capName: "pipeline-executor",
25973
- capScope: "system",
25974
- addonId: null,
25975
- access: "create"
25976
- },
25977
26441
  "pipelineExecutor.runAudioTest": {
25978
26442
  capName: "pipeline-executor",
25979
26443
  capScope: "system",
@@ -26124,6 +26588,12 @@ Object.freeze({
26124
26588
  addonId: null,
26125
26589
  access: "view"
26126
26590
  },
26591
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26592
+ capName: "pipeline-orchestrator",
26593
+ capScope: "system",
26594
+ addonId: null,
26595
+ access: "view"
26596
+ },
26127
26597
  "pipelineOrchestrator.getPipelineAssignment": {
26128
26598
  capName: "pipeline-orchestrator",
26129
26599
  capScope: "system",
@@ -26136,6 +26606,12 @@ Object.freeze({
26136
26606
  addonId: null,
26137
26607
  access: "view"
26138
26608
  },
26609
+ "pipelineOrchestrator.getPipelineDevicePin": {
26610
+ capName: "pipeline-orchestrator",
26611
+ capScope: "system",
26612
+ addonId: null,
26613
+ access: "view"
26614
+ },
26139
26615
  "pipelineOrchestrator.listAgentSettings": {
26140
26616
  capName: "pipeline-orchestrator",
26141
26617
  capScope: "system",
@@ -26178,19 +26654,19 @@ Object.freeze({
26178
26654
  addonId: null,
26179
26655
  access: "create"
26180
26656
  },
26181
- "pipelineOrchestrator.setAgentAddonDefaults": {
26657
+ "pipelineOrchestrator.setAgentCapabilities": {
26182
26658
  capName: "pipeline-orchestrator",
26183
26659
  capScope: "system",
26184
26660
  addonId: null,
26185
26661
  access: "create"
26186
26662
  },
26187
- "pipelineOrchestrator.setAgentCapabilities": {
26663
+ "pipelineOrchestrator.setAgentDetectWeight": {
26188
26664
  capName: "pipeline-orchestrator",
26189
26665
  capScope: "system",
26190
26666
  addonId: null,
26191
26667
  access: "create"
26192
26668
  },
26193
- "pipelineOrchestrator.setAgentDetectWeight": {
26669
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26194
26670
  capName: "pipeline-orchestrator",
26195
26671
  capScope: "system",
26196
26672
  addonId: null,
@@ -26232,6 +26708,12 @@ Object.freeze({
26232
26708
  addonId: null,
26233
26709
  access: "create"
26234
26710
  },
26711
+ "pipelineOrchestrator.setPipelineDevicePin": {
26712
+ capName: "pipeline-orchestrator",
26713
+ capScope: "system",
26714
+ addonId: null,
26715
+ access: "create"
26716
+ },
26235
26717
  "pipelineOrchestrator.unassignAudio": {
26236
26718
  capName: "pipeline-orchestrator",
26237
26719
  capScope: "system",
@@ -27784,32 +28266,6 @@ Object.freeze({
27784
28266
  "network-access": "ingress",
27785
28267
  "smtp-provider": "email"
27786
28268
  });
27787
- var frameworkSwapPackageSchema = object({
27788
- name: string(),
27789
- stagedPath: string(),
27790
- backupPath: string(),
27791
- toVersion: string(),
27792
- fromVersion: string().nullable()
27793
- });
27794
- object({
27795
- jobId: string(),
27796
- taskId: string(),
27797
- packages: array(frameworkSwapPackageSchema),
27798
- requestedAtMs: number(),
27799
- schemaVersion: literal(1)
27800
- });
27801
- object({
27802
- jobId: string(),
27803
- taskId: string(),
27804
- backups: array(object({
27805
- name: string(),
27806
- backupPath: string(),
27807
- livePath: string()
27808
- })),
27809
- appliedAtMs: number(),
27810
- bootAttempts: number(),
27811
- schemaVersion: literal(1)
27812
- });
27813
28269
  //#endregion
27814
28270
  //#region src/config.ts
27815
28271
  /**