@camstack/types 1.2.312 → 1.2.314

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.
@@ -112,6 +112,13 @@ export interface ConfigFieldModelApplicability {
112
112
  * a filter that can never match).
113
113
  */
114
114
  readonly optionsByModel?: Readonly<Record<string, readonly ConfigOption[]>>;
115
+ /**
116
+ * modelId → this field's DEFAULT when that model runs, for a field whose
117
+ * default belongs to the model (D738: the per-class confidence floors).
118
+ * Only models whose default differs from the field's own `default` are
119
+ * listed; a model absent here runs at `default`.
120
+ */
121
+ readonly defaultByModel?: Readonly<Record<string, unknown>>;
115
122
  }
116
123
  export interface ConfigFieldBase {
117
124
  readonly key: string;
@@ -143,6 +150,13 @@ export interface ConfigFieldBase {
143
150
  readonly secret?: boolean;
144
151
  /** Per-model knob applicability — see {@link ConfigFieldModelApplicability}. */
145
152
  readonly modelApplicability?: ConfigFieldModelApplicability;
153
+ /**
154
+ * An operator value of this field is stored together with the model it was
155
+ * made for (`<key>ModelId`) and applies only while that model runs; any
156
+ * other model runs at its own default (D738). Read and written only through
157
+ * `pipeline/model-bound-settings.ts`.
158
+ */
159
+ readonly bindsToModel?: boolean;
146
160
  /**
147
161
  * Save behavior when value changes.
148
162
  * - true: save immediately on change (toggles, selects, checkboxes)
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Model-bound step settings (D738): an operator value that is only meaningful
3
+ * for ONE model, stored together with that model's id.
4
+ *
5
+ * The per-class confidence floors are the case it exists for. A score is a
6
+ * property of one detector's output scale — on this hub the median score of a
7
+ * correct person was 0.78 on `yolov9m-320-int8`, 0.68 on `yolo26s-320-int8`,
8
+ * 0.40 on `yolo26n-320-int8` and 0.89 on `yolo26s` (640) — so a floor tuned on
9
+ * one model is wrong on the next. The DEFAULT of such a field belongs to the
10
+ * model (the catalog entry); an operator OVERRIDE belongs to the model it was
11
+ * made for.
12
+ *
13
+ * The binding is checked at READ time against the model that RUNS, never
14
+ * enforced by a write on the model-change path: a model can change without any
15
+ * operator write at all (an unpinned root follows the elected device's
16
+ * hardware-aware default, D736), and an event-driven reset could be dropped
17
+ * (events are telemetry, D8/D11). So:
18
+ *
19
+ * effective = override when the stored binding names the running model
20
+ * | override when no binding is stored (a legacy / programmatic
21
+ * value — it applies to whatever runs, as before D738)
22
+ * | the running model's default, when it declares one
23
+ * | the field's global default.
24
+ *
25
+ * Storage shape: the value stays a plain number under its own key (every
26
+ * reader of the raw settings bag keeps working), and the binding is a SIBLING
27
+ * key, {@link modelBindingKey}. Both are flat so the shallow per-key merges of
28
+ * the settings layers (node fold, camera override) carry a value and its
29
+ * binding together whenever one layer writes both — which every writer here
30
+ * does.
31
+ *
32
+ * Lives in the bare `@camstack/types` entry, which every addon bundles, so the
33
+ * runner (`addon-pipeline`) and the editors (`ui-library`, `addon-admin-ui`)
34
+ * apply the same rule.
35
+ */
36
+ /** `minConfidencePerson` → `minConfidencePersonModelId`. */
37
+ export declare function modelBindingKey(key: string): string;
38
+ /** A loose step-settings bag, as it is stored and travels. */
39
+ export type ModelBoundSettingsBag = Readonly<Record<string, unknown>>;
40
+ /** Where an effective model-bound value came from. */
41
+ export type ModelBoundSettingSource = 'override' | 'model-default' | 'global-default';
42
+ /** An override that is stored but not applied, because another model runs. */
43
+ export interface InapplicableModelBoundOverride {
44
+ readonly value: unknown;
45
+ readonly modelId: string;
46
+ }
47
+ /** The effective value of one model-bound field, and why. */
48
+ export interface ModelBoundSettingState {
49
+ readonly value: unknown;
50
+ readonly source: ModelBoundSettingSource;
51
+ /** The model the applied override was made for; absent for a legacy unbound value. */
52
+ readonly boundModelId?: string;
53
+ /** A stored override that does NOT apply to the running model. */
54
+ readonly inapplicableOverride?: InapplicableModelBoundOverride;
55
+ }
56
+ /**
57
+ * The effective value of `key` for the model that runs (`runningModelId`,
58
+ * `undefined` when unknown — it then matches no binding).
59
+ */
60
+ export declare function resolveModelBoundSetting(settings: ModelBoundSettingsBag | undefined, key: string, runningModelId: string | undefined, modelDefault: unknown, globalDefault: unknown): ModelBoundSettingState;
61
+ /**
62
+ * The OPERATOR layer of a step's settings as the running model sees it: every
63
+ * model-bound value made for another model is removed (so the default
64
+ * underneath — the running model's — wins the merge), and every binding key is
65
+ * stripped. Unbound values are kept. Returns a fresh object; `undefined` stays
66
+ * `undefined`.
67
+ */
68
+ export declare function applyModelBoundSettings(settings: ModelBoundSettingsBag | undefined, boundKeys: readonly string[], runningModelId: string | undefined): Record<string, unknown> | undefined;
69
+ /** Store `value` for `key`, made for `modelId`. Returns a fresh object. */
70
+ export declare function writeModelBoundSetting(settings: ModelBoundSettingsBag | undefined, key: string, value: unknown, modelId: string): Record<string, unknown>;
71
+ /** Remove an override and its binding — "reset to the model default". */
72
+ export declare function clearModelBoundSetting(settings: ModelBoundSettingsBag | undefined, key: string): Record<string, unknown>;
73
+ /** True when any of `boundKeys` has an override IN FORCE for `modelId`. */
74
+ export declare function hasModelBoundOverrides(settings: ModelBoundSettingsBag | undefined, boundKeys: readonly string[], modelId: string | undefined): boolean;
75
+ /**
76
+ * "Reset thresholds to model defaults": remove every override of `boundKeys`
77
+ * that is in force for `modelId` (bound to it, or unbound), with its binding —
78
+ * one result, so the editor writes it in one save. An override stored for
79
+ * ANOTHER model is kept: it is not in force here, and it applies again when
80
+ * that model runs.
81
+ */
82
+ export declare function clearModelBoundOverrides(settings: ModelBoundSettingsBag | undefined, boundKeys: readonly string[], modelId: string | undefined): Record<string, unknown>;
@@ -69,6 +69,8 @@ export interface ModelVariantTier {
69
69
  export interface ModelVariantFamily {
70
70
  readonly family: string;
71
71
  readonly label: string;
72
+ /** One short line on what picking this family means, when it is not obvious. */
73
+ readonly hint?: string;
72
74
  readonly tiers: readonly ModelVariantTier[];
73
75
  }
74
76
  /**
@@ -193,6 +193,10 @@ export type ModelLicense = z.infer<typeof ModelLicenseSchema>;
193
193
  * - `crop`: the root draws the box the step would have found (`license_plate`
194
194
  * for plate-detection, `face` for face-detection). The box becomes a detail
195
195
  * child of the `parentMacro` detection that contains it — never a track.
196
+ * - `mask`: the root's decode emits an instance mask with every detection (a
197
+ * YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
198
+ * detection in the shape that step produces. Derived from the model's
199
+ * postprocessor on read, never stored by an import.
196
200
  */
197
201
  export declare const RootStepSupplySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
198
202
  kind: z.ZodLiteral<"label">;
@@ -219,6 +223,11 @@ export declare const RootStepSupplySchema: z.ZodDiscriminatedUnion<[z.ZodObject<
219
223
  plate: "plate";
220
224
  }>;
221
225
  rootInputPx: z.ZodOptional<z.ZodNumber>;
226
+ }, z.core.$strip>, z.ZodObject<{
227
+ kind: z.ZodLiteral<"mask">;
228
+ stepId: z.ZodEnum<{
229
+ segmentation: "segmentation";
230
+ }>;
222
231
  }, z.core.$strip>], "kind">;
223
232
  export type RootStepSupply = z.infer<typeof RootStepSupplySchema>;
224
233
  export declare const ModelCatalogEntrySchema: z.ZodObject<{
@@ -310,6 +319,12 @@ export declare const ModelCatalogEntrySchema: z.ZodObject<{
310
319
  }>>;
311
320
  postprocessor: z.ZodOptional<z.ZodCustom<PostprocessorType, PostprocessorType>>;
312
321
  defaultConfidence: z.ZodOptional<z.ZodNumber>;
322
+ defaultClassFloors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
323
+ gpuInferencePrecision: z.ZodOptional<z.ZodEnum<{
324
+ f32: "f32";
325
+ f16: "f16";
326
+ }>>;
327
+ suppliedLabelFloors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
313
328
  faceAlignment: z.ZodOptional<z.ZodBoolean>;
314
329
  extraFiles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
315
330
  url: z.ZodString;
@@ -396,6 +411,11 @@ export declare const ModelCatalogEntrySchema: z.ZodObject<{
396
411
  plate: "plate";
397
412
  }>;
398
413
  rootInputPx: z.ZodOptional<z.ZodNumber>;
414
+ }, z.core.$strip>, z.ZodObject<{
415
+ kind: z.ZodLiteral<"mask">;
416
+ stepId: z.ZodEnum<{
417
+ segmentation: "segmentation";
418
+ }>;
399
419
  }, z.core.$strip>], "kind">>>>;
