@camstack/addon-provider-unraid 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.mjs CHANGED
@@ -7097,6 +7097,17 @@ var ModelCatalogEntrySchema = object({
7097
7097
  "imagenet",
7098
7098
  "none"
7099
7099
  ]).optional(),
7100
+ /**
7101
+ * The model already applies softmax IN-GRAPH — its raw output is a
7102
+ * probability distribution, not logits. When set, the `softmax`
7103
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7104
+ * probability vector collapses it toward uniform (top-1 score craters far
7105
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7106
+ * the output is raw logits and the postprocessor applies softmax (the normal
7107
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7108
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7109
+ */
7110
+ outputProbabilities: boolean().optional(),
7100
7111
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7101
7112
  /**
7102
7113
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7656,6 +7667,160 @@ var EncodeProfileSchema = object({
7656
7667
  */
7657
7668
  outputArgs: array(string()).optional()
7658
7669
  });
7670
+ var COCO_TO_MACRO = {
7671
+ mapping: {
7672
+ person: "person",
7673
+ bicycle: "vehicle",
7674
+ car: "vehicle",
7675
+ motorcycle: "vehicle",
7676
+ airplane: "vehicle",
7677
+ bus: "vehicle",
7678
+ train: "vehicle",
7679
+ truck: "vehicle",
7680
+ boat: "vehicle",
7681
+ bird: "animal",
7682
+ cat: "animal",
7683
+ dog: "animal",
7684
+ horse: "animal",
7685
+ sheep: "animal",
7686
+ cow: "animal",
7687
+ elephant: "animal",
7688
+ bear: "animal",
7689
+ zebra: "animal",
7690
+ giraffe: "animal",
7691
+ suitcase: "package",
7692
+ backpack: "package",
7693
+ handbag: "package"
7694
+ },
7695
+ preserveOriginal: false
7696
+ };
7697
+ var AUDIO_MACRO_LABELS = [
7698
+ {
7699
+ id: "speech",
7700
+ name: "Speech",
7701
+ icon: "🗣️"
7702
+ },
7703
+ {
7704
+ id: "scream",
7705
+ name: "Scream / Shout",
7706
+ icon: "😱"
7707
+ },
7708
+ {
7709
+ id: "crying",
7710
+ name: "Crying / Baby",
7711
+ icon: "😢"
7712
+ },
7713
+ {
7714
+ id: "laughter",
7715
+ name: "Laughter",
7716
+ icon: "😂"
7717
+ },
7718
+ {
7719
+ id: "music",
7720
+ name: "Music",
7721
+ icon: "🎵"
7722
+ },
7723
+ {
7724
+ id: "dog",
7725
+ name: "Dog",
7726
+ icon: "🐕"
7727
+ },
7728
+ {
7729
+ id: "cat",
7730
+ name: "Cat",
7731
+ icon: "🐈"
7732
+ },
7733
+ {
7734
+ id: "bird",
7735
+ name: "Bird",
7736
+ icon: "🐦"
7737
+ },
7738
+ {
7739
+ id: "animal",
7740
+ name: "Animal (other)",
7741
+ icon: "🐾"
7742
+ },
7743
+ {
7744
+ id: "alarm",
7745
+ name: "Alarm / Siren",
7746
+ icon: "🚨"
7747
+ },
7748
+ {
7749
+ id: "doorbell",
7750
+ name: "Doorbell / Knock",
7751
+ icon: "🔔"
7752
+ },
7753
+ {
7754
+ id: "glass_breaking",
7755
+ name: "Glass Breaking",
7756
+ icon: "💥"
7757
+ },
7758
+ {
7759
+ id: "gunshot",
7760
+ name: "Gunshot / Explosion",
7761
+ icon: "💣"
7762
+ },
7763
+ {
7764
+ id: "vehicle",
7765
+ name: "Vehicle",
7766
+ icon: "🚗"
7767
+ },
7768
+ {
7769
+ id: "siren",
7770
+ name: "Emergency Siren",
7771
+ icon: "🚑"
7772
+ },
7773
+ {
7774
+ id: "fire",
7775
+ name: "Fire / Smoke",
7776
+ icon: "🔥"
7777
+ },
7778
+ {
7779
+ id: "water",
7780
+ name: "Water",
7781
+ icon: "💧"
7782
+ },
7783
+ {
7784
+ id: "wind",
7785
+ name: "Wind / Weather",
7786
+ icon: "🌬️"
7787
+ },
7788
+ {
7789
+ id: "door",
7790
+ name: "Door",
7791
+ icon: "🚪"
7792
+ },
7793
+ {
7794
+ id: "footsteps",
7795
+ name: "Footsteps",
7796
+ icon: "👣"
7797
+ },
7798
+ {
7799
+ id: "crowd",
7800
+ name: "Crowd / Chatter",
7801
+ icon: "👥"
7802
+ },
7803
+ {
7804
+ id: "telephone",
7805
+ name: "Telephone",
7806
+ icon: "📞"
7807
+ },
7808
+ {
7809
+ id: "engine",
7810
+ name: "Engine / Motor",
7811
+ icon: "⚙️"
7812
+ },
7813
+ {
7814
+ id: "tools",
7815
+ name: "Tools / Construction",
7816
+ icon: "🔨"
7817
+ },
7818
+ {
7819
+ id: "silence",
7820
+ name: "Silence",
7821
+ icon: "🤫"
7822
+ }
7823
+ ];
7659
7824
  var YAMNET_TO_MACRO = {
7660
7825
  mapping: {
7661
7826
  Speech: "speech",
@@ -7922,6 +8087,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7922
8087
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7923
8088
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7924
8089
  /**
8090
+ * Unified event-kind taxonomy — THE single source of truth for
8091
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8092
+ * icon }`.
8093
+ *
8094
+ * This dictionary folds together what used to be scattered across four
8095
+ * copies:
8096
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8097
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8098
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8099
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8100
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8101
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8102
+ *
8103
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8104
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8105
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8106
+ * color or an icon: they read this dictionary (server descriptors carry the
8107
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8108
+ *
8109
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8110
+ */
8111
+ var TAXONOMY_COLORS = {
8112
+ motion: "#f59e0b",
8113
+ audio: "#06b6d4",
8114
+ person: "#22c55e",
8115
+ vehicle: "#3b82f6",
8116
+ animal: "#f97316",
8117
+ package: "#a855f7",
8118
+ sensor: "#8b5cf6",
8119
+ control: "#10b981",
8120
+ genericDetection: "#64748b"
8121
+ };
8122
+ var DETECTION_SUB_COLORS = {
8123
+ car: "#f59e0b",
8124
+ truck: "#d97706",
8125
+ bus: "#b45309",
8126
+ motorcycle: "#eab308",
8127
+ bicycle: "#ca8a04",
8128
+ airplane: "#60a5fa",
8129
+ boat: "#2563eb",
8130
+ train: "#1d4ed8",
8131
+ bird: "#14b8a6",
8132
+ dog: "#84cc16",
8133
+ cat: "#f97316",
8134
+ horse: "#a16207",
8135
+ sheep: "#a3a3a3",
8136
+ cow: "#78716c",
8137
+ elephant: "#6b7280",
8138
+ bear: "#7c2d12",
8139
+ zebra: "#404040",
8140
+ giraffe: "#d4a373"
8141
+ };
8142
+ function titleCase(id) {
8143
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8144
+ }
8145
+ var entries = /* @__PURE__ */ new Map();
8146
+ function macro(kind, category, color, iconId, label) {
8147
+ entries.set(kind, {
8148
+ kind,
8149
+ parentKind: null,
8150
+ level: "macro",
8151
+ category,
8152
+ color,
8153
+ iconId,
8154
+ labelKey: `eventKind.${kind}`,
8155
+ label
8156
+ });
8157
+ }
8158
+ function sub(kind, parentKind, category, color, iconId, label) {
8159
+ entries.set(kind, {
8160
+ kind,
8161
+ parentKind,
8162
+ level: "sub",
8163
+ category,
8164
+ color,
8165
+ iconId,
8166
+ labelKey: `eventKind.${kind}`,
8167
+ label
8168
+ });
8169
+ }
8170
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8171
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8172
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8173
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8174
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8175
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8176
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8177
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8178
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8179
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8180
+ if (entries.has(cocoClass)) continue;
8181
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8182
+ }
8183
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8184
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8185
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8186
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8187
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8188
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8189
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8190
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8191
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8192
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8193
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8194
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8195
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8196
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8197
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8198
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8199
+ sub("button", "control", "control", "#10b981", "button", "Button");
8200
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8201
+ for (const l of AUDIO_MACRO_LABELS) {
8202
+ const kind = `audio-${l.id}`;
8203
+ if (entries.has(kind)) continue;
8204
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8205
+ }
8206
+ /** The complete taxonomy dictionary, keyed by kind. */
8207
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8208
+ /**
7925
8209
  * Error types for the safe expression engine. Two distinct classes so callers
7926
8210
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7927
8211
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12114,10 +12398,7 @@ var ConfigUISchemaNullableBridge = custom();
12114
12398
  var InferenceCapabilitiesBridge = custom();
12115
12399
  var ModelAvailabilityListBridge = custom();
12116
12400
  var PipelineRunResultBridge = custom();
12117
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12118
- kind: "mutation",
12119
- auth: "admin"
12120
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12401
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12121
12402
  modelId: string(),
12122
12403
  settings: record(string(), unknown()).readonly()
12123
12404
  }))), method(object({ steps: record(string(), object({
@@ -12177,13 +12458,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12177
12458
  * (inputClasses ≠ null) are skipped and served per-track via
12178
12459
  * pipelineRunner.runDetailSubtree (two-plane design).
12179
12460
  */
12180
- plane: _enum(["full", "frame"]).optional()
12461
+ plane: _enum(["full", "frame"]).optional(),
12462
+ /**
12463
+ * Inference-device selector (Phase 2 multi-device). Format
12464
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12465
+ * Omitted ⇒ the runner's default device (current single-engine
12466
+ * behaviour). Selects WHICH device pool of the node runs the call.
12467
+ */
12468
+ deviceKey: string().optional()
12181
12469
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12182
12470
  engine: PipelineEngineChoiceSchema.optional(),
12183
12471
  steps: array(PipelineStepInputSchema).min(1),
12184
12472
  frames: array(FrameInputSchema).min(1).max(255),
12185
12473
  deviceId: number().optional(),
12186
- sessionId: string().optional()
12474
+ sessionId: string().optional(),
12475
+ /**
12476
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12477
+ * the batch to the Python pool's bench preprocess cache
12478
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12479
+ * preprocessed ONCE and every later inference is a pure-inference cache
12480
+ * hit — the sustained-throughput run measures inference, not
12481
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12482
+ * full preprocess every call, correct). Fresh per sustained run;
12483
+ * released via `uncacheFrame`.
12484
+ */
12485
+ frameId: number().int().nonnegative().optional(),
12486
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12487
+ deviceKey: string().optional()
12187
12488
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12188
12489
  data: _instanceof(Uint8Array),
12189
12490
  width: number().int().positive(),
@@ -12215,8 +12516,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12215
12516
  * - `runtime` — main camera-serving engine (no idle TTL).
12216
12517
  * - `warm-override` — benchmark/test override held in the warm
12217
12518
  * cache; auto-disposed after the idle TTL.
12519
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12520
+ * multi-device, keyed by `deviceKey`) resolved
12521
+ * via `resolveDeviceFactory`. Runs alongside the
12522
+ * `runtime` engine on a DIFFERENT accelerator
12523
+ * (NPU / iGPU / Coral) — this is how the
12524
+ * Engines tab shows all pools running at once.
12218
12525
  */
