@camstack/addon-provider-tuya 0.1.13 → 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.js CHANGED
@@ -7102,6 +7102,17 @@ var ModelCatalogEntrySchema = object({
7102
7102
  "imagenet",
7103
7103
  "none"
7104
7104
  ]).optional(),
7105
+ /**
7106
+ * The model already applies softmax IN-GRAPH — its raw output is a
7107
+ * probability distribution, not logits. When set, the `softmax`
7108
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7109
+ * probability vector collapses it toward uniform (top-1 score craters far
7110
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7111
+ * the output is raw logits and the postprocessor applies softmax (the normal
7112
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7113
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7114
+ */
7115
+ outputProbabilities: boolean().optional(),
7105
7116
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7106
7117
  /**
7107
7118
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7661,6 +7672,160 @@ var EncodeProfileSchema = object({
7661
7672
  */
7662
7673
  outputArgs: array(string()).optional()
7663
7674
  });
7675
+ var COCO_TO_MACRO = {
7676
+ mapping: {
7677
+ person: "person",
7678
+ bicycle: "vehicle",
7679
+ car: "vehicle",
7680
+ motorcycle: "vehicle",
7681
+ airplane: "vehicle",
7682
+ bus: "vehicle",
7683
+ train: "vehicle",
7684
+ truck: "vehicle",
7685
+ boat: "vehicle",
7686
+ bird: "animal",
7687
+ cat: "animal",
7688
+ dog: "animal",
7689
+ horse: "animal",
7690
+ sheep: "animal",
7691
+ cow: "animal",
7692
+ elephant: "animal",
7693
+ bear: "animal",
7694
+ zebra: "animal",
7695
+ giraffe: "animal",
7696
+ suitcase: "package",
7697
+ backpack: "package",
7698
+ handbag: "package"
7699
+ },
7700
+ preserveOriginal: false
7701
+ };
7702
+ var AUDIO_MACRO_LABELS = [
7703
+ {
7704
+ id: "speech",
7705
+ name: "Speech",
7706
+ icon: "🗣️"
7707
+ },
7708
+ {
7709
+ id: "scream",
7710
+ name: "Scream / Shout",
7711
+ icon: "😱"
7712
+ },
7713
+ {
7714
+ id: "crying",
7715
+ name: "Crying / Baby",
7716
+ icon: "😢"
7717
+ },
7718
+ {
7719
+ id: "laughter",
7720
+ name: "Laughter",
7721
+ icon: "😂"
7722
+ },
7723
+ {
7724
+ id: "music",
7725
+ name: "Music",
7726
+ icon: "🎵"
7727
+ },
7728
+ {
7729
+ id: "dog",
7730
+ name: "Dog",
7731
+ icon: "🐕"
7732
+ },
7733
+ {
7734
+ id: "cat",
7735
+ name: "Cat",
7736
+ icon: "🐈"
7737
+ },
7738
+ {
7739
+ id: "bird",
7740
+ name: "Bird",
7741
+ icon: "🐦"
7742
+ },
7743
+ {
7744
+ id: "animal",
7745
+ name: "Animal (other)",
7746
+ icon: "🐾"
7747
+ },
7748
+ {
7749
+ id: "alarm",
7750
+ name: "Alarm / Siren",
7751
+ icon: "🚨"
7752
+ },
7753
+ {
7754
+ id: "doorbell",
7755
+ name: "Doorbell / Knock",
7756
+ icon: "🔔"
7757
+ },
7758
+ {
7759
+ id: "glass_breaking",
7760
+ name: "Glass Breaking",
7761
+ icon: "💥"
7762
+ },
7763
+ {
7764
+ id: "gunshot",
7765
+ name: "Gunshot / Explosion",
7766
+ icon: "💣"
7767
+ },
7768
+ {
7769
+ id: "vehicle",
7770
+ name: "Vehicle",
7771
+ icon: "🚗"
7772
+ },
7773
+ {
7774
+ id: "siren",
7775
+ name: "Emergency Siren",
7776
+ icon: "🚑"
7777
+ },
7778
+ {
7779
+ id: "fire",
7780
+ name: "Fire / Smoke",
7781
+ icon: "🔥"
7782
+ },
7783
+ {
7784
+ id: "water",
7785
+ name: "Water",
7786
+ icon: "💧"
7787
+ },
7788
+ {
7789
+ id: "wind",
7790
+ name: "Wind / Weather",
7791
+ icon: "🌬️"
7792
+ },
7793
+ {
7794
+ id: "door",
7795
+ name: "Door",
7796
+ icon: "🚪"
7797
+ },
7798
+ {
7799
+ id: "footsteps",
7800
+ name: "Footsteps",
7801
+ icon: "👣"
7802
+ },
7803
+ {
7804
+ id: "crowd",
7805
+ name: "Crowd / Chatter",
7806
+ icon: "👥"
7807
+ },
7808
+ {
7809
+ id: "telephone",
7810
+ name: "Telephone",
7811
+ icon: "📞"
7812
+ },
7813
+ {
7814
+ id: "engine",
7815
+ name: "Engine / Motor",
7816
+ icon: "⚙️"
7817
+ },
7818
+ {
7819
+ id: "tools",
7820
+ name: "Tools / Construction",
7821
+ icon: "🔨"
7822
+ },
7823
+ {
7824
+ id: "silence",
7825
+ name: "Silence",
7826
+ icon: "🤫"
7827
+ }
7828
+ ];
7664
7829
  var YAMNET_TO_MACRO = {
7665
7830
  mapping: {
7666
7831
  Speech: "speech",
@@ -7927,6 +8092,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7927
8092
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7928
8093
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7929
8094
  /**
8095
+ * Unified event-kind taxonomy — THE single source of truth for
8096
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8097
+ * icon }`.
8098
+ *
8099
+ * This dictionary folds together what used to be scattered across four
8100
+ * copies:
8101
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8102
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8103
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8104
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8105
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8106
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8107
+ *
8108
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8109
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8110
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8111
+ * color or an icon: they read this dictionary (server descriptors carry the
8112
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8113
+ *
8114
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8115
+ */
8116
+ var TAXONOMY_COLORS = {
8117
+ motion: "#f59e0b",
8118
+ audio: "#06b6d4",
8119
+ person: "#22c55e",
8120
+ vehicle: "#3b82f6",
8121
+ animal: "#f97316",
8122
+ package: "#a855f7",
8123
+ sensor: "#8b5cf6",
8124
+ control: "#10b981",
8125
+ genericDetection: "#64748b"
8126
+ };
8127
+ var DETECTION_SUB_COLORS = {
8128
+ car: "#f59e0b",
8129
+ truck: "#d97706",
8130
+ bus: "#b45309",
8131
+ motorcycle: "#eab308",
8132
+ bicycle: "#ca8a04",
8133
+ airplane: "#60a5fa",
8134
+ boat: "#2563eb",
8135
+ train: "#1d4ed8",
8136
+ bird: "#14b8a6",
8137
+ dog: "#84cc16",
8138
+ cat: "#f97316",
8139
+ horse: "#a16207",
8140
+ sheep: "#a3a3a3",
8141
+ cow: "#78716c",
8142
+ elephant: "#6b7280",
8143
+ bear: "#7c2d12",
8144
+ zebra: "#404040",
8145
+ giraffe: "#d4a373"
8146
+ };
8147
+ function titleCase(id) {
8148
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8149
+ }
8150
+ var entries = /* @__PURE__ */ new Map();
8151
+ function macro(kind, category, color, iconId, label) {
8152
+ entries.set(kind, {
8153
+ kind,
8154
+ parentKind: null,
8155
+ level: "macro",
8156
+ category,
8157
+ color,
8158
+ iconId,
8159
+ labelKey: `eventKind.${kind}`,
8160
+ label
8161
+ });
8162
+ }
8163
+ function sub(kind, parentKind, category, color, iconId, label) {
8164
+ entries.set(kind, {
8165
+ kind,
8166
+ parentKind,
8167
+ level: "sub",
8168
+ category,
8169
+ color,
8170
+ iconId,
8171
+ labelKey: `eventKind.${kind}`,
8172
+ label
8173
+ });
8174
+ }
8175
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8176
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8177
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8178
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8179
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8180
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8181
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8182
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8183
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8184
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8185
+ if (entries.has(cocoClass)) continue;
8186
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8187
+ }
8188
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8189
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8190
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8191
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8192
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8193
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8194
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8195
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8196
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8197
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8198
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8199
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8200
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8201
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8202
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8203
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8204
+ sub("button", "control", "control", "#10b981", "button", "Button");
8205
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8206
+ for (const l of AUDIO_MACRO_LABELS) {
8207
+ const kind = `audio-${l.id}`;
8208
+ if (entries.has(kind)) continue;
8209
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8210
+ }
8211
+ /** The complete taxonomy dictionary, keyed by kind. */
8212
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8213
+ /**
7930
8214
  * Error types for the safe expression engine. Two distinct classes so callers
7931
8215
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7932
8216
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12119,10 +12403,7 @@ var ConfigUISchemaNullableBridge = custom();
12119
12403
  var InferenceCapabilitiesBridge = custom();
12120
12404
  var ModelAvailabilityListBridge = custom();
12121
12405
  var PipelineRunResultBridge = custom();
12122
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12123
- kind: "mutation",
12124
- auth: "admin"
12125
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12406
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12126
12407
  modelId: string(),
12127
12408
  settings: record(string(), unknown()).readonly()
12128
12409
  }))), method(object({ steps: record(string(), object({
@@ -12182,13 +12463,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12182
12463
  * (inputClasses ≠ null) are skipped and served per-track via
12183
12464
  * pipelineRunner.runDetailSubtree (two-plane design).
12184
12465
  */
12185
- plane: _enum(["full", "frame"]).optional()
12466
+ plane: _enum(["full", "frame"]).optional(),
12467
+ /**
12468
+ * Inference-device selector (Phase 2 multi-device). Format
12469
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12470
+ * Omitted ⇒ the runner's default device (current single-engine
12471
+ * behaviour). Selects WHICH device pool of the node runs the call.
12472
+ */
12473
+ deviceKey: string().optional()
12186
12474
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12187
12475
  engine: PipelineEngineChoiceSchema.optional(),
12188
12476
  steps: array(PipelineStepInputSchema).min(1),
12189
12477
  frames: array(FrameInputSchema).min(1).max(255),
12190
12478
  deviceId: number().optional(),
12191
- sessionId: string().optional()
12479
+ sessionId: string().optional(),
12480
+ /**
12481
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12482
+ * the batch to the Python pool's bench preprocess cache
12483
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12484
+ * preprocessed ONCE and every later inference is a pure-inference cache
12485
+ * hit — the sustained-throughput run measures inference, not
12486
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12487
+ * full preprocess every call, correct). Fresh per sustained run;
12488
+ * released via `uncacheFrame`.
12489
+ */
12490
+ frameId: number().int().nonnegative().optional(),
12491
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12492
+ deviceKey: string().optional()
12192
12493
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12193
12494
  data: _instanceof(Uint8Array),
12194
12495
  width: number().int().positive(),
@@ -12220,8 +12521,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12220
12521
  * - `runtime` — main camera-serving engine (no idle TTL).
12221
12522
  * - `warm-override` — benchmark/test override held in the warm
12222
12523
  * cache; auto-disposed after the idle TTL.
12524
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12525
+ * multi-device, keyed by `deviceKey`) resolved
12526
+ * via `resolveDeviceFactory`. Runs alongside the
12527
+ * `runtime` engine on a DIFFERENT accelerator
12528
+ * (NPU / iGPU / Coral) — this is how the
12529
+ * Engines tab shows all pools running at once.
12223
12530
  */
