@camstack/types 1.1.57 → 1.1.76

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.
@@ -19,10 +19,11 @@
19
19
  */
20
20
  import type { CameraPipelineConfig } from './camera-pipeline.js';
21
21
  /**
22
- * Per-addon configuration stored under `agent.addonDefaults[addonId]`.
23
- * Every addon in the catalog gets one entry — whether enabled or not.
24
- * Operators edit these to pick models, tune settings, flip default
25
- * enabled state for their hardware.
22
+ * LEGACY per-addon configuration (the removed per-node model layer,
23
+ * `agent.addonDefaults[addonId]`). Retained ONLY for the one-shot boot
24
+ * migration that strips `addonDefaults`, and for UI/library code pending
25
+ * the per-(node,device) rework. New code carries model/settings per
26
+ * `(node,device)` via {@link DeviceStepConfig}.
26
27
  *
27
28
  * modelId present ONLY when the operator explicitly chose a model;
28
29
  * absent = use this node's format default (resolved on-the-fly by the
@@ -34,16 +35,25 @@ export interface AgentAddonConfig {
34
35
  readonly settings: Readonly<Record<string, unknown>>;
35
36
  }
36
37
  /**
37
- * Partial override of a single addon's config for one (device, agent) pair.
38
- * Every field is optional the resolver shallow-merges this patch on top
39
- * of the agent.addonDefaults base, so operators can override one field
40
- * (e.g. just the model) without redeclaring the whole config. The merge is
41
- * per-field on the top-level interface keys only: when `settings` is present
42
- * on the patch, it fully replaces the base `settings` map (no key-level
43
- * deep merge inside `settings`).
38
+ * Per-(node,device) BASE provisioning for one step: the model + intrinsic
39
+ * settings the executing node applies for EVERY camera landing on that
40
+ * accelerator. Both fields optional absent = the executor resolves its own
41
+ * format default at runtime. This is the same shape carried by the
42
+ * per-camera-device OVERRIDE ({@link CameraStepOverridePatch}); the dispatch
43
+ * provisioning stage merges override on top of base (`override ?? base`).
44
+ */
45
+ export interface DeviceStepConfig {
46
+ readonly modelId?: string;
47
+ readonly settings?: Readonly<Record<string, unknown>>;
48
+ }
49
+ /**
50
+ * Per-(camera,node,device,step) override patch over the per-(node,device)
51
+ * base ({@link DeviceStepConfig}). Both fields optional — unset means
52
+ * "inherit from the device base". Enablement is NOT carried here: which
53
+ * steps run is the per-camera `stepToggles` authority. When `settings` is
54
+ * present it merges over the base `settings` (override keys win).
44
55
  */
45
56
  export interface CameraStepOverridePatch {
46
- readonly enabled?: boolean;
47
57
  readonly modelId?: string;
48
58
  readonly settings?: Readonly<Record<string, unknown>>;
49
59
  }
