@camstack/addon-ai 0.2.0 → 0.2.2

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/addon.js CHANGED
@@ -11088,7 +11088,8 @@ var PipelineStepInputSchema = lazy(() => object({
11088
11088
  modelId: string().optional(),
11089
11089
  enabled: boolean().default(true),
11090
11090
  children: array(PipelineStepInputSchema).optional(),
11091
- settings: record(string(), unknown()).optional()
11091
+ settings: record(string(), unknown()).optional(),
11092
+ jumpDeviceKey: string().optional()
11092
11093
  }));
11093
11094
  var ModelSubstitutionSchema = object({
11094
11095
  addonId: string(),
@@ -11394,10 +11395,40 @@ var NativeCropBboxSchema = object({
11394
11395
  });
11395
11396
  /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
11396
11397
  var NativeCropResultSchema = object({
11397
- /** Packed rgb (24-bit) pixels of the crop. */
11398
- bytes: _instanceof(Uint8Array),
11398
+ /**
11399
+ * Packed rgb (24-bit) pixels of the crop. Present on the DEFAULT (raw) path —
11400
+ * same-node (in-process / UDS) callers get zero-copy RGB and encode locally.
11401
+ * OMITTED when the caller requested `encodeJpeg` (the cross-node compressed
11402
+ * path below), where shipping raw RGB is both an invariant violation and, for
11403
+ * a native full frame (~26 MB at 4K), larger than Moleculer's 10 MB
11404
+ * `maxPacketSize` → the packet is dropped and the call 60s-times-out. That is
11405
+ * the cross-node native-media miss: `bytes` is replaced by `jpeg`.
11406
+ */
11407
+ bytes: _instanceof(Uint8Array).optional(),
11408
+ /**
11409
+ * Base64 JPEG of the crop — the COMPRESSED cross-node payload. The OWNING node
11410
+ * (which holds the native surface) encodes it in-process, so a native 4K frame
11411
+ * ships as ~0.5–2 MB (well under `maxPacketSize`) and NO raw pixels ever cross
11412
+ * a process boundary (CLAUDE.md invariant #21). Present ONLY when the request
11413
+ * set `encodeJpeg: true`; `bytes` is then absent.
11414
+ */
11415
+ jpeg: string().optional(),
11399
11416
  width: number().int().positive(),
11400
- height: number().int().positive()
11417
+ height: number().int().positive(),
11418
+ /**
11419
+ * Which source served this crop, so a quality-sensitive consumer (the native
11420
+ * `keyFrame`) can reject a degraded fallback:
11421
+ * - `native` — cut from the decode worker's retained NATIVE surface (the
11422
+ * quality path).
11423
+ * - `ram-fullframe` — the native surface MISSED but the request was full-frame,
11424
+ * so the ≤640 RAM `RetainedFrameStore` served it (honest lower-res; legit for
11425
+ * the blank-frame guard / 640-snapshot resolve, NOT for the clean keyFrame).
11426
+ *
11427
+ * OPTIONAL: a pre-tier runner (version skew) omits it — an ABSENT `tier` MUST be
11428
+ * treated as `native` (accepted) by every consumer so mixed-version clusters
11429
+ * keep the pre-tier behaviour. An ROI miss returns `null` (no tier at all).
11430
+ */
11431
+ tier: _enum(["native", "ram-fullframe"]).optional()
11401
11432
  });
11402
11433
  /** Parent detection context passed to `runDetailSubtree` — the crop's
11403
11434
  * originating detection, in FRAME-space coordinates. Reuses
@@ -11527,6 +11558,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
11527
11558
  hubHostnameOverride: string().optional()
11528
11559
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
11529
11560
  /**
11561
+ * One ENABLED inference device on the runner's node, as the step-tree
11562
+ * device-jump resolver sees it (phase 1). The orchestrator populates this
11563
+ * roster on the attach payload whenever the camera is elected onto a specific
11564
+ * `deviceKey` and the node has ≥2 enabled devices — it is the candidate set the
11565
+ * runner auto-jumps an enrichment step to when the elected device's format
11566
+ * cannot run that step's model. `weight`/`maxSessions` mirror the balancer's
11567
+ * per-device knobs so the auto choice is weighted-least-loaded.
11568
+ */
11569
+ var RunnerInferenceDeviceSchema = object({
11570
+ deviceKey: string(),
11571
+ weight: number().positive().default(1),
11572
+ maxSessions: number().int().positive().nullable().default(null)
11573
+ });
11574
+ /**
11530
11575
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
11531
11576
  * specific runner instance via `attachCamera`. Carries everything the
11532
11577
  * runner needs to subscribe to the local broker and execute inference.
@@ -11644,7 +11689,16 @@ var RunnerCameraConfigSchema = object({
11644
11689
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
11645
11690
  * this only selects WHICH device pool of that node runs the session.
11646
11691
  */
11647
- deviceKey: string().optional()
11692
+ deviceKey: string().optional(),
11693
+ /**
11694
+ * Step-tree device-jump roster (phase 1): the node's ENABLED inference
11695
+ * devices, populated by the orchestrator ONLY when `deviceKey` is set and the
11696
+ * node has ≥2 enabled devices. The runner uses it to AUTO-jump an enrichment
11697
+ * step whose model has no build for the elected device's format onto another
11698
+ * enabled device of the SAME node (weighted-least-loaded). Absent/single-entry
11699
+ * ⇒ no jump possible; the step runs on `deviceKey`.
11700
+ */
11701
+ inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
11648
11702
  });
