@camstack/types 1.2.308 → 1.2.310

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 (39) hide show
  1. package/dist/addon.js +1 -1
  2. package/dist/addon.mjs +1 -1
  3. package/dist/capabilities/custom-model-registry.cap.d.ts +38 -4
  4. package/dist/capabilities/device-manager.cap.d.ts +8 -8
  5. package/dist/capabilities/hub-address.d.ts +123 -0
  6. package/dist/capabilities/index.d.ts +4 -3
  7. package/dist/capabilities/local-network.cap.d.ts +605 -11
  8. package/dist/capabilities/model-convert.cap.d.ts +19 -2
  9. package/dist/capabilities/model-distributor.cap.d.ts +38 -4
  10. package/dist/capabilities/pipeline-executor.cap.d.ts +124 -10
  11. package/dist/capabilities/pipeline-runner.cap.d.ts +13 -0
  12. package/dist/capabilities/webrtc-session.cap.d.ts +36 -0
  13. package/dist/catalogs/frigate-plus-classmap.d.ts +10 -7
  14. package/dist/catalogs/index.d.ts +1 -1
  15. package/dist/catalogs/root-model-supply.d.ts +202 -0
  16. package/dist/client.js +55 -49
  17. package/dist/client.mjs +55 -49
  18. package/dist/device/location-icon.d.ts +4 -4
  19. package/dist/device/site-zone.d.ts +2 -2
  20. package/dist/ffmpeg/pinned-spawn.d.ts +1 -1
  21. package/dist/generated/addon-api.d.ts +40 -0
  22. package/dist/generated/method-access-map.d.ts +1 -1
  23. package/dist/generated/method-device-selectors.d.ts +1 -1
  24. package/dist/generated/system-proxy.d.ts +1 -1
  25. package/dist/index.d.ts +2 -1
  26. package/dist/index.js +1351 -641
  27. package/dist/index.mjs +1310 -629
  28. package/dist/interfaces/event-bus.d.ts +12 -6
  29. package/dist/interfaces/pipeline-executor-capability.d.ts +6 -1
  30. package/dist/node.js +1 -1
  31. package/dist/node.mjs +1 -1
  32. package/dist/pipeline/root-face-crop.d.ts +31 -0
  33. package/dist/{sleep-DXKLNFvA.mjs → sleep-C16NCZR2.mjs} +1 -0
  34. package/dist/{sleep-C3gDpn7G.js → sleep-DyF95STh.js} +1 -0
  35. package/dist/types/detection.d.ts +9 -0
  36. package/dist/types/models.d.ts +69 -8
  37. package/dist/types/pipeline-step.d.ts +6 -0
  38. package/package.json +1 -1
  39. package/dist/catalogs/classifier-fill.d.ts +0 -104
@@ -279,7 +279,8 @@ export declare const modelConvertCapability: {
279
279
  }>>;
280
280
  preserveOriginal: z.ZodBoolean;
281
281
  }, z.core.$strip>>;
282
- fillsClassifierEffects: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
282
+ suppliesSteps: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
283
+ kind: z.ZodLiteral<"label">;
283
284
  stepId: z.ZodEnum<{
284
285
  "animal-classifier": "animal-classifier";
285
286
  "vehicle-classifier": "vehicle-classifier";
@@ -287,7 +288,23 @@ export declare const modelConvertCapability: {
287
288
  }>;
288
289
  labelToEffect: z.ZodRecord<z.ZodString, z.ZodString>;
289
290
  uncovered: z.ZodReadonly<z.ZodArray<z.ZodString>>;
290
- }, z.core.$strip>>>>;
291
+ }, z.core.$strip>, z.ZodObject<{
292
+ kind: z.ZodLiteral<"crop">;
293
+ stepId: z.ZodEnum<{
294
+ "plate-detection": "plate-detection";
295
+ "face-detection": "face-detection";
296
+ }>;
297
+ rootLabels: z.ZodReadonly<z.ZodArray<z.ZodString>>;
298
+ parentMacro: z.ZodEnum<{
299
+ person: "person";
300
+ vehicle: "vehicle";
301
+ }>;
302
+ childClass: z.ZodEnum<{
303
+ face: "face";
304
+ plate: "plate";
305
+ }>;
306
+ rootInputPx: z.ZodOptional<z.ZodNumber>;
307
+ }, z.core.$strip>], "kind">>>>;
291
308
  clip: z.ZodOptional<z.ZodObject<{
292
309
  textModelId: z.ZodString;
293
310
  embeddingDim: z.ZodNumber;
@@ -177,7 +177,8 @@ export declare const ModelDistributeInputSchema: z.ZodObject<{
177
177
  }>>;
178
178
  preserveOriginal: z.ZodBoolean;
179
179
  }, z.core.$strip>>;
