@camstack/addon-matter-broker 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
@@ -12335,7 +12335,8 @@ var PipelineStepInputSchema = lazy(() => object({
12335
12335
  modelId: string$2().optional(),
12336
12336
  enabled: boolean().default(true),
12337
12337
  children: array(PipelineStepInputSchema).optional(),
12338
- settings: record(string$2(), unknown()).optional()
12338
+ settings: record(string$2(), unknown()).optional(),
12339
+ jumpDeviceKey: string$2().optional()
12339
12340
  }));
12340
12341
  var ModelSubstitutionSchema = object({
12341
12342
  addonId: string$2(),
@@ -12674,10 +12675,40 @@ var NativeCropBboxSchema = object({
12674
12675
  });
12675
12676
  /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
12676
12677
  var NativeCropResultSchema = object({
12677
- /** Packed rgb (24-bit) pixels of the crop. */
12678
- bytes: _instanceof(Uint8Array),
12678
+ /**
12679
+ * Packed rgb (24-bit) pixels of the crop. Present on the DEFAULT (raw) path —
12680
+ * same-node (in-process / UDS) callers get zero-copy RGB and encode locally.
12681
+ * OMITTED when the caller requested `encodeJpeg` (the cross-node compressed
12682
+ * path below), where shipping raw RGB is both an invariant violation and, for
12683
+ * a native full frame (~26 MB at 4K), larger than Moleculer's 10 MB
12684
+ * `maxPacketSize` → the packet is dropped and the call 60s-times-out. That is
12685
+ * the cross-node native-media miss: `bytes` is replaced by `jpeg`.
12686
+ */
12687
+ bytes: _instanceof(Uint8Array).optional(),
12688
+ /**
12689
+ * Base64 JPEG of the crop — the COMPRESSED cross-node payload. The OWNING node
12690
+ * (which holds the native surface) encodes it in-process, so a native 4K frame
12691
+ * ships as ~0.5–2 MB (well under `maxPacketSize`) and NO raw pixels ever cross
12692
+ * a process boundary (CLAUDE.md invariant #21). Present ONLY when the request
12693
+ * set `encodeJpeg: true`; `bytes` is then absent.
12694
+ */
12695
+ jpeg: string$2().optional(),
12679
12696
  width: number().int().positive(),
12680
- height: number().int().positive()
12697
+ height: number().int().positive(),
12698
+ /**
12699
+ * Which source served this crop, so a quality-sensitive consumer (the native
12700
+ * `keyFrame`) can reject a degraded fallback:
12701
+ * - `native` — cut from the decode worker's retained NATIVE surface (the
12702
+ * quality path).
12703
+ * - `ram-fullframe` — the native surface MISSED but the request was full-frame,
12704
+ * so the ≤640 RAM `RetainedFrameStore` served it (honest lower-res; legit for
12705
+ * the blank-frame guard / 640-snapshot resolve, NOT for the clean keyFrame).
12706
+ *
12707
+ * OPTIONAL: a pre-tier runner (version skew) omits it — an ABSENT `tier` MUST be
12708
+ * treated as `native` (accepted) by every consumer so mixed-version clusters
12709
+ * keep the pre-tier behaviour. An ROI miss returns `null` (no tier at all).
12710
+ */
12711
+ tier: _enum(["native", "ram-fullframe"]).optional()
12681
12712
  });
12682
12713
  /** Parent detection context passed to `runDetailSubtree` — the crop's
12683
12714
  * originating detection, in FRAME-space coordinates. Reuses
@@ -12807,6 +12838,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
12807
12838
  hubHostnameOverride: string$2().optional()
12808
12839
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
12809
12840
  /**
12841
+ * One ENABLED inference device on the runner's node, as the step-tree
12842
+ * device-jump resolver sees it (phase 1). The orchestrator populates this
12843
+ * roster on the attach payload whenever the camera is elected onto a specific
12844
+ * `deviceKey` and the node has ≥2 enabled devices — it is the candidate set the
12845
+ * runner auto-jumps an enrichment step to when the elected device's format
12846
+ * cannot run that step's model. `weight`/`maxSessions` mirror the balancer's
12847
+ * per-device knobs so the auto choice is weighted-least-loaded.
12848
+ */
12849
+ var RunnerInferenceDeviceSchema = object({
12850
+ deviceKey: string$2(),
12851
+ weight: number().positive().default(1),
12852
+ maxSessions: number().int().positive().nullable().default(null)
12853
+ });
12854
+ /**
12810
12855
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
12811
12856
  * specific runner instance via `attachCamera`. Carries everything the
12812
12857
  * runner needs to subscribe to the local broker and execute inference.
@@ -12924,7 +12969,16 @@ var RunnerCameraConfigSchema = object({
12924
12969
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
12925
12970
  * this only selects WHICH device pool of that node runs the session.
12926
12971
  */
12927
- deviceKey: string$2().optional()
12972
+ deviceKey: string$2().optional(),
12973
+ /**
12974
+ * Step-tree device-jump roster (phase 1): the node's ENABLED inference
12975
+ * devices, populated by the orchestrator ONLY when `deviceKey` is set and the
12976
+ * node has ≥2 enabled devices. The runner uses it to AUTO-jump an enrichment
12977
+ * step whose model has no build for the elected device's format onto another
12978
+ * enabled device of the SAME node (weighted-least-loaded). Absent/single-entry
12979
+ * ⇒ no jump possible; the step runs on `deviceKey`.
12980
+ */
12981
+ inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
12928
12982
  });
