@camstack/types 1.1.41 → 1.1.43

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.
@@ -1,5 +1,5 @@
1
1
  import type { FrameResult, AudioResult } from '../types/detection.js';
2
- import type { PipelineExecutionTrace } from '../types/pipeline-step.js';
2
+ import type { PipelineExecutionTrace, StepCadence } from '../types/pipeline-step.js';
3
3
  import type { MotionRegion } from '../capabilities/motion-detection.cap.js';
4
4
  import type { CameraPipelineConfig } from '../types/camera-pipeline.js';
5
5
  import type { CameraMetrics } from './api-shared.js';
@@ -120,6 +120,18 @@ export interface DetectionResultPayload {
120
120
  readonly capturedAt?: number;
121
121
  [key: string]: unknown;
122
122
  }
123
+ /**
124
+ * Child steps enabled for a camera + their scheduling policy, as read
125
+ * from the pipeline catalog. Announced on `PipelineInferenceResultPayload`
126
+ * so a track-level consumer knows which detail-subtree steps it can
127
+ * dispatch via `pipelineRunner.runDetailSubtree` and on what cadence,
128
+ * without a separate round-trip to the executor's schema/config caps.
129
+ */
130
+ export interface DetailStepAnnounce {
131
+ readonly stepId: string;
132
+ readonly inputClasses: readonly string[];
133
+ readonly cadence: StepCadence;
134
+ }
123
135
  /**
124
136
  * Raw inference output emitted by `addon-pipeline-runner` per detection
125
137
  * frame. Carries the FrameResult produced by the runner — the hub-side
@@ -145,6 +157,8 @@ export interface PipelineInferenceResultPayload {
145
157
  * → delivery latency. Undefined when the frame carried no capture stamp.
146
158
  */
147
159
  readonly capturedAt?: number;
160
+ /** Child steps enabled for this camera + their scheduling policy (from the catalog). */
161
+ readonly detailSteps?: readonly DetailStepAnnounce[];
148
162
  readonly [key: string]: unknown;
149
163
  }
150
164
  /**
@@ -1,4 +1,5 @@
1
1
  import type { PipelineEngineChoice, PipelineConfig } from '../types/pipeline.js';
2
+ import type { PipelineExecutionPlane } from '../types/pipeline-step.js';
2
3
  import type { PipelineSchema, PipelineDefaultStep, PipelineTemplateStep, PipelineTemplate } from '../types/pipeline-schema.js';
3
4
  import type { ModelFormat } from '../types/models.js';
4
5
  import type { FrameInput } from '../types/io.js';
@@ -65,6 +66,14 @@ export interface PipelineRunInput {
65
66
  * that omit this field get a generated id.
66
67
  */
67
68
  readonly sessionId?: string;
69
+ /**
70
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
71
+ * reference-image, and detail-subtree calls. 'frame' is the live
72
+ * per-frame dispatch: ONLY root-plane steps run; crop children
73
+ * (inputClasses ≠ null) are skipped and served per-track via
74
+ * pipelineRunner.runDetailSubtree (two-plane design).
75
+ */
76
+ readonly plane?: PipelineExecutionPlane;
68
77
  }
69
78
  /**
70
79
  * Singleton capability provided by the pipeline-executor addon.
@@ -166,4 +166,12 @@ export interface IPipelineRunnerProvider {
166
166
  } & CameraMetrics>;
167
167
  /** List the deviceIds currently attached to this runner. */
168
168
  getLocalCameras(): readonly number[];
169
+ /**
170
+ * Two-plane design: run the DETAIL subtree (crop children — embedding,
171
+ * classifier, refiner steps whose `inputClasses !== null`) for a single
172
+ * tracked detection. See `pipelineRunnerCapability.runDetailSubtree`
173
+ * (`capabilities/pipeline-runner.cap.ts`) for full semantics. Returns
174
+ * `null` when neither `frameHandle` nor `cropJpeg` resolves to a crop.
175
+ */
176
+ runDetailSubtree(input: import('../capabilities/pipeline-runner.cap.js').RunDetailSubtreeInput): Promise<import('../capabilities/pipeline-runner.cap.js').RunDetailSubtreeResult | null>;
169
177
  }
@@ -3408,6 +3408,7 @@ function createDeviceProxy(api, binding, opts) {
3408
3408
  getMotionEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getMotionEvents", "query", input),
3409
3409
  getObjectEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getObjectEvents", "query", input),
3410
3410
  getAudioEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getAudioEvents", "query", input),
3411
+ getKeyEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getKeyEvents", "query", input),
3411
3412
  getEventDensity: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getEventDensity", "query", input),
3412
3413
  pruneEventsBefore: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "pruneEventsBefore", "mutation", input),
3413
3414
  getEventMedia: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getEventMedia", "query", input),
@@ -3625,7 +3626,8 @@ function createDeviceProxy(api, binding, opts) {
3625
3626
  },
3626
3627
  pipelineRunner: {
3627
3628
  detachCamera: (input) => dispatchSystem("pipelineRunner", "detachCamera", "mutation", input),
3628
- getCameraMetrics: (input) => dispatchSystem("pipelineRunner", "getCameraMetrics", "query", input)
3629
+ getCameraMetrics: (input) => dispatchSystem("pipelineRunner", "getCameraMetrics", "query", input),
3630
+ runDetailSubtree: (input) => dispatchSystem("pipelineRunner", "runDetailSubtree", "mutation", input)
3629
3631
  },