180
- fillsClassifierEffects: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
180
+ suppliesSteps: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
181
+ kind: z.ZodLiteral<"label">;
181
182
  stepId: z.ZodEnum<{
182
183
  "animal-classifier": "animal-classifier";
183
184
  "vehicle-classifier": "vehicle-classifier";
@@ -185,7 +186,23 @@ export declare const ModelDistributeInputSchema: z.ZodObject<{
185
186
  }>;
186
187
  labelToEffect: z.ZodRecord<z.ZodString, z.ZodString>;
187
188
  uncovered: z.ZodReadonly<z.ZodArray<z.ZodString>>;
188
- }, z.core.$strip>>>>;
189
+ }, z.core.$strip>, z.ZodObject<{
190
+ kind: z.ZodLiteral<"crop">;
191
+ stepId: z.ZodEnum<{
192
+ "plate-detection": "plate-detection";
193
+ "face-detection": "face-detection";
194
+ }>;
195
+ rootLabels: z.ZodReadonly<z.ZodArray<z.ZodString>>;
196
+ parentMacro: z.ZodEnum<{
197
+ person: "person";
198
+ vehicle: "vehicle";
199
+ }>;
200
+ childClass: z.ZodEnum<{
201
+ face: "face";
202
+ plate: "plate";
203
+ }>;
204
+ rootInputPx: z.ZodOptional<z.ZodNumber>;
205
+ }, z.core.$strip>], "kind">>>>;
189
206
  clip: z.ZodOptional<z.ZodObject<{
190
207
  textModelId: z.ZodString;
191
208
  embeddingDim: z.ZodNumber;
@@ -370,7 +387,8 @@ export declare const modelDistributorCapability: {
370
387
  }>>;
371
388
  preserveOriginal: z.ZodBoolean;
372
389
  }, z.core.$strip>>;
