@camstack/addon-auth 1.1.14 → 1.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.
@@ -7079,6 +7079,17 @@ var ModelCatalogEntrySchema = object({
7079
7079
  "imagenet",
7080
7080
  "none"
7081
7081
  ]).optional(),
7082
+ /**
7083
+ * The model already applies softmax IN-GRAPH — its raw output is a
7084
+ * probability distribution, not logits. When set, the `softmax`
7085
+ * postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
7086
+ * probability vector collapses it toward uniform (top-1 score craters far
7087
+ * below its true value, making every confidence gate meaningless). Absent ⇒
7088
+ * the output is raw logits and the postprocessor applies softmax (the normal
7089
+ * case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
7090
+ * TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
7091
+ */
7092
+ outputProbabilities: boolean().optional(),
7082
7093
  preprocessMode: _enum(["letterbox", "resize"]).optional(),
7083
7094
  /**
7084
7095
  * Per-MODEL postprocessor override. Absent ⇒ the step's own
@@ -7755,6 +7766,160 @@ var EncodeProfileSchema = object({
7755
7766
  */
7756
7767
  outputArgs: array(string()).optional()
7757
7768
  });
7769
+ var COCO_TO_MACRO = {
7770
+ mapping: {
7771
+ person: "person",
7772
+ bicycle: "vehicle",
7773
+ car: "vehicle",
7774
+ motorcycle: "vehicle",
7775
+ airplane: "vehicle",
7776
+ bus: "vehicle",
7777
+ train: "vehicle",
7778
+ truck: "vehicle",
7779
+ boat: "vehicle",
7780
+ bird: "animal",
7781
+ cat: "animal",
7782
+ dog: "animal",
7783
+ horse: "animal",
7784
+ sheep: "animal",
7785
+ cow: "animal",
7786
+ elephant: "animal",
7787
+ bear: "animal",
7788
+ zebra: "animal",
7789
+ giraffe: "animal",
7790
+ suitcase: "package",
7791
+ backpack: "package",
7792
+ handbag: "package"
7793
+ },
7794
+ preserveOriginal: false
7795
+ };
7796
+ var AUDIO_MACRO_LABELS = [
7797
+ {
7798
+ id: "speech",
7799
+ name: "Speech",
7800
+ icon: "🗣️"
7801
+ },
7802
+ {
7803
+ id: "scream",
7804
+ name: "Scream / Shout",
7805
+ icon: "😱"
7806
+ },
7807
+ {
7808
+ id: "crying",
7809
+ name: "Crying / Baby",
7810
+ icon: "😢"
7811
+ },
7812
+ {
7813
+ id: "laughter",
7814
+ name: "Laughter",
7815
+ icon: "😂"
7816
+ },
7817
+ {
7818
+ id: "music",
7819
+ name: "Music",
7820
+ icon: "🎵"
7821
+ },
7822
+ {
7823
+ id: "dog",
7824
+ name: "Dog",
7825
+ icon: "🐕"
7826
+ },
7827
+ {
7828
+ id: "cat",
7829
+ name: "Cat",
7830
+ icon: "🐈"
7831
+ },
7832
+ {
7833
+ id: "bird",
7834
+ name: "Bird",
7835
+ icon: "🐦"
7836
+ },
7837
+ {
7838
+ id: "animal",
7839
+ name: "Animal (other)",
7840
+ icon: "🐾"
7841
+ },
7842
+ {
7843
+ id: "alarm",
7844
+ name: "Alarm / Siren",
7845
+ icon: "🚨"
7846
+ },
7847
+ {
7848
+ id: "doorbell",
7849
+ name: "Doorbell / Knock",
7850
+ icon: "🔔"
7851
+ },
7852
+ {
7853
+ id: "glass_breaking",
7854
+ name: "Glass Breaking",
7855
+ icon: "💥"
7856
+ },
7857
+ {
7858
+ id: "gunshot",
7859
+ name: "Gunshot / Explosion",
7860
+ icon: "💣"
7861
+ },
7862
+ {
7863
+ id: "vehicle",
7864
+ name: "Vehicle",
7865
+ icon: "🚗"
7866
+ },
7867
+ {
7868
+ id: "siren",
7869
+ name: "Emergency Siren",
7870
+ icon: "🚑"
7871
+ },
7872
+ {
7873
+ id: "fire",
7874
+ name: "Fire / Smoke",
7875
+ icon: "🔥"
7876
+ },
7877
+ {
7878
+ id: "water",
7879
+ name: "Water",
7880
+ icon: "💧"
7881
+ },
7882
+ {
7883
+ id: "wind",
7884
+ name: "Wind / Weather",
7885
+ icon: "🌬️"
7886
+ },
7887
+ {
7888
+ id: "door",
7889
+ name: "Door",
7890
+ icon: "🚪"
7891
+ },
7892
+ {
7893
+ id: "footsteps",
7894
+ name: "Footsteps",
7895
+ icon: "👣"
7896
+ },
7897
+ {
7898
+ id: "crowd",
7899
+ name: "Crowd / Chatter",
7900
+ icon: "👥"
7901
+ },
7902
+ {
7903
+ id: "telephone",
7904
+ name: "Telephone",
7905
+ icon: "📞"
7906
+ },
7907
+ {
7908
+ id: "engine",
7909
+ name: "Engine / Motor",
7910
+ icon: "⚙️"
7911
+ },
7912
+ {
7913
+ id: "tools",
7914
+ name: "Tools / Construction",
7915
+ icon: "🔨"
7916
+ },
7917
+ {
7918
+ id: "silence",
7919
+ name: "Silence",
7920
+ icon: "🤫"
7921
+ }
7922
+ ];
7758
7923
  var YAMNET_TO_MACRO = {
7759
7924
  mapping: {
7760
7925
  Speech: "speech",
@@ -8021,6 +8186,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
8021
8186
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8022
8187
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
8023
8188
  /**
8189
+ * Unified event-kind taxonomy — THE single source of truth for
8190
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8191
+ * icon }`.
8192
+ *
8193
+ * This dictionary folds together what used to be scattered across four
8194
+ * copies:
8195
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8196
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8197
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8198
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8199
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8200
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8201
+ *
8202
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8203
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8204
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8205
+ * color or an icon: they read this dictionary (server descriptors carry the
8206
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8207
+ *
8208
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8209
+ */
8210
+ var TAXONOMY_COLORS = {
8211
+ motion: "#f59e0b",
8212
+ audio: "#06b6d4",
8213
+ person: "#22c55e",
8214
+ vehicle: "#3b82f6",
8215
+ animal: "#f97316",
8216
+ package: "#a855f7",
8217
+ sensor: "#8b5cf6",
8218
+ control: "#10b981",
8219
+ genericDetection: "#64748b"
8220
+ };
8221
+ var DETECTION_SUB_COLORS = {
8222
+ car: "#f59e0b",
8223
+ truck: "#d97706",
8224
+ bus: "#b45309",
8225
+ motorcycle: "#eab308",
8226
+ bicycle: "#ca8a04",
8227
+ airplane: "#60a5fa",
8228
+ boat: "#2563eb",
8229
+ train: "#1d4ed8",
8230
+ bird: "#14b8a6",
8231
+ dog: "#84cc16",
8232
+ cat: "#f97316",
8233
+ horse: "#a16207",
8234
+ sheep: "#a3a3a3",
8235
+ cow: "#78716c",
8236
+ elephant: "#6b7280",
8237
+ bear: "#7c2d12",
8238
+ zebra: "#404040",
8239
+ giraffe: "#d4a373"
8240
+ };
8241
+ function titleCase(id) {
8242
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8243
+ }
8244
+ var entries = /* @__PURE__ */ new Map();
8245
+ function macro(kind, category, color, iconId, label) {
8246
+ entries.set(kind, {
8247
+ kind,
8248
+ parentKind: null,
8249
+ level: "macro",
8250
+ category,
8251
+ color,
8252
+ iconId,
8253
+ labelKey: `eventKind.${kind}`,
8254
+ label
8255
+ });
8256
+ }
8257
+ function sub(kind, parentKind, category, color, iconId, label) {
8258
+ entries.set(kind, {
8259
+ kind,
8260
+ parentKind,
8261
+ level: "sub",
8262
+ category,
8263
+ color,
8264
+ iconId,
8265
+ labelKey: `eventKind.${kind}`,
8266
+ label
8267
+ });
8268
+ }
8269
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8270
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8271
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8272
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8273
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8274
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8275
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8276
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8277
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8278
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8279
+ if (entries.has(cocoClass)) continue;
8280
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8281
+ }
8282
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8283
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8284
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8285
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8286
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8287
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8288
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8289
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8290
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8291
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8292
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8293
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8294
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8295
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8296
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8297
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8298
+ sub("button", "control", "control", "#10b981", "button", "Button");
8299
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8300
+ for (const l of AUDIO_MACRO_LABELS) {
8301
+ const kind = `audio-${l.id}`;
8302
+ if (entries.has(kind)) continue;
8303
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8304
+ }
8305
+ /** The complete taxonomy dictionary, keyed by kind. */
8306
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8307
+ /**
8024
8308
  * Error types for the safe expression engine. Two distinct classes so callers
8025
8309
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
8026
8310
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -10936,10 +11220,7 @@ var ConfigUISchemaNullableBridge = custom();
10936
11220
  var InferenceCapabilitiesBridge = custom();
10937
11221
  var ModelAvailabilityListBridge = custom();
10938
11222
  var PipelineRunResultBridge = custom();
10939
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10940
- kind: "mutation",
10941
- auth: "admin"
10942
- }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
11223
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10943
11224
  modelId: string(),
10944
11225
  settings: record(string(), unknown()).readonly()
10945
11226
  }))), method(object({ steps: record(string(), object({
@@ -10999,13 +11280,33 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10999
11280
  * (inputClasses ≠ null) are skipped and served per-track via
11000
11281
  * pipelineRunner.runDetailSubtree (two-plane design).
11001
11282
  */
11002
- plane: _enum(["full", "frame"]).optional()
11283
+ plane: _enum(["full", "frame"]).optional(),
11284
+ /**
11285
+ * Inference-device selector (Phase 2 multi-device). Format
11286
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
11287
+ * Omitted ⇒ the runner's default device (current single-engine
11288
+ * behaviour). Selects WHICH device pool of the node runs the call.
11289
+ */
11290
+ deviceKey: string().optional()
11003
11291
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
11004
11292
  engine: PipelineEngineChoiceSchema.optional(),
11005
11293
  steps: array(PipelineStepInputSchema).min(1),
11006
11294
  frames: array(FrameInputSchema).min(1).max(255),
11007
11295
  deviceId: number().optional(),
11008
- sessionId: string().optional()
11296
+ sessionId: string().optional(),
11297
+ /**
11298
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
11299
+ * the batch to the Python pool's bench preprocess cache
11300
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
11301
+ * preprocessed ONCE and every later inference is a pure-inference cache
11302
+ * hit — the sustained-throughput run measures inference, not
11303
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
11304
+ * full preprocess every call, correct). Fresh per sustained run;
11305
+ * released via `uncacheFrame`.
11306
+ */
11307
+ frameId: number().int().nonnegative().optional(),
11308
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
11309
+ deviceKey: string().optional()
11009
11310
  }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
