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