373
- fillsClassifierEffects: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
390
+ suppliesSteps: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
391
+ kind: z.ZodLiteral<"label">;
374
392
  stepId: z.ZodEnum<{
375
393
  "animal-classifier": "animal-classifier";
376
394
  "vehicle-classifier": "vehicle-classifier";
@@ -378,7 +396,23 @@ export declare const modelDistributorCapability: {
378
396
  }>;
379
397
  labelToEffect: z.ZodRecord<z.ZodString, z.ZodString>;
380
398
  uncovered: z.ZodReadonly<z.ZodArray<z.ZodString>>;
381
- }, z.core.$strip>>>>;
399
+ }, z.core.$strip>, z.ZodObject<{
400
+ kind: z.ZodLiteral<"crop">;
401
+ stepId: z.ZodEnum<{
402
+ "plate-detection": "plate-detection";
403
+ "face-detection": "face-detection";
404
+ }>;
405
+ rootLabels: z.ZodReadonly<z.ZodArray<z.ZodString>>;
406
+ parentMacro: z.ZodEnum<{
407
+ person: "person";
408
+ vehicle: "vehicle";
409
+ }>;
410
+ childClass: z.ZodEnum<{
411
+ face: "face";
412
+ plate: "plate";
413
+ }>;
414
+ rootInputPx: z.ZodOptional<z.ZodNumber>;
415
+ }, z.core.$strip>], "kind">>>>;
382
416
  clip: z.ZodOptional<z.ZodObject<{
383
417
  textModelId: z.ZodString;
384
418
  embeddingDim: z.ZodNumber;
@@ -4,6 +4,23 @@ import type { InferenceCapabilities, ModelAvailability } from '../interfaces/inf
4
4
  import type { AudioResult, FrameResult } from '../types/detection.js';
5
5
  import type { PipelineConfig } from '../types/pipeline.js';
6
6
  import { type InferProvider } from './capability-definition.js';
7
+ /**
8
+ * A root model's boxes standing in for one crop-kind step's own inference
9
+ * (D730) — see `runPipeline.suppliedRoot`.
10
+ */
11
+ export declare const SuppliedRootOutputSchema: z.ZodObject<{
12
+ stepId: z.ZodString;
13
+ modelId: z.ZodString;
14
+ detections: z.ZodArray<z.ZodObject<{
15
+ bbox: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
16
+ score: z.ZodNumber;
17
+ landmarks: z.ZodOptional<z.ZodArray<z.ZodObject<{
18
+ x: z.ZodNumber;
19
+ y: z.ZodNumber;
20
+ }, z.core.$strip>>>;
21
+ }, z.core.$strip>>;
22
+ }, z.core.$strip>;
23
+ export type SuppliedRootOutput = z.infer<typeof SuppliedRootOutputSchema>;
7
24
  /**
8
25
  * Reference to the frame's retained NATIVE surface + the parent crop's placement
9
26
  * within the frame, so the executor can re-cut a leaf child ROI at native
@@ -204,7 +221,8 @@ declare const PipelineModelOptionSchema: z.ZodObject<{
204
221
  scrypted: "scrypted";
205
222
  }>>;
206
223
  defaultConfidence: z.ZodOptional<z.ZodNumber>;
207
- fillsClassifierEffects: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
224
+ suppliesSteps: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
225
+ kind: z.ZodLiteral<"label">;
208
226
  stepId: z.ZodEnum<{
209
227
  "animal-classifier": "animal-classifier";
210
228
  "vehicle-classifier": "vehicle-classifier";
@@ -212,7 +230,23 @@ declare const PipelineModelOptionSchema: z.ZodObject<{
212
230
  }>;
213
231
  labelToEffect: z.ZodRecord<z.ZodString, z.ZodString>;
214
232
  uncovered: z.ZodReadonly<z.ZodArray<z.ZodString>>;
215
- }, z.core.$strip>>>>;
233
+ }, z.core.$strip>, z.ZodObject<{
234
+ kind: z.ZodLiteral<"crop">;
235
+ stepId: z.ZodEnum<{
236
+ "plate-detection": "plate-detection";
237
+ "face-detection": "face-detection";
238
+ }>;
239
+ rootLabels: z.ZodReadonly<z.ZodArray<z.ZodString>>;
240
+ parentMacro: z.ZodEnum<{
241
+ person: "person";
242
+ vehicle: "vehicle";
243
+ }>;
244
+ childClass: z.ZodEnum<{
245
+ face: "face";
246
+ plate: "plate";
247
+ }>;
248
+ rootInputPx: z.ZodOptional<z.ZodNumber>;
249
+ }, z.core.$strip>], "kind">>>>;
216
250
  }, z.core.$strip>;
217
251
  declare const PipelineAddonSchemaSchema: z.ZodObject<{
218
252
  id: z.ZodString;
@@ -261,7 +295,8 @@ declare const PipelineAddonSchemaSchema: z.ZodObject<{
261
295
  scrypted: "scrypted";
262
296
  }>>;
263
297
  defaultConfidence: z.ZodOptional<z.ZodNumber>;
264
- fillsClassifierEffects: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
298
+ suppliesSteps: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
299
+ kind: z.ZodLiteral<"label">;
265
300
  stepId: z.ZodEnum<{
266
301
  "animal-classifier": "animal-classifier";
267
302
  "vehicle-classifier": "vehicle-classifier";
@@ -269,7 +304,23 @@ declare const PipelineAddonSchemaSchema: z.ZodObject<{
269
304
  }>;
270
305
  labelToEffect: z.ZodRecord<z.ZodString, z.ZodString>;
271
306
  uncovered: z.ZodReadonly<z.ZodArray<z.ZodString>>;
272
- }, z.core.$strip>>>>;
307
+ }, z.core.$strip>, z.ZodObject<{
308
+ kind: z.ZodLiteral<"crop">;
309
+ stepId: z.ZodEnum<{
310
+ "plate-detection": "plate-detection";
311
+ "face-detection": "face-detection";
312
+ }>;
313
+ rootLabels: z.ZodReadonly<z.ZodArray<z.ZodString>>;
314
+ parentMacro: z.ZodEnum<{
315
+ person: "person";
316
+ vehicle: "vehicle";
317
+ }>;
318
+ childClass: z.ZodEnum<{
319
+ face: "face";
320
+ plate: "plate";
321
+ }>;
322
+ rootInputPx: z.ZodOptional<z.ZodNumber>;
323
+ }, z.core.$strip>], "kind">>>>;
273
324
  }, z.core.$strip>>>;
274
325
  defaultModelId: z.ZodString;
275
326
  defaultModelIdByFormat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -343,7 +394,8 @@ declare const PipelineSlotSchemaSchema: z.ZodObject<{
343
394
  scrypted: "scrypted";
344
395
  }>>;
345
396
  defaultConfidence: z.ZodOptional<z.ZodNumber>;
346
- fillsClassifierEffects: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
397
+ suppliesSteps: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
398
+ kind: z.ZodLiteral<"label">;
347
399
  stepId: z.ZodEnum<{
348
400
  "animal-classifier": "animal-classifier";
349
401
  "vehicle-classifier": "vehicle-classifier";
@@ -351,7 +403,23 @@ declare const PipelineSlotSchemaSchema: z.ZodObject<{
351
403
  }>;
352
404
  labelToEffect: z.ZodRecord<z.ZodString, z.ZodString>;
353
405
  uncovered: z.ZodReadonly<z.ZodArray<z.ZodString>>;
354
- }, z.core.$strip>>>>;
406
+ }, z.core.$strip>, z.ZodObject<{
407
+ kind: z.ZodLiteral<"crop">;
408
+ stepId: z.ZodEnum<{
409
+ "plate-detection": "plate-detection";
410
+ "face-detection": "face-detection";
411
+ }>;
412
+ rootLabels: z.ZodReadonly<z.ZodArray<z.ZodString>>;
413
+ parentMacro: z.ZodEnum<{
414
+ person: "person";
415
+ vehicle: "vehicle";
416
+ }>;
417
+ childClass: z.ZodEnum<{
418
+ face: "face";
419
+ plate: "plate";
420
+ }>;
421
+ rootInputPx: z.ZodOptional<z.ZodNumber>;
422
+ }, z.core.$strip>], "kind">>>>;
355
423
  }, z.core.$strip>>>;
356
424
  defaultModelId: z.ZodString;
357
425
  defaultModelIdByFormat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -461,7 +529,8 @@ declare const PipelineSchemaSchema: z.ZodObject<{
461
529
  scrypted: "scrypted";
462
530
  }>>;
463
531
  defaultConfidence: z.ZodOptional<z.ZodNumber>;
464
- fillsClassifierEffects: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
532
+ suppliesSteps: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
533
+ kind: z.ZodLiteral<"label">;
465
534
  stepId: z.ZodEnum<{
466
535
  "animal-classifier": "animal-classifier";
467
536
  "vehicle-classifier": "vehicle-classifier";
@@ -469,7 +538,23 @@ declare const PipelineSchemaSchema: z.ZodObject<{
469
538
  }>;
470
539
  labelToEffect: z.ZodRecord<z.ZodString, z.ZodString>;
471
540
  uncovered: z.ZodReadonly<z.ZodArray<z.ZodString>>;
472
- }, z.core.$strip>>>>;
541
+ }, z.core.$strip>, z.ZodObject<{
542
+ kind: z.ZodLiteral<"crop">;
543
+ stepId: z.ZodEnum<{
544
+ "plate-detection": "plate-detection";
545
+ "face-detection": "face-detection";
546
+ }>;
547
+ rootLabels: z.ZodReadonly<z.ZodArray<z.ZodString>>;
548
+ parentMacro: z.ZodEnum<{
549
+ person: "person";
550
+ vehicle: "vehicle";
551
+ }>;
552
+ childClass: z.ZodEnum<{
553
+ face: "face";
554
+ plate: "plate";
555
+ }>;
556
+ rootInputPx: z.ZodOptional<z.ZodNumber>;
557
+ }, z.core.$strip>], "kind">>>>;
473
558
  }, z.core.$strip>>>;
474
559
  defaultModelId: z.ZodString;
475
560
  defaultModelIdByFormat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -825,7 +910,8 @@ export declare const pipelineExecutorCapability: {
825
910
  scrypted: "scrypted";
826
911
  }>>;
827
912
  defaultConfidence: z.ZodOptional<z.ZodNumber>;
828
- fillsClassifierEffects: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
913
+ suppliesSteps: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
914
+ kind: z.ZodLiteral<"label">;
829
915
  stepId: z.ZodEnum<{
830
916
  "animal-classifier": "animal-classifier";
831
917
  "vehicle-classifier": "vehicle-classifier";
@@ -833,7 +919,23 @@ export declare const pipelineExecutorCapability: {
833
919
  }>;
834
920
  labelToEffect: z.ZodRecord<z.ZodString, z.ZodString>;
835
921
  uncovered: z.ZodReadonly<z.ZodArray<z.ZodString>>;
836
- }, z.core.$strip>>>>;
922
+ }, z.core.$strip>, z.ZodObject<{
923
+ kind: z.ZodLiteral<"crop">;
924
+ stepId: z.ZodEnum<{
925
+ "plate-detection": "plate-detection";
926
+ "face-detection": "face-detection";
927
+ }>;
928
+ rootLabels: z.ZodReadonly<z.ZodArray<z.ZodString>>;
929
+ parentMacro: z.ZodEnum<{
930
+ person: "person";
931
+ vehicle: "vehicle";
932
+ }>;
933
+ childClass: z.ZodEnum<{
934
+ face: "face";
935
+ plate: "plate";
936
+ }>;
937
+ rootInputPx: z.ZodOptional<z.ZodNumber>;
938
+ }, z.core.$strip>], "kind">>>>;
837
939
  }, z.core.$strip>>>;
838
940
  defaultModelId: z.ZodString;
839
941
  defaultModelIdByFormat: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -1113,6 +1215,18 @@ export declare const pipelineExecutorCapability: {
1113
1215
  }, z.core.$strip>;
1114
1216
  }, z.core.$strip>>;
1115
1217
  replay: z.ZodOptional<z.ZodLiteral<true>>;
1218
+ suppliedRoot: z.ZodOptional<z.ZodObject<{
1219
+ stepId: z.ZodString;
1220
+ modelId: z.ZodString;
1221
+ detections: z.ZodArray<z.ZodObject<{
1222
+ bbox: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
1223
+ score: z.ZodNumber;
1224
+ landmarks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1225
+ x: z.ZodNumber;
1226
+ y: z.ZodNumber;
1227
+ }, z.core.$strip>>>;
1228
+ }, z.core.$strip>>;
1229
+ }, z.core.$strip>>;
1116
1230
  }, z.core.$strip>, z.ZodCustom<FrameResult, FrameResult>, "mutation">;
1117
1231
  /**
1118
1232
  * Batched run — N raw frames packed into one cap call. The provider
@@ -1085,6 +1085,19 @@ export declare const pipelineRunnerCapability: {
1085
1085
  className: z.ZodString;
1086
1086
  }, z.core.$strip>;
1087
1087
  steps: z.ZodOptional<z.ZodArray<z.ZodString>>;
1088
+ supplied: z.ZodOptional<z.ZodObject<{
1089
+ stepId: z.ZodString;
1090
+ modelId: z.ZodString;
1091
+ boxes: z.ZodArray<z.ZodObject<{
1092
+ bbox: z.ZodObject<{
1093
+ x: z.ZodNumber;
1094
+ y: z.ZodNumber;
1095
+ w: z.ZodNumber;
1096
+ h: z.ZodNumber;
1097
+ }, z.core.$strip>;
1098
+ score: z.ZodNumber;
1099
+ }, z.core.$strip>>;
1100
+ }, z.core.$strip>>;
1088
1101
  }, z.core.$strip>, z.ZodNullable<z.ZodObject<{
1089
1102
  details: z.ZodArray<z.ZodObject<{
1090
1103
  stepId: z.ZodString;
@@ -559,6 +559,42 @@ export declare const webrtcSessionCapability: {
559
559
  }, z.core.$strip>>;
560
560
  alive: z.ZodBoolean;
561
561
  }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
562
+ /**
563
+ * The viewer's downlink probe, for ONE live session (D733).
564
+ *
565
+ * The player measures `/adaptive-probe` after the session's first decoded
566
+ * frame (D635). It used to act on the reading itself, by opening a SECOND
567
+ * session with `hints.downlinkMbps` — every adaptive live open became two
568
+ * sessions, two ICE + DTLS handshakes and two server pipelines. It now
569
+ * hands the measurement to the session it already has; the provider picks
570
+ * the rung exactly as it would from an offer's hints (same viewport
571
+ * ceiling) and moves the session there — in place when the negotiated
572
+ * codec carries the new rendition, by the existing re-offer
573
+ * (`getSessionState.pendingRenegotiation`) when it cannot.
574
+ *
575
+ * A MEASUREMENT, never a tier: the client does not choose. A probe only
576
+ * raises the rung; lowering it stays the ladder's call on delivery.
577
+ * `held` answers why nothing moved (`not-adaptive`, `pinned`,
578
+ * `already-there`, `recorded`, …) — a client that gets ANY answer must not
579
+ * fall back to a reconnect; only a provider that does not know the method
580
+ * (an older hub) leaves the client its legacy second session.
581
+ */
582
+ readonly applyDownlinkProbe: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
583
+ deviceId: z.ZodNumber;
584
+ sessionId: z.ZodString;
585
+ downlinkMbps: z.ZodNumber;
586
+ }, z.core.$strip>, z.ZodObject<{
587
+ outcome: z.ZodEnum<{
588
+ switching: "switching";
589
+ held: "held";
590
+ }>;
591
+ tier: z.ZodNullable<z.ZodEnum<{
592
+ high: "high";
593
+ mid: "mid";
594
+ low: "low";
595
+ }>>;
596
+ reason: z.ZodString;
597
+ }, z.core.$strip>, "mutation">;
562
598
  /**
563
599
  * The SERVER's half of the stream-debug overlay, for one live session.
564
600
  *
@@ -1,5 +1,5 @@
1
1
  import { CLASS_MAP_MACRO_TARGETS, type DetectionCatalogClassMap } from '../types/labels.js';
2
- import { type ClassifierFillDeclaration } from './classifier-fill.js';
2
+ import type { RootStepSupply } from '../types/models.js';
3
3
  /** A macro a detection catalog classMap may resolve to. */
