@camstack/addon-pipeline 1.2.135 → 1.2.137

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.
Files changed (41) hide show
  1. package/dist/{addon-utils-CKf8kbwh.js → addon-utils-C6b5Tnia.js} +3 -3
  2. package/dist/audio-analyzer/index.js +5 -5
  3. package/dist/audio-analyzer/index.mjs +4 -4
  4. package/dist/detection-pipeline/index.js +55 -17
  5. package/dist/detection-pipeline/index.mjs +53 -15
  6. package/dist/{dist-BzLiQ8Ue.js → dist-4EMKvxCp.js} +275 -25
  7. package/dist/{dist-C1dXLLQq.mjs → dist-g0Or5_pR.mjs} +270 -26
  8. package/dist/{event-loop-stall-monitor-CU-xxX5c.mjs → event-loop-stall-monitor-CskL9Lgu.mjs} +1 -1
  9. package/dist/{event-loop-stall-monitor-DjV4Bow7.js → event-loop-stall-monitor-DDm07Ei6.js} +1 -1
  10. package/dist/{lazy-sharp-DxWmhTqk.js → lazy-sharp-BlA9PxWk.js} +3 -3
  11. package/dist/motion-wasm/index.js +3 -3
  12. package/dist/motion-wasm/index.mjs +3 -3
  13. package/dist/node-BOHn8gpk.js +721 -0
  14. package/dist/node-Bo1g8hLO.mjs +690 -0
  15. package/dist/pipeline-runner/index.js +37 -11
  16. package/dist/pipeline-runner/index.mjs +37 -11
  17. package/dist/{process-memory-CZK3D3kM.js → process-memory-C3084DOt.js} +2 -2
  18. package/dist/{process-memory-CaEwi5Cd.mjs → process-memory-DmrHWybb.mjs} +2 -2
  19. package/dist/recorder/index.js +382 -35
  20. package/dist/recorder/index.mjs +382 -35
  21. package/dist/{segment-demux-js-BbpqygHL.js → segment-demux-js-BrQ_A0oi.js} +1 -1
  22. package/dist/{segment-demux-js-njRO85gd.mjs → segment-demux-js-C-a2pghM.mjs} +1 -1
  23. package/dist/session-decode/decode-worker-child.js +2 -2
  24. package/dist/session-decode/decode-worker-child.mjs +2 -2
  25. package/dist/stream-broker/_stub.js +2 -2
  26. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C14Qqrqn.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-AH6OJ3hJ.mjs} +3 -3
  27. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CQyiEd0l.mjs +26 -0
  28. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BrTM_tsb.mjs +26 -0
  29. package/dist/stream-broker/demux-worker-child.js +1 -1
  30. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  31. package/dist/stream-broker/{hostInit-kjsveCjG.mjs → hostInit-XNyn-FTM.mjs} +3 -3
  32. package/dist/stream-broker/index.js +88 -515
  33. package/dist/stream-broker/index.mjs +85 -510
  34. package/dist/stream-broker/remoteEntry.js +1 -1
  35. package/dist/{worker-protocol-DvTZBvh2.js → worker-protocol-BLfaD5uC.js} +1 -1
  36. package/dist/{worker-protocol-DxsVx0G7.mjs → worker-protocol-vc8WWhjx.mjs} +1 -1
  37. package/package.json +17 -3
  38. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DqplWP1i.mjs +0 -26
  39. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DKMXG57X.mjs +0 -26
  40. package/dist/{addon-utils-CgBCF-mE.mjs → addon-utils-C8KTuPdE.mjs} +2 -2
  41. package/dist/{lazy-sharp-BtT5x-qP.mjs → lazy-sharp-DXsqwpph.mjs} +1 -1
@@ -2,16 +2,17 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-BzLiQ8Ue.js");
6
- const require_event_loop_stall_monitor = require("../event-loop-stall-monitor-DjV4Bow7.js");
7
- const require_worker_protocol = require("../worker-protocol-DvTZBvh2.js");
5
+ const require_dist = require("../dist-4EMKvxCp.js");
6
+ const require_node = require("../node-BOHn8gpk.js");
7
+ const require_event_loop_stall_monitor = require("../event-loop-stall-monitor-DDm07Ei6.js");
8
+ const require_worker_protocol = require("../worker-protocol-BLfaD5uC.js");
8
9
  const require_hub_hostname = require("../hub-hostname-DAJXlOgV.js");
9
- const require_lazy_sharp = require("../lazy-sharp-DxWmhTqk.js");
10
+ const require_lazy_sharp = require("../lazy-sharp-BlA9PxWk.js");
10
11
  const require_restream_intent = require("../restream-intent-Cv9x3jmu.js");