11649
11703
  motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
11650
11704
  /**
@@ -11700,7 +11754,18 @@ var RunnerLocalMetricsSchema = object({
11700
11754
  method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mutation" }), method(object({ deviceId: number() }), object({ success: literal(true) }), { kind: "mutation" }), method(ReportMotionInputSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), RunnerLocalLoadSchema), method(_void(), RunnerLocalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(_void(), array(CameraMetricsWithDeviceIdSchema).readonly()), method(_void(), array(number()).readonly()), method(object({
11701
11755
  handle: FrameHandleSchema,
11702
11756
  bbox: NativeCropBboxSchema,
11703
- maxWidth: number().int().positive().optional()
11757
+ maxWidth: number().int().positive().optional(),
11758
+ /**
11759
+ * When `true`, the runner encodes the resolved crop to JPEG ON THE
11760
+ * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
11761
+ * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
11762
+ * agent) so the compressed payload fits Moleculer's `maxPacketSize` and
11763
+ * no raw pixels cross the process boundary. Same-node callers omit it
11764
+ * and keep the zero-copy raw `bytes` path. Additive + optional: a
11765
+ * pre-encode runner (version skew) ignores it and returns `bytes`, so
11766
+ * the caller falls back to encoding locally.
11767
+ */
11768
+ encodeJpeg: boolean().optional()
11704
11769
  }), NativeCropResultSchema.nullable()), method(object({
11705
11770
  deviceId: number(),
11706
11771
  frameHandle: FrameHandleSchema.optional(),
@@ -14728,7 +14793,8 @@ var LinkedDeviceSchema = object({
14728
14793
  deviceId: number(),
14729
14794
  name: string(),
14730
14795
  location: string().nullable(),
14731
- features: array(string())
14796
+ features: array(string()),
14797
+ producesTrackedEvents: boolean().optional()
14732
14798
  });
14733
14799
  var SavedDeviceRowSchema = object({
14734
14800
  /** Numeric id reserved at allocateDeviceId time. */
@@ -16403,6 +16469,7 @@ var TrackSchema = object({
16403
16469
  deviceId: number(),
16404
16470
  className: string(),
16405
16471
  label: string().optional(),
16472
+ producingDeviceName: string().optional(),
16406
16473
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16407
16474
  source: TrackSourceSchema.optional(),
16408
16475
  firstSeen: number(),
@@ -16540,7 +16607,8 @@ var MediaFileKindEnum = _enum([
16540
16607
  "fullFrameBoxed",
16541
16608
  "faceCrop",
16542
16609
  "plateCrop",
16543
- "keyFrame"
16610
+ "keyFrame",
16611
+ "keyFrameSmall"
16544
16612
  ]);
16545
16613
  var MediaFileSchema = object({
16546
16614
  key: string(),
@@ -16871,7 +16939,16 @@ var PipelineTemplateSchema = object({
16871
16939
  });
16872
16940
  var DeviceStepConfigSchema = object({
16873
16941
  modelId: string().optional(),
16874
- settings: record(string(), unknown()).optional()
16942
+ settings: record(string(), unknown()).optional(),
16943
+ /**
16944
+ * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
16945
+ * When set, this step runs on the named enabled device of the SAME node
16946
+ * (`<backend>:<device>`) instead of the camera's elected device, bypassing
16947
+ * the runtime AUTO-jump. The orchestrator rejects a `jumpDeviceKey` pointing
16948
+ * at a disabled/absent device on that node at save time. Absent ⇒ the runner
16949
+ * auto-jumps only when the effective device's format cannot run the step.
16950
+ */
16951
+ jumpDeviceKey: string().optional()
16875
16952
  });
16876
16953
  var AgentPipelineSettingsSchema = object({
16877
16954
  maxCameras: number().int().nonnegative().nullable().default(null),
package/dist/addon.mjs CHANGED
@@ -11050,7 +11050,8 @@ var PipelineStepInputSchema = lazy(() => object({
11050
11050
  modelId: string().optional(),
11051
11051
  enabled: boolean().default(true),
11052
11052
  children: array(PipelineStepInputSchema).optional(),
11053
- settings: record(string(), unknown()).optional()
11053
+ settings: record(string(), unknown()).optional(),
11054
+ jumpDeviceKey: string().optional()
11054
11055
  }));
11055
11056
  var ModelSubstitutionSchema = object({
11056
11057
  addonId: string(),
@@ -11356,10 +11357,40 @@ var NativeCropBboxSchema = object({
11356
11357
  });
11357
11358
  /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
11358
11359
  var NativeCropResultSchema = object({
11359
- /** Packed rgb (24-bit) pixels of the crop. */
11360
- bytes: _instanceof(Uint8Array),
11360
+ /**
11361
+ * Packed rgb (24-bit) pixels of the crop. Present on the DEFAULT (raw) path —
11362
+ * same-node (in-process / UDS) callers get zero-copy RGB and encode locally.
11363
+ * OMITTED when the caller requested `encodeJpeg` (the cross-node compressed
11364
+ * path below), where shipping raw RGB is both an invariant violation and, for
11365
+ * a native full frame (~26 MB at 4K), larger than Moleculer's 10 MB
11366
+ * `maxPacketSize` → the packet is dropped and the call 60s-times-out. That is
11367
+ * the cross-node native-media miss: `bytes` is replaced by `jpeg`.
11368
+ */
11369
+ bytes: _instanceof(Uint8Array).optional(),
11370
+ /**
11371
+ * Base64 JPEG of the crop — the COMPRESSED cross-node payload. The OWNING node
11372
+ * (which holds the native surface) encodes it in-process, so a native 4K frame
11373
+ * ships as ~0.5–2 MB (well under `maxPacketSize`) and NO raw pixels ever cross
11374
+ * a process boundary (CLAUDE.md invariant #21). Present ONLY when the request
11375
+ * set `encodeJpeg: true`; `bytes` is then absent.
11376
+ */
11377
+ jpeg: string().optional(),
11361
11378
  width: number().int().positive(),
11362
- height: number().int().positive()
11379
+ height: number().int().positive(),
11380
+ /**
11381
+ * Which source served this crop, so a quality-sensitive consumer (the native
11382
+ * `keyFrame`) can reject a degraded fallback:
11383
+ * - `native` — cut from the decode worker's retained NATIVE surface (the
11384
+ * quality path).
11385
+ * - `ram-fullframe` — the native surface MISSED but the request was full-frame,
11386
+ * so the ≤640 RAM `RetainedFrameStore` served it (honest lower-res; legit for
11387
+ * the blank-frame guard / 640-snapshot resolve, NOT for the clean keyFrame).
11388
+ *
11389
+ * OPTIONAL: a pre-tier runner (version skew) omits it — an ABSENT `tier` MUST be
11390
+ * treated as `native` (accepted) by every consumer so mixed-version clusters
11391
+ * keep the pre-tier behaviour. An ROI miss returns `null` (no tier at all).
11392
+ */
11393
+ tier: _enum(["native", "ram-fullframe"]).optional()
11363
11394
  });
11364
11395
  /** Parent detection context passed to `runDetailSubtree` — the crop's
11365
11396
  * originating detection, in FRAME-space coordinates. Reuses
@@ -11489,6 +11520,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
11489
11520
  hubHostnameOverride: string().optional()
11490
11521
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
11491
11522
  /**
11523
+ * One ENABLED inference device on the runner's node, as the step-tree
11524
+ * device-jump resolver sees it (phase 1). The orchestrator populates this
11525
+ * roster on the attach payload whenever the camera is elected onto a specific
11526
+ * `deviceKey` and the node has ≥2 enabled devices — it is the candidate set the
11527
+ * runner auto-jumps an enrichment step to when the elected device's format
11528
+ * cannot run that step's model. `weight`/`maxSessions` mirror the balancer's
11529
+ * per-device knobs so the auto choice is weighted-least-loaded.
11530
+ */
11531
+ var RunnerInferenceDeviceSchema = object({
11532
+ deviceKey: string(),
11533
+ weight: number().positive().default(1),
11534
+ maxSessions: number().int().positive().nullable().default(null)
11535
+ });
11536
+ /**
11492
11537
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
11493
11538
  * specific runner instance via `attachCamera`. Carries everything the
11494
11539
  * runner needs to subscribe to the local broker and execute inference.
@@ -11606,7 +11651,16 @@ var RunnerCameraConfigSchema = object({
11606
11651
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
11607
11652
  * this only selects WHICH device pool of that node runs the session.
11608
11653
  */
11609
- deviceKey: string().optional()
11654
+ deviceKey: string().optional(),
11655
+ /**
11656
+ * Step-tree device-jump roster (phase 1): the node's ENABLED inference
11657
+ * devices, populated by the orchestrator ONLY when `deviceKey` is set and the
11658
+ * node has ≥2 enabled devices. The runner uses it to AUTO-jump an enrichment
11659
+ * step whose model has no build for the elected device's format onto another
11660
+ * enabled device of the SAME node (weighted-least-loaded). Absent/single-entry
11661
+ * ⇒ no jump possible; the step runs on `deviceKey`.
11662
+ */
11663
+ inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
11610
11664
  });
11611
11665
  motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
11612
11666
  /**
@@ -11662,7 +11716,18 @@ var RunnerLocalMetricsSchema = object({
11662
11716
  method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mutation" }), method(object({ deviceId: number() }), object({ success: literal(true) }), { kind: "mutation" }), method(ReportMotionInputSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), RunnerLocalLoadSchema), method(_void(), RunnerLocalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(_void(), array(CameraMetricsWithDeviceIdSchema).readonly()), method(_void(), array(number()).readonly()), method(object({
11663
11717
  handle: FrameHandleSchema,
11664
11718
  bbox: NativeCropBboxSchema,
11665
- maxWidth: number().int().positive().optional()
11719
+ maxWidth: number().int().positive().optional(),
11720
+ /**
11721
+ * When `true`, the runner encodes the resolved crop to JPEG ON THE
11722
+ * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
11723
+ * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
11724
+ * agent) so the compressed payload fits Moleculer's `maxPacketSize` and
11725
+ * no raw pixels cross the process boundary. Same-node callers omit it
11726
+ * and keep the zero-copy raw `bytes` path. Additive + optional: a
11727
+ * pre-encode runner (version skew) ignores it and returns `bytes`, so
11728
+ * the caller falls back to encoding locally.
11729
+ */
11730
+ encodeJpeg: boolean().optional()
11666
11731
  }), NativeCropResultSchema.nullable()), method(object({
11667
11732
  deviceId: number(),
11668
11733
  frameHandle: FrameHandleSchema.optional(),
@@ -14690,7 +14755,8 @@ var LinkedDeviceSchema = object({
14690
14755
  deviceId: number(),
14691
14756
  name: string(),
14692
14757
  location: string().nullable(),
14693
- features: array(string())
14758
+ features: array(string()),
14759
+ producesTrackedEvents: boolean().optional()
14694
14760
  });
14695
14761
  var SavedDeviceRowSchema = object({
14696
14762
  /** Numeric id reserved at allocateDeviceId time. */
@@ -16365,6 +16431,7 @@ var TrackSchema = object({
16365
16431
  deviceId: number(),
16366
16432
  className: string(),
16367
16433
  label: string().optional(),
16434
+ producingDeviceName: string().optional(),
16368
16435
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16369
16436
  source: TrackSourceSchema.optional(),
16370
16437
  firstSeen: number(),
@@ -16502,7 +16569,8 @@ var MediaFileKindEnum = _enum([
16502
16569
  "fullFrameBoxed",
16503
16570
  "faceCrop",
16504
16571
  "plateCrop",
16505
- "keyFrame"
16572
+ "keyFrame",
16573
+ "keyFrameSmall"
16506
16574
  ]);
16507
16575
  var MediaFileSchema = object({
16508
16576
  key: string(),
@@ -16833,7 +16901,16 @@ var PipelineTemplateSchema = object({
16833
16901
  });
16834
16902
  var DeviceStepConfigSchema = object({
16835
16903
  modelId: string().optional(),
16836
- settings: record(string(), unknown()).optional()
16904
+ settings: record(string(), unknown()).optional(),
16905
+ /**
16906
+ * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
16907
+ * When set, this step runs on the named enabled device of the SAME node
16908
+ * (`<backend>:<device>`) instead of the camera's elected device, bypassing
16909
+ * the runtime AUTO-jump. The orchestrator rejects a `jumpDeviceKey` pointing
16910
+ * at a disabled/absent device on that node at save time. Absent ⇒ the runner
16911
+ * auto-jumps only when the effective device's format cannot run the step.
16912
+ */
16913
+ jumpDeviceKey: string().optional()
16837
16914
  });
16838
16915
  var AgentPipelineSettingsSchema = object({
16839
16916
  maxCameras: number().int().nonnegative().nullable().default(null),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-ai",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "AI addon for CamStack — the `llm` collection provider (cloud, LAN, and camstack-managed local llama.cpp profiles) plus the per-node `llm-runtime` managed executor.",
5
5
  "keywords": [
6
6
  "camstack",