4
4
  export type ClassMapMacroTarget = (typeof CLASS_MAP_MACRO_TARGETS)[number];
5
5
  /**
@@ -22,7 +22,9 @@ export declare const FRIGATE_PLUS_TO_MACRO: Readonly<Record<string, ClassMapMacr
22
22
  * - `attribute`: Frigate+ emits these INSIDE a parent box (a face inside a
23
23
  * person, a plate or a carrier logo on a vehicle). Mapping one to its
24
24
  * parent's macro would spawn a second, overlapping track for the same
25
- * subject; CamStack derives faces and plates with its own detail steps.
25
+ * subject. `face` and `license_plate` are instead declared as CROP supplies
26
+ * (D730): the box becomes a detail child of the person / vehicle containing
27
+ * it, when the face / plate step uses the root model.
26
28
  * - `no-macro`: an object with no detection macro to live under.
27
29
  */
28
30
  export declare const FRIGATE_PLUS_UNMAPPED_LABELS: Readonly<Record<string, 'attribute' | 'no-macro'>>;
@@ -38,12 +40,13 @@ export declare function buildFrigateClassMap(labels: readonly string[]): Detecti
38
40
  /** The label-derived fields of a Frigate catalog entry. */
39
41
  export interface FrigateLabelFields {
40
42
  readonly classMap: DetectionCatalogClassMap;
41
- readonly fillsClassifierEffects?: readonly ClassifierFillDeclaration[];
43
+ readonly suppliesSteps?: readonly RootStepSupply[];
42
44
  }