12219
- kind: _enum(["runtime", "warm-override"]),
12526
+ kind: _enum([
12527
+ "runtime",
12528
+ "warm-override",
12529
+ "device-pool"
12530
+ ]),
12220
12531
  /** Native pid of the underlying Python pool (null when no pool). */
12221
12532
  poolPid: number().nullable(),
12222
12533
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12591,7 +12902,14 @@ var RunnerCameraConfigSchema = object({
12591
12902
  * camera's detect node differs from its source-owner (P2d, gated by the
12592
12903
  * `remoteSourcingNodes` rollout setting).
12593
12904
  */
12594
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12905
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12906
+ /**
12907
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12908
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12909
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12910
+ * this only selects WHICH device pool of that node runs the session.
12911
+ */
12912
+ deviceKey: string().optional()
12595
12913
  });
12596
12914
  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;
12597
12915
  /**
@@ -12612,6 +12930,19 @@ var RunnerLocalLoadSchema = object({
12612
12930
  avgInferenceTimeMs: number(),
12613
12931
  /** Total queue depth across motion + detection queues. */
12614
12932
  queueDepthTotal: number(),
12933
+ /**
12934
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
12935
+ * this runner currently has attached cameras on, so the orchestrator's second
12936
+ * `balance()` pass (over a node's devices) weights on real per-pool session
12937
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
12938
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
12939
+ */
12940
+ devices: array(object({
12941
+ deviceKey: string(),
12942
+ backend: string(),
12943
+ attachedCameras: number(),
12944
+ queueDepthTotal: number()
12945
+ })).default([]),
12615
12946
  /** Hardware capability flags reported by this node. */