12224
- kind: _enum(["runtime", "warm-override"]),
12531
+ kind: _enum([
12532
+ "runtime",
12533
+ "warm-override",
12534
+ "device-pool"
12535
+ ]),
12225
12536
  /** Native pid of the underlying Python pool (null when no pool). */
12226
12537
  poolPid: number().nullable(),
12227
12538
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12596,7 +12907,14 @@ var RunnerCameraConfigSchema = object({
12596
12907
  * camera's detect node differs from its source-owner (P2d, gated by the
12597
12908
  * `remoteSourcingNodes` rollout setting).
12598
12909
  */
12599
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12910
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12911
+ /**
12912
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12913
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12914
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12915
+ * this only selects WHICH device pool of that node runs the session.
12916
+ */
12917
+ deviceKey: string().optional()
12600
12918
  });
12601
12919
  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;
12602
12920
  /**
@@ -12617,6 +12935,19 @@ var RunnerLocalLoadSchema = object({
12617
12935
  avgInferenceTimeMs: number(),
12618
12936
  /** Total queue depth across motion + detection queues. */
12619
12937
  queueDepthTotal: number(),
12938
+ /**
12939
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12940
+ * this runner currently has attached cameras on, so the orchestrator's second
12941
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12942
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12943
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12944
+ */
12945
+ devices: array(object({
12946
+ deviceKey: string(),
12947
+ backend: string(),
12948
+ attachedCameras: number(),
12949
+ queueDepthTotal: number()
12950
+ })).default([]),
12620
12951
  /** Hardware capability flags reported by this node. */
