@camstack/types 1.2.398 → 1.2.400

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.
@@ -7,7 +7,8 @@
7
7
  * `docs/benchmarks/model-floors.json` (person precision / recall at the
8
8
  * shipped floor). `__tests__/detector-performance.spec.ts` holds both tables
9
9
  * equal to those files, so a re-measurement replaces the JSON and this file
10
- * together. Only the YOLOv9 t/s/m family is here: the cluster runs ONE family
10
+ * together. Only the YOLOv9 t/s/m family is here (plus, in each `coral` column,
11
+ * the one Edge TPU build a Coral runs by default, `yolov9s-320-edgetpu`, D912): the cluster runs ONE family
11
12
  * (YOLOv9 — the one that runs well on every accelerator class measured), and
12
13
  * tier c is not offered (a few recall points for 25–50 % more latency).
13
14
  */
@@ -52,8 +52,6 @@ export declare const RecommendationReasonSchema: z.ZodDiscriminatedUnion<[z.ZodO
52
52
  modelId: z.ZodString;
53
53
  }, z.core.$strip>, z.ZodObject<{
54
54
  kind: z.ZodLiteral<"cpu-device">;
55
- }, z.core.$strip>, z.ZodObject<{
56
- kind: z.ZodLiteral<"coral-untouched">;
57
55
  }, z.core.$strip>, z.ZodObject<{
58
56
  kind: z.ZodLiteral<"device-disabled">;
59
57
  }, z.core.$strip>, z.ZodObject<{
@@ -172,8 +170,6 @@ export declare const DeviceRecommendationSchema: z.ZodObject<{
172
170
  modelId: z.ZodString;
173
171
  }, z.core.$strip>, z.ZodObject<{
174
172
  kind: z.ZodLiteral<"cpu-device">;
175
- }, z.core.$strip>, z.ZodObject<{
176
- kind: z.ZodLiteral<"coral-untouched">;
177
173
  }, z.core.$strip>, z.ZodObject<{
178
174
  kind: z.ZodLiteral<"device-disabled">;
179
175
  }, z.core.$strip>, z.ZodObject<{
@@ -276,8 +272,6 @@ export declare const NodeRecommendationSchema: z.ZodObject<{
276
272
  modelId: z.ZodString;
277
273
  }, z.core.$strip>, z.ZodObject<{
278
274
  kind: z.ZodLiteral<"cpu-device">;
279
- }, z.core.$strip>, z.ZodObject<{
280
- kind: z.ZodLiteral<"coral-untouched">;
281
275
  }, z.core.$strip>, z.ZodObject<{
282
276
  kind: z.ZodLiteral<"device-disabled">;
283
277
  }, z.core.$strip>, z.ZodObject<{
@@ -334,8 +328,6 @@ export declare const NodeRecommendationSchema: z.ZodObject<{
334
328
  modelId: z.ZodString;
335
329
  }, z.core.$strip>, z.ZodObject<{
336
330
  kind: z.ZodLiteral<"cpu-device">;
337
- }, z.core.$strip>, z.ZodObject<{
338
- kind: z.ZodLiteral<"coral-untouched">;
339
331
  }, z.core.$strip>, z.ZodObject<{
340
332
  kind: z.ZodLiteral<"device-disabled">;
341
333
  }, z.core.$strip>, z.ZodObject<{
@@ -411,10 +403,6 @@ export declare const AutoTuneWarningSchema: z.ZodDiscriminatedUnion<[z.ZodObject
411
403
  }, z.core.$strip>, z.ZodObject<{
412
404
  kind: z.ZodLiteral<"detector-store-unreadable">;
413
405
  error: z.ZodString;
414
- }, z.core.$strip>, z.ZodObject<{
415
- kind: z.ZodLiteral<"coral-enabled">;
416
- nodeId: z.ZodString;
417
- deviceKey: z.ZodString;
418
406
  }, z.core.$strip>, z.ZodObject<{
419
407
  kind: z.ZodLiteral<"custom-pin-kept">;
420
408
  nodeId: z.ZodString;
@@ -504,8 +492,6 @@ export declare const AutoTunePlanSchema: z.ZodObject<{
504
492
  modelId: z.ZodString;
505
493
  }, z.core.$strip>, z.ZodObject<{
506
494
  kind: z.ZodLiteral<"cpu-device">;
507
- }, z.core.$strip>, z.ZodObject<{
508
- kind: z.ZodLiteral<"coral-untouched">;
509
495
  }, z.core.$strip>, z.ZodObject<{
510
496
  kind: z.ZodLiteral<"device-disabled">;
511
497
  }, z.core.$strip>, z.ZodObject<{
@@ -562,8 +548,6 @@ export declare const AutoTunePlanSchema: z.ZodObject<{
562
548
  modelId: z.ZodString;
563
549
  }, z.core.$strip>, z.ZodObject<{
564
550
  kind: z.ZodLiteral<"cpu-device">;
565
- }, z.core.$strip>, z.ZodObject<{
566
- kind: z.ZodLiteral<"coral-untouched">;
567
551
  }, z.core.$strip>, z.ZodObject<{
568
552
  kind: z.ZodLiteral<"device-disabled">;
569
553
  }, z.core.$strip>, z.ZodObject<{
@@ -634,10 +618,6 @@ export declare const AutoTunePlanSchema: z.ZodObject<{
634
618
  }, z.core.$strip>, z.ZodObject<{
635
619
  kind: z.ZodLiteral<"detector-store-unreadable">;
636
620
  error: z.ZodString;
637
- }, z.core.$strip>, z.ZodObject<{
638
- kind: z.ZodLiteral<"coral-enabled">;
639
- nodeId: z.ZodString;
640
- deviceKey: z.ZodString;
641
621
  }, z.core.$strip>, z.ZodObject<{
642
622
  kind: z.ZodLiteral<"custom-pin-kept">;
643
623
  nodeId: z.ZodString;
@@ -769,8 +749,6 @@ export declare const AutoTuneApplyResultSchema: z.ZodDiscriminatedUnion<[z.ZodOb
769
749
  modelId: z.ZodString;
770
750
  }, z.core.$strip>, z.ZodObject<{
771
751
  kind: z.ZodLiteral<"cpu-device">;
772
- }, z.core.$strip>, z.ZodObject<{
773
- kind: z.ZodLiteral<"coral-untouched">;
774
752
  }, z.core.$strip>, z.ZodObject<{
775
753
  kind: z.ZodLiteral<"device-disabled">;
776
754
  }, z.core.$strip>, z.ZodObject<{
@@ -827,8 +805,6 @@ export declare const AutoTuneApplyResultSchema: z.ZodDiscriminatedUnion<[z.ZodOb
827
805
  modelId: z.ZodString;
828
806
  }, z.core.$strip>, z.ZodObject<{
829
807
  kind: z.ZodLiteral<"cpu-device">;
830
- }, z.core.$strip>, z.ZodObject<{
831
- kind: z.ZodLiteral<"coral-untouched">;
832
808
  }, z.core.$strip>, z.ZodObject<{
833
809
  kind: z.ZodLiteral<"device-disabled">;
834
810
  }, z.core.$strip>, z.ZodObject<{
@@ -899,10 +875,6 @@ export declare const AutoTuneApplyResultSchema: z.ZodDiscriminatedUnion<[z.ZodOb
899
875
  }, z.core.$strip>, z.ZodObject<{
900
876
  kind: z.ZodLiteral<"detector-store-unreadable">;
901
877
  error: z.ZodString;
902
- }, z.core.$strip>, z.ZodObject<{
903
- kind: z.ZodLiteral<"coral-enabled">;
904
- nodeId: z.ZodString;
905
- deviceKey: z.ZodString;
906
878
  }, z.core.$strip>, z.ZodObject<{
907
879
  kind: z.ZodLiteral<"custom-pin-kept">;
908
880
  nodeId: z.ZodString;
@@ -25,7 +25,10 @@
25
25
  * variant down from m-640 is s-640-int8, not m-320. When nothing fits,
26
26
  * the candidate with the most capacity is used and the plan says so.
27
27
  * 5. An enabled CPU device (the fallback pool) gets its own pick the same
28
- * way; a Coral is never touched (no YOLOv9 build), only reported.
28
+ * way. An ENABLED Coral is sized at its one default build
29
+ * (`CORAL_DEFAULT_MODEL_ID`) from the `coral` column, outside the
30
+ * accelerator group — it shares no model with it. A DISABLED Coral stays
31
+ * out like any disabled device; a Coral is enabled by default (D912).
29
32
  * 6. A device whose root detector is pinned to a CUSTOM-registry model (a
30
33
  * fine-tune, a canary) is KEPT (D786): no model is chosen for it, so Apply
31
34
  * writes nothing there. One kept accelerator keeps the whole accelerator
@@ -37,6 +40,11 @@ import { type DetectorPerfTable } from './detector-performance.js';
37
40
  import { type NodeRecommendation } from './plan-schemas.js';
38
41
  /** The family the cluster runs. */
39
42
  export declare const AUTO_TUNE_FAMILY = "yolov9";
43
+ /**
44
+ * The model a Coral runs by default (D908) and the only one Auto tune sizes it
45
+ * at (D912). Auto tune never enables a device; it sizes the enabled ones.
46
+ */
47
+ export declare const CORAL_DEFAULT_MODEL_ID = "yolov9s-320-edgetpu";
40
48
  /** Recall within this of the best counts as a tie — the faster one wins. */
41
49
  export declare const RECALL_TIE = 0.02;
42
50
  /** Default share of an accelerator's throughput kept free. */
@@ -7,6 +7,12 @@ export interface DeviceMeasuredCapacity {
7
7
  readonly maxSessions: number;
8
8
  readonly modelId: string | null;
9
9
  readonly measuredAtMs: number;
10
+ /**
11
+ * Which measurement the number comes from: a `pipeline` cell's sessions, or
12
+ * a `device` cell's `kMax` read as sessions (an upper bound — see
13
+ * `sessionsOfDeviceCell`). Absent = a source that does not say.
14
+ */
15
+ readonly phase?: 'pipeline' | 'device';
10
16
  }
11
17
  /** One node's measured capacity. */
12
18
  export interface NodeMeasuredCapacity {
@@ -22,6 +28,27 @@ export interface NodeCapacitySource {
22
28
  /** The usable (fresh) measured capacity of each asked node that has any. */
23
29
  readMeasuredCapacity(nodeIds: readonly string[]): Promise<ReadonlyMap<string, NodeMeasuredCapacity>>;
24
30
  }
31
+ /**
32
+ * The measured capacity of `deviceKey` for the model it runs NOW, or
33
+ * undefined. A cell measured for another model says nothing about this one
34
+ * (a failed load of a heavier build is not this build's capacity), and a cell
35
+ * that names no model cannot be matched. The ONE predicate behind both the
36
+ * automatic shares and the automatic benchmark's "has results".
37
+ */
38
+ export declare function capacityForModel(node: NodeMeasuredCapacity | undefined, deviceKey: string, modelId: string | null): DeviceMeasuredCapacity | undefined;
39
+ /** A measured cell the shares ignore: it is for a model the device does not run now. */
40
+ export interface ForeignCapacityCell {
41
+ readonly nodeId: string;
42
+ readonly deviceKey: string;
43
+ readonly measuredModelId: string;
44
+ /** The model Auto tune pins on the device now, or null = none chosen. */
45
+ readonly runsModelId: string | null;
46
+ }
47
+ /**
48
+ * Every measured (device × model) cell that no device runs now — what
49
+ * {@link capacityForModel} skips, so the caller can say so once.
50
+ */
51
+ export declare function foreignCapacityCells(recommendations: readonly NodeRecommendation[], measured: ReadonlyMap<string, NodeMeasuredCapacity>): readonly ForeignCapacityCell[];
25
52
  /** A source that has no results — the benchmark store before it exists. */
26
53
  export declare const NO_MEASURED_CAPACITY: NodeCapacitySource;
27
54
  /** Integer shares summing to 100 (largest remainder); ties broken by key. */
@@ -29,6 +29,13 @@ export interface ShareCandidate {
29
29
  readonly share: number;
30
30
  /** Sessions running on this candidate now. */
31
31
  readonly running: number;
32
+ /**
33
+ * Recent elections that are not running now, decayed over time (default 0).
34
+ * Sessions that never overlap leave `running` at 0 at every election, so the
35
+ * deficits tie forever and the key order hands every session to the same
36
+ * candidate; counting history makes the CUMULATIVE split follow the shares.
37
+ */
38
+ readonly recent?: number;
32
39
  /** At an explicit cap — never elected. */
33
40
  readonly capped: boolean;
34
41
  /** Drowning (pool queue at its shed cap) — stepped over while another is free. */
@@ -46,7 +46,21 @@ export interface MeasuredDetectorCell {
46
46
  /** deviceKey → modelId → the fresh `device` measurement on `nodeId`. */
47
47
  export declare function measuredDetectorCells(rows: readonly NodeBenchmarkResult[], nodeId: string, ctx: StandingContext): Readonly<Record<string, Readonly<Record<string, MeasuredDetectorCell>>>>;
48
48
  /**
49
- * Per node, each device at its newest fresh `pipeline` measurement — the
50
- * `NodeCapacitySource` answer the automatic shares read.
49
+ * Parallel sessions a `device`-phase cell stands for.
50
+ *
51
+ * Both numbers are "streams at the camera rate the hardware carried inside
52
+ * the frame interval" (`kMax` for the detector alone, `maxSessions` for the
53
+ * detector plus its enrichment steps) and the benchmark page already shows
54
+ * `kMax` as "streams", so the unit is the same and the conversion is the
55
+ * identity. It is an UPPER bound for a session that also runs enrichment —
56
+ * which is why a `pipeline` cell for the same model always wins over it.
57
+ */
58
+ export declare function sessionsOfDeviceCell(kMax: number): number;
59
+ /**
60
+ * Per node, every (device × model) at its best fresh measurement: the newest
61
+ * `pipeline` cell, else the newest `device` cell read as
62
+ * {@link sessionsOfDeviceCell}. Several models of one device are kept apart —
63
+ * the caller picks the one the device runs NOW (a cell for another model says
64
+ * nothing about it).
51
65
  */
52
66
  export declare function measuredCapacityFromResults(rows: readonly NodeBenchmarkResult[], nodeIds: readonly string[], ctx: StandingContext): ReadonlyMap<string, NodeMeasuredCapacity>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.398",
3
+ "version": "1.2.400",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",