@camstack/addon-provider-amcrest 0.1.14 → 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
@@ -7077,6 +7077,17 @@ var ModelCatalogEntrySchema = object({
7077
7077
  "imagenet",
7078
7078
  "none"
7079
7079
  ]).optional(),
7080
+ /**
7081
+ * The model already applies softmax IN-GRAPH — its raw output is a
7082
+ * probability distribution, not logits. When set, the `softmax`
7083
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7084
+ * probability vector collapses it toward uniform (top-1 score craters far
7085
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7086
+ * the output is raw logits and the postprocessor applies softmax (the normal
7087
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7088
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7089
+ */
7090
+ outputProbabilities: boolean().optional(),
7080
7091
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7081
7092
  /**
7082
7093
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7636,6 +7647,160 @@ var EncodeProfileSchema = object({
7636
7647
  */
7637
7648
  outputArgs: array(string()).optional()
7638
7649
  });
7650
+ var COCO_TO_MACRO = {
7651
+ mapping: {
7652
+ person: "person",
7653
+ bicycle: "vehicle",
7654
+ car: "vehicle",
7655
+ motorcycle: "vehicle",
7656
+ airplane: "vehicle",
7657
+ bus: "vehicle",
7658
+ train: "vehicle",
7659
+ truck: "vehicle",
7660
+ boat: "vehicle",
7661
+ bird: "animal",
7662
+ cat: "animal",
7663
+ dog: "animal",
7664
+ horse: "animal",
7665
+ sheep: "animal",
7666
+ cow: "animal",
7667
+ elephant: "animal",
7668
+ bear: "animal",
7669
+ zebra: "animal",
7670
+ giraffe: "animal",
7671
+ suitcase: "package",
7672
+ backpack: "package",
7673
+ handbag: "package"
7674
+ },
7675
+ preserveOriginal: false
7676
+ };
7677
+ var AUDIO_MACRO_LABELS = [
7678
+ {
7679
+ id: "speech",
7680
+ name: "Speech",
7681
+ icon: "🗣️"
7682
+ },
7683
+ {
7684
+ id: "scream",
7685
+ name: "Scream / Shout",
7686
+ icon: "😱"
7687
+ },
7688
+ {
7689
+ id: "crying",
7690
+ name: "Crying / Baby",
7691
+ icon: "😢"
7692
+ },
7693
+ {
7694
+ id: "laughter",
7695
+ name: "Laughter",
7696
+ icon: "😂"
7697
+ },
7698
+ {
7699
+ id: "music",
7700
+ name: "Music",
7701
+ icon: "🎵"
7702
+ },
7703
+ {
7704
+ id: "dog",
7705
+ name: "Dog",
7706
+ icon: "🐕"
7707
+ },
7708
+ {
7709
+ id: "cat",
7710
+ name: "Cat",
7711
+ icon: "🐈"
7712
+ },
7713
+ {
7714
+ id: "bird",
7715
+ name: "Bird",
7716
+ icon: "🐦"
7717
+ },
7718
+ {
7719
+ id: "animal",
7720
+ name: "Animal (other)",
7721
+ icon: "🐾"
7722
+ },
7723
+ {
7724
+ id: "alarm",
7725
+ name: "Alarm / Siren",
7726
+ icon: "🚨"
7727
+ },
7728
+ {
7729
+ id: "doorbell",
7730
+ name: "Doorbell / Knock",
7731
+ icon: "🔔"
7732
+ },
7733
+ {
7734
+ id: "glass_breaking",
7735
+ name: "Glass Breaking",
7736
+ icon: "💥"
7737
+ },
7738
+ {
7739
+ id: "gunshot",
7740
+ name: "Gunshot / Explosion",
7741
+ icon: "💣"
7742
+ },
7743
+ {
7744
+ id: "vehicle",
7745
+ name: "Vehicle",
7746
+ icon: "🚗"
7747
+ },
7748
+ {
7749
+ id: "siren",
7750
+ name: "Emergency Siren",
7751
+ icon: "🚑"
7752
+ },
7753
+ {
7754
+ id: "fire",
7755
+ name: "Fire / Smoke",
7756
+ icon: "🔥"
7757
+ },
7758
+ {
7759
+ id: "water",
7760
+ name: "Water",
7761
+ icon: "💧"
7762
+ },
7763
+ {
7764
+ id: "wind",
7765
+ name: "Wind / Weather",
7766
+ icon: "🌬️"
7767
+ },
7768
+ {
7769
+ id: "door",
7770
+ name: "Door",
7771
+ icon: "🚪"
7772
+ },
7773
+ {
7774
+ id: "footsteps",
7775
+ name: "Footsteps",
7776
+ icon: "👣"
7777
+ },
7778
+ {
7779
+ id: "crowd",
7780
+ name: "Crowd / Chatter",
7781
+ icon: "👥"
7782
+ },
7783
+ {
7784
+ id: "telephone",
7785
+ name: "Telephone",
7786
+ icon: "📞"
7787
+ },
7788
+ {
7789
+ id: "engine",
7790
+ name: "Engine / Motor",
7791
+ icon: "⚙️"
7792
+ },
7793
+ {
7794
+ id: "tools",
7795
+ name: "Tools / Construction",
7796
+ icon: "🔨"
7797
+ },
7798
+ {
7799
+ id: "silence",
7800
+ name: "Silence",
7801
+ icon: "🤫"
7802
+ }
7803
+ ];
7639
7804
  var YAMNET_TO_MACRO = {
7640
7805
  mapping: {
7641
7806
  Speech: "speech",
@@ -7902,6 +8067,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7902
8067
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7903
8068
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7904
8069
  /**
8070
+ * Unified event-kind taxonomy — THE single source of truth for
8071
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8072
+ * icon }`.
8073
+ *
8074
+ * This dictionary folds together what used to be scattered across four
8075
+ * copies:
8076
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8077
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8078
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8079
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8080
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8081
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8082
+ *
8083
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8084
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8085
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8086
+ * color or an icon: they read this dictionary (server descriptors carry the
8087
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8088
+ *
8089
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8090
+ */
8091
+ var TAXONOMY_COLORS = {
8092
+ motion: "#f59e0b",
8093
+ audio: "#06b6d4",
8094
+ person: "#22c55e",
8095
+ vehicle: "#3b82f6",
8096
+ animal: "#f97316",
8097
+ package: "#a855f7",
8098
+ sensor: "#8b5cf6",
8099
+ control: "#10b981",
8100
+ genericDetection: "#64748b"
8101
+ };
8102
+ var DETECTION_SUB_COLORS = {
8103
+ car: "#f59e0b",
8104
+ truck: "#d97706",
8105
+ bus: "#b45309",
8106
+ motorcycle: "#eab308",
8107
+ bicycle: "#ca8a04",
8108
+ airplane: "#60a5fa",
8109
+ boat: "#2563eb",
8110
+ train: "#1d4ed8",
8111
+ bird: "#14b8a6",
8112
+ dog: "#84cc16",
8113
+ cat: "#f97316",
8114
+ horse: "#a16207",
8115
+ sheep: "#a3a3a3",
8116
+ cow: "#78716c",
8117
+ elephant: "#6b7280",
8118
+ bear: "#7c2d12",
8119
+ zebra: "#404040",
8120
+ giraffe: "#d4a373"
8121
+ };
8122
+ function titleCase(id) {
8123
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8124
+ }
8125
+ var entries = /* @__PURE__ */ new Map();
8126
+ function macro(kind, category, color, iconId, label) {
8127
+ entries.set(kind, {
8128
+ kind,
8129
+ parentKind: null,
8130
+ level: "macro",
8131
+ category,
8132
+ color,
8133
+ iconId,
8134
+ labelKey: `eventKind.${kind}`,
8135
+ label
8136
+ });
8137
+ }
8138
+ function sub(kind, parentKind, category, color, iconId, label) {
8139
+ entries.set(kind, {
8140
+ kind,
8141
+ parentKind,
8142
+ level: "sub",
8143
+ category,
8144
+ color,
8145
+ iconId,
8146
+ labelKey: `eventKind.${kind}`,
8147
+ label
8148
+ });
8149
+ }
8150
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8151
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8152
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8153
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8154
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8155
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8156
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8157
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8158
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8159
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8160
+ if (entries.has(cocoClass)) continue;
8161
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8162
+ }
8163
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8164
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8165
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8166
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8167
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8168
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8169
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8170
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8171
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8172
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8173
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8174
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8175
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8176
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8177
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8178
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8179
+ sub("button", "control", "control", "#10b981", "button", "Button");
8180
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8181
+ for (const l of AUDIO_MACRO_LABELS) {
8182
+ const kind = `audio-${l.id}`;
8183
+ if (entries.has(kind)) continue;
8184
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8185
+ }
8186
+ /** The complete taxonomy dictionary, keyed by kind. */
8187
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8188
+ /**
7905
8189
  * Error types for the safe expression engine. Two distinct classes so callers
7906
8190
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7907
8191
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -12184,10 +12468,7 @@ var ConfigUISchemaNullableBridge = custom();
12184
12468
  var InferenceCapabilitiesBridge = custom();
12185
12469
  var ModelAvailabilityListBridge = custom();
12186
12470
  var PipelineRunResultBridge = custom();
12187
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
12188
- kind: "mutation",
12189
- auth: "admin"
12190
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12471
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
12191
12472
  modelId: string(),
12192
12473
  settings: record(string(), unknown()).readonly()
12193
12474
  }))), method(object({ steps: record(string(), object({
@@ -12247,13 +12528,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12247
12528
  * (inputClasses ≠ null) are skipped and served per-track via
12248
12529
  * pipelineRunner.runDetailSubtree (two-plane design).
12249
12530
  */
12250
- plane: _enum(["full", "frame"]).optional()
12531
+ plane: _enum(["full", "frame"]).optional(),
12532
+ /**
12533
+ * Inference-device selector (Phase 2 multi-device). Format
12534
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
12535
+ * Omitted ⇒ the runner's default device (current single-engine
12536
+ * behaviour). Selects WHICH device pool of the node runs the call.
12537
+ */
12538
+ deviceKey: string().optional()
12251
12539
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
12252
12540
  engine: PipelineEngineChoiceSchema.optional(),
12253
12541
  steps: array(PipelineStepInputSchema).min(1),
12254
12542
  frames: array(FrameInputSchema).min(1).max(255),
12255
12543
  deviceId: number().optional(),
12256
- sessionId: string().optional()
12544
+ sessionId: string().optional(),
12545
+ /**
12546
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
12547
+ * the batch to the Python pool's bench preprocess cache
12548
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
12549
+ * preprocessed ONCE and every later inference is a pure-inference cache
12550
+ * hit — the sustained-throughput run measures inference, not
12551
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
12552
+ * full preprocess every call, correct). Fresh per sustained run;
12553
+ * released via `uncacheFrame`.
12554
+ */
12555
+ frameId: number().int().nonnegative().optional(),
12556
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
12557
+ deviceKey: string().optional()
12257
12558
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
12258
12559
  data: _instanceof(Uint8Array),
12259
12560
  width: number().int().positive(),
@@ -12285,8 +12586,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
12285
12586
  * - `runtime` — main camera-serving engine (no idle TTL).
12286
12587
  * - `warm-override` — benchmark/test override held in the warm
12287
12588
  * cache; auto-disposed after the idle TTL.
12589
+ * - `device-pool` — a concurrent per-device pool (Phase 2
12590
+ * multi-device, keyed by `deviceKey`) resolved
12591
+ * via `resolveDeviceFactory`. Runs alongside the
12592
+ * `runtime` engine on a DIFFERENT accelerator
12593
+ * (NPU / iGPU / Coral) — this is how the
12594
+ * Engines tab shows all pools running at once.
12288
12595
  */
12289
- kind: _enum(["runtime", "warm-override"]),
12596
+ kind: _enum([
12597
+ "runtime",
12598
+ "warm-override",
12599
+ "device-pool"
12600
+ ]),
12290
12601
  /** Native pid of the underlying Python pool (null when no pool). */
12291
12602
  poolPid: number().nullable(),
12292
12603
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -12661,7 +12972,14 @@ var RunnerCameraConfigSchema = object({
12661
12972
  * camera's detect node differs from its source-owner (P2d, gated by the
12662
12973
  * `remoteSourcingNodes` rollout setting).
12663
12974
  */
12664
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
12975
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
12976
+ /**
12977
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
12978
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
12979
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
12980
+ * this only selects WHICH device pool of that node runs the session.
12981
+ */
12982
+ deviceKey: string().optional()
12665
12983
  });
