@camstack/types 1.2.315 → 1.2.317

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,54 @@
1
+ /**
2
+ * The Best settings recommender (D745): one detector per node, from ONE family
3
+ * (YOLOv9) for the whole cluster, chosen from static hardware facts × the
4
+ * measured latency table × the node's detection demand. Pure; no benchmark.
5
+ *
6
+ * Per node:
7
+ * 1. Classify the hardware (`classifyInferenceHardware`). An unknown class,
8
+ * an offline node or a node with nothing to recommend is left untouched.
9
+ * 2. The node's ACCELERATORS (NPU, iGPU, Neural Engine) that are enabled and
10
+ * available share ONE model — so a camera's floors never flip with the
11
+ * device the balancer rotated it onto. A candidate must have a build for
12
+ * every accelerator's format and a latency cell for each.
13
+ * 3. A candidate FITS a device when its throughput, less the headroom, covers
14
+ * the device's demand and the single fastest camera that can land on it.
15
+ * 4. Among candidates that fit everywhere, the most accurate wins (person
16
+ * recall at the shipped floor); within `RECALL_TIE` of the best, the
17
+ * fastest wins. That IS the step-down order the data gives: the first
18
+ * variant down from m-640 is s-640-int8, not m-320.
19
+ * 5. An enabled CPU device (the fallback pool) gets its own pick the same
20
+ * way; a Coral is never touched (no YOLOv9 build), only reported.
21
+ */
22
+ import type { HardwareInfo } from '../../interfaces/platform.js';
23
+ import type { ModelFormat } from '../../types/models.js';
24
+ import { type DetectorPerfTable } from './detector-performance.js';
25
+ import type { DeviceDemand, NodeRecommendation } from './plan-schemas.js';
26
+ /** The family the cluster runs. */
27
+ export declare const BEST_SETTINGS_FAMILY = "yolov9";
28
+ /** Recall within this of the best counts as a tie — the faster one wins. */
29
+ export declare const RECALL_TIE = 0.02;
30
+ /** Default share of an accelerator's throughput kept free. */
31
+ export declare const DEFAULT_HEADROOM = 0.4;
32
+ /** One device of a node, as the recommender reads it. */
33
+ export interface BestSettingsDeviceInput {
34
+ readonly key: string;
35
+ readonly format: ModelFormat;
36
+ readonly enabled: boolean;
37
+ readonly available: boolean;
38
+ }
39
+ /** One node, as the recommender reads it. */
40
+ export interface BestSettingsNodeInput {
41
+ readonly nodeId: string;
42
+ readonly reachable: boolean;
43
+ readonly hardware: HardwareInfo | null;
44
+ readonly devices: readonly BestSettingsDeviceInput[];
45
+ /** Object-detection model id → the formats it has a build for, from the node's catalog. */
46
+ readonly formatsByModel: Readonly<Record<string, readonly ModelFormat[]>>;
47
+ }
48
+ /** Recommend one node. See the module header. */
49
+ export declare function recommendNode(input: {
50
+ readonly node: BestSettingsNodeInput;
51
+ readonly demand: readonly DeviceDemand[];
52
+ readonly headroom?: number;
53
+ readonly perf?: DetectorPerfTable;
54
+ }): NodeRecommendation;
@@ -33,6 +33,7 @@
33
33
  * runner (`addon-pipeline`) and the editors (`ui-library`, `addon-admin-ui`)
34
34
  * apply the same rule.
35
35
  */
36
+ import type { ConfigField } from '../interfaces/config-ui.js';
36
37
  /** `minConfidencePerson` → `minConfidencePersonModelId`. */
37
38
  export declare function modelBindingKey(key: string): string;
38
39
  /** A loose step-settings bag, as it is stored and travels. */
@@ -80,3 +81,9 @@ export declare function hasModelBoundOverrides(settings: ModelBoundSettingsBag |
80
81
  * that model runs.
81
82
  */
82
83
  export declare function clearModelBoundOverrides(settings: ModelBoundSettingsBag | undefined, boundKeys: readonly string[], modelId: string | undefined): Record<string, unknown>;
84
+ /**
85
+ * The keys of every `bindsToModel` field of a step's config schema, groups
86
+ * flattened (D738). One definition for the runner (which applies the binding)
87
+ * and the orchestrator's Best settings (which clears those overrides, D745).
88
+ */
89
+ export declare function collectModelBoundKeys(fields: readonly ConfigField[]): string[];
@@ -27,6 +27,51 @@ export declare const ModelFormatEntrySchema: z.ZodObject<{
27
27
  revision: z.ZodOptional<z.ZodString>;
28
28
  }, z.core.$strip>;
29
29
  export type ModelFormatEntry = z.infer<typeof ModelFormatEntrySchema>;
30
+ /**
31
+ * What a node holds for one (model, format) (D746). `current` is a complete
32
+ * copy at its catalog revision — exactly what `downloaded: true` means.
33
+ * `stale` is bytes on disk that are not (yet) proven current under D743/D744:
34
+ * no or a different revision record, or a missing sibling. `missing` is no
35
+ * copy. `downloaded` alone folds `stale` into "not downloaded", which hid
36
+ * reclaimable bytes and a copy about to be replaced.
37
+ */
38
+ export declare const ModelOnDiskStateSchema: z.ZodEnum<{
39
+ missing: "missing";
40
+ current: "current";
41
+ stale: "stale";
42
+ }>;
43
+ export type ModelOnDiskState = z.infer<typeof ModelOnDiskStateSchema>;
44
+ /**
45
+ * The numeric precision of one format's BUILD (D746) — reported only when the
46
+ * build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
47
+ * CamStack Core ML export). Absent means "not stated", never "fp32".
48
+ */
49
+ export declare const ModelFormatPrecisionSchema: z.ZodEnum<{
50
+ fp32: "fp32";
51
+ fp16: "fp16";
52
+ int8: "int8";
53
+ }>;
54
+ export type ModelFormatPrecision = z.infer<typeof ModelFormatPrecisionSchema>;
55
+ /**
56
+ * One format of one model as a node's `pipelineExecutor.getSchema` reports it.
57
+ * `onDisk` / `precision` are optional for version skew: a runner that predates
58
+ * them omits them, and a reader falls back to `downloaded`.
59
+ */
60
+ export declare const PipelineModelFormatStatusSchema: z.ZodObject<{
61
+ downloaded: z.ZodBoolean;
62
+ sizeMB: z.ZodNumber;
63
+ onDisk: z.ZodOptional<z.ZodEnum<{
64
+ missing: "missing";
65
+ current: "current";
66
+ stale: "stale";
67
+ }>>;
68
+ precision: z.ZodOptional<z.ZodEnum<{
69
+ fp32: "fp32";
70
+ fp16: "fp16";
71
+ int8: "int8";
72
+ }>>;
73
+ }, z.core.$strip>;
74
+ export type PipelineModelFormatStatus = z.infer<typeof PipelineModelFormatStatusSchema>;
30
75
  /**
31
76
  * Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
32
77
  * The downloader fetches from `url` and saves to `{modelsDir}/{filename}`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.315",
3
+ "version": "1.2.317",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",