@camstack/addon-provider-tuya 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
@@ -12325,7 +12325,8 @@ var PipelineStepInputSchema = lazy(() => object({
12325
12325
  modelId: string().optional(),
12326
12326
  enabled: boolean().default(true),
12327
12327
  children: array(PipelineStepInputSchema).optional(),
12328
- settings: record(string(), unknown()).optional()
12328
+ settings: record(string(), unknown()).optional(),
12329
+ jumpDeviceKey: string().optional()
12329
12330
  }));
12330
12331
  var ModelSubstitutionSchema = object({
12331
12332
  addonId: string(),
@@ -12664,10 +12665,40 @@ var NativeCropBboxSchema = object({
12664
12665
  });
12665
12666
  /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
12666
12667
  var NativeCropResultSchema = object({
12667
- /** Packed rgb (24-bit) pixels of the crop. */
12668
- bytes: _instanceof(Uint8Array),
12668
+ /**
12669
+ * Packed rgb (24-bit) pixels of the crop. Present on the DEFAULT (raw) path —
12670
+ * same-node (in-process / UDS) callers get zero-copy RGB and encode locally.
12671
+ * OMITTED when the caller requested `encodeJpeg` (the cross-node compressed
12672
+ * path below), where shipping raw RGB is both an invariant violation and, for
12673
+ * a native full frame (~26 MB at 4K), larger than Moleculer's 10 MB
12674
+ * `maxPacketSize` → the packet is dropped and the call 60s-times-out. That is
12675
+ * the cross-node native-media miss: `bytes` is replaced by `jpeg`.
12676
+ */
12677
+ bytes: _instanceof(Uint8Array).optional(),
12678
+ /**
12679
+ * Base64 JPEG of the crop — the COMPRESSED cross-node payload. The OWNING node
12680
+ * (which holds the native surface) encodes it in-process, so a native 4K frame
12681
+ * ships as ~0.5–2 MB (well under `maxPacketSize`) and NO raw pixels ever cross
12682
+ * a process boundary (CLAUDE.md invariant #21). Present ONLY when the request
12683
+ * set `encodeJpeg: true`; `bytes` is then absent.
12684
+ */
12685
+ jpeg: string().optional(),
12669
12686
  width: number().int().positive(),
12670
- height: number().int().positive()
12687
+ height: number().int().positive(),
12688
+ /**
12689
+ * Which source served this crop, so a quality-sensitive consumer (the native
12690
+ * `keyFrame`) can reject a degraded fallback:
12691
+ * - `native` — cut from the decode worker's retained NATIVE surface (the
12692
+ * quality path).
12693
+ * - `ram-fullframe` — the native surface MISSED but the request was full-frame,
12694
+ * so the ≤640 RAM `RetainedFrameStore` served it (honest lower-res; legit for
12695
+ * the blank-frame guard / 640-snapshot resolve, NOT for the clean keyFrame).
12696
+ *
12697
+ * OPTIONAL: a pre-tier runner (version skew) omits it — an ABSENT `tier` MUST be
12698
+ * treated as `native` (accepted) by every consumer so mixed-version clusters
12699
+ * keep the pre-tier behaviour. An ROI miss returns `null` (no tier at all).
12700
+ */
12701
+ tier: _enum(["native", "ram-fullframe"]).optional()
12671
12702
  });
12672
12703
  /** Parent detection context passed to `runDetailSubtree` — the crop's
12673
12704
  * originating detection, in FRAME-space coordinates. Reuses
@@ -12797,6 +12828,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
12797
12828
  hubHostnameOverride: string().optional()
12798
12829
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
12799
12830
  /**
12831
+ * One ENABLED inference device on the runner's node, as the step-tree
12832
+ * device-jump resolver sees it (phase 1). The orchestrator populates this
12833
+ * roster on the attach payload whenever the camera is elected onto a specific
12834
+ * `deviceKey` and the node has ≥2 enabled devices — it is the candidate set the
12835
+ * runner auto-jumps an enrichment step to when the elected device's format
12836
+ * cannot run that step's model. `weight`/`maxSessions` mirror the balancer's
12837
+ * per-device knobs so the auto choice is weighted-least-loaded.
12838
+ */
12839
+ var RunnerInferenceDeviceSchema = object({
12840
+ deviceKey: string(),
12841
+ weight: number().positive().default(1),
12842
+ maxSessions: number().int().positive().nullable().default(null)
12843
+ });
12844
+ /**
12800
12845
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
12801
12846
  * specific runner instance via `attachCamera`. Carries everything the
12802
12847
  * runner needs to subscribe to the local broker and execute inference.
@@ -12914,7 +12959,16 @@ var RunnerCameraConfigSchema = object({
12914
12959
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
12915
12960
  * this only selects WHICH device pool of that node runs the session.
12916
12961
  */
12917
- deviceKey: string().optional()
12962
+ deviceKey: string().optional(),
12963
+ /**
12964
+ * Step-tree device-jump roster (phase 1): the node's ENABLED inference
12965
+ * devices, populated by the orchestrator ONLY when `deviceKey` is set and the
12966
+ * node has ≥2 enabled devices. The runner uses it to AUTO-jump an enrichment
12967
+ * step whose model has no build for the elected device's format onto another
12968
+ * enabled device of the SAME node (weighted-least-loaded). Absent/single-entry
12969
+ * ⇒ no jump possible; the step runs on `deviceKey`.
12970
+ */
12971
+ inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
12918
12972
  });
