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