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