12666
12984
  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;
12667
12985
  /**
@@ -12682,6 +13000,19 @@ var RunnerLocalLoadSchema = object({
12682
13000
  avgInferenceTimeMs: number(),
12683
13001
  /** Total queue depth across motion + detection queues. */
12684
13002
  queueDepthTotal: number(),
13003
+ /**
13004
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
13005
+ * this runner currently has attached cameras on, so the orchestrator's second
13006
+ * `balance()` pass (over a node's devices) weights on real per-pool session
13007
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
13008
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
13009
+ */
13010
+ devices: array(object({
13011
+ deviceKey: string(),
13012
+ backend: string(),
13013
+ attachedCameras: number(),
13014
+ queueDepthTotal: number()
13015
+ })).default([]),
12685
13016
  /** Hardware capability flags reported by this node. */
12686
13017
  hardware: object({
12687
13018
  hasGpu: boolean(),
@@ -15830,6 +16161,8 @@ var BaseDeviceProvider = class extends BaseAddon {
15830
16161
  return toDeviceSummary(device, this.addonId);
15831
16162
  }
15832
16163
  };
16164
+ 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;
16165
+ new Set(Object.values(DeviceType));
15833
16166
  /**
15834
16167
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
15835
16168
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -18924,17 +19257,30 @@ var EventKindCategorySchema = _enum([
18924
19257
  "audio",
18925
19258
  "detection",
18926
19259
  "sensor",
19260
+ "control",
18927
19261
  "custom",
18928
19262
  "package"
18929
19263
  ]);
19264
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
19265
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
18930
19266
  var EventKindDescriptorSchema = object({
18931
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
19267
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
18932
19268
  kind: string(),
19269
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
19270
+ labelKey: string(),
19271
+ /** English fallback label (kept for clients that don't translate). */
18933
19272
  label: string(),
18934
19273
  /** Hex color for timeline/legend rendering. */
18935
19274
  color: string(),
19275
+ /** Dictionary id → lucide component on the UI side. */
19276
+ iconId: string(),
19277
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18936
19278
  icon: EventKindIconSchema,
18937
19279
  category: EventKindCategorySchema,
19280
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
19281
+ parentKind: string().nullable(),
19282
+ /** Derived from `parentKind`, explicit for the client tree. */
19283
+ level: EventKindLevelSchema,
18938
19284
  /** Which cap + device contributes this kind. For built-ins the camera
18939
19285
  * itself; for sensor kinds the LINKED source device. */
18940
19286
  source: object({
@@ -19007,11 +19353,21 @@ var TrackAudioLabelSchema = object({
19007
19353
  firstAt: number(),
19008
19354
  lastAt: number()
19009
19355
  });
19356
+ /**
19357
+ * How a track was produced. `pipeline` (default / absent) = the spatial
19358
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
19359
+ * linked sensor/control state change (no positions; carries a snapshot). The
19360
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
19361
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
19362
+ */
19363
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
19010
19364
  var TrackSchema = object({
19011
19365
  trackId: string(),
19012
19366
  deviceId: number(),
19013
19367
  className: string(),
19014
19368
  label: string().optional(),
19369
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19370
+ source: TrackSourceSchema.optional(),
19015
19371
  firstSeen: number(),
19016
19372
  lastSeen: number(),
19017
19373
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -19388,6 +19744,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19388
19744
  eventId: string(),
19389
19745
  timestamp: number()
19390
19746
  });
19747
+ /**
19748
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
19749
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
19750
+ * caps into per-camera event-kind descriptors.
19751
+ *
19752
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
19753
+ * is NOT duplicated here — every entry is derived from the single
19754
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
19755
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
19756
+ * control cap means adding one line here (and a taxonomy entry); the anti-
19757
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
19758
+ * eventful cap is missing.
19759
+ */
19760
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
19761
+ var LEGACY_ICON = {
19762
+ motion: "motion",
19763
+ audio: "audio",
19764
+ person: "person",
19765
+ vehicle: "vehicle",
19766
+ animal: "animal",
19767
+ package: "package",
19768
+ door: "door",
19769
+ pir: "pir",
19770
+ smoke: "smoke",
19771
+ water: "water",
19772
+ button: "button",
19773
+ generic: "generic",
19774
+ gas: "smoke",
19775
+ vibration: "generic",
19776
+ tamper: "generic",
19777
+ presence: "person",
19778
+ lock: "generic",
19779
+ siren: "generic",
19780
+ switch: "generic",
19781
+ doorbell: "button"
19782
+ };
19783
+ function legacyIcon(iconId) {
19784
+ return LEGACY_ICON[iconId] ?? "generic";
19785
+ }
19786
+ /**
19787
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
19788
+ * The anti-drift guard cross-checks this against the eventful caps declared
19789
+ * in `packages/types/src/capabilities/*.cap.ts`.
19790
+ */
19791
+ var CAP_TO_KIND = {
19792
+ contact: "contact",
19793
+ motion: "motion-sensor",
19794
+ smoke: "smoke",
19795
+ flood: "flood",
19796
+ gas: "gas",
19797
+ "carbon-monoxide": "carbon-monoxide",
19798
+ vibration: "vibration",
19799
+ tamper: "tamper",
19800
+ presence: "presence",
19801
+ "enum-sensor": "enum-sensor",
19802
+ "event-emitter": "device-event",
19803
+ "lock-control": "lock",
19804
+ switch: "switch",
19805
+ button: "button",
19806
+ doorbell: "doorbell"
19807
+ };
19808
+ function buildDescriptor(capName, kind) {
19809
+ const t = EVENT_TAXONOMY[kind];
19810
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
19811
+ return {
19812
+ ...t,
19813
+ icon: legacyIcon(t.iconId)
19814
+ };
19815
+ }
19816
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
19391
19817
  var CameraPipelineConfigSchema = object({
19392
19818
  engine: PipelineEngineChoiceSchema.optional(),
19393
19819
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19406,13 +19832,11 @@ var PipelineTemplateSchema = object({
19406
19832
  createdAt: string(),
19407
19833
  updatedAt: string()
19408
19834
  });
19409
- var AgentAddonConfigSchema = object({
19410
- enabled: boolean(),
19835
+ var DeviceStepConfigSchema = object({
19411
19836
  modelId: string().optional(),
19412
- settings: record(string(), unknown()).readonly()
19837
+ settings: record(string(), unknown()).optional()
19413
19838
  });
19414
19839
  var AgentPipelineSettingsSchema = object({
19415
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
19416
19840
  maxCameras: number().int().nonnegative().nullable().default(null),
19417
19841
  /** Per-node detection weight (relative share for the quota balancer). */
19418
19842
  detectWeight: number().positive().optional(),
@@ -19436,7 +19860,22 @@ var AgentPipelineSettingsSchema = object({
19436
19860
  * it already uses to reach the hub). Set this only when the auto-detected
19437
19861
  * address is wrong (multi-homed host, NAT, custom interface).
19438
19862
  */
19439
- reachableHost: string().optional()
19863
+ reachableHost: string().optional(),
19864
+ /**
19865
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
19866
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
19867
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
19868
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
19869
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
19870
+ * the default model/settings for every camera landing on that accelerator;
19871
+ * a stepId absent ⇒ the step uses that device's format default.
19872
+ */
19873
+ inferenceDevices: record(string(), object({
19874
+ enabled: boolean(),
19875
+ weight: number().positive().optional(),
19876
+ maxSessions: number().int().positive().optional(),
19877
+ steps: record(string(), DeviceStepConfigSchema).optional()
19878
+ })).optional()
19440
19879
  });
19441
19880
  var CameraPipelineForAgentSchema = object({
19442
19881
  steps: array(PipelineStepInputSchema).readonly(),
@@ -19446,14 +19885,13 @@ var CameraPipelineForAgentSchema = object({
19446
19885
  }).nullable()
19447
19886
  });
19448
19887
  var CameraStepOverridePatchSchema = object({
19449
- enabled: boolean().optional(),
19450
19888
  modelId: string().optional(),
19451
19889
  settings: record(string(), unknown()).readonly().optional()
19452
19890
  });
19453
19891
  var CameraPipelineSettingsSchema = object({
19454
19892
  pinnedAgentNodeId: string().optional(),
19455
19893
  stepToggles: record(string(), boolean()).optional(),
19456
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
19894
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
19457
19895
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
19458
19896
  });
19459
19897
  /**
@@ -19667,6 +20105,44 @@ var CameraStatusSchema = object({
19667
20105
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19668
20106
  fetchedAt: number()
19669
20107
  });
20108
+ var NodeInferenceDeviceSchema = object({
20109
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
20110
+ key: string(),
20111
+ backend: string(),
20112
+ device: string(),
20113
+ format: _enum(MODEL_FORMATS),
20114
+ /** Whether the node's live probe reports the device as usable right now. */
20115
+ available: boolean(),
20116
+ /**
20117
+ * Whether this device participates in dispatch. AUTO default (spec C2):
20118
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
20119
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
20120
+ * not a balanced target). An explicit stored value always wins; a stored-only
20121
+ * (unavailable) key keeps its stored value.
20122
+ */
20123
+ enabled: boolean(),
20124
+ /** Relative balancer weight for the enabled device (default 1). */
20125
+ weight: number(),
20126
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
20127
+ maxSessions: number().nullable(),
20128
+ /** Object-detection model the executor defaults to for this deviceKey. */
20129
+ defaultModelId: string(),
20130
+ /**
20131
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
20132
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
20133
+ * Absent/empty ⇒ no base (every step uses its device format default). The
20134
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
20135
+ * available per format; this is the stored selection that becomes the
20136
+ * default for EVERY camera landing on this accelerator.
20137
+ */
20138
+ steps: record(string(), DeviceStepConfigSchema).optional()
20139
+ });
20140
+ var NodeInferenceDevicesSchema = object({
20141
+ nodeId: string(),
20142
+ /** False when the node's platform-probe was unreachable (no live device set). */
20143
+ reachable: boolean(),
20144
+ devices: array(NodeInferenceDeviceSchema).readonly()
20145
+ });
19670
20146
  method(object({
19671
20147
  deviceId: number(),
19672
20148
  agentNodeId: string()
@@ -19676,7 +20152,13 @@ method(object({
19676
20152
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
19677
20153
  kind: "mutation",
19678
20154
  auth: "admin"
19679
- }), method(_void(), object({ migrated: number() }), {
20155
+ }), method(object({
20156
+ deviceId: number(),
20157
+ deviceKey: string()
20158
+ }), object({ success: literal(true) }), {
20159
+ kind: "mutation",
20160
+ auth: "admin"
20161
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
19680
20162
  kind: "mutation",
19681
20163
  auth: "admin"
19682
20164
  }), 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({
@@ -19710,13 +20192,7 @@ method(object({
19710
20192
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
19711
20193
  nodeId: string(),
19712
20194
  settings: AgentPipelineSettingsSchema
19713
- })).readonly()), method(object({
19714
- agentNodeId: string(),
19715
- defaults: record(string(), AgentAddonConfigSchema)
19716
- }), object({ success: literal(true) }), {
19717
- kind: "mutation",
19718
- auth: "admin"
19719
- }), method(object({ agentNodeId: string() }), object({
20195
+ })).readonly()), method(object({ agentNodeId: string() }), object({
19720
20196
  success: boolean(),
19721
20197
  removed: boolean()
19722
20198
  }), {
@@ -19748,7 +20224,18 @@ method(object({
19748
20224
  }), object({ success: literal(true) }), {
19749
20225
  kind: "mutation",
19750
20226
  auth: "admin"
19751
- }), method(object({ agentNodeId: string() }), object({
20227
+ }), method(object({
20228
+ agentNodeId: string(),
20229
+ inferenceDevices: record(string(), object({
20230
+ enabled: boolean(),
20231
+ weight: number().positive().optional(),
20232
+ maxSessions: number().int().positive().optional(),
20233
+ steps: record(string(), DeviceStepConfigSchema).optional()
20234
+ }))
20235
+ }), object({ success: literal(true) }), {
20236
+ kind: "mutation",
20237
+ auth: "admin"
20238
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
19752
20239
  success: literal(true),
19753
20240
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
19754
20241
  effectiveModelId: string().nullable(),
@@ -19764,9 +20251,10 @@ method(object({
19764
20251
  }), object({ success: literal(true) }), {
19765
20252
  kind: "mutation",
19766
20253
  auth: "admin"
19767
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
20254
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
19768
20255
  deviceId: number(),
19769
20256
  agentNodeId: string(),
20257
+ deviceKey: string(),
19770
20258
  addonId: string(),
19771
20259
  patch: CameraStepOverridePatchSchema.nullable()
19772
20260
  }), object({ success: literal(true) }), {
@@ -19803,14 +20291,13 @@ method(object({
19803
20291
  });
19804
20292
  /**
19805
20293
  * server-management — per-NODE singleton capability for a node's ROOT
19806
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
19807
- * agents).
20294
+ * package lifecycle (runtime-updatable node packages).
19808
20295
  *
19809
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
19810
- * on agents) carries the whole software stack in its npm dep tree, so ONE
19811
- * version describes the node. Updates install into
19812
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
19813
- * starter (probation boot + auto-rollback to N-1).
20296
+ * Every node role runs the SAME root package (`@camstack/server`), which
20297
+ * carries the whole software stack in its npm dep tree, so ONE version
20298
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
20299
+ * on restart via the baked starter (single-copy in-place swap — no probation,
20300
+ * no auto-rollback).
19814
20301
  *
19815
20302
  * Providers:
19816
20303
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -19918,7 +20405,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
19918
20405
  /** Explicit target version; omitted = latest from the registry. */
19919
20406
  version: string().optional() }), ServerUpdateActionResultSchema, {
19920
20407
  kind: "mutation",
19921
- auth: "admin"
20408
+ auth: "admin",
20409
+ timeoutMs: 16 * 6e4
19922
20410
  }), method(_void(), ServerUpdateActionResultSchema, {
19923
20411
  kind: "mutation",
19924
20412
  auth: "admin"
@@ -21013,22 +21501,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
21013
21501
  var RestartAddonResultSchema = unknown();
21014
21502
  var InstallPackageResultSchema = unknown();
21015
21503
  var ReloadPackagesResultSchema = unknown();
21016
- /**
21017
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
21018
- * server restarts so the admin UI can react to the `restartingAt`
21019
- * timestamp (shows reconnect overlay). The transition from
21020
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
21021
- * `system.restart-completed` event after the new process boots.
21022
- *
21023
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
21024
- */
21025
- var UpdateFrameworkPackageResultSchema = object({
21026
- packageName: string(),
21027
- fromVersion: string(),
21028
- toVersion: string(),
21029
- /** Ms-epoch the server scheduled its self-restart. */
21030
- restartingAt: number()
21031
- });
21032
21504
  var BulkUpdateItemStatusSchema = _enum([
21033
21505
  "queued",
21034
21506
  "updating",
@@ -21156,13 +21628,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
21156
21628
  }), object({ success: literal(true) }), {
21157
21629
  kind: "mutation",
21158
21630
  auth: "admin"
21159
- }), method(object({
21160
- packageName: string().min(1),
21161
- version: string().optional(),
21162
- deferRestart: boolean().optional()
21163
- }), UpdateFrameworkPackageResultSchema, {
21164
- kind: "mutation",
21165
- auth: "admin"
21166
21631
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
21167
21632
  kind: "mutation",
21168
21633
  auth: "admin"
@@ -22028,10 +22493,10 @@ var TopologyCategorySchema = object({
22028
22493
  addons: array(TopologyCategoryAddonSchema).readonly()
22029
22494
  });
22030
22495
  /**
22031
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
22032
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
22033
- * version visibility for the Server management surface. Nullable: offline
22034
- * rows and pre-phase-2 nodes report none.
22496
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
22497
+ * root package for every node role) as reported by its `registerNode`
22498
+ * manifest — version visibility for the Server management surface. Nullable:
22499
+ * offline rows and nodes that never reported one.
22035
22500
  */
22036
22501
  var TopologyRootPackageSchema = object({
22037
22502
  name: string(),
@@ -22465,17 +22930,28 @@ var PlatformScoreSchema = object({
22465
22930
  format: _enum([
22466
22931
  "onnx",
22467
22932
  "coreml",
22468
- "openvino"
22933
+ "openvino",
22934
+ "tflite"
22469
22935
  ]),
22470
22936
  score: number(),
22471
22937
  reason: string(),
22472
22938
  available: boolean()
22473
22939
  });
22940
+ var InferenceDeviceDescriptorSchema = object({
22941
+ key: string(),
22942
+ backend: string(),
22943
+ device: string(),
22944
+ format: ModelFormatSchema,
22945
+ runtime: literal("python"),
22946
+ score: number(),
22947
+ available: boolean()
22948
+ });
22474
22949
  var PlatformCapabilitiesSchema = object({
22475
22950
  hardware: HardwareInfoSchema,
22476
22951
  scores: array(PlatformScoreSchema).readonly(),
22477
22952
  bestScore: PlatformScoreSchema,
22478
- pythonPath: string().nullable()
22953
+ pythonPath: string().nullable(),
22954
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
22479
22955
  });
22480
22956
  var ModelRequirementSchema = object({
22481
22957
  modelId: string(),
@@ -23607,12 +24083,6 @@ Object.freeze({
23607
24083
  addonId: null,
23608
24084
  access: "delete"
23609
24085
  },
23610
- "addons.updateFrameworkPackage": {
23611
- capName: "addons",
23612
- capScope: "system",
23613
- addonId: null,
23614
- access: "create"
23615
- },
23616
24086
  "addons.updatePackage": {
23617
24087
  capName: "addons",
23618
24088
  capScope: "system",
@@ -26385,12 +26855,6 @@ Object.freeze({
26385
26855
  addonId: null,
26386
26856
  access: "view"
26387
26857
  },
26388
- "pipelineExecutor.reprobeEngine": {
26389
- capName: "pipeline-executor",
26390
- capScope: "system",
26391
- addonId: null,
26392
- access: "create"
26393
- },
26394
26858
  "pipelineExecutor.runAudioTest": {
26395
26859
  capName: "pipeline-executor",
26396
26860
  capScope: "system",
@@ -26541,6 +27005,12 @@ Object.freeze({
26541
27005
  addonId: null,
26542
27006
  access: "view"
26543
27007
  },
27008
+ "pipelineOrchestrator.getNodeInferenceDevices": {
27009
+ capName: "pipeline-orchestrator",
27010
+ capScope: "system",
27011
+ addonId: null,
27012
+ access: "view"
27013
+ },
26544
27014
  "pipelineOrchestrator.getPipelineAssignment": {
26545
27015
  capName: "pipeline-orchestrator",
26546
27016
  capScope: "system",
@@ -26553,6 +27023,12 @@ Object.freeze({
26553
27023
  addonId: null,
26554
27024
  access: "view"
26555
27025
  },
27026
+ "pipelineOrchestrator.getPipelineDevicePin": {
27027
+ capName: "pipeline-orchestrator",
27028
+ capScope: "system",
27029
+ addonId: null,
27030
+ access: "view"
27031
+ },
26556
27032
  "pipelineOrchestrator.listAgentSettings": {
26557
27033
  capName: "pipeline-orchestrator",
26558
27034
  capScope: "system",
@@ -26595,19 +27071,19 @@ Object.freeze({
26595
27071
  addonId: null,
26596
27072
  access: "create"
26597
27073
  },
26598
- "pipelineOrchestrator.setAgentAddonDefaults": {
27074
+ "pipelineOrchestrator.setAgentCapabilities": {
26599
27075
  capName: "pipeline-orchestrator",
26600
27076
  capScope: "system",
26601
27077
  addonId: null,
26602
27078
  access: "create"
26603
27079
  },
26604
- "pipelineOrchestrator.setAgentCapabilities": {
27080
+ "pipelineOrchestrator.setAgentDetectWeight": {
26605
27081
  capName: "pipeline-orchestrator",
26606
27082
  capScope: "system",
26607
27083
  addonId: null,
26608
27084
  access: "create"
26609
27085
  },
26610
- "pipelineOrchestrator.setAgentDetectWeight": {
27086
+ "pipelineOrchestrator.setAgentInferenceDevices": {
26611
27087
  capName: "pipeline-orchestrator",
26612
27088
  capScope: "system",
26613
27089
  addonId: null,
@@ -26649,6 +27125,12 @@ Object.freeze({
26649
27125
  addonId: null,
26650
27126
  access: "create"
26651
27127
  },
27128
+ "pipelineOrchestrator.setPipelineDevicePin": {
27129
+ capName: "pipeline-orchestrator",
27130
+ capScope: "system",
27131
+ addonId: null,
27132
+ access: "create"
27133
+ },
26652
27134
  "pipelineOrchestrator.unassignAudio": {
26653
27135
  capName: "pipeline-orchestrator",
26654
27136
  capScope: "system",
@@ -28201,32 +28683,6 @@ Object.freeze({
28201
28683
  "network-access": "ingress",
28202
28684
  "smtp-provider": "email"
28203
28685
  });
28204
- var frameworkSwapPackageSchema = object({
28205
- name: string(),
28206
- stagedPath: string(),
28207
- backupPath: string(),
28208
- toVersion: string(),
28209
- fromVersion: string().nullable()
28210
- });
28211
- object({
28212
- jobId: string(),
28213
- taskId: string(),
28214
- packages: array(frameworkSwapPackageSchema),
28215
- requestedAtMs: number(),
28216
- schemaVersion: literal(1)
28217
- });
28218
- object({
28219
- jobId: string(),
28220
- taskId: string(),
28221
- backups: array(object({
28222
- name: string(),
28223
- backupPath: string(),
28224
- livePath: string()
28225
- })),
28226
- appliedAtMs: number(),
28227
- bootAttempts: number(),
28228
- schemaVersion: literal(1)
28229
- });
28230
28686
  //#endregion
28231
28687
  //#region src/schema.ts
28232
28688
  /** Addon id — must match `package.json`'s `camstack.addons[0].id`. */