3630
3632
  plateGallery: {
3631
3633
  listPlates: (input) => dispatchSystem("plateGallery", "listPlates", "query", input),
@@ -3408,6 +3408,7 @@ function createDeviceProxy(api, binding, opts) {
3408
3408
  getMotionEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getMotionEvents", "query", input),
3409
3409
  getObjectEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getObjectEvents", "query", input),
3410
3410
  getAudioEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getAudioEvents", "query", input),
3411
+ getKeyEvents: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getKeyEvents", "query", input),
3411
3412
  getEventDensity: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getEventDensity", "query", input),
3412
3413
  pruneEventsBefore: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "pruneEventsBefore", "mutation", input),
3413
3414
  getEventMedia: (input) => dispatch("pipeline-analytics", "pipelineAnalytics", "getEventMedia", "query", input),
@@ -3625,7 +3626,8 @@ function createDeviceProxy(api, binding, opts) {
3625
3626
  },
3626
3627
  pipelineRunner: {
3627
3628
  detachCamera: (input) => dispatchSystem("pipelineRunner", "detachCamera", "mutation", input),
3628
- getCameraMetrics: (input) => dispatchSystem("pipelineRunner", "getCameraMetrics", "query", input)
3629
+ getCameraMetrics: (input) => dispatchSystem("pipelineRunner", "getCameraMetrics", "query", input),
3630
+ runDetailSubtree: (input) => dispatchSystem("pipelineRunner", "runDetailSubtree", "mutation", input)
3629
3631
  },
3630
3632
  plateGallery: {
3631
3633
  listPlates: (input) => dispatchSystem("plateGallery", "listPlates", "query", input),
@@ -206,6 +206,18 @@ export interface ObjectDetection extends DetectionBase {
206
206
  /** Model id that produced `embedding` (e.g. `arcface-r100`). Present iff
207
207
  * `embedding` is present — lets consumers skip samples from a stale model. */
208
208
  readonly embeddingModelId?: string;
209
+ /**
210
+ * The EXACT landmark-aligned crop (base64-encoded JPEG) that a face-embedding
211
+ * step fed to the recognizer for THIS `face` detail — i.e. the literal ArcFace
212
+ * model input the `embedding` above was computed from. Present iff an aligned
213
+ * crop was produced (a `faceAlignment` model ran with ≥5 landmarks); absent on
214
+ * the plain-crop fallback and on non-face detections. Lets a gallery display
215
+ * the true embedded crop (1:1 with the embedding, for match debugging) instead
216
+ * of a separately captured natural crop. Small (a 112² JPEG), cheap to carry on
217
+ * the face detail. Only the `face` detail carries it — it is NOT inherited onto
218
+ * the parent person (the person box is not the ArcFace input).
219
+ */
220
+ readonly faceAlignedCrop?: string;
209
221
  }
210
222
  /** Audio detection — flat, time-localised within the window. */
211
223
  export interface AudioDetection extends DetectionBase {
@@ -82,6 +82,28 @@ export interface StepDefinition {
82
82
  * detected with score ≥ 0.7. Configurable per-step via settings.
83
83
  */
84
84
  readonly defaultMinParentScore?: number;
85
+ /**
86
+ * Detail-subtree dispatch cadence — how often a track-level consumer
87
+ * should invoke `pipelineRunner.runDetailSubtree` for this step. Only
88
+ * meaningful for child steps (`inputClasses !== null`); root steps
89
+ * (object-detection, audio-classifier) run on every frame instead and
90
+ * ignore this field. Absent on a child step falls back to the catalog
91
+ * builder's default (`{ trigger: 'once', maxPerTrack: 3 }` — see
92
+ * `PipelineStepBase` in `addon-pipeline`'s step-definitions.ts).
93
+ */
94
+ readonly cadence?: StepCadence;
95
+ }
96
+ /**
97
+ * Scheduling policy for a detail-subtree step, shared by
98
+ * `StepDefinition.cadence` (the catalog authority) and
99
+ * `DetailStepAnnounce.cadence` (the per-camera announce derived from it —
100
+ * see `interfaces/event-bus.ts`).
101
+ */
102
+ export interface StepCadence {
103
+ readonly trigger: 'once' | 'improve' | 'periodic';
104
+ readonly minIntervalMs?: number;
105
+ readonly maxPerTrack?: number;
106
+ readonly stickyOnConfidence?: number;
85
107
  }
86
108
  export interface PoolModelConfig {
87
109
  /** Absolute path to the model file (.mlpackage, .xml, .onnx) */
@@ -158,8 +180,17 @@ export interface MaskOutput {
158
180
  /** Discriminated union for step output — use switch(output.kind) */
159
181
  export type StepOutput = DetectionsOutput | ClassificationsOutput | EmbeddingOutput | TextOutput | MaskOutput;
160
182
  export type TraceVerbosity = 'off' | 'summary' | 'full';
183
+ /**
184
+ * Execution plane for a pipeline run (two-plane design). `'full'` (default)
185
+ * runs the whole tree — benchmark, reference-image, and detail-subtree
186
+ * calls. `'frame'` is the live per-frame dispatch: ONLY root-plane steps
187
+ * (`StepDefinition.inputClasses === null`) run; crop children are skipped
188
+ * and served per-track via a separate detail-subtree call instead.
189
+ */
190
+ export type PipelineExecutionPlane = 'full' | 'frame';
161
191
  export interface PipelineRunOptions {
162
192
  readonly traceVerbosity?: TraceVerbosity;
193
+ readonly plane?: PipelineExecutionPlane;
163
194
  }
164
195
  export interface StepTrace {
165
196
  readonly stepId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.1.41",
3
+ "version": "1.1.43",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",