wyren-mcp 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.2
4
+
5
+ - **Fixed** Caption renders failed on hosts that can't reach the media CDN directly — broken-IPv6 networks (WSL2, and some end-user machines), where the bundled ffmpeg core-dumps and Chromium `net::ERR_FAIL`s fetching the CDN even though Node's `fetch` reaches it fine. The worker now prefetches the source video — and any remote audio track — via Node `fetch` and serves them (with the trimmed segments) over one loopback HTTP server, so ffmpeg and Chromium/OffthreadVideo only read from `127.0.0.1`. The render then completes on any network. Rebuilt from monorepo main `df78a6b`. Verified end-to-end on a broken-IPv6 box (14 s chunked ~32 s; 8 s single-pass with muxed audio ~24 s).
6
+
7
+ ## 1.2.1
8
+
9
+ - **Fixed** The daemon survives WebSocket drops (e.g. every backend redeploy) without losing in-flight work: it no longer aborts running jobs when the socket closes. Render, presigned upload, and completion run over the HTTP lifecycle independent of the socket, so jobs finish and report while the socket reconnects in the background. Only a real shutdown aborts in-flight work.
10
+
3
11
  ## 1.2.0
4
12
 
5
13
  - **Fixed** Caption (and slideshow) renders failed in the daemon: the vendored `remotion-bundle` was missing `bundle.js.map`, which Remotion's `prepareServer` reads — `sync-worker.mjs` was stripping ALL `.map` files. It now keeps the Remotion bundle maps (still drops the worker's debug map).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyren-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Install the Wyren MCP server, agent skills, and auto-starting local render worker for Claude Code",
