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