12616
12947
  hardware: object({
12617
12948
  hasGpu: boolean(),
@@ -15760,6 +16091,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15760
16091
  return toDeviceSummary(device, this.addonId);
15761
16092
  }
15762
16093
  };
16094
+ 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;
16095
+ new Set(Object.values(DeviceType));
15763
16096
  /**
15764
16097
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15765
16098
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18854,17 +19187,30 @@ var EventKindCategorySchema = _enum([
18854
19187
  "audio",
18855
19188
  "detection",
18856
19189
  "sensor",
19190
+ "control",
18857
19191
  "custom",
18858
19192
  "package"
18859
19193
  ]);
19194
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19195
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18860
19196
  var EventKindDescriptorSchema = object({
18861
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19197
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18862
19198
  kind: string(),
19199
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19200
+ labelKey: string(),
19201
+ /** English fallback label (kept for clients that don't translate). */
18863
19202
  label: string(),
18864
19203
  /** Hex color for timeline/legend rendering. */
18865
19204
  color: string(),
19205
+ /** Dictionary id → lucide component on the UI side. */
19206
+ iconId: string(),
19207
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18866
19208
  icon: EventKindIconSchema,
18867
19209
  category: EventKindCategorySchema,
19210
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19211
+ parentKind: string().nullable(),
19212
+ /** Derived from `parentKind`, explicit for the client tree. */
19213
+ level: EventKindLevelSchema,
18868
19214
  /** Which cap + device contributes this kind. For built-ins the camera
18869
19215
  * itself; for sensor kinds the LINKED source device. */
