@taptap/maker 0.0.34-beta.4 → 0.0.34-beta.5

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/dist/maker.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // TapTap Maker MCP - Standalone Bundle
3
- // TapTap Maker MCP version: 0.0.34-beta.4
3
+ // TapTap Maker MCP version: 0.0.34-beta.5
4
4
  import { createRequire } from 'node:module';
5
5
  const require = createRequire(import.meta.url);
6
6
  const __MAKER_BUNDLE_URL__ = import.meta.url;
@@ -449,8 +449,8 @@ var init_parseUtil = __esm({
449
449
  init_errors();
450
450
  init_en();
451
451
  makeIssue = (params) => {
452
- const { data, path: path55, errorMaps, issueData } = params;
453
- const fullPath = [...path55, ...issueData.path || []];
452
+ const { data, path: path56, errorMaps, issueData } = params;
453
+ const fullPath = [...path56, ...issueData.path || []];
454
454
  const fullIssue = {
455
455
  ...issueData,
456
456
  path: fullPath
@@ -730,11 +730,11 @@ var init_types = __esm({
730
730
  init_parseUtil();
731
731
  init_util();
732
732
  ParseInputLazyPath = class {
733
- constructor(parent, value, path55, key) {
733
+ constructor(parent, value, path56, key) {
734
734
  this._cachedPath = [];
735
735
  this.parent = parent;
736
736
  this.data = value;
737
- this._path = path55;
737
+ this._path = path56;
738
738
  this._key = key;
739
739
  }
740
740
  get path() {
@@ -4243,10 +4243,10 @@ function mergeDefs(...defs) {
4243
4243
  function cloneDef(schema) {
4244
4244
  return mergeDefs(schema._zod.def);
4245
4245
  }
4246
- function getElementAtPath(obj, path55) {
4247
- if (!path55)
4246
+ function getElementAtPath(obj, path56) {
4247
+ if (!path56)
4248
4248
  return obj;
4249
- return path55.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
4249
+ return path56.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
4250
4250
  }
4251
4251
  function promiseAllObject(promisesObj) {
4252
4252
  const keys = Object.keys(promisesObj);
@@ -4559,11 +4559,11 @@ function aborted(x, startIndex = 0) {
4559
4559
  }
4560
4560
  return false;
4561
4561
  }
4562
- function prefixIssues(path55, issues) {
4562
+ function prefixIssues(path56, issues) {
4563
4563
  return issues.map((iss) => {
4564
4564
  var _a3;
4565
4565
  (_a3 = iss).path ?? (_a3.path = []);
4566
- iss.path.unshift(path55);
4566
+ iss.path.unshift(path56);
4567
4567
  return iss;
4568
4568
  });
4569
4569
  }
@@ -17726,8 +17726,8 @@ var require_utils = __commonJS({
17726
17726
  }
17727
17727
  return ind;
17728
17728
  }
17729
- function removeDotSegments(path55) {
17730
- let input2 = path55;
17729
+ function removeDotSegments(path56) {
17730
+ let input2 = path56;
17731
17731
  const output2 = [];
17732
17732
  let nextSlash = -1;
17733
17733
  let len = 0;
@@ -17926,8 +17926,8 @@ var require_schemes = __commonJS({
17926
17926
  wsComponent.secure = void 0;
17927
17927
  }
17928
17928
  if (wsComponent.resourceName) {
17929
- const [path55, query] = wsComponent.resourceName.split("?");
17930
- wsComponent.path = path55 && path55 !== "/" ? path55 : void 0;
17929
+ const [path56, query] = wsComponent.resourceName.split("?");
17930
+ wsComponent.path = path56 && path56 !== "/" ? path56 : void 0;
17931
17931
  wsComponent.query = query;
17932
17932
  wsComponent.resourceName = void 0;
17933
17933
  }
@@ -26984,12 +26984,12 @@ var require_dist = __commonJS({
26984
26984
  throw new Error(`Unknown format "${name}"`);
26985
26985
  return f;
26986
26986
  };
26987
- function addFormats(ajv, list, fs52, exportName) {
26987
+ function addFormats(ajv, list, fs53, exportName) {
26988
26988
  var _a3;
26989
26989
  var _b;
26990
26990
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
26991
26991
  for (const f of list)
26992
- ajv.addFormat(f, fs52[f]);
26992
+ ajv.addFormat(f, fs53[f]);
26993
26993
  }
26994
26994
  module.exports = exports = formatsPlugin;
26995
26995
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -28546,8 +28546,8 @@ var require_windows = __commonJS({
28546
28546
  "node_modules/isexe/windows.js"(exports, module) {
28547
28547
  module.exports = isexe;
28548
28548
  isexe.sync = sync;
28549
- var fs52 = __require("fs");
28550
- function checkPathExt(path55, options3) {
28549
+ var fs53 = __require("fs");
28550
+ function checkPathExt(path56, options3) {
28551
28551
  var pathext = options3.pathExt !== void 0 ? options3.pathExt : process.env.PATHEXT;
28552
28552
  if (!pathext) {
28553
28553
  return true;
@@ -28558,25 +28558,25 @@ var require_windows = __commonJS({
28558
28558
  }
28559
28559
  for (var i = 0; i < pathext.length; i++) {
28560
28560
  var p = pathext[i].toLowerCase();
28561
- if (p && path55.substr(-p.length).toLowerCase() === p) {
28561
+ if (p && path56.substr(-p.length).toLowerCase() === p) {
28562
28562
  return true;
28563
28563
  }
28564
28564
  }
28565
28565
  return false;
28566
28566
  }
28567
- function checkStat(stat, path55, options3) {
28567
+ function checkStat(stat, path56, options3) {
28568
28568
  if (!stat.isSymbolicLink() && !stat.isFile()) {
28569
28569
  return false;
28570
28570
  }
28571
- return checkPathExt(path55, options3);
28571
+ return checkPathExt(path56, options3);
28572
28572
  }
28573
- function isexe(path55, options3, cb) {
28574
- fs52.stat(path55, function(er, stat) {
28575
- cb(er, er ? false : checkStat(stat, path55, options3));
28573
+ function isexe(path56, options3, cb) {
28574
+ fs53.stat(path56, function(er, stat) {
28575
+ cb(er, er ? false : checkStat(stat, path56, options3));
28576
28576
  });
28577
28577
  }
28578
- function sync(path55, options3) {
28579
- return checkStat(fs52.statSync(path55), path55, options3);
28578
+ function sync(path56, options3) {
28579
+ return checkStat(fs53.statSync(path56), path56, options3);
28580
28580
  }
28581
28581
  }
28582
28582
  });
@@ -28586,14 +28586,14 @@ var require_mode = __commonJS({
28586
28586
  "node_modules/isexe/mode.js"(exports, module) {
28587
28587
  module.exports = isexe;
28588
28588
  isexe.sync = sync;
28589
- var fs52 = __require("fs");
28590
- function isexe(path55, options3, cb) {
28591
- fs52.stat(path55, function(er, stat) {
28589
+ var fs53 = __require("fs");
28590
+ function isexe(path56, options3, cb) {
28591
+ fs53.stat(path56, function(er, stat) {
28592
28592
  cb(er, er ? false : checkStat(stat, options3));
28593
28593
  });
28594
28594
  }
28595
- function sync(path55, options3) {
28596
- return checkStat(fs52.statSync(path55), options3);
28595
+ function sync(path56, options3) {
28596
+ return checkStat(fs53.statSync(path56), options3);
28597
28597
  }
28598
28598
  function checkStat(stat, options3) {
28599
28599
  return stat.isFile() && checkMode(stat, options3);
@@ -28617,7 +28617,7 @@ var require_mode = __commonJS({
28617
28617
  // node_modules/isexe/index.js
28618
28618
  var require_isexe = __commonJS({
28619
28619
  "node_modules/isexe/index.js"(exports, module) {
28620
- var fs52 = __require("fs");
28620
+ var fs53 = __require("fs");
28621
28621
  var core;
28622
28622
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
28623
28623
  core = require_windows();
@@ -28626,7 +28626,7 @@ var require_isexe = __commonJS({
28626
28626
  }
28627
28627
  module.exports = isexe;
28628
28628
  isexe.sync = sync;
28629
- function isexe(path55, options3, cb) {
28629
+ function isexe(path56, options3, cb) {
28630
28630
  if (typeof options3 === "function") {
28631
28631
  cb = options3;
28632
28632
  options3 = {};
@@ -28636,7 +28636,7 @@ var require_isexe = __commonJS({
28636
28636
  throw new TypeError("callback not provided");
28637
28637
  }
28638
28638
  return new Promise(function(resolve, reject) {
28639
- isexe(path55, options3 || {}, function(er, is) {
28639
+ isexe(path56, options3 || {}, function(er, is) {
28640
28640
  if (er) {
28641
28641
  reject(er);
28642
28642
  } else {
@@ -28645,7 +28645,7 @@ var require_isexe = __commonJS({
28645
28645
  });
28646
28646
  });
28647
28647
  }
28648
- core(path55, options3 || {}, function(er, is) {
28648
+ core(path56, options3 || {}, function(er, is) {
28649
28649
  if (er) {
28650
28650
  if (er.code === "EACCES" || options3 && options3.ignoreErrors) {
28651
28651
  er = null;
@@ -28655,9 +28655,9 @@ var require_isexe = __commonJS({
28655
28655
  cb(er, is);
28656
28656
  });
28657
28657
  }
28658
- function sync(path55, options3) {
28658
+ function sync(path56, options3) {
28659
28659
  try {
28660
- return core.sync(path55, options3 || {});
28660
+ return core.sync(path56, options3 || {});
28661
28661
  } catch (er) {
28662
28662
  if (options3 && options3.ignoreErrors || er.code === "EACCES") {
28663
28663
  return false;
@@ -28673,7 +28673,7 @@ var require_isexe = __commonJS({
28673
28673
  var require_which = __commonJS({
28674
28674
  "node_modules/which/which.js"(exports, module) {
28675
28675
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
28676
- var path55 = __require("path");
28676
+ var path56 = __require("path");
28677
28677
  var COLON = isWindows ? ";" : ":";
28678
28678
  var isexe = require_isexe();
28679
28679
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -28711,7 +28711,7 @@ var require_which = __commonJS({
28711
28711
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
28712
28712
  const ppRaw = pathEnv[i];
28713
28713
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
28714
- const pCmd = path55.join(pathPart, cmd);
28714
+ const pCmd = path56.join(pathPart, cmd);
28715
28715
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
28716
28716
  resolve(subStep(p, i, 0));
28717
28717
  });
@@ -28738,7 +28738,7 @@ var require_which = __commonJS({
28738
28738
  for (let i = 0; i < pathEnv.length; i++) {
28739
28739
  const ppRaw = pathEnv[i];
28740
28740
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
28741
- const pCmd = path55.join(pathPart, cmd);
28741
+ const pCmd = path56.join(pathPart, cmd);
28742
28742
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
28743
28743
  for (let j = 0; j < pathExt.length; j++) {
28744
28744
  const cur = p + pathExt[j];
@@ -28786,7 +28786,7 @@ var require_path_key = __commonJS({
28786
28786
  var require_resolveCommand = __commonJS({
28787
28787
  "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
28788
28788
  "use strict";
28789
- var path55 = __require("path");
28789
+ var path56 = __require("path");
28790
28790
  var which = require_which();
28791
28791
  var getPathKey = require_path_key();
28792
28792
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -28804,7 +28804,7 @@ var require_resolveCommand = __commonJS({
28804
28804
  try {
28805
28805
  resolved = which.sync(parsed.command, {
28806
28806
  path: env[getPathKey({ env })],
28807
- pathExt: withoutPathExt ? path55.delimiter : void 0
28807
+ pathExt: withoutPathExt ? path56.delimiter : void 0
28808
28808
  });
28809
28809
  } catch (e) {
28810
28810
  } finally {
@@ -28813,7 +28813,7 @@ var require_resolveCommand = __commonJS({
28813
28813
  }
28814
28814
  }
28815
28815
  if (resolved) {
28816
- resolved = path55.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
28816
+ resolved = path56.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
28817
28817
  }
28818
28818
  return resolved;
28819
28819
  }
@@ -28867,8 +28867,8 @@ var require_shebang_command = __commonJS({
28867
28867
  if (!match) {
28868
28868
  return null;
28869
28869
  }
28870
- const [path55, argument] = match[0].replace(/#! ?/, "").split(" ");
28871
- const binary = path55.split("/").pop();
28870
+ const [path56, argument] = match[0].replace(/#! ?/, "").split(" ");
28871
+ const binary = path56.split("/").pop();
28872
28872
  if (binary === "env") {
28873
28873
  return argument;
28874
28874
  }
@@ -28881,16 +28881,16 @@ var require_shebang_command = __commonJS({
28881
28881
  var require_readShebang = __commonJS({
28882
28882
  "node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
28883
28883
  "use strict";
28884
- var fs52 = __require("fs");
28884
+ var fs53 = __require("fs");
28885
28885
  var shebangCommand = require_shebang_command();
28886
28886
  function readShebang(command) {
28887
28887
  const size = 150;
28888
28888
  const buffer = Buffer.alloc(size);
28889
28889
  let fd;
28890
28890
  try {
28891
- fd = fs52.openSync(command, "r");
28892
- fs52.readSync(fd, buffer, 0, size, 0);
28893
- fs52.closeSync(fd);
28891
+ fd = fs53.openSync(command, "r");
28892
+ fs53.readSync(fd, buffer, 0, size, 0);
28893
+ fs53.closeSync(fd);
28894
28894
  } catch (e) {
28895
28895
  }
28896
28896
  return shebangCommand(buffer.toString());
@@ -28903,7 +28903,7 @@ var require_readShebang = __commonJS({
28903
28903
  var require_parse = __commonJS({
28904
28904
  "node_modules/cross-spawn/lib/parse.js"(exports, module) {
28905
28905
  "use strict";
28906
- var path55 = __require("path");
28906
+ var path56 = __require("path");
28907
28907
  var resolveCommand = require_resolveCommand();
28908
28908
  var escape3 = require_escape();
28909
28909
  var readShebang = require_readShebang();
@@ -28928,7 +28928,7 @@ var require_parse = __commonJS({
28928
28928
  const needsShell = !isExecutableRegExp.test(commandFile);
28929
28929
  if (parsed.options.forceShell || needsShell) {
28930
28930
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
28931
- parsed.command = path55.normalize(parsed.command);
28931
+ parsed.command = path56.normalize(parsed.command);
28932
28932
  parsed.command = escape3.command(parsed.command);
28933
28933
  parsed.args = parsed.args.map((arg) => escape3.argument(arg, needsDoubleEscapeMetaChars));
28934
28934
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -30627,7 +30627,7 @@ function createMakerAgentsPolicyBody() {
30627
30627
  " `mcp report --ide <client> --target-dir <project> --context-stdin --consent --json`.",
30628
30628
  "- This preserves the configured package version and the absolute Windows node.exe/npm-cli.js.",
30629
30629
  "- Only with a known exact installed version, fallback to",
30630
- " `npx -y --package @taptap/maker@0.0.34-beta.4 taptap-maker mcp report ...`.",
30630
+ " `npx -y --package @taptap/maker@0.0.34-beta.5 taptap-maker mcp report ...`.",
30631
30631
  "- Never use an unversioned npm package, or assume `taptap-maker`/`npx` is globally available.",
30632
30632
  "- Never include the complete conversation, project source, other MCP server entries, PAT/token",
30633
30633
  " values, or full environment variables. Normalize the user home path to `~`.",
@@ -39355,7 +39355,7 @@ var init_tracking = __esm({
39355
39355
  MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
39356
39356
  MAKER_MCP_TRACKING_SOURCE = "local_mcp";
39357
39357
  MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
39358
- MAKER_MCP_VERSION = "0.0.34-beta.4".trim() ? "0.0.34-beta.4".trim() : "dev";
39358
+ MAKER_MCP_VERSION = "0.0.34-beta.5".trim() ? "0.0.34-beta.5".trim() : "dev";
39359
39359
  TRACKING_ERROR_MAX_LENGTH = 500;
39360
39360
  }
39361
39361
  });
@@ -42667,7 +42667,7 @@ var init_mcp = __esm({
42667
42667
  init_remoteProxyManager();
42668
42668
  init_proxyAssets();
42669
42669
  init_diagnosticRedaction();
42670
- VERSION = true ? "0.0.34-beta.4" : "dev";
42670
+ VERSION = true ? "0.0.34-beta.5" : "dev";
42671
42671
  DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
42672
42672
  DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
42673
42673
  DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -42954,7 +42954,7 @@ function readPreviewRecord(project) {
42954
42954
  const filename2 = path24.join(previewDirectory(project), "session.json");
42955
42955
  if (!fs23.existsSync(filename2)) return void 0;
42956
42956
  const record2 = JSON.parse(fs23.readFileSync(filename2, "utf8"));
42957
- if (record2.project_realpath !== project || record2.protocol_version !== PREVIEW_PROTOCOL_VERSION || !/^[a-f0-9]{64}$/.test(record2.token) || !Number.isInteger(record2.port) || record2.port < 0 || record2.port > 65535 || !Number.isInteger(record2.supervisor_pid) || record2.supervisor_pid < 0 || record2.runtime_pid !== void 0 && (!Number.isInteger(record2.runtime_pid) || record2.runtime_pid < 0) || !/^[0-9a-f-]{36}$/.test(record2.session_id) || !record2.supervisor_id || !Number.isSafeInteger(record2.reload_id) || record2.reload_id < 0 || !record2.started_at || record2.launch_deadline !== void 0 && (!Number.isSafeInteger(record2.launch_deadline) || record2.launch_deadline <= 0) || !path24.isAbsolute(record2.executable)) {
42957
+ if (record2.project_realpath !== project || record2.protocol_version !== PREVIEW_PROTOCOL_VERSION || !/^[a-f0-9]{64}$/.test(record2.token) || !Number.isInteger(record2.port) || record2.port < 0 || record2.port > 65535 || !Number.isInteger(record2.supervisor_pid) || record2.supervisor_pid < 0 || record2.runtime_pid !== void 0 && (!Number.isInteger(record2.runtime_pid) || record2.runtime_pid < 0) || record2.runtime_launch_pending !== void 0 && typeof record2.runtime_launch_pending !== "boolean" || !/^[0-9a-f-]{36}$/.test(record2.session_id) || !record2.supervisor_id || !Number.isSafeInteger(record2.reload_id) || record2.reload_id < 0 || !record2.started_at || record2.launch_deadline !== void 0 && (!Number.isSafeInteger(record2.launch_deadline) || record2.launch_deadline <= 0) || !path24.isAbsolute(record2.executable)) {
42958
42958
  throw new Error("Invalid preview session record; refusing to manage an unverified process.");
42959
42959
  }
42960
42960
  return record2;
@@ -49755,17 +49755,17 @@ var require_codegen3 = __commonJS({
49755
49755
  var require_fs = __commonJS({
49756
49756
  "node_modules/protobufjs/src/util/fs.js"(exports, module) {
49757
49757
  "use strict";
49758
- var fs52 = null;
49758
+ var fs53 = null;
49759
49759
  try {
49760
- fs52 = __require(
49760
+ fs53 = __require(
49761
49761
  /* webpackIgnore: true */
49762
49762
  "fs"
49763
49763
  );
49764
- if (!fs52 || !fs52.readFile || !fs52.readFileSync)
49765
- fs52 = null;
49764
+ if (!fs53 || !fs53.readFile || !fs53.readFileSync)
49765
+ fs53 = null;
49766
49766
  } catch (e) {
49767
49767
  }
49768
- module.exports = fs52;
49768
+ module.exports = fs53;
49769
49769
  }
49770
49770
  });
49771
49771
 
@@ -49775,7 +49775,7 @@ var require_fetch = __commonJS({
49775
49775
  "use strict";
49776
49776
  module.exports = fetch2;
49777
49777
  var asPromise = require_aspromise();
49778
- var fs52 = require_fs();
49778
+ var fs53 = require_fs();
49779
49779
  function fetch2(filename2, options3, callback) {
49780
49780
  if (typeof options3 === "function") {
49781
49781
  callback = options3;
@@ -49784,8 +49784,8 @@ var require_fetch = __commonJS({
49784
49784
  options3 = {};
49785
49785
  if (!callback)
49786
49786
  return asPromise(fetch2, this, filename2, options3);
49787
- if (!options3.xhr && fs52 && fs52.readFile)
49788
- return fs52.readFile(filename2, function fetchReadFileCallback(err, contents) {
49787
+ if (!options3.xhr && fs53 && fs53.readFile)
49788
+ return fs53.readFile(filename2, function fetchReadFileCallback(err, contents) {
49789
49789
  return err && typeof XMLHttpRequest !== "undefined" ? fetch2.xhr(filename2, options3, callback) : err ? callback(err) : callback(null, options3.binary ? contents : contents.toString("utf8"));
49790
49790
  });
49791
49791
  return fetch2.xhr(filename2, options3, callback);
@@ -49823,13 +49823,13 @@ var require_fetch = __commonJS({
49823
49823
  var require_path = __commonJS({
49824
49824
  "node_modules/protobufjs/src/util/path.js"(exports) {
49825
49825
  "use strict";
49826
- var path55 = exports;
49826
+ var path56 = exports;
49827
49827
  var urlRe = /^[a-zA-Z][a-zA-Z0-9+.-]+:\/\//;
49828
- function normalizeUrl(path56) {
49829
- if (typeof URL === "undefined" || !urlRe.test(path56))
49828
+ function normalizeUrl(path57) {
49829
+ if (typeof URL === "undefined" || !urlRe.test(path57))
49830
49830
  return null;
49831
49831
  try {
49832
- return new URL(path56).href;
49832
+ return new URL(path57).href;
49833
49833
  } catch (e) {
49834
49834
  return null;
49835
49835
  }
@@ -49849,8 +49849,8 @@ var require_path = __commonJS({
49849
49849
  * @param {string} path Path to test
49850
49850
  * @returns {boolean} `true` if path is absolute
49851
49851
  */
49852
- path55.isAbsolute = function isAbsolute2(path56) {
49853
- return /^(?:\/|\w+:|\\\\\w+)/.test(path56);
49852
+ path56.isAbsolute = function isAbsolute2(path57) {
49853
+ return /^(?:\/|\w+:|\\\\\w+)/.test(path57);
49854
49854
  }
49855
49855
  );
49856
49856
  var normalize = (
@@ -49859,18 +49859,18 @@ var require_path = __commonJS({
49859
49859
  * @param {string} path Path to normalize
49860
49860
  * @returns {string} Normalized path
49861
49861
  */
49862
- path55.normalize = function normalize2(path56) {
49863
- var normalizedUrl = normalizeUrl(path56);
49862
+ path56.normalize = function normalize2(path57) {
49863
+ var normalizedUrl = normalizeUrl(path57);
49864
49864
  if (normalizedUrl)
49865
49865
  return normalizedUrl;
49866
- var firstTwoCharacters = path56.substring(0, 2);
49866
+ var firstTwoCharacters = path57.substring(0, 2);
49867
49867
  var uncPrefix = "";
49868
49868
  if (firstTwoCharacters === "\\\\") {
49869
49869
  uncPrefix = firstTwoCharacters;
49870
- path56 = path56.substring(2);
49870
+ path57 = path57.substring(2);
49871
49871
  }
49872
- path56 = path56.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
49873
- var parts = path56.split("/"), absolute = isAbsolute(path56), prefix = "";
49872
+ path57 = path57.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
49873
+ var parts = path57.split("/"), absolute = isAbsolute(path57), prefix = "";
49874
49874
  if (absolute)
49875
49875
  prefix = parts.shift() + "/";
49876
49876
  for (var i = 0; i < parts.length; ) {
@@ -49889,7 +49889,7 @@ var require_path = __commonJS({
49889
49889
  return uncPrefix + prefix + parts.join("/");
49890
49890
  }
49891
49891
  );
49892
- path55.resolve = function resolve(originPath, includePath, alreadyNormalized) {
49892
+ path56.resolve = function resolve(originPath, includePath, alreadyNormalized) {
49893
49893
  var resolvedUrl = resolveUrl(originPath, includePath);
49894
49894
  if (resolvedUrl)
49895
49895
  return resolvedUrl;
@@ -50062,18 +50062,18 @@ var require_namespace = __commonJS({
50062
50062
  object3.onRemove(this);
50063
50063
  return clearCache(this);
50064
50064
  };
50065
- Namespace.prototype.define = function define2(path55, json2) {
50066
- if (util2.isString(path55))
50067
- path55 = path55.split(".");
50068
- else if (!Array.isArray(path55))
50065
+ Namespace.prototype.define = function define2(path56, json2) {
50066
+ if (util2.isString(path56))
50067
+ path56 = path56.split(".");
50068
+ else if (!Array.isArray(path56))
50069
50069
  throw TypeError("illegal path");
50070
- if (path55 && path55.length && path55[0] === "")
50070
+ if (path56 && path56.length && path56[0] === "")
50071
50071
  throw Error("path must be relative");
50072
- if (path55.length > util2.recursionLimit)
50072
+ if (path56.length > util2.recursionLimit)
50073
50073
  throw Error("max depth exceeded");
50074
50074
  var ptr = this;
50075
- while (path55.length > 0) {
50076
- var part = path55.shift();
50075
+ while (path56.length > 0) {
50076
+ var part = path56.shift();
50077
50077
  if (ptr.nested && ptr.nested[part]) {
50078
50078
  ptr = ptr.nested[part];
50079
50079
  if (!(ptr instanceof Namespace))
@@ -50109,22 +50109,22 @@ var require_namespace = __commonJS({
50109
50109
  });
50110
50110
  return this;
50111
50111
  };
50112
- Namespace.prototype.lookup = function lookup(path55, filterTypes, parentAlreadyChecked) {
50112
+ Namespace.prototype.lookup = function lookup(path56, filterTypes, parentAlreadyChecked) {
50113
50113
  if (typeof filterTypes === "boolean") {
50114
50114
  parentAlreadyChecked = filterTypes;
50115
50115
  filterTypes = void 0;
50116
50116
  } else if (filterTypes && !Array.isArray(filterTypes))
50117
50117
  filterTypes = [filterTypes];
50118
- if (util2.isString(path55) && path55.length) {
50119
- if (path55 === ".")
50118
+ if (util2.isString(path56) && path56.length) {
50119
+ if (path56 === ".")
50120
50120
  return this.root;
50121
- path55 = path55.split(".");
50122
- } else if (!path55.length)
50121
+ path56 = path56.split(".");
50122
+ } else if (!path56.length)
50123
50123
  return this;
50124
- var flatPath = path55.join(".");
50125
- if (path55[0] === "")
50126
- return this.root.lookup(path55.slice(1), filterTypes);
50127
- var found = this._lookupImpl(path55, flatPath);
50124
+ var flatPath = path56.join(".");
50125
+ if (path56[0] === "")
50126
+ return this.root.lookup(path56.slice(1), filterTypes);
50127
+ var found = this._lookupImpl(path56, flatPath);
50128
50128
  if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
50129
50129
  return found;
50130
50130
  }
@@ -50136,7 +50136,7 @@ var require_namespace = __commonJS({
50136
50136
  return null;
50137
50137
  var current = this;
50138
50138
  while (current.parent) {
50139
- found = current.parent._lookupImpl(path55, flatPath);
50139
+ found = current.parent._lookupImpl(path56, flatPath);
50140
50140
  if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
50141
50141
  return found;
50142
50142
  }
@@ -50144,22 +50144,22 @@ var require_namespace = __commonJS({
50144
50144
  }
50145
50145
  return null;
50146
50146
  };
50147
- Namespace.prototype._lookupImpl = function lookup(path55, flatPath) {
50147
+ Namespace.prototype._lookupImpl = function lookup(path56, flatPath) {
50148
50148
  if (Object.prototype.hasOwnProperty.call(this._lookupCache, flatPath)) {
50149
50149
  return this._lookupCache[flatPath];
50150
50150
  }
50151
- var found = this.get(path55[0]);
50151
+ var found = this.get(path56[0]);
50152
50152
  var exact = null;
50153
50153
  if (found) {
50154
- if (path55.length === 1) {
50154
+ if (path56.length === 1) {
50155
50155
  exact = found;
50156
50156
  } else if (found instanceof Namespace) {
50157
- path55 = path55.slice(1);
50158
- exact = found._lookupImpl(path55, path55.join("."));
50157
+ path56 = path56.slice(1);
50158
+ exact = found._lookupImpl(path56, path56.join("."));
50159
50159
  }
50160
50160
  } else {
50161
50161
  for (var i = 0; i < this.nestedArray.length; ++i)
50162
- if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path55, flatPath))) {
50162
+ if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path56, flatPath))) {
50163
50163
  exact = found;
50164
50164
  break;
50165
50165
  }
@@ -50167,28 +50167,28 @@ var require_namespace = __commonJS({
50167
50167
  this._lookupCache[flatPath] = exact;
50168
50168
  return exact;
50169
50169
  };
50170
- Namespace.prototype.lookupType = function lookupType(path55) {
50171
- var found = this.lookup(path55, [Type]);
50170
+ Namespace.prototype.lookupType = function lookupType(path56) {
50171
+ var found = this.lookup(path56, [Type]);
50172
50172
  if (!found)
50173
- throw Error("no such type: " + path55);
50173
+ throw Error("no such type: " + path56);
50174
50174
  return found;
50175
50175
  };
50176
- Namespace.prototype.lookupEnum = function lookupEnum(path55) {
50177
- var found = this.lookup(path55, [Enum]);
50176
+ Namespace.prototype.lookupEnum = function lookupEnum(path56) {
50177
+ var found = this.lookup(path56, [Enum]);
50178
50178
  if (!found)
50179
- throw Error("no such Enum '" + path55 + "' in " + this);
50179
+ throw Error("no such Enum '" + path56 + "' in " + this);
50180
50180
  return found;
50181
50181
  };
50182
- Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path55) {
50183
- var found = this.lookup(path55, [Type, Enum]);
50182
+ Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path56) {
50183
+ var found = this.lookup(path56, [Type, Enum]);
50184
50184
  if (!found)
50185
- throw Error("no such Type or Enum '" + path55 + "' in " + this);
50185
+ throw Error("no such Type or Enum '" + path56 + "' in " + this);
50186
50186
  return found;
50187
50187
  };
50188
- Namespace.prototype.lookupService = function lookupService(path55) {
50189
- var found = this.lookup(path55, [Service]);
50188
+ Namespace.prototype.lookupService = function lookupService(path56) {
50189
+ var found = this.lookup(path56, [Service]);
50190
50190
  if (!found)
50191
- throw Error("no such Service '" + path55 + "' in " + this);
50191
+ throw Error("no such Service '" + path56 + "' in " + this);
50192
50192
  return found;
50193
50193
  };
50194
50194
  Namespace._configure = function(Type_, Service_, Enum_) {
@@ -51805,13 +51805,13 @@ var require_util3 = __commonJS({
51805
51805
  Object.defineProperty(object3, "$type", { value: enm, enumerable: false });
51806
51806
  return enm;
51807
51807
  };
51808
- util2.setProperty = function setProperty(dst, path55, value, ifNotSet) {
51809
- function setProp(dst2, path56, value2) {
51810
- var part = path56.shift();
51808
+ util2.setProperty = function setProperty(dst, path56, value, ifNotSet) {
51809
+ function setProp(dst2, path57, value2) {
51810
+ var part = path57.shift();
51811
51811
  if (util2.isUnsafeProperty(part))
51812
51812
  return dst2;
51813
- if (path56.length > 0) {
51814
- dst2[part] = setProp(dst2[part] || {}, path56, value2);
51813
+ if (path57.length > 0) {
51814
+ dst2[part] = setProp(dst2[part] || {}, path57, value2);
51815
51815
  } else {
51816
51816
  var prevValue = dst2[part];
51817
51817
  if (prevValue && ifNotSet)
@@ -51824,12 +51824,12 @@ var require_util3 = __commonJS({
51824
51824
  }
51825
51825
  if (typeof dst !== "object")
51826
51826
  throw TypeError("dst must be an object");
51827
- if (!path55)
51827
+ if (!path56)
51828
51828
  throw TypeError("path must be specified");
51829
- path55 = path55.split(".");
51830
- if (path55.length > util2.recursionLimit)
51829
+ path56 = path56.split(".");
51830
+ if (path56.length > util2.recursionLimit)
51831
51831
  throw Error("max depth exceeded");
51832
- return setProp(dst, path55, value);
51832
+ return setProp(dst, path56, value);
51833
51833
  };
51834
51834
  Object.defineProperty(util2, "decorateRoot", {
51835
51835
  get: function() {
@@ -52409,12 +52409,12 @@ var require_object = __commonJS({
52409
52409
  */
52410
52410
  fullName: {
52411
52411
  get: function() {
52412
- var path55 = [this.name], ptr = this.parent;
52412
+ var path56 = [this.name], ptr = this.parent;
52413
52413
  while (ptr) {
52414
- path55.unshift(ptr.name);
52414
+ path56.unshift(ptr.name);
52415
52415
  ptr = ptr.parent;
52416
52416
  }
52417
- return path55.join(".");
52417
+ return path56.join(".");
52418
52418
  }
52419
52419
  }
52420
52420
  });
@@ -54622,7 +54622,8 @@ function renderVersionPicker() {
54622
54622
  const managed = state.distribution && state.distribution !== 'standalone';
54623
54623
  const updating = updateSubmitting || state.update?.status === 'running';
54624
54624
  const newer = versionCatalog?.updateAvailable === true;
54625
- const label = updating ? '更新中…' : current + (managed ? '(插件管理)' : newer ? '(有新版本)' : '');
54625
+ const label = updating ? '更新中…' : versionQuery ? '检查版本中…' :
54626
+ current + (managed ? '(插件管理)' : newer ? '(有新版本)' : '');
54626
54627
  replace(picker,[]);
54627
54628
  const active = node('option',label); active.value = ''; picker.append(active);
54628
54629
  if (!managed) {
@@ -54674,6 +54675,7 @@ async function selectMakerVersion(event) {
54674
54675
  let detail = null;
54675
54676
  let preview = null;
54676
54677
  let previewError = '';
54678
+ let previewLoading = false;
54677
54679
  const logViews = new Map();
54678
54680
  function logView() {
54679
54681
  if (!logViews.has(selected)) logViews.set(selected,{tab:'build',runtime:'',loading:false,wrap:false,cleared:{}});
@@ -54710,6 +54712,20 @@ function consoleLogText() {
54710
54712
  return [output,details].filter(Boolean).join('\n\n') ||
54711
54713
  (view.tab === 'runtime' ? '点击刷新读取运行时日志' : snapshot.id ? '等待任务输出' : '暂无日志');
54712
54714
  }
54715
+ function logLineClass(line) {
54716
+ if (/(?:^|\b)(?:error|fatal|失败|错误|异常)(?:\b|$)/i.test(line)) return 'log-line log-error';
54717
+ if (/(?:^|\b)(?:warn(?:ing)?|警告|注意)(?:\b|$)/i.test(line)) return 'log-line log-warning';
54718
+ return 'log-line';
54719
+ }
54720
+ function renderLogLines(output) {
54721
+ const fragment = document.createDocumentFragment();
54722
+ const lines = String(output || '').split('\n');
54723
+ lines.forEach((line,index) => {
54724
+ fragment.append(node('span',line,logLineClass(line)));
54725
+ if (index < lines.length - 1) fragment.append(document.createTextNode('\n'));
54726
+ });
54727
+ return fragment;
54728
+ }
54713
54729
  function renderConsoleLogs() {
54714
54730
  const host = $('console-logs');
54715
54731
  if (!host) return;
@@ -54726,11 +54742,12 @@ function renderConsoleLogs() {
54726
54742
  const wrap = node('label','自动换行','theme');
54727
54743
  const checkbox = node('input'); checkbox.type = 'checkbox'; checkbox.checked = view.wrap;
54728
54744
  checkbox.addEventListener('change',() => { view.wrap = checkbox.checked; renderConsoleLogs(); }); wrap.append(checkbox);
54729
- actions.append(wrap,button('刷新',() => { if(view.tab === 'runtime') void loadLogs(); else void pollState().then(renderConsoleLogs).catch(e=>notify(e.message)); },{disabled:offline || view.loading}),
54730
- button('清理日志',clearConsoleLogs,{icon:'trash',disabled:view.loading}),
54731
- button('复制',async () => { try { await navigator.clipboard.writeText(consoleLogText()); announce('日志已复制'); } catch (_) { notify('复制失败,请手动选择日志复制'); } }));
54732
- toolbar.append(tabs,actions);
54733
- const output = node('pre',consoleLogText(),'console-log-output' + (view.wrap ? ' wrap' : ''));
54745
+ actions.append(wrap,button(view.loading ? '读取中' : '刷新',() => { if(view.tab === 'runtime') void loadLogs(); else void pollState().then(renderConsoleLogs).catch(e=>notify(e.message)); },{icon:'refresh',iconOnly:true,className:'icon-button',loading:view.loading,disabled:offline || view.loading}),
54746
+ button('清理日志',clearConsoleLogs,{icon:'trash',iconOnly:true,className:'icon-button',disabled:view.loading}),
54747
+ button('复制',async () => { try { await navigator.clipboard.writeText(consoleLogText()); announce('日志已复制'); } catch (_) { notify('复制失败,请手动选择日志复制'); } },{icon:'copy',iconOnly:true,className:'icon-button'}));
54748
+ toolbar.append(node('h2','日志'),actions);
54749
+ const output = node('pre',undefined,'console-log-output' + (view.wrap ? ' wrap' : ''));
54750
+ output.append(renderLogLines(consoleLogText()));
54734
54751
  output.id = 'console-log-output'; output.setAttribute('role','tabpanel'); output.tabIndex = 0;
54735
54752
  const previous = $('console-log-output');
54736
54753
  const top = previous?.scrollTop || 0, left = previous?.scrollLeft || 0;
@@ -54808,13 +54825,16 @@ function icon(name) {
54808
54825
  return svg;
54809
54826
  }
54810
54827
  function button(label, handler, options = {}) {
54811
- const b = node('button', options.iconOnly ? undefined : label, options.className);
54828
+ const b = node('button', options.iconOnly ? undefined : label,
54829
+ [options.className, options.loading ? 'is-loading' : ''].filter(Boolean).join(' '));
54812
54830
  b.type = 'button';
54813
- b.disabled = Boolean(options.disabled);
54831
+ b.disabled = Boolean(options.disabled || options.loading);
54814
54832
  b.title = label;
54815
54833
  b.setAttribute('aria-label', label);
54816
- if (options.icon) b.prepend(icon(options.icon));
54834
+ if (options.loading) b.prepend(node('span',undefined,'loading-spinner'));
54835
+ else if (options.icon) b.prepend(icon(options.icon));
54817
54836
  if (options.focus) b.dataset.focus = options.focus;
54837
+ if (options.loading) b.setAttribute('aria-busy','true');
54818
54838
  b.addEventListener('click', handler);
54819
54839
  return b;
54820
54840
  }
@@ -54884,6 +54904,10 @@ function tasksFor(key) {
54884
54904
  return Array.from(tasks.values()).sort((a,b) => String(b.startedAt).localeCompare(String(a.startedAt))).slice(0,10);
54885
54905
  }
54886
54906
  function busy(key = selected) { return pending.has(key) || tasksFor(key).some(t => t.status === 'running'); }
54907
+ function actionBusy(action, key = selected) {
54908
+ return pendingActions.get(key) === action ||
54909
+ tasksFor(key).some(task => task.action === action && task.status === 'running');
54910
+ }
54887
54911
  function selectionMatches(key, epoch) { return key === selected && epoch === selectionEpoch; }
54888
54912
  function notify(message, tone = 'error') {
54889
54913
  $('feedback-text').textContent = text(message);
@@ -54962,10 +54986,14 @@ function updateChrome() {
54962
54986
  }
54963
54987
  function headingActionButtons() {
54964
54988
  const actions = previewActions(preview);
54989
+ const previewBusy = actionBusy('preview.start') || actionBusy('preview.refresh') ||
54990
+ actionBusy('preview.install') || actionBusy('preview.stop');
54991
+ const qrcodeBusy = actionBusy('qrcode');
54965
54992
  const local = button('本地预览',() => {
54966
54993
  const action = previewActions(preview)[0];
54967
54994
  if (action) void runProjectAction(action);
54968
- },{className:'preview-button',icon:'monitor',disabled:offline || busy() || !actions.length,focus:'heading-preview'});
54995
+ },{className:'preview-button',icon:'monitor',loading:previewBusy,
54996
+ disabled:offline || busy() || !actions.length,focus:'heading-preview'});
54969
54997
  local.title = actions.length ? '本地预览 · ' + actionLabels[actions[0]] :
54970
54998
  '本地预览 · ' + (previewError || text(preview?.error,previewLabel()));
54971
54999
  const checking = pendingActions.get(selected) === 'lua-lsp.check' ||
@@ -54979,7 +55007,7 @@ function headingActionButtons() {
54979
55007
  build.setAttribute('aria-busy',String(presentation.active || checking));
54980
55008
  const primary = node('div',undefined,'actions heading-primary');
54981
55009
  primary.append(local,build,button('测试二维码',() => void runProjectAction('qrcode'),{
54982
- icon:'qrcode',disabled:offline || busy(),focus:'heading-qrcode'
55010
+ icon:'qrcode',loading:qrcodeBusy,disabled:offline || busy(),focus:'heading-qrcode'
54983
55011
  }));
54984
55012
  const secondary = node('div',undefined,'actions heading-secondary');
54985
55013
  secondary.append(luaCheckOption());
@@ -55472,8 +55500,9 @@ function explainQrcode(title, message) {
55472
55500
  }
55473
55501
  function showQrcode(task) {
55474
55502
  const source = qrcodeImageSource(task);
55475
- if (!source || task.projectKey !== selected || consoleDialogOpen()) return;
55476
- const dialog = $('qrcode-result'), image = $('qrcode-result-image'), status = $('qrcode-result-status');
55503
+ const dialog = $('qrcode-result');
55504
+ if (!source || task.projectKey !== selected || (consoleDialogOpen() && !dialog?.open)) return;
55505
+ const image = $('qrcode-result-image'), status = $('qrcode-result-status');
55477
55506
  const retry = $('qrcode-result-reload'), original = $('qrcode-result-original');
55478
55507
  $('qrcode-result-project').textContent = '项目:' + task.projectName;
55479
55508
  original.hidden = source.startsWith('data:');
@@ -55490,7 +55519,21 @@ function showQrcode(task) {
55490
55519
  image.src = source;
55491
55520
  };
55492
55521
  retry.onclick = loadImage;
55522
+ if (dialog.removeAttribute) dialog.removeAttribute('aria-busy');
55493
55523
  loadImage();
55524
+ if (!dialog.open) dialog.showModal();
55525
+ }
55526
+ function showQrcodeLoading(project) {
55527
+ const dialog = $('qrcode-result');
55528
+ if (!dialog || consoleDialogOpen()) return;
55529
+ $('qrcode-result-project').textContent = '项目:' + text(project?.name, '当前项目');
55530
+ $('qrcode-result-status').hidden = false;
55531
+ $('qrcode-result-status').textContent = '正在生成测试二维码,请稍候…';
55532
+ $('qrcode-result-status').className = 'pending';
55533
+ $('qrcode-result-image').hidden = true;
55534
+ $('qrcode-result-reload').hidden = true;
55535
+ $('qrcode-result-original').hidden = true;
55536
+ dialog.setAttribute('aria-busy','true');
55494
55537
  dialog.showModal();
55495
55538
  }
55496
55539
  const handledQrcodeTasks = new Set();
@@ -55499,10 +55542,21 @@ function handleQrcodeCompletion(task) {
55499
55542
  handledQrcodeTasks.has(task.id)) return;
55500
55543
  handledQrcodeTasks.add(task.id);
55501
55544
  while (handledQrcodeTasks.size > 100) handledQrcodeTasks.delete(handledQrcodeTasks.values().next().value);
55502
- if (consoleDialogOpen()) return;
55545
+ if (consoleDialogOpen() && !$('qrcode-result')?.open) return;
55503
55546
  if (task.status === 'succeeded') {
55504
55547
  if (qrcodeImageSource(task)) showQrcode(task);
55505
- else notify('二维码工具已返回,请在任务结果中查看链接。','warning');
55548
+ else {
55549
+ if ($('qrcode-result')?.open) {
55550
+ if ($('qrcode-result').removeAttribute) $('qrcode-result').removeAttribute('aria-busy');
55551
+ $('qrcode-result-status').hidden = false;
55552
+ $('qrcode-result-status').textContent = '二维码任务已完成,但未返回可显示的二维码图片,请查看任务结果。';
55553
+ $('qrcode-result-status').className = 'pending';
55554
+ }
55555
+ notify('二维码工具已返回,请在任务结果中查看链接。','warning');
55556
+ }
55557
+ } else if ($('qrcode-result')?.open) {
55558
+ $('qrcode-result').close();
55559
+ if ($('qrcode-result').removeAttribute) $('qrcode-result').removeAttribute('aria-busy');
55506
55560
  } else if (task.interaction?.kind === 'select_developer' && !busy(task.projectKey)) {
55507
55561
  void runAction('qrcode',{sourceTaskId:task.id});
55508
55562
  }
@@ -55757,7 +55811,8 @@ function updateBuild() {
55757
55811
  summary.append(node('span','Runtime · ' + (preview?.install_state === 'ready' ? '已安装' :
55758
55812
  preview?.install_state === 'missing' ? '未安装' : '待检测'),
55759
55813
  preview?.install_state === 'ready' ? 'good' : preview?.install_state === 'missing' ? 'pending' : 'muted'));
55760
- summary.append(node('span',previewError ? '检测失败' : previewInfo.stateLabel,previewInfo.tone));
55814
+ summary.append(node('span',previewLoading ? '检测中…' : previewError ? '检测失败' : previewInfo.stateLabel,
55815
+ previewLoading ? 'pending' : previewInfo.tone));
55761
55816
  if (previewInfo.errorCount) summary.append(node('span',previewInfo.errorCount + ' 条日志错误','bad'));
55762
55817
  const localChildren = [node('h2','本地预览'),summary];
55763
55818
  localChildren.push(renderWindowSettings());
@@ -55773,11 +55828,14 @@ function updateBuild() {
55773
55828
  }
55774
55829
  if (preview?.supported === false) localChildren.push(node('p','当前平台不支持本地预览','bad'));
55775
55830
  const actions = node('div',undefined,'actions preview-controls');
55776
- previewActions(preview).forEach(action => actions.append(button(actionLabels[action],() => void runAction(action),{
55777
- disabled:busy(),focus:action, ...(action === 'preview.refresh' ? {icon:'refresh'} : {})
55778
- })));
55779
- actions.append(button('检测预览状态',() => void refreshPreview(),{icon:'refresh',iconOnly:true,
55780
- className:'icon-button',focus:'preview-status'}));
55831
+ previewActions(preview).forEach(action => actions.append(button(
55832
+ actionBusy(action) ? actionLabels[action] + '中' : actionLabels[action],
55833
+ () => void runAction(action),{
55834
+ loading:actionBusy(action),disabled:offline || busy(),focus:action,
55835
+ ...(action === 'preview.refresh' ? {icon:'refresh'} : {})
55836
+ })));
55837
+ actions.append(button(previewLoading ? '检测中' : '检测预览状态',() => void refreshPreview(),{
55838
+ icon:'refresh',iconOnly:true,className:'icon-button',loading:previewLoading,focus:'preview-status'}));
55781
55839
  actions.append(button('查看运行日志',() => void loadLogs(),{focus:'preview-logs'}));
55782
55840
  localChildren.push(actions);
55783
55841
  replace($('preview-panel'),localChildren);
@@ -55790,6 +55848,8 @@ function updateBuild() {
55790
55848
  async function refreshPreview() {
55791
55849
  const key = selected, epoch = selectionEpoch;
55792
55850
  if (!key || !currentProject()?.valid) return;
55851
+ previewLoading = true;
55852
+ if (page === 'build') updateBuild();
55793
55853
  try {
55794
55854
  const result = await api(projectPath(key,'/preview'));
55795
55855
  if (!selectionMatches(key,epoch)) return;
@@ -55802,6 +55862,11 @@ async function refreshPreview() {
55802
55862
  preview = null; previewError = error.message;
55803
55863
  if (page === 'build') updateBuild();
55804
55864
  if (page === 'overview') renderOverview();
55865
+ } finally {
55866
+ if (selectionMatches(key,epoch)) {
55867
+ previewLoading = false;
55868
+ if (page === 'build') updateBuild();
55869
+ }
55805
55870
  }
55806
55871
  }
55807
55872
  async function loadLogs() {
@@ -55961,6 +56026,10 @@ async function runAction(action, options = {}) {
55961
56026
  const task = await api('/api/tasks',{method:'POST',body:{projectKey:key,action,...choice}});
55962
56027
  if (task.projectKey !== key) throw new Error('任务项目与请求不一致,请检查任务状态。');
55963
56028
  rememberTask(task);
56029
+ if (selectionMatches(key,epoch)) {
56030
+ if (task.status === 'running') showQrcodeLoading(project);
56031
+ else if (task.status === 'succeeded') handleQrcodeCompletion(task);
56032
+ }
55964
56033
  void pollTask(task.id,key,epoch);
55965
56034
  return;
55966
56035
  }
@@ -55983,11 +56052,14 @@ async function runAction(action, options = {}) {
55983
56052
  if (luaCheckBlocksBuild(check)) {
55984
56053
  if (selectionMatches(key,epoch)) {
55985
56054
  selectLog('lua');
55986
- notify(text(nestedResult(check)?.error || check?.error,'Lua 检查未通过,已停止构建。'));
56055
+ announce('Lua 检查未通过,已停止构建,请查看下方 Lua 检查日志。');
55987
56056
  }
55988
56057
  return;
55989
56058
  }
55990
- if (selectionMatches(key,epoch) && check?.status === 'failed') notify(text(check.error,'Lua 检查不可用,仍继续构建。'));
56059
+ if (selectionMatches(key,epoch) && check?.status === 'failed') {
56060
+ selectLog('lua');
56061
+ announce('Lua 检查不可用,已继续构建,请查看下方 Lua 检查日志。');
56062
+ }
55991
56063
  pendingActions.set(key,'build');
55992
56064
  updateChrome(); updateBuild();
55993
56065
  }
@@ -56346,8 +56418,10 @@ button.is-building:disabled{opacity:1;cursor:wait}
56346
56418
  .build-progress-label{font-size:12px;margin-top:6px;text-align:right}
56347
56419
  @keyframes build-spin{to{transform:rotate(360deg)}}
56348
56420
  @keyframes build-travel{from{transform:translateX(-100%)}to{transform:translateX(386%)}}
56421
+ .loading-spinner{display:inline-block;width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;flex:none}
56422
+ .is-loading{cursor:wait!important}
56349
56423
  @media(prefers-reduced-motion:no-preference){
56350
- .is-building .icon,.build-spinner{animation:build-spin 1.2s linear infinite}
56424
+ .is-building .icon,.build-spinner,.loading-spinner{animation:build-spin 1.2s linear infinite}
56351
56425
  .build-progress.indeterminate span{animation:build-travel 1.8s ease-in-out infinite}
56352
56426
  .build-progress.determinate span{transition:width .25s ease}
56353
56427
  }
@@ -56463,6 +56537,9 @@ pre{white-space:pre-wrap;tab-size:2;margin:10px 0 0;background:var(--code);paddi
56463
56537
  .console-log-toolbar [aria-selected="true"]{color:var(--accent);border-bottom:2px solid var(--accent)}
56464
56538
  .console-logs .console-log-output{height:360px;max-height:60vh;width:100%;max-width:100%;overflow:auto;white-space:pre;overflow-wrap:normal;word-break:normal;margin:0}
56465
56539
  .console-logs .console-log-output.wrap{white-space:pre-wrap;overflow-wrap:anywhere}
56540
+ .console-log-output .log-line{color:var(--text)}
56541
+ .console-log-output .log-error{color:var(--red)}
56542
+ .console-log-output .log-warning{color:var(--yellow)}
56466
56543
  button.link.bad{color:var(--red)}button.link.good{color:var(--green)}button.link.pending{color:var(--accent)}
56467
56544
  .preview-status-summary{display:flex;flex-wrap:wrap;align-items:center;gap:8px 20px;padding:12px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
56468
56545
  .preview-status-summary span{font-weight:600}
@@ -56727,17 +56804,17 @@ var require_visit = __commonJS({
56727
56804
  visit.BREAK = BREAK;
56728
56805
  visit.SKIP = SKIP;
56729
56806
  visit.REMOVE = REMOVE;
56730
- function visit_(key, node, visitor, path55) {
56731
- const ctrl = callVisitor(key, node, visitor, path55);
56807
+ function visit_(key, node, visitor, path56) {
56808
+ const ctrl = callVisitor(key, node, visitor, path56);
56732
56809
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
56733
- replaceNode(key, path55, ctrl);
56734
- return visit_(key, ctrl, visitor, path55);
56810
+ replaceNode(key, path56, ctrl);
56811
+ return visit_(key, ctrl, visitor, path56);
56735
56812
  }
56736
56813
  if (typeof ctrl !== "symbol") {
56737
56814
  if (identity.isCollection(node)) {
56738
- path55 = Object.freeze(path55.concat(node));
56815
+ path56 = Object.freeze(path56.concat(node));
56739
56816
  for (let i = 0; i < node.items.length; ++i) {
56740
- const ci = visit_(i, node.items[i], visitor, path55);
56817
+ const ci = visit_(i, node.items[i], visitor, path56);
56741
56818
  if (typeof ci === "number")
56742
56819
  i = ci - 1;
56743
56820
  else if (ci === BREAK)
@@ -56748,13 +56825,13 @@ var require_visit = __commonJS({
56748
56825
  }
56749
56826
  }
56750
56827
  } else if (identity.isPair(node)) {
56751
- path55 = Object.freeze(path55.concat(node));
56752
- const ck = visit_("key", node.key, visitor, path55);
56828
+ path56 = Object.freeze(path56.concat(node));
56829
+ const ck = visit_("key", node.key, visitor, path56);
56753
56830
  if (ck === BREAK)
56754
56831
  return BREAK;
56755
56832
  else if (ck === REMOVE)
56756
56833
  node.key = null;
56757
- const cv = visit_("value", node.value, visitor, path55);
56834
+ const cv = visit_("value", node.value, visitor, path56);
56758
56835
  if (cv === BREAK)
56759
56836
  return BREAK;
56760
56837
  else if (cv === REMOVE)
@@ -56775,17 +56852,17 @@ var require_visit = __commonJS({
56775
56852
  visitAsync.BREAK = BREAK;
56776
56853
  visitAsync.SKIP = SKIP;
56777
56854
  visitAsync.REMOVE = REMOVE;
56778
- async function visitAsync_(key, node, visitor, path55) {
56779
- const ctrl = await callVisitor(key, node, visitor, path55);
56855
+ async function visitAsync_(key, node, visitor, path56) {
56856
+ const ctrl = await callVisitor(key, node, visitor, path56);
56780
56857
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
56781
- replaceNode(key, path55, ctrl);
56782
- return visitAsync_(key, ctrl, visitor, path55);
56858
+ replaceNode(key, path56, ctrl);
56859
+ return visitAsync_(key, ctrl, visitor, path56);
56783
56860
  }
56784
56861
  if (typeof ctrl !== "symbol") {
56785
56862
  if (identity.isCollection(node)) {
56786
- path55 = Object.freeze(path55.concat(node));
56863
+ path56 = Object.freeze(path56.concat(node));
56787
56864
  for (let i = 0; i < node.items.length; ++i) {
56788
- const ci = await visitAsync_(i, node.items[i], visitor, path55);
56865
+ const ci = await visitAsync_(i, node.items[i], visitor, path56);
56789
56866
  if (typeof ci === "number")
56790
56867
  i = ci - 1;
56791
56868
  else if (ci === BREAK)
@@ -56796,13 +56873,13 @@ var require_visit = __commonJS({
56796
56873
  }
56797
56874
  }
56798
56875
  } else if (identity.isPair(node)) {
56799
- path55 = Object.freeze(path55.concat(node));
56800
- const ck = await visitAsync_("key", node.key, visitor, path55);
56876
+ path56 = Object.freeze(path56.concat(node));
56877
+ const ck = await visitAsync_("key", node.key, visitor, path56);
56801
56878
  if (ck === BREAK)
56802
56879
  return BREAK;
56803
56880
  else if (ck === REMOVE)
56804
56881
  node.key = null;
56805
- const cv = await visitAsync_("value", node.value, visitor, path55);
56882
+ const cv = await visitAsync_("value", node.value, visitor, path56);
56806
56883
  if (cv === BREAK)
56807
56884
  return BREAK;
56808
56885
  else if (cv === REMOVE)
@@ -56829,24 +56906,24 @@ var require_visit = __commonJS({
56829
56906
  }
56830
56907
  return visitor;
56831
56908
  }
56832
- function callVisitor(key, node, visitor, path55) {
56909
+ function callVisitor(key, node, visitor, path56) {
56833
56910
  var _a3, _b, _c, _d, _e;
56834
56911
  if (typeof visitor === "function")
56835
- return visitor(key, node, path55);
56912
+ return visitor(key, node, path56);
56836
56913
  if (identity.isMap(node))
56837
- return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node, path55);
56914
+ return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node, path56);
56838
56915
  if (identity.isSeq(node))
56839
- return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node, path55);
56916
+ return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node, path56);
56840
56917
  if (identity.isPair(node))
56841
- return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node, path55);
56918
+ return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node, path56);
56842
56919
  if (identity.isScalar(node))
56843
- return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path55);
56920
+ return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path56);
56844
56921
  if (identity.isAlias(node))
56845
- return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node, path55);
56922
+ return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node, path56);
56846
56923
  return void 0;
56847
56924
  }
56848
- function replaceNode(key, path55, node) {
56849
- const parent = path55[path55.length - 1];
56925
+ function replaceNode(key, path56, node) {
56926
+ const parent = path56[path56.length - 1];
56850
56927
  if (identity.isCollection(parent)) {
56851
56928
  parent.items[key] = node;
56852
56929
  } else if (identity.isPair(parent)) {
@@ -57458,10 +57535,10 @@ var require_Collection = __commonJS({
57458
57535
  var createNode = require_createNode();
57459
57536
  var identity = require_identity();
57460
57537
  var Node = require_Node();
57461
- function collectionFromPath(schema, path55, value) {
57538
+ function collectionFromPath(schema, path56, value) {
57462
57539
  let v = value;
57463
- for (let i = path55.length - 1; i >= 0; --i) {
57464
- const k = path55[i];
57540
+ for (let i = path56.length - 1; i >= 0; --i) {
57541
+ const k = path56[i];
57465
57542
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
57466
57543
  const a = [];
57467
57544
  a[k] = v;
@@ -57480,7 +57557,7 @@ var require_Collection = __commonJS({
57480
57557
  sourceObjects: /* @__PURE__ */ new Map()
57481
57558
  });
57482
57559
  }
57483
- var isEmptyPath = (path55) => path55 == null || typeof path55 === "object" && !!path55[Symbol.iterator]().next().done;
57560
+ var isEmptyPath = (path56) => path56 == null || typeof path56 === "object" && !!path56[Symbol.iterator]().next().done;
57484
57561
  var Collection = class extends Node.NodeBase {
57485
57562
  constructor(type, schema) {
57486
57563
  super(type);
@@ -57510,11 +57587,11 @@ var require_Collection = __commonJS({
57510
57587
  * be a Pair instance or a `{ key, value }` object, which may not have a key
57511
57588
  * that already exists in the map.
57512
57589
  */
57513
- addIn(path55, value) {
57514
- if (isEmptyPath(path55))
57590
+ addIn(path56, value) {
57591
+ if (isEmptyPath(path56))
57515
57592
  this.add(value);
57516
57593
  else {
57517
- const [key, ...rest] = path55;
57594
+ const [key, ...rest] = path56;
57518
57595
  const node = this.get(key, true);
57519
57596
  if (identity.isCollection(node))
57520
57597
  node.addIn(rest, value);
@@ -57528,8 +57605,8 @@ var require_Collection = __commonJS({
57528
57605
  * Removes a value from the collection.
57529
57606
  * @returns `true` if the item was found and removed.
57530
57607
  */
57531
- deleteIn(path55) {
57532
- const [key, ...rest] = path55;
57608
+ deleteIn(path56) {
57609
+ const [key, ...rest] = path56;
57533
57610
  if (rest.length === 0)
57534
57611
  return this.delete(key);
57535
57612
  const node = this.get(key, true);
@@ -57543,8 +57620,8 @@ var require_Collection = __commonJS({
57543
57620
  * scalar values from their surrounding node; to disable set `keepScalar` to
57544
57621
  * `true` (collections are always returned intact).
57545
57622
  */
57546
- getIn(path55, keepScalar) {
57547
- const [key, ...rest] = path55;
57623
+ getIn(path56, keepScalar) {
57624
+ const [key, ...rest] = path56;
57548
57625
  const node = this.get(key, true);
57549
57626
  if (rest.length === 0)
57550
57627
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -57562,8 +57639,8 @@ var require_Collection = __commonJS({
57562
57639
  /**
57563
57640
  * Checks if the collection includes a value with the key `key`.
57564
57641
  */
57565
- hasIn(path55) {
57566
- const [key, ...rest] = path55;
57642
+ hasIn(path56) {
57643
+ const [key, ...rest] = path56;
57567
57644
  if (rest.length === 0)
57568
57645
  return this.has(key);
57569
57646
  const node = this.get(key, true);
@@ -57573,8 +57650,8 @@ var require_Collection = __commonJS({
57573
57650
  * Sets a value in this collection. For `!!set`, `value` needs to be a
57574
57651
  * boolean to add/remove the item from the set.
57575
57652
  */
57576
- setIn(path55, value) {
57577
- const [key, ...rest] = path55;
57653
+ setIn(path56, value) {
57654
+ const [key, ...rest] = path56;
57578
57655
  if (rest.length === 0) {
57579
57656
  this.set(key, value);
57580
57657
  } else {
@@ -60088,9 +60165,9 @@ var require_Document = __commonJS({
60088
60165
  this.contents.add(value);
60089
60166
  }
60090
60167
  /** Adds a value to the document. */
60091
- addIn(path55, value) {
60168
+ addIn(path56, value) {
60092
60169
  if (assertCollection(this.contents))
60093
- this.contents.addIn(path55, value);
60170
+ this.contents.addIn(path56, value);
60094
60171
  }
60095
60172
  /**
60096
60173
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -60165,14 +60242,14 @@ var require_Document = __commonJS({
60165
60242
  * Removes a value from the document.
60166
60243
  * @returns `true` if the item was found and removed.
60167
60244
  */
60168
- deleteIn(path55) {
60169
- if (Collection.isEmptyPath(path55)) {
60245
+ deleteIn(path56) {
60246
+ if (Collection.isEmptyPath(path56)) {
60170
60247
  if (this.contents == null)
60171
60248
  return false;
60172
60249
  this.contents = null;
60173
60250
  return true;
60174
60251
  }
60175
- return assertCollection(this.contents) ? this.contents.deleteIn(path55) : false;
60252
+ return assertCollection(this.contents) ? this.contents.deleteIn(path56) : false;
60176
60253
  }
60177
60254
  /**
60178
60255
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -60187,10 +60264,10 @@ var require_Document = __commonJS({
60187
60264
  * scalar values from their surrounding node; to disable set `keepScalar` to
60188
60265
  * `true` (collections are always returned intact).
60189
60266
  */
60190
- getIn(path55, keepScalar) {
60191
- if (Collection.isEmptyPath(path55))
60267
+ getIn(path56, keepScalar) {
60268
+ if (Collection.isEmptyPath(path56))
60192
60269
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
60193
- return identity.isCollection(this.contents) ? this.contents.getIn(path55, keepScalar) : void 0;
60270
+ return identity.isCollection(this.contents) ? this.contents.getIn(path56, keepScalar) : void 0;
60194
60271
  }
60195
60272
  /**
60196
60273
  * Checks if the document includes a value with the key `key`.
@@ -60201,10 +60278,10 @@ var require_Document = __commonJS({
60201
60278
  /**
60202
60279
  * Checks if the document includes a value at `path`.
60203
60280
  */
60204
- hasIn(path55) {
60205
- if (Collection.isEmptyPath(path55))
60281
+ hasIn(path56) {
60282
+ if (Collection.isEmptyPath(path56))
60206
60283
  return this.contents !== void 0;
60207
- return identity.isCollection(this.contents) ? this.contents.hasIn(path55) : false;
60284
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path56) : false;
60208
60285
  }
60209
60286
  /**
60210
60287
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -60221,13 +60298,13 @@ var require_Document = __commonJS({
60221
60298
  * Sets a value in this document. For `!!set`, `value` needs to be a
60222
60299
  * boolean to add/remove the item from the set.
60223
60300
  */
60224
- setIn(path55, value) {
60225
- if (Collection.isEmptyPath(path55)) {
60301
+ setIn(path56, value) {
60302
+ if (Collection.isEmptyPath(path56)) {
60226
60303
  this.contents = value;
60227
60304
  } else if (this.contents == null) {
60228
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path55), value);
60305
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path56), value);
60229
60306
  } else if (assertCollection(this.contents)) {
60230
- this.contents.setIn(path55, value);
60307
+ this.contents.setIn(path56, value);
60231
60308
  }
60232
60309
  }
60233
60310
  /**
@@ -62190,9 +62267,9 @@ var require_cst_visit = __commonJS({
62190
62267
  visit.BREAK = BREAK;
62191
62268
  visit.SKIP = SKIP;
62192
62269
  visit.REMOVE = REMOVE;
62193
- visit.itemAtPath = (cst, path55) => {
62270
+ visit.itemAtPath = (cst, path56) => {
62194
62271
  let item = cst;
62195
- for (const [field, index] of path55) {
62272
+ for (const [field, index] of path56) {
62196
62273
  const tok = item == null ? void 0 : item[field];
62197
62274
  if (tok && "items" in tok) {
62198
62275
  item = tok.items[index];
@@ -62201,23 +62278,23 @@ var require_cst_visit = __commonJS({
62201
62278
  }
62202
62279
  return item;
62203
62280
  };
62204
- visit.parentCollection = (cst, path55) => {
62205
- const parent = visit.itemAtPath(cst, path55.slice(0, -1));
62206
- const field = path55[path55.length - 1][0];
62281
+ visit.parentCollection = (cst, path56) => {
62282
+ const parent = visit.itemAtPath(cst, path56.slice(0, -1));
62283
+ const field = path56[path56.length - 1][0];
62207
62284
  const coll = parent == null ? void 0 : parent[field];
62208
62285
  if (coll && "items" in coll)
62209
62286
  return coll;
62210
62287
  throw new Error("Parent collection not found");
62211
62288
  };
62212
- function _visit(path55, item, visitor) {
62213
- let ctrl = visitor(item, path55);
62289
+ function _visit(path56, item, visitor) {
62290
+ let ctrl = visitor(item, path56);
62214
62291
  if (typeof ctrl === "symbol")
62215
62292
  return ctrl;
62216
62293
  for (const field of ["key", "value"]) {
62217
62294
  const token = item[field];
62218
62295
  if (token && "items" in token) {
62219
62296
  for (let i = 0; i < token.items.length; ++i) {
62220
- const ci = _visit(Object.freeze(path55.concat([[field, i]])), token.items[i], visitor);
62297
+ const ci = _visit(Object.freeze(path56.concat([[field, i]])), token.items[i], visitor);
62221
62298
  if (typeof ci === "number")
62222
62299
  i = ci - 1;
62223
62300
  else if (ci === BREAK)
@@ -62228,10 +62305,10 @@ var require_cst_visit = __commonJS({
62228
62305
  }
62229
62306
  }
62230
62307
  if (typeof ctrl === "function" && field === "key")
62231
- ctrl = ctrl(item, path55);
62308
+ ctrl = ctrl(item, path56);
62232
62309
  }
62233
62310
  }
62234
- return typeof ctrl === "function" ? ctrl(item, path55) : ctrl;
62311
+ return typeof ctrl === "function" ? ctrl(item, path56) : ctrl;
62235
62312
  }
62236
62313
  exports.visit = visit;
62237
62314
  }
@@ -63518,14 +63595,14 @@ var require_parser = __commonJS({
63518
63595
  case "scalar":
63519
63596
  case "single-quoted-scalar":
63520
63597
  case "double-quoted-scalar": {
63521
- const fs52 = this.flowScalar(this.type);
63598
+ const fs53 = this.flowScalar(this.type);
63522
63599
  if (atNextItem || it.value) {
63523
- map2.items.push({ start, key: fs52, sep: [] });
63600
+ map2.items.push({ start, key: fs53, sep: [] });
63524
63601
  this.onKeyLine = true;
63525
63602
  } else if (it.sep) {
63526
- this.stack.push(fs52);
63603
+ this.stack.push(fs53);
63527
63604
  } else {
63528
- Object.assign(it, { key: fs52, sep: [] });
63605
+ Object.assign(it, { key: fs53, sep: [] });
63529
63606
  this.onKeyLine = true;
63530
63607
  }
63531
63608
  return;
@@ -63654,13 +63731,13 @@ var require_parser = __commonJS({
63654
63731
  case "scalar":
63655
63732
  case "single-quoted-scalar":
63656
63733
  case "double-quoted-scalar": {
63657
- const fs52 = this.flowScalar(this.type);
63734
+ const fs53 = this.flowScalar(this.type);
63658
63735
  if (!it || it.value)
63659
- fc.items.push({ start: [], key: fs52, sep: [] });
63736
+ fc.items.push({ start: [], key: fs53, sep: [] });
63660
63737
  else if (it.sep)
63661
- this.stack.push(fs52);
63738
+ this.stack.push(fs53);
63662
63739
  else
63663
- Object.assign(it, { key: fs52, sep: [] });
63740
+ Object.assign(it, { key: fs53, sep: [] });
63664
63741
  return;
63665
63742
  }
63666
63743
  case "flow-map-end":
@@ -64026,7 +64103,7 @@ var require_pend = __commonJS({
64026
64103
  // node_modules/yauzl/fd-slicer.js
64027
64104
  var require_fd_slicer = __commonJS({
64028
64105
  "node_modules/yauzl/fd-slicer.js"(exports) {
64029
- var fs52 = __require("fs");
64106
+ var fs53 = __require("fs");
64030
64107
  var util2 = __require("util");
64031
64108
  var stream = __require("stream");
64032
64109
  var Readable2 = stream.Readable;
@@ -64046,7 +64123,7 @@ var require_fd_slicer = __commonJS({
64046
64123
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
64047
64124
  var self2 = this;
64048
64125
  self2.pend.go(function(cb) {
64049
- fs52.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
64126
+ fs53.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
64050
64127
  cb();
64051
64128
  callback(err, bytesRead, buffer2);
64052
64129
  });
@@ -64063,7 +64140,7 @@ var require_fd_slicer = __commonJS({
64063
64140
  self2.refCount -= 1;
64064
64141
  if (self2.refCount < 0) throw new Error("invalid unref");
64065
64142
  if (self2.refCount > 0) return;
64066
- fs52.close(self2.fd, onCloseDone);
64143
+ fs53.close(self2.fd, onCloseDone);
64067
64144
  function onCloseDone(err) {
64068
64145
  if (err) {
64069
64146
  self2.emit("error", err);
@@ -64095,7 +64172,7 @@ var require_fd_slicer = __commonJS({
64095
64172
  }
64096
64173
  self2.context.pend.go(function(cb) {
64097
64174
  var buffer = Buffer.allocUnsafe(toRead);
64098
- fs52.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
64175
+ fs53.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
64099
64176
  if (err) {
64100
64177
  self2.destroy(err);
64101
64178
  } else if (bytesRead === 0) {
@@ -64455,7 +64532,7 @@ var require_crc32 = __commonJS({
64455
64532
  // node_modules/yauzl/index.js
64456
64533
  var require_yauzl = __commonJS({
64457
64534
  "node_modules/yauzl/index.js"(exports) {
64458
- var fs52 = __require("fs");
64535
+ var fs53 = __require("fs");
64459
64536
  var zlib = __require("zlib");
64460
64537
  var fd_slicer = require_fd_slicer();
64461
64538
  var util2 = __require("util");
@@ -64480,9 +64557,9 @@ var require_yauzl = __commonJS({
64480
64557
  exports.Entry = Entry;
64481
64558
  exports.LocalFileHeader = LocalFileHeader;
64482
64559
  exports.RandomAccessReader = RandomAccessReader;
64483
- function openPromise(path55, options3) {
64560
+ function openPromise(path56, options3) {
64484
64561
  return new Promise((resolve, reject) => {
64485
- open(path55, { ...options3, lazyEntries: true }, function(err, zipfile) {
64562
+ open(path56, { ...options3, lazyEntries: true }, function(err, zipfile) {
64486
64563
  if (err) return reject(err);
64487
64564
  resolve(zipfile);
64488
64565
  });
@@ -64512,7 +64589,7 @@ var require_yauzl = __commonJS({
64512
64589
  });
64513
64590
  });
64514
64591
  }
64515
- function open(path55, options3, callback) {
64592
+ function open(path56, options3, callback) {
64516
64593
  if (typeof options3 === "function") {
64517
64594
  callback = options3;
64518
64595
  options3 = null;
@@ -64524,10 +64601,10 @@ var require_yauzl = __commonJS({
64524
64601
  if (options3.validateEntrySizes == null) options3.validateEntrySizes = true;
64525
64602
  if (options3.strictFileNames == null) options3.strictFileNames = false;
64526
64603
  if (callback == null) callback = defaultCallback;
64527
- fs52.open(path55, "r", function(err, fd) {
64604
+ fs53.open(path56, "r", function(err, fd) {
64528
64605
  if (err) return callback(err);
64529
64606
  fromFd(fd, options3, function(err2, zipfile) {
64530
- if (err2) fs52.close(fd, defaultCallback);
64607
+ if (err2) fs53.close(fd, defaultCallback);
64531
64608
  callback(err2, zipfile);
64532
64609
  });
64533
64610
  });
@@ -64544,7 +64621,7 @@ var require_yauzl = __commonJS({
64544
64621
  if (options3.validateEntrySizes == null) options3.validateEntrySizes = true;
64545
64622
  if (options3.strictFileNames == null) options3.strictFileNames = false;
64546
64623
  if (callback == null) callback = defaultCallback;
64547
- fs52.fstat(fd, function(err, stats) {
64624
+ fs53.fstat(fd, function(err, stats) {
64548
64625
  if (err) return callback(err);
64549
64626
  var reader = new fd_slicer.FdSlicer(fd);
64550
64627
  fromRandomAccessReader(reader, stats.size, options3, callback);
@@ -65318,9 +65395,9 @@ init_mcp();
65318
65395
  init_config();
65319
65396
  import { spawnSync as spawnSync8 } from "node:child_process";
65320
65397
  import crypto5 from "node:crypto";
65321
- import fs50 from "node:fs";
65322
- import os11 from "node:os";
65323
- import path52 from "node:path";
65398
+ import fs51 from "node:fs";
65399
+ import os12 from "node:os";
65400
+ import path53 from "node:path";
65324
65401
  import readline from "node:readline/promises";
65325
65402
  import { stdin as input, stdout as output } from "node:process";
65326
65403
  import { pathToFileURL as pathToFileURL2 } from "node:url";
@@ -65480,21 +65557,21 @@ init_runtimeLogs();
65480
65557
 
65481
65558
  // src/maker/cli/preview.ts
65482
65559
  init_protocol2();
65483
- import fs35 from "node:fs";
65484
- import path36 from "node:path";
65560
+ import fs36 from "node:fs";
65561
+ import path37 from "node:path";
65485
65562
  import { randomBytes as randomBytes3, randomUUID as randomUUID6 } from "node:crypto";
65486
65563
 
65487
65564
  // src/maker/preview/installation.ts
65488
65565
  init_python();
65489
65566
  init_protocol2();
65490
- import fs32 from "node:fs";
65491
- import path33 from "node:path";
65567
+ import fs33 from "node:fs";
65568
+ import path34 from "node:path";
65492
65569
  import { createHash as createHash5, randomUUID as randomUUID5 } from "node:crypto";
65493
65570
 
65494
65571
  // src/maker/preview/runtime.ts
65495
65572
  init_protocol2();
65496
- import fs30 from "node:fs";
65497
- import path31 from "node:path";
65573
+ import fs31 from "node:fs";
65574
+ import path32 from "node:path";
65498
65575
  import { spawn as spawn6 } from "node:child_process";
65499
65576
  import { StringDecoder } from "node:string_decoder";
65500
65577
 
@@ -66276,13 +66353,45 @@ function requestPreviewServer(project, auth2, signal, options3 = {}) {
66276
66353
  });
66277
66354
  }
66278
66355
 
66356
+ // src/maker/preview/sourceAlias.ts
66357
+ import fs30 from "node:fs";
66358
+ import os5 from "node:os";
66359
+ import path31 from "node:path";
66360
+ function createPreviewSourceAlias(source, platform = process.platform, temporaryDirectory = os5.tmpdir()) {
66361
+ if (platform !== "win32") return { source, close: () => {
66362
+ } };
66363
+ const target = fs30.realpathSync(source);
66364
+ const directory = fs30.mkdtempSync(path31.join(temporaryDirectory, "maker-preview-"));
66365
+ const alias = path31.join(directory, "source");
66366
+ try {
66367
+ if (alias.length > 180)
66368
+ throw new Error("Windows preview needs a shorter TEMP directory (Runtime path limit).");
66369
+ fs30.symlinkSync(target, alias, "junction");
66370
+ } catch (error2) {
66371
+ fs30.rmdirSync(directory);
66372
+ throw error2;
66373
+ }
66374
+ let closed = false;
66375
+ return {
66376
+ source: alias,
66377
+ close: () => {
66378
+ if (closed) return;
66379
+ if (!fs30.lstatSync(alias).isSymbolicLink() || fs30.realpathSync(alias) !== target)
66380
+ throw new Error("Preview source alias changed; refusing cleanup.");
66381
+ fs30.unlinkSync(alias);
66382
+ fs30.rmdirSync(directory);
66383
+ closed = true;
66384
+ }
66385
+ };
66386
+ }
66387
+
66279
66388
  // src/maker/preview/runtime.ts
66280
66389
  var PREVIEW_TIMEOUT_MS = 3e4;
66281
66390
  async function probeRuntime(executable, signal) {
66282
66391
  if (signal == null ? void 0 : signal.aborted) throw new Error("CANCELLED");
66283
- if (!path31.isAbsolute(executable) || !fs30.statSync(executable).isFile())
66392
+ if (!path32.isAbsolute(executable) || !fs31.statSync(executable).isFile())
66284
66393
  throw new Error("Runtime must be an absolute executable file.");
66285
- fs30.accessSync(executable, process.platform === "win32" ? fs30.constants.R_OK : fs30.constants.X_OK);
66394
+ fs31.accessSync(executable, process.platform === "win32" ? fs31.constants.R_OK : fs31.constants.X_OK);
66286
66395
  return {
66287
66396
  protocol_version: 0,
66288
66397
  runtime_version: "unknown",
@@ -66303,12 +66412,14 @@ async function preflightPreview(_executable, project, signal) {
66303
66412
  };
66304
66413
  }
66305
66414
  var PreviewRuntime = class {
66306
- constructor(executable, identity, directory, changed, timeout = PREVIEW_TIMEOUT_MS) {
66415
+ constructor(executable, identity, directory, changed, timeout = PREVIEW_TIMEOUT_MS, launching = () => {
66416
+ }) {
66307
66417
  this.executable = executable;
66308
66418
  this.identity = identity;
66309
66419
  this.directory = directory;
66310
66420
  this.changed = changed;
66311
66421
  this.timeout = timeout;
66422
+ this.launching = launching;
66312
66423
  this.stopping = false;
66313
66424
  this.abort = new AbortController();
66314
66425
  this.closed = Promise.resolve();
@@ -66353,11 +66464,11 @@ var PreviewRuntime = class {
66353
66464
  let cacheRoot;
66354
66465
  if (this.launchMode === "loopback_manifest") {
66355
66466
  this.assets = await startPreviewAssetServer(source, this.abort.signal);
66356
- cacheRoot = path31.join(storage, "runtime-cache");
66467
+ cacheRoot = path32.join(storage, "runtime-cache");
66357
66468
  try {
66358
- fs30.mkdirSync(cacheRoot, { recursive: true, mode: 448 });
66359
- this.assetCache = path31.join(
66360
- fs30.realpathSync(cacheRoot),
66469
+ fs31.mkdirSync(cacheRoot, { recursive: true, mode: 448 });
66470
+ this.assetCache = path32.join(
66471
+ fs31.realpathSync(cacheRoot),
66361
66472
  this.assets.url.slice("http://".length).replace(":", "_")
66362
66473
  );
66363
66474
  } catch (error2) {
@@ -66371,10 +66482,13 @@ var PreviewRuntime = class {
66371
66482
  }
66372
66483
  let child;
66373
66484
  try {
66485
+ this.sourceAlias = createPreviewSourceAlias(source);
66486
+ const runtimeSource = this.sourceAlias.source;
66487
+ this.launching();
66374
66488
  child = spawn6(
66375
66489
  this.executable,
66376
66490
  [
66377
- ...this.assets ? ["-game_url=" + this.assets.url] : [entry, "-tapcode_dir=" + source],
66491
+ ...this.assets ? ["-game_url=" + this.assets.url] : [entry, "-tapcode_dir=" + runtimeSource],
66378
66492
  ...cacheRoot ? ["-game_path=" + cacheRoot] : [],
66379
66493
  "-skip_login",
66380
66494
  ...server ? previewNetworkArgs(server) : [],
@@ -66383,10 +66497,11 @@ var PreviewRuntime = class {
66383
66497
  "-width=" + window2.width,
66384
66498
  "-height=" + window2.height
66385
66499
  ],
66386
- { cwd: source, stdio: ["pipe", "pipe", "pipe"], windowsHide: false }
66500
+ { cwd: runtimeSource, stdio: ["pipe", "pipe", "pipe"], windowsHide: false }
66387
66501
  );
66388
66502
  } catch (error2) {
66389
66503
  await ((_b = this.assets) == null ? void 0 : _b.close());
66504
+ this.clearSourceAlias();
66390
66505
  throw error2;
66391
66506
  }
66392
66507
  this.child = child;
@@ -66394,52 +66509,78 @@ var PreviewRuntime = class {
66394
66509
  (resolve) => child.once("close", () => {
66395
66510
  void (async () => {
66396
66511
  var _a4;
66397
- await ((_a4 = this.assets) == null ? void 0 : _a4.close());
66512
+ try {
66513
+ await ((_a4 = this.assets) == null ? void 0 : _a4.close());
66514
+ } catch (error2) {
66515
+ this.recordError(String(error2));
66516
+ }
66398
66517
  this.clearAssetCache();
66399
- this.changed(this.stopping || child.exitCode === 0 ? "stopped" : "failed");
66400
- resolve();
66518
+ this.clearSourceAlias();
66519
+ try {
66520
+ this.changed(this.stopping || child.exitCode === 0 ? "stopped" : "failed");
66521
+ } catch (error2) {
66522
+ this.recordError(String(error2));
66523
+ } finally {
66524
+ resolve();
66525
+ }
66401
66526
  })();
66402
66527
  })
66403
66528
  );
66404
66529
  child.on("error", (error2) => {
66405
66530
  this.recordError(error2.message);
66406
- this.changed("failed");
66531
+ try {
66532
+ this.changed("failed");
66533
+ } catch (persistenceError) {
66534
+ this.recordError(String(persistenceError));
66535
+ }
66407
66536
  });
66408
66537
  this.consume(child.stdout);
66409
66538
  this.consume(child.stderr);
66410
- await new Promise((resolve, reject) => {
66411
- let settle;
66412
- const cleanup = () => {
66413
- clearTimeout(deadline);
66414
- clearTimeout(settle);
66415
- child.removeListener("error", failed);
66416
- child.removeListener("close", exited);
66417
- };
66418
- const failed = (error2) => {
66419
- cleanup();
66420
- reject(error2);
66421
- };
66422
- const exited = () => failed(new Error("Runtime exited during startup. Read preview logs."));
66423
- const deadline = setTimeout(
66424
- () => failed(new Error("TIMEOUT: Runtime process did not start.")),
66425
- this.timeout
66426
- );
66427
- child.once("error", failed);
66428
- child.once("close", exited);
66429
- child.once("spawn", () => {
66430
- settle = setTimeout(() => {
66539
+ try {
66540
+ if (child.pid) this.launching(child.pid);
66541
+ await new Promise((resolve, reject) => {
66542
+ let settle;
66543
+ const cleanup = () => {
66544
+ clearTimeout(deadline);
66545
+ clearTimeout(settle);
66546
+ child.removeListener("error", failed);
66547
+ child.removeListener("close", exited);
66548
+ };
66549
+ const failed = (error2) => {
66431
66550
  cleanup();
66432
- if (this.stopping || !this.processAlive) reject(new Error("CANCELLED: preview stopped."));
66433
- else {
66434
- this.changed("running");
66435
- resolve();
66436
- }
66437
- }, 300);
66551
+ reject(error2);
66552
+ };
66553
+ const exited = () => failed(new Error("Runtime exited during startup. Read preview logs."));
66554
+ const deadline = setTimeout(
66555
+ () => failed(new Error("TIMEOUT: Runtime process did not start.")),
66556
+ this.timeout
66557
+ );
66558
+ child.once("error", failed);
66559
+ child.once("close", exited);
66560
+ child.once("spawn", () => {
66561
+ settle = setTimeout(() => {
66562
+ cleanup();
66563
+ if (this.stopping || !this.processAlive)
66564
+ reject(new Error("CANCELLED: preview stopped."));
66565
+ else {
66566
+ try {
66567
+ this.changed("running");
66568
+ resolve();
66569
+ } catch (error2) {
66570
+ failed(error2);
66571
+ }
66572
+ }
66573
+ }, 300);
66574
+ });
66438
66575
  });
66439
- }).catch(async (error2) => {
66440
- await this.stop();
66576
+ } catch (error2) {
66577
+ try {
66578
+ await this.stop();
66579
+ } catch (cleanupError) {
66580
+ throw new Error(String(error2) + "; Runtime cleanup is unverified: " + String(cleanupError));
66581
+ }
66441
66582
  throw error2;
66442
- });
66583
+ }
66443
66584
  }
66444
66585
  recordError(message) {
66445
66586
  this.errors.push(String(sanitizeDiagnosticValue(message)).slice(0, 16384));
@@ -66448,15 +66589,24 @@ var PreviewRuntime = class {
66448
66589
  clearAssetCache() {
66449
66590
  if (!this.assetCache) return;
66450
66591
  try {
66451
- const parent = path31.dirname(this.assetCache);
66452
- if (fs30.existsSync(parent) && fs30.realpathSync(parent) === parent) {
66453
- fs30.rmSync(this.assetCache, { recursive: true, force: true });
66454
- if (!fs30.readdirSync(parent).length) fs30.rmdirSync(parent);
66592
+ const parent = path32.dirname(this.assetCache);
66593
+ if (fs31.existsSync(parent) && fs31.realpathSync(parent) === parent) {
66594
+ fs31.rmSync(this.assetCache, { recursive: true, force: true });
66595
+ if (!fs31.readdirSync(parent).length) fs31.rmdirSync(parent);
66455
66596
  }
66456
66597
  } catch {
66457
66598
  this.recordError("Could not remove this round of local preview download cache.");
66458
66599
  }
66459
66600
  }
66601
+ clearSourceAlias() {
66602
+ var _a3;
66603
+ try {
66604
+ (_a3 = this.sourceAlias) == null ? void 0 : _a3.close();
66605
+ this.sourceAlias = void 0;
66606
+ } catch (error2) {
66607
+ this.recordError(String(error2));
66608
+ }
66609
+ }
66460
66610
  consume(stream) {
66461
66611
  const decoder = new StringDecoder("utf8");
66462
66612
  let buffer = "";
@@ -66523,8 +66673,8 @@ var PreviewRuntime = class {
66523
66673
  };
66524
66674
 
66525
66675
  // src/maker/preview/runtimeResources.ts
66526
- import fs31 from "node:fs";
66527
- import path32 from "node:path";
66676
+ import fs32 from "node:fs";
66677
+ import path33 from "node:path";
66528
66678
  var FALLBACK_FONT = "MiSans-Regular.ttf";
66529
66679
  function defaultFontCandidates(platform) {
66530
66680
  if (platform === "darwin") {
@@ -66536,44 +66686,44 @@ function defaultFontCandidates(platform) {
66536
66686
  if (platform === "win32") {
66537
66687
  const windows = process.env.WINDIR || process.env.SystemRoot || "C:\\Windows";
66538
66688
  return [
66539
- path32.join(windows, "Fonts", "Deng.ttf"),
66540
- path32.join(windows, "Fonts", "Dengb.ttf"),
66541
- path32.join(windows, "Fonts", "msyh.ttc")
66689
+ path33.join(windows, "Fonts", "Deng.ttf"),
66690
+ path33.join(windows, "Fonts", "Dengb.ttf"),
66691
+ path33.join(windows, "Fonts", "msyh.ttc")
66542
66692
  ];
66543
66693
  }
66544
66694
  return [];
66545
66695
  }
66546
66696
  function existingFile(filename2) {
66547
66697
  try {
66548
- return fs31.statSync(filename2).isFile();
66698
+ return fs32.statSync(filename2).isFile();
66549
66699
  } catch {
66550
66700
  return false;
66551
66701
  }
66552
66702
  }
66553
66703
  function ensurePreviewRuntimeResources(executable, options3 = {}) {
66554
- const runtimeRoot = path32.dirname(fs31.realpathSync(executable));
66555
- const fonts = path32.join(runtimeRoot, "Res", "Fonts");
66556
- const legacyFonts = path32.join(runtimeRoot, "Data", "Fonts");
66704
+ const runtimeRoot = path33.dirname(fs32.realpathSync(executable));
66705
+ const fonts = path33.join(runtimeRoot, "Res", "Fonts");
66706
+ const legacyFonts = path33.join(runtimeRoot, "Data", "Fonts");
66557
66707
  for (const directory of [
66558
- path32.join(runtimeRoot, "Data", "LuaScripts"),
66708
+ path33.join(runtimeRoot, "Data", "LuaScripts"),
66559
66709
  legacyFonts,
66560
66710
  fonts,
66561
- path32.join(runtimeRoot, "CoreData")
66711
+ path33.join(runtimeRoot, "CoreData")
66562
66712
  ]) {
66563
- fs31.mkdirSync(directory, { recursive: true });
66713
+ fs32.mkdirSync(directory, { recursive: true });
66564
66714
  }
66565
- const target = path32.join(fonts, FALLBACK_FONT);
66566
- if (fs31.existsSync(target)) return { fallbackFont: "existing", warnings: [] };
66715
+ const target = path33.join(fonts, FALLBACK_FONT);
66716
+ if (fs32.existsSync(target)) return { fallbackFont: "existing", warnings: [] };
66567
66717
  const platform = options3.platform || process.platform;
66568
66718
  const candidates = [
66569
- path32.join(legacyFonts, FALLBACK_FONT),
66719
+ path33.join(legacyFonts, FALLBACK_FONT),
66570
66720
  ...options3.fontCandidates || defaultFontCandidates(platform)
66571
66721
  ];
66572
66722
  const copyErrors = [];
66573
66723
  for (const candidate of candidates) {
66574
66724
  if (!existingFile(candidate)) continue;
66575
66725
  try {
66576
- fs31.copyFileSync(candidate, target, fs31.constants.COPYFILE_EXCL);
66726
+ fs32.copyFileSync(candidate, target, fs32.constants.COPYFILE_EXCL);
66577
66727
  return { fallbackFont: "copied", fallbackFontSource: candidate, warnings: [] };
66578
66728
  } catch (error2) {
66579
66729
  if (error2.code === "EEXIST") {
@@ -66807,10 +66957,10 @@ function processPresence(pid) {
66807
66957
 
66808
66958
  // src/maker/preview/installation.ts
66809
66959
  function readInstallation(filename2) {
66810
- if (!fs32.existsSync(filename2)) return void 0;
66960
+ if (!fs33.existsSync(filename2)) return void 0;
66811
66961
  try {
66812
- const value = JSON.parse(fs32.readFileSync(filename2, "utf8"));
66813
- if (value.install_state !== "ready" || !value.executable || !path33.isAbsolute(value.executable) || !fs32.statSync(value.executable).isFile()) {
66962
+ const value = JSON.parse(fs33.readFileSync(filename2, "utf8"));
66963
+ if (value.install_state !== "ready" || !value.executable || !path34.isAbsolute(value.executable) || !fs33.statSync(value.executable).isFile()) {
66814
66964
  return void 0;
66815
66965
  }
66816
66966
  return value;
@@ -66819,27 +66969,27 @@ function readInstallation(filename2) {
66819
66969
  }
66820
66970
  }
66821
66971
  function isInside(directory, filename2) {
66822
- const relative = path33.relative(directory, filename2);
66823
- return relative !== "" && !relative.startsWith(".." + path33.sep) && !path33.isAbsolute(relative);
66972
+ const relative = path34.relative(directory, filename2);
66973
+ return relative !== "" && !relative.startsWith(".." + path34.sep) && !path34.isAbsolute(relative);
66824
66974
  }
66825
66975
  function legacyPreviewInstallation(project) {
66826
66976
  var _a3;
66827
- const root2 = path33.dirname(previewDirectory(project));
66828
- if (!fs32.existsSync(root2)) return void 0;
66829
- const entries = fs32.readdirSync(root2, { withFileTypes: true }).filter((entry) => entry.isDirectory() && /^[a-f0-9]{64}$/.test(entry.name));
66977
+ const root2 = path34.dirname(previewDirectory(project));
66978
+ if (!fs33.existsSync(root2)) return void 0;
66979
+ const entries = fs33.readdirSync(root2, { withFileTypes: true }).filter((entry) => entry.isDirectory() && /^[a-f0-9]{64}$/.test(entry.name));
66830
66980
  const candidates = [];
66831
66981
  for (const entry of entries) {
66832
- const directory = path33.join(root2, entry.name);
66833
- const filename2 = path33.join(directory, "installation.json");
66982
+ const directory = path34.join(root2, entry.name);
66983
+ const filename2 = path34.join(directory, "installation.json");
66834
66984
  const installation = readInstallation(filename2);
66835
66985
  if (!(installation == null ? void 0 : installation.executable)) continue;
66836
66986
  try {
66837
- const executable = fs32.realpathSync(installation.executable);
66838
- const managedDirectory = fs32.realpathSync(directory);
66987
+ const executable = fs33.realpathSync(installation.executable);
66988
+ const managedDirectory = fs33.realpathSync(directory);
66839
66989
  if (!isInside(managedDirectory, executable)) continue;
66840
66990
  candidates.push({
66841
66991
  installation: { ...installation, executable },
66842
- modified: Date.parse(installation.installed_at || "") || fs32.statSync(filename2).mtimeMs
66992
+ modified: Date.parse(installation.installed_at || "") || fs33.statSync(filename2).mtimeMs
66843
66993
  });
66844
66994
  } catch {
66845
66995
  }
@@ -66848,7 +66998,7 @@ function legacyPreviewInstallation(project) {
66848
66998
  return (_a3 = candidates[0]) == null ? void 0 : _a3.installation;
66849
66999
  }
66850
67000
  function previewInstallation(project) {
66851
- const filename2 = path33.join(runtimeDirectory(), "installation.json");
67001
+ const filename2 = path34.join(runtimeDirectory(), "installation.json");
66852
67002
  const current = readInstallation(filename2);
66853
67003
  if (current) return current;
66854
67004
  const legacy = legacyPreviewInstallation(project);
@@ -66867,31 +67017,31 @@ function previewInstallation(project) {
66867
67017
  }
66868
67018
  }
66869
67019
  async function withFileLock(directory, name, busyMessage, action) {
66870
- fs32.mkdirSync(directory, { recursive: true, mode: 448 });
66871
- const filename2 = path33.join(directory, name);
67020
+ fs33.mkdirSync(directory, { recursive: true, mode: 448 });
67021
+ const filename2 = path34.join(directory, name);
66872
67022
  let descriptor;
66873
67023
  try {
66874
- descriptor = fs32.openSync(filename2, "wx", 384);
67024
+ descriptor = fs33.openSync(filename2, "wx", 384);
66875
67025
  } catch {
66876
67026
  throw new Error(
66877
67027
  busyMessage + " If an interrupted command left a lock, verify it exited before removing " + filename2
66878
67028
  );
66879
67029
  }
66880
67030
  try {
66881
- fs32.writeFileSync(
67031
+ fs33.writeFileSync(
66882
67032
  descriptor,
66883
67033
  JSON.stringify({ pid: process.pid, created_at: (/* @__PURE__ */ new Date()).toISOString() })
66884
67034
  );
66885
67035
  return await action();
66886
67036
  } finally {
66887
- fs32.closeSync(descriptor);
66888
- fs32.unlinkSync(filename2);
67037
+ fs33.closeSync(descriptor);
67038
+ fs33.unlinkSync(filename2);
66889
67039
  }
66890
67040
  }
66891
67041
  async function withPreviewLock(project, action) {
66892
67042
  const directory = previewDirectory(project);
66893
- fs32.mkdirSync(directory, { recursive: true, mode: 448 });
66894
- const filename2 = path33.join(fs32.realpathSync(directory), "operation.lock");
67043
+ fs33.mkdirSync(directory, { recursive: true, mode: 448 });
67044
+ const filename2 = path34.join(fs33.realpathSync(directory), "operation.lock");
66895
67045
  const busy = () => new Error("Another preview operation is in progress. Please retry after it finishes.");
66896
67046
  const release = await claimRecoveryMutex(filename2, busy);
66897
67047
  const identity = JSON.stringify({
@@ -66901,8 +67051,8 @@ async function withPreviewLock(project, action) {
66901
67051
  });
66902
67052
  let owned = false;
66903
67053
  try {
66904
- if (fs32.existsSync(filename2)) {
66905
- const previous = fs32.readFileSync(filename2, "utf8");
67054
+ if (fs33.existsSync(filename2)) {
67055
+ const previous = fs33.readFileSync(filename2, "utf8");
66906
67056
  let pid;
66907
67057
  try {
66908
67058
  pid = JSON.parse(previous).pid;
@@ -66912,9 +67062,9 @@ async function withPreviewLock(project, action) {
66912
67062
  throw new Error(
66913
67063
  "Preview operation ownership is still active or unverified. Confirm the previous command has exited before removing only: " + filename2
66914
67064
  );
66915
- fs32.unlinkSync(filename2);
67065
+ fs33.unlinkSync(filename2);
66916
67066
  }
66917
- fs32.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
67067
+ fs33.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
66918
67068
  owned = true;
66919
67069
  return await action();
66920
67070
  } finally {
@@ -66927,7 +67077,7 @@ async function withPreviewLock(project, action) {
66927
67077
  }
66928
67078
  function removeOwnedPreviewLock(filename2, identity) {
66929
67079
  try {
66930
- if (fs32.readFileSync(filename2, "utf8") === identity) fs32.unlinkSync(filename2);
67080
+ if (fs33.readFileSync(filename2, "utf8") === identity) fs33.unlinkSync(filename2);
66931
67081
  } catch (error2) {
66932
67082
  if (error2.code !== "ENOENT") throw error2;
66933
67083
  }
@@ -66941,17 +67091,17 @@ async function withRuntimeInstallLock(action) {
66941
67091
  );
66942
67092
  }
66943
67093
  function activePreviewRuntimeDirectories(project) {
66944
- const root2 = path33.dirname(previewDirectory(project));
66945
- if (!fs32.existsSync(root2)) return [];
67094
+ const root2 = path34.dirname(previewDirectory(project));
67095
+ if (!fs33.existsSync(root2)) return [];
66946
67096
  const protectedDirectories = [];
66947
- for (const entry of fs32.readdirSync(root2, { withFileTypes: true })) {
67097
+ for (const entry of fs33.readdirSync(root2, { withFileTypes: true })) {
66948
67098
  if (!entry.isDirectory() || !/^[a-f0-9]{64}$/.test(entry.name)) continue;
66949
- const filename2 = path33.join(root2, entry.name, "session.json");
66950
- if (!fs32.existsSync(filename2)) continue;
67099
+ const filename2 = path34.join(root2, entry.name, "session.json");
67100
+ if (!fs33.existsSync(filename2)) continue;
66951
67101
  try {
66952
- const record2 = JSON.parse(fs32.readFileSync(filename2, "utf8"));
66953
- if (record2.state !== "stopped" && record2.executable && path33.isAbsolute(record2.executable)) {
66954
- protectedDirectories.push(path33.dirname(record2.executable));
67102
+ const record2 = JSON.parse(fs33.readFileSync(filename2, "utf8"));
67103
+ if (record2.state !== "stopped" && record2.executable && path34.isAbsolute(record2.executable)) {
67104
+ protectedDirectories.push(path34.dirname(record2.executable));
66955
67105
  }
66956
67106
  } catch {
66957
67107
  }
@@ -66977,12 +67127,12 @@ async function installPreviewRuntime(project, signal, update = false) {
66977
67127
  }
66978
67128
  }
66979
67129
  const directory = runtimeDirectory();
66980
- const unresolved = fs32.existsSync(directory) && fs32.readdirSync(directory, { withFileTypes: true }).find(
66981
- (entry) => entry.isDirectory() && entry.name.startsWith("runtime-") && fs32.existsSync(path33.join(directory, entry.name, UNVERIFIED_CLEANUP_MARKER))
67130
+ const unresolved = fs33.existsSync(directory) && fs33.readdirSync(directory, { withFileTypes: true }).find(
67131
+ (entry) => entry.isDirectory() && entry.name.startsWith("runtime-") && fs33.existsSync(path34.join(directory, entry.name, UNVERIFIED_CLEANUP_MARKER))
66982
67132
  );
66983
67133
  if (unresolved) {
66984
67134
  throw new Error(
66985
- "The previous installer cleanup is unverified. Confirm its processes have exited before removing only the marked directory: " + path33.join(directory, unresolved.name)
67135
+ "The previous installer cleanup is unverified. Confirm its processes have exited before removing only the marked directory: " + path34.join(directory, unresolved.name)
66986
67136
  );
66987
67137
  }
66988
67138
  const python = checkMakerPythonEnvironment();
@@ -66991,10 +67141,10 @@ async function installPreviewRuntime(project, signal, update = false) {
66991
67141
  "Runtime installation needs Python and curl. Run taptap-maker python setup with host approval, then retry."
66992
67142
  );
66993
67143
  }
66994
- const staging = path33.join(directory, "runtime-" + randomUUID5());
66995
- fs32.mkdirSync(staging, { recursive: true, mode: 448 });
66996
- const installer = path33.join(staging, "install-urhox-runtime.py");
66997
- fs32.writeFileSync(installer, PREVIEW_INSTALLER_SOURCE, { mode: 384 });
67144
+ const staging = path34.join(directory, "runtime-" + randomUUID5());
67145
+ fs33.mkdirSync(staging, { recursive: true, mode: 448 });
67146
+ const installer = path34.join(staging, "install-urhox-runtime.py");
67147
+ fs33.writeFileSync(installer, PREVIEW_INSTALLER_SOURCE, { mode: 384 });
66998
67148
  const platform = process.platform === "win32" ? "win32" : "darwin";
66999
67149
  try {
67000
67150
  await runPreviewInstaller(
@@ -67007,14 +67157,14 @@ async function installPreviewRuntime(project, signal, update = false) {
67007
67157
  signal
67008
67158
  }
67009
67159
  );
67010
- const executable = fs32.realpathSync(
67011
- path33.join(staging, platform === "win32" ? "UrhoXRuntime.exe" : "UrhoXRuntime")
67160
+ const executable = fs33.realpathSync(
67161
+ path34.join(staging, platform === "win32" ? "UrhoXRuntime.exe" : "UrhoXRuntime")
67012
67162
  );
67013
67163
  const resources2 = ensurePreviewRuntimeResources(executable);
67014
67164
  const runtime = await probeRuntime(executable, signal);
67015
- const archive = path33.join(staging, "UrhoXRuntime.zip");
67165
+ const archive = path34.join(staging, "UrhoXRuntime.zip");
67016
67166
  const hash2 = createHash5("sha256");
67017
- for await (const chunk of fs32.createReadStream(archive)) hash2.update(chunk);
67167
+ for await (const chunk of fs33.createReadStream(archive)) hash2.update(chunk);
67018
67168
  const installation = {
67019
67169
  install_state: "ready",
67020
67170
  executable,
@@ -67024,19 +67174,19 @@ async function installPreviewRuntime(project, signal, update = false) {
67024
67174
  warnings: resources2.warnings
67025
67175
  };
67026
67176
  const protectedDirectories = [staging, ...activePreviewRuntimeDirectories(project)];
67027
- if (previous.executable) protectedDirectories.push(path33.dirname(previous.executable));
67177
+ if (previous.executable) protectedDirectories.push(path34.dirname(previous.executable));
67028
67178
  installation.warnings = [
67029
67179
  ...installation.warnings || [],
67030
67180
  ...trimPreviewCache(directory, "runtime-", 2, protectedDirectories)
67031
67181
  ];
67032
- writePrivateJson(path33.join(directory, "installation.json"), installation);
67182
+ writePrivateJson(path34.join(directory, "installation.json"), installation);
67033
67183
  return installation;
67034
67184
  } catch (error2) {
67035
67185
  const cleanupUnverified = error2.cleanupVerified === false;
67036
- if (!cleanupUnverified) fs32.rmSync(staging, { recursive: true, force: true });
67186
+ if (!cleanupUnverified) fs33.rmSync(staging, { recursive: true, force: true });
67037
67187
  else
67038
- fs32.writeFileSync(
67039
- path33.join(staging, UNVERIFIED_CLEANUP_MARKER),
67188
+ fs33.writeFileSync(
67189
+ path34.join(staging, UNVERIFIED_CLEANUP_MARKER),
67040
67190
  "Installer process ownership must be verified before cleanup.\n",
67041
67191
  { mode: 384 }
67042
67192
  );
@@ -67048,10 +67198,10 @@ async function installPreviewRuntime(project, signal, update = false) {
67048
67198
 
67049
67199
  // src/maker/preview/session.ts
67050
67200
  init_protocol2();
67051
- import fs33 from "node:fs";
67052
- import path34 from "node:path";
67201
+ import fs34 from "node:fs";
67202
+ import path35 from "node:path";
67053
67203
  import http2 from "node:http";
67054
- import os5 from "node:os";
67204
+ import os6 from "node:os";
67055
67205
  import { timingSafeEqual } from "node:crypto";
67056
67206
  init_diagnosticRedaction();
67057
67207
  var PreviewSession = class {
@@ -67076,10 +67226,10 @@ var PreviewSession = class {
67076
67226
  if ((current == null ? void 0 : current.session_id) !== this.record.session_id || current.supervisor_id !== this.record.supervisor_id)
67077
67227
  return;
67078
67228
  writePrivateJson(
67079
- path34.join(previewDirectory(this.record.project_realpath), "session.json"),
67229
+ path35.join(previewDirectory(this.record.project_realpath), "session.json"),
67080
67230
  this.record
67081
67231
  );
67082
- writePrivateJson(path34.join(previewRoundDirectory(this.record), "result.json"), this.status());
67232
+ writePrivateJson(path35.join(previewRoundDirectory(this.record), "result.json"), this.status());
67083
67233
  }
67084
67234
  }
67085
67235
  status() {
@@ -67184,12 +67334,17 @@ var PreviewSession = class {
67184
67334
  if (this.runtime !== runtime || this.stopping) return;
67185
67335
  if (state === "stopped" && this.record.state === "reloading") return;
67186
67336
  this.setState(state);
67337
+ },
67338
+ void 0,
67339
+ (pid) => {
67340
+ this.record.runtime_launch_pending = pid === void 0;
67341
+ this.setState(this.record.state);
67187
67342
  }
67188
67343
  );
67189
67344
  this.runtime = runtime;
67190
67345
  await runtime.start(
67191
67346
  String(this.preflight.entry),
67192
- path34.join(previewDirectory(this.record.project_realpath), "storage"),
67347
+ path35.join(previewDirectory(this.record.project_realpath), "storage"),
67193
67348
  this.preflight.window
67194
67349
  );
67195
67350
  if (this.stopping) throw new Error("CANCELLED");
@@ -67208,7 +67363,7 @@ var PreviewSession = class {
67208
67363
  } finally {
67209
67364
  try {
67210
67365
  trimPreviewEvidence(
67211
- path34.join(previewDirectory(this.record.project_realpath), "sessions"),
67366
+ path35.join(previewDirectory(this.record.project_realpath), "sessions"),
67212
67367
  this.record.session_id,
67213
67368
  this.record.reload_id
67214
67369
  );
@@ -67376,7 +67531,7 @@ async function runPreviewSupervisor(project, sessionId) {
67376
67531
  try {
67377
67532
  const current = readPreviewRecord(project);
67378
67533
  if ((current == null ? void 0 : current.session_id) === record2.session_id && current.supervisor_id === record2.supervisor_id && current.reload_id === record2.reload_id) {
67379
- writePrivateJson(path34.join(previewRoundDirectory(record2), "result.json"), {
67534
+ writePrivateJson(path35.join(previewRoundDirectory(record2), "result.json"), {
67380
67535
  ...session.status(),
67381
67536
  supervisor_retired: true
67382
67537
  });
@@ -67452,7 +67607,8 @@ async function runPreviewSupervisor(project, sessionId) {
67452
67607
  record2.port = address.port;
67453
67608
  record2.supervisor_pid = process.pid;
67454
67609
  record2.runtime_pid = 0;
67455
- writePrivateJson(path34.join(previewDirectory(project), "session.json"), record2);
67610
+ record2.runtime_launch_pending = false;
67611
+ writePrivateJson(path35.join(previewDirectory(project), "session.json"), record2);
67456
67612
  const idleTimer = setInterval(() => {
67457
67613
  if (record2.state === "stopped") void shutdown();
67458
67614
  else if (session.canRetireFailure) void shutdown(true);
@@ -67486,10 +67642,10 @@ async function previewStatus(project) {
67486
67642
  };
67487
67643
  } catch {
67488
67644
  const stopped = record2.state === "stopped";
67489
- const filename2 = path34.join(previewRoundDirectory(record2), "result.json");
67645
+ const filename2 = path35.join(previewRoundDirectory(record2), "result.json");
67490
67646
  let evidence = {};
67491
- if (fs33.existsSync(filename2)) {
67492
- const saved = JSON.parse(fs33.readFileSync(filename2, "utf8"));
67647
+ if (fs34.existsSync(filename2)) {
67648
+ const saved = JSON.parse(fs34.readFileSync(filename2, "utf8"));
67493
67649
  if (samePreviewIdentity(saved, record2)) {
67494
67650
  evidence = { ...saved };
67495
67651
  delete evidence.token;
@@ -67499,8 +67655,9 @@ async function previewStatus(project) {
67499
67655
  const runtimePid = Number(record2.runtime_pid || evidence.runtime_pid || 0);
67500
67656
  const unpublished = record2.state === "starting" && !record2.port && !record2.supervisor_pid && !record2.runtime_pid;
67501
67657
  const expiredLaunch = unpublished && record2.launch_deadline !== void 0 && Date.now() >= record2.launch_deadline;
67502
- const beforeBoot = unpublished && Date.parse(record2.started_at) < Date.now() - os5.uptime() * 1e3 - 6e4;
67503
- const staleSessionRecovered = expiredLaunch || beforeBoot || !retiredFailure && (record2.state === "running" || record2.state === "failed") && sameSupervisorEvidence(evidence, record2) && processPresence(record2.supervisor_pid) === "missing" && runtimePid > 0 && processPresence(runtimePid) === "missing";
67658
+ const beforeBoot = record2.state === "starting" && Date.parse(record2.started_at) < Date.now() - os6.uptime() * 1e3 - 6e4 && (record2.supervisor_pid === 0 || processPresence(record2.supervisor_pid) === "missing") && (runtimePid === 0 || processPresence(runtimePid) === "missing");
67659
+ const interruptedStartup = record2.state === "starting" && record2.port > 0 && record2.supervisor_pid > 0 && record2.runtime_launch_pending === false && processPresence(record2.supervisor_pid) === "missing" && (runtimePid === 0 || processPresence(runtimePid) === "missing");
67660
+ const staleSessionRecovered = expiredLaunch || beforeBoot || interruptedStartup || !retiredFailure && (record2.state === "running" || record2.state === "failed") && sameSupervisorEvidence(evidence, record2) && processPresence(record2.supervisor_pid) === "missing" && runtimePid > 0 && processPresence(runtimePid) === "missing";
67504
67661
  if (staleSessionRecovered) {
67505
67662
  evidence = {
67506
67663
  ...evidence,
@@ -67512,7 +67669,7 @@ async function previewStatus(project) {
67512
67669
  runtime_pid: 0,
67513
67670
  supervisor_retired: true,
67514
67671
  stale_session_recovered: true,
67515
- error: expiredLaunch ? "本地预览启动超时,未启动游戏。可以重新点击“本地预览”。" : "Previous preview processes are no longer running. The stale session was retired safely."
67672
+ error: expiredLaunch ? "本地预览启动超时,未启动游戏。可以重新点击“本地预览”。" : interruptedStartup ? "本地预览启动已中断,已确认相关进程不存在。可以重新点击“本地预览”。" : "Previous preview processes are no longer running. The stale session was retired safely."
67516
67673
  };
67517
67674
  }
67518
67675
  return {
@@ -67543,8 +67700,8 @@ init_diagnosticRedaction();
67543
67700
 
67544
67701
  // src/maker/system/backgroundProcess.ts
67545
67702
  import { spawn as spawn8 } from "node:child_process";
67546
- import fs34 from "node:fs";
67547
- import path35 from "node:path";
67703
+ import fs35 from "node:fs";
67704
+ import path36 from "node:path";
67548
67705
  var WINDOWS_ENV_KEYS = /* @__PURE__ */ new Set([
67549
67706
  "APPDATA",
67550
67707
  "COMSPEC",
@@ -67579,9 +67736,9 @@ var WINDOWS_ENV_KEYS = /* @__PURE__ */ new Set([
67579
67736
  "WINDIR"
67580
67737
  ]);
67581
67738
  function openBackgroundProcessLog(filename2) {
67582
- fs34.mkdirSync(path35.dirname(filename2), { recursive: true, mode: 448 });
67583
- const oversized = fs34.existsSync(filename2) && fs34.statSync(filename2).size > 1024 * 1024;
67584
- return fs34.openSync(filename2, oversized ? "w" : "a", 384);
67739
+ fs35.mkdirSync(path36.dirname(filename2), { recursive: true, mode: 448 });
67740
+ const oversized = fs35.existsSync(filename2) && fs35.statSync(filename2).size > 1024 * 1024;
67741
+ return fs35.openSync(filename2, oversized ? "w" : "a", 384);
67585
67742
  }
67586
67743
  function selectWindowsBackgroundEnvironment(env) {
67587
67744
  return Object.fromEntries(
@@ -67623,7 +67780,7 @@ async function launchBackgroundProcess(options3) {
67623
67780
  var _a3, _b, _c;
67624
67781
  if ((_a3 = options3.signal) == null ? void 0 : _a3.aborted) throw new Error("CANCELLED: background launch.");
67625
67782
  if ((options3.platform ?? process.platform) !== "win32") return directLaunch(options3);
67626
- fs34.closeSync(openBackgroundProcessLog(options3.logFile));
67783
+ fs35.closeSync(openBackgroundProcessLog(options3.logFile));
67627
67784
  const scripts = buildWindowsBackgroundLaunchScripts(options3);
67628
67785
  const broker = spawn8(
67629
67786
  "powershell.exe",
@@ -67696,7 +67853,7 @@ function directLaunch(options3) {
67696
67853
  env: options3.env
67697
67854
  });
67698
67855
  } finally {
67699
- fs34.closeSync(stderr);
67856
+ fs35.closeSync(stderr);
67700
67857
  }
67701
67858
  let launchFailure;
67702
67859
  child.once("error", (error2) => {
@@ -67800,7 +67957,7 @@ async function runPreviewCli(action, options3) {
67800
67957
  );
67801
67958
  } else {
67802
67959
  if (action === "stop") {
67803
- writePrivateJson(path36.join(previewDirectory(project), "stop.json"), {
67960
+ writePrivateJson(path37.join(previewDirectory(project), "stop.json"), {
67804
67961
  request_id: randomUUID6()
67805
67962
  });
67806
67963
  }
@@ -67879,8 +68036,8 @@ async function runPreviewCli(action, options3) {
67879
68036
  process.exitCode = 1;
67880
68037
  }
67881
68038
  async function startPreview(project, options3, signal) {
67882
- const stopFile = path36.join(previewDirectory(project), "stop.json");
67883
- const readStop = () => fs35.existsSync(stopFile) ? fs35.readFileSync(stopFile, "utf8") : "";
68039
+ const stopFile = path37.join(previewDirectory(project), "stop.json");
68040
+ const readStop = () => fs36.existsSync(stopFile) ? fs36.readFileSync(stopFile, "utf8") : "";
67884
68041
  const stopGeneration = readStop();
67885
68042
  const checkCancelled = () => {
67886
68043
  if (signal.aborted || readStop() !== stopGeneration)
@@ -67914,9 +68071,9 @@ async function startPreview(project, options3, signal) {
67914
68071
  install_state: "missing",
67915
68072
  error: "Runtime is missing. With host approval, run taptap-maker preview install --target-dir <PROJECT_ABSOLUTE_PATH>, then retry start."
67916
68073
  };
67917
- if (!path36.isAbsolute(configured))
68074
+ if (!path37.isAbsolute(configured))
67918
68075
  throw new Error("--runtime must be an absolute executable path.");
67919
- const executable = fs35.realpathSync(configured);
68076
+ const executable = fs36.realpathSync(configured);
67920
68077
  const resourceWarnings = externalRuntime ? [] : ensurePreviewRuntimeResources(executable).warnings;
67921
68078
  const runtime = await probeRuntime(executable, signal);
67922
68079
  checkCancelled();
@@ -67936,14 +68093,14 @@ async function startPreview(project, options3, signal) {
67936
68093
  state: "starting",
67937
68094
  runtime
67938
68095
  };
67939
- writePrivateJson(path36.join(previewDirectory(project), "session.json"), record2);
68096
+ writePrivateJson(path37.join(previewDirectory(project), "session.json"), record2);
67940
68097
  const launch = await launchPreviewSupervisorProcess({
67941
68098
  execPath: process.execPath,
67942
68099
  execArgv: process.execArgv,
67943
68100
  entry: process.argv[1],
67944
68101
  project,
67945
68102
  sessionId: record2.session_id,
67946
- cwd: path36.dirname(executable),
68103
+ cwd: path37.dirname(executable),
67947
68104
  logFile: previewSupervisorLogPath(project),
67948
68105
  env: process.env,
67949
68106
  signal
@@ -67988,7 +68145,7 @@ async function startPreview(project, options3, signal) {
67988
68145
  } else {
67989
68146
  if (launch.stopUnpublished()) {
67990
68147
  record2.state = "stopped";
67991
- writePrivateJson(path36.join(previewDirectory(project), "session.json"), record2);
68148
+ writePrivateJson(path37.join(previewDirectory(project), "session.json"), record2);
67992
68149
  } else {
67993
68150
  throw new Error(
67994
68151
  String(error2) + "; supervisor exit is unverified. Inspect " + previewSupervisorLogPath(project)
@@ -68000,8 +68157,8 @@ async function startPreview(project, options3, signal) {
68000
68157
  }
68001
68158
 
68002
68159
  // src/maker/console/cli.ts
68003
- import fs43 from "node:fs";
68004
- import path45 from "node:path";
68160
+ import fs44 from "node:fs";
68161
+ import path46 from "node:path";
68005
68162
  import { spawn as spawn11 } from "node:child_process";
68006
68163
  import { createHash as createHash8, randomUUID as randomUUID8 } from "node:crypto";
68007
68164
  init_storage();
@@ -68014,8 +68171,8 @@ init_projectSettings();
68014
68171
  init_qrcodePreflight();
68015
68172
  init_qrcodeInteraction();
68016
68173
  init_git();
68017
- import fs36 from "node:fs";
68018
- import path37 from "node:path";
68174
+ import fs37 from "node:fs";
68175
+ import path38 from "node:path";
68019
68176
  import { execFile as execFile2 } from "node:child_process";
68020
68177
  import { promisify as promisify2 } from "node:util";
68021
68178
 
@@ -68039,17 +68196,17 @@ var ConsoleError = class extends Error {
68039
68196
  // src/maker/console/projects.ts
68040
68197
  var exec = promisify2(execFile2);
68041
68198
  function objectFile2(filename2) {
68042
- const stat = fs36.statSync(filename2);
68199
+ const stat = fs37.statSync(filename2);
68043
68200
  if (!stat.isFile() || stat.size > 2 * 1024 * 1024)
68044
68201
  throw new ConsoleError("Project configuration exceeds the supported size.");
68045
- const data = JSON.parse(fs36.readFileSync(filename2, "utf8"));
68202
+ const data = JSON.parse(fs37.readFileSync(filename2, "utf8"));
68046
68203
  if (!data || typeof data !== "object" || Array.isArray(data))
68047
68204
  throw new ConsoleError("Invalid project configuration.");
68048
68205
  return data;
68049
68206
  }
68050
68207
  function optionalConfig(root2, file3) {
68051
68208
  try {
68052
- return objectFile2(path37.join(root2, ".project", file3));
68209
+ return objectFile2(path38.join(root2, ".project", file3));
68053
68210
  } catch {
68054
68211
  return {};
68055
68212
  }
@@ -68092,7 +68249,7 @@ var ConsoleProjects = class {
68092
68249
  const error2 = entry.error;
68093
68250
  const config2 = error2 ? {} : optionalConfig(entry.path, "project.json");
68094
68251
  const title = (_b = text((_a3 = config2.taptap_publish) == null ? void 0 : _a3.title)) == null ? void 0 : _b.trim();
68095
- const name = title && title !== "<game title, required>" ? title : path37.basename(entry.path) + (error2 ? "" : "(未发布)");
68252
+ const name = title && title !== "<game title, required>" ? title : path38.basename(entry.path) + (error2 ? "" : "(未发布)");
68096
68253
  return {
68097
68254
  key: entry.key,
68098
68255
  projectid: entry.binding,
@@ -68128,7 +68285,7 @@ var ConsoleProjects = class {
68128
68285
  const entry = config2["entry@server"] || resources2["entry@server"];
68129
68286
  const normalized = typeof entry === "string" ? entry.replace(/\\/g, "/").replace(/^\.\//, "") : "";
68130
68287
  const entries = normalized ? [normalized, "scripts/" + normalized, "assets/" + normalized] : [];
68131
- const directories = entries.map((file3) => path37.posix.dirname(file3)).filter((dir) => ![".", "scripts", "assets"].includes(dir));
68288
+ const directories = entries.map((file3) => path38.posix.dirname(file3)).filter((dir) => ![".", "scripts", "assets"].includes(dir));
68132
68289
  const raw = (await inspectGit(["status", "--porcelain=v1", "-z", "--untracked-files=all"])).split("\0");
68133
68290
  const files = /* @__PURE__ */ new Set();
68134
68291
  for (let i = 0; i < raw.length && raw[i]; i++) {
@@ -68145,7 +68302,7 @@ var ConsoleProjects = class {
68145
68302
  const meta3 = source + ".meta";
68146
68303
  const current = (() => {
68147
68304
  try {
68148
- return objectFile2(path37.join(project.path, meta3));
68305
+ return objectFile2(path38.join(project.path, meta3));
68149
68306
  } catch {
68150
68307
  return {};
68151
68308
  }
@@ -68532,8 +68689,8 @@ init_privateJson();
68532
68689
  init_diagnosticRedaction();
68533
68690
  init_qrcodePreflight();
68534
68691
  init_qrcodeInteraction();
68535
- import fs37 from "node:fs";
68536
- import path38 from "node:path";
68692
+ import fs38 from "node:fs";
68693
+ import path39 from "node:path";
68537
68694
  import { randomUUID as randomUUID7 } from "node:crypto";
68538
68695
  var ConsoleTasks = class {
68539
68696
  constructor(projects, execute, historyFile, onSettled = () => {
@@ -68544,10 +68701,10 @@ var ConsoleTasks = class {
68544
68701
  this.onSettled = onSettled;
68545
68702
  this.tasks = /* @__PURE__ */ new Map();
68546
68703
  this.running = /* @__PURE__ */ new Set();
68547
- if (historyFile && fs37.existsSync(historyFile)) {
68548
- if (fs37.statSync(historyFile).size > 40 * 1024 * 1024)
68704
+ if (historyFile && fs38.existsSync(historyFile)) {
68705
+ if (fs38.statSync(historyFile).size > 40 * 1024 * 1024)
68549
68706
  throw new ConsoleError("Console task history exceeds the supported size.");
68550
- const data = JSON.parse(fs37.readFileSync(historyFile, "utf8"));
68707
+ const data = JSON.parse(fs38.readFileSync(historyFile, "utf8"));
68551
68708
  if (!Array.isArray(data) || data.length > 100)
68552
68709
  throw new ConsoleError("Invalid console task history.");
68553
68710
  for (const task of data) {
@@ -68709,7 +68866,7 @@ var ConsoleTasks = class {
68709
68866
  persist() {
68710
68867
  this.pruneHistory();
68711
68868
  if (this.historyFile) {
68712
- fs37.mkdirSync(path38.dirname(this.historyFile), { recursive: true, mode: 448 });
68869
+ fs38.mkdirSync(path39.dirname(this.historyFile), { recursive: true, mode: 448 });
68713
68870
  while (Buffer.byteLength(JSON.stringify(Array.from(this.tasks.values()))) > 40 * 1024 * 1024) {
68714
68871
  const oldest = this.list().reverse().find((task) => task.status !== "running");
68715
68872
  if (!oldest) throw new ConsoleError("Active console history exceeds the supported size.");
@@ -68725,8 +68882,8 @@ init_diagnosticRedaction();
68725
68882
  init_luaLsp();
68726
68883
 
68727
68884
  // src/maker/console/integrations/framecrate.ts
68728
- import fs38 from "node:fs";
68729
- import path39 from "node:path";
68885
+ import fs39 from "node:fs";
68886
+ import path40 from "node:path";
68730
68887
  import { pathToFileURL } from "node:url";
68731
68888
  import { spawn as spawn10 } from "node:child_process";
68732
68889
  var FramecrateLauncher = class {
@@ -68764,7 +68921,7 @@ var FramecrateLauncher = class {
68764
68921
  throw new ConsoleError("FrameCrate requires the exact console host origin.");
68765
68922
  }
68766
68923
  }
68767
- if (!path39.isAbsolute(projectPath) || fs38.realpathSync(projectPath) !== projectPath)
68924
+ if (!path40.isAbsolute(projectPath) || fs39.realpathSync(projectPath) !== projectPath)
68768
68925
  throw new ConsoleError("FrameCrate requires a validated project realpath.");
68769
68926
  const existing = this.sessions.get(projectPath);
68770
68927
  if (existing) {
@@ -68782,7 +68939,7 @@ var FramecrateLauncher = class {
68782
68939
  );
68783
68940
  const env = this.options.env ?? process.env;
68784
68941
  const configured = (_a3 = env.FRAMECRATE_STUDIO_DIR) == null ? void 0 : _a3.trim();
68785
- if (!configured || !path39.isAbsolute(configured))
68942
+ if (!configured || !path40.isAbsolute(configured))
68786
68943
  throw new ConsoleError(
68787
68944
  "FrameCrate unavailable: set FRAMECRATE_STUDIO_DIR to the absolute path of an installed studio, then reopen the console.",
68788
68945
  409
@@ -68791,10 +68948,10 @@ var FramecrateLauncher = class {
68791
68948
  let entry;
68792
68949
  let loader;
68793
68950
  try {
68794
- root2 = fs38.realpathSync(configured);
68795
- entry = path39.join(root2, "server/main.ts");
68796
- loader = path39.join(root2, "node_modules/tsx/dist/loader.mjs");
68797
- if (!fs38.statSync(entry).isFile() || !fs38.statSync(loader).isFile()) throw new Error();
68951
+ root2 = fs39.realpathSync(configured);
68952
+ entry = path40.join(root2, "server/main.ts");
68953
+ loader = path40.join(root2, "node_modules/tsx/dist/loader.mjs");
68954
+ if (!fs39.statSync(entry).isFile() || !fs39.statSync(loader).isFile()) throw new Error();
68798
68955
  } catch {
68799
68956
  throw new ConsoleError(
68800
68957
  "FrameCrate unavailable: FRAMECRATE_STUDIO_DIR must contain server/main.ts and node_modules/tsx/dist/loader.mjs. No installer is provided.",
@@ -68991,14 +69148,14 @@ var ConsolePlugins = class {
68991
69148
 
68992
69149
  // src/maker/console/updates.ts
68993
69150
  import { execFile as execFile3 } from "node:child_process";
68994
- import fs40 from "node:fs";
68995
- import path41 from "node:path";
69151
+ import fs41 from "node:fs";
69152
+ import path42 from "node:path";
68996
69153
 
68997
69154
  // src/maker/cli/mcpLauncher.ts
68998
69155
  init_client2();
68999
69156
  init_stdio3();
69000
- import fs39 from "node:fs";
69001
- import path40 from "node:path";
69157
+ import fs40 from "node:fs";
69158
+ import path41 from "node:path";
69002
69159
  import { fileURLToPath as fileURLToPath3 } from "node:url";
69003
69160
  var DEFAULT_VERIFY_TIMEOUT_MS = 9e4;
69004
69161
  var VERIFY_CLIENT_VERSION = "1.0.0";
@@ -69025,33 +69182,33 @@ function materializeMakerSelfLauncher(options3) {
69025
69182
  throw new Error(`Invalid Maker runtime version: ${options3.version}`);
69026
69183
  }
69027
69184
  const execPath = options3.execPath ?? process.execPath;
69028
- if (!path40.isAbsolute(execPath) || !fs39.existsSync(execPath)) {
69185
+ if (!path41.isAbsolute(execPath) || !fs40.existsSync(execPath)) {
69029
69186
  throw new Error("Maker self launcher requires an existing absolute Node executable.");
69030
69187
  }
69031
69188
  const sourceBundle = fileURLToPath3(options3.bundleUrl);
69032
- const sourceRoot = path40.dirname(path40.dirname(sourceBundle));
69033
- const runtimeRoot = path40.join(path40.resolve(options3.makerHome), "mcp-runtime", options3.version);
69189
+ const sourceRoot = path41.dirname(path41.dirname(sourceBundle));
69190
+ const runtimeRoot = path41.join(path41.resolve(options3.makerHome), "mcp-runtime", options3.version);
69034
69191
  for (const relativePath of [...SELF_RUNTIME_FILES, ...SELF_RUNTIME_DIRECTORIES]) {
69035
- const sourcePath = path40.join(sourceRoot, relativePath);
69036
- if (!fs39.existsSync(sourcePath)) {
69192
+ const sourcePath = path41.join(sourceRoot, relativePath);
69193
+ if (!fs40.existsSync(sourcePath)) {
69037
69194
  throw new Error(`Maker self runtime source is incomplete: ${sourcePath}`);
69038
69195
  }
69039
69196
  }
69040
- if (path40.resolve(sourceRoot) !== path40.resolve(runtimeRoot)) {
69197
+ if (path41.resolve(sourceRoot) !== path41.resolve(runtimeRoot)) {
69041
69198
  for (const relativePath of SELF_RUNTIME_FILES) {
69042
- const sourcePath = path40.join(sourceRoot, relativePath);
69043
- const targetPath = path40.join(runtimeRoot, relativePath);
69044
- fs39.mkdirSync(path40.dirname(targetPath), { recursive: true });
69045
- fs39.copyFileSync(sourcePath, targetPath);
69199
+ const sourcePath = path41.join(sourceRoot, relativePath);
69200
+ const targetPath = path41.join(runtimeRoot, relativePath);
69201
+ fs40.mkdirSync(path41.dirname(targetPath), { recursive: true });
69202
+ fs40.copyFileSync(sourcePath, targetPath);
69046
69203
  }
69047
69204
  for (const relativePath of SELF_RUNTIME_DIRECTORIES) {
69048
69205
  copySelfRuntimeDirectory(
69049
- path40.join(sourceRoot, relativePath),
69050
- path40.join(runtimeRoot, relativePath)
69206
+ path41.join(sourceRoot, relativePath),
69207
+ path41.join(runtimeRoot, relativePath)
69051
69208
  );
69052
69209
  }
69053
69210
  }
69054
- const stableBundle = path40.join(runtimeRoot, "dist", "maker.js");
69211
+ const stableBundle = path41.join(runtimeRoot, "dist", "maker.js");
69055
69212
  return {
69056
69213
  kind: "self_runtime",
69057
69214
  command: execPath,
@@ -69061,7 +69218,7 @@ function materializeMakerSelfLauncher(options3) {
69061
69218
  }
69062
69219
  function copySelfRuntimeDirectory(sourcePath, targetPath) {
69063
69220
  try {
69064
- fs39.cpSync(sourcePath, targetPath, { recursive: true });
69221
+ fs40.cpSync(sourcePath, targetPath, { recursive: true });
69065
69222
  } catch (error2) {
69066
69223
  const code = typeof error2 === "object" && error2 !== null && "code" in error2 ? String(error2.code) : void 0;
69067
69224
  if (!code || !SELF_RUNTIME_COPY_FALLBACK_CODES.has(code)) {
@@ -69071,14 +69228,14 @@ function copySelfRuntimeDirectory(sourcePath, targetPath) {
69071
69228
  }
69072
69229
  }
69073
69230
  function copyDirectoryEntries(sourcePath, targetPath) {
69074
- fs39.mkdirSync(targetPath, { recursive: true });
69075
- for (const entry of fs39.readdirSync(sourcePath, { withFileTypes: true })) {
69076
- const sourceEntry = path40.join(sourcePath, entry.name);
69077
- const targetEntry = path40.join(targetPath, entry.name);
69231
+ fs40.mkdirSync(targetPath, { recursive: true });
69232
+ for (const entry of fs40.readdirSync(sourcePath, { withFileTypes: true })) {
69233
+ const sourceEntry = path41.join(sourcePath, entry.name);
69234
+ const targetEntry = path41.join(targetPath, entry.name);
69078
69235
  if (entry.isDirectory()) {
69079
69236
  copyDirectoryEntries(sourceEntry, targetEntry);
69080
69237
  } else {
69081
- fs39.copyFileSync(sourceEntry, targetEntry);
69238
+ fs40.copyFileSync(sourceEntry, targetEntry);
69082
69239
  }
69083
69240
  }
69084
69241
  }
@@ -69093,10 +69250,10 @@ function resolveMakerMcpLauncher(options3) {
69093
69250
  commandAndArgs: ["npx", ...args]
69094
69251
  };
69095
69252
  }
69096
- const existsSync2 = options3.existsSync ?? fs39.existsSync;
69253
+ const existsSync2 = options3.existsSync ?? fs40.existsSync;
69097
69254
  const execPath = options3.execPath ?? process.execPath;
69098
69255
  const npmExecPath = options3.npmExecPath ?? process.env.npm_execpath;
69099
- const windowsPath = path40.win32;
69256
+ const windowsPath = path41.win32;
69100
69257
  const npmCliCandidates = uniqueStrings([
69101
69258
  npmExecPath,
69102
69259
  windowsPath.join(windowsPath.dirname(execPath), "node_modules", "npm", "bin", "npm-cli.js")
@@ -69264,8 +69421,8 @@ function runConsoleUpgrade(version2) {
69264
69421
  if (!VERSION2.test(version2)) throw new Error("无效版本号");
69265
69422
  const launcher = resolveMakerMcpLauncher({ packageName: `@taptap/maker@${version2}` });
69266
69423
  const home2 = getMakerHome();
69267
- const cache = path41.join(home2, "cache", "npm");
69268
- fs40.mkdirSync(cache, { recursive: true });
69424
+ const cache = path42.join(home2, "cache", "npm");
69425
+ fs41.mkdirSync(cache, { recursive: true });
69269
69426
  return new Promise((resolve, reject) => {
69270
69427
  execFile3(
69271
69428
  launcher.command,
@@ -69351,8 +69508,8 @@ var ConsoleUpdates = class {
69351
69508
  };
69352
69509
 
69353
69510
  // src/maker/console/documents.ts
69354
- import fs41 from "node:fs";
69355
- import path42 from "node:path";
69511
+ import fs42 from "node:fs";
69512
+ import path43 from "node:path";
69356
69513
  import { createHash as createHash6 } from "node:crypto";
69357
69514
 
69358
69515
  // node_modules/marked/lib/marked.esm.js
@@ -71458,8 +71615,8 @@ var GROUPS = [
71458
71615
  ["templates", "示例与模板"]
71459
71616
  ];
71460
71617
  function inside2(root2, file3) {
71461
- const relative = path42.relative(root2, file3);
71462
- return relative !== ".." && !relative.startsWith(`..${path42.sep}`) && !path42.isAbsolute(relative);
71618
+ const relative = path43.relative(root2, file3);
71619
+ return relative !== ".." && !relative.startsWith(`..${path43.sep}`) && !path43.isAbsolute(relative);
71463
71620
  }
71464
71621
  var ConsoleDocuments = class {
71465
71622
  constructor(packageRoot) {
@@ -71470,34 +71627,34 @@ var ConsoleDocuments = class {
71470
71627
  const seen = /* @__PURE__ */ new Set();
71471
71628
  let visited = 0;
71472
71629
  const collect = (base, source, relative, kind, category) => {
71473
- if (!fs41.existsSync(base)) return;
71474
- const root2 = fs41.realpathSync(base);
71630
+ if (!fs42.existsSync(base)) return;
71631
+ const root2 = fs42.realpathSync(base);
71475
71632
  const walk = (filename2, depth) => {
71476
71633
  var _a3, _b;
71477
71634
  if (depth > 7 || visited++ > 6e3 || entries.length >= MAX_ENTRIES) return;
71478
71635
  try {
71479
- const real = fs41.realpathSync(filename2);
71636
+ const real = fs42.realpathSync(filename2);
71480
71637
  if (!inside2(root2, real)) return;
71481
- const stat = fs41.statSync(real);
71638
+ const stat = fs42.statSync(real);
71482
71639
  if (stat.isDirectory()) {
71483
- if (fs41.lstatSync(filename2).isSymbolicLink()) return;
71484
- for (const name of fs41.readdirSync(filename2).sort()) {
71640
+ if (fs42.lstatSync(filename2).isSymbolicLink()) return;
71641
+ for (const name of fs42.readdirSync(filename2).sort()) {
71485
71642
  if (name === "node_modules" || name === ".git") continue;
71486
- walk(path42.join(filename2, name), depth + 1);
71643
+ walk(path43.join(filename2, name), depth + 1);
71487
71644
  }
71488
71645
  } else if (stat.isFile() && /\.md$/i.test(filename2) && stat.size <= MAX_FILE && !seen.has(real)) {
71489
71646
  seen.add(real);
71490
- const relativePath = path42.relative(root2, filename2).split(path42.sep).join("/");
71491
- const descriptor = fs41.openSync(real, "r");
71647
+ const relativePath = path43.relative(root2, filename2).split(path43.sep).join("/");
71648
+ const descriptor = fs42.openSync(real, "r");
71492
71649
  const buffer = Buffer.alloc(Math.min(8192, stat.size));
71493
71650
  let content;
71494
71651
  try {
71495
- content = buffer.subarray(0, fs41.readSync(descriptor, buffer, 0, buffer.length, 0)).toString("utf8");
71652
+ content = buffer.subarray(0, fs42.readSync(descriptor, buffer, 0, buffer.length, 0)).toString("utf8");
71496
71653
  } finally {
71497
- fs41.closeSync(descriptor);
71654
+ fs42.closeSync(descriptor);
71498
71655
  }
71499
71656
  const heading = (_b = (_a3 = content.match(/^#\s+(.+)$/m)) == null ? void 0 : _a3[1]) == null ? void 0 : _b.trim();
71500
- const fallback = path42.basename(filename2).toLowerCase() === "skill.md" ? path42.basename(path42.dirname(filename2)) : path42.basename(filename2, path42.extname(filename2));
71657
+ const fallback = path43.basename(filename2).toLowerCase() === "skill.md" ? path43.basename(path43.dirname(filename2)) : path43.basename(filename2, path43.extname(filename2));
71501
71658
  entries.push({
71502
71659
  id: createHash6("sha256").update(source + ":" + relativePath).digest("hex"),
71503
71660
  title: (heading || fallback).slice(0, 160),
@@ -71512,7 +71669,7 @@ var ConsoleDocuments = class {
71512
71669
  } catch {
71513
71670
  }
71514
71671
  };
71515
- walk(path42.join(root2, relative), 0);
71672
+ walk(path43.join(root2, relative), 0);
71516
71673
  };
71517
71674
  for (const filename2 of [
71518
71675
  "MAKER_CONSOLE.md",
@@ -71564,10 +71721,10 @@ var ConsoleDocuments = class {
71564
71721
  if (!entry) throw new ConsoleError("文档不存在或已移除,请刷新目录。", 404);
71565
71722
  let content = entry.content;
71566
71723
  if (content === void 0) {
71567
- const real = fs41.realpathSync(entry.filename);
71568
- if (!inside2(entry.root, real) || fs41.statSync(real).size > MAX_FILE)
71724
+ const real = fs42.realpathSync(entry.filename);
71725
+ if (!inside2(entry.root, real) || fs42.statSync(real).size > MAX_FILE)
71569
71726
  throw new ConsoleError("文档无法安全读取。", 403);
71570
- content = fs41.readFileSync(real, "utf8");
71727
+ content = fs42.readFileSync(real, "utf8");
71571
71728
  }
71572
71729
  return {
71573
71730
  id,
@@ -71580,7 +71737,7 @@ var ConsoleDocuments = class {
71580
71737
 
71581
71738
  // src/maker/console/folderPicker.ts
71582
71739
  import { execFile as execFile4 } from "node:child_process";
71583
- import path43 from "node:path";
71740
+ import path44 from "node:path";
71584
71741
  async function chooseProjectDirectory(platform = process.platform, signal) {
71585
71742
  let command;
71586
71743
  let args;
@@ -71598,7 +71755,7 @@ async function chooseProjectDirectory(platform = process.platform, signal) {
71598
71755
  ].join("\n")
71599
71756
  ];
71600
71757
  } else if (platform === "win32") {
71601
- command = path43.win32.join(
71758
+ command = path44.win32.join(
71602
71759
  process.env.SystemRoot || "C:\\Windows",
71603
71760
  "System32",
71604
71761
  "WindowsPowerShell",
@@ -71663,8 +71820,8 @@ async function chooseProjectDirectory(platform = process.platform, signal) {
71663
71820
  }
71664
71821
 
71665
71822
  // src/maker/console/projectDiscovery.ts
71666
- import fs42 from "node:fs";
71667
- import path44 from "node:path";
71823
+ import fs43 from "node:fs";
71824
+ import path45 from "node:path";
71668
71825
  var EXCLUDED = /* @__PURE__ */ new Set([
71669
71826
  ".git",
71670
71827
  "node_modules",
@@ -71679,7 +71836,7 @@ var EXCLUDED = /* @__PURE__ */ new Set([
71679
71836
  "System Volume Information"
71680
71837
  ]);
71681
71838
  async function discoverConsoleProjects(directory, registry2) {
71682
- const root2 = await fs42.promises.realpath(directory);
71839
+ const root2 = await fs43.promises.realpath(directory);
71683
71840
  const known = new Set(registry2.list().map((project) => project.path));
71684
71841
  const result = { added: 0, existing: 0, skipped: 0, limited: false };
71685
71842
  const deadline = Date.now() + 1e4;
@@ -71692,8 +71849,8 @@ async function discoverConsoleProjects(directory, registry2) {
71692
71849
  }
71693
71850
  const current = queue.shift();
71694
71851
  visited++;
71695
- const marker = path44.join(current.directory, ".maker-mcp/config.json");
71696
- if (fs42.existsSync(marker) || fs42.existsSync(path44.join(current.directory, ".project/project.json"))) {
71852
+ const marker = path45.join(current.directory, ".maker-mcp/config.json");
71853
+ if (fs43.existsSync(marker) || fs43.existsSync(path45.join(current.directory, ".project/project.json"))) {
71697
71854
  try {
71698
71855
  const project = registry2.add(current.directory);
71699
71856
  if (known.has(project.path)) result.existing++;
@@ -71707,7 +71864,7 @@ async function discoverConsoleProjects(directory, registry2) {
71707
71864
  }
71708
71865
  }
71709
71866
  try {
71710
- const entries = await fs42.promises.opendir(current.directory);
71867
+ const entries = await fs43.promises.opendir(current.directory);
71711
71868
  for await (const entry of entries) {
71712
71869
  if (++visited >= 5e3 || Date.now() >= deadline) {
71713
71870
  result.limited = true;
@@ -71719,7 +71876,7 @@ async function discoverConsoleProjects(directory, registry2) {
71719
71876
  continue;
71720
71877
  }
71721
71878
  queue.push({
71722
- directory: path44.join(current.directory, entry.name),
71879
+ directory: path45.join(current.directory, entry.name),
71723
71880
  depth: current.depth + 1
71724
71881
  });
71725
71882
  }
@@ -72077,13 +72234,13 @@ async function readBody(request2) {
72077
72234
  }
72078
72235
 
72079
72236
  // src/maker/console/cli.ts
72080
- var VERSION3 = false ? "dev" : "0.0.34-beta.4";
72237
+ var VERSION3 = false ? "dev" : "0.0.34-beta.5";
72081
72238
  var CONSOLE_PROTOCOL_VERSION = 2;
72082
72239
  function home() {
72083
- return path45.join(getMakerHome(), "console");
72240
+ return path46.join(getMakerHome(), "console");
72084
72241
  }
72085
72242
  function sessionPath() {
72086
- return path45.join(home(), "session.json");
72243
+ return path46.join(home(), "session.json");
72087
72244
  }
72088
72245
  function createConsoleLauncherIdentity(version2, developmentSource) {
72089
72246
  return createHash8("sha256").update(
@@ -72102,15 +72259,15 @@ function ensureCompatibleConsoleLauncher(actual, expected) {
72102
72259
  }
72103
72260
  }
72104
72261
  function launcherIdentity() {
72105
- const entry = fs43.realpathSync(process.argv[1]);
72262
+ const entry = fs44.realpathSync(process.argv[1]);
72106
72263
  return createConsoleLauncherIdentity(VERSION3, {
72107
72264
  entry,
72108
- mtimeMs: fs43.statSync(entry).mtimeMs
72265
+ mtimeMs: fs44.statSync(entry).mtimeMs
72109
72266
  });
72110
72267
  }
72111
72268
  function readSession() {
72112
- if (!fs43.existsSync(sessionPath())) return void 0;
72113
- const session = JSON.parse(fs43.readFileSync(sessionPath(), "utf8"));
72269
+ if (!fs44.existsSync(sessionPath())) return void 0;
72270
+ const session = JSON.parse(fs44.readFileSync(sessionPath(), "utf8"));
72114
72271
  if (session.schema !== 1 || !/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}$/.test(session.origin) || Number(new URL(session.origin).port) > 65535 || !/^[a-f0-9-]{36}$/.test(session.instanceId) || !Number.isInteger(session.pid) || session.pid <= 0 || typeof session.launcher !== "string" || session.draining !== void 0 && typeof session.draining !== "boolean")
72115
72272
  throw new ConsoleError(
72116
72273
  "Invalid local console session. Refusing to contact an unknown service."
@@ -72187,9 +72344,9 @@ async function runConsoleSupervisor() {
72187
72344
  registry: registry2,
72188
72345
  html: getConsoleHtml2(),
72189
72346
  version: VERSION3,
72190
- packageRoot: path45.dirname(path45.dirname(path45.resolve(process.argv[1]))),
72347
+ packageRoot: path46.dirname(path46.dirname(path46.resolve(process.argv[1]))),
72191
72348
  distribution: process.env.TAPTAP_MAKER_DISTRIBUTION,
72192
- historyFile: path45.join(home(), "tasks.json"),
72349
+ historyFile: path46.join(home(), "tasks.json"),
72193
72350
  instanceId,
72194
72351
  execute: createConsoleExecutor({ entry: process.argv[1] }),
72195
72352
  onDraining: () => {
@@ -72214,7 +72371,7 @@ async function runConsoleSupervisor() {
72214
72371
  const cleanup = () => {
72215
72372
  var _a3;
72216
72373
  try {
72217
- if (((_a3 = readSession()) == null ? void 0 : _a3.instanceId) === instanceId) fs43.unlinkSync(sessionPath());
72374
+ if (((_a3 = readSession()) == null ? void 0 : _a3.instanceId) === instanceId) fs44.unlinkSync(sessionPath());
72218
72375
  } catch {
72219
72376
  }
72220
72377
  release();
@@ -72237,11 +72394,11 @@ async function runConsoleSupervisor() {
72237
72394
  }
72238
72395
  }
72239
72396
  async function claimConsoleServerLock(directory) {
72240
- fs43.mkdirSync(directory, { recursive: true, mode: 448 });
72241
- return claimOwnedLock(path45.join(directory, "server.lock"));
72397
+ fs44.mkdirSync(directory, { recursive: true, mode: 448 });
72398
+ return claimOwnedLock(path46.join(directory, "server.lock"));
72242
72399
  }
72243
72400
  async function claimOwnedLock(filename2) {
72244
- filename2 = path45.join(fs43.realpathSync(path45.dirname(filename2)), path45.basename(filename2));
72401
+ filename2 = path46.join(fs44.realpathSync(path46.dirname(filename2)), path46.basename(filename2));
72245
72402
  const identity = `${process.pid}:${randomUUID8()}`;
72246
72403
  const recoveryFilename = filename2 + ".recovery";
72247
72404
  const releaseMutex = await claimRecoveryMutex2(filename2);
@@ -72249,10 +72406,10 @@ async function claimOwnedLock(filename2) {
72249
72406
  claimRecoveryGuard(recoveryFilename, identity);
72250
72407
  for (let attempt = 0; attempt < 3; attempt++) {
72251
72408
  try {
72252
- fs43.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
72409
+ fs44.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
72253
72410
  return () => {
72254
72411
  try {
72255
- if (fs43.readFileSync(filename2, "utf8") === identity) fs43.unlinkSync(filename2);
72412
+ if (fs44.readFileSync(filename2, "utf8") === identity) fs44.unlinkSync(filename2);
72256
72413
  } catch {
72257
72414
  }
72258
72415
  };
@@ -72260,7 +72417,7 @@ async function claimOwnedLock(filename2) {
72260
72417
  if (error2.code !== "EEXIST") throw error2;
72261
72418
  let previous;
72262
72419
  try {
72263
- previous = fs43.readFileSync(filename2, "utf8");
72420
+ previous = fs44.readFileSync(filename2, "utf8");
72264
72421
  } catch (cause) {
72265
72422
  if (cause.code === "ENOENT") continue;
72266
72423
  throw cause;
@@ -72275,7 +72432,7 @@ async function claimOwnedLock(filename2) {
72275
72432
  } catch (cause) {
72276
72433
  if (cause.code === "ESRCH") {
72277
72434
  try {
72278
- if (fs43.readFileSync(filename2, "utf8") === previous) fs43.unlinkSync(filename2);
72435
+ if (fs44.readFileSync(filename2, "utf8") === previous) fs44.unlinkSync(filename2);
72279
72436
  } catch (error3) {
72280
72437
  if (error3.code !== "ENOENT") throw error3;
72281
72438
  }
@@ -72307,19 +72464,19 @@ function claimRecoveryGuard(filename2, identity) {
72307
72464
  for (let attempt = 0; attempt < 3; attempt++) {
72308
72465
  let descriptor;
72309
72466
  try {
72310
- descriptor = fs43.openSync(filename2, "wx", 384);
72467
+ descriptor = fs44.openSync(filename2, "wx", 384);
72311
72468
  } catch (error2) {
72312
72469
  if (error2.code !== "EEXIST") throw error2;
72313
72470
  if (reclaimStaleRecoveryGuard(filename2)) continue;
72314
72471
  throw new ConsoleError("Console ownership recovery is already in progress.", 409);
72315
72472
  }
72316
72473
  try {
72317
- fs43.writeFileSync(descriptor, identity, "utf8");
72474
+ fs44.writeFileSync(descriptor, identity, "utf8");
72318
72475
  } catch (error2) {
72319
- fs43.unlinkSync(filename2);
72476
+ fs44.unlinkSync(filename2);
72320
72477
  throw error2;
72321
72478
  } finally {
72322
- fs43.closeSync(descriptor);
72479
+ fs44.closeSync(descriptor);
72323
72480
  }
72324
72481
  return;
72325
72482
  }
@@ -72329,8 +72486,8 @@ function reclaimStaleRecoveryGuard(filename2) {
72329
72486
  let content;
72330
72487
  let modified;
72331
72488
  try {
72332
- content = fs43.readFileSync(filename2, "utf8");
72333
- modified = fs43.statSync(filename2).mtimeMs;
72489
+ content = fs44.readFileSync(filename2, "utf8");
72490
+ modified = fs44.statSync(filename2).mtimeMs;
72334
72491
  } catch (error2) {
72335
72492
  return error2.code === "ENOENT";
72336
72493
  }
@@ -72338,8 +72495,8 @@ function reclaimStaleRecoveryGuard(filename2) {
72338
72495
  const stale = Number.isInteger(pid) && pid > 0 ? processPresence(pid) === "missing" : content === "" && Date.now() - modified >= 2e3;
72339
72496
  if (!stale) return false;
72340
72497
  try {
72341
- if (fs43.readFileSync(filename2, "utf8") === content && fs43.statSync(filename2).mtimeMs === modified) {
72342
- fs43.unlinkSync(filename2);
72498
+ if (fs44.readFileSync(filename2, "utf8") === content && fs44.statSync(filename2).mtimeMs === modified) {
72499
+ fs44.unlinkSync(filename2);
72343
72500
  return true;
72344
72501
  }
72345
72502
  } catch (error2) {
@@ -72349,19 +72506,19 @@ function reclaimStaleRecoveryGuard(filename2) {
72349
72506
  }
72350
72507
  function removeOwnedFile(filename2, identity) {
72351
72508
  try {
72352
- if (fs43.readFileSync(filename2, "utf8") === identity) fs43.unlinkSync(filename2);
72509
+ if (fs44.readFileSync(filename2, "utf8") === identity) fs44.unlinkSync(filename2);
72353
72510
  } catch {
72354
72511
  }
72355
72512
  }
72356
72513
  async function ensureSession() {
72357
72514
  var _a3;
72358
- fs43.mkdirSync(home(), { recursive: true, mode: 448 });
72515
+ fs44.mkdirSync(home(), { recursive: true, mode: 448 });
72359
72516
  const existing = await availableSession();
72360
72517
  if (existing) {
72361
72518
  ensureCompatibleConsoleLauncher(existing.launcher, launcherIdentity());
72362
72519
  return existing;
72363
72520
  }
72364
- const lock = path45.join(home(), "launch.lock");
72521
+ const lock = path46.join(home(), "launch.lock");
72365
72522
  let releaseLaunch;
72366
72523
  for (let attempt = 0; attempt < 60; attempt++) {
72367
72524
  try {
@@ -72390,7 +72547,7 @@ async function ensureSession() {
72390
72547
  execArgv: process.execArgv,
72391
72548
  entry: process.argv[1],
72392
72549
  cwd: home(),
72393
- logFile: path45.join(home(), "server.log"),
72550
+ logFile: path46.join(home(), "server.log"),
72394
72551
  env: process.env
72395
72552
  });
72396
72553
  for (let attempt = 0; attempt < 80; attempt++) {
@@ -72453,7 +72610,7 @@ async function runConsoleCli(action, options3) {
72453
72610
  if (action !== "open") throw new ConsoleError("Use console open|status|stop.");
72454
72611
  const target = typeof options3.target_dir === "string" ? options3.target_dir : void 0;
72455
72612
  if (target) {
72456
- if (!path45.isAbsolute(target))
72613
+ if (!path46.isAbsolute(target))
72457
72614
  throw new ConsoleError("--target-dir must be an absolute project path.");
72458
72615
  const { previewProject: previewProject2 } = await Promise.resolve().then(() => (init_protocol2(), protocol_exports));
72459
72616
  previewProject2(target);
@@ -72684,16 +72841,16 @@ init_diagnosticRedaction();
72684
72841
  init_identify();
72685
72842
  init_pluginDistribution();
72686
72843
  import { spawnSync as spawnSync7 } from "node:child_process";
72687
- import fs45 from "node:fs";
72688
- import os7 from "node:os";
72689
- import path47 from "node:path";
72844
+ import fs46 from "node:fs";
72845
+ import os8 from "node:os";
72846
+ import path48 from "node:path";
72690
72847
  import { fileURLToPath as fileURLToPath4 } from "node:url";
72691
72848
 
72692
72849
  // src/maker/cli/dshMcpConfig.ts
72693
72850
  var import_yaml = __toESM(require_dist2());
72694
- import fs44 from "node:fs";
72695
- import os6 from "node:os";
72696
- import path46 from "node:path";
72851
+ import fs45 from "node:fs";
72852
+ import os7 from "node:os";
72853
+ import path47 from "node:path";
72697
72854
  var DSH_MCP_PLUGIN_NAME = "@deepseek-ai/dsh-mcp-client";
72698
72855
  var DSH_MAKER_PLUGIN_ID = "mcp-taptap-maker";
72699
72856
  var DSH_MAKER_TOOL_CALL_TIMEOUT_MS = 60 * 60 * 1e3;
@@ -72701,10 +72858,10 @@ function getDshHome(options3 = {}) {
72701
72858
  var _a3;
72702
72859
  const configured = (_a3 = (options3.environment || process.env).DSH_HOME) == null ? void 0 : _a3.trim();
72703
72860
  if (configured) {
72704
- const expanded = configured === "~" ? options3.homeDir || os6.homedir() : configured.startsWith("~/") || configured.startsWith("~\\") ? path46.join(options3.homeDir || os6.homedir(), configured.slice(2)) : configured;
72705
- return path46.resolve(expanded);
72861
+ const expanded = configured === "~" ? options3.homeDir || os7.homedir() : configured.startsWith("~/") || configured.startsWith("~\\") ? path47.join(options3.homeDir || os7.homedir(), configured.slice(2)) : configured;
72862
+ return path47.resolve(expanded);
72706
72863
  }
72707
- return path46.join(options3.homeDir || os6.homedir(), ".dsh");
72864
+ return path47.join(options3.homeDir || os7.homedir(), ".dsh");
72708
72865
  }
72709
72866
  function createDshMakerPluginConfig(options3) {
72710
72867
  return {
@@ -72722,8 +72879,8 @@ function createDshMakerPluginConfig(options3) {
72722
72879
  };
72723
72880
  }
72724
72881
  function mergeDshMakerMcpConfig(configPath, desired) {
72725
- const existed = fs44.existsSync(configPath);
72726
- const previousContent = existed ? fs44.readFileSync(configPath, "utf8") : "[]\n";
72882
+ const existed = fs45.existsSync(configPath);
72883
+ const previousContent = existed ? fs45.readFileSync(configPath, "utf8") : "[]\n";
72727
72884
  const document = parseDshDocument(previousContent, configPath);
72728
72885
  const sequence = ensurePluginSequence(document, configPath);
72729
72886
  const candidates = findDshMakerPluginCandidates(
@@ -72782,7 +72939,7 @@ function findDshMakerPluginEntry(content, mcpName, source = "DSH config") {
72782
72939
  }
72783
72940
  function getDshMcpInstallPaths(options3) {
72784
72941
  const dshHome = getDshHome(options3);
72785
- const homePatchPath = path46.join(dshHome, "cordis.patch.yml");
72942
+ const homePatchPath = path47.join(dshHome, "cordis.patch.yml");
72786
72943
  const homeHasMaker = dshConfigFileHasMaker(homePatchPath, options3.mcpName);
72787
72944
  const profilePatchPaths = listDshProfilePatchPathsForInstall(dshHome).filter(
72788
72945
  (configPath) => dshConfigFileHasMaker(configPath, options3.mcpName)
@@ -72798,22 +72955,22 @@ function getDshMcpInstallPaths(options3) {
72798
72955
  return profilePatchPaths.length > 0 ? profilePatchPaths : [homePatchPath];
72799
72956
  }
72800
72957
  function listDshProfilePatchPathsForInstall(dshHome) {
72801
- const profilesDir = path46.join(dshHome, "profiles");
72958
+ const profilesDir = path47.join(dshHome, "profiles");
72802
72959
  let entries;
72803
72960
  try {
72804
- entries = fs44.readdirSync(profilesDir, { withFileTypes: true });
72961
+ entries = fs45.readdirSync(profilesDir, { withFileTypes: true });
72805
72962
  } catch (error2) {
72806
72963
  if (isMissingPathError(error2)) {
72807
72964
  return [];
72808
72965
  }
72809
72966
  throw error2;
72810
72967
  }
72811
- return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().map((profileName) => path46.join(profilesDir, profileName, "cordis.patch.yml"));
72968
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().map((profileName) => path47.join(profilesDir, profileName, "cordis.patch.yml"));
72812
72969
  }
72813
72970
  function dshConfigFileHasMaker(configPath, mcpName) {
72814
72971
  let content;
72815
72972
  try {
72816
- content = fs44.readFileSync(configPath, "utf8");
72973
+ content = fs45.readFileSync(configPath, "utf8");
72817
72974
  } catch (error2) {
72818
72975
  if (isMissingPathError(error2)) {
72819
72976
  return false;
@@ -72826,21 +72983,21 @@ function isMissingPathError(error2) {
72826
72983
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
72827
72984
  }
72828
72985
  function listDshMcpConfigPaths(options3) {
72829
- const dshHome = options3.dshHome || path46.join(options3.homeDir, ".dsh");
72830
- const paths = [path46.join(dshHome, "cordis.patch.yml")];
72831
- const profilesDir = path46.join(dshHome, "profiles");
72832
- if (!fs44.existsSync(profilesDir)) {
72986
+ const dshHome = options3.dshHome || path47.join(options3.homeDir, ".dsh");
72987
+ const paths = [path47.join(dshHome, "cordis.patch.yml")];
72988
+ const profilesDir = path47.join(dshHome, "profiles");
72989
+ if (!fs45.existsSync(profilesDir)) {
72833
72990
  return paths;
72834
72991
  }
72835
72992
  let profileNames = [];
72836
72993
  try {
72837
- profileNames = fs44.readdirSync(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().slice(0, 50);
72994
+ profileNames = fs45.readdirSync(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().slice(0, 50);
72838
72995
  } catch {
72839
72996
  return paths;
72840
72997
  }
72841
72998
  for (const profileName of profileNames) {
72842
- const profileDir = path46.join(profilesDir, profileName);
72843
- paths.push(path46.join(profileDir, "cordis.patch.yml"), path46.join(profileDir, "cordis.yml"));
72999
+ const profileDir = path47.join(profilesDir, profileName);
73000
+ paths.push(path47.join(profileDir, "cordis.patch.yml"), path47.join(profileDir, "cordis.yml"));
72844
73001
  }
72845
73002
  return paths;
72846
73003
  }
@@ -72892,14 +73049,14 @@ function findDshMakerPluginCandidates(patches, mcpName) {
72892
73049
  }
72893
73050
  function writeDshConfigWithBackup(configPath, previousContent, existed, nextContent, desired) {
72894
73051
  const backupPath = existed ? `${configPath}.taptap-maker.bak.latest` : void 0;
72895
- fs44.mkdirSync(path46.dirname(configPath), { recursive: true });
73052
+ fs45.mkdirSync(path47.dirname(configPath), { recursive: true });
72896
73053
  if (backupPath) {
72897
- fs44.writeFileSync(backupPath, previousContent, "utf8");
73054
+ fs45.writeFileSync(backupPath, previousContent, "utf8");
72898
73055
  }
72899
73056
  try {
72900
- fs44.writeFileSync(configPath, nextContent, "utf8");
73057
+ fs45.writeFileSync(configPath, nextContent, "utf8");
72901
73058
  const written = findDshMakerPluginEntry(
72902
- fs44.readFileSync(configPath, "utf8"),
73059
+ fs45.readFileSync(configPath, "utf8"),
72903
73060
  desired.config.serverName,
72904
73061
  configPath
72905
73062
  );
@@ -72911,9 +73068,9 @@ function writeDshConfigWithBackup(configPath, previousContent, existed, nextCont
72911
73068
  return { changed: true, backupPath };
72912
73069
  } catch (error2) {
72913
73070
  if (existed) {
72914
- fs44.writeFileSync(configPath, previousContent, "utf8");
73071
+ fs45.writeFileSync(configPath, previousContent, "utf8");
72915
73072
  } else {
72916
- fs44.rmSync(configPath, { force: true });
73073
+ fs45.rmSync(configPath, { force: true });
72917
73074
  }
72918
73075
  throw error2;
72919
73076
  }
@@ -72992,7 +73149,7 @@ function inspectMakerMcpClientConfig(options3) {
72992
73149
  if (!configPaths) {
72993
73150
  return { ide, status: "unsupported", entries: [] };
72994
73151
  }
72995
- const entries = configPaths.filter((configPath) => fs45.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, options3.mcpName || MAKER_MCP_NAME));
73152
+ const entries = configPaths.filter((configPath) => fs46.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, options3.mcpName || MAKER_MCP_NAME));
72996
73153
  const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
72997
73154
  return { ide, status, entries };
72998
73155
  }
@@ -73006,15 +73163,15 @@ function resolveMakerMcpReportRuntime(options3) {
73006
73163
  `${pluginDistribution.displayName} plugin diagnostics require the active Maker bundle URL.`
73007
73164
  );
73008
73165
  }
73009
- const bundlePath = path47.resolve(fileURLToPath4(options3.bundleUrl));
73010
- const pluginRoot = path47.dirname(path47.dirname(bundlePath));
73166
+ const bundlePath = path48.resolve(fileURLToPath4(options3.bundleUrl));
73167
+ const pluginRoot = path48.dirname(path48.dirname(bundlePath));
73011
73168
  const execPath = options3.execPath ?? process.execPath;
73012
73169
  return {
73013
73170
  distribution: pluginDistribution.id,
73014
73171
  client: pluginDistribution.client,
73015
73172
  config_source: {
73016
73173
  format: "json",
73017
- paths: [path47.join(pluginRoot, ".mcp.json")],
73174
+ paths: [path48.join(pluginRoot, ".mcp.json")],
73018
73175
  mcp_name: "taptap-maker-plugin"
73019
73176
  },
73020
73177
  launcher: {
@@ -73064,9 +73221,9 @@ function buildMakerMcpIssue(options3) {
73064
73221
  async function collectMakerMcpIssueDiagnostics(options3) {
73065
73222
  var _a3, _b;
73066
73223
  const platform = options3.platform || process.platform;
73067
- const homeDir = options3.homeDir || os7.homedir();
73068
- const processCwd = path47.resolve(options3.processCwd || process.cwd());
73069
- const targetDir = path47.resolve(options3.targetDir);
73224
+ const homeDir = options3.homeDir || os8.homedir();
73225
+ const processCwd = path48.resolve(options3.processCwd || process.cwd());
73226
+ const targetDir = path48.resolve(options3.targetDir);
73070
73227
  const identify = identifyMakerProject({ cwd: targetDir });
73071
73228
  const projectContext = identify.projectRoot ? {
73072
73229
  status: "bound",
@@ -73146,29 +73303,29 @@ function submitMakerMcpIssue(issue3, options3 = {}) {
73146
73303
  function getMcpConfigPaths(options3) {
73147
73304
  const { ide, homeDir, platform } = options3;
73148
73305
  if (ide === "codex") {
73149
- return [path47.join(homeDir, ".codex", "config.toml")];
73306
+ return [path48.join(homeDir, ".codex", "config.toml")];
73150
73307
  }
73151
73308
  if (ide === "cursor") {
73152
- return [path47.join(homeDir, ".cursor", "mcp.json")];
73309
+ return [path48.join(homeDir, ".cursor", "mcp.json")];
73153
73310
  }
73154
73311
  if (ide === "claude") {
73155
- return [path47.join(homeDir, ".claude.json")];
73312
+ return [path48.join(homeDir, ".claude.json")];
73156
73313
  }
73157
73314
  if (ide === "opencode") {
73158
- return [path47.join(homeDir, ".config", "opencode", "opencode.jsonc")];
73315
+ return [path48.join(homeDir, ".config", "opencode", "opencode.jsonc")];
73159
73316
  }
73160
73317
  if (ide === "workbuddy") {
73161
- const primary = path47.join(homeDir, ".workbuddy", "mcp.json");
73162
- if (fs45.existsSync(primary)) {
73318
+ const primary = path48.join(homeDir, ".workbuddy", "mcp.json");
73319
+ if (fs46.existsSync(primary)) {
73163
73320
  return [primary];
73164
73321
  }
73165
- const legacy = path47.join(homeDir, ".workbuddy", ".mcp.json");
73166
- return fs45.existsSync(legacy) ? [legacy] : [primary];
73322
+ const legacy = path48.join(homeDir, ".workbuddy", ".mcp.json");
73323
+ return fs46.existsSync(legacy) ? [legacy] : [primary];
73167
73324
  }
73168
73325
  if (ide === "trae") {
73169
- const root2 = platform === "win32" ? options3.appData || path47.join(homeDir, "AppData", "Roaming") : path47.join(homeDir, "Library", "Application Support");
73326
+ const root2 = platform === "win32" ? options3.appData || path48.join(homeDir, "AppData", "Roaming") : path48.join(homeDir, "Library", "Application Support");
73170
73327
  return ["TRAE SOLO", "TRAE SOLO CN", "Trae", "TRAE", "Trae CN"].map(
73171
- (name) => path47.join(root2, name, "User", "mcp.json")
73328
+ (name) => path48.join(root2, name, "User", "mcp.json")
73172
73329
  );
73173
73330
  }
73174
73331
  if (ide === "dsh") {
@@ -73179,7 +73336,7 @@ function getMcpConfigPaths(options3) {
73179
73336
  function inspectMcpConfigFile(configPath, ide, mcpName, format) {
73180
73337
  try {
73181
73338
  const resolvedFormat = format ?? (ide === "codex" ? "codex_toml" : ide === "dsh" ? "dsh" : ide === "opencode" ? "jsonc" : "json");
73182
- const content = fs45.readFileSync(configPath, "utf8");
73339
+ const content = fs46.readFileSync(configPath, "utf8");
73183
73340
  const server = resolvedFormat === "codex_toml" ? extractCodexMcpServerConfig(content, mcpName) : resolvedFormat === "dsh" ? extractDshMcpServerConfig(content, mcpName, configPath) : extractMakerMcpServerConfig(
73184
73341
  parseJsonConfig(content, resolvedFormat === "jsonc"),
73185
73342
  mcpName
@@ -73190,7 +73347,7 @@ function inspectMcpConfigFile(configPath, ide, mcpName, format) {
73190
73347
  }
73191
73348
  }
73192
73349
  function inspectMakerMcpConfigSource(ide, source) {
73193
- const entries = source.paths.filter((configPath) => fs45.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
73350
+ const entries = source.paths.filter((configPath) => fs46.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
73194
73351
  const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
73195
73352
  return { ide, status, entries };
73196
73353
  }
@@ -73407,13 +73564,13 @@ function inspectWorkBuddyTrust(homeDir, mcpName) {
73407
73564
  pending_accounts: 0,
73408
73565
  unreadable_accounts: 0
73409
73566
  };
73410
- const connectorsDir = path47.join(homeDir, ".workbuddy", "connectors");
73411
- if (!fs45.existsSync(connectorsDir)) {
73567
+ const connectorsDir = path48.join(homeDir, ".workbuddy", "connectors");
73568
+ if (!fs46.existsSync(connectorsDir)) {
73412
73569
  return { status: "not_found", ...emptyCounts };
73413
73570
  }
73414
73571
  let entries;
73415
73572
  try {
73416
- entries = fs45.readdirSync(connectorsDir, { withFileTypes: true });
73573
+ entries = fs46.readdirSync(connectorsDir, { withFileTypes: true });
73417
73574
  } catch {
73418
73575
  return { status: "unreadable", ...emptyCounts };
73419
73576
  }
@@ -73422,12 +73579,12 @@ function inspectWorkBuddyTrust(homeDir, mcpName) {
73422
73579
  if (!entry.isDirectory()) {
73423
73580
  continue;
73424
73581
  }
73425
- const statePath = path47.join(connectorsDir, entry.name, "connector-states.json");
73426
- if (!fs45.existsSync(statePath)) {
73582
+ const statePath = path48.join(connectorsDir, entry.name, "connector-states.json");
73583
+ if (!fs46.existsSync(statePath)) {
73427
73584
  continue;
73428
73585
  }
73429
73586
  try {
73430
- const state = JSON.parse(fs45.readFileSync(statePath, "utf8"));
73587
+ const state = JSON.parse(fs46.readFileSync(statePath, "utf8"));
73431
73588
  if (!isRecord4(state)) {
73432
73589
  counts.accounts_checked += 1;
73433
73590
  counts.unreadable_accounts += 1;
@@ -73622,9 +73779,9 @@ function stripControlCharacters(value) {
73622
73779
 
73623
73780
  // src/maker/cli/pluginMigration.ts
73624
73781
  init_storage();
73625
- import fs47 from "node:fs";
73626
- import os8 from "node:os";
73627
- import path49 from "node:path";
73782
+ import fs48 from "node:fs";
73783
+ import os9 from "node:os";
73784
+ import path50 from "node:path";
73628
73785
  import crypto3 from "node:crypto";
73629
73786
 
73630
73787
  // src/maker/cli/codexMcpConfig.ts
@@ -73831,28 +73988,28 @@ function escapeRegExp3(value) {
73831
73988
  }
73832
73989
 
73833
73990
  // src/maker/cli/configWrite.ts
73834
- import fs46 from "node:fs";
73835
- import path48 from "node:path";
73991
+ import fs47 from "node:fs";
73992
+ import path49 from "node:path";
73836
73993
  function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate2) {
73837
- const existed = fs46.existsSync(filePath);
73838
- const previousContent = existed ? fs46.readFileSync(filePath, "utf8") : void 0;
73994
+ const existed = fs47.existsSync(filePath);
73995
+ const previousContent = existed ? fs47.readFileSync(filePath, "utf8") : void 0;
73839
73996
  if (previousContent === nextContent) {
73840
73997
  return { changed: false };
73841
73998
  }
73842
73999
  const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
73843
- fs46.mkdirSync(path48.dirname(filePath), { recursive: true });
74000
+ fs47.mkdirSync(path49.dirname(filePath), { recursive: true });
73844
74001
  if (previousContent !== void 0 && backupPath) {
73845
- fs46.writeFileSync(backupPath, previousContent, "utf8");
74002
+ fs47.writeFileSync(backupPath, previousContent, "utf8");
73846
74003
  }
73847
74004
  try {
73848
- fs46.writeFileSync(filePath, nextContent, "utf8");
73849
- validate2 == null ? void 0 : validate2(fs46.readFileSync(filePath, "utf8"));
74005
+ fs47.writeFileSync(filePath, nextContent, "utf8");
74006
+ validate2 == null ? void 0 : validate2(fs47.readFileSync(filePath, "utf8"));
73850
74007
  return { changed: true, backupPath };
73851
74008
  } catch (error2) {
73852
74009
  if (previousContent !== void 0) {
73853
- fs46.writeFileSync(filePath, previousContent, "utf8");
74010
+ fs47.writeFileSync(filePath, previousContent, "utf8");
73854
74011
  } else {
73855
- fs46.rmSync(filePath, { force: true });
74012
+ fs47.rmSync(filePath, { force: true });
73856
74013
  }
73857
74014
  throw error2;
73858
74015
  }
@@ -73860,11 +74017,11 @@ function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate2)
73860
74017
 
73861
74018
  // src/maker/cli/pluginMigration.ts
73862
74019
  function inspectCodexLegacyMakerMcp(options3 = {}) {
73863
- const configPath = options3.configPath ?? path49.join(os8.homedir(), ".codex", "config.toml");
73864
- if (!fs47.existsSync(configPath)) {
74020
+ const configPath = options3.configPath ?? path50.join(os9.homedir(), ".codex", "config.toml");
74021
+ if (!fs48.existsSync(configPath)) {
73865
74022
  return createInspection(configPath, "not_found", 0);
73866
74023
  }
73867
- const content = fs47.readFileSync(configPath, "utf8");
74024
+ const content = fs48.readFileSync(configPath, "utf8");
73868
74025
  const registrations = findCodexMakerMainTables(content);
73869
74026
  if (registrations.length === 0) {
73870
74027
  return createInspection(configPath, "not_found", 0);
@@ -73879,7 +74036,7 @@ function inspectCodexLegacyMakerMcp(options3 = {}) {
73879
74036
  };
73880
74037
  }
73881
74038
  function migrateCodexLegacyMakerMcp(options3 = {}) {
73882
- const configPath = options3.configPath ?? path49.join(os8.homedir(), ".codex", "config.toml");
74039
+ const configPath = options3.configPath ?? path50.join(os9.homedir(), ".codex", "config.toml");
73883
74040
  const makerHome = options3.makerHome ?? getMakerHome();
73884
74041
  const statePath = getCodexPluginMigrationStatePath(makerHome);
73885
74042
  const inspection = inspectCodexLegacyMakerMcp({ configPath });
@@ -73893,7 +74050,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
73893
74050
  }
73894
74051
  if (inspection.status === "disabled") {
73895
74052
  const state2 = readMigrationState(statePath);
73896
- const content = fs47.readFileSync(configPath, "utf8");
74053
+ const content = fs48.readFileSync(configPath, "utf8");
73897
74054
  const registration2 = findCodexMakerMainTables(content)[0];
73898
74055
  const owned = (state2 == null ? void 0 : state2.config_path) === configPath && sha256(readCodexMakerRegistration(content, registration2)) === state2.migrated_registration_sha256;
73899
74056
  return {
@@ -73906,7 +74063,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
73906
74063
  if (!options3.confirm) {
73907
74064
  throw new Error("Disabling the legacy Codex Maker MCP requires explicit confirmation.");
73908
74065
  }
73909
- const previousContent = fs47.readFileSync(configPath, "utf8");
74066
+ const previousContent = fs48.readFileSync(configPath, "utf8");
73910
74067
  const registration = findCodexMakerMainTables(previousContent)[0];
73911
74068
  const nextContent = disableCodexMakerRegistration(previousContent, registration);
73912
74069
  const state = {
@@ -73920,13 +74077,13 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
73920
74077
  ),
73921
74078
  migrated_at: (/* @__PURE__ */ new Date()).toISOString()
73922
74079
  };
73923
- fs47.mkdirSync(path49.dirname(statePath), { recursive: true });
74080
+ fs48.mkdirSync(path50.dirname(statePath), { recursive: true });
73924
74081
  const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
73925
74082
  const migratedInspection = inspectCodexLegacyMakerMcp({ configPath });
73926
74083
  if (migratedInspection.status !== "disabled") {
73927
74084
  throw new Error("Codex Maker MCP migration validation did not find a disabled registration.");
73928
74085
  }
73929
- fs47.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
74086
+ fs48.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
73930
74087
  `, "utf8");
73931
74088
  });
73932
74089
  return {
@@ -73938,7 +74095,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
73938
74095
  };
73939
74096
  }
73940
74097
  function restoreCodexLegacyMakerMcp(options3 = {}) {
73941
- const configPath = options3.configPath ?? path49.join(os8.homedir(), ".codex", "config.toml");
74098
+ const configPath = options3.configPath ?? path50.join(os9.homedir(), ".codex", "config.toml");
73942
74099
  const makerHome = options3.makerHome ?? getMakerHome();
73943
74100
  const statePath = getCodexPluginMigrationStatePath(makerHome);
73944
74101
  const inspection = inspectCodexLegacyMakerMcp({ configPath });
@@ -73959,14 +74116,14 @@ function restoreCodexLegacyMakerMcp(options3 = {}) {
73959
74116
  "The migrated Codex Maker MCP registration no longer exists and cannot be restored."
73960
74117
  );
73961
74118
  }
73962
- const previousContent = fs47.readFileSync(configPath, "utf8");
74119
+ const previousContent = fs48.readFileSync(configPath, "utf8");
73963
74120
  const registration = findCodexMakerMainTables(previousContent)[0];
73964
74121
  const registrationSha256 = sha256(readCodexMakerRegistration(previousContent, registration));
73965
74122
  if (inspection.status === "active") {
73966
74123
  if (registrationSha256 !== state.original_registration_sha256) {
73967
74124
  return { ...inspection, action: "not_owned", changed: false };
73968
74125
  }
73969
- fs47.unlinkSync(statePath);
74126
+ fs48.unlinkSync(statePath);
73970
74127
  return { ...inspection, action: "already_restored", changed: false };
73971
74128
  }
73972
74129
  if (registrationSha256 !== state.migrated_registration_sha256) {
@@ -73980,12 +74137,12 @@ function restoreCodexLegacyMakerMcp(options3 = {}) {
73980
74137
  "Codex Maker MCP restoration validation did not find an active registration."
73981
74138
  );
73982
74139
  }
73983
- const restoredContent = fs47.readFileSync(configPath, "utf8");
74140
+ const restoredContent = fs48.readFileSync(configPath, "utf8");
73984
74141
  const restoredRegistration = findCodexMakerMainTables(restoredContent)[0];
73985
74142
  if (sha256(readCodexMakerRegistration(restoredContent, restoredRegistration)) !== state.original_registration_sha256) {
73986
74143
  throw new Error("Codex Maker MCP restoration changed the migrated registration identity.");
73987
74144
  }
73988
- fs47.unlinkSync(statePath);
74145
+ fs48.unlinkSync(statePath);
73989
74146
  });
73990
74147
  return {
73991
74148
  ...inspectCodexLegacyMakerMcp({ configPath }),
@@ -74048,14 +74205,14 @@ function readCodexMakerRegistration(content, registration) {
74048
74205
  return content.slice(registration.headerStart, registration.bodyEnd).trimEnd();
74049
74206
  }
74050
74207
  function getCodexPluginMigrationStatePath(makerHome) {
74051
- return path49.join(makerHome, "plugin-migrations", "codex.json");
74208
+ return path50.join(makerHome, "plugin-migrations", "codex.json");
74052
74209
  }
74053
74210
  function readMigrationState(statePath) {
74054
- if (!fs47.existsSync(statePath)) {
74211
+ if (!fs48.existsSync(statePath)) {
74055
74212
  return void 0;
74056
74213
  }
74057
74214
  try {
74058
- const state = JSON.parse(fs47.readFileSync(statePath, "utf8"));
74215
+ const state = JSON.parse(fs48.readFileSync(statePath, "utf8"));
74059
74216
  return (state == null ? void 0 : state.schema_version) === 2 && state.client === "codex" ? state : void 0;
74060
74217
  } catch {
74061
74218
  return void 0;
@@ -74145,7 +74302,7 @@ function migrateWorkBuddyLegacyMakerMcp(options3 = {}) {
74145
74302
  migrated_registration_sha256: hashWorkBuddyRegistration(migratedRegistration),
74146
74303
  migrated_at: (/* @__PURE__ */ new Date()).toISOString()
74147
74304
  };
74148
- fs47.mkdirSync(path49.dirname(statePath), { recursive: true });
74305
+ fs48.mkdirSync(path50.dirname(statePath), { recursive: true });
74149
74306
  const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
74150
74307
  const migrated = findWorkBuddyMakerRegistrations(configPaths).find(
74151
74308
  (entry) => entry.configPath === current.configPath
@@ -74155,7 +74312,7 @@ function migrateWorkBuddyLegacyMakerMcp(options3 = {}) {
74155
74312
  "WorkBuddy Maker MCP migration validation did not find the disabled registration."
74156
74313
  );
74157
74314
  }
74158
- fs47.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
74315
+ fs48.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
74159
74316
  `, "utf8");
74160
74317
  });
74161
74318
  const migratedInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
@@ -74209,7 +74366,7 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
74209
74366
  changed: false
74210
74367
  };
74211
74368
  }
74212
- fs47.unlinkSync(statePath);
74369
+ fs48.unlinkSync(statePath);
74213
74370
  return {
74214
74371
  ...inspection,
74215
74372
  config_path: current.configPath,
@@ -74242,7 +74399,7 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
74242
74399
  if (!restored || hashWorkBuddyRegistration(restored.registration) !== state.original_registration_sha256) {
74243
74400
  throw new Error("WorkBuddy Maker MCP restoration changed the registration identity.");
74244
74401
  }
74245
- fs47.unlinkSync(statePath);
74402
+ fs48.unlinkSync(statePath);
74246
74403
  });
74247
74404
  return {
74248
74405
  ...inspectWorkBuddyLegacyMakerMcp({ configPaths }),
@@ -74255,19 +74412,19 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
74255
74412
  }
74256
74413
  function getWorkBuddyConfigPaths(configPaths) {
74257
74414
  return configPaths ?? [
74258
- path49.join(os8.homedir(), ".workbuddy", "mcp.json"),
74259
- path49.join(os8.homedir(), ".workbuddy", ".mcp.json")
74415
+ path50.join(os9.homedir(), ".workbuddy", "mcp.json"),
74416
+ path50.join(os9.homedir(), ".workbuddy", ".mcp.json")
74260
74417
  ];
74261
74418
  }
74262
74419
  function findWorkBuddyMakerRegistrations(configPaths) {
74263
74420
  const registrations = [];
74264
74421
  for (const configPath of configPaths) {
74265
- if (!fs47.existsSync(configPath)) {
74422
+ if (!fs48.existsSync(configPath)) {
74266
74423
  continue;
74267
74424
  }
74268
74425
  let config2;
74269
74426
  try {
74270
- config2 = JSON.parse(fs47.readFileSync(configPath, "utf8"));
74427
+ config2 = JSON.parse(fs48.readFileSync(configPath, "utf8"));
74271
74428
  } catch (error2) {
74272
74429
  throw new Error(
74273
74430
  `Cannot parse WorkBuddy MCP config ${configPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
@@ -74302,14 +74459,14 @@ function setWorkBuddyMakerRegistration(config2, registration) {
74302
74459
  servers["taptap-maker"] = registration;
74303
74460
  }
74304
74461
  function getWorkBuddyPluginMigrationStatePath(makerHome) {
74305
- return path49.join(makerHome, "plugin-migrations", "workbuddy.json");
74462
+ return path50.join(makerHome, "plugin-migrations", "workbuddy.json");
74306
74463
  }
74307
74464
  function readWorkBuddyMigrationState(statePath) {
74308
- if (!fs47.existsSync(statePath)) {
74465
+ if (!fs48.existsSync(statePath)) {
74309
74466
  return void 0;
74310
74467
  }
74311
74468
  try {
74312
- const state = JSON.parse(fs47.readFileSync(statePath, "utf8"));
74469
+ const state = JSON.parse(fs48.readFileSync(statePath, "utf8"));
74313
74470
  return (state == null ? void 0 : state.schema_version) === 1 && state.client === "workbuddy" ? state : void 0;
74314
74471
  } catch {
74315
74472
  return void 0;
@@ -74334,9 +74491,9 @@ function isRecord5(value) {
74334
74491
  // src/maker/cli/dshPluginMigration.ts
74335
74492
  var import_yaml2 = __toESM(require_dist2());
74336
74493
  init_storage();
74337
- import fs48 from "node:fs";
74338
- import os9 from "node:os";
74339
- import path50 from "node:path";
74494
+ import fs49 from "node:fs";
74495
+ import os10 from "node:os";
74496
+ import path51 from "node:path";
74340
74497
  import crypto4 from "node:crypto";
74341
74498
  var DSH_MAKER_MCP_NAME = "taptap-maker";
74342
74499
  function inspectDshLegacyMakerMcp(options3 = {}) {
@@ -74369,7 +74526,7 @@ function migrateDshLegacyMakerMcp(options3 = {}) {
74369
74526
  );
74370
74527
  }
74371
74528
  const registration = registrations[0];
74372
- const previousContent = fs48.readFileSync(registration.configPath, "utf8");
74529
+ const previousContent = fs49.readFileSync(registration.configPath, "utf8");
74373
74530
  const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
74374
74531
  if (document.errors.length > 0) {
74375
74532
  throw new Error(`Invalid YAML in ${registration.configPath}: ${document.errors[0].message}`);
@@ -74384,13 +74541,13 @@ function migrateDshLegacyMakerMcp(options3 = {}) {
74384
74541
  removed_registration_sha256: sha2562(JSON.stringify(registration.registration)),
74385
74542
  migrated_at: (/* @__PURE__ */ new Date()).toISOString()
74386
74543
  };
74387
- fs48.mkdirSync(path50.dirname(statePath), { recursive: true });
74544
+ fs49.mkdirSync(path51.dirname(statePath), { recursive: true });
74388
74545
  const write = writeConfigWithTapTapBackupIfChanged(registration.configPath, nextContent, () => {
74389
74546
  const after = findDshMakerRegistrations(options3.dshHome);
74390
74547
  if (after.some((entry) => entry.configPath === registration.configPath)) {
74391
74548
  throw new Error("DSH Maker MCP migration validation still found a registration.");
74392
74549
  }
74393
- fs48.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
74550
+ fs49.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
74394
74551
  `, "utf8");
74395
74552
  });
74396
74553
  return {
@@ -74423,13 +74580,13 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
74423
74580
  const current = findDshMakerRegistrations(options3.dshHome)[0];
74424
74581
  const currentSha = sha2562(JSON.stringify(current.registration));
74425
74582
  if (currentSha === state.removed_registration_sha256) {
74426
- fs48.rmSync(statePath, { force: true });
74583
+ fs49.rmSync(statePath, { force: true });
74427
74584
  return { ...inspection, action: "already_restored", changed: false, state_path: statePath };
74428
74585
  }
74429
74586
  return { ...inspection, action: "not_owned", changed: false };
74430
74587
  }
74431
74588
  const configPath = state.config_path;
74432
- const previousContent = fs48.readFileSync(configPath, "utf8");
74589
+ const previousContent = fs49.readFileSync(configPath, "utf8");
74433
74590
  const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
74434
74591
  if (document.errors.length > 0) {
74435
74592
  throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
@@ -74442,7 +74599,7 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
74442
74599
  if (!match || sha2562(JSON.stringify(match.registration)) !== state.removed_registration_sha256) {
74443
74600
  throw new Error("DSH Maker MCP restoration changed the registration identity.");
74444
74601
  }
74445
- fs48.rmSync(statePath, { force: true });
74602
+ fs49.rmSync(statePath, { force: true });
74446
74603
  });
74447
74604
  return {
74448
74605
  ...inspectDshLegacyMakerMcp(options3),
@@ -74454,13 +74611,13 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
74454
74611
  }
74455
74612
  function findDshMakerRegistrations(dshHome) {
74456
74613
  const resolvedDshHome = dshHome || getDshHome();
74457
- const configPaths = listDshMcpConfigPaths({ homeDir: os9.homedir(), dshHome: resolvedDshHome });
74614
+ const configPaths = listDshMcpConfigPaths({ homeDir: os10.homedir(), dshHome: resolvedDshHome });
74458
74615
  const registrations = [];
74459
74616
  for (const configPath of configPaths) {
74460
- if (!fs48.existsSync(configPath)) {
74617
+ if (!fs49.existsSync(configPath)) {
74461
74618
  continue;
74462
74619
  }
74463
- const content = fs48.readFileSync(configPath, "utf8");
74620
+ const content = fs49.readFileSync(configPath, "utf8");
74464
74621
  const document = (0, import_yaml2.parseDocument)(content, { prettyErrors: true });
74465
74622
  if (document.errors.length > 0) {
74466
74623
  throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
@@ -74545,14 +74702,14 @@ function isDshMakerPluginCandidate(value) {
74545
74702
  return value.name === DSH_MCP_PLUGIN_NAME && (config2 == null ? void 0 : config2.serverName) === DSH_MAKER_MCP_NAME;
74546
74703
  }
74547
74704
  function getDshPluginMigrationStatePath(makerHome) {
74548
- return path50.join(makerHome, "plugin-migrations", "dsh.json");
74705
+ return path51.join(makerHome, "plugin-migrations", "dsh.json");
74549
74706
  }
74550
74707
  function readDshMigrationState(statePath) {
74551
- if (!fs48.existsSync(statePath)) {
74708
+ if (!fs49.existsSync(statePath)) {
74552
74709
  return void 0;
74553
74710
  }
74554
74711
  try {
74555
- const state = JSON.parse(fs48.readFileSync(statePath, "utf8"));
74712
+ const state = JSON.parse(fs49.readFileSync(statePath, "utf8"));
74556
74713
  return (state == null ? void 0 : state.schema_version) === 1 && state.client === "dsh" ? state : void 0;
74557
74714
  } catch {
74558
74715
  return void 0;
@@ -74593,9 +74750,9 @@ init_config();
74593
74750
  init_fetchTimeout();
74594
74751
  init_identify();
74595
74752
  init_storage();
74596
- import fs49 from "node:fs";
74597
- import os10 from "node:os";
74598
- import path51 from "node:path";
74753
+ import fs50 from "node:fs";
74754
+ import os11 from "node:os";
74755
+ import path52 from "node:path";
74599
74756
  import { randomUUID as randomUUID9 } from "node:crypto";
74600
74757
  import { Readable, Transform } from "node:stream";
74601
74758
  import { pipeline as pipeline2 } from "node:stream/promises";
@@ -74605,7 +74762,7 @@ var MAX_ARCHIVE_ENTRIES = 1e3;
74605
74762
  var MAX_ARCHIVE_EXTRACTED_BYTES = 128 * 1024 * 1024;
74606
74763
  async function pullMakerUserSkills(options3 = {}) {
74607
74764
  var _a3, _b;
74608
- const requestedDir = path51.resolve(options3.targetDir || process.cwd());
74765
+ const requestedDir = path52.resolve(options3.targetDir || process.cwd());
74609
74766
  const project = identifyMakerProject({ cwd: requestedDir });
74610
74767
  if (!project.projectRoot) {
74611
74768
  throw new Error(
@@ -74617,10 +74774,10 @@ async function pullMakerUserSkills(options3 = {}) {
74617
74774
  if (!token) {
74618
74775
  throw new Error("Maker authentication not found. Run `taptap-maker login` and try again.");
74619
74776
  }
74620
- const sourceDir = path51.join(project.projectRoot, ".installer", "skills");
74621
- const tempDir = fs49.mkdtempSync(path51.join(os10.tmpdir(), "taptap-maker-user-skills-"));
74622
- const archivePath = path51.join(tempDir, "user-skills.zip");
74623
- const stagingDir = path51.join(tempDir, "skills");
74777
+ const sourceDir = path52.join(project.projectRoot, ".installer", "skills");
74778
+ const tempDir = fs50.mkdtempSync(path52.join(os11.tmpdir(), "taptap-maker-user-skills-"));
74779
+ const archivePath = path52.join(tempDir, "user-skills.zip");
74780
+ const stagingDir = path52.join(tempDir, "skills");
74624
74781
  try {
74625
74782
  const response = await fetchWithTimeout(
74626
74783
  options3.fetchImpl || fetch,
@@ -74652,7 +74809,7 @@ async function pullMakerUserSkills(options3 = {}) {
74652
74809
  preservedSkills
74653
74810
  };
74654
74811
  } finally {
74655
- fs49.rmSync(tempDir, { recursive: true, force: true });
74812
+ fs50.rmSync(tempDir, { recursive: true, force: true });
74656
74813
  }
74657
74814
  }
74658
74815
  async function writeArchiveResponse(response, archivePath) {
@@ -74677,7 +74834,7 @@ async function writeArchiveResponse(response, archivePath) {
74677
74834
  await pipeline2(
74678
74835
  Readable.fromWeb(response.body),
74679
74836
  limit,
74680
- fs49.createWriteStream(archivePath, { flags: "wx" })
74837
+ fs50.createWriteStream(archivePath, { flags: "wx" })
74681
74838
  );
74682
74839
  }
74683
74840
  function validateUserSkillArchivePath(entryPath) {
@@ -74692,7 +74849,7 @@ function validateUserSkillArchivePath(entryPath) {
74692
74849
  return segments;
74693
74850
  }
74694
74851
  async function extractUserSkillsArchive(archivePath, stagingDir) {
74695
- fs49.mkdirSync(stagingDir, { recursive: true });
74852
+ fs50.mkdirSync(stagingDir, { recursive: true });
74696
74853
  const zipFile = await import_yauzl.default.openPromise(archivePath, {
74697
74854
  lazyEntries: true,
74698
74855
  decodeStrings: true,
@@ -74712,7 +74869,7 @@ async function extractUserSkillsArchive(archivePath, stagingDir) {
74712
74869
  );
74713
74870
  }
74714
74871
  const segments = validateUserSkillArchivePath(entry.fileName);
74715
- if (segments.some((segment) => path51.basename(segment).startsWith(".nfs"))) {
74872
+ if (segments.some((segment) => path52.basename(segment).startsWith(".nfs"))) {
74716
74873
  continue;
74717
74874
  }
74718
74875
  const isDirectory2 = isZipDirectory(entry);
@@ -74734,24 +74891,24 @@ async function extractUserSkillsArchive(archivePath, stagingDir) {
74734
74891
  }
74735
74892
  seenPaths.add(collisionKey);
74736
74893
  skillNames.add(segments[0]);
74737
- const destination = path51.join(stagingDir, ...segments);
74894
+ const destination = path52.join(stagingDir, ...segments);
74738
74895
  if (isDirectory2) {
74739
- fs49.mkdirSync(destination, { recursive: true });
74896
+ fs50.mkdirSync(destination, { recursive: true });
74740
74897
  continue;
74741
74898
  }
74742
- fs49.mkdirSync(path51.dirname(destination), { recursive: true });
74899
+ fs50.mkdirSync(path52.dirname(destination), { recursive: true });
74743
74900
  const input2 = await zipFile.openReadStreamPromise(entry);
74744
- await pipeline2(input2, fs49.createWriteStream(destination, { flags: "wx" }));
74901
+ await pipeline2(input2, fs50.createWriteStream(destination, { flags: "wx" }));
74745
74902
  }
74746
74903
  } finally {
74747
74904
  zipFile.close();
74748
74905
  }
74749
74906
  const installedSkills = [...skillNames].sort();
74750
74907
  for (const skillName of installedSkills) {
74751
- const definitionPath = path51.join(stagingDir, skillName, "SKILL.md");
74908
+ const definitionPath = path52.join(stagingDir, skillName, "SKILL.md");
74752
74909
  let definition;
74753
74910
  try {
74754
- definition = fs49.lstatSync(definitionPath);
74911
+ definition = fs50.lstatSync(definitionPath);
74755
74912
  } catch {
74756
74913
  throw new Error(`Maker user Skill "${skillName}" is missing SKILL.md.`);
74757
74914
  }
@@ -74785,31 +74942,31 @@ function installUserSkills(projectRoot, stagingDir, skillNames) {
74785
74942
  if (skillNames.length === 0) {
74786
74943
  return;
74787
74944
  }
74788
- const installerDir = path51.join(projectRoot, ".installer");
74789
- const sourceDir = path51.join(installerDir, "skills");
74790
- const transactionDir = path51.join(installerDir, `.user-skills-${randomUUID9()}`);
74791
- const preparedDir = path51.join(transactionDir, "prepared");
74792
- const backupDir = path51.join(transactionDir, "backup");
74945
+ const installerDir = path52.join(projectRoot, ".installer");
74946
+ const sourceDir = path52.join(installerDir, "skills");
74947
+ const transactionDir = path52.join(installerDir, `.user-skills-${randomUUID9()}`);
74948
+ const preparedDir = path52.join(transactionDir, "prepared");
74949
+ const backupDir = path52.join(transactionDir, "backup");
74793
74950
  const completed = [];
74794
74951
  let preserveTransaction = false;
74795
- fs49.mkdirSync(preparedDir, { recursive: true });
74796
- fs49.mkdirSync(sourceDir, { recursive: true });
74952
+ fs50.mkdirSync(preparedDir, { recursive: true });
74953
+ fs50.mkdirSync(sourceDir, { recursive: true });
74797
74954
  try {
74798
74955
  for (const skillName of skillNames) {
74799
- fs49.cpSync(path51.join(stagingDir, skillName), path51.join(preparedDir, skillName), {
74956
+ fs50.cpSync(path52.join(stagingDir, skillName), path52.join(preparedDir, skillName), {
74800
74957
  recursive: true
74801
74958
  });
74802
74959
  }
74803
74960
  for (const skillName of skillNames) {
74804
- const target = path51.join(sourceDir, skillName);
74805
- const backup = path51.join(backupDir, skillName);
74961
+ const target = path52.join(sourceDir, skillName);
74962
+ const backup = path52.join(backupDir, skillName);
74806
74963
  const hadExisting = pathExists(target);
74807
74964
  if (hadExisting) {
74808
- fs49.mkdirSync(path51.dirname(backup), { recursive: true });
74809
- fs49.renameSync(target, backup);
74965
+ fs50.mkdirSync(path52.dirname(backup), { recursive: true });
74966
+ fs50.renameSync(target, backup);
74810
74967
  }
74811
74968
  completed.push({ target, backup, hadExisting });
74812
- fs49.renameSync(path51.join(preparedDir, skillName), target);
74969
+ fs50.renameSync(path52.join(preparedDir, skillName), target);
74813
74970
  }
74814
74971
  installUserSkillsForClients(projectRoot, skillNames);
74815
74972
  } catch (error2) {
@@ -74823,7 +74980,7 @@ function installUserSkills(projectRoot, stagingDir, skillNames) {
74823
74980
  throw new Error(`Failed to install Maker user Skills: ${formatError4(error2)}`);
74824
74981
  } finally {
74825
74982
  if (!preserveTransaction) {
74826
- fs49.rmSync(transactionDir, { recursive: true, force: true });
74983
+ fs50.rmSync(transactionDir, { recursive: true, force: true });
74827
74984
  }
74828
74985
  }
74829
74986
  }
@@ -74831,27 +74988,27 @@ function installUserSkillsForClients(projectRoot, skillNames) {
74831
74988
  if (skillNames.length === 0) {
74832
74989
  return;
74833
74990
  }
74834
- const sourceRoot = path51.join(projectRoot, ".installer", "skills");
74835
- const transactionDir = path51.join(
74991
+ const sourceRoot = path52.join(projectRoot, ".installer", "skills");
74992
+ const transactionDir = path52.join(
74836
74993
  projectRoot,
74837
74994
  ".installer",
74838
74995
  `.user-skill-clients-${randomUUID9()}`
74839
74996
  );
74840
- const backupRoot = path51.join(transactionDir, "backup");
74997
+ const backupRoot = path52.join(transactionDir, "backup");
74841
74998
  const changed = [];
74842
74999
  let preserveTransaction = false;
74843
75000
  try {
74844
75001
  for (const clientDir of USER_SKILL_CLIENT_DIRS) {
74845
- const targetRoot = path51.join(projectRoot, clientDir, "skills");
74846
- fs49.mkdirSync(targetRoot, { recursive: true });
75002
+ const targetRoot = path52.join(projectRoot, clientDir, "skills");
75003
+ fs50.mkdirSync(targetRoot, { recursive: true });
74847
75004
  for (const skillName of skillNames) {
74848
- const source = path51.join(sourceRoot, skillName);
74849
- const target = path51.join(targetRoot, skillName);
74850
- const backup = path51.join(backupRoot, clientDir, skillName);
75005
+ const source = path52.join(sourceRoot, skillName);
75006
+ const target = path52.join(targetRoot, skillName);
75007
+ const backup = path52.join(backupRoot, clientDir, skillName);
74851
75008
  const hadExisting = pathExists(target);
74852
75009
  if (hadExisting) {
74853
- fs49.mkdirSync(path51.dirname(backup), { recursive: true });
74854
- fs49.renameSync(target, backup);
75010
+ fs50.mkdirSync(path52.dirname(backup), { recursive: true });
75011
+ fs50.renameSync(target, backup);
74855
75012
  }
74856
75013
  changed.push({ target, backup, hadExisting });
74857
75014
  linkOrCopySkill(source, target);
@@ -74868,7 +75025,7 @@ function installUserSkillsForClients(projectRoot, skillNames) {
74868
75025
  throw new Error(`Failed to install Maker user Skills for AI clients: ${formatError4(error2)}`);
74869
75026
  } finally {
74870
75027
  if (!preserveTransaction) {
74871
- fs49.rmSync(transactionDir, { recursive: true, force: true });
75028
+ fs50.rmSync(transactionDir, { recursive: true, force: true });
74872
75029
  }
74873
75030
  }
74874
75031
  }
@@ -74879,7 +75036,7 @@ function rollbackSkillChanges(changes) {
74879
75036
  try {
74880
75037
  removePathEntry(item.target);
74881
75038
  if (item.hadExisting && pathExists(item.backup)) {
74882
- fs49.renameSync(item.backup, item.target);
75039
+ fs50.renameSync(item.backup, item.target);
74883
75040
  }
74884
75041
  } catch (error2) {
74885
75042
  errors.push(`${item.target}: ${formatError4(error2)}`);
@@ -74889,12 +75046,12 @@ function rollbackSkillChanges(changes) {
74889
75046
  }
74890
75047
  function linkOrCopySkill(source, target) {
74891
75048
  try {
74892
- const linkTarget = process.platform === "win32" ? source : path51.relative(path51.dirname(target), source);
74893
- fs49.symlinkSync(linkTarget, target, process.platform === "win32" ? "junction" : "dir");
75049
+ const linkTarget = process.platform === "win32" ? source : path52.relative(path52.dirname(target), source);
75050
+ fs50.symlinkSync(linkTarget, target, process.platform === "win32" ? "junction" : "dir");
74894
75051
  } catch (linkError) {
74895
75052
  removePathEntry(target);
74896
75053
  try {
74897
- fs49.cpSync(source, target, { recursive: true });
75054
+ fs50.cpSync(source, target, { recursive: true });
74898
75055
  } catch (copyError) {
74899
75056
  throw new Error(
74900
75057
  `Failed to link ${source}: ${formatError4(linkError)}; copy fallback: ${formatError4(copyError)}`
@@ -74904,12 +75061,12 @@ function linkOrCopySkill(source, target) {
74904
75061
  }
74905
75062
  function removePathEntry(value) {
74906
75063
  try {
74907
- const stat = fs49.lstatSync(value);
75064
+ const stat = fs50.lstatSync(value);
74908
75065
  if (stat.isSymbolicLink()) {
74909
- fs49.unlinkSync(value);
75066
+ fs50.unlinkSync(value);
74910
75067
  return;
74911
75068
  }
74912
- fs49.rmSync(value, { recursive: true, force: true });
75069
+ fs50.rmSync(value, { recursive: true, force: true });
74913
75070
  } catch (error2) {
74914
75071
  if (error2.code !== "ENOENT") {
74915
75072
  throw error2;
@@ -74918,7 +75075,7 @@ function removePathEntry(value) {
74918
75075
  }
74919
75076
  function listLocalSkills(sourceDir) {
74920
75077
  try {
74921
- return fs49.readdirSync(sourceDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
75078
+ return fs50.readdirSync(sourceDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
74922
75079
  } catch {
74923
75080
  return [];
74924
75081
  }
@@ -74934,7 +75091,7 @@ function createDownloadError(status) {
74934
75091
  }
74935
75092
  function pathExists(value) {
74936
75093
  try {
74937
- fs49.lstatSync(value);
75094
+ fs50.lstatSync(value);
74938
75095
  return true;
74939
75096
  } catch {
74940
75097
  return false;
@@ -74951,7 +75108,7 @@ function hasControlCharacter(value) {
74951
75108
  }
74952
75109
 
74953
75110
  // src/maker/cli/commands.ts
74954
- var VERSION4 = true ? "0.0.34-beta.4" : "dev";
75111
+ var VERSION4 = true ? "0.0.34-beta.5" : "dev";
74955
75112
  var DEFAULT_MCP_NAME = "taptap-maker";
74956
75113
  var MAKER_NPM_PACKAGE = "@taptap/maker";
74957
75114
  var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
@@ -75182,7 +75339,7 @@ function toOptionKey(value) {
75182
75339
  }
75183
75340
  async function runInit(parsed, ctx) {
75184
75341
  rejectPackageOption(parsed);
75185
- const targetDir = path52.resolve(stringOption(parsed, "target_dir") || process.cwd());
75342
+ const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
75186
75343
  const env = makerEnvOption(parsed);
75187
75344
  const skipConfirm = booleanOption(parsed, "skip_confirm");
75188
75345
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -75299,7 +75456,7 @@ async function runInit(parsed, ctx) {
75299
75456
  }
75300
75457
  async function runDoctor(parsed, ctx) {
75301
75458
  var _a3, _b;
75302
- const targetDir = path52.resolve(stringOption(parsed, "target_dir") || process.cwd());
75459
+ const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
75303
75460
  const env = makerEnvOption(parsed);
75304
75461
  const git2 = checkGitEnvironment();
75305
75462
  const python = checkMakerPythonEnvironment();
@@ -75390,8 +75547,8 @@ async function runDoctor(parsed, ctx) {
75390
75547
  );
75391
75548
  }
75392
75549
  function inspectMakerDoctorExecutionContext(options3) {
75393
- const doctorCwd = path52.resolve(process.cwd());
75394
- const makerProjectDir = options3.makerProjectDir ? path52.resolve(options3.makerProjectDir) : void 0;
75550
+ const doctorCwd = path53.resolve(process.cwd());
75551
+ const makerProjectDir = options3.makerProjectDir ? path53.resolve(options3.makerProjectDir) : void 0;
75395
75552
  if (!makerProjectDir) {
75396
75553
  return {
75397
75554
  active_client_session: "not_checked",
@@ -75426,9 +75583,9 @@ function samePath2(left, right) {
75426
75583
  return normalizePathForCompare3(left) === normalizePathForCompare3(right);
75427
75584
  }
75428
75585
  function normalizePathForCompare3(value) {
75429
- const resolved = path52.resolve(value);
75586
+ const resolved = path53.resolve(value);
75430
75587
  try {
75431
- return fs50.realpathSync.native(resolved);
75588
+ return fs51.realpathSync.native(resolved);
75432
75589
  } catch {
75433
75590
  return resolved;
75434
75591
  }
@@ -75746,7 +75903,7 @@ async function runPatSet(parsed, ctx) {
75746
75903
  }
75747
75904
  async function resolvePatSet(parsed, ctx) {
75748
75905
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
75749
- const pat = fs50.readFileSync(0, "utf8").trim();
75906
+ const pat = fs51.readFileSync(0, "utf8").trim();
75750
75907
  if (!pat) {
75751
75908
  throw new Error("No PAT found on stdin.");
75752
75909
  }
@@ -75801,17 +75958,17 @@ async function prepareMcpLauncher(options3) {
75801
75958
  if (options3.mode === "self") {
75802
75959
  launcher = materializeMakerSelfLauncher({
75803
75960
  version: VERSION4,
75804
- bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL2(path52.resolve(process.cwd(), "dist", "maker.js")).href,
75961
+ bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL2(path53.resolve(process.cwd(), "dist", "maker.js")).href,
75805
75962
  makerHome: getMakerHome()
75806
75963
  });
75807
75964
  } else {
75808
75965
  const packageSpec = resolveMakerPackageSpec(MAKER_NPM_PACKAGE, VERSION4);
75809
75966
  launcher = resolveMakerMcpLauncher({ packageName: packageSpec });
75810
75967
  const configuredCache = process.env.npm_config_cache || process.env.NPM_CONFIG_CACHE;
75811
- const npmCacheDir = path52.resolve(
75812
- configuredCache || path52.join(getMakerHome(), "cache", "npm")
75968
+ const npmCacheDir = path53.resolve(
75969
+ configuredCache || path53.join(getMakerHome(), "cache", "npm")
75813
75970
  );
75814
- fs50.mkdirSync(npmCacheDir, { recursive: true });
75971
+ fs51.mkdirSync(npmCacheDir, { recursive: true });
75815
75972
  launcherEnv = { npm_config_cache: npmCacheDir };
75816
75973
  }
75817
75974
  } catch (error2) {
@@ -75944,7 +76101,7 @@ ${indent3(payload.stderr)}` : "",
75944
76101
  }
75945
76102
  async function runMcpReport(parsed, ctx) {
75946
76103
  rejectPackageOption(parsed);
75947
- const targetDir = path52.resolve(stringOption(parsed, "target_dir") || process.cwd());
76104
+ const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
75948
76105
  const contextInput = booleanOption(parsed, "context_stdin") ? await readStdinText() : "";
75949
76106
  const context = parseMakerMcpReportContext(contextInput);
75950
76107
  const contextValidation = validateMakerMcpReportContext(context);
@@ -76018,7 +76175,7 @@ async function runMcpReport(parsed, ctx) {
76018
76175
  const issue3 = buildMakerMcpIssue({
76019
76176
  context,
76020
76177
  diagnostics,
76021
- homeDir: os11.homedir()
76178
+ homeDir: os12.homedir()
76022
76179
  });
76023
76180
  const submission = booleanOption(parsed, "consent") ? submitMakerMcpIssue(issue3) : {
76024
76181
  status: "consent_required",
@@ -76045,7 +76202,7 @@ async function runMcpReport(parsed, ctx) {
76045
76202
  );
76046
76203
  }
76047
76204
  async function runAgentsUpdate(parsed, ctx) {
76048
- const targetDir = path52.resolve(stringOption(parsed, "target_dir") || process.cwd());
76205
+ const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
76049
76206
  const result = updateMakerAgentsPolicy(targetDir);
76050
76207
  if (ctx.json) {
76051
76208
  writeJson(result);
@@ -76064,7 +76221,7 @@ async function runAgentsUpdate(parsed, ctx) {
76064
76221
  async function runUpgrade(parsed, ctx) {
76065
76222
  rejectPackageOption(parsed);
76066
76223
  const explicitTargetDir = stringOption(parsed, "target_dir");
76067
- const targetDir = path52.resolve(explicitTargetDir || process.cwd());
76224
+ const targetDir = path53.resolve(explicitTargetDir || process.cwd());
76068
76225
  const env = makerEnvOption(parsed);
76069
76226
  const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
76070
76227
  const pluginDistribution = resolveMakerPluginDistribution();
@@ -76153,7 +76310,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
76153
76310
  ];
76154
76311
  }
76155
76312
  async function runDevKitUpdate(parsed, ctx) {
76156
- const targetDir = path52.resolve(stringOption(parsed, "target_dir") || process.cwd());
76313
+ const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
76157
76314
  const result = await installAiDevKit({
76158
76315
  targetDir,
76159
76316
  preserveExisting: false,
@@ -76167,7 +76324,7 @@ async function runDevKitUpdate(parsed, ctx) {
76167
76324
  }
76168
76325
  async function runUserSkillsPull(parsed, ctx) {
76169
76326
  const result = await pullMakerUserSkills({
76170
- targetDir: path52.resolve(stringOption(parsed, "target_dir") || process.cwd()),
76327
+ targetDir: path53.resolve(stringOption(parsed, "target_dir") || process.cwd()),
76171
76328
  environment: makerEnvOption(parsed)
76172
76329
  });
76173
76330
  if (ctx.json) {
@@ -76186,7 +76343,7 @@ async function runUserSkillsPull(parsed, ctx) {
76186
76343
  );
76187
76344
  }
76188
76345
  async function runLogsWatch(parsed, ctx) {
76189
- const targetDir = path52.resolve(stringOption(parsed, "target_dir") || process.cwd());
76346
+ const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
76190
76347
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
76191
76348
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? MAKER_TOOL_CALL_TIMEOUT_MS;
76192
76349
  const maxPolls = numberOption(parsed, "max_polls");
@@ -76196,9 +76353,9 @@ async function runLogsWatch(parsed, ctx) {
76196
76353
  serverUrl: stringOption(parsed, "server_url"),
76197
76354
  env: makerEnvOption(parsed)
76198
76355
  });
76199
- const runtimeDir = path52.join(proxy.projectRoot, ".maker", "logs", "runtime");
76200
- const runtimeLog = path52.join(runtimeDir, "runtime.log");
76201
- const pidFile = path52.join(runtimeDir, "watcher.pid");
76356
+ const runtimeDir = path53.join(proxy.projectRoot, ".maker", "logs", "runtime");
76357
+ const runtimeLog = path53.join(runtimeDir, "runtime.log");
76358
+ const pidFile = path53.join(runtimeDir, "watcher.pid");
76202
76359
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
76203
76360
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
76204
76361
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -76243,10 +76400,10 @@ async function runLogsWatch(parsed, ctx) {
76243
76400
  }
76244
76401
  }
76245
76402
  function registerRuntimeLogWatcherProcess(pidFile) {
76246
- fs50.mkdirSync(path52.dirname(pidFile), { recursive: true });
76403
+ fs51.mkdirSync(path53.dirname(pidFile), { recursive: true });
76247
76404
  const existingPid = readPidFile(pidFile);
76248
76405
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
76249
- fs50.writeFileSync(
76406
+ fs51.writeFileSync(
76250
76407
  pidFile,
76251
76408
  `${JSON.stringify(
76252
76409
  {
@@ -76264,10 +76421,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
76264
76421
  return previous;
76265
76422
  }
76266
76423
  function readPidFile(pidFile) {
76267
- if (!fs50.existsSync(pidFile)) {
76424
+ if (!fs51.existsSync(pidFile)) {
76268
76425
  return void 0;
76269
76426
  }
76270
- const raw = fs50.readFileSync(pidFile, "utf8").trim();
76427
+ const raw = fs51.readFileSync(pidFile, "utf8").trim();
76271
76428
  let pid = Number(raw);
76272
76429
  if (!Number.isInteger(pid) || pid <= 0) {
76273
76430
  try {
@@ -76287,7 +76444,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
76287
76444
  }
76288
76445
  cleaned = true;
76289
76446
  if (readPidFile(pidFile) === process.pid) {
76290
- fs50.rmSync(pidFile, { force: true });
76447
+ fs51.rmSync(pidFile, { force: true });
76291
76448
  }
76292
76449
  };
76293
76450
  process.once("exit", cleanup);
@@ -76438,7 +76595,7 @@ async function prepareDevKit(targetDir, ctx, options3 = {}) {
76438
76595
  onStart: (event) => emitSkillInstallerStart(ctx, event)
76439
76596
  });
76440
76597
  writeDevKitStagedGitignore(
76441
- path52.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
76598
+ path53.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
76442
76599
  listPresentDevKitManagedEntries(targetDir)
76443
76600
  );
76444
76601
  syncWorkBuddyDevKitSkills(targetDir, ctx);
@@ -76456,7 +76613,7 @@ async function prepareDevKit(targetDir, ctx, options3 = {}) {
76456
76613
  );
76457
76614
  } catch (error2) {
76458
76615
  writeDevKitStagedGitignore(
76459
- path52.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
76616
+ path53.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
76460
76617
  listPresentDevKitManagedEntries(targetDir)
76461
76618
  );
76462
76619
  if (options3.finalizeGitignore) {
@@ -76503,10 +76660,10 @@ function syncWorkBuddyDevKitSkills(targetDir, ctx) {
76503
76660
  try {
76504
76661
  const result = syncWorkBuddyProjectSkills(targetDir);
76505
76662
  const managedSkillPaths = [...result.installedSkills, ...result.skippedSkills].map(
76506
- (skillName) => path52.join(".workbuddy", "skills", skillName)
76663
+ (skillName) => path53.join(".workbuddy", "skills", skillName)
76507
76664
  );
76508
76665
  if (managedSkillPaths.length > 0) {
76509
- writeDevKitStagedGitignore(path52.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
76666
+ writeDevKitStagedGitignore(path53.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
76510
76667
  ...listPresentDevKitManagedEntries(targetDir),
76511
76668
  ...managedSkillPaths
76512
76669
  ]);
@@ -76583,12 +76740,12 @@ function installMcpConfig(ide, options3) {
76583
76740
  }
76584
76741
  function installMcpConfigUnsafe(ide, options3) {
76585
76742
  if (ide === "codex") {
76586
- const configPath = path52.join(os11.homedir(), ".codex", "config.toml");
76743
+ const configPath = path53.join(os12.homedir(), ".codex", "config.toml");
76587
76744
  const write = mergeCodexMcpConfig(configPath, withClientIde(options3, "codex"));
76588
76745
  return [createMcpInstallResult(ide, "Codex", configPath, write)];
76589
76746
  }
76590
76747
  if (ide === "cursor") {
76591
- const configPath = path52.join(os11.homedir(), ".cursor", "mcp.json");
76748
+ const configPath = path53.join(os12.homedir(), ".cursor", "mcp.json");
76592
76749
  const write = mergeJsonMcpConfig(configPath, withClientIde(options3, "cursor"));
76593
76750
  return [createMcpInstallResult(ide, "Cursor", configPath, write)];
76594
76751
  }
@@ -76605,7 +76762,7 @@ function installMcpConfigUnsafe(ide, options3) {
76605
76762
  }
76606
76763
  ];
76607
76764
  }
76608
- const configPath = path52.join(os11.homedir(), ".claude.json");
76765
+ const configPath = path53.join(os12.homedir(), ".claude.json");
76609
76766
  const write = mergeJsonMcpConfig(configPath, claudeOptions);
76610
76767
  return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
76611
76768
  }
@@ -76619,7 +76776,7 @@ function installMcpConfigUnsafe(ide, options3) {
76619
76776
  }
76620
76777
  if (ide === "opencode") {
76621
76778
  const configPath = getOpenCodeMcpConfigPath();
76622
- if (!fs50.existsSync(configPath)) {
76779
+ if (!fs51.existsSync(configPath)) {
76623
76780
  return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
76624
76781
  }
76625
76782
  const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options3, "opencode"));
@@ -76702,13 +76859,13 @@ function getDefaultMcpInstallIdes() {
76702
76859
  if (getTraeMcpInstallPaths().length > 0) {
76703
76860
  ides.push("trae");
76704
76861
  }
76705
- if (fs50.existsSync(getOpenCodeMcpConfigPath())) {
76862
+ if (fs51.existsSync(getOpenCodeMcpConfigPath())) {
76706
76863
  ides.push("opencode");
76707
76864
  }
76708
76865
  if (getWorkBuddyMcpInstallPaths().length > 0) {
76709
76866
  ides.push("workbuddy");
76710
76867
  }
76711
- if (fs50.existsSync(getDshHome())) {
76868
+ if (fs51.existsSync(getDshHome())) {
76712
76869
  ides.push("dsh");
76713
76870
  }
76714
76871
  return ides;
@@ -76722,7 +76879,7 @@ function getExistingTraeUserConfigPaths(paths) {
76722
76879
  const seen = /* @__PURE__ */ new Set();
76723
76880
  return paths.filter((configPath) => {
76724
76881
  const key = normalizeConfigPathKey(configPath);
76725
- if (seen.has(key) || !fs50.existsSync(path52.dirname(configPath))) {
76882
+ if (seen.has(key) || !fs51.existsSync(path53.dirname(configPath))) {
76726
76883
  return false;
76727
76884
  }
76728
76885
  seen.add(key);
@@ -76733,7 +76890,7 @@ function getExistingConfigPaths(paths) {
76733
76890
  const seen = /* @__PURE__ */ new Set();
76734
76891
  return paths.filter((configPath) => {
76735
76892
  const key = normalizeConfigPathKey(configPath);
76736
- if (seen.has(key) || !fs50.existsSync(configPath)) {
76893
+ if (seen.has(key) || !fs51.existsSync(configPath)) {
76737
76894
  return false;
76738
76895
  }
76739
76896
  seen.add(key);
@@ -76741,62 +76898,62 @@ function getExistingConfigPaths(paths) {
76741
76898
  });
76742
76899
  }
76743
76900
  function normalizeConfigPathKey(configPath) {
76744
- const resolved = path52.resolve(configPath);
76901
+ const resolved = path53.resolve(configPath);
76745
76902
  return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
76746
76903
  }
76747
76904
  function getTraeSoloMcpConfigPaths() {
76748
76905
  if (process.platform === "win32") {
76749
- const roaming = process.env.APPDATA || path52.join(os11.homedir(), "AppData", "Roaming");
76906
+ const roaming = process.env.APPDATA || path53.join(os12.homedir(), "AppData", "Roaming");
76750
76907
  return [
76751
- path52.join(roaming, "TRAE SOLO", "User", "mcp.json"),
76752
- path52.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
76908
+ path53.join(roaming, "TRAE SOLO", "User", "mcp.json"),
76909
+ path53.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
76753
76910
  ];
76754
76911
  }
76755
- const appSupport = path52.join(os11.homedir(), "Library", "Application Support");
76912
+ const appSupport = path53.join(os12.homedir(), "Library", "Application Support");
76756
76913
  return [
76757
- path52.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
76758
- path52.join(appSupport, "TRAE SOLO", "User", "mcp.json")
76914
+ path53.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
76915
+ path53.join(appSupport, "TRAE SOLO", "User", "mcp.json")
76759
76916
  ];
76760
76917
  }
76761
76918
  function getTraeUnverifiedMcpConfigPaths() {
76762
76919
  if (process.platform === "win32") {
76763
- const roaming = process.env.APPDATA || path52.join(os11.homedir(), "AppData", "Roaming");
76920
+ const roaming = process.env.APPDATA || path53.join(os12.homedir(), "AppData", "Roaming");
76764
76921
  return [
76765
- path52.join(roaming, "Trae", "User", "mcp.json"),
76766
- path52.join(roaming, "TRAE", "User", "mcp.json"),
76767
- path52.join(roaming, "Trae CN", "User", "mcp.json")
76922
+ path53.join(roaming, "Trae", "User", "mcp.json"),
76923
+ path53.join(roaming, "TRAE", "User", "mcp.json"),
76924
+ path53.join(roaming, "Trae CN", "User", "mcp.json")
76768
76925
  ];
76769
76926
  }
76770
- const appSupport = path52.join(os11.homedir(), "Library", "Application Support");
76927
+ const appSupport = path53.join(os12.homedir(), "Library", "Application Support");
76771
76928
  return [
76772
- path52.join(appSupport, "Trae", "User", "mcp.json"),
76773
- path52.join(appSupport, "TRAE", "User", "mcp.json"),
76774
- path52.join(appSupport, "Trae CN", "User", "mcp.json")
76929
+ path53.join(appSupport, "Trae", "User", "mcp.json"),
76930
+ path53.join(appSupport, "TRAE", "User", "mcp.json"),
76931
+ path53.join(appSupport, "Trae CN", "User", "mcp.json")
76775
76932
  ];
76776
76933
  }
76777
76934
  function getOpenCodeMcpConfigPath() {
76778
- return path52.join(os11.homedir(), ".config", "opencode", "opencode.jsonc");
76935
+ return path53.join(os12.homedir(), ".config", "opencode", "opencode.jsonc");
76779
76936
  }
76780
76937
  function getWorkBuddyHome() {
76781
- return path52.join(os11.homedir(), ".workbuddy");
76938
+ return path53.join(os12.homedir(), ".workbuddy");
76782
76939
  }
76783
76940
  function getWorkBuddyMcpInstallPaths(options3 = {}) {
76784
- const primary = path52.join(getWorkBuddyHome(), "mcp.json");
76785
- if (fs50.existsSync(primary) || options3.createPrimary) {
76941
+ const primary = path53.join(getWorkBuddyHome(), "mcp.json");
76942
+ if (fs51.existsSync(primary) || options3.createPrimary) {
76786
76943
  return [primary];
76787
76944
  }
76788
- const legacy = path52.join(getWorkBuddyHome(), ".mcp.json");
76789
- if (fs50.existsSync(legacy)) {
76945
+ const legacy = path53.join(getWorkBuddyHome(), ".mcp.json");
76946
+ if (fs51.existsSync(legacy)) {
76790
76947
  return [legacy];
76791
76948
  }
76792
76949
  return [];
76793
76950
  }
76794
76951
  function inspectWorkBuddyTrustState(mcpName) {
76795
76952
  const workbuddyHome = getWorkBuddyHome();
76796
- const connectorsDir = path52.join(workbuddyHome, "connectors");
76953
+ const connectorsDir = path53.join(workbuddyHome, "connectors");
76797
76954
  const accounts = [];
76798
76955
  const stateFiles = [];
76799
- if (!fs50.existsSync(connectorsDir)) {
76956
+ if (!fs51.existsSync(connectorsDir)) {
76800
76957
  return {
76801
76958
  status: "not_found",
76802
76959
  mcp_name: mcpName,
@@ -76806,12 +76963,12 @@ function inspectWorkBuddyTrustState(mcpName) {
76806
76963
  accounts
76807
76964
  };
76808
76965
  }
76809
- for (const entry of fs50.readdirSync(connectorsDir, { withFileTypes: true })) {
76966
+ for (const entry of fs51.readdirSync(connectorsDir, { withFileTypes: true })) {
76810
76967
  if (!entry.isDirectory()) {
76811
76968
  continue;
76812
76969
  }
76813
- const statePath = path52.join(connectorsDir, entry.name, "connector-states.json");
76814
- if (!fs50.existsSync(statePath)) {
76970
+ const statePath = path53.join(connectorsDir, entry.name, "connector-states.json");
76971
+ if (!fs51.existsSync(statePath)) {
76815
76972
  continue;
76816
76973
  }
76817
76974
  stateFiles.push(statePath);
@@ -76890,7 +77047,7 @@ function mergeJsonMcpConfig(configPath, options3) {
76890
77047
  );
76891
77048
  }
76892
77049
  function mergeOpenCodeMcpConfig(configPath, options3) {
76893
- const rawContent = fs50.readFileSync(configPath, "utf8");
77050
+ const rawContent = fs51.readFileSync(configPath, "utf8");
76894
77051
  const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
76895
77052
  const existing = readJsonObject(configPath, { jsonc: true });
76896
77053
  const mcp = asObject(existing.mcp);
@@ -76922,7 +77079,7 @@ function mergeOpenCodeMcpConfig(configPath, options3) {
76922
77079
  return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
76923
77080
  }
76924
77081
  function mergeCodexMcpConfig(configPath, options3) {
76925
- const existing = fs50.existsSync(configPath) ? fs50.readFileSync(configPath, "utf8") : "";
77082
+ const existing = fs51.existsSync(configPath) ? fs51.readFileSync(configPath, "utf8") : "";
76926
77083
  const withoutOld = removeCodexMcpTables(existing, options3.mcpName).trimEnd();
76927
77084
  const launch = options3.launcher;
76928
77085
  const envValues = createMcpEnvironmentValues(options3.env, options3.clientIde, options3.launcherEnv);
@@ -76956,7 +77113,7 @@ function mergeCodexMcpConfig(configPath, options3) {
76956
77113
  );
76957
77114
  }
76958
77115
  function tryClaudeMcpAdd(options3) {
76959
- const configPath = path52.join(os11.homedir(), ".claude.json");
77116
+ const configPath = path53.join(os12.homedir(), ".claude.json");
76960
77117
  try {
76961
77118
  const existing = readJsonObject(configPath);
76962
77119
  const server = asObject(asObject(existing.mcpServers)[options3.mcpName]);
@@ -77049,10 +77206,10 @@ function rejectPackageOption(parsed) {
77049
77206
  }
77050
77207
  }
77051
77208
  function readJsonObject(filePath, options3 = {}) {
77052
- if (!fs50.existsSync(filePath)) {
77209
+ if (!fs51.existsSync(filePath)) {
77053
77210
  return {};
77054
77211
  }
77055
- const raw = fs50.readFileSync(filePath, "utf8");
77212
+ const raw = fs51.readFileSync(filePath, "utf8");
77056
77213
  try {
77057
77214
  const normalized = normalizeJsonConfigContent(raw, options3);
77058
77215
  const parsed = JSON.parse(normalized);
@@ -77224,10 +77381,10 @@ function formatMcpInstallMessage(label, configPath, write) {
77224
77381
  ].filter(Boolean).join("\n");
77225
77382
  }
77226
77383
  function saveInitState(targetDir, state) {
77227
- fs50.mkdirSync(getMakerHome(), { recursive: true });
77228
- const key = crypto5.createHash("sha256").update(path52.resolve(targetDir)).digest("hex").slice(0, 16);
77229
- fs50.writeFileSync(
77230
- path52.join(getMakerHome(), `init-state-${key}.json`),
77384
+ fs51.mkdirSync(getMakerHome(), { recursive: true });
77385
+ const key = crypto5.createHash("sha256").update(path53.resolve(targetDir)).digest("hex").slice(0, 16);
77386
+ fs51.writeFileSync(
77387
+ path53.join(getMakerHome(), `init-state-${key}.json`),
77231
77388
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
77232
77389
  `,
77233
77390
  "utf8"
@@ -77375,7 +77532,7 @@ function makerEnvOption(parsed) {
77375
77532
  return env;
77376
77533
  }
77377
77534
  const targetDir = stringOption(parsed, "target_dir");
77378
- return getMakerEnvironment(void 0, targetDir ? path52.resolve(targetDir) : process.cwd());
77535
+ return getMakerEnvironment(void 0, targetDir ? path53.resolve(targetDir) : process.cwd());
77379
77536
  }
77380
77537
  function makerMcpConfigEnvOption(parsed) {
77381
77538
  return stringOption(parsed, "env") === "rnd" ? "rnd" : "production";
@@ -79078,7 +79235,7 @@ var StreamableHTTPClientTransport = class {
79078
79235
 
79079
79236
  // src/mcp-proxy/proxy.ts
79080
79237
  init_types2();
79081
- import * as path54 from "node:path";
79238
+ import * as path55 from "node:path";
79082
79239
  import * as crypto8 from "node:crypto";
79083
79240
 
79084
79241
  // src/mcp-proxy/cookieJar.ts
@@ -79274,8 +79431,8 @@ function isStandaloneSseRequest(input2, init) {
79274
79431
  }
79275
79432
 
79276
79433
  // src/core/utils/logWriter.ts
79277
- import * as fs51 from "node:fs";
79278
- import * as path53 from "node:path";
79434
+ import * as fs52 from "node:fs";
79435
+ import * as path54 from "node:path";
79279
79436
  import * as crypto7 from "node:crypto";
79280
79437
 
79281
79438
  // src/core/types/log.ts
@@ -79316,7 +79473,7 @@ var LogWriter = class {
79316
79473
  return;
79317
79474
  }
79318
79475
  try {
79319
- await fs51.promises.mkdir(this.config.logDir, { recursive: true });
79476
+ await fs52.promises.mkdir(this.config.logDir, { recursive: true });
79320
79477
  await this.cleanupOldLogs();
79321
79478
  this.initialized = true;
79322
79479
  } catch (error2) {
@@ -79339,7 +79496,7 @@ var LogWriter = class {
79339
79496
  */
79340
79497
  getLogFilePath(date5) {
79341
79498
  const d = date5 || this.getCurrentDate();
79342
- return path53.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
79499
+ return path54.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
79343
79500
  }
79344
79501
  /**
79345
79502
  * 获取或创建写入流
@@ -79354,7 +79511,7 @@ var LogWriter = class {
79354
79511
  }
79355
79512
  this.currentDate = date5;
79356
79513
  try {
79357
- this.writeStream = fs51.createWriteStream(this.getLogFilePath(date5), {
79514
+ this.writeStream = fs52.createWriteStream(this.getLogFilePath(date5), {
79358
79515
  flags: "a",
79359
79516
  encoding: "utf8"
79360
79517
  });
@@ -79406,11 +79563,11 @@ var LogWriter = class {
79406
79563
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
79407
79564
  try {
79408
79565
  const filePath = this.getLogFilePath();
79409
- const dir = path53.dirname(filePath);
79410
- if (!fs51.existsSync(dir)) {
79411
- fs51.mkdirSync(dir, { recursive: true });
79566
+ const dir = path54.dirname(filePath);
79567
+ if (!fs52.existsSync(dir)) {
79568
+ fs52.mkdirSync(dir, { recursive: true });
79412
79569
  }
79413
- fs51.appendFileSync(filePath, message, "utf8");
79570
+ fs52.appendFileSync(filePath, message, "utf8");
79414
79571
  } catch {
79415
79572
  }
79416
79573
  }
@@ -79421,7 +79578,7 @@ var LogWriter = class {
79421
79578
  async cleanupOldLogs() {
79422
79579
  if (this.config.maxDays <= 0) return;
79423
79580
  try {
79424
- const files = await fs51.promises.readdir(this.config.logDir);
79581
+ const files = await fs52.promises.readdir(this.config.logDir);
79425
79582
  const cutoffDate = /* @__PURE__ */ new Date();
79426
79583
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
79427
79584
  const prefix = this.config.prefix;
@@ -79436,7 +79593,7 @@ var LogWriter = class {
79436
79593
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
79437
79594
  const fileDate = new Date(year, month - 1, day);
79438
79595
  if (fileDate < cutoffDate) {
79439
- await fs51.promises.unlink(path53.join(this.config.logDir, file3));
79596
+ await fs52.promises.unlink(path54.join(this.config.logDir, file3));
79440
79597
  process.stderr.write(`[LogWriter] Deleted old log: ${file3}
79441
79598
  `);
79442
79599
  }
@@ -79570,10 +79727,10 @@ var TapTapMCPProxy = class {
79570
79727
  const { user_id, project_id } = this.config.tenant;
79571
79728
  let logDir;
79572
79729
  if (user_id && project_id) {
79573
- logDir = path54.join(logRoot, "proxy", user_id, project_id);
79730
+ logDir = path55.join(logRoot, "proxy", user_id, project_id);
79574
79731
  } else {
79575
79732
  const kidHash = crypto8.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
79576
- logDir = path54.join(logRoot, "proxy", kidHash);
79733
+ logDir = path55.join(logRoot, "proxy", kidHash);
79577
79734
  }
79578
79735
  return new LogWriter({
79579
79736
  logDir,