@camstack/addon-cloudflare 1.2.0 → 1.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.
@@ -11013,7 +11013,8 @@ var PipelineStepInputSchema = lazy(() => object({
11013
11013
  modelId: string().optional(),
11014
11014
  enabled: boolean().default(true),
11015
11015
  children: array(PipelineStepInputSchema).optional(),
11016
- settings: record(string(), unknown()).optional()
11016
+ settings: record(string(), unknown()).optional(),
11017
+ jumpDeviceKey: string().optional()
11017
11018
  }));
11018
11019
  var ModelSubstitutionSchema = object({
11019
11020
  addonId: string(),
@@ -11319,10 +11320,40 @@ var NativeCropBboxSchema = object({
11319
11320
  });
11320
11321
  /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
11321
11322
  var NativeCropResultSchema = object({
11322
- /** Packed rgb (24-bit) pixels of the crop. */
11323
- bytes: _instanceof(Uint8Array),
11323
+ /**
11324
+ * Packed rgb (24-bit) pixels of the crop. Present on the DEFAULT (raw) path —
11325
+ * same-node (in-process / UDS) callers get zero-copy RGB and encode locally.
11326
+ * OMITTED when the caller requested `encodeJpeg` (the cross-node compressed
11327
+ * path below), where shipping raw RGB is both an invariant violation and, for
11328
+ * a native full frame (~26 MB at 4K), larger than Moleculer's 10 MB
11329
+ * `maxPacketSize` → the packet is dropped and the call 60s-times-out. That is
11330
+ * the cross-node native-media miss: `bytes` is replaced by `jpeg`.
11331
+ */
11332
+ bytes: _instanceof(Uint8Array).optional(),
11333
+ /**
11334
+ * Base64 JPEG of the crop — the COMPRESSED cross-node payload. The OWNING node
11335
+ * (which holds the native surface) encodes it in-process, so a native 4K frame
11336
+ * ships as ~0.5–2 MB (well under `maxPacketSize`) and NO raw pixels ever cross
11337
+ * a process boundary (CLAUDE.md invariant #21). Present ONLY when the request
11338
+ * set `encodeJpeg: true`; `bytes` is then absent.
11339
+ */
11340
+ jpeg: string().optional(),
11324
11341
  width: number().int().positive(),
11325
- height: number().int().positive()
11342
+ height: number().int().positive(),
11343
+ /**
11344
+ * Which source served this crop, so a quality-sensitive consumer (the native
11345
+ * `keyFrame`) can reject a degraded fallback:
11346
+ * - `native` — cut from the decode worker's retained NATIVE surface (the
11347
+ * quality path).
11348
+ * - `ram-fullframe` — the native surface MISSED but the request was full-frame,
11349
+ * so the ≤640 RAM `RetainedFrameStore` served it (honest lower-res; legit for
11350
+ * the blank-frame guard / 640-snapshot resolve, NOT for the clean keyFrame).
11351
+ *
11352
+ * OPTIONAL: a pre-tier runner (version skew) omits it — an ABSENT `tier` MUST be
11353
+ * treated as `native` (accepted) by every consumer so mixed-version clusters
11354
+ * keep the pre-tier behaviour. An ROI miss returns `null` (no tier at all).
11355
+ */
11356
+ tier: _enum(["native", "ram-fullframe"]).optional()
11326
11357
  });
11327
11358
  /** Parent detection context passed to `runDetailSubtree` — the crop's
11328
11359
  * originating detection, in FRAME-space coordinates. Reuses
@@ -11452,6 +11483,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
11452
11483
  hubHostnameOverride: string().optional()
11453
11484
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
11454
11485
  /**
11486
+ * One ENABLED inference device on the runner's node, as the step-tree
11487
+ * device-jump resolver sees it (phase 1). The orchestrator populates this
11488
+ * roster on the attach payload whenever the camera is elected onto a specific
11489
+ * `deviceKey` and the node has ≥2 enabled devices — it is the candidate set the
11490
+ * runner auto-jumps an enrichment step to when the elected device's format
11491
+ * cannot run that step's model. `weight`/`maxSessions` mirror the balancer's
11492
+ * per-device knobs so the auto choice is weighted-least-loaded.
11493
+ */
11494
+ var RunnerInferenceDeviceSchema = object({
11495
+ deviceKey: string(),
11496
+ weight: number().positive().default(1),
11497
+ maxSessions: number().int().positive().nullable().default(null)
11498
+ });
11499
+ /**
11455
11500
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
11456
11501
  * specific runner instance via `attachCamera`. Carries everything the
11457
11502
  * runner needs to subscribe to the local broker and execute inference.
@@ -11569,7 +11614,16 @@ var RunnerCameraConfigSchema = object({
11569
11614
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
11570
11615
  * this only selects WHICH device pool of that node runs the session.
11571
11616
  */
11572
- deviceKey: string().optional()
11617
+ deviceKey: string().optional(),
11618
+ /**
11619
+ * Step-tree device-jump roster (phase 1): the node's ENABLED inference
11620
+ * devices, populated by the orchestrator ONLY when `deviceKey` is set and the
11621
+ * node has ≥2 enabled devices. The runner uses it to AUTO-jump an enrichment
11622
+ * step whose model has no build for the elected device's format onto another
11623
+ * enabled device of the SAME node (weighted-least-loaded). Absent/single-entry
11624
+ * ⇒ no jump possible; the step runs on `deviceKey`.
11625
+ */
11626
+ inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
11573
11627
  });
