@camstack/addon-pipeline-analytics 0.1.1

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 (56) hide show
  1. package/dist/@mf-types/compiled-types/widgets/AudioHistoryChart.d.ts +5 -0
  2. package/dist/@mf-types/compiled-types/widgets/AudioHistoryChart.d.ts.map +1 -0
  3. package/dist/@mf-types/compiled-types/widgets/AudioMetricsPanel.d.ts +11 -0
  4. package/dist/@mf-types/compiled-types/widgets/AudioMetricsPanel.d.ts.map +1 -0
  5. package/dist/@mf-types/compiled-types/widgets/DetectionHistoryChart.d.ts +5 -0
  6. package/dist/@mf-types/compiled-types/widgets/DetectionHistoryChart.d.ts.map +1 -0
  7. package/dist/@mf-types/compiled-types/widgets/MotionHistoryChart.d.ts +5 -0
  8. package/dist/@mf-types/compiled-types/widgets/MotionHistoryChart.d.ts.map +1 -0
  9. package/dist/@mf-types/compiled-types/widgets/OccupancyHistoryChart.d.ts +5 -0
  10. package/dist/@mf-types/compiled-types/widgets/OccupancyHistoryChart.d.ts.map +1 -0
  11. package/dist/@mf-types/compiled-types/widgets/OccupancyPanel.d.ts +11 -0
  12. package/dist/@mf-types/compiled-types/widgets/OccupancyPanel.d.ts.map +1 -0
  13. package/dist/@mf-types/compiled-types/widgets/chart-utils.d.ts +98 -0
  14. package/dist/@mf-types/compiled-types/widgets/chart-utils.d.ts.map +1 -0
  15. package/dist/@mf-types/compiled-types/widgets/index.d.ts +28 -0
  16. package/dist/@mf-types/compiled-types/widgets/index.d.ts.map +1 -0
  17. package/dist/@mf-types/widgets.d.ts +2 -0
  18. package/dist/@mf-types.d.ts +3 -0
  19. package/dist/@mf-types.zip +0 -0
  20. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-CCBTZBOa.mjs +12 -0
  21. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-OesvKBZV.mjs +16 -0
  22. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-D0mniK1l.mjs +15 -0
  23. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs +104 -0
  24. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-52bfkwC8.mjs +85 -0
  25. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-CVrnrGED.mjs +62 -0
  26. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react__loadShare__.mjs-DuO9h7li.mjs +85 -0
  27. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-CmqNjq44.mjs +29 -0
  28. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-BsyrX6NO.mjs +36 -0
  29. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_2_dom__loadShare__.mjs-Dp8hqYOB.mjs +45 -0
  30. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-CA8cCIEl.mjs +6 -0
  31. package/dist/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-BZjEt71l.mjs +34 -0
  32. package/dist/_stub.js +1397 -0
  33. package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-Cm7MAUA1.mjs +157 -0
  34. package/dist/client-DdXDZxzK.mjs +10063 -0
  35. package/dist/getErrorShape-BPSzUA7W-TlK8ipWe.mjs +211 -0
  36. package/dist/hostInit-WKMmag4S.mjs +168 -0
  37. package/dist/index-B4OKsa9p.mjs +2603 -0
  38. package/dist/index-C3iAUQqS.mjs +533 -0
  39. package/dist/index-D0dNM7_R.mjs +2892 -0
  40. package/dist/index-DKqbmJDl.mjs +2464 -0
  41. package/dist/index-DnFVXz0U.mjs +14162 -0
  42. package/dist/index-DyYvUfc7.mjs +725 -0
  43. package/dist/index-Oq45bZIA.mjs +17936 -0
  44. package/dist/index-k0CA0h_r.mjs +185 -0
  45. package/dist/index-kIgjN-uq.mjs +435 -0
  46. package/dist/index-xncRG7-x.mjs +2713 -0
  47. package/dist/index.d.mts +190 -0
  48. package/dist/index.d.ts +190 -0
  49. package/dist/index.js +2623 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/index.mjs +2602 -0
  52. package/dist/index.mjs.map +1 -0
  53. package/dist/jsx-runtime-4ro1c69i.mjs +55 -0
  54. package/dist/remoteEntry.js +85 -0
  55. package/dist/virtualExposes-8FzWTdq3.mjs +42 -0
  56. package/package.json +89 -0