12919
12973
  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;
12920
12974
  /**
@@ -12970,7 +13024,18 @@ var RunnerLocalMetricsSchema = object({
12970
13024
  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({
12971
13025
  handle: FrameHandleSchema,
12972
13026
  bbox: NativeCropBboxSchema,
12973
- maxWidth: number().int().positive().optional()
13027
+ maxWidth: number().int().positive().optional(),
13028
+ /**
13029
+ * When `true`, the runner encodes the resolved crop to JPEG ON THE
13030
+ * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
13031
+ * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
13032
+ * agent) so the compressed payload fits Moleculer's `maxPacketSize` and
13033
+ * no raw pixels cross the process boundary. Same-node callers omit it
13034
+ * and keep the zero-copy raw `bytes` path. Additive + optional: a
13035
+ * pre-encode runner (version skew) ignores it and returns `bytes`, so
13036
+ * the caller falls back to encoding locally.
13037
+ */
13038
+ encodeJpeg: boolean().optional()
12974
13039
  }), NativeCropResultSchema.nullable()), method(object({
12975
13040
  deviceId: number(),
12976
13041
  frameHandle: FrameHandleSchema.optional(),
@@ -17688,7 +17753,8 @@ var LinkedDeviceSchema = object({
17688
17753
  deviceId: number(),
17689
17754
  name: string(),
17690
17755
  location: string().nullable(),
17691
- features: array(string())
17756
+ features: array(string()),
17757
+ producesTrackedEvents: boolean().optional()
17692
17758
  });
17693
17759
  var SavedDeviceRowSchema = object({
17694
17760
  /** Numeric id reserved at allocateDeviceId time. */
@@ -19318,6 +19384,7 @@ var TrackSchema = object({
19318
19384
  deviceId: number(),
19319
19385
  className: string(),
19320
19386
  label: string().optional(),
19387
+ producingDeviceName: string().optional(),
19321
19388
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19322
19389
  source: TrackSourceSchema.optional(),
19323
19390
  firstSeen: number(),
@@ -19455,7 +19522,8 @@ var MediaFileKindEnum = _enum([
19455
19522
  "fullFrameBoxed",
19456
19523
  "faceCrop",
19457
19524
  "plateCrop",
19458
- "keyFrame"
19525
+ "keyFrame",
19526
+ "keyFrameSmall"
19459
19527
  ]);
19460
19528
  var MediaFileSchema = object({
19461
19529
  key: string(),
@@ -19786,7 +19854,16 @@ var PipelineTemplateSchema = object({
19786
19854
  });
19787
19855
  var DeviceStepConfigSchema = object({
19788
19856
  modelId: string().optional(),
19789
- settings: record(string(), unknown()).optional()
19857
+ settings: record(string(), unknown()).optional(),
19858
+ /**
19859
+ * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
19860
+ * When set, this step runs on the named enabled device of the SAME node
19861
+ * (`<backend>:<device>`) instead of the camera's elected device, bypassing
19862
+ * the runtime AUTO-jump. The orchestrator rejects a `jumpDeviceKey` pointing
19863
+ * at a disabled/absent device on that node at save time. Absent ⇒ the runner
19864
+ * auto-jumps only when the effective device's format cannot run the step.
19865
+ */
19866
+ jumpDeviceKey: string().optional()
19790
19867
  });
19791
19868
  var AgentPipelineSettingsSchema = object({
19792
19869
  maxCameras: number().int().nonnegative().nullable().default(null),
package/dist/addon.mjs CHANGED
@@ -12324,7 +12324,8 @@ var PipelineStepInputSchema = lazy(() => object({
12324
12324
  modelId: string().optional(),
12325
12325
  enabled: boolean().default(true),
12326
12326
  children: array(PipelineStepInputSchema).optional(),
12327
- settings: record(string(), unknown()).optional()
12327
+ settings: record(string(), unknown()).optional(),
12328
+ jumpDeviceKey: string().optional()
12328
12329
  }));
12329
12330
  var ModelSubstitutionSchema = object({
12330
12331
  addonId: string(),
@@ -12663,10 +12664,40 @@ var NativeCropBboxSchema = object({
12663
12664
  });
12664
12665
  /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
12665
12666
  var NativeCropResultSchema = object({
12666
- /** Packed rgb (24-bit) pixels of the crop. */
12667
- bytes: _instanceof(Uint8Array),
12667
+ /**
12668
+ * Packed rgb (24-bit) pixels of the crop. Present on the DEFAULT (raw) path —
12669
+ * same-node (in-process / UDS) callers get zero-copy RGB and encode locally.
12670
+ * OMITTED when the caller requested `encodeJpeg` (the cross-node compressed
12671
+ * path below), where shipping raw RGB is both an invariant violation and, for
12672
+ * a native full frame (~26 MB at 4K), larger than Moleculer's 10 MB
12673
+ * `maxPacketSize` → the packet is dropped and the call 60s-times-out. That is
12674
+ * the cross-node native-media miss: `bytes` is replaced by `jpeg`.
12675
+ */
12676
+ bytes: _instanceof(Uint8Array).optional(),
12677
+ /**
12678
+ * Base64 JPEG of the crop — the COMPRESSED cross-node payload. The OWNING node
12679
+ * (which holds the native surface) encodes it in-process, so a native 4K frame
12680
+ * ships as ~0.5–2 MB (well under `maxPacketSize`) and NO raw pixels ever cross
12681
+ * a process boundary (CLAUDE.md invariant #21). Present ONLY when the request
12682
+ * set `encodeJpeg: true`; `bytes` is then absent.
12683
+ */
12684
+ jpeg: string().optional(),
12668
12685
  width: number().int().positive(),
12669
- height: number().int().positive()
12686
+ height: number().int().positive(),
12687
+ /**
12688
+ * Which source served this crop, so a quality-sensitive consumer (the native
12689
+ * `keyFrame`) can reject a degraded fallback:
12690
+ * - `native` — cut from the decode worker's retained NATIVE surface (the
12691
+ * quality path).
12692
+ * - `ram-fullframe` — the native surface MISSED but the request was full-frame,
12693
+ * so the ≤640 RAM `RetainedFrameStore` served it (honest lower-res; legit for
12694
+ * the blank-frame guard / 640-snapshot resolve, NOT for the clean keyFrame).
12695
+ *
12696
+ * OPTIONAL: a pre-tier runner (version skew) omits it — an ABSENT `tier` MUST be
12697
+ * treated as `native` (accepted) by every consumer so mixed-version clusters
12698
+ * keep the pre-tier behaviour. An ROI miss returns `null` (no tier at all).
12699
+ */
12700
+ tier: _enum(["native", "ram-fullframe"]).optional()
12670
12701
  });
12671
12702
  /** Parent detection context passed to `runDetailSubtree` — the crop's
12672
12703
  * originating detection, in FRAME-space coordinates. Reuses
@@ -12796,6 +12827,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
12796
12827
  hubHostnameOverride: string().optional()
12797
12828
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
12798
12829
  /**
12830
+ * One ENABLED inference device on the runner's node, as the step-tree
12831
+ * device-jump resolver sees it (phase 1). The orchestrator populates this
12832
+ * roster on the attach payload whenever the camera is elected onto a specific
12833
+ * `deviceKey` and the node has ≥2 enabled devices — it is the candidate set the
12834
+ * runner auto-jumps an enrichment step to when the elected device's format
12835
+ * cannot run that step's model. `weight`/`maxSessions` mirror the balancer's
12836
+ * per-device knobs so the auto choice is weighted-least-loaded.
12837
+ */
12838
+ var RunnerInferenceDeviceSchema = object({
12839
+ deviceKey: string(),
12840
+ weight: number().positive().default(1),
12841
+ maxSessions: number().int().positive().nullable().default(null)
12842
+ });
12843
+ /**
12799
12844
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
12800
12845
  * specific runner instance via `attachCamera`. Carries everything the
12801
12846
  * runner needs to subscribe to the local broker and execute inference.
@@ -12913,7 +12958,16 @@ var RunnerCameraConfigSchema = object({
12913
12958
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
12914
12959
  * this only selects WHICH device pool of that node runs the session.
12915
12960
  */
12916
- deviceKey: string().optional()
12961
+ deviceKey: string().optional(),
12962
+ /**
12963
+ * Step-tree device-jump roster (phase 1): the node's ENABLED inference
12964
+ * devices, populated by the orchestrator ONLY when `deviceKey` is set and the
12965
+ * node has ≥2 enabled devices. The runner uses it to AUTO-jump an enrichment
12966
+ * step whose model has no build for the elected device's format onto another
12967
+ * enabled device of the SAME node (weighted-least-loaded). Absent/single-entry
12968
+ * ⇒ no jump possible; the step runs on `deviceKey`.
12969
+ */
12970
+ inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
12917
12971
  });
12918
12972
  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;
12919
12973
  /**
@@ -12969,7 +13023,18 @@ var RunnerLocalMetricsSchema = object({
12969
13023
  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({
12970
13024
  handle: FrameHandleSchema,
12971
13025
  bbox: NativeCropBboxSchema,
12972
- maxWidth: number().int().positive().optional()
13026
+ maxWidth: number().int().positive().optional(),
13027
+ /**
13028
+ * When `true`, the runner encodes the resolved crop to JPEG ON THE
13029
+ * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
13030
+ * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
13031
+ * agent) so the compressed payload fits Moleculer's `maxPacketSize` and
13032
+ * no raw pixels cross the process boundary. Same-node callers omit it
13033
+ * and keep the zero-copy raw `bytes` path. Additive + optional: a
13034
+ * pre-encode runner (version skew) ignores it and returns `bytes`, so
13035
+ * the caller falls back to encoding locally.
13036
+ */
13037
+ encodeJpeg: boolean().optional()
12973
13038
  }), NativeCropResultSchema.nullable()), method(object({
12974
13039
  deviceId: number(),
12975
13040
  frameHandle: FrameHandleSchema.optional(),
@@ -17687,7 +17752,8 @@ var LinkedDeviceSchema = object({
17687
17752
  deviceId: number(),
17688
17753
  name: string(),
17689
17754
  location: string().nullable(),
17690
- features: array(string())
17755
+ features: array(string()),
17756
+ producesTrackedEvents: boolean().optional()
17691
17757
  });
17692
17758
  var SavedDeviceRowSchema = object({
17693
17759
  /** Numeric id reserved at allocateDeviceId time. */
@@ -19317,6 +19383,7 @@ var TrackSchema = object({
19317
19383
  deviceId: number(),
19318
19384
  className: string(),
19319
19385
  label: string().optional(),
19386
+ producingDeviceName: string().optional(),
19320
19387
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
19321
19388
  source: TrackSourceSchema.optional(),
19322
19389
  firstSeen: number(),
@@ -19454,7 +19521,8 @@ var MediaFileKindEnum = _enum([
19454
19521
  "fullFrameBoxed",
19455
19522
  "faceCrop",
19456
19523
  "plateCrop",
19457
- "keyFrame"
19524
+ "keyFrame",
19525
+ "keyFrameSmall"
19458
19526
  ]);
19459
19527
  var MediaFileSchema = object({
19460
19528
  key: string(),
@@ -19785,7 +19853,16 @@ var PipelineTemplateSchema = object({
19785
19853
  });
19786
19854
  var DeviceStepConfigSchema = object({
19787
19855
  modelId: string().optional(),
19788
- settings: record(string(), unknown()).optional()
19856
+ settings: record(string(), unknown()).optional(),
19857
+ /**
19858
+ * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
19859
+ * When set, this step runs on the named enabled device of the SAME node
19860
+ * (`<backend>:<device>`) instead of the camera's elected device, bypassing
19861
+ * the runtime AUTO-jump. The orchestrator rejects a `jumpDeviceKey` pointing
19862
+ * at a disabled/absent device on that node at save time. Absent ⇒ the runner
19863
+ * auto-jumps only when the effective device's format cannot run the step.
19864
+ */
19865
+ jumpDeviceKey: string().optional()
19789
19866
  });
19790
19867
  var AgentPipelineSettingsSchema = object({
19791
19868
  maxCameras: number().int().nonnegative().nullable().default(null),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
5
5
  "keywords": [
6
6
  "camstack",