meshy-node 0.5.2 → 0.5.4

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/main.cjs CHANGED
@@ -2878,7 +2878,7 @@ var require_semver2 = __commonJS({
2878
2878
  "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js"(exports2, module2) {
2879
2879
  "use strict";
2880
2880
  var internalRe = require_re();
2881
- var constants = require_constants();
2881
+ var constants2 = require_constants();
2882
2882
  var SemVer = require_semver();
2883
2883
  var identifiers = require_identifiers();
2884
2884
  var parse = require_parse();
@@ -2960,8 +2960,8 @@ var require_semver2 = __commonJS({
2960
2960
  re: internalRe.re,
2961
2961
  src: internalRe.src,
2962
2962
  tokens: internalRe.t,
2963
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
2964
- RELEASE_TYPES: constants.RELEASE_TYPES,
2963
+ SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
2964
+ RELEASE_TYPES: constants2.RELEASE_TYPES,
2965
2965
  compareIdentifiers: identifiers.compareIdentifiers,
2966
2966
  rcompareIdentifiers: identifiers.rcompareIdentifiers
2967
2967
  };
@@ -6629,8 +6629,8 @@ var require_node2 = __commonJS({
6629
6629
  }
6630
6630
  break;
6631
6631
  case "FILE":
6632
- var fs23 = require("fs");
6633
- stream2 = new fs23.SyncWriteStream(fd2, { autoClose: false });
6632
+ var fs24 = require("fs");
6633
+ stream2 = new fs24.SyncWriteStream(fd2, { autoClose: false });
6634
6634
  stream2._type = "fs";
6635
6635
  break;
6636
6636
  case "PIPE":
@@ -23749,7 +23749,7 @@ var require_view = __commonJS({
23749
23749
  "use strict";
23750
23750
  var debug = require_src2()("express:view");
23751
23751
  var path23 = require("path");
23752
- var fs23 = require("fs");
23752
+ var fs24 = require("fs");
23753
23753
  var dirname8 = path23.dirname;
23754
23754
  var basename5 = path23.basename;
23755
23755
  var extname3 = path23.extname;
@@ -23815,7 +23815,7 @@ var require_view = __commonJS({
23815
23815
  function tryStat(path24) {
23816
23816
  debug('stat "%s"', path24);
23817
23817
  try {
23818
- return fs23.statSync(path24);
23818
+ return fs24.statSync(path24);
23819
23819
  } catch (e) {
23820
23820
  return void 0;
23821
23821
  }
@@ -24113,7 +24113,7 @@ var require_mime = __commonJS({
24113
24113
  "../../node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports2, module2) {
24114
24114
  "use strict";
24115
24115
  var path23 = require("path");
24116
- var fs23 = require("fs");
24116
+ var fs24 = require("fs");
24117
24117
  function Mime() {
24118
24118
  this.types = /* @__PURE__ */ Object.create(null);
24119
24119
  this.extensions = /* @__PURE__ */ Object.create(null);
@@ -24134,7 +24134,7 @@ var require_mime = __commonJS({
24134
24134
  };
24135
24135
  Mime.prototype.load = function(file) {
24136
24136
  this._loading = file;
24137
- var map = {}, content = fs23.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
24137
+ var map = {}, content = fs24.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
24138
24138
  lines.forEach(function(line) {
24139
24139
  var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
24140
24140
  map[fields.shift()] = fields;
@@ -24256,7 +24256,7 @@ var require_send = __commonJS({
24256
24256
  var escapeHtml2 = require_escape_html();
24257
24257
  var etag = require_etag();
24258
24258
  var fresh = require_fresh();
24259
- var fs23 = require("fs");
24259
+ var fs24 = require("fs");
24260
24260
  var mime = require_mime();
24261
24261
  var ms = require_ms();
24262
24262
  var onFinished = require_on_finished();
@@ -24269,7 +24269,7 @@ var require_send = __commonJS({
24269
24269
  var join17 = path23.join;
24270
24270
  var normalize = path23.normalize;
24271
24271
  var resolve15 = path23.resolve;
24272
- var sep4 = path23.sep;
24272
+ var sep5 = path23.sep;
24273
24273
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
24274
24274
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
24275
24275
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
@@ -24477,14 +24477,14 @@ var require_send = __commonJS({
24477
24477
  var parts;
24478
24478
  if (root !== null) {
24479
24479
  if (path24) {
24480
- path24 = normalize("." + sep4 + path24);
24480
+ path24 = normalize("." + sep5 + path24);
24481
24481
  }
24482
24482
  if (UP_PATH_REGEXP.test(path24)) {
24483
24483
  debug('malicious path "%s"', path24);
24484
24484
  this.error(403);
24485
24485
  return res;
24486
24486
  }
24487
- parts = path24.split(sep4);
24487
+ parts = path24.split(sep5);
24488
24488
  path24 = normalize(join17(root, path24));
24489
24489
  } else {
24490
24490
  if (UP_PATH_REGEXP.test(path24)) {
@@ -24492,7 +24492,7 @@ var require_send = __commonJS({
24492
24492
  this.error(403);
24493
24493
  return res;
24494
24494
  }
24495
- parts = normalize(path24).split(sep4);
24495
+ parts = normalize(path24).split(sep5);
24496
24496
  path24 = resolve15(path24);
24497
24497
  }
24498
24498
  if (containsDotFile(parts)) {
@@ -24589,8 +24589,8 @@ var require_send = __commonJS({
24589
24589
  var i = 0;
24590
24590
  var self2 = this;
24591
24591
  debug('stat "%s"', path24);
24592
- fs23.stat(path24, function onstat(err, stat) {
24593
- if (err && err.code === "ENOENT" && !extname3(path24) && path24[path24.length - 1] !== sep4) {
24592
+ fs24.stat(path24, function onstat(err, stat) {
24593
+ if (err && err.code === "ENOENT" && !extname3(path24) && path24[path24.length - 1] !== sep5) {
24594
24594
  return next(err);
24595
24595
  }
24596
24596
  if (err) return self2.onStatError(err);
@@ -24604,7 +24604,7 @@ var require_send = __commonJS({
24604
24604
  }
24605
24605
  var p = path24 + "." + self2._extensions[i++];
24606
24606
  debug('stat "%s"', p);
24607
- fs23.stat(p, function(err2, stat) {
24607
+ fs24.stat(p, function(err2, stat) {
24608
24608
  if (err2) return next(err2);
24609
24609
  if (stat.isDirectory()) return next();
24610
24610
  self2.emit("file", p, stat);
@@ -24622,7 +24622,7 @@ var require_send = __commonJS({
24622
24622
  }
24623
24623
  var p = join17(path24, self2._index[i]);
24624
24624
  debug('stat "%s"', p);
24625
- fs23.stat(p, function(err2, stat) {
24625
+ fs24.stat(p, function(err2, stat) {
24626
24626
  if (err2) return next(err2);
24627
24627
  if (stat.isDirectory()) return next();
24628
24628
  self2.emit("file", p, stat);
@@ -24634,7 +24634,7 @@ var require_send = __commonJS({
24634
24634
  SendStream.prototype.stream = function stream(path24, options) {
24635
24635
  var self2 = this;
24636
24636
  var res = this.res;
24637
- var stream2 = fs23.createReadStream(path24, options);
24637
+ var stream2 = fs24.createReadStream(path24, options);
24638
24638
  this.emit("stream", stream2);
24639
24639
  stream2.pipe(res);
24640
24640
  function cleanup() {
@@ -43460,7 +43460,7 @@ var BatchTaskIdsBody = external_exports.object({
43460
43460
 
43461
43461
  // ../../packages/api/src/app/server.ts
43462
43462
  var path20 = __toESM(require("path"), 1);
43463
- var fs19 = __toESM(require("fs"), 1);
43463
+ var fs20 = __toESM(require("fs"), 1);
43464
43464
  var import_express14 = __toESM(require_express2(), 1);
43465
43465
 
43466
43466
  // ../../packages/api/src/middleware/auth.ts
@@ -44306,37 +44306,71 @@ function readFileContent(root, relativePath) {
44306
44306
  };
44307
44307
  }
44308
44308
 
44309
- // ../../packages/api/src/output/git-branches.ts
44309
+ // ../../packages/api/src/output/git-command.ts
44310
+ var fs15 = __toESM(require("fs"), 1);
44310
44311
  var import_node_child_process6 = require("child_process");
44312
+ var COMMON_GIT_BINARIES = [
44313
+ "/opt/homebrew/bin/git",
44314
+ "/usr/local/bin/git",
44315
+ "/usr/bin/git"
44316
+ ];
44317
+ function isExecutable(filePath) {
44318
+ try {
44319
+ fs15.accessSync(filePath, fs15.constants.X_OK);
44320
+ return true;
44321
+ } catch {
44322
+ return false;
44323
+ }
44324
+ }
44325
+ function getGitCandidates() {
44326
+ const candidates = [
44327
+ process.env.MESHY_GIT_BINARY,
44328
+ "git",
44329
+ ...COMMON_GIT_BINARIES.filter(isExecutable)
44330
+ ].filter((candidate) => Boolean(candidate));
44331
+ return [...new Set(candidates)];
44332
+ }
44333
+ function isMissingBinaryError(error) {
44334
+ return typeof error === "object" && error !== null && error.code === "ENOENT";
44335
+ }
44336
+ function execGit(args, cwd, timeout = 1e4) {
44337
+ let lastError;
44338
+ for (const command of getGitCandidates()) {
44339
+ try {
44340
+ return (0, import_node_child_process6.execFileSync)(command, ["-C", cwd, ...args], {
44341
+ encoding: "utf-8",
44342
+ timeout,
44343
+ stdio: ["pipe", "pipe", "pipe"],
44344
+ windowsHide: true
44345
+ }).trim();
44346
+ } catch (err) {
44347
+ lastError = err;
44348
+ if (!isMissingBinaryError(err)) {
44349
+ throw err;
44350
+ }
44351
+ }
44352
+ }
44353
+ throw lastError instanceof Error ? lastError : new Error("git executable not found");
44354
+ }
44355
+
44356
+ // ../../packages/api/src/output/git-branches.ts
44311
44357
  function git(args, cwd) {
44312
44358
  try {
44313
- return (0, import_node_child_process6.execFileSync)("git", ["-C", cwd, ...args], {
44314
- encoding: "utf-8",
44315
- timeout: 1e4,
44316
- stdio: ["pipe", "pipe", "pipe"]
44317
- }).trim();
44359
+ return execGit(args, cwd);
44318
44360
  } catch {
44319
44361
  return "";
44320
44362
  }
44321
44363
  }
44322
44364
  function gitSucceeds(args, cwd) {
44323
44365
  try {
44324
- (0, import_node_child_process6.execFileSync)("git", ["-C", cwd, ...args], {
44325
- encoding: "utf-8",
44326
- timeout: 1e4,
44327
- stdio: ["pipe", "pipe", "pipe"]
44328
- });
44366
+ execGit(args, cwd);
44329
44367
  return true;
44330
44368
  } catch {
44331
44369
  return false;
44332
44370
  }
44333
44371
  }
44334
44372
  function runGit(args, cwd) {
44335
- return (0, import_node_child_process6.execFileSync)("git", ["-C", cwd, ...args], {
44336
- encoding: "utf-8",
44337
- timeout: 1e4,
44338
- stdio: ["pipe", "pipe", "pipe"]
44339
- }).trim();
44373
+ return execGit(args, cwd);
44340
44374
  }
44341
44375
  function isGitRepo(dirPath) {
44342
44376
  return git(["rev-parse", "--is-inside-work-tree"], dirPath) === "true";
@@ -44490,14 +44524,9 @@ function createGitBranch(dirPath, branchName, startPoint, options) {
44490
44524
  }
44491
44525
 
44492
44526
  // ../../packages/api/src/output/git-diff.ts
44493
- var import_node_child_process7 = require("child_process");
44494
44527
  function git2(args, cwd) {
44495
44528
  try {
44496
- return (0, import_node_child_process7.execFileSync)("git", ["-C", cwd, ...args], {
44497
- encoding: "utf-8",
44498
- timeout: 1e4,
44499
- stdio: ["pipe", "pipe", "pipe"]
44500
- }).trim();
44529
+ return execGit(args, cwd);
44501
44530
  } catch {
44502
44531
  return "";
44503
44532
  }
@@ -44548,12 +44577,22 @@ function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute)
44548
44577
  }
44549
44578
  const useAbsolute = allowAbsolute && isAbsolutePath(currentPath);
44550
44579
  const resolvedPath = useAbsolute ? path16.resolve(currentPath) : currentPath;
44580
+ const targetPath = useAbsolute ? resolvedPath : resolveRelativeNodeWorkDirTarget(rootPath, resolvedPath);
44551
44581
  return {
44552
44582
  rootPath,
44553
44583
  resolvedPath,
44584
+ targetPath,
44554
44585
  useAbsolute
44555
44586
  };
44556
44587
  }
44588
+ function resolveRelativeNodeWorkDirTarget(rootPath, relativePath) {
44589
+ const resolvedRoot = path16.resolve(rootPath);
44590
+ const resolved = path16.resolve(resolvedRoot, relativePath);
44591
+ if (!resolved.startsWith(resolvedRoot + path16.sep) && resolved !== resolvedRoot) {
44592
+ throw new MeshyError("VALIDATION_ERROR", "Invalid directory path", 400);
44593
+ }
44594
+ return resolved;
44595
+ }
44557
44596
  function getLocalNodeWorkDirTree(nodeId, rootPath, currentPath, options) {
44558
44597
  const { rootPath: resolvedRootPath, resolvedPath, useAbsolute } = resolveNodeWorkDirTarget(
44559
44598
  nodeId,
@@ -44587,24 +44626,24 @@ function getLocalNodeWorkDirTree(nodeId, rootPath, currentPath, options) {
44587
44626
  }
44588
44627
  }
44589
44628
  function getLocalNodeWorkDirBranchInfo(nodeId, rootPath, currentPath, options) {
44590
- const { resolvedPath } = resolveNodeWorkDirTarget(
44629
+ const { targetPath } = resolveNodeWorkDirTarget(
44591
44630
  nodeId,
44592
44631
  rootPath,
44593
44632
  currentPath,
44594
44633
  options.allowAbsolute
44595
44634
  );
44596
- const branchInfo = getGitBranchInfo(resolvedPath, {
44635
+ const branchInfo = getGitBranchInfo(targetPath, {
44597
44636
  limit: options.limit,
44598
44637
  offset: options.offset
44599
44638
  });
44600
44639
  return {
44601
44640
  nodeId,
44602
- path: resolvedPath,
44641
+ path: targetPath,
44603
44642
  ...branchInfo
44604
44643
  };
44605
44644
  }
44606
44645
  function createLocalNodeWorkDirBranch(nodeId, rootPath, currentPath, options) {
44607
- const { resolvedPath } = resolveNodeWorkDirTarget(
44646
+ const { targetPath } = resolveNodeWorkDirTarget(
44608
44647
  nodeId,
44609
44648
  rootPath,
44610
44649
  currentPath,
@@ -44612,14 +44651,14 @@ function createLocalNodeWorkDirBranch(nodeId, rootPath, currentPath, options) {
44612
44651
  );
44613
44652
  try {
44614
44653
  const result = createGitBranch(
44615
- resolvedPath,
44654
+ targetPath,
44616
44655
  options.branchName,
44617
44656
  options.startPoint,
44618
44657
  { limit: options.limit, offset: options.offset }
44619
44658
  );
44620
44659
  return {
44621
44660
  nodeId,
44622
- path: resolvedPath,
44661
+ path: targetPath,
44623
44662
  ...result
44624
44663
  };
44625
44664
  } catch (err) {
@@ -44649,11 +44688,11 @@ function computeParentPath(rootPath, currentPath, useAbsolute) {
44649
44688
  var import_node_crypto7 = require("crypto");
44650
44689
 
44651
44690
  // ../../packages/api/src/node/agent-upgrade-service.ts
44652
- var import_node_child_process9 = require("child_process");
44691
+ var import_node_child_process8 = require("child_process");
44653
44692
 
44654
44693
  // ../../packages/api/src/app/system-info.ts
44655
44694
  var os6 = __toESM(require("os"), 1);
44656
- var import_node_child_process8 = require("child_process");
44695
+ var import_node_child_process7 = require("child_process");
44657
44696
  var RUNTIME_TOOLS = [
44658
44697
  { id: "claude", label: "Claude Code", command: "claude", packageName: "@anthropic-ai/claude-code" },
44659
44698
  { id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" }
@@ -44667,7 +44706,7 @@ function clearRuntimeToolUpdateCache(packageName) {
44667
44706
  runtimeToolUpdateCache.clear();
44668
44707
  }
44669
44708
  function runRuntimeToolCommand(command, args, platform2) {
44670
- const result = (0, import_node_child_process8.spawnSync)(command, args, {
44709
+ const result = (0, import_node_child_process7.spawnSync)(command, args, {
44671
44710
  encoding: "utf-8",
44672
44711
  shell: platform2 === "win32" && command !== "where",
44673
44712
  windowsHide: true,
@@ -44872,7 +44911,7 @@ function summarizeOutput(value) {
44872
44911
  return text.length > OUTPUT_LIMIT ? `${text.slice(0, OUTPUT_LIMIT)}\u2026` : text;
44873
44912
  }
44874
44913
  function defaultCommandRunner(command, args) {
44875
- const result = (0, import_node_child_process9.spawnSync)(command, args, {
44914
+ const result = (0, import_node_child_process8.spawnSync)(command, args, {
44876
44915
  encoding: "utf-8",
44877
44916
  shell: process.platform === "win32",
44878
44917
  windowsHide: true,
@@ -45372,7 +45411,7 @@ async function sendNodeWorkDirBranchCreateOperation(req, res, nodeId) {
45372
45411
  }
45373
45412
 
45374
45413
  // ../../packages/api/src/tasks/task-route-utils.ts
45375
- var fs15 = __toESM(require("fs"), 1);
45414
+ var fs16 = __toESM(require("fs"), 1);
45376
45415
  var import_node_stream2 = require("stream");
45377
45416
  var import_promises5 = require("stream/promises");
45378
45417
 
@@ -45434,10 +45473,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
45434
45473
  throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
45435
45474
  }
45436
45475
  const logPath = engine.getLogPath(taskId);
45437
- if (!fs15.existsSync(logPath)) {
45476
+ if (!fs16.existsSync(logPath)) {
45438
45477
  return { logs: [], total: 0 };
45439
45478
  }
45440
- const content = fs15.readFileSync(logPath, "utf-8");
45479
+ const content = fs16.readFileSync(logPath, "utf-8");
45441
45480
  const allLines = content.trim().split("\n").filter(Boolean);
45442
45481
  const logs = [];
45443
45482
  for (let i = after; i < allLines.length; i++) {
@@ -45668,11 +45707,11 @@ async function maybeProxyReadToLeader(req, res, options = {}) {
45668
45707
  }
45669
45708
 
45670
45709
  // ../../packages/api/src/node/node-terminal-session-service.ts
45671
- var import_node_child_process10 = require("child_process");
45710
+ var import_node_child_process9 = require("child_process");
45672
45711
  var import_node_crypto8 = require("crypto");
45673
45712
 
45674
45713
  // ../../packages/api/src/node/node-terminal-service.ts
45675
- var fs16 = __toESM(require("fs"), 1);
45714
+ var fs17 = __toESM(require("fs"), 1);
45676
45715
  var path17 = __toESM(require("path"), 1);
45677
45716
  var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
45678
45717
  function isAbsolutePath2(value) {
@@ -45684,7 +45723,7 @@ function resolveNodeTerminalCwd(nodeId, rootPath, cwd) {
45684
45723
  }
45685
45724
  const requestedCwd = cwd?.trim() || ".";
45686
45725
  const resolved = isAbsolutePath2(requestedCwd) ? path17.resolve(requestedCwd) : path17.resolve(rootPath, requestedCwd);
45687
- if (!fs16.existsSync(resolved) || !fs16.statSync(resolved).isDirectory()) {
45726
+ if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isDirectory()) {
45688
45727
  throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
45689
45728
  }
45690
45729
  return resolved;
@@ -45748,7 +45787,7 @@ var NodeTerminalSessionService = class {
45748
45787
  }
45749
45788
  const cwd = resolveNodeTerminalCwd(nodeId, rootPath, options.cwd);
45750
45789
  const startedAt = Date.now();
45751
- const child = (0, import_node_child_process10.spawn)(normalizedCommand, {
45790
+ const child = (0, import_node_child_process9.spawn)(normalizedCommand, {
45752
45791
  cwd,
45753
45792
  shell: true,
45754
45793
  windowsHide: true,
@@ -45923,12 +45962,12 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
45923
45962
  }
45924
45963
 
45925
45964
  // ../../packages/api/src/tasks/task-output-service.ts
45926
- var fs18 = __toESM(require("fs"), 1);
45965
+ var fs19 = __toESM(require("fs"), 1);
45927
45966
  var path19 = __toESM(require("path"), 1);
45928
45967
 
45929
45968
  // ../../packages/api/src/preview/preview-server.ts
45930
45969
  var crypto3 = __toESM(require("crypto"), 1);
45931
- var fs17 = __toESM(require("fs"), 1);
45970
+ var fs18 = __toESM(require("fs"), 1);
45932
45971
  var path18 = __toESM(require("path"), 1);
45933
45972
  var http2 = __toESM(require("http"), 1);
45934
45973
  var import_node_stream3 = require("stream");
@@ -46053,7 +46092,7 @@ function resolvePreviewPath(rootPath, relativePath) {
46053
46092
  }
46054
46093
  function resolvePreviewEntryPath(rootPath, entryPath) {
46055
46094
  const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
46056
- if (!fs17.existsSync(absolutePath) || !fs17.statSync(absolutePath).isFile()) {
46095
+ if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
46057
46096
  throw new Error("Preview entry not found");
46058
46097
  }
46059
46098
  return normalizedPath;
@@ -46509,14 +46548,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
46509
46548
  res.end("Invalid path");
46510
46549
  return;
46511
46550
  }
46512
- if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isFile()) {
46551
+ if (!fs18.existsSync(resolved) || !fs18.statSync(resolved).isFile()) {
46513
46552
  res.writeHead(404, { "Content-Type": "text/plain" });
46514
46553
  res.end("File not found");
46515
46554
  return;
46516
46555
  }
46517
46556
  const ext = path18.extname(resolved).toLowerCase();
46518
46557
  const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
46519
- const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs17.readFileSync(resolved, "utf8"), path18.basename(resolved)) : fs17.readFileSync(resolved);
46558
+ const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs18.readFileSync(resolved, "utf8"), path18.basename(resolved)) : fs18.readFileSync(resolved);
46520
46559
  res.writeHead(200, {
46521
46560
  "Content-Type": mime,
46522
46561
  "Content-Length": content.length,
@@ -46845,13 +46884,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
46845
46884
  const rootPath = getTaskOutputRoot(taskEngine, taskId);
46846
46885
  try {
46847
46886
  const absolutePath = resolveOutputPath(rootPath, filePath);
46848
- if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
46887
+ if (!fs19.existsSync(absolutePath) || !fs19.statSync(absolutePath).isFile()) {
46849
46888
  throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
46850
46889
  }
46851
46890
  const { mimeType } = classifyFile(absolutePath);
46852
46891
  const fileName = path19.basename(absolutePath).replace(/"/g, "");
46853
46892
  return {
46854
- content: fs18.readFileSync(absolutePath),
46893
+ content: fs19.readFileSync(absolutePath),
46855
46894
  headers: {
46856
46895
  "Content-Type": mimeType,
46857
46896
  "Content-Disposition": `inline; filename="${fileName}"`,
@@ -49925,7 +49964,7 @@ function hasAuthorizationHeader(req) {
49925
49964
  function resolveRuntimeBaseDir() {
49926
49965
  const entryPath = process.argv[1];
49927
49966
  if (typeof entryPath === "string" && entryPath.length > 0) {
49928
- const resolved = fs19.realpathSync(path20.resolve(entryPath));
49967
+ const resolved = fs20.realpathSync(path20.resolve(entryPath));
49929
49968
  return path20.dirname(resolved);
49930
49969
  }
49931
49970
  return process.cwd();
@@ -49945,7 +49984,7 @@ function resolveStaticDir(baseDir) {
49945
49984
  path20.resolve(process.cwd(), "packages/api/public")
49946
49985
  ].filter((value) => typeof value === "string" && value.length > 0);
49947
49986
  for (const candidate of candidateDirs) {
49948
- if (fs19.existsSync(candidate)) {
49987
+ if (fs20.existsSync(candidate)) {
49949
49988
  return candidate;
49950
49989
  }
49951
49990
  }
@@ -50051,7 +50090,7 @@ function createServer2(deps) {
50051
50090
  app.use("/api/events", createEventRoutes());
50052
50091
  if (staticDir) {
50053
50092
  const indexPath = path20.join(staticDir, "index.html");
50054
- if (fs19.existsSync(indexPath)) {
50093
+ if (fs20.existsSync(indexPath)) {
50055
50094
  app.get("*", (req, res, next) => {
50056
50095
  if (isApiRequest(req)) {
50057
50096
  next();
@@ -50135,10 +50174,10 @@ var DirectTransport = class {
50135
50174
  };
50136
50175
 
50137
50176
  // ../../packages/transport/src/devtunnel.ts
50138
- var import_node_child_process11 = require("child_process");
50177
+ var import_node_child_process10 = require("child_process");
50139
50178
  function isInstalled(cmd) {
50140
50179
  try {
50141
- (0, import_node_child_process11.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
50180
+ (0, import_node_child_process10.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
50142
50181
  return true;
50143
50182
  } catch {
50144
50183
  return false;
@@ -50161,14 +50200,14 @@ var DevTunnelTransport = class {
50161
50200
  );
50162
50201
  }
50163
50202
  try {
50164
- (0, import_node_child_process11.execSync)("devtunnel user show", { stdio: "pipe" });
50203
+ (0, import_node_child_process10.execSync)("devtunnel user show", { stdio: "pipe" });
50165
50204
  } catch {
50166
50205
  throw new Error(
50167
50206
  "Not logged in to devtunnel. Run: devtunnel user login"
50168
50207
  );
50169
50208
  }
50170
50209
  const hostArgs = this.buildHostArgs(localPort);
50171
- const child = (0, import_node_child_process11.spawn)("devtunnel", hostArgs, {
50210
+ const child = (0, import_node_child_process10.spawn)("devtunnel", hostArgs, {
50172
50211
  stdio: ["pipe", "pipe", "pipe"]
50173
50212
  });
50174
50213
  this.process = child;
@@ -50273,7 +50312,7 @@ ${lines.join("")}`
50273
50312
  return;
50274
50313
  }
50275
50314
  try {
50276
- (0, import_node_child_process11.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
50315
+ (0, import_node_child_process10.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
50277
50316
  } catch (err) {
50278
50317
  if (isExistingTenantAccessError(err)) {
50279
50318
  return;
@@ -50289,7 +50328,7 @@ ${lines.join("")}`
50289
50328
  return void 0;
50290
50329
  }
50291
50330
  try {
50292
- (0, import_node_child_process11.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
50331
+ (0, import_node_child_process10.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
50293
50332
  return tunnelId;
50294
50333
  } catch {
50295
50334
  const createArgs = ["create", tunnelId];
@@ -50297,7 +50336,7 @@ ${lines.join("")}`
50297
50336
  createArgs.push("-a");
50298
50337
  }
50299
50338
  try {
50300
- (0, import_node_child_process11.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
50339
+ (0, import_node_child_process10.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
50301
50340
  return tunnelId;
50302
50341
  } catch (err) {
50303
50342
  throw new Error(
@@ -50309,13 +50348,13 @@ ${lines.join("")}`
50309
50348
  ensureTunnelPort(tunnelId, localPort) {
50310
50349
  const ports = this.listTunnelPorts(tunnelId);
50311
50350
  for (const stalePort of ports.filter((p) => p !== localPort)) {
50312
- (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
50351
+ (0, import_node_child_process10.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
50313
50352
  }
50314
50353
  if (ports.includes(localPort)) {
50315
50354
  return;
50316
50355
  }
50317
50356
  try {
50318
- (0, import_node_child_process11.execFileSync)(
50357
+ (0, import_node_child_process10.execFileSync)(
50319
50358
  "devtunnel",
50320
50359
  ["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
50321
50360
  { stdio: "pipe" }
@@ -50331,7 +50370,7 @@ ${lines.join("")}`
50331
50370
  }
50332
50371
  listTunnelPorts(tunnelId) {
50333
50372
  try {
50334
- const output = (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
50373
+ const output = (0, import_node_child_process10.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
50335
50374
  const parsed = JSON.parse(output.toString());
50336
50375
  const items = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" && Array.isArray(parsed.ports) ? parsed.ports : parsed && typeof parsed === "object" && Array.isArray(parsed.value) ? parsed.value : [];
50337
50376
  return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
@@ -50343,7 +50382,7 @@ ${lines.join("")}`
50343
50382
  }
50344
50383
  hasTunnelPort(tunnelId, localPort) {
50345
50384
  try {
50346
- (0, import_node_child_process11.execFileSync)(
50385
+ (0, import_node_child_process10.execFileSync)(
50347
50386
  "devtunnel",
50348
50387
  ["port", "show", tunnelId, "-p", String(localPort), "-j"],
50349
50388
  { stdio: "pipe" }
@@ -50447,10 +50486,10 @@ var terminalWriter = {
50447
50486
  };
50448
50487
 
50449
50488
  // src/startup.ts
50450
- var fs20 = __toESM(require("fs"), 1);
50489
+ var fs21 = __toESM(require("fs"), 1);
50451
50490
  var path21 = __toESM(require("path"), 1);
50452
50491
  var readline = __toESM(require("readline/promises"), 1);
50453
- var import_node_child_process12 = require("child_process");
50492
+ var import_node_child_process11 = require("child_process");
50454
50493
  function getDefaultNodeName() {
50455
50494
  return getDeviceNodeName();
50456
50495
  }
@@ -50496,7 +50535,7 @@ function createPromptSession(prompt) {
50496
50535
  }
50497
50536
  function createDefaultCommandRunner(platform2) {
50498
50537
  return (command, args, interactive = false) => {
50499
- const result = (0, import_node_child_process12.spawnSync)(command, args, {
50538
+ const result = (0, import_node_child_process11.spawnSync)(command, args, {
50500
50539
  encoding: "utf-8",
50501
50540
  shell: platform2 === "win32",
50502
50541
  stdio: interactive ? "inherit" : "pipe"
@@ -50515,15 +50554,15 @@ function getNodeMetadataPath2(storagePath) {
50515
50554
  }
50516
50555
  function readStartupMetadataFile(storagePath) {
50517
50556
  try {
50518
- const raw = JSON.parse(fs20.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
50557
+ const raw = JSON.parse(fs21.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
50519
50558
  return typeof raw === "object" && raw !== null ? raw : {};
50520
50559
  } catch {
50521
50560
  return {};
50522
50561
  }
50523
50562
  }
50524
50563
  function writeStartupMetadataFile(storagePath, metadata) {
50525
- fs20.mkdirSync(storagePath, { recursive: true });
50526
- fs20.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
50564
+ fs21.mkdirSync(storagePath, { recursive: true });
50565
+ fs21.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
50527
50566
  }
50528
50567
  function formatLocalDate2(now) {
50529
50568
  const year = now.getFullYear();
@@ -50764,7 +50803,7 @@ async function ensureStartupRequirements(storagePath, options = {}) {
50764
50803
  }
50765
50804
  function loadConfigFile(path23) {
50766
50805
  try {
50767
- const raw = fs20.readFileSync(path23, "utf-8");
50806
+ const raw = fs21.readFileSync(path23, "utf-8");
50768
50807
  return JSON.parse(raw);
50769
50808
  } catch {
50770
50809
  return {};
@@ -50942,9 +50981,9 @@ function formatLoadedStartMetadata(info, authEnabled) {
50942
50981
  }
50943
50982
 
50944
50983
  // src/runtime-metadata.ts
50945
- var fs21 = __toESM(require("fs"), 1);
50984
+ var fs22 = __toESM(require("fs"), 1);
50946
50985
  var path22 = __toESM(require("path"), 1);
50947
- var import_node_child_process13 = require("child_process");
50986
+ var import_node_child_process12 = require("child_process");
50948
50987
  var runtimeDir = resolveRuntimeDir();
50949
50988
  var appRoot = resolveAppRoot(runtimeDir);
50950
50989
  var repoRoot = path22.resolve(appRoot, "../..");
@@ -50952,7 +50991,7 @@ function resolveRuntimeDir() {
50952
50991
  const entryPath = process.argv[1];
50953
50992
  if (typeof entryPath === "string" && entryPath.length > 0) {
50954
50993
  try {
50955
- return path22.dirname(fs21.realpathSync(path22.resolve(entryPath)));
50994
+ return path22.dirname(fs22.realpathSync(path22.resolve(entryPath)));
50956
50995
  } catch {
50957
50996
  return path22.dirname(path22.resolve(entryPath));
50958
50997
  }
@@ -50961,7 +51000,7 @@ function resolveRuntimeDir() {
50961
51000
  }
50962
51001
  function readJsonFile(filePath) {
50963
51002
  try {
50964
- return JSON.parse(fs21.readFileSync(filePath, "utf-8"));
51003
+ return JSON.parse(fs22.readFileSync(filePath, "utf-8"));
50965
51004
  } catch {
50966
51005
  return null;
50967
51006
  }
@@ -50998,7 +51037,7 @@ function resolveAppRoot(baseDir) {
50998
51037
  }
50999
51038
  }
51000
51039
  for (const candidate of candidates) {
51001
- if (fs21.existsSync(path22.join(candidate, "package.json"))) {
51040
+ if (fs22.existsSync(path22.join(candidate, "package.json"))) {
51002
51041
  return candidate;
51003
51042
  }
51004
51043
  }
@@ -51040,7 +51079,7 @@ function readRepositoryUrlFromManifest(manifest) {
51040
51079
  }
51041
51080
  function readGitValue(args) {
51042
51081
  try {
51043
- const output = (0, import_node_child_process13.execFileSync)("git", args, {
51082
+ const output = (0, import_node_child_process12.execFileSync)("git", args, {
51044
51083
  cwd: repoRoot,
51045
51084
  encoding: "utf-8",
51046
51085
  stdio: ["ignore", "pipe", "ignore"],
@@ -51086,9 +51125,9 @@ function buildRuntimeMetadata(storagePath) {
51086
51125
  }
51087
51126
 
51088
51127
  // src/bootstrap/runtime-restart.ts
51089
- var fs22 = __toESM(require("fs"), 1);
51128
+ var fs23 = __toESM(require("fs"), 1);
51090
51129
  var nodePath2 = __toESM(require("path"), 1);
51091
- var import_node_child_process14 = require("child_process");
51130
+ var import_node_child_process13 = require("child_process");
51092
51131
  function resolveRuntimeRestartStartArgs(hydratedArgs, restartArgs) {
51093
51132
  return restartArgs ? { ...restartArgs } : hydratedArgs;
51094
51133
  }
@@ -51202,7 +51241,7 @@ function compareSemver2(left, right) {
51202
51241
  return 0;
51203
51242
  }
51204
51243
  function runRuntimePackageCommand(command, args) {
51205
- const result = (0, import_node_child_process14.spawnSync)(command, args, {
51244
+ const result = (0, import_node_child_process13.spawnSync)(command, args, {
51206
51245
  encoding: "utf-8",
51207
51246
  windowsHide: true,
51208
51247
  timeout: 2500
@@ -51241,7 +51280,7 @@ function createSpawnableCommand(command, args, platform2) {
51241
51280
  }
51242
51281
  function readProcessCommand(pid, platform2) {
51243
51282
  if (platform2 === "win32") return null;
51244
- const result = (0, import_node_child_process14.spawnSync)("ps", ["-p", String(pid), "-o", "args="], {
51283
+ const result = (0, import_node_child_process13.spawnSync)("ps", ["-p", String(pid), "-o", "args="], {
51245
51284
  encoding: "utf-8",
51246
51285
  windowsHide: true,
51247
51286
  timeout: 1e3
@@ -51332,9 +51371,9 @@ function createRuntimeRestartLaunchPlan(options) {
51332
51371
  };
51333
51372
  }
51334
51373
  function scheduleRuntimeRestart(plan, options = {}) {
51335
- fs22.mkdirSync(nodePath2.dirname(plan.logPath), { recursive: true });
51336
- const logFd = fs22.openSync(plan.logPath, "a");
51337
- const spawnImpl = options.spawnImpl ?? import_node_child_process14.spawn;
51374
+ fs23.mkdirSync(nodePath2.dirname(plan.logPath), { recursive: true });
51375
+ const logFd = fs23.openSync(plan.logPath, "a");
51376
+ const spawnImpl = options.spawnImpl ?? import_node_child_process13.spawn;
51338
51377
  const env = {
51339
51378
  ...process.env,
51340
51379
  MESHY_RESTART_PARENT_PID: String(options.parentPid ?? process.pid),