12621
12952
  hardware: object({
12622
12953
  hasGpu: boolean(),
@@ -15765,6 +16096,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15765
16096
  return toDeviceSummary(device, this.addonId);
15766
16097
  }
15767
16098
  };
16099
+ 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;
16100
+ new Set(Object.values(DeviceType));
15768
16101
  /**
15769
16102
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15770
16103
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18876,17 +19209,30 @@ var EventKindCategorySchema = _enum([
18876
19209
  "audio",
18877
19210
  "detection",
18878
19211
  "sensor",
19212
+ "control",
18879
19213
  "custom",
18880
19214
  "package"
18881
19215
  ]);
19216
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19217
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18882
19218
  var EventKindDescriptorSchema = object({
18883
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19219
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18884
19220
  kind: string(),
19221
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19222
+ labelKey: string(),
19223
+ /** English fallback label (kept for clients that don't translate). */
18885
19224
  label: string(),
18886
19225
  /** Hex color for timeline/legend rendering. */
18887
19226
  color: string(),
19227
+ /** Dictionary id → lucide component on the UI side. */
19228
+ iconId: string(),
19229
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18888
19230
  icon: EventKindIconSchema,
18889
19231
  category: EventKindCategorySchema,
19232
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19233
+ parentKind: string().nullable(),
19234
+ /** Derived from `parentKind`, explicit for the client tree. */
19235
+ level: EventKindLevelSchema,
18890
19236
  /** Which cap + device contributes this kind. For built-ins the camera
18891
19237
  * itself; for sensor kinds the LINKED source device. */