5
5
  "bin": {
6
6
  "wyren-mcp": "setup.mjs"
@@ -14,7 +14,7 @@
14
14
  //
15
15
  // Provenance of the artifacts currently vendored in this package:
16
16
  // monorepo branch: main
17
- // monorepo commit: 0600ac2
17
+ // monorepo commit: df78a6b
18
18
  // tsup config: backend/tsup.worker.config.ts
19
19
  // externals (must stay in this package's dependencies, in sync with that
20
20
  // config's EXTERNAL_RUNTIME_DEPS):
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module';
2
2
  import url, { fileURLToPath, URLSearchParams, URL as URL$1 } from 'url';
3
- import * as path8 from 'path';
4
- import path8__default, { dirname, join, extname } from 'path';
3
+ import * as path28 from 'path';
4
+ import path28__default, { dirname, join, extname } from 'path';
5
5
  import * as fs7 from 'fs';
6
6
  import fs7__default, { createWriteStream, chmodSync, accessSync, constants, statSync, existsSync, cpSync, promises, rmSync, readFileSync, mkdirSync, createReadStream, writeSync } from 'fs';
7
7
  import * as os3 from 'os';
@@ -14543,7 +14543,7 @@ var __export = (target, all) => {
14543
14543
  };
14544
14544
  var __require2 = /* @__PURE__ */ createRequire(import.meta.url);
14545
14545
  var ensureOutputDirectory = (outputLocation) => {
14546
- const dirName = path8__default.dirname(outputLocation);
14546
+ const dirName = path28__default.dirname(outputLocation);
14547
14547
  if (!fs7__default.existsSync(dirName)) {
14548
14548
  fs7__default.mkdirSync(dirName, {
14549
14549
  recursive: true
@@ -14697,12 +14697,12 @@ var findClosestPackageJson = () => {
14697
14697
  let currentDir = process.cwd();
14698
14698
  let possiblePackageJson = "";
14699
14699
  for (let i = 0; i < recursionLimit; i++) {
14700
- possiblePackageJson = path8__default.join(currentDir, "package.json");
14700
+ possiblePackageJson = path28__default.join(currentDir, "package.json");
14701
14701
  const exists = fs7__default.existsSync(possiblePackageJson);
14702
14702
  if (exists) {
14703
14703
  return possiblePackageJson;
14704
14704
  }
14705
- currentDir = path8__default.dirname(currentDir);
14705
+ currentDir = path28__default.dirname(currentDir);
14706
14706
  }
14707
14707
  return null;
14708
14708
  };
@@ -14711,7 +14711,7 @@ var findRemotionRoot = () => {
14711
14711
  if (closestPackageJson === null) {
14712
14712
  return process.cwd();
14713
14713
  }
14714
- return path8__default.dirname(closestPackageJson);
14714
+ return path28__default.dirname(closestPackageJson);
14715
14715
  };
14716
14716
  var isServeUrl = (potentialUrl) => {
14717
14717
  if (typeof potentialUrl === "undefined") {
@@ -14737,7 +14737,7 @@ var readyDirSync = (dir) => {
14737
14737
  return fs7__default.mkdirSync(dir, { recursive: true });
14738
14738
  }
14739
14739
  items.forEach((item) => {
14740
- item = path8__default.join(dir, item);
14740
+ item = path28__default.join(dir, item);
14741
14741
  fs7__default.rmSync(item, { recursive: true, force: true });
14742
14742
  });
14743
14743
  };
@@ -14764,9 +14764,9 @@ var zipFolder = ({
14764
14764
  };
14765
14765
  var reproWriter = (name) => {
14766
14766
  const root = findRemotionRoot();
14767
- const reproFolder = path8__default.join(root, REPRO_DIR);
14768
- const logPath = path8__default.join(reproFolder, LOG_FILE_NAME);
14769
- const zipFile = path8__default.join(root, getZipFileName(name));
14767
+ const reproFolder = path28__default.join(root, REPRO_DIR);
14768
+ const logPath = path28__default.join(reproFolder, LOG_FILE_NAME);
14769
+ const zipFile = path28__default.join(root, getZipFileName(name));
14770
14770
  readyDirSync(reproFolder);
14771
14771
  const reproLogWriteStream = fs7__default.createWriteStream(logPath, { flags: "a" });
14772
14772
  const serializeArgs = (args) => JSON.stringify(args);
@@ -14784,13 +14784,13 @@ var reproWriter = (name) => {
14784
14784
  }) => {
14785
14785
  const isServe = isServeUrl(serveUrl);
14786
14786
  if (!isServe) {
14787
- const inputDir = path8__default.resolve(reproFolder, INPUT_DIR);
14787
+ const inputDir = path28__default.resolve(reproFolder, INPUT_DIR);
14788
14788
  readyDirSync(inputDir);
14789
14789
  fs7__default.cpSync(serveUrl, inputDir, { recursive: true });
14790
14790
  }
14791
- const serializedProps = path8__default.resolve(reproFolder, "input-props.json");
14791
+ const serializedProps = path28__default.resolve(reproFolder, "input-props.json");
14792
14792
  fs7__default.writeFileSync(serializedProps, serializedInputPropsWithCustomSchema);
14793
- const serializedResolvedProps = path8__default.resolve(reproFolder, "resolved-props.json");
14793
+ const serializedResolvedProps = path28__default.resolve(reproFolder, "resolved-props.json");
14794
14794
  fs7__default.writeFileSync(serializedResolvedProps, serializedResolvedPropsWithCustomSchema);
14795
14795
  writeLine("info", [`Args: ${JSON.stringify(process.argv)}`]);
14796
14796
  writeLine("info", [`Node/Bun version: ${process.version}`]);
@@ -14806,10 +14806,10 @@ var reproWriter = (name) => {
14806
14806
  return new Promise((resolve3, reject) => {
14807
14807
  try {
14808
14808
  if (output) {
14809
- const outputDir = path8__default.resolve(reproFolder, OUTPUT_DIR);
14809
+ const outputDir = path28__default.resolve(reproFolder, OUTPUT_DIR);
14810
14810
  readyDirSync(outputDir);
14811
- const fileName = path8__default.basename(output);
14812
- const targetPath = path8__default.join(outputDir, fileName);
14811
+ const fileName = path28__default.basename(output);
14812
+ const targetPath = path28__default.join(outputDir, fileName);
14813
14813
  fs7__default.copyFileSync(output, targetPath);
14814
14814
  }
14815
14815
  disableRepro();
@@ -18284,19 +18284,19 @@ var getExecutablePath = ({
18284
18284
  switch (type) {
18285
18285
  case "compositor":
18286
18286
  if (process.platform === "win32") {
18287
- return path8__default.resolve(base, "remotion.exe");
18287
+ return path28__default.resolve(base, "remotion.exe");
18288
18288
  }
18289
- return path8__default.resolve(base, "remotion");
18289
+ return path28__default.resolve(base, "remotion");
18290
18290
  case "ffmpeg":
18291
18291
  if (process.platform === "win32") {
18292
- return path8__default.join(base, "ffmpeg.exe");
18292
+ return path28__default.join(base, "ffmpeg.exe");
18293
18293
  }
18294
- return path8__default.join(base, "ffmpeg");
18294
+ return path28__default.join(base, "ffmpeg");
18295
18295
  case "ffprobe":
18296
18296
  if (process.platform === "win32") {
18297
- return path8__default.join(base, "ffprobe.exe");
18297
+ return path28__default.join(base, "ffprobe.exe");
18298
18298
  }
18299
- return path8__default.join(base, "ffprobe");
18299
+ return path28__default.join(base, "ffprobe");
18300
18300
  default:
18301
18301
  throw new Error(`Unknown executable type: ${type}`);
18302
18302
  }
@@ -18394,7 +18394,7 @@ var callFf = ({
18394
18394
  binariesDirectory
18395
18395
  });
18396
18396
  makeFileExecutableIfItIsNot(executablePath);
18397
- const cwd = path8__default.dirname(executablePath);
18397
+ const cwd = path28__default.dirname(executablePath);
18398
18398
  const task = (0, import_execa2.default)(executablePath, args.filter(truthy2), {
18399
18399
  cwd,
18400
18400
  env: getExplicitEnv(cwd),
@@ -18421,7 +18421,7 @@ var callFfNative = ({
18421
18421
  binariesDirectory
18422
18422
  });
18423
18423
  makeFileExecutableIfItIsNot(executablePath);
18424
- const cwd = path8__default.dirname(executablePath);
18424
+ const cwd = path28__default.dirname(executablePath);
18425
18425
  const task = spawn(executablePath, args.filter(truthy2), {
18426
18426
  cwd,
18427
18427
  env: getExplicitEnv(cwd),
@@ -18574,7 +18574,7 @@ var getSourceMap = (filePath, fileContents, type) => {
18574
18574
  }
18575
18575
  }
18576
18576
  {
18577
- const newFilePath = path8__default.join(path8__default.dirname(filePath), sm);
18577
+ const newFilePath = path28__default.join(path28__default.dirname(filePath), sm);
18578
18578
  return Promise.resolve(new import_source_map.SourceMapConsumer(readFileSync(newFilePath, "utf8")));
18579
18579
  }
18580
18580
  };
@@ -19026,12 +19026,12 @@ var getDownloadsCacheDir = () => {
19026
19026
  let dir = cwd;
19027
19027
  for (; ; ) {
19028
19028
  try {
19029
- if (fs7__default.statSync(path8__default.join(dir, "package.json")).isFile()) {
19029
+ if (fs7__default.statSync(path28__default.join(dir, "package.json")).isFile()) {
19030
19030
  break;
19031
19031
  }
19032
19032
  } catch (e) {
19033
19033
  }
19034
- const parent = path8__default.dirname(dir);
19034
+ const parent = path28__default.dirname(dir);
19035
19035
  if (dir === parent) {
19036
19036
  dir = void 0;
19037
19037
  break;
@@ -19039,15 +19039,15 @@ var getDownloadsCacheDir = () => {
19039
19039
  dir = parent;
19040
19040
  }
19041
19041
  if (!dir) {
19042
- return path8__default.resolve(cwd, ".remotion");
19042
+ return path28__default.resolve(cwd, ".remotion");
19043
19043
  }
19044
19044
  if (process.versions.pnp === "1") {
19045
- return path8__default.resolve(dir, ".pnp/.remotion");
19045
+ return path28__default.resolve(dir, ".pnp/.remotion");
19046
19046
  }
19047
19047
  if (process.versions.pnp === "3") {
19048
- return path8__default.resolve(dir, ".yarn/.remotion");
19048
+ return path28__default.resolve(dir, ".yarn/.remotion");
19049
19049
  }
19050
- return path8__default.resolve(dir, "node_modules/.remotion");
19050
+ return path28__default.resolve(dir, "node_modules/.remotion");
19051
19051
  };
19052
19052
  var mkdirAsync = fs7.promises.mkdir;
19053
19053
  var unlinkAsync = promisify(fs7.unlink.bind(fs7));
@@ -19073,11 +19073,11 @@ var getPlatform = () => {
19073
19073
  };
19074
19074
  var getDownloadsFolder = (chromeMode) => {
19075
19075
  const destination = chromeMode === "headless-shell" ? "chrome-headless-shell" : "chrome-for-testing";
19076
- return path8.join(getDownloadsCacheDir(), destination);
19076
+ return path28.join(getDownloadsCacheDir(), destination);
19077
19077
  };
19078
19078
  var getVersionFilePath = (chromeMode) => {
19079
19079
  const downloadsFolder = getDownloadsFolder(chromeMode);
19080
- return path8.join(downloadsFolder, "VERSION");
19080
+ return path28.join(downloadsFolder, "VERSION");
19081
19081
  };
19082
19082
  var getExpectedVersion = (version, _chromeMode) => {
19083
19083
  if (version) {
@@ -19111,7 +19111,7 @@ var downloadBrowser = async ({
19111
19111
  throw new Error(`A malformed download URL was found: ${downloadURL}.`);
19112
19112
  }
19113
19113
  const downloadsFolder = getDownloadsFolder(chromeMode);
19114
- const archivePath = path8.join(downloadsFolder, fileName);
19114
+ const archivePath = path28.join(downloadsFolder, fileName);
19115
19115
  const outputPath = getFolderPath(downloadsFolder, platform3);
19116
19116
  const expectedVersion = getExpectedVersion(version);
19117
19117
  if (await existsAsync(outputPath)) {
@@ -19160,14 +19160,14 @@ var downloadBrowser = async ({
19160
19160
  "chromium-headless-shell-amazon-linux2023-x64"
19161
19161
  ];
19162
19162
  for (const subdir of possibleSubdirs) {
19163
- const chromeLinuxFolder = path8.join(outputPath, subdir);
19164
- const chromePath = path8.join(chromeLinuxFolder, "chrome");
19163
+ const chromeLinuxFolder = path28.join(outputPath, subdir);
19164
+ const chromePath = path28.join(chromeLinuxFolder, "chrome");
19165
19165
  if (fs7.existsSync(chromePath)) {
19166
- const chromeHeadlessShellPath = path8.join(chromeLinuxFolder, "chrome-headless-shell");
19166
+ const chromeHeadlessShellPath = path28.join(chromeLinuxFolder, "chrome-headless-shell");
19167
19167
  fs7.renameSync(chromePath, chromeHeadlessShellPath);
19168
19168
  }
19169
19169
  if (fs7.existsSync(chromeLinuxFolder)) {
19170
- const targetFolder = path8.join(outputPath, "chrome-headless-shell-" + platform3);
19170
+ const targetFolder = path28.join(outputPath, "chrome-headless-shell-" + platform3);
19171
19171
  if (chromeLinuxFolder !== targetFolder) {
19172
19172
  fs7.renameSync(chromeLinuxFolder, targetFolder);
19173
19173
  }
@@ -19186,7 +19186,7 @@ var downloadBrowser = async ({
19186
19186
  return revisionInfo;
19187
19187
  };
19188
19188
  var getFolderPath = (downloadsFolder, platform3) => {
19189
- return path8.resolve(downloadsFolder, platform3);
19189
+ return path28.resolve(downloadsFolder, platform3);
19190
19190
  };
19191
19191
  var getExecutablePath2 = (chromeMode) => {
19192
19192
  const downloadsFolder = getDownloadsFolder(chromeMode);
@@ -19194,18 +19194,18 @@ var getExecutablePath2 = (chromeMode) => {
19194
19194
  const folderPath = getFolderPath(downloadsFolder, platform3);
19195
19195
  if (chromeMode === "chrome-for-testing") {
19196
19196
  if (platform3 === "mac-arm64" || platform3 === "mac-x64") {
19197
- return path8.join(folderPath, `chrome-${platform3}`, "Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing");
19197
+ return path28.join(folderPath, `chrome-${platform3}`, "Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing");
19198
19198
  }
19199
19199
  if (platform3 === "win64") {
19200
- return path8.join(folderPath, "chrome-win64", "chrome.exe");
19200
+ return path28.join(folderPath, "chrome-win64", "chrome.exe");
19201
19201
  }
19202
19202
  if (platform3 === "linux64" || platform3 === "linux-arm64") {
19203
- return path8.join(folderPath, "chrome-linux64", "chrome");
19203
+ return path28.join(folderPath, "chrome-linux64", "chrome");
19204
19204
  }
19205
19205
  throw new Error("unsupported platform" + platform3);
19206
19206
  }
19207
19207
  if (chromeMode === "headless-shell") {
19208
- return path8.join(folderPath, `chrome-headless-shell-${platform3}`, platform3 === "win64" ? "chrome-headless-shell.exe" : platform3 === "linux-arm64" || isAmazonLinux2023() ? "headless_shell" : "chrome-headless-shell");
19208
+ return path28.join(folderPath, `chrome-headless-shell-${platform3}`, platform3 === "win64" ? "chrome-headless-shell.exe" : platform3 === "linux-arm64" || isAmazonLinux2023() ? "headless_shell" : "chrome-headless-shell");
19209
19209
  }
19210
19210
  throw new Error("unsupported chrome mode" + chromeMode);
19211
19211
  };
@@ -19559,7 +19559,7 @@ var internalOpenBrowser = async ({
19559
19559
  if (chromiumOptions.userAgent) {
19560
19560
  Log.verbose({ indent, logLevel, tag: "openBrowser()" }, `Using custom user agent: ${chromiumOptions.userAgent}`);
19561
19561
  }
19562
- const userDataDir = await fs7__default.promises.mkdtemp(path8__default.join(os3__default.tmpdir(), "puppeteer_dev_chrome_profile-"));
19562
+ const userDataDir = await fs7__default.promises.mkdtemp(path28__default.join(os3__default.tmpdir(), "puppeteer_dev_chrome_profile-"));
19563
19563
  const browserInstance = await launchChrome({
19564
19564
  executablePath,
19565
19565
  logLevel,
@@ -28610,7 +28610,7 @@ var sanitizeFilename = (input) => {
28610
28610
  };
28611
28611
  var pathSeparators = /[/\\]/;
28612
28612
  var sanitizeFilePath = (pathToSanitize) => {
28613
- return pathToSanitize.split(pathSeparators).map((s) => sanitizeFilename(s)).join(path8__default.sep);
28613
+ return pathToSanitize.split(pathSeparators).map((s) => sanitizeFilename(s)).join(path28__default.sep);
28614
28614
  };
28615
28615
  var waitForAssetToBeDownloaded = ({
28616
28616
  src,
@@ -28840,7 +28840,7 @@ var getSanitizedFilenameForAssetUrl = ({
28840
28840
  const fileExtension = split.length > 1 && split[split.length - 1] ? `.${split[split.length - 1]}` : "";
28841
28841
  const hashedFileName = String(random(`${src}${pathname}${search}`)).replace("0.", "");
28842
28842
  const filename = hashedFileName + fileExtension;
28843
- return path8__default.join(downloadDir, sanitizeFilePath(filename));
28843
+ return path28__default.join(downloadDir, sanitizeFilePath(filename));
28844
28844
  };
28845
28845
  var downloadAndMapAssetsToFileUrl = async ({
28846
28846
  renderAsset,
@@ -28933,7 +28933,7 @@ var startCompositor = ({
28933
28933
  });
28934
28934
  makeFileExecutableIfItIsNot(bin);
28935
28935
  const fullCommand = serializeCommand(type, payload);
28936
- const cwd = path8__default.dirname(bin);
28936
+ const cwd = path28__default.dirname(bin);
28937
28937
  const child = spawn(bin, [JSON.stringify(fullCommand)], {
28938
28938
  cwd,
28939
28939
  env: process.platform === "darwin" ? {
@@ -29294,7 +29294,7 @@ var randomHash = () => {
29294
29294
  }).join("");
29295
29295
  };
29296
29296
  var tmpDir = (str) => {
29297
- const newDir = path8__default.join(os3__default.tmpdir(), str + randomHash());
29297
+ const newDir = path28__default.join(os3__default.tmpdir(), str + randomHash());
29298
29298
  if (fs7__default.existsSync(newDir)) {
29299
29299
  fs7__default.rmSync(newDir, {
29300
29300
  recursive: true,
@@ -29379,7 +29379,7 @@ var makeInlineAudioMixing = (dir) => {
29379
29379
  return Object.keys(openFiles);
29380
29380
  };
29381
29381
  const getFilePath = (asset) => {
29382
- return path8__default.join(folderToAdd, `${asset.id}.wav`);
29382
+ return path28__default.join(folderToAdd, `${asset.id}.wav`);
29383
29383
  };
29384
29384
  const ensureAsset = ({
29385
29385
  asset,
@@ -29480,7 +29480,7 @@ var makeInlineAudioMixing = (dir) => {
29480
29480
  };
29481
29481
  };
29482
29482
  var makeAndReturn = (dir, name) => {
29483
- const p = path8__default.join(dir, name);
29483
+ const p = path28__default.join(dir, name);
29484
29484
  mkdirSync(p);
29485
29485
  return p;
29486
29486
  };
@@ -29536,7 +29536,7 @@ var map = (webpackBundleOrServeUrl, suffix) => {
29536
29536
  }
29537
29537
  return parsed.origin + parsed.pathname.substring(0, idx + 1) + suffix;
29538
29538
  }
29539
- const index = webpackBundleOrServeUrl.lastIndexOf(path8__default.sep);
29539
+ const index = webpackBundleOrServeUrl.lastIndexOf(path28__default.sep);
29540
29540
  const url2 = webpackBundleOrServeUrl.substring(0, index + 1) + suffix;
29541
29541
  return url2;
29542
29542
  };
@@ -29778,10 +29778,10 @@ var isPathInside = function(thePath, potentialParent) {
29778
29778
  thePath = thePath.toLowerCase();
29779
29779
  potentialParent = potentialParent.toLowerCase();
29780
29780
  }
29781
- return thePath.lastIndexOf(potentialParent, 0) === 0 && (thePath[potentialParent.length] === path8__default.sep || thePath[potentialParent.length] === void 0);
29781
+ return thePath.lastIndexOf(potentialParent, 0) === 0 && (thePath[potentialParent.length] === path28__default.sep || thePath[potentialParent.length] === void 0);
29782
29782
  };
29783
29783
  function stripTrailingSep(thePath) {
29784
- if (thePath[thePath.length - 1] === path8__default.sep) {
29784
+ if (thePath[thePath.length - 1] === path28__default.sep) {
29785
29785
  return thePath.slice(0, -1);
29786
29786
  }
29787
29787
  return thePath;
@@ -29824,7 +29824,7 @@ var rangeParser = (size, str) => {
29824
29824
  return { ranges, type };
29825
29825
  };
29826
29826
  var getHeaders = (absolutePath, stats) => {
29827
- const { base } = path8__default.parse(absolutePath);
29827
+ const { base } = path28__default.parse(absolutePath);
29828
29828
  let defaultHeaders = {};
29829
29829
  if (stats) {
29830
29830
  defaultHeaders = {
@@ -29840,15 +29840,15 @@ var getHeaders = (absolutePath, stats) => {
29840
29840
  return defaultHeaders;
29841
29841
  };
29842
29842
  var getPossiblePaths = (relativePath, extension2) => [
29843
- path8__default.join(relativePath, `index${extension2}`),
29843
+ path28__default.join(relativePath, `index${extension2}`),
29844
29844
  relativePath.endsWith("/") ? relativePath.replace(/\/$/g, extension2) : relativePath + extension2
29845
- ].filter((item) => path8__default.basename(item) !== extension2);
29845
+ ].filter((item) => path28__default.basename(item) !== extension2);
29846
29846
  var findRelated = async (current, relativePath) => {
29847
29847
  const possible = getPossiblePaths(relativePath, ".html");
29848
29848
  let stats = null;
29849
29849
  for (let index = 0; index < possible.length; index++) {
29850
29850
  const related = possible[index];
29851
- const absolutePath = path8__default.join(current, related);
29851
+ const absolutePath = path28__default.join(current, related);
29852
29852
  try {
29853
29853
  stats = await promises.lstat(absolutePath);
29854
29854
  } catch (err) {
@@ -29882,7 +29882,7 @@ var internalError = (absolutePath, response) => {
29882
29882
  };
29883
29883
  var serveHandler = async (request, response, config) => {
29884
29884
  const cwd = process.cwd();
29885
- const current = path8__default.resolve(cwd, config.public);
29885
+ const current = path28__default.resolve(cwd, config.public);
29886
29886
  let relativePath = null;
29887
29887
  try {
29888
29888
  const parsedUrl = new URL(request.url, `http://${request.headers.host}`);
@@ -29893,7 +29893,7 @@ var serveHandler = async (request, response, config) => {
29893
29893
  message: "Bad Request"
29894
29894
  });
29895
29895
  }
29896
- let absolutePath = path8__default.join(current, relativePath);
29896
+ let absolutePath = path28__default.join(current, relativePath);
29897
29897
  if (!isPathInside(absolutePath, current)) {
29898
29898
  return sendError(absolutePath, response, {
29899
29899
  statusCode: 400,
@@ -29901,7 +29901,7 @@ var serveHandler = async (request, response, config) => {
29901
29901
  });
29902
29902
  }
29903
29903
  let stats = null;
29904
- if (path8__default.extname(relativePath) !== "") {
29904
+ if (path28__default.extname(relativePath) !== "") {
29905
29905
  try {
29906
29906
  stats = await promises.lstat(absolutePath);
29907
29907
  } catch (err) {
@@ -30142,13 +30142,13 @@ var prepareServer = async ({
30142
30142
  downloadMap
30143
30143
  });
30144
30144
  }
30145
- const indexFile = path8__default.join(webpackConfigOrServeUrl, "index.html");
30145
+ const indexFile = path28__default.join(webpackConfigOrServeUrl, "index.html");
30146
30146
  const exists = existsSync(indexFile);
30147
30147
  if (!exists) {
30148
30148
  throw new Error(`Tried to serve the Webpack bundle on a HTTP server, but the file ${indexFile} does not exist. Is this a valid path to a Webpack bundle?`);
30149
30149
  }
30150
30150
  let localSourceMap = null;
30151
- getSourceMapFromLocalFile(path8__default.join(webpackConfigOrServeUrl, NoReactInternals.bundleName)).then((s) => {
30151
+ getSourceMapFromLocalFile(path28__default.join(webpackConfigOrServeUrl, NoReactInternals.bundleName)).then((s) => {
30152
30152
  localSourceMap = s;
30153
30153
  }).catch((err) => {
30154
30154
  Log.verbose({ indent, logLevel }, "Could not fetch sourcemap for ", webpackConfigOrServeUrl, err);
@@ -31944,7 +31944,7 @@ var renderFrameWithOptionToReject = async ({
31944
31944
  freePage: page,
31945
31945
  height,
31946
31946
  imageFormat: assetsOnly ? "none" : imageFormat,
31947
- output: index === null ? null : path8__default.join(frameDir, getFrameOutputFileName({
31947
+ output: index === null ? null : path28__default.join(frameDir, getFrameOutputFileName({
31948
31948
  frame,
31949
31949
  imageFormat,
31950
31950
  index,
@@ -32550,7 +32550,7 @@ var innerRenderFrames = async ({
32550
32550
  assets: assets.sort((a, b) => {
32551
32551
  return a.frame - b.frame;
32552
32552
  }),
32553
- imageSequenceName: path8__default.join(frameDir, imageSequenceName),
32553
+ imageSequenceName: path28__default.join(frameDir, imageSequenceName),
32554
32554
  firstFrameIndex,
32555
32555
  downloadMap,
32556
32556
  trimLeftOffset,
@@ -33551,7 +33551,7 @@ var makeFfmpegFilterFile = (complexFilter, downloadMap) => {
33551
33551
  };
33552
33552
  var makeFfmpegFilterFileStr = async (complexFilter, downloadMap) => {
33553
33553
  const random2 = Math.random().toString().replace(".", "");
33554
- const filterFile = path8__default.join(downloadMap.complexFilter, "complex-filter-" + random2 + ".txt");
33554
+ const filterFile = path28__default.join(downloadMap.complexFilter, "complex-filter-" + random2 + ".txt");
33555
33555
  if (!existsSync(downloadMap.complexFilter)) {
33556
33556
  fs7__default.mkdirSync(downloadMap.complexFilter, { recursive: true });
33557
33557
  }
@@ -33652,7 +33652,7 @@ var mergeAudioTrackUnlimited = async ({
33652
33652
  onProgress(combinedProgress);
33653
33653
  };
33654
33654
  const chunkNames = await Promise.all(chunked.map(async (chunkFiles, i) => {
33655
- const chunkOutname = path8__default.join(tempPath, `chunk-${i}.wav`);
33655
+ const chunkOutname = path28__default.join(tempPath, `chunk-${i}.wav`);
33656
33656
  await mergeAudioTrack({
33657
33657
  files: chunkFiles,
33658
33658
  chunkLengthInSeconds,
@@ -34094,7 +34094,7 @@ var createAudio = async ({
34094
34094
  onProgress(totalProgress);
34095
34095
  };
34096
34096
  const audioTracks = await Promise.all(assetPositions.map(async (asset, index) => {
34097
- const filterFile = path8__default.join(downloadMap.audioMixing, `${index}.wav`);
34097
+ const filterFile = path28__default.join(downloadMap.audioMixing, `${index}.wav`);
34098
34098
  const result = await preprocessAudioTrack({
34099
34099
  outName: filterFile,
34100
34100
  asset,
@@ -34136,9 +34136,9 @@ var createAudio = async ({
34136
34136
  }
34137
34137
  }))
34138
34138
  ];
34139
- const merged = path8__default.join(downloadMap.audioPreprocessing, "merged.wav");
34139
+ const merged = path28__default.join(downloadMap.audioPreprocessing, "merged.wav");
34140
34140
  const extension2 = getExtensionFromAudioCodec(audioCodec);
34141
- const outName = path8__default.join(downloadMap.audioPreprocessing, `audio.${extension2}`);
34141
+ const outName = path28__default.join(downloadMap.audioPreprocessing, `audio.${extension2}`);
34142
34142
  await mergeAudioTrack({
34143
34143
  files: preprocessed,
34144
34144
  outName: merged,
@@ -34305,7 +34305,7 @@ var innerStitchFramesToVideo = async ({
34305
34305
  setting: audioCodecSetting,
34306
34306
  separateAudioTo
34307
34307
  });
34308
- const tempFile = outputLocation ? null : path8__default.join(assetsInfo.downloadMap.stitchFrames, `out.${getFileExtensionFromCodec(codec, resolvedAudioCodec)}`);
34308
+ const tempFile = outputLocation ? null : path28__default.join(assetsInfo.downloadMap.stitchFrames, `out.${getFileExtensionFromCodec(codec, resolvedAudioCodec)}`);
34309
34309
  Log.verbose({
34310
34310
  indent,
34311
34311
  logLevel,
@@ -34379,7 +34379,7 @@ var innerStitchFramesToVideo = async ({
34379
34379
  }
34380
34380
  cpSync(audio, outputLocation ?? tempFile);
34381
34381
  onProgress?.(Math.round(assetsInfo.chunkLengthInSeconds * fps));
34382
- deleteDirectory(path8__default.dirname(audio));
34382
+ deleteDirectory(path28__default.dirname(audio));
34383
34383
  const file = await new Promise((resolve22, reject) => {
34384
34384
  if (tempFile) {
34385
34385
  promises.readFile(tempFile).then((f) => {
@@ -34468,7 +34468,7 @@ var innerStitchFramesToVideo = async ({
34468
34468
  if (!audio) {
34469
34469
  throw new Error(`\`separateAudioTo\` was set to ${JSON.stringify(separateAudioTo)}, but this render included no audio`);
34470
34470
  }
34471
- const finalDestination = path8__default.resolve(remotionRoot, separateAudioTo);
34471
+ const finalDestination = path28__default.resolve(remotionRoot, separateAudioTo);
34472
34472
  cpSync(audio, finalDestination);
34473
34473
  rmSync(audio);
34474
34474
  }
@@ -34716,7 +34716,7 @@ var internalRenderMediaRaw = ({
34716
34716
  separateAudioTo
34717
34717
  });
34718
34718
  }
34719
- const absoluteOutputLocation = outputLocation ? path8__default.resolve(process.cwd(), outputLocation) : null;
34719
+ const absoluteOutputLocation = outputLocation ? path28__default.resolve(process.cwd(), outputLocation) : null;
34720
34720
  validateScale(scale);
34721
34721
  validateFfmpegOverride(ffmpegOverride);
34722
34722
  validateEveryNthFrame(everyNthFrame);
@@ -34782,8 +34782,8 @@ var internalRenderMediaRaw = ({
34782
34782
  }
34783
34783
  const imageFormat = isAudioCodec(codec) ? "none" : provisionalImageFormat ?? compositionWithPossibleUnevenDimensions.defaultVideoImageFormat ?? DEFAULT_VIDEO_IMAGE_FORMAT;
34784
34784
  validateSelectedPixelFormatAndImageFormatCombination(pixelFormat, imageFormat);
34785
- const workingDir = fs7__default.mkdtempSync(path8__default.join(os3__default.tmpdir(), "react-motion-render"));
34786
- const preEncodedFileLocation = parallelEncoding ? path8__default.join(workingDir, "pre-encode." + getFileExtensionFromCodec(codec, audioCodec)) : null;
34785
+ const workingDir = fs7__default.mkdtempSync(path28__default.join(os3__default.tmpdir(), "react-motion-render"));
34786
+ const preEncodedFileLocation = parallelEncoding ? path28__default.join(workingDir, "pre-encode." + getFileExtensionFromCodec(codec, audioCodec)) : null;
34787
34787
  if (onCtrlCExit && workingDir) {
34788
34788
  onCtrlCExit(`Delete ${workingDir}`, () => deleteDirectory(workingDir));
34789
34789
  }
@@ -35109,7 +35109,7 @@ var internalRenderMediaRaw = ({
35109
35109
  reject(err);
35110
35110
  }).finally(() => {
35111
35111
  if (preEncodedFileLocation !== null && fs7__default.existsSync(preEncodedFileLocation)) {
35112
- deleteDirectory(path8__default.dirname(preEncodedFileLocation));
35112
+ deleteDirectory(path28__default.dirname(preEncodedFileLocation));
35113
35113
  }
35114
35114
  if (workingDir && fs7__default.existsSync(workingDir)) {
35115
35115
  deleteDirectory(workingDir);
@@ -36034,13 +36034,13 @@ async function renderSinglePass(opts, progressBase = 0, progressSpan = 0.95) {
36034
36034
  jobId,
36035
36035
  signal,
36036
36036
  tmpDir: tmpDir2,
36037
- videoUrl,
36037
+ sourceServedUrl,
36038
36038
  captionConfig,
36039
36039
  concurrency,
36040
36040
  onProgress,
36041
36041
  logger
36042
36042
  } = opts;
36043
- const inputProps = { ...captionConfig, videoUrl };
36043
+ const inputProps = { ...captionConfig, videoUrl: sourceServedUrl };
36044
36044
  const selectStart = Date.now();
36045
36045
  const composition = await selectComposition({
36046
36046
  serveUrl: bundlePath,
@@ -36049,7 +36049,7 @@ async function renderSinglePass(opts, progressBase = 0, progressSpan = 0.95) {
36049
36049
  timeoutInMilliseconds: 12e4
36050
36050
  });
36051
36051
  logger.info("Single-pass composition selected", { jobId, selectMs: Date.now() - selectStart });
36052
- const outputLocation = path8__default.join(tmpDir2, "output.mp4");
36052
+ const outputLocation = path28__default.join(tmpDir2, "output.mp4");
36053
36053
  const { cancelSignal, cancel } = makeCancelSignal();
36054
36054
  signal.addEventListener("abort", () => cancel(), { once: true });
36055
36055
  const renderStart = Date.now();
@@ -36082,6 +36082,27 @@ async function renderSinglePass(opts, progressBase = 0, progressSpan = 0.95) {
36082
36082
  });
36083
36083
  return outputLocation;
36084
36084
  }
36085
+ function contentTypeFor(name) {
36086
+ switch (path28__default.extname(name).toLowerCase()) {
36087
+ case ".mp4":
36088
+ case ".m4v":
36089
+ return "video/mp4";
36090
+ case ".webm":
36091
+ return "video/webm";
36092
+ case ".mp3":
36093
+ return "audio/mpeg";
36094
+ case ".m4a":
36095
+ return "audio/mp4";
36096
+ case ".wav":
36097
+ return "audio/wav";
36098
+ case ".aac":
36099
+ return "audio/aac";
36100
+ case ".ogg":
36101
+ return "audio/ogg";
36102
+ default:
36103
+ return "application/octet-stream";
36104
+ }
36105
+ }
36085
36106
  function startLocalFileServer(dir) {
36086
36107
  const server = http.createServer((req, res) => {
36087
36108
  res.setHeader("Access-Control-Allow-Origin", "*");
@@ -36092,15 +36113,15 @@ function startLocalFileServer(dir) {
36092
36113
  res.end();
36093
36114
  return;
36094
36115
  }
36095
- const name = path8__default.basename(decodeURIComponent((req.url ?? "/").split("?")[0] ?? "/"));
36096
- const filePath = path8__default.join(dir, name);
36116
+ const name = path28__default.basename(decodeURIComponent((req.url ?? "/").split("?")[0] ?? "/"));
36117
+ const filePath = path28__default.join(dir, name);
36097
36118
  if (!name || !fs7__default.existsSync(filePath)) {
36098
36119
  res.statusCode = 404;
36099
36120
  res.end();
36100
36121
  return;
36101
36122
  }
36102
36123
  const { size } = fs7__default.statSync(filePath);
36103
- res.setHeader("Content-Type", "video/mp4");
36124
+ res.setHeader("Content-Type", contentTypeFor(name));
36104
36125
  res.setHeader("Accept-Ranges", "bytes");
36105
36126
  const range = req.headers.range;
36106
36127
  if (range) {
@@ -36132,7 +36153,8 @@ async function renderChunked(opts, totalSeconds) {
36132
36153
  jobId,
36133
36154
  signal,
36134
36155
  tmpDir: tmpDir2,
36135
- videoUrl,
36156
+ sourceLocalPath,
36157
+ fileServerOrigin,
36136
36158
  captionConfig,
36137
36159
  concurrency,
36138
36160
  onProgress,
@@ -36142,8 +36164,6 @@ async function renderChunked(opts, totalSeconds) {
36142
36164
  const segmentCount = Math.ceil(totalSeconds / SEGMENT_SECONDS);
36143
36165
  const segmentPaths = new Array(segmentCount);
36144
36166
  const parallel = resolveSegmentConcurrency(segmentCount);
36145
- const fileServer = await startLocalFileServer(tmpDir2);
36146
- const fileServerOrigin = fileServer.origin;
36147
36167
  logger.info("Rendering captions in chunks", {
36148
36168
  jobId,
36149
36169
  totalSeconds,
@@ -36156,7 +36176,7 @@ async function renderChunked(opts, totalSeconds) {
36156
36176
  const startSec = i * SEGMENT_SECONDS;
36157
36177
  const endSec = Math.min(startSec + SEGMENT_SECONDS, totalSeconds);
36158
36178
  const segDurationSec = endSec - startSec;
36159
- const trimmedSrc = path8__default.join(tmpDir2, `src-seg-${i}.mp4`);
36179
+ const trimmedSrc = path28__default.join(tmpDir2, `src-seg-${i}.mp4`);
36160
36180
  await runFFmpeg(
36161
36181
  [
36162
36182
  "-y",
@@ -36165,7 +36185,7 @@ async function renderChunked(opts, totalSeconds) {
36165
36185
  "-ss",
36166
36186
  startSec.toFixed(3),
36167
36187
  "-i",
36168
- videoUrl,
36188
+ sourceLocalPath,
36169
36189
  "-t",
36170
36190
  segDurationSec.toFixed(3),
36171
36191
  "-c",
@@ -36189,7 +36209,7 @@ async function renderChunked(opts, totalSeconds) {
36189
36209
  ...captionConfig,
36190
36210
  // Served over loopback HTTP (not file://) — Chromium/OffthreadVideo can't
36191
36211
  // load file:// segments (fails on WSL2 and in the compositor).
36192
- videoUrl: `${fileServerOrigin}/${path8__default.basename(trimmedSrc)}`,
36212
+ videoUrl: `${fileServerOrigin}/${path28__default.basename(trimmedSrc)}`,
36193
36213
  words: segmentWords,
36194
36214
  durationInFrames: Math.max(1, Math.ceil(segDurationSec * CAPTION_FPS))
36195
36215
  };
@@ -36199,7 +36219,7 @@ async function renderChunked(opts, totalSeconds) {
36199
36219
  inputProps: segmentInputProps,
36200
36220
  timeoutInMilliseconds: 6e4
36201
36221
  });
36202
- const segOut = path8__default.join(tmpDir2, `cap-seg-${i}.mp4`);
36222
+ const segOut = path28__default.join(tmpDir2, `cap-seg-${i}.mp4`);
36203
36223
  const { cancelSignal, cancel } = makeCancelSignal();
36204
36224
  const onAbort = () => cancel();
36205
36225
  signal.addEventListener("abort", onAbort, { once: true });
@@ -36240,17 +36260,13 @@ async function renderChunked(opts, totalSeconds) {
36240
36260
  logger.info("Caption chunk render done", { jobId, chunkIdx: i, completed, segmentCount });
36241
36261
  }
36242
36262
  };
36243
- try {
36244
- await Promise.all(Array.from({ length: Math.min(parallel, segmentCount) }, () => worker()));
36245
- } finally {
36246
- await fileServer.close();
36247
- }
36248
- const concatListPath = path8__default.join(tmpDir2, "concat.txt");
36263
+ await Promise.all(Array.from({ length: Math.min(parallel, segmentCount) }, () => worker()));
36264
+ const concatListPath = path28__default.join(tmpDir2, "concat.txt");
36249
36265
  fs7__default.writeFileSync(
36250
36266
  concatListPath,
36251
36267
  segmentPaths.map((p) => `file '${p.replace(/'/g, "'\\''")}'`).join("\n")
36252
36268
  );
36253
- const finalOutput = path8__default.join(tmpDir2, "output.mp4");
36269
+ const finalOutput = path28__default.join(tmpDir2, "output.mp4");
36254
36270
  await runFFmpeg(buildConcatDemuxerCommand(concatListPath, finalOutput), {
36255
36271
  signal,
36256
36272
  timeoutMs: 6e4
@@ -36274,20 +36290,42 @@ async function renderCaptions(input) {
36274
36290
  chunked,
36275
36291
  videoUrl: input.videoUrl
36276
36292
  });
36277
- const chunkInputs = {
36278
- bundlePath: input.bundlePath,
36279
- jobId: input.jobId,
36280
- signal: input.cancelSignal,
36281
- tmpDir: input.workDir,
36282
- videoUrl: input.videoUrl,
36283
- captionConfig: input.captionConfig,
36284
- concurrency: input.concurrency,
36285
- logger,
36286
- ...input.onProgress ? { onProgress: input.onProgress } : {}
36287
- };
36288
- const outputFilePath = chunked ? await renderChunked(chunkInputs, totalSeconds) : await renderSinglePass(chunkInputs);
36289
- const durationSec = Math.round(rawFrames / CAPTION_FPS * 10) / 10;
36290
- return { outputFilePath, durationSec };
36293
+ const fileServer = await startLocalFileServer(input.workDir);
36294
+ try {
36295
+ const sourceLocalPath = path28__default.join(input.workDir, "source.mp4");
36296
+ if (/^https?:\/\//i.test(input.videoUrl)) {
36297
+ await downloadToFile(input.videoUrl, sourceLocalPath);
36298
+ } else {
36299
+ fs7__default.copyFileSync(input.videoUrl, sourceLocalPath);
36300
+ }
36301
+ const sourceServedUrl = `${fileServer.origin}/${path28__default.basename(sourceLocalPath)}`;
36302
+ const captionConfig = { ...input.captionConfig };
36303
+ const audioUrl = captionConfig.audioUrl;
36304
+ if (typeof audioUrl === "string" && /^https?:\/\//i.test(audioUrl)) {
36305
+ const audioExt = path28__default.extname(new URL(audioUrl).pathname) || ".mp3";
36306
+ const audioLocalName = `source-audio${audioExt}`;
36307
+ await downloadToFile(audioUrl, path28__default.join(input.workDir, audioLocalName));
36308
+ captionConfig.audioUrl = `${fileServer.origin}/${audioLocalName}`;
36309
+ }
36310
+ const chunkInputs = {
36311
+ bundlePath: input.bundlePath,
36312
+ jobId: input.jobId,
36313
+ signal: input.cancelSignal,
36314
+ tmpDir: input.workDir,
36315
+ sourceLocalPath,
36316
+ sourceServedUrl,
36317
+ fileServerOrigin: fileServer.origin,
36318
+ captionConfig,
36319
+ concurrency: input.concurrency,
36320
+ logger,
36321
+ ...input.onProgress ? { onProgress: input.onProgress } : {}
36322
+ };
36323
+ const outputFilePath = chunked ? await renderChunked(chunkInputs, totalSeconds) : await renderSinglePass(chunkInputs);
36324
+ const durationSec = Math.round(rawFrames / CAPTION_FPS * 10) / 10;
36325
+ return { outputFilePath, durationSec };
36326
+ } finally {
36327
+ await fileServer.close();
36328
+ }
36291
36329
  }
36292
36330
  var SLIDESHOW_FPS = 30;
36293
36331
  var NOOP_LOGGER2 = {
@@ -36325,7 +36363,7 @@ async function renderSlideshow(input) {
36325
36363
  inputProps,
36326
36364
  timeoutInMilliseconds: 12e4
36327
36365
  });
36328
- const outputLocation = path8__default.join(input.workDir, "output.mp4");
36366
+ const outputLocation = path28__default.join(input.workDir, "output.mp4");
36329
36367
  const { cancelSignal, cancel } = makeCancelSignal();
36330
36368
  input.cancelSignal.addEventListener("abort", () => cancel(), { once: true });
36331
36369
  const renderStart = Date.now();
@@ -37205,16 +37243,16 @@ var CAPABILITIES = [
37205
37243
  var HEARTBEAT_INTERVAL_MS = 15e3;
37206
37244
  var RECONNECT_BASE_MS = 1e3;
37207
37245
  var RECONNECT_MAX_MS = 3e4;
37208
- var ENTRY_POINT = path8__default.resolve(process.cwd(), "remotion/Root.tsx");
37246
+ var ENTRY_POINT = path28__default.resolve(process.cwd(), "remotion/Root.tsx");
37209
37247
  function resolvePrebuiltBundleDir() {
37210
37248
  const override = process.env.WYREN_REMOTION_BUNDLE_DIR?.trim();
37211
- if (override) return path8__default.resolve(override);
37212
- const moduleDir = path8__default.dirname(fileURLToPath(import.meta.url));
37213
- const installRelative = path8__default.join(moduleDir, "remotion-bundle");
37214
- if (fs7__default.existsSync(path8__default.join(installRelative, "index.html"))) {
37249
+ if (override) return path28__default.resolve(override);
37250
+ const moduleDir = path28__default.dirname(fileURLToPath(import.meta.url));
37251
+ const installRelative = path28__default.join(moduleDir, "remotion-bundle");
37252
+ if (fs7__default.existsSync(path28__default.join(installRelative, "index.html"))) {
37215
37253
  return installRelative;
37216
37254
  }
37217
- return path8__default.resolve(process.cwd(), "backend/dist/remotion-bundle");
37255
+ return path28__default.resolve(process.cwd(), "backend/dist/remotion-bundle");
37218
37256
  }
37219
37257
  var PREBUILT_BUNDLE_DIR = resolvePrebuiltBundleDir();
37220
37258
  function log(msg, ctx) {
@@ -37240,7 +37278,7 @@ function wsUrlFor(backendUrl) {
37240
37278
  var cachedBundlePath = null;
37241
37279
  async function resolveBundle() {
37242
37280
  if (cachedBundlePath) return cachedBundlePath;
37243
- const prebuiltIndex = path8__default.join(PREBUILT_BUNDLE_DIR, "index.html");
37281
+ const prebuiltIndex = path28__default.join(PREBUILT_BUNDLE_DIR, "index.html");
37244
37282
  if (fs7__default.existsSync(prebuiltIndex)) {
37245
37283
  log("Using pre-built Remotion bundle", { dir: PREBUILT_BUNDLE_DIR });
37246
37284
  cachedBundlePath = PREBUILT_BUNDLE_DIR;
@@ -37303,7 +37341,7 @@ var BackendClient = class {
37303
37341
  async uploadViaPresign(localPath, endpoint, contentType, purpose) {
37304
37342
  const size = fs7__default.statSync(localPath).size;
37305
37343
  const body = {
37306
- filename: path8__default.basename(localPath),
37344
+ filename: path28__default.basename(localPath),
37307
37345
  contentType,
37308
37346
  size
37309
37347
  };
@@ -37435,7 +37473,7 @@ var videoMergeHandler = async (ctx) => {
37435
37473
  for (let i = 0; i < videoUrls.length; i++) {
37436
37474
  const url2 = videoUrls[i];
37437
37475
  await validateExternalUrl(url2);
37438
- const filePath = path8__default.join(ctx.workDir, `input${i}.mp4`);
37476
+ const filePath = path28__default.join(ctx.workDir, `input${i}.mp4`);
37439
37477
  await downloadToFile(url2, filePath);
37440
37478
  inputPaths.push(filePath);
37441
37479
  }
@@ -37467,13 +37505,13 @@ var brainrotComposeHandler = async (ctx) => {
37467
37505
  throw new Error("brainrot-compose requires at least one video URL");
37468
37506
  }
37469
37507
  await validateExternalUrl(config.audioUrl);
37470
- const audioPath = path8__default.join(ctx.workDir, "voiceover.audio");
37508
+ const audioPath = path28__default.join(ctx.workDir, "voiceover.audio");
37471
37509
  await downloadToFile(config.audioUrl, audioPath);
37472
37510
  const inputPaths = [];
37473
37511
  for (let i = 0; i < config.videoUrls.length; i++) {
37474
37512
  const url2 = config.videoUrls[i];
37475
37513
  await validateExternalUrl(url2);
37476
- const filePath = path8__default.join(ctx.workDir, `clip-${i}.mp4`);
37514
+ const filePath = path28__default.join(ctx.workDir, `clip-${i}.mp4`);
37477
37515
  await downloadToFile(url2, filePath);
37478
37516
  inputPaths.push(filePath);
37479
37517
  }
@@ -37515,7 +37553,7 @@ async function runJob(socket, client, jobType, jobId, concurrency, cancelSignal)
37515
37553
  const userId = job.user_id;
37516
37554
  if (!userId) throw new Error(`Job ${jobId} has no user_id`);
37517
37555
  await client.markProcessing(jobId);
37518
- const workDir = fs7__default.mkdtempSync(path8__default.join(os3__default.tmpdir(), `wyren-daemon-${jobId}-`));
37556
+ const workDir = fs7__default.mkdtempSync(path28__default.join(os3__default.tmpdir(), `wyren-daemon-${jobId}-`));
37519
37557
  try {
37520
37558
  await handler5({ socket, client, jobId, userId, job, concurrency, cancelSignal, workDir });
37521
37559
  log("Job completed", { jobType, jobId });
@@ -37572,9 +37610,12 @@ var Daemon = class {
37572
37610
  void this.handleDispatch(socket, msg);
37573
37611
  });
37574
37612
  socket.on("close", (code, reason) => {
37575
- log("WebSocket closed", { code, reason: reason.toString() });
37613
+ log("WebSocket closed", {
37614
+ code,
37615
+ reason: reason.toString(),
37616
+ inFlight: this.inFlight.size
37617
+ });
37576
37618
  this.cleanupSocket();
37577
- this.abortAllInFlight("socket disconnected");
37578
37619
  this.scheduleReconnect();
37579
37620
  });
37580
37621
  socket.on("error", (err) => {