43
45
  /**
44
- * Everything a Frigate / Frigate+ entry derives from its labelmap: the classMap
45
- * and the steps it fills (D715). Every Frigate builder spreads this, so the two
46
- * cannot be derived from different label lists. A COCO labelmap gets its map
47
- * and no fill.
46
+ * Everything a Frigate / Frigate+ entry derives from ITS OWN labelmap: the
47
+ * classMap and the steps it can supply (D730) — label and crop kinds alike.
48
+ * Every Frigate builder spreads this at import, so the two cannot be derived
49
+ * from different label lists, and no family is assumed to carry a label it
50
+ * does not list.
48
51
  */
49
52
  export declare function frigateLabelFields(labels: readonly string[]): FrigateLabelFields;
@@ -1,6 +1,6 @@
1
1
  export * from './coco-classmap.js';
2
2
  export * from './frigate-plus-classmap.js';
3
- export * from './classifier-fill.js';
3
+ export * from './root-model-supply.js';
4
4
  export * from './sensor-active-state.js';
5
5
  export * from './audio-classmap.js';
6
6
  export * from './event-taxonomy.js';
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Root-model supply — the ONE place that says which pipeline steps a root
3
+ * detector can supply from its own output, how, and whether the camera uses it.
4
+ *
5
+ * A root detector's labels can already be the effect a step exists to produce:
6
+ * a Frigate+ model emits `deer`, `car`, `package`, a COCO model emits `dog`,
7
+ * `bus`. Some also emit the CHILD boxes a detail step exists to find: a
8
+ * Frigate+ `license_plate` inside a car, a `face` inside a person. Every root
9
+ * model DECLARES what it can supply (`ModelCatalogEntry.suppliesSteps`),
10
+ * derived from its own labelmap and classMap by {@link deriveRootSupplies} —
11
+ * never assumed per family. Whether a camera USES that is the step's own
12
+ * `useRootModel` flag, an operator intent kept beside the step's `modelId`
13
+ * and never touching it (D730). {@link resolveRootSupply} is the one decision
14
+ * the runner, the detail dispatcher and the admin UI all read.
15
+ *
16
+ * Two kinds of supply:
17
+ * - `label` — the root's raw class IS the step's answer (`deer` for the animal
18
+ * classifier). The detection carries it as a linked label.
19
+ * - `crop` — the root draws the box the step would have found (a plate inside
20
+ * a vehicle). The box becomes a detail child of the parent that contains it,
21
+ * never a track of its own (D683).
22
+ *
23
+ * Pure — no I/O, no clock.
24
+ */
25
+ import type { ModelCatalogEntry, RootStepSupply } from '../types/models.js';
26
+ /** Steps whose effect a root label can BE. */
27
+ export declare const LABEL_SUPPLY_STEP_IDS: readonly ["animal-classifier", "vehicle-classifier", "package-detection"];
28
+ export type LabelSupplyStepId = (typeof LABEL_SUPPLY_STEP_IDS)[number];
29
+ /** Steps whose box a root detection can BE. */
30
+ export declare const CROP_SUPPLY_STEP_IDS: readonly ["plate-detection", "face-detection"];
31
+ export type CropSupplyStepId = (typeof CROP_SUPPLY_STEP_IDS)[number];
32
+ /** Every step a root model can supply. */
33
+ export declare const ROOT_SUPPLIABLE_STEP_IDS: readonly ["animal-classifier", "vehicle-classifier", "package-detection", "plate-detection", "face-detection"];
34
+ export type RootSuppliableStepId = LabelSupplyStepId | CropSupplyStepId;
35
+ /** Narrow a step id to a suppliable one — type guard, not a cast. */
36
+ export declare function isRootSuppliableStepId(value: string): value is RootSuppliableStepId;
37
+ /** Narrow a step id to a label-kind one. */
38
+ export declare function isLabelSupplyStepId(value: string): value is LabelSupplyStepId;
39
+ /**
40
+ * The EFFECT vocabulary of each label-kind step: exactly the strings the step
41
+ * itself emits, in its own spelling. A linked label is one of these and nothing
42
+ * else, so a tier-1 value means the same thing whichever writer produced it.
43
+ *
44
+ * - `animal-classifier`: the PRIMARY model's `-labels.json` (Open Images V7,
45
+ * 8 classes) — also the species allow-list the step offers.
46
+ * - `vehicle-classifier`: the classifier's labels, capitalised as it emits them
47
+ * (it writes `winner.class` verbatim).
48
+ * - `package-detection`: its one output class.
49
+ *
50
+ * `scripts/check-label-link-vocabulary.ts` fails the build if a declared
51
+ * `labelToEffect` names anything outside this table.
52
+ */
53
+ export declare const LABEL_SUPPLY_VOCABULARIES: Readonly<Record<LabelSupplyStepId, readonly string[]>>;
54
+ /** The macro a detection must carry for a label-kind step to apply to it. */
55
+ export declare const LABEL_SUPPLY_MACRO: Readonly<Record<LabelSupplyStepId, string>>;
56
+ /** What a crop-kind supply is made of. */
57
+ export interface CropSupplySource {
58
+ /** Raw root labels that ARE this step's box. */
59
+ readonly rootLabels: readonly string[];
60
+ /** The macro of the parent the box must lie inside. */
61
+ readonly parentMacro: 'vehicle' | 'person';
62
+ /** The detail class the box becomes. */
63
+ readonly childClass: 'plate' | 'face';
64
+ /**
65
+ * The step's own children that still run on the root's box: `plate-ocr`
66
+ * reads a root plate, `face-embedding` embeds a refined root face.
67
+ */
68
+ readonly servedChildSteps: readonly string[];
69
+ /**
70
+ * How the root's box stands in for the step's inference.
71
+ * - `as-output`: the box IS the step's output (a plate box goes straight to
72
+ * the reader).
73
+ * - `refine`: the box is only a LOCATION. The step's own detector re-finds
74
+ * the subject inside a square around it (`deriveRootFaceRefineRect`) so
75
+ * its children get what they need — a face's landmarks — and nothing
76
+ * unaligned ever reaches the embedder. No face found ⇒ nothing.
77
+ */
78
+ readonly use: 'as-output' | 'refine';
79
+ /**
80
+ * The root's smallest input side for the supply to be in force. A root that
81
+ * sees the frame smaller than this misses too many of these boxes to be the
82
+ * source (a 320 px root loses ~60% of the faces a 640 one finds on 4K
83
+ * cameras). Absent ⇒ any root.
84
+ */
85
+ readonly minRootInputPx?: number;
86
+ }
87
+ export declare const CROP_SUPPLY_SOURCES: Readonly<Record<CropSupplyStepId, CropSupplySource>>;
88
+ /**
89
+ * Whether an operator intends a step to take the root's output when the
90
+ * root declares it — the default of the `useRootModel` flag. The label kinds
91
+ * default ON: the detector's answer is the cheaper one and the classifier
92
+ * keeps its model for the day the root changes. The crop kinds default OFF: a
93
+ * root plate box has an uncalibrated OCR margin, and root-face refinement has
94
+ * not run on live traffic yet.
95
+ */
96
+ export declare const USE_ROOT_MODEL_DEFAULTS: Readonly<Record<RootSuppliableStepId, boolean>>;
97
+ /** The step-settings key the flag is stored under (DeviceStepConfig.settings, camera overrides). */
98
+ export declare const USE_ROOT_MODEL_SETTING_KEY = "useRootModel";
99
+ /** `ScoredLabel.stepId` prefix of a label the detector wrote for a step. */
100
+ export declare const LINKED_LABEL_STEP_PREFIX = "detector-link:";
101
+ /** `detector-link:<stepId>` — the attribution of a linked label. */
102
+ export declare function linkedLabelStepId(stepId: LabelSupplyStepId): string;
103
+ /** The step a linked label stands in for, or `undefined` for any other attribution. */
104
+ export declare function linkedStepOf(attributionStepId: string | undefined): LabelSupplyStepId | undefined;
105
+ /** The classMap shape the derivation reads. */
106
+ export interface SupplyClassMap {
107
+ readonly mapping: Readonly<Record<string, string>>;
108
+ }
109
+ /**
110
+ * Which steps a root detector can supply, from its labelmap and classMap.
111
+ *
112
+ * - label kind: a label counts for a step only when the classMap sends it to
113
+ * that step's macro AND it names a vocabulary entry. Every root is judged
114
+ * the same way — a COCO model supplies the animal classifier with the six
115
+ * species COCO names, exactly as a Frigate+ model supplies seven.
116
+ * - crop kind: the labelmap carries one of the step's root labels. Those
117
+ * labels are deliberately left out of the classMap, so they never make a
118
+ * track of their own.
119
+ *
120
+ * No classMap ⇒ no label supply (nothing says which macro a label lives under).
121
+ */
122
+ export declare function deriveRootSupplies(labels: readonly string[], classMap: SupplyClassMap | undefined): readonly RootStepSupply[];
123
+ /** What a step definition contributes when a model entry carries no labels/classMap of its own. */
124
+ export interface RootSupplyStepDefaults {
125
+ readonly labels: readonly string[];
126
+ readonly classMap?: SupplyClassMap;
127
+ }
128
+ /**
129
+ * The supplies a root model declares. A row registered with a declaration
130
+ * carries it (`suppliesSteps`, computed at import from the model's own
131
+ * labelmap); a row without one — a built-in entry, or a custom row registered
132
+ * before the field existed — is derived here, on read, from the same inputs.
133
+ */
134
+ export declare function rootSuppliesOf(entry: Pick<ModelCatalogEntry, 'labels' | 'classMap' | 'suppliesSteps' | 'inputSize'> | undefined, stepDefaults: RootSupplyStepDefaults): readonly RootStepSupply[];
135
+ /** The supply a root declares for one step, if any. */
136
+ export declare function supplyFor(supplies: readonly RootStepSupply[] | undefined, stepId: string): RootStepSupply | undefined;
137
+ /**
138
+ * Read the `useRootModel` flag off a step's settings bag. Absent ⇒ the
139
+ * retired `labelLink` value if one is stored, else the step's default.
140
+ */
141
+ export declare function readUseRootModel(stepId: RootSuppliableStepId, settings: Readonly<Record<string, unknown>> | undefined): boolean;
142
+ /** One step's root-supply state for one camera (or one node/device column). */
143
+ export interface RootSupplyState {
144
+ readonly stepId: RootSuppliableStepId;
145
+ /** What the current root declares for this step, if anything. */
146
+ readonly supply: RootStepSupply | undefined;
147
+ /** The operator's `useRootModel` intent (stored or default). */
148
+ readonly intent: boolean;
149
+ /**
150
+ * The root's output IS this step's result: the step's own inference does
151
+ * not run and the root's linked label / child box is authoritative.
152
+ * `intent && supply && nothing blocks it`.
153
+ */
154
+ readonly effective: boolean;
155
+ /** Intent is on but the current root cannot supply the step. */
156
+ readonly inactive: boolean;
157
+ /** Why an intended supply is not in force — present iff `inactive`. */
158
+ readonly inactiveReason?: RootSupplyInactiveReason;
159
+ }
160
+ /**
161
+ * Why an intended root supply is not in force.
162
+ * - `root-does-not-declare`: the root's labels cannot supply the step.
163
+ * - `root-input-too-small`: they can, but the root sees the frame smaller than
164
+ * the step's `minRootInputPx` (or its input size is unknown).
165
+ */
166
+ export type RootSupplyInactiveReason = 'root-does-not-declare' | 'root-input-too-small';
167
+ /**
168
+ * THE decision. Effective = the operator intends it AND the current root
169
+ * declares it. It never looks at, changes or clears the step's `modelId`: a
170
+ * root that cannot supply the step leaves the step running its own model, and
171
+ * switching back to a root that can re-activates the supply by itself.
172
+ */
173
+ export declare function resolveRootSupply(stepId: RootSuppliableStepId, settings: Readonly<Record<string, unknown>> | undefined, rootSupplies: readonly RootStepSupply[] | undefined): RootSupplyState;
174
+ /**
175
+ * The fine label a supplied root class becomes for a step whose supply is
176
+ * effective, or `undefined` when the step's `enabledClasses` switched it off —
177
+ * the detection then stays at its macro (`animal`). Empty / absent allow-list
178
+ * = every class.
179
+ */
180
+ export declare function allowedSuppliedEffect(effect: string, settings: Readonly<Record<string, unknown>> | undefined): boolean;
181
+ /** The child steps of a crop-kind step that still run on the root's box. */
182
+ export declare function rootSupplyServes(stepId: CropSupplyStepId): readonly string[];
183
+ /** Minimum fraction of a child box's area that must lie inside its parent. */
184
+ export declare const ROOT_CHILD_CONTAINMENT_MIN = 0.9;
185
+ /** An axis-aligned box in one pixel space. */
186
+ export interface SupplyBox {
187
+ readonly x: number;
188
+ readonly y: number;
189
+ readonly w: number;
190
+ readonly h: number;
191
+ }
192
+ /**
193
+ * The parent a root child box belongs to: among `parents`, the SMALLEST whose
194
+ * box holds at least {@link ROOT_CHILD_CONTAINMENT_MIN} of the child's area
195
+ * (a plate inside the car, not inside the bus behind it). `-1` when none does
196
+ * — the box then belongs to nobody and makes nothing.
197
+ */
198
+ export declare function containingParentIndex(child: SupplyBox, parents: readonly SupplyBox[]): number;
199
+ /** One short phrase per supply — `animals 6/8`, `plates`. */
200
+ export declare function describeRootSupply(supply: RootStepSupply): string;
201
+ /** `animals 6/8 · vehicles 5/8 · plates · faces` — empty string for none. */
202
+ export declare function describeRootSupplies(supplies: readonly RootStepSupply[] | undefined): string;