11
12
  const require_remote_restream = require("../remote-restream-CO36Sr30.js");
13
+ let node_child_process = require("node:child_process");
12
14
  let sharp = require("sharp");
13
15
  sharp = require_dist.__toESM(sharp);
14
- let node_child_process = require("node:child_process");
15
16
  let node_url = require("node:url");
16
17
  let node_perf_hooks = require("node:perf_hooks");
17
18
  let node_os = require("node:os");
@@ -29,9 +30,18 @@ var KILL_SIGNALS = {
29
30
  SIGKILL: "SIGKILL",
30
31
  SIGTERM: "SIGTERM"
31
32
  };
32
- /** Adapt a Node {@link ChildProcess} to the coordinator's {@link ForkedChildLike}. */
33
- function wrapChild(child) {
33
+ /**
34
+ * Adapt a Node {@link ChildProcess} to the coordinator's
35
+ * {@link ForkedChildLike}.
36
+ *
37
+ * `onExit` is invoked exactly once, on the child's real exit, before the
38
+ * coordinator's own listener — it is how the cost claim is released. It is a
39
+ * parameter rather than a second `child.on('exit')` in the caller because
40
+ * every listener added out here is one somebody can forget to remove.
41
+ */
42
+ function wrapChild(child, onExit) {
34
43
  child.on("error", () => void 0);
44
+ child.on("exit", onExit);
35
45
  return {
36
46
  send: (msg) => {
37
47
  if (!child.connected) return;
@@ -75,14 +85,21 @@ function wrapChild(child) {
75
85
  * node-av through `CAMSTACK_FRAMEWORK_DIR` / `CAMSTACK_BUNDLED_ADDONS_DIR` on
76
86
  * agents, so a replaced env would silently break decoding off the hub.
77
87
  */
78
- function forkDecodeWorker(_source, leaseOverride = {}) {
79
- return wrapChild((0, node_child_process.fork)(CHILD_ENTRY_PATH, [], {
88
+ function forkDecodeWorker(source, leaseOverride = {}, costRegistry) {
89
+ const child = (0, node_child_process.fork)(CHILD_ENTRY_PATH, [], {
80
90
  serialization: "advanced",
81
91
  env: {
82
92
  ...process.env,
83
93
  ...require_worker_protocol.nativeLeaseSettingEnv(leaseOverride)
84
94
  }
85
- }));
95
+ });
96
+ const costClaim = costRegistry?.claim({
97
+ role: "decode",
98
+ deviceId: source.deviceId,
99
+ unit: `${source.deviceId}/decode`,
100
+ pid: child.pid
101
+ }) ?? require_node.NO_COST_CLAIM;
102
+ return wrapChild(child, () => costClaim.release());
86
103
  }
87
104
  //#endregion
88
105
  //#region src/session-decode/guarded-session-decode.ts
@@ -5210,6 +5227,12 @@ var METRICS_HEARTBEAT_MS = 3e4;
5210
5227
  var PipelineRunnerAddon = class PipelineRunnerAddon extends require_dist.BaseAddon {
5211
5228
  runner = null;
5212
5229
  /**
5230
+ * The decode-worker children this addon forked, claimed at the fork and
5231
+ * released at their exit. One registry per PROCESS; it dies with the
5232
+ * process, which is correct — those workers were this process's children.
5233
+ */
5234
+ costRegistry = new require_node.ChildCostRegistry();
5235
+ /**
5213
5236
  * Per-runner (per-node) decode-worker SPAWN-CONCURRENCY GATE (P5). A single
5214
5237
  * counting semaphore every session-decode fork (detection + motion, all
5215
5238
  * cameras on this node) passes through, sized to
@@ -5511,6 +5534,9 @@ var PipelineRunnerAddon = class PipelineRunnerAddon extends require_dist.BaseAdd
5511
5534
  providers: [{
5512
5535
  capability: require_dist.pipelineRunnerCapability,
5513
5536
  provider: this
5537
+ }, {
5538
+ capability: require_dist.loadContributionCapability,
5539
+ provider: { list: () => this.costRegistry.contributions() }
5514
5540
  }],
5515
5541
  customActions: pipelineRunnerBenchActions,
5516
5542
  actionHandlers: {
@@ -6660,7 +6686,7 @@ var PipelineRunnerAddon = class PipelineRunnerAddon extends require_dist.BaseAdd
6660
6686
  * knobs are read at spawn, so a changed setting reaches NEW sessions and
6661
6687
  * leaves running ones alone (a live session would have to be re-dialled).
6662
6688
  */
6663
- forkDecodeWorkerWithLease = (source) => forkDecodeWorker(source, this.nativeLease.current());
6689
+ forkDecodeWorkerWithLease = (source) => forkDecodeWorker(source, this.nativeLease.current(), this.costRegistry);
6664
6690
  /**
6665
6691
  * Refresh the lease knobs before a decode worker is spawned. Awaited on the
6666
6692
  * `acquire` leg of `startGuardedSessionDecode` (which always completes before
@@ -1,12 +1,13 @@
1
- import { $t as EventCategory, B as defineCustomActions, H as deriveDetailCropRect, Ht as _enum, Jt as number, Kt as lazy, L as customAction, Lt as nodePin, Mt as createEvent, Ot as BaseAddon, St as errMsg, Ut as array, Wt as boolean, Yt as object, Zt as string, ct as pickNativeLeaseOverride, m as DEVICE_BACKEND_TO_FORMAT, p as DEFAULT_NATIVE_LEASE_SETTINGS, qt as literal, st as pickDetailCropConvention, u as DEFAULT_DETAIL_CROP_CONVENTION, ut as pipelineRunnerCapability } from "../dist-C1dXLLQq.mjs";
2
- import { i as resolveFrameViewGeometry, r as localFrameRegistry, t as attributeStall, u as getStepDefinition } from "../event-loop-stall-monitor-CU-xxX5c.mjs";
3
- import { a as nativeLeaseSettingEnv, t as isWorkerReply } from "../worker-protocol-DxsVx0G7.mjs";
1
+ import { $ as loadContributionCapability, B as defineCustomActions, Ct as errMsg, Gt as boolean, H as deriveDetailCropRect, Jt as literal, L as customAction, Nt as createEvent, Qt as string, Rt as nodePin, Ut as _enum, Wt as array, Xt as object, Yt as number, ct as pickDetailCropConvention, dt as pipelineRunnerCapability, en as EventCategory, kt as BaseAddon, lt as pickNativeLeaseOverride, m as DEVICE_BACKEND_TO_FORMAT, p as DEFAULT_NATIVE_LEASE_SETTINGS, qt as lazy, u as DEFAULT_DETAIL_CROP_CONVENTION } from "../dist-g0Or5_pR.mjs";
2
+ import { i as NO_COST_CLAIM, t as ChildCostRegistry } from "../node-Bo1g8hLO.mjs";
3
+ import { i as resolveFrameViewGeometry, r as localFrameRegistry, t as attributeStall, u as getStepDefinition } from "../event-loop-stall-monitor-CskL9Lgu.mjs";
4
+ import { a as nativeLeaseSettingEnv, t as isWorkerReply } from "../worker-protocol-vc8WWhjx.mjs";
4
5
  import { t as resolveHubHostname } from "../hub-hostname-cCknRYKj.mjs";
5
- import { t as getSharp } from "../lazy-sharp-BtT5x-qP.mjs";
6
+ import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
6
7
  import { n as withDetectionIntent } from "../restream-intent-B4BXZra7.mjs";
7
8
  import { n as profileForStreamId, t as isRemoteRestream } from "../remote-restream-BeHi78PZ.mjs";
8
- import sharp from "sharp";
9
9
  import { fork } from "node:child_process";
10
+ import sharp from "sharp";
10
11
  import { fileURLToPath } from "node:url";
11
12
  import { PerformanceObserver } from "node:perf_hooks";
12
13
  import * as os from "node:os";
@@ -23,9 +24,18 @@ var KILL_SIGNALS = {
23
24
  SIGKILL: "SIGKILL",
24
25
  SIGTERM: "SIGTERM"
25
26
  };
26
- /** Adapt a Node {@link ChildProcess} to the coordinator's {@link ForkedChildLike}. */
27
- function wrapChild(child) {
27
+ /**
28
+ * Adapt a Node {@link ChildProcess} to the coordinator's
29
+ * {@link ForkedChildLike}.
30
+ *
31
+ * `onExit` is invoked exactly once, on the child's real exit, before the
32
+ * coordinator's own listener — it is how the cost claim is released. It is a
33
+ * parameter rather than a second `child.on('exit')` in the caller because
34
+ * every listener added out here is one somebody can forget to remove.
35
+ */
36
+ function wrapChild(child, onExit) {
28
37
  child.on("error", () => void 0);
38
+ child.on("exit", onExit);
29
39
  return {
30
40
  send: (msg) => {
31
41
  if (!child.connected) return;
@@ -69,14 +79,21 @@ function wrapChild(child) {
69
79
  * node-av through `CAMSTACK_FRAMEWORK_DIR` / `CAMSTACK_BUNDLED_ADDONS_DIR` on
70
80
  * agents, so a replaced env would silently break decoding off the hub.
71
81
  */
72
- function forkDecodeWorker(_source, leaseOverride = {}) {
73
- return wrapChild(fork(CHILD_ENTRY_PATH, [], {
82
+ function forkDecodeWorker(source, leaseOverride = {}, costRegistry) {
83
+ const child = fork(CHILD_ENTRY_PATH, [], {
74
84
  serialization: "advanced",
75
85
  env: {
76
86
  ...process.env,
77
87
  ...nativeLeaseSettingEnv(leaseOverride)
78
88
  }
79
- }));
89
+ });
90
+ const costClaim = costRegistry?.claim({
91
+ role: "decode",
92
+ deviceId: source.deviceId,
93
+ unit: `${source.deviceId}/decode`,
94
+ pid: child.pid
95
+ }) ?? NO_COST_CLAIM;
96
+ return wrapChild(child, () => costClaim.release());
80
97
  }
81
98
  //#endregion
82
99
  //#region src/session-decode/guarded-session-decode.ts
@@ -5203,6 +5220,12 @@ var METRICS_HEARTBEAT_MS = 3e4;
5203
5220
  var PipelineRunnerAddon = class PipelineRunnerAddon extends BaseAddon {
5204
5221
  runner = null;
5205
5222
  /**
5223
+ * The decode-worker children this addon forked, claimed at the fork and
5224
+ * released at their exit. One registry per PROCESS; it dies with the
5225
+ * process, which is correct — those workers were this process's children.
5226
+ */
5227
+ costRegistry = new ChildCostRegistry();
5228
+ /**
5206
5229
  * Per-runner (per-node) decode-worker SPAWN-CONCURRENCY GATE (P5). A single
5207
5230
  * counting semaphore every session-decode fork (detection + motion, all
5208
5231
  * cameras on this node) passes through, sized to
@@ -5504,6 +5527,9 @@ var PipelineRunnerAddon = class PipelineRunnerAddon extends BaseAddon {
5504
5527
  providers: [{
5505
5528
  capability: pipelineRunnerCapability,
5506
5529
  provider: this
5530
+ }, {
5531
+ capability: loadContributionCapability,
5532
+ provider: { list: () => this.costRegistry.contributions() }
5507
5533
  }],
5508
5534
  customActions: pipelineRunnerBenchActions,
5509
5535
  actionHandlers: {
@@ -6653,7 +6679,7 @@ var PipelineRunnerAddon = class PipelineRunnerAddon extends BaseAddon {
6653
6679
  * knobs are read at spawn, so a changed setting reaches NEW sessions and
6654
6680
  * leaves running ones alone (a live session would have to be re-dialled).
6655
6681
  */
6656
- forkDecodeWorkerWithLease = (source) => forkDecodeWorker(source, this.nativeLease.current());
6682
+ forkDecodeWorkerWithLease = (source) => forkDecodeWorker(source, this.nativeLease.current(), this.costRegistry);
6657
6683
  /**
6658
6684
  * Refresh the lease knobs before a decode worker is spawned. Awaited on the
6659
6685
  * `acquire` leg of `startGuardedSessionDecode` (which always completes before
@@ -1,7 +1,7 @@
1
- const require_dist = require("./dist-BzLiQ8Ue.js");
2
- let node_child_process = require("node:child_process");
1
+ const require_dist = require("./dist-4EMKvxCp.js");
3
2
  let node_fs = require("node:fs");
4
3
  node_fs = require_dist.__toESM(node_fs);
4
+ let node_child_process = require("node:child_process");
5
5
  //#region src/shared/node-topology-platform.ts
6
6
  /**
7
7
  * Pick a node's `{ platform, arch }` from the cluster topology. Returns an empty
@@ -1,6 +1,6 @@
1
- import { it as parseProcStatus } from "./dist-C1dXLLQq.mjs";
2
- import { execFile } from "node:child_process";
1
+ import { at as parseProcStatus } from "./dist-g0Or5_pR.mjs";
3
2
  import * as fs from "node:fs";
3
+ import { execFile } from "node:child_process";
4
4
  //#region src/shared/node-topology-platform.ts
5
5
  /**
6
6
  * Pick a node's `{ platform, arch }` from the cluster topology. Returns an empty