12929
12983
  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;
12930
12984
  /**
@@ -12980,7 +13034,18 @@ var RunnerLocalMetricsSchema = object({
12980
13034
  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({
12981
13035
  handle: FrameHandleSchema,
12982
13036
  bbox: NativeCropBboxSchema,
12983
- maxWidth: number().int().positive().optional()
13037
+ maxWidth: number().int().positive().optional(),
13038
+ /**
13039
+ * When `true`, the runner encodes the resolved crop to JPEG ON THE
13040
+ * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
13041
+ * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
13042
+ * agent) so the compressed payload fits Moleculer's `maxPacketSize` and
13043
+ * no raw pixels cross the process boundary. Same-node callers omit it
13044
+ * and keep the zero-copy raw `bytes` path. Additive + optional: a
13045
+ * pre-encode runner (version skew) ignores it and returns `bytes`, so
13046
+ * the caller falls back to encoding locally.
13047
+ */
13048
+ encodeJpeg: boolean().optional()
12984
13049
  }), NativeCropResultSchema.nullable()), method(object({
12985
13050
  deviceId: number(),
12986
13051
  frameHandle: FrameHandleSchema.optional(),
@@ -17747,7 +17812,8 @@ var LinkedDeviceSchema = object({
17747
17812
  deviceId: number(),
17748
17813
  name: string$2(),
17749
17814
  location: string$2().nullable(),
17750
- features: array(string$2())
17815
+ features: array(string$2()),
17816
+ producesTrackedEvents: boolean().optional()
17751
17817
  });
17752
17818
  var SavedDeviceRowSchema = object({
17753
17819
  /** Numeric id reserved at allocateDeviceId time. */
@@ -19377,6 +19443,7 @@ var TrackSchema = object({
19377
19443
  deviceId: number(),
19378
19444
  className: string$2(),
19379
19445
  label: string$2().optional(),
19446
+ producingDeviceName: string$2().optional(),
19380
19447
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19381
19448
  source: TrackSourceSchema.optional(),
19382
19449
  firstSeen: number(),
@@ -19514,7 +19581,8 @@ var MediaFileKindEnum = _enum([
19514
19581
  "fullFrameBoxed",
19515
19582
  "faceCrop",
19516
19583
  "plateCrop",
19517
- "keyFrame"
19584
+ "keyFrame",
19585
+ "keyFrameSmall"
19518
19586
  ]);
19519
19587
  var MediaFileSchema = object({
19520
19588
  key: string$2(),
@@ -19845,7 +19913,16 @@ var PipelineTemplateSchema = object({
19845
19913
  });
19846
19914
  var DeviceStepConfigSchema = object({
19847
19915
  modelId: string$2().optional(),
19848
- settings: record(string$2(), unknown()).optional()
19916
+ settings: record(string$2(), unknown()).optional(),
19917
+ /**
19918
+ * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
19919
+ * When set, this step runs on the named enabled device of the SAME node
19920
+ * (`<backend>:<device>`) instead of the camera's elected device, bypassing
19921
+ * the runtime AUTO-jump. The orchestrator rejects a `jumpDeviceKey` pointing
19922
+ * at a disabled/absent device on that node at save time. Absent ⇒ the runner
19923
+ * auto-jumps only when the effective device's format cannot run the step.
19924
+ */
19925
+ jumpDeviceKey: string$2().optional()
19849
19926
  });
19850
19927
  var AgentPipelineSettingsSchema = object({
19851
19928
  maxCameras: number().int().nonnegative().nullable().default(null),
package/dist/addon.mjs CHANGED
@@ -12333,7 +12333,8 @@ var PipelineStepInputSchema = lazy(() => object({
12333
12333
  modelId: string$2().optional(),
12334
12334
  enabled: boolean().default(true),
12335
12335
  children: array(PipelineStepInputSchema).optional(),
12336
- settings: record(string$2(), unknown()).optional()
12336
+ settings: record(string$2(), unknown()).optional(),
12337
+ jumpDeviceKey: string$2().optional()
12337
12338
  }));
12338
12339
  var ModelSubstitutionSchema = object({
12339
12340
  addonId: string$2(),
@@ -12672,10 +12673,40 @@ var NativeCropBboxSchema = object({
12672
12673
  });
12673
12674
  /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
12674
12675
  var NativeCropResultSchema = object({
12675
- /** Packed rgb (24-bit) pixels of the crop. */
12676
- bytes: _instanceof(Uint8Array),
12676
+ /**
12677
+ * Packed rgb (24-bit) pixels of the crop. Present on the DEFAULT (raw) path —
12678
+ * same-node (in-process / UDS) callers get zero-copy RGB and encode locally.
12679
+ * OMITTED when the caller requested `encodeJpeg` (the cross-node compressed
12680
+ * path below), where shipping raw RGB is both an invariant violation and, for
12681
+ * a native full frame (~26 MB at 4K), larger than Moleculer's 10 MB
12682
+ * `maxPacketSize` → the packet is dropped and the call 60s-times-out. That is
12683
+ * the cross-node native-media miss: `bytes` is replaced by `jpeg`.
12684
+ */
12685
+ bytes: _instanceof(Uint8Array).optional(),
12686
+ /**
12687
+ * Base64 JPEG of the crop — the COMPRESSED cross-node payload. The OWNING node
12688
+ * (which holds the native surface) encodes it in-process, so a native 4K frame
12689
+ * ships as ~0.5–2 MB (well under `maxPacketSize`) and NO raw pixels ever cross
12690
+ * a process boundary (CLAUDE.md invariant #21). Present ONLY when the request
12691
+ * set `encodeJpeg: true`; `bytes` is then absent.
12692
+ */
12693
+ jpeg: string$2().optional(),
12677
12694
  width: number().int().positive(),
12678
- height: number().int().positive()
12695
+ height: number().int().positive(),
12696
+ /**
12697
+ * Which source served this crop, so a quality-sensitive consumer (the native
12698
+ * `keyFrame`) can reject a degraded fallback:
12699
+ * - `native` — cut from the decode worker's retained NATIVE surface (the
12700
+ * quality path).
12701
+ * - `ram-fullframe` — the native surface MISSED but the request was full-frame,
12702
+ * so the ≤640 RAM `RetainedFrameStore` served it (honest lower-res; legit for
12703
+ * the blank-frame guard / 640-snapshot resolve, NOT for the clean keyFrame).
12704
+ *
12705
+ * OPTIONAL: a pre-tier runner (version skew) omits it — an ABSENT `tier` MUST be
12706
+ * treated as `native` (accepted) by every consumer so mixed-version clusters
12707
+ * keep the pre-tier behaviour. An ROI miss returns `null` (no tier at all).
12708
+ */
12709
+ tier: _enum(["native", "ram-fullframe"]).optional()
12679
12710
  });
12680
12711
  /** Parent detection context passed to `runDetailSubtree` — the crop's
12681
12712
  * originating detection, in FRAME-space coordinates. Reuses
@@ -12805,6 +12836,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
12805
12836
  hubHostnameOverride: string$2().optional()
12806
12837
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
12807
12838
  /**
12839
+ * One ENABLED inference device on the runner's node, as the step-tree
12840
+ * device-jump resolver sees it (phase 1). The orchestrator populates this
12841
+ * roster on the attach payload whenever the camera is elected onto a specific
12842
+ * `deviceKey` and the node has ≥2 enabled devices — it is the candidate set the
12843
+ * runner auto-jumps an enrichment step to when the elected device's format
12844
+ * cannot run that step's model. `weight`/`maxSessions` mirror the balancer's
12845
+ * per-device knobs so the auto choice is weighted-least-loaded.
12846
+ */
12847
+ var RunnerInferenceDeviceSchema = object({
12848
+ deviceKey: string$2(),
12849
+ weight: number().positive().default(1),
12850
+ maxSessions: number().int().positive().nullable().default(null)
12851
+ });
12852
+ /**
12808
12853
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
12809
12854
  * specific runner instance via `attachCamera`. Carries everything the
12810
12855
  * runner needs to subscribe to the local broker and execute inference.
@@ -12922,7 +12967,16 @@ var RunnerCameraConfigSchema = object({
12922
12967
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
12923
12968
  * this only selects WHICH device pool of that node runs the session.
12924
12969
  */
12925
- deviceKey: string$2().optional()
12970
+ deviceKey: string$2().optional(),
12971
+ /**
12972
+ * Step-tree device-jump roster (phase 1): the node's ENABLED inference
12973
+ * devices, populated by the orchestrator ONLY when `deviceKey` is set and the
12974
+ * node has ≥2 enabled devices. The runner uses it to AUTO-jump an enrichment
12975
+ * step whose model has no build for the elected device's format onto another
12976
+ * enabled device of the SAME node (weighted-least-loaded). Absent/single-entry
12977
+ * ⇒ no jump possible; the step runs on `deviceKey`.
12978
+ */
12979
+ inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
12926
12980
  });
12927
12981
  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;
12928
12982
  /**
@@ -12978,7 +13032,18 @@ var RunnerLocalMetricsSchema = object({
12978
13032
  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({
12979
13033
  handle: FrameHandleSchema,
12980
13034
  bbox: NativeCropBboxSchema,
12981
- maxWidth: number().int().positive().optional()
13035
+ maxWidth: number().int().positive().optional(),
13036
+ /**
13037
+ * When `true`, the runner encodes the resolved crop to JPEG ON THE
13038
+ * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
13039
+ * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
13040
+ * agent) so the compressed payload fits Moleculer's `maxPacketSize` and
13041
+ * no raw pixels cross the process boundary. Same-node callers omit it
13042
+ * and keep the zero-copy raw `bytes` path. Additive + optional: a
13043
+ * pre-encode runner (version skew) ignores it and returns `bytes`, so
13044
+ * the caller falls back to encoding locally.
13045
+ */
13046
+ encodeJpeg: boolean().optional()
12982
13047
  }), NativeCropResultSchema.nullable()), method(object({
12983
13048
  deviceId: number(),
12984
13049
  frameHandle: FrameHandleSchema.optional(),
@@ -17745,7 +17810,8 @@ var LinkedDeviceSchema = object({
17745
17810
  deviceId: number(),
17746
17811
  name: string$2(),
17747
17812
  location: string$2().nullable(),
17748
- features: array(string$2())
17813
+ features: array(string$2()),
17814
+ producesTrackedEvents: boolean().optional()
17749
17815
  });
17750
17816
  var SavedDeviceRowSchema = object({
17751
17817
  /** Numeric id reserved at allocateDeviceId time. */
@@ -19375,6 +19441,7 @@ var TrackSchema = object({
19375
19441
  deviceId: number(),
19376
19442
  className: string$2(),
19377
19443
  label: string$2().optional(),
19444
+ producingDeviceName: string$2().optional(),
19378
19445
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19379
19446
  source: TrackSourceSchema.optional(),
19380
19447
  firstSeen: number(),
@@ -19512,7 +19579,8 @@ var MediaFileKindEnum = _enum([
19512
19579
  "fullFrameBoxed",
19513
19580
  "faceCrop",
19514
19581
  "plateCrop",
19515
- "keyFrame"
19582
+ "keyFrame",
19583
+ "keyFrameSmall"
19516
19584
  ]);
19517
19585
  var MediaFileSchema = object({
19518
19586
  key: string$2(),
@@ -19843,7 +19911,16 @@ var PipelineTemplateSchema = object({
19843
19911
  });
19844
19912
  var DeviceStepConfigSchema = object({
19845
19913
  modelId: string$2().optional(),
19846
- settings: record(string$2(), unknown()).optional()
19914
+ settings: record(string$2(), unknown()).optional(),
19915
+ /**
19916
+ * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
19917
+ * When set, this step runs on the named enabled device of the SAME node
19918
+ * (`<backend>:<device>`) instead of the camera's elected device, bypassing
19919
+ * the runtime AUTO-jump. The orchestrator rejects a `jumpDeviceKey` pointing
19920
+ * at a disabled/absent device on that node at save time. Absent ⇒ the runner
19921
+ * auto-jumps only when the effective device's format cannot run the step.
19922
+ */
19923
+ jumpDeviceKey: string$2().optional()
19847
19924
  });
19848
19925
  var AgentPipelineSettingsSchema = object({
19849
19926
  maxCameras: number().int().nonnegative().nullable().default(null),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-matter-broker",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Matter broker addon for CamStack — owns a Matter fabric (commissioning + the long-lived controller) via the matter.js controller and brokers commissioned Matter nodes into CamStack",
5
5
  "keywords": [
6
6
  "camstack",