@camstack/addon-pipeline 1.2.59 → 1.2.61

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 (90) hide show
  1. package/dist/audio-analyzer/index.js +1 -1
  2. package/dist/audio-analyzer/index.mjs +1 -1
  3. package/dist/detection-pipeline/index.js +2 -2
  4. package/dist/detection-pipeline/index.mjs +2 -2
  5. package/dist/{dist-D8TX_P_A.js → dist-BInMIG0Q.js} +54 -7
  6. package/dist/{dist-B55xTTsS.mjs → dist-aslBaGaT.mjs} +54 -7
  7. package/dist/{event-loop-stall-monitor-Cq_KOlfb.mjs → event-loop-stall-monitor-CQTw_YEv.mjs} +1 -1
  8. package/dist/{event-loop-stall-monitor-Bs6d-u_F.js → event-loop-stall-monitor-DXI8aXvN.js} +1 -1
  9. package/dist/motion-wasm/index.js +1 -1
  10. package/dist/motion-wasm/index.mjs +1 -1
  11. package/dist/pipeline-runner/index.js +3 -3
  12. package/dist/pipeline-runner/index.mjs +3 -3
  13. package/dist/recorder/index.js +1 -1
  14. package/dist/recorder/index.mjs +1 -1
  15. package/dist/session-decode/decode-worker-child.js +1 -1
  16. package/dist/session-decode/decode-worker-child.mjs +1 -1
  17. package/dist/stream-broker/_stub.js +1 -1
  18. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C-9q6y1s.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-BqfT64lY.mjs} +3 -3
  19. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-SwB-L-Iy.mjs +26 -0
  20. package/dist/stream-broker/{hostInit-DiXYwnXH.mjs → hostInit-gSVkUY-E.mjs} +3 -3
  21. package/dist/stream-broker/index.js +22 -58
  22. package/dist/stream-broker/index.mjs +23 -59
  23. package/dist/stream-broker/remoteEntry.js +1 -1
  24. package/dist/{worker-protocol-C2uctCrd.js → worker-protocol-Bs2ULhzO.js} +1 -1
  25. package/dist/{worker-protocol-Bol291_n.mjs → worker-protocol-DQJWq-MP.mjs} +1 -1
  26. package/package.json +2 -5
  27. package/python/__pycache__/inference_pool.cpython-312.pyc +0 -0
  28. package/python/__pycache__/inference_pool.cpython-313.pyc +0 -0
  29. package/python/__pycache__/inference_pool.cpython-314.pyc +0 -0
  30. package/python/__pycache__/test_inference_pool_backpressure.cpython-314.pyc +0 -0
  31. package/python/__pycache__/test_inference_pool_coreml_cache.cpython-314.pyc +0 -0
  32. package/python/__pycache__/test_inference_pool_device_selection.cpython-314.pyc +0 -0
  33. package/python/__pycache__/test_inference_pool_layout.cpython-314.pyc +0 -0
  34. package/python/__pycache__/test_inference_pool_preprocess.cpython-314.pyc +0 -0
  35. package/python/__pycache__/yamnet_audio.cpython-314.pyc +0 -0
  36. package/python/postprocessors/__pycache__/__init__.cpython-312.pyc +0 -0
  37. package/python/postprocessors/__pycache__/__init__.cpython-313.pyc +0 -0
  38. package/python/postprocessors/__pycache__/__init__.cpython-314.pyc +0 -0
  39. package/python/postprocessors/__pycache__/_safety.cpython-313.pyc +0 -0
  40. package/python/postprocessors/__pycache__/arcface.cpython-312.pyc +0 -0
  41. package/python/postprocessors/__pycache__/arcface.cpython-313.pyc +0 -0
  42. package/python/postprocessors/__pycache__/arcface.cpython-314.pyc +0 -0
  43. package/python/postprocessors/__pycache__/clip.cpython-312.pyc +0 -0
  44. package/python/postprocessors/__pycache__/clip.cpython-313.pyc +0 -0
  45. package/python/postprocessors/__pycache__/clip.cpython-314.pyc +0 -0
  46. package/python/postprocessors/__pycache__/ctc.cpython-312.pyc +0 -0
  47. package/python/postprocessors/__pycache__/ctc.cpython-313.pyc +0 -0
  48. package/python/postprocessors/__pycache__/ctc.cpython-314.pyc +0 -0
  49. package/python/postprocessors/__pycache__/rfdetr.cpython-312.pyc +0 -0
  50. package/python/postprocessors/__pycache__/saliency.cpython-312.pyc +0 -0
  51. package/python/postprocessors/__pycache__/saliency.cpython-313.pyc +0 -0
  52. package/python/postprocessors/__pycache__/saliency.cpython-314.pyc +0 -0
  53. package/python/postprocessors/__pycache__/scrfd.cpython-312.pyc +0 -0
  54. package/python/postprocessors/__pycache__/scrfd.cpython-313.pyc +0 -0
  55. package/python/postprocessors/__pycache__/scrfd.cpython-314.pyc +0 -0
  56. package/python/postprocessors/__pycache__/softmax.cpython-312.pyc +0 -0
  57. package/python/postprocessors/__pycache__/softmax.cpython-313.pyc +0 -0
  58. package/python/postprocessors/__pycache__/softmax.cpython-314.pyc +0 -0
  59. package/python/postprocessors/__pycache__/ssd.cpython-312.pyc +0 -0
  60. package/python/postprocessors/__pycache__/ssd.cpython-313.pyc +0 -0
  61. package/python/postprocessors/__pycache__/ssd.cpython-314.pyc +0 -0
  62. package/python/postprocessors/__pycache__/test_clip.cpython-312-pytest-9.1.1.pyc +0 -0
  63. package/python/postprocessors/__pycache__/test_clip.cpython-313-pytest-9.1.1.pyc +0 -0
  64. package/python/postprocessors/__pycache__/test_ctc.cpython-312-pytest-9.1.1.pyc +0 -0
  65. package/python/postprocessors/__pycache__/test_ctc.cpython-312.pyc +0 -0
  66. package/python/postprocessors/__pycache__/test_ctc.cpython-313-pytest-9.1.1.pyc +0 -0
  67. package/python/postprocessors/__pycache__/test_ctc.cpython-313.pyc +0 -0
  68. package/python/postprocessors/__pycache__/test_rfdetr.cpython-312-pytest-9.1.1.pyc +0 -0
  69. package/python/postprocessors/__pycache__/test_saliency.cpython-312-pytest-9.1.1.pyc +0 -0
  70. package/python/postprocessors/__pycache__/test_saliency.cpython-313-pytest-9.1.1.pyc +0 -0
  71. package/python/postprocessors/__pycache__/test_softmax.cpython-312-pytest-9.1.1.pyc +0 -0
  72. package/python/postprocessors/__pycache__/test_yolo_nms.cpython-312-pytest-9.1.1.pyc +0 -0
  73. package/python/postprocessors/__pycache__/test_yolo_nms.cpython-39.pyc +0 -0
  74. package/python/postprocessors/__pycache__/yamnet.cpython-312.pyc +0 -0
  75. package/python/postprocessors/__pycache__/yamnet.cpython-313.pyc +0 -0
  76. package/python/postprocessors/__pycache__/yamnet.cpython-314.pyc +0 -0
  77. package/python/postprocessors/__pycache__/yolo.cpython-312.pyc +0 -0
  78. package/python/postprocessors/__pycache__/yolo.cpython-313.pyc +0 -0
  79. package/python/postprocessors/__pycache__/yolo.cpython-314.pyc +0 -0
  80. package/python/postprocessors/__pycache__/yolo.cpython-39.pyc +0 -0
  81. package/python/postprocessors/__pycache__/yolo_seg.cpython-312.pyc +0 -0
  82. package/python/postprocessors/__pycache__/yolo_seg.cpython-313.pyc +0 -0
  83. package/python/postprocessors/__pycache__/yolo_seg.cpython-314.pyc +0 -0
  84. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CAmiVOsA.mjs +0 -26
  85. package/embed-dist/assets/MaskShapeCanvas-DI4BY7W2-BWAtF7b-.js +0 -33
  86. package/embed-dist/assets/MotionZonesSettings-NcxxQN8r-ByQWV87C.js +0 -1
  87. package/embed-dist/assets/PrivacyMaskSettings-APgPLF7p-B9uGNcFR.js +0 -1
  88. package/embed-dist/assets/index-C68W664Z.css +0 -2
  89. package/embed-dist/assets/index-Dcfe-5Ig.js +0 -112
  90. package/embed-dist/index.html +0 -13