18870
19216
  source: object({
@@ -18937,11 +19283,21 @@ var TrackAudioLabelSchema = object({
18937
19283
  firstAt: number(),
18938
19284
  lastAt: number()
18939
19285
  });
19286
+ /**
19287
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19288
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19289
+ * linked sensor/control state change (no positions; carries a snapshot). The
19290
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19291
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19292
+ */
19293
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
18940
19294
  var TrackSchema = object({
18941
19295
  trackId: string(),
18942
19296
  deviceId: number(),
18943
19297
  className: string(),
18944
19298
  label: string().optional(),
19299
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19300
+ source: TrackSourceSchema.optional(),
18945
19301
  firstSeen: number(),
18946
19302
  lastSeen: number(),
18947
19303
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19318,6 +19674,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19318
19674
  eventId: string(),
19319
19675
  timestamp: number()
19320
19676
  });
19677
+ /**
19678
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19679
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19680
+ * caps into per-camera event-kind descriptors.
19681
+ *
19682
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19683
+ * is NOT duplicated here — every entry is derived from the single
19684
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19685
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19686
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19687
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19688
+ * eventful cap is missing.
19689
+ */
19690
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19691
+ var LEGACY_ICON = {
19692
+ motion: "motion",
19693
+ audio: "audio",
19694
+ person: "person",
19695
+ vehicle: "vehicle",
19696
+ animal: "animal",
19697
+ package: "package",
19698
+ door: "door",
19699
+ pir: "pir",
19700
+ smoke: "smoke",
19701
+ water: "water",
19702
+ button: "button",
19703
+ generic: "generic",
19704
+ gas: "smoke",
19705
+ vibration: "generic",
19706
+ tamper: "generic",
19707
+ presence: "person",
19708
+ lock: "generic",
19709
+ siren: "generic",
19710
+ switch: "generic",
19711
+ doorbell: "button"
19712
+ };
19713
+ function legacyIcon(iconId) {
19714
+ return LEGACY_ICON[iconId] ?? "generic";
19715
+ }
19716
+ /**
19717
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19718
+ * The anti-drift guard cross-checks this against the eventful caps declared
19719
+ * in `packages/types/src/capabilities/*.cap.ts`.
19720
+ */
19721
+ var CAP_TO_KIND = {
19722
+ contact: "contact",
19723
+ motion: "motion-sensor",
19724
+ smoke: "smoke",
19725
+ flood: "flood",
19726
+ gas: "gas",
19727
+ "carbon-monoxide": "carbon-monoxide",
19728
+ vibration: "vibration",
19729
+ tamper: "tamper",
19730
+ presence: "presence",
19731
+ "enum-sensor": "enum-sensor",
19732
+ "event-emitter": "device-event",
19733
+ "lock-control": "lock",
19734
+ switch: "switch",
19735
+ button: "button",
19736
+ doorbell: "doorbell"
19737
+ };
19738
+ function buildDescriptor(capName, kind) {
19739
+ const t = EVENT_TAXONOMY[kind];
19740
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19741
+ return {
19742
+ ...t,
19743
+ icon: legacyIcon(t.iconId)
19744
+ };
19745
+ }
19746
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19321
19747
  var CameraPipelineConfigSchema = object({
19322
19748
  engine: PipelineEngineChoiceSchema.optional(),
19323
19749
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19336,13 +19762,11 @@ var PipelineTemplateSchema = object({
19336
19762
  createdAt: string(),
19337
19763
  updatedAt: string()
19338
19764
  });
19339
- var AgentAddonConfigSchema = object({
19340
- enabled: boolean(),
19765
+ var DeviceStepConfigSchema = object({
19341
19766
  modelId: string().optional(),
19342
- settings: record(string(), unknown()).readonly()
19767
+ settings: record(string(), unknown()).optional()
19343
19768
  });
19344
19769
  var AgentPipelineSettingsSchema = object({
19345
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19346
19770
  maxCameras: number().int().nonnegative().nullable().default(null),
19347
19771
  /** Per-node detection weight (relative share for the quota balancer). */
19348
19772
  detectWeight: number().positive().optional(),
@@ -19366,7 +19790,22 @@ var AgentPipelineSettingsSchema = object({
19366
19790
  * it already uses to reach the hub). Set this only when the auto-detected
19367
19791
  * address is wrong (multi-homed host, NAT, custom interface).
19368
19792
  */
19369
- reachableHost: string().optional()
19793
+ reachableHost: string().optional(),
19794
+ /**
19795
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19796
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19797
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19798
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19799
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19800
+ * the default model/settings for every camera landing on that accelerator;
19801
+ * a stepId absent ⇒ the step uses that device's format default.
19802
+ */
19803
+ inferenceDevices: record(string(), object({
19804
+ enabled: boolean(),
19805
+ weight: number().positive().optional(),
19806
+ maxSessions: number().int().positive().optional(),
19807
+ steps: record(string(), DeviceStepConfigSchema).optional()
19808
+ })).optional()
19370
19809
  });
19371
19810
  var CameraPipelineForAgentSchema = object({
19372
19811
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19376,14 +19815,13 @@ var CameraPipelineForAgentSchema = object({
19376
19815
  }).nullable()
19377
19816
  });
19378
19817
  var CameraStepOverridePatchSchema = object({
19379
- enabled: boolean().optional(),
19380
19818
  modelId: string().optional(),
19381
19819
  settings: record(string(), unknown()).readonly().optional()
19382
19820
  });
19383
19821
  var CameraPipelineSettingsSchema = object({
19384
19822
  pinnedAgentNodeId: string().optional(),
19385
19823
  stepToggles: record(string(), boolean()).optional(),
19386
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19824
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19387
19825
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19388
19826
  });
19389
19827
  /**
@@ -19597,6 +20035,44 @@ var CameraStatusSchema = object({
19597
20035
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19598
20036
  fetchedAt: number()
19599
20037
  });
20038
+ var NodeInferenceDeviceSchema = object({
20039
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20040
+ key: string(),
20041
+ backend: string(),
20042
+ device: string(),
20043
+ format: _enum(MODEL_FORMATS),
20044
+ /** Whether the node's live probe reports the device as usable right now. */
20045
+ available: boolean(),
20046
+ /**
20047
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20048
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20049
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20050
+ * not a balanced target). An explicit stored value always wins; a stored-only
20051
+ * (unavailable) key keeps its stored value.
20052
+ */
20053
+ enabled: boolean(),
20054
+ /** Relative balancer weight for the enabled device (default 1). */
20055
+ weight: number(),
20056
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20057
+ maxSessions: number().nullable(),
20058
+ /** Object-detection model the executor defaults to for this deviceKey. */
20059
+ defaultModelId: string(),
20060
+ /**
20061
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20062
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20063
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20064
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20065
+ * available per format; this is the stored selection that becomes the
20066
+ * default for EVERY camera landing on this accelerator.
20067
+ */
20068
+ steps: record(string(), DeviceStepConfigSchema).optional()
20069
+ });
20070
+ var NodeInferenceDevicesSchema = object({
20071
+ nodeId: string(),
20072
+ /** False when the node's platform-probe was unreachable (no live device set). */
20073
+ reachable: boolean(),
20074
+ devices: array(NodeInferenceDeviceSchema).readonly()
20075
+ });
19600
20076
  method(object({
19601
20077
  deviceId: number(),
19602
20078
  agentNodeId: string()
@@ -19606,7 +20082,13 @@ method(object({
19606
20082
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19607
20083
  kind: "mutation",
19608
20084
  auth: "admin"
19609
- }), method(_void(), object({ migrated: number() }), {
20085
+ }), method(object({
20086
+ deviceId: number(),
20087
+ deviceKey: string()
20088
+ }), object({ success: literal(true) }), {
20089
+ kind: "mutation",
20090
+ auth: "admin"
20091
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19610
20092
  kind: "mutation",
19611
20093
  auth: "admin"
19612
20094
  }), 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({
@@ -19640,13 +20122,7 @@ method(object({
19640
20122
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19641
20123
  nodeId: string(),
19642
20124
  settings: AgentPipelineSettingsSchema
19643
- })).readonly()), method(object({
19644
- agentNodeId: string(),
19645
- defaults: record(string(), AgentAddonConfigSchema)
19646
- }), object({ success: literal(true) }), {
19647
- kind: "mutation",
19648
- auth: "admin"
19649
- }), method(object({ agentNodeId: string() }), object({
20125
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19650
20126
  success: boolean(),
19651
20127
  removed: boolean()
19652
20128
  }), {
@@ -19678,7 +20154,18 @@ method(object({
19678
20154
  }), object({ success: literal(true) }), {
19679
20155
  kind: "mutation",
19680
20156
  auth: "admin"
19681
- }), method(object({ agentNodeId: string() }), object({
20157
+ }), method(object({
20158
+ agentNodeId: string(),
20159
+ inferenceDevices: record(string(), object({
20160
+ enabled: boolean(),
20161
+ weight: number().positive().optional(),
20162
+ maxSessions: number().int().positive().optional(),
20163
+ steps: record(string(), DeviceStepConfigSchema).optional()
20164
+ }))
20165
+ }), object({ success: literal(true) }), {
20166
+ kind: "mutation",
20167
+ auth: "admin"
20168
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19682
20169
  success: literal(true),
19683
20170
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19684
20171
  effectiveModelId: string().nullable(),
@@ -19694,9 +20181,10 @@ method(object({
19694
20181
  }), object({ success: literal(true) }), {
19695
20182
  kind: "mutation",
19696
20183
  auth: "admin"
19697
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20184
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19698
20185
  deviceId: number(),
19699
20186
  agentNodeId: string(),
20187
+ deviceKey: string(),
19700
20188
  addonId: string(),
19701
20189
  patch: CameraStepOverridePatchSchema.nullable()
19702
20190
  }), object({ success: literal(true) }), {
@@ -19733,14 +20221,13 @@ method(object({
19733
20221
  });
19734
20222
  /**
19735
20223
  * server-management — per-NODE singleton capability for a node's ROOT
19736
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19737
- * agents).
20224
+ * package lifecycle (runtime-updatable node packages).
19738
20225
  *
19739
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19740
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19741
- * version describes the node. Updates install into
19742
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19743
- * starter (probation boot + auto-rollback to N-1).
20226
+ * Every node role runs the SAME root package (`@camstack/server`), which
20227
+ * carries the whole software stack in its npm dep tree, so ONE version
20228
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20229
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20230
+ * no auto-rollback).
19744
20231
  *
19745
20232
  * Providers:
19746
20233
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19848,7 +20335,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19848
20335
  /** Explicit target version; omitted = latest from the registry. */
19849
20336
  version: string().optional() }), ServerUpdateActionResultSchema, {
19850
20337
  kind: "mutation",
19851
- auth: "admin"
20338
+ auth: "admin",
20339
+ timeoutMs: 16 * 6e4
19852
20340
  }), method(_void(), ServerUpdateActionResultSchema, {
19853
20341
  kind: "mutation",
19854
20342
  auth: "admin"
@@ -20892,22 +21380,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
20892
21380
  var RestartAddonResultSchema = unknown();
20893
21381
  var InstallPackageResultSchema = unknown();
20894
21382
  var ReloadPackagesResultSchema = unknown();
20895
- /**
20896
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
20897
- * server restarts so the admin UI can react to the `restartingAt`
20898
- * timestamp (shows reconnect overlay). The transition from
20899
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
20900
- * `system.restart-completed` event after the new process boots.
20901
- *
20902
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
20903
- */
20904
- var UpdateFrameworkPackageResultSchema = object({
20905
- packageName: string(),
20906
- fromVersion: string(),
20907
- toVersion: string(),
20908
- /** Ms-epoch the server scheduled its self-restart. */
20909
- restartingAt: number()
20910
- });
20911
21383
  var BulkUpdateItemStatusSchema = _enum([
20912
21384
  "queued",
20913
21385
  "updating",
@@ -21035,13 +21507,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21035
21507
  }), object({ success: literal(true) }), {
21036
21508
  kind: "mutation",
21037
21509
  auth: "admin"
21038
- }), method(object({
21039
- packageName: string().min(1),
21040
- version: string().optional(),
21041
- deferRestart: boolean().optional()
21042
- }), UpdateFrameworkPackageResultSchema, {
21043
- kind: "mutation",
21044
- auth: "admin"
21045
21510
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21046
21511
  kind: "mutation",
21047
21512
  auth: "admin"
@@ -21924,10 +22389,10 @@ var TopologyCategorySchema = object({
21924
22389
  addons: array(TopologyCategoryAddonSchema).readonly()
21925
22390
  });
21926
22391
  /**
21927
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
21928
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
21929
- * version visibility for the Server management surface. Nullable: offline
21930
- * rows and pre-phase-2 nodes report none.
22392
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22393
+ * root package for every node role) as reported by its `registerNode`
22394
+ * manifest — version visibility for the Server management surface. Nullable:
22395
+ * offline rows and nodes that never reported one.
21931
22396
  */
21932
22397
  var TopologyRootPackageSchema = object({
21933
22398
  name: string(),
@@ -22315,17 +22780,28 @@ var PlatformScoreSchema = object({
22315
22780
  format: _enum([
22316
22781
  "onnx",
22317
22782
  "coreml",
22318
- "openvino"
22783
+ "openvino",
22784
+ "tflite"
22319
22785
  ]),
22320
22786
  score: number(),
22321
22787
  reason: string(),
22322
22788
  available: boolean()
22323
22789
  });
22790
+ var InferenceDeviceDescriptorSchema = object({
22791
+ key: string(),
22792
+ backend: string(),
22793
+ device: string(),
22794
+ format: ModelFormatSchema,
22795
+ runtime: literal("python"),
22796
+ score: number(),
22797
+ available: boolean()
22798
+ });
22324
22799
  var PlatformCapabilitiesSchema = object({
22325
22800
  hardware: HardwareInfoSchema,
22326
22801
  scores: array(PlatformScoreSchema).readonly(),
22327
22802
  bestScore: PlatformScoreSchema,
22328
- pythonPath: string().nullable()
22803
+ pythonPath: string().nullable(),
22804
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22329
22805
  });
22330
22806
  var ModelRequirementSchema = object({
22331
22807
  modelId: string(),
@@ -23204,12 +23680,6 @@ Object.freeze({
23204
23680
  addonId: null,
23205
23681
  access: "delete"
23206
23682
  },
23207
- "addons.updateFrameworkPackage": {
23208
- capName: "addons",
23209
- capScope: "system",
23210
- addonId: null,
23211
- access: "create"
23212
- },
23213
23683
  "addons.updatePackage": {
23214
23684
  capName: "addons",
23215
23685
  capScope: "system",
@@ -25982,12 +26452,6 @@ Object.freeze({
25982
26452
  addonId: null,
25983
26453
  access: "view"
25984
26454
  },
25985
- "pipelineExecutor.reprobeEngine": {
25986
- capName: "pipeline-executor",
25987
- capScope: "system",
25988
- addonId: null,
25989
- access: "create"
25990
- },
25991
26455
  "pipelineExecutor.runAudioTest": {
25992
26456
  capName: "pipeline-executor",
25993
26457
  capScope: "system",
@@ -26138,6 +26602,12 @@ Object.freeze({
26138
26602
  addonId: null,
26139
26603
  access: "view"
26140
26604
  },
26605
+ "pipelineOrchestrator.getNodeInferenceDevices": {
26606
+ capName: "pipeline-orchestrator",
26607
+ capScope: "system",
26608
+ addonId: null,
26609
+ access: "view"
26610
+ },
26141
26611
  "pipelineOrchestrator.getPipelineAssignment": {
26142
26612
  capName: "pipeline-orchestrator",
26143
26613
  capScope: "system",
@@ -26150,6 +26620,12 @@ Object.freeze({
26150
26620
  addonId: null,
26151
26621
  access: "view"
26152
26622
  },
26623
+ "pipelineOrchestrator.getPipelineDevicePin": {
26624
+ capName: "pipeline-orchestrator",
26625
+ capScope: "system",
26626
+ addonId: null,
26627
+ access: "view"
26628
+ },
26153
26629
  "pipelineOrchestrator.listAgentSettings": {
26154
26630
  capName: "pipeline-orchestrator",
26155
26631
  capScope: "system",
@@ -26192,19 +26668,19 @@ Object.freeze({
26192
26668
  addonId: null,
26193
26669
  access: "create"
26194
26670
  },
26195
- "pipelineOrchestrator.setAgentAddonDefaults": {
26671
+ "pipelineOrchestrator.setAgentCapabilities": {
26196
26672
  capName: "pipeline-orchestrator",
26197
26673
  capScope: "system",
26198
26674
  addonId: null,
26199
26675
  access: "create"
26200
26676
  },
26201
- "pipelineOrchestrator.setAgentCapabilities": {
26677
+ "pipelineOrchestrator.setAgentDetectWeight": {
26202
26678
  capName: "pipeline-orchestrator",
26203
26679
  capScope: "system",
26204
26680
  addonId: null,
26205
26681
  access: "create"
26206
26682
  },
26207
- "pipelineOrchestrator.setAgentDetectWeight": {
26683
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26208
26684
  capName: "pipeline-orchestrator",
26209
26685
  capScope: "system",
26210
26686
  addonId: null,
@@ -26246,6 +26722,12 @@ Object.freeze({
26246
26722
  addonId: null,
26247
26723
  access: "create"
26248
26724
  },
26725
+ "pipelineOrchestrator.setPipelineDevicePin": {
26726
+ capName: "pipeline-orchestrator",
26727
+ capScope: "system",
26728
+ addonId: null,
26729
+ access: "create"
26730
+ },
26249
26731
  "pipelineOrchestrator.unassignAudio": {
26250
26732
  capName: "pipeline-orchestrator",
26251
26733
  capScope: "system",
@@ -27798,32 +28280,6 @@ Object.freeze({
27798
28280
  "network-access": "ingress",
27799
28281
  "smtp-provider": "email"
27800
28282
  });
27801
- var frameworkSwapPackageSchema = object({
27802
- name: string(),
27803
- stagedPath: string(),
27804
- backupPath: string(),
27805
- toVersion: string(),
27806
- fromVersion: string().nullable()
27807
- });
27808
- object({
27809
- jobId: string(),
27810
- taskId: string(),
27811
- packages: array(frameworkSwapPackageSchema),
27812
- requestedAtMs: number(),
27813
- schemaVersion: literal(1)
27814
- });
27815
- object({
27816
- jobId: string(),
27817
- taskId: string(),
27818
- backups: array(object({
27819
- name: string(),
27820
- backupPath: string(),
27821
- livePath: string()
27822
- })),
27823
- appliedAtMs: number(),
27824
- bootAttempts: number(),
27825
- schemaVersion: literal(1)
27826
- });
27827
28283
  //#endregion
27828
28284
  //#region src/config.ts
27829
28285
  /**