@camstack/types 1.0.4 → 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.
package/dist/index.js CHANGED
@@ -473,6 +473,18 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
473
473
  */
474
474
  EventCategory["PipelineEngineMetricsSnapshot"] = "pipeline.engine-metrics-snapshot";
475
475
  /**
476
+ * Per-node detection-engine runtime-provisioning transition. Emitted by
477
+ * the detection-pipeline provider on every state change of its lazy
478
+ * engine-provisioning machine (idle → installing → verifying → ready,
479
+ * or → failed with a `nextRetryAt`). Payload is the
480
+ * `EngineProvisioningState` snapshot; `event.source.nodeId` carries the
481
+ * node. The Pipeline page subscribes to drive a live "installing
482
+ * OpenVINO… / ready" indicator per node without polling
483
+ * `pipelineExecutor.getEngineProvisioning`. Telemetry-grade (D8): the UI
484
+ * also reads the cap snapshot on mount / reconnect. Phase 2.
485
+ */
486
+ EventCategory["PipelineEngineProvisioning"] = "pipeline.engine-provisioning";
487
+ /**
476
488
  * Cluster topology snapshot. Carries the same payload returned by
477
489
  * `nodes.topology` (every reachable node + addons + processes).
478
490
  * Emitted by the hub on any agent / addon lifecycle change
@@ -8402,6 +8414,24 @@ var DetectorOutputSchema = zod.z.object({
8402
8414
  inferenceMs: zod.z.number(),
8403
8415
  modelId: zod.z.string()
8404
8416
  });
8417
+ var EngineProvisioningSchema = zod.z.object({
8418
+ runtimeId: zod.z.enum([
8419
+ "onnx",
8420
+ "openvino",
8421
+ "coreml"
8422
+ ]).nullable(),
8423
+ device: zod.z.string().nullable(),
8424
+ state: zod.z.enum([
8425
+ "idle",
8426
+ "installing",
8427
+ "verifying",
8428
+ "ready",
8429
+ "failed"
8430
+ ]),
8431
+ progress: zod.z.number().optional(),
8432
+ error: zod.z.string().optional(),
8433
+ nextRetryAt: zod.z.number().optional()
8434
+ });
8405
8435
  var PipelineStepInputSchema = zod.z.lazy(() => zod.z.object({
8406
8436
  addonId: zod.z.string(),
8407
8437
  modelId: zod.z.string(),
@@ -8501,6 +8531,15 @@ var pipelineExecutorCapability = {
8501
8531
  kind: "mutation",
8502
8532
  auth: "admin"
8503
8533
  }),
8534
+ /**
8535
+ * Per-node detection-engine provisioning snapshot. Returns the live
8536
+ * state of the lazy runtime-provisioning machine on `nodeId`
8537
+ * (idle / installing / verifying / ready / failed). The UI pairs this
8538
+ * one-shot query with the `pipeline.engine-provisioning` live event
8539
+ * (emitted on every transition) to drive a per-node "engine ready?"
8540
+ * indicator without polling. Phase 2.
8541
+ */
8542
+ getEngineProvisioning: method(zod.z.object({ nodeId: zod.z.string() }), EngineProvisioningSchema),
8504
8543
  getVideoPipelineSteps: method(zod.z.void(), zod.z.record(zod.z.string(), zod.z.object({
8505
8544
  modelId: zod.z.string(),
8506
8545
  settings: zod.z.record(zod.z.string(), zod.z.unknown()).readonly()
@@ -12926,6 +12965,7 @@ function createDeviceProxy(api, binding, opts) {
12926
12965
  setCameraStepOverride: (input) => dispatchSystem("pipelineOrchestrator", "setCameraStepOverride", "mutation", input),
12927
12966
  setCameraPipelineForAgent: (input) => dispatchSystem("pipelineOrchestrator", "setCameraPipelineForAgent", "mutation", input),
12928
12967
  resolvePipeline: (input) => dispatchSystem("pipelineOrchestrator", "resolvePipeline", "query", input),
12968
+ getCameraStatus: (input) => dispatchSystem("pipelineOrchestrator", "getCameraStatus", "query", input),
12929
12969
  getDeviceSettingsContribution: (input) => dispatchSystem("pipelineOrchestrator", "getDeviceSettingsContribution", "query", input),
12930
12970
  getDeviceLiveContribution: (input) => dispatchSystem("pipelineOrchestrator", "getDeviceLiveContribution", "query", input),
12931
12971
  applyDeviceSettingsPatch: (input) => dispatchSystem("pipelineOrchestrator", "applyDeviceSettingsPatch", "mutation", input)
@@ -13337,6 +13377,7 @@ function createSystemProxy(api) {
13337
13377
  getSelectedEngine: (input) => dispatch("pipelineExecutor", "getSelectedEngine", "query", input),
13338
13378
  getDefaultSteps: (input) => dispatch("pipelineExecutor", "getDefaultSteps", "query", input),
13339
13379
  reprobeEngine: (input) => dispatch("pipelineExecutor", "reprobeEngine", "mutation", input),
13380
+ getEngineProvisioning: (input) => dispatch("pipelineExecutor", "getEngineProvisioning", "query", input),
13340
13381
  getVideoPipelineSteps: (input) => dispatch("pipelineExecutor", "getVideoPipelineSteps", "query", input),
13341
13382
  setVideoPipelineSteps: (input) => dispatch("pipelineExecutor", "setVideoPipelineSteps", "mutation", input),
13342
13383
  getSchema: (input) => dispatch("pipelineExecutor", "getSchema", "query", input),
@@ -13380,6 +13421,8 @@ function createSystemProxy(api) {
13380
13421
  listAgentSettings: (input) => dispatch("pipelineOrchestrator", "listAgentSettings", "query", input),
13381
13422
  setAgentAddonDefaults: (input) => dispatch("pipelineOrchestrator", "setAgentAddonDefaults", "mutation", input),
13382
13423
  removeAgentSettings: (input) => dispatch("pipelineOrchestrator", "removeAgentSettings", "mutation", input),
13424
+ setAgentMaxCameras: (input) => dispatch("pipelineOrchestrator", "setAgentMaxCameras", "mutation", input),
13425
+ getCameraStatuses: (input) => dispatch("pipelineOrchestrator", "getCameraStatuses", "query", input),
13383
13426
  listTemplates: (input) => dispatch("pipelineOrchestrator", "listTemplates", "query", input),
13384
13427
  saveTemplate: (input) => dispatch("pipelineOrchestrator", "saveTemplate", "mutation", input),
13385
13428
  updateTemplate: (input) => dispatch("pipelineOrchestrator", "updateTemplate", "mutation", input),
@@ -16995,7 +17038,10 @@ var AgentAddonConfigSchema = zod.z.object({
16995
17038
  modelId: zod.z.string(),
16996
17039
  settings: zod.z.record(zod.z.string(), zod.z.unknown()).readonly()
16997
17040
  });
16998
- var AgentPipelineSettingsSchema = zod.z.object({ addonDefaults: zod.z.record(zod.z.string(), AgentAddonConfigSchema).readonly() });
17041
+ var AgentPipelineSettingsSchema = zod.z.object({
17042
+ addonDefaults: zod.z.record(zod.z.string(), AgentAddonConfigSchema).readonly(),
17043
+ maxCameras: zod.z.number().int().nonnegative().nullable().default(null)
17044
+ });
16999
17045
  var CameraPipelineForAgentSchema = zod.z.object({
17000
17046
  steps: zod.z.array(PipelineStepInputSchema).readonly(),
17001
17047
  audio: zod.z.object({
@@ -17097,6 +17143,141 @@ var GlobalMetricsSchema = zod.z.object({
17097
17143
  * capability providers.
17098
17144
  */
17099
17145
  var CapabilityBindingsSchema = zod.z.record(zod.z.string(), zod.z.string());
17146
+ /** Stream entry surfaced from the stream-catalog for one device. */
17147
+ var CameraSourceStreamSchema = zod.z.object({
17148
+ camStreamId: zod.z.string(),
17149
+ codec: zod.z.string(),
17150
+ width: zod.z.number(),
17151
+ height: zod.z.number(),
17152
+ fps: zod.z.number(),
17153
+ kind: zod.z.string()
17154
+ });
17155
+ /** Source block — always present; derives from the stream catalog. */
17156
+ var CameraSourceStatusSchema = zod.z.object({ streams: zod.z.array(CameraSourceStreamSchema).readonly() });
17157
+ /** Assignment block — always present (orchestrator-local, no remote call). */
17158
+ var CameraAssignmentStatusSchema = zod.z.object({
17159
+ detectionNodeId: zod.z.string().nullable(),
17160
+ decoderNodeId: zod.z.string().nullable(),
17161
+ audioNodeId: zod.z.string().nullable(),
17162
+ pinned: zod.z.object({
17163
+ detection: zod.z.boolean(),
17164
+ decoder: zod.z.boolean(),
17165
+ audio: zod.z.boolean()
17166
+ }),
17167
+ reasons: zod.z.object({
17168
+ detection: zod.z.string().optional(),
17169
+ decoder: zod.z.string().optional(),
17170
+ audio: zod.z.string().optional()
17171
+ })
17172
+ });
17173
+ /** Broker profile slot entry within the broker block. */
17174
+ var CameraBrokerProfileSchema = zod.z.object({
17175
+ profile: zod.z.string(),
17176
+ status: zod.z.string(),
17177
+ codec: zod.z.string(),
17178
+ width: zod.z.number(),
17179
+ height: zod.z.number(),
17180
+ subscribers: zod.z.number(),
17181
+ inFps: zod.z.number(),
17182
+ outFps: zod.z.number()
17183
+ });
17184
+ /** Broker block — null when the broker stage is unreachable or inactive. */
17185
+ var CameraBrokerStatusSchema = zod.z.object({
17186
+ profiles: zod.z.array(CameraBrokerProfileSchema).readonly(),
17187
+ webrtcSessions: zod.z.number(),
17188
+ rtspRestream: zod.z.boolean()
17189
+ });
17190
+ /** Shared-memory ring statistics within the decoder block. */
17191
+ var CameraDecoderShmSchema = zod.z.object({
17192
+ framesWritten: zod.z.number(),
17193
+ getFrameHits: zod.z.number(),
17194
+ getFrameMisses: zod.z.number(),
17195
+ budgetMb: zod.z.number()
17196
+ });
17197
+ /** Decoder block — null when the decoder stage is unreachable or inactive. */
17198
+ var CameraDecoderStatusSchema = zod.z.object({
17199
+ nodeId: zod.z.string(),
17200
+ formats: zod.z.array(zod.z.string()).readonly(),
17201
+ sessionCount: zod.z.number(),
17202
+ shm: CameraDecoderShmSchema
17203
+ });
17204
+ /** Motion block — null when motion detection is not active for this device. */
17205
+ var CameraMotionStatusSchema = zod.z.object({
17206
+ enabled: zod.z.boolean(),
17207
+ fps: zod.z.number()
17208
+ });
17209
+ /** Detection engine provisioning state (mirrors pipeline-executor provisioning states). */
17210
+ var CameraDetectionProvisioningStateSchema = zod.z.enum([
17211
+ "idle",
17212
+ "installing",
17213
+ "verifying",
17214
+ "ready",
17215
+ "failed"
17216
+ ]);
17217
+ /** Detection provisioning sub-block. */
17218
+ var CameraDetectionProvisioningSchema = zod.z.object({
17219
+ state: CameraDetectionProvisioningStateSchema,
17220
+ error: zod.z.string().optional()
17221
+ });
17222
+ /** Detection phase — derived from the runner's engine phase. */
17223
+ var CameraDetectionPhaseSchema = zod.z.enum([
17224
+ "idle",
17225
+ "watching",
17226
+ "active"
17227
+ ]);
17228
+ /** Detection block — null when no detection node is assigned or reachable. */
17229
+ var CameraDetectionStatusSchema = zod.z.object({
17230
+ nodeId: zod.z.string(),
17231
+ engine: zod.z.object({
17232
+ backend: zod.z.string(),
17233
+ device: zod.z.string()
17234
+ }),
17235
+ phase: CameraDetectionPhaseSchema,
17236
+ configuredFps: zod.z.number(),
17237
+ actualFps: zod.z.number(),
17238
+ queueDepth: zod.z.number(),
17239
+ avgInferenceMs: zod.z.number(),
17240
+ provisioning: CameraDetectionProvisioningSchema
17241
+ });
17242
+ /** Audio block — null when no audio node is assigned or reachable. */
17243
+ var CameraAudioStatusSchema = zod.z.object({
17244
+ nodeId: zod.z.string(),
17245
+ enabled: zod.z.boolean()
17246
+ });
17247
+ /** Recording mode enum (matches recording cap). */
17248
+ var CameraRecordingModeSchema = zod.z.enum([
17249
+ "off",
17250
+ "continuous",
17251
+ "events"
17252
+ ]);
17253
+ /** Recording block — null when no recording cap is active for this device. */
17254
+ var CameraRecordingStatusSchema = zod.z.object({
17255
+ mode: CameraRecordingModeSchema,
17256
+ active: zod.z.boolean(),
17257
+ storageBytes: zod.z.number()
17258
+ });
17259
+ /**
17260
+ * Aggregated per-camera pipeline status — server-composed, single call.
17261
+ *
17262
+ * The `assignment` and `source` blocks are always present.
17263
+ * Every other block is `null` when the stage is inactive or unreachable
17264
+ * during the bounded parallel fan-out in the orchestrator implementation.
17265
+ *
17266
+ * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
17267
+ */
17268
+ var CameraStatusSchema = zod.z.object({
17269
+ deviceId: zod.z.number(),
17270
+ assignment: CameraAssignmentStatusSchema,
17271
+ source: CameraSourceStatusSchema,
17272
+ broker: CameraBrokerStatusSchema.nullable(),
17273
+ decoder: CameraDecoderStatusSchema.nullable(),
17274
+ motion: CameraMotionStatusSchema.nullable(),
17275
+ detection: CameraDetectionStatusSchema.nullable(),
17276
+ audio: CameraAudioStatusSchema.nullable(),
17277
+ recording: CameraRecordingStatusSchema.nullable(),
17278
+ /** Unix timestamp (ms) when this snapshot was composed server-side. */
17279
+ fetchedAt: zod.z.number()
17280
+ });
17100
17281
  /**
17101
17282
  * Pipeline Orchestrator capability — global load balancer + camera dispatcher.
17102
17283
  *
@@ -17273,6 +17454,25 @@ var pipelineOrchestratorCapability = {
17273
17454
  kind: "mutation",
17274
17455
  auth: "admin"
17275
17456
  }),
17457
+ /**
17458
+ * Set the per-node camera cap for one agent.
17459
+ *
17460
+ * `maxCameras: 0` and `maxCameras: null` are both treated as unlimited
17461
+ * by the load balancer (0 is stored as-is; the balancer treats ≤0 as
17462
+ * unlimited alongside null). Pass `null` to clear an existing cap.
17463
+ * Note: the admin UI normalises 0→null before calling this method, so
17464
+ * `maxCameras: 0` only reaches the store via direct SDK or CLI calls.
17465
+ * Changes take effect immediately on the next dispatch cycle — cameras
17466
+ * currently assigned over-cap are left in place (no forced eviction),
17467
+ * but new assignments obey the updated cap.
17468
+ */
17469
+ setAgentMaxCameras: method(zod.z.object({
17470
+ agentNodeId: zod.z.string(),
17471
+ maxCameras: zod.z.number().int().nonnegative().nullable()
17472
+ }), zod.z.object({ success: zod.z.literal(true) }), {
17473
+ kind: "mutation",
17474
+ auth: "admin"
17475
+ }),
17276
17476
  /** Read one camera's settings. Null when never touched (inherits agent defaults fully). */
17277
17477
  getCameraSettings: method(zod.z.object({ deviceId: zod.z.number() }), CameraPipelineSettingsSchema.nullable()),
17278
17478
  /** Set or clear the 3-state toggle for one (camera, addonId). Pass `enabled: null` to clear and revert to agent default. */
@@ -17313,6 +17513,29 @@ var pipelineOrchestratorCapability = {
17313
17513
  deviceId: zod.z.number(),
17314
17514
  agentNodeId: zod.z.string().optional()
17315
17515
  }), CameraPipelineConfigSchema),
17516
+ /**
17517
+ * Server-composed aggregated status for a single camera.
17518
+ *
17519
+ * Fans out in parallel (bounded, per-stage graceful degradation) to
17520
+ * broker / decoder / motion / detection / audio / recording source caps
17521
+ * via `ctx.api`. A stage whose source errors or times out becomes `null`
17522
+ * in the returned payload — one slow agent never breaks the whole call.
17523
+ *
17524
+ * Intended for "on open / on camera select" snapshots. Live deltas
17525
+ * keep arriving from the existing ~1Hz events the UI already subscribes to.
17526
+ */
17527
+ getCameraStatus: method(zod.z.object({ deviceId: zod.z.number() }), CameraStatusSchema),
17528
+ /**
17529
+ * Server-composed aggregated status for multiple cameras in one call.
17530
+ *
17531
+ * `deviceIds` defaults to all cameras currently tracked by the
17532
+ * orchestrator's assignment map when omitted.
17533
+ *
17534
+ * Runs per-device composition in parallel (bounded). Use this to
17535
+ * populate the cluster assignments table and the pipeline flow overview
17536
+ * rail without issuing N parallel browser round-trips.
17537
+ */
17538
+ getCameraStatuses: method(zod.z.object({ deviceIds: zod.z.array(zod.z.number()).optional() }), zod.z.array(CameraStatusSchema).readonly()),
17316
17539
  /** List every template the operator has saved. */
17317
17540
  listTemplates: method(zod.z.void(), zod.z.array(PipelineTemplateSchema).readonly()),
17318
17541
  /** Create a new named preset from a given CameraPipelineConfig. */
@@ -26025,6 +26248,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
26025
26248
  addonId: null,
26026
26249
  access: "view"
26027
26250
  },
26251
+ "pipelineExecutor.getEngineProvisioning": {
26252
+ capName: "pipeline-executor",
26253
+ capScope: "system",
26254
+ addonId: null,
26255
+ access: "view"
26256
+ },
26028
26257
  "pipelineExecutor.getGlobalPipelineConfig": {
26029
26258
  capName: "pipeline-executor",
26030
26259
  capScope: "system",
@@ -26229,6 +26458,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
26229
26458
  addonId: null,
26230
26459
  access: "view"
26231
26460
  },
26461
+ "pipelineOrchestrator.getCameraStatus": {
26462
+ capName: "pipeline-orchestrator",
26463
+ capScope: "system",
26464
+ addonId: null,
26465
+ access: "view"
26466
+ },
26467
+ "pipelineOrchestrator.getCameraStatuses": {
26468
+ capName: "pipeline-orchestrator",
26469
+ capScope: "system",
26470
+ addonId: null,
26471
+ access: "view"
26472
+ },
26232
26473
  "pipelineOrchestrator.getCameraStepOverrides": {
26233
26474
  capName: "pipeline-orchestrator",
26234
26475
  capScope: "system",
@@ -26313,6 +26554,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
26313
26554
  addonId: null,
26314
26555
  access: "create"
26315
26556
  },
26557
+ "pipelineOrchestrator.setAgentMaxCameras": {
26558
+ capName: "pipeline-orchestrator",
26559
+ capScope: "system",
26560
+ addonId: null,
26561
+ access: "create"
26562
+ },
26316
26563
  "pipelineOrchestrator.setCameraPipelineForAgent": {
26317
26564
  capName: "pipeline-orchestrator",
26318
26565
  capScope: "system",
@@ -28549,10 +28796,26 @@ exports.CamProfileSchema = CamProfileSchema;
28549
28796
  exports.CamStreamDescriptorSchema = CamStreamDescriptorSchema;
28550
28797
  exports.CamStreamKindSchema = CamStreamKindSchema;
28551
28798
  exports.CamStreamResolutionSchema = CamStreamResolutionSchema;
28799
+ exports.CameraAssignmentStatusSchema = CameraAssignmentStatusSchema;
28800
+ exports.CameraAudioStatusSchema = CameraAudioStatusSchema;
28801
+ exports.CameraBrokerProfileSchema = CameraBrokerProfileSchema;
28802
+ exports.CameraBrokerStatusSchema = CameraBrokerStatusSchema;
28552
28803
  exports.CameraCredentialsSchema = CameraCredentialsSchema;
28553
28804
  exports.CameraCredentialsStatusSchema = CameraCredentialsStatusSchema;
28805
+ exports.CameraDecoderShmSchema = CameraDecoderShmSchema;
28806
+ exports.CameraDecoderStatusSchema = CameraDecoderStatusSchema;
28807
+ exports.CameraDetectionPhaseSchema = CameraDetectionPhaseSchema;
28808
+ exports.CameraDetectionProvisioningSchema = CameraDetectionProvisioningSchema;
28809
+ exports.CameraDetectionProvisioningStateSchema = CameraDetectionProvisioningStateSchema;
28810
+ exports.CameraDetectionStatusSchema = CameraDetectionStatusSchema;
28554
28811
  exports.CameraMetricsSchema = CameraMetricsSchema;
28555
28812
  exports.CameraMetricsWithDeviceIdSchema = CameraMetricsWithDeviceIdSchema;
28813
+ exports.CameraMotionStatusSchema = CameraMotionStatusSchema;
28814
+ exports.CameraRecordingModeSchema = CameraRecordingModeSchema;
28815
+ exports.CameraRecordingStatusSchema = CameraRecordingStatusSchema;
28816
+ exports.CameraSourceStatusSchema = CameraSourceStatusSchema;
28817
+ exports.CameraSourceStreamSchema = CameraSourceStreamSchema;
28818
+ exports.CameraStatusSchema = CameraStatusSchema;
28556
28819
  exports.CameraStreamSchema = CameraStreamSchema;
28557
28820
  exports.CandidateQueryFilterSchema = CandidateQueryFilterSchema;
28558
28821
  exports.CapScopeSchema = CapScopeSchema;