@@ -3,9 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../chunk-emK7D4bc.js");
6
- const require_dist = require("../dist-D8TX_P_A.js");
6
+ const require_dist = require("../dist-BInMIG0Q.js");
7
7
  const require_remote_restream = require("../remote-restream-CO36Sr30.js");
8
- const require_addon_utils = require("../addon-utils-CQs-AjTJ.js");
9
8
  let node_crypto = require("node:crypto");
10
9
  node_crypto = require_chunk.__toESM(node_crypto, 1);
11
10
  let node_child_process = require("node:child_process");
@@ -27,35 +26,6 @@ let events = require("events");
27
26
  let node_dns_promises = require("node:dns/promises");
28
27
  let node_module = require("node:module");
29
28
  let node_events = require("node:events");
30
- //#region src/stream-broker/embed-file-handler.ts
31
- /** Build a `(req, res)` handler serving the embed bundle at `root` with SPA fallback.
32
- * Web MIME types (`.html`/`.js`/`.css`/…) come from the core handler's defaults. */
33
- /** Cache-Control for the CONTENT-HASHED vite assets (`/assets/index-<hash>.js`):
34
- * a new build changes the filename, so the old bytes can cache forever. The
35
- * entry `index.html` keeps the handler's default `no-cache`. Without this the
36
- * WebView re-downloaded the ~1.5MB bundle on EVERY player open — a real chunk
37
- * of the "live stream takes ~10s to start" cold-start cost (worse on 4G). */
38
- var IMMUTABLE_CACHE = "public, max-age=31536000, immutable";
39
- function createEmbedSpaHandler(root) {
40
- const fileHandler = require_addon_utils.createFileDataPlaneHandler({
41
- getRoots: () => [root],
42
- cacheControl: (rel) => rel.startsWith("assets/") ? IMMUTABLE_CACHE : void 0
43
- });
44
- return (req, res) => {
45
- const [pathPart = "/", query] = (req.url ?? "/").split("?");
46
- const lastSegment = pathPart.split("/").pop() ?? "";
47
- if (pathPart === "/" || pathPart === "" || !lastSegment.includes(".")) req.url = query !== void 0 ? `/index.html?${query}` : "/index.html";
48
- else if (pathPart.startsWith("/assets/")) {
49
- const origWriteHead = res.writeHead.bind(res);
50
- res.writeHead = ((status, headers) => origWriteHead(status, {
51
- ...headers,
52
- "cache-control": IMMUTABLE_CACHE
53
- }));
54
- }
55
- return fileHandler(req, res);
56
- };
57
- }
58
- //#endregion
59
29
  //#region src/stream-broker/client-log-ingest.ts
