@taptap/maker 0.0.24-beta.2 → 0.0.24

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
@@ -3233,8 +3233,8 @@ var require_utils = __commonJS({
3233
3233
  }
3234
3234
  return ind;
3235
3235
  }
3236
- function removeDotSegments(path20) {
3237
- let input2 = path20;
3236
+ function removeDotSegments(path21) {
3237
+ let input2 = path21;
3238
3238
  const output2 = [];
3239
3239
  let nextSlash = -1;
3240
3240
  let len = 0;
@@ -3433,8 +3433,8 @@ var require_schemes = __commonJS({
3433
3433
  wsComponent.secure = void 0;
3434
3434
  }
3435
3435
  if (wsComponent.resourceName) {
3436
- const [path20, query] = wsComponent.resourceName.split("?");
3437
- wsComponent.path = path20 && path20 !== "/" ? path20 : void 0;
3436
+ const [path21, query] = wsComponent.resourceName.split("?");
3437
+ wsComponent.path = path21 && path21 !== "/" ? path21 : void 0;
3438
3438
  wsComponent.query = query;
3439
3439
  wsComponent.resourceName = void 0;
3440
3440
  }
@@ -12491,12 +12491,12 @@ var require_dist = __commonJS({
12491
12491
  throw new Error(`Unknown format "${name}"`);
12492
12492
  return f;
12493
12493
  };
12494
- function addFormats(ajv, list, fs18, exportName) {
12494
+ function addFormats(ajv, list, fs19, exportName) {
12495
12495
  var _a3;
12496
12496
  var _b;
12497
12497
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
12498
12498
  for (const f of list)
12499
- ajv.addFormat(f, fs18[f]);
12499
+ ajv.addFormat(f, fs19[f]);
12500
12500
  }
12501
12501
  module.exports = exports = formatsPlugin;
12502
12502
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -12509,8 +12509,8 @@ var require_windows = __commonJS({
12509
12509
  "node_modules/isexe/windows.js"(exports, module) {
12510
12510
  module.exports = isexe;
12511
12511
  isexe.sync = sync;
12512
- var fs18 = __require("fs");
12513
- function checkPathExt(path20, options) {
12512
+ var fs19 = __require("fs");
12513
+ function checkPathExt(path21, options) {
12514
12514
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
12515
12515
  if (!pathext) {
12516
12516
  return true;
@@ -12521,25 +12521,25 @@ var require_windows = __commonJS({
12521
12521
  }
12522
12522
  for (var i = 0; i < pathext.length; i++) {
12523
12523
  var p = pathext[i].toLowerCase();
12524
- if (p && path20.substr(-p.length).toLowerCase() === p) {
12524
+ if (p && path21.substr(-p.length).toLowerCase() === p) {
12525
12525
  return true;
12526
12526
  }
12527
12527
  }
12528
12528
  return false;
12529
12529
  }
12530
- function checkStat(stat, path20, options) {
12530
+ function checkStat(stat, path21, options) {
12531
12531
  if (!stat.isSymbolicLink() && !stat.isFile()) {
12532
12532
  return false;
12533
12533
  }
12534
- return checkPathExt(path20, options);
12534
+ return checkPathExt(path21, options);
12535
12535
  }
12536
- function isexe(path20, options, cb) {
12537
- fs18.stat(path20, function(er, stat) {
12538
- cb(er, er ? false : checkStat(stat, path20, options));
12536
+ function isexe(path21, options, cb) {
12537
+ fs19.stat(path21, function(er, stat) {
12538
+ cb(er, er ? false : checkStat(stat, path21, options));
12539
12539
  });
12540
12540
  }
12541
- function sync(path20, options) {
12542
- return checkStat(fs18.statSync(path20), path20, options);
12541
+ function sync(path21, options) {
12542
+ return checkStat(fs19.statSync(path21), path21, options);
12543
12543
  }
12544
12544
  }
12545
12545
  });
@@ -12549,14 +12549,14 @@ var require_mode = __commonJS({
12549
12549
  "node_modules/isexe/mode.js"(exports, module) {
12550
12550
  module.exports = isexe;
12551
12551
  isexe.sync = sync;
12552
- var fs18 = __require("fs");
12553
- function isexe(path20, options, cb) {
12554
- fs18.stat(path20, function(er, stat) {
12552
+ var fs19 = __require("fs");
12553
+ function isexe(path21, options, cb) {
12554
+ fs19.stat(path21, function(er, stat) {
12555
12555
  cb(er, er ? false : checkStat(stat, options));
12556
12556
  });
12557
12557
  }
12558
- function sync(path20, options) {
12559
- return checkStat(fs18.statSync(path20), options);
12558
+ function sync(path21, options) {
12559
+ return checkStat(fs19.statSync(path21), options);
12560
12560
  }
12561
12561
  function checkStat(stat, options) {
12562
12562
  return stat.isFile() && checkMode(stat, options);
@@ -12580,7 +12580,7 @@ var require_mode = __commonJS({
12580
12580
  // node_modules/isexe/index.js
12581
12581
  var require_isexe = __commonJS({
12582
12582
  "node_modules/isexe/index.js"(exports, module) {
12583
- var fs18 = __require("fs");
12583
+ var fs19 = __require("fs");
12584
12584
  var core;
12585
12585
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
12586
12586
  core = require_windows();
@@ -12589,7 +12589,7 @@ var require_isexe = __commonJS({
12589
12589
  }
12590
12590
  module.exports = isexe;
12591
12591
  isexe.sync = sync;
12592
- function isexe(path20, options, cb) {
12592
+ function isexe(path21, options, cb) {
12593
12593
  if (typeof options === "function") {
12594
12594
  cb = options;
12595
12595
  options = {};
@@ -12599,7 +12599,7 @@ var require_isexe = __commonJS({
12599
12599
  throw new TypeError("callback not provided");
12600
12600
  }
12601
12601
  return new Promise(function(resolve, reject) {
12602
- isexe(path20, options || {}, function(er, is) {
12602
+ isexe(path21, options || {}, function(er, is) {
12603
12603
  if (er) {
12604
12604
  reject(er);
12605
12605
  } else {
@@ -12608,7 +12608,7 @@ var require_isexe = __commonJS({
12608
12608
  });
12609
12609
  });
12610
12610
  }
12611
- core(path20, options || {}, function(er, is) {
12611
+ core(path21, options || {}, function(er, is) {
12612
12612
  if (er) {
12613
12613
  if (er.code === "EACCES" || options && options.ignoreErrors) {
12614
12614
  er = null;
@@ -12618,9 +12618,9 @@ var require_isexe = __commonJS({
12618
12618
  cb(er, is);
12619
12619
  });
12620
12620
  }
12621
- function sync(path20, options) {
12621
+ function sync(path21, options) {
12622
12622
  try {
12623
- return core.sync(path20, options || {});
12623
+ return core.sync(path21, options || {});
12624
12624
  } catch (er) {
12625
12625
  if (options && options.ignoreErrors || er.code === "EACCES") {
12626
12626
  return false;
@@ -12636,7 +12636,7 @@ var require_isexe = __commonJS({
12636
12636
  var require_which = __commonJS({
12637
12637
  "node_modules/which/which.js"(exports, module) {
12638
12638
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
12639
- var path20 = __require("path");
12639
+ var path21 = __require("path");
12640
12640
  var COLON = isWindows ? ";" : ":";
12641
12641
  var isexe = require_isexe();
12642
12642
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -12674,7 +12674,7 @@ var require_which = __commonJS({
12674
12674
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
12675
12675
  const ppRaw = pathEnv[i];
12676
12676
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
12677
- const pCmd = path20.join(pathPart, cmd);
12677
+ const pCmd = path21.join(pathPart, cmd);
12678
12678
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
12679
12679
  resolve(subStep(p, i, 0));
12680
12680
  });
@@ -12701,7 +12701,7 @@ var require_which = __commonJS({
12701
12701
  for (let i = 0; i < pathEnv.length; i++) {
12702
12702
  const ppRaw = pathEnv[i];
12703
12703
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
12704
- const pCmd = path20.join(pathPart, cmd);
12704
+ const pCmd = path21.join(pathPart, cmd);
12705
12705
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
12706
12706
  for (let j = 0; j < pathExt.length; j++) {
12707
12707
  const cur = p + pathExt[j];
@@ -12749,7 +12749,7 @@ var require_path_key = __commonJS({
12749
12749
  var require_resolveCommand = __commonJS({
12750
12750
  "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
12751
12751
  "use strict";
12752
- var path20 = __require("path");
12752
+ var path21 = __require("path");
12753
12753
  var which = require_which();
12754
12754
  var getPathKey = require_path_key();
12755
12755
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -12767,7 +12767,7 @@ var require_resolveCommand = __commonJS({
12767
12767
  try {
12768
12768
  resolved = which.sync(parsed.command, {
12769
12769
  path: env[getPathKey({ env })],
12770
- pathExt: withoutPathExt ? path20.delimiter : void 0
12770
+ pathExt: withoutPathExt ? path21.delimiter : void 0
12771
12771
  });
12772
12772
  } catch (e) {
12773
12773
  } finally {
@@ -12776,7 +12776,7 @@ var require_resolveCommand = __commonJS({
12776
12776
  }
12777
12777
  }
12778
12778
  if (resolved) {
12779
- resolved = path20.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12779
+ resolved = path21.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12780
12780
  }
12781
12781
  return resolved;
12782
12782
  }
@@ -12830,8 +12830,8 @@ var require_shebang_command = __commonJS({
12830
12830
  if (!match) {
12831
12831
  return null;
12832
12832
  }
12833
- const [path20, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
- const binary = path20.split("/").pop();
12833
+ const [path21, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
+ const binary = path21.split("/").pop();
12835
12835
  if (binary === "env") {
12836
12836
  return argument;
12837
12837
  }
@@ -12844,16 +12844,16 @@ var require_shebang_command = __commonJS({
12844
12844
  var require_readShebang = __commonJS({
12845
12845
  "node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
12846
12846
  "use strict";
12847
- var fs18 = __require("fs");
12847
+ var fs19 = __require("fs");
12848
12848
  var shebangCommand = require_shebang_command();
12849
12849
  function readShebang(command) {
12850
12850
  const size = 150;
12851
12851
  const buffer = Buffer.alloc(size);
12852
12852
  let fd;
12853
12853
  try {
12854
- fd = fs18.openSync(command, "r");
12855
- fs18.readSync(fd, buffer, 0, size, 0);
12856
- fs18.closeSync(fd);
12854
+ fd = fs19.openSync(command, "r");
12855
+ fs19.readSync(fd, buffer, 0, size, 0);
12856
+ fs19.closeSync(fd);
12857
12857
  } catch (e) {
12858
12858
  }
12859
12859
  return shebangCommand(buffer.toString());
@@ -12866,7 +12866,7 @@ var require_readShebang = __commonJS({
12866
12866
  var require_parse = __commonJS({
12867
12867
  "node_modules/cross-spawn/lib/parse.js"(exports, module) {
12868
12868
  "use strict";
12869
- var path20 = __require("path");
12869
+ var path21 = __require("path");
12870
12870
  var resolveCommand = require_resolveCommand();
12871
12871
  var escape2 = require_escape();
12872
12872
  var readShebang = require_readShebang();
@@ -12891,7 +12891,7 @@ var require_parse = __commonJS({
12891
12891
  const needsShell = !isExecutableRegExp.test(commandFile);
12892
12892
  if (parsed.options.forceShell || needsShell) {
12893
12893
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
12894
- parsed.command = path20.normalize(parsed.command);
12894
+ parsed.command = path21.normalize(parsed.command);
12895
12895
  parsed.command = escape2.command(parsed.command);
12896
12896
  parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
12897
12897
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -13003,8 +13003,8 @@ var require_cross_spawn = __commonJS({
13003
13003
 
13004
13004
  // src/maker/server/mcp.ts
13005
13005
  import { execFileSync, spawn as spawn4 } from "node:child_process";
13006
- import fs15 from "node:fs";
13007
- import path16 from "node:path";
13006
+ import fs16 from "node:fs";
13007
+ import path17 from "node:path";
13008
13008
  import { fileURLToPath as fileURLToPath2 } from "node:url";
13009
13009
 
13010
13010
  // node_modules/zod/v3/helpers/util.js
@@ -13366,8 +13366,8 @@ function getErrorMap() {
13366
13366
 
13367
13367
  // node_modules/zod/v3/helpers/parseUtil.js
13368
13368
  var makeIssue = (params) => {
13369
- const { data, path: path20, errorMaps, issueData } = params;
13370
- const fullPath = [...path20, ...issueData.path || []];
13369
+ const { data, path: path21, errorMaps, issueData } = params;
13370
+ const fullPath = [...path21, ...issueData.path || []];
13371
13371
  const fullIssue = {
13372
13372
  ...issueData,
13373
13373
  path: fullPath
@@ -13482,11 +13482,11 @@ var errorUtil;
13482
13482
 
13483
13483
  // node_modules/zod/v3/types.js
13484
13484
  var ParseInputLazyPath = class {
13485
- constructor(parent, value, path20, key) {
13485
+ constructor(parent, value, path21, key) {
13486
13486
  this._cachedPath = [];
13487
13487
  this.parent = parent;
13488
13488
  this.data = value;
13489
- this._path = path20;
13489
+ this._path = path21;
13490
13490
  this._key = key;
13491
13491
  }
13492
13492
  get path() {
@@ -17135,10 +17135,10 @@ function mergeDefs(...defs) {
17135
17135
  function cloneDef(schema) {
17136
17136
  return mergeDefs(schema._zod.def);
17137
17137
  }
17138
- function getElementAtPath(obj, path20) {
17139
- if (!path20)
17138
+ function getElementAtPath(obj, path21) {
17139
+ if (!path21)
17140
17140
  return obj;
17141
- return path20.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
17141
+ return path21.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
17142
17142
  }
17143
17143
  function promiseAllObject(promisesObj) {
17144
17144
  const keys = Object.keys(promisesObj);
@@ -17523,11 +17523,11 @@ function aborted(x, startIndex = 0) {
17523
17523
  }
17524
17524
  return false;
17525
17525
  }
17526
- function prefixIssues(path20, issues) {
17526
+ function prefixIssues(path21, issues) {
17527
17527
  return issues.map((iss) => {
17528
17528
  var _a3;
17529
17529
  (_a3 = iss).path ?? (_a3.path = []);
17530
- iss.path.unshift(path20);
17530
+ iss.path.unshift(path21);
17531
17531
  return iss;
17532
17532
  });
17533
17533
  }
@@ -33335,9 +33335,138 @@ function isNonEmptyStringLike(value) {
33335
33335
  return value !== void 0 && value !== null && String(value).trim() !== "";
33336
33336
  }
33337
33337
 
33338
- // src/maker/server/proxyAssets.ts
33338
+ // src/maker/projectSettings.ts
33339
33339
  import fs14 from "node:fs";
33340
33340
  import path15 from "node:path";
33341
+ var REQUIRED_SOURCE_TAGS = ["stable"];
33342
+ function inspectMakerProjectSettings(projectRoot) {
33343
+ const resolvedProjectRoot = path15.resolve(projectRoot);
33344
+ const settingsJsonPath = path15.join(resolvedProjectRoot, ".project", "settings.json");
33345
+ const baseStatus = {
33346
+ projectRoot: resolvedProjectRoot,
33347
+ settingsJsonPath
33348
+ };
33349
+ if (!fs14.existsSync(settingsJsonPath)) {
33350
+ return {
33351
+ ...baseStatus,
33352
+ status: "missing_settings_json"
33353
+ };
33354
+ }
33355
+ let settings;
33356
+ try {
33357
+ settings = JSON.parse(fs14.readFileSync(settingsJsonPath, "utf8"));
33358
+ } catch (error2) {
33359
+ return {
33360
+ ...baseStatus,
33361
+ status: "invalid_settings_json",
33362
+ error: error2 instanceof Error ? error2.message : String(error2)
33363
+ };
33364
+ }
33365
+ const issues = validateMakerProjectSettings(settings);
33366
+ if (issues.length > 0) {
33367
+ return {
33368
+ ...baseStatus,
33369
+ status: "invalid_project_settings",
33370
+ issues
33371
+ };
33372
+ }
33373
+ return {
33374
+ ...baseStatus,
33375
+ status: "ready"
33376
+ };
33377
+ }
33378
+ function formatMakerProjectSettingsStatus(status) {
33379
+ var _a3;
33380
+ if (status.status === "ready" || status.status === "missing_settings_json") {
33381
+ return "";
33382
+ }
33383
+ const lines = [
33384
+ "Maker project settings",
33385
+ "",
33386
+ `- status: ${status.status}`,
33387
+ `- config: ${status.settingsJsonPath}`,
33388
+ "- impact: 构建可能失败或游戏黑屏;坏配置不应提交到 Maker 远端。"
33389
+ ];
33390
+ if (status.error) {
33391
+ lines.push(`- error: ${status.error}`);
33392
+ }
33393
+ if ((_a3 = status.issues) == null ? void 0 : _a3.length) {
33394
+ lines.push("- issues:");
33395
+ lines.push(...status.issues.map((issue2) => ` - ${issue2}`));
33396
+ }
33397
+ lines.push(
33398
+ "- next_action: 恢复 .project/settings.json 的构建关键字段后再构建;保留合法的 @runtime 配置。"
33399
+ );
33400
+ return lines.join("\n");
33401
+ }
33402
+ function isMakerProjectSettingsBlocking(status) {
33403
+ return status.status === "invalid_settings_json" || status.status === "invalid_project_settings";
33404
+ }
33405
+ function validateMakerProjectSettings(settings) {
33406
+ const issues = [];
33407
+ if (!isPlainObject3(settings)) {
33408
+ return ["settings.json must be a JSON object"];
33409
+ }
33410
+ expectValue(settings, "$schema", "../schemas/settings.schema.json", issues);
33411
+ const sources = readPath(settings, "sources");
33412
+ if (!isPlainObject3(sources)) {
33413
+ issues.push("sources must be an object");
33414
+ } else {
33415
+ expectOneOf(settings, "sources.engine.tag", REQUIRED_SOURCE_TAGS, issues);
33416
+ expectOneOf(settings, "sources.engine-res.tag", REQUIRED_SOURCE_TAGS, issues);
33417
+ expectOneOf(settings, "sources.official-res.tag", REQUIRED_SOURCE_TAGS, issues);
33418
+ }
33419
+ const build = readPath(settings, "build");
33420
+ if (!isPlainObject3(build)) {
33421
+ issues.push("build must be an object");
33422
+ return issues;
33423
+ }
33424
+ expectValue(settings, "build.generate_fs_path", true, issues);
33425
+ expectValue(settings, "build.output_dir", "../dist", issues);
33426
+ const assetDirs = readPath(build, "asset_dirs");
33427
+ if (!isStringArray(assetDirs) || !sameStringSet(assetDirs, ["../assets", "../scripts"])) {
33428
+ issues.push('build.asset_dirs must contain only "../assets" and "../scripts"');
33429
+ }
33430
+ if (readPath(build, "asset_ignores") === void 0) {
33431
+ issues.push("build.asset_ignores must exist");
33432
+ }
33433
+ return issues;
33434
+ }
33435
+ function expectValue(settings, fieldPath, expected, issues) {
33436
+ if (readPath(settings, fieldPath) !== expected) {
33437
+ issues.push(`${fieldPath} must be ${JSON.stringify(expected)}`);
33438
+ }
33439
+ }
33440
+ function expectOneOf(settings, fieldPath, expectedValues, issues) {
33441
+ if (!expectedValues.includes(String(readPath(settings, fieldPath)))) {
33442
+ issues.push(
33443
+ `${fieldPath} must be ${expectedValues.map((value) => JSON.stringify(value)).join(" or ")}`
33444
+ );
33445
+ }
33446
+ }
33447
+ function readPath(value, fieldPath) {
33448
+ let current = value;
33449
+ for (const segment of fieldPath.split(".")) {
33450
+ if (!isPlainObject3(current)) {
33451
+ return void 0;
33452
+ }
33453
+ current = current[segment];
33454
+ }
33455
+ return current;
33456
+ }
33457
+ function isPlainObject3(value) {
33458
+ return typeof value === "object" && value !== null && !Array.isArray(value);
33459
+ }
33460
+ function isStringArray(value) {
33461
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
33462
+ }
33463
+ function sameStringSet(left, right) {
33464
+ return left.length === right.length && right.every((item) => left.includes(item));
33465
+ }
33466
+
33467
+ // src/maker/server/proxyAssets.ts
33468
+ import fs15 from "node:fs";
33469
+ import path16 from "node:path";
33341
33470
  var IMAGE_ASSET_DIRS = ["assets/image"];
33342
33471
  var VIDEO_ASSET_DIRS = ["assets/video"];
33343
33472
  var AUDIO_ASSET_DIRS = ["assets/audio"];
@@ -33537,7 +33666,7 @@ async function materializeDebugFeedbackResult(options) {
33537
33666
  ...materialized
33538
33667
  });
33539
33668
  }
33540
- const localCandidateSaveDir = remoteSaveDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteSaveDir) : feedbacks.some(hasDebugFeedbackArtifactUrls) ? path15.join(options.targetDir, "logs", "feed_back") : void 0;
33669
+ const localCandidateSaveDir = remoteSaveDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteSaveDir) : feedbacks.some(hasDebugFeedbackArtifactUrls) ? path16.join(options.targetDir, "logs", "feed_back") : void 0;
33541
33670
  const filesVerifiedLocally = nextFeedbacks.some(
33542
33671
  (feedback) => numberField2(feedback.artifacts_downloaded) > 0
33543
33672
  );
@@ -33553,7 +33682,7 @@ async function materializeDebugFeedbackResult(options) {
33553
33682
  };
33554
33683
  }
33555
33684
  async function materializeDebugFeedbackArtifacts(options) {
33556
- const feedbackId = stringField2(options.feedback.feedback_id) || String(options.feedback.feedback_id || "");
33685
+ const feedbackId = stringField2(options.feedback.feedback_id) ?? (options.feedback.feedback_id != null ? String(options.feedback.feedback_id) : "");
33557
33686
  if (!feedbackId) {
33558
33687
  return {};
33559
33688
  }
@@ -33565,7 +33694,7 @@ async function materializeDebugFeedbackArtifacts(options) {
33565
33694
  if (logUrls.length === 0 && screenshotUrls.length === 0 && extraUrls.length === 0) {
33566
33695
  return {};
33567
33696
  }
33568
- const localDir = path15.join(options.targetDir, "logs", "feed_back", `feedback_${feedbackId}`);
33697
+ const localDir = path16.join(options.targetDir, "logs", "feed_back", `feedback_${feedbackId}`);
33569
33698
  const localLogPaths = [];
33570
33699
  const localScreenshotPaths = [];
33571
33700
  const localDownloadPaths = [];
@@ -33573,7 +33702,7 @@ async function materializeDebugFeedbackArtifacts(options) {
33573
33702
  for (const [index, url2] of logUrls.entries()) {
33574
33703
  const result = await downloadDebugFeedbackArtifact({
33575
33704
  url: url2,
33576
- directory: path15.join(localDir, "logs"),
33705
+ directory: path16.join(localDir, "logs"),
33577
33706
  fallbackName: `log_${index + 1}.log`,
33578
33707
  fetchImpl: options.fetchImpl
33579
33708
  });
@@ -33586,7 +33715,7 @@ async function materializeDebugFeedbackArtifacts(options) {
33586
33715
  for (const [index, url2] of screenshotUrls.entries()) {
33587
33716
  const result = await downloadDebugFeedbackArtifact({
33588
33717
  url: url2,
33589
- directory: path15.join(localDir, "screenshots"),
33718
+ directory: path16.join(localDir, "screenshots"),
33590
33719
  fallbackName: `screenshot_${index + 1}.png`,
33591
33720
  fetchImpl: options.fetchImpl
33592
33721
  });
@@ -33599,7 +33728,7 @@ async function materializeDebugFeedbackArtifacts(options) {
33599
33728
  for (const [index, url2] of extraUrls.entries()) {
33600
33729
  const result = await downloadDebugFeedbackArtifact({
33601
33730
  url: url2,
33602
- directory: path15.join(localDir, "downloads"),
33731
+ directory: path16.join(localDir, "downloads"),
33603
33732
  fallbackName: `artifact_${index + 1}`,
33604
33733
  fetchImpl: options.fetchImpl
33605
33734
  });
@@ -33627,14 +33756,14 @@ async function downloadDebugFeedbackArtifact(options) {
33627
33756
  error: `${options.url}: HTTP ${response.status}`
33628
33757
  };
33629
33758
  }
33630
- fs14.mkdirSync(options.directory, { recursive: true });
33759
+ fs15.mkdirSync(options.directory, { recursive: true });
33631
33760
  const filePath = allocateDebugFeedbackArtifactPath(
33632
33761
  options.directory,
33633
33762
  options.url,
33634
33763
  options.fallbackName
33635
33764
  );
33636
33765
  const bytes = Buffer.from(await response.arrayBuffer());
33637
- fs14.writeFileSync(filePath, bytes);
33766
+ fs15.writeFileSync(filePath, bytes);
33638
33767
  return { success: true, path: filePath };
33639
33768
  } catch (error2) {
33640
33769
  return {
@@ -33645,14 +33774,14 @@ async function downloadDebugFeedbackArtifact(options) {
33645
33774
  }
33646
33775
  function allocateDebugFeedbackArtifactPath(directory, url2, fallbackName) {
33647
33776
  const rawName = fileNameFromUrl(url2) || fallbackName;
33648
- const rawExtension = path15.extname(rawName);
33777
+ const rawExtension = path16.extname(rawName);
33649
33778
  const finalExtension = rawExtension && rawExtension !== "." ? rawExtension.replace(/[^A-Za-z0-9.]/g, "_") : "";
33650
33779
  const rawStem = finalExtension ? rawName.slice(0, -rawExtension.length) : rawName;
33651
33780
  const stem = sanitizeAssetBaseName(rawStem);
33652
33781
  for (let index = 1; index <= 9999; index += 1) {
33653
33782
  const suffix = index === 1 ? "" : `_${index}`;
33654
- const candidate = path15.join(directory, `${stem}${suffix}${finalExtension}`);
33655
- if (!fs14.existsSync(candidate)) {
33783
+ const candidate = path16.join(directory, `${stem}${suffix}${finalExtension}`);
33784
+ if (!fs15.existsSync(candidate)) {
33656
33785
  return candidate;
33657
33786
  }
33658
33787
  }
@@ -33661,7 +33790,7 @@ function allocateDebugFeedbackArtifactPath(directory, url2, fallbackName) {
33661
33790
  function fileNameFromUrl(url2) {
33662
33791
  try {
33663
33792
  const pathname = new URL(url2).pathname;
33664
- const name = decodeURIComponent(path15.basename(pathname));
33793
+ const name = decodeURIComponent(path16.basename(pathname));
33665
33794
  return name && name !== "/" ? name : void 0;
33666
33795
  } catch {
33667
33796
  return void 0;
@@ -33675,11 +33804,11 @@ function getDebugFeedbackSaveDir(payload) {
33675
33804
  return stringField2(payload.save_dir) || (isRecord(summary) ? stringField2(summary.save_dir) : void 0);
33676
33805
  }
33677
33806
  function resolveDebugFeedbackCandidatePath(targetDir, remotePath) {
33678
- if (path15.isAbsolute(remotePath)) {
33807
+ if (path16.isAbsolute(remotePath)) {
33679
33808
  return void 0;
33680
33809
  }
33681
33810
  const trimmedRemotePath = remotePath.replace(/[\\/]+$/, "");
33682
- return path15.normalize(path15.join(targetDir, trimmedRemotePath || "."));
33811
+ return path16.normalize(path16.join(targetDir, trimmedRemotePath || "."));
33683
33812
  }
33684
33813
  function replaceDebugFeedbackItems(payload, nextFeedbacks) {
33685
33814
  const summary = payload.summary;
@@ -33832,13 +33961,13 @@ function findExistingMaterializedVideo(targetDir, options) {
33832
33961
  function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
33833
33962
  const candidates = [];
33834
33963
  const absolutePath = stringField2(record2.absolutePath);
33835
- if (absolutePath && path15.isAbsolute(absolutePath)) {
33964
+ if (absolutePath && path16.isAbsolute(absolutePath)) {
33836
33965
  candidates.push(absolutePath);
33837
33966
  }
33838
- candidates.push(path15.join(targetDir, ...localPath.split("/")));
33967
+ candidates.push(path16.join(targetDir, ...localPath.split("/")));
33839
33968
  for (const candidate of candidates) {
33840
33969
  try {
33841
- if (fs14.statSync(candidate).isFile()) {
33970
+ if (fs15.statSync(candidate).isFile()) {
33842
33971
  return candidate;
33843
33972
  }
33844
33973
  } catch {
@@ -34003,7 +34132,7 @@ async function materialize3dFinalResult(options, toolName) {
34003
34132
  try {
34004
34133
  extractZip(
34005
34134
  mdlMaterialized.absolutePath,
34006
- path15.join(options.targetDir, "assets"),
34135
+ path16.join(options.targetDir, "assets"),
34007
34136
  "3D model asset"
34008
34137
  );
34009
34138
  nextPayload.mdlExtracted = true;
@@ -34110,8 +34239,8 @@ async function materializeAsset(options) {
34110
34239
  };
34111
34240
  }
34112
34241
  const bytes = Buffer.from(await response.arrayBuffer());
34113
- fs14.mkdirSync(path15.dirname(absolutePath), { recursive: true });
34114
- fs14.writeFileSync(absolutePath, bytes);
34242
+ fs15.mkdirSync(path16.dirname(absolutePath), { recursive: true });
34243
+ fs15.writeFileSync(absolutePath, bytes);
34115
34244
  return { localPath: relativePath, absolutePath, download: { success: true } };
34116
34245
  } catch (error2) {
34117
34246
  return {
@@ -34125,12 +34254,12 @@ async function materializeAsset(options) {
34125
34254
  function createUniqueAssetPath(options) {
34126
34255
  const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
34127
34256
  for (let index = 1; index <= 9999; index += 1) {
34128
- const relativePath = path15.posix.join(
34257
+ const relativePath = path16.posix.join(
34129
34258
  options.relativeDir,
34130
34259
  `${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
34131
34260
  );
34132
- const absolutePath = path15.join(options.targetDir, ...relativePath.split("/"));
34133
- if (!fs14.existsSync(absolutePath)) {
34261
+ const absolutePath = path16.join(options.targetDir, ...relativePath.split("/"));
34262
+ if (!fs15.existsSync(absolutePath)) {
34134
34263
  return { relativePath, absolutePath };
34135
34264
  }
34136
34265
  }
@@ -34308,7 +34437,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
34308
34437
  if (!isKnownAssetPath(localPath, assetDirs)) {
34309
34438
  return false;
34310
34439
  }
34311
- const basename = path15.posix.basename(localPath);
34440
+ const basename = path16.posix.basename(localPath);
34312
34441
  const stem = basename.replace(/\.[^.]+$/, "");
34313
34442
  return basename === value || stem === value || record2.name === value || record2.taskId === value;
34314
34443
  });
@@ -34321,13 +34450,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
34321
34450
  }
34322
34451
  function findLocalAssetByName(targetDir, value, assetDirs) {
34323
34452
  var _a3;
34324
- const hasExtension = Boolean(path15.extname(value));
34453
+ const hasExtension = Boolean(path16.extname(value));
34325
34454
  const candidates = [];
34326
34455
  for (const assetDir of assetDirs) {
34327
- const absoluteDir = path15.join(targetDir, ...assetDir.split("/"));
34456
+ const absoluteDir = path16.join(targetDir, ...assetDir.split("/"));
34328
34457
  let entries;
34329
34458
  try {
34330
- entries = fs14.readdirSync(absoluteDir);
34459
+ entries = fs15.readdirSync(absoluteDir);
34331
34460
  } catch {
34332
34461
  continue;
34333
34462
  }
@@ -34336,11 +34465,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
34336
34465
  if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
34337
34466
  continue;
34338
34467
  }
34339
- const absolutePath = path15.join(absoluteDir, entry);
34468
+ const absolutePath = path16.join(absoluteDir, entry);
34340
34469
  try {
34341
34470
  candidates.push({
34342
- localPath: path15.posix.join(assetDir, entry),
34343
- mtimeMs: fs14.statSync(absolutePath).mtimeMs
34471
+ localPath: path16.posix.join(assetDir, entry),
34472
+ mtimeMs: fs15.statSync(absolutePath).mtimeMs
34344
34473
  });
34345
34474
  } catch {
34346
34475
  }
@@ -34350,7 +34479,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
34350
34479
  return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
34351
34480
  }
34352
34481
  function isKnownAssetPath(relativePath, assetDirs) {
34353
- if (relativePath.startsWith("../") || path15.isAbsolute(relativePath)) {
34482
+ if (relativePath.startsWith("../") || path16.isAbsolute(relativePath)) {
34354
34483
  return false;
34355
34484
  }
34356
34485
  return assetDirs.some(
@@ -34374,14 +34503,14 @@ function localAssetReferenceToDataUrl(options) {
34374
34503
  }
34375
34504
  let stat;
34376
34505
  try {
34377
- stat = fs14.statSync(absolutePath);
34506
+ stat = fs15.statSync(absolutePath);
34378
34507
  } catch {
34379
34508
  return void 0;
34380
34509
  }
34381
34510
  if (!stat.isFile() || stat.size > options.maxBytes) {
34382
34511
  return void 0;
34383
34512
  }
34384
- const bytes = fs14.readFileSync(absolutePath);
34513
+ const bytes = fs15.readFileSync(absolutePath);
34385
34514
  return `data:${mime};base64,${bytes.toString("base64")}`;
34386
34515
  }
34387
34516
  function resolveLocalAssetAbsolutePath(targetDir, options) {
@@ -34392,7 +34521,7 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
34392
34521
  candidates.push(localPath);
34393
34522
  }
34394
34523
  }
34395
- if (path15.isAbsolute(options.value)) {
34524
+ if (path16.isAbsolute(options.value)) {
34396
34525
  candidates.push(options.value);
34397
34526
  } else {
34398
34527
  const localPath = resolveProjectRelativePath(targetDir, options.value);
@@ -34401,54 +34530,54 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
34401
34530
  }
34402
34531
  }
34403
34532
  for (const candidate of candidates) {
34404
- if (fs14.existsSync(candidate)) {
34533
+ if (fs15.existsSync(candidate)) {
34405
34534
  return candidate;
34406
34535
  }
34407
34536
  }
34408
34537
  return void 0;
34409
34538
  }
34410
34539
  function resolveProjectRelativePath(targetDir, value) {
34411
- const root = path15.resolve(targetDir);
34412
- const absolutePath = path15.resolve(root, value);
34413
- const relativePath = path15.relative(root, absolutePath);
34414
- const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path15.sep}`) || path15.isAbsolute(relativePath);
34540
+ const root = path16.resolve(targetDir);
34541
+ const absolutePath = path16.resolve(root, value);
34542
+ const relativePath = path16.relative(root, absolutePath);
34543
+ const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path16.sep}`) || path16.isAbsolute(relativePath);
34415
34544
  if (!escapesRoot) {
34416
34545
  return absolutePath;
34417
34546
  }
34418
34547
  return void 0;
34419
34548
  }
34420
34549
  function dataUrlMimeForPath(filePath, mediaKind) {
34421
- return DATA_URL_MIME_BY_EXTENSION[mediaKind][path15.extname(filePath).toLowerCase()];
34550
+ return DATA_URL_MIME_BY_EXTENSION[mediaKind][path16.extname(filePath).toLowerCase()];
34422
34551
  }
34423
34552
  function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
34424
34553
  const registry2 = readGeneratedAssetRegistry(targetDir);
34425
34554
  registry2[localPath] = record2;
34426
34555
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
34427
- fs14.mkdirSync(path15.dirname(registryPath), { recursive: true });
34428
- fs14.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
34556
+ fs15.mkdirSync(path16.dirname(registryPath), { recursive: true });
34557
+ fs15.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
34429
34558
  `, "utf8");
34430
34559
  }
34431
34560
  function readGeneratedAssetRegistry(targetDir) {
34432
34561
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
34433
- if (!fs14.existsSync(registryPath)) {
34562
+ if (!fs15.existsSync(registryPath)) {
34434
34563
  return {};
34435
34564
  }
34436
34565
  try {
34437
- const parsed = JSON.parse(fs14.readFileSync(registryPath, "utf8"));
34566
+ const parsed = JSON.parse(fs15.readFileSync(registryPath, "utf8"));
34438
34567
  return isRecord(parsed) ? parsed : {};
34439
34568
  } catch {
34440
34569
  return {};
34441
34570
  }
34442
34571
  }
34443
34572
  function getGeneratedAssetRegistryPath(targetDir) {
34444
- return path15.join(targetDir, ".maker", "assets", "generated-assets.json");
34573
+ return path16.join(targetDir, ".maker", "assets", "generated-assets.json");
34445
34574
  }
34446
34575
  function normalizeAssetRegistryKey(targetDir, value) {
34447
34576
  if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
34448
34577
  return void 0;
34449
34578
  }
34450
- const relative = path15.isAbsolute(value) ? path15.relative(targetDir, value) : value;
34451
- return relative.split(path15.sep).join("/");
34579
+ const relative = path16.isAbsolute(value) ? path16.relative(targetDir, value) : value;
34580
+ return relative.split(path16.sep).join("/");
34452
34581
  }
34453
34582
  function isRecord(value) {
34454
34583
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -34487,7 +34616,7 @@ function extensionFromUrl(url2) {
34487
34616
  }
34488
34617
  try {
34489
34618
  const pathname = new URL(url2).pathname;
34490
- const extension = path15.extname(pathname).replace(/^\./, "").toLowerCase();
34619
+ const extension = path16.extname(pathname).replace(/^\./, "").toLowerCase();
34491
34620
  return extension || void 0;
34492
34621
  } catch {
34493
34622
  return void 0;
@@ -34638,7 +34767,7 @@ function applyDefaults(config2) {
34638
34767
  }
34639
34768
 
34640
34769
  // src/maker/server/mcp.ts
34641
- var VERSION = true ? "0.0.24-beta.2" : "dev";
34770
+ var VERSION = true ? "0.0.24" : "dev";
34642
34771
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
34643
34772
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
34644
34773
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -34659,6 +34788,61 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
34659
34788
  "get_ad_config",
34660
34789
  "get_debug_feedbacks"
34661
34790
  ];
34791
+ var MAKER_BUILD_MULTIPLAYER_SCHEMA = {
34792
+ type: "object",
34793
+ description: "Optional Maker multiplayer config forwarded to remote build and written by maker-tools to .project/settings.json @runtime.multiplayer. If omitted and no .project/settings.json exists, Maker MCP sends { enabled: false } for first single-player build initialization. First multiplayer build with entry_client/entry_server should pass multiplayer.enabled=true and any needed match/world fields in the same call. Later builds update only the provided fields and keep existing config for omitted fields. Runtime defaults: enabled=false, max_players=4, background_match=false.",
34794
+ properties: {
34795
+ enabled: {
34796
+ type: "boolean",
34797
+ description: "Enable multiplayer mode. When true, initializes the networking subsystem and lobby. Runtime default: false."
34798
+ },
34799
+ max_players: {
34800
+ type: "number",
34801
+ minimum: 2,
34802
+ maximum: 100,
34803
+ description: "Maximum players allowed in one session (2-100). Actual match size can be smaller via match_info.player_number. Runtime default: 4."
34804
+ },
34805
+ background_match: {
34806
+ type: "boolean",
34807
+ description: "Enable background matching. When true, game scripts load immediately and matching runs in the background; handle the ServerReady event after match success. Runtime default: false."
34808
+ },
34809
+ match_info: {
34810
+ type: "object",
34811
+ description: "Match/session-based gameplay config for lobby, room, or round-based games. Examples: LoL, CS2, PUBG, DotA 2.",
34812
+ properties: {
34813
+ desc_name: {
34814
+ type: "string",
34815
+ enum: ["free_match", "free_match_with_ai"],
34816
+ description: "Matching algorithm: free_match waits without AI fill; free_match_with_ai fills with AI after timeout."
34817
+ },
34818
+ player_number: {
34819
+ type: "number",
34820
+ minimum: 1,
34821
+ description: "Players required to start the match. Must be less than or equal to multiplayer.max_players."
34822
+ },
34823
+ immediately_start: {
34824
+ type: "boolean",
34825
+ description: "Start immediately without waiting for a full match."
34826
+ },
34827
+ match_timeout: {
34828
+ type: "number",
34829
+ minimum: 0,
34830
+ description: "Match timeout in seconds. Only effective for desc_name=free_match_with_ai; AI fills after timeout."
34831
+ }
34832
+ }
34833
+ },
34834
+ persistent_world: {
34835
+ type: "object",
34836
+ description: "Persistent-world config for long-running/shared worlds where players can join an already running world. Examples: Roblox, World of Warcraft, Minecraft.",
34837
+ properties: {
34838
+ enabled: {
34839
+ type: "boolean",
34840
+ description: "Enable persistent-world mode instead of starting a separate match/session first. Runtime default: false."
34841
+ }
34842
+ }
34843
+ }
34844
+ }
34845
+ };
34662
34846
  var MakerCloneFailedError = class extends Error {
34663
34847
  constructor(targetDir, originalError) {
34664
34848
  const message = originalError instanceof Error ? originalError.message : String(originalError);
@@ -34706,16 +34890,13 @@ var tools = [
34706
34890
  },
34707
34891
  entry_client: {
34708
34892
  type: "string",
34709
- description: 'Optional multiplayer client entry relative to scriptsPath, e.g. "client_main.lua".'
34893
+ description: 'Optional multiplayer C/S client entry relative to scriptsPath, e.g. "client_main.lua". Forwarded to maker-tools build and written to project.json as entry@client. On the first multiplayer build, pass multiplayer.enabled=true in the same call; otherwise first-build defaults may initialize multiplayer as disabled.'
34710
34894
  },
34711
34895
  entry_server: {
34712
34896
  type: "string",
34713
- description: 'Optional multiplayer server entry relative to scriptsPath, e.g. "server_main.lua".'
34714
- },
34715
- multiplayer: {
34716
- type: "object",
34717
- description: "Optional multiplayer config forwarded to remote build. If omitted and no .project/settings.json exists, Maker MCP sends { enabled: false } for first single-player build initialization."
34897
+ description: 'Optional multiplayer C/S server entry relative to scriptsPath, e.g. "server_main.lua". Forwarded to maker-tools build and written to project.json as entry@server. On the first multiplayer build, pass multiplayer.enabled=true in the same call; otherwise first-build defaults may initialize multiplayer as disabled.'
34718
34898
  },
34899
+ multiplayer: MAKER_BUILD_MULTIPLAYER_SCHEMA,
34719
34900
  server_url: {
34720
34901
  type: "string",
34721
34902
  description: "Optional remote MCP server URL override. Defaults to the Maker endpoint table for TAPTAP_MCP_ENV."
@@ -35156,7 +35337,7 @@ async function formatStatus(options = {}) {
35156
35337
  const env = getMakerEnvironment(void 0, targetDir);
35157
35338
  const identify = identifyMakerProject({ cwd: targetDir });
35158
35339
  const mcpCwd = process.cwd();
35159
- const mcpCwdIdentify = path16.resolve(mcpCwd) === path16.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
35340
+ const mcpCwdIdentify = path17.resolve(mcpCwd) === path17.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
35160
35341
  const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
35161
35342
  const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
35162
35343
  const pat = loadPat();
@@ -35191,6 +35372,7 @@ async function formatStatus(options = {}) {
35191
35372
  const projectInitializationText = identify.projectRoot ? formatMakerProjectInitializationStatus(
35192
35373
  inspectMakerProjectInitialization(identify.projectRoot)
35193
35374
  ) : "";
35375
+ const projectSettingsText = identify.projectRoot ? formatMakerProjectSettingsStatus(inspectMakerProjectSettings(identify.projectRoot)) : "";
35194
35376
  const projectSection = identify.projectId ? [
35195
35377
  "目标目录已绑定 Maker 项目。",
35196
35378
  "请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
@@ -35222,6 +35404,7 @@ async function formatStatus(options = {}) {
35222
35404
  "",
35223
35405
  formatMakerGitDirectoryStatus(gitDirectoryStatus),
35224
35406
  ...projectInitializationText ? ["", projectInitializationText, ""] : [""],
35407
+ ...projectSettingsText ? ["", projectSettingsText, ""] : [""],
35225
35408
  formatMakerClientRootsStatus(projectContext.roots),
35226
35409
  "",
35227
35410
  projectContext.source === "client_roots" ? "" : formatMakerToolRegistrationCwdStatus({
@@ -35292,10 +35475,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
35292
35475
  if (!options.projectRoot) {
35293
35476
  return "";
35294
35477
  }
35295
- const mcpCwd = path16.resolve(options.mcpCwd);
35296
- const targetDir = path16.resolve(options.targetDir);
35297
- const projectRoot = path16.resolve(options.projectRoot);
35298
- const mcpProjectRoot = options.mcpProjectRoot ? path16.resolve(options.mcpProjectRoot) : void 0;
35478
+ const mcpCwd = path17.resolve(options.mcpCwd);
35479
+ const targetDir = path17.resolve(options.targetDir);
35480
+ const projectRoot = path17.resolve(options.projectRoot);
35481
+ const mcpProjectRoot = options.mcpProjectRoot ? path17.resolve(options.mcpProjectRoot) : void 0;
35299
35482
  if (mcpProjectRoot === projectRoot) {
35300
35483
  return "";
35301
35484
  }
@@ -35468,7 +35651,7 @@ function createServerClientRootsProvider(server) {
35468
35651
  async function resolveMakerProjectContext(options = {}) {
35469
35652
  if (options.targetDir) {
35470
35653
  return {
35471
- targetDir: path16.resolve(options.targetDir),
35654
+ targetDir: path17.resolve(options.targetDir),
35472
35655
  source: "explicit_target_dir",
35473
35656
  roots: { status: "not_requested", roots: [] }
35474
35657
  };
@@ -35563,7 +35746,7 @@ function rootToLocalPath(root) {
35563
35746
  if (url2.protocol !== "file:") {
35564
35747
  return void 0;
35565
35748
  }
35566
- return path16.resolve(fileURLToPath2(url2));
35749
+ return path17.resolve(fileURLToPath2(url2));
35567
35750
  } catch {
35568
35751
  return void 0;
35569
35752
  }
@@ -35577,14 +35760,14 @@ function uniquePaths(values) {
35577
35760
  continue;
35578
35761
  }
35579
35762
  seen.add(normalized);
35580
- result.push(path16.resolve(value));
35763
+ result.push(path17.resolve(value));
35581
35764
  }
35582
35765
  return result;
35583
35766
  }
35584
35767
  function normalizePathForCompare2(value) {
35585
- const resolved = path16.resolve(value);
35768
+ const resolved = path17.resolve(value);
35586
35769
  try {
35587
- return fs15.realpathSync.native(resolved);
35770
+ return fs16.realpathSync.native(resolved);
35588
35771
  } catch {
35589
35772
  return resolved;
35590
35773
  }
@@ -35733,14 +35916,14 @@ function formatStatusProjectList(projects) {
35733
35916
  ].filter((line) => line !== void 0).join("\n");
35734
35917
  }
35735
35918
  function formatClonePartialStateLines(targetDir) {
35736
- const resolvedTargetDir = path16.resolve(targetDir);
35919
+ const resolvedTargetDir = path17.resolve(targetDir);
35737
35920
  const identify = identifyMakerProject({ cwd: resolvedTargetDir });
35738
35921
  const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
35739
35922
  const devKitStatus = inspectAiDevKit(resolvedTargetDir);
35740
- const stagedDevKitGitignorePath = path16.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
35923
+ const stagedDevKitGitignorePath = path17.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
35741
35924
  const projectBound = Boolean(identify.projectId);
35742
35925
  const gitInitialized = Boolean(
35743
- gitStatus.isOwnGitRoot || fs15.existsSync(path16.join(resolvedTargetDir, ".git"))
35926
+ gitStatus.isOwnGitRoot || fs16.existsSync(path17.join(resolvedTargetDir, ".git"))
35744
35927
  );
35745
35928
  const safeToRetry = !projectBound;
35746
35929
  return [
@@ -35754,7 +35937,7 @@ function formatClonePartialStateLines(targetDir) {
35754
35937
  identify.configPath ? `- config: ${identify.configPath}` : "",
35755
35938
  `- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
35756
35939
  `- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
35757
- `- staged_dev_kit_gitignore: ${fs15.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
35940
+ `- staged_dev_kit_gitignore: ${fs16.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
35758
35941
  `- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
35759
35942
  safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
35760
35943
  ].filter(Boolean);
@@ -35830,12 +36013,12 @@ function resolveEmbeddedProxyCommand(options) {
35830
36013
  }
35831
36014
  return {
35832
36015
  command: process.execPath,
35833
- args: [path16.resolve(makerEntry), "__maker-proxy"]
36016
+ args: [path17.resolve(makerEntry), "__maker-proxy"]
35834
36017
  };
35835
36018
  }
35836
36019
  function resolveBundledMakerEntry() {
35837
- const bundledEntry = path16.resolve(__dirname, "../../../bin/taptap-maker");
35838
- return fs15.existsSync(bundledEntry) ? bundledEntry : void 0;
36020
+ const bundledEntry = path17.resolve(__dirname, "../../../bin/taptap-maker");
36021
+ return fs16.existsSync(bundledEntry) ? bundledEntry : void 0;
35839
36022
  }
35840
36023
  function isUsableEmbeddedMakerEntry(entry) {
35841
36024
  if (!entry) {
@@ -35940,6 +36123,15 @@ async function buildCurrentDirectory(options) {
35940
36123
  const localChanges = await readMakerProjectLocalChanges(options.targetDir);
35941
36124
  if (!options.confirmRemoteBuildWithoutSubmit) {
35942
36125
  const config2 = loadProjectConfig(localChanges.projectRoot);
36126
+ const settingsStatus = inspectMakerProjectSettings(localChanges.projectRoot);
36127
+ if (isMakerProjectSettingsBlocking(settingsStatus)) {
36128
+ return {
36129
+ mode: "settings_invalid_before_build",
36130
+ projectRoot: localChanges.projectRoot,
36131
+ projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
36132
+ settingsStatus
36133
+ };
36134
+ }
35943
36135
  (_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
35944
36136
  progress: 0,
35945
36137
  total: 100,
@@ -36161,18 +36353,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
36161
36353
  }
36162
36354
  }
36163
36355
  async function startRuntimeLogWatch(buildResult) {
36164
- const runtimeDir = path16.join(buildResult.projectRoot, ".maker", "logs", "runtime");
36165
- fs15.mkdirSync(runtimeDir, { recursive: true });
36166
- const stdoutLog = path16.join(runtimeDir, "watcher.out.log");
36167
- const stderrLog = path16.join(runtimeDir, "watcher.err.log");
36168
- const pidFile = path16.join(runtimeDir, "watcher.pid");
36356
+ const runtimeDir = path17.join(buildResult.projectRoot, ".maker", "logs", "runtime");
36357
+ fs16.mkdirSync(runtimeDir, { recursive: true });
36358
+ const stdoutLog = path17.join(runtimeDir, "watcher.out.log");
36359
+ const stderrLog = path17.join(runtimeDir, "watcher.err.log");
36360
+ const pidFile = path17.join(runtimeDir, "watcher.pid");
36169
36361
  const previous = stopExistingRuntimeLogWatcher(pidFile);
36170
- const outFd = fs15.openSync(stdoutLog, "a");
36171
- const errFd = fs15.openSync(stderrLog, "a");
36362
+ const outFd = fs16.openSync(stdoutLog, "a");
36363
+ const errFd = fs16.openSync(stderrLog, "a");
36172
36364
  const command = formatRuntimeLogWatchCommand(buildResult);
36173
36365
  if (previous.previousStopError) {
36174
- fs15.closeSync(outFd);
36175
- fs15.closeSync(errFd);
36366
+ fs16.closeSync(outFd);
36367
+ fs16.closeSync(errFd);
36176
36368
  return {
36177
36369
  started: false,
36178
36370
  command: command.text,
@@ -36235,18 +36427,18 @@ async function startRuntimeLogWatch(buildResult) {
36235
36427
  ...previous
36236
36428
  };
36237
36429
  } finally {
36238
- fs15.closeSync(outFd);
36239
- fs15.closeSync(errFd);
36430
+ fs16.closeSync(outFd);
36431
+ fs16.closeSync(errFd);
36240
36432
  }
36241
36433
  }
36242
36434
  function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36243
- if (!fs15.existsSync(pidFile)) {
36435
+ if (!fs16.existsSync(pidFile)) {
36244
36436
  return {};
36245
36437
  }
36246
36438
  const pidState = readRuntimeLogWatcherPidState(pidFile);
36247
36439
  const pid = pidState == null ? void 0 : pidState.pid;
36248
36440
  if (!Number.isInteger(pid) || pid <= 0) {
36249
- fs15.rmSync(pidFile, { force: true });
36441
+ fs16.rmSync(pidFile, { force: true });
36250
36442
  return {};
36251
36443
  }
36252
36444
  try {
@@ -36254,7 +36446,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36254
36446
  const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
36255
36447
  const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
36256
36448
  if (!verifiedCommand) {
36257
- fs15.rmSync(pidFile, { force: true });
36449
+ fs16.rmSync(pidFile, { force: true });
36258
36450
  return {
36259
36451
  previousPid: pid,
36260
36452
  previousStopped: false,
@@ -36264,7 +36456,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36264
36456
  process.kill(pid, "SIGTERM");
36265
36457
  const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
36266
36458
  if (stopped) {
36267
- fs15.rmSync(pidFile, { force: true });
36459
+ fs16.rmSync(pidFile, { force: true });
36268
36460
  return { previousPid: pid, previousStopped: true };
36269
36461
  }
36270
36462
  return {
@@ -36273,7 +36465,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36273
36465
  previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
36274
36466
  };
36275
36467
  } catch (error2) {
36276
- fs15.rmSync(pidFile, { force: true });
36468
+ fs16.rmSync(pidFile, { force: true });
36277
36469
  const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
36278
36470
  if (code === "ESRCH") {
36279
36471
  return { previousPid: pid, previousStopped: false };
@@ -36286,7 +36478,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36286
36478
  }
36287
36479
  }
36288
36480
  function readRuntimeLogWatcherPidState(pidFile) {
36289
- const raw = fs15.readFileSync(pidFile, "utf8").trim();
36481
+ const raw = fs16.readFileSync(pidFile, "utf8").trim();
36290
36482
  if (!raw) {
36291
36483
  return null;
36292
36484
  }
@@ -36302,7 +36494,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
36302
36494
  }
36303
36495
  }
36304
36496
  function writeRuntimeLogWatcherPidFile(pidFile, state) {
36305
- fs15.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
36497
+ fs16.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
36306
36498
  `, "utf8");
36307
36499
  }
36308
36500
  function getProcessCommand(pid) {
@@ -36388,10 +36580,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
36388
36580
  };
36389
36581
  }
36390
36582
  function resolveMakerCliEntry() {
36391
- return process.argv[1] || path16.resolve(process.cwd(), "dist", "maker.js");
36583
+ return process.argv[1] || path17.resolve(process.cwd(), "dist", "maker.js");
36392
36584
  }
36393
36585
  function getRuntimeLogFilePath(projectRoot) {
36394
- return path16.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
36586
+ return path17.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
36395
36587
  }
36396
36588
  async function refreshMakerPreview(buildResult) {
36397
36589
  const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
@@ -36525,7 +36717,7 @@ function createBuildArgs(projectRoot, options) {
36525
36717
  if (options.scriptsPath) {
36526
36718
  buildArgs.scriptsPath = options.scriptsPath;
36527
36719
  }
36528
- if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs15.existsSync(path16.join(projectRoot, "scripts", "main.lua"))) {
36720
+ if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs16.existsSync(path17.join(projectRoot, "scripts", "main.lua"))) {
36529
36721
  buildArgs.entry = "main.lua";
36530
36722
  buildArgs.scriptsPath = "scripts";
36531
36723
  }
@@ -36537,7 +36729,7 @@ function createBuildArgs(projectRoot, options) {
36537
36729
  }
36538
36730
  if (options.multiplayer) {
36539
36731
  buildArgs.multiplayer = options.multiplayer;
36540
- } else if (!fs15.existsSync(path16.join(projectRoot, ".project", "settings.json"))) {
36732
+ } else if (!options.entryClient && !options.entryServer && !fs16.existsSync(path17.join(projectRoot, ".project", "settings.json"))) {
36541
36733
  buildArgs.multiplayer = { enabled: false };
36542
36734
  }
36543
36735
  return buildArgs;
@@ -36616,6 +36808,17 @@ function formatBuildResult(result, progressSummary) {
36616
36808
  ] : []
36617
36809
  ].filter(Boolean).join("\n");
36618
36810
  }
36811
+ if (result.mode === "settings_invalid_before_build") {
36812
+ return [
36813
+ "✗ Maker project settings are invalid; submit and remote build were not started",
36814
+ "",
36815
+ `- project_root: ${result.projectRoot}`,
36816
+ `- project_id: ${result.projectId}`,
36817
+ ...formatProgressSummary(progressSummary),
36818
+ "",
36819
+ formatMakerProjectSettingsStatus(result.settingsStatus)
36820
+ ].filter(Boolean).join("\n");
36821
+ }
36619
36822
  if (result.mode === "build_failed_after_submit") {
36620
36823
  return [
36621
36824
  "✗ Maker project submitted, but remote Maker build failed",
@@ -36699,11 +36902,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
36699
36902
  ((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
36700
36903
  `- watch_command: ${command}`,
36701
36904
  ((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
36702
- `- local_file: ${path16.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
36905
+ `- local_file: ${path17.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
36703
36906
  ((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
36704
36907
  ((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
36705
36908
  ((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
36706
- `- state_file: ${path16.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
36909
+ `- state_file: ${path17.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
36707
36910
  ((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
36708
36911
  ((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
36709
36912
  ((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
@@ -36894,9 +37097,9 @@ function indent2(value) {
36894
37097
  // src/maker/cli/commands.ts
36895
37098
  import { spawnSync as spawnSync7 } from "node:child_process";
36896
37099
  import crypto3 from "node:crypto";
36897
- import fs16 from "node:fs";
37100
+ import fs17 from "node:fs";
36898
37101
  import os4 from "node:os";
36899
- import path17 from "node:path";
37102
+ import path18 from "node:path";
36900
37103
  import readline from "node:readline/promises";
36901
37104
  import { stdin as input, stdout as output } from "node:process";
36902
37105
 
@@ -37042,7 +37245,7 @@ function formatError2(error2) {
37042
37245
  }
37043
37246
 
37044
37247
  // src/maker/cli/commands.ts
37045
- var VERSION2 = true ? "0.0.24-beta.2" : "dev";
37248
+ var VERSION2 = true ? "0.0.24" : "dev";
37046
37249
  var DEFAULT_MCP_NAME = "taptap-maker";
37047
37250
  var MAKER_NPM_PACKAGE = "@taptap/maker";
37048
37251
  var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
@@ -37177,7 +37380,7 @@ function toOptionKey(value) {
37177
37380
  }
37178
37381
  async function runInit(parsed, ctx) {
37179
37382
  rejectPackageOption(parsed);
37180
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
37383
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37181
37384
  const env = makerEnvOption(parsed);
37182
37385
  const skipConfirm = booleanOption(parsed, "skip_confirm");
37183
37386
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -37270,7 +37473,7 @@ async function runInit(parsed, ctx) {
37270
37473
  }
37271
37474
  async function runDoctor(parsed, ctx) {
37272
37475
  var _a3, _b;
37273
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
37476
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37274
37477
  const env = makerEnvOption(parsed);
37275
37478
  const git = checkGitEnvironment();
37276
37479
  const python = checkMakerPythonEnvironment();
@@ -37293,6 +37496,7 @@ async function runDoctor(parsed, ctx) {
37293
37496
  makerProjectDir: identify.projectRoot
37294
37497
  });
37295
37498
  const projectInitialization = isProjectBound ? inspectMakerProjectInitialization(projectRoot) : void 0;
37499
+ const projectSettings = isProjectBound ? inspectMakerProjectSettings(projectRoot) : void 0;
37296
37500
  const workBuddyTrust = shouldShowWorkBuddyTrustInspection() ? inspectWorkBuddyTrustState(DEFAULT_MCP_NAME) : void 0;
37297
37501
  if (ctx.json) {
37298
37502
  writeJson({
@@ -37310,6 +37514,7 @@ async function runDoctor(parsed, ctx) {
37310
37514
  dev_kit_update: devKitUpdate,
37311
37515
  package_update: packageUpdate,
37312
37516
  project_initialization: projectInitialization,
37517
+ project_settings: projectSettings,
37313
37518
  mcp_tools_availability: mcpToolsAvailability,
37314
37519
  ...workBuddyTrust ? { workbuddy_trust: workBuddyTrust } : {},
37315
37520
  orphan_process_check: orphanProcessCheck
@@ -37338,6 +37543,7 @@ async function runDoctor(parsed, ctx) {
37338
37543
  `- project_id: ${identify.projectId || "(none)"}`,
37339
37544
  identify.configPath ? `- config: ${identify.configPath}` : "",
37340
37545
  projectInitialization ? formatMakerProjectInitializationStatus(projectInitialization) : "",
37546
+ projectSettings ? formatMakerProjectSettingsStatus(projectSettings) : "",
37341
37547
  isProjectBound ? formatMakerAgentsPolicyStatus(projectRoot) : "",
37342
37548
  "",
37343
37549
  "AI dev kit",
@@ -37361,9 +37567,9 @@ async function runDoctor(parsed, ctx) {
37361
37567
  );
37362
37568
  }
37363
37569
  function inspectMakerMcpToolsAvailability(options) {
37364
- const aiPwd = path17.resolve(process.cwd());
37570
+ const aiPwd = path18.resolve(process.cwd());
37365
37571
  const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
37366
- const makerProjectDir = options.makerProjectDir ? path17.resolve(options.makerProjectDir) : void 0;
37572
+ const makerProjectDir = options.makerProjectDir ? path18.resolve(options.makerProjectDir) : void 0;
37367
37573
  if (!makerProjectDir) {
37368
37574
  return {
37369
37575
  tools_visibility: "refresh_ai_client_if_missing",
@@ -37405,9 +37611,9 @@ function samePath2(left, right) {
37405
37611
  return normalizePathForCompare3(left) === normalizePathForCompare3(right);
37406
37612
  }
37407
37613
  function normalizePathForCompare3(value) {
37408
- const resolved = path17.resolve(value);
37614
+ const resolved = path18.resolve(value);
37409
37615
  try {
37410
- return fs16.realpathSync.native(resolved);
37616
+ return fs17.realpathSync.native(resolved);
37411
37617
  } catch {
37412
37618
  return resolved;
37413
37619
  }
@@ -37725,7 +37931,7 @@ async function runPatSet(parsed, ctx) {
37725
37931
  }
37726
37932
  async function resolvePatSet(parsed, ctx) {
37727
37933
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
37728
- const pat = fs16.readFileSync(0, "utf8").trim();
37934
+ const pat = fs17.readFileSync(0, "utf8").trim();
37729
37935
  if (!pat) {
37730
37936
  throw new Error("No PAT found on stdin.");
37731
37937
  }
@@ -37755,7 +37961,7 @@ async function runMcpInstall(parsed, ctx) {
37755
37961
  env: makerEnvOption(parsed),
37756
37962
  pkg: MAKER_NPM_PACKAGE,
37757
37963
  mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
37758
- cwd: explicitTargetDir ? path17.resolve(explicitTargetDir) : void 0
37964
+ cwd: explicitTargetDir ? path18.resolve(explicitTargetDir) : void 0
37759
37965
  });
37760
37966
  if (ctx.json) {
37761
37967
  writeJson(results);
@@ -37814,7 +38020,7 @@ ${indent3(payload.stderr)}` : "",
37814
38020
  );
37815
38021
  }
37816
38022
  async function runAgentsUpdate(parsed, ctx) {
37817
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
38023
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37818
38024
  const result = updateMakerAgentsPolicy(targetDir);
37819
38025
  if (ctx.json) {
37820
38026
  writeJson(result);
@@ -37833,7 +38039,7 @@ async function runAgentsUpdate(parsed, ctx) {
37833
38039
  async function runUpgrade(parsed, ctx) {
37834
38040
  rejectPackageOption(parsed);
37835
38041
  const explicitTargetDir = stringOption(parsed, "target_dir");
37836
- const targetDir = path17.resolve(explicitTargetDir || process.cwd());
38042
+ const targetDir = path18.resolve(explicitTargetDir || process.cwd());
37837
38043
  const env = makerEnvOption(parsed);
37838
38044
  const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
37839
38045
  const installResults = installMcpConfigs({
@@ -37918,7 +38124,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
37918
38124
  ];
37919
38125
  }
37920
38126
  async function runDevKitUpdate(parsed, ctx) {
37921
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
38127
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37922
38128
  const result = await installAiDevKit({
37923
38129
  targetDir,
37924
38130
  preserveExisting: false,
@@ -37930,7 +38136,7 @@ async function runDevKitUpdate(parsed, ctx) {
37930
38136
  emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
37931
38137
  }
37932
38138
  async function runLogsWatch(parsed, ctx) {
37933
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
38139
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37934
38140
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
37935
38141
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
37936
38142
  const maxPolls = numberOption(parsed, "max_polls");
@@ -37940,9 +38146,9 @@ async function runLogsWatch(parsed, ctx) {
37940
38146
  serverUrl: stringOption(parsed, "server_url"),
37941
38147
  env: makerEnvOption(parsed)
37942
38148
  });
37943
- const runtimeDir = path17.join(proxy.projectRoot, ".maker", "logs", "runtime");
37944
- const runtimeLog = path17.join(runtimeDir, "runtime.log");
37945
- const pidFile = path17.join(runtimeDir, "watcher.pid");
38149
+ const runtimeDir = path18.join(proxy.projectRoot, ".maker", "logs", "runtime");
38150
+ const runtimeLog = path18.join(runtimeDir, "runtime.log");
38151
+ const pidFile = path18.join(runtimeDir, "watcher.pid");
37946
38152
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
37947
38153
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
37948
38154
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -37987,10 +38193,10 @@ async function runLogsWatch(parsed, ctx) {
37987
38193
  }
37988
38194
  }
37989
38195
  function registerRuntimeLogWatcherProcess(pidFile) {
37990
- fs16.mkdirSync(path17.dirname(pidFile), { recursive: true });
38196
+ fs17.mkdirSync(path18.dirname(pidFile), { recursive: true });
37991
38197
  const existingPid = readPidFile(pidFile);
37992
38198
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
37993
- fs16.writeFileSync(
38199
+ fs17.writeFileSync(
37994
38200
  pidFile,
37995
38201
  `${JSON.stringify(
37996
38202
  {
@@ -38008,10 +38214,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
38008
38214
  return previous;
38009
38215
  }
38010
38216
  function readPidFile(pidFile) {
38011
- if (!fs16.existsSync(pidFile)) {
38217
+ if (!fs17.existsSync(pidFile)) {
38012
38218
  return void 0;
38013
38219
  }
38014
- const raw = fs16.readFileSync(pidFile, "utf8").trim();
38220
+ const raw = fs17.readFileSync(pidFile, "utf8").trim();
38015
38221
  let pid = Number(raw);
38016
38222
  if (!Number.isInteger(pid) || pid <= 0) {
38017
38223
  try {
@@ -38031,7 +38237,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
38031
38237
  }
38032
38238
  cleaned = true;
38033
38239
  if (readPidFile(pidFile) === process.pid) {
38034
- fs16.rmSync(pidFile, { force: true });
38240
+ fs17.rmSync(pidFile, { force: true });
38035
38241
  }
38036
38242
  };
38037
38243
  process.once("exit", cleanup);
@@ -38182,7 +38388,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
38182
38388
  onStart: (event) => emitSkillInstallerStart(ctx, event)
38183
38389
  });
38184
38390
  writeDevKitStagedGitignore(
38185
- path17.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
38391
+ path18.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
38186
38392
  listPresentDevKitManagedEntries(targetDir)
38187
38393
  );
38188
38394
  if (options.finalizeGitignore) {
@@ -38199,7 +38405,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
38199
38405
  );
38200
38406
  } catch (error2) {
38201
38407
  writeDevKitStagedGitignore(
38202
- path17.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
38408
+ path18.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
38203
38409
  listPresentDevKitManagedEntries(targetDir)
38204
38410
  );
38205
38411
  if (options.finalizeGitignore) {
@@ -38289,12 +38495,12 @@ function installMcpConfig(ide, options) {
38289
38495
  }
38290
38496
  function installMcpConfigUnsafe(ide, options) {
38291
38497
  if (ide === "codex") {
38292
- const configPath = path17.join(os4.homedir(), ".codex", "config.toml");
38498
+ const configPath = path18.join(os4.homedir(), ".codex", "config.toml");
38293
38499
  const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
38294
38500
  return [createMcpInstallResult(ide, "Codex", configPath, write)];
38295
38501
  }
38296
38502
  if (ide === "cursor") {
38297
- const configPath = path17.join(os4.homedir(), ".cursor", "mcp.json");
38503
+ const configPath = path18.join(os4.homedir(), ".cursor", "mcp.json");
38298
38504
  const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
38299
38505
  return [createMcpInstallResult(ide, "Cursor", configPath, write)];
38300
38506
  }
@@ -38312,7 +38518,7 @@ function installMcpConfigUnsafe(ide, options) {
38312
38518
  ];
38313
38519
  }
38314
38520
  }
38315
- const configPath = path17.join(os4.homedir(), ".claude.json");
38521
+ const configPath = path18.join(os4.homedir(), ".claude.json");
38316
38522
  const write = mergeJsonMcpConfig(configPath, claudeOptions);
38317
38523
  return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
38318
38524
  }
@@ -38326,7 +38532,7 @@ function installMcpConfigUnsafe(ide, options) {
38326
38532
  }
38327
38533
  if (ide === "opencode") {
38328
38534
  const configPath = getOpenCodeMcpConfigPath();
38329
- if (!fs16.existsSync(configPath)) {
38535
+ if (!fs17.existsSync(configPath)) {
38330
38536
  return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
38331
38537
  }
38332
38538
  const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
@@ -38394,7 +38600,7 @@ function getDefaultMcpInstallIdes() {
38394
38600
  if (getTraeMcpInstallPaths().length > 0) {
38395
38601
  ides.push("trae");
38396
38602
  }
38397
- if (fs16.existsSync(getOpenCodeMcpConfigPath())) {
38603
+ if (fs17.existsSync(getOpenCodeMcpConfigPath())) {
38398
38604
  ides.push("opencode");
38399
38605
  }
38400
38606
  if (getWorkBuddyMcpInstallPaths().length > 0) {
@@ -38411,7 +38617,7 @@ function getExistingTraeUserConfigPaths(paths) {
38411
38617
  const seen = /* @__PURE__ */ new Set();
38412
38618
  return paths.filter((configPath) => {
38413
38619
  const key = normalizeConfigPathKey(configPath);
38414
- if (seen.has(key) || !fs16.existsSync(path17.dirname(configPath))) {
38620
+ if (seen.has(key) || !fs17.existsSync(path18.dirname(configPath))) {
38415
38621
  return false;
38416
38622
  }
38417
38623
  seen.add(key);
@@ -38422,7 +38628,7 @@ function getExistingConfigPaths(paths) {
38422
38628
  const seen = /* @__PURE__ */ new Set();
38423
38629
  return paths.filter((configPath) => {
38424
38630
  const key = normalizeConfigPathKey(configPath);
38425
- if (seen.has(key) || !fs16.existsSync(configPath)) {
38631
+ if (seen.has(key) || !fs17.existsSync(configPath)) {
38426
38632
  return false;
38427
38633
  }
38428
38634
  seen.add(key);
@@ -38430,65 +38636,65 @@ function getExistingConfigPaths(paths) {
38430
38636
  });
38431
38637
  }
38432
38638
  function normalizeConfigPathKey(configPath) {
38433
- const resolved = path17.resolve(configPath);
38639
+ const resolved = path18.resolve(configPath);
38434
38640
  return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
38435
38641
  }
38436
38642
  function getTraeSoloMcpConfigPaths() {
38437
38643
  if (process.platform === "win32") {
38438
- const roaming = process.env.APPDATA || path17.join(os4.homedir(), "AppData", "Roaming");
38644
+ const roaming = process.env.APPDATA || path18.join(os4.homedir(), "AppData", "Roaming");
38439
38645
  return [
38440
- path17.join(roaming, "TRAE SOLO", "User", "mcp.json"),
38441
- path17.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
38646
+ path18.join(roaming, "TRAE SOLO", "User", "mcp.json"),
38647
+ path18.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
38442
38648
  ];
38443
38649
  }
38444
- const appSupport = path17.join(os4.homedir(), "Library", "Application Support");
38650
+ const appSupport = path18.join(os4.homedir(), "Library", "Application Support");
38445
38651
  return [
38446
- path17.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
38447
- path17.join(appSupport, "TRAE SOLO", "User", "mcp.json")
38652
+ path18.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
38653
+ path18.join(appSupport, "TRAE SOLO", "User", "mcp.json")
38448
38654
  ];
38449
38655
  }
38450
38656
  function getTraeUnverifiedMcpConfigPaths() {
38451
38657
  if (process.platform === "win32") {
38452
- const roaming = process.env.APPDATA || path17.join(os4.homedir(), "AppData", "Roaming");
38658
+ const roaming = process.env.APPDATA || path18.join(os4.homedir(), "AppData", "Roaming");
38453
38659
  return [
38454
- path17.join(roaming, "Trae", "User", "mcp.json"),
38455
- path17.join(roaming, "TRAE", "User", "mcp.json"),
38456
- path17.join(roaming, "Trae CN", "User", "mcp.json")
38660
+ path18.join(roaming, "Trae", "User", "mcp.json"),
38661
+ path18.join(roaming, "TRAE", "User", "mcp.json"),
38662
+ path18.join(roaming, "Trae CN", "User", "mcp.json")
38457
38663
  ];
38458
38664
  }
38459
- const appSupport = path17.join(os4.homedir(), "Library", "Application Support");
38665
+ const appSupport = path18.join(os4.homedir(), "Library", "Application Support");
38460
38666
  return [
38461
- path17.join(appSupport, "Trae", "User", "mcp.json"),
38462
- path17.join(appSupport, "TRAE", "User", "mcp.json"),
38463
- path17.join(appSupport, "Trae CN", "User", "mcp.json")
38667
+ path18.join(appSupport, "Trae", "User", "mcp.json"),
38668
+ path18.join(appSupport, "TRAE", "User", "mcp.json"),
38669
+ path18.join(appSupport, "Trae CN", "User", "mcp.json")
38464
38670
  ];
38465
38671
  }
38466
38672
  function getOpenCodeMcpConfigPath() {
38467
- return path17.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
38673
+ return path18.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
38468
38674
  }
38469
38675
  function getWorkBuddyHome() {
38470
- return path17.join(os4.homedir(), ".workbuddy");
38676
+ return path18.join(os4.homedir(), ".workbuddy");
38471
38677
  }
38472
38678
  function shouldShowWorkBuddyTrustInspection() {
38473
- return fs16.existsSync(getWorkBuddyHome());
38679
+ return fs17.existsSync(getWorkBuddyHome());
38474
38680
  }
38475
38681
  function getWorkBuddyMcpInstallPaths(options = {}) {
38476
- const primary = path17.join(getWorkBuddyHome(), "mcp.json");
38477
- if (fs16.existsSync(primary) || options.createPrimary) {
38682
+ const primary = path18.join(getWorkBuddyHome(), "mcp.json");
38683
+ if (fs17.existsSync(primary) || options.createPrimary) {
38478
38684
  return [primary];
38479
38685
  }
38480
- const legacy = path17.join(getWorkBuddyHome(), ".mcp.json");
38481
- if (fs16.existsSync(legacy)) {
38686
+ const legacy = path18.join(getWorkBuddyHome(), ".mcp.json");
38687
+ if (fs17.existsSync(legacy)) {
38482
38688
  return [legacy];
38483
38689
  }
38484
38690
  return [];
38485
38691
  }
38486
38692
  function inspectWorkBuddyTrustState(mcpName) {
38487
38693
  const workbuddyHome = getWorkBuddyHome();
38488
- const connectorsDir = path17.join(workbuddyHome, "connectors");
38694
+ const connectorsDir = path18.join(workbuddyHome, "connectors");
38489
38695
  const accounts = [];
38490
38696
  const stateFiles = [];
38491
- if (!fs16.existsSync(connectorsDir)) {
38697
+ if (!fs17.existsSync(connectorsDir)) {
38492
38698
  return {
38493
38699
  status: "not_found",
38494
38700
  mcp_name: mcpName,
@@ -38498,12 +38704,12 @@ function inspectWorkBuddyTrustState(mcpName) {
38498
38704
  accounts
38499
38705
  };
38500
38706
  }
38501
- for (const entry of fs16.readdirSync(connectorsDir, { withFileTypes: true })) {
38707
+ for (const entry of fs17.readdirSync(connectorsDir, { withFileTypes: true })) {
38502
38708
  if (!entry.isDirectory()) {
38503
38709
  continue;
38504
38710
  }
38505
- const statePath = path17.join(connectorsDir, entry.name, "connector-states.json");
38506
- if (!fs16.existsSync(statePath)) {
38711
+ const statePath = path18.join(connectorsDir, entry.name, "connector-states.json");
38712
+ if (!fs17.existsSync(statePath)) {
38507
38713
  continue;
38508
38714
  }
38509
38715
  stateFiles.push(statePath);
@@ -38578,7 +38784,7 @@ function mergeJsonMcpConfig(configPath, options) {
38578
38784
  );
38579
38785
  }
38580
38786
  function mergeOpenCodeMcpConfig(configPath, options) {
38581
- const rawContent = fs16.readFileSync(configPath, "utf8");
38787
+ const rawContent = fs17.readFileSync(configPath, "utf8");
38582
38788
  const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
38583
38789
  const existing = readJsonObject(configPath, { jsonc: true });
38584
38790
  const mcp = asObject(existing.mcp);
@@ -38605,7 +38811,7 @@ function mergeOpenCodeMcpConfig(configPath, options) {
38605
38811
  return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
38606
38812
  }
38607
38813
  function mergeCodexMcpConfig(configPath, options) {
38608
- const existing = fs16.existsSync(configPath) ? fs16.readFileSync(configPath, "utf8") : "";
38814
+ const existing = fs17.existsSync(configPath) ? fs17.readFileSync(configPath, "utf8") : "";
38609
38815
  const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
38610
38816
  const withoutOld = existing.replace(sectionPattern, "").trimEnd();
38611
38817
  const launch = getNpxCliCommand(options.pkg);
@@ -38775,10 +38981,10 @@ function rejectPackageOption(parsed) {
38775
38981
  }
38776
38982
  }
38777
38983
  function readJsonObject(filePath, options = {}) {
38778
- if (!fs16.existsSync(filePath)) {
38984
+ if (!fs17.existsSync(filePath)) {
38779
38985
  return {};
38780
38986
  }
38781
- const raw = fs16.readFileSync(filePath, "utf8");
38987
+ const raw = fs17.readFileSync(filePath, "utf8");
38782
38988
  try {
38783
38989
  const normalized = normalizeJsonConfigContent(raw, options);
38784
38990
  const parsed = JSON.parse(normalized);
@@ -38798,25 +39004,25 @@ function asObject(value) {
38798
39004
  return {};
38799
39005
  }
38800
39006
  function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
38801
- const existed = fs16.existsSync(filePath);
38802
- const previousContent = existed ? fs16.readFileSync(filePath, "utf8") : void 0;
39007
+ const existed = fs17.existsSync(filePath);
39008
+ const previousContent = existed ? fs17.readFileSync(filePath, "utf8") : void 0;
38803
39009
  if (previousContent === nextContent) {
38804
39010
  return { changed: false };
38805
39011
  }
38806
39012
  const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
38807
- fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
39013
+ fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
38808
39014
  if (previousContent !== void 0 && backupPath) {
38809
- fs16.writeFileSync(backupPath, previousContent, "utf8");
39015
+ fs17.writeFileSync(backupPath, previousContent, "utf8");
38810
39016
  }
38811
39017
  try {
38812
- fs16.writeFileSync(filePath, nextContent, "utf8");
38813
- validate == null ? void 0 : validate(fs16.readFileSync(filePath, "utf8"));
39018
+ fs17.writeFileSync(filePath, nextContent, "utf8");
39019
+ validate == null ? void 0 : validate(fs17.readFileSync(filePath, "utf8"));
38814
39020
  return { changed: true, backupPath };
38815
39021
  } catch (error2) {
38816
39022
  if (previousContent !== void 0) {
38817
- fs16.writeFileSync(filePath, previousContent, "utf8");
39023
+ fs17.writeFileSync(filePath, previousContent, "utf8");
38818
39024
  } else {
38819
- fs16.rmSync(filePath, { force: true });
39025
+ fs17.rmSync(filePath, { force: true });
38820
39026
  }
38821
39027
  throw error2;
38822
39028
  }
@@ -38963,10 +39169,10 @@ function formatMcpInstallMessage(label, configPath, write) {
38963
39169
  ].filter(Boolean).join("\n");
38964
39170
  }
38965
39171
  function saveInitState(targetDir, state) {
38966
- fs16.mkdirSync(getMakerHome(), { recursive: true });
38967
- const key = crypto3.createHash("sha256").update(path17.resolve(targetDir)).digest("hex").slice(0, 16);
38968
- fs16.writeFileSync(
38969
- path17.join(getMakerHome(), `init-state-${key}.json`),
39172
+ fs17.mkdirSync(getMakerHome(), { recursive: true });
39173
+ const key = crypto3.createHash("sha256").update(path18.resolve(targetDir)).digest("hex").slice(0, 16);
39174
+ fs17.writeFileSync(
39175
+ path18.join(getMakerHome(), `init-state-${key}.json`),
38970
39176
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
38971
39177
  `,
38972
39178
  "utf8"
@@ -39114,7 +39320,7 @@ function makerEnvOption(parsed) {
39114
39320
  return env;
39115
39321
  }
39116
39322
  const targetDir = stringOption(parsed, "target_dir");
39117
- return getMakerEnvironment(void 0, targetDir ? path17.resolve(targetDir) : process.cwd());
39323
+ return getMakerEnvironment(void 0, targetDir ? path18.resolve(targetDir) : process.cwd());
39118
39324
  }
39119
39325
  function mcpVerifyModeOption(parsed) {
39120
39326
  const mode = stringOption(parsed, "mode") || "npx";
@@ -40618,7 +40824,7 @@ var StreamableHTTPClientTransport = class {
40618
40824
  };
40619
40825
 
40620
40826
  // src/mcp-proxy/proxy.ts
40621
- import * as path19 from "node:path";
40827
+ import * as path20 from "node:path";
40622
40828
  import * as crypto6 from "node:crypto";
40623
40829
 
40624
40830
  // src/mcp-proxy/cookieJar.ts
@@ -40800,8 +41006,8 @@ function createCookieFetch(cookieJar) {
40800
41006
  }
40801
41007
 
40802
41008
  // src/core/utils/logWriter.ts
40803
- import * as fs17 from "node:fs";
40804
- import * as path18 from "node:path";
41009
+ import * as fs18 from "node:fs";
41010
+ import * as path19 from "node:path";
40805
41011
  import * as crypto5 from "node:crypto";
40806
41012
 
40807
41013
  // src/core/types/log.ts
@@ -40842,7 +41048,7 @@ var LogWriter = class {
40842
41048
  return;
40843
41049
  }
40844
41050
  try {
40845
- await fs17.promises.mkdir(this.config.logDir, { recursive: true });
41051
+ await fs18.promises.mkdir(this.config.logDir, { recursive: true });
40846
41052
  await this.cleanupOldLogs();
40847
41053
  this.initialized = true;
40848
41054
  } catch (error2) {
@@ -40865,7 +41071,7 @@ var LogWriter = class {
40865
41071
  */
40866
41072
  getLogFilePath(date5) {
40867
41073
  const d = date5 || this.getCurrentDate();
40868
- return path18.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
41074
+ return path19.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
40869
41075
  }
40870
41076
  /**
40871
41077
  * 获取或创建写入流
@@ -40880,7 +41086,7 @@ var LogWriter = class {
40880
41086
  }
40881
41087
  this.currentDate = date5;
40882
41088
  try {
40883
- this.writeStream = fs17.createWriteStream(this.getLogFilePath(date5), {
41089
+ this.writeStream = fs18.createWriteStream(this.getLogFilePath(date5), {
40884
41090
  flags: "a",
40885
41091
  encoding: "utf8"
40886
41092
  });
@@ -40932,11 +41138,11 @@ var LogWriter = class {
40932
41138
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
40933
41139
  try {
40934
41140
  const filePath = this.getLogFilePath();
40935
- const dir = path18.dirname(filePath);
40936
- if (!fs17.existsSync(dir)) {
40937
- fs17.mkdirSync(dir, { recursive: true });
41141
+ const dir = path19.dirname(filePath);
41142
+ if (!fs18.existsSync(dir)) {
41143
+ fs18.mkdirSync(dir, { recursive: true });
40938
41144
  }
40939
- fs17.appendFileSync(filePath, message, "utf8");
41145
+ fs18.appendFileSync(filePath, message, "utf8");
40940
41146
  } catch {
40941
41147
  }
40942
41148
  }
@@ -40947,7 +41153,7 @@ var LogWriter = class {
40947
41153
  async cleanupOldLogs() {
40948
41154
  if (this.config.maxDays <= 0) return;
40949
41155
  try {
40950
- const files = await fs17.promises.readdir(this.config.logDir);
41156
+ const files = await fs18.promises.readdir(this.config.logDir);
40951
41157
  const cutoffDate = /* @__PURE__ */ new Date();
40952
41158
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
40953
41159
  const prefix = this.config.prefix;
@@ -40962,7 +41168,7 @@ var LogWriter = class {
40962
41168
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
40963
41169
  const fileDate = new Date(year, month - 1, day);
40964
41170
  if (fileDate < cutoffDate) {
40965
- await fs17.promises.unlink(path18.join(this.config.logDir, file2));
41171
+ await fs18.promises.unlink(path19.join(this.config.logDir, file2));
40966
41172
  process.stderr.write(`[LogWriter] Deleted old log: ${file2}
40967
41173
  `);
40968
41174
  }
@@ -41036,10 +41242,10 @@ var TapTapMCPProxy = class {
41036
41242
  const { user_id, project_id } = this.config.tenant;
41037
41243
  let logDir;
41038
41244
  if (user_id && project_id) {
41039
- logDir = path19.join(logRoot, "proxy", user_id, project_id);
41245
+ logDir = path20.join(logRoot, "proxy", user_id, project_id);
41040
41246
  } else {
41041
41247
  const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
41042
- logDir = path19.join(logRoot, "proxy", kidHash);
41248
+ logDir = path20.join(logRoot, "proxy", kidHash);
41043
41249
  }
41044
41250
  return new LogWriter({
41045
41251
  logDir,