400
420
  clip: z.ZodOptional<z.ZodObject<{
401
421
  textModelId: z.ZodString;
@@ -482,11 +502,11 @@ export declare const ModelConvertMetadataSchema: z.ZodObject<{
482
502
  }>>;
483
503
  outputFormat: z.ZodEnum<{
484
504
  classification: "classification";
505
+ segmentation: "segmentation";
485
506
  yolo: "yolo";
486
507
  ssd: "ssd";
487
508
  embedding: "embedding";
488
509
  ocr: "ocr";
489
- segmentation: "segmentation";
490
510
  }>;
491
511
  faceAlignment: z.ZodOptional<z.ZodBoolean>;
492
512
  classMap: z.ZodOptional<z.ZodObject<{
@@ -608,6 +628,12 @@ export declare const ConvertResultSchema: z.ZodObject<{
608
628
  }>>;
609
629
  postprocessor: z.ZodOptional<z.ZodCustom<PostprocessorType, PostprocessorType>>;
610
630
  defaultConfidence: z.ZodOptional<z.ZodNumber>;
631
+ defaultClassFloors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
632
+ gpuInferencePrecision: z.ZodOptional<z.ZodEnum<{
633
+ f32: "f32";
634
+ f16: "f16";
635
+ }>>;
636
+ suppliedLabelFloors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
611
637
  faceAlignment: z.ZodOptional<z.ZodBoolean>;
612
638
  extraFiles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
613
639
  url: z.ZodString;
@@ -694,6 +720,11 @@ export declare const ConvertResultSchema: z.ZodObject<{
694
720
  plate: "plate";
695
721
  }>;
696
722
  rootInputPx: z.ZodOptional<z.ZodNumber>;
723
+ }, z.core.$strip>, z.ZodObject<{
724
+ kind: z.ZodLiteral<"mask">;
725
+ stepId: z.ZodEnum<{
726
+ segmentation: "segmentation";
727
+ }>;
697
728
  }, z.core.$strip>], "kind">>>>;
698
729
  clip: z.ZodOptional<z.ZodObject<{
699
730
  textModelId: z.ZodString;
@@ -251,6 +251,11 @@ export interface PoolModelConfig {
251
251
  * `ModelCatalogEntry.outputProbabilities`.
252
252
  */
253
253
  readonly outputProbabilities?: boolean;
254
+ /**
255
+ * OpenVINO GPU inference precision the model needs (`INFERENCE_PRECISION_HINT`,
256
+ * GPU only). See `ModelCatalogEntry.gpuInferencePrecision`. Absent ⇒ device default.
257
+ */
258
+ readonly gpuInferencePrecision?: 'f32' | 'f16';
254
259
  /** Postprocessor to apply to raw output in Python */
255
260
  readonly postprocessor: PostprocessorType;
256
261
  /** Confidence threshold for NMS / filtering */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.312",
3
+ "version": "1.2.314",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",