60
30
  var MAX_BODY_BYTES = 512 * 1024;
61
31
  /** Camera identity carried inside an entry's `data` (the embed stamps it via
@@ -21552,11 +21522,13 @@ var AdaptiveController = class {
21552
21522
  */
21553
21523
  armed = false;
21554
21524
  failures;
21525
+ upgradeCount;
21555
21526
  constructor(opts) {
21556
21527
  this.opts = opts;
21557
21528
  this.tracker = new LossTracker(opts.config);
21558
21529
  this.tier = opts.initialTier;
21559
21530
  this.failures = new Map(opts.priorFailures ?? []);
21531
+ this.upgradeCount = Math.max(0, opts.priorUpgradeCount ?? 0);
21560
21532
  }
21561
21533
  get currentTier() {
21562
21534
  return this.tier;
@@ -21569,6 +21541,9 @@ var AdaptiveController = class {
21569
21541
  get failureCounts() {
21570
21542
  return this.failures;
21571
21543
  }
21544
+ get successfulUpgradeCount() {
21545
+ return this.upgradeCount;
21546
+ }
21572
21547
  onLoss(sample, now) {
21573
21548
  this.tracker.track(sample, now);
21574
21549
  }
@@ -21621,8 +21596,9 @@ var AdaptiveController = class {
21621
21596
  */
21622
21597
  requiredHealthyMs(tier) {
21623
21598
  const failures = this.failures.get(tier) ?? 0;
21624
- if (failures <= 0) return this.opts.config.upgradeHealthyMs;
21625
- return Math.min(this.opts.config.upgradeHealthyMs * 2 ** failures, this.opts.config.maxUpgradeBackoffMs);
21599
+ const progressiveMs = Math.min(this.opts.config.upgradeHealthyMs * this.opts.config.upgradeHealthyGrowthFactor ** this.upgradeCount, this.opts.config.maxProgressiveUpgradeHealthyMs);
21600
+ if (failures <= 0) return progressiveMs;
21601
+ return Math.min(progressiveMs * 2 ** failures, this.opts.config.maxUpgradeBackoffMs);
21626
21602
  }
21627
21603
  commitChange(now) {
21628
21604
  this.lastChangeAt = now;
@@ -21659,6 +21635,7 @@ var AdaptiveController = class {
21659
21635
  this.tier = next;
21660
21636
  this.mtuReduced = false;
21661
21637
  this.transcodeEngaged = false;
21638
+ this.upgradeCount += 1;
21662
21639
  this.opts.onSwitchTier(next);
21663
21640
  this.commitChange(now);
21664
21641
  this.healthySince = now;
@@ -31397,8 +31374,10 @@ var ADAPTIVE_CONFIG = {
31397
31374
  analyzeWindowMs: 15e3,
31398
31375
  minFailPercent: .05,
31399
31376
  waitAfterResetMs: 8e3,
31400
- upgradeHealthyMs: 2e4,
31401
- minTimeBetweenChangesMs: 2e4,
31377
+ upgradeHealthyMs: 4e3,
31378
+ upgradeHealthyGrowthFactor: 3,
31379
+ maxProgressiveUpgradeHealthyMs: 3e4,
31380
+ minTimeBetweenChangesMs: 4e3,
31402
31381
  maxUpgradeBackoffMs: 9e5
31403
31382
  };
31404
31383
  /**
@@ -32466,7 +32445,7 @@ var BrokerWebrtcServer = class {
32466
32445
  };
32467
32446
  if (streamId.endsWith("/adaptive")) {
32468
32447
  const initialTier = this.profileTierResolver?.(brokerId) ?? "high";
32469
- this.startAdaptive(entry, deviceId, initialTier, sessionId, intent?.failures);
32448
+ this.startAdaptive(entry, deviceId, initialTier, sessionId, intent?.failures, intent?.upgradeCount);
32470
32449
  }
32471
32450
  return {
32472
32451
  sessionId,
@@ -32567,10 +32546,11 @@ var BrokerWebrtcServer = class {
32567
32546
  * whichever produces the higher loss ratio across its window. The async
32568
32547
  * poll is guarded against overlapping ticks via `tickInFlight`.
32569
32548
  */
32570
- startAdaptive(entry, deviceId, initialTier, sessionId, priorFailures) {
32549
+ startAdaptive(entry, deviceId, initialTier, sessionId, priorFailures, priorUpgradeCount) {
32571
32550
  const controller = new AdaptiveController({
32572
32551
  initialTier,
32573
32552
  priorFailures,
32553
+ priorUpgradeCount,
32574
32554
  config: ADAPTIVE_CONFIG,
32575
32555
  onSwitchTier: (tier) => {
32576
32556
  this.switchSessionTier(entry, deviceId, tier, sessionId);
@@ -32628,10 +32608,12 @@ var BrokerWebrtcServer = class {
32628
32608
  switchSessionTier(entry, deviceId, tier, sessionId, forceTranscodeDown = false) {
32629
32609
  const prev = this.adaptiveIntent.get(sessionId);
32630
32610
  const failures = new Map(entry.adaptiveController?.failureCounts ?? prev?.failures);
32611
+ const upgradeCount = entry.adaptiveController?.successfulUpgradeCount ?? prev?.upgradeCount ?? 0;
32631
32612
  this.adaptiveIntent.set(sessionId, {
32632
32613
  prefersTier: tier,
32633
32614
  forceTranscodeDown: forceTranscodeDown || (prev?.forceTranscodeDown ?? false),
32634
- failures
32615
+ failures,
32616
+ upgradeCount
32635
32617
  });
32636
32618
  const epoch = (entry.session.pendingRenegotiation?.epoch ?? 0) + 1;
32637
32619
  entry.session.pendingRenegotiation = {
@@ -32646,7 +32628,8 @@ var BrokerWebrtcServer = class {
32646
32628
  tier,
32647
32629
  forceTranscodeDown,
32648
32630
  epoch,
32649
- failures: Object.fromEntries(failures)
32631
+ failures: Object.fromEntries(failures),
32632
+ upgradeCount
32650
32633
  }
32651
32634
  });
32652
32635
  }
@@ -33429,8 +33412,6 @@ var StreamBrokerAddon = class extends require_dist.BaseAddon {
33429
33412
  * leaks those sockets and wedges the next runner's werift ICE agent
33430
33413
  * (DTLS never connects until a full hub restart). */
33431
33414
  webrtcServer = null;
33432
- /** Handle for the embed SPA data-plane listener (disposed on shutdown). */
33433
- embedDataPlane = null;
33434
33415
  /** Names this process's event-loop stalls — see onInitialize. */
33435
33416
  loopStallMonitor = null;
33436
33417
  /**
@@ -33828,17 +33809,6 @@ var StreamBrokerAddon = class extends require_dist.BaseAddon {
33828
33809
  defaultRows: 2
33829
33810
  }] };
33830
33811
  this.ctx.logger.info("Stream broker manager initialized");
33831
- try {
33832
- const handler = createEmbedSpaHandler(node_path.default.resolve(__dirname, "../../embed-dist"));
33833
- this.embedDataPlane = await this.ctx.dataPlane?.serve({
33834
- prefix: "embed",
33835
- access: "public",
33836
- handler
33837
- }) ?? null;
33838
- this.ctx.logger.info("stream-broker: embed served", { meta: { baseUrl: this.embedDataPlane?.baseUrl ?? "(no dataPlane facility)" } });
33839
- } catch (err) {
33840
- this.ctx.logger.warn("stream-broker: embed data-plane failed to serve", { meta: { error: require_dist.errMsg(err) } });
33841
- }
33842
33812
  try {
33843
33813
  const clientLogHandler = createClientLogIngest((entries, source) => {
33844
33814
  for (const e of entries) {
@@ -33898,12 +33868,6 @@ var StreamBrokerAddon = class extends require_dist.BaseAddon {
33898
33868
  clearInterval(this.catalogReconcileTimer);
33899
33869
  this.catalogReconcileTimer = null;
33900
33870
  }
33901
- try {
33902
- await this.embedDataPlane?.dispose();
33903
- } catch (err) {
33904
- this.ctx?.logger?.warn?.("stream-broker: embed data-plane dispose failed", { meta: { error: require_dist.errMsg(err) } });
33905
- }
33906
- this.embedDataPlane = null;
33907
33871
  try {
33908
33872
  await this.webrtcServer?.stop();
33909
33873
  } catch (err) {
@@ -1,7 +1,6 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "../chunk-DnnnRqeS.mjs";
2
- import { $ as webrtcSessionCapability, At as union, B as maskUrlCredentials, C as addonWidgetsSourceCapability, Ct as discriminatedUnion, D as createHwAccelCache, Dt as object, E as cameraStreamsCapability, Et as number, F as egressTransportFromRequest, J as resolveEgressDecodeHwAccel, Ot as record, P as egressTranscodeSharingKey, St as boolean, Tt as literal, Z as streamBrokerCapability, _t as parseProfileBrokerId, at as isSoftwareDecode, bt as _enum, ct as DeviceFeature, et as errMsg, f as EncodeProfileSchema, ft as isEvent, ht as nodePin, it as invocationFromEncodeProfile, jt as EventCategory, kt as string, lt as DeviceType, mt as makeSourceBrokerId, nt as Fmp4BoxSplitter, ot as BaseAddon, pt as makeProfileBrokerId, rt as buildFfmpegArgs$1, st as CAM_PROFILE_ORDER, tt as AUDIO_PRESETS, ut as createEvent, v as RATE_CONTROL_RELAXED, x as RingBuffer, xt as array, y as RATE_CONTROL_TIGHT } from "../dist-B55xTTsS.mjs";
2
+ import { $ as webrtcSessionCapability, At as union, B as maskUrlCredentials, C as addonWidgetsSourceCapability, Ct as discriminatedUnion, D as createHwAccelCache, Dt as object, E as cameraStreamsCapability, Et as number, F as egressTransportFromRequest, J as resolveEgressDecodeHwAccel, Ot as record, P as egressTranscodeSharingKey, St as boolean, Tt as literal, Z as streamBrokerCapability, _t as parseProfileBrokerId, at as isSoftwareDecode, bt as _enum, ct as DeviceFeature, et as errMsg, f as EncodeProfileSchema, ft as isEvent, ht as nodePin, it as invocationFromEncodeProfile, jt as EventCategory, kt as string, lt as DeviceType, mt as makeSourceBrokerId, nt as Fmp4BoxSplitter, ot as BaseAddon, pt as makeProfileBrokerId, rt as buildFfmpegArgs$1, st as CAM_PROFILE_ORDER, tt as AUDIO_PRESETS, ut as createEvent, v as RATE_CONTROL_RELAXED, x as RingBuffer, xt as array, y as RATE_CONTROL_TIGHT } from "../dist-aslBaGaT.mjs";
3
3
  import { n as profileForStreamId } from "../remote-restream-BeHi78PZ.mjs";
4
- import { n as createFileDataPlaneHandler } from "../addon-utils-CZ2xo67g.mjs";
5
4
  import { createRequire } from "node:module";
6
5
  import * as crypto$1 from "node:crypto";
7
6
  import crypto, { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -12,7 +11,7 @@ import { networkInterfaces, tmpdir } from "node:os";
12
11
  import * as fs from "node:fs";
13
12
  import "node:fs";
14
13
  import * as path$1 from "node:path";
15
- import path, { join } from "node:path";
14
+ import { join } from "node:path";
16
15
  import * as net$1 from "node:net";
17
16
  import net from "node:net";
18
17
  import { readFile } from "node:fs/promises";
@@ -21,35 +20,6 @@ import { Socket } from "net";
21
20
  import { once } from "events";
22
21
  import { lookup } from "node:dns/promises";
23
22
  import { EventEmitter } from "node:events";
24
- //#region src/stream-broker/embed-file-handler.ts
25
- /** Build a `(req, res)` handler serving the embed bundle at `root` with SPA fallback.
26
- * Web MIME types (`.html`/`.js`/`.css`/…) come from the core handler's defaults. */
27
- /** Cache-Control for the CONTENT-HASHED vite assets (`/assets/index-<hash>.js`):
28
- * a new build changes the filename, so the old bytes can cache forever. The
29
- * entry `index.html` keeps the handler's default `no-cache`. Without this the
30
- * WebView re-downloaded the ~1.5MB bundle on EVERY player open — a real chunk
31
- * of the "live stream takes ~10s to start" cold-start cost (worse on 4G). */
32
- var IMMUTABLE_CACHE = "public, max-age=31536000, immutable";
33
- function createEmbedSpaHandler(root) {
34
- const fileHandler = createFileDataPlaneHandler({
35
- getRoots: () => [root],
36
- cacheControl: (rel) => rel.startsWith("assets/") ? IMMUTABLE_CACHE : void 0
37
- });
38
- return (req, res) => {
39
- const [pathPart = "/", query] = (req.url ?? "/").split("?");
40
- const lastSegment = pathPart.split("/").pop() ?? "";
41
- if (pathPart === "/" || pathPart === "" || !lastSegment.includes(".")) req.url = query !== void 0 ? `/index.html?${query}` : "/index.html";
42
- else if (pathPart.startsWith("/assets/")) {
43
- const origWriteHead = res.writeHead.bind(res);
44
- res.writeHead = ((status, headers) => origWriteHead(status, {
45
- ...headers,
46
- "cache-control": IMMUTABLE_CACHE
47
- }));
48
- }
49
- return fileHandler(req, res);
50
- };
51
- }
52
- //#endregion
53
23
  //#region src/stream-broker/client-log-ingest.ts
54
24
  var MAX_BODY_BYTES = 512 * 1024;
55
25
  /** Camera identity carried inside an entry's `data` (the embed stamps it via
@@ -21546,11 +21516,13 @@ var AdaptiveController = class {
21546
21516
  */
21547
21517
  armed = false;
21548
21518
  failures;
21519
+ upgradeCount;
21549
21520
  constructor(opts) {
21550
21521
  this.opts = opts;
21551
21522
  this.tracker = new LossTracker(opts.config);
21552
21523
  this.tier = opts.initialTier;
21553
21524
  this.failures = new Map(opts.priorFailures ?? []);
21525
+ this.upgradeCount = Math.max(0, opts.priorUpgradeCount ?? 0);
21554
21526
  }
21555
21527
  get currentTier() {
21556
21528
  return this.tier;
@@ -21563,6 +21535,9 @@ var AdaptiveController = class {
21563
21535
  get failureCounts() {
21564
21536
  return this.failures;
21565
21537
  }
21538
+ get successfulUpgradeCount() {
21539
+ return this.upgradeCount;
21540
+ }
21566
21541
  onLoss(sample, now) {
21567
21542
  this.tracker.track(sample, now);
21568
21543
  }
@@ -21615,8 +21590,9 @@ var AdaptiveController = class {
21615
21590
  */
21616
21591
  requiredHealthyMs(tier) {
21617
21592
  const failures = this.failures.get(tier) ?? 0;
21618
- if (failures <= 0) return this.opts.config.upgradeHealthyMs;
21619
- return Math.min(this.opts.config.upgradeHealthyMs * 2 ** failures, this.opts.config.maxUpgradeBackoffMs);
21593
+ const progressiveMs = Math.min(this.opts.config.upgradeHealthyMs * this.opts.config.upgradeHealthyGrowthFactor ** this.upgradeCount, this.opts.config.maxProgressiveUpgradeHealthyMs);
21594
+ if (failures <= 0) return progressiveMs;
21595
+ return Math.min(progressiveMs * 2 ** failures, this.opts.config.maxUpgradeBackoffMs);
21620
21596
  }
21621
21597
  commitChange(now) {
21622
21598
  this.lastChangeAt = now;
@@ -21653,6 +21629,7 @@ var AdaptiveController = class {
21653
21629
  this.tier = next;
21654
21630
  this.mtuReduced = false;
21655
21631
  this.transcodeEngaged = false;
21632
+ this.upgradeCount += 1;
21656
21633
  this.opts.onSwitchTier(next);
21657
21634
  this.commitChange(now);
21658
21635
  this.healthySince = now;
@@ -31388,8 +31365,10 @@ var ADAPTIVE_CONFIG = {
31388
31365
  analyzeWindowMs: 15e3,
31389
31366
  minFailPercent: .05,
31390
31367
  waitAfterResetMs: 8e3,
31391
- upgradeHealthyMs: 2e4,
31392
- minTimeBetweenChangesMs: 2e4,
31368
+ upgradeHealthyMs: 4e3,
31369
+ upgradeHealthyGrowthFactor: 3,
31370
+ maxProgressiveUpgradeHealthyMs: 3e4,
31371
+ minTimeBetweenChangesMs: 4e3,
31393
31372
  maxUpgradeBackoffMs: 9e5
31394
31373
  };
31395
31374
  /**
@@ -32457,7 +32436,7 @@ var BrokerWebrtcServer = class {
32457
32436
  };
32458
32437
  if (streamId.endsWith("/adaptive")) {
32459
32438
  const initialTier = this.profileTierResolver?.(brokerId) ?? "high";
32460
- this.startAdaptive(entry, deviceId, initialTier, sessionId, intent?.failures);
32439
+ this.startAdaptive(entry, deviceId, initialTier, sessionId, intent?.failures, intent?.upgradeCount);
32461
32440
  }
32462
32441
  return {
32463
32442
  sessionId,
@@ -32558,10 +32537,11 @@ var BrokerWebrtcServer = class {
32558
32537
  * whichever produces the higher loss ratio across its window. The async
32559
32538
  * poll is guarded against overlapping ticks via `tickInFlight`.
32560
32539
  */
32561
- startAdaptive(entry, deviceId, initialTier, sessionId, priorFailures) {
32540
+ startAdaptive(entry, deviceId, initialTier, sessionId, priorFailures, priorUpgradeCount) {
32562
32541
  const controller = new AdaptiveController({
32563
32542
  initialTier,
32564
32543
  priorFailures,
32544
+ priorUpgradeCount,
32565
32545
  config: ADAPTIVE_CONFIG,
32566
32546
  onSwitchTier: (tier) => {
32567
32547
  this.switchSessionTier(entry, deviceId, tier, sessionId);
@@ -32619,10 +32599,12 @@ var BrokerWebrtcServer = class {
32619
32599
  switchSessionTier(entry, deviceId, tier, sessionId, forceTranscodeDown = false) {
32620
32600
  const prev = this.adaptiveIntent.get(sessionId);
32621
32601
  const failures = new Map(entry.adaptiveController?.failureCounts ?? prev?.failures);
32602
+ const upgradeCount = entry.adaptiveController?.successfulUpgradeCount ?? prev?.upgradeCount ?? 0;
32622
32603
  this.adaptiveIntent.set(sessionId, {
32623
32604
  prefersTier: tier,
32624
32605
  forceTranscodeDown: forceTranscodeDown || (prev?.forceTranscodeDown ?? false),
32625
- failures
32606
+ failures,
32607
+ upgradeCount
32626
32608
  });
32627
32609
  const epoch = (entry.session.pendingRenegotiation?.epoch ?? 0) + 1;
32628
32610
  entry.session.pendingRenegotiation = {
@@ -32637,7 +32619,8 @@ var BrokerWebrtcServer = class {
32637
32619
  tier,
32638
32620
  forceTranscodeDown,
32639
32621
  epoch,
32640
- failures: Object.fromEntries(failures)
32622
+ failures: Object.fromEntries(failures),
32623
+ upgradeCount
32641
32624
  }
32642
32625
  });
32643
32626
  }
@@ -33420,8 +33403,6 @@ var StreamBrokerAddon = class extends BaseAddon {
33420
33403
  * leaks those sockets and wedges the next runner's werift ICE agent
33421
33404
  * (DTLS never connects until a full hub restart). */
33422
33405
  webrtcServer = null;
33423
- /** Handle for the embed SPA data-plane listener (disposed on shutdown). */
33424
- embedDataPlane = null;
33425
33406
  /** Names this process's event-loop stalls — see onInitialize. */
33426
33407
  loopStallMonitor = null;
33427
33408
  /**
@@ -33819,17 +33800,6 @@ var StreamBrokerAddon = class extends BaseAddon {
33819
33800
  defaultRows: 2
33820
33801
  }] };
33821
33802
  this.ctx.logger.info("Stream broker manager initialized");
33822
- try {
33823
- const handler = createEmbedSpaHandler(path.resolve(__dirname, "../../embed-dist"));
33824
- this.embedDataPlane = await this.ctx.dataPlane?.serve({
33825
- prefix: "embed",
33826
- access: "public",
33827
- handler
33828
- }) ?? null;
33829
- this.ctx.logger.info("stream-broker: embed served", { meta: { baseUrl: this.embedDataPlane?.baseUrl ?? "(no dataPlane facility)" } });
33830
- } catch (err) {
33831
- this.ctx.logger.warn("stream-broker: embed data-plane failed to serve", { meta: { error: errMsg(err) } });
33832
- }
33833
33803
  try {
33834
33804
  const clientLogHandler = createClientLogIngest((entries, source) => {
33835
33805
  for (const e of entries) {
@@ -33889,12 +33859,6 @@ var StreamBrokerAddon = class extends BaseAddon {
33889
33859
  clearInterval(this.catalogReconcileTimer);
33890
33860
  this.catalogReconcileTimer = null;
33891
33861
  }
33892
- try {
33893
- await this.embedDataPlane?.dispose();
33894
- } catch (err) {
33895
- this.ctx?.logger?.warn?.("stream-broker: embed data-plane dispose failed", { meta: { error: errMsg(err) } });
33896
- }
33897
- this.embedDataPlane = null;
33898
33862
  try {
33899
33863
  await this.webrtcServer?.stop();
33900
33864
  } catch (err) {
@@ -30,7 +30,7 @@ async function d(e) {
30
30
  }
31
31
  }
32
32
  async function f() {
33
- return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C-9q6y1s.mjs")).catch((e) => {
33
+ return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-BqfT64lY.mjs")).catch((e) => {
34
34
  throw l = void 0, e;
35
35
  }), l;
36
36
  }
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-D8TX_P_A.js");
1
+ const require_dist = require("./dist-BInMIG0Q.js");
2
2
  //#region src/session-decode/native-lease-config.ts
3
3
  /**
4
4
  * Resolution of the native-frame lease knobs for one decode worker.
@@ -1,4 +1,4 @@
1
- import { g as NativeLeaseSettingsSchema, h as NativeLeaseAdmissionSchema, l as DEFAULT_NATIVE_LEASE_SETTINGS } from "./dist-B55xTTsS.mjs";
1
+ import { g as NativeLeaseSettingsSchema, h as NativeLeaseAdmissionSchema, l as DEFAULT_NATIVE_LEASE_SETTINGS } from "./dist-aslBaGaT.mjs";
2
2
  //#region src/session-decode/native-lease-config.ts
3
3
  /**
4
4
  * Resolution of the native-frame lease knobs for one decode worker.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-pipeline",
3
- "version": "1.2.59",
3
+ "version": "1.2.61",
4
4
  "description": "Pipeline bundle — runner, detection, motion, audio + stream broker. Multi-entry npm package shipping pipeline addons under a single bundle.",
5
5
  "keywords": [
6
6
  "camstack",
@@ -47,7 +47,6 @@
47
47
  },
48
48
  "files": [
49
49
  "dist",
50
- "embed-dist",
51
50
  "python",
52
51
  "swift",
53
52
  "wasm",
@@ -239,13 +238,11 @@
239
238
  ]
240
239
  },
241
240
  "scripts": {
242
- "build": "vite build && vite build --config vite.widgets.stream-broker.config.ts && npm run build:embed",
241
+ "build": "vite build && vite build --config vite.widgets.stream-broker.config.ts",
243
242
  "build:server": "vite build",
244
243
  "build:widgets": "vite build --config vite.widgets.stream-broker.config.ts",
245
- "build:embed": "vite build -c embed/vite.config.ts",
246
244
  "dev": "vite build --watch",
247
245
  "typecheck": "tsc --noEmit",
248
- "typecheck:embed": "tsc --noEmit -p embed/tsconfig.json",
249
246
  "test": "vitest run",
250
247
  "test:embed": "vitest run -c embed/vitest.config.ts",
251
248
  "publish": "npm publish --access public"