@@ -0,0 +1,190 @@
1
+ import * as _camstack_types from '@camstack/types';
2
+ import { TrackState, ObjectEvent, TrackedDetection, BaseAddon, IPipelineAnalyticsProvider, ProviderRegistration, Track, MotionEvent, AudioEvent, MediaFile, ConfigUISchemaWithValues } from '@camstack/types';
3
+
4
+ /**
5
+ * FrameProcessor — per-device pipeline stage runner.
6
+ *
7
+ * Consumes a raw `PipelineInferenceResult` payload and runs:
8
+ * 1. Flatten first-level detections
9
+ * 2. Zone filter (ZoneEngine)
10
+ * 3. Tracking (SortTracker)
11
+ * 4. State analysis (StateAnalyzer)
12
+ * 5. Event emission (DetectionEventEmitter)
13
+ *
14
+ * Returns a structured result the addon uses to:
15
+ * - upsert TrackStore
16
+ * - insert ObjectEvent rows into the declared collection
17
+ * - emit onFrameTracked / onDetectionEvent on the bus
18
+ *
19
+ * One FrameProcessor per device — lifecycle managed by DeviceRegistry.
20
+ */
21
+
22
+ interface TrackedDetectionOut {
23
+ readonly trackId: string;
24
+ readonly className: string;
25
+ readonly confidence: number;
26
+ readonly bbox: {
27
+ x: number;
28
+ y: number;
29
+ w: number;
30
+ h: number;
31
+ };
32
+ readonly zones: readonly string[];
33
+ readonly state: TrackState;
34
+ }
35
+ interface FrameProcessorResult {
36
+ readonly deviceId: number;
37
+ readonly timestamp: number;
38
+ readonly frameWidth: number;
39
+ readonly frameHeight: number;
40
+ readonly tracked: readonly TrackedDetectionOut[];
41
+ readonly objectEvents: readonly ObjectEvent[];
42
+ /** Raw TrackedDetection array — consumed by TrackStore for position
43
+ * history updates. Kept separate from `tracked` which is the
44
+ * lightweight shape consumed by the bus emit. */
45
+ readonly rawTrackedDetections: readonly TrackedDetection[];
46
+ }
47
+
48
+ declare class PipelineAnalyticsAddon extends BaseAddon implements IPipelineAnalyticsProvider {
49
+ private processors;
50
+ private trackStore;
51
+ private mediaStore;
52
+ private eventStore;
53
+ private bindingCache;
54
+ private zoneAnalytics;
55
+ private audioMetrics;
56
+ /**
57
+ * Per-device {@link DeviceProxy} used to read live zones +
58
+ * detection rules off the kernel runtime-state mirror. Replaces
59
+ * the manual DeviceStateChanged subscription + per-cap-name caches
60
+ * — `proxy.state.zones.value` and `proxy.state.zoneRules.value`
61
+ * stay warm as long as the slice handles are subscribed.
62
+ */
63
+ private readonly proxies;
64
+ /** Slice subscription pins for cache warmth + pushed updates into
65
+ * the per-device FrameProcessor. */
66
+ private readonly proxyUnsubs;
67
+ private unsubInference;
68
+ private unsubAudio;
69
+ private unsubMotion;
70
+ private unsubMotionOnboard;
71
+ private unsubBindings;
72
+ private unsubDeviceUnreg;
73
+ private ttlSweepTimer;
74
+ private retentionSweepTimer;
75
+ private readonly lastActiveTrackIds;
76
+ private readonly lastAudioInsertByDevice;
77
+ private readonly lastMotionInsertByDevice;
78
+ private shuttingDown;
79
+ constructor();
80
+ protected onInitialize(): Promise<ProviderRegistration[]>;
81
+ protected onShutdown(): Promise<void>;
82
+ private handleInferenceResult;
83
+ private handleAudioResult;
84
+ /**
85
+ * Persist motion-analysis bus events. Mirrors `handleAudioResult`'s
86
+ * coalescing strategy: emit one row on off→on transition, then one
87
+ * per `MOTION_EVENT_HEARTBEAT_MS` while motion stays detected. No
88
+ * row on off→off (silence) or while heartbeat hasn't elapsed.
89
+ *
90
+ * Gated on the same `pipeline-analytics` wrapper binding as the
91
+ * inference + audio handlers so toggling the wrapper off for a
92
+ * camera stops every kind of event persistence at once.
93
+ */
94
+ private handleMotionAnalysis;
95
+ /**
96
+ * Persist firmware-driven (onboard) motion events. Mirrors
97
+ * {@link handleMotionAnalysis}'s coalescing — one row on off→on
98
+ * transition, then one per `MOTION_EVENT_HEARTBEAT_MS` while motion
99
+ * stays detected — but reads from the {@link MotionOnMotionChangedPayload}
100
+ * shape which lacks frame dimensions and pixel-level region details
101
+ * (firmware reports a binary detected flag plus, on rare devices, a
102
+ * coarse bbox via the optional `regions` field).
103
+ *
104
+ * The same `lastMotionInsertByDevice` map is shared with the analyzer
105
+ * path so a camera that briefly switches `motionSources` between
106
+ * `onboard` and `analyzer` gets consistent throttling — both paths
107
+ * are mutually exclusive at the event-emit layer (the runner only
108
+ * fires `MotionAnalysis` when its analyzer runs; onboard providers
109
+ * never fire `MotionAnalysis`), so there's no double-count risk.
110
+ */
111
+ private handleOnboardMotion;
112
+ private sweepExpiredTracks;
113
+ private sweepRetention;
114
+ private getOrCreateProcessor;
115
+ /**
116
+ * Resolve and cache a {@link DeviceProxy} for a device. Pins the
117
+ * `state.zones` + `state.zoneRules` slice handles so `.value` stays
118
+ * warm via the kernel runtime-state mirror. Slice subscribers also
119
+ * forward updates to the per-device FrameProcessor so a rule change
120
+ * applies to the very next frame even when frames stop briefly
121
+ * (e.g. during binding flips).
122
+ */
123
+ private ensureProxy;
124
+ private releaseProxy;
125
+ getActiveTracks(input: {
126
+ deviceId: number;
127
+ }): Promise<readonly Track[]>;
128
+ getTrack(input: {
129
+ deviceId: number;
130
+ trackId: string;
131
+ }): Promise<Track | null>;
132
+ listTracks(input: {
133
+ deviceId: number;
134
+ since?: number;
135
+ until?: number;
136
+ limit?: number;
137
+ }): Promise<readonly Track[]>;
138
+ clearTracks(input: {
139
+ deviceId: number;
140
+ }): Promise<void>;
141
+ getMotionEvents(input: {
142
+ deviceId: number;
143
+ since?: number;
144
+ until?: number;
145
+ limit?: number;
146
+ }): Promise<readonly MotionEvent[]>;
147
+ getObjectEvents(input: {
148
+ deviceId: number;
149
+ since?: number;
150
+ until?: number;
151
+ classFilter?: string;
152
+ limit?: number;
153
+ }): Promise<readonly ObjectEvent[]>;
154
+ getAudioEvents(input: {
155
+ deviceId: number;
156
+ since?: number;
157
+ until?: number;
158
+ limit?: number;
159
+ }): Promise<readonly AudioEvent[]>;
160
+ getEventMedia(input: {
161
+ eventId: string;
162
+ }): Promise<readonly MediaFile[]>;
163
+ getTrackMedia(input: {
164
+ trackId: string;
165
+ }): Promise<readonly MediaFile[]>;
166
+ protected globalSettingsSchema(): _camstack_types.ConfigUISchema;
167
+ getDeviceSettingsContribution(input: {
168
+ deviceId: number;
169
+ }): Promise<ConfigUISchemaWithValues | null>;
170
+ getDeviceLiveContribution(_input: {
171
+ deviceId: number;
172
+ }): Promise<ConfigUISchemaWithValues | null>;
173
+ applyDeviceSettingsPatch(input: {
174
+ deviceId: number;
175
+ patch: Record<string, unknown>;
176
+ }): Promise<{
177
+ success: true;
178
+ }>;
179
+ /**
180
+ * Best-effort camera-type check. Used to short-circuit the settings
181
+ * contribution on non-camera devices. Returns `true` on lookup
182
+ * failure so a transient device-manager hiccup never silently hides
183
+ * legitimate camera sections.
184
+ */
185
+ private isCameraDevice;
186
+ }
187
+
188
+ type _TrackedDetectionBridge = TrackedDetection;
189
+
190
+ export { type FrameProcessorResult, type TrackedDetectionOut, type _TrackedDetectionBridge, PipelineAnalyticsAddon as default };
@@ -0,0 +1,190 @@
1
+ import * as _camstack_types from '@camstack/types';
2
+ import { TrackState, ObjectEvent, TrackedDetection, BaseAddon, IPipelineAnalyticsProvider, ProviderRegistration, Track, MotionEvent, AudioEvent, MediaFile, ConfigUISchemaWithValues } from '@camstack/types';
3
+
4
+ /**
5
+ * FrameProcessor — per-device pipeline stage runner.
6
+ *
7
+ * Consumes a raw `PipelineInferenceResult` payload and runs:
8
+ * 1. Flatten first-level detections
9
+ * 2. Zone filter (ZoneEngine)
10
+ * 3. Tracking (SortTracker)
11
+ * 4. State analysis (StateAnalyzer)
12
+ * 5. Event emission (DetectionEventEmitter)
13
+ *
14
+ * Returns a structured result the addon uses to:
15
+ * - upsert TrackStore
16
+ * - insert ObjectEvent rows into the declared collection
17
+ * - emit onFrameTracked / onDetectionEvent on the bus
18
+ *
19
+ * One FrameProcessor per device — lifecycle managed by DeviceRegistry.
20
+ */
21
+
22
+ interface TrackedDetectionOut {
23
+ readonly trackId: string;
24
+ readonly className: string;
25
+ readonly confidence: number;
26
+ readonly bbox: {
27
+ x: number;
28
+ y: number;
29
+ w: number;
30
+ h: number;
31
+ };
32
+ readonly zones: readonly string[];
33
+ readonly state: TrackState;
34
+ }
35
+ interface FrameProcessorResult {
36
+ readonly deviceId: number;
37
+ readonly timestamp: number;
38
+ readonly frameWidth: number;
39
+ readonly frameHeight: number;
40
+ readonly tracked: readonly TrackedDetectionOut[];
41
+ readonly objectEvents: readonly ObjectEvent[];
42
+ /** Raw TrackedDetection array — consumed by TrackStore for position
43
+ * history updates. Kept separate from `tracked` which is the
44
+ * lightweight shape consumed by the bus emit. */
45
+ readonly rawTrackedDetections: readonly TrackedDetection[];
46
+ }
47
+
48
+ declare class PipelineAnalyticsAddon extends BaseAddon implements IPipelineAnalyticsProvider {
49
+ private processors;
50
+ private trackStore;
51
+ private mediaStore;
52
+ private eventStore;
53
+ private bindingCache;
54
+ private zoneAnalytics;
55
+ private audioMetrics;
56
+ /**
57
+ * Per-device {@link DeviceProxy} used to read live zones +
58
+ * detection rules off the kernel runtime-state mirror. Replaces
59
+ * the manual DeviceStateChanged subscription + per-cap-name caches
60
+ * — `proxy.state.zones.value` and `proxy.state.zoneRules.value`
61
+ * stay warm as long as the slice handles are subscribed.
62
+ */
63
+ private readonly proxies;
64
+ /** Slice subscription pins for cache warmth + pushed updates into
65
+ * the per-device FrameProcessor. */
66
+ private readonly proxyUnsubs;
67
+ private unsubInference;
68
+ private unsubAudio;
69
+ private unsubMotion;
70
+ private unsubMotionOnboard;
71
+ private unsubBindings;
72
+ private unsubDeviceUnreg;
73
+ private ttlSweepTimer;
74
+ private retentionSweepTimer;
75
+ private readonly lastActiveTrackIds;
76
+ private readonly lastAudioInsertByDevice;
77
+ private readonly lastMotionInsertByDevice;
78
+ private shuttingDown;
79
+ constructor();
80
+ protected onInitialize(): Promise<ProviderRegistration[]>;
81
+ protected onShutdown(): Promise<void>;
82
+ private handleInferenceResult;
83
+ private handleAudioResult;
84
+ /**
85
+ * Persist motion-analysis bus events. Mirrors `handleAudioResult`'s
86
+ * coalescing strategy: emit one row on off→on transition, then one
87
+ * per `MOTION_EVENT_HEARTBEAT_MS` while motion stays detected. No
88
+ * row on off→off (silence) or while heartbeat hasn't elapsed.
89
+ *
90
+ * Gated on the same `pipeline-analytics` wrapper binding as the
91
+ * inference + audio handlers so toggling the wrapper off for a
92
+ * camera stops every kind of event persistence at once.
93
+ */
94
+ private handleMotionAnalysis;
95
+ /**
96
+ * Persist firmware-driven (onboard) motion events. Mirrors
97
+ * {@link handleMotionAnalysis}'s coalescing — one row on off→on
98
+ * transition, then one per `MOTION_EVENT_HEARTBEAT_MS` while motion
99
+ * stays detected — but reads from the {@link MotionOnMotionChangedPayload}
100
+ * shape which lacks frame dimensions and pixel-level region details
101
+ * (firmware reports a binary detected flag plus, on rare devices, a
102
+ * coarse bbox via the optional `regions` field).
103
+ *
104
+ * The same `lastMotionInsertByDevice` map is shared with the analyzer
105
+ * path so a camera that briefly switches `motionSources` between
106
+ * `onboard` and `analyzer` gets consistent throttling — both paths
107
+ * are mutually exclusive at the event-emit layer (the runner only
108
+ * fires `MotionAnalysis` when its analyzer runs; onboard providers
109
+ * never fire `MotionAnalysis`), so there's no double-count risk.
110
+ */
111
+ private handleOnboardMotion;
112
+ private sweepExpiredTracks;
113
+ private sweepRetention;
114
+ private getOrCreateProcessor;
115
+ /**
116
+ * Resolve and cache a {@link DeviceProxy} for a device. Pins the
117
+ * `state.zones` + `state.zoneRules` slice handles so `.value` stays
118
+ * warm via the kernel runtime-state mirror. Slice subscribers also
119
+ * forward updates to the per-device FrameProcessor so a rule change
120
+ * applies to the very next frame even when frames stop briefly
121
+ * (e.g. during binding flips).
122
+ */
123
+ private ensureProxy;
124
+ private releaseProxy;
125
+ getActiveTracks(input: {
126
+ deviceId: number;
127
+ }): Promise<readonly Track[]>;
128
+ getTrack(input: {
129
+ deviceId: number;
130
+ trackId: string;
131
+ }): Promise<Track | null>;
132
+ listTracks(input: {
133
+ deviceId: number;
134
+ since?: number;
135
+ until?: number;
136
+ limit?: number;
137
+ }): Promise<readonly Track[]>;
138
+ clearTracks(input: {
139
+ deviceId: number;
140
+ }): Promise<void>;
141
+ getMotionEvents(input: {
142
+ deviceId: number;
143
+ since?: number;
144
+ until?: number;
145
+ limit?: number;
146
+ }): Promise<readonly MotionEvent[]>;
147
+ getObjectEvents(input: {
148
+ deviceId: number;
149
+ since?: number;
150
+ until?: number;
151
+ classFilter?: string;
152
+ limit?: number;
153
+ }): Promise<readonly ObjectEvent[]>;
154
+ getAudioEvents(input: {
155
+ deviceId: number;
156
+ since?: number;
157
+ until?: number;
158
+ limit?: number;
159
+ }): Promise<readonly AudioEvent[]>;
160
+ getEventMedia(input: {
161
+ eventId: string;
162
+ }): Promise<readonly MediaFile[]>;
163
+ getTrackMedia(input: {
164
+ trackId: string;
165
+ }): Promise<readonly MediaFile[]>;
166
+ protected globalSettingsSchema(): _camstack_types.ConfigUISchema;
167
+ getDeviceSettingsContribution(input: {
168
+ deviceId: number;
169
+ }): Promise<ConfigUISchemaWithValues | null>;
170
+ getDeviceLiveContribution(_input: {
171
+ deviceId: number;
172
+ }): Promise<ConfigUISchemaWithValues | null>;
173
+ applyDeviceSettingsPatch(input: {
174
+ deviceId: number;
175
+ patch: Record<string, unknown>;
176
+ }): Promise<{
177
+ success: true;
178
+ }>;
179
+ /**
180
+ * Best-effort camera-type check. Used to short-circuit the settings
181
+ * contribution on non-camera devices. Returns `true` on lookup
182
+ * failure so a transient device-manager hiccup never silently hides
183
+ * legitimate camera sections.
184
+ */
185
+ private isCameraDevice;
186
+ }
187
+
188
+ type _TrackedDetectionBridge = TrackedDetection;
189
+
190
+ export { type FrameProcessorResult, type TrackedDetectionOut, type _TrackedDetectionBridge, PipelineAnalyticsAddon as default };