@camstack/types 1.1.50 → 1.1.51

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.
@@ -78,7 +78,7 @@ export { type ILlmRuntimeProvider, llmRuntimeCapability, type LlmNodeModel, LlmN
78
78
  export { type LlmErrorCode, LlmErrorCodeSchema, type LlmGenerateBaseInput, LlmGenerateBaseInputSchema, type LlmGenerateErr, LlmGenerateErrSchema, type LlmGenerateOk, LlmGenerateOkSchema, type LlmGenerateResult, LlmGenerateResultSchema, type LlmImage, LlmImageSchema, type LlmUsage, LlmUsageSchema, } from './llm-shared.js';
79
79
  export { type IOauthIntegrationProvider, type OauthIntegrationDescriptor, OauthIntegrationDescriptorSchema, oauthIntegrationCapability, } from './oauth-integration.cap.js';
80
80
  export { type AudioEvent, AudioEventSchema, type DetectionSource, DetectionSourceSchema, type EventKind, type EventKindCategory, EventKindCategorySchema, type EventKindDescriptor, EventKindDescriptorSchema, type EventKindIcon, EventKindIconSchema, EventKindSchema, type EventPruneCounts, type EventStoreDeviceFootprint, type EventStoreFootprint, type IPipelineAnalyticsProvider, type KeyEvent, KeyEventSchema, type MediaFile, type MediaFileKind, MediaFileSchema, type MotionEvent, MotionEventSchema, type ObjectEvent, ObjectEventSchema, pipelineAnalyticsCapability, type RecentTracksPage, RecentTracksPageSchema, type RecentTracksQuery, RecentTracksQueryInput, type ScoredObjectEvent, ScoredObjectEventSchema, type SensorEvent, SensorEventSchema, type Track, type TrackCascadeCounts, TrackCascadeCountsSchema, TrackedDetectionSchema, type TrackEnvelope, TrackEnvelopeSchema, type TrackProjection, TrackProjectionSchema, TrackSchema, type TrackState, TrackStateSchema, type TrackZoneFilter, TrackZoneFilterSchema, } from './pipeline-analytics.cap.js';
81
- export { EVENT_KIND_BY_CAP, type SensorEventKindDescriptor } from './sensor-event-kinds.js';
81
+ export { EVENT_KIND_BY_CAP, EVENTFUL_CAP_NAMES, buildEventKindDescriptor, type SensorEventKindDescriptor, } from './sensor-event-kinds.js';
82
82
  export type { PipelineStepInputOutput, PipelineValidationIssue, PipelineValidationResult, } from './pipeline-executor.cap.js';
83
83
  export { ModelSubstitutionSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, pipelineExecutorCapability, } from './pipeline-executor.cap.js';
84
84
  export type { CameraAssignmentStatus, CameraAudioStatus, CameraBrokerProfile, CameraBrokerStatus, CameraDecoderShm, CameraDecoderStatus, CameraDetectionPhase, CameraDetectionProvisioning, CameraDetectionProvisioningState, CameraDetectionStatus, CameraMotionStatus, CameraRecordingMode, CameraRecordingStatus, CameraSourceStatus, CameraSourceStream, CameraStatus, IngestOwner, } from './pipeline-orchestrator.cap.js';
@@ -76,6 +76,7 @@ export declare const EventKindIconSchema: z.ZodEnum<{
76
76
  export type EventKindIcon = z.infer<typeof EventKindIconSchema>;
77
77
  export declare const EventKindCategorySchema: z.ZodEnum<{
78
78
  sensor: "sensor";
79
+ control: "control";
79
80
  audio: "audio";
80
81
  custom: "custom";
81
82
  motion: "motion";
@@ -83,10 +84,18 @@ export declare const EventKindCategorySchema: z.ZodEnum<{
83
84
  detection: "detection";
84
85
  }>;
85
86
  export type EventKindCategory = z.infer<typeof EventKindCategorySchema>;
87
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
88
+ export declare const EventKindLevelSchema: z.ZodEnum<{
89
+ sub: "sub";
90
+ macro: "macro";
91
+ }>;
92
+ export type EventKindLevel = z.infer<typeof EventKindLevelSchema>;
86
93
  declare const EventKindDescriptorSchema: z.ZodObject<{
87
94
  kind: z.ZodString;
95
+ labelKey: z.ZodString;
88
96
  label: z.ZodString;
89
97
  color: z.ZodString;
98
+ iconId: z.ZodString;
90
99
  icon: z.ZodEnum<{
91
100
  button: "button";
92
101
  generic: "generic";
@@ -103,12 +112,18 @@ declare const EventKindDescriptorSchema: z.ZodObject<{
103
112
  }>;
104
113
  category: z.ZodEnum<{
105
114
  sensor: "sensor";
115
+ control: "control";
106
116
  audio: "audio";
107
117
  custom: "custom";
108
118
  motion: "motion";
109
119
  package: "package";
110
120
  detection: "detection";
111
121
  }>;
122
+ parentKind: z.ZodNullable<z.ZodString>;
123
+ level: z.ZodEnum<{
124
+ sub: "sub";
125
+ macro: "macro";
126
+ }>;
112
127
  source: z.ZodObject<{
113
128
  capName: z.ZodString;
114
129
  deviceId: z.ZodNumber;
@@ -168,11 +183,27 @@ declare const TrackAudioLabelSchema: z.ZodObject<{
168
183
  lastAt: z.ZodNumber;
169
184
  }, z.core.$strip>;
170
185
  export type TrackAudioLabel = z.infer<typeof TrackAudioLabelSchema>;
186
+ /**
187
+ * How a track was produced. `pipeline` (default / absent) = the spatial
188
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
189
+ * linked sensor/control state change (no positions; carries a snapshot). The
190
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
191
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
192
+ */
193
+ export declare const TrackSourceSchema: z.ZodEnum<{
194
+ sensor: "sensor";
195
+ pipeline: "pipeline";
196
+ }>;
197
+ export type TrackSource = z.infer<typeof TrackSourceSchema>;
171
198
  declare const TrackSchema: z.ZodObject<{
172
199
  trackId: z.ZodString;
173
200
  deviceId: z.ZodNumber;
174
201
  className: z.ZodString;
175
202
  label: z.ZodOptional<z.ZodString>;
203
+ source: z.ZodOptional<z.ZodEnum<{
204
+ sensor: "sensor";
205
+ pipeline: "pipeline";
206
+ }>>;
176
207
  firstSeen: z.ZodNumber;
177
208
  lastSeen: z.ZodNumber;
178
209
  positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -365,6 +396,10 @@ declare const RecentTracksPageSchema: z.ZodObject<{
365
396
  deviceId: z.ZodNumber;
366
397
  className: z.ZodString;
367
398
  label: z.ZodOptional<z.ZodString>;
399
+ source: z.ZodOptional<z.ZodEnum<{
400
+ sensor: "sensor";
401
+ pipeline: "pipeline";
402
+ }>>;
368
403
  firstSeen: z.ZodNumber;
369
404
  lastSeen: z.ZodNumber;
370
405
  positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -541,6 +576,10 @@ export declare const pipelineAnalyticsCapability: {
541
576
  deviceId: z.ZodNumber;
542
577
  className: z.ZodString;
543
578
  label: z.ZodOptional<z.ZodString>;
579
+ source: z.ZodOptional<z.ZodEnum<{
580
+ sensor: "sensor";
581
+ pipeline: "pipeline";
582
+ }>>;
544
583
  firstSeen: z.ZodNumber;
545
584
  lastSeen: z.ZodNumber;
546
585
  positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -605,6 +644,10 @@ export declare const pipelineAnalyticsCapability: {
605
644
  deviceId: z.ZodNumber;
606
645
  className: z.ZodString;
607
646
  label: z.ZodOptional<z.ZodString>;
647
+ source: z.ZodOptional<z.ZodEnum<{
648
+ sensor: "sensor";
649
+ pipeline: "pipeline";
650
+ }>>;
608
651
  firstSeen: z.ZodNumber;
609
652
  lastSeen: z.ZodNumber;
610
653
  positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -691,6 +734,10 @@ export declare const pipelineAnalyticsCapability: {
691
734
  deviceId: z.ZodNumber;
692
735
  className: z.ZodString;
693
736
  label: z.ZodOptional<z.ZodString>;
737
+ source: z.ZodOptional<z.ZodEnum<{
738
+ sensor: "sensor";
739
+ pipeline: "pipeline";
740
+ }>>;
694
741
  firstSeen: z.ZodNumber;
695
742
  lastSeen: z.ZodNumber;
696
743
  positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -773,6 +820,10 @@ export declare const pipelineAnalyticsCapability: {
773
820
  deviceId: z.ZodNumber;
774
821
  className: z.ZodString;
775
822
  label: z.ZodOptional<z.ZodString>;
823
+ source: z.ZodOptional<z.ZodEnum<{
824
+ sensor: "sensor";
825
+ pipeline: "pipeline";
826
+ }>>;
776
827
  firstSeen: z.ZodNumber;
777
828
  lastSeen: z.ZodNumber;
778
829
  positions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -941,8 +992,10 @@ export declare const pipelineAnalyticsCapability: {
941
992
  deviceId: z.ZodNumber;
942
993
  }, z.core.$strip>, z.ZodReadonly<z.ZodArray<z.ZodObject<{
943
994
  kind: z.ZodString;
995
+ labelKey: z.ZodString;
944
996
  label: z.ZodString;
945
997
  color: z.ZodString;
998
+ iconId: z.ZodString;
946
999
  icon: z.ZodEnum<{
947
1000
  button: "button";
948
1001
  generic: "generic";
@@ -959,12 +1012,18 @@ export declare const pipelineAnalyticsCapability: {
959
1012
  }>;
960
1013
  category: z.ZodEnum<{
961
1014
  sensor: "sensor";
1015
+ control: "control";
962
1016
  audio: "audio";
963
1017
  custom: "custom";
964
1018
  motion: "motion";
965
1019
  package: "package";
966
1020
  detection: "detection";
967
1021
  }>;
1022
+ parentKind: z.ZodNullable<z.ZodString>;
1023
+ level: z.ZodEnum<{
1024
+ sub: "sub";
1025
+ macro: "macro";
1026
+ }>;
968
1027
  source: z.ZodObject<{
969
1028
  capName: z.ZodString;
970
1029
  deviceId: z.ZodNumber;
@@ -1,25 +1,42 @@
1
1
  /**
2
- * Static event-kind descriptors for the SENSOR cap family — the mapping
2
+ * Cap event-kind mapping for the SENSOR / CONTROL cap families — the table
3
3
  * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
4
- * sensor caps (contact / flood / gas / carbon-monoxide / enum-sensor /
5
- * event-emitter) into per-camera event-kind entries.
4
+ * caps into per-camera event-kind descriptors.
6
5
  *
7
- * Lives beside the sensor cap definitions so adding a new sensor cap and its
8
- * event-kind descriptor happens in one place. The `source` field of the full
9
- * `EventKindDescriptor` is stamped at compose time (per linked device) — this
10
- * map carries only the static half.
6
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
7
+ * is NOT duplicated here every entry is derived from the single
8
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
9
+ * ONLY the cap-name taxonomy-kind mapping. Adding a new eventful sensor /
10
+ * control cap means adding one line here (and a taxonomy entry); the anti-
11
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
12
+ * eventful cap is missing.
11
13
  */
12
- import type { EventKindCategory, EventKindIcon } from './pipeline-analytics.cap.js';
13
- /** The static half of an `EventKindDescriptor` (no per-device `source`). */
14
- export interface SensorEventKindDescriptor {
15
- readonly kind: string;
16
- readonly label: string;
17
- readonly color: string;
14
+ import { type EventTaxonomyEntry } from '../catalogs/event-taxonomy.js';
15
+ import type { EventKindDescriptor, EventKindIcon } from './pipeline-analytics.cap.js';
16
+ /**
17
+ * The static half of an `EventKindDescriptor` (no per-device `source`).
18
+ * Extends the taxonomy entry with the legacy closed-enum `icon` glyph kept
19
+ * as a fallback for clients that predate `iconId`.
20
+ */
21
+ export interface SensorEventKindDescriptor extends EventTaxonomyEntry {
22
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
18
23
  readonly icon: EventKindIcon;
19
- readonly category: EventKindCategory;
20
24
  }
21
25
  /**
22
- * Sensor cap name → static event-kind descriptor. A linked device
26
+ * Sensor / control cap name → static event-kind descriptor. A linked device
23
27
  * contributes one entry per bound cap present in this map.
24
28
  */
25
29
  export declare const EVENT_KIND_BY_CAP: Readonly<Record<string, SensorEventKindDescriptor>>;
30
+ /** The cap names covered by the taxonomy (for the anti-drift guard). */
31
+ export declare const EVENTFUL_CAP_NAMES: readonly string[];
32
+ /**
33
+ * Build a full `EventKindDescriptor` for a taxonomy `kind`, stamping the
34
+ * per-device `source`. Returns null when `kind` is not in the taxonomy.
35
+ * This is THE bridge from the serializable taxonomy dictionary to the cap
36
+ * wire shape — every event-kind descriptor the server emits goes through it,
37
+ * so color/iconId/labelKey are never re-declared at a call site.
38
+ */
39
+ export declare function buildEventKindDescriptor(kind: string, source: {
40
+ readonly capName: string;
41
+ readonly deviceId: number;
42
+ }): EventKindDescriptor | null;
@@ -0,0 +1,44 @@
1
+ export type EventTaxonomyCategory = 'motion' | 'audio' | 'detection' | 'sensor' | 'control' | 'package' | 'custom';
2
+ export type EventTaxonomyLevel = 'macro' | 'sub';
3
+ /**
4
+ * The static, serializable half of an event kind. Descriptors surfaced by
5
+ * `listEventKinds` extend this with a per-device `source`.
6
+ */
7
+ export interface EventTaxonomyEntry {
8
+ /** Unique kind id ('vehicle', 'car', 'lock', 'audio-dog', …). */
9
+ readonly kind: string;
10
+ /** Macro parent ('car' → 'vehicle'); null for a macro. */
11
+ readonly parentKind: string | null;
12
+ /** Derived from `parentKind` — explicit for the UI. */
13
+ readonly level: EventTaxonomyLevel;
14
+ readonly category: EventTaxonomyCategory;
15
+ /** Hex color for timeline/legend rendering. */
16
+ readonly color: string;
17
+ /** Dictionary id → lucide component on the UI side. */
18
+ readonly iconId: string;
19
+ /** i18n key; `label` is the English fallback. */
20
+ readonly labelKey: string;
21
+ /** English fallback label (UI translates `labelKey` when it can). */
22
+ readonly label: string;
23
+ }
24
+ export declare const TAXONOMY_COLORS: {
25
+ readonly motion: "#f59e0b";
26
+ readonly audio: "#06b6d4";
27
+ readonly person: "#22c55e";
28
+ readonly vehicle: "#3b82f6";
29
+ readonly animal: "#f97316";
30
+ readonly package: "#a855f7";
31
+ readonly sensor: "#8b5cf6";
32
+ readonly control: "#10b981";
33
+ readonly genericDetection: "#64748b";
34
+ };
35
+ /** Global default color when a kind is unknown (matches legacy box-drawer). */
36
+ export declare const DEFAULT_EVENT_COLOR = "#22ff55";
37
+ /** The complete taxonomy dictionary, keyed by kind. */
38
+ export declare const EVENT_TAXONOMY: Readonly<Record<string, EventTaxonomyEntry>>;
39
+ /** Taxonomy entry for a kind, or undefined when unknown. */
40
+ export declare function getTaxonomyEntry(kind: string): EventTaxonomyEntry | undefined;
41
+ /** Color for a kind — dictionary value, else the global default. */
42
+ export declare function colorForKind(kind: string): string;
43
+ /** The sub kinds whose `parentKind` is `macro` (empty for a leaf macro). */
44
+ export declare function subKindsOf(macro: string): readonly EventTaxonomyEntry[];
@@ -1 +1,3 @@
1
1
  export * from './coco-classmap.js';
2
+ export * from './audio-classmap.js';
3
+ export * from './event-taxonomy.js';
@@ -9671,6 +9671,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
9671
9671
  state: "idle" | "left" | "moving" | "new" | "entered";
9672
9672
  active: boolean;
9673
9673
  label?: string | undefined;
9674
+ source?: "pipeline" | "sensor" | undefined;
9674
9675
  classes?: readonly string[] | undefined;
9675
9676
  importance?: number | undefined;
9676
9677
  bestEventId?: string | undefined;
@@ -9734,6 +9735,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
9734
9735
  state: "idle" | "left" | "moving" | "new" | "entered";
9735
9736
  active: boolean;
9736
9737
  label?: string | undefined;
9738
+ source?: "pipeline" | "sensor" | undefined;
9737
9739
  classes?: readonly string[] | undefined;
9738
9740
  importance?: number | undefined;
9739
9741
  bestEventId?: string | undefined;
@@ -9813,6 +9815,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
9813
9815
  state: "idle" | "left" | "moving" | "new" | "entered";
9814
9816
  active: boolean;
9815
9817
  label?: string | undefined;
9818
+ source?: "pipeline" | "sensor" | undefined;
9816
9819
  classes?: readonly string[] | undefined;
9817
9820
  importance?: number | undefined;
9818
9821
  bestEventId?: string | undefined;
@@ -9881,6 +9884,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
9881
9884
  state: "idle" | "left" | "moving" | "new" | "entered";
9882
9885
  active: boolean;
9883
9886
  label?: string | undefined;
9887
+ source?: "pipeline" | "sensor" | undefined;
9884
9888
  classes?: readonly string[] | undefined;
9885
9889
  importance?: number | undefined;
9886
9890
  bestEventId?: string | undefined;
@@ -10012,10 +10016,14 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
10012
10016
  };
10013
10017
  output: readonly {
10014
10018
  kind: string;
10019
+ labelKey: string;
10015
10020
  label: string;
10016
10021
  color: string;
10022
+ iconId: string;
10017
10023
  icon: "motion" | "smoke" | "button" | "audio" | "person" | "vehicle" | "animal" | "package" | "generic" | "door" | "pir" | "water";
10018
- category: "custom" | "motion" | "audio" | "package" | "sensor" | "detection";
10024
+ category: "custom" | "motion" | "control" | "audio" | "package" | "sensor" | "detection";
10025
+ parentKind: string | null;
10026
+ level: "sub" | "macro";
10019
10027
  source: {
10020
10028
  capName: string;
10021
10029
  deviceId: number;
@@ -26409,6 +26417,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
26409
26417
  state: "idle" | "left" | "moving" | "new" | "entered";
26410
26418
  active: boolean;
26411
26419
  label?: string | undefined;
26420
+ source?: "pipeline" | "sensor" | undefined;
26412
26421
  classes?: readonly string[] | undefined;
26413
26422
  importance?: number | undefined;
26414
26423
  bestEventId?: string | undefined;
@@ -26472,6 +26481,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
26472
26481
  state: "idle" | "left" | "moving" | "new" | "entered";
26473
26482
  active: boolean;
26474
26483
  label?: string | undefined;
26484
+ source?: "pipeline" | "sensor" | undefined;
26475
26485
  classes?: readonly string[] | undefined;
26476
26486
  importance?: number | undefined;
26477
26487
  bestEventId?: string | undefined;
@@ -26551,6 +26561,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
26551
26561
  state: "idle" | "left" | "moving" | "new" | "entered";
26552
26562
  active: boolean;
26553
26563
  label?: string | undefined;
26564
+ source?: "pipeline" | "sensor" | undefined;
26554
26565
  classes?: readonly string[] | undefined;
26555
26566
  importance?: number | undefined;
26556
26567
  bestEventId?: string | undefined;
@@ -26619,6 +26630,7 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
26619
26630
  state: "idle" | "left" | "moving" | "new" | "entered";
26620
26631
  active: boolean;
26621
26632
  label?: string | undefined;
26633
+ source?: "pipeline" | "sensor" | undefined;
26622
26634
  classes?: readonly string[] | undefined;
26623
26635
  importance?: number | undefined;
26624
26636
  bestEventId?: string | undefined;
@@ -26750,10 +26762,14 @@ export type AppRouter = import("@trpc/server/unstable-core-do-not-import").Route
26750
26762
  };
26751
26763
  output: readonly {
26752
26764
  kind: string;
26765
+ labelKey: string;
26753
26766
  label: string;
26754
26767
  color: string;
26768
+ iconId: string;
26755
26769
  icon: "motion" | "smoke" | "button" | "audio" | "person" | "vehicle" | "animal" | "package" | "generic" | "door" | "pir" | "water";
26756
- category: "custom" | "motion" | "audio" | "package" | "sensor" | "detection";
26770
+ category: "custom" | "motion" | "control" | "audio" | "package" | "sensor" | "detection";
26771
+ parentKind: string | null;
26772
+ level: "sub" | "macro";
26757
26773
  source: {
26758
26774
  capName: string;
26759
26775
  deviceId: number;
package/dist/index.d.ts CHANGED
@@ -119,6 +119,7 @@ export { runInferenceStep } from './utils/run-inference-step.js';
119
119
  export type { InferenceStepResult } from './utils/run-inference-step.js';
120
120
  export { COCO_80_LABELS, COCO_TO_MACRO, MACRO_LABELS, } from './catalogs/coco-classmap.js';
121
121
  export { AUDIO_MACRO_LABELS, YAMNET_TO_MACRO, APPLE_SA_TO_MACRO, mapAudioLabelToMacro, getAudioMacroClassIds, } from './catalogs/audio-classmap.js';
122
+ export { EVENT_TAXONOMY, TAXONOMY_COLORS, DEFAULT_EVENT_COLOR, getTaxonomyEntry, colorForKind, subKindsOf, type EventTaxonomyEntry, type EventTaxonomyCategory, type EventTaxonomyLevel, } from './catalogs/event-taxonomy.js';
122
123
  export type { CameraMotionConfig, CameraNativeDetectionConfig, CameraDetectionCapabilities, } from './types/camera-detection.js';
123
124
  export { type DeviceTypeInfo, DEVICE_TYPE_INFO } from './types/device-type.js';
124
125
  export type { DeviceBinding, DeviceBindingEntry } from './device/device-binding.js';