11574
11628
  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;
11575
11629
  /**
@@ -11625,7 +11679,18 @@ var RunnerLocalMetricsSchema = object({
11625
11679
  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({
11626
11680
  handle: FrameHandleSchema,
11627
11681
  bbox: NativeCropBboxSchema,
11628
- maxWidth: number().int().positive().optional()
11682
+ maxWidth: number().int().positive().optional(),
11683
+ /**
11684
+ * When `true`, the runner encodes the resolved crop to JPEG ON THE
11685
+ * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
11686
+ * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
11687
+ * agent) so the compressed payload fits Moleculer's `maxPacketSize` and
11688
+ * no raw pixels cross the process boundary. Same-node callers omit it
11689
+ * and keep the zero-copy raw `bytes` path. Additive + optional: a
11690
+ * pre-encode runner (version skew) ignores it and returns `bytes`, so
11691
+ * the caller falls back to encoding locally.
11692
+ */
11693
+ encodeJpeg: boolean().optional()
11629
11694
  }), NativeCropResultSchema.nullable()), method(object({
11630
11695
  deviceId: number(),
11631
11696
  frameHandle: FrameHandleSchema.optional(),
@@ -14674,7 +14739,8 @@ var LinkedDeviceSchema = object({
14674
14739
  deviceId: number(),
14675
14740
  name: string(),
14676
14741
  location: string().nullable(),
14677
- features: array(string())
14742
+ features: array(string()),
14743
+ producesTrackedEvents: boolean().optional()
14678
14744
  });
14679
14745
  var SavedDeviceRowSchema = object({
14680
14746
  /** Numeric id reserved at allocateDeviceId time. */
@@ -16321,6 +16387,7 @@ var TrackSchema = object({
16321
16387
  deviceId: number(),
16322
16388
  className: string(),
16323
16389
  label: string().optional(),
16390
+ producingDeviceName: string().optional(),
16324
16391
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16325
16392
  source: TrackSourceSchema.optional(),
16326
16393
  firstSeen: number(),
@@ -16458,7 +16525,8 @@ var MediaFileKindEnum = _enum([
16458
16525
  "fullFrameBoxed",
16459
16526
  "faceCrop",
16460
16527
  "plateCrop",
16461
- "keyFrame"
16528
+ "keyFrame",
16529
+ "keyFrameSmall"
16462
16530
  ]);
16463
16531
  var MediaFileSchema = object({
16464
16532
  key: string(),
@@ -16789,7 +16857,16 @@ var PipelineTemplateSchema = object({
16789
16857
  });
16790
16858
  var DeviceStepConfigSchema = object({
16791
16859
  modelId: string().optional(),
16792
- settings: record(string(), unknown()).optional()
16860
+ settings: record(string(), unknown()).optional(),
16861
+ /**
16862
+ * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
16863
+ * When set, this step runs on the named enabled device of the SAME node
16864
+ * (`<backend>:<device>`) instead of the camera's elected device, bypassing
16865
+ * the runtime AUTO-jump. The orchestrator rejects a `jumpDeviceKey` pointing
16866
+ * at a disabled/absent device on that node at save time. Absent ⇒ the runner
16867
+ * auto-jumps only when the effective device's format cannot run the step.
16868
+ */
16869
+ jumpDeviceKey: string().optional()
16793
16870
  });
16794
16871
  var AgentPipelineSettingsSchema = object({
16795
16872
  maxCameras: number().int().nonnegative().nullable().default(null),
@@ -11013,7 +11013,8 @@ var PipelineStepInputSchema = lazy(() => object({
11013
11013
  modelId: string().optional(),
11014
11014
  enabled: boolean().default(true),
11015
11015
  children: array(PipelineStepInputSchema).optional(),
11016
- settings: record(string(), unknown()).optional()
11016
+ settings: record(string(), unknown()).optional(),
11017
+ jumpDeviceKey: string().optional()
11017
11018
  }));
11018
11019
  var ModelSubstitutionSchema = object({
11019
11020
  addonId: string(),
@@ -11319,10 +11320,40 @@ var NativeCropBboxSchema = object({
11319
11320
  });
11320
11321
  /** Result of a best-effort native-resolution crop (`getNativeCrop`). */
11321
11322
  var NativeCropResultSchema = object({
11322
- /** Packed rgb (24-bit) pixels of the crop. */
11323
- bytes: _instanceof(Uint8Array),
11323
+ /**
11324
+ * Packed rgb (24-bit) pixels of the crop. Present on the DEFAULT (raw) path —
11325
+ * same-node (in-process / UDS) callers get zero-copy RGB and encode locally.
11326
+ * OMITTED when the caller requested `encodeJpeg` (the cross-node compressed
11327
+ * path below), where shipping raw RGB is both an invariant violation and, for
11328
+ * a native full frame (~26 MB at 4K), larger than Moleculer's 10 MB
11329
+ * `maxPacketSize` → the packet is dropped and the call 60s-times-out. That is
11330
+ * the cross-node native-media miss: `bytes` is replaced by `jpeg`.
11331
+ */
11332
+ bytes: _instanceof(Uint8Array).optional(),
11333
+ /**
11334
+ * Base64 JPEG of the crop — the COMPRESSED cross-node payload. The OWNING node
11335
+ * (which holds the native surface) encodes it in-process, so a native 4K frame
11336
+ * ships as ~0.5–2 MB (well under `maxPacketSize`) and NO raw pixels ever cross
11337
+ * a process boundary (CLAUDE.md invariant #21). Present ONLY when the request
11338
+ * set `encodeJpeg: true`; `bytes` is then absent.
11339
+ */
11340
+ jpeg: string().optional(),
11324
11341
  width: number().int().positive(),
11325
- height: number().int().positive()
11342
+ height: number().int().positive(),
11343
+ /**
11344
+ * Which source served this crop, so a quality-sensitive consumer (the native
11345
+ * `keyFrame`) can reject a degraded fallback:
11346
+ * - `native` — cut from the decode worker's retained NATIVE surface (the
11347
+ * quality path).
11348
+ * - `ram-fullframe` — the native surface MISSED but the request was full-frame,
11349
+ * so the ≤640 RAM `RetainedFrameStore` served it (honest lower-res; legit for
11350
+ * the blank-frame guard / 640-snapshot resolve, NOT for the clean keyFrame).
11351
+ *
11352
+ * OPTIONAL: a pre-tier runner (version skew) omits it — an ABSENT `tier` MUST be
11353
+ * treated as `native` (accepted) by every consumer so mixed-version clusters
11354
+ * keep the pre-tier behaviour. An ROI miss returns `null` (no tier at all).
11355
+ */
11356
+ tier: _enum(["native", "ram-fullframe"]).optional()
11326
11357
  });
11327
11358
  /** Parent detection context passed to `runDetailSubtree` — the crop's
11328
11359
  * originating detection, in FRAME-space coordinates. Reuses
@@ -11452,6 +11483,20 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
11452
11483
  hubHostnameOverride: string().optional()
11453
11484
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
11454
11485
  /**
11486
+ * One ENABLED inference device on the runner's node, as the step-tree
11487
+ * device-jump resolver sees it (phase 1). The orchestrator populates this
11488
+ * roster on the attach payload whenever the camera is elected onto a specific
11489
+ * `deviceKey` and the node has ≥2 enabled devices — it is the candidate set the
11490
+ * runner auto-jumps an enrichment step to when the elected device's format
11491
+ * cannot run that step's model. `weight`/`maxSessions` mirror the balancer's
11492
+ * per-device knobs so the auto choice is weighted-least-loaded.
11493
+ */
11494
+ var RunnerInferenceDeviceSchema = object({
11495
+ deviceKey: string(),
11496
+ weight: number().positive().default(1),
11497
+ maxSessions: number().int().positive().nullable().default(null)
11498
+ });
11499
+ /**
11455
11500
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
11456
11501
  * specific runner instance via `attachCamera`. Carries everything the
11457
11502
  * runner needs to subscribe to the local broker and execute inference.
@@ -11569,7 +11614,16 @@ var RunnerCameraConfigSchema = object({
11569
11614
  * omitted ⇒ the runner's default device. The engine itself stays node-local —
11570
11615
  * this only selects WHICH device pool of that node runs the session.
11571
11616
  */
11572
- deviceKey: string().optional()
11617
+ deviceKey: string().optional(),
11618
+ /**
11619
+ * Step-tree device-jump roster (phase 1): the node's ENABLED inference
11620
+ * devices, populated by the orchestrator ONLY when `deviceKey` is set and the
11621
+ * node has ≥2 enabled devices. The runner uses it to AUTO-jump an enrichment
11622
+ * step whose model has no build for the elected device's format onto another
11623
+ * enabled device of the SAME node (weighted-least-loaded). Absent/single-entry
11624
+ * ⇒ no jump possible; the step runs on `deviceKey`.
11625
+ */
11626
+ inferenceDevices: array(RunnerInferenceDeviceSchema).readonly().optional()
11573
11627
  });
11574
11628
  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;
11575
11629
  /**
@@ -11625,7 +11679,18 @@ var RunnerLocalMetricsSchema = object({
11625
11679
  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({
11626
11680
  handle: FrameHandleSchema,
11627
11681
  bbox: NativeCropBboxSchema,
11628
- maxWidth: number().int().positive().optional()
11682
+ maxWidth: number().int().positive().optional(),
11683
+ /**
11684
+ * When `true`, the runner encodes the resolved crop to JPEG ON THE
11685
+ * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
11686
+ * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
11687
+ * agent) so the compressed payload fits Moleculer's `maxPacketSize` and
11688
+ * no raw pixels cross the process boundary. Same-node callers omit it
11689
+ * and keep the zero-copy raw `bytes` path. Additive + optional: a
11690
+ * pre-encode runner (version skew) ignores it and returns `bytes`, so
11691
+ * the caller falls back to encoding locally.
11692
+ */
11693
+ encodeJpeg: boolean().optional()
11629
11694
  }), NativeCropResultSchema.nullable()), method(object({
11630
11695
  deviceId: number(),
11631
11696
  frameHandle: FrameHandleSchema.optional(),
@@ -14674,7 +14739,8 @@ var LinkedDeviceSchema = object({
14674
14739
  deviceId: number(),
14675
14740
  name: string(),
14676
14741
  location: string().nullable(),
14677
- features: array(string())
14742
+ features: array(string()),
14743
+ producesTrackedEvents: boolean().optional()
14678
14744
  });
14679
14745
  var SavedDeviceRowSchema = object({
14680
14746
  /** Numeric id reserved at allocateDeviceId time. */
@@ -16321,6 +16387,7 @@ var TrackSchema = object({
16321
16387
  deviceId: number(),
16322
16388
  className: string(),
16323
16389
  label: string().optional(),
16390
+ producingDeviceName: string().optional(),
16324
16391
  /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16325
16392
  source: TrackSourceSchema.optional(),
16326
16393
  firstSeen: number(),
@@ -16458,7 +16525,8 @@ var MediaFileKindEnum = _enum([
16458
16525
  "fullFrameBoxed",
16459
16526
  "faceCrop",
16460
16527
  "plateCrop",
16461
- "keyFrame"
16528
+ "keyFrame",
16529
+ "keyFrameSmall"
16462
16530
  ]);
16463
16531
  var MediaFileSchema = object({
16464
16532
  key: string(),
@@ -16789,7 +16857,16 @@ var PipelineTemplateSchema = object({
16789
16857
  });
16790
16858
  var DeviceStepConfigSchema = object({
16791
16859
  modelId: string().optional(),
16792
- settings: record(string(), unknown()).optional()
16860
+ settings: record(string(), unknown()).optional(),
16861
+ /**
16862
+ * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
16863
+ * When set, this step runs on the named enabled device of the SAME node
16864
+ * (`<backend>:<device>`) instead of the camera's elected device, bypassing
16865
+ * the runtime AUTO-jump. The orchestrator rejects a `jumpDeviceKey` pointing
16866
+ * at a disabled/absent device on that node at save time. Absent ⇒ the runner
16867
+ * auto-jumps only when the effective device's format cannot run the step.
16868
+ */
16869
+ jumpDeviceKey: string().optional()
16793
16870
  });
16794
16871
  var AgentPipelineSettingsSchema = object({
16795
16872
  maxCameras: number().int().nonnegative().nullable().default(null),
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
- const require_dist = require("../dist-BlG4exZI.js");
24
+ const require_dist = require("../dist-MFDeHonq.js");
25
25
  let node_path = require("node:path");
26
26
  node_path = __toESM(node_path);
27
27
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { a as BaseAddon, c as boolean, d as number, f as object, m as EventCategory, n as defineCustomActions, o as _enum, p as string, r as networkAccessCapability, s as array, t as customAction, u as literal } from "../dist-DJJB6LQC.mjs";
1
+ import { a as BaseAddon, c as boolean, d as number, f as object, m as EventCategory, n as defineCustomActions, o as _enum, p as string, r as networkAccessCapability, s as array, t as customAction, u as literal } from "../dist-BIPIB3HA.mjs";
2
2
  import * as path from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { spawn } from "node:child_process";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("../dist-BlG4exZI.js");
2
+ const require_dist = require("../dist-MFDeHonq.js");
3
3
  //#region src/turn/cloudflare-turn.ts
4
4
  /**
5
5
  * Cloudflare returns ICE servers in several flavours depending on which
@@ -1,4 +1,4 @@
1
- import { a as BaseAddon, c as boolean, d as number, f as object, i as turnProviderCapability, l as discriminatedUnion, n as defineCustomActions, p as string, t as customAction, u as literal } from "../dist-DJJB6LQC.mjs";
1
+ import { a as BaseAddon, c as boolean, d as number, f as object, i as turnProviderCapability, l as discriminatedUnion, n as defineCustomActions, p as string, t as customAction, u as literal } from "../dist-BIPIB3HA.mjs";
2
2
  //#region src/turn/cloudflare-turn.ts
3
3
  /**
4
4
  * Cloudflare returns ICE servers in several flavours depending on which
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-cloudflare",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Cloudflare bundle — Tunnel (network-access) + TURN relay (turn-provider). Multi-entry npm package shipping 2 addons under a single bundle.",
5
5
  "keywords": [
6
6
  "camstack",