11010
11311
  data: _instanceof(Uint8Array),
11011
11312
  width: number().int().positive(),
@@ -11037,8 +11338,18 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
11037
11338
  * - `runtime` — main camera-serving engine (no idle TTL).
11038
11339
  * - `warm-override` — benchmark/test override held in the warm
11039
11340
  * cache; auto-disposed after the idle TTL.
11341
+ * - `device-pool` — a concurrent per-device pool (Phase 2
11342
+ * multi-device, keyed by `deviceKey`) resolved
11343
+ * via `resolveDeviceFactory`. Runs alongside the
11344
+ * `runtime` engine on a DIFFERENT accelerator
11345
+ * (NPU / iGPU / Coral) — this is how the
11346
+ * Engines tab shows all pools running at once.
11040
11347
  */
11041
- kind: _enum(["runtime", "warm-override"]),
11348
+ kind: _enum([
11349
+ "runtime",
11350
+ "warm-override",
11351
+ "device-pool"
11352
+ ]),
11042
11353
  /** Native pid of the underlying Python pool (null when no pool). */
11043
11354
  poolPid: number().nullable(),
11044
11355
  /** ms since this factory was last used (null when not warm-tracked). */
@@ -11380,7 +11691,14 @@ var RunnerCameraConfigSchema = object({
11380
11691
  * camera's detect node differs from its source-owner (P2d, gated by the
11381
11692
  * `remoteSourcingNodes` rollout setting).
11382
11693
  */
11383
- frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11694
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" }),
11695
+ /**
11696
+ * Inference-device selector for this camera's sessions (Phase 2 multi-device).
11697
+ * Format `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`);
11698
+ * omitted ⇒ the runner's default device. The engine itself stays node-local —
11699
+ * this only selects WHICH device pool of that node runs the session.
11700
+ */
11701
+ deviceKey: string().optional()
11384
11702
  });
