@camstack/types 1.2.318 → 1.2.319

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,10 +1,10 @@
1
1
  import type { DeviceDemand } from './plan-schemas.js';
2
2
  /** How a camera's detection runs. `disabled` cameras charge nothing. */
3
- export type BestSettingsDetectionMode = 'always-on' | 'on-motion' | 'disabled';
3
+ export type AutoTuneDetectionMode = 'always-on' | 'on-motion' | 'disabled';
4
4
  /** One camera's detection load. */
5
- export interface BestSettingsCameraLoad {
5
+ export interface AutoTuneCameraLoad {
6
6
  readonly deviceId: number;
7
- readonly mode: BestSettingsDetectionMode;
7
+ readonly mode: AutoTuneDetectionMode;
8
8
  /** Detection frames per second while a session runs. */
9
9
  readonly fps: number;
10
10
  /** False when only the camera's own (onboard) detector runs — no pipeline root. */
@@ -35,7 +35,7 @@ export interface DemandShares {
35
35
  readonly clusterPeak: ObservedClusterPeak | null;
36
36
  }
37
37
  /** A device the balancer may place a session on. */
38
- export interface BestSettingsEligibleDevice {
38
+ export interface AutoTuneEligibleDevice {
39
39
  readonly nodeId: string;
40
40
  readonly deviceKey: string;
41
41
  readonly weight: number;
@@ -66,8 +66,8 @@ export declare function estimatedConcurrentSessions(cameraCount: number, options
66
66
  * Demand on every eligible device of the cluster.
67
67
  */
68
68
  export declare function estimateDeviceDemand(input: {
69
- readonly cameras: readonly BestSettingsCameraLoad[];
70
- readonly eligible: readonly BestSettingsEligibleDevice[];
69
+ readonly cameras: readonly AutoTuneCameraLoad[];
70
+ readonly eligible: readonly AutoTuneEligibleDevice[];
71
71
  readonly peaks: readonly ObservedDevicePeak[];
72
72
  readonly options?: DemandOptions;
73
73
  /** Present ⇒ share placement (D748); absent ⇒ least-loaded. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Static hardware classification for the Best settings recommender (D745).
2
+ * Static hardware classification for the Auto tune recommender (D745).
3
3
  *
4
4
  * A node is classified from the facts its platform probe already reports —
5
5
  * `cpuModel`, `arch`, `gpu`, `npu` — never from a benchmark. The class picks a
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Best settings (D745): the static-hardware × measured-latency × demand
2
+ * Auto tune (D745): the static-hardware × measured-latency × demand
3
3
  * recommender of ONE detector family for the whole cluster, and the shapes of
4
4
  * its plan. See `recommend.ts`.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The wire shapes of the Best settings plan and apply (D745), used by the
2
+ * The wire shapes of the Auto tune plan and apply (D745), used by the
3
3
  * `pipeline-orchestrator` cap. The recommender's own types
4
4
  * (`recommend.ts`, `demand.ts`) are the TS face of the same data; these
5
5
  * schemas are what crosses the cap boundary.
@@ -385,7 +385,7 @@ export declare const DetectorStoreClearSchema: z.ZodObject<{
385
385
  deviceId: z.ZodNumber;
386
386
  keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
387
387
  }, z.core.$strip>;
388
- export declare const BestSettingsWarningSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
388
+ export declare const AutoTuneWarningSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
389
389
  kind: z.ZodLiteral<"detector-store-cluster-wide">;
390
390
  skippedNodes: z.ZodReadonly<z.ZodArray<z.ZodString>>;
391
391
  }, z.core.$strip>, z.ZodObject<{
@@ -396,14 +396,14 @@ export declare const BestSettingsWarningSchema: z.ZodDiscriminatedUnion<[z.ZodOb
396
396
  nodeId: z.ZodString;
397
397
  deviceKey: z.ZodString;
398
398
  }, z.core.$strip>], "kind">;
399
- export declare const BestSettingsOptionsSchema: z.ZodObject<{
399
+ export declare const AutoTuneOptionsSchema: z.ZodObject<{
400
400
  headroom: z.ZodDefault<z.ZodNumber>;
401
401
  shares: z.ZodOptional<z.ZodObject<{
402
402
  nodes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
403
403
  devices: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>>;
404
404
  }, z.core.$strip>>;
405
405
  }, z.core.$strip>;
406
- export declare const BestSettingsPlanSchema: z.ZodObject<{
406
+ export declare const AutoTunePlanSchema: z.ZodObject<{
407
407
  planHash: z.ZodString;
408
408
  family: z.ZodLiteral<"yolov9">;
409
409
  headroom: z.ZodNumber;
@@ -610,11 +610,11 @@ export declare const BestSettingsPlanSchema: z.ZodObject<{
610
610
  deviceKey: z.ZodString;
611
611
  }, z.core.$strip>], "kind">>>;
612
612
  }, z.core.$strip>;
613
- export declare const BestSettingsApplyInputSchema: z.ZodObject<{
613
+ export declare const AutoTuneApplyInputSchema: z.ZodObject<{
614
614
  planHash: z.ZodString;
615
615
  headroom: z.ZodDefault<z.ZodNumber>;
616
616
  }, z.core.$strip>;
617
- export declare const BestSettingsPhaseResultSchema: z.ZodObject<{
617
+ export declare const AutoTunePhaseResultSchema: z.ZodObject<{
618
618
  phase: z.ZodEnum<{
619
619
  download: "download";
620
620
  "camera-overrides": "camera-overrides";
@@ -625,7 +625,7 @@ export declare const BestSettingsPhaseResultSchema: z.ZodObject<{
625
625
  ok: z.ZodBoolean;
626
626
  detail: z.ZodString;
627
627
  }, z.core.$strip>;
628
- export declare const BestSettingsApplyResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
628
+ export declare const AutoTuneApplyResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
629
629
  kind: z.ZodLiteral<"applied">;
630
630
  planHash: z.ZodString;
631
631
  phases: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -867,15 +867,15 @@ export declare const BestSettingsApplyResultSchema: z.ZodDiscriminatedUnion<[z.Z
867
867
  "apply-in-progress": "apply-in-progress";
868
868
  }>;
869
869
  }, z.core.$strip>], "kind">;
870
- export type BestSettingsPlan = z.infer<typeof BestSettingsPlanSchema>;
871
- export type BestSettingsOptions = z.infer<typeof BestSettingsOptionsSchema>;
872
- export type BestSettingsApplyInput = z.infer<typeof BestSettingsApplyInputSchema>;
873
- export type BestSettingsApplyResult = z.infer<typeof BestSettingsApplyResultSchema>;
874
- export type BestSettingsPhaseResult = z.infer<typeof BestSettingsPhaseResultSchema>;
875
- export type BestSettingsWarning = z.infer<typeof BestSettingsWarningSchema>;
870
+ export type AutoTunePlan = z.infer<typeof AutoTunePlanSchema>;
871
+ export type AutoTuneOptions = z.infer<typeof AutoTuneOptionsSchema>;
872
+ export type AutoTuneApplyInput = z.infer<typeof AutoTuneApplyInputSchema>;
873
+ export type AutoTuneApplyResult = z.infer<typeof AutoTuneApplyResultSchema>;
874
+ export type AutoTunePhaseResult = z.infer<typeof AutoTunePhaseResultSchema>;
875
+ export type AutoTuneWarning = z.infer<typeof AutoTuneWarningSchema>;
876
876
  export type DetectorStoreClear = z.infer<typeof DetectorStoreClearSchema>;
877
- export type BestSettingsCameraOverrideClear = z.infer<typeof CameraOverrideClearSchema>;
878
- export type BestSettingsNodeDeviceChange = z.infer<typeof NodeDeviceChangeSchema>;
877
+ export type AutoTuneCameraOverrideClear = z.infer<typeof CameraOverrideClearSchema>;
878
+ export type AutoTuneNodeDeviceChange = z.infer<typeof NodeDeviceChangeSchema>;
879
879
  export type HardwareClassId = z.infer<typeof HardwareClassIdSchema>;
880
880
  export type AcceleratorKind = z.infer<typeof AcceleratorKindSchema>;
881
881
  export type RecommendationReason = z.infer<typeof RecommendationReasonSchema>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The Best settings recommender (D745): one detector per node, from ONE family
2
+ * The Auto tune recommender (D745): one detector per node, from ONE family
3
3
  * (YOLOv9) for the whole cluster, chosen from static hardware facts × the
4
4
  * measured latency table × the node's detection demand. Pure; no benchmark.
5
5
  *
@@ -24,30 +24,30 @@ import type { ModelFormat } from '../../types/models.js';
24
24
  import { type DetectorPerfTable } from './detector-performance.js';
25
25
  import type { DeviceDemand, NodeRecommendation } from './plan-schemas.js';
26
26
  /** The family the cluster runs. */
27
- export declare const BEST_SETTINGS_FAMILY = "yolov9";
27
+ export declare const AUTO_TUNE_FAMILY = "yolov9";
28
28
  /** Recall within this of the best counts as a tie — the faster one wins. */
29
29
  export declare const RECALL_TIE = 0.02;
30
30
  /** Default share of an accelerator's throughput kept free. */
31
31
  export declare const DEFAULT_HEADROOM = 0.4;
32
32
  /** One device of a node, as the recommender reads it. */
33
- export interface BestSettingsDeviceInput {
33
+ export interface AutoTuneDeviceInput {
34
34
  readonly key: string;
35
35
  readonly format: ModelFormat;
36
36
  readonly enabled: boolean;
37
37
  readonly available: boolean;
38
38
  }
39
39
  /** One node, as the recommender reads it. */
40
- export interface BestSettingsNodeInput {
40
+ export interface AutoTuneNodeInput {
41
41
  readonly nodeId: string;
42
42
  readonly reachable: boolean;
43
43
  readonly hardware: HardwareInfo | null;
44
- readonly devices: readonly BestSettingsDeviceInput[];
44
+ readonly devices: readonly AutoTuneDeviceInput[];
45
45
  /** Object-detection model id → the formats it has a build for, from the node's catalog. */
46
46
  readonly formatsByModel: Readonly<Record<string, readonly ModelFormat[]>>;
47
47
  }
48
48
  /** Recommend one node. See the module header. */
49
49
  export declare function recommendNode(input: {
50
- readonly node: BestSettingsNodeInput;
50
+ readonly node: AutoTuneNodeInput;
51
51
  readonly demand: readonly DeviceDemand[];
52
52
  readonly headroom?: number;
53
53
  readonly perf?: DetectorPerfTable;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The shares a session election actually reads, and the view the Load
3
+ * balancing tab shows (D750). Pure.
4
+ *
5
+ * The SOURCE decides the configured weights: the automatic capacity shares,
6
+ * or the operator's stored sliders. Eligibility decides the effective ones: a
7
+ * node or device that cannot take a session now (offline, switched off, no
8
+ * detect capability, unable to run the root) contributes nothing, and the
9
+ * others split its share in proportion to their own. That redistribution is
10
+ * exactly what `electByShare` does over its candidate set, so the view and
11
+ * the election cannot disagree; the stored values are never rewritten for it.
12
+ */
13
+ import type { EffectiveShares, SessionPlacementPolicy, ShareSource, ShareWeights } from './schemas.js';
14
+ export interface EffectiveSharesInput {
15
+ readonly source: ShareSource;
16
+ /** Every node the view covers, eligible or not. */
17
+ readonly nodeIds: readonly string[];
18
+ readonly stored: ShareWeights;
19
+ /** The last automatic computation; null = none yet. */
20
+ readonly auto: ShareWeights | null;
21
+ readonly eligibleNodes: readonly string[];
22
+ /** nodeId → device keys that can take sessions; a node absent here lists none. */
23
+ readonly eligibleDevices: Readonly<Record<string, readonly string[]>>;
24
+ readonly policy?: SessionPlacementPolicy;
25
+ readonly computedAt?: number | null;
26
+ readonly trigger?: string | null;
27
+ }
28
+ export declare function resolveEffectiveShares(input: EffectiveSharesInput): EffectiveShares;
@@ -1,6 +1,8 @@
1
1
  /**
2
- * Load balancing (D748): the share placement policy for detection sessions
3
- * and the shapes of its admin surface. See `share-election.ts`.
2
+ * Load balancing (D748, D750): the share placement policy for detection
3
+ * sessions, where its shares come from, and the shapes of its admin surface.
4
+ * See `share-election.ts` and `effective-shares.ts`.
4
5
  */
5
6
  export * from './share-election.js';
6
7
  export * from './schemas.js';
8
+ export * from './effective-shares.js';
@@ -17,10 +17,14 @@ export declare const SessionPlacementPolicySchema: z.ZodEnum<{
17
17
  share: "share";
18
18
  }>;
19
19
  export type SessionPlacementPolicy = z.infer<typeof SessionPlacementPolicySchema>;
20
+ /**
21
+ * `share` since D750: the percentages are held by default. `least-loaded` stays
22
+ * selectable.
23
+ */
20
24
  export declare const DEFAULT_SESSION_PLACEMENT_POLICY: SessionPlacementPolicy;
21
25
  /** The global-settings key the policy is stored under (orchestrator `load` section). */
22
26
  export declare const SESSION_PLACEMENT_SETTING_KEY = "sessionPlacement";
23
- /** Parse a stored value; anything unknown is the default (nothing changes on deploy). */
27
+ /** Parse a stored value; anything unknown is the default. */
24
28
  export declare function parseSessionPlacementPolicy(value: unknown): SessionPlacementPolicy;
25
29
  export declare const LoadBalancingSharesInputSchema: z.ZodObject<{
26
30
  nodes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
@@ -144,3 +148,85 @@ export declare const SuggestSharesResultSchema: z.ZodObject<{
144
148
  }, z.core.$strip>>>;
145
149
  }, z.core.$strip>;
146
150
  export type SuggestSharesResult = z.infer<typeof SuggestSharesResultSchema>;
151
+ /**
152
+ * Where the node and device shares come from (D750).
153
+ * - `auto` — computed by the system from the cluster's measured capacity at
154
+ * the Auto tune models, and recomputed whenever a node or device joins,
155
+ * leaves, is switched on or off, or changes model.
156
+ * - `manual` — the operator's stored sliders. A node or device that cannot
157
+ * take sessions gives its share to the others in proportion; the stored
158
+ * values are never rewritten for that.
159
+ */
160
+ export declare const ShareSourceSchema: z.ZodEnum<{
161
+ manual: "manual";
162
+ auto: "auto";
163
+ }>;
164
+ export type ShareSource = z.infer<typeof ShareSourceSchema>;
165
+ export declare const DEFAULT_SHARE_SOURCE: ShareSource;
166
+ /** Headroom the automatic shares are computed at (Auto tune's default). */
167
+ export declare const AUTO_SHARE_HEADROOM = 0.4;
168
+ /** The global-settings key the share source is stored under (orchestrator `load` section). */
169
+ export declare const SHARE_SOURCE_SETTING_KEY = "shareSource";
170
+ /** Parse a stored value; anything unknown is the default. */
171
+ export declare function parseShareSource(value: unknown): ShareSource;
172
+ export declare const SetShareSourceInputSchema: z.ZodObject<{
173
+ source: z.ZodEnum<{
174
+ manual: "manual";
175
+ auto: "auto";
176
+ }>;
177
+ }, z.core.$strip>;
178
+ export type SetShareSourceInput = z.infer<typeof SetShareSourceInputSchema>;
179
+ /** Raw relative weights (any scale) per node and per node's device. */
180
+ export declare const ShareWeightsSchema: z.ZodObject<{
181
+ nodes: z.ZodRecord<z.ZodString, z.ZodNumber>;
182
+ devices: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
183
+ }, z.core.$strip>;
184
+ export type ShareWeights = z.infer<typeof ShareWeightsSchema>;
185
+ export declare const EffectiveDeviceShareSchema: z.ZodObject<{
186
+ deviceKey: z.ZodString;
187
+ eligible: z.ZodBoolean;
188
+ configuredPct: z.ZodNumber;
189
+ effectivePct: z.ZodNumber;
190
+ }, z.core.$strip>;
191
+ export type EffectiveDeviceShare = z.infer<typeof EffectiveDeviceShareSchema>;
192
+ export declare const EffectiveNodeShareSchema: z.ZodObject<{
193
+ nodeId: z.ZodString;
194
+ eligible: z.ZodBoolean;
195
+ configuredPct: z.ZodNumber;
196
+ effectivePct: z.ZodNumber;
197
+ devices: z.ZodReadonly<z.ZodArray<z.ZodObject<{
198
+ deviceKey: z.ZodString;
199
+ eligible: z.ZodBoolean;
200
+ configuredPct: z.ZodNumber;
201
+ effectivePct: z.ZodNumber;
202
+ }, z.core.$strip>>>;
203
+ }, z.core.$strip>;
204
+ export type EffectiveNodeShare = z.infer<typeof EffectiveNodeShareSchema>;
205
+ export declare const EffectiveSharesSchema: z.ZodObject<{
206
+ source: z.ZodEnum<{
207
+ manual: "manual";
208
+ auto: "auto";
209
+ }>;
210
+ policy: z.ZodEnum<{
211
+ "least-loaded": "least-loaded";
212
+ share: "share";
213
+ }>;
214
+ autoPending: z.ZodBoolean;
215
+ computedAt: z.ZodNullable<z.ZodNumber>;
216
+ trigger: z.ZodNullable<z.ZodString>;
217
+ nodes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
218
+ nodeId: z.ZodString;
219
+ eligible: z.ZodBoolean;
220
+ configuredPct: z.ZodNumber;
221
+ effectivePct: z.ZodNumber;
222
+ devices: z.ZodReadonly<z.ZodArray<z.ZodObject<{
223
+ deviceKey: z.ZodString;
224
+ eligible: z.ZodBoolean;
225
+ configuredPct: z.ZodNumber;
226
+ effectivePct: z.ZodNumber;
227
+ }, z.core.$strip>>>;
228
+ }, z.core.$strip>>>;
229
+ nodeWeights: z.ZodRecord<z.ZodString, z.ZodNumber>;
230
+ deviceWeights: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
231
+ }, z.core.$strip>;
232
+ export type EffectiveShares = z.infer<typeof EffectiveSharesSchema>;
@@ -84,6 +84,6 @@ export declare function clearModelBoundOverrides(settings: ModelBoundSettingsBag
84
84
  /**
85
85
  * The keys of every `bindsToModel` field of a step's config schema, groups
86
86
  * flattened (D738). One definition for the runner (which applies the binding)
87
- * and the orchestrator's Best settings (which clears those overrides, D745).
87
+ * and the orchestrator's Auto tune (which clears those overrides, D745).
88
88
  */
89
89
  export declare function collectModelBoundKeys(fields: readonly ConfigField[]): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.318",
3
+ "version": "1.2.319",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",