@taptap/maker 0.0.37-beta.2 → 0.0.37-beta.3

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.37-beta.2
3
+ // TapTap Maker MCP version: 0.0.37-beta.3
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: path61, errorMaps, issueData } = params;
453
- const fullPath = [...path61, ...issueData.path || []];
452
+ const { data, path: path62, errorMaps, issueData } = params;
453
+ const fullPath = [...path62, ...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, path61, key) {
733
+ constructor(parent, value, path62, key) {
734
734
  this._cachedPath = [];
735
735
  this.parent = parent;
736
736
  this.data = value;
737
- this._path = path61;
737
+ this._path = path62;
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, path61) {
4247
- if (!path61)
4246
+ function getElementAtPath(obj, path62) {
4247
+ if (!path62)
4248
4248
  return obj;
4249
- return path61.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
4249
+ return path62.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(path61, issues) {
4562
+ function prefixIssues(path62, issues) {
4563
4563
  return issues.map((iss) => {
4564
4564
  var _a3;
4565
4565
  (_a3 = iss).path ?? (_a3.path = []);
4566
- iss.path.unshift(path61);
4566
+ iss.path.unshift(path62);
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(path61) {
17730
- let input2 = path61;
17729
+ function removeDotSegments(path62) {
17730
+ let input2 = path62;
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 [path61, query] = wsComponent.resourceName.split("?");
17930
- wsComponent.path = path61 && path61 !== "/" ? path61 : void 0;
17929
+ const [path62, query] = wsComponent.resourceName.split("?");
17930
+ wsComponent.path = path62 && path62 !== "/" ? path62 : 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, fs58, exportName) {
26987
+ function addFormats(ajv, list, fs59, 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, fs58[f]);
26992
+ ajv.addFormat(f, fs59[f]);
26993
26993
  }
26994
26994
  module.exports = exports = formatsPlugin;
26995
26995
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -29980,7 +29980,7 @@ function createMakerAgentsPolicyBody() {
29980
29980
  " `mcp report --ide <client> --target-dir <project> --context-stdin --consent --json`.",
29981
29981
  "- This preserves the configured package version and the absolute Windows node.exe/npm-cli.js.",
29982
29982
  "- Only with a known exact installed version, fallback to",
29983
- " `npx -y --package @taptap/maker@0.0.37-beta.2 taptap-maker mcp report ...`.",
29983
+ " `npx -y --package @taptap/maker@0.0.37-beta.3 taptap-maker mcp report ...`.",
29984
29984
  "- Never use an unversioned npm package, or assume `taptap-maker`/`npx` is globally available.",
29985
29985
  "- Never include the complete conversation, project source, other MCP server entries, PAT/token",
29986
29986
  " values, or full environment variables. Normalize the user home path to `~`.",
@@ -39289,7 +39289,7 @@ var init_tracking = __esm({
39289
39289
  MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
39290
39290
  MAKER_MCP_TRACKING_SOURCE = "local_mcp";
39291
39291
  MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
39292
- MAKER_MCP_VERSION = "0.0.37-beta.2".trim() ? "0.0.37-beta.2".trim() : "dev";
39292
+ MAKER_MCP_VERSION = "0.0.37-beta.3".trim() ? "0.0.37-beta.3".trim() : "dev";
39293
39293
  TRACKING_ERROR_MAX_LENGTH = 500;
39294
39294
  }
39295
39295
  });
@@ -39340,8 +39340,8 @@ var require_windows = __commonJS({
39340
39340
  "node_modules/isexe/windows.js"(exports, module) {
39341
39341
  module.exports = isexe;
39342
39342
  isexe.sync = sync;
39343
- var fs58 = __require("fs");
39344
- function checkPathExt(path61, options3) {
39343
+ var fs59 = __require("fs");
39344
+ function checkPathExt(path62, options3) {
39345
39345
  var pathext = options3.pathExt !== void 0 ? options3.pathExt : process.env.PATHEXT;
39346
39346
  if (!pathext) {
39347
39347
  return true;
@@ -39352,25 +39352,25 @@ var require_windows = __commonJS({
39352
39352
  }
39353
39353
  for (var i = 0; i < pathext.length; i++) {
39354
39354
  var p = pathext[i].toLowerCase();
39355
- if (p && path61.substr(-p.length).toLowerCase() === p) {
39355
+ if (p && path62.substr(-p.length).toLowerCase() === p) {
39356
39356
  return true;
39357
39357
  }
39358
39358
  }
39359
39359
  return false;
39360
39360
  }
39361
- function checkStat(stat, path61, options3) {
39361
+ function checkStat(stat, path62, options3) {
39362
39362
  if (!stat.isSymbolicLink() && !stat.isFile()) {
39363
39363
  return false;
39364
39364
  }
39365
- return checkPathExt(path61, options3);
39365
+ return checkPathExt(path62, options3);
39366
39366
  }
39367
- function isexe(path61, options3, cb) {
39368
- fs58.stat(path61, function(er, stat) {
39369
- cb(er, er ? false : checkStat(stat, path61, options3));
39367
+ function isexe(path62, options3, cb) {
39368
+ fs59.stat(path62, function(er, stat) {
39369
+ cb(er, er ? false : checkStat(stat, path62, options3));
39370
39370
  });
39371
39371
  }
39372
- function sync(path61, options3) {
39373
- return checkStat(fs58.statSync(path61), path61, options3);
39372
+ function sync(path62, options3) {
39373
+ return checkStat(fs59.statSync(path62), path62, options3);
39374
39374
  }
39375
39375
  }
39376
39376
  });
@@ -39380,14 +39380,14 @@ var require_mode = __commonJS({
39380
39380
  "node_modules/isexe/mode.js"(exports, module) {
39381
39381
  module.exports = isexe;
39382
39382
  isexe.sync = sync;
39383
- var fs58 = __require("fs");
39384
- function isexe(path61, options3, cb) {
39385
- fs58.stat(path61, function(er, stat) {
39383
+ var fs59 = __require("fs");
39384
+ function isexe(path62, options3, cb) {
39385
+ fs59.stat(path62, function(er, stat) {
39386
39386
  cb(er, er ? false : checkStat(stat, options3));
39387
39387
  });
39388
39388
  }
39389
- function sync(path61, options3) {
39390
- return checkStat(fs58.statSync(path61), options3);
39389
+ function sync(path62, options3) {
39390
+ return checkStat(fs59.statSync(path62), options3);
39391
39391
  }
39392
39392
  function checkStat(stat, options3) {
39393
39393
  return stat.isFile() && checkMode(stat, options3);
@@ -39411,7 +39411,7 @@ var require_mode = __commonJS({
39411
39411
  // node_modules/isexe/index.js
39412
39412
  var require_isexe = __commonJS({
39413
39413
  "node_modules/isexe/index.js"(exports, module) {
39414
- var fs58 = __require("fs");
39414
+ var fs59 = __require("fs");
39415
39415
  var core;
39416
39416
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
39417
39417
  core = require_windows();
@@ -39420,7 +39420,7 @@ var require_isexe = __commonJS({
39420
39420
  }
39421
39421
  module.exports = isexe;
39422
39422
  isexe.sync = sync;
39423
- function isexe(path61, options3, cb) {
39423
+ function isexe(path62, options3, cb) {
39424
39424
  if (typeof options3 === "function") {
39425
39425
  cb = options3;
39426
39426
  options3 = {};
@@ -39430,7 +39430,7 @@ var require_isexe = __commonJS({
39430
39430
  throw new TypeError("callback not provided");
39431
39431
  }
39432
39432
  return new Promise(function(resolve, reject) {
39433
- isexe(path61, options3 || {}, function(er, is) {
39433
+ isexe(path62, options3 || {}, function(er, is) {
39434
39434
  if (er) {
39435
39435
  reject(er);
39436
39436
  } else {
@@ -39439,7 +39439,7 @@ var require_isexe = __commonJS({
39439
39439
  });
39440
39440
  });
39441
39441
  }
39442
- core(path61, options3 || {}, function(er, is) {
39442
+ core(path62, options3 || {}, function(er, is) {
39443
39443
  if (er) {
39444
39444
  if (er.code === "EACCES" || options3 && options3.ignoreErrors) {
39445
39445
  er = null;
@@ -39449,9 +39449,9 @@ var require_isexe = __commonJS({
39449
39449
  cb(er, is);
39450
39450
  });
39451
39451
  }
39452
- function sync(path61, options3) {
39452
+ function sync(path62, options3) {
39453
39453
  try {
39454
- return core.sync(path61, options3 || {});
39454
+ return core.sync(path62, options3 || {});
39455
39455
  } catch (er) {
39456
39456
  if (options3 && options3.ignoreErrors || er.code === "EACCES") {
39457
39457
  return false;
@@ -39467,7 +39467,7 @@ var require_isexe = __commonJS({
39467
39467
  var require_which = __commonJS({
39468
39468
  "node_modules/which/which.js"(exports, module) {
39469
39469
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
39470
- var path61 = __require("path");
39470
+ var path62 = __require("path");
39471
39471
  var COLON = isWindows ? ";" : ":";
39472
39472
  var isexe = require_isexe();
39473
39473
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -39505,7 +39505,7 @@ var require_which = __commonJS({
39505
39505
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
39506
39506
  const ppRaw = pathEnv[i];
39507
39507
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
39508
- const pCmd = path61.join(pathPart, cmd);
39508
+ const pCmd = path62.join(pathPart, cmd);
39509
39509
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
39510
39510
  resolve(subStep(p, i, 0));
39511
39511
  });
@@ -39532,7 +39532,7 @@ var require_which = __commonJS({
39532
39532
  for (let i = 0; i < pathEnv.length; i++) {
39533
39533
  const ppRaw = pathEnv[i];
39534
39534
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
39535
- const pCmd = path61.join(pathPart, cmd);
39535
+ const pCmd = path62.join(pathPart, cmd);
39536
39536
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
39537
39537
  for (let j = 0; j < pathExt.length; j++) {
39538
39538
  const cur = p + pathExt[j];
@@ -39580,7 +39580,7 @@ var require_path_key = __commonJS({
39580
39580
  var require_resolveCommand = __commonJS({
39581
39581
  "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
39582
39582
  "use strict";
39583
- var path61 = __require("path");
39583
+ var path62 = __require("path");
39584
39584
  var which = require_which();
39585
39585
  var getPathKey = require_path_key();
39586
39586
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -39598,7 +39598,7 @@ var require_resolveCommand = __commonJS({
39598
39598
  try {
39599
39599
  resolved = which.sync(parsed.command, {
39600
39600
  path: env[getPathKey({ env })],
39601
- pathExt: withoutPathExt ? path61.delimiter : void 0
39601
+ pathExt: withoutPathExt ? path62.delimiter : void 0
39602
39602
  });
39603
39603
  } catch (e) {
39604
39604
  } finally {
@@ -39607,7 +39607,7 @@ var require_resolveCommand = __commonJS({
39607
39607
  }
39608
39608
  }
39609
39609
  if (resolved) {
39610
- resolved = path61.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
39610
+ resolved = path62.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
39611
39611
  }
39612
39612
  return resolved;
39613
39613
  }
@@ -39661,8 +39661,8 @@ var require_shebang_command = __commonJS({
39661
39661
  if (!match) {
39662
39662
  return null;
39663
39663
  }
39664
- const [path61, argument] = match[0].replace(/#! ?/, "").split(" ");
39665
- const binary = path61.split("/").pop();
39664
+ const [path62, argument] = match[0].replace(/#! ?/, "").split(" ");
39665
+ const binary = path62.split("/").pop();
39666
39666
  if (binary === "env") {
39667
39667
  return argument;
39668
39668
  }
@@ -39675,16 +39675,16 @@ var require_shebang_command = __commonJS({
39675
39675
  var require_readShebang = __commonJS({
39676
39676
  "node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
39677
39677
  "use strict";
39678
- var fs58 = __require("fs");
39678
+ var fs59 = __require("fs");
39679
39679
  var shebangCommand = require_shebang_command();
39680
39680
  function readShebang(command) {
39681
39681
  const size = 150;
39682
39682
  const buffer = Buffer.alloc(size);
39683
39683
  let fd;
39684
39684
  try {
39685
- fd = fs58.openSync(command, "r");
39686
- fs58.readSync(fd, buffer, 0, size, 0);
39687
- fs58.closeSync(fd);
39685
+ fd = fs59.openSync(command, "r");
39686
+ fs59.readSync(fd, buffer, 0, size, 0);
39687
+ fs59.closeSync(fd);
39688
39688
  } catch (e) {
39689
39689
  }
39690
39690
  return shebangCommand(buffer.toString());
@@ -39697,7 +39697,7 @@ var require_readShebang = __commonJS({
39697
39697
  var require_parse = __commonJS({
39698
39698
  "node_modules/cross-spawn/lib/parse.js"(exports, module) {
39699
39699
  "use strict";
39700
- var path61 = __require("path");
39700
+ var path62 = __require("path");
39701
39701
  var resolveCommand = require_resolveCommand();
39702
39702
  var escape3 = require_escape();
39703
39703
  var readShebang = require_readShebang();
@@ -39722,7 +39722,7 @@ var require_parse = __commonJS({
39722
39722
  const needsShell = !isExecutableRegExp.test(commandFile);
39723
39723
  if (parsed.options.forceShell || needsShell) {
39724
39724
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
39725
- parsed.command = path61.normalize(parsed.command);
39725
+ parsed.command = path62.normalize(parsed.command);
39726
39726
  parsed.command = escape3.command(parsed.command);
39727
39727
  parsed.args = parsed.args.map((arg) => escape3.argument(arg, needsDoubleEscapeMetaChars));
39728
39728
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -43298,7 +43298,7 @@ var init_mcp = __esm({
43298
43298
  init_remoteProxyManager();
43299
43299
  init_proxyAssets();
43300
43300
  init_diagnosticRedaction();
43301
- VERSION = true ? "0.0.37-beta.2" : "dev";
43301
+ VERSION = true ? "0.0.37-beta.3" : "dev";
43302
43302
  DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
43303
43303
  DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
43304
43304
  DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -47036,7 +47036,7 @@ var require_websocket = __commonJS({
47036
47036
  var http4 = __require("http");
47037
47037
  var net = __require("net");
47038
47038
  var tls = __require("tls");
47039
- var { randomBytes: randomBytes4, createHash: createHash12 } = __require("crypto");
47039
+ var { randomBytes: randomBytes4, createHash: createHash13 } = __require("crypto");
47040
47040
  var { Duplex, Readable: Readable2 } = __require("stream");
47041
47041
  var { URL: URL2 } = __require("url");
47042
47042
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -47704,7 +47704,7 @@ var require_websocket = __commonJS({
47704
47704
  abortHandshake(websocket, socket, "Invalid Upgrade header");
47705
47705
  return;
47706
47706
  }
47707
- const digest = createHash12("sha1").update(key + GUID).digest("base64");
47707
+ const digest = createHash13("sha1").update(key + GUID).digest("base64");
47708
47708
  if (res.headers["sec-websocket-accept"] !== digest) {
47709
47709
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
47710
47710
  return;
@@ -48073,7 +48073,7 @@ var require_websocket_server = __commonJS({
48073
48073
  var EventEmitter = __require("events");
48074
48074
  var http4 = __require("http");
48075
48075
  var { Duplex } = __require("stream");
48076
- var { createHash: createHash12 } = __require("crypto");
48076
+ var { createHash: createHash13 } = __require("crypto");
48077
48077
  var extension2 = require_extension();
48078
48078
  var PerMessageDeflate2 = require_permessage_deflate();
48079
48079
  var subprotocol2 = require_subprotocol();
@@ -48380,7 +48380,7 @@ var require_websocket_server = __commonJS({
48380
48380
  );
48381
48381
  }
48382
48382
  if (this._state > RUNNING) return abortHandshake(socket, 503);
48383
- const digest = createHash12("sha1").update(key + GUID).digest("base64");
48383
+ const digest = createHash13("sha1").update(key + GUID).digest("base64");
48384
48384
  const headers = [
48385
48385
  "HTTP/1.1 101 Switching Protocols",
48386
48386
  "Upgrade: websocket",
@@ -51562,17 +51562,17 @@ var require_codegen3 = __commonJS({
51562
51562
  var require_fs = __commonJS({
51563
51563
  "node_modules/protobufjs/src/util/fs.js"(exports, module) {
51564
51564
  "use strict";
51565
- var fs58 = null;
51565
+ var fs59 = null;
51566
51566
  try {
51567
- fs58 = __require(
51567
+ fs59 = __require(
51568
51568
  /* webpackIgnore: true */
51569
51569
  "fs"
51570
51570
  );
51571
- if (!fs58 || !fs58.readFile || !fs58.readFileSync)
51572
- fs58 = null;
51571
+ if (!fs59 || !fs59.readFile || !fs59.readFileSync)
51572
+ fs59 = null;
51573
51573
  } catch (e) {
51574
51574
  }
51575
- module.exports = fs58;
51575
+ module.exports = fs59;
51576
51576
  }
51577
51577
  });
51578
51578
 
@@ -51582,7 +51582,7 @@ var require_fetch = __commonJS({
51582
51582
  "use strict";
51583
51583
  module.exports = fetch2;
51584
51584
  var asPromise = require_aspromise();
51585
- var fs58 = require_fs();
51585
+ var fs59 = require_fs();
51586
51586
  function fetch2(filename2, options3, callback) {
51587
51587
  if (typeof options3 === "function") {
51588
51588
  callback = options3;
@@ -51591,8 +51591,8 @@ var require_fetch = __commonJS({
51591
51591
  options3 = {};
51592
51592
  if (!callback)
51593
51593
  return asPromise(fetch2, this, filename2, options3);
51594
- if (!options3.xhr && fs58 && fs58.readFile)
51595
- return fs58.readFile(filename2, function fetchReadFileCallback(err, contents) {
51594
+ if (!options3.xhr && fs59 && fs59.readFile)
51595
+ return fs59.readFile(filename2, function fetchReadFileCallback(err, contents) {
51596
51596
  return err && typeof XMLHttpRequest !== "undefined" ? fetch2.xhr(filename2, options3, callback) : err ? callback(err) : callback(null, options3.binary ? contents : contents.toString("utf8"));
51597
51597
  });
51598
51598
  return fetch2.xhr(filename2, options3, callback);
@@ -51630,13 +51630,13 @@ var require_fetch = __commonJS({
51630
51630
  var require_path = __commonJS({
51631
51631
  "node_modules/protobufjs/src/util/path.js"(exports) {
51632
51632
  "use strict";
51633
- var path61 = exports;
51633
+ var path62 = exports;
51634
51634
  var urlRe = /^[a-zA-Z][a-zA-Z0-9+.-]+:\/\//;
51635
- function normalizeUrl(path62) {
51636
- if (typeof URL === "undefined" || !urlRe.test(path62))
51635
+ function normalizeUrl(path63) {
51636
+ if (typeof URL === "undefined" || !urlRe.test(path63))
51637
51637
  return null;
51638
51638
  try {
51639
- return new URL(path62).href;
51639
+ return new URL(path63).href;
51640
51640
  } catch (e) {
51641
51641
  return null;
51642
51642
  }
@@ -51656,8 +51656,8 @@ var require_path = __commonJS({
51656
51656
  * @param {string} path Path to test
51657
51657
  * @returns {boolean} `true` if path is absolute
51658
51658
  */
51659
- path61.isAbsolute = function isAbsolute2(path62) {
51660
- return /^(?:\/|\w+:|\\\\\w+)/.test(path62);
51659
+ path62.isAbsolute = function isAbsolute2(path63) {
51660
+ return /^(?:\/|\w+:|\\\\\w+)/.test(path63);
51661
51661
  }
51662
51662
  );
51663
51663
  var normalize = (
@@ -51666,18 +51666,18 @@ var require_path = __commonJS({
51666
51666
  * @param {string} path Path to normalize
51667
51667
  * @returns {string} Normalized path
51668
51668
  */
51669
- path61.normalize = function normalize2(path62) {
51670
- var normalizedUrl = normalizeUrl(path62);
51669
+ path62.normalize = function normalize2(path63) {
51670
+ var normalizedUrl = normalizeUrl(path63);
51671
51671
  if (normalizedUrl)
51672
51672
  return normalizedUrl;
51673
- var firstTwoCharacters = path62.substring(0, 2);
51673
+ var firstTwoCharacters = path63.substring(0, 2);
51674
51674
  var uncPrefix = "";
51675
51675
  if (firstTwoCharacters === "\\\\") {
51676
51676
  uncPrefix = firstTwoCharacters;
51677
- path62 = path62.substring(2);
51677
+ path63 = path63.substring(2);
51678
51678
  }
51679
- path62 = path62.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
51680
- var parts = path62.split("/"), absolute = isAbsolute(path62), prefix = "";
51679
+ path63 = path63.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
51680
+ var parts = path63.split("/"), absolute = isAbsolute(path63), prefix = "";
51681
51681
  if (absolute)
51682
51682
  prefix = parts.shift() + "/";
51683
51683
  for (var i = 0; i < parts.length; ) {
@@ -51696,7 +51696,7 @@ var require_path = __commonJS({
51696
51696
  return uncPrefix + prefix + parts.join("/");
51697
51697
  }
51698
51698
  );
51699
- path61.resolve = function resolve(originPath, includePath, alreadyNormalized) {
51699
+ path62.resolve = function resolve(originPath, includePath, alreadyNormalized) {
51700
51700
  var resolvedUrl = resolveUrl(originPath, includePath);
51701
51701
  if (resolvedUrl)
51702
51702
  return resolvedUrl;
@@ -51869,18 +51869,18 @@ var require_namespace = __commonJS({
51869
51869
  object3.onRemove(this);
51870
51870
  return clearCache(this);
51871
51871
  };
51872
- Namespace.prototype.define = function define2(path61, json2) {
51873
- if (util2.isString(path61))
51874
- path61 = path61.split(".");
51875
- else if (!Array.isArray(path61))
51872
+ Namespace.prototype.define = function define2(path62, json2) {
51873
+ if (util2.isString(path62))
51874
+ path62 = path62.split(".");
51875
+ else if (!Array.isArray(path62))
51876
51876
  throw TypeError("illegal path");
51877
- if (path61 && path61.length && path61[0] === "")
51877
+ if (path62 && path62.length && path62[0] === "")
51878
51878
  throw Error("path must be relative");
51879
- if (path61.length > util2.recursionLimit)
51879
+ if (path62.length > util2.recursionLimit)
51880
51880
  throw Error("max depth exceeded");
51881
51881
  var ptr = this;
51882
- while (path61.length > 0) {
51883
- var part = path61.shift();
51882
+ while (path62.length > 0) {
51883
+ var part = path62.shift();
51884
51884
  if (ptr.nested && ptr.nested[part]) {
51885
51885
  ptr = ptr.nested[part];
51886
51886
  if (!(ptr instanceof Namespace))
@@ -51916,22 +51916,22 @@ var require_namespace = __commonJS({
51916
51916
  });
51917
51917
  return this;
51918
51918
  };
51919
- Namespace.prototype.lookup = function lookup(path61, filterTypes, parentAlreadyChecked) {
51919
+ Namespace.prototype.lookup = function lookup(path62, filterTypes, parentAlreadyChecked) {
51920
51920
  if (typeof filterTypes === "boolean") {
51921
51921
  parentAlreadyChecked = filterTypes;
51922
51922
  filterTypes = void 0;
51923
51923
  } else if (filterTypes && !Array.isArray(filterTypes))
51924
51924
  filterTypes = [filterTypes];
51925
- if (util2.isString(path61) && path61.length) {
51926
- if (path61 === ".")
51925
+ if (util2.isString(path62) && path62.length) {
51926
+ if (path62 === ".")
51927
51927
  return this.root;
51928
- path61 = path61.split(".");
51929
- } else if (!path61.length)
51928
+ path62 = path62.split(".");
51929
+ } else if (!path62.length)
51930
51930
  return this;
51931
- var flatPath = path61.join(".");
51932
- if (path61[0] === "")
51933
- return this.root.lookup(path61.slice(1), filterTypes);
51934
- var found = this._lookupImpl(path61, flatPath);
51931
+ var flatPath = path62.join(".");
51932
+ if (path62[0] === "")
51933
+ return this.root.lookup(path62.slice(1), filterTypes);
51934
+ var found = this._lookupImpl(path62, flatPath);
51935
51935
  if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
51936
51936
  return found;
51937
51937
  }
@@ -51943,7 +51943,7 @@ var require_namespace = __commonJS({
51943
51943
  return null;
51944
51944
  var current = this;
51945
51945
  while (current.parent) {
51946
- found = current.parent._lookupImpl(path61, flatPath);
51946
+ found = current.parent._lookupImpl(path62, flatPath);
51947
51947
  if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
51948
51948
  return found;
51949
51949
  }
@@ -51951,22 +51951,22 @@ var require_namespace = __commonJS({
51951
51951
  }
51952
51952
  return null;
51953
51953
  };
51954
- Namespace.prototype._lookupImpl = function lookup(path61, flatPath) {
51954
+ Namespace.prototype._lookupImpl = function lookup(path62, flatPath) {
51955
51955
  if (Object.prototype.hasOwnProperty.call(this._lookupCache, flatPath)) {
51956
51956
  return this._lookupCache[flatPath];
51957
51957
  }
51958
- var found = this.get(path61[0]);
51958
+ var found = this.get(path62[0]);
51959
51959
  var exact = null;
51960
51960
  if (found) {
51961
- if (path61.length === 1) {
51961
+ if (path62.length === 1) {
51962
51962
  exact = found;
51963
51963
  } else if (found instanceof Namespace) {
51964
- path61 = path61.slice(1);
51965
- exact = found._lookupImpl(path61, path61.join("."));
51964
+ path62 = path62.slice(1);
51965
+ exact = found._lookupImpl(path62, path62.join("."));
51966
51966
  }
51967
51967
  } else {
51968
51968
  for (var i = 0; i < this.nestedArray.length; ++i)
51969
- if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path61, flatPath))) {
51969
+ if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path62, flatPath))) {
51970
51970
  exact = found;
51971
51971
  break;
51972
51972
  }
@@ -51974,28 +51974,28 @@ var require_namespace = __commonJS({
51974
51974
  this._lookupCache[flatPath] = exact;
51975
51975
  return exact;
51976
51976
  };
51977
- Namespace.prototype.lookupType = function lookupType(path61) {
51978
- var found = this.lookup(path61, [Type]);
51977
+ Namespace.prototype.lookupType = function lookupType(path62) {
51978
+ var found = this.lookup(path62, [Type]);
51979
51979
  if (!found)
51980
- throw Error("no such type: " + path61);
51980
+ throw Error("no such type: " + path62);
51981
51981
  return found;
51982
51982
  };
51983
- Namespace.prototype.lookupEnum = function lookupEnum(path61) {
51984
- var found = this.lookup(path61, [Enum]);
51983
+ Namespace.prototype.lookupEnum = function lookupEnum(path62) {
51984
+ var found = this.lookup(path62, [Enum]);
51985
51985
  if (!found)
51986
- throw Error("no such Enum '" + path61 + "' in " + this);
51986
+ throw Error("no such Enum '" + path62 + "' in " + this);
51987
51987
  return found;
51988
51988
  };
51989
- Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path61) {
51990
- var found = this.lookup(path61, [Type, Enum]);
51989
+ Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path62) {
51990
+ var found = this.lookup(path62, [Type, Enum]);
51991
51991
  if (!found)
51992
- throw Error("no such Type or Enum '" + path61 + "' in " + this);
51992
+ throw Error("no such Type or Enum '" + path62 + "' in " + this);
51993
51993
  return found;
51994
51994
  };
51995
- Namespace.prototype.lookupService = function lookupService(path61) {
51996
- var found = this.lookup(path61, [Service]);
51995
+ Namespace.prototype.lookupService = function lookupService(path62) {
51996
+ var found = this.lookup(path62, [Service]);
51997
51997
  if (!found)
51998
- throw Error("no such Service '" + path61 + "' in " + this);
51998
+ throw Error("no such Service '" + path62 + "' in " + this);
51999
51999
  return found;
52000
52000
  };
52001
52001
  Namespace._configure = function(Type_, Service_, Enum_) {
@@ -53612,13 +53612,13 @@ var require_util3 = __commonJS({
53612
53612
  Object.defineProperty(object3, "$type", { value: enm, enumerable: false });
53613
53613
  return enm;
53614
53614
  };
53615
- util2.setProperty = function setProperty(dst, path61, value, ifNotSet) {
53616
- function setProp(dst2, path62, value2) {
53617
- var part = path62.shift();
53615
+ util2.setProperty = function setProperty(dst, path62, value, ifNotSet) {
53616
+ function setProp(dst2, path63, value2) {
53617
+ var part = path63.shift();
53618
53618
  if (util2.isUnsafeProperty(part))
53619
53619
  return dst2;
53620
- if (path62.length > 0) {
53621
- dst2[part] = setProp(dst2[part] || {}, path62, value2);
53620
+ if (path63.length > 0) {
53621
+ dst2[part] = setProp(dst2[part] || {}, path63, value2);
53622
53622
  } else {
53623
53623
  var prevValue = dst2[part];
53624
53624
  if (prevValue && ifNotSet)
@@ -53631,12 +53631,12 @@ var require_util3 = __commonJS({
53631
53631
  }
53632
53632
  if (typeof dst !== "object")
53633
53633
  throw TypeError("dst must be an object");
53634
- if (!path61)
53634
+ if (!path62)
53635
53635
  throw TypeError("path must be specified");
53636
- path61 = path61.split(".");
53637
- if (path61.length > util2.recursionLimit)
53636
+ path62 = path62.split(".");
53637
+ if (path62.length > util2.recursionLimit)
53638
53638
  throw Error("max depth exceeded");
53639
- return setProp(dst, path61, value);
53639
+ return setProp(dst, path62, value);
53640
53640
  };
53641
53641
  Object.defineProperty(util2, "decorateRoot", {
53642
53642
  get: function() {
@@ -54216,12 +54216,12 @@ var require_object = __commonJS({
54216
54216
  */
54217
54217
  fullName: {
54218
54218
  get: function() {
54219
- var path61 = [this.name], ptr = this.parent;
54219
+ var path62 = [this.name], ptr = this.parent;
54220
54220
  while (ptr) {
54221
- path61.unshift(ptr.name);
54221
+ path62.unshift(ptr.name);
54222
54222
  ptr = ptr.parent;
54223
54223
  }
54224
- return path61.join(".");
54224
+ return path62.join(".");
54225
54225
  }
54226
54226
  }
54227
54227
  });
@@ -56303,17 +56303,107 @@ var init_network = __esm({
56303
56303
  }
56304
56304
  });
56305
56305
 
56306
- // src/maker/preview/runtime.ts
56306
+ // src/maker/preview/downloadCache.ts
56307
56307
  import fs33 from "node:fs";
56308
56308
  import path34 from "node:path";
56309
56309
  import os5 from "node:os";
56310
+ import { createHash as createHash4 } from "node:crypto";
56311
+ function requireDirectory(directory) {
56312
+ const stat = fs33.lstatSync(directory);
56313
+ if (!stat.isDirectory() || stat.isSymbolicLink() || fs33.realpathSync(directory) !== directory)
56314
+ throw new Error("Preview download cache ownership changed; refusing linked directories.");
56315
+ }
56316
+ function openPreviewDownloadCache(storage, gameUrl, platform = process.platform) {
56317
+ fs33.mkdirSync(storage, { recursive: true, mode: 448 });
56318
+ if (fs33.lstatSync(storage).isSymbolicLink())
56319
+ throw new Error("Preview download storage must not be a symbolic link.");
56320
+ const owner = fs33.realpathSync(storage);
56321
+ const root2 = platform === "win32" ? path34.join(
56322
+ fs33.realpathSync(os5.tmpdir()),
56323
+ "maker-cache-" + createHash4("sha256").update(owner).digest("hex").slice(0, 16)
56324
+ ) : path34.join(owner, "runtime-cache");
56325
+ let created = false;
56326
+ try {
56327
+ fs33.mkdirSync(root2, { mode: 448 });
56328
+ created = true;
56329
+ } catch (error2) {
56330
+ if (error2.code !== "EEXIST") throw error2;
56331
+ }
56332
+ requireDirectory(root2);
56333
+ const requireOwner = () => {
56334
+ requireDirectory(root2);
56335
+ if (platform !== "win32") return;
56336
+ const filename2 = path34.join(root2, WINDOWS_CACHE_OWNER);
56337
+ const stat = fs33.lstatSync(filename2);
56338
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 4096)
56339
+ throw new Error("Invalid preview download cache owner.");
56340
+ const saved = JSON.parse(fs33.readFileSync(filename2, "utf8"));
56341
+ if (saved.storage !== owner)
56342
+ throw new Error("Preview download cache belongs to another project; refusing reuse.");
56343
+ };
56344
+ if (platform === "win32" && created) {
56345
+ const filename2 = path34.join(root2, WINDOWS_CACHE_OWNER);
56346
+ let markerCreated = false;
56347
+ try {
56348
+ const descriptor = fs33.openSync(filename2, "wx", 384);
56349
+ markerCreated = true;
56350
+ try {
56351
+ fs33.writeFileSync(descriptor, JSON.stringify({ storage: owner }));
56352
+ } finally {
56353
+ fs33.closeSync(descriptor);
56354
+ }
56355
+ } catch (error2) {
56356
+ try {
56357
+ requireDirectory(root2);
56358
+ if (markerCreated) fs33.unlinkSync(filename2);
56359
+ fs33.rmdirSync(root2);
56360
+ } catch {
56361
+ }
56362
+ throw error2;
56363
+ }
56364
+ }
56365
+ requireOwner();
56366
+ const url2 = new URL(gameUrl);
56367
+ if (url2.protocol !== "http:" || url2.hostname !== "127.0.0.1" || !url2.port || url2.username || url2.password || url2.search || url2.hash || !/^\/[a-z0-9_-]+\/$/i.test(url2.pathname))
56368
+ throw new Error("Preview download cache requires the protected loopback project URL.");
56369
+ const hostDirectory = path34.join(root2, url2.host.replace(":", "_"));
56370
+ const projectDirectory = path34.join(hostDirectory, url2.pathname.slice(1, -1));
56371
+ const requireProjectDirectories = () => {
56372
+ requireOwner();
56373
+ for (const directory of [hostDirectory, projectDirectory]) {
56374
+ if (fs33.existsSync(directory) || fs33.lstatSync(directory, { throwIfNoEntry: false }))
56375
+ requireDirectory(directory);
56376
+ }
56377
+ };
56378
+ requireProjectDirectories();
56379
+ return {
56380
+ root: root2,
56381
+ clearProject() {
56382
+ requireProjectDirectories();
56383
+ fs33.rmSync(projectDirectory, { recursive: true, force: true });
56384
+ if (fs33.existsSync(hostDirectory) && !fs33.readdirSync(hostDirectory).length)
56385
+ fs33.rmdirSync(hostDirectory);
56386
+ }
56387
+ };
56388
+ }
56389
+ var WINDOWS_CACHE_OWNER;
56390
+ var init_downloadCache = __esm({
56391
+ "src/maker/preview/downloadCache.ts"() {
56392
+ "use strict";
56393
+ WINDOWS_CACHE_OWNER = ".maker-preview-owner.json";
56394
+ }
56395
+ });
56396
+
56397
+ // src/maker/preview/runtime.ts
56398
+ import fs34 from "node:fs";
56399
+ import path35 from "node:path";
56310
56400
  import { spawn as spawn7 } from "node:child_process";
56311
56401
  import { StringDecoder as StringDecoder2 } from "node:string_decoder";
56312
56402
  async function probeRuntime(executable, signal) {
56313
56403
  if (signal == null ? void 0 : signal.aborted) throw new Error("CANCELLED");
56314
- if (!path34.isAbsolute(executable) || !fs33.statSync(executable).isFile())
56404
+ if (!path35.isAbsolute(executable) || !fs34.statSync(executable).isFile())
56315
56405
  throw new Error("Runtime must be an absolute executable file.");
56316
- fs33.accessSync(executable, process.platform === "win32" ? fs33.constants.R_OK : fs33.constants.X_OK);
56406
+ fs34.accessSync(executable, process.platform === "win32" ? fs34.constants.R_OK : fs34.constants.X_OK);
56317
56407
  return {
56318
56408
  protocol_version: 0,
56319
56409
  runtime_version: "unknown",
@@ -56347,6 +56437,7 @@ var init_runtime = __esm({
56347
56437
  init_luaLog();
56348
56438
  init_backgroundProcess();
56349
56439
  init_network();
56440
+ init_downloadCache();
56350
56441
  init_windowSettings();
56351
56442
  PREVIEW_TIMEOUT_MS = 3e4;
56352
56443
  RUNTIME_STARTUP_SETTLE_MS = 3e3;
@@ -56409,14 +56500,8 @@ var init_runtime = __esm({
56409
56500
  this.assets = await startPreviewAssetServer(source, this.abort.signal);
56410
56501
  this.mode = "loopback_manifest";
56411
56502
  try {
56412
- cacheRoot = process.platform === "win32" ? this.temporaryCache = fs33.realpathSync(
56413
- fs33.mkdtempSync(path34.join(os5.tmpdir(), "maker-cache-"))
56414
- ) : path34.join(_storage, "runtime-cache");
56415
- fs33.mkdirSync(cacheRoot, { recursive: true, mode: 448 });
56416
- this.assetCache = path34.join(
56417
- fs33.realpathSync(cacheRoot),
56418
- this.assets.url.slice("http://".length).replace(":", "_")
56419
- );
56503
+ this.downloadCache = openPreviewDownloadCache(_storage, this.assets.url);
56504
+ cacheRoot = this.downloadCache.root;
56420
56505
  } catch (error2) {
56421
56506
  await this.assets.close();
56422
56507
  this.assets = void 0;
@@ -56550,29 +56635,12 @@ var init_runtime = __esm({
56550
56635
  if (this.errors.length > 100) this.errors.shift();
56551
56636
  }
56552
56637
  clearAssetCache() {
56553
- if (this.temporaryCache) {
56554
- try {
56555
- if (fs33.existsSync(this.temporaryCache)) {
56556
- if (fs33.lstatSync(this.temporaryCache).isSymbolicLink() || fs33.realpathSync(this.temporaryCache) !== this.temporaryCache)
56557
- throw new Error("Preview cache ownership changed.");
56558
- fs33.rmSync(this.temporaryCache, { recursive: true, force: true });
56559
- }
56560
- this.temporaryCache = void 0;
56561
- this.assetCache = void 0;
56562
- } catch {
56563
- this.recordError("Could not remove this round of local preview download cache.");
56564
- }
56565
- return;
56566
- }
56567
- if (!this.assetCache) return;
56638
+ if (!this.downloadCache) return;
56568
56639
  try {
56569
- const parent = path34.dirname(this.assetCache);
56570
- if (fs33.existsSync(parent) && fs33.realpathSync(parent) === parent) {
56571
- fs33.rmSync(this.assetCache, { recursive: true, force: true });
56572
- if (!fs33.readdirSync(parent).length) fs33.rmdirSync(parent);
56573
- }
56640
+ this.downloadCache.clearProject();
56641
+ this.downloadCache = void 0;
56574
56642
  } catch {
56575
- this.recordError("Could not remove this round of local preview download cache.");
56643
+ this.recordError("Could not remove this round of local preview project download cache.");
56576
56644
  }
56577
56645
  }
56578
56646
  appendLog(line) {
@@ -56649,8 +56717,8 @@ var init_runtime = __esm({
56649
56717
  });
56650
56718
 
56651
56719
  // src/maker/preview/runtimeResources.ts
56652
- import fs34 from "node:fs";
56653
- import path35 from "node:path";
56720
+ import fs35 from "node:fs";
56721
+ import path36 from "node:path";
56654
56722
  function defaultFontCandidates(platform) {
56655
56723
  if (platform === "darwin") {
56656
56724
  return [
@@ -56661,44 +56729,44 @@ function defaultFontCandidates(platform) {
56661
56729
  if (platform === "win32") {
56662
56730
  const windows = process.env.WINDIR || process.env.SystemRoot || "C:\\Windows";
56663
56731
  return [
56664
- path35.join(windows, "Fonts", "Deng.ttf"),
56665
- path35.join(windows, "Fonts", "Dengb.ttf"),
56666
- path35.join(windows, "Fonts", "msyh.ttc")
56732
+ path36.join(windows, "Fonts", "Deng.ttf"),
56733
+ path36.join(windows, "Fonts", "Dengb.ttf"),
56734
+ path36.join(windows, "Fonts", "msyh.ttc")
56667
56735
  ];
56668
56736
  }
56669
56737
  return [];
56670
56738
  }
56671
56739
  function existingFile(filename2) {
56672
56740
  try {
56673
- return fs34.statSync(filename2).isFile();
56741
+ return fs35.statSync(filename2).isFile();
56674
56742
  } catch {
56675
56743
  return false;
56676
56744
  }
56677
56745
  }
56678
56746
  function ensurePreviewRuntimeResources(executable, options3 = {}) {
56679
- const runtimeRoot = path35.dirname(fs34.realpathSync(executable));
56680
- const fonts = path35.join(runtimeRoot, "Res", "Fonts");
56681
- const legacyFonts = path35.join(runtimeRoot, "Data", "Fonts");
56747
+ const runtimeRoot = path36.dirname(fs35.realpathSync(executable));
56748
+ const fonts = path36.join(runtimeRoot, "Res", "Fonts");
56749
+ const legacyFonts = path36.join(runtimeRoot, "Data", "Fonts");
56682
56750
  for (const directory of [
56683
- path35.join(runtimeRoot, "Data", "LuaScripts"),
56751
+ path36.join(runtimeRoot, "Data", "LuaScripts"),
56684
56752
  legacyFonts,
56685
56753
  fonts,
56686
- path35.join(runtimeRoot, "CoreData")
56754
+ path36.join(runtimeRoot, "CoreData")
56687
56755
  ]) {
56688
- fs34.mkdirSync(directory, { recursive: true });
56756
+ fs35.mkdirSync(directory, { recursive: true });
56689
56757
  }
56690
- const target = path35.join(fonts, FALLBACK_FONT);
56691
- if (fs34.existsSync(target)) return { fallbackFont: "existing", warnings: [] };
56758
+ const target = path36.join(fonts, FALLBACK_FONT);
56759
+ if (fs35.existsSync(target)) return { fallbackFont: "existing", warnings: [] };
56692
56760
  const platform = options3.platform || process.platform;
56693
56761
  const candidates = [
56694
- path35.join(legacyFonts, FALLBACK_FONT),
56762
+ path36.join(legacyFonts, FALLBACK_FONT),
56695
56763
  ...options3.fontCandidates || defaultFontCandidates(platform)
56696
56764
  ];
56697
56765
  const copyErrors = [];
56698
56766
  for (const candidate of candidates) {
56699
56767
  if (!existingFile(candidate)) continue;
56700
56768
  try {
56701
- fs34.copyFileSync(candidate, target, fs34.constants.COPYFILE_EXCL);
56769
+ fs35.copyFileSync(candidate, target, fs35.constants.COPYFILE_EXCL);
56702
56770
  return { fallbackFont: "copied", fallbackFontSource: candidate, warnings: [] };
56703
56771
  } catch (error2) {
56704
56772
  if (error2.code === "EEXIST") {
@@ -56931,10 +56999,10 @@ finally:
56931
56999
  });
56932
57000
 
56933
57001
  // src/maker/system/recoveryMutex.ts
56934
- import { createHash as createHash4 } from "node:crypto";
57002
+ import { createHash as createHash5 } from "node:crypto";
56935
57003
  import { createServer } from "node:net";
56936
57004
  function recoveryMutexPort(filename2, offset = 0) {
56937
- const preferred = EPHEMERAL_PORT_BASE + createHash4("sha256").update(filename2).digest().readUInt16BE(0) % EPHEMERAL_PORT_COUNT;
57005
+ const preferred = EPHEMERAL_PORT_BASE + createHash5("sha256").update(filename2).digest().readUInt16BE(0) % EPHEMERAL_PORT_COUNT;
56938
57006
  const shift = (offset % EPHEMERAL_PORT_COUNT + EPHEMERAL_PORT_COUNT) % EPHEMERAL_PORT_COUNT;
56939
57007
  return EPHEMERAL_PORT_BASE + (preferred - EPHEMERAL_PORT_BASE + shift) % EPHEMERAL_PORT_COUNT;
56940
57008
  }
@@ -56978,14 +57046,14 @@ var init_recoveryMutex = __esm({
56978
57046
  });
56979
57047
 
56980
57048
  // src/maker/preview/installation.ts
56981
- import fs35 from "node:fs";
56982
- import path36 from "node:path";
56983
- import { createHash as createHash5, randomUUID as randomUUID5 } from "node:crypto";
57049
+ import fs36 from "node:fs";
57050
+ import path37 from "node:path";
57051
+ import { createHash as createHash6, randomUUID as randomUUID5 } from "node:crypto";
56984
57052
  function readInstallation(filename2) {
56985
- if (!fs35.existsSync(filename2)) return void 0;
57053
+ if (!fs36.existsSync(filename2)) return void 0;
56986
57054
  try {
56987
- const value = JSON.parse(fs35.readFileSync(filename2, "utf8"));
56988
- if (value.install_state !== "ready" || !value.executable || !path36.isAbsolute(value.executable) || !fs35.statSync(value.executable).isFile()) {
57055
+ const value = JSON.parse(fs36.readFileSync(filename2, "utf8"));
57056
+ if (value.install_state !== "ready" || !value.executable || !path37.isAbsolute(value.executable) || !fs36.statSync(value.executable).isFile()) {
56989
57057
  return void 0;
56990
57058
  }
56991
57059
  return value;
@@ -56994,27 +57062,27 @@ function readInstallation(filename2) {
56994
57062
  }
56995
57063
  }
56996
57064
  function isInside(directory, filename2) {
56997
- const relative = path36.relative(directory, filename2);
56998
- return relative !== "" && !relative.startsWith(".." + path36.sep) && !path36.isAbsolute(relative);
57065
+ const relative = path37.relative(directory, filename2);
57066
+ return relative !== "" && !relative.startsWith(".." + path37.sep) && !path37.isAbsolute(relative);
56999
57067
  }
57000
57068
  function legacyPreviewInstallation(project) {
57001
57069
  var _a3;
57002
- const root2 = path36.dirname(previewDirectory(project));
57003
- if (!fs35.existsSync(root2)) return void 0;
57004
- const entries = fs35.readdirSync(root2, { withFileTypes: true }).filter((entry) => entry.isDirectory() && /^[a-f0-9]{64}$/.test(entry.name));
57070
+ const root2 = path37.dirname(previewDirectory(project));
57071
+ if (!fs36.existsSync(root2)) return void 0;
57072
+ const entries = fs36.readdirSync(root2, { withFileTypes: true }).filter((entry) => entry.isDirectory() && /^[a-f0-9]{64}$/.test(entry.name));
57005
57073
  const candidates = [];
57006
57074
  for (const entry of entries) {
57007
- const directory = path36.join(root2, entry.name);
57008
- const filename2 = path36.join(directory, "installation.json");
57075
+ const directory = path37.join(root2, entry.name);
57076
+ const filename2 = path37.join(directory, "installation.json");
57009
57077
  const installation = readInstallation(filename2);
57010
57078
  if (!(installation == null ? void 0 : installation.executable)) continue;
57011
57079
  try {
57012
- const executable = fs35.realpathSync(installation.executable);
57013
- const managedDirectory = fs35.realpathSync(directory);
57080
+ const executable = fs36.realpathSync(installation.executable);
57081
+ const managedDirectory = fs36.realpathSync(directory);
57014
57082
  if (!isInside(managedDirectory, executable)) continue;
57015
57083
  candidates.push({
57016
57084
  installation: { ...installation, executable },
57017
- modified: Date.parse(installation.installed_at || "") || fs35.statSync(filename2).mtimeMs
57085
+ modified: Date.parse(installation.installed_at || "") || fs36.statSync(filename2).mtimeMs
57018
57086
  });
57019
57087
  } catch {
57020
57088
  }
@@ -57023,7 +57091,7 @@ function legacyPreviewInstallation(project) {
57023
57091
  return (_a3 = candidates[0]) == null ? void 0 : _a3.installation;
57024
57092
  }
57025
57093
  function previewInstallation(project) {
57026
- const filename2 = path36.join(runtimeDirectory(), "installation.json");
57094
+ const filename2 = path37.join(runtimeDirectory(), "installation.json");
57027
57095
  const current = readInstallation(filename2);
57028
57096
  if (current) return current;
57029
57097
  const legacy = legacyPreviewInstallation(project);
@@ -57042,31 +57110,31 @@ function previewInstallation(project) {
57042
57110
  }
57043
57111
  }
57044
57112
  async function withFileLock(directory, name, busyMessage, action) {
57045
- fs35.mkdirSync(directory, { recursive: true, mode: 448 });
57046
- const filename2 = path36.join(directory, name);
57113
+ fs36.mkdirSync(directory, { recursive: true, mode: 448 });
57114
+ const filename2 = path37.join(directory, name);
57047
57115
  let descriptor;
57048
57116
  try {
57049
- descriptor = fs35.openSync(filename2, "wx", 384);
57117
+ descriptor = fs36.openSync(filename2, "wx", 384);
57050
57118
  } catch {
57051
57119
  throw new Error(
57052
57120
  busyMessage + " If an interrupted command left a lock, verify it exited before removing " + filename2
57053
57121
  );
57054
57122
  }
57055
57123
  try {
57056
- fs35.writeFileSync(
57124
+ fs36.writeFileSync(
57057
57125
  descriptor,
57058
57126
  JSON.stringify({ pid: process.pid, created_at: (/* @__PURE__ */ new Date()).toISOString() })
57059
57127
  );
57060
57128
  return await action();
57061
57129
  } finally {
57062
- fs35.closeSync(descriptor);
57063
- fs35.unlinkSync(filename2);
57130
+ fs36.closeSync(descriptor);
57131
+ fs36.unlinkSync(filename2);
57064
57132
  }
57065
57133
  }
57066
57134
  async function withPreviewLock(project, action) {
57067
57135
  const directory = previewDirectory(project);
57068
- fs35.mkdirSync(directory, { recursive: true, mode: 448 });
57069
- const filename2 = path36.join(fs35.realpathSync(directory), "operation.lock");
57136
+ fs36.mkdirSync(directory, { recursive: true, mode: 448 });
57137
+ const filename2 = path37.join(fs36.realpathSync(directory), "operation.lock");
57070
57138
  const busy = (port) => new Error(
57071
57139
  "Another preview operation is in progress, or preferred loopback port " + port + " is in use. Please retry after it finishes."
57072
57140
  );
@@ -57078,8 +57146,8 @@ async function withPreviewLock(project, action) {
57078
57146
  });
57079
57147
  let owned = false;
57080
57148
  try {
57081
- if (fs35.existsSync(filename2)) {
57082
- const previous = fs35.readFileSync(filename2, "utf8");
57149
+ if (fs36.existsSync(filename2)) {
57150
+ const previous = fs36.readFileSync(filename2, "utf8");
57083
57151
  let pid;
57084
57152
  try {
57085
57153
  pid = JSON.parse(previous).pid;
@@ -57089,9 +57157,9 @@ async function withPreviewLock(project, action) {
57089
57157
  throw new Error(
57090
57158
  "Preview operation ownership is still active or unverified. Confirm the previous command has exited before removing only: " + filename2
57091
57159
  );
57092
- fs35.unlinkSync(filename2);
57160
+ fs36.unlinkSync(filename2);
57093
57161
  }
57094
- fs35.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
57162
+ fs36.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
57095
57163
  owned = true;
57096
57164
  return await action();
57097
57165
  } finally {
@@ -57104,7 +57172,7 @@ async function withPreviewLock(project, action) {
57104
57172
  }
57105
57173
  function removeOwnedPreviewLock(filename2, identity) {
57106
57174
  try {
57107
- if (fs35.readFileSync(filename2, "utf8") === identity) fs35.unlinkSync(filename2);
57175
+ if (fs36.readFileSync(filename2, "utf8") === identity) fs36.unlinkSync(filename2);
57108
57176
  } catch (error2) {
57109
57177
  if (error2.code !== "ENOENT") throw error2;
57110
57178
  }
@@ -57118,17 +57186,17 @@ async function withRuntimeInstallLock(action) {
57118
57186
  );
57119
57187
  }
57120
57188
  function activePreviewRuntimeDirectories(project) {
57121
- const root2 = path36.dirname(previewDirectory(project));
57122
- if (!fs35.existsSync(root2)) return [];
57189
+ const root2 = path37.dirname(previewDirectory(project));
57190
+ if (!fs36.existsSync(root2)) return [];
57123
57191
  const protectedDirectories = [];
57124
- for (const entry of fs35.readdirSync(root2, { withFileTypes: true })) {
57192
+ for (const entry of fs36.readdirSync(root2, { withFileTypes: true })) {
57125
57193
  if (!entry.isDirectory() || !/^[a-f0-9]{64}$/.test(entry.name)) continue;
57126
- const filename2 = path36.join(root2, entry.name, "session.json");
57127
- if (!fs35.existsSync(filename2)) continue;
57194
+ const filename2 = path37.join(root2, entry.name, "session.json");
57195
+ if (!fs36.existsSync(filename2)) continue;
57128
57196
  try {
57129
- const record3 = JSON.parse(fs35.readFileSync(filename2, "utf8"));
57130
- if (record3.state !== "stopped" && record3.executable && path36.isAbsolute(record3.executable)) {
57131
- protectedDirectories.push(path36.dirname(record3.executable));
57197
+ const record3 = JSON.parse(fs36.readFileSync(filename2, "utf8"));
57198
+ if (record3.state !== "stopped" && record3.executable && path37.isAbsolute(record3.executable)) {
57199
+ protectedDirectories.push(path37.dirname(record3.executable));
57132
57200
  }
57133
57201
  } catch {
57134
57202
  }
@@ -57154,12 +57222,12 @@ async function installPreviewRuntime(project, signal, update = false) {
57154
57222
  }
57155
57223
  }
57156
57224
  const directory = runtimeDirectory();
57157
- const unresolved = fs35.existsSync(directory) && fs35.readdirSync(directory, { withFileTypes: true }).find(
57158
- (entry) => entry.isDirectory() && entry.name.startsWith("runtime-") && fs35.existsSync(path36.join(directory, entry.name, UNVERIFIED_CLEANUP_MARKER))
57225
+ const unresolved = fs36.existsSync(directory) && fs36.readdirSync(directory, { withFileTypes: true }).find(
57226
+ (entry) => entry.isDirectory() && entry.name.startsWith("runtime-") && fs36.existsSync(path37.join(directory, entry.name, UNVERIFIED_CLEANUP_MARKER))
57159
57227
  );
57160
57228
  if (unresolved) {
57161
57229
  throw new Error(
57162
- "The previous installer cleanup is unverified. Confirm its processes have exited before removing only the marked directory: " + path36.join(directory, unresolved.name)
57230
+ "The previous installer cleanup is unverified. Confirm its processes have exited before removing only the marked directory: " + path37.join(directory, unresolved.name)
57163
57231
  );
57164
57232
  }
57165
57233
  const python = await checkMakerPythonEnvironmentAsync(signal);
@@ -57168,10 +57236,10 @@ async function installPreviewRuntime(project, signal, update = false) {
57168
57236
  "Runtime installation needs Python and curl. Run taptap-maker python setup with host approval, then retry."
57169
57237
  );
57170
57238
  }
57171
- const staging = path36.join(directory, "runtime-" + randomUUID5());
57172
- fs35.mkdirSync(staging, { recursive: true, mode: 448 });
57173
- const installer = path36.join(staging, "install-urhox-runtime.py");
57174
- fs35.writeFileSync(installer, PREVIEW_INSTALLER_SOURCE, { mode: 384 });
57239
+ const staging = path37.join(directory, "runtime-" + randomUUID5());
57240
+ fs36.mkdirSync(staging, { recursive: true, mode: 448 });
57241
+ const installer = path37.join(staging, "install-urhox-runtime.py");
57242
+ fs36.writeFileSync(installer, PREVIEW_INSTALLER_SOURCE, { mode: 384 });
57175
57243
  const platform = process.platform === "win32" ? "win32" : "darwin";
57176
57244
  try {
57177
57245
  await runPreviewInstaller(
@@ -57184,14 +57252,14 @@ async function installPreviewRuntime(project, signal, update = false) {
57184
57252
  signal
57185
57253
  }
57186
57254
  );
57187
- const executable = fs35.realpathSync(
57188
- path36.join(staging, platform === "win32" ? "UrhoXRuntime.exe" : "UrhoXRuntime")
57255
+ const executable = fs36.realpathSync(
57256
+ path37.join(staging, platform === "win32" ? "UrhoXRuntime.exe" : "UrhoXRuntime")
57189
57257
  );
57190
57258
  const resources2 = ensurePreviewRuntimeResources(executable);
57191
57259
  const runtime = await probeRuntime(executable, signal);
57192
- const archive = path36.join(staging, "UrhoXRuntime.zip");
57193
- const hash2 = createHash5("sha256");
57194
- for await (const chunk of fs35.createReadStream(archive)) hash2.update(chunk);
57260
+ const archive = path37.join(staging, "UrhoXRuntime.zip");
57261
+ const hash2 = createHash6("sha256");
57262
+ for await (const chunk of fs36.createReadStream(archive)) hash2.update(chunk);
57195
57263
  const installation = {
57196
57264
  install_state: "ready",
57197
57265
  executable,
@@ -57201,19 +57269,19 @@ async function installPreviewRuntime(project, signal, update = false) {
57201
57269
  warnings: resources2.warnings
57202
57270
  };
57203
57271
  const protectedDirectories = [staging, ...activePreviewRuntimeDirectories(project)];
57204
- if (previous.executable) protectedDirectories.push(path36.dirname(previous.executable));
57272
+ if (previous.executable) protectedDirectories.push(path37.dirname(previous.executable));
57205
57273
  installation.warnings = [
57206
57274
  ...installation.warnings || [],
57207
57275
  ...trimPreviewCache(directory, "runtime-", 2, protectedDirectories)
57208
57276
  ];
57209
- writePrivateJson(path36.join(directory, "installation.json"), installation);
57277
+ writePrivateJson(path37.join(directory, "installation.json"), installation);
57210
57278
  return installation;
57211
57279
  } catch (error2) {
57212
57280
  const cleanupUnverified = error2.cleanupVerified === false;
57213
- if (!cleanupUnverified) fs35.rmSync(staging, { recursive: true, force: true });
57281
+ if (!cleanupUnverified) fs36.rmSync(staging, { recursive: true, force: true });
57214
57282
  else
57215
- fs35.writeFileSync(
57216
- path36.join(staging, UNVERIFIED_CLEANUP_MARKER),
57283
+ fs36.writeFileSync(
57284
+ path37.join(staging, UNVERIFIED_CLEANUP_MARKER),
57217
57285
  "Installer process ownership must be verified before cleanup.\n",
57218
57286
  { mode: 384 }
57219
57287
  );
@@ -57238,8 +57306,8 @@ var init_installation = __esm({
57238
57306
  });
57239
57307
 
57240
57308
  // src/maker/preview/session.ts
57241
- import fs36 from "node:fs";
57242
- import path37 from "node:path";
57309
+ import fs37 from "node:fs";
57310
+ import path38 from "node:path";
57243
57311
  import http2 from "node:http";
57244
57312
  import os6 from "node:os";
57245
57313
  import { timingSafeEqual } from "node:crypto";
@@ -57353,7 +57421,7 @@ async function runPreviewSupervisor(project, sessionId, owner) {
57353
57421
  try {
57354
57422
  const current = readPreviewRecord(project);
57355
57423
  if ((current == null ? void 0 : current.session_id) === record3.session_id && current.supervisor_id === record3.supervisor_id && current.reload_id === record3.reload_id) {
57356
- writePrivateJson(path37.join(previewRoundDirectory(record3), "result.json"), {
57424
+ writePrivateJson(path38.join(previewRoundDirectory(record3), "result.json"), {
57357
57425
  ...session.status(),
57358
57426
  supervisor_retired: true
57359
57427
  });
@@ -57434,7 +57502,7 @@ async function runPreviewSupervisor(project, sessionId, owner) {
57434
57502
  record3.runtime_pid = 0;
57435
57503
  record3.runtime_launch_pending = false;
57436
57504
  try {
57437
- writePrivateJson(path37.join(previewDirectory(project), "session.json"), record3);
57505
+ writePrivateJson(path38.join(previewDirectory(project), "session.json"), record3);
57438
57506
  } catch (error2) {
57439
57507
  await new Promise((resolve) => server.close(() => resolve()));
57440
57508
  throw error2;
@@ -57485,10 +57553,10 @@ async function previewStatus(project) {
57485
57553
  };
57486
57554
  } catch {
57487
57555
  const stopped = record3.state === "stopped";
57488
- const filename2 = path37.join(previewRoundDirectory(record3), "result.json");
57556
+ const filename2 = path38.join(previewRoundDirectory(record3), "result.json");
57489
57557
  let evidence = {};
57490
- if (fs36.existsSync(filename2)) {
57491
- const saved = JSON.parse(fs36.readFileSync(filename2, "utf8"));
57558
+ if (fs37.existsSync(filename2)) {
57559
+ const saved = JSON.parse(fs37.readFileSync(filename2, "utf8"));
57492
57560
  if (samePreviewIdentity(saved, record3)) {
57493
57561
  evidence = { ...saved };
57494
57562
  delete evidence.token;
@@ -57569,10 +57637,10 @@ var init_session = __esm({
57569
57637
  if ((current == null ? void 0 : current.session_id) !== this.record.session_id || current.supervisor_id !== this.record.supervisor_id)
57570
57638
  return;
57571
57639
  writePrivateJson(
57572
- path37.join(previewDirectory(this.record.project_realpath), "session.json"),
57640
+ path38.join(previewDirectory(this.record.project_realpath), "session.json"),
57573
57641
  this.record
57574
57642
  );
57575
- writePrivateJson(path37.join(previewRoundDirectory(this.record), "result.json"), this.status());
57643
+ writePrivateJson(path38.join(previewRoundDirectory(this.record), "result.json"), this.status());
57576
57644
  }
57577
57645
  }
57578
57646
  setTerminalState(state) {
@@ -57700,7 +57768,7 @@ var init_session = __esm({
57700
57768
  this.runtime = runtime;
57701
57769
  await runtime.start(
57702
57770
  String(this.preflight.entry),
57703
- path37.join(previewDirectory(this.record.project_realpath), "storage"),
57771
+ path38.join(previewDirectory(this.record.project_realpath), "storage"),
57704
57772
  this.preflight.window
57705
57773
  );
57706
57774
  if (this.stopping) throw new Error("CANCELLED");
@@ -57719,7 +57787,7 @@ var init_session = __esm({
57719
57787
  } finally {
57720
57788
  try {
57721
57789
  trimPreviewEvidence(
57722
- path37.join(previewDirectory(this.record.project_realpath), "sessions"),
57790
+ path38.join(previewDirectory(this.record.project_realpath), "sessions"),
57723
57791
  this.record.session_id,
57724
57792
  this.record.reload_id
57725
57793
  );
@@ -57799,23 +57867,23 @@ var init_session = __esm({
57799
57867
  });
57800
57868
 
57801
57869
  // src/maker/preview/validationHistory.ts
57802
- import fs37 from "node:fs";
57803
- import path38 from "node:path";
57870
+ import fs38 from "node:fs";
57871
+ import path39 from "node:path";
57804
57872
  import { randomUUID as randomUUID6 } from "node:crypto";
57805
57873
  async function historyRoot(project, create = false) {
57806
- if (create) await fs37.promises.mkdir(getMakerHome(), { recursive: true, mode: 448 });
57807
- const home2 = await fs37.promises.realpath(getMakerHome());
57874
+ if (create) await fs38.promises.mkdir(getMakerHome(), { recursive: true, mode: 448 });
57875
+ const home2 = await fs38.promises.realpath(getMakerHome());
57808
57876
  let current = home2;
57809
- for (const part of ["preview", path38.basename(previewDirectory(project)), "validation"]) {
57810
- current = path38.join(current, part);
57877
+ for (const part of ["preview", path39.basename(previewDirectory(project)), "validation"]) {
57878
+ current = path39.join(current, part);
57811
57879
  if (create) {
57812
57880
  try {
57813
- await fs37.promises.mkdir(current, { mode: 448 });
57881
+ await fs38.promises.mkdir(current, { mode: 448 });
57814
57882
  } catch (error2) {
57815
57883
  if (error2.code !== "EEXIST") throw error2;
57816
57884
  }
57817
57885
  }
57818
- const stat = await fs37.promises.lstat(current);
57886
+ const stat = await fs38.promises.lstat(current);
57819
57887
  if (!stat.isDirectory() || stat.isSymbolicLink())
57820
57888
  throw new Error("Invalid validation evidence directory.");
57821
57889
  }
@@ -57823,21 +57891,21 @@ async function historyRoot(project, create = false) {
57823
57891
  }
57824
57892
  async function runDirectory(project, id) {
57825
57893
  if (!UUID2.test(id)) throw new Error("Invalid validation run ID.");
57826
- const directory = path38.join(await historyRoot(project), id);
57827
- const stat = await fs37.promises.lstat(directory);
57894
+ const directory = path39.join(await historyRoot(project), id);
57895
+ const stat = await fs38.promises.lstat(directory);
57828
57896
  if (!stat.isDirectory() || stat.isSymbolicLink())
57829
57897
  throw new Error("Invalid validation run directory.");
57830
57898
  return directory;
57831
57899
  }
57832
57900
  async function artifact(directory, name, max = LIMITS[name]) {
57833
57901
  if (!max) throw new Error("Unknown validation artifact.");
57834
- const filename2 = path38.join(directory, name);
57902
+ const filename2 = path39.join(directory, name);
57835
57903
  let file3;
57836
57904
  try {
57837
- const before = await fs37.promises.lstat(filename2);
57905
+ const before = await fs38.promises.lstat(filename2);
57838
57906
  if (!before.isFile() || before.isSymbolicLink() || before.size > max)
57839
57907
  throw new Error("Invalid or oversized validation artifact.");
57840
- file3 = await fs37.promises.open(filename2, fs37.constants.O_RDONLY | (fs37.constants.O_NOFOLLOW || 0));
57908
+ file3 = await fs38.promises.open(filename2, fs38.constants.O_RDONLY | (fs38.constants.O_NOFOLLOW || 0));
57841
57909
  const stat = await file3.stat();
57842
57910
  if (!stat.isFile() || stat.dev !== before.dev || stat.ino !== before.ino || stat.size > max)
57843
57911
  throw new Error("Validation artifact identity changed.");
@@ -57879,9 +57947,9 @@ function summary(run) {
57879
57947
  async function createValidationRun(project) {
57880
57948
  const root2 = await historyRoot(project, true);
57881
57949
  const run_id = randomUUID6();
57882
- const directory = path38.join(root2, run_id);
57883
- await fs37.promises.mkdir(directory, { mode: 448 });
57884
- await fs37.promises.writeFile(path38.join(directory, "runtime.log"), "", { flag: "wx", mode: 384 });
57950
+ const directory = path39.join(root2, run_id);
57951
+ await fs38.promises.mkdir(directory, { mode: 448 });
57952
+ await fs38.promises.writeFile(path39.join(directory, "runtime.log"), "", { flag: "wx", mode: 384 });
57885
57953
  const run = {
57886
57954
  run_id,
57887
57955
  directory,
@@ -57896,11 +57964,11 @@ async function createValidationRun(project) {
57896
57964
  function updateValidationRun(run, update) {
57897
57965
  Object.assign(run, update);
57898
57966
  const { directory, ...data } = run;
57899
- writePrivateJson(path38.join(directory, "run.json"), data);
57967
+ writePrivateJson(path39.join(directory, "run.json"), data);
57900
57968
  }
57901
57969
  function finishValidationRun(run, result) {
57902
57970
  var _a3;
57903
- writePrivateJson(path38.join(run.directory, "result.json"), result);
57971
+ writePrivateJson(path39.join(run.directory, "result.json"), result);
57904
57972
  updateValidationRun(run, {
57905
57973
  phase: "finished",
57906
57974
  finished_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -57914,7 +57982,7 @@ async function records(project, limit = 5e3) {
57914
57982
  const warnings = [];
57915
57983
  let entries;
57916
57984
  try {
57917
- entries = await fs37.promises.readdir(await historyRoot(project), { withFileTypes: true });
57985
+ entries = await fs38.promises.readdir(await historyRoot(project), { withFileTypes: true });
57918
57986
  } catch (error2) {
57919
57987
  if (error2.code === "ENOENT") return { runs: [], warnings };
57920
57988
  throw error2;
@@ -57937,14 +58005,14 @@ async function requireNoActiveValidationRuntime(project, currentRun) {
57937
58005
  const { runs, warnings } = await records(project, Infinity);
57938
58006
  if (warnings.length)
57939
58007
  throw new Error(
57940
- "Validation Runtime ownership is unverified. Inspect " + path38.join(previewDirectory(project), "validation") + ": " + warnings.join("; ")
58008
+ "Validation Runtime ownership is unverified. Inspect " + path39.join(previewDirectory(project), "validation") + ": " + warnings.join("; ")
57941
58009
  );
57942
58010
  for (const run of runs) {
57943
58011
  if (run.run_id === currentRun || run.finished_at) continue;
57944
58012
  const unknownLaunch = run.runtime_launch_pending === true || !run.runtime_pid && run.phase !== "preparing";
57945
58013
  if (unknownLaunch || run.runtime_pid && processPresence(run.runtime_pid) !== "missing")
57946
58014
  throw new Error(
57947
- "A previous validation Runtime is active or unverified (run " + run.run_id + "). Inspect " + path38.join(previewDirectory(project), "validation", run.run_id, "run.json") + " and confirm that Runtime has exited before retrying. No process was stopped."
58015
+ "A previous validation Runtime is active or unverified (run " + run.run_id + "). Inspect " + path39.join(previewDirectory(project), "validation", run.run_id, "run.json") + " and confirm that Runtime has exited before retrying. No process was stopped."
57948
58016
  );
57949
58017
  }
57950
58018
  }
@@ -58069,17 +58137,17 @@ async function cleanValidationHistory(project) {
58069
58137
  const expired = Date.now() - Date.parse(run.finished_at || run.started_at) > RETENTION_MS;
58070
58138
  const inactive = run.finished_at || processPresence(run.owner_pid) === "missing" && !run.runtime_launch_pending && (!run.runtime_pid || processPresence(run.runtime_pid) === "missing");
58071
58139
  if (expired && inactive) {
58072
- await fs37.promises.rm(directory, { recursive: true, force: true });
58140
+ await fs38.promises.rm(directory, { recursive: true, force: true });
58073
58141
  continue;
58074
58142
  }
58075
58143
  const pending = [directory];
58076
58144
  while (pending.length && count < 5e4) {
58077
58145
  const current = pending.pop();
58078
- for (const entry of await fs37.promises.readdir(current, { withFileTypes: true })) {
58146
+ for (const entry of await fs38.promises.readdir(current, { withFileTypes: true })) {
58079
58147
  if (count >= 5e4) break;
58080
58148
  count++;
58081
- const filename2 = path38.join(current, entry.name);
58082
- const stat = await fs37.promises.lstat(filename2);
58149
+ const filename2 = path39.join(current, entry.name);
58150
+ const stat = await fs38.promises.lstat(filename2);
58083
58151
  if (stat.isSymbolicLink()) continue;
58084
58152
  if (stat.isDirectory()) pending.push(filename2);
58085
58153
  else if (stat.isFile()) bytes += stat.size;
@@ -58091,22 +58159,22 @@ async function cleanValidationHistory(project) {
58091
58159
  warnings.push(
58092
58160
  "Validation cache exceeds 5 GiB. Archive needed evidence before manually removing completed runs; recent runs were not deleted."
58093
58161
  );
58094
- writePrivateJson(path38.join(root2, "cleanup.json"), {
58162
+ writePrivateJson(path39.join(root2, "cleanup.json"), {
58095
58163
  completed_at: new Date(Date.now()).toISOString()
58096
58164
  });
58097
58165
  return warnings;
58098
58166
  });
58099
58167
  }
58100
58168
  async function archiveValidationRun(run, outputDir) {
58101
- if (!path38.isAbsolute(outputDir)) throw new Error("--output-dir must be an absolute directory.");
58102
- await fs37.promises.mkdir(outputDir, { recursive: true, mode: 448 });
58103
- const root2 = await fs37.promises.realpath(outputDir);
58104
- const managed = await fs37.promises.realpath(path38.dirname(previewDirectory(run.project_realpath)));
58105
- const relative = path38.relative(managed, root2);
58106
- if (!relative || !relative.startsWith(".." + path38.sep) && relative !== ".." && !path38.isAbsolute(relative))
58169
+ if (!path39.isAbsolute(outputDir)) throw new Error("--output-dir must be an absolute directory.");
58170
+ await fs38.promises.mkdir(outputDir, { recursive: true, mode: 448 });
58171
+ const root2 = await fs38.promises.realpath(outputDir);
58172
+ const managed = await fs38.promises.realpath(path39.dirname(previewDirectory(run.project_realpath)));
58173
+ const relative = path39.relative(managed, root2);
58174
+ if (!relative || !relative.startsWith(".." + path39.sep) && relative !== ".." && !path39.isAbsolute(relative))
58107
58175
  throw new Error("--output-dir must be outside the managed preview cache.");
58108
- const destination = path38.join(root2, run.run_id);
58109
- await fs37.promises.mkdir(destination, { mode: 448 });
58176
+ const destination = path39.join(root2, run.run_id);
58177
+ await fs38.promises.mkdir(destination, { mode: 448 });
58110
58178
  const files = [
58111
58179
  ...Object.keys(LIMITS).filter((name) => !["run.json", "result.json"].includes(name)),
58112
58180
  "run.json",
@@ -58121,17 +58189,17 @@ async function archiveValidationRun(run, outputDir) {
58121
58189
  source_evidence_directory: run.directory,
58122
58190
  evidence_directory: destination,
58123
58191
  archive_directory: destination,
58124
- log_path: path38.join(destination, "runtime.log"),
58125
- invocation_path: path38.join(destination, "invocation.json"),
58192
+ log_path: path39.join(destination, "runtime.log"),
58193
+ invocation_path: path39.join(destination, "invocation.json"),
58126
58194
  artifacts: Array.isArray(result.artifacts) ? result.artifacts.map((item) => {
58127
58195
  const original = typeof item.path === "string" ? item.path : "";
58128
- return original && path38.dirname(original) === run.directory && LIMITS[path38.basename(original)] ? { ...item, path: path38.join(destination, path38.basename(original)) } : item;
58196
+ return original && path39.dirname(original) === run.directory && LIMITS[path39.basename(original)] ? { ...item, path: path39.join(destination, path39.basename(original)) } : item;
58129
58197
  }) : []
58130
58198
  };
58131
58199
  bytes = Buffer.from(JSON.stringify(archived, null, 2));
58132
58200
  }
58133
58201
  if (bytes)
58134
- await fs37.promises.writeFile(path38.join(destination, name), bytes, { flag: "wx", mode: 384 });
58202
+ await fs38.promises.writeFile(path39.join(destination, name), bytes, { flag: "wx", mode: 384 });
58135
58203
  }
58136
58204
  return destination;
58137
58205
  }
@@ -60376,9 +60444,8 @@ var init_validationScreenshot = __esm({
60376
60444
  });
60377
60445
 
60378
60446
  // src/maker/preview/validation.ts
60379
- import fs38 from "node:fs";
60380
- import path39 from "node:path";
60381
- import os7 from "node:os";
60447
+ import fs39 from "node:fs";
60448
+ import path40 from "node:path";
60382
60449
  import { spawn as spawn9 } from "node:child_process";
60383
60450
  import { StringDecoder as StringDecoder3 } from "node:string_decoder";
60384
60451
  function numberOption(options3, name, fallback, max = 2147483647) {
@@ -60415,10 +60482,10 @@ function captureOutput(stream, append) {
60415
60482
  });
60416
60483
  }
60417
60484
  function readArtifact(filename2, max) {
60418
- const stat = fs38.lstatSync(filename2);
60485
+ const stat = fs39.lstatSync(filename2);
60419
60486
  if (!stat.isFile() || stat.isSymbolicLink() || stat.size === 0 || stat.size > max)
60420
60487
  throw new Error("Missing, empty or invalid artifact: " + filename2);
60421
- return fs38.readFileSync(filename2);
60488
+ return fs39.readFileSync(filename2);
60422
60489
  }
60423
60490
  function screenshotRetryTimeout(options3, nextFrame, runtimeMs, explicitTimeout = options3.validate_timeout !== void 0) {
60424
60491
  const frame = Number(options3.screenshot_frame);
@@ -60437,8 +60504,8 @@ async function runSkillValidation(project, options3, signal) {
60437
60504
  const paths = {
60438
60505
  run_id: run.run_id,
60439
60506
  evidence_directory: run.directory,
60440
- log_path: path39.join(run.directory, "runtime.log"),
60441
- invocation_path: path39.join(run.directory, "invocation.json"),
60507
+ log_path: path40.join(run.directory, "runtime.log"),
60508
+ invocation_path: path40.join(run.directory, "invocation.json"),
60442
60509
  started_at: run.started_at
60443
60510
  };
60444
60511
  process.stderr.write(JSON.stringify({ event: "validation.started", ...paths }) + "\n");
@@ -60447,7 +60514,7 @@ async function runSkillValidation(project, options3, signal) {
60447
60514
  writePrivateJson(paths.invocation_path, {
60448
60515
  requested_options: sanitizeDiagnosticValue(attemptOptions)
60449
60516
  });
60450
- if (options3.output_dir !== void 0 && (typeof options3.output_dir !== "string" || !path39.isAbsolute(options3.output_dir)))
60517
+ if (options3.output_dir !== void 0 && (typeof options3.output_dir !== "string" || !path40.isAbsolute(options3.output_dir)))
60451
60518
  throw new Error("--output-dir must be an absolute directory.");
60452
60519
  output2 = await executeSkillValidation(project, attemptOptions, signal, run);
60453
60520
  } catch (error2) {
@@ -60607,9 +60674,9 @@ async function executeSkillValidation(project, options3, signal, run) {
60607
60674
  throw new Error(
60608
60675
  "Runtime is missing. Use preview install through the current Maker distribution."
60609
60676
  );
60610
- if (!path39.isAbsolute(configured))
60677
+ if (!path40.isAbsolute(configured))
60611
60678
  throw new Error("--runtime must be an absolute executable path.");
60612
- const executable = fs38.realpathSync(configured);
60679
+ const executable = fs39.realpathSync(configured);
60613
60680
  await probeRuntime(executable, signal);
60614
60681
  if (!external) ensurePreviewRuntimeResources(executable);
60615
60682
  const identity = {
@@ -60638,8 +60705,8 @@ async function executeSkillValidation(project, options3, signal, run) {
60638
60705
  }
60639
60706
  };
60640
60707
  const lua = new PreviewLuaLog(executable, appendLog);
60641
- const reportPath = path39.join(directory, "validate.json");
60642
- const pngPath = path39.join(directory, "screenshot.png");
60708
+ const reportPath = path40.join(directory, "validate.json");
60709
+ const pngPath = path40.join(directory, "screenshot.png");
60643
60710
  const artifacts = [];
60644
60711
  const warnings = repairLocalValidationSkillFilter(project);
60645
60712
  let report;
@@ -60652,7 +60719,7 @@ async function executeSkillValidation(project, options3, signal, run) {
60652
60719
  let timedOut = false;
60653
60720
  let runtimeDurationMs;
60654
60721
  const started = run.started_at;
60655
- const invocationPath = path39.join(directory, "invocation.json");
60722
+ const invocationPath = path40.join(directory, "invocation.json");
60656
60723
  try {
60657
60724
  let source = project;
60658
60725
  let runtimeEntry = entry;
@@ -60670,8 +60737,11 @@ async function executeSkillValidation(project, options3, signal, run) {
60670
60737
  let args;
60671
60738
  if (classification.preparation_required) {
60672
60739
  assets = await startPreviewAssetServer(source, signal);
60673
- cache = fs38.realpathSync(fs38.mkdtempSync(path39.join(os7.tmpdir(), "maker-validate-")));
60674
- args = ["-game_url=" + assets.url, "-game_path=" + cache];
60740
+ cache = openPreviewDownloadCache(
60741
+ path40.join(previewDirectory(project), "storage"),
60742
+ assets.url
60743
+ );
60744
+ args = ["-game_url=" + assets.url, "-game_path=" + cache.root];
60675
60745
  } else {
60676
60746
  args = [runtimeEntry, "-tapcode_dir=" + source];
60677
60747
  }
@@ -60685,7 +60755,7 @@ async function executeSkillValidation(project, options3, signal, run) {
60685
60755
  "-validate-output=" + reportPath
60686
60756
  );
60687
60757
  if (!capture) args.push("-graphicsheadless");
60688
- if (test) args.push("-validate-test=" + path39.join(source, "scripts", test));
60758
+ if (test) args.push("-validate-test=" + path40.join(source, "scripts", test));
60689
60759
  if (spike !== void 0) args.push("-validate-spike-threshold=" + spike);
60690
60760
  }
60691
60761
  if (capture) args.push("-screenshot=" + pngPath, "-screenshot-frame=" + frame);
@@ -60760,11 +60830,7 @@ async function executeSkillValidation(project, options3, signal, run) {
60760
60830
  if (!await lua.finish()) failures.push("Final Lua log collection is incomplete.");
60761
60831
  try {
60762
60832
  await (assets == null ? void 0 : assets.close());
60763
- if (cache) {
60764
- if (fs38.lstatSync(cache).isSymbolicLink() || fs38.realpathSync(cache) !== cache)
60765
- failures.push("Validation cache ownership changed; cache retained.");
60766
- else fs38.rmSync(cache, { recursive: true, force: true });
60767
- }
60833
+ cache == null ? void 0 : cache.clearProject();
60768
60834
  } catch (error2) {
60769
60835
  failures.push(String(error2));
60770
60836
  }
@@ -60809,8 +60875,8 @@ async function executeSkillValidation(project, options3, signal, run) {
60809
60875
  );
60810
60876
  }
60811
60877
  }
60812
- const prepareLog = path39.join(directory, "prepare.log");
60813
- if (fs38.existsSync(prepareLog)) artifacts.push({ kind: "prepare-log", path: prepareLog });
60878
+ const prepareLog = path40.join(directory, "prepare.log");
60879
+ if (fs39.existsSync(prepareLog)) artifacts.push({ kind: "prepare-log", path: prepareLog });
60814
60880
  if (exitCode !== 0 && !(exitCode === 1 && (report == null ? void 0 : report.result) === "FAIL"))
60815
60881
  failures.push("Runtime did not complete normally; inspect its logs and original report.");
60816
60882
  const collectionResult = signal.aborted ? "CANCELLED" : timedOut || (report == null ? void 0 : report.result) === "TIMEOUT" ? "TIMEOUT" : failures.length ? "FAIL" : "COMPLETED";
@@ -60842,7 +60908,7 @@ async function executeSkillValidation(project, options3, signal, run) {
60842
60908
  exit_signal: exitSignal,
60843
60909
  warnings,
60844
60910
  error: failures.length ? failures.join("\n") : void 0,
60845
- log_path: path39.join(directory, "runtime.log"),
60911
+ log_path: path40.join(directory, "runtime.log"),
60846
60912
  invocation_path: invocationPath,
60847
60913
  evidence_directory: directory,
60848
60914
  started_at: started,
@@ -60867,14 +60933,15 @@ var init_validation = __esm({
60867
60933
  init_backgroundProcess();
60868
60934
  init_diagnosticRedaction();
60869
60935
  init_devKit();
60936
+ init_downloadCache();
60870
60937
  init_validationScreenshot();
60871
60938
  init_validationHistory();
60872
60939
  }
60873
60940
  });
60874
60941
 
60875
60942
  // src/maker/console/gitPull.ts
60876
- import fs39 from "node:fs";
60877
- import path40 from "node:path";
60943
+ import fs40 from "node:fs";
60944
+ import path41 from "node:path";
60878
60945
  import { execFile as execFile2 } from "node:child_process";
60879
60946
  import { promisify as promisify2 } from "node:util";
60880
60947
  async function pullConsoleGit(options3) {
@@ -61142,7 +61209,7 @@ async function gitOperationInProgress(root2, run) {
61142
61209
  }
61143
61210
  async function pathExists(root2, run, name) {
61144
61211
  const relative = (await run(["rev-parse", "--git-path", name], INSPECT_TIMEOUT_MS)).trim();
61145
- return fs39.existsSync(path40.resolve(root2, relative));
61212
+ return fs40.existsSync(path41.resolve(root2, relative));
61146
61213
  }
61147
61214
  async function refExists(root2, run, ref) {
61148
61215
  try {
@@ -61291,22 +61358,22 @@ var init_types3 = __esm({
61291
61358
  });
61292
61359
 
61293
61360
  // src/maker/console/projects.ts
61294
- import fs40 from "node:fs";
61295
- import path41 from "node:path";
61361
+ import fs41 from "node:fs";
61362
+ import path42 from "node:path";
61296
61363
  import { execFile as execFile3 } from "node:child_process";
61297
61364
  import { promisify as promisify3 } from "node:util";
61298
61365
  function objectFile2(filename2) {
61299
- const stat = fs40.statSync(filename2);
61366
+ const stat = fs41.statSync(filename2);
61300
61367
  if (!stat.isFile() || stat.size > 2 * 1024 * 1024)
61301
61368
  throw new ConsoleError("Project configuration exceeds the supported size.");
61302
- const data = JSON.parse(fs40.readFileSync(filename2, "utf8"));
61369
+ const data = JSON.parse(fs41.readFileSync(filename2, "utf8"));
61303
61370
  if (!data || typeof data !== "object" || Array.isArray(data))
61304
61371
  throw new ConsoleError("Invalid project configuration.");
61305
61372
  return data;
61306
61373
  }
61307
61374
  function optionalConfig(root2, file3) {
61308
61375
  try {
61309
- return objectFile2(path41.join(root2, ".project", file3));
61376
+ return objectFile2(path42.join(root2, ".project", file3));
61310
61377
  } catch {
61311
61378
  return {};
61312
61379
  }
@@ -61362,7 +61429,7 @@ var init_projects2 = __esm({
61362
61429
  const error2 = entry.error;
61363
61430
  const config2 = error2 ? {} : optionalConfig(entry.path, "project.json");
61364
61431
  const title = (_b = text((_a3 = config2.taptap_publish) == null ? void 0 : _a3.title)) == null ? void 0 : _b.trim();
61365
- const name = title && title !== "<game title, required>" ? title : path41.basename(entry.path) + (error2 ? "" : "(未发布)");
61432
+ const name = title && title !== "<game title, required>" ? title : path42.basename(entry.path) + (error2 ? "" : "(未发布)");
61366
61433
  return {
61367
61434
  key: entry.key,
61368
61435
  projectid: entry.binding,
@@ -61398,7 +61465,7 @@ var init_projects2 = __esm({
61398
61465
  const entry = config2["entry@server"] || resources2["entry@server"];
61399
61466
  const normalized = typeof entry === "string" ? entry.replace(/\\/g, "/").replace(/^\.\//, "") : "";
61400
61467
  const entries = normalized ? [normalized, "scripts/" + normalized, "assets/" + normalized] : [];
61401
- const directories = entries.map((file3) => path41.posix.dirname(file3)).filter((dir) => ![".", "scripts", "assets"].includes(dir));
61468
+ const directories = entries.map((file3) => path42.posix.dirname(file3)).filter((dir) => ![".", "scripts", "assets"].includes(dir));
61402
61469
  const raw = (await inspectGit(["status", "--porcelain=v1", "-z", "--untracked-files=all"])).split("\0");
61403
61470
  const files = /* @__PURE__ */ new Set();
61404
61471
  for (let i = 0; i < raw.length && raw[i]; i++) {
@@ -61415,7 +61482,7 @@ var init_projects2 = __esm({
61415
61482
  const meta3 = source + ".meta";
61416
61483
  const current = (() => {
61417
61484
  try {
61418
- return objectFile2(path41.join(project.path, meta3));
61485
+ return objectFile2(path42.join(project.path, meta3));
61419
61486
  } catch {
61420
61487
  return {};
61421
61488
  }
@@ -61861,10 +61928,10 @@ var init_processLauncher2 = __esm({
61861
61928
  });
61862
61929
 
61863
61930
  // src/maker/console/issueReport.ts
61864
- import fs41 from "node:fs";
61865
- import os8 from "node:os";
61866
- import path42 from "node:path";
61867
- import { createHash as createHash6 } from "node:crypto";
61931
+ import fs42 from "node:fs";
61932
+ import os7 from "node:os";
61933
+ import path43 from "node:path";
61934
+ import { createHash as createHash7 } from "node:crypto";
61868
61935
  function consoleReportOffer(task) {
61869
61936
  if (!["failed", "unknown"].includes(task.status)) return;
61870
61937
  if (task.action === "lua-lsp.check" || task.interaction || task.recovery) return;
@@ -61882,28 +61949,28 @@ function consoleReportOffer(task) {
61882
61949
  const stable = error2.replace(/[a-f0-9]{8}-[a-f0-9-]{27,}/gi, "<id>").replace(/[a-f0-9]{64}/gi, "<hash>").replace(/\b\d+\b/g, "<n>");
61883
61950
  return {
61884
61951
  category,
61885
- fingerprint: createHash6("sha256").update(task.projectKey + ":" + task.action + ":" + stable).digest("hex")
61952
+ fingerprint: createHash7("sha256").update(task.projectKey + ":" + task.action + ":" + stable).digest("hex")
61886
61953
  };
61887
61954
  }
61888
61955
  function logTail(root2, relative) {
61889
61956
  let fd;
61890
61957
  try {
61891
- if (fs41.lstatSync(root2).isSymbolicLink()) return "[日志不可用]";
61892
- const file3 = path42.join(fs41.realpathSync(root2), relative);
61893
- if (fs41.realpathSync(file3) !== file3 || !fs41.lstatSync(file3).isFile()) return "[日志不可用]";
61894
- fd = fs41.openSync(file3, fs41.constants.O_RDONLY | (fs41.constants.O_NOFOLLOW || 0));
61895
- const stat = fs41.fstatSync(fd);
61958
+ if (fs42.lstatSync(root2).isSymbolicLink()) return "[日志不可用]";
61959
+ const file3 = path43.join(fs42.realpathSync(root2), relative);
61960
+ if (fs42.realpathSync(file3) !== file3 || !fs42.lstatSync(file3).isFile()) return "[日志不可用]";
61961
+ fd = fs42.openSync(file3, fs42.constants.O_RDONLY | (fs42.constants.O_NOFOLLOW || 0));
61962
+ const stat = fs42.fstatSync(fd);
61896
61963
  if (!stat.isFile()) return "[日志不可用]";
61897
61964
  const offset = Math.max(0, stat.size - 6e3);
61898
61965
  const buffer = Buffer.alloc(Math.min(stat.size, 6e3));
61899
- fs41.readSync(fd, buffer, 0, buffer.length, offset);
61966
+ fs42.readSync(fd, buffer, 0, buffer.length, offset);
61900
61967
  let text2 = buffer.toString("utf8");
61901
61968
  if (offset) text2 = text2.includes("\n") ? text2.slice(text2.indexOf("\n") + 1) : "";
61902
61969
  return (offset ? "[日志仅含尾部]\n" : "") + String(sanitizeDiagnosticValue(text2));
61903
61970
  } catch {
61904
61971
  return "[日志不存在或无法读取]";
61905
61972
  } finally {
61906
- if (fd !== void 0) fs41.closeSync(fd);
61973
+ if (fd !== void 0) fs42.closeSync(fd);
61907
61974
  }
61908
61975
  }
61909
61976
  function consoleReportContext(task, project) {
@@ -61929,9 +61996,9 @@ function consoleReportContext(task, project) {
61929
61996
  runtime: record3.runtime,
61930
61997
  executable: record3.executable
61931
61998
  };
61932
- const round = path42.join("sessions", record3.session_id, String(record3.reload_id));
61933
- logs.prepare = logTail(directory, path42.join(round, "prepare.log"));
61934
- logs.runtime = logTail(directory, path42.join(round, "runtime.log"));
61999
+ const round = path43.join("sessions", record3.session_id, String(record3.reload_id));
62000
+ logs.prepare = logTail(directory, path43.join(round, "prepare.log"));
62001
+ logs.runtime = logTail(directory, path43.join(round, "runtime.log"));
61935
62002
  }
61936
62003
  if (!record3) logs.supervisor = logTail(directory, "supervisor.log");
61937
62004
  } catch {
@@ -61949,7 +62016,7 @@ function consoleReportContext(task, project) {
61949
62016
  started_at: task.startedAt,
61950
62017
  finished_at: task.finishedAt,
61951
62018
  status: task.status,
61952
- os_release: os8.release(),
62019
+ os_release: os7.release(),
61953
62020
  preview,
61954
62021
  logs,
61955
62022
  output: task.output.slice(-2e3)
@@ -61965,8 +62032,8 @@ var init_issueReport = __esm({
61965
62032
  });
61966
62033
 
61967
62034
  // src/maker/console/tasks.ts
61968
- import fs42 from "node:fs";
61969
- import path43 from "node:path";
62035
+ import fs43 from "node:fs";
62036
+ import path44 from "node:path";
61970
62037
  import { randomUUID as randomUUID7 } from "node:crypto";
61971
62038
  var ConsoleTasks;
61972
62039
  var init_tasks = __esm({
@@ -61989,10 +62056,10 @@ var init_tasks = __esm({
61989
62056
  this.running = /* @__PURE__ */ new Set();
61990
62057
  this.occupied = /* @__PURE__ */ new Set();
61991
62058
  var _a3;
61992
- if (historyFile && fs42.existsSync(historyFile)) {
61993
- if (fs42.statSync(historyFile).size > 40 * 1024 * 1024)
62059
+ if (historyFile && fs43.existsSync(historyFile)) {
62060
+ if (fs43.statSync(historyFile).size > 40 * 1024 * 1024)
61994
62061
  throw new ConsoleError("Console task history exceeds the supported size.");
61995
- const data = JSON.parse(fs42.readFileSync(historyFile, "utf8"));
62062
+ const data = JSON.parse(fs43.readFileSync(historyFile, "utf8"));
61996
62063
  if (!Array.isArray(data) || data.length > 100)
61997
62064
  throw new ConsoleError("Invalid console task history.");
61998
62065
  for (const task of data) {
@@ -62263,7 +62330,7 @@ var init_tasks = __esm({
62263
62330
  persist() {
62264
62331
  this.pruneHistory();
62265
62332
  if (this.historyFile) {
62266
- fs42.mkdirSync(path43.dirname(this.historyFile), { recursive: true, mode: 448 });
62333
+ fs43.mkdirSync(path44.dirname(this.historyFile), { recursive: true, mode: 448 });
62267
62334
  while (Buffer.byteLength(JSON.stringify(Array.from(this.tasks.values()))) > 40 * 1024 * 1024) {
62268
62335
  const oldest = this.list().reverse().find((task) => {
62269
62336
  var _a3;
@@ -62280,8 +62347,8 @@ var init_tasks = __esm({
62280
62347
  });
62281
62348
 
62282
62349
  // src/maker/console/integrations/framecrate.ts
62283
- import fs43 from "node:fs";
62284
- import path44 from "node:path";
62350
+ import fs44 from "node:fs";
62351
+ import path45 from "node:path";
62285
62352
  import { pathToFileURL } from "node:url";
62286
62353
  import { spawn as spawn11 } from "node:child_process";
62287
62354
  var FramecrateLauncher;
@@ -62324,7 +62391,7 @@ var init_framecrate = __esm({
62324
62391
  throw new ConsoleError("FrameCrate requires the exact console host origin.");
62325
62392
  }
62326
62393
  }
62327
- if (!path44.isAbsolute(projectPath) || fs43.realpathSync(projectPath) !== projectPath)
62394
+ if (!path45.isAbsolute(projectPath) || fs44.realpathSync(projectPath) !== projectPath)
62328
62395
  throw new ConsoleError("FrameCrate requires a validated project realpath.");
62329
62396
  const existing = this.sessions.get(projectPath);
62330
62397
  if (existing) {
@@ -62342,7 +62409,7 @@ var init_framecrate = __esm({
62342
62409
  );
62343
62410
  const env = this.options.env ?? process.env;
62344
62411
  const configured = (_a3 = env.FRAMECRATE_STUDIO_DIR) == null ? void 0 : _a3.trim();
62345
- if (!configured || !path44.isAbsolute(configured))
62412
+ if (!configured || !path45.isAbsolute(configured))
62346
62413
  throw new ConsoleError(
62347
62414
  "FrameCrate unavailable: set FRAMECRATE_STUDIO_DIR to the absolute path of an installed studio, then reopen the console.",
62348
62415
  409
@@ -62351,10 +62418,10 @@ var init_framecrate = __esm({
62351
62418
  let entry;
62352
62419
  let loader;
62353
62420
  try {
62354
- root2 = fs43.realpathSync(configured);
62355
- entry = path44.join(root2, "server/main.ts");
62356
- loader = path44.join(root2, "node_modules/tsx/dist/loader.mjs");
62357
- if (!fs43.statSync(entry).isFile() || !fs43.statSync(loader).isFile()) throw new Error();
62421
+ root2 = fs44.realpathSync(configured);
62422
+ entry = path45.join(root2, "server/main.ts");
62423
+ loader = path45.join(root2, "node_modules/tsx/dist/loader.mjs");
62424
+ if (!fs44.statSync(entry).isFile() || !fs44.statSync(loader).isFile()) throw new Error();
62358
62425
  } catch {
62359
62426
  throw new ConsoleError(
62360
62427
  "FrameCrate unavailable: FRAMECRATE_STUDIO_DIR must contain server/main.ts and node_modules/tsx/dist/loader.mjs. No installer is provided.",
@@ -62560,8 +62627,8 @@ var init_plugins = __esm({
62560
62627
  });
62561
62628
 
62562
62629
  // src/maker/cli/mcpLauncher.ts
62563
- import fs44 from "node:fs";
62564
- import path45 from "node:path";
62630
+ import fs45 from "node:fs";
62631
+ import path46 from "node:path";
62565
62632
  import { fileURLToPath as fileURLToPath3 } from "node:url";
62566
62633
  function resolveMakerPackageSpec(packageName, currentVersion) {
62567
62634
  return PUBLISHED_VERSION_PATTERN.test(currentVersion) ? `${packageName}@${currentVersion}` : packageName;
@@ -62571,33 +62638,33 @@ function materializeMakerSelfLauncher(options3) {
62571
62638
  throw new Error(`Invalid Maker runtime version: ${options3.version}`);
62572
62639
  }
62573
62640
  const execPath = options3.execPath ?? process.execPath;
62574
- if (!path45.isAbsolute(execPath) || !fs44.existsSync(execPath)) {
62641
+ if (!path46.isAbsolute(execPath) || !fs45.existsSync(execPath)) {
62575
62642
  throw new Error("Maker self launcher requires an existing absolute Node executable.");
62576
62643
  }
62577
62644
  const sourceBundle = fileURLToPath3(options3.bundleUrl);
62578
- const sourceRoot = path45.dirname(path45.dirname(sourceBundle));
62579
- const runtimeRoot = path45.join(path45.resolve(options3.makerHome), "mcp-runtime", options3.version);
62645
+ const sourceRoot = path46.dirname(path46.dirname(sourceBundle));
62646
+ const runtimeRoot = path46.join(path46.resolve(options3.makerHome), "mcp-runtime", options3.version);
62580
62647
  for (const relativePath of [...SELF_RUNTIME_FILES, ...SELF_RUNTIME_DIRECTORIES]) {
62581
- const sourcePath = path45.join(sourceRoot, relativePath);
62582
- if (!fs44.existsSync(sourcePath)) {
62648
+ const sourcePath = path46.join(sourceRoot, relativePath);
62649
+ if (!fs45.existsSync(sourcePath)) {
62583
62650
  throw new Error(`Maker self runtime source is incomplete: ${sourcePath}`);
62584
62651
  }
62585
62652
  }
62586
- if (path45.resolve(sourceRoot) !== path45.resolve(runtimeRoot)) {
62653
+ if (path46.resolve(sourceRoot) !== path46.resolve(runtimeRoot)) {
62587
62654
  for (const relativePath of SELF_RUNTIME_FILES) {
62588
- const sourcePath = path45.join(sourceRoot, relativePath);
62589
- const targetPath = path45.join(runtimeRoot, relativePath);
62590
- fs44.mkdirSync(path45.dirname(targetPath), { recursive: true });
62591
- fs44.copyFileSync(sourcePath, targetPath);
62655
+ const sourcePath = path46.join(sourceRoot, relativePath);
62656
+ const targetPath = path46.join(runtimeRoot, relativePath);
62657
+ fs45.mkdirSync(path46.dirname(targetPath), { recursive: true });
62658
+ fs45.copyFileSync(sourcePath, targetPath);
62592
62659
  }
62593
62660
  for (const relativePath of SELF_RUNTIME_DIRECTORIES) {
62594
62661
  copySelfRuntimeDirectory(
62595
- path45.join(sourceRoot, relativePath),
62596
- path45.join(runtimeRoot, relativePath)
62662
+ path46.join(sourceRoot, relativePath),
62663
+ path46.join(runtimeRoot, relativePath)
62597
62664
  );
62598
62665
  }
62599
62666
  }
62600
- const stableBundle = path45.join(runtimeRoot, "dist", "maker.js");
62667
+ const stableBundle = path46.join(runtimeRoot, "dist", "maker.js");
62601
62668
  return {
62602
62669
  kind: "self_runtime",
62603
62670
  command: execPath,
@@ -62607,7 +62674,7 @@ function materializeMakerSelfLauncher(options3) {
62607
62674
  }
62608
62675
  function copySelfRuntimeDirectory(sourcePath, targetPath) {
62609
62676
  try {
62610
- fs44.cpSync(sourcePath, targetPath, { recursive: true });
62677
+ fs45.cpSync(sourcePath, targetPath, { recursive: true });
62611
62678
  } catch (error2) {
62612
62679
  const code = typeof error2 === "object" && error2 !== null && "code" in error2 ? String(error2.code) : void 0;
62613
62680
  if (!code || !SELF_RUNTIME_COPY_FALLBACK_CODES.has(code)) {
@@ -62617,14 +62684,14 @@ function copySelfRuntimeDirectory(sourcePath, targetPath) {
62617
62684
  }
62618
62685
  }
62619
62686
  function copyDirectoryEntries(sourcePath, targetPath) {
62620
- fs44.mkdirSync(targetPath, { recursive: true });
62621
- for (const entry of fs44.readdirSync(sourcePath, { withFileTypes: true })) {
62622
- const sourceEntry = path45.join(sourcePath, entry.name);
62623
- const targetEntry = path45.join(targetPath, entry.name);
62687
+ fs45.mkdirSync(targetPath, { recursive: true });
62688
+ for (const entry of fs45.readdirSync(sourcePath, { withFileTypes: true })) {
62689
+ const sourceEntry = path46.join(sourcePath, entry.name);
62690
+ const targetEntry = path46.join(targetPath, entry.name);
62624
62691
  if (entry.isDirectory()) {
62625
62692
  copyDirectoryEntries(sourceEntry, targetEntry);
62626
62693
  } else {
62627
- fs44.copyFileSync(sourceEntry, targetEntry);
62694
+ fs45.copyFileSync(sourceEntry, targetEntry);
62628
62695
  }
62629
62696
  }
62630
62697
  }
@@ -62639,10 +62706,10 @@ function resolveMakerMcpLauncher(options3) {
62639
62706
  commandAndArgs: ["npx", ...args]
62640
62707
  };
62641
62708
  }
62642
- const existsSync2 = options3.existsSync ?? fs44.existsSync;
62709
+ const existsSync2 = options3.existsSync ?? fs45.existsSync;
62643
62710
  const execPath = options3.execPath ?? process.execPath;
62644
62711
  const npmExecPath = options3.npmExecPath ?? process.env.npm_execpath;
62645
- const windowsPath = path45.win32;
62712
+ const windowsPath = path46.win32;
62646
62713
  const npmCliCandidates = uniqueStrings([
62647
62714
  npmExecPath,
62648
62715
  windowsPath.join(windowsPath.dirname(execPath), "node_modules", "npm", "bin", "npm-cli.js")
@@ -62815,8 +62882,8 @@ var init_mcpLauncher = __esm({
62815
62882
 
62816
62883
  // src/maker/console/updates.ts
62817
62884
  import { execFile as execFile4 } from "node:child_process";
62818
- import fs45 from "node:fs";
62819
- import path46 from "node:path";
62885
+ import fs46 from "node:fs";
62886
+ import path47 from "node:path";
62820
62887
  async function fetchConsoleVersions() {
62821
62888
  var _a3, _b;
62822
62889
  const response = await fetch("https://registry.npmjs.org/@taptap%2fmaker", {
@@ -62835,8 +62902,8 @@ function runConsoleUpgrade(version2) {
62835
62902
  if (!VERSION2.test(version2)) throw new Error("无效版本号");
62836
62903
  const launcher = resolveMakerMcpLauncher({ packageName: `@taptap/maker@${version2}` });
62837
62904
  const home2 = getMakerHome();
62838
- const cache = path46.join(home2, "cache", "npm");
62839
- fs45.mkdirSync(cache, { recursive: true });
62905
+ const cache = path47.join(home2, "cache", "npm");
62906
+ fs46.mkdirSync(cache, { recursive: true });
62840
62907
  return new Promise((resolve, reject) => {
62841
62908
  execFile4(
62842
62909
  launcher.command,
@@ -64929,9 +64996,9 @@ ${content}</tr>
64929
64996
  });
64930
64997
 
64931
64998
  // src/maker/console/documents.ts
64932
- import fs46 from "node:fs";
64933
- import path47 from "node:path";
64934
- import { createHash as createHash7 } from "node:crypto";
64999
+ import fs47 from "node:fs";
65000
+ import path48 from "node:path";
65001
+ import { createHash as createHash8 } from "node:crypto";
64935
65002
  function guideKey(entry) {
64936
65003
  if (entry.kind === "skills" && entry.relativePath.endsWith("/SKILL.md"))
64937
65004
  return "skill:" + entry.relativePath.split("/").slice(-2, -1)[0];
@@ -64959,8 +65026,8 @@ function enrich(entries) {
64959
65026
  });
64960
65027
  }
64961
65028
  function inside2(root2, file3) {
64962
- const relative = path47.relative(root2, file3);
64963
- return relative !== ".." && !relative.startsWith(`..${path47.sep}`) && !path47.isAbsolute(relative);
65029
+ const relative = path48.relative(root2, file3);
65030
+ return relative !== ".." && !relative.startsWith(`..${path48.sep}`) && !path48.isAbsolute(relative);
64964
65031
  }
64965
65032
  var GUIDES, MAX_FILE, MAX_ENTRIES, SKILL_DIRS, GROUPS, ConsoleDocuments;
64966
65033
  var init_documents = __esm({
@@ -65061,36 +65128,36 @@ var init_documents = __esm({
65061
65128
  const seen = /* @__PURE__ */ new Set();
65062
65129
  let visited = 0;
65063
65130
  const collect = (base, source, relative, kind, category) => {
65064
- if (!fs46.existsSync(base)) return;
65065
- const root2 = fs46.realpathSync(base);
65131
+ if (!fs47.existsSync(base)) return;
65132
+ const root2 = fs47.realpathSync(base);
65066
65133
  const walk = (filename2, depth) => {
65067
65134
  var _a3, _b;
65068
65135
  if (depth > 7 || visited++ > 6e3 || entries.length >= MAX_ENTRIES) return;
65069
65136
  try {
65070
- const real = fs46.realpathSync(filename2);
65137
+ const real = fs47.realpathSync(filename2);
65071
65138
  if (!inside2(root2, real)) return;
65072
- const stat = fs46.statSync(real);
65139
+ const stat = fs47.statSync(real);
65073
65140
  if (stat.isDirectory()) {
65074
- if (fs46.lstatSync(filename2).isSymbolicLink()) return;
65075
- for (const name of fs46.readdirSync(filename2).sort()) {
65141
+ if (fs47.lstatSync(filename2).isSymbolicLink()) return;
65142
+ for (const name of fs47.readdirSync(filename2).sort()) {
65076
65143
  if (name === "node_modules" || name === ".git") continue;
65077
- walk(path47.join(filename2, name), depth + 1);
65144
+ walk(path48.join(filename2, name), depth + 1);
65078
65145
  }
65079
65146
  } else if (stat.isFile() && /\.md$/i.test(filename2) && stat.size <= MAX_FILE && !seen.has(real)) {
65080
65147
  seen.add(real);
65081
- const relativePath = path47.relative(root2, filename2).split(path47.sep).join("/");
65082
- const descriptor = fs46.openSync(real, "r");
65148
+ const relativePath = path48.relative(root2, filename2).split(path48.sep).join("/");
65149
+ const descriptor = fs47.openSync(real, "r");
65083
65150
  const buffer = Buffer.alloc(Math.min(8192, stat.size));
65084
65151
  let content;
65085
65152
  try {
65086
- content = buffer.subarray(0, fs46.readSync(descriptor, buffer, 0, buffer.length, 0)).toString("utf8");
65153
+ content = buffer.subarray(0, fs47.readSync(descriptor, buffer, 0, buffer.length, 0)).toString("utf8");
65087
65154
  } finally {
65088
- fs46.closeSync(descriptor);
65155
+ fs47.closeSync(descriptor);
65089
65156
  }
65090
65157
  const heading = (_b = (_a3 = content.match(/^#\s+(.+)$/m)) == null ? void 0 : _a3[1]) == null ? void 0 : _b.trim();
65091
- const fallback = path47.basename(filename2).toLowerCase() === "skill.md" ? path47.basename(path47.dirname(filename2)) : path47.basename(filename2, path47.extname(filename2));
65158
+ const fallback = path48.basename(filename2).toLowerCase() === "skill.md" ? path48.basename(path48.dirname(filename2)) : path48.basename(filename2, path48.extname(filename2));
65092
65159
  entries.push({
65093
- id: createHash7("sha256").update(source + ":" + relativePath).digest("hex"),
65160
+ id: createHash8("sha256").update(source + ":" + relativePath).digest("hex"),
65094
65161
  title: (heading || fallback).slice(0, 160),
65095
65162
  kind,
65096
65163
  category,
@@ -65103,7 +65170,7 @@ var init_documents = __esm({
65103
65170
  } catch {
65104
65171
  }
65105
65172
  };
65106
- walk(path47.join(root2, relative), 0);
65173
+ walk(path48.join(root2, relative), 0);
65107
65174
  };
65108
65175
  for (const filename2 of [
65109
65176
  "MAKER_CONSOLE.md",
@@ -65155,10 +65222,10 @@ var init_documents = __esm({
65155
65222
  if (!entry) throw new ConsoleError("文档不存在或已移除,请刷新目录。", 404);
65156
65223
  let content = entry.content;
65157
65224
  if (content === void 0) {
65158
- const real = fs46.realpathSync(entry.filename);
65159
- if (!inside2(entry.root, real) || fs46.statSync(real).size > MAX_FILE)
65225
+ const real = fs47.realpathSync(entry.filename);
65226
+ if (!inside2(entry.root, real) || fs47.statSync(real).size > MAX_FILE)
65160
65227
  throw new ConsoleError("文档无法安全读取。", 403);
65161
- content = fs46.readFileSync(real, "utf8");
65228
+ content = fs47.readFileSync(real, "utf8");
65162
65229
  }
65163
65230
  return {
65164
65231
  id,
@@ -65173,7 +65240,7 @@ var init_documents = __esm({
65173
65240
 
65174
65241
  // src/maker/console/folderPicker.ts
65175
65242
  import { execFile as execFile5 } from "node:child_process";
65176
- import path48 from "node:path";
65243
+ import path49 from "node:path";
65177
65244
  async function chooseProjectDirectory(platform = process.platform, signal) {
65178
65245
  let command;
65179
65246
  let args;
@@ -65191,7 +65258,7 @@ async function chooseProjectDirectory(platform = process.platform, signal) {
65191
65258
  ].join("\n")
65192
65259
  ];
65193
65260
  } else if (platform === "win32") {
65194
- command = path48.win32.join(
65261
+ command = path49.win32.join(
65195
65262
  process.env.SystemRoot || "C:\\Windows",
65196
65263
  "System32",
65197
65264
  "WindowsPowerShell",
@@ -65262,10 +65329,10 @@ var init_folderPicker = __esm({
65262
65329
  });
65263
65330
 
65264
65331
  // src/maker/console/projectDiscovery.ts
65265
- import fs47 from "node:fs";
65266
- import path49 from "node:path";
65332
+ import fs48 from "node:fs";
65333
+ import path50 from "node:path";
65267
65334
  async function discoverConsoleProjects(directory, registry2) {
65268
- const root2 = await fs47.promises.realpath(directory);
65335
+ const root2 = await fs48.promises.realpath(directory);
65269
65336
  const known = new Set(registry2.list().map((project) => project.path));
65270
65337
  const result = { added: 0, existing: 0, skipped: 0, limited: false };
65271
65338
  const deadline = Date.now() + 1e4;
@@ -65278,8 +65345,8 @@ async function discoverConsoleProjects(directory, registry2) {
65278
65345
  }
65279
65346
  const current = queue.shift();
65280
65347
  visited++;
65281
- const marker = path49.join(current.directory, ".maker-mcp/config.json");
65282
- if (fs47.existsSync(marker) || fs47.existsSync(path49.join(current.directory, ".project/project.json"))) {
65348
+ const marker = path50.join(current.directory, ".maker-mcp/config.json");
65349
+ if (fs48.existsSync(marker) || fs48.existsSync(path50.join(current.directory, ".project/project.json"))) {
65283
65350
  try {
65284
65351
  const project = registry2.add(current.directory);
65285
65352
  if (known.has(project.path)) result.existing++;
@@ -65293,7 +65360,7 @@ async function discoverConsoleProjects(directory, registry2) {
65293
65360
  }
65294
65361
  }
65295
65362
  try {
65296
- const entries = await fs47.promises.opendir(current.directory);
65363
+ const entries = await fs48.promises.opendir(current.directory);
65297
65364
  for await (const entry of entries) {
65298
65365
  if (++visited >= 5e3 || Date.now() >= deadline) {
65299
65366
  result.limited = true;
@@ -65305,7 +65372,7 @@ async function discoverConsoleProjects(directory, registry2) {
65305
65372
  continue;
65306
65373
  }
65307
65374
  queue.push({
65308
- directory: path49.join(current.directory, entry.name),
65375
+ directory: path50.join(current.directory, entry.name),
65309
65376
  depth: current.depth + 1
65310
65377
  });
65311
65378
  }
@@ -65337,7 +65404,7 @@ var init_projectDiscovery = __esm({
65337
65404
 
65338
65405
  // src/maker/console/server.ts
65339
65406
  import http3 from "node:http";
65340
- import { createHash as createHash8 } from "node:crypto";
65407
+ import { createHash as createHash9 } from "node:crypto";
65341
65408
  async function startConsoleServer(options3) {
65342
65409
  const now = options3.now || Date.now;
65343
65410
  const idleMs = options3.idleMs ?? 30 * 60 * 1e3;
@@ -65412,7 +65479,7 @@ async function startConsoleServer(options3) {
65412
65479
  }
65413
65480
  }
65414
65481
  const scriptHashes = [...options3.html.matchAll(/<script>([\s\S]*?)<\/script>/gi)].map(
65415
- (match) => `'sha256-${createHash8("sha256").update(match[1]).digest("base64")}'`
65482
+ (match) => `'sha256-${createHash9("sha256").update(match[1]).digest("base64")}'`
65416
65483
  );
65417
65484
  const server = http3.createServer(async (request2, response) => {
65418
65485
  const json2 = (status, value) => {
@@ -69179,18 +69246,18 @@ __export(cli_exports, {
69179
69246
  runConsoleSupervisor: () => runConsoleSupervisor,
69180
69247
  startConsolePreview: () => startConsolePreview
69181
69248
  });
69182
- import fs48 from "node:fs";
69183
- import path50 from "node:path";
69249
+ import fs49 from "node:fs";
69250
+ import path51 from "node:path";
69184
69251
  import { spawn as spawn12 } from "node:child_process";
69185
- import { createHash as createHash9, randomUUID as randomUUID8 } from "node:crypto";
69252
+ import { createHash as createHash10, randomUUID as randomUUID8 } from "node:crypto";
69186
69253
  function home() {
69187
- return path50.join(getMakerHome(), "console");
69254
+ return path51.join(getMakerHome(), "console");
69188
69255
  }
69189
69256
  function sessionPath() {
69190
- return path50.join(home(), "session.json");
69257
+ return path51.join(home(), "session.json");
69191
69258
  }
69192
69259
  function createConsoleLauncherIdentity(version2, developmentSource) {
69193
- return createHash9("sha256").update(
69260
+ return createHash10("sha256").update(
69194
69261
  JSON.stringify({
69195
69262
  protocol: CONSOLE_PROTOCOL_VERSION,
69196
69263
  version: version2,
@@ -69206,15 +69273,15 @@ function ensureCompatibleConsoleLauncher(actual, expected) {
69206
69273
  }
69207
69274
  }
69208
69275
  function launcherIdentity() {
69209
- const entry = fs48.realpathSync(process.argv[1]);
69276
+ const entry = fs49.realpathSync(process.argv[1]);
69210
69277
  return createConsoleLauncherIdentity(VERSION3, {
69211
69278
  entry,
69212
- mtimeMs: fs48.statSync(entry).mtimeMs
69279
+ mtimeMs: fs49.statSync(entry).mtimeMs
69213
69280
  });
69214
69281
  }
69215
69282
  function readSession() {
69216
- if (!fs48.existsSync(sessionPath())) return void 0;
69217
- const session = JSON.parse(fs48.readFileSync(sessionPath(), "utf8"));
69283
+ if (!fs49.existsSync(sessionPath())) return void 0;
69284
+ const session = JSON.parse(fs49.readFileSync(sessionPath(), "utf8"));
69218
69285
  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" || session.userHost !== void 0 && typeof session.userHost !== "boolean")
69219
69286
  throw new ConsoleError(
69220
69287
  "Invalid local console session. Refusing to contact an unknown service."
@@ -69295,9 +69362,9 @@ async function runConsoleSupervisor() {
69295
69362
  closePreviews: () => previewOwner.close(),
69296
69363
  html: getConsoleHtml2(),
69297
69364
  version: VERSION3,
69298
- packageRoot: path50.dirname(path50.dirname(path50.resolve(process.argv[1]))),
69365
+ packageRoot: path51.dirname(path51.dirname(path51.resolve(process.argv[1]))),
69299
69366
  distribution: process.env.TAPTAP_MAKER_DISTRIBUTION,
69300
- historyFile: path50.join(home(), "tasks.json"),
69367
+ historyFile: path51.join(home(), "tasks.json"),
69301
69368
  instanceId,
69302
69369
  execute: createConsoleExecutor({
69303
69370
  entry: process.argv[1],
@@ -69326,7 +69393,7 @@ async function runConsoleSupervisor() {
69326
69393
  const cleanup = () => {
69327
69394
  var _a3;
69328
69395
  try {
69329
- if (((_a3 = readSession()) == null ? void 0 : _a3.instanceId) === instanceId) fs48.unlinkSync(sessionPath());
69396
+ if (((_a3 = readSession()) == null ? void 0 : _a3.instanceId) === instanceId) fs49.unlinkSync(sessionPath());
69330
69397
  } catch {
69331
69398
  }
69332
69399
  release();
@@ -69349,11 +69416,11 @@ async function runConsoleSupervisor() {
69349
69416
  }
69350
69417
  }
69351
69418
  async function claimConsoleServerLock(directory) {
69352
- fs48.mkdirSync(directory, { recursive: true, mode: 448 });
69353
- return claimOwnedLock(path50.join(directory, "server.lock"));
69419
+ fs49.mkdirSync(directory, { recursive: true, mode: 448 });
69420
+ return claimOwnedLock(path51.join(directory, "server.lock"));
69354
69421
  }
69355
69422
  async function claimOwnedLock(filename2) {
69356
- filename2 = path50.join(fs48.realpathSync(path50.dirname(filename2)), path50.basename(filename2));
69423
+ filename2 = path51.join(fs49.realpathSync(path51.dirname(filename2)), path51.basename(filename2));
69357
69424
  const identity = `${process.pid}:${randomUUID8()}`;
69358
69425
  const recoveryFilename = filename2 + ".recovery";
69359
69426
  const releaseMutex = await claimRecoveryMutex2(filename2);
@@ -69361,10 +69428,10 @@ async function claimOwnedLock(filename2) {
69361
69428
  claimRecoveryGuard(recoveryFilename, identity);
69362
69429
  for (let attempt = 0; attempt < 3; attempt++) {
69363
69430
  try {
69364
- fs48.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
69431
+ fs49.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
69365
69432
  return () => {
69366
69433
  try {
69367
- if (fs48.readFileSync(filename2, "utf8") === identity) fs48.unlinkSync(filename2);
69434
+ if (fs49.readFileSync(filename2, "utf8") === identity) fs49.unlinkSync(filename2);
69368
69435
  } catch {
69369
69436
  }
69370
69437
  };
@@ -69372,7 +69439,7 @@ async function claimOwnedLock(filename2) {
69372
69439
  if (error2.code !== "EEXIST") throw error2;
69373
69440
  let previous;
69374
69441
  try {
69375
- previous = fs48.readFileSync(filename2, "utf8");
69442
+ previous = fs49.readFileSync(filename2, "utf8");
69376
69443
  } catch (cause) {
69377
69444
  if (cause.code === "ENOENT") continue;
69378
69445
  throw cause;
@@ -69387,7 +69454,7 @@ async function claimOwnedLock(filename2) {
69387
69454
  } catch (cause) {
69388
69455
  if (cause.code === "ESRCH") {
69389
69456
  try {
69390
- if (fs48.readFileSync(filename2, "utf8") === previous) fs48.unlinkSync(filename2);
69457
+ if (fs49.readFileSync(filename2, "utf8") === previous) fs49.unlinkSync(filename2);
69391
69458
  } catch (error3) {
69392
69459
  if (error3.code !== "ENOENT") throw error3;
69393
69460
  }
@@ -69419,19 +69486,19 @@ function claimRecoveryGuard(filename2, identity) {
69419
69486
  for (let attempt = 0; attempt < 3; attempt++) {
69420
69487
  let descriptor;
69421
69488
  try {
69422
- descriptor = fs48.openSync(filename2, "wx", 384);
69489
+ descriptor = fs49.openSync(filename2, "wx", 384);
69423
69490
  } catch (error2) {
69424
69491
  if (error2.code !== "EEXIST") throw error2;
69425
69492
  if (reclaimStaleRecoveryGuard(filename2)) continue;
69426
69493
  throw new ConsoleError("Console ownership recovery is already in progress.", 409);
69427
69494
  }
69428
69495
  try {
69429
- fs48.writeFileSync(descriptor, identity, "utf8");
69496
+ fs49.writeFileSync(descriptor, identity, "utf8");
69430
69497
  } catch (error2) {
69431
- fs48.unlinkSync(filename2);
69498
+ fs49.unlinkSync(filename2);
69432
69499
  throw error2;
69433
69500
  } finally {
69434
- fs48.closeSync(descriptor);
69501
+ fs49.closeSync(descriptor);
69435
69502
  }
69436
69503
  return;
69437
69504
  }
@@ -69441,8 +69508,8 @@ function reclaimStaleRecoveryGuard(filename2) {
69441
69508
  let content;
69442
69509
  let modified;
69443
69510
  try {
69444
- content = fs48.readFileSync(filename2, "utf8");
69445
- modified = fs48.statSync(filename2).mtimeMs;
69511
+ content = fs49.readFileSync(filename2, "utf8");
69512
+ modified = fs49.statSync(filename2).mtimeMs;
69446
69513
  } catch (error2) {
69447
69514
  return error2.code === "ENOENT";
69448
69515
  }
@@ -69450,8 +69517,8 @@ function reclaimStaleRecoveryGuard(filename2) {
69450
69517
  const stale = Number.isInteger(pid) && pid > 0 ? processPresence(pid) === "missing" : content === "" && Date.now() - modified >= 2e3;
69451
69518
  if (!stale) return false;
69452
69519
  try {
69453
- if (fs48.readFileSync(filename2, "utf8") === content && fs48.statSync(filename2).mtimeMs === modified) {
69454
- fs48.unlinkSync(filename2);
69520
+ if (fs49.readFileSync(filename2, "utf8") === content && fs49.statSync(filename2).mtimeMs === modified) {
69521
+ fs49.unlinkSync(filename2);
69455
69522
  return true;
69456
69523
  }
69457
69524
  } catch (error2) {
@@ -69461,18 +69528,18 @@ function reclaimStaleRecoveryGuard(filename2) {
69461
69528
  }
69462
69529
  function removeOwnedFile(filename2, identity) {
69463
69530
  try {
69464
- if (fs48.readFileSync(filename2, "utf8") === identity) fs48.unlinkSync(filename2);
69531
+ if (fs49.readFileSync(filename2, "utf8") === identity) fs49.unlinkSync(filename2);
69465
69532
  } catch {
69466
69533
  }
69467
69534
  }
69468
69535
  async function ensureSession(allowLegacy = false) {
69469
- fs48.mkdirSync(home(), { recursive: true, mode: 448 });
69536
+ fs49.mkdirSync(home(), { recursive: true, mode: 448 });
69470
69537
  const existing = await availableSession();
69471
69538
  if (existing) {
69472
69539
  ensureCompatibleConsoleLauncher(existing.launcher, launcherIdentity());
69473
69540
  return existing;
69474
69541
  }
69475
- const lock = path50.join(home(), "launch.lock");
69542
+ const lock = path51.join(home(), "launch.lock");
69476
69543
  let releaseLaunch;
69477
69544
  for (let attempt = 0; attempt < 60; attempt++) {
69478
69545
  try {
@@ -69501,7 +69568,7 @@ async function ensureSession(allowLegacy = false) {
69501
69568
  execArgv: process.execArgv,
69502
69569
  entry: process.argv[1],
69503
69570
  cwd: home(),
69504
- logFile: path50.join(home(), "server.log"),
69571
+ logFile: path51.join(home(), "server.log"),
69505
69572
  env: process.env,
69506
69573
  legacy: allowLegacy
69507
69574
  });
@@ -69603,7 +69670,7 @@ async function runConsoleCli(action, options3) {
69603
69670
  if (action !== "open") throw new ConsoleError("Use console open|status|stop.");
69604
69671
  const target = typeof options3.target_dir === "string" ? options3.target_dir : void 0;
69605
69672
  if (target) {
69606
- if (!path50.isAbsolute(target))
69673
+ if (!path51.isAbsolute(target))
69607
69674
  throw new ConsoleError("--target-dir must be an absolute project path.");
69608
69675
  const { previewProject: previewProject2 } = await Promise.resolve().then(() => (init_protocol2(), protocol_exports));
69609
69676
  previewProject2(target);
@@ -69658,14 +69725,14 @@ var init_cli = __esm({
69658
69725
  init_types3();
69659
69726
  init_owner();
69660
69727
  init_diagnosticRedaction();
69661
- VERSION3 = false ? "dev" : "0.0.37-beta.2";
69728
+ VERSION3 = false ? "dev" : "0.0.37-beta.3";
69662
69729
  CONSOLE_PROTOCOL_VERSION = 3;
69663
69730
  }
69664
69731
  });
69665
69732
 
69666
69733
  // src/maker/cli/preview.ts
69667
- import fs49 from "node:fs";
69668
- import path51 from "node:path";
69734
+ import fs50 from "node:fs";
69735
+ import path52 from "node:path";
69669
69736
  import { randomBytes as randomBytes3, randomUUID as randomUUID9 } from "node:crypto";
69670
69737
  function isRetiredFailure(status, record3) {
69671
69738
  return Boolean(
@@ -69748,7 +69815,7 @@ async function executePreviewOperation(action, options3, signal, owner) {
69748
69815
  if (options3.session_id && options3.session_id !== (record3 == null ? void 0 : record3.session_id))
69749
69816
  throw new Error("Preview session changed. Read status again.");
69750
69817
  if (action === "stop" && record3) {
69751
- writePrivateJson(path51.join(previewDirectory(project), "stop.json"), {
69818
+ writePrivateJson(path52.join(previewDirectory(project), "stop.json"), {
69752
69819
  request_id: randomUUID9(),
69753
69820
  session_id: record3.session_id,
69754
69821
  supervisor_id: record3.supervisor_id
@@ -69825,7 +69892,7 @@ async function executePreviewOperation(action, options3, signal, owner) {
69825
69892
  function windowsLaunchHint(logFile) {
69826
69893
  let empty = true;
69827
69894
  try {
69828
- empty = fs49.statSync(logFile).size === 0;
69895
+ empty = fs50.statSync(logFile).size === 0;
69829
69896
  } catch {
69830
69897
  empty = true;
69831
69898
  }
@@ -69905,9 +69972,9 @@ async function startPreview(project, options3, signal, owner) {
69905
69972
  await requireNoActiveValidationRuntime(project);
69906
69973
  const sessionId = randomUUID9();
69907
69974
  const supervisorId = randomUUID9();
69908
- const stopFile = path51.join(previewDirectory(project), "stop.json");
69975
+ const stopFile = path52.join(previewDirectory(project), "stop.json");
69909
69976
  const checkCancelled = () => {
69910
- const stop = fs49.existsSync(stopFile) ? JSON.parse(fs49.readFileSync(stopFile, "utf8")) : void 0;
69977
+ const stop = fs50.existsSync(stopFile) ? JSON.parse(fs50.readFileSync(stopFile, "utf8")) : void 0;
69911
69978
  if (signal.aborted || (stop == null ? void 0 : stop.session_id) === sessionId && stop.supervisor_id === supervisorId)
69912
69979
  throw new Error("CANCELLED: preview start was stopped.");
69913
69980
  };
@@ -69943,9 +70010,9 @@ async function startPreview(project, options3, signal, owner) {
69943
70010
  install_state: "missing",
69944
70011
  error: "Runtime is missing. With host approval, run taptap-maker preview install --target-dir <PROJECT_ABSOLUTE_PATH>, then retry start."
69945
70012
  };
69946
- if (!path51.isAbsolute(configured))
70013
+ if (!path52.isAbsolute(configured))
69947
70014
  throw new Error("--runtime must be an absolute executable path.");
69948
- const executable = fs49.realpathSync(configured);
70015
+ const executable = fs50.realpathSync(configured);
69949
70016
  const resourceWarnings = externalRuntime ? [] : ensurePreviewRuntimeResources(executable).warnings;
69950
70017
  const runtime = await probeRuntime(executable, signal);
69951
70018
  checkCancelled();
@@ -69965,7 +70032,7 @@ async function startPreview(project, options3, signal, owner) {
69965
70032
  state: "starting",
69966
70033
  runtime
69967
70034
  };
69968
- writePrivateJson(path51.join(previewDirectory(project), "session.json"), record3);
70035
+ writePrivateJson(path52.join(previewDirectory(project), "session.json"), record3);
69969
70036
  if (owner) {
69970
70037
  checkCancelled();
69971
70038
  await runPreviewSupervisor(project, record3.session_id, owner);
@@ -69990,7 +70057,7 @@ async function startPreview(project, options3, signal, owner) {
69990
70057
  entry: process.argv[1],
69991
70058
  project,
69992
70059
  sessionId: record3.session_id,
69993
- cwd: path51.dirname(executable),
70060
+ cwd: path52.dirname(executable),
69994
70061
  logFile: previewSupervisorLogPath(project),
69995
70062
  env: process.env,
69996
70063
  signal
@@ -70035,7 +70102,7 @@ async function startPreview(project, options3, signal, owner) {
70035
70102
  } else {
70036
70103
  if (launch.stopUnpublished()) {
70037
70104
  record3.state = "stopped";
70038
- writePrivateJson(path51.join(previewDirectory(project), "session.json"), record3);
70105
+ writePrivateJson(path52.join(previewDirectory(project), "session.json"), record3);
70039
70106
  } else {
70040
70107
  throw new Error(
70041
70108
  String(error2) + "; supervisor exit is unverified. " + windowsLaunchHint(previewSupervisorLogPath(project))
@@ -70154,17 +70221,17 @@ var require_visit = __commonJS({
70154
70221
  visit.BREAK = BREAK;
70155
70222
  visit.SKIP = SKIP;
70156
70223
  visit.REMOVE = REMOVE;
70157
- function visit_(key, node, visitor, path61) {
70158
- const ctrl = callVisitor(key, node, visitor, path61);
70224
+ function visit_(key, node, visitor, path62) {
70225
+ const ctrl = callVisitor(key, node, visitor, path62);
70159
70226
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
70160
- replaceNode(key, path61, ctrl);
70161
- return visit_(key, ctrl, visitor, path61);
70227
+ replaceNode(key, path62, ctrl);
70228
+ return visit_(key, ctrl, visitor, path62);
70162
70229
  }
70163
70230
  if (typeof ctrl !== "symbol") {
70164
70231
  if (identity.isCollection(node)) {
70165
- path61 = Object.freeze(path61.concat(node));
70232
+ path62 = Object.freeze(path62.concat(node));
70166
70233
  for (let i = 0; i < node.items.length; ++i) {
70167
- const ci = visit_(i, node.items[i], visitor, path61);
70234
+ const ci = visit_(i, node.items[i], visitor, path62);
70168
70235
  if (typeof ci === "number")
70169
70236
  i = ci - 1;
70170
70237
  else if (ci === BREAK)
@@ -70175,13 +70242,13 @@ var require_visit = __commonJS({
70175
70242
  }
70176
70243
  }
70177
70244
  } else if (identity.isPair(node)) {
70178
- path61 = Object.freeze(path61.concat(node));
70179
- const ck = visit_("key", node.key, visitor, path61);
70245
+ path62 = Object.freeze(path62.concat(node));
70246
+ const ck = visit_("key", node.key, visitor, path62);
70180
70247
  if (ck === BREAK)
70181
70248
  return BREAK;
70182
70249
  else if (ck === REMOVE)
70183
70250
  node.key = null;
70184
- const cv = visit_("value", node.value, visitor, path61);
70251
+ const cv = visit_("value", node.value, visitor, path62);
70185
70252
  if (cv === BREAK)
70186
70253
  return BREAK;
70187
70254
  else if (cv === REMOVE)
@@ -70202,17 +70269,17 @@ var require_visit = __commonJS({
70202
70269
  visitAsync.BREAK = BREAK;
70203
70270
  visitAsync.SKIP = SKIP;
70204
70271
  visitAsync.REMOVE = REMOVE;
70205
- async function visitAsync_(key, node, visitor, path61) {
70206
- const ctrl = await callVisitor(key, node, visitor, path61);
70272
+ async function visitAsync_(key, node, visitor, path62) {
70273
+ const ctrl = await callVisitor(key, node, visitor, path62);
70207
70274
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
70208
- replaceNode(key, path61, ctrl);
70209
- return visitAsync_(key, ctrl, visitor, path61);
70275
+ replaceNode(key, path62, ctrl);
70276
+ return visitAsync_(key, ctrl, visitor, path62);
70210
70277
  }
70211
70278
  if (typeof ctrl !== "symbol") {
70212
70279
  if (identity.isCollection(node)) {
70213
- path61 = Object.freeze(path61.concat(node));
70280
+ path62 = Object.freeze(path62.concat(node));
70214
70281
  for (let i = 0; i < node.items.length; ++i) {
70215
- const ci = await visitAsync_(i, node.items[i], visitor, path61);
70282
+ const ci = await visitAsync_(i, node.items[i], visitor, path62);
70216
70283
  if (typeof ci === "number")
70217
70284
  i = ci - 1;
70218
70285
  else if (ci === BREAK)
@@ -70223,13 +70290,13 @@ var require_visit = __commonJS({
70223
70290
  }
70224
70291
  }
70225
70292
  } else if (identity.isPair(node)) {
70226
- path61 = Object.freeze(path61.concat(node));
70227
- const ck = await visitAsync_("key", node.key, visitor, path61);
70293
+ path62 = Object.freeze(path62.concat(node));
70294
+ const ck = await visitAsync_("key", node.key, visitor, path62);
70228
70295
  if (ck === BREAK)
70229
70296
  return BREAK;
70230
70297
  else if (ck === REMOVE)
70231
70298
  node.key = null;
70232
- const cv = await visitAsync_("value", node.value, visitor, path61);
70299
+ const cv = await visitAsync_("value", node.value, visitor, path62);
70233
70300
  if (cv === BREAK)
70234
70301
  return BREAK;
70235
70302
  else if (cv === REMOVE)
@@ -70256,24 +70323,24 @@ var require_visit = __commonJS({
70256
70323
  }
70257
70324
  return visitor;
70258
70325
  }
70259
- function callVisitor(key, node, visitor, path61) {
70326
+ function callVisitor(key, node, visitor, path62) {
70260
70327
  var _a3, _b, _c, _d, _e;
70261
70328
  if (typeof visitor === "function")
70262
- return visitor(key, node, path61);
70329
+ return visitor(key, node, path62);
70263
70330
  if (identity.isMap(node))
70264
- return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node, path61);
70331
+ return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node, path62);
70265
70332
  if (identity.isSeq(node))
70266
- return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node, path61);
70333
+ return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node, path62);
70267
70334
  if (identity.isPair(node))
70268
- return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node, path61);
70335
+ return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node, path62);
70269
70336
  if (identity.isScalar(node))
70270
- return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path61);
70337
+ return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path62);
70271
70338
  if (identity.isAlias(node))
70272
- return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node, path61);
70339
+ return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node, path62);
70273
70340
  return void 0;
70274
70341
  }
70275
- function replaceNode(key, path61, node) {
70276
- const parent = path61[path61.length - 1];
70342
+ function replaceNode(key, path62, node) {
70343
+ const parent = path62[path62.length - 1];
70277
70344
  if (identity.isCollection(parent)) {
70278
70345
  parent.items[key] = node;
70279
70346
  } else if (identity.isPair(parent)) {
@@ -70885,10 +70952,10 @@ var require_Collection = __commonJS({
70885
70952
  var createNode = require_createNode();
70886
70953
  var identity = require_identity();
70887
70954
  var Node = require_Node();
70888
- function collectionFromPath(schema, path61, value) {
70955
+ function collectionFromPath(schema, path62, value) {
70889
70956
  let v = value;
70890
- for (let i = path61.length - 1; i >= 0; --i) {
70891
- const k = path61[i];
70957
+ for (let i = path62.length - 1; i >= 0; --i) {
70958
+ const k = path62[i];
70892
70959
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
70893
70960
  const a = [];
70894
70961
  a[k] = v;
@@ -70907,7 +70974,7 @@ var require_Collection = __commonJS({
70907
70974
  sourceObjects: /* @__PURE__ */ new Map()
70908
70975
  });
70909
70976
  }
70910
- var isEmptyPath = (path61) => path61 == null || typeof path61 === "object" && !!path61[Symbol.iterator]().next().done;
70977
+ var isEmptyPath = (path62) => path62 == null || typeof path62 === "object" && !!path62[Symbol.iterator]().next().done;
70911
70978
  var Collection = class extends Node.NodeBase {
70912
70979
  constructor(type, schema) {
70913
70980
  super(type);
@@ -70937,11 +71004,11 @@ var require_Collection = __commonJS({
70937
71004
  * be a Pair instance or a `{ key, value }` object, which may not have a key
70938
71005
  * that already exists in the map.
70939
71006
  */
70940
- addIn(path61, value) {
70941
- if (isEmptyPath(path61))
71007
+ addIn(path62, value) {
71008
+ if (isEmptyPath(path62))
70942
71009
  this.add(value);
70943
71010
  else {
70944
- const [key, ...rest] = path61;
71011
+ const [key, ...rest] = path62;
70945
71012
  const node = this.get(key, true);
70946
71013
  if (identity.isCollection(node))
70947
71014
  node.addIn(rest, value);
@@ -70955,8 +71022,8 @@ var require_Collection = __commonJS({
70955
71022
  * Removes a value from the collection.
70956
71023
  * @returns `true` if the item was found and removed.
70957
71024
  */
70958
- deleteIn(path61) {
70959
- const [key, ...rest] = path61;
71025
+ deleteIn(path62) {
71026
+ const [key, ...rest] = path62;
70960
71027
  if (rest.length === 0)
70961
71028
  return this.delete(key);
70962
71029
  const node = this.get(key, true);
@@ -70970,8 +71037,8 @@ var require_Collection = __commonJS({
70970
71037
  * scalar values from their surrounding node; to disable set `keepScalar` to
70971
71038
  * `true` (collections are always returned intact).
70972
71039
  */
70973
- getIn(path61, keepScalar) {
70974
- const [key, ...rest] = path61;
71040
+ getIn(path62, keepScalar) {
71041
+ const [key, ...rest] = path62;
70975
71042
  const node = this.get(key, true);
70976
71043
  if (rest.length === 0)
70977
71044
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -70989,8 +71056,8 @@ var require_Collection = __commonJS({
70989
71056
  /**
70990
71057
  * Checks if the collection includes a value with the key `key`.
70991
71058
  */
70992
- hasIn(path61) {
70993
- const [key, ...rest] = path61;
71059
+ hasIn(path62) {
71060
+ const [key, ...rest] = path62;
70994
71061
  if (rest.length === 0)
70995
71062
  return this.has(key);
70996
71063
  const node = this.get(key, true);
@@ -71000,8 +71067,8 @@ var require_Collection = __commonJS({
71000
71067
  * Sets a value in this collection. For `!!set`, `value` needs to be a
71001
71068
  * boolean to add/remove the item from the set.
71002
71069
  */
71003
- setIn(path61, value) {
71004
- const [key, ...rest] = path61;
71070
+ setIn(path62, value) {
71071
+ const [key, ...rest] = path62;
71005
71072
  if (rest.length === 0) {
71006
71073
  this.set(key, value);
71007
71074
  } else {
@@ -73515,9 +73582,9 @@ var require_Document = __commonJS({
73515
73582
  this.contents.add(value);
73516
73583
  }
73517
73584
  /** Adds a value to the document. */
73518
- addIn(path61, value) {
73585
+ addIn(path62, value) {
73519
73586
  if (assertCollection(this.contents))
73520
- this.contents.addIn(path61, value);
73587
+ this.contents.addIn(path62, value);
73521
73588
  }
73522
73589
  /**
73523
73590
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -73592,14 +73659,14 @@ var require_Document = __commonJS({
73592
73659
  * Removes a value from the document.
73593
73660
  * @returns `true` if the item was found and removed.
73594
73661
  */
73595
- deleteIn(path61) {
73596
- if (Collection.isEmptyPath(path61)) {
73662
+ deleteIn(path62) {
73663
+ if (Collection.isEmptyPath(path62)) {
73597
73664
  if (this.contents == null)
73598
73665
  return false;
73599
73666
  this.contents = null;
73600
73667
  return true;
73601
73668
  }
73602
- return assertCollection(this.contents) ? this.contents.deleteIn(path61) : false;
73669
+ return assertCollection(this.contents) ? this.contents.deleteIn(path62) : false;
73603
73670
  }
73604
73671
  /**
73605
73672
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -73614,10 +73681,10 @@ var require_Document = __commonJS({
73614
73681
  * scalar values from their surrounding node; to disable set `keepScalar` to
73615
73682
  * `true` (collections are always returned intact).
73616
73683
  */
73617
- getIn(path61, keepScalar) {
73618
- if (Collection.isEmptyPath(path61))
73684
+ getIn(path62, keepScalar) {
73685
+ if (Collection.isEmptyPath(path62))
73619
73686
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
73620
- return identity.isCollection(this.contents) ? this.contents.getIn(path61, keepScalar) : void 0;
73687
+ return identity.isCollection(this.contents) ? this.contents.getIn(path62, keepScalar) : void 0;
73621
73688
  }
73622
73689
  /**
73623
73690
  * Checks if the document includes a value with the key `key`.
@@ -73628,10 +73695,10 @@ var require_Document = __commonJS({
73628
73695
  /**
73629
73696
  * Checks if the document includes a value at `path`.
73630
73697
  */
73631
- hasIn(path61) {
73632
- if (Collection.isEmptyPath(path61))
73698
+ hasIn(path62) {
73699
+ if (Collection.isEmptyPath(path62))
73633
73700
  return this.contents !== void 0;
73634
- return identity.isCollection(this.contents) ? this.contents.hasIn(path61) : false;
73701
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path62) : false;
73635
73702
  }
73636
73703
  /**
73637
73704
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -73648,13 +73715,13 @@ var require_Document = __commonJS({
73648
73715
  * Sets a value in this document. For `!!set`, `value` needs to be a
73649
73716
  * boolean to add/remove the item from the set.
73650
73717
  */
73651
- setIn(path61, value) {
73652
- if (Collection.isEmptyPath(path61)) {
73718
+ setIn(path62, value) {
73719
+ if (Collection.isEmptyPath(path62)) {
73653
73720
  this.contents = value;
73654
73721
  } else if (this.contents == null) {
73655
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path61), value);
73722
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path62), value);
73656
73723
  } else if (assertCollection(this.contents)) {
73657
- this.contents.setIn(path61, value);
73724
+ this.contents.setIn(path62, value);
73658
73725
  }
73659
73726
  }
73660
73727
  /**
@@ -75617,9 +75684,9 @@ var require_cst_visit = __commonJS({
75617
75684
  visit.BREAK = BREAK;
75618
75685
  visit.SKIP = SKIP;
75619
75686
  visit.REMOVE = REMOVE;
75620
- visit.itemAtPath = (cst, path61) => {
75687
+ visit.itemAtPath = (cst, path62) => {
75621
75688
  let item = cst;
75622
- for (const [field, index] of path61) {
75689
+ for (const [field, index] of path62) {
75623
75690
  const tok = item == null ? void 0 : item[field];
75624
75691
  if (tok && "items" in tok) {
75625
75692
  item = tok.items[index];
@@ -75628,23 +75695,23 @@ var require_cst_visit = __commonJS({
75628
75695
  }
75629
75696
  return item;
75630
75697
  };
75631
- visit.parentCollection = (cst, path61) => {
75632
- const parent = visit.itemAtPath(cst, path61.slice(0, -1));
75633
- const field = path61[path61.length - 1][0];
75698
+ visit.parentCollection = (cst, path62) => {
75699
+ const parent = visit.itemAtPath(cst, path62.slice(0, -1));
75700
+ const field = path62[path62.length - 1][0];
75634
75701
  const coll = parent == null ? void 0 : parent[field];
75635
75702
  if (coll && "items" in coll)
75636
75703
  return coll;
75637
75704
  throw new Error("Parent collection not found");
75638
75705
  };
75639
- function _visit(path61, item, visitor) {
75640
- let ctrl = visitor(item, path61);
75706
+ function _visit(path62, item, visitor) {
75707
+ let ctrl = visitor(item, path62);
75641
75708
  if (typeof ctrl === "symbol")
75642
75709
  return ctrl;
75643
75710
  for (const field of ["key", "value"]) {
75644
75711
  const token = item[field];
75645
75712
  if (token && "items" in token) {
75646
75713
  for (let i = 0; i < token.items.length; ++i) {
75647
- const ci = _visit(Object.freeze(path61.concat([[field, i]])), token.items[i], visitor);
75714
+ const ci = _visit(Object.freeze(path62.concat([[field, i]])), token.items[i], visitor);
75648
75715
  if (typeof ci === "number")
75649
75716
  i = ci - 1;
75650
75717
  else if (ci === BREAK)
@@ -75655,10 +75722,10 @@ var require_cst_visit = __commonJS({
75655
75722
  }
75656
75723
  }
75657
75724
  if (typeof ctrl === "function" && field === "key")
75658
- ctrl = ctrl(item, path61);
75725
+ ctrl = ctrl(item, path62);
75659
75726
  }
75660
75727
  }
75661
- return typeof ctrl === "function" ? ctrl(item, path61) : ctrl;
75728
+ return typeof ctrl === "function" ? ctrl(item, path62) : ctrl;
75662
75729
  }
75663
75730
  exports.visit = visit;
75664
75731
  }
@@ -76945,14 +77012,14 @@ var require_parser2 = __commonJS({
76945
77012
  case "scalar":
76946
77013
  case "single-quoted-scalar":
76947
77014
  case "double-quoted-scalar": {
76948
- const fs58 = this.flowScalar(this.type);
77015
+ const fs59 = this.flowScalar(this.type);
76949
77016
  if (atNextItem || it.value) {
76950
- map2.items.push({ start, key: fs58, sep: [] });
77017
+ map2.items.push({ start, key: fs59, sep: [] });
76951
77018
  this.onKeyLine = true;
76952
77019
  } else if (it.sep) {
76953
- this.stack.push(fs58);
77020
+ this.stack.push(fs59);
76954
77021
  } else {
76955
- Object.assign(it, { key: fs58, sep: [] });
77022
+ Object.assign(it, { key: fs59, sep: [] });
76956
77023
  this.onKeyLine = true;
76957
77024
  }
76958
77025
  return;
@@ -77081,13 +77148,13 @@ var require_parser2 = __commonJS({
77081
77148
  case "scalar":
77082
77149
  case "single-quoted-scalar":
77083
77150
  case "double-quoted-scalar": {
77084
- const fs58 = this.flowScalar(this.type);
77151
+ const fs59 = this.flowScalar(this.type);
77085
77152
  if (!it || it.value)
77086
- fc.items.push({ start: [], key: fs58, sep: [] });
77153
+ fc.items.push({ start: [], key: fs59, sep: [] });
77087
77154
  else if (it.sep)
77088
- this.stack.push(fs58);
77155
+ this.stack.push(fs59);
77089
77156
  else
77090
- Object.assign(it, { key: fs58, sep: [] });
77157
+ Object.assign(it, { key: fs59, sep: [] });
77091
77158
  return;
77092
77159
  }
77093
77160
  case "flow-map-end":
@@ -77453,7 +77520,7 @@ var require_pend = __commonJS({
77453
77520
  // node_modules/yauzl/fd-slicer.js
77454
77521
  var require_fd_slicer = __commonJS({
77455
77522
  "node_modules/yauzl/fd-slicer.js"(exports) {
77456
- var fs58 = __require("fs");
77523
+ var fs59 = __require("fs");
77457
77524
  var util2 = __require("util");
77458
77525
  var stream = __require("stream");
77459
77526
  var Readable2 = stream.Readable;
@@ -77473,7 +77540,7 @@ var require_fd_slicer = __commonJS({
77473
77540
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
77474
77541
  var self2 = this;
77475
77542
  self2.pend.go(function(cb) {
77476
- fs58.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
77543
+ fs59.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
77477
77544
  cb();
77478
77545
  callback(err, bytesRead, buffer2);
77479
77546
  });
@@ -77490,7 +77557,7 @@ var require_fd_slicer = __commonJS({
77490
77557
  self2.refCount -= 1;
77491
77558
  if (self2.refCount < 0) throw new Error("invalid unref");
77492
77559
  if (self2.refCount > 0) return;
77493
- fs58.close(self2.fd, onCloseDone);
77560
+ fs59.close(self2.fd, onCloseDone);
77494
77561
  function onCloseDone(err) {
77495
77562
  if (err) {
77496
77563
  self2.emit("error", err);
@@ -77522,7 +77589,7 @@ var require_fd_slicer = __commonJS({
77522
77589
  }
77523
77590
  self2.context.pend.go(function(cb) {
77524
77591
  var buffer = Buffer.allocUnsafe(toRead);
77525
- fs58.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
77592
+ fs59.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
77526
77593
  if (err) {
77527
77594
  self2.destroy(err);
77528
77595
  } else if (bytesRead === 0) {
@@ -77882,7 +77949,7 @@ var require_crc32 = __commonJS({
77882
77949
  // node_modules/yauzl/index.js
77883
77950
  var require_yauzl = __commonJS({
77884
77951
  "node_modules/yauzl/index.js"(exports) {
77885
- var fs58 = __require("fs");
77952
+ var fs59 = __require("fs");
77886
77953
  var zlib = __require("zlib");
77887
77954
  var fd_slicer = require_fd_slicer();
77888
77955
  var util2 = __require("util");
@@ -77907,9 +77974,9 @@ var require_yauzl = __commonJS({
77907
77974
  exports.Entry = Entry;
77908
77975
  exports.LocalFileHeader = LocalFileHeader;
77909
77976
  exports.RandomAccessReader = RandomAccessReader;
77910
- function openPromise(path61, options3) {
77977
+ function openPromise(path62, options3) {
77911
77978
  return new Promise((resolve, reject) => {
77912
- open(path61, { ...options3, lazyEntries: true }, function(err, zipfile) {
77979
+ open(path62, { ...options3, lazyEntries: true }, function(err, zipfile) {
77913
77980
  if (err) return reject(err);
77914
77981
  resolve(zipfile);
77915
77982
  });
@@ -77939,7 +78006,7 @@ var require_yauzl = __commonJS({
77939
78006
  });
77940
78007
  });
77941
78008
  }
77942
- function open(path61, options3, callback) {
78009
+ function open(path62, options3, callback) {
77943
78010
  if (typeof options3 === "function") {
77944
78011
  callback = options3;
77945
78012
  options3 = null;
@@ -77951,10 +78018,10 @@ var require_yauzl = __commonJS({
77951
78018
  if (options3.validateEntrySizes == null) options3.validateEntrySizes = true;
77952
78019
  if (options3.strictFileNames == null) options3.strictFileNames = false;
77953
78020
  if (callback == null) callback = defaultCallback;
77954
- fs58.open(path61, "r", function(err, fd) {
78021
+ fs59.open(path62, "r", function(err, fd) {
77955
78022
  if (err) return callback(err);
77956
78023
  fromFd(fd, options3, function(err2, zipfile) {
77957
- if (err2) fs58.close(fd, defaultCallback);
78024
+ if (err2) fs59.close(fd, defaultCallback);
77958
78025
  callback(err2, zipfile);
77959
78026
  });
77960
78027
  });
@@ -77971,7 +78038,7 @@ var require_yauzl = __commonJS({
77971
78038
  if (options3.validateEntrySizes == null) options3.validateEntrySizes = true;
77972
78039
  if (options3.strictFileNames == null) options3.strictFileNames = false;
77973
78040
  if (callback == null) callback = defaultCallback;
77974
- fs58.fstat(fd, function(err, stats) {
78041
+ fs59.fstat(fd, function(err, stats) {
77975
78042
  if (err) return callback(err);
77976
78043
  var reader = new fd_slicer.FdSlicer(fd);
77977
78044
  fromRandomAccessReader(reader, stats.size, options3, callback);
@@ -78745,9 +78812,9 @@ init_mcp();
78745
78812
  init_config();
78746
78813
  import { spawnSync as spawnSync9 } from "node:child_process";
78747
78814
  import crypto5 from "node:crypto";
78748
- import fs56 from "node:fs";
78749
- import os14 from "node:os";
78750
- import path58 from "node:path";
78815
+ import fs57 from "node:fs";
78816
+ import os13 from "node:os";
78817
+ import path59 from "node:path";
78751
78818
  import readline from "node:readline/promises";
78752
78819
  import { stdin as input, stdout as output } from "node:process";
78753
78820
  import { pathToFileURL as pathToFileURL2 } from "node:url";
@@ -79113,16 +79180,16 @@ init_diagnosticRedaction();
79113
79180
  init_identify();
79114
79181
  init_pluginDistribution();
79115
79182
  import { spawnSync as spawnSync8 } from "node:child_process";
79116
- import fs51 from "node:fs";
79117
- import os10 from "node:os";
79118
- import path53 from "node:path";
79183
+ import fs52 from "node:fs";
79184
+ import os9 from "node:os";
79185
+ import path54 from "node:path";
79119
79186
  import { fileURLToPath as fileURLToPath4 } from "node:url";
79120
79187
 
79121
79188
  // src/maker/cli/dshMcpConfig.ts
79122
79189
  var import_yaml = __toESM(require_dist2());
79123
- import fs50 from "node:fs";
79124
- import os9 from "node:os";
79125
- import path52 from "node:path";
79190
+ import fs51 from "node:fs";
79191
+ import os8 from "node:os";
79192
+ import path53 from "node:path";
79126
79193
  var DSH_MCP_PLUGIN_NAME = "@deepseek-ai/dsh-mcp-client";
79127
79194
  var DSH_MAKER_PLUGIN_ID = "mcp-taptap-maker";
79128
79195
  var DSH_MAKER_TOOL_CALL_TIMEOUT_MS = 60 * 60 * 1e3;
@@ -79130,10 +79197,10 @@ function getDshHome(options3 = {}) {
79130
79197
  var _a3;
79131
79198
  const configured = (_a3 = (options3.environment || process.env).DSH_HOME) == null ? void 0 : _a3.trim();
79132
79199
  if (configured) {
79133
- const expanded = configured === "~" ? options3.homeDir || os9.homedir() : configured.startsWith("~/") || configured.startsWith("~\\") ? path52.join(options3.homeDir || os9.homedir(), configured.slice(2)) : configured;
79134
- return path52.resolve(expanded);
79200
+ const expanded = configured === "~" ? options3.homeDir || os8.homedir() : configured.startsWith("~/") || configured.startsWith("~\\") ? path53.join(options3.homeDir || os8.homedir(), configured.slice(2)) : configured;
79201
+ return path53.resolve(expanded);
79135
79202
  }
79136
- return path52.join(options3.homeDir || os9.homedir(), ".dsh");
79203
+ return path53.join(options3.homeDir || os8.homedir(), ".dsh");
79137
79204
  }
79138
79205
  function createDshMakerPluginConfig(options3) {
79139
79206
  return {
@@ -79151,8 +79218,8 @@ function createDshMakerPluginConfig(options3) {
79151
79218
  };
79152
79219
  }
79153
79220
  function mergeDshMakerMcpConfig(configPath, desired) {
79154
- const existed = fs50.existsSync(configPath);
79155
- const previousContent = existed ? fs50.readFileSync(configPath, "utf8") : "[]\n";
79221
+ const existed = fs51.existsSync(configPath);
79222
+ const previousContent = existed ? fs51.readFileSync(configPath, "utf8") : "[]\n";
79156
79223
  const document = parseDshDocument(previousContent, configPath);
79157
79224
  const sequence = ensurePluginSequence(document, configPath);
79158
79225
  const candidates = findDshMakerPluginCandidates(
@@ -79211,7 +79278,7 @@ function findDshMakerPluginEntry(content, mcpName, source = "DSH config") {
79211
79278
  }
79212
79279
  function getDshMcpInstallPaths(options3) {
79213
79280
  const dshHome = getDshHome(options3);
79214
- const homePatchPath = path52.join(dshHome, "cordis.patch.yml");
79281
+ const homePatchPath = path53.join(dshHome, "cordis.patch.yml");
79215
79282
  const homeHasMaker = dshConfigFileHasMaker(homePatchPath, options3.mcpName);
79216
79283
  const profilePatchPaths = listDshProfilePatchPathsForInstall(dshHome).filter(
79217
79284
  (configPath) => dshConfigFileHasMaker(configPath, options3.mcpName)
@@ -79227,22 +79294,22 @@ function getDshMcpInstallPaths(options3) {
79227
79294
  return profilePatchPaths.length > 0 ? profilePatchPaths : [homePatchPath];
79228
79295
  }
79229
79296
  function listDshProfilePatchPathsForInstall(dshHome) {
79230
- const profilesDir = path52.join(dshHome, "profiles");
79297
+ const profilesDir = path53.join(dshHome, "profiles");
79231
79298
  let entries;
79232
79299
  try {
79233
- entries = fs50.readdirSync(profilesDir, { withFileTypes: true });
79300
+ entries = fs51.readdirSync(profilesDir, { withFileTypes: true });
79234
79301
  } catch (error2) {
79235
79302
  if (isMissingPathError(error2)) {
79236
79303
  return [];
79237
79304
  }
79238
79305
  throw error2;
79239
79306
  }
79240
- return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().map((profileName) => path52.join(profilesDir, profileName, "cordis.patch.yml"));
79307
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().map((profileName) => path53.join(profilesDir, profileName, "cordis.patch.yml"));
79241
79308
  }
79242
79309
  function dshConfigFileHasMaker(configPath, mcpName) {
79243
79310
  let content;
79244
79311
  try {
79245
- content = fs50.readFileSync(configPath, "utf8");
79312
+ content = fs51.readFileSync(configPath, "utf8");
79246
79313
  } catch (error2) {
79247
79314
  if (isMissingPathError(error2)) {
79248
79315
  return false;
@@ -79255,21 +79322,21 @@ function isMissingPathError(error2) {
79255
79322
  return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
79256
79323
  }
79257
79324
  function listDshMcpConfigPaths(options3) {
79258
- const dshHome = options3.dshHome || path52.join(options3.homeDir, ".dsh");
79259
- const paths = [path52.join(dshHome, "cordis.patch.yml")];
79260
- const profilesDir = path52.join(dshHome, "profiles");
79261
- if (!fs50.existsSync(profilesDir)) {
79325
+ const dshHome = options3.dshHome || path53.join(options3.homeDir, ".dsh");
79326
+ const paths = [path53.join(dshHome, "cordis.patch.yml")];
79327
+ const profilesDir = path53.join(dshHome, "profiles");
79328
+ if (!fs51.existsSync(profilesDir)) {
79262
79329
  return paths;
79263
79330
  }
79264
79331
  let profileNames = [];
79265
79332
  try {
79266
- profileNames = fs50.readdirSync(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().slice(0, 50);
79333
+ profileNames = fs51.readdirSync(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().slice(0, 50);
79267
79334
  } catch {
79268
79335
  return paths;
79269
79336
  }
79270
79337
  for (const profileName of profileNames) {
79271
- const profileDir = path52.join(profilesDir, profileName);
79272
- paths.push(path52.join(profileDir, "cordis.patch.yml"), path52.join(profileDir, "cordis.yml"));
79338
+ const profileDir = path53.join(profilesDir, profileName);
79339
+ paths.push(path53.join(profileDir, "cordis.patch.yml"), path53.join(profileDir, "cordis.yml"));
79273
79340
  }
79274
79341
  return paths;
79275
79342
  }
@@ -79321,14 +79388,14 @@ function findDshMakerPluginCandidates(patches, mcpName) {
79321
79388
  }
79322
79389
  function writeDshConfigWithBackup(configPath, previousContent, existed, nextContent, desired) {
79323
79390
  const backupPath = existed ? `${configPath}.taptap-maker.bak.latest` : void 0;
79324
- fs50.mkdirSync(path52.dirname(configPath), { recursive: true });
79391
+ fs51.mkdirSync(path53.dirname(configPath), { recursive: true });
79325
79392
  if (backupPath) {
79326
- fs50.writeFileSync(backupPath, previousContent, "utf8");
79393
+ fs51.writeFileSync(backupPath, previousContent, "utf8");
79327
79394
  }
79328
79395
  try {
79329
- fs50.writeFileSync(configPath, nextContent, "utf8");
79396
+ fs51.writeFileSync(configPath, nextContent, "utf8");
79330
79397
  const written = findDshMakerPluginEntry(
79331
- fs50.readFileSync(configPath, "utf8"),
79398
+ fs51.readFileSync(configPath, "utf8"),
79332
79399
  desired.config.serverName,
79333
79400
  configPath
79334
79401
  );
@@ -79340,9 +79407,9 @@ function writeDshConfigWithBackup(configPath, previousContent, existed, nextCont
79340
79407
  return { changed: true, backupPath };
79341
79408
  } catch (error2) {
79342
79409
  if (existed) {
79343
- fs50.writeFileSync(configPath, previousContent, "utf8");
79410
+ fs51.writeFileSync(configPath, previousContent, "utf8");
79344
79411
  } else {
79345
- fs50.rmSync(configPath, { force: true });
79412
+ fs51.rmSync(configPath, { force: true });
79346
79413
  }
79347
79414
  throw error2;
79348
79415
  }
@@ -79428,7 +79495,7 @@ function inspectMakerMcpClientConfig(options3) {
79428
79495
  if (!configPaths) {
79429
79496
  return { ide, status: "unsupported", entries: [] };
79430
79497
  }
79431
- const entries = configPaths.filter((configPath) => fs51.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, options3.mcpName || MAKER_MCP_NAME));
79498
+ const entries = configPaths.filter((configPath) => fs52.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, options3.mcpName || MAKER_MCP_NAME));
79432
79499
  const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
79433
79500
  return { ide, status, entries };
79434
79501
  }
@@ -79442,15 +79509,15 @@ function resolveMakerMcpReportRuntime(options3) {
79442
79509
  `${pluginDistribution.displayName} plugin diagnostics require the active Maker bundle URL.`
79443
79510
  );
79444
79511
  }
79445
- const bundlePath = path53.resolve(fileURLToPath4(options3.bundleUrl));
79446
- const pluginRoot = path53.dirname(path53.dirname(bundlePath));
79512
+ const bundlePath = path54.resolve(fileURLToPath4(options3.bundleUrl));
79513
+ const pluginRoot = path54.dirname(path54.dirname(bundlePath));
79447
79514
  const execPath = options3.execPath ?? process.execPath;
79448
79515
  return {
79449
79516
  distribution: pluginDistribution.id,
79450
79517
  client: pluginDistribution.client,
79451
79518
  config_source: {
79452
79519
  format: "json",
79453
- paths: [path53.join(pluginRoot, ".mcp.json")],
79520
+ paths: [path54.join(pluginRoot, ".mcp.json")],
79454
79521
  mcp_name: "taptap-maker-plugin"
79455
79522
  },
79456
79523
  launcher: {
@@ -79501,9 +79568,9 @@ function buildMakerMcpIssue(options3) {
79501
79568
  async function collectMakerMcpIssueDiagnostics(options3) {
79502
79569
  var _a3, _b;
79503
79570
  const platform = options3.platform || process.platform;
79504
- const homeDir = options3.homeDir || os10.homedir();
79505
- const processCwd = path53.resolve(options3.processCwd || process.cwd());
79506
- const targetDir = path53.resolve(options3.targetDir);
79571
+ const homeDir = options3.homeDir || os9.homedir();
79572
+ const processCwd = path54.resolve(options3.processCwd || process.cwd());
79573
+ const targetDir = path54.resolve(options3.targetDir);
79507
79574
  const identify = identifyMakerProject({ cwd: targetDir });
79508
79575
  const projectContext = identify.projectRoot ? {
79509
79576
  status: "bound",
@@ -79583,29 +79650,29 @@ function submitMakerMcpIssue(issue3, options3 = {}) {
79583
79650
  function getMcpConfigPaths(options3) {
79584
79651
  const { ide, homeDir, platform } = options3;
79585
79652
  if (ide === "codex") {
79586
- return [path53.join(homeDir, ".codex", "config.toml")];
79653
+ return [path54.join(homeDir, ".codex", "config.toml")];
79587
79654
  }
79588
79655
  if (ide === "cursor") {
79589
- return [path53.join(homeDir, ".cursor", "mcp.json")];
79656
+ return [path54.join(homeDir, ".cursor", "mcp.json")];
79590
79657
  }
79591
79658
  if (ide === "claude") {
79592
- return [path53.join(homeDir, ".claude.json")];
79659
+ return [path54.join(homeDir, ".claude.json")];
79593
79660
  }
79594
79661
  if (ide === "opencode") {
79595
- return [path53.join(homeDir, ".config", "opencode", "opencode.jsonc")];
79662
+ return [path54.join(homeDir, ".config", "opencode", "opencode.jsonc")];
79596
79663
  }
79597
79664
  if (ide === "workbuddy") {
79598
- const primary = path53.join(homeDir, ".workbuddy", "mcp.json");
79599
- if (fs51.existsSync(primary)) {
79665
+ const primary = path54.join(homeDir, ".workbuddy", "mcp.json");
79666
+ if (fs52.existsSync(primary)) {
79600
79667
  return [primary];
79601
79668
  }
79602
- const legacy = path53.join(homeDir, ".workbuddy", ".mcp.json");
79603
- return fs51.existsSync(legacy) ? [legacy] : [primary];
79669
+ const legacy = path54.join(homeDir, ".workbuddy", ".mcp.json");
79670
+ return fs52.existsSync(legacy) ? [legacy] : [primary];
79604
79671
  }
79605
79672
  if (ide === "trae") {
79606
- const root2 = platform === "win32" ? options3.appData || path53.join(homeDir, "AppData", "Roaming") : path53.join(homeDir, "Library", "Application Support");
79673
+ const root2 = platform === "win32" ? options3.appData || path54.join(homeDir, "AppData", "Roaming") : path54.join(homeDir, "Library", "Application Support");
79607
79674
  return ["TRAE SOLO", "TRAE SOLO CN", "Trae", "TRAE", "Trae CN"].map(
79608
- (name) => path53.join(root2, name, "User", "mcp.json")
79675
+ (name) => path54.join(root2, name, "User", "mcp.json")
79609
79676
  );
79610
79677
  }
79611
79678
  if (ide === "dsh") {
@@ -79616,7 +79683,7 @@ function getMcpConfigPaths(options3) {
79616
79683
  function inspectMcpConfigFile(configPath, ide, mcpName, format) {
79617
79684
  try {
79618
79685
  const resolvedFormat = format ?? (ide === "codex" ? "codex_toml" : ide === "dsh" ? "dsh" : ide === "opencode" ? "jsonc" : "json");
79619
- const content = fs51.readFileSync(configPath, "utf8");
79686
+ const content = fs52.readFileSync(configPath, "utf8");
79620
79687
  const server = resolvedFormat === "codex_toml" ? extractCodexMcpServerConfig(content, mcpName) : resolvedFormat === "dsh" ? extractDshMcpServerConfig(content, mcpName, configPath) : extractMakerMcpServerConfig(
79621
79688
  parseJsonConfig(content, resolvedFormat === "jsonc"),
79622
79689
  mcpName
@@ -79627,7 +79694,7 @@ function inspectMcpConfigFile(configPath, ide, mcpName, format) {
79627
79694
  }
79628
79695
  }
79629
79696
  function inspectMakerMcpConfigSource(ide, source) {
79630
- const entries = source.paths.filter((configPath) => fs51.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
79697
+ const entries = source.paths.filter((configPath) => fs52.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
79631
79698
  const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
79632
79699
  return { ide, status, entries };
79633
79700
  }
@@ -79844,13 +79911,13 @@ function inspectWorkBuddyTrust(homeDir, mcpName) {
79844
79911
  pending_accounts: 0,
79845
79912
  unreadable_accounts: 0
79846
79913
  };
79847
- const connectorsDir = path53.join(homeDir, ".workbuddy", "connectors");
79848
- if (!fs51.existsSync(connectorsDir)) {
79914
+ const connectorsDir = path54.join(homeDir, ".workbuddy", "connectors");
79915
+ if (!fs52.existsSync(connectorsDir)) {
79849
79916
  return { status: "not_found", ...emptyCounts };
79850
79917
  }
79851
79918
  let entries;
79852
79919
  try {
79853
- entries = fs51.readdirSync(connectorsDir, { withFileTypes: true });
79920
+ entries = fs52.readdirSync(connectorsDir, { withFileTypes: true });
79854
79921
  } catch {
79855
79922
  return { status: "unreadable", ...emptyCounts };
79856
79923
  }
@@ -79859,12 +79926,12 @@ function inspectWorkBuddyTrust(homeDir, mcpName) {
79859
79926
  if (!entry.isDirectory()) {
79860
79927
  continue;
79861
79928
  }
79862
- const statePath = path53.join(connectorsDir, entry.name, "connector-states.json");
79863
- if (!fs51.existsSync(statePath)) {
79929
+ const statePath = path54.join(connectorsDir, entry.name, "connector-states.json");
79930
+ if (!fs52.existsSync(statePath)) {
79864
79931
  continue;
79865
79932
  }
79866
79933
  try {
79867
- const state = JSON.parse(fs51.readFileSync(statePath, "utf8"));
79934
+ const state = JSON.parse(fs52.readFileSync(statePath, "utf8"));
79868
79935
  if (!isRecord4(state)) {
79869
79936
  counts.accounts_checked += 1;
79870
79937
  counts.unreadable_accounts += 1;
@@ -80062,9 +80129,9 @@ function stripControlCharacters(value) {
80062
80129
 
80063
80130
  // src/maker/cli/pluginMigration.ts
80064
80131
  init_storage();
80065
- import fs53 from "node:fs";
80066
- import os11 from "node:os";
80067
- import path55 from "node:path";
80132
+ import fs54 from "node:fs";
80133
+ import os10 from "node:os";
80134
+ import path56 from "node:path";
80068
80135
  import crypto3 from "node:crypto";
80069
80136
 
80070
80137
  // src/maker/cli/codexMcpConfig.ts
@@ -80271,28 +80338,28 @@ function escapeRegExp3(value) {
80271
80338
  }
80272
80339
 
80273
80340
  // src/maker/cli/configWrite.ts
80274
- import fs52 from "node:fs";
80275
- import path54 from "node:path";
80341
+ import fs53 from "node:fs";
80342
+ import path55 from "node:path";
80276
80343
  function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate2) {
80277
- const existed = fs52.existsSync(filePath);
80278
- const previousContent = existed ? fs52.readFileSync(filePath, "utf8") : void 0;
80344
+ const existed = fs53.existsSync(filePath);
80345
+ const previousContent = existed ? fs53.readFileSync(filePath, "utf8") : void 0;
80279
80346
  if (previousContent === nextContent) {
80280
80347
  return { changed: false };
80281
80348
  }
80282
80349
  const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
80283
- fs52.mkdirSync(path54.dirname(filePath), { recursive: true });
80350
+ fs53.mkdirSync(path55.dirname(filePath), { recursive: true });
80284
80351
  if (previousContent !== void 0 && backupPath) {
80285
- fs52.writeFileSync(backupPath, previousContent, "utf8");
80352
+ fs53.writeFileSync(backupPath, previousContent, "utf8");
80286
80353
  }
80287
80354
  try {
80288
- fs52.writeFileSync(filePath, nextContent, "utf8");
80289
- validate2 == null ? void 0 : validate2(fs52.readFileSync(filePath, "utf8"));
80355
+ fs53.writeFileSync(filePath, nextContent, "utf8");
80356
+ validate2 == null ? void 0 : validate2(fs53.readFileSync(filePath, "utf8"));
80290
80357
  return { changed: true, backupPath };
80291
80358
  } catch (error2) {
80292
80359
  if (previousContent !== void 0) {
80293
- fs52.writeFileSync(filePath, previousContent, "utf8");
80360
+ fs53.writeFileSync(filePath, previousContent, "utf8");
80294
80361
  } else {
80295
- fs52.rmSync(filePath, { force: true });
80362
+ fs53.rmSync(filePath, { force: true });
80296
80363
  }
80297
80364
  throw error2;
80298
80365
  }
@@ -80300,11 +80367,11 @@ function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate2)
80300
80367
 
80301
80368
  // src/maker/cli/pluginMigration.ts
80302
80369
  function inspectCodexLegacyMakerMcp(options3 = {}) {
80303
- const configPath = options3.configPath ?? path55.join(os11.homedir(), ".codex", "config.toml");
80304
- if (!fs53.existsSync(configPath)) {
80370
+ const configPath = options3.configPath ?? path56.join(os10.homedir(), ".codex", "config.toml");
80371
+ if (!fs54.existsSync(configPath)) {
80305
80372
  return createInspection(configPath, "not_found", 0);
80306
80373
  }
80307
- const content = fs53.readFileSync(configPath, "utf8");
80374
+ const content = fs54.readFileSync(configPath, "utf8");
80308
80375
  const registrations = findCodexMakerMainTables(content);
80309
80376
  if (registrations.length === 0) {
80310
80377
  return createInspection(configPath, "not_found", 0);
@@ -80319,7 +80386,7 @@ function inspectCodexLegacyMakerMcp(options3 = {}) {
80319
80386
  };
80320
80387
  }
80321
80388
  function migrateCodexLegacyMakerMcp(options3 = {}) {
80322
- const configPath = options3.configPath ?? path55.join(os11.homedir(), ".codex", "config.toml");
80389
+ const configPath = options3.configPath ?? path56.join(os10.homedir(), ".codex", "config.toml");
80323
80390
  const makerHome = options3.makerHome ?? getMakerHome();
80324
80391
  const statePath = getCodexPluginMigrationStatePath(makerHome);
80325
80392
  const inspection = inspectCodexLegacyMakerMcp({ configPath });
@@ -80333,7 +80400,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
80333
80400
  }
80334
80401
  if (inspection.status === "disabled") {
80335
80402
  const state2 = readMigrationState(statePath);
80336
- const content = fs53.readFileSync(configPath, "utf8");
80403
+ const content = fs54.readFileSync(configPath, "utf8");
80337
80404
  const registration2 = findCodexMakerMainTables(content)[0];
80338
80405
  const owned = (state2 == null ? void 0 : state2.config_path) === configPath && sha256(readCodexMakerRegistration(content, registration2)) === state2.migrated_registration_sha256;
80339
80406
  return {
@@ -80346,7 +80413,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
80346
80413
  if (!options3.confirm) {
80347
80414
  throw new Error("Disabling the legacy Codex Maker MCP requires explicit confirmation.");
80348
80415
  }
80349
- const previousContent = fs53.readFileSync(configPath, "utf8");
80416
+ const previousContent = fs54.readFileSync(configPath, "utf8");
80350
80417
  const registration = findCodexMakerMainTables(previousContent)[0];
80351
80418
  const nextContent = disableCodexMakerRegistration(previousContent, registration);
80352
80419
  const state = {
@@ -80360,13 +80427,13 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
80360
80427
  ),
80361
80428
  migrated_at: (/* @__PURE__ */ new Date()).toISOString()
80362
80429
  };
80363
- fs53.mkdirSync(path55.dirname(statePath), { recursive: true });
80430
+ fs54.mkdirSync(path56.dirname(statePath), { recursive: true });
80364
80431
  const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
80365
80432
  const migratedInspection = inspectCodexLegacyMakerMcp({ configPath });
80366
80433
  if (migratedInspection.status !== "disabled") {
80367
80434
  throw new Error("Codex Maker MCP migration validation did not find a disabled registration.");
80368
80435
  }
80369
- fs53.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
80436
+ fs54.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
80370
80437
  `, "utf8");
80371
80438
  });
80372
80439
  return {
@@ -80378,7 +80445,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
80378
80445
  };
80379
80446
  }
80380
80447
  function restoreCodexLegacyMakerMcp(options3 = {}) {
80381
- const configPath = options3.configPath ?? path55.join(os11.homedir(), ".codex", "config.toml");
80448
+ const configPath = options3.configPath ?? path56.join(os10.homedir(), ".codex", "config.toml");
80382
80449
  const makerHome = options3.makerHome ?? getMakerHome();
80383
80450
  const statePath = getCodexPluginMigrationStatePath(makerHome);
80384
80451
  const inspection = inspectCodexLegacyMakerMcp({ configPath });
@@ -80399,14 +80466,14 @@ function restoreCodexLegacyMakerMcp(options3 = {}) {
80399
80466
  "The migrated Codex Maker MCP registration no longer exists and cannot be restored."
80400
80467
  );
80401
80468
  }
80402
- const previousContent = fs53.readFileSync(configPath, "utf8");
80469
+ const previousContent = fs54.readFileSync(configPath, "utf8");
80403
80470
  const registration = findCodexMakerMainTables(previousContent)[0];
80404
80471
  const registrationSha256 = sha256(readCodexMakerRegistration(previousContent, registration));
80405
80472
  if (inspection.status === "active") {
80406
80473
  if (registrationSha256 !== state.original_registration_sha256) {
80407
80474
  return { ...inspection, action: "not_owned", changed: false };
80408
80475
  }
80409
- fs53.unlinkSync(statePath);
80476
+ fs54.unlinkSync(statePath);
80410
80477
  return { ...inspection, action: "already_restored", changed: false };
80411
80478
  }
80412
80479
  if (registrationSha256 !== state.migrated_registration_sha256) {
@@ -80420,12 +80487,12 @@ function restoreCodexLegacyMakerMcp(options3 = {}) {
80420
80487
  "Codex Maker MCP restoration validation did not find an active registration."
80421
80488
  );
80422
80489
  }
80423
- const restoredContent = fs53.readFileSync(configPath, "utf8");
80490
+ const restoredContent = fs54.readFileSync(configPath, "utf8");
80424
80491
  const restoredRegistration = findCodexMakerMainTables(restoredContent)[0];
80425
80492
  if (sha256(readCodexMakerRegistration(restoredContent, restoredRegistration)) !== state.original_registration_sha256) {
80426
80493
  throw new Error("Codex Maker MCP restoration changed the migrated registration identity.");
80427
80494
  }
80428
- fs53.unlinkSync(statePath);
80495
+ fs54.unlinkSync(statePath);
80429
80496
  });
80430
80497
  return {
80431
80498
  ...inspectCodexLegacyMakerMcp({ configPath }),
@@ -80488,14 +80555,14 @@ function readCodexMakerRegistration(content, registration) {
80488
80555
  return content.slice(registration.headerStart, registration.bodyEnd).trimEnd();
80489
80556
  }
80490
80557
  function getCodexPluginMigrationStatePath(makerHome) {
80491
- return path55.join(makerHome, "plugin-migrations", "codex.json");
80558
+ return path56.join(makerHome, "plugin-migrations", "codex.json");
80492
80559
  }
80493
80560
  function readMigrationState(statePath) {
80494
- if (!fs53.existsSync(statePath)) {
80561
+ if (!fs54.existsSync(statePath)) {
80495
80562
  return void 0;
80496
80563
  }
80497
80564
  try {
80498
- const state = JSON.parse(fs53.readFileSync(statePath, "utf8"));
80565
+ const state = JSON.parse(fs54.readFileSync(statePath, "utf8"));
80499
80566
  return (state == null ? void 0 : state.schema_version) === 2 && state.client === "codex" ? state : void 0;
80500
80567
  } catch {
80501
80568
  return void 0;
@@ -80585,7 +80652,7 @@ function migrateWorkBuddyLegacyMakerMcp(options3 = {}) {
80585
80652
  migrated_registration_sha256: hashWorkBuddyRegistration(migratedRegistration),
80586
80653
  migrated_at: (/* @__PURE__ */ new Date()).toISOString()
80587
80654
  };
80588
- fs53.mkdirSync(path55.dirname(statePath), { recursive: true });
80655
+ fs54.mkdirSync(path56.dirname(statePath), { recursive: true });
80589
80656
  const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
80590
80657
  const migrated = findWorkBuddyMakerRegistrations(configPaths).find(
80591
80658
  (entry) => entry.configPath === current.configPath
@@ -80595,7 +80662,7 @@ function migrateWorkBuddyLegacyMakerMcp(options3 = {}) {
80595
80662
  "WorkBuddy Maker MCP migration validation did not find the disabled registration."
80596
80663
  );
80597
80664
  }
80598
- fs53.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
80665
+ fs54.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
80599
80666
  `, "utf8");
80600
80667
  });
80601
80668
  const migratedInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
@@ -80649,7 +80716,7 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
80649
80716
  changed: false
80650
80717
  };
80651
80718
  }
80652
- fs53.unlinkSync(statePath);
80719
+ fs54.unlinkSync(statePath);
80653
80720
  return {
80654
80721
  ...inspection,
80655
80722
  config_path: current.configPath,
@@ -80682,7 +80749,7 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
80682
80749
  if (!restored || hashWorkBuddyRegistration(restored.registration) !== state.original_registration_sha256) {
80683
80750
  throw new Error("WorkBuddy Maker MCP restoration changed the registration identity.");
80684
80751
  }
80685
- fs53.unlinkSync(statePath);
80752
+ fs54.unlinkSync(statePath);
80686
80753
  });
80687
80754
  return {
80688
80755
  ...inspectWorkBuddyLegacyMakerMcp({ configPaths }),
@@ -80695,19 +80762,19 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
80695
80762
  }
80696
80763
  function getWorkBuddyConfigPaths(configPaths) {
80697
80764
  return configPaths ?? [
80698
- path55.join(os11.homedir(), ".workbuddy", "mcp.json"),
80699
- path55.join(os11.homedir(), ".workbuddy", ".mcp.json")
80765
+ path56.join(os10.homedir(), ".workbuddy", "mcp.json"),
80766
+ path56.join(os10.homedir(), ".workbuddy", ".mcp.json")
80700
80767
  ];
80701
80768
  }
80702
80769
  function findWorkBuddyMakerRegistrations(configPaths) {
80703
80770
  const registrations = [];
80704
80771
  for (const configPath of configPaths) {
80705
- if (!fs53.existsSync(configPath)) {
80772
+ if (!fs54.existsSync(configPath)) {
80706
80773
  continue;
80707
80774
  }
80708
80775
  let config2;
80709
80776
  try {
80710
- config2 = JSON.parse(fs53.readFileSync(configPath, "utf8"));
80777
+ config2 = JSON.parse(fs54.readFileSync(configPath, "utf8"));
80711
80778
  } catch (error2) {
80712
80779
  throw new Error(
80713
80780
  `Cannot parse WorkBuddy MCP config ${configPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
@@ -80742,14 +80809,14 @@ function setWorkBuddyMakerRegistration(config2, registration) {
80742
80809
  servers["taptap-maker"] = registration;
80743
80810
  }
80744
80811
  function getWorkBuddyPluginMigrationStatePath(makerHome) {
80745
- return path55.join(makerHome, "plugin-migrations", "workbuddy.json");
80812
+ return path56.join(makerHome, "plugin-migrations", "workbuddy.json");
80746
80813
  }
80747
80814
  function readWorkBuddyMigrationState(statePath) {
80748
- if (!fs53.existsSync(statePath)) {
80815
+ if (!fs54.existsSync(statePath)) {
80749
80816
  return void 0;
80750
80817
  }
80751
80818
  try {
80752
- const state = JSON.parse(fs53.readFileSync(statePath, "utf8"));
80819
+ const state = JSON.parse(fs54.readFileSync(statePath, "utf8"));
80753
80820
  return (state == null ? void 0 : state.schema_version) === 1 && state.client === "workbuddy" ? state : void 0;
80754
80821
  } catch {
80755
80822
  return void 0;
@@ -80774,9 +80841,9 @@ function isRecord5(value) {
80774
80841
  // src/maker/cli/dshPluginMigration.ts
80775
80842
  var import_yaml2 = __toESM(require_dist2());
80776
80843
  init_storage();
80777
- import fs54 from "node:fs";
80778
- import os12 from "node:os";
80779
- import path56 from "node:path";
80844
+ import fs55 from "node:fs";
80845
+ import os11 from "node:os";
80846
+ import path57 from "node:path";
80780
80847
  import crypto4 from "node:crypto";
80781
80848
  var DSH_MAKER_MCP_NAME = "taptap-maker";
80782
80849
  function inspectDshLegacyMakerMcp(options3 = {}) {
@@ -80809,7 +80876,7 @@ function migrateDshLegacyMakerMcp(options3 = {}) {
80809
80876
  );
80810
80877
  }
80811
80878
  const registration = registrations[0];
80812
- const previousContent = fs54.readFileSync(registration.configPath, "utf8");
80879
+ const previousContent = fs55.readFileSync(registration.configPath, "utf8");
80813
80880
  const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
80814
80881
  if (document.errors.length > 0) {
80815
80882
  throw new Error(`Invalid YAML in ${registration.configPath}: ${document.errors[0].message}`);
@@ -80824,13 +80891,13 @@ function migrateDshLegacyMakerMcp(options3 = {}) {
80824
80891
  removed_registration_sha256: sha2562(JSON.stringify(registration.registration)),
80825
80892
  migrated_at: (/* @__PURE__ */ new Date()).toISOString()
80826
80893
  };
80827
- fs54.mkdirSync(path56.dirname(statePath), { recursive: true });
80894
+ fs55.mkdirSync(path57.dirname(statePath), { recursive: true });
80828
80895
  const write = writeConfigWithTapTapBackupIfChanged(registration.configPath, nextContent, () => {
80829
80896
  const after = findDshMakerRegistrations(options3.dshHome);
80830
80897
  if (after.some((entry) => entry.configPath === registration.configPath)) {
80831
80898
  throw new Error("DSH Maker MCP migration validation still found a registration.");
80832
80899
  }
80833
- fs54.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
80900
+ fs55.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
80834
80901
  `, "utf8");
80835
80902
  });
80836
80903
  return {
@@ -80863,13 +80930,13 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
80863
80930
  const current = findDshMakerRegistrations(options3.dshHome)[0];
80864
80931
  const currentSha = sha2562(JSON.stringify(current.registration));
80865
80932
  if (currentSha === state.removed_registration_sha256) {
80866
- fs54.rmSync(statePath, { force: true });
80933
+ fs55.rmSync(statePath, { force: true });
80867
80934
  return { ...inspection, action: "already_restored", changed: false, state_path: statePath };
80868
80935
  }
80869
80936
  return { ...inspection, action: "not_owned", changed: false };
80870
80937
  }
80871
80938
  const configPath = state.config_path;
80872
- const previousContent = fs54.readFileSync(configPath, "utf8");
80939
+ const previousContent = fs55.readFileSync(configPath, "utf8");
80873
80940
  const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
80874
80941
  if (document.errors.length > 0) {
80875
80942
  throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
@@ -80882,7 +80949,7 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
80882
80949
  if (!match || sha2562(JSON.stringify(match.registration)) !== state.removed_registration_sha256) {
80883
80950
  throw new Error("DSH Maker MCP restoration changed the registration identity.");
80884
80951
  }
80885
- fs54.rmSync(statePath, { force: true });
80952
+ fs55.rmSync(statePath, { force: true });
80886
80953
  });
80887
80954
  return {
80888
80955
  ...inspectDshLegacyMakerMcp(options3),
@@ -80894,13 +80961,13 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
80894
80961
  }
80895
80962
  function findDshMakerRegistrations(dshHome) {
80896
80963
  const resolvedDshHome = dshHome || getDshHome();
80897
- const configPaths = listDshMcpConfigPaths({ homeDir: os12.homedir(), dshHome: resolvedDshHome });
80964
+ const configPaths = listDshMcpConfigPaths({ homeDir: os11.homedir(), dshHome: resolvedDshHome });
80898
80965
  const registrations = [];
80899
80966
  for (const configPath of configPaths) {
80900
- if (!fs54.existsSync(configPath)) {
80967
+ if (!fs55.existsSync(configPath)) {
80901
80968
  continue;
80902
80969
  }
80903
- const content = fs54.readFileSync(configPath, "utf8");
80970
+ const content = fs55.readFileSync(configPath, "utf8");
80904
80971
  const document = (0, import_yaml2.parseDocument)(content, { prettyErrors: true });
80905
80972
  if (document.errors.length > 0) {
80906
80973
  throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
@@ -80985,14 +81052,14 @@ function isDshMakerPluginCandidate(value) {
80985
81052
  return value.name === DSH_MCP_PLUGIN_NAME && (config2 == null ? void 0 : config2.serverName) === DSH_MAKER_MCP_NAME;
80986
81053
  }
80987
81054
  function getDshPluginMigrationStatePath(makerHome) {
80988
- return path56.join(makerHome, "plugin-migrations", "dsh.json");
81055
+ return path57.join(makerHome, "plugin-migrations", "dsh.json");
80989
81056
  }
80990
81057
  function readDshMigrationState(statePath) {
80991
- if (!fs54.existsSync(statePath)) {
81058
+ if (!fs55.existsSync(statePath)) {
80992
81059
  return void 0;
80993
81060
  }
80994
81061
  try {
80995
- const state = JSON.parse(fs54.readFileSync(statePath, "utf8"));
81062
+ const state = JSON.parse(fs55.readFileSync(statePath, "utf8"));
80996
81063
  return (state == null ? void 0 : state.schema_version) === 1 && state.client === "dsh" ? state : void 0;
80997
81064
  } catch {
80998
81065
  return void 0;
@@ -81033,9 +81100,9 @@ init_config();
81033
81100
  init_fetchTimeout();
81034
81101
  init_identify();
81035
81102
  init_storage();
81036
- import fs55 from "node:fs";
81037
- import os13 from "node:os";
81038
- import path57 from "node:path";
81103
+ import fs56 from "node:fs";
81104
+ import os12 from "node:os";
81105
+ import path58 from "node:path";
81039
81106
  import { randomUUID as randomUUID10 } from "node:crypto";
81040
81107
  import { Readable, Transform } from "node:stream";
81041
81108
  import { pipeline as pipeline2 } from "node:stream/promises";
@@ -81045,7 +81112,7 @@ var MAX_ARCHIVE_ENTRIES = 1e3;
81045
81112
  var MAX_ARCHIVE_EXTRACTED_BYTES = 128 * 1024 * 1024;
81046
81113
  async function pullMakerUserSkills(options3 = {}) {
81047
81114
  var _a3, _b;
81048
- const requestedDir = path57.resolve(options3.targetDir || process.cwd());
81115
+ const requestedDir = path58.resolve(options3.targetDir || process.cwd());
81049
81116
  const project = identifyMakerProject({ cwd: requestedDir });
81050
81117
  if (!project.projectRoot) {
81051
81118
  throw new Error(
@@ -81057,10 +81124,10 @@ async function pullMakerUserSkills(options3 = {}) {
81057
81124
  if (!token) {
81058
81125
  throw new Error("Maker authentication not found. Run `taptap-maker login` and try again.");
81059
81126
  }
81060
- const sourceDir = path57.join(project.projectRoot, ".installer", "skills");
81061
- const tempDir = fs55.mkdtempSync(path57.join(os13.tmpdir(), "taptap-maker-user-skills-"));
81062
- const archivePath = path57.join(tempDir, "user-skills.zip");
81063
- const stagingDir = path57.join(tempDir, "skills");
81127
+ const sourceDir = path58.join(project.projectRoot, ".installer", "skills");
81128
+ const tempDir = fs56.mkdtempSync(path58.join(os12.tmpdir(), "taptap-maker-user-skills-"));
81129
+ const archivePath = path58.join(tempDir, "user-skills.zip");
81130
+ const stagingDir = path58.join(tempDir, "skills");
81064
81131
  try {
81065
81132
  const response = await fetchWithTimeout(
81066
81133
  options3.fetchImpl || fetch,
@@ -81092,7 +81159,7 @@ async function pullMakerUserSkills(options3 = {}) {
81092
81159
  preservedSkills
81093
81160
  };
81094
81161
  } finally {
81095
- fs55.rmSync(tempDir, { recursive: true, force: true });
81162
+ fs56.rmSync(tempDir, { recursive: true, force: true });
81096
81163
  }
81097
81164
  }
81098
81165
  async function writeArchiveResponse(response, archivePath) {
@@ -81117,7 +81184,7 @@ async function writeArchiveResponse(response, archivePath) {
81117
81184
  await pipeline2(
81118
81185
  Readable.fromWeb(response.body),
81119
81186
  limit,
81120
- fs55.createWriteStream(archivePath, { flags: "wx" })
81187
+ fs56.createWriteStream(archivePath, { flags: "wx" })
81121
81188
  );
81122
81189
  }
81123
81190
  function validateUserSkillArchivePath(entryPath) {
@@ -81132,7 +81199,7 @@ function validateUserSkillArchivePath(entryPath) {
81132
81199
  return segments;
81133
81200
  }
81134
81201
  async function extractUserSkillsArchive(archivePath, stagingDir) {
81135
- fs55.mkdirSync(stagingDir, { recursive: true });
81202
+ fs56.mkdirSync(stagingDir, { recursive: true });
81136
81203
  const zipFile = await import_yauzl.default.openPromise(archivePath, {
81137
81204
  lazyEntries: true,
81138
81205
  decodeStrings: true,
@@ -81152,7 +81219,7 @@ async function extractUserSkillsArchive(archivePath, stagingDir) {
81152
81219
  );
81153
81220
  }
81154
81221
  const segments = validateUserSkillArchivePath(entry.fileName);
81155
- if (segments.some((segment) => path57.basename(segment).startsWith(".nfs"))) {
81222
+ if (segments.some((segment) => path58.basename(segment).startsWith(".nfs"))) {
81156
81223
  continue;
81157
81224
  }
81158
81225
  const isDirectory2 = isZipDirectory(entry);
@@ -81174,24 +81241,24 @@ async function extractUserSkillsArchive(archivePath, stagingDir) {
81174
81241
  }
81175
81242
  seenPaths.add(collisionKey);
81176
81243
  skillNames.add(segments[0]);
81177
- const destination = path57.join(stagingDir, ...segments);
81244
+ const destination = path58.join(stagingDir, ...segments);
81178
81245
  if (isDirectory2) {
81179
- fs55.mkdirSync(destination, { recursive: true });
81246
+ fs56.mkdirSync(destination, { recursive: true });
81180
81247
  continue;
81181
81248
  }
81182
- fs55.mkdirSync(path57.dirname(destination), { recursive: true });
81249
+ fs56.mkdirSync(path58.dirname(destination), { recursive: true });
81183
81250
  const input2 = await zipFile.openReadStreamPromise(entry);
81184
- await pipeline2(input2, fs55.createWriteStream(destination, { flags: "wx" }));
81251
+ await pipeline2(input2, fs56.createWriteStream(destination, { flags: "wx" }));
81185
81252
  }
81186
81253
  } finally {
81187
81254
  zipFile.close();
81188
81255
  }
81189
81256
  const installedSkills = [...skillNames].sort();
81190
81257
  for (const skillName of installedSkills) {
81191
- const definitionPath = path57.join(stagingDir, skillName, "SKILL.md");
81258
+ const definitionPath = path58.join(stagingDir, skillName, "SKILL.md");
81192
81259
  let definition;
81193
81260
  try {
81194
- definition = fs55.lstatSync(definitionPath);
81261
+ definition = fs56.lstatSync(definitionPath);
81195
81262
  } catch {
81196
81263
  throw new Error(`Maker user Skill "${skillName}" is missing SKILL.md.`);
81197
81264
  }
@@ -81225,31 +81292,31 @@ function installUserSkills(projectRoot, stagingDir, skillNames) {
81225
81292
  if (skillNames.length === 0) {
81226
81293
  return;
81227
81294
  }
81228
- const installerDir = path57.join(projectRoot, ".installer");
81229
- const sourceDir = path57.join(installerDir, "skills");
81230
- const transactionDir = path57.join(installerDir, `.user-skills-${randomUUID10()}`);
81231
- const preparedDir = path57.join(transactionDir, "prepared");
81232
- const backupDir = path57.join(transactionDir, "backup");
81295
+ const installerDir = path58.join(projectRoot, ".installer");
81296
+ const sourceDir = path58.join(installerDir, "skills");
81297
+ const transactionDir = path58.join(installerDir, `.user-skills-${randomUUID10()}`);
81298
+ const preparedDir = path58.join(transactionDir, "prepared");
81299
+ const backupDir = path58.join(transactionDir, "backup");
81233
81300
  const completed = [];
81234
81301
  let preserveTransaction = false;
81235
- fs55.mkdirSync(preparedDir, { recursive: true });
81236
- fs55.mkdirSync(sourceDir, { recursive: true });
81302
+ fs56.mkdirSync(preparedDir, { recursive: true });
81303
+ fs56.mkdirSync(sourceDir, { recursive: true });
81237
81304
  try {
81238
81305
  for (const skillName of skillNames) {
81239
- fs55.cpSync(path57.join(stagingDir, skillName), path57.join(preparedDir, skillName), {
81306
+ fs56.cpSync(path58.join(stagingDir, skillName), path58.join(preparedDir, skillName), {
81240
81307
  recursive: true
81241
81308
  });
81242
81309
  }
81243
81310
  for (const skillName of skillNames) {
81244
- const target = path57.join(sourceDir, skillName);
81245
- const backup = path57.join(backupDir, skillName);
81311
+ const target = path58.join(sourceDir, skillName);
81312
+ const backup = path58.join(backupDir, skillName);
81246
81313
  const hadExisting = pathExists2(target);
81247
81314
  if (hadExisting) {
81248
- fs55.mkdirSync(path57.dirname(backup), { recursive: true });
81249
- fs55.renameSync(target, backup);
81315
+ fs56.mkdirSync(path58.dirname(backup), { recursive: true });
81316
+ fs56.renameSync(target, backup);
81250
81317
  }
81251
81318
  completed.push({ target, backup, hadExisting });
81252
- fs55.renameSync(path57.join(preparedDir, skillName), target);
81319
+ fs56.renameSync(path58.join(preparedDir, skillName), target);
81253
81320
  }
81254
81321
  installUserSkillsForClients(projectRoot, skillNames);
81255
81322
  } catch (error2) {
@@ -81263,7 +81330,7 @@ function installUserSkills(projectRoot, stagingDir, skillNames) {
81263
81330
  throw new Error(`Failed to install Maker user Skills: ${formatError5(error2)}`);
81264
81331
  } finally {
81265
81332
  if (!preserveTransaction) {
81266
- fs55.rmSync(transactionDir, { recursive: true, force: true });
81333
+ fs56.rmSync(transactionDir, { recursive: true, force: true });
81267
81334
  }
81268
81335
  }
81269
81336
  }
@@ -81271,27 +81338,27 @@ function installUserSkillsForClients(projectRoot, skillNames) {
81271
81338
  if (skillNames.length === 0) {
81272
81339
  return;
81273
81340
  }
81274
- const sourceRoot = path57.join(projectRoot, ".installer", "skills");
81275
- const transactionDir = path57.join(
81341
+ const sourceRoot = path58.join(projectRoot, ".installer", "skills");
81342
+ const transactionDir = path58.join(
81276
81343
  projectRoot,
81277
81344
  ".installer",
81278
81345
  `.user-skill-clients-${randomUUID10()}`
81279
81346
  );
81280
- const backupRoot = path57.join(transactionDir, "backup");
81347
+ const backupRoot = path58.join(transactionDir, "backup");
81281
81348
  const changed = [];
81282
81349
  let preserveTransaction = false;
81283
81350
  try {
81284
81351
  for (const clientDir of USER_SKILL_CLIENT_DIRS) {
81285
- const targetRoot = path57.join(projectRoot, clientDir, "skills");
81286
- fs55.mkdirSync(targetRoot, { recursive: true });
81352
+ const targetRoot = path58.join(projectRoot, clientDir, "skills");
81353
+ fs56.mkdirSync(targetRoot, { recursive: true });
81287
81354
  for (const skillName of skillNames) {
81288
- const source = path57.join(sourceRoot, skillName);
81289
- const target = path57.join(targetRoot, skillName);
81290
- const backup = path57.join(backupRoot, clientDir, skillName);
81355
+ const source = path58.join(sourceRoot, skillName);
81356
+ const target = path58.join(targetRoot, skillName);
81357
+ const backup = path58.join(backupRoot, clientDir, skillName);
81291
81358
  const hadExisting = pathExists2(target);
81292
81359
  if (hadExisting) {
81293
- fs55.mkdirSync(path57.dirname(backup), { recursive: true });
81294
- fs55.renameSync(target, backup);
81360
+ fs56.mkdirSync(path58.dirname(backup), { recursive: true });
81361
+ fs56.renameSync(target, backup);
81295
81362
  }
81296
81363
  changed.push({ target, backup, hadExisting });
81297
81364
  linkOrCopySkill(source, target);
@@ -81308,7 +81375,7 @@ function installUserSkillsForClients(projectRoot, skillNames) {
81308
81375
  throw new Error(`Failed to install Maker user Skills for AI clients: ${formatError5(error2)}`);
81309
81376
  } finally {
81310
81377
  if (!preserveTransaction) {
81311
- fs55.rmSync(transactionDir, { recursive: true, force: true });
81378
+ fs56.rmSync(transactionDir, { recursive: true, force: true });
81312
81379
  }
81313
81380
  }
81314
81381
  }
@@ -81319,7 +81386,7 @@ function rollbackSkillChanges(changes) {
81319
81386
  try {
81320
81387
  removePathEntry(item.target);
81321
81388
  if (item.hadExisting && pathExists2(item.backup)) {
81322
- fs55.renameSync(item.backup, item.target);
81389
+ fs56.renameSync(item.backup, item.target);
81323
81390
  }
81324
81391
  } catch (error2) {
81325
81392
  errors.push(`${item.target}: ${formatError5(error2)}`);
@@ -81329,12 +81396,12 @@ function rollbackSkillChanges(changes) {
81329
81396
  }
81330
81397
  function linkOrCopySkill(source, target) {
81331
81398
  try {
81332
- const linkTarget = process.platform === "win32" ? source : path57.relative(path57.dirname(target), source);
81333
- fs55.symlinkSync(linkTarget, target, process.platform === "win32" ? "junction" : "dir");
81399
+ const linkTarget = process.platform === "win32" ? source : path58.relative(path58.dirname(target), source);
81400
+ fs56.symlinkSync(linkTarget, target, process.platform === "win32" ? "junction" : "dir");
81334
81401
  } catch (linkError) {
81335
81402
  removePathEntry(target);
81336
81403
  try {
81337
- fs55.cpSync(source, target, { recursive: true });
81404
+ fs56.cpSync(source, target, { recursive: true });
81338
81405
  } catch (copyError) {
81339
81406
  throw new Error(
81340
81407
  `Failed to link ${source}: ${formatError5(linkError)}; copy fallback: ${formatError5(copyError)}`
@@ -81344,12 +81411,12 @@ function linkOrCopySkill(source, target) {
81344
81411
  }
81345
81412
  function removePathEntry(value) {
81346
81413
  try {
81347
- const stat = fs55.lstatSync(value);
81414
+ const stat = fs56.lstatSync(value);
81348
81415
  if (stat.isSymbolicLink()) {
81349
- fs55.unlinkSync(value);
81416
+ fs56.unlinkSync(value);
81350
81417
  return;
81351
81418
  }
81352
- fs55.rmSync(value, { recursive: true, force: true });
81419
+ fs56.rmSync(value, { recursive: true, force: true });
81353
81420
  } catch (error2) {
81354
81421
  if (error2.code !== "ENOENT") {
81355
81422
  throw error2;
@@ -81358,7 +81425,7 @@ function removePathEntry(value) {
81358
81425
  }
81359
81426
  function listLocalSkills(sourceDir) {
81360
81427
  try {
81361
- return fs55.readdirSync(sourceDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
81428
+ return fs56.readdirSync(sourceDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
81362
81429
  } catch {
81363
81430
  return [];
81364
81431
  }
@@ -81374,7 +81441,7 @@ function createDownloadError(status) {
81374
81441
  }
81375
81442
  function pathExists2(value) {
81376
81443
  try {
81377
- fs55.lstatSync(value);
81444
+ fs56.lstatSync(value);
81378
81445
  return true;
81379
81446
  } catch {
81380
81447
  return false;
@@ -81391,7 +81458,7 @@ function hasControlCharacter(value) {
81391
81458
  }
81392
81459
 
81393
81460
  // src/maker/cli/commands.ts
81394
- var VERSION4 = true ? "0.0.37-beta.2" : "dev";
81461
+ var VERSION4 = true ? "0.0.37-beta.3" : "dev";
81395
81462
  var DEFAULT_MCP_NAME = "taptap-maker";
81396
81463
  var MAKER_NPM_PACKAGE = "@taptap/maker";
81397
81464
  var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
@@ -81622,7 +81689,7 @@ function toOptionKey(value) {
81622
81689
  }
81623
81690
  async function runInit(parsed, ctx) {
81624
81691
  rejectPackageOption(parsed);
81625
- const targetDir = path58.resolve(stringOption(parsed, "target_dir") || process.cwd());
81692
+ const targetDir = path59.resolve(stringOption(parsed, "target_dir") || process.cwd());
81626
81693
  const env = makerEnvOption(parsed);
81627
81694
  const skipConfirm = booleanOption(parsed, "skip_confirm");
81628
81695
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -81739,7 +81806,7 @@ async function runInit(parsed, ctx) {
81739
81806
  }
81740
81807
  async function runDoctor(parsed, ctx) {
81741
81808
  var _a3, _b;
81742
- const targetDir = path58.resolve(stringOption(parsed, "target_dir") || process.cwd());
81809
+ const targetDir = path59.resolve(stringOption(parsed, "target_dir") || process.cwd());
81743
81810
  const env = makerEnvOption(parsed);
81744
81811
  const git3 = checkGitEnvironment();
81745
81812
  const python = checkMakerPythonEnvironment();
@@ -81830,8 +81897,8 @@ async function runDoctor(parsed, ctx) {
81830
81897
  );
81831
81898
  }
81832
81899
  function inspectMakerDoctorExecutionContext(options3) {
81833
- const doctorCwd = path58.resolve(process.cwd());
81834
- const makerProjectDir = options3.makerProjectDir ? path58.resolve(options3.makerProjectDir) : void 0;
81900
+ const doctorCwd = path59.resolve(process.cwd());
81901
+ const makerProjectDir = options3.makerProjectDir ? path59.resolve(options3.makerProjectDir) : void 0;
81835
81902
  if (!makerProjectDir) {
81836
81903
  return {
81837
81904
  active_client_session: "not_checked",
@@ -81866,9 +81933,9 @@ function samePath2(left, right) {
81866
81933
  return normalizePathForCompare3(left) === normalizePathForCompare3(right);
81867
81934
  }
81868
81935
  function normalizePathForCompare3(value) {
81869
- const resolved = path58.resolve(value);
81936
+ const resolved = path59.resolve(value);
81870
81937
  try {
81871
- return fs56.realpathSync.native(resolved);
81938
+ return fs57.realpathSync.native(resolved);
81872
81939
  } catch {
81873
81940
  return resolved;
81874
81941
  }
@@ -82186,7 +82253,7 @@ async function runPatSet(parsed, ctx) {
82186
82253
  }
82187
82254
  async function resolvePatSet(parsed, ctx) {
82188
82255
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
82189
- const pat = fs56.readFileSync(0, "utf8").trim();
82256
+ const pat = fs57.readFileSync(0, "utf8").trim();
82190
82257
  if (!pat) {
82191
82258
  throw new Error("No PAT found on stdin.");
82192
82259
  }
@@ -82241,17 +82308,17 @@ async function prepareMcpLauncher(options3) {
82241
82308
  if (options3.mode === "self") {
82242
82309
  launcher = materializeMakerSelfLauncher({
82243
82310
  version: VERSION4,
82244
- bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL2(path58.resolve(process.cwd(), "dist", "maker.js")).href,
82311
+ bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL2(path59.resolve(process.cwd(), "dist", "maker.js")).href,
82245
82312
  makerHome: getMakerHome()
82246
82313
  });
82247
82314
  } else {
82248
82315
  const packageSpec = resolveMakerPackageSpec(MAKER_NPM_PACKAGE, VERSION4);
82249
82316
  launcher = resolveMakerMcpLauncher({ packageName: packageSpec });
82250
82317
  const configuredCache = process.env.npm_config_cache || process.env.NPM_CONFIG_CACHE;
82251
- const npmCacheDir = path58.resolve(
82252
- configuredCache || path58.join(getMakerHome(), "cache", "npm")
82318
+ const npmCacheDir = path59.resolve(
82319
+ configuredCache || path59.join(getMakerHome(), "cache", "npm")
82253
82320
  );
82254
- fs56.mkdirSync(npmCacheDir, { recursive: true });
82321
+ fs57.mkdirSync(npmCacheDir, { recursive: true });
82255
82322
  launcherEnv = { npm_config_cache: npmCacheDir };
82256
82323
  }
82257
82324
  } catch (error2) {
@@ -82384,7 +82451,7 @@ ${indent3(payload.stderr)}` : "",
82384
82451
  }
82385
82452
  async function runMcpReport(parsed, ctx) {
82386
82453
  rejectPackageOption(parsed);
82387
- const targetDir = path58.resolve(stringOption(parsed, "target_dir") || process.cwd());
82454
+ const targetDir = path59.resolve(stringOption(parsed, "target_dir") || process.cwd());
82388
82455
  const contextInput = booleanOption(parsed, "context_stdin") ? await readStdinText() : "";
82389
82456
  const context = parseMakerMcpReportContext(contextInput);
82390
82457
  const contextValidation = validateMakerMcpReportContext(context);
@@ -82459,7 +82526,7 @@ async function runMcpReport(parsed, ctx) {
82459
82526
  const issue3 = buildMakerMcpIssue({
82460
82527
  context,
82461
82528
  diagnostics,
82462
- homeDir: os14.homedir()
82529
+ homeDir: os13.homedir()
82463
82530
  });
82464
82531
  const submission = booleanOption(parsed, "consent") ? submitMakerMcpIssue(issue3) : {
82465
82532
  status: "consent_required",
@@ -82486,7 +82553,7 @@ async function runMcpReport(parsed, ctx) {
82486
82553
  );
82487
82554
  }
82488
82555
  async function runAgentsUpdate(parsed, ctx) {
82489
- const targetDir = path58.resolve(stringOption(parsed, "target_dir") || process.cwd());
82556
+ const targetDir = path59.resolve(stringOption(parsed, "target_dir") || process.cwd());
82490
82557
  const result = updateMakerAgentsPolicy(targetDir);
82491
82558
  if (ctx.json) {
82492
82559
  writeJson(result);
@@ -82505,7 +82572,7 @@ async function runAgentsUpdate(parsed, ctx) {
82505
82572
  async function runUpgrade(parsed, ctx) {
82506
82573
  rejectPackageOption(parsed);
82507
82574
  const explicitTargetDir = stringOption(parsed, "target_dir");
82508
- const targetDir = path58.resolve(explicitTargetDir || process.cwd());
82575
+ const targetDir = path59.resolve(explicitTargetDir || process.cwd());
82509
82576
  const env = makerEnvOption(parsed);
82510
82577
  const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
82511
82578
  const pluginDistribution = resolveMakerPluginDistribution();
@@ -82594,7 +82661,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
82594
82661
  ];
82595
82662
  }
82596
82663
  async function runDevKitUpdate(parsed, ctx) {
82597
- const targetDir = path58.resolve(stringOption(parsed, "target_dir") || process.cwd());
82664
+ const targetDir = path59.resolve(stringOption(parsed, "target_dir") || process.cwd());
82598
82665
  const result = await installAiDevKit({
82599
82666
  targetDir,
82600
82667
  preserveExisting: false,
@@ -82608,7 +82675,7 @@ async function runDevKitUpdate(parsed, ctx) {
82608
82675
  }
82609
82676
  async function runUserSkillsPull(parsed, ctx) {
82610
82677
  const result = await pullMakerUserSkills({
82611
- targetDir: path58.resolve(stringOption(parsed, "target_dir") || process.cwd()),
82678
+ targetDir: path59.resolve(stringOption(parsed, "target_dir") || process.cwd()),
82612
82679
  environment: makerEnvOption(parsed)
82613
82680
  });
82614
82681
  if (ctx.json) {
@@ -82627,7 +82694,7 @@ async function runUserSkillsPull(parsed, ctx) {
82627
82694
  );
82628
82695
  }
82629
82696
  async function runLogsWatch(parsed, ctx) {
82630
- const targetDir = path58.resolve(stringOption(parsed, "target_dir") || process.cwd());
82697
+ const targetDir = path59.resolve(stringOption(parsed, "target_dir") || process.cwd());
82631
82698
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
82632
82699
  const timeoutMs = numberOption2(parsed, "timeout_ms") ?? MAKER_TOOL_CALL_TIMEOUT_MS;
82633
82700
  const maxPolls = numberOption2(parsed, "max_polls");
@@ -82637,9 +82704,9 @@ async function runLogsWatch(parsed, ctx) {
82637
82704
  serverUrl: stringOption(parsed, "server_url"),
82638
82705
  env: makerEnvOption(parsed)
82639
82706
  });
82640
- const runtimeDir = path58.join(proxy.projectRoot, ".maker", "logs", "runtime");
82641
- const runtimeLog = path58.join(runtimeDir, "runtime.log");
82642
- const pidFile = path58.join(runtimeDir, "watcher.pid");
82707
+ const runtimeDir = path59.join(proxy.projectRoot, ".maker", "logs", "runtime");
82708
+ const runtimeLog = path59.join(runtimeDir, "runtime.log");
82709
+ const pidFile = path59.join(runtimeDir, "watcher.pid");
82643
82710
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
82644
82711
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
82645
82712
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -82684,10 +82751,10 @@ async function runLogsWatch(parsed, ctx) {
82684
82751
  }
82685
82752
  }
82686
82753
  function registerRuntimeLogWatcherProcess(pidFile) {
82687
- fs56.mkdirSync(path58.dirname(pidFile), { recursive: true });
82754
+ fs57.mkdirSync(path59.dirname(pidFile), { recursive: true });
82688
82755
  const existingPid = readPidFile(pidFile);
82689
82756
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
82690
- fs56.writeFileSync(
82757
+ fs57.writeFileSync(
82691
82758
  pidFile,
82692
82759
  `${JSON.stringify(
82693
82760
  {
@@ -82705,10 +82772,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
82705
82772
  return previous;
82706
82773
  }
82707
82774
  function readPidFile(pidFile) {
82708
- if (!fs56.existsSync(pidFile)) {
82775
+ if (!fs57.existsSync(pidFile)) {
82709
82776
  return void 0;
82710
82777
  }
82711
- const raw = fs56.readFileSync(pidFile, "utf8").trim();
82778
+ const raw = fs57.readFileSync(pidFile, "utf8").trim();
82712
82779
  let pid = Number(raw);
82713
82780
  if (!Number.isInteger(pid) || pid <= 0) {
82714
82781
  try {
@@ -82728,7 +82795,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
82728
82795
  }
82729
82796
  cleaned = true;
82730
82797
  if (readPidFile(pidFile) === process.pid) {
82731
- fs56.rmSync(pidFile, { force: true });
82798
+ fs57.rmSync(pidFile, { force: true });
82732
82799
  }
82733
82800
  };
82734
82801
  process.once("exit", cleanup);
@@ -82879,7 +82946,7 @@ async function prepareDevKit(targetDir, ctx, options3 = {}) {
82879
82946
  onStart: (event) => emitSkillInstallerStart(ctx, event)
82880
82947
  });
82881
82948
  writeDevKitStagedGitignore(
82882
- path58.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
82949
+ path59.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
82883
82950
  listPresentDevKitManagedEntries(targetDir)
82884
82951
  );
82885
82952
  syncWorkBuddyDevKitSkills(targetDir, ctx);
@@ -82897,7 +82964,7 @@ async function prepareDevKit(targetDir, ctx, options3 = {}) {
82897
82964
  );
82898
82965
  } catch (error2) {
82899
82966
  writeDevKitStagedGitignore(
82900
- path58.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
82967
+ path59.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
82901
82968
  listPresentDevKitManagedEntries(targetDir)
82902
82969
  );
82903
82970
  if (options3.finalizeGitignore) {
@@ -82944,10 +83011,10 @@ function syncWorkBuddyDevKitSkills(targetDir, ctx) {
82944
83011
  try {
82945
83012
  const result = syncWorkBuddyProjectSkills(targetDir);
82946
83013
  const managedSkillPaths = [...result.installedSkills, ...result.skippedSkills].map(
82947
- (skillName) => path58.join(".workbuddy", "skills", skillName)
83014
+ (skillName) => path59.join(".workbuddy", "skills", skillName)
82948
83015
  );
82949
83016
  if (managedSkillPaths.length > 0) {
82950
- writeDevKitStagedGitignore(path58.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
83017
+ writeDevKitStagedGitignore(path59.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
82951
83018
  ...listPresentDevKitManagedEntries(targetDir),
82952
83019
  ...managedSkillPaths
82953
83020
  ]);
@@ -83024,12 +83091,12 @@ function installMcpConfig(ide, options3) {
83024
83091
  }
83025
83092
  function installMcpConfigUnsafe(ide, options3) {
83026
83093
  if (ide === "codex") {
83027
- const configPath = path58.join(os14.homedir(), ".codex", "config.toml");
83094
+ const configPath = path59.join(os13.homedir(), ".codex", "config.toml");
83028
83095
  const write = mergeCodexMcpConfig(configPath, withClientIde(options3, "codex"));
83029
83096
  return [createMcpInstallResult(ide, "Codex", configPath, write)];
83030
83097
  }
83031
83098
  if (ide === "cursor") {
83032
- const configPath = path58.join(os14.homedir(), ".cursor", "mcp.json");
83099
+ const configPath = path59.join(os13.homedir(), ".cursor", "mcp.json");
83033
83100
  const write = mergeJsonMcpConfig(configPath, withClientIde(options3, "cursor"));
83034
83101
  return [createMcpInstallResult(ide, "Cursor", configPath, write)];
83035
83102
  }
@@ -83046,7 +83113,7 @@ function installMcpConfigUnsafe(ide, options3) {
83046
83113
  }
83047
83114
  ];
83048
83115
  }
83049
- const configPath = path58.join(os14.homedir(), ".claude.json");
83116
+ const configPath = path59.join(os13.homedir(), ".claude.json");
83050
83117
  const write = mergeJsonMcpConfig(configPath, claudeOptions);
83051
83118
  return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
83052
83119
  }
@@ -83060,7 +83127,7 @@ function installMcpConfigUnsafe(ide, options3) {
83060
83127
  }
83061
83128
  if (ide === "opencode") {
83062
83129
  const configPath = getOpenCodeMcpConfigPath();
83063
- if (!fs56.existsSync(configPath)) {
83130
+ if (!fs57.existsSync(configPath)) {
83064
83131
  return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
83065
83132
  }
83066
83133
  const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options3, "opencode"));
@@ -83143,13 +83210,13 @@ function getDefaultMcpInstallIdes() {
83143
83210
  if (getTraeMcpInstallPaths().length > 0) {
83144
83211
  ides.push("trae");
83145
83212
  }
83146
- if (fs56.existsSync(getOpenCodeMcpConfigPath())) {
83213
+ if (fs57.existsSync(getOpenCodeMcpConfigPath())) {
83147
83214
  ides.push("opencode");
83148
83215
  }
83149
83216
  if (getWorkBuddyMcpInstallPaths().length > 0) {
83150
83217
  ides.push("workbuddy");
83151
83218
  }
83152
- if (fs56.existsSync(getDshHome())) {
83219
+ if (fs57.existsSync(getDshHome())) {
83153
83220
  ides.push("dsh");
83154
83221
  }
83155
83222
  return ides;
@@ -83163,7 +83230,7 @@ function getExistingTraeUserConfigPaths(paths) {
83163
83230
  const seen = /* @__PURE__ */ new Set();
83164
83231
  return paths.filter((configPath) => {
83165
83232
  const key = normalizeConfigPathKey(configPath);
83166
- if (seen.has(key) || !fs56.existsSync(path58.dirname(configPath))) {
83233
+ if (seen.has(key) || !fs57.existsSync(path59.dirname(configPath))) {
83167
83234
  return false;
83168
83235
  }
83169
83236
  seen.add(key);
@@ -83174,7 +83241,7 @@ function getExistingConfigPaths(paths) {
83174
83241
  const seen = /* @__PURE__ */ new Set();
83175
83242
  return paths.filter((configPath) => {
83176
83243
  const key = normalizeConfigPathKey(configPath);
83177
- if (seen.has(key) || !fs56.existsSync(configPath)) {
83244
+ if (seen.has(key) || !fs57.existsSync(configPath)) {
83178
83245
  return false;
83179
83246
  }
83180
83247
  seen.add(key);
@@ -83182,62 +83249,62 @@ function getExistingConfigPaths(paths) {
83182
83249
  });
83183
83250
  }
83184
83251
  function normalizeConfigPathKey(configPath) {
83185
- const resolved = path58.resolve(configPath);
83252
+ const resolved = path59.resolve(configPath);
83186
83253
  return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
83187
83254
  }
83188
83255
  function getTraeSoloMcpConfigPaths() {
83189
83256
  if (process.platform === "win32") {
83190
- const roaming = process.env.APPDATA || path58.join(os14.homedir(), "AppData", "Roaming");
83257
+ const roaming = process.env.APPDATA || path59.join(os13.homedir(), "AppData", "Roaming");
83191
83258
  return [
83192
- path58.join(roaming, "TRAE SOLO", "User", "mcp.json"),
83193
- path58.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
83259
+ path59.join(roaming, "TRAE SOLO", "User", "mcp.json"),
83260
+ path59.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
83194
83261
  ];
83195
83262
  }
83196
- const appSupport = path58.join(os14.homedir(), "Library", "Application Support");
83263
+ const appSupport = path59.join(os13.homedir(), "Library", "Application Support");
83197
83264
  return [
83198
- path58.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
83199
- path58.join(appSupport, "TRAE SOLO", "User", "mcp.json")
83265
+ path59.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
83266
+ path59.join(appSupport, "TRAE SOLO", "User", "mcp.json")
83200
83267
  ];
83201
83268
  }
83202
83269
  function getTraeUnverifiedMcpConfigPaths() {
83203
83270
  if (process.platform === "win32") {
83204
- const roaming = process.env.APPDATA || path58.join(os14.homedir(), "AppData", "Roaming");
83271
+ const roaming = process.env.APPDATA || path59.join(os13.homedir(), "AppData", "Roaming");
83205
83272
  return [
83206
- path58.join(roaming, "Trae", "User", "mcp.json"),
83207
- path58.join(roaming, "TRAE", "User", "mcp.json"),
83208
- path58.join(roaming, "Trae CN", "User", "mcp.json")
83273
+ path59.join(roaming, "Trae", "User", "mcp.json"),
83274
+ path59.join(roaming, "TRAE", "User", "mcp.json"),
83275
+ path59.join(roaming, "Trae CN", "User", "mcp.json")
83209
83276
  ];
83210
83277
  }
83211
- const appSupport = path58.join(os14.homedir(), "Library", "Application Support");
83278
+ const appSupport = path59.join(os13.homedir(), "Library", "Application Support");
83212
83279
  return [
83213
- path58.join(appSupport, "Trae", "User", "mcp.json"),
83214
- path58.join(appSupport, "TRAE", "User", "mcp.json"),
83215
- path58.join(appSupport, "Trae CN", "User", "mcp.json")
83280
+ path59.join(appSupport, "Trae", "User", "mcp.json"),
83281
+ path59.join(appSupport, "TRAE", "User", "mcp.json"),
83282
+ path59.join(appSupport, "Trae CN", "User", "mcp.json")
83216
83283
  ];
83217
83284
  }
83218
83285
  function getOpenCodeMcpConfigPath() {
83219
- return path58.join(os14.homedir(), ".config", "opencode", "opencode.jsonc");
83286
+ return path59.join(os13.homedir(), ".config", "opencode", "opencode.jsonc");
83220
83287
  }
83221
83288
  function getWorkBuddyHome() {
83222
- return path58.join(os14.homedir(), ".workbuddy");
83289
+ return path59.join(os13.homedir(), ".workbuddy");
83223
83290
  }
83224
83291
  function getWorkBuddyMcpInstallPaths(options3 = {}) {
83225
- const primary = path58.join(getWorkBuddyHome(), "mcp.json");
83226
- if (fs56.existsSync(primary) || options3.createPrimary) {
83292
+ const primary = path59.join(getWorkBuddyHome(), "mcp.json");
83293
+ if (fs57.existsSync(primary) || options3.createPrimary) {
83227
83294
  return [primary];
83228
83295
  }
83229
- const legacy = path58.join(getWorkBuddyHome(), ".mcp.json");
83230
- if (fs56.existsSync(legacy)) {
83296
+ const legacy = path59.join(getWorkBuddyHome(), ".mcp.json");
83297
+ if (fs57.existsSync(legacy)) {
83231
83298
  return [legacy];
83232
83299
  }
83233
83300
  return [];
83234
83301
  }
83235
83302
  function inspectWorkBuddyTrustState(mcpName) {
83236
83303
  const workbuddyHome = getWorkBuddyHome();
83237
- const connectorsDir = path58.join(workbuddyHome, "connectors");
83304
+ const connectorsDir = path59.join(workbuddyHome, "connectors");
83238
83305
  const accounts = [];
83239
83306
  const stateFiles = [];
83240
- if (!fs56.existsSync(connectorsDir)) {
83307
+ if (!fs57.existsSync(connectorsDir)) {
83241
83308
  return {
83242
83309
  status: "not_found",
83243
83310
  mcp_name: mcpName,
@@ -83247,12 +83314,12 @@ function inspectWorkBuddyTrustState(mcpName) {
83247
83314
  accounts
83248
83315
  };
83249
83316
  }
83250
- for (const entry of fs56.readdirSync(connectorsDir, { withFileTypes: true })) {
83317
+ for (const entry of fs57.readdirSync(connectorsDir, { withFileTypes: true })) {
83251
83318
  if (!entry.isDirectory()) {
83252
83319
  continue;
83253
83320
  }
83254
- const statePath = path58.join(connectorsDir, entry.name, "connector-states.json");
83255
- if (!fs56.existsSync(statePath)) {
83321
+ const statePath = path59.join(connectorsDir, entry.name, "connector-states.json");
83322
+ if (!fs57.existsSync(statePath)) {
83256
83323
  continue;
83257
83324
  }
83258
83325
  stateFiles.push(statePath);
@@ -83331,7 +83398,7 @@ function mergeJsonMcpConfig(configPath, options3) {
83331
83398
  );
83332
83399
  }
83333
83400
  function mergeOpenCodeMcpConfig(configPath, options3) {
83334
- const rawContent = fs56.readFileSync(configPath, "utf8");
83401
+ const rawContent = fs57.readFileSync(configPath, "utf8");
83335
83402
  const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
83336
83403
  const existing = readJsonObject(configPath, { jsonc: true });
83337
83404
  const mcp = asObject(existing.mcp);
@@ -83363,7 +83430,7 @@ function mergeOpenCodeMcpConfig(configPath, options3) {
83363
83430
  return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
83364
83431
  }
83365
83432
  function mergeCodexMcpConfig(configPath, options3) {
83366
- const existing = fs56.existsSync(configPath) ? fs56.readFileSync(configPath, "utf8") : "";
83433
+ const existing = fs57.existsSync(configPath) ? fs57.readFileSync(configPath, "utf8") : "";
83367
83434
  const withoutOld = removeCodexMcpTables(existing, options3.mcpName).trimEnd();
83368
83435
  const launch = options3.launcher;
83369
83436
  const envValues = createMcpEnvironmentValues(options3.env, options3.clientIde, options3.launcherEnv);
@@ -83397,7 +83464,7 @@ function mergeCodexMcpConfig(configPath, options3) {
83397
83464
  );
83398
83465
  }
83399
83466
  function tryClaudeMcpAdd(options3) {
83400
- const configPath = path58.join(os14.homedir(), ".claude.json");
83467
+ const configPath = path59.join(os13.homedir(), ".claude.json");
83401
83468
  try {
83402
83469
  const existing = readJsonObject(configPath);
83403
83470
  const server = asObject(asObject(existing.mcpServers)[options3.mcpName]);
@@ -83490,10 +83557,10 @@ function rejectPackageOption(parsed) {
83490
83557
  }
83491
83558
  }
83492
83559
  function readJsonObject(filePath, options3 = {}) {
83493
- if (!fs56.existsSync(filePath)) {
83560
+ if (!fs57.existsSync(filePath)) {
83494
83561
  return {};
83495
83562
  }
83496
- const raw = fs56.readFileSync(filePath, "utf8");
83563
+ const raw = fs57.readFileSync(filePath, "utf8");
83497
83564
  try {
83498
83565
  const normalized = normalizeJsonConfigContent(raw, options3);
83499
83566
  const parsed = JSON.parse(normalized);
@@ -83665,10 +83732,10 @@ function formatMcpInstallMessage(label, configPath, write) {
83665
83732
  ].filter(Boolean).join("\n");
83666
83733
  }
83667
83734
  function saveInitState(targetDir, state) {
83668
- fs56.mkdirSync(getMakerHome(), { recursive: true });
83669
- const key = crypto5.createHash("sha256").update(path58.resolve(targetDir)).digest("hex").slice(0, 16);
83670
- fs56.writeFileSync(
83671
- path58.join(getMakerHome(), `init-state-${key}.json`),
83735
+ fs57.mkdirSync(getMakerHome(), { recursive: true });
83736
+ const key = crypto5.createHash("sha256").update(path59.resolve(targetDir)).digest("hex").slice(0, 16);
83737
+ fs57.writeFileSync(
83738
+ path59.join(getMakerHome(), `init-state-${key}.json`),
83672
83739
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
83673
83740
  `,
83674
83741
  "utf8"
@@ -83816,7 +83883,7 @@ function makerEnvOption(parsed) {
83816
83883
  return env;
83817
83884
  }
83818
83885
  const targetDir = stringOption(parsed, "target_dir");
83819
- return getMakerEnvironment(void 0, targetDir ? path58.resolve(targetDir) : process.cwd());
83886
+ return getMakerEnvironment(void 0, targetDir ? path59.resolve(targetDir) : process.cwd());
83820
83887
  }
83821
83888
  function makerMcpConfigEnvOption(parsed) {
83822
83889
  return stringOption(parsed, "env") === "rnd" ? "rnd" : "production";
@@ -85528,7 +85595,7 @@ var StreamableHTTPClientTransport = class {
85528
85595
 
85529
85596
  // src/mcp-proxy/proxy.ts
85530
85597
  init_types2();
85531
- import * as path60 from "node:path";
85598
+ import * as path61 from "node:path";
85532
85599
  import * as crypto8 from "node:crypto";
85533
85600
 
85534
85601
  // src/mcp-proxy/cookieJar.ts
@@ -85724,8 +85791,8 @@ function isStandaloneSseRequest(input2, init) {
85724
85791
  }
85725
85792
 
85726
85793
  // src/core/utils/logWriter.ts
85727
- import * as fs57 from "node:fs";
85728
- import * as path59 from "node:path";
85794
+ import * as fs58 from "node:fs";
85795
+ import * as path60 from "node:path";
85729
85796
  import * as crypto7 from "node:crypto";
85730
85797
 
85731
85798
  // src/core/types/log.ts
@@ -85766,7 +85833,7 @@ var LogWriter = class {
85766
85833
  return;
85767
85834
  }
85768
85835
  try {
85769
- await fs57.promises.mkdir(this.config.logDir, { recursive: true });
85836
+ await fs58.promises.mkdir(this.config.logDir, { recursive: true });
85770
85837
  await this.cleanupOldLogs();
85771
85838
  this.initialized = true;
85772
85839
  } catch (error2) {
@@ -85789,7 +85856,7 @@ var LogWriter = class {
85789
85856
  */
85790
85857
  getLogFilePath(date5) {
85791
85858
  const d = date5 || this.getCurrentDate();
85792
- return path59.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
85859
+ return path60.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
85793
85860
  }
85794
85861
  /**
85795
85862
  * 获取或创建写入流
@@ -85804,7 +85871,7 @@ var LogWriter = class {
85804
85871
  }
85805
85872
  this.currentDate = date5;
85806
85873
  try {
85807
- this.writeStream = fs57.createWriteStream(this.getLogFilePath(date5), {
85874
+ this.writeStream = fs58.createWriteStream(this.getLogFilePath(date5), {
85808
85875
  flags: "a",
85809
85876
  encoding: "utf8"
85810
85877
  });
@@ -85856,11 +85923,11 @@ var LogWriter = class {
85856
85923
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
85857
85924
  try {
85858
85925
  const filePath = this.getLogFilePath();
85859
- const dir = path59.dirname(filePath);
85860
- if (!fs57.existsSync(dir)) {
85861
- fs57.mkdirSync(dir, { recursive: true });
85926
+ const dir = path60.dirname(filePath);
85927
+ if (!fs58.existsSync(dir)) {
85928
+ fs58.mkdirSync(dir, { recursive: true });
85862
85929
  }
85863
- fs57.appendFileSync(filePath, message, "utf8");
85930
+ fs58.appendFileSync(filePath, message, "utf8");
85864
85931
  } catch {
85865
85932
  }
85866
85933
  }
@@ -85871,7 +85938,7 @@ var LogWriter = class {
85871
85938
  async cleanupOldLogs() {
85872
85939
  if (this.config.maxDays <= 0) return;
85873
85940
  try {
85874
- const files = await fs57.promises.readdir(this.config.logDir);
85941
+ const files = await fs58.promises.readdir(this.config.logDir);
85875
85942
  const cutoffDate = /* @__PURE__ */ new Date();
85876
85943
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
85877
85944
  const prefix = this.config.prefix;
@@ -85886,7 +85953,7 @@ var LogWriter = class {
85886
85953
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
85887
85954
  const fileDate = new Date(year, month - 1, day);
85888
85955
  if (fileDate < cutoffDate) {
85889
- await fs57.promises.unlink(path59.join(this.config.logDir, file3));
85956
+ await fs58.promises.unlink(path60.join(this.config.logDir, file3));
85890
85957
  process.stderr.write(`[LogWriter] Deleted old log: ${file3}
85891
85958
  `);
85892
85959
  }
@@ -86020,10 +86087,10 @@ var TapTapMCPProxy = class {
86020
86087
  const { user_id, project_id } = this.config.tenant;
86021
86088
  let logDir;
86022
86089
  if (user_id && project_id) {
86023
- logDir = path60.join(logRoot, "proxy", user_id, project_id);
86090
+ logDir = path61.join(logRoot, "proxy", user_id, project_id);
86024
86091
  } else {
86025
86092
  const kidHash = crypto8.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
86026
- logDir = path60.join(logRoot, "proxy", kidHash);
86093
+ logDir = path61.join(logRoot, "proxy", kidHash);
86027
86094
  }
86028
86095
  return new LogWriter({
86029
86096
  logDir,