@camstack/types 0.1.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.
@@ -0,0 +1,798 @@
1
+ import { M as ModelCatalogEntry, a as ModelFormat, C as CustomModelMetadata, b as ModelOutputFormat, c as ClassMapDefinition, D as DetectionModel, L as LabelDefinition } from './index-B9wf2RhV.js';
2
+ export { A as ANIMAL_TYPE_MODELS, d as AUDIO_CLASSIFICATION_MODELS, B as BIRD_NABIRDS_MODELS, e as BIRD_SPECIES_MODELS, f as COCO_80_LABELS, g as COCO_TO_MACRO, F as FACE_DETECTION_MODELS, h as FACE_RECOGNITION_MODELS, i as MACRO_LABELS, j as ModelDownloadOptions, k as ModelDownloadResult, l as ModelFormatEntry, O as OBJECT_DETECTION_MODELS, P as PLATE_DETECTION_MODELS, m as PLATE_RECOGNITION_MODELS, S as SEGMENTATION_MODELS } from './index-B9wf2RhV.js';
3
+ import { ChildProcess } from 'node:child_process';
4
+
5
+ interface BoundingBox {
6
+ readonly x: number;
7
+ readonly y: number;
8
+ readonly w: number;
9
+ readonly h: number;
10
+ }
11
+ interface Landmark {
12
+ readonly x: number;
13
+ readonly y: number;
14
+ readonly label?: string;
15
+ }
16
+ interface FrameInput {
17
+ readonly data: Buffer;
18
+ readonly format: 'jpeg' | 'rgb' | 'yuv420';
19
+ readonly width: number;
20
+ readonly height: number;
21
+ readonly timestamp: number;
22
+ }
23
+ interface AudioChunkInput {
24
+ readonly data: Float32Array;
25
+ readonly sampleRate: number;
26
+ readonly channels: number;
27
+ readonly timestamp: number;
28
+ }
29
+
30
+ interface SpatialDetection {
31
+ readonly class: string;
32
+ readonly originalClass: string;
33
+ readonly score: number;
34
+ readonly bbox: BoundingBox;
35
+ readonly landmarks?: readonly Landmark[];
36
+ readonly mask?: Uint8Array;
37
+ readonly maskWidth?: number;
38
+ readonly maskHeight?: number;
39
+ }
40
+ interface CropInput {
41
+ readonly frame: FrameInput;
42
+ readonly roi: BoundingBox;
43
+ readonly parentDetection: SpatialDetection;
44
+ }
45
+ interface Classification {
46
+ readonly class: string;
47
+ readonly score: number;
48
+ readonly text?: string;
49
+ readonly embedding?: Float32Array;
50
+ readonly metadata?: Readonly<Record<string, unknown>>;
51
+ }
52
+ interface DetectorOutput {
53
+ readonly detections: readonly SpatialDetection[];
54
+ readonly inferenceMs: number;
55
+ readonly modelId: string;
56
+ }
57
+ interface CropperOutput {
58
+ readonly crops: readonly SpatialDetection[];
59
+ readonly inferenceMs: number;
60
+ readonly modelId: string;
61
+ }
62
+ interface ClassifierOutput {
63
+ readonly classifications: readonly Classification[];
64
+ readonly inferenceMs: number;
65
+ readonly modelId: string;
66
+ }
67
+
68
+ type ObjectState = 'entering' | 'moving' | 'stationary' | 'leaving' | 'loitering';
69
+ interface TrackedDetection extends SpatialDetection {
70
+ readonly trackId: string;
71
+ readonly trackAge: number;
72
+ readonly velocity?: {
73
+ readonly dx: number;
74
+ readonly dy: number;
75
+ };
76
+ readonly path: readonly BoundingBox[];
77
+ }
78
+ interface TrackedObjectState {
79
+ readonly trackId: string;
80
+ readonly state: ObjectState;
81
+ readonly stationarySince?: number;
82
+ readonly enteredAt: number;
83
+ readonly totalDistancePx: number;
84
+ readonly dwellTimeMs: number;
85
+ }
86
+
87
+ type DetectionEventType = 'object.detected' | 'object.classified' | 'object.entering' | 'object.leaving' | 'object.stationary' | 'object.loitering' | 'zone.enter' | 'zone.exit' | 'tripwire.cross' | 'audio.detected';
88
+ interface ZoneEvent {
89
+ readonly type: 'zone-enter' | 'zone-exit' | 'zone-loiter' | 'tripwire-cross';
90
+ readonly zoneId: string;
91
+ readonly zoneName: string;
92
+ readonly trackId: string;
93
+ readonly detection: TrackedDetection;
94
+ readonly direction?: 'in' | 'out' | 'left' | 'right';
95
+ readonly timestamp: number;
96
+ }
97
+ interface EventSnapshot {
98
+ readonly thumbnailPath: string;
99
+ readonly annotatedFramePath: string;
100
+ readonly debugThumbnails?: Readonly<Record<string, string>>;
101
+ readonly clipPath?: string;
102
+ readonly clipDurationSec?: number;
103
+ }
104
+ interface DetectionEvent {
105
+ readonly id: string;
106
+ readonly type: DetectionEventType;
107
+ readonly timestamp: number;
108
+ readonly deviceId: string;
109
+ readonly detection: TrackedDetection;
110
+ readonly classifications: readonly Classification[];
111
+ readonly objectState: TrackedObjectState;
112
+ readonly zoneEvents: readonly ZoneEvent[];
113
+ readonly snapshot?: EventSnapshot;
114
+ readonly trackPath: readonly BoundingBox[];
115
+ }
116
+
117
+ type DetectionRuntime = 'onnx' | 'coreml' | 'pytorch' | 'openvino' | 'tflite';
118
+ type DetectionDevice = 'cpu' | 'gpu-cuda' | 'gpu-mps' | 'npu' | 'coral-edgetpu' | 'tensorrt';
119
+ type ProbeCapability = 'fp32' | 'fp16' | 'int8' | 'batch-inference';
120
+ interface ProbeResult {
121
+ readonly available: boolean;
122
+ readonly runtime: DetectionRuntime;
123
+ readonly device: DetectionDevice;
124
+ readonly capabilities: readonly ProbeCapability[];
125
+ readonly estimatedMemoryMB?: number;
126
+ }
127
+ interface CameraAnalysisConfig {
128
+ readonly tracker: {
129
+ readonly maxAge: number;
130
+ readonly minHits: number;
131
+ readonly iouThreshold: number;
132
+ };
133
+ readonly stateAnalyzer: {
134
+ readonly stationaryThresholdSec: number;
135
+ readonly loiteringThresholdSec: number;
136
+ readonly velocityThreshold: number;
137
+ };
138
+ readonly snapshots: {
139
+ readonly enabled: boolean;
140
+ readonly saveThumbnail: boolean;
141
+ readonly saveAnnotatedFrame: boolean;
142
+ readonly saveDebugThumbnails: boolean;
143
+ readonly clipPreSec: number;
144
+ readonly clipPostSec: number;
145
+ };
146
+ readonly events: {
147
+ readonly minTrackAge: number;
148
+ readonly cooldownSec: number;
149
+ readonly enabledTypes: readonly DetectionEventType[];
150
+ };
151
+ }
152
+
153
+ interface ZoneDefinition {
154
+ readonly id: string;
155
+ readonly name: string;
156
+ readonly cameraId: string;
157
+ readonly type: 'polygon' | 'tripwire';
158
+ readonly points: ReadonlyArray<{
159
+ readonly x: number;
160
+ readonly y: number;
161
+ }>;
162
+ readonly direction?: 'in' | 'out' | 'both';
163
+ readonly alertOnClasses?: readonly string[];
164
+ readonly color?: string;
165
+ }
166
+ interface KnownFace {
167
+ readonly id: string;
168
+ readonly name: string;
169
+ readonly label?: string;
170
+ readonly embeddings: readonly Float32Array[];
171
+ readonly thumbnailPath?: string;
172
+ readonly createdAt: number;
173
+ }
174
+ interface KnownPlate {
175
+ readonly id: string;
176
+ readonly plateText: string;
177
+ readonly label?: string;
178
+ readonly vehicleDescription?: string;
179
+ readonly createdAt: number;
180
+ }
181
+ interface KnownAudioEvent {
182
+ readonly id: string;
183
+ readonly className: string;
184
+ readonly label: string;
185
+ readonly notifyAlways: boolean;
186
+ }
187
+
188
+ type PipelineSlot = 'detector' | 'cropper' | 'classifier';
189
+ interface PipelineNode {
190
+ readonly step: string;
191
+ readonly addon: string;
192
+ readonly configOverride?: Readonly<Record<string, unknown>>;
193
+ readonly children?: readonly PipelineNode[];
194
+ }
195
+ interface PipelineConfig {
196
+ readonly video: readonly PipelineNode[];
197
+ readonly audio?: PipelineNode;
198
+ }
199
+ interface PipelineStatus {
200
+ readonly addon: string;
201
+ readonly slot: PipelineSlot;
202
+ readonly state: 'initializing' | 'ready' | 'running' | 'error';
203
+ readonly error?: string;
204
+ readonly lastRunMs?: number;
205
+ }
206
+ interface StepError {
207
+ readonly code: string;
208
+ readonly message: string;
209
+ readonly childrenSkipped: boolean;
210
+ }
211
+ interface StepResult {
212
+ readonly addon: string;
213
+ readonly slot: PipelineSlot;
214
+ readonly output: DetectorOutput | CropperOutput | ClassifierOutput;
215
+ readonly parentResultId?: string;
216
+ readonly resultId: string;
217
+ readonly inferenceMs: number;
218
+ readonly preprocessMs: number;
219
+ readonly totalMs: number;
220
+ readonly error?: StepError;
221
+ }
222
+ interface PipelineResult {
223
+ readonly results: readonly StepResult[];
224
+ readonly totalMs: number;
225
+ readonly timings: Readonly<Record<string, number>>;
226
+ readonly frameTimestamp: number;
227
+ }
228
+
229
+ interface TrackedObjectSummary {
230
+ readonly trackId: string;
231
+ readonly class: string;
232
+ readonly originalClass: string;
233
+ readonly state: ObjectState;
234
+ readonly bbox: BoundingBox;
235
+ readonly velocity: {
236
+ readonly dx: number;
237
+ readonly dy: number;
238
+ };
239
+ readonly dwellTimeMs: number;
240
+ readonly inZones: readonly string[];
241
+ readonly identity?: string;
242
+ readonly plateText?: string;
243
+ readonly subClass?: string;
244
+ }
245
+ interface ZoneLiveState {
246
+ readonly zoneId: string;
247
+ readonly zoneName: string;
248
+ readonly occupied: boolean;
249
+ readonly objectCount: number;
250
+ readonly objectsByClass: Readonly<Record<string, number>>;
251
+ readonly trackIds: readonly string[];
252
+ readonly avgDwellTimeMs: number;
253
+ readonly totalEntrancesToday: number;
254
+ readonly totalExitsToday: number;
255
+ readonly loiteringTracks: readonly string[];
256
+ }
257
+ interface CameraLiveState {
258
+ readonly deviceId: string;
259
+ readonly lastFrameTimestamp: number;
260
+ readonly activeObjects: number;
261
+ readonly movingObjects: number;
262
+ readonly stationaryObjects: number;
263
+ readonly objectCounts: Readonly<Record<string, number>>;
264
+ readonly tracks: readonly TrackedObjectSummary[];
265
+ readonly zones: readonly ZoneLiveState[];
266
+ readonly lastEvent?: DetectionEvent;
267
+ readonly pipelineStatus: readonly PipelineStatus[];
268
+ readonly avgPipelineMs: number;
269
+ readonly currentFps: number;
270
+ }
271
+
272
+ interface TrackFilter {
273
+ readonly class?: readonly string[];
274
+ readonly state?: readonly ObjectState[];
275
+ readonly inZone?: string;
276
+ readonly minDwellMs?: number;
277
+ }
278
+ interface TimeRangeOptions {
279
+ readonly from: number;
280
+ readonly to: number;
281
+ readonly resolution: 'minute' | '5min' | 'hour';
282
+ }
283
+ interface ZoneHistoryPoint {
284
+ readonly timestamp: number;
285
+ readonly objectCount: number;
286
+ readonly objectsByClass: Readonly<Record<string, number>>;
287
+ readonly entrances: number;
288
+ readonly exits: number;
289
+ }
290
+ interface HeatmapOptions {
291
+ readonly from: number;
292
+ readonly to: number;
293
+ readonly class?: string;
294
+ readonly resolution: number;
295
+ }
296
+ interface HeatmapData {
297
+ readonly width: number;
298
+ readonly height: number;
299
+ readonly gridSize: number;
300
+ readonly cells: Float32Array;
301
+ readonly maxCount: number;
302
+ }
303
+ interface TrackDetail {
304
+ readonly trackId: string;
305
+ readonly class: string;
306
+ readonly originalClass: string;
307
+ readonly state: ObjectState;
308
+ readonly firstSeen: number;
309
+ readonly lastSeen: number;
310
+ readonly totalDwellMs: number;
311
+ readonly path: ReadonlyArray<{
312
+ readonly timestamp: number;
313
+ readonly bbox: BoundingBox;
314
+ readonly velocity: {
315
+ readonly dx: number;
316
+ readonly dy: number;
317
+ };
318
+ }>;
319
+ readonly identity?: {
320
+ readonly name: string;
321
+ readonly confidence: number;
322
+ readonly matchedAt: number;
323
+ };
324
+ readonly plateText?: {
325
+ readonly text: string;
326
+ readonly confidence: number;
327
+ readonly readAt: number;
328
+ };
329
+ readonly subClass?: {
330
+ readonly class: string;
331
+ readonly confidence: number;
332
+ };
333
+ readonly zoneTransitions: ReadonlyArray<{
334
+ readonly zoneId: string;
335
+ readonly zoneName: string;
336
+ readonly entered: number;
337
+ readonly exited?: number;
338
+ readonly dwellMs: number;
339
+ }>;
340
+ readonly bestSnapshot?: EventSnapshot;
341
+ readonly events: readonly DetectionEvent[];
342
+ }
343
+
344
+ type BenchmarkMode = 'single-addon' | 'full-pipeline' | 'compare-runtimes' | 'compare-models';
345
+ type BenchmarkSource = {
346
+ readonly type: 'reference';
347
+ readonly images: 'all' | readonly string[];
348
+ } | {
349
+ readonly type: 'camera';
350
+ readonly deviceId: string;
351
+ readonly durationSec: number;
352
+ };
353
+ type BenchmarkExecution = {
354
+ readonly type: 'local';
355
+ } | {
356
+ readonly type: 'agent';
357
+ readonly agentId: string;
358
+ } | {
359
+ readonly type: 'multi-agent';
360
+ readonly agentIds: readonly string[];
361
+ } | {
362
+ readonly type: 'all-agents';
363
+ };
364
+ interface BenchmarkTarget {
365
+ readonly label: string;
366
+ readonly addonId: string;
367
+ readonly config: Readonly<Record<string, unknown>>;
368
+ }
369
+ interface BenchmarkConfig {
370
+ readonly mode: BenchmarkMode;
371
+ readonly source: BenchmarkSource;
372
+ readonly execution: BenchmarkExecution;
373
+ readonly iterations?: number;
374
+ readonly warmup?: number;
375
+ readonly targets: readonly BenchmarkTarget[];
376
+ }
377
+ interface LatencyStats {
378
+ readonly mean: number;
379
+ readonly median: number;
380
+ readonly p95: number;
381
+ readonly p99: number;
382
+ readonly min: number;
383
+ readonly max: number;
384
+ }
385
+ interface ResourceStats {
386
+ readonly peakMemoryMB: number;
387
+ readonly avgCpuPercent: number;
388
+ readonly avgGpuPercent?: number;
389
+ }
390
+ interface AccuracyStats {
391
+ readonly mAP50?: number;
392
+ readonly precision?: number;
393
+ readonly recall?: number;
394
+ }
395
+ interface SystemInfo {
396
+ readonly os: string;
397
+ readonly arch: string;
398
+ readonly cpuModel: string;
399
+ readonly cpuCores: number;
400
+ readonly totalMemoryMB: number;
401
+ readonly gpuModel?: string;
402
+ readonly pythonVersion?: string;
403
+ readonly nodeVersion: string;
404
+ }
405
+ interface BenchmarkTargetResult {
406
+ readonly label: string;
407
+ readonly addonId: string;
408
+ readonly config: Readonly<Record<string, unknown>>;
409
+ readonly latency: LatencyStats;
410
+ readonly fps: number;
411
+ readonly accuracy?: AccuracyStats;
412
+ readonly resources: ResourceStats;
413
+ readonly stepBreakdown?: Readonly<Record<string, {
414
+ readonly meanMs: number;
415
+ readonly percentOfTotal: number;
416
+ }>>;
417
+ }
418
+ type AgentBenchmarkStatus = 'completed' | 'partial' | 'failed' | 'disconnected';
419
+ interface MultiBenchmarkReport {
420
+ readonly timestamp: string;
421
+ readonly source: BenchmarkSource;
422
+ readonly agents: ReadonlyArray<{
423
+ readonly agentId: string;
424
+ readonly status: AgentBenchmarkStatus;
425
+ readonly systemInfo: SystemInfo;
426
+ readonly results: readonly BenchmarkTargetResult[];
427
+ readonly error?: string;
428
+ readonly completedIterations?: number;
429
+ }>;
430
+ readonly leaderboard: ReadonlyArray<{
431
+ readonly rank: number;
432
+ readonly agentId: string;
433
+ readonly label: string;
434
+ readonly meanMs: number;
435
+ readonly fps: number;
436
+ readonly peakMemoryMB: number;
437
+ readonly accuracy?: AccuracyStats;
438
+ }>;
439
+ }
440
+ interface GroundTruthAnnotation {
441
+ readonly class: string;
442
+ readonly originalClass?: string;
443
+ readonly bbox: BoundingBox;
444
+ readonly children?: readonly GroundTruthAnnotation[];
445
+ readonly identity?: string;
446
+ readonly plateText?: string;
447
+ readonly species?: string;
448
+ readonly vehicleType?: string;
449
+ }
450
+ interface GroundTruth {
451
+ readonly image: string;
452
+ readonly annotations: readonly GroundTruthAnnotation[];
453
+ }
454
+
455
+ interface ConfigFieldBase {
456
+ readonly key: string;
457
+ readonly label: string;
458
+ readonly description?: string;
459
+ readonly required?: boolean;
460
+ readonly dependsOn?: Readonly<Record<string, unknown>>;
461
+ }
462
+ interface ConfigTextField extends ConfigFieldBase {
463
+ readonly type: 'text';
464
+ readonly placeholder?: string;
465
+ }
466
+ interface ConfigNumberField extends ConfigFieldBase {
467
+ readonly type: 'number';
468
+ readonly min?: number;
469
+ readonly max?: number;
470
+ readonly step?: number;
471
+ }
472
+ interface ConfigBooleanField extends ConfigFieldBase {
473
+ readonly type: 'boolean';
474
+ }
475
+ interface ConfigSelectField extends ConfigFieldBase {
476
+ readonly type: 'select';
477
+ readonly options: ReadonlyArray<{
478
+ readonly value: string;
479
+ readonly label: string;
480
+ }>;
481
+ }
482
+ interface ConfigSliderField extends ConfigFieldBase {
483
+ readonly type: 'slider';
484
+ readonly min: number;
485
+ readonly max: number;
486
+ readonly step: number;
487
+ readonly default: number;
488
+ }
489
+ interface ConfigModelSelectorField extends ConfigFieldBase {
490
+ readonly type: 'model-selector';
491
+ readonly catalog: readonly ModelCatalogEntry[];
492
+ readonly allowCustom: boolean;
493
+ readonly acceptFormats?: readonly ModelFormat[];
494
+ readonly allowConversion?: boolean;
495
+ readonly requiredMetadata: readonly (keyof CustomModelMetadata)[];
496
+ readonly outputFormatHint?: ModelOutputFormat;
497
+ }
498
+ type ConfigField = ConfigTextField | ConfigNumberField | ConfigBooleanField | ConfigSelectField | ConfigSliderField | ConfigModelSelectorField;
499
+ interface ConfigSection {
500
+ readonly id: string;
501
+ readonly title: string;
502
+ readonly description?: string;
503
+ readonly style?: 'card' | 'accordion';
504
+ readonly columns?: 1 | 2 | 3 | 4;
505
+ readonly fields: readonly ConfigField[];
506
+ }
507
+ interface ConfigUISchema {
508
+ readonly sections: readonly ConfigSection[];
509
+ }
510
+
511
+ interface RouteRequest {
512
+ readonly params: Readonly<Record<string, string>>;
513
+ readonly query: Readonly<Record<string, string | string[]>>;
514
+ readonly headers: Readonly<Record<string, string | undefined>>;
515
+ readonly body?: unknown;
516
+ }
517
+ interface RouteResponse {
518
+ status(code: number): RouteResponse;
519
+ json(data: unknown): void;
520
+ send(data: string | Buffer): void;
521
+ sendFile(path: string): void;
522
+ header(name: string, value: string): RouteResponse;
523
+ }
524
+ type RouteHandler = (req: RouteRequest, res: RouteResponse) => void | Promise<void>;
525
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
526
+ interface IAddonRouter {
527
+ /** Public route — no auth required */
528
+ public(method: HttpMethod, path: string, handler: RouteHandler): void;
529
+ /** Protected route — requires valid JWT or API key */
530
+ protected(method: HttpMethod, path: string, handler: RouteHandler): void;
531
+ /** Admin route — requires admin role */
532
+ admin(method: HttpMethod, path: string, handler: RouteHandler): void;
533
+ /** Serve static directory */
534
+ static(urlPath: string, directory: string, options?: {
535
+ auth?: boolean;
536
+ }): void;
537
+ /** Get the base URL prefix for this addon's routes */
538
+ getBaseUrl(): string;
539
+ }
540
+
541
+ interface NetworkAddress {
542
+ readonly host: string;
543
+ readonly port: number;
544
+ readonly protocol: 'http' | 'https';
545
+ }
546
+ interface PublicAddress {
547
+ readonly url: string;
548
+ readonly provider: string;
549
+ }
550
+ interface INetworkProvider {
551
+ getLocalAddress(): NetworkAddress;
552
+ getPublicAddress(): PublicAddress | null;
553
+ registerRemoteAccess(provider: IRemoteAccessProvider): void;
554
+ unregisterRemoteAccess(providerId: string): void;
555
+ onPublicAddressChange(callback: (address: PublicAddress | null) => void): () => void;
556
+ }
557
+ type RemoteAccessStatus = 'connected' | 'connecting' | 'disconnected' | 'error';
558
+ interface IRemoteAccessProvider {
559
+ readonly id: string;
560
+ readonly name: string;
561
+ getPublicUrl(): string | null;
562
+ getStatus(): RemoteAccessStatus;
563
+ start(): Promise<void>;
564
+ stop(): Promise<void>;
565
+ onStatusChange?(callback: (status: RemoteAccessStatus) => void): () => void;
566
+ }
567
+ interface ITurnProvider {
568
+ readonly id: string;
569
+ readonly name: string;
570
+ getCredentials(): Promise<TurnCredentials>;
571
+ getServers(): TurnServer[];
572
+ }
573
+ interface TurnCredentials {
574
+ readonly username: string;
575
+ readonly credential: string;
576
+ readonly ttl: number;
577
+ }
578
+ interface TurnServer {
579
+ readonly urls: string;
580
+ readonly username?: string;
581
+ readonly credential?: string;
582
+ }
583
+
584
+ type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'verbose';
585
+ interface IScopedLogger {
586
+ error(message: string, ...meta: unknown[]): void;
587
+ warn(message: string, ...meta: unknown[]): void;
588
+ info(message: string, ...meta: unknown[]): void;
589
+ debug(message: string, ...meta: unknown[]): void;
590
+ verbose(message: string, ...meta: unknown[]): void;
591
+ child(scope: string): IScopedLogger;
592
+ }
593
+ interface ILogDestination {
594
+ readonly id: string;
595
+ readonly name: string;
596
+ write(level: LogLevel, scope: string, message: string, meta?: unknown): void;
597
+ }
598
+
599
+ type EventCallback<T = unknown> = (data: T) => void;
600
+ interface IEventBus {
601
+ on<T = unknown>(event: string, callback: EventCallback<T>): () => void;
602
+ once<T = unknown>(event: string, callback: EventCallback<T>): () => void;
603
+ emit<T = unknown>(event: string, data: T): void;
604
+ removeAllListeners(event?: string): void;
605
+ }
606
+
607
+ type StorageLocationName = 'data' | 'media' | 'recordings' | 'models' | 'cache' | 'logs';
608
+ interface IStorageBackend {
609
+ resolve(location: StorageLocationName, ...segments: string[]): string;
610
+ isAvailable(location: StorageLocationName): boolean;
611
+ initialize(): Promise<void>;
612
+ getLocationPath(location: StorageLocationName): string;
613
+ }
614
+ interface IStorageProvider {
615
+ getLocation(name: string): string;
616
+ setLocationPath(name: StorageLocationName, absolutePath: string): void;
617
+ }
618
+
619
+ interface RequiredStep {
620
+ readonly slot: PipelineSlot;
621
+ readonly outputClasses: readonly string[];
622
+ readonly description: string;
623
+ }
624
+ interface AddonManifest {
625
+ readonly id: string;
626
+ readonly name: string;
627
+ readonly version: string;
628
+ readonly description: string;
629
+ readonly packageName: string;
630
+ readonly slot?: PipelineSlot;
631
+ readonly inputClasses?: readonly string[];
632
+ readonly outputClasses?: readonly string[];
633
+ readonly requiredSteps?: readonly RequiredStep[];
634
+ readonly supportsCustomModels?: boolean;
635
+ readonly mayRequirePython?: boolean;
636
+ readonly defaultConfig?: Readonly<Record<string, unknown>>;
637
+ }
638
+ interface AddonLocationPaths {
639
+ readonly data: string;
640
+ readonly media: string;
641
+ readonly models: string;
642
+ readonly logs: string;
643
+ readonly cache: string;
644
+ }
645
+ interface AddonContext {
646
+ readonly addonConfig: Readonly<Record<string, unknown>>;
647
+ readonly locationPaths: AddonLocationPaths;
648
+ readonly router?: IAddonRouter;
649
+ readonly network?: INetworkProvider;
650
+ readonly logger?: IScopedLogger;
651
+ readonly eventBus?: IEventBus;
652
+ readonly storage?: IStorageProvider;
653
+ }
654
+ interface ICamstackAddon {
655
+ readonly id: string;
656
+ readonly manifest: AddonManifest;
657
+ initialize(context: AddonContext): Promise<void>;
658
+ shutdown(): Promise<void>;
659
+ getConfigSchema?(): ConfigUISchema;
660
+ }
661
+ interface AddonDeclaration {
662
+ readonly id: string;
663
+ readonly entry: string;
664
+ readonly slot: PipelineSlot;
665
+ }
666
+ interface AddonPackageManifest {
667
+ readonly addons: readonly AddonDeclaration[];
668
+ }
669
+
670
+ interface IPipelineSlotProvider {
671
+ readonly slot: PipelineSlot;
672
+ readonly inputClasses: readonly string[] | null;
673
+ readonly outputClasses: readonly string[];
674
+ readonly requiredSteps?: readonly RequiredStep[];
675
+ readonly slotPriority: number;
676
+ }
677
+
678
+ interface IDetectorProvider extends IPipelineSlotProvider {
679
+ readonly slot: 'detector';
680
+ detect(frame: FrameInput): Promise<DetectorOutput>;
681
+ }
682
+
683
+ interface ICropperProvider extends IPipelineSlotProvider {
684
+ readonly slot: 'cropper';
685
+ crop(input: CropInput): Promise<CropperOutput>;
686
+ }
687
+
688
+ interface IClassifierProvider extends IPipelineSlotProvider {
689
+ readonly slot: 'classifier';
690
+ classify(input: CropInput): Promise<ClassifierOutput>;
691
+ }
692
+
693
+ interface IDetectionAddon extends ICamstackAddon, IPipelineSlotProvider {
694
+ getConfigSchema(): ConfigUISchema;
695
+ getClassMap(): ClassMapDefinition;
696
+ getModelCatalog(): ModelCatalogEntry[];
697
+ getAvailableModels(): DetectionModel[];
698
+ getActiveLabels(): readonly LabelDefinition[];
699
+ probe(): Promise<ProbeResult>;
700
+ }
701
+
702
+ interface IInferenceEngine {
703
+ readonly runtime: DetectionRuntime;
704
+ readonly device: DetectionDevice;
705
+ run(input: Float32Array, inputShape: readonly number[]): Promise<Float32Array>;
706
+ /** Run inference and return all named output tensors. Used by multi-output models (e.g. YOLO-seg). */
707
+ runMultiOutput(input: Float32Array, inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
708
+ dispose(): Promise<void>;
709
+ }
710
+ interface ResolveEngineOptions {
711
+ readonly runtime: DetectionRuntime | 'auto';
712
+ readonly backend: string;
713
+ readonly modelEntry: ModelCatalogEntry;
714
+ readonly modelsDir: string;
715
+ }
716
+
717
+ interface IZoneRepository {
718
+ getByCamera(cameraId: string): Promise<ZoneDefinition[]>;
719
+ save(zone: ZoneDefinition): Promise<void>;
720
+ delete(zoneId: string): Promise<void>;
721
+ }
722
+ interface IKnownFaceRepository {
723
+ getAll(): Promise<KnownFace[]>;
724
+ findByEmbedding(embedding: Float32Array, threshold: number): Promise<KnownFace | null>;
725
+ save(face: KnownFace): Promise<void>;
726
+ addEmbedding(faceId: string, embedding: Float32Array): Promise<void>;
727
+ delete(faceId: string): Promise<void>;
728
+ }
729
+ interface IKnownPlateRepository {
730
+ getAll(): Promise<KnownPlate[]>;
731
+ findByText(text: string): Promise<KnownPlate | null>;
732
+ save(plate: KnownPlate): Promise<void>;
733
+ delete(plateId: string): Promise<void>;
734
+ }
735
+
736
+ interface ICameraAnalyticsProvider {
737
+ getLiveState(deviceId: string): CameraLiveState | null;
738
+ getTracks(deviceId: string, filter?: TrackFilter): TrackedObjectSummary[];
739
+ getZoneState(deviceId: string, zoneId: string): ZoneLiveState | null;
740
+ getZoneHistory(deviceId: string, zoneId: string, options: TimeRangeOptions): Promise<ZoneHistoryPoint[]>;
741
+ getHeatmap(deviceId: string, options: HeatmapOptions): Promise<HeatmapData>;
742
+ getTrackDetail(deviceId: string, trackId: string): TrackDetail | null;
743
+ getCameraStatus(deviceId: string): PipelineStatus[];
744
+ }
745
+ interface IAnalysisAddon extends ICamstackAddon, ICameraAnalyticsProvider {
746
+ processFrame(deviceId: string, frame: FrameInput): Promise<DetectionEvent[]>;
747
+ setCameraPipeline(deviceId: string, config: PipelineConfig): void;
748
+ setCameraZones(deviceId: string, zones: ZoneDefinition[]): void;
749
+ setKnownFaces(faces: KnownFace[]): void;
750
+ setKnownPlates(plates: KnownPlate[]): void;
751
+ onLiveStateChange(deviceId: string, callback: (state: CameraLiveState) => void): () => void;
752
+ }
753
+
754
+ interface PythonProbeResult {
755
+ readonly available: boolean;
756
+ readonly version?: string;
757
+ readonly path?: string;
758
+ readonly installedPackages?: readonly string[];
759
+ }
760
+ interface PythonEnvReady {
761
+ readonly pythonPath: string;
762
+ readonly venvPath: string;
763
+ spawn(script: string, args: readonly string[]): ChildProcess;
764
+ }
765
+ interface IPythonEnvironment {
766
+ probe(): Promise<PythonProbeResult>;
767
+ ensure(options: {
768
+ readonly packages: readonly string[];
769
+ }): Promise<PythonEnvReady>;
770
+ spawn(script: string, args: readonly string[]): ChildProcess;
771
+ }
772
+
773
+ interface IPipelineRunner {
774
+ run(frame: FrameInput, config?: PipelineConfig): Promise<PipelineResult>;
775
+ runSingle(addonId: string, input: FrameInput | CropInput, config?: Record<string, unknown>): Promise<StepResult>;
776
+ getStatus(): PipelineStatus[];
777
+ }
778
+ interface ValidationIssue {
779
+ readonly step?: string;
780
+ readonly addon?: string;
781
+ readonly message: string;
782
+ readonly severity: 'error' | 'warning';
783
+ }
784
+ interface ValidationResult {
785
+ readonly valid: boolean;
786
+ readonly errors: readonly ValidationIssue[];
787
+ readonly warnings: readonly ValidationIssue[];
788
+ }
789
+ interface IPipelineValidator {
790
+ validate(config: PipelineConfig): ValidationResult;
791
+ }
792
+
793
+ declare const HF_REPO = "camstack/camstack-models";
794
+ declare const HF_BASE_URL = "https://huggingface.co/camstack/camstack-models/resolve/main";
795
+
796
+ declare function hfModelUrl(repo: string, path: string): string;
797
+
798
+ export { type AccuracyStats, type AddonContext, type AddonDeclaration, type AddonLocationPaths, type AddonManifest, type AddonPackageManifest, type AgentBenchmarkStatus, type AudioChunkInput, type BenchmarkConfig, type BenchmarkExecution, type BenchmarkMode, type BenchmarkSource, type BenchmarkTarget, type BenchmarkTargetResult, type BoundingBox, type CameraAnalysisConfig, type CameraLiveState, ClassMapDefinition, type Classification, type ClassifierOutput, type ConfigBooleanField, type ConfigField, type ConfigFieldBase, type ConfigModelSelectorField, type ConfigNumberField, type ConfigSection, type ConfigSelectField, type ConfigSliderField, type ConfigTextField, type ConfigUISchema, type CropInput, type CropperOutput, CustomModelMetadata, type DetectionDevice, type DetectionEvent, type DetectionEventType, DetectionModel, type DetectionRuntime, type DetectorOutput, type EventCallback, type EventSnapshot, type FrameInput, type GroundTruth, type GroundTruthAnnotation, HF_BASE_URL, HF_REPO, type HeatmapData, type HeatmapOptions, type HttpMethod, type IAddonRouter, type IAnalysisAddon, type ICameraAnalyticsProvider, type ICamstackAddon, type IClassifierProvider, type ICropperProvider, type IDetectionAddon, type IDetectorProvider, type IEventBus, type IInferenceEngine, type IKnownFaceRepository, type IKnownPlateRepository, type ILogDestination, type INetworkProvider, type IPipelineRunner, type IPipelineSlotProvider, type IPipelineValidator, type IPythonEnvironment, type IRemoteAccessProvider, type IScopedLogger, type IStorageBackend, type IStorageProvider, type ITurnProvider, type IZoneRepository, type KnownAudioEvent, type KnownFace, type KnownPlate, LabelDefinition, type Landmark, type LatencyStats, type LogLevel, ModelCatalogEntry, ModelFormat, ModelOutputFormat, type MultiBenchmarkReport, type NetworkAddress, type ObjectState, type PipelineConfig, type PipelineNode, type PipelineResult, type PipelineSlot, type PipelineStatus, type ProbeCapability, type ProbeResult, type PublicAddress, type PythonEnvReady, type PythonProbeResult, type RemoteAccessStatus, type RequiredStep, type ResolveEngineOptions, type ResourceStats, type RouteHandler, type RouteRequest, type RouteResponse, type SpatialDetection, type StepError, type StepResult, type StorageLocationName, type SystemInfo, type TimeRangeOptions, type TrackDetail, type TrackFilter, type TrackedDetection, type TrackedObjectState, type TrackedObjectSummary, type TurnCredentials, type TurnServer, type ValidationIssue, type ValidationResult, type ZoneDefinition, type ZoneEvent, type ZoneHistoryPoint, type ZoneLiveState, hfModelUrl };