@camstack/addon-ai 0.2.1 → 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,8 +11395,24 @@ 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
11417
  height: number().int().positive(),
11401
11418
  /**
@@ -11541,6 +11558,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
11541
11558
  hubHostnameOverride: string().optional()
11542
11559
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
11543
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
+ /**
11544
11575
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
11545
11576
  * specific runner instance via `attachCamera`. Carries everything the
11546
11577
  * runner needs to subscribe to the local broker and execute inference.
@@ -11658,7 +11689,16 @@ var RunnerCameraConfigSchema = object({
11658
11689
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
11659
11690
  * this only selects WHICH device pool of that node runs the session.
11660
11691
  */
11661
- 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()
11662
11702
  });
11663
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;
11664
11704
  /**
@@ -11714,7 +11754,18 @@ var RunnerLocalMetricsSchema = object({
11714
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({
11715
11755
  handle: FrameHandleSchema,
11716
11756
  bbox: NativeCropBboxSchema,
11717
- 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()
11718
11769
  }), NativeCropResultSchema.nullable()), method(object({
11719
11770
  deviceId: number(),
11720
11771
  frameHandle: FrameHandleSchema.optional(),
@@ -16888,7 +16939,16 @@ var PipelineTemplateSchema = object({
16888
16939
  });
16889
16940
  var DeviceStepConfigSchema = object({
16890
16941
  modelId: string().optional(),
16891
- 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()
16892
16952
  });
16893
16953
  var AgentPipelineSettingsSchema = object({
16894
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,8 +11357,24 @@ 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
11379
  height: number().int().positive(),
11363
11380
  /**
@@ -11503,6 +11520,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
11503
11520
  hubHostnameOverride: string().optional()
11504
11521
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
11505
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
+ /**
11506
11537
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
11507
11538
  * specific runner instance via `attachCamera`. Carries everything the
11508
11539
  * runner needs to subscribe to the local broker and execute inference.
@@ -11620,7 +11651,16 @@ var RunnerCameraConfigSchema = object({
11620
11651
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
11621
11652
  * this only selects WHICH device pool of that node runs the session.
11622
11653
  */
11623
- 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()
11624
11664
  });
11625
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;
11626
11666
  /**
@@ -11676,7 +11716,18 @@ var RunnerLocalMetricsSchema = object({
11676
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({
11677
11717
  handle: FrameHandleSchema,
11678
11718
  bbox: NativeCropBboxSchema,
11679
- 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()
11680
11731
  }), NativeCropResultSchema.nullable()), method(object({
11681
11732
  deviceId: number(),
11682
11733
  frameHandle: FrameHandleSchema.optional(),
@@ -16850,7 +16901,16 @@ var PipelineTemplateSchema = object({
16850
16901
  });
16851
16902
  var DeviceStepConfigSchema = object({
16852
16903
  modelId: string().optional(),
16853
- 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()
16854
16914
  });
16855
16915
  var AgentPipelineSettingsSchema = object({
16856
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.1",
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",