@taptap/maker 0.0.24-beta.2 → 0.0.25-beta.1

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
  }
@@ -29288,11 +29288,10 @@ function createMakerAgentsPolicyBody() {
29288
29288
  "- `create_video_task` for game video assets or referenced image/video generation.",
29289
29289
  "- `query_video_task` for refreshing video task status and fetching completed videos.",
29290
29290
  "- `text_to_music` for game music or audio assets.",
29291
- "- `create_3d_model_task` for game 3D model assets.",
29292
- "- `query_3d_model_task` for polling 3D model tasks.",
29293
- "- For 3D characters that need skeletons, animation, or FBX output, ask whether to use",
29294
- " `rig=true`. Use it only for biped humanoid characters in A-pose or A-pose-compatible",
29295
- " front-view inputs; otherwise keep static model generation.",
29291
+ "- `create_3d_asset` for the complete 3D lifecycle: start, query, explicit review continuation,",
29292
+ " option inspection, and post-processing.",
29293
+ "- Never automatically continue a 3D review step. Show returned previews and wait for explicit",
29294
+ ' user approval before calling `create_3d_asset` with `action="continue"`.',
29296
29295
  "",
29297
29296
  "Follow each Maker tool schema for supported local path, remote URL, and data URL inputs.",
29298
29297
  "If the user references attached/local media, inspect the attachment or workspace file path",
@@ -29307,8 +29306,8 @@ function createMakerAgentsPolicyBody() {
29307
29306
  "Generated Maker proxy assets should stay in the Maker project asset workflow under",
29308
29307
  "`assets/image`, `assets/video`, `assets/audio`, or `assets/model`, with remote mappings",
29309
29308
  "preserved for later edits and builds.",
29310
- "3D model results save the original GLB/FBX, the MDL zip, extracted MDL assets, and rendered",
29311
- "preview images when those URLs are returned."
29309
+ "`create_3d_asset` local runtime `model_files` copy/extract instructions are materialized into",
29310
+ "`assets/model`. Use `local_delivery` for the usable local model path and preserve the remote result."
29312
29311
  ].join("\n");
29313
29312
  }
