@camstack/types 1.0.3 → 1.0.5

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,15 @@
1
+ /**
2
+ * Minimal configuration port consumed by the shared `NodeRuntime`.
3
+ *
4
+ * The runtime never reaches a concrete config service: hub and agent each
5
+ * supply their own adapter (the hub over its `ConfigService`, the agent over
6
+ * env + `/data/agent.json`). Keeping the surface to a namespaced get/set keeps
7
+ * the runtime host-agnostic — a port leak (the runtime reaching a backend type)
8
+ * must break the agent build, which is the desired signal.
9
+ */
10
+ export interface ConfigPort {
11
+ /** Read a namespaced config value (e.g. "capabilities.singleton.storage"). */
12
+ get<T = string>(key: string): T | undefined;
13
+ /** Persist a namespaced config value. May be async (storage-backed). */
14
+ set(key: string, value: unknown): void | Promise<void>;
15
+ }
@@ -278,7 +278,7 @@ export interface SystemReadyStatePayload {
278
278
  * `framework-update` — single system-package update via `updateFrameworkPackage`
279
279
  * `manual` — operator-triggered restart (restartServer)
280
280
  * `system` — internal / supervisor-initiated restart
281
- * `framework-bulk-update` — multi-package bulk update orchestrated by BulkUpdateCoordinator
281
+ * `framework-bulk-update` — multi-package bulk update run as one lifecycle engine job
282
282
  */
283
283
  export interface PendingRestartMarkerPayload {
284
284
  readonly kind: 'framework-update' | 'manual' | 'system' | 'framework-bulk-update';
@@ -799,6 +799,21 @@ export interface EventCatalog {
799
799
  }>;
800
800
  readonly timestamp: number;
801
801
  };
802
+ /**
803
+ * Per-node detection-engine runtime-provisioning transition. Carries
804
+ * the `EngineProvisioningState` snapshot (runtimeId / device / phase +
805
+ * optional progress / error / nextRetryAt). `nodeId` rides on
806
+ * `event.source.nodeId`. Emitted by the detection-pipeline provider on
807
+ * every state change. Phase 2.
808
+ */
809
+ 'pipeline.engine-provisioning': {
810
+ readonly runtimeId: 'onnx' | 'openvino' | 'coreml' | null;
811
+ readonly device: string | null;
812
+ readonly state: 'idle' | 'installing' | 'verifying' | 'ready' | 'failed';
813
+ readonly progress?: number;
814
+ readonly error?: string;
815
+ readonly nextRetryAt?: number;
816
+ };
802
817
  /**
803
818
  * Cluster topology snapshot — same payload shape that
804
819
  * `nodes.topology` returns. Emitted by the hub on any agent /
@@ -952,12 +967,10 @@ export interface EventCatalog {
952
967
  readonly freedMB?: number;
953
968
  };
954
969
  /**
955
- * Progress snapshot emitted by `BulkUpdateCoordinator` on every state
956
- * transition (item status change, phase change, completion, cancel).
957
- * Payload is `BulkUpdateState`. Admin UI subscribes via `useLiveEvent`
958
- * to drive the sticky `BulkUpdateBanner` and per-row `AddonRowBadge`.
959
- *
960
- * Spec: docs/superpowers/specs/2026-05-21-addons-bulk-update-progress-design.md
970
+ * Legacy bulk-update progress snapshot (payload `BulkUpdateState`). No longer
971
+ * emitted F3 removed the coordinator that produced it; "Update all" now runs
972
+ * as one lifecycle engine job. Retained only to keep the event maps stable;
973
+ * removed in F4 once live bulk progress moves to the engine events.
961
974
  */
962
975
  'addons.bulk-update-progress': BulkUpdateState;
963
976
  /**
@@ -6,6 +6,7 @@ import type { FrameResult, DetectorOutput } from '../types/detection.js';
6
6
  import type { ConfigUISchema } from './config-ui.js';
7
7
  import type { InferenceCapabilities } from './inference-capabilities.js';
8
8
  import type { IAddonResolver } from './pipeline-runner.js';
9
+ import type { EngineProvisioning } from '../capabilities/pipeline-executor.cap.js';
9
10
  /**
10
11
  * Step configuration for pipeline execution — no runtime/backend (comes
11
12
  * from engine). Phase 7 (settings redesign) removed the generic
@@ -72,6 +73,13 @@ export interface IPipelineExecutorProvider {
72
73
  getGlobalPipelineConfig(): Promise<PipelineConfig | null>;
73
74
  /** Get the currently selected engine (bootstrap default on the node). */
74
75
  getSelectedEngine(): Promise<PipelineEngineChoice>;
76
+ /**
77
+ * Per-node detection-engine provisioning snapshot (idle / installing /
78
+ * verifying / ready / failed). Read by the cap and the inference gate.
79
+ * The cap routes `{ nodeId }` for provider resolution only — each node
80
+ * returns its own local machine state, so the provider takes no args.
81
+ */
82
+ getEngineProvisioning(): EngineProvisioning;
75
83
  getOrchestratorConfigSchema(): Promise<ConfigUISchema>;
76
84
  /** Get full inference capabilities (addon models, runtimes, etc.) */
77
85
  getCapabilities(forceRefresh?: boolean): Promise<InferenceCapabilities>;
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ export declare const frameworkSwapPackageSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ stagedPath: z.ZodString;
5
+ backupPath: z.ZodString;
6
+ toVersion: z.ZodString;
7
+ fromVersion: z.ZodNullable<z.ZodString>;
8
+ }, z.core.$strip>;
9
+ export type FrameworkSwapPackage = z.infer<typeof frameworkSwapPackageSchema>;
10
+ export declare const pendingFrameworkSwapSchema: z.ZodObject<{
11
+ jobId: z.ZodString;
12
+ taskId: z.ZodString;
13
+ packages: z.ZodArray<z.ZodObject<{
14
+ name: z.ZodString;
15
+ stagedPath: z.ZodString;
16
+ backupPath: z.ZodString;
17
+ toVersion: z.ZodString;
18
+ fromVersion: z.ZodNullable<z.ZodString>;
19
+ }, z.core.$strip>>;
20
+ requestedAtMs: z.ZodNumber;
21
+ schemaVersion: z.ZodLiteral<1>;
22
+ }, z.core.$strip>;
23
+ export type PendingFrameworkSwap = z.infer<typeof pendingFrameworkSwapSchema>;
24
+ export declare const frameworkSwapConfirmSchema: z.ZodObject<{
25
+ jobId: z.ZodString;
26
+ taskId: z.ZodString;
27
+ backups: z.ZodArray<z.ZodObject<{
28
+ name: z.ZodString;
29
+ backupPath: z.ZodString;
30
+ livePath: z.ZodString;
31
+ }, z.core.$strip>>;
32
+ appliedAtMs: z.ZodNumber;
33
+ bootAttempts: z.ZodNumber;
34
+ schemaVersion: z.ZodLiteral<1>;
35
+ }, z.core.$strip>;
36
+ export type FrameworkSwapConfirm = z.infer<typeof frameworkSwapConfirmSchema>;
@@ -0,0 +1,2 @@
1
+ export * from './job.js';
2
+ export * from './framework-swap.js';
@@ -0,0 +1,177 @@
1
+ import { z } from 'zod';
2
+ export declare const jobKindSchema: z.ZodEnum<{
3
+ update: "update";
4
+ install: "install";
5
+ uninstall: "uninstall";
6
+ restart: "restart";
7
+ }>;
8
+ export type JobKind = z.infer<typeof jobKindSchema>;
9
+ export declare const taskPhaseSchema: z.ZodEnum<{
10
+ failed: "failed";
11
+ queued: "queued";
12
+ fetching: "fetching";
13
+ staged: "staged";
14
+ validating: "validating";
15
+ applying: "applying";
16
+ restarting: "restarting";
17
+ applied: "applied";
18
+ done: "done";
19
+ skipped: "skipped";
20
+ }>;
21
+ export type TaskPhase = z.infer<typeof taskPhaseSchema>;
22
+ export declare const taskTargetSchema: z.ZodEnum<{
23
+ addon: "addon";
24
+ framework: "framework";
25
+ }>;
26
+ export type TaskTarget = z.infer<typeof taskTargetSchema>;
27
+ export declare const taskLogEntrySchema: z.ZodObject<{
28
+ tsMs: z.ZodNumber;
29
+ nodeId: z.ZodString;
30
+ packageName: z.ZodString;
31
+ phase: z.ZodEnum<{
32
+ failed: "failed";
33
+ queued: "queued";
34
+ fetching: "fetching";
35
+ staged: "staged";
36
+ validating: "validating";
37
+ applying: "applying";
38
+ restarting: "restarting";
39
+ applied: "applied";
40
+ done: "done";
41
+ skipped: "skipped";
42
+ }>;
43
+ message: z.ZodString;
44
+ }, z.core.$strip>;
45
+ export type TaskLogEntry = z.infer<typeof taskLogEntrySchema>;
46
+ export declare const lifecycleTaskSchema: z.ZodObject<{
47
+ taskId: z.ZodString;
48
+ nodeId: z.ZodString;
49
+ packageName: z.ZodString;
50
+ fromVersion: z.ZodNullable<z.ZodString>;
51
+ toVersion: z.ZodString;
52
+ target: z.ZodEnum<{
53
+ addon: "addon";
54
+ framework: "framework";
55
+ }>;
56
+ phase: z.ZodEnum<{
57
+ failed: "failed";
58
+ queued: "queued";
59
+ fetching: "fetching";
60
+ staged: "staged";
61
+ validating: "validating";
62
+ applying: "applying";
63
+ restarting: "restarting";
64
+ applied: "applied";
65
+ done: "done";
66
+ skipped: "skipped";
67
+ }>;
68
+ stagedPath: z.ZodNullable<z.ZodString>;
69
+ attempts: z.ZodNumber;
70
+ steps: z.ZodArray<z.ZodObject<{
71
+ tsMs: z.ZodNumber;
72
+ nodeId: z.ZodString;
73
+ packageName: z.ZodString;
74
+ phase: z.ZodEnum<{
75
+ failed: "failed";
76
+ queued: "queued";
77
+ fetching: "fetching";
78
+ staged: "staged";
79
+ validating: "validating";
80
+ applying: "applying";
81
+ restarting: "restarting";
82
+ applied: "applied";
83
+ done: "done";
84
+ skipped: "skipped";
85
+ }>;
86
+ message: z.ZodString;
87
+ }, z.core.$strip>>;
88
+ error: z.ZodNullable<z.ZodString>;
89
+ startedAtMs: z.ZodNullable<z.ZodNumber>;
90
+ finishedAtMs: z.ZodNullable<z.ZodNumber>;
91
+ }, z.core.$strip>;
92
+ export type LifecycleTask = z.infer<typeof lifecycleTaskSchema>;
93
+ export declare const lifecycleJobStateSchema: z.ZodEnum<{
94
+ running: "running";
95
+ failed: "failed";
96
+ completed: "completed";
97
+ "partially-failed": "partially-failed";
98
+ cancelled: "cancelled";
99
+ }>;
100
+ export type LifecycleJobState = z.infer<typeof lifecycleJobStateSchema>;
101
+ export declare const lifecycleJobScopeSchema: z.ZodEnum<{
102
+ single: "single";
103
+ bulk: "bulk";
104
+ cluster: "cluster";
105
+ }>;
106
+ export type LifecycleJobScope = z.infer<typeof lifecycleJobScopeSchema>;
107
+ export declare const lifecycleJobSchema: z.ZodObject<{
108
+ jobId: z.ZodString;
109
+ kind: z.ZodEnum<{
110
+ update: "update";
111
+ install: "install";
112
+ uninstall: "uninstall";
113
+ restart: "restart";
114
+ }>;
115
+ createdAtMs: z.ZodNumber;
116
+ createdBy: z.ZodString;
117
+ scope: z.ZodEnum<{
118
+ single: "single";
119
+ bulk: "bulk";
120
+ cluster: "cluster";
121
+ }>;
122
+ tasks: z.ZodArray<z.ZodObject<{
123
+ taskId: z.ZodString;
124
+ nodeId: z.ZodString;
125
+ packageName: z.ZodString;
126
+ fromVersion: z.ZodNullable<z.ZodString>;
127
+ toVersion: z.ZodString;
128
+ target: z.ZodEnum<{
129
+ addon: "addon";
130
+ framework: "framework";
131
+ }>;
132
+ phase: z.ZodEnum<{
133
+ failed: "failed";
134
+ queued: "queued";
135
+ fetching: "fetching";
136
+ staged: "staged";
137
+ validating: "validating";
138
+ applying: "applying";
139
+ restarting: "restarting";
140
+ applied: "applied";
141
+ done: "done";
142
+ skipped: "skipped";
143
+ }>;
144
+ stagedPath: z.ZodNullable<z.ZodString>;
145
+ attempts: z.ZodNumber;
146
+ steps: z.ZodArray<z.ZodObject<{
147
+ tsMs: z.ZodNumber;
148
+ nodeId: z.ZodString;
149
+ packageName: z.ZodString;
150
+ phase: z.ZodEnum<{
151
+ failed: "failed";
152
+ queued: "queued";
153
+ fetching: "fetching";
154
+ staged: "staged";
155
+ validating: "validating";
156
+ applying: "applying";
157
+ restarting: "restarting";
158
+ applied: "applied";
159
+ done: "done";
160
+ skipped: "skipped";
161
+ }>;
162
+ message: z.ZodString;
163
+ }, z.core.$strip>>;
164
+ error: z.ZodNullable<z.ZodString>;
165
+ startedAtMs: z.ZodNullable<z.ZodNumber>;
166
+ finishedAtMs: z.ZodNullable<z.ZodNumber>;
167
+ }, z.core.$strip>>;
168
+ state: z.ZodEnum<{
169
+ running: "running";
170
+ failed: "failed";
171
+ completed: "completed";
172
+ "partially-failed": "partially-failed";
173
+ cancelled: "cancelled";
174
+ }>;
175
+ schemaVersion: z.ZodLiteral<1>;
176
+ }, z.core.$strip>;
177
+ export type LifecycleJob = z.infer<typeof lifecycleJobSchema>;
@@ -54,6 +54,13 @@ export interface CameraStepOverridePatch {
54
54
  */
55
55
  export interface AgentPipelineSettings {
56
56
  readonly addonDefaults: Readonly<Record<string, AgentAddonConfig>>;
57
+ /**
58
+ * Optional per-node camera capacity cap. When set, the load balancer will
59
+ * not assign more than this many cameras to this agent. `null` = unlimited.
60
+ * Defaults to `null` on the Zod schema so existing persisted blobs load
61
+ * without migration.
62
+ */
63
+ readonly maxCameras?: number | null;
57
64
  }
58
65
  /**
59
66
  * Per-camera pipeline settings. Sparse by design — a camera that has
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",