@@ -57,7 +67,6 @@ export interface CameraStepOverridePatch {
57
67
  * on these settings nor carried on the attach payload.
58
68
  */
59
69
  export interface AgentPipelineSettings {
60
- readonly addonDefaults: Readonly<Record<string, AgentAddonConfig>>;
61
70
  /**
62
71
  * Optional per-node camera capacity cap. When set, the load balancer will
63
72
  * not assign more than this many cameras to this agent. `null` = unlimited.
@@ -111,10 +120,21 @@ export interface AgentPipelineSettings {
111
120
  * one best accelerator, others opt-in. When TWO+ keys are enabled the
112
121
  * dispatcher balances new sessions across them (weighted, by active-session
113
122
  * count) so the accelerators run CONCURRENTLY.
123
+ *
124
+ * `steps` (per-(node,device) BASE provisioning) — an optional
125
+ * `stepId → {modelId?, settings?}` map: the default model + intrinsic
126
+ * settings for EVERY camera landing on that accelerator, overridable
127
+ * per-camera via `cameraSettings.stepOverridesByDevice`. A stepId ABSENT ⇒
128
+ * that step uses the device format default. A pinned modelId MUST have a
129
+ * build for the device's FORMAT, else the executor's `resolveInputSteps`
130
+ * substitutes it back to the format default (the UI only offers
131
+ * format-compatible models, so a stored base is always valid).
114
132
  */
115
133
  readonly inferenceDevices?: Readonly<Record<string, {
116
134
  readonly enabled: boolean;
117
135
  readonly weight?: number;
136
+ readonly maxSessions?: number;
137
+ readonly steps?: Readonly<Record<string, DeviceStepConfig>>;
118
138
  }>>;
119
139
  }
120
140
  /**
@@ -128,15 +148,15 @@ export interface CameraPipelineSettings {
128
148
  readonly pinnedAgentNodeId?: string;
129
149
  readonly stepToggles?: Readonly<Record<string, boolean>>;
130
150
  /**
131
- * L2.5 per-agent per-step override. Shallow-merged on top of the L1
132
- * agent defaults AFTER the L2 flat stepToggles overlay but BEFORE the
133
- * L3 wholesale bypass. `pipelineByAgent[agent]` still takes full
134
- * precedence when present — the L2.5 map for that agent is ignored.
135
- * When an L2.5 patch has `enabled` set, it supersedes the corresponding
136
- * L2 `stepToggles` entry for that (agent, addonId) pair; L2 still
137
- * applies when the L2.5 patch leaves `enabled` undefined.
151
+ * Per-(camera,node,device) model/settings override. Addressed by
152
+ * `[agentNodeId][deviceKey][addonId]` because the camera is balanced onto
153
+ * one `(node,deviceKey)` per session and a node's accelerators share no
154
+ * format. Overrides the per-(node,device) base
155
+ * (`inferenceDevices[node][deviceKey].steps`) for one camera on one
156
+ * accelerator; the wholesale `pipelineByAgent[agent]` escape hatch, when
157
+ * present, still bypasses this. Enablement is orthogonal (`stepToggles`).
138
158
  */
139
- readonly stepOverridesByAgent?: Readonly<Record<string, Readonly<Record<string, CameraStepOverridePatch>>>>;
159
+ readonly stepOverridesByDevice?: Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, CameraStepOverridePatch>>>>>>;
140
160
  /**
141
161
  * Per-agent wholesale pipeline override. Engine is NOT stored here —
142
162
  * the override runs under the engine selected on that agent via the
@@ -21,6 +21,22 @@ export type PipelineRuntime = 'node' | 'python';
21
21
  * Python backends use their native format.
22
22
  */
23
23
  declare const BACKEND_TO_FORMAT: Readonly<Record<string, ModelFormat>>;
24
+ /**
25
+ * DEVICE-POOL backend → model format — the SSOT for the multi-device inference
26
+ * DESCRIPTOR path (Python per-device pools), distinct from {@link BACKEND_TO_FORMAT}
27
+ * above which is the legacy NODE runtime map (where `coreml → onnx` because
28
+ * onnxruntime-node's CoreML EP loads `.onnx`). Here a device pool runs the
29
+ * backend NATIVELY, so `coreml → coreml` and `edgetpu → tflite`. Consumed by
30
+ * `resolveDeviceEngine` (addon-pipeline) and the orchestrator's
31
+ * `parseDeviceKey`/`getNodeInferenceDevices` — the previously-duplicated
32
+ * `BACKEND_FORMAT` maps (R3/node-F2). `cpu`/`cuda` floor to onnx.
33
+ */
34
+ declare const DEVICE_BACKEND_TO_FORMAT: Readonly<Record<string, ModelFormat>>;
35
+ /**
36
+ * Resolve a DEVICE-POOL backend to its model format via {@link DEVICE_BACKEND_TO_FORMAT},
37
+ * flooring unknown backends to `onnx`. The single entry point both addons call.
38
+ */
39
+ declare function deviceBackendToFormat(backend: string): ModelFormat;
24
40
  /**
25
41
  * Map DetectionRuntime to ModelFormat.
26
42
  * Used when the addon receives an explicit runtime (not 'auto').
@@ -84,4 +100,4 @@ export declare function pythonScriptForBackend(backend: string): string | undefi
84
100
  * 'coreml', 'pytorch', 'openvino' need Python; 'onnx' and 'tflite' don't.
85
101
  */
86
102
  export declare function requiresPython(runtime: DetectionRuntime | string): boolean;
87
- export { BACKEND_TO_FORMAT, RUNTIME_TO_FORMAT, PYTHON_SCRIPT };
103
+ export { BACKEND_TO_FORMAT, DEVICE_BACKEND_TO_FORMAT, deviceBackendToFormat, RUNTIME_TO_FORMAT, PYTHON_SCRIPT, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.1.57",
3
+ "version": "1.1.76",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",