11385
11703
  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;
11386
11704
  /**
@@ -11401,6 +11719,19 @@ var RunnerLocalLoadSchema = object({
11401
11719
  avgInferenceTimeMs: number(),
11402
11720
  /** Total queue depth across motion + detection queues. */
11403
11721
  queueDepthTotal: number(),
11722
+ /**
11723
+ * Per-inference-device live load (multi-device C4). One entry per deviceKey
11724
+ * this runner currently has attached cameras on, so the orchestrator's second
11725
+ * `balance()` pass (over a node's devices) weights on real per-pool session
11726
+ * counts. Empty on single-device / pre-multi-device runners. `queueDepthTotal`
11727
+ * per device is 0 until the pool backlog gets a public accessor (follow-up).
11728
+ */
11729
+ devices: array(object({
11730
+ deviceKey: string(),
11731
+ backend: string(),
11732
+ attachedCameras: number(),
11733
+ queueDepthTotal: number()
11734
+ })).default([]),
11404
11735
  /** Hardware capability flags reported by this node. */
11405
11736
  hardware: object({
11406
11737
  hasGpu: boolean(),
@@ -12876,6 +13207,8 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
12876
13207
  kind: "mutation",
12877
13208
  auth: "admin"
12878
13209
  });
13210
+ 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;
13211
+ new Set(Object.values(DeviceType));
12879
13212
  /**
12880
13213
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
12881
13214
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -16016,17 +16349,30 @@ var EventKindCategorySchema = _enum([
16016
16349
  "audio",
16017
16350
  "detection",
16018
16351
  "sensor",
16352
+ "control",
16019
16353
  "custom",
16020
16354
  "package"
16021
16355
  ]);
16356
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16357
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
16022
16358
  var EventKindDescriptorSchema = object({
16023
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16359
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
16024
16360
  kind: string(),
16361
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16362
+ labelKey: string(),
16363
+ /** English fallback label (kept for clients that don't translate). */
16025
16364
  label: string(),