29314
29313
  function hashPolicyBody(body) {
@@ -32347,7 +32346,7 @@ function formatMakerSkillStatus(_options = {}) {
32347
32346
  "- If Maker proxy tools are missing, explain the session/configuration issue and available alternatives.",
32348
32347
  "- Use generate_image, batch_generate_images, edit_image for game image assets.",
32349
32348
  "- Use create_video_task, query_video_task, and text_to_music for game video/audio assets.",
32350
- "- Use create_3d_model_task and query_3d_model_task for game 3D model assets.",
32349
+ "- Use create_3d_asset with start/query/continue/post_process for game 3D model assets.",
32351
32350
  "- For any ad-related request, call get_ad_config first to get ad activation status and ad config.",
32352
32351
  "- Do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks.",
32353
32352
  "- If .project/project.json is missing, build once with maker_build_current_directory, then call get_ad_config again.",
@@ -32357,8 +32356,8 @@ function formatMakerSkillStatus(_options = {}) {
32357
32356
  "- Generated assets are saved under assets/image, assets/video, assets/audio, or assets/model with remote mappings.",
32358
32357
  "- Follow each tool schema for supported local path, remote URL, and data URL inputs.",
32359
32358
  "- Local proxy may convert resolvable local reference media to data URLs before forwarding.",
32360
- "- Generated 3D outputs save original GLB/FBX and MDL zip under assets/model.",
32361
- "- MDL zip contents are extracted into assets/Meshes, assets/Materials, assets/Textures, and assets/Prefabs.",
32359
+ "- create_3d_asset local runtime model_files copy/extract instructions are materialized under assets/model.",
32360
+ "- Use local_delivery for the usable local model path and preview_assets for local review images.",
32362
32361
  "Maker initialization next_step: execute `taptap-maker init`.",
32363
32362
  "Load these documents when the current AI client supports reading local guide files."
32364
32363
  ].join("\n");
@@ -33335,9 +33334,138 @@ function isNonEmptyStringLike(value) {
33335
33334
  return value !== void 0 && value !== null && String(value).trim() !== "";
33336
33335
  }
33337
33336
 
33338
- // src/maker/server/proxyAssets.ts
33337
+ // src/maker/projectSettings.ts
33339
33338
  import fs14 from "node:fs";
33340
33339
  import path15 from "node:path";
33340
+ var REQUIRED_SOURCE_TAGS = ["stable"];
33341
+ function inspectMakerProjectSettings(projectRoot) {
33342
+ const resolvedProjectRoot = path15.resolve(projectRoot);
33343
+ const settingsJsonPath = path15.join(resolvedProjectRoot, ".project", "settings.json");
33344
+ const baseStatus = {
33345
+ projectRoot: resolvedProjectRoot,
33346
+ settingsJsonPath
33347
+ };
33348
+ if (!fs14.existsSync(settingsJsonPath)) {
33349
+ return {
33350
+ ...baseStatus,
33351
+ status: "missing_settings_json"
33352
+ };
33353
+ }
33354
+ let settings;
33355
+ try {
33356
+ settings = JSON.parse(fs14.readFileSync(settingsJsonPath, "utf8"));
33357
+ } catch (error2) {
33358
+ return {
33359
+ ...baseStatus,
33360
+ status: "invalid_settings_json",
33361
+ error: error2 instanceof Error ? error2.message : String(error2)
33362
+ };
33363
+ }
33364
+ const issues = validateMakerProjectSettings(settings);
33365
+ if (issues.length > 0) {
33366
+ return {
33367
+ ...baseStatus,
33368
+ status: "invalid_project_settings",
33369
+ issues
33370
+ };
33371
+ }
33372
+ return {
33373
+ ...baseStatus,
33374
+ status: "ready"
33375
+ };
33376
+ }
33377
+ function formatMakerProjectSettingsStatus(status) {
33378
+ var _a3;
33379
+ if (status.status === "ready" || status.status === "missing_settings_json") {
33380
+ return "";
33381
+ }
33382
+ const lines = [
33383
+ "Maker project settings",
33384
+ "",
33385
+ `- status: ${status.status}`,
33386
+ `- config: ${status.settingsJsonPath}`,
33387
+ "- impact: 构建可能失败或游戏黑屏;坏配置不应提交到 Maker 远端。"
33388
+ ];
33389
+ if (status.error) {
33390
+ lines.push(`- error: ${status.error}`);
33391
+ }
33392
+ if ((_a3 = status.issues) == null ? void 0 : _a3.length) {
33393
+ lines.push("- issues:");
33394
+ lines.push(...status.issues.map((issue2) => ` - ${issue2}`));
33395
+ }
33396
+ lines.push(
33397
+ "- next_action: 恢复 .project/settings.json 的构建关键字段后再构建;保留合法的 @runtime 配置。"
33398
+ );
33399
+ return lines.join("\n");
33400
+ }
33401
+ function isMakerProjectSettingsBlocking(status) {
33402
+ return status.status === "invalid_settings_json" || status.status === "invalid_project_settings";
33403
+ }
33404
+ function validateMakerProjectSettings(settings) {
33405
+ const issues = [];
33406
+ if (!isPlainObject3(settings)) {
33407
+ return ["settings.json must be a JSON object"];
33408
+ }
33409
+ expectValue(settings, "$schema", "../schemas/settings.schema.json", issues);
33410
+ const sources = readPath(settings, "sources");
33411
+ if (!isPlainObject3(sources)) {
33412
+ issues.push("sources must be an object");
33413
+ } else {
33414
+ expectOneOf(settings, "sources.engine.tag", REQUIRED_SOURCE_TAGS, issues);
33415
+ expectOneOf(settings, "sources.engine-res.tag", REQUIRED_SOURCE_TAGS, issues);
33416
+ expectOneOf(settings, "sources.official-res.tag", REQUIRED_SOURCE_TAGS, issues);
33417
+ }
33418
+ const build = readPath(settings, "build");
33419
+ if (!isPlainObject3(build)) {
33420
+ issues.push("build must be an object");
33421
+ return issues;
33422
+ }
33423
+ expectValue(settings, "build.generate_fs_path", true, issues);
33424
+ expectValue(settings, "build.output_dir", "../dist", issues);
33425
+ const assetDirs = readPath(build, "asset_dirs");
33426
+ if (!isStringArray(assetDirs) || !sameStringSet(assetDirs, ["../assets", "../scripts"])) {
33427
+ issues.push('build.asset_dirs must contain only "../assets" and "../scripts"');
33428
+ }
33429
+ if (readPath(build, "asset_ignores") === void 0) {
33430
+ issues.push("build.asset_ignores must exist");
33431
+ }
33432
+ return issues;
33433
+ }
33434
+ function expectValue(settings, fieldPath, expected, issues) {
33435
+ if (readPath(settings, fieldPath) !== expected) {
33436
+ issues.push(`${fieldPath} must be ${JSON.stringify(expected)}`);
33437
+ }
33438
+ }
33439
+ function expectOneOf(settings, fieldPath, expectedValues, issues) {
33440
+ if (!expectedValues.includes(String(readPath(settings, fieldPath)))) {
33441
+ issues.push(
33442
+ `${fieldPath} must be ${expectedValues.map((value) => JSON.stringify(value)).join(" or ")}`
33443
+ );
33444
+ }
33445
+ }
33446
+ function readPath(value, fieldPath) {
33447
+ let current = value;
33448
+ for (const segment of fieldPath.split(".")) {
33449
+ if (!isPlainObject3(current)) {
33450
+ return void 0;
33451
+ }
33452
+ current = current[segment];
33453
+ }
33454
+ return current;
33455
+ }
33456
+ function isPlainObject3(value) {
33457
+ return typeof value === "object" && value !== null && !Array.isArray(value);
33458
+ }
33459
+ function isStringArray(value) {
33460
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
33461
+ }
33462
+ function sameStringSet(left, right) {
33463
+ return left.length === right.length && right.every((item) => left.includes(item));
33464
+ }
33465
+
33466
+ // src/maker/server/proxyAssets.ts
33467
+ import fs15 from "node:fs";
33468
+ import path16 from "node:path";
33341
33469
  var IMAGE_ASSET_DIRS = ["assets/image"];
33342
33470
  var VIDEO_ASSET_DIRS = ["assets/video"];
33343
33471
  var AUDIO_ASSET_DIRS = ["assets/audio"];
@@ -33348,6 +33476,7 @@ var VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES = 30 * 1024 * 1024;
33348
33476
  var VIDEO_REFERENCE_MAX_BYTES = 50 * 1024 * 1024;
33349
33477
  var AUDIO_REFERENCE_MAX_BYTES = 15 * 1024 * 1024;
33350
33478
  var DEBUG_FEEDBACK_PATH_HINT = "Use local_dir/local_log_paths/local_screenshot_paths when they are returned. If only local_candidate_* is present, it is a possible project-relative location and must not be treated as a downloaded local file.";
33479
+ var CREATE_3D_ASSET_PROXY_TOOL_NAME = "create_3d_asset";
33351
33480
  var DATA_URL_MIME_BY_EXTENSION = {
33352
33481
  image: {
33353
33482
  ".gif": "image/gif",
@@ -33392,8 +33521,8 @@ function prepareRemoteProxyToolArgs(options) {
33392
33521
  if (options.toolName === "create_video_task") {
33393
33522
  return rewriteVideoReferenceAssetArgs(options.targetDir, options.args);
33394
33523
  }
33395
- if (options.toolName === "create_3d_model_task") {
33396
- return rewrite3dModelAssetArgs(options.targetDir, options.args);
33524
+ if (options.toolName === CREATE_3D_ASSET_PROXY_TOOL_NAME) {
33525
+ return rewriteCreate3dAssetArgs(options.targetDir, options.args);
33397
33526
  }
33398
33527
  return options.args;
33399
33528
  }
@@ -33457,8 +33586,7 @@ function shouldMaterializeRemoteProxyTool(toolName) {
33457
33586
  "create_video_task",
33458
33587
  "query_video_task",
33459
33588
  "text_to_music",
33460
- "create_3d_model_task",
33461
- "query_3d_model_task",
33589
+ CREATE_3D_ASSET_PROXY_TOOL_NAME,
33462
33590
  "get_debug_feedbacks"
33463
33591
  ].includes(toolName);
33464
33592
  }
@@ -33505,8 +33633,8 @@ async function materializeParsedProxyResult(options) {
33505
33633
  if (options.toolName === "text_to_music") {
33506
33634
  return await materializeMusicResult(options);
33507
33635
  }
33508
- if (options.toolName === "create_3d_model_task" || options.toolName === "query_3d_model_task") {
33509
- return await materialize3dModelResult(options, options.toolName);
33636
+ if (options.toolName === CREATE_3D_ASSET_PROXY_TOOL_NAME) {
33637
+ return await materializeCreate3dAssetResult(options);
33510
33638
  }
33511
33639
  if (options.toolName === "get_debug_feedbacks") {
33512
33640
  return await materializeDebugFeedbackResult(options);
@@ -33537,7 +33665,7 @@ async function materializeDebugFeedbackResult(options) {
33537
33665
  ...materialized
33538
33666
  });
33539
33667
  }
33540
- const localCandidateSaveDir = remoteSaveDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteSaveDir) : feedbacks.some(hasDebugFeedbackArtifactUrls) ? path15.join(options.targetDir, "logs", "feed_back") : void 0;
33668
+ const localCandidateSaveDir = remoteSaveDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteSaveDir) : feedbacks.some(hasDebugFeedbackArtifactUrls) ? path16.join(options.targetDir, "logs", "feed_back") : void 0;
33541
33669
  const filesVerifiedLocally = nextFeedbacks.some(
33542
33670
  (feedback) => numberField2(feedback.artifacts_downloaded) > 0
33543
33671
  );
@@ -33553,7 +33681,7 @@ async function materializeDebugFeedbackResult(options) {
33553
33681
  };
33554
33682
  }
33555
33683
  async function materializeDebugFeedbackArtifacts(options) {
33556
- const feedbackId = stringField2(options.feedback.feedback_id) || String(options.feedback.feedback_id || "");
33684
+ const feedbackId = stringField2(options.feedback.feedback_id) ?? (options.feedback.feedback_id != null ? String(options.feedback.feedback_id) : "");
33557
33685
  if (!feedbackId) {
33558
33686
  return {};
33559
33687
  }
@@ -33565,7 +33693,7 @@ async function materializeDebugFeedbackArtifacts(options) {
33565
33693
  if (logUrls.length === 0 && screenshotUrls.length === 0 && extraUrls.length === 0) {
33566
33694
  return {};
33567
33695
  }
33568
- const localDir = path15.join(options.targetDir, "logs", "feed_back", `feedback_${feedbackId}`);
33696
+ const localDir = path16.join(options.targetDir, "logs", "feed_back", `feedback_${feedbackId}`);
33569
33697
  const localLogPaths = [];
33570
33698
  const localScreenshotPaths = [];
33571
33699
  const localDownloadPaths = [];
@@ -33573,7 +33701,7 @@ async function materializeDebugFeedbackArtifacts(options) {
33573
33701
  for (const [index, url2] of logUrls.entries()) {
33574
33702
  const result = await downloadDebugFeedbackArtifact({
33575
33703
  url: url2,
33576
- directory: path15.join(localDir, "logs"),
33704
+ directory: path16.join(localDir, "logs"),
33577
33705
  fallbackName: `log_${index + 1}.log`,
33578
33706
  fetchImpl: options.fetchImpl
33579
33707
  });
@@ -33586,7 +33714,7 @@ async function materializeDebugFeedbackArtifacts(options) {
33586
33714
  for (const [index, url2] of screenshotUrls.entries()) {
33587
33715
  const result = await downloadDebugFeedbackArtifact({
33588
33716
  url: url2,
33589
- directory: path15.join(localDir, "screenshots"),
33717
+ directory: path16.join(localDir, "screenshots"),
33590
33718
  fallbackName: `screenshot_${index + 1}.png`,
33591
33719
  fetchImpl: options.fetchImpl
33592
33720
  });
@@ -33599,7 +33727,7 @@ async function materializeDebugFeedbackArtifacts(options) {
33599
33727
  for (const [index, url2] of extraUrls.entries()) {
33600
33728
  const result = await downloadDebugFeedbackArtifact({
33601
33729
  url: url2,
33602
- directory: path15.join(localDir, "downloads"),
33730
+ directory: path16.join(localDir, "downloads"),
33603
33731
  fallbackName: `artifact_${index + 1}`,
33604
33732
  fetchImpl: options.fetchImpl
33605
33733
  });
@@ -33627,14 +33755,14 @@ async function downloadDebugFeedbackArtifact(options) {
33627
33755
  error: `${options.url}: HTTP ${response.status}`
33628
33756
  };
33629
33757
  }
33630
- fs14.mkdirSync(options.directory, { recursive: true });
33758
+ fs15.mkdirSync(options.directory, { recursive: true });
33631
33759
  const filePath = allocateDebugFeedbackArtifactPath(
33632
33760
  options.directory,
33633
33761
  options.url,
33634
33762
  options.fallbackName
33635
33763
  );
33636
33764
  const bytes = Buffer.from(await response.arrayBuffer());
33637
- fs14.writeFileSync(filePath, bytes);
33765
+ fs15.writeFileSync(filePath, bytes);
33638
33766
  return { success: true, path: filePath };
33639
33767
  } catch (error2) {
33640
33768
  return {
@@ -33645,14 +33773,14 @@ async function downloadDebugFeedbackArtifact(options) {
33645
33773
  }
33646
33774
  function allocateDebugFeedbackArtifactPath(directory, url2, fallbackName) {
33647
33775
  const rawName = fileNameFromUrl(url2) || fallbackName;
33648
- const rawExtension = path15.extname(rawName);
33776
+ const rawExtension = path16.extname(rawName);
33649
33777
  const finalExtension = rawExtension && rawExtension !== "." ? rawExtension.replace(/[^A-Za-z0-9.]/g, "_") : "";
33650
33778
  const rawStem = finalExtension ? rawName.slice(0, -rawExtension.length) : rawName;
33651
33779
  const stem = sanitizeAssetBaseName(rawStem);
33652
33780
  for (let index = 1; index <= 9999; index += 1) {
33653
33781
  const suffix = index === 1 ? "" : `_${index}`;
33654
- const candidate = path15.join(directory, `${stem}${suffix}${finalExtension}`);
33655
- if (!fs14.existsSync(candidate)) {
33782
+ const candidate = path16.join(directory, `${stem}${suffix}${finalExtension}`);
33783
+ if (!fs15.existsSync(candidate)) {
33656
33784
  return candidate;
33657
33785
  }
33658
33786
  }
@@ -33661,7 +33789,7 @@ function allocateDebugFeedbackArtifactPath(directory, url2, fallbackName) {
33661
33789
  function fileNameFromUrl(url2) {
33662
33790
  try {
33663
33791
  const pathname = new URL(url2).pathname;
33664
- const name = decodeURIComponent(path15.basename(pathname));
33792
+ const name = decodeURIComponent(path16.basename(pathname));
33665
33793
  return name && name !== "/" ? name : void 0;
33666
33794
  } catch {
33667
33795
  return void 0;
@@ -33675,11 +33803,11 @@ function getDebugFeedbackSaveDir(payload) {
33675
33803
  return stringField2(payload.save_dir) || (isRecord(summary) ? stringField2(summary.save_dir) : void 0);
33676
33804
  }
33677
33805
  function resolveDebugFeedbackCandidatePath(targetDir, remotePath) {
33678
- if (path15.isAbsolute(remotePath)) {
33806
+ if (path16.isAbsolute(remotePath)) {
33679
33807
  return void 0;
33680
33808
  }
33681
33809
  const trimmedRemotePath = remotePath.replace(/[\\/]+$/, "");
33682
- return path15.normalize(path15.join(targetDir, trimmedRemotePath || "."));
33810
+ return path16.normalize(path16.join(targetDir, trimmedRemotePath || "."));
33683
33811
  }
33684
33812
  function replaceDebugFeedbackItems(payload, nextFeedbacks) {
33685
33813
  const summary = payload.summary;
@@ -33832,13 +33960,13 @@ function findExistingMaterializedVideo(targetDir, options) {
33832
33960
  function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
33833
33961
  const candidates = [];
33834
33962
  const absolutePath = stringField2(record2.absolutePath);
33835
- if (absolutePath && path15.isAbsolute(absolutePath)) {
33963
+ if (absolutePath && path16.isAbsolute(absolutePath)) {
33836
33964
  candidates.push(absolutePath);
33837
33965
  }
33838
- candidates.push(path15.join(targetDir, ...localPath.split("/")));
33966
+ candidates.push(path16.join(targetDir, ...localPath.split("/")));
33839
33967
  for (const candidate of candidates) {
33840
33968
  try {
33841
- if (fs14.statSync(candidate).isFile()) {
33969
+ if (fs15.statSync(candidate).isFile()) {
33842
33970
  return candidate;
33843
33971
  }
33844
33972
  } catch {
@@ -33878,197 +34006,271 @@ async function materializeMusicResult(options) {
33878
34006
  })
33879
34007
  } : options.payload;
33880
34008
  }
33881
- async function materialize3dModelResult(options, toolName) {
33882
- if (options.payload.phase === 1) {
33883
- return await materialize3dPreviewResult(options);
34009
+ async function materializeCreate3dAssetResult(options) {
34010
+ var _a3;
34011
+ const payload = isRecord(options.payload.preview) ? await materializeCreate3dAssetPreviewResult(options) : options.payload;
34012
+ const modelFile = Array.isArray(payload.model_files) ? payload.model_files.find(isRecord) : void 0;
34013
+ if (!modelFile) {
34014
+ return payload;
33884
34015
  }
33885
- return await materialize3dFinalResult(options, toolName);
33886
- }
33887
- async function materialize3dPreviewResult(options) {
33888
- if (!isRecord(options.payload.preview_urls)) {
33889
- return options.payload;
34016
+ const assetId = stringField2(modelFile.assetId) || stringField2(payload.asset_id) || stringField2(payload.task_id) || "3d_asset";
34017
+ const remoteUrl = stringField2(modelFile.modelUrl);
34018
+ const format = (_a3 = stringField2(modelFile.format)) == null ? void 0 : _a3.toLowerCase();
34019
+ const materialization = stringField2(modelFile.materialization);
34020
+ if (!remoteUrl || !format || !materialization) {
34021
+ return {
34022
+ ...payload,
34023
+ local_delivery: create3dAssetDeliveryFailure(
34024
+ assetId,
34025
+ remoteUrl,
34026
+ format,
34027
+ materialization,
34028
+ "Invalid create_3d_asset model_files entry."
34029
+ )
34030
+ };
33890
34031
  }
33891
- let changed = false;
34032
+ const existing = findExistingCreate3dAssetDelivery({
34033
+ targetDir: options.targetDir,
34034
+ assetId,
34035
+ remoteUrl
34036
+ });
34037
+ if (existing) {
34038
+ return {
34039
+ ...payload,
34040
+ local_delivery: create3dAssetLocalDelivery({
34041
+ assetId,
34042
+ remoteUrl,
34043
+ format,
34044
+ materialization,
34045
+ materialized: existing,
34046
+ reused: true
34047
+ })
34048
+ };
34049
+ }
34050
+ const materialized = await materializeCreate3dAssetModelFile({
34051
+ ...options,
34052
+ assetId,
34053
+ modelFile,
34054
+ remoteUrl,
34055
+ format,
34056
+ materialization
34057
+ });
34058
+ if ("localPath" in materialized) {
34059
+ upsertGeneratedAssetRecord(options.targetDir, materialized.localPath, {
34060
+ tool: CREATE_3D_ASSET_PROXY_TOOL_NAME,
34061
+ name: assetId,
34062
+ assetKind: "model",
34063
+ assetId,
34064
+ taskId: stringField2(payload.task_id),
34065
+ cdnUrl: remoteUrl,
34066
+ previewUrl: remoteUrl,
34067
+ localPath: materialized.localPath,
34068
+ absolutePath: materialized.absolutePath,
34069
+ createdAt: options.now.toISOString(),
34070
+ modelCdnUrl: remoteUrl
34071
+ });
34072
+ }
34073
+ return {
34074
+ ...payload,
34075
+ local_delivery: create3dAssetLocalDelivery({
34076
+ assetId,
34077
+ remoteUrl,
34078
+ format,
34079
+ materialization,
34080
+ materialized,
34081
+ reused: false
34082
+ })
34083
+ };
34084
+ }
34085
+ async function materializeCreate3dAssetPreviewResult(options) {
34086
+ const preview = options.payload.preview;
34087
+ const assetId = stringField2(options.payload.asset_id) || "3d_asset";
33892
34088
  const previewAssets = {};
33893
- const taskId = get3dTaskId(options.payload);
33894
- const mode = stringField2(options.payload.mode);
33895
34089
  for (const view of THREE_D_MODEL_VIEWS) {
33896
- const url2 = stringField2(options.payload.preview_urls[view]);
34090
+ const url2 = stringField2(preview[view]);
33897
34091
  const materialized = await materializeAsset({
33898
34092
  targetDir: options.targetDir,
33899
34093
  url: url2,
33900
- baseName: `${taskId || "3d_model"}_${view}`,
33901
- relativeDir: "assets/image",
34094
+ baseName: `${assetId}_${view}`,
34095
+ relativeDir: IMAGE_ASSET_DIRS[0],
33902
34096
  extension: extensionFromUrl(url2) || "png",
33903
34097
  now: options.now,
33904
34098
  fetchImpl: options.fetchImpl
33905
34099
  });
33906
- if (!materialized) {
33907
- continue;
33908
- }
33909
- changed = true;
34100
+ if (!materialized) continue;
33910
34101
  previewAssets[view] = { ...materialized, cdnUrl: url2 };
33911
34102
  if ("localPath" in materialized && url2) {
33912
34103
  upsertGeneratedAssetRecord(options.targetDir, materialized.localPath, {
33913
- tool: "create_3d_model_task",
33914
- name: `${taskId || "3d_model"}_${view}`,
34104
+ tool: CREATE_3D_ASSET_PROXY_TOOL_NAME,
34105
+ name: `${assetId}_${view}`,
34106
+ assetId,
33915
34107
  cdnUrl: url2,
33916
34108
  previewUrl: url2,
33917
34109
  localPath: materialized.localPath,
33918
34110
  absolutePath: materialized.absolutePath,
33919
34111
  createdAt: options.now.toISOString(),
33920
- taskId,
33921
- mode,
33922
- phase: 1,
33923
34112
  view
33924
34113
  });
33925
34114
  }
33926
34115
  }
33927
- return {
33928
- ...options.payload,
33929
- ...changed ? { preview_assets: previewAssets } : {},
33930
- ...create3dPreviewReviewGuidance()
33931
- };
34116
+ return Object.keys(previewAssets).length > 0 ? { ...options.payload, preview_assets: previewAssets } : options.payload;
33932
34117
  }
33933
- function create3dPreviewReviewGuidance() {
33934
- return {
33935
- workflow_state: "awaiting_user_review",
33936
- user_review_required: true,
33937
- next_action: "Show the four-view previews to the user and ask whether they approve them or want changes.",
33938
- approval_next_step: "If the user approves, continue the original 3D model generation flow by calling create_3d_model_task again with the approved four-view images.",
33939
- revision_next_step: "If the user requests changes, call create_3d_model_task again with the requested changes to regenerate the four-view previews before model generation.",
33940
- agent_instruction: "Do not stop after phase 1. The 3D model is not complete until the user approves the four-view previews and final model generation finishes."
33941
- };
33942
- }
33943
- async function materialize3dFinalResult(options, toolName) {
33944
- if (options.payload.status !== "success") {
33945
- return options.payload;
34118
+ async function materializeCreate3dAssetModelFile(options) {
34119
+ var _a3;
34120
+ const targetDirectory = stringField2(options.modelFile.targetDirectory);
34121
+ const suggestedFileName = stringField2(options.modelFile.suggestedFileName);
34122
+ const targetAbsolutePath = targetDirectory ? resolveProjectRelativePath(options.targetDir, targetDirectory) : void 0;
34123
+ const modelAssetRoot = path16.resolve(options.targetDir, MODEL_ASSET_DIRS[0]);
34124
+ if (!targetDirectory || !targetAbsolutePath || !isKnownAssetPath(targetDirectory, MODEL_ASSET_DIRS) || !isPathWithinDirectory(modelAssetRoot, targetAbsolutePath) || !suggestedFileName || path16.posix.basename(suggestedFileName) !== suggestedFileName || suggestedFileName.includes("\\")) {
34125
+ return {
34126
+ download: { success: false, error: "Invalid create_3d_asset local target path." }
34127
+ };
33946
34128
  }
33947
- let changed = false;
33948
- const nextPayload = { ...options.payload };
33949
- const taskId = get3dTaskId(options.payload);
33950
- const modelCdnUrl = stringField2(options.payload.model_cdn_url);
33951
- const renderedImageUrl = stringField2(options.payload.rendered_image_url);
33952
- const mdlConversionError = stringField2(options.payload.mdl_conversion_error);
33953
- const modelMaterialized = await materializeAsset({
33954
- targetDir: options.targetDir,
33955
- url: modelCdnUrl,
33956
- baseName: taskId || "3d_model",
33957
- relativeDir: MODEL_ASSET_DIRS[0],
33958
- extension: extensionFromUrl(modelCdnUrl) || "glb",
33959
- now: options.now,
33960
- fetchImpl: options.fetchImpl
33961
- });
33962
- if (modelMaterialized) {
33963
- changed = true;
33964
- nextPayload.modelDownload = modelMaterialized.download;
33965
- if ("localPath" in modelMaterialized) {
33966
- nextPayload.modelLocalPath = modelMaterialized.localPath;
33967
- nextPayload.modelAbsolutePath = modelMaterialized.absolutePath;
33968
- if (modelCdnUrl) {
33969
- upsertGeneratedAssetRecord(options.targetDir, modelMaterialized.localPath, {
33970
- tool: toolName,
33971
- name: taskId,
33972
- assetKind: "model",
33973
- cdnUrl: modelCdnUrl,
33974
- previewUrl: renderedImageUrl || modelCdnUrl,
33975
- localPath: modelMaterialized.localPath,
33976
- absolutePath: modelMaterialized.absolutePath,
33977
- createdAt: options.now.toISOString(),
33978
- taskId,
33979
- modelCdnUrl,
33980
- renderedImageUrl,
33981
- mdlConversionError
33982
- });
34129
+ if (options.materialization === "copy") {
34130
+ return await materializeAssetAtPath({
34131
+ url: options.remoteUrl,
34132
+ relativePath: path16.posix.join(targetDirectory, suggestedFileName),
34133
+ targetDir: options.targetDir,
34134
+ fetchImpl: options.fetchImpl
34135
+ });
34136
+ }
34137
+ if (options.materialization !== "extract") {
34138
+ return {
34139
+ download: {
34140
+ success: false,
34141
+ error: `Unsupported create_3d_asset materialization: ${options.materialization}`
33983
34142
  }
33984
- }
34143
+ };
33985
34144
  }
33986
- const mdlUrl = stringField2(options.payload.mdl_cdn_url);
33987
- const mdlMaterialized = await materializeAsset({
34145
+ const archive = await materializeAsset({
33988
34146
  targetDir: options.targetDir,
33989
- url: mdlUrl,
33990
- baseName: taskId || "3d_model",
33991
- relativeDir: MODEL_ASSET_DIRS[0],
33992
- extension: extensionFromUrl(mdlUrl) || "zip",
34147
+ url: options.remoteUrl,
34148
+ baseName: options.assetId,
34149
+ relativeDir: ".maker/assets/downloads",
34150
+ extension: path16.extname(suggestedFileName).replace(/^\./, "") || "zip",
33993
34151
  now: options.now,
33994
34152
  fetchImpl: options.fetchImpl
33995
34153
  });
33996
- if (mdlMaterialized) {
33997
- changed = true;
33998
- nextPayload.mdlDownload = mdlMaterialized.download;
33999
- if ("localPath" in mdlMaterialized) {
34000
- nextPayload.mdlLocalPath = mdlMaterialized.localPath;
34001
- nextPayload.mdlAbsolutePath = mdlMaterialized.absolutePath;
34002
- let mdlExtractError;
34003
- try {
34004
- extractZip(
34005
- mdlMaterialized.absolutePath,
34006
- path15.join(options.targetDir, "assets"),
34007
- "3D model asset"
34008
- );
34009
- nextPayload.mdlExtracted = true;
34010
- nextPayload.mdlExtractedTo = "assets";
34011
- } catch (error2) {
34012
- mdlExtractError = `3D model asset extraction failed: ${error2 instanceof Error ? error2.message : String(error2)}`;
34013
- nextPayload.mdlExtracted = false;
34014
- nextPayload.mdlExtractError = mdlExtractError;
34015
- }
34016
- if (mdlUrl) {
34017
- upsertGeneratedAssetRecord(options.targetDir, mdlMaterialized.localPath, {
34018
- tool: toolName,
34019
- name: taskId,
34020
- assetKind: "mdl_zip",
34021
- cdnUrl: mdlUrl,
34022
- previewUrl: renderedImageUrl || mdlUrl,
34023
- localPath: mdlMaterialized.localPath,
34024
- absolutePath: mdlMaterialized.absolutePath,
34025
- createdAt: options.now.toISOString(),
34026
- taskId,
34027
- modelCdnUrl,
34028
- renderedImageUrl,
34029
- mdlConversionError,
34030
- mdlExtractError
34031
- });
34154
+ if (!archive || !("localPath" in archive)) {
34155
+ return archive ?? {
34156
+ download: { success: false, error: "Missing create_3d_asset model archive." }
34157
+ };
34158
+ }
34159
+ try {
34160
+ fs15.mkdirSync(targetAbsolutePath, { recursive: true });
34161
+ extractZip(archive.absolutePath, targetAbsolutePath, "3D model asset");
34162
+ const entrypointExtension = ((_a3 = stringField2(options.modelFile.entrypointExtension)) == null ? void 0 : _a3.toLowerCase()) || ".mdl";
34163
+ const entrypoint = findFileByExtension(targetAbsolutePath, entrypointExtension);
34164
+ if (!entrypoint) {
34165
+ throw new Error(`3D model archive contains no ${entrypointExtension} entrypoint.`);
34166
+ }
34167
+ const localPath = path16.relative(options.targetDir, entrypoint).split(path16.sep).join("/");
34168
+ return {
34169
+ localPath,
34170
+ absolutePath: entrypoint,
34171
+ download: archive.download
34172
+ };
34173
+ } catch (error2) {
34174
+ return {
34175
+ download: {
34176
+ success: false,
34177
+ error: `3D model asset extraction failed: ${error2 instanceof Error ? error2.message : String(error2)}`
34032
34178
  }
34179
+ };
34180
+ } finally {
34181
+ fs15.rmSync(archive.absolutePath, { force: true });
34182
+ }
34183
+ }
34184
+ async function materializeAssetAtPath(options) {
34185
+ const absolutePath = resolveProjectRelativePath(options.targetDir, options.relativePath);
34186
+ if (!absolutePath) {
34187
+ return { download: { success: false, error: "Asset target path escapes the project." } };
34188
+ }
34189
+ try {
34190
+ const response = await options.fetchImpl(options.url);
34191
+ if (!response.ok) {
34192
+ return {
34193
+ download: { success: false, error: `Asset download failed: HTTP ${response.status}` }
34194
+ };
34033
34195
  }
34196
+ fs15.mkdirSync(path16.dirname(absolutePath), { recursive: true });
34197
+ fs15.writeFileSync(absolutePath, Buffer.from(await response.arrayBuffer()));
34198
+ return { localPath: options.relativePath, absolutePath, download: { success: true } };
34199
+ } catch (error2) {
34200
+ return {
34201
+ download: {
34202
+ success: false,
34203
+ error: `Asset download failed: ${error2 instanceof Error ? error2.message : String(error2)}`
34204
+ }
34205
+ };
34034
34206
  }
34035
- const renderedImageMaterialized = await materializeAsset({
34036
- targetDir: options.targetDir,
34037
- url: renderedImageUrl,
34038
- baseName: `${taskId || "3d_model"}_render`,
34039
- relativeDir: "assets/image",
34040
- extension: extensionFromUrl(renderedImageUrl) || "png",
34041
- now: options.now,
34042
- fetchImpl: options.fetchImpl
34207
+ }
34208
+ function findFileByExtension(directory, extension) {
34209
+ const entries = fs15.readdirSync(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name));
34210
+ for (const entry of entries) {
34211
+ const absolutePath = path16.join(directory, entry.name);
34212
+ if (entry.isDirectory()) {
34213
+ const nested = findFileByExtension(absolutePath, extension);
34214
+ if (nested) return nested;
34215
+ } else if (entry.isFile() && entry.name.toLowerCase().endsWith(extension)) {
34216
+ return absolutePath;
34217
+ }
34218
+ }
34219
+ return void 0;
34220
+ }
34221
+ function findExistingCreate3dAssetDelivery(options) {
34222
+ const registry2 = readGeneratedAssetRegistry(options.targetDir);
34223
+ const match = Object.entries(registry2).find(([, record3]) => {
34224
+ return record3.tool === CREATE_3D_ASSET_PROXY_TOOL_NAME && record3.assetId === options.assetId && record3.cdnUrl === options.remoteUrl && typeof record3.absolutePath === "string" && fs15.existsSync(record3.absolutePath);
34043
34225
  });
34044
- if (renderedImageMaterialized) {
34045
- changed = true;
34046
- nextPayload.renderedImageDownload = renderedImageMaterialized.download;
34047
- if ("localPath" in renderedImageMaterialized) {
34048
- nextPayload.renderedImageLocalPath = renderedImageMaterialized.localPath;
34049
- nextPayload.renderedImageAbsolutePath = renderedImageMaterialized.absolutePath;
34050
- if (renderedImageUrl) {
34051
- upsertGeneratedAssetRecord(options.targetDir, renderedImageMaterialized.localPath, {
34052
- tool: toolName,
34053
- name: `${taskId || "3d_model"}_render`,
34054
- assetKind: "render",
34055
- cdnUrl: renderedImageUrl,
34056
- previewUrl: renderedImageUrl,
34057
- localPath: renderedImageMaterialized.localPath,
34058
- absolutePath: renderedImageMaterialized.absolutePath,
34059
- createdAt: options.now.toISOString(),
34060
- taskId,
34061
- modelCdnUrl,
34062
- renderedImageUrl,
34063
- mdlConversionError
34064
- });
34226
+ if (!match) {
34227
+ return void 0;
34228
+ }
34229
+ const [localPath, record2] = match;
34230
+ return {
34231
+ localPath,
34232
+ absolutePath: record2.absolutePath,
34233
+ download: { success: true }
34234
+ };
34235
+ }
34236
+ function create3dAssetLocalDelivery(options) {
34237
+ if (!("localPath" in options.materialized)) {
34238
+ return {
34239
+ status: "failed",
34240
+ asset_id: options.assetId,
34241
+ model: {
34242
+ remote_url: options.remoteUrl,
34243
+ format: options.format,
34244
+ materialization: options.materialization,
34245
+ download: options.materialized.download
34065
34246
  }
34066
- }
34247
+ };
34067
34248
  }
34068
- return changed ? nextPayload : options.payload;
34249
+ return {
34250
+ status: "success",
34251
+ asset_id: options.assetId,
34252
+ model: {
34253
+ remote_url: options.remoteUrl,
34254
+ local_path: options.materialized.localPath,
34255
+ absolute_path: options.materialized.absolutePath,
34256
+ format: options.format,
34257
+ materialization: options.materialization,
34258
+ reused: options.reused,
34259
+ download: options.materialized.download
34260
+ }
34261
+ };
34069
34262
  }
34070
- function get3dTaskId(payload) {
34071
- return stringField2(payload.task_id) || stringField2(payload.taskId);
34263
+ function create3dAssetDeliveryFailure(assetId, remoteUrl, format, materialization, error2) {
34264
+ return {
34265
+ status: "failed",
34266
+ asset_id: assetId,
34267
+ model: {
34268
+ remote_url: remoteUrl,
34269
+ format,
34270
+ materialization,
34271
+ download: { success: false, error: error2 }
34272
+ }
34273
+ };
34072
34274
  }
34073
34275
  function persistMaterializedAsset(options) {
34074
34276
  const nextPayload = { ...options.payload, ...options.materialized };
@@ -34110,8 +34312,8 @@ async function materializeAsset(options) {
34110
34312
  };
34111
34313
  }
34112
34314
  const bytes = Buffer.from(await response.arrayBuffer());
34113
- fs14.mkdirSync(path15.dirname(absolutePath), { recursive: true });
34114
- fs14.writeFileSync(absolutePath, bytes);
34315
+ fs15.mkdirSync(path16.dirname(absolutePath), { recursive: true });
34316
+ fs15.writeFileSync(absolutePath, bytes);
34115
34317
  return { localPath: relativePath, absolutePath, download: { success: true } };
34116
34318
  } catch (error2) {
34117
34319
  return {
@@ -34125,12 +34327,12 @@ async function materializeAsset(options) {
34125
34327
  function createUniqueAssetPath(options) {
34126
34328
  const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
34127
34329
  for (let index = 1; index <= 9999; index += 1) {
34128
- const relativePath = path15.posix.join(
34330
+ const relativePath = path16.posix.join(
34129
34331
  options.relativeDir,
34130
34332
  `${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
34131
34333
  );
34132
- const absolutePath = path15.join(options.targetDir, ...relativePath.split("/"));
34133
- if (!fs14.existsSync(absolutePath)) {
34334
+ const absolutePath = path16.join(options.targetDir, ...relativePath.split("/"));
34335
+ if (!fs15.existsSync(absolutePath)) {
34134
34336
  return { relativePath, absolutePath };
34135
34337
  }
34136
34338
  }
@@ -34209,48 +34411,29 @@ function rewriteVideoReferenceAssetArgs(targetDir, args) {
34209
34411
  })
34210
34412
  };
34211
34413
  }
34212
- function rewrite3dModelAssetArgs(targetDir, args) {
34414
+ function rewriteCreate3dAssetArgs(targetDir, args) {
34415
+ if (!isRecord(args.payload) || !isRecord(args.payload.images)) {
34416
+ return args;
34417
+ }
34213
34418
  const registry2 = readGeneratedAssetRegistry(targetDir);
34214
34419
  const imageOptions = {
34215
34420
  assetDirs: IMAGE_ASSET_DIRS,
34216
34421
  mediaKind: "image",
34217
34422
  maxBytes: IMAGE_REFERENCE_MAX_BYTES
34218
34423
  };
34424
+ const images = args.payload.images;
34219
34425
  return {
34220
34426
  ...args,
34221
- image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, imageOptions),
34222
- front_image: rewriteGeneratedAssetReference(
34223
- targetDir,
34224
- args.front_image,
34225
- registry2,
34226
- imageOptions
34227
- ),
34228
- left_image: rewriteGeneratedAssetReference(targetDir, args.left_image, registry2, imageOptions),
34229
- back_image: rewriteGeneratedAssetReference(targetDir, args.back_image, registry2, imageOptions),
34230
- right_image: rewriteGeneratedAssetReference(
34231
- targetDir,
34232
- args.right_image,
34233
- registry2,
34234
- imageOptions
34235
- ),
34236
- confirmed_image_paths: rewrite3dConfirmedImagePaths(
34237
- targetDir,
34238
- args.confirmed_image_paths,
34239
- registry2,
34240
- imageOptions
34241
- )
34242
- };
34243
- }
34244
- function rewrite3dConfirmedImagePaths(targetDir, value, registry2, options) {
34245
- if (!isRecord(value)) {
34246
- return value;
34247
- }
34248
- return {
34249
- ...value,
34250
- front: rewriteGeneratedAssetReference(targetDir, value.front, registry2, options),
34251
- left: rewriteGeneratedAssetReference(targetDir, value.left, registry2, options),
34252
- back: rewriteGeneratedAssetReference(targetDir, value.back, registry2, options),
34253
- right: rewriteGeneratedAssetReference(targetDir, value.right, registry2, options)
34427
+ payload: {
34428
+ ...args.payload,
34429
+ images: {
34430
+ ...images,
34431
+ front: rewriteGeneratedAssetReference(targetDir, images.front, registry2, imageOptions),
34432
+ left: rewriteGeneratedAssetReference(targetDir, images.left, registry2, imageOptions),
34433
+ back: rewriteGeneratedAssetReference(targetDir, images.back, registry2, imageOptions),
34434
+ right: rewriteGeneratedAssetReference(targetDir, images.right, registry2, imageOptions)
34435
+ }
34436
+ }
34254
34437
  };
34255
34438
  }
34256
34439
  function rewriteUrlObjectArray(targetDir, value, registry2, options) {
@@ -34308,7 +34491,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
34308
34491
  if (!isKnownAssetPath(localPath, assetDirs)) {
34309
34492
  return false;
34310
34493
  }
34311
- const basename = path15.posix.basename(localPath);
34494
+ const basename = path16.posix.basename(localPath);
34312
34495
  const stem = basename.replace(/\.[^.]+$/, "");
34313
34496
  return basename === value || stem === value || record2.name === value || record2.taskId === value;
34314
34497
  });
@@ -34321,13 +34504,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
34321
34504
  }
34322
34505
  function findLocalAssetByName(targetDir, value, assetDirs) {
34323
34506
  var _a3;
34324
- const hasExtension = Boolean(path15.extname(value));
34507
+ const hasExtension = Boolean(path16.extname(value));
34325
34508
  const candidates = [];
34326
34509
  for (const assetDir of assetDirs) {
34327
- const absoluteDir = path15.join(targetDir, ...assetDir.split("/"));
34510
+ const absoluteDir = path16.join(targetDir, ...assetDir.split("/"));
34328
34511
  let entries;
34329
34512
  try {
34330
- entries = fs14.readdirSync(absoluteDir);
34513
+ entries = fs15.readdirSync(absoluteDir);
34331
34514
  } catch {
34332
34515
  continue;
34333
34516
  }
@@ -34336,11 +34519,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
34336
34519
  if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
34337
34520
  continue;
34338
34521
  }
34339
- const absolutePath = path15.join(absoluteDir, entry);
34522
+ const absolutePath = path16.join(absoluteDir, entry);
34340
34523
  try {
34341
34524
  candidates.push({
34342
- localPath: path15.posix.join(assetDir, entry),
34343
- mtimeMs: fs14.statSync(absolutePath).mtimeMs
34525
+ localPath: path16.posix.join(assetDir, entry),
34526
+ mtimeMs: fs15.statSync(absolutePath).mtimeMs
34344
34527
  });
34345
34528
  } catch {
34346
34529
  }
@@ -34350,7 +34533,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
34350
34533
  return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
34351
34534
  }
34352
34535
  function isKnownAssetPath(relativePath, assetDirs) {
34353
- if (relativePath.startsWith("../") || path15.isAbsolute(relativePath)) {
34536
+ if (relativePath.startsWith("../") || path16.isAbsolute(relativePath)) {
34354
34537
  return false;
34355
34538
  }
34356
34539
  return assetDirs.some(
@@ -34374,14 +34557,14 @@ function localAssetReferenceToDataUrl(options) {
34374
34557
  }
34375
34558
  let stat;
34376
34559
  try {
34377
- stat = fs14.statSync(absolutePath);
34560
+ stat = fs15.statSync(absolutePath);
34378
34561
  } catch {
34379
34562
  return void 0;
34380
34563
  }
34381
34564
  if (!stat.isFile() || stat.size > options.maxBytes) {
34382
34565
  return void 0;
34383
34566
  }
34384
- const bytes = fs14.readFileSync(absolutePath);
34567
+ const bytes = fs15.readFileSync(absolutePath);
34385
34568
  return `data:${mime};base64,${bytes.toString("base64")}`;
34386
34569
  }
34387
34570
  function resolveLocalAssetAbsolutePath(targetDir, options) {
@@ -34392,7 +34575,7 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
34392
34575
  candidates.push(localPath);
34393
34576
  }
34394
34577
  }
34395
- if (path15.isAbsolute(options.value)) {
34578
+ if (path16.isAbsolute(options.value)) {
34396
34579
  candidates.push(options.value);
34397
34580
  } else {
34398
34581
  const localPath = resolveProjectRelativePath(targetDir, options.value);
@@ -34401,54 +34584,58 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
34401
34584
  }
34402
34585
  }
34403
34586
  for (const candidate of candidates) {
34404
- if (fs14.existsSync(candidate)) {
34587
+ if (fs15.existsSync(candidate)) {
34405
34588
  return candidate;
34406
34589
  }
34407
34590
  }
34408
34591
  return void 0;
34409
34592
  }
34410
34593
  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);
34594
+ const root = path16.resolve(targetDir);
34595
+ const absolutePath = path16.resolve(root, value);
34596
+ const relativePath = path16.relative(root, absolutePath);
34597
+ const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path16.sep}`) || path16.isAbsolute(relativePath);
34415
34598
  if (!escapesRoot) {
34416
34599
  return absolutePath;
34417
34600
  }
34418
34601
  return void 0;
34419
34602
  }
34603
+ function isPathWithinDirectory(rootDir, candidatePath) {
34604
+ const relativePath = path16.relative(path16.resolve(rootDir), path16.resolve(candidatePath));
34605
+ return relativePath === "" || relativePath !== ".." && !relativePath.startsWith(`..${path16.sep}`) && !path16.isAbsolute(relativePath);
34606
+ }
34420
34607
  function dataUrlMimeForPath(filePath, mediaKind) {
34421
- return DATA_URL_MIME_BY_EXTENSION[mediaKind][path15.extname(filePath).toLowerCase()];
34608
+ return DATA_URL_MIME_BY_EXTENSION[mediaKind][path16.extname(filePath).toLowerCase()];
34422
34609
  }
34423
34610
  function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
34424
34611
  const registry2 = readGeneratedAssetRegistry(targetDir);
34425
34612
  registry2[localPath] = record2;
34426
34613
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
34427
- fs14.mkdirSync(path15.dirname(registryPath), { recursive: true });
34428
- fs14.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
34614
+ fs15.mkdirSync(path16.dirname(registryPath), { recursive: true });
34615
+ fs15.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
34429
34616
  `, "utf8");
34430
34617
  }
34431
34618
  function readGeneratedAssetRegistry(targetDir) {
34432
34619
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
34433
- if (!fs14.existsSync(registryPath)) {
34620
+ if (!fs15.existsSync(registryPath)) {
34434
34621
  return {};
34435
34622
  }
34436
34623
  try {
34437
- const parsed = JSON.parse(fs14.readFileSync(registryPath, "utf8"));
34624
+ const parsed = JSON.parse(fs15.readFileSync(registryPath, "utf8"));
34438
34625
  return isRecord(parsed) ? parsed : {};
34439
34626
  } catch {
34440
34627
  return {};
34441
34628
  }
34442
34629
  }
34443
34630
  function getGeneratedAssetRegistryPath(targetDir) {
34444
- return path15.join(targetDir, ".maker", "assets", "generated-assets.json");
34631
+ return path16.join(targetDir, ".maker", "assets", "generated-assets.json");
34445
34632
  }
34446
34633
  function normalizeAssetRegistryKey(targetDir, value) {
34447
34634
  if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
34448
34635
  return void 0;
34449
34636
  }
34450
- const relative = path15.isAbsolute(value) ? path15.relative(targetDir, value) : value;
34451
- return relative.split(path15.sep).join("/");
34637
+ const relative = path16.isAbsolute(value) ? path16.relative(targetDir, value) : value;
34638
+ return relative.split(path16.sep).join("/");
34452
34639
  }
34453
34640
  function isRecord(value) {
34454
34641
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -34487,7 +34674,7 @@ function extensionFromUrl(url2) {
34487
34674
  }
34488
34675
  try {
34489
34676
  const pathname = new URL(url2).pathname;
34490
- const extension = path15.extname(pathname).replace(/^\./, "").toLowerCase();
34677
+ const extension = path16.extname(pathname).replace(/^\./, "").toLowerCase();
34491
34678
  return extension || void 0;
34492
34679
  } catch {
34493
34680
  return void 0;
@@ -34638,7 +34825,7 @@ function applyDefaults(config2) {
34638
34825
  }
34639
34826
 
34640
34827
  // src/maker/server/mcp.ts
34641
- var VERSION = true ? "0.0.24-beta.2" : "dev";
34828
+ var VERSION = true ? "0.0.25-beta.1" : "dev";
34642
34829
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
34643
34830
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
34644
34831
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -34653,12 +34840,66 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
34653
34840
  "create_video_task",
34654
34841
  "query_video_task",
34655
34842
  "text_to_music",
34656
- "create_3d_model_task",
34657
- "query_3d_model_task",
34843
+ CREATE_3D_ASSET_PROXY_TOOL_NAME,
34658
34844
  "generate_test_qrcode",
34659
34845
  "get_ad_config",
34660
34846
  "get_debug_feedbacks"
34661
34847
  ];
34848
+ var MAKER_BUILD_MULTIPLAYER_SCHEMA = {
34849
+ type: "object",
34850
+ 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.",
34851
+ properties: {
34852
+ enabled: {
34853
+ type: "boolean",
34854
+ description: "Enable multiplayer mode. When true, initializes the networking subsystem and lobby. Runtime default: false."
34855
+ },
34856
+ max_players: {
34857
+ type: "number",
34858
+ minimum: 2,
34859
+ maximum: 100,
34860
+ description: "Maximum players allowed in one session (2-100). Actual match size can be smaller via match_info.player_number. Runtime default: 4."
34861
+ },
34862
+ background_match: {
34863
+ type: "boolean",
34864
+ 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."
34865
+ },
34866
+ match_info: {
34867
+ type: "object",
34868
+ description: "Match/session-based gameplay config for lobby, room, or round-based games. Examples: LoL, CS2, PUBG, DotA 2.",
34869
+ properties: {
34870
+ desc_name: {
34871
+ type: "string",
34872
+ enum: ["free_match", "free_match_with_ai"],
34873
+ description: "Matching algorithm: free_match waits without AI fill; free_match_with_ai fills with AI after timeout."
34874
+ },
34875
+ player_number: {
34876
+ type: "number",
34877
+ minimum: 1,
34878
+ description: "Players required to start the match. Must be less than or equal to multiplayer.max_players."
34879
+ },
34880
+ immediately_start: {
34881
+ type: "boolean",
34882
+ description: "Start immediately without waiting for a full match."
34883
+ },
34884
+ match_timeout: {
34885
+ type: "number",
34886
+ minimum: 0,
34887
+ description: "Match timeout in seconds. Only effective for desc_name=free_match_with_ai; AI fills after timeout."
34888
+ }
34889
+ }
34890
+ },
34891
+ persistent_world: {
34892
+ type: "object",
34893
+ description: "Persistent-world config for long-running/shared worlds where players can join an already running world. Examples: Roblox, World of Warcraft, Minecraft.",
34894
+ properties: {
34895
+ enabled: {
34896
+ type: "boolean",
34897
+ description: "Enable persistent-world mode instead of starting a separate match/session first. Runtime default: false."
34898
+ }
34899
+ }
34900
+ }
34901
+ }
34902
+ };
34662
34903
  var MakerCloneFailedError = class extends Error {
34663
34904
  constructor(targetDir, originalError) {
34664
34905
  const message = originalError instanceof Error ? originalError.message : String(originalError);
@@ -34706,16 +34947,13 @@ var tools = [
34706
34947
  },
34707
34948
  entry_client: {
34708
34949
  type: "string",
34709
- description: 'Optional multiplayer client entry relative to scriptsPath, e.g. "client_main.lua".'
34950
+ 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
34951
  },
34711
34952
  entry_server: {
34712
34953
  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."
34954
+ 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
34955
  },
34956
+ multiplayer: MAKER_BUILD_MULTIPLAYER_SCHEMA,
34719
34957
  server_url: {
34720
34958
  type: "string",
34721
34959
  description: "Optional remote MCP server URL override. Defaults to the Maker endpoint table for TAPTAP_MCP_ENV."
@@ -34844,6 +35082,14 @@ function remoteProxyToolGuidance(toolName) {
34844
35082
  "**Maker asset workflow hint:** Prefer this Maker MCP proxy tool for Maker music generation so generated audio can be materialized into the project and recorded for later Maker references.",
34845
35083
  failurePolicy
34846
35084
  ].join(" ");
35085
+ case CREATE_3D_ASSET_PROXY_TOOL_NAME:
35086
+ return [
35087
+ "**Maker asset workflow hint:** Use this tool for the complete Maker 3D asset lifecycle: start, query, continue after explicit user review, inspect options, and post-process completed assets.",
35088
+ "Local image paths in payload.images are forwarded as data URLs when they resolve inside the Maker project. Unknown server response fields are preserved. In local runtime query results, model_files copy/extract instructions are materialized into assets/model and local_delivery reports the usable local model path.",
35089
+ "Review preview URLs are materialized into assets/image and returned in preview_assets when possible.",
35090
+ 'Do not automatically approve review steps; show the returned previews to the user and wait for explicit confirmation before action="continue".',
35091
+ failurePolicy
35092
+ ].join(" ");
34847
35093
  case "get_ad_config":
34848
35094
  return [
34849
35095
  "**Maker hint:** Trigger this tool for any ad-related request (广告, 激励视频, 播放广告, ad ID, ad placement, ShowRewardVideoAd, ad status, or ad config). Call it first to get the current Maker project ad activation status and ad config; do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks. If .project/project.json is missing, build the project once with maker_build_current_directory to initialize it, then call this tool again. If this tool says app_id or developer_id is missing, call generate_test_qrcode once to generate test QR code metadata, then call this tool again.",
@@ -35156,7 +35402,7 @@ async function formatStatus(options = {}) {
35156
35402
  const env = getMakerEnvironment(void 0, targetDir);
35157
35403
  const identify = identifyMakerProject({ cwd: targetDir });
35158
35404
  const mcpCwd = process.cwd();
35159
- const mcpCwdIdentify = path16.resolve(mcpCwd) === path16.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
35405
+ const mcpCwdIdentify = path17.resolve(mcpCwd) === path17.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
35160
35406
  const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
35161
35407
  const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
35162
35408
  const pat = loadPat();
@@ -35191,6 +35437,7 @@ async function formatStatus(options = {}) {
35191
35437
  const projectInitializationText = identify.projectRoot ? formatMakerProjectInitializationStatus(
35192
35438
  inspectMakerProjectInitialization(identify.projectRoot)
35193
35439
  ) : "";
35440
+ const projectSettingsText = identify.projectRoot ? formatMakerProjectSettingsStatus(inspectMakerProjectSettings(identify.projectRoot)) : "";
35194
35441
  const projectSection = identify.projectId ? [
35195
35442
  "目标目录已绑定 Maker 项目。",
35196
35443
  "请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
@@ -35222,6 +35469,7 @@ async function formatStatus(options = {}) {
35222
35469
  "",
35223
35470
  formatMakerGitDirectoryStatus(gitDirectoryStatus),
35224
35471
  ...projectInitializationText ? ["", projectInitializationText, ""] : [""],
35472
+ ...projectSettingsText ? ["", projectSettingsText, ""] : [""],
35225
35473
  formatMakerClientRootsStatus(projectContext.roots),
35226
35474
  "",
35227
35475
  projectContext.source === "client_roots" ? "" : formatMakerToolRegistrationCwdStatus({
@@ -35292,10 +35540,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
35292
35540
  if (!options.projectRoot) {
35293
35541
  return "";
35294
35542
  }
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;
35543
+ const mcpCwd = path17.resolve(options.mcpCwd);
35544
+ const targetDir = path17.resolve(options.targetDir);
35545
+ const projectRoot = path17.resolve(options.projectRoot);
35546
+ const mcpProjectRoot = options.mcpProjectRoot ? path17.resolve(options.mcpProjectRoot) : void 0;
35299
35547
  if (mcpProjectRoot === projectRoot) {
35300
35548
  return "";
35301
35549
  }
@@ -35468,7 +35716,7 @@ function createServerClientRootsProvider(server) {
35468
35716
  async function resolveMakerProjectContext(options = {}) {
35469
35717
  if (options.targetDir) {
35470
35718
  return {
35471
- targetDir: path16.resolve(options.targetDir),
35719
+ targetDir: path17.resolve(options.targetDir),
35472
35720
  source: "explicit_target_dir",
35473
35721
  roots: { status: "not_requested", roots: [] }
35474
35722
  };
@@ -35563,7 +35811,7 @@ function rootToLocalPath(root) {
35563
35811
  if (url2.protocol !== "file:") {
35564
35812
  return void 0;
35565
35813
  }
35566
- return path16.resolve(fileURLToPath2(url2));
35814
+ return path17.resolve(fileURLToPath2(url2));
35567
35815
  } catch {
35568
35816
  return void 0;
35569
35817
  }
@@ -35577,14 +35825,14 @@ function uniquePaths(values) {
35577
35825
  continue;
35578
35826
  }
35579
35827
  seen.add(normalized);
35580
- result.push(path16.resolve(value));
35828
+ result.push(path17.resolve(value));
35581
35829
  }
35582
35830
  return result;
35583
35831
  }
35584
35832
  function normalizePathForCompare2(value) {
35585
- const resolved = path16.resolve(value);
35833
+ const resolved = path17.resolve(value);
35586
35834
  try {
35587
- return fs15.realpathSync.native(resolved);
35835
+ return fs16.realpathSync.native(resolved);
35588
35836
  } catch {
35589
35837
  return resolved;
35590
35838
  }
@@ -35733,14 +35981,14 @@ function formatStatusProjectList(projects) {
35733
35981
  ].filter((line) => line !== void 0).join("\n");
35734
35982
  }
35735
35983
  function formatClonePartialStateLines(targetDir) {
35736
- const resolvedTargetDir = path16.resolve(targetDir);
35984
+ const resolvedTargetDir = path17.resolve(targetDir);
35737
35985
  const identify = identifyMakerProject({ cwd: resolvedTargetDir });
35738
35986
  const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
35739
35987
  const devKitStatus = inspectAiDevKit(resolvedTargetDir);
35740
- const stagedDevKitGitignorePath = path16.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
35988
+ const stagedDevKitGitignorePath = path17.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
35741
35989
  const projectBound = Boolean(identify.projectId);
35742
35990
  const gitInitialized = Boolean(
35743
- gitStatus.isOwnGitRoot || fs15.existsSync(path16.join(resolvedTargetDir, ".git"))
35991
+ gitStatus.isOwnGitRoot || fs16.existsSync(path17.join(resolvedTargetDir, ".git"))
35744
35992
  );
35745
35993
  const safeToRetry = !projectBound;
35746
35994
  return [
@@ -35754,7 +36002,7 @@ function formatClonePartialStateLines(targetDir) {
35754
36002
  identify.configPath ? `- config: ${identify.configPath}` : "",
35755
36003
  `- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
35756
36004
  `- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
35757
- `- staged_dev_kit_gitignore: ${fs15.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
36005
+ `- staged_dev_kit_gitignore: ${fs16.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
35758
36006
  `- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
35759
36007
  safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
35760
36008
  ].filter(Boolean);
@@ -35830,12 +36078,12 @@ function resolveEmbeddedProxyCommand(options) {
35830
36078
  }
35831
36079
  return {
35832
36080
  command: process.execPath,
35833
- args: [path16.resolve(makerEntry), "__maker-proxy"]
36081
+ args: [path17.resolve(makerEntry), "__maker-proxy"]
35834
36082
  };
35835
36083
  }
35836
36084
  function resolveBundledMakerEntry() {
35837
- const bundledEntry = path16.resolve(__dirname, "../../../bin/taptap-maker");
35838
- return fs15.existsSync(bundledEntry) ? bundledEntry : void 0;
36085
+ const bundledEntry = path17.resolve(__dirname, "../../../bin/taptap-maker");
36086
+ return fs16.existsSync(bundledEntry) ? bundledEntry : void 0;
35839
36087
  }
35840
36088
  function isUsableEmbeddedMakerEntry(entry) {
35841
36089
  if (!entry) {
@@ -35940,6 +36188,15 @@ async function buildCurrentDirectory(options) {
35940
36188
  const localChanges = await readMakerProjectLocalChanges(options.targetDir);
35941
36189
  if (!options.confirmRemoteBuildWithoutSubmit) {
35942
36190
  const config2 = loadProjectConfig(localChanges.projectRoot);
36191
+ const settingsStatus = inspectMakerProjectSettings(localChanges.projectRoot);
36192
+ if (isMakerProjectSettingsBlocking(settingsStatus)) {
36193
+ return {
36194
+ mode: "settings_invalid_before_build",
36195
+ projectRoot: localChanges.projectRoot,
36196
+ projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
36197
+ settingsStatus
36198
+ };
36199
+ }
35943
36200
  (_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
35944
36201
  progress: 0,
35945
36202
  total: 100,
@@ -36161,18 +36418,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
36161
36418
  }
36162
36419
  }
36163
36420
  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");
36421
+ const runtimeDir = path17.join(buildResult.projectRoot, ".maker", "logs", "runtime");
36422
+ fs16.mkdirSync(runtimeDir, { recursive: true });
36423
+ const stdoutLog = path17.join(runtimeDir, "watcher.out.log");
36424
+ const stderrLog = path17.join(runtimeDir, "watcher.err.log");
36425
+ const pidFile = path17.join(runtimeDir, "watcher.pid");
36169
36426
  const previous = stopExistingRuntimeLogWatcher(pidFile);
36170
- const outFd = fs15.openSync(stdoutLog, "a");
36171
- const errFd = fs15.openSync(stderrLog, "a");
36427
+ const outFd = fs16.openSync(stdoutLog, "a");
36428
+ const errFd = fs16.openSync(stderrLog, "a");
36172
36429
  const command = formatRuntimeLogWatchCommand(buildResult);
36173
36430
  if (previous.previousStopError) {
36174
- fs15.closeSync(outFd);
36175
- fs15.closeSync(errFd);
36431
+ fs16.closeSync(outFd);
36432
+ fs16.closeSync(errFd);
36176
36433
  return {
36177
36434
  started: false,
36178
36435
  command: command.text,
@@ -36235,18 +36492,18 @@ async function startRuntimeLogWatch(buildResult) {
36235
36492
  ...previous
36236
36493
  };
36237
36494
  } finally {
36238
- fs15.closeSync(outFd);
36239
- fs15.closeSync(errFd);
36495
+ fs16.closeSync(outFd);
36496
+ fs16.closeSync(errFd);
36240
36497
  }
36241
36498
  }
36242
36499
  function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36243
- if (!fs15.existsSync(pidFile)) {
36500
+ if (!fs16.existsSync(pidFile)) {
36244
36501
  return {};
36245
36502
  }
36246
36503
  const pidState = readRuntimeLogWatcherPidState(pidFile);
36247
36504
  const pid = pidState == null ? void 0 : pidState.pid;
36248
36505
  if (!Number.isInteger(pid) || pid <= 0) {
36249
- fs15.rmSync(pidFile, { force: true });
36506
+ fs16.rmSync(pidFile, { force: true });
36250
36507
  return {};
36251
36508
  }
36252
36509
  try {
@@ -36254,7 +36511,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36254
36511
  const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
36255
36512
  const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
36256
36513
  if (!verifiedCommand) {
36257
- fs15.rmSync(pidFile, { force: true });
36514
+ fs16.rmSync(pidFile, { force: true });
36258
36515
  return {
36259
36516
  previousPid: pid,
36260
36517
  previousStopped: false,
@@ -36264,7 +36521,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36264
36521
  process.kill(pid, "SIGTERM");
36265
36522
  const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
36266
36523
  if (stopped) {
36267
- fs15.rmSync(pidFile, { force: true });
36524
+ fs16.rmSync(pidFile, { force: true });
36268
36525
  return { previousPid: pid, previousStopped: true };
36269
36526
  }
36270
36527
  return {
@@ -36273,7 +36530,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36273
36530
  previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
36274
36531
  };
36275
36532
  } catch (error2) {
36276
- fs15.rmSync(pidFile, { force: true });
36533
+ fs16.rmSync(pidFile, { force: true });
36277
36534
  const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
36278
36535
  if (code === "ESRCH") {
36279
36536
  return { previousPid: pid, previousStopped: false };
@@ -36286,7 +36543,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
36286
36543
  }
36287
36544
  }
36288
36545
  function readRuntimeLogWatcherPidState(pidFile) {
36289
- const raw = fs15.readFileSync(pidFile, "utf8").trim();
36546
+ const raw = fs16.readFileSync(pidFile, "utf8").trim();
36290
36547
  if (!raw) {
36291
36548
  return null;
36292
36549
  }
@@ -36302,7 +36559,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
36302
36559
  }
36303
36560
  }
36304
36561
  function writeRuntimeLogWatcherPidFile(pidFile, state) {
36305
- fs15.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
36562
+ fs16.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
36306
36563
  `, "utf8");
36307
36564
  }
36308
36565
  function getProcessCommand(pid) {
@@ -36388,10 +36645,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
36388
36645
  };
36389
36646
  }
36390
36647
  function resolveMakerCliEntry() {
36391
- return process.argv[1] || path16.resolve(process.cwd(), "dist", "maker.js");
36648
+ return process.argv[1] || path17.resolve(process.cwd(), "dist", "maker.js");
36392
36649
  }
36393
36650
  function getRuntimeLogFilePath(projectRoot) {
36394
- return path16.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
36651
+ return path17.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
36395
36652
  }
36396
36653
  async function refreshMakerPreview(buildResult) {
36397
36654
  const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
@@ -36525,7 +36782,7 @@ function createBuildArgs(projectRoot, options) {
36525
36782
  if (options.scriptsPath) {
36526
36783
  buildArgs.scriptsPath = options.scriptsPath;
36527
36784
  }
36528
- if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs15.existsSync(path16.join(projectRoot, "scripts", "main.lua"))) {
36785
+ if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs16.existsSync(path17.join(projectRoot, "scripts", "main.lua"))) {
36529
36786
  buildArgs.entry = "main.lua";
36530
36787
  buildArgs.scriptsPath = "scripts";
36531
36788
  }
@@ -36537,7 +36794,7 @@ function createBuildArgs(projectRoot, options) {
36537
36794
  }
36538
36795
  if (options.multiplayer) {
36539
36796
  buildArgs.multiplayer = options.multiplayer;
36540
- } else if (!fs15.existsSync(path16.join(projectRoot, ".project", "settings.json"))) {
36797
+ } else if (!options.entryClient && !options.entryServer && !fs16.existsSync(path17.join(projectRoot, ".project", "settings.json"))) {
36541
36798
  buildArgs.multiplayer = { enabled: false };
36542
36799
  }
36543
36800
  return buildArgs;
@@ -36616,6 +36873,17 @@ function formatBuildResult(result, progressSummary) {
36616
36873
  ] : []
36617
36874
  ].filter(Boolean).join("\n");
36618
36875
  }
36876
+ if (result.mode === "settings_invalid_before_build") {
36877
+ return [
36878
+ "✗ Maker project settings are invalid; submit and remote build were not started",
36879
+ "",
36880
+ `- project_root: ${result.projectRoot}`,
36881
+ `- project_id: ${result.projectId}`,
36882
+ ...formatProgressSummary(progressSummary),
36883
+ "",
36884
+ formatMakerProjectSettingsStatus(result.settingsStatus)
36885
+ ].filter(Boolean).join("\n");
36886
+ }
36619
36887
  if (result.mode === "build_failed_after_submit") {
36620
36888
  return [
36621
36889
  "✗ Maker project submitted, but remote Maker build failed",
@@ -36699,11 +36967,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
36699
36967
  ((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
36700
36968
  `- watch_command: ${command}`,
36701
36969
  ((_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")}`,
36970
+ `- local_file: ${path17.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
36703
36971
  ((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
36704
36972
  ((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
36705
36973
  ((_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")}`,
36974
+ `- state_file: ${path17.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
36707
36975
  ((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
36708
36976
  ((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
36709
36977
  ((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
@@ -36814,19 +37082,37 @@ function formatToolException(toolName, error2) {
36814
37082
  ].join("\n");
36815
37083
  }
36816
37084
  if (error2 instanceof RemoteProxyToolResultError) {
37085
+ const displayResult = flattenNestedMcpErrorPrefixes(error2.result);
37086
+ const remoteMessage = extractRemoteProxyErrorMessage(displayResult);
36817
37087
  return [
36818
37088
  "✗ Maker MCP proxy tool failed",
36819
37089
  "",
36820
37090
  `- tool: ${toolName}`,
36821
37091
  "- reason: remote_proxy_tool_result_error",
36822
37092
  `- error_name: ${error2.name}`,
36823
- `- message: ${firstLine(error2.message)}`,
37093
+ `- message: ${remoteMessage ?? firstLine(error2.message)}`,
36824
37094
  "",
36825
- formatRemoteProxyToolResult(error2.result),
37095
+ formatRemoteProxyToolResult(displayResult),
36826
37096
  "",
36827
37097
  "next_action: 远端 proxy tool 已返回失败结果;请把 remote_result 原样反馈给开发者,方便排查 server 返回内容。"
36828
37098
  ].join("\n");
36829
37099
  }
37100
+ if (isExposedRemoteProxyTool(toolName)) {
37101
+ return [
37102
+ "✗ Maker MCP proxy tool failed",
37103
+ "",
37104
+ `- tool: ${toolName}`,
37105
+ "- reason: remote_proxy_tool_call_error",
37106
+ `- error_name: ${error2 instanceof Error ? error2.name : typeof error2}`,
37107
+ `- message: ${stripNestedMcpErrorPrefixes(message)}`,
37108
+ ...formatUnknownExceptionDetailLines(error2),
37109
+ "",
37110
+ "debug:",
37111
+ stack ? indent2(stack) : indent2(message),
37112
+ "",
37113
+ "next_action: 请根据上面的简化 message 判断失败原因;参数或能力不支持时不要重复调用,并保留 error_details/debug 反馈给开发者。"
37114
+ ].join("\n");
37115
+ }
36830
37116
  return [
36831
37117
  "✗ Maker MCP tool failed",
36832
37118
  "",
@@ -36841,6 +37127,68 @@ function formatToolException(toolName, error2) {
36841
37127
  "next_action: 请把上面的完整错误反馈给开发者;如果本地已有 commit 但 push 未完成,不要重复 commit,直接重试 maker_build_current_directory。"
36842
37128
  ].join("\n");
36843
37129
  }
37130
+ function stripNestedMcpErrorPrefixes(message) {
37131
+ const prefix = /^MCP error -?\d+:\s*/i;
37132
+ let concise = message.trim();
37133
+ while (prefix.test(concise)) {
37134
+ concise = concise.replace(prefix, "");
37135
+ }
37136
+ return concise || message;
37137
+ }
37138
+ function flattenNestedMcpErrorPrefixes(value) {
37139
+ if (typeof value === "string") {
37140
+ return stripNestedMcpErrorPrefixes(value);
37141
+ }
37142
+ if (Array.isArray(value)) {
37143
+ return value.map((item) => flattenNestedMcpErrorPrefixes(item));
37144
+ }
37145
+ if (isPlainRecord(value)) {
37146
+ return Object.fromEntries(
37147
+ Object.entries(value).map(([key, nestedValue]) => [
37148
+ key,
37149
+ flattenNestedMcpErrorPrefixes(nestedValue)
37150
+ ])
37151
+ );
37152
+ }
37153
+ return value;
37154
+ }
37155
+ function extractRemoteProxyErrorMessage(result) {
37156
+ if (!isPlainRecord(result) || !Array.isArray(result.content)) {
37157
+ return void 0;
37158
+ }
37159
+ for (const item of result.content) {
37160
+ if (!isPlainRecord(item) || typeof item.text !== "string") {
37161
+ continue;
37162
+ }
37163
+ const text = item.text.trim();
37164
+ if (!text) {
37165
+ continue;
37166
+ }
37167
+ try {
37168
+ const parsed = JSON.parse(text);
37169
+ const structuredMessage = extractStructuredErrorMessage(parsed);
37170
+ if (structuredMessage) {
37171
+ return firstLine(structuredMessage);
37172
+ }
37173
+ return void 0;
37174
+ } catch {
37175
+ return firstLine(text);
37176
+ }
37177
+ }
37178
+ return void 0;
37179
+ }
37180
+ function extractStructuredErrorMessage(value) {
37181
+ if (!isPlainRecord(value)) {
37182
+ return void 0;
37183
+ }
37184
+ for (const key of ["message", "error", "detail"]) {
37185
+ const candidate = value[key];
37186
+ if (typeof candidate === "string" && candidate.trim()) {
37187
+ return stripNestedMcpErrorPrefixes(candidate);
37188
+ }
37189
+ }
37190
+ return void 0;
37191
+ }
36844
37192
  function firstLine(value) {
36845
37193
  return value.split("\n")[0] || value;
36846
37194
  }
@@ -36894,9 +37242,9 @@ function indent2(value) {
36894
37242
  // src/maker/cli/commands.ts
36895
37243
  import { spawnSync as spawnSync7 } from "node:child_process";
36896
37244
  import crypto3 from "node:crypto";
36897
- import fs16 from "node:fs";
37245
+ import fs17 from "node:fs";
36898
37246
  import os4 from "node:os";
36899
- import path17 from "node:path";
37247
+ import path18 from "node:path";
36900
37248
  import readline from "node:readline/promises";
36901
37249
  import { stdin as input, stdout as output } from "node:process";
36902
37250
 
@@ -37042,7 +37390,7 @@ function formatError2(error2) {
37042
37390
  }
37043
37391
 
37044
37392
  // src/maker/cli/commands.ts
37045
- var VERSION2 = true ? "0.0.24-beta.2" : "dev";
37393
+ var VERSION2 = true ? "0.0.25-beta.1" : "dev";
37046
37394
  var DEFAULT_MCP_NAME = "taptap-maker";
37047
37395
  var MAKER_NPM_PACKAGE = "@taptap/maker";
37048
37396
  var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
@@ -37177,7 +37525,7 @@ function toOptionKey(value) {
37177
37525
  }
37178
37526
  async function runInit(parsed, ctx) {
37179
37527
  rejectPackageOption(parsed);
37180
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
37528
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37181
37529
  const env = makerEnvOption(parsed);
37182
37530
  const skipConfirm = booleanOption(parsed, "skip_confirm");
37183
37531
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -37270,7 +37618,7 @@ async function runInit(parsed, ctx) {
37270
37618
  }
37271
37619
  async function runDoctor(parsed, ctx) {
37272
37620
  var _a3, _b;
37273
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
37621
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37274
37622
  const env = makerEnvOption(parsed);
37275
37623
  const git = checkGitEnvironment();
37276
37624
  const python = checkMakerPythonEnvironment();
@@ -37293,6 +37641,7 @@ async function runDoctor(parsed, ctx) {
37293
37641
  makerProjectDir: identify.projectRoot
37294
37642
  });
37295
37643
  const projectInitialization = isProjectBound ? inspectMakerProjectInitialization(projectRoot) : void 0;
37644
+ const projectSettings = isProjectBound ? inspectMakerProjectSettings(projectRoot) : void 0;
37296
37645
  const workBuddyTrust = shouldShowWorkBuddyTrustInspection() ? inspectWorkBuddyTrustState(DEFAULT_MCP_NAME) : void 0;
37297
37646
  if (ctx.json) {
37298
37647
  writeJson({
@@ -37310,6 +37659,7 @@ async function runDoctor(parsed, ctx) {
37310
37659
  dev_kit_update: devKitUpdate,
37311
37660
  package_update: packageUpdate,
37312
37661
  project_initialization: projectInitialization,
37662
+ project_settings: projectSettings,
37313
37663
  mcp_tools_availability: mcpToolsAvailability,
37314
37664
  ...workBuddyTrust ? { workbuddy_trust: workBuddyTrust } : {},
37315
37665
  orphan_process_check: orphanProcessCheck
@@ -37338,6 +37688,7 @@ async function runDoctor(parsed, ctx) {
37338
37688
  `- project_id: ${identify.projectId || "(none)"}`,
37339
37689
  identify.configPath ? `- config: ${identify.configPath}` : "",
37340
37690
  projectInitialization ? formatMakerProjectInitializationStatus(projectInitialization) : "",
37691
+ projectSettings ? formatMakerProjectSettingsStatus(projectSettings) : "",
37341
37692
  isProjectBound ? formatMakerAgentsPolicyStatus(projectRoot) : "",
37342
37693
  "",
37343
37694
  "AI dev kit",
@@ -37361,9 +37712,9 @@ async function runDoctor(parsed, ctx) {
37361
37712
  );
37362
37713
  }
37363
37714
  function inspectMakerMcpToolsAvailability(options) {
37364
- const aiPwd = path17.resolve(process.cwd());
37715
+ const aiPwd = path18.resolve(process.cwd());
37365
37716
  const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
37366
- const makerProjectDir = options.makerProjectDir ? path17.resolve(options.makerProjectDir) : void 0;
37717
+ const makerProjectDir = options.makerProjectDir ? path18.resolve(options.makerProjectDir) : void 0;
37367
37718
  if (!makerProjectDir) {
37368
37719
  return {
37369
37720
  tools_visibility: "refresh_ai_client_if_missing",
@@ -37405,9 +37756,9 @@ function samePath2(left, right) {
37405
37756
  return normalizePathForCompare3(left) === normalizePathForCompare3(right);
37406
37757
  }
37407
37758
  function normalizePathForCompare3(value) {
37408
- const resolved = path17.resolve(value);
37759
+ const resolved = path18.resolve(value);
37409
37760
  try {
37410
- return fs16.realpathSync.native(resolved);
37761
+ return fs17.realpathSync.native(resolved);
37411
37762
  } catch {
37412
37763
  return resolved;
37413
37764
  }
@@ -37725,7 +38076,7 @@ async function runPatSet(parsed, ctx) {
37725
38076
  }
37726
38077
  async function resolvePatSet(parsed, ctx) {
37727
38078
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
37728
- const pat = fs16.readFileSync(0, "utf8").trim();
38079
+ const pat = fs17.readFileSync(0, "utf8").trim();
37729
38080
  if (!pat) {
37730
38081
  throw new Error("No PAT found on stdin.");
37731
38082
  }
@@ -37755,7 +38106,7 @@ async function runMcpInstall(parsed, ctx) {
37755
38106
  env: makerEnvOption(parsed),
37756
38107
  pkg: MAKER_NPM_PACKAGE,
37757
38108
  mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
37758
- cwd: explicitTargetDir ? path17.resolve(explicitTargetDir) : void 0
38109
+ cwd: explicitTargetDir ? path18.resolve(explicitTargetDir) : void 0
37759
38110
  });
37760
38111
  if (ctx.json) {
37761
38112
  writeJson(results);
@@ -37814,7 +38165,7 @@ ${indent3(payload.stderr)}` : "",
37814
38165
  );
37815
38166
  }
37816
38167
  async function runAgentsUpdate(parsed, ctx) {
37817
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
38168
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37818
38169
  const result = updateMakerAgentsPolicy(targetDir);
37819
38170
  if (ctx.json) {
37820
38171
  writeJson(result);
@@ -37833,7 +38184,7 @@ async function runAgentsUpdate(parsed, ctx) {
37833
38184
  async function runUpgrade(parsed, ctx) {
37834
38185
  rejectPackageOption(parsed);
37835
38186
  const explicitTargetDir = stringOption(parsed, "target_dir");
37836
- const targetDir = path17.resolve(explicitTargetDir || process.cwd());
38187
+ const targetDir = path18.resolve(explicitTargetDir || process.cwd());
37837
38188
  const env = makerEnvOption(parsed);
37838
38189
  const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
37839
38190
  const installResults = installMcpConfigs({
@@ -37918,7 +38269,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
37918
38269
  ];
37919
38270
  }
37920
38271
  async function runDevKitUpdate(parsed, ctx) {
37921
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
38272
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37922
38273
  const result = await installAiDevKit({
37923
38274
  targetDir,
37924
38275
  preserveExisting: false,
@@ -37930,7 +38281,7 @@ async function runDevKitUpdate(parsed, ctx) {
37930
38281
  emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
37931
38282
  }
37932
38283
  async function runLogsWatch(parsed, ctx) {
37933
- const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
38284
+ const targetDir = path18.resolve(stringOption(parsed, "target_dir") || process.cwd());
37934
38285
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
37935
38286
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
37936
38287
  const maxPolls = numberOption(parsed, "max_polls");
@@ -37940,9 +38291,9 @@ async function runLogsWatch(parsed, ctx) {
37940
38291
  serverUrl: stringOption(parsed, "server_url"),
37941
38292
  env: makerEnvOption(parsed)
37942
38293
  });
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");
38294
+ const runtimeDir = path18.join(proxy.projectRoot, ".maker", "logs", "runtime");
38295
+ const runtimeLog = path18.join(runtimeDir, "runtime.log");
38296
+ const pidFile = path18.join(runtimeDir, "watcher.pid");
37946
38297
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
37947
38298
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
37948
38299
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -37987,10 +38338,10 @@ async function runLogsWatch(parsed, ctx) {
37987
38338
  }
37988
38339
  }
37989
38340
  function registerRuntimeLogWatcherProcess(pidFile) {
37990
- fs16.mkdirSync(path17.dirname(pidFile), { recursive: true });
38341
+ fs17.mkdirSync(path18.dirname(pidFile), { recursive: true });
37991
38342
  const existingPid = readPidFile(pidFile);
37992
38343
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
37993
- fs16.writeFileSync(
38344
+ fs17.writeFileSync(
37994
38345
  pidFile,
37995
38346
  `${JSON.stringify(
37996
38347
  {
@@ -38008,10 +38359,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
38008
38359
  return previous;
38009
38360
  }
38010
38361
  function readPidFile(pidFile) {
38011
- if (!fs16.existsSync(pidFile)) {
38362
+ if (!fs17.existsSync(pidFile)) {
38012
38363
  return void 0;
38013
38364
  }
38014
- const raw = fs16.readFileSync(pidFile, "utf8").trim();
38365
+ const raw = fs17.readFileSync(pidFile, "utf8").trim();
38015
38366
  let pid = Number(raw);
38016
38367
  if (!Number.isInteger(pid) || pid <= 0) {
38017
38368
  try {
@@ -38031,7 +38382,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
38031
38382
  }
38032
38383
  cleaned = true;
38033
38384
  if (readPidFile(pidFile) === process.pid) {
38034
- fs16.rmSync(pidFile, { force: true });
38385
+ fs17.rmSync(pidFile, { force: true });
38035
38386
  }
38036
38387
  };
38037
38388
  process.once("exit", cleanup);
@@ -38182,7 +38533,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
38182
38533
  onStart: (event) => emitSkillInstallerStart(ctx, event)
38183
38534
  });
38184
38535
  writeDevKitStagedGitignore(
38185
- path17.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
38536
+ path18.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
38186
38537
  listPresentDevKitManagedEntries(targetDir)
38187
38538
  );
38188
38539
  if (options.finalizeGitignore) {
@@ -38199,7 +38550,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
38199
38550
  );
38200
38551
  } catch (error2) {
38201
38552
  writeDevKitStagedGitignore(
38202
- path17.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
38553
+ path18.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
38203
38554
  listPresentDevKitManagedEntries(targetDir)
38204
38555
  );
38205
38556
  if (options.finalizeGitignore) {
@@ -38289,12 +38640,12 @@ function installMcpConfig(ide, options) {
38289
38640
  }
38290
38641
  function installMcpConfigUnsafe(ide, options) {
38291
38642
  if (ide === "codex") {
38292
- const configPath = path17.join(os4.homedir(), ".codex", "config.toml");
38643
+ const configPath = path18.join(os4.homedir(), ".codex", "config.toml");
38293
38644
  const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
38294
38645
  return [createMcpInstallResult(ide, "Codex", configPath, write)];
38295
38646
  }
38296
38647
  if (ide === "cursor") {
38297
- const configPath = path17.join(os4.homedir(), ".cursor", "mcp.json");
38648
+ const configPath = path18.join(os4.homedir(), ".cursor", "mcp.json");
38298
38649
  const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
38299
38650
  return [createMcpInstallResult(ide, "Cursor", configPath, write)];
38300
38651
  }
@@ -38312,7 +38663,7 @@ function installMcpConfigUnsafe(ide, options) {
38312
38663
  ];
38313
38664
  }
38314
38665
  }
38315
- const configPath = path17.join(os4.homedir(), ".claude.json");
38666
+ const configPath = path18.join(os4.homedir(), ".claude.json");
38316
38667
  const write = mergeJsonMcpConfig(configPath, claudeOptions);
38317
38668
  return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
38318
38669
  }
@@ -38326,7 +38677,7 @@ function installMcpConfigUnsafe(ide, options) {
38326
38677
  }
38327
38678
  if (ide === "opencode") {
38328
38679
  const configPath = getOpenCodeMcpConfigPath();
38329
- if (!fs16.existsSync(configPath)) {
38680
+ if (!fs17.existsSync(configPath)) {
38330
38681
  return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
38331
38682
  }
38332
38683
  const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
@@ -38394,7 +38745,7 @@ function getDefaultMcpInstallIdes() {
38394
38745
  if (getTraeMcpInstallPaths().length > 0) {
38395
38746
  ides.push("trae");
38396
38747
  }
38397
- if (fs16.existsSync(getOpenCodeMcpConfigPath())) {
38748
+ if (fs17.existsSync(getOpenCodeMcpConfigPath())) {
38398
38749
  ides.push("opencode");
38399
38750
  }
38400
38751
  if (getWorkBuddyMcpInstallPaths().length > 0) {
@@ -38411,7 +38762,7 @@ function getExistingTraeUserConfigPaths(paths) {
38411
38762
  const seen = /* @__PURE__ */ new Set();
38412
38763
  return paths.filter((configPath) => {
38413
38764
  const key = normalizeConfigPathKey(configPath);
38414
- if (seen.has(key) || !fs16.existsSync(path17.dirname(configPath))) {
38765
+ if (seen.has(key) || !fs17.existsSync(path18.dirname(configPath))) {
38415
38766
  return false;
38416
38767
  }
38417
38768
  seen.add(key);
@@ -38422,7 +38773,7 @@ function getExistingConfigPaths(paths) {
38422
38773
  const seen = /* @__PURE__ */ new Set();
38423
38774
  return paths.filter((configPath) => {
38424
38775
  const key = normalizeConfigPathKey(configPath);
38425
- if (seen.has(key) || !fs16.existsSync(configPath)) {
38776
+ if (seen.has(key) || !fs17.existsSync(configPath)) {
38426
38777
  return false;
38427
38778
  }
38428
38779
  seen.add(key);
@@ -38430,65 +38781,65 @@ function getExistingConfigPaths(paths) {
38430
38781
  });
38431
38782
  }
38432
38783
  function normalizeConfigPathKey(configPath) {
38433
- const resolved = path17.resolve(configPath);
38784
+ const resolved = path18.resolve(configPath);
38434
38785
  return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
38435
38786
  }
38436
38787
  function getTraeSoloMcpConfigPaths() {
38437
38788
  if (process.platform === "win32") {
38438
- const roaming = process.env.APPDATA || path17.join(os4.homedir(), "AppData", "Roaming");
38789
+ const roaming = process.env.APPDATA || path18.join(os4.homedir(), "AppData", "Roaming");
38439
38790
  return [
38440
- path17.join(roaming, "TRAE SOLO", "User", "mcp.json"),
38441
- path17.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
38791
+ path18.join(roaming, "TRAE SOLO", "User", "mcp.json"),
38792
+ path18.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
38442
38793
  ];
38443
38794
  }
38444
- const appSupport = path17.join(os4.homedir(), "Library", "Application Support");
38795
+ const appSupport = path18.join(os4.homedir(), "Library", "Application Support");
38445
38796
  return [
38446
- path17.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
38447
- path17.join(appSupport, "TRAE SOLO", "User", "mcp.json")
38797
+ path18.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
38798
+ path18.join(appSupport, "TRAE SOLO", "User", "mcp.json")
38448
38799
  ];
38449
38800
  }
38450
38801
  function getTraeUnverifiedMcpConfigPaths() {
38451
38802
  if (process.platform === "win32") {
38452
- const roaming = process.env.APPDATA || path17.join(os4.homedir(), "AppData", "Roaming");
38803
+ const roaming = process.env.APPDATA || path18.join(os4.homedir(), "AppData", "Roaming");
38453
38804
  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")
38805
+ path18.join(roaming, "Trae", "User", "mcp.json"),
38806
+ path18.join(roaming, "TRAE", "User", "mcp.json"),
38807
+ path18.join(roaming, "Trae CN", "User", "mcp.json")
38457
38808
  ];
38458
38809
  }
38459
- const appSupport = path17.join(os4.homedir(), "Library", "Application Support");
38810
+ const appSupport = path18.join(os4.homedir(), "Library", "Application Support");
38460
38811
  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")
38812
+ path18.join(appSupport, "Trae", "User", "mcp.json"),
38813
+ path18.join(appSupport, "TRAE", "User", "mcp.json"),
38814
+ path18.join(appSupport, "Trae CN", "User", "mcp.json")
38464
38815
  ];
38465
38816
  }
38466
38817
  function getOpenCodeMcpConfigPath() {
38467
- return path17.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
38818
+ return path18.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
38468
38819
  }
38469
38820
  function getWorkBuddyHome() {
38470
- return path17.join(os4.homedir(), ".workbuddy");
38821
+ return path18.join(os4.homedir(), ".workbuddy");
38471
38822
  }
38472
38823
  function shouldShowWorkBuddyTrustInspection() {
38473
- return fs16.existsSync(getWorkBuddyHome());
38824
+ return fs17.existsSync(getWorkBuddyHome());
38474
38825
  }
38475
38826
  function getWorkBuddyMcpInstallPaths(options = {}) {
38476
- const primary = path17.join(getWorkBuddyHome(), "mcp.json");
38477
- if (fs16.existsSync(primary) || options.createPrimary) {
38827
+ const primary = path18.join(getWorkBuddyHome(), "mcp.json");
38828
+ if (fs17.existsSync(primary) || options.createPrimary) {
38478
38829
  return [primary];
38479
38830
  }
38480
- const legacy = path17.join(getWorkBuddyHome(), ".mcp.json");
38481
- if (fs16.existsSync(legacy)) {
38831
+ const legacy = path18.join(getWorkBuddyHome(), ".mcp.json");
38832
+ if (fs17.existsSync(legacy)) {
38482
38833
  return [legacy];
38483
38834
  }
38484
38835
  return [];
38485
38836
  }
38486
38837
  function inspectWorkBuddyTrustState(mcpName) {
38487
38838
  const workbuddyHome = getWorkBuddyHome();
38488
- const connectorsDir = path17.join(workbuddyHome, "connectors");
38839
+ const connectorsDir = path18.join(workbuddyHome, "connectors");
38489
38840
  const accounts = [];
38490
38841
  const stateFiles = [];
38491
- if (!fs16.existsSync(connectorsDir)) {
38842
+ if (!fs17.existsSync(connectorsDir)) {
38492
38843
  return {
38493
38844
  status: "not_found",
38494
38845
  mcp_name: mcpName,
@@ -38498,12 +38849,12 @@ function inspectWorkBuddyTrustState(mcpName) {
38498
38849
  accounts
38499
38850
  };
38500
38851
  }
38501
- for (const entry of fs16.readdirSync(connectorsDir, { withFileTypes: true })) {
38852
+ for (const entry of fs17.readdirSync(connectorsDir, { withFileTypes: true })) {
38502
38853
  if (!entry.isDirectory()) {
38503
38854
  continue;
38504
38855
  }
38505
- const statePath = path17.join(connectorsDir, entry.name, "connector-states.json");
38506
- if (!fs16.existsSync(statePath)) {
38856
+ const statePath = path18.join(connectorsDir, entry.name, "connector-states.json");
38857
+ if (!fs17.existsSync(statePath)) {
38507
38858
  continue;
38508
38859
  }
38509
38860
  stateFiles.push(statePath);
@@ -38578,7 +38929,7 @@ function mergeJsonMcpConfig(configPath, options) {
38578
38929
  );
38579
38930
  }
38580
38931
  function mergeOpenCodeMcpConfig(configPath, options) {
38581
- const rawContent = fs16.readFileSync(configPath, "utf8");
38932
+ const rawContent = fs17.readFileSync(configPath, "utf8");
38582
38933
  const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
38583
38934
  const existing = readJsonObject(configPath, { jsonc: true });
38584
38935
  const mcp = asObject(existing.mcp);
@@ -38605,7 +38956,7 @@ function mergeOpenCodeMcpConfig(configPath, options) {
38605
38956
  return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
38606
38957
  }
38607
38958
  function mergeCodexMcpConfig(configPath, options) {
38608
- const existing = fs16.existsSync(configPath) ? fs16.readFileSync(configPath, "utf8") : "";
38959
+ const existing = fs17.existsSync(configPath) ? fs17.readFileSync(configPath, "utf8") : "";
38609
38960
  const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
38610
38961
  const withoutOld = existing.replace(sectionPattern, "").trimEnd();
38611
38962
  const launch = getNpxCliCommand(options.pkg);
@@ -38775,10 +39126,10 @@ function rejectPackageOption(parsed) {
38775
39126
  }
38776
39127
  }
38777
39128
  function readJsonObject(filePath, options = {}) {
38778
- if (!fs16.existsSync(filePath)) {
39129
+ if (!fs17.existsSync(filePath)) {
38779
39130
  return {};
38780
39131
  }
38781
- const raw = fs16.readFileSync(filePath, "utf8");
39132
+ const raw = fs17.readFileSync(filePath, "utf8");
38782
39133
  try {
38783
39134
  const normalized = normalizeJsonConfigContent(raw, options);
38784
39135
  const parsed = JSON.parse(normalized);
@@ -38798,25 +39149,25 @@ function asObject(value) {
38798
39149
  return {};
38799
39150
  }
38800
39151
  function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
38801
- const existed = fs16.existsSync(filePath);
38802
- const previousContent = existed ? fs16.readFileSync(filePath, "utf8") : void 0;
39152
+ const existed = fs17.existsSync(filePath);
39153
+ const previousContent = existed ? fs17.readFileSync(filePath, "utf8") : void 0;
38803
39154
  if (previousContent === nextContent) {
38804
39155
  return { changed: false };
38805
39156
  }
38806
39157
  const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
38807
- fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
39158
+ fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
38808
39159
  if (previousContent !== void 0 && backupPath) {
38809
- fs16.writeFileSync(backupPath, previousContent, "utf8");
39160
+ fs17.writeFileSync(backupPath, previousContent, "utf8");
38810
39161
  }
38811
39162
  try {
38812
- fs16.writeFileSync(filePath, nextContent, "utf8");
38813
- validate == null ? void 0 : validate(fs16.readFileSync(filePath, "utf8"));
39163
+ fs17.writeFileSync(filePath, nextContent, "utf8");
39164
+ validate == null ? void 0 : validate(fs17.readFileSync(filePath, "utf8"));
38814
39165
  return { changed: true, backupPath };
38815
39166
  } catch (error2) {
38816
39167
  if (previousContent !== void 0) {
38817
- fs16.writeFileSync(filePath, previousContent, "utf8");
39168
+ fs17.writeFileSync(filePath, previousContent, "utf8");
38818
39169
  } else {
38819
- fs16.rmSync(filePath, { force: true });
39170
+ fs17.rmSync(filePath, { force: true });
38820
39171
  }
38821
39172
  throw error2;
38822
39173
  }
@@ -38963,10 +39314,10 @@ function formatMcpInstallMessage(label, configPath, write) {
38963
39314
  ].filter(Boolean).join("\n");
38964
39315
  }
38965
39316
  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`),
39317
+ fs17.mkdirSync(getMakerHome(), { recursive: true });
39318
+ const key = crypto3.createHash("sha256").update(path18.resolve(targetDir)).digest("hex").slice(0, 16);
39319
+ fs17.writeFileSync(
39320
+ path18.join(getMakerHome(), `init-state-${key}.json`),
38970
39321
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
38971
39322
  `,
38972
39323
  "utf8"
@@ -39114,7 +39465,7 @@ function makerEnvOption(parsed) {
39114
39465
  return env;
39115
39466
  }
39116
39467
  const targetDir = stringOption(parsed, "target_dir");
39117
- return getMakerEnvironment(void 0, targetDir ? path17.resolve(targetDir) : process.cwd());
39468
+ return getMakerEnvironment(void 0, targetDir ? path18.resolve(targetDir) : process.cwd());
39118
39469
  }
39119
39470
  function mcpVerifyModeOption(parsed) {
39120
39471
  const mode = stringOption(parsed, "mode") || "npx";
@@ -40618,7 +40969,7 @@ var StreamableHTTPClientTransport = class {
40618
40969
  };
40619
40970
 
40620
40971
  // src/mcp-proxy/proxy.ts
40621
- import * as path19 from "node:path";
40972
+ import * as path20 from "node:path";
40622
40973
  import * as crypto6 from "node:crypto";
40623
40974
 
40624
40975
  // src/mcp-proxy/cookieJar.ts
@@ -40800,8 +41151,8 @@ function createCookieFetch(cookieJar) {
40800
41151
  }
40801
41152
 
40802
41153
  // src/core/utils/logWriter.ts
40803
- import * as fs17 from "node:fs";
40804
- import * as path18 from "node:path";
41154
+ import * as fs18 from "node:fs";
41155
+ import * as path19 from "node:path";
40805
41156
  import * as crypto5 from "node:crypto";
40806
41157
 
40807
41158
  // src/core/types/log.ts
@@ -40842,7 +41193,7 @@ var LogWriter = class {
40842
41193
  return;
40843
41194
  }
40844
41195
  try {
40845
- await fs17.promises.mkdir(this.config.logDir, { recursive: true });
41196
+ await fs18.promises.mkdir(this.config.logDir, { recursive: true });
40846
41197
  await this.cleanupOldLogs();
40847
41198
  this.initialized = true;
40848
41199
  } catch (error2) {
@@ -40865,7 +41216,7 @@ var LogWriter = class {
40865
41216
  */
40866
41217
  getLogFilePath(date5) {
40867
41218
  const d = date5 || this.getCurrentDate();
40868
- return path18.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
41219
+ return path19.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
40869
41220
  }
40870
41221
  /**
40871
41222
  * 获取或创建写入流
@@ -40880,7 +41231,7 @@ var LogWriter = class {
40880
41231
  }
40881
41232
  this.currentDate = date5;
40882
41233
  try {
40883
- this.writeStream = fs17.createWriteStream(this.getLogFilePath(date5), {
41234
+ this.writeStream = fs18.createWriteStream(this.getLogFilePath(date5), {
40884
41235
  flags: "a",
40885
41236
  encoding: "utf8"
40886
41237
  });
@@ -40932,11 +41283,11 @@ var LogWriter = class {
40932
41283
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
40933
41284
  try {
40934
41285
  const filePath = this.getLogFilePath();
40935
- const dir = path18.dirname(filePath);
40936
- if (!fs17.existsSync(dir)) {
40937
- fs17.mkdirSync(dir, { recursive: true });
41286
+ const dir = path19.dirname(filePath);
41287
+ if (!fs18.existsSync(dir)) {
41288
+ fs18.mkdirSync(dir, { recursive: true });
40938
41289
  }
40939
- fs17.appendFileSync(filePath, message, "utf8");
41290
+ fs18.appendFileSync(filePath, message, "utf8");
40940
41291
  } catch {
40941
41292
  }
40942
41293
  }
@@ -40947,7 +41298,7 @@ var LogWriter = class {
40947
41298
  async cleanupOldLogs() {
40948
41299
  if (this.config.maxDays <= 0) return;
40949
41300
  try {
40950
- const files = await fs17.promises.readdir(this.config.logDir);
41301
+ const files = await fs18.promises.readdir(this.config.logDir);
40951
41302
  const cutoffDate = /* @__PURE__ */ new Date();
40952
41303
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
40953
41304
  const prefix = this.config.prefix;
@@ -40962,7 +41313,7 @@ var LogWriter = class {
40962
41313
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
40963
41314
  const fileDate = new Date(year, month - 1, day);
40964
41315
  if (fileDate < cutoffDate) {
40965
- await fs17.promises.unlink(path18.join(this.config.logDir, file2));
41316
+ await fs18.promises.unlink(path19.join(this.config.logDir, file2));
40966
41317
  process.stderr.write(`[LogWriter] Deleted old log: ${file2}
40967
41318
  `);
40968
41319
  }
@@ -41036,10 +41387,10 @@ var TapTapMCPProxy = class {
41036
41387
  const { user_id, project_id } = this.config.tenant;
41037
41388
  let logDir;
41038
41389
  if (user_id && project_id) {
41039
- logDir = path19.join(logRoot, "proxy", user_id, project_id);
41390
+ logDir = path20.join(logRoot, "proxy", user_id, project_id);
41040
41391
  } else {
41041
41392
  const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
41042
- logDir = path19.join(logRoot, "proxy", kidHash);
41393
+ logDir = path20.join(logRoot, "proxy", kidHash);
41043
41394
  }
41044
41395
  return new LogWriter({
41045
41396
  logDir,