18892
19238
  source: object({
@@ -18959,11 +19305,21 @@ var TrackAudioLabelSchema = object({
18959
19305
  firstAt: number(),
18960
19306
  lastAt: number()
18961
19307
  });
19308
+ /**
19309
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19310
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19311
+ * linked sensor/control state change (no positions; carries a snapshot). The
19312
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19313
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19314
+ */
19315
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18962
19316
  var TrackSchema = object({
18963
19317
  trackId: string(),
18964
19318
  deviceId: number(),
18965
19319
  className: string(),
18966
19320
  label: string().optional(),
19321
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19322
+ source: TrackSourceSchema.optional(),
18967
19323
  firstSeen: number(),
18968
19324
  lastSeen: number(),
18969
19325
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19340,6 +19696,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19340
19696
  eventId: string(),
19341
19697
  timestamp: number()
19342
19698
  });
19699
+ /**
19700
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19701
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19702
+ * caps into per-camera event-kind descriptors.
19703
+ *
19704
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19705
+ * is NOT duplicated here — every entry is derived from the single
19706
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19707
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19708
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19709
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19710
+ * eventful cap is missing.
19711
+ */
19712
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19713
+ var LEGACY_ICON = {
19714
+ motion: "motion",
19715
+ audio: "audio",
19716
+ person: "person",
19717
+ vehicle: "vehicle",
19718
+ animal: "animal",
19719
+ package: "package",
19720
+ door: "door",
19721
+ pir: "pir",
19722
+ smoke: "smoke",
19723
+ water: "water",
19724
+ button: "button",
19725
+ generic: "generic",
19726
+ gas: "smoke",
19727
+ vibration: "generic",
19728
+ tamper: "generic",
19729
+ presence: "person",
19730
+ lock: "generic",
19731
+ siren: "generic",
19732
+ switch: "generic",
19733
+ doorbell: "button"
19734
+ };
19735
+ function legacyIcon(iconId) {
19736
+ return LEGACY_ICON[iconId] ?? "generic";
19737
+ }
19738
+ /**
19739
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19740
+ * The anti-drift guard cross-checks this against the eventful caps declared
19741
+ * in `packages/types/src/capabilities/*.cap.ts`.
19742
+ */
19743
+ var CAP_TO_KIND = {
19744
+ contact: "contact",
19745
+ motion: "motion-sensor",
19746
+ smoke: "smoke",
19747
+ flood: "flood",
19748
+ gas: "gas",
19749
+ "carbon-monoxide": "carbon-monoxide",
19750
+ vibration: "vibration",
19751
+ tamper: "tamper",
19752
+ presence: "presence",
19753
+ "enum-sensor": "enum-sensor",
19754
+ "event-emitter": "device-event",
19755
+ "lock-control": "lock",
19756
+ switch: "switch",
19757
+ button: "button",
19758
+ doorbell: "doorbell"
19759
+ };
19760
+ function buildDescriptor(capName, kind) {
19761
+ const t = EVENT_TAXONOMY[kind];
19762
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19763
+ return {
19764
+ ...t,
19765
+ icon: legacyIcon(t.iconId)
19766
+ };
19767
+ }
19768
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19343
19769
  var CameraPipelineConfigSchema = object({
19344
19770
  engine: PipelineEngineChoiceSchema.optional(),
19345
19771
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19358,13 +19784,11 @@ var PipelineTemplateSchema = object({
19358
19784
  createdAt: string(),
19359
19785
  updatedAt: string()
19360
19786
  });
19361
- var AgentAddonConfigSchema = object({
19362
- enabled: boolean(),
19787
+ var DeviceStepConfigSchema = object({
19363
19788
  modelId: string().optional(),
19364
- settings: record(string(), unknown()).readonly()
19789
+ settings: record(string(), unknown()).optional()
19365
19790
  });
19366
19791
  var AgentPipelineSettingsSchema = object({
19367
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19368
19792
  maxCameras: number().int().nonnegative().nullable().default(null),
19369
19793
  /** Per-node detection weight (relative share for the quota balancer). */
19370
19794
  detectWeight: number().positive().optional(),
@@ -19388,7 +19812,22 @@ var AgentPipelineSettingsSchema = object({
19388
19812
  * it already uses to reach the hub). Set this only when the auto-detected
19389
19813
  * address is wrong (multi-homed host, NAT, custom interface).
19390
19814
  */
19391
- reachableHost: string().optional()
19815
+ reachableHost: string().optional(),
19816
+ /**
19817
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19818
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19819
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19820
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19821
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19822
+ * the default model/settings for every camera landing on that accelerator;
19823
+ * a stepId absent ⇒ the step uses that device's format default.
19824
+ */
19825
+ inferenceDevices: record(string(), object({
19826
+ enabled: boolean(),
19827
+ weight: number().positive().optional(),
19828
+ maxSessions: number().int().positive().optional(),
19829
+ steps: record(string(), DeviceStepConfigSchema).optional()
19830
+ })).optional()
19392
19831
  });
19393
19832
  var CameraPipelineForAgentSchema = object({
19394
19833
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19398,14 +19837,13 @@ var CameraPipelineForAgentSchema = object({
19398
19837
  }).nullable()
19399
19838
  });
19400
19839
  var CameraStepOverridePatchSchema = object({
19401
- enabled: boolean().optional(),
19402
19840
  modelId: string().optional(),
19403
19841
  settings: record(string(), unknown()).readonly().optional()
19404
19842
  });
19405
19843
  var CameraPipelineSettingsSchema = object({
19406
19844
  pinnedAgentNodeId: string().optional(),
19407
19845
  stepToggles: record(string(), boolean()).optional(),
19408
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19846
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19409
19847
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19410
19848
  });
19411
19849
  /**
@@ -19619,6 +20057,44 @@ var CameraStatusSchema = object({
19619
20057
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19620
20058
  fetchedAt: number()
19621
20059
  });
20060
+ var NodeInferenceDeviceSchema = object({
20061
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20062
+ key: string(),
20063
+ backend: string(),
20064
+ device: string(),
20065
+ format: _enum(MODEL_FORMATS),
20066
+ /** Whether the node's live probe reports the device as usable right now. */
20067
+ available: boolean(),
20068
+ /**
20069
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20070
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20071
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20072
+ * not a balanced target). An explicit stored value always wins; a stored-only
20073
+ * (unavailable) key keeps its stored value.
20074
+ */
20075
+ enabled: boolean(),
20076
+ /** Relative balancer weight for the enabled device (default 1). */
20077
+ weight: number(),
20078
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20079
+ maxSessions: number().nullable(),
20080
+ /** Object-detection model the executor defaults to for this deviceKey. */
20081
+ defaultModelId: string(),
20082
+ /**
20083
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20084
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20085
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20086
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20087
+ * available per format; this is the stored selection that becomes the
20088
+ * default for EVERY camera landing on this accelerator.
20089
+ */
20090
+ steps: record(string(), DeviceStepConfigSchema).optional()
20091
+ });
20092
+ var NodeInferenceDevicesSchema = object({
20093
+ nodeId: string(),
20094
+ /** False when the node's platform-probe was unreachable (no live device set). */
20095
+ reachable: boolean(),
20096
+ devices: array(NodeInferenceDeviceSchema).readonly()
20097
+ });
19622
20098
  method(object({
19623
20099
  deviceId: number(),
19624
20100
  agentNodeId: string()
@@ -19628,7 +20104,13 @@ method(object({
19628
20104
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19629
20105
  kind: "mutation",
19630
20106
  auth: "admin"
19631
- }), method(_void(), object({ migrated: number() }), {
20107
+ }), method(object({
20108
+ deviceId: number(),
20109
+ deviceKey: string()
20110
+ }), object({ success: literal(true) }), {
20111
+ kind: "mutation",
20112
+ auth: "admin"
20113
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19632
20114
  kind: "mutation",
19633
20115
  auth: "admin"
19634
20116
  }), 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({
@@ -19662,13 +20144,7 @@ method(object({
19662
20144
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19663
20145
  nodeId: string(),
19664
20146
  settings: AgentPipelineSettingsSchema
19665
- })).readonly()), method(object({
19666
- agentNodeId: string(),
19667
- defaults: record(string(), AgentAddonConfigSchema)
19668
- }), object({ success: literal(true) }), {
19669
- kind: "mutation",
19670
- auth: "admin"
19671
- }), method(object({ agentNodeId: string() }), object({
20147
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19672
20148
  success: boolean(),
19673
20149
  removed: boolean()
19674
20150
  }), {
@@ -19700,7 +20176,18 @@ method(object({
19700
20176
  }), object({ success: literal(true) }), {
19701
20177
  kind: "mutation",
19702
20178
  auth: "admin"
19703
- }), method(object({ agentNodeId: string() }), object({
20179
+ }), method(object({
20180
+ agentNodeId: string(),
20181
+ inferenceDevices: record(string(), object({
20182
+ enabled: boolean(),
20183
+ weight: number().positive().optional(),
20184
+ maxSessions: number().int().positive().optional(),
20185
+ steps: record(string(), DeviceStepConfigSchema).optional()
20186
+ }))
20187
+ }), object({ success: literal(true) }), {
20188
+ kind: "mutation",
20189
+ auth: "admin"
20190
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19704
20191
  success: literal(true),
19705
20192
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19706
20193
  effectiveModelId: string().nullable(),
@@ -19716,9 +20203,10 @@ method(object({
19716
20203
  }), object({ success: literal(true) }), {
19717
20204
  kind: "mutation",
19718
20205
  auth: "admin"
19719
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20206
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19720
20207
  deviceId: number(),
19721
20208
  agentNodeId: string(),
20209
+ deviceKey: string(),
19722
20210
  addonId: string(),
19723
20211
  patch: CameraStepOverridePatchSchema.nullable()
19724
20212
  }), object({ success: literal(true) }), {
@@ -19755,14 +20243,13 @@ method(object({
19755
20243
  });
19756
20244
  /**
19757
20245
  * server-management — per-NODE singleton capability for a node's ROOT
19758
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19759
- * agents).
20246
+ * package lifecycle (runtime-updatable node packages).
19760
20247
  *
19761
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19762
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19763
- * version describes the node. Updates install into
19764
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19765
- * starter (probation boot + auto-rollback to N-1).
20248
+ * Every node role runs the SAME root package (`@camstack/server`), which
20249
+ * carries the whole software stack in its npm dep tree, so ONE version
20250
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20251
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20252
+ * no auto-rollback).
19766
20253
  *
19767
20254
  * Providers:
19768
20255
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19870,7 +20357,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19870
20357
  /** Explicit target version; omitted = latest from the registry. */
19871
20358
  version: string().optional() }), ServerUpdateActionResultSchema, {
19872
20359
  kind: "mutation",
19873
- auth: "admin"
20360
+ auth: "admin",
20361
+ timeoutMs: 16 * 6e4
19874
20362
  }), method(_void(), ServerUpdateActionResultSchema, {
19875
20363
  kind: "mutation",
19876
20364
  auth: "admin"
@@ -20914,22 +21402,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20914
21402
  var RestartAddonResultSchema = unknown();
20915
21403
  var InstallPackageResultSchema = unknown();
20916
21404
  var ReloadPackagesResultSchema = unknown();
20917
- /**
20918
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20919
- * server restarts so the admin UI can react to the `restartingAt`
20920
- * timestamp (shows reconnect overlay). The transition from
20921
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20922
- * `system.restart-completed` event after the new process boots.
20923
- *
20924
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20925
- */
20926
- var UpdateFrameworkPackageResultSchema = object({
20927
- packageName: string(),
20928
- fromVersion: string(),
20929
- toVersion: string(),
20930
- /** Ms-epoch the server scheduled its self-restart. */
20931
- restartingAt: number()
20932
- });
20933
21405
  var BulkUpdateItemStatusSchema = _enum([
20934
21406
  "queued",
20935
21407
  "updating",
@@ -21057,13 +21529,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21057
21529
  }), object({ success: literal(true) }), {
21058
21530
  kind: "mutation",
21059
21531
  auth: "admin"
21060
- }), method(object({
21061
- packageName: string().min(1),
21062
- version: string().optional(),
21063
- deferRestart: boolean().optional()
21064
- }), UpdateFrameworkPackageResultSchema, {
21065
- kind: "mutation",
21066
- auth: "admin"
21067
21532
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21068
21533
  kind: "mutation",
21069
21534
  auth: "admin"
@@ -21929,10 +22394,10 @@ var TopologyCategorySchema = object({
21929
22394
  addons: array(TopologyCategoryAddonSchema).readonly()
21930
22395
  });
21931
22396
  /**
21932
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21933
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21934
- * version visibility for the Server management surface. Nullable: offline
21935
- * rows and pre-phase-2 nodes report none.
22397
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22398
+ * root package for every node role) as reported by its `registerNode`
22399
+ * manifest — version visibility for the Server management surface. Nullable:
22400
+ * offline rows and nodes that never reported one.
21936
22401
  */
21937
22402
  var TopologyRootPackageSchema = object({
21938
22403
  name: string(),
@@ -22320,17 +22785,28 @@ var PlatformScoreSchema = object({
22320
22785
  format: _enum([
22321
22786
  "onnx",
22322
22787
  "coreml",
22323
- "openvino"
22788
+ "openvino",
22789
+ "tflite"
22324
22790
  ]),
22325
22791
  score: number(),
22326
22792
  reason: string(),
22327
22793
  available: boolean()
22328
22794
  });
22795
+ var InferenceDeviceDescriptorSchema = object({
22796
+ key: string(),
22797
+ backend: string(),
22798
+ device: string(),
22799
+ format: ModelFormatSchema,
22800
+ runtime: literal("python"),
22801
+ score: number(),
22802
+ available: boolean()
22803
+ });
22329
22804
  var PlatformCapabilitiesSchema = object({
22330
22805
  hardware: HardwareInfoSchema,
22331
22806
  scores: array(PlatformScoreSchema).readonly(),
22332
22807
  bestScore: PlatformScoreSchema,
22333
- pythonPath: string().nullable()
22808
+ pythonPath: string().nullable(),
22809
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22334
22810
  });
22335
22811
  var ModelRequirementSchema = object({
22336
22812
  modelId: string(),
@@ -23209,12 +23685,6 @@ Object.freeze({
23209
23685
  addonId: null,
23210
23686
  access: "delete"
23211
23687
  },
23212
- "addons.updateFrameworkPackage": {
23213
- capName: "addons",
23214
- capScope: "system",
23215
- addonId: null,
23216
- access: "create"
23217
- },
23218
23688
  "addons.updatePackage": {
23219
23689
  capName: "addons",
23220
23690
  capScope: "system",
@@ -25987,12 +26457,6 @@ Object.freeze({
25987
26457
  addonId: null,
25988
26458
  access: "view"
25989
26459
  },
25990
- "pipelineExecutor.reprobeEngine": {
25991
- capName: "pipeline-executor",
25992
- capScope: "system",
25993
- addonId: null,
25994
- access: "create"
25995
- },
25996
26460
  "pipelineExecutor.runAudioTest": {
25997
26461
  capName: "pipeline-executor",
25998
26462
  capScope: "system",
@@ -26143,6 +26607,12 @@ Object.freeze({
26143
26607
  addonId: null,
26144
26608
  access: "view"
26145
26609
  },
26610
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26611
+ capName: "pipeline-orchestrator",
26612
+ capScope: "system",
26613
+ addonId: null,
26614
+ access: "view"
26615
+ },
26146
26616
  "pipelineOrchestrator.getPipelineAssignment": {
26147
26617
  capName: "pipeline-orchestrator",
26148
26618
  capScope: "system",
@@ -26155,6 +26625,12 @@ Object.freeze({
26155
26625
  addonId: null,
26156
26626
  access: "view"
26157
26627
  },
26628
+ "pipelineOrchestrator.getPipelineDevicePin": {
26629
+ capName: "pipeline-orchestrator",
26630
+ capScope: "system",
26631
+ addonId: null,
26632
+ access: "view"
26633
+ },
26158
26634
  "pipelineOrchestrator.listAgentSettings": {
26159
26635
  capName: "pipeline-orchestrator",
26160
26636
  capScope: "system",
@@ -26197,19 +26673,19 @@ Object.freeze({
26197
26673
  addonId: null,
26198
26674
  access: "create"
26199
26675
  },
26200
- "pipelineOrchestrator.setAgentAddonDefaults": {
26676
+ "pipelineOrchestrator.setAgentCapabilities": {
26201
26677
  capName: "pipeline-orchestrator",
26202
26678
  capScope: "system",
26203
26679
  addonId: null,
26204
26680
  access: "create"
26205
26681
  },
26206
- "pipelineOrchestrator.setAgentCapabilities": {
26682
+ "pipelineOrchestrator.setAgentDetectWeight": {
26207
26683
  capName: "pipeline-orchestrator",
26208
26684
  capScope: "system",
26209
26685
  addonId: null,
26210
26686
  access: "create"
26211
26687
  },
26212
- "pipelineOrchestrator.setAgentDetectWeight": {
26688
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26213
26689
  capName: "pipeline-orchestrator",
26214
26690
  capScope: "system",
26215
26691
  addonId: null,
@@ -26251,6 +26727,12 @@ Object.freeze({
26251
26727
  addonId: null,
26252
26728
  access: "create"
26253
26729
  },
26730
+ "pipelineOrchestrator.setPipelineDevicePin": {
26731
+ capName: "pipeline-orchestrator",
26732
+ capScope: "system",
26733
+ addonId: null,
26734
+ access: "create"
26735
+ },
26254
26736
  "pipelineOrchestrator.unassignAudio": {
26255
26737
  capName: "pipeline-orchestrator",
26256
26738
  capScope: "system",
@@ -27803,32 +28285,6 @@ Object.freeze({
27803
28285
  "network-access": "ingress",
27804
28286
  "smtp-provider": "email"
27805
28287
  });
27806
- var frameworkSwapPackageSchema = object({
27807
- name: string(),
27808
- stagedPath: string(),
27809
- backupPath: string(),
27810
- toVersion: string(),
27811
- fromVersion: string().nullable()
27812
- });
27813
- object({
27814
- jobId: string(),
27815
- taskId: string(),
27816
- packages: array(frameworkSwapPackageSchema),
27817
- requestedAtMs: number(),
27818
- schemaVersion: literal(1)
27819
- });
27820
- object({
27821
- jobId: string(),
27822
- taskId: string(),
27823
- backups: array(object({
27824
- name: string(),
27825
- backupPath: string(),
27826
- livePath: string()
27827
- })),
27828
- appliedAtMs: number(),
27829
- bootAttempts: number(),
27830
- schemaVersion: literal(1)
27831
- });
27832
28288
  //#endregion
27833
28289
  //#region src/config.ts
27834
28290
  /**