16026
16365
  /** Hex color for timeline/legend rendering. */
16027
16366
  color: string(),
16367
+ /** Dictionary id → lucide component on the UI side. */
16368
+ iconId: string(),
16369
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
16028
16370
  icon: EventKindIconSchema,
16029
16371
  category: EventKindCategorySchema,
16372
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16373
+ parentKind: string().nullable(),
16374
+ /** Derived from `parentKind`, explicit for the client tree. */
16375
+ level: EventKindLevelSchema,
16030
16376
  /** Which cap + device contributes this kind. For built-ins the camera
16031
16377
  * itself; for sensor kinds the LINKED source device. */
16032
16378
  source: object({
@@ -16099,11 +16445,21 @@ var TrackAudioLabelSchema = object({
16099
16445
  firstAt: number(),
16100
16446
  lastAt: number()
16101
16447
  });
16448
+ /**
16449
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16450
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16451
+ * linked sensor/control state change (no positions; carries a snapshot). The
16452
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16453
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16454
+ */
16455
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16102
16456
  var TrackSchema = object({
16103
16457
  trackId: string(),
16104
16458
  deviceId: number(),
16105
16459
  className: string(),
16106
16460
  label: string().optional(),
16461
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16462
+ source: TrackSourceSchema.optional(),
16107
16463
  firstSeen: number(),
16108
16464
  lastSeen: number(),
16109
16465
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16480,6 +16836,76 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
16480
16836
  eventId: string(),
16481
16837
  timestamp: number()
16482
16838
  });
16839
+ /**
16840
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16841
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16842
+ * caps into per-camera event-kind descriptors.
16843
+ *
16844
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16845
+ * is NOT duplicated here — every entry is derived from the single
16846
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16847
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16848
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16849
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16850
+ * eventful cap is missing.
16851
+ */
16852
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16853
+ var LEGACY_ICON = {
16854
+ motion: "motion",
16855
+ audio: "audio",
16856
+ person: "person",
16857
+ vehicle: "vehicle",
16858
+ animal: "animal",
16859
+ package: "package",
16860
+ door: "door",
16861
+ pir: "pir",
16862
+ smoke: "smoke",
16863
+ water: "water",
16864
+ button: "button",
16865
+ generic: "generic",
16866
+ gas: "smoke",
16867
+ vibration: "generic",
16868
+ tamper: "generic",
16869
+ presence: "person",
16870
+ lock: "generic",
16871
+ siren: "generic",
16872
+ switch: "generic",
16873
+ doorbell: "button"
16874
+ };
16875
+ function legacyIcon(iconId) {
16876
+ return LEGACY_ICON[iconId] ?? "generic";
16877
+ }
16878
+ /**
16879
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16880
+ * The anti-drift guard cross-checks this against the eventful caps declared
16881
+ * in `packages/types/src/capabilities/*.cap.ts`.
16882
+ */
16883
+ var CAP_TO_KIND = {
16884
+ contact: "contact",
16885
+ motion: "motion-sensor",
16886
+ smoke: "smoke",
16887
+ flood: "flood",
16888
+ gas: "gas",
16889
+ "carbon-monoxide": "carbon-monoxide",
16890
+ vibration: "vibration",
16891
+ tamper: "tamper",
16892
+ presence: "presence",
16893
+ "enum-sensor": "enum-sensor",
16894
+ "event-emitter": "device-event",
16895
+ "lock-control": "lock",
16896
+ switch: "switch",
16897
+ button: "button",
16898
+ doorbell: "doorbell"
16899
+ };
16900
+ function buildDescriptor(capName, kind) {
16901
+ const t = EVENT_TAXONOMY[kind];
16902
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16903
+ return {
16904
+ ...t,
16905
+ icon: legacyIcon(t.iconId)
16906
+ };
16907
+ }
16908
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16483
16909
  var CameraPipelineConfigSchema = object({
16484
16910
  engine: PipelineEngineChoiceSchema.optional(),
16485
16911
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16498,13 +16924,11 @@ var PipelineTemplateSchema = object({
16498
16924
  createdAt: string(),
16499
16925
  updatedAt: string()
16500
16926
  });
16501
- var AgentAddonConfigSchema = object({
16502
- enabled: boolean(),
16927
+ var DeviceStepConfigSchema = object({
16503
16928
  modelId: string().optional(),
16504
- settings: record(string(), unknown()).readonly()
16929
+ settings: record(string(), unknown()).optional()
16505
16930
  });
16506
16931
  var AgentPipelineSettingsSchema = object({
16507
- addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
16508
16932
  maxCameras: number().int().nonnegative().nullable().default(null),
16509
16933
  /** Per-node detection weight (relative share for the quota balancer). */
16510
16934
  detectWeight: number().positive().optional(),
@@ -16528,7 +16952,22 @@ var AgentPipelineSettingsSchema = object({
16528
16952
  * it already uses to reach the hub). Set this only when the auto-detected
16529
16953
  * address is wrong (multi-homed host, NAT, custom interface).
16530
16954
  */
16531
- reachableHost: string().optional()
16955
+ reachableHost: string().optional(),
16956
+ /**
16957
+ * Multi-device inference opt-in (Phase 4). Per-node map deviceKey → {enabled,
16958
+ * weight, steps}. Absent / all-disabled ⇒ the node's single default
16959
+ * accelerator (safe default); two+ enabled ⇒ the dispatcher balances
16960
+ * detection sessions across them so they run CONCURRENTLY. `steps` is the
16961
+ * per-(node,device) BASE provisioning (`stepId → {modelId?, settings?}`) —
16962
+ * the default model/settings for every camera landing on that accelerator;
16963
+ * a stepId absent ⇒ the step uses that device's format default.
16964
+ */
16965
+ inferenceDevices: record(string(), object({
16966
+ enabled: boolean(),
16967
+ weight: number().positive().optional(),
16968
+ maxSessions: number().int().positive().optional(),
16969
+ steps: record(string(), DeviceStepConfigSchema).optional()
16970
+ })).optional()
16532
16971
  });
16533
16972
  var CameraPipelineForAgentSchema = object({
16534
16973
  steps: array(PipelineStepInputSchema).readonly(),
@@ -16538,14 +16977,13 @@ var CameraPipelineForAgentSchema = object({
16538
16977
  }).nullable()
16539
16978
  });
16540
16979
  var CameraStepOverridePatchSchema = object({
16541
- enabled: boolean().optional(),
16542
16980
  modelId: string().optional(),
16543
16981
  settings: record(string(), unknown()).readonly().optional()
16544
16982
  });
16545
16983
  var CameraPipelineSettingsSchema = object({
16546
16984
  pinnedAgentNodeId: string().optional(),
16547
16985
  stepToggles: record(string(), boolean()).optional(),
16548
- stepOverridesByAgent: record(string(), record(string(), CameraStepOverridePatchSchema)).optional(),
16986
+ stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
16549
16987
  pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
16550
16988
  });
16551
16989
  /**
@@ -16759,6 +17197,44 @@ var CameraStatusSchema = object({
16759
17197
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
16760
17198
  fetchedAt: number()
16761
17199
  });
17200
+ var NodeInferenceDeviceSchema = object({
17201
+ /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
17202
+ key: string(),
17203
+ backend: string(),
17204
+ device: string(),
17205
+ format: _enum(MODEL_FORMATS),
17206
+ /** Whether the node's live probe reports the device as usable right now. */
17207
+ available: boolean(),
17208
+ /**
17209
+ * Whether this device participates in dispatch. AUTO default (spec C2):
17210
+ * accelerators are opt-OUT (a discovered NPU/iGPU/Coral/ANE with no stored
17211
+ * entry is `true`); CPU is opt-IN (`false` by default — the fallback pool,
17212
+ * not a balanced target). An explicit stored value always wins; a stored-only
17213
+ * (unavailable) key keeps its stored value.
17214
+ */
17215
+ enabled: boolean(),
17216
+ /** Relative balancer weight for the enabled device (default 1). */
17217
+ weight: number(),
17218
+ /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
17219
+ maxSessions: number().nullable(),
17220
+ /** Object-detection model the executor defaults to for this deviceKey. */
17221
+ defaultModelId: string(),
17222
+ /**
17223
+ * Per-(node,device) BASE provisioning (C7.2/C7.4) — the RAW stored
17224
+ * `stepId → {modelId?, settings?}` map from `inferenceDevices[key].steps`.
17225
+ * Absent/empty ⇒ no base (every step uses its device format default). The
17226
+ * UI cross-references `pipelineExecutor.getSchema` for the models actually
17227
+ * available per format; this is the stored selection that becomes the
17228
+ * default for EVERY camera landing on this accelerator.
17229
+ */
17230
+ steps: record(string(), DeviceStepConfigSchema).optional()
17231
+ });
17232
+ var NodeInferenceDevicesSchema = object({
17233
+ nodeId: string(),
17234
+ /** False when the node's platform-probe was unreachable (no live device set). */
17235
+ reachable: boolean(),
17236
+ devices: array(NodeInferenceDeviceSchema).readonly()
17237
+ });
16762
17238
  method(object({
16763
17239
  deviceId: number(),
16764
17240
  agentNodeId: string()
@@ -16768,7 +17244,13 @@ method(object({
16768
17244
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
16769
17245
  kind: "mutation",
16770
17246
  auth: "admin"
16771
- }), method(_void(), object({ migrated: number() }), {
17247
+ }), method(object({
17248
+ deviceId: number(),
17249
+ deviceKey: string()
17250
+ }), object({ success: literal(true) }), {
17251
+ kind: "mutation",
17252
+ auth: "admin"
17253
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
16772
17254
  kind: "mutation",
16773
17255
  auth: "admin"
16774
17256
  }), 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({
@@ -16802,13 +17284,7 @@ method(object({
16802
17284
  }))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
16803
17285
  nodeId: string(),
16804
17286
  settings: AgentPipelineSettingsSchema
16805
- })).readonly()), method(object({
16806
- agentNodeId: string(),
16807
- defaults: record(string(), AgentAddonConfigSchema)
16808
- }), object({ success: literal(true) }), {
16809
- kind: "mutation",
16810
- auth: "admin"
16811
- }), method(object({ agentNodeId: string() }), object({
17287
+ })).readonly()), method(object({ agentNodeId: string() }), object({
16812
17288
  success: boolean(),
16813
17289
  removed: boolean()
16814
17290
  }), {
@@ -16840,7 +17316,18 @@ method(object({
16840
17316
  }), object({ success: literal(true) }), {
16841
17317
  kind: "mutation",
16842
17318
  auth: "admin"
16843
- }), method(object({ agentNodeId: string() }), object({
17319
+ }), method(object({
17320
+ agentNodeId: string(),
17321
+ inferenceDevices: record(string(), object({
17322
+ enabled: boolean(),
17323
+ weight: number().positive().optional(),
17324
+ maxSessions: number().int().positive().optional(),
17325
+ steps: record(string(), DeviceStepConfigSchema).optional()
17326
+ }))
17327
+ }), object({ success: literal(true) }), {
17328
+ kind: "mutation",
17329
+ auth: "admin"
17330
+ }), method(object({ nodeId: string() }), NodeInferenceDevicesSchema), method(object({ agentNodeId: string() }), object({
16844
17331
  success: literal(true),
16845
17332
  /** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
16846
17333
  effectiveModelId: string().nullable(),
@@ -16856,9 +17343,10 @@ method(object({
16856
17343
  }), object({ success: literal(true) }), {
16857
17344
  kind: "mutation",
16858
17345
  auth: "admin"
16859
- }), method(object({ deviceId: number() }), record(string(), record(string(), CameraStepOverridePatchSchema)).nullable()), method(object({
17346
+ }), method(object({ deviceId: number() }), record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).nullable()), method(object({
16860
17347
  deviceId: number(),
16861
17348
  agentNodeId: string(),
17349
+ deviceKey: string(),
16862
17350
  addonId: string(),
16863
17351
  patch: CameraStepOverridePatchSchema.nullable()
16864
17352
  }), object({ success: literal(true) }), {
@@ -16895,14 +17383,13 @@ method(object({
16895
17383
  });
16896
17384
  /**
16897
17385
  * server-management — per-NODE singleton capability for a node's ROOT
16898
- * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
16899
- * agents).
17386
+ * package lifecycle (runtime-updatable node packages).
16900
17387
  *
16901
- * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
16902
- * on agents) carries the whole software stack in its npm dep tree, so ONE
16903
- * version describes the node. Updates install into
16904
- * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
16905
- * starter (probation boot + auto-rollback to N-1).
17388
+ * Every node role runs the SAME root package (`@camstack/server`), which
17389
+ * carries the whole software stack in its npm dep tree, so ONE version
17390
+ * describes the node. Updates stage into `<dataDir>/server-root/` and apply
17391
+ * on restart via the baked starter (single-copy in-place swap — no probation,
17392
+ * no auto-rollback).
16906
17393
  *
16907
17394
  * Providers:
16908
17395
  * - HUB: `ServerUpdateService` behind the `server-provided` mount
@@ -17010,7 +17497,8 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
17010
17497
  /** Explicit target version; omitted = latest from the registry. */
17011
17498
  version: string().optional() }), ServerUpdateActionResultSchema, {
17012
17499
  kind: "mutation",
17013
- auth: "admin"
17500
+ auth: "admin",
17501
+ timeoutMs: 16 * 6e4
17014
17502
  }), method(_void(), ServerUpdateActionResultSchema, {
17015
17503
  kind: "mutation",
17016
17504
  auth: "admin"
@@ -18071,22 +18559,6 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
18071
18559
  var RestartAddonResultSchema = unknown();
18072
18560
  var InstallPackageResultSchema = unknown();
18073
18561
  var ReloadPackagesResultSchema = unknown();
18074
- /**
18075
- * Result of `updateFrameworkPackage`. The cap method returns BEFORE the
18076
- * server restarts so the admin UI can react to the `restartingAt`
18077
- * timestamp (shows reconnect overlay). The transition from
18078
- * `fromVersion` to `toVersion` will be confirmed by a subsequent
18079
- * `system.restart-completed` event after the new process boots.
18080
- *
18081
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
18082
- */
18083
- var UpdateFrameworkPackageResultSchema = object({
18084
- packageName: string(),
18085
- fromVersion: string(),
18086
- toVersion: string(),
18087
- /** Ms-epoch the server scheduled its self-restart. */
18088
- restartingAt: number()
18089
- });
18090
18562
  var BulkUpdateItemStatusSchema = _enum([
18091
18563
  "queued",
18092
18564
  "updating",
@@ -18214,13 +18686,6 @@ method(_void(), array(AddonListItemSchema).readonly()), method(object({
18214
18686
  }), object({ success: literal(true) }), {
18215
18687
  kind: "mutation",
18216
18688
  auth: "admin"
18217
- }), method(object({
18218
- packageName: string().min(1),
18219
- version: string().optional(),
18220
- deferRestart: boolean().optional()
18221
- }), UpdateFrameworkPackageResultSchema, {
18222
- kind: "mutation",
18223
- auth: "admin"
18224
18689
  }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
18225
18690
  kind: "mutation",
18226
18691
  auth: "admin"
@@ -19086,10 +19551,10 @@ var TopologyCategorySchema = object({
19086
19551
  addons: array(TopologyCategoryAddonSchema).readonly()
19087
19552
  });
19088
19553
  /**
19089
- * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
19090
- * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
19091
- * version visibility for the Server management surface. Nullable: offline
19092
- * rows and pre-phase-2 nodes report none.
19554
+ * The node's runtime-updatable ROOT package (`@camstack/server` the single
19555
+ * root package for every node role) as reported by its `registerNode`
19556
+ * manifest — version visibility for the Server management surface. Nullable:
19557
+ * offline rows and nodes that never reported one.
19093
19558
  */
19094
19559
  var TopologyRootPackageSchema = object({
19095
19560
  name: string(),
@@ -19477,17 +19942,28 @@ var PlatformScoreSchema = object({
19477
19942
  format: _enum([
19478
19943
  "onnx",
19479
19944
  "coreml",
19480
- "openvino"
19945
+ "openvino",
19946
+ "tflite"
19481
19947
  ]),
19482
19948
  score: number(),
19483
19949
  reason: string(),
19484
19950
  available: boolean()
19485
19951
  });
19952
+ var InferenceDeviceDescriptorSchema = object({
19953
+ key: string(),
19954
+ backend: string(),
19955
+ device: string(),
19956
+ format: ModelFormatSchema,
19957
+ runtime: literal("python"),
19958
+ score: number(),
19959
+ available: boolean()
19960
+ });
19486
19961
  var PlatformCapabilitiesSchema = object({
19487
19962
  hardware: HardwareInfoSchema,
19488
19963
  scores: array(PlatformScoreSchema).readonly(),
19489
19964
  bestScore: PlatformScoreSchema,
19490
- pythonPath: string().nullable()
19965
+ pythonPath: string().nullable(),
19966
+ devices: array(InferenceDeviceDescriptorSchema).readonly()
19491
19967
  });
19492
19968
  var ModelRequirementSchema = object({
19493
19969
  modelId: string(),
@@ -20366,12 +20842,6 @@ Object.freeze({
20366
20842
  addonId: null,
20367
20843
  access: "delete"
20368
20844
  },
20369
- "addons.updateFrameworkPackage": {
20370
- capName: "addons",
20371
- capScope: "system",
20372
- addonId: null,
20373
- access: "create"
20374
- },
20375
20845
  "addons.updatePackage": {
20376
20846
  capName: "addons",
20377
20847
  capScope: "system",
@@ -23144,12 +23614,6 @@ Object.freeze({
23144
23614
  addonId: null,
23145
23615
  access: "view"
23146
23616
  },
23147
- "pipelineExecutor.reprobeEngine": {
23148
- capName: "pipeline-executor",
23149
- capScope: "system",
23150
- addonId: null,
23151
- access: "create"
23152
- },
23153
23617
  "pipelineExecutor.runAudioTest": {
23154
23618
  capName: "pipeline-executor",
23155
23619
  capScope: "system",
@@ -23300,6 +23764,12 @@ Object.freeze({
23300
23764
  addonId: null,
23301
23765
  access: "view"
23302
23766
  },
23767
+ "pipelineOrchestrator.getNodeInferenceDevices": {
23768
+ capName: "pipeline-orchestrator",
23769
+ capScope: "system",
23770
+ addonId: null,
23771
+ access: "view"
23772
+ },
23303
23773
  "pipelineOrchestrator.getPipelineAssignment": {
23304
23774
  capName: "pipeline-orchestrator",
23305
23775
  capScope: "system",
@@ -23312,6 +23782,12 @@ Object.freeze({
23312
23782
  addonId: null,
23313
23783
  access: "view"
23314
23784
  },
23785
+ "pipelineOrchestrator.getPipelineDevicePin": {
23786
+ capName: "pipeline-orchestrator",
23787
+ capScope: "system",
23788
+ addonId: null,
23789
+ access: "view"
23790
+ },
23315
23791
  "pipelineOrchestrator.listAgentSettings": {
23316
23792
  capName: "pipeline-orchestrator",
23317
23793
  capScope: "system",
@@ -23354,19 +23830,19 @@ Object.freeze({
23354
23830
  addonId: null,
23355
23831
  access: "create"
23356
23832
  },
23357
- "pipelineOrchestrator.setAgentAddonDefaults": {
23833
+ "pipelineOrchestrator.setAgentCapabilities": {
23358
23834
  capName: "pipeline-orchestrator",
23359
23835
  capScope: "system",
23360
23836
  addonId: null,
23361
23837
  access: "create"
23362
23838
  },
23363
- "pipelineOrchestrator.setAgentCapabilities": {
23839
+ "pipelineOrchestrator.setAgentDetectWeight": {
23364
23840
  capName: "pipeline-orchestrator",
23365
23841
  capScope: "system",
23366
23842
  addonId: null,
23367
23843
  access: "create"
23368
23844
  },
23369
- "pipelineOrchestrator.setAgentDetectWeight": {
23845
+ "pipelineOrchestrator.setAgentInferenceDevices": {
23370
23846
  capName: "pipeline-orchestrator",
23371
23847
  capScope: "system",
23372
23848
  addonId: null,
@@ -23408,6 +23884,12 @@ Object.freeze({
23408
23884
  addonId: null,
23409
23885
  access: "create"
23410
23886
  },
23887
+ "pipelineOrchestrator.setPipelineDevicePin": {
23888
+ capName: "pipeline-orchestrator",
23889
+ capScope: "system",
23890
+ addonId: null,
23891
+ access: "create"
23892
+ },
23411
23893
  "pipelineOrchestrator.unassignAudio": {
23412
23894
  capName: "pipeline-orchestrator",
23413
23895
  capScope: "system",
@@ -24960,32 +25442,6 @@ Object.freeze({
24960
25442
  "network-access": "ingress",
24961
25443
  "smtp-provider": "email"
24962
25444
  });
24963
- var frameworkSwapPackageSchema = object({
24964
- name: string(),
24965
- stagedPath: string(),
24966
- backupPath: string(),
24967
- toVersion: string(),
24968
- fromVersion: string().nullable()
24969
- });
24970
- object({
24971
- jobId: string(),
24972
- taskId: string(),
24973
- packages: array(frameworkSwapPackageSchema),
24974
- requestedAtMs: number(),
24975
- schemaVersion: literal(1)
24976
- });
24977
- object({
24978
- jobId: string(),
24979
- taskId: string(),
24980
- backups: array(object({
24981
- name: string(),
24982
- backupPath: string(),
24983
- livePath: string()
24984
- })),
24985
- appliedAtMs: number(),
24986
- bootAttempts: number(),
24987
- schemaVersion: literal(1)
24988
- });
24989
25445
  //#endregion
24990
25446
  Object.defineProperty(exports, "BaseAddon", {
24991
25447
  enumerable: true,