@taptap/maker 0.0.18-beta.1 → 0.0.19-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(path17) {
3237
- let input2 = path17;
3236
+ function removeDotSegments(path18) {
3237
+ let input2 = path18;
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 [path17, query] = wsComponent.resourceName.split("?");
3437
- wsComponent.path = path17 && path17 !== "/" ? path17 : void 0;
3436
+ const [path18, query] = wsComponent.resourceName.split("?");
3437
+ wsComponent.path = path18 && path18 !== "/" ? path18 : 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, fs15, exportName) {
12494
+ function addFormats(ajv, list, fs16, 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, fs15[f]);
12499
+ ajv.addFormat(f, fs16[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 fs15 = __require("fs");
12513
- function checkPathExt(path17, options) {
12512
+ var fs16 = __require("fs");
12513
+ function checkPathExt(path18, 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 && path17.substr(-p.length).toLowerCase() === p) {
12524
+ if (p && path18.substr(-p.length).toLowerCase() === p) {
12525
12525
  return true;
12526
12526
  }
12527
12527
  }
12528
12528
  return false;
12529
12529
  }
12530
- function checkStat(stat, path17, options) {
12530
+ function checkStat(stat, path18, options) {
12531
12531
  if (!stat.isSymbolicLink() && !stat.isFile()) {
12532
12532
  return false;
12533
12533
  }
12534
- return checkPathExt(path17, options);
12534
+ return checkPathExt(path18, options);
12535
12535
  }
12536
- function isexe(path17, options, cb) {
12537
- fs15.stat(path17, function(er, stat) {
12538
- cb(er, er ? false : checkStat(stat, path17, options));
12536
+ function isexe(path18, options, cb) {
12537
+ fs16.stat(path18, function(er, stat) {
12538
+ cb(er, er ? false : checkStat(stat, path18, options));
12539
12539
  });
12540
12540
  }
12541
- function sync(path17, options) {
12542
- return checkStat(fs15.statSync(path17), path17, options);
12541
+ function sync(path18, options) {
12542
+ return checkStat(fs16.statSync(path18), path18, 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 fs15 = __require("fs");
12553
- function isexe(path17, options, cb) {
12554
- fs15.stat(path17, function(er, stat) {
12552
+ var fs16 = __require("fs");
12553
+ function isexe(path18, options, cb) {
12554
+ fs16.stat(path18, function(er, stat) {
12555
12555
  cb(er, er ? false : checkStat(stat, options));
12556
12556
  });
12557
12557
  }
12558
- function sync(path17, options) {
12559
- return checkStat(fs15.statSync(path17), options);
12558
+ function sync(path18, options) {
12559
+ return checkStat(fs16.statSync(path18), 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 fs15 = __require("fs");
12583
+ var fs16 = __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(path17, options, cb) {
12592
+ function isexe(path18, 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(path17, options || {}, function(er, is) {
12602
+ isexe(path18, 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(path17, options || {}, function(er, is) {
12611
+ core(path18, 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(path17, options) {
12621
+ function sync(path18, options) {
12622
12622
  try {
12623
- return core.sync(path17, options || {});
12623
+ return core.sync(path18, 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 path17 = __require("path");
12639
+ var path18 = __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 = path17.join(pathPart, cmd);
12677
+ const pCmd = path18.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 = path17.join(pathPart, cmd);
12704
+ const pCmd = path18.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 path17 = __require("path");
12752
+ var path18 = __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 ? path17.delimiter : void 0
12770
+ pathExt: withoutPathExt ? path18.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 = path17.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12779
+ resolved = path18.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 [path17, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
- const binary = path17.split("/").pop();
12833
+ const [path18, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
+ const binary = path18.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 fs15 = __require("fs");
12847
+ var fs16 = __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 = fs15.openSync(command, "r");
12855
- fs15.readSync(fd, buffer, 0, size, 0);
12856
- fs15.closeSync(fd);
12854
+ fd = fs16.openSync(command, "r");
12855
+ fs16.readSync(fd, buffer, 0, size, 0);
12856
+ fs16.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 path17 = __require("path");
12869
+ var path18 = __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 = path17.normalize(parsed.command);
12894
+ parsed.command = path18.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, spawnSync as spawnSync6 } from "node:child_process";
13006
- import fs12 from "node:fs";
13007
- import path13 from "node:path";
13006
+ import fs13 from "node:fs";
13007
+ import path14 from "node:path";
13008
13008
 
13009
13009
  // node_modules/zod/v3/helpers/util.js
13010
13010
  var util;
@@ -13365,8 +13365,8 @@ function getErrorMap() {
13365
13365
 
13366
13366
  // node_modules/zod/v3/helpers/parseUtil.js
13367
13367
  var makeIssue = (params) => {
13368
- const { data, path: path17, errorMaps, issueData } = params;
13369
- const fullPath = [...path17, ...issueData.path || []];
13368
+ const { data, path: path18, errorMaps, issueData } = params;
13369
+ const fullPath = [...path18, ...issueData.path || []];
13370
13370
  const fullIssue = {
13371
13371
  ...issueData,
13372
13372
  path: fullPath
@@ -13481,11 +13481,11 @@ var errorUtil;
13481
13481
 
13482
13482
  // node_modules/zod/v3/types.js
13483
13483
  var ParseInputLazyPath = class {
13484
- constructor(parent, value, path17, key) {
13484
+ constructor(parent, value, path18, key) {
13485
13485
  this._cachedPath = [];
13486
13486
  this.parent = parent;
13487
13487
  this.data = value;
13488
- this._path = path17;
13488
+ this._path = path18;
13489
13489
  this._key = key;
13490
13490
  }
13491
13491
  get path() {
@@ -17134,10 +17134,10 @@ function mergeDefs(...defs) {
17134
17134
  function cloneDef(schema) {
17135
17135
  return mergeDefs(schema._zod.def);
17136
17136
  }
17137
- function getElementAtPath(obj, path17) {
17138
- if (!path17)
17137
+ function getElementAtPath(obj, path18) {
17138
+ if (!path18)
17139
17139
  return obj;
17140
- return path17.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
17140
+ return path18.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
17141
17141
  }
17142
17142
  function promiseAllObject(promisesObj) {
17143
17143
  const keys = Object.keys(promisesObj);
@@ -17522,11 +17522,11 @@ function aborted(x, startIndex = 0) {
17522
17522
  }
17523
17523
  return false;
17524
17524
  }
17525
- function prefixIssues(path17, issues) {
17525
+ function prefixIssues(path18, issues) {
17526
17526
  return issues.map((iss) => {
17527
17527
  var _a3;
17528
17528
  (_a3 = iss).path ?? (_a3.path = []);
17529
- iss.path.unshift(path17);
17529
+ iss.path.unshift(path18);
17530
17530
  return iss;
17531
17531
  });
17532
17532
  }
@@ -28507,8 +28507,8 @@ function logLifecycleEvent(source, message) {
28507
28507
 
28508
28508
  // src/maker/cli/projects.ts
28509
28509
  import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
28510
- import fs6 from "node:fs";
28511
- import path7 from "node:path";
28510
+ import fs7 from "node:fs";
28511
+ import path8 from "node:path";
28512
28512
 
28513
28513
  // src/maker/config.ts
28514
28514
  import fs4 from "node:fs";
@@ -29124,9 +29124,9 @@ function formatGitMissingMessage(environment) {
29124
29124
 
29125
29125
  // src/maker/cli/devKit.ts
29126
29126
  import { spawnSync as spawnSync2 } from "node:child_process";
29127
- import fs5 from "node:fs";
29127
+ import fs6 from "node:fs";
29128
29128
  import os3 from "node:os";
29129
- import path6 from "node:path";
29129
+ import path7 from "node:path";
29130
29130
 
29131
29131
  // src/maker/fetchTimeout.ts
29132
29132
  var DEFAULT_SHORT_FETCH_TIMEOUT_MS = 10 * 1e3;
@@ -29151,13 +29151,141 @@ async function fetchWithTimeout(fetchImpl, url2, init, timeoutMs, label) {
29151
29151
  }
29152
29152
  }
29153
29153
 
29154
+ // src/maker/cli/agentsPolicy.ts
29155
+ import crypto from "node:crypto";
29156
+ import fs5 from "node:fs";
29157
+ import path6 from "node:path";
29158
+ var MAKER_AGENTS_FILE = "AGENTS.md";
29159
+ var POLICY_VERSION = "1";
29160
+ var POLICY_END = "<!-- <<< TapTap Maker managed AGENTS policy <<< -->";
29161
+ var POLICY_BLOCK_PATTERN = /(?:# TapTap Maker Project Asset Tool Policy\s*)?<!-- >>> TapTap Maker (?:managed AGENTS policy version=([^ ]+) hash=sha256:([0-9a-f]+)|asset tool policy) >>> -->[\s\S]*?<!-- <<< TapTap Maker (?:managed AGENTS policy|asset tool policy) <<< -->\n?/;
29162
+ function inspectMakerAgentsPolicy(targetDir) {
29163
+ const resolvedTargetDir = path6.resolve(targetDir);
29164
+ const agentsPath = path6.join(resolvedTargetDir, MAKER_AGENTS_FILE);
29165
+ const expectedHash = hashPolicyBody(createMakerAgentsPolicyBody());
29166
+ if (!fs5.existsSync(agentsPath)) {
29167
+ return {
29168
+ targetDir: resolvedTargetDir,
29169
+ path: agentsPath,
29170
+ status: "missing_file",
29171
+ expectedHash
29172
+ };
29173
+ }
29174
+ const existing = fs5.readFileSync(agentsPath, "utf8");
29175
+ const match = POLICY_BLOCK_PATTERN.exec(existing);
29176
+ if (!match) {
29177
+ return {
29178
+ targetDir: resolvedTargetDir,
29179
+ path: agentsPath,
29180
+ status: "missing_block",
29181
+ expectedHash
29182
+ };
29183
+ }
29184
+ const version2 = match[1];
29185
+ const hash2 = match[2];
29186
+ return {
29187
+ targetDir: resolvedTargetDir,
29188
+ path: agentsPath,
29189
+ status: version2 === POLICY_VERSION && hash2 === expectedHash ? "current" : "outdated",
29190
+ version: version2,
29191
+ hash: hash2,
29192
+ expectedHash
29193
+ };
29194
+ }
29195
+ function updateMakerAgentsPolicy(targetDir) {
29196
+ const resolvedTargetDir = path6.resolve(targetDir);
29197
+ fs5.mkdirSync(resolvedTargetDir, { recursive: true });
29198
+ const inspection = inspectMakerAgentsPolicy(resolvedTargetDir);
29199
+ const agentsPath = inspection.path;
29200
+ const existing = fs5.existsSync(agentsPath) ? fs5.readFileSync(agentsPath, "utf8") : "";
29201
+ const next = prependOrReplaceMakerAgentsPolicyBlock(existing);
29202
+ if (existing !== next) {
29203
+ fs5.writeFileSync(agentsPath, next, "utf8");
29204
+ }
29205
+ return {
29206
+ path: agentsPath,
29207
+ previousStatus: inspection.status,
29208
+ changed: existing !== next,
29209
+ expectedHash: inspection.expectedHash
29210
+ };
29211
+ }
29212
+ function formatMakerAgentsPolicyStatus(targetDir) {
29213
+ const inspection = inspectMakerAgentsPolicy(targetDir);
29214
+ const lines = [
29215
+ "AGENTS.md",
29216
+ `- path: ${inspection.path}`,
29217
+ `- status: ${inspection.status}`,
29218
+ `- expected_hash: sha256:${inspection.expectedHash}`,
29219
+ inspection.version ? `- current_version: ${inspection.version}` : "",
29220
+ inspection.hash ? `- current_hash: sha256:${inspection.hash}` : "",
29221
+ inspection.status === "current" ? "" : "- next_step: taptap-maker agents update --target-dir <Maker project dir>"
29222
+ ];
29223
+ return lines.filter(Boolean).join("\n");
29224
+ }
29225
+ function prependOrReplaceMakerAgentsPolicyBlock(existing) {
29226
+ const withoutOldBlock = existing.replace(POLICY_BLOCK_PATTERN, "").trimStart();
29227
+ return [createMakerAgentsPolicyBlock(), withoutOldBlock].filter((part) => part.length > 0).join("\n\n");
29228
+ }
29229
+ function createMakerAgentsPolicyBlock() {
29230
+ const body = createMakerAgentsPolicyBody();
29231
+ const hash2 = hashPolicyBody(body);
29232
+ return [
29233
+ `<!-- >>> TapTap Maker managed AGENTS policy version=${POLICY_VERSION} hash=sha256:${hash2} >>> -->`,
29234
+ body,
29235
+ POLICY_END,
29236
+ ""
29237
+ ].join("\n");
29238
+ }
29239
+ function createMakerAgentsPolicyBody() {
29240
+ return [
29241
+ "# TapTap Maker Project Asset Tool Policy",
29242
+ "",
29243
+ "This is a bound TapTap Maker project. For game asset generation or editing in this project,",
29244
+ "the local AI/Agent should prefer Maker MCP proxy tools when they are available:",
29245
+ "",
29246
+ "- `generate_image` for one image asset.",
29247
+ "- `batch_generate_images` for multiple image assets.",
29248
+ "- `edit_image` for modifying existing project images.",
29249
+ "- `create_video_task` for game video assets or referenced image/video generation.",
29250
+ "- `query_video_task` for refreshing video task status and fetching completed videos.",
29251
+ "- `text_to_music` for game music or audio assets.",
29252
+ "- `create_3d_model_task` for game 3D model assets.",
29253
+ "- `query_3d_model_task` for polling 3D model tasks.",
29254
+ "- For 3D characters that need skeletons, animation, or FBX output, ask whether to use",
29255
+ " `rig=true`. Use it only for biped humanoid characters in A-pose or A-pose-compatible",
29256
+ " front-view inputs; otherwise keep static model generation.",
29257
+ "",
29258
+ "Follow each Maker tool schema for supported local path, remote URL, and data URL inputs.",
29259
+ "If the user references attached/local media, inspect the attachment or workspace file path",
29260
+ "before calling the tool. Local proxy may convert resolvable local reference media to data URLs",
29261
+ "before forwarding to the remote Maker MCP server.",
29262
+ "",
29263
+ "If the required Maker proxy tool is not exposed in the current AI session, explain that the",
29264
+ "Maker proxy tool is unavailable and suggest checking/reconnecting the Maker MCP session.",
29265
+ "Other client media tools may still be usable when their output is passed back through a supported",
29266
+ "local path, remote URL, or data URL input.",
29267
+ "",
29268
+ "Generated Maker proxy assets should stay in the Maker project asset workflow under",
29269
+ "`assets/image`, `assets/video`, `assets/audio`, or `assets/model`, with remote mappings",
29270
+ "preserved for later edits and builds.",
29271
+ "3D model results save the original GLB/FBX, the MDL zip, extracted MDL assets, and rendered",
29272
+ "preview images when those URLs are returned."
29273
+ ].join("\n");
29274
+ }
29275
+ function hashPolicyBody(body) {
29276
+ return crypto.createHash("sha256").update(normalizePolicyText(body)).digest("hex");
29277
+ }
29278
+ function normalizePolicyText(text) {
29279
+ return text.replace(/\r\n/g, "\n").trim();
29280
+ }
29281
+
29154
29282
  // src/maker/cli/devKit.ts
29155
29283
  var AI_DEV_KIT_URLS = {
29156
29284
  production: "https://urhox-demo-platform.spark.xd.com/ai-dev-kit/pd/stable/ai-dev-kit.zip",
29157
29285
  rnd: "https://urhox-demo-platform.spark.xd.com/ai-dev-kit/rnd/latest/ai-dev-kit.zip"
29158
29286
  };
29159
29287
  var DEFAULT_AI_DEV_KIT_URL = AI_DEV_KIT_URLS.production;
29160
- var AI_DEV_KIT_VERSION_METADATA_FILE = path6.join(".maker", "ai-dev-kit-version.json");
29288
+ var AI_DEV_KIT_VERSION_METADATA_FILE = path7.join(".maker", "ai-dev-kit-version.json");
29161
29289
  var AI_DEV_KIT_DOWNLOAD_ENV = {
29162
29290
  production: "pd",
29163
29291
  rnd: "rnd"
@@ -29168,9 +29296,6 @@ function resolveDefaultAiDevKitUrl(environment = EnvConfig.environment) {
29168
29296
  }
29169
29297
  var DEV_KIT_IGNORE_BEGIN = "# >>> TapTap Maker AI dev kit (local only) >>>";
29170
29298
  var DEV_KIT_IGNORE_END = "# <<< TapTap Maker AI dev kit (local only) <<<";
29171
- var MAKER_ASSET_POLICY_BEGIN = "<!-- >>> TapTap Maker asset tool policy >>> -->";
29172
- var MAKER_ASSET_POLICY_END = "<!-- <<< TapTap Maker asset tool policy <<< -->";
29173
- var AGENTS_INSTRUCTION_FILE = "AGENTS.md";
29174
29299
  var DEV_KIT_GITIGNORE_STAGING_FILE = ".gitignore.dev-kit-before-clone";
29175
29300
  var DEV_KIT_REQUIRED_ENTRIES = ["CLAUDE.md", "examples", "templates", "urhox-libs"];
29176
29301
  var ALWAYS_IGNORED_LOCAL_ENTRIES = [".DS_Store", ".maker", ".installer"];
@@ -29195,9 +29320,9 @@ var DEV_KIT_MANAGED_ENTRY_CANDIDATES = [
29195
29320
  var SKIPPED_TOP_LEVEL_ENTRIES = /* @__PURE__ */ new Set(["scripts", ".DS_Store", "ai-dev-kit.zip"]);
29196
29321
  var SKILL_INSTALLER_OUTPUT_ENTRIES = [".claude", ".codex", ".cursor", ".gemini"];
29197
29322
  function inspectAiDevKit(targetDir) {
29198
- const resolvedTargetDir = path6.resolve(targetDir);
29323
+ const resolvedTargetDir = path7.resolve(targetDir);
29199
29324
  const presentEntries = DEV_KIT_REQUIRED_ENTRIES.filter(
29200
- (entry) => fs5.existsSync(path6.join(resolvedTargetDir, entry))
29325
+ (entry) => fs6.existsSync(path7.join(resolvedTargetDir, entry))
29201
29326
  );
29202
29327
  const missingEntries = DEV_KIT_REQUIRED_ENTRIES.filter(
29203
29328
  (entry) => !presentEntries.includes(entry)
@@ -29212,16 +29337,16 @@ function inspectAiDevKit(targetDir) {
29212
29337
  };
29213
29338
  }
29214
29339
  function getAiDevKitVersionMetadataPath(targetDir) {
29215
- return path6.join(path6.resolve(targetDir), AI_DEV_KIT_VERSION_METADATA_FILE);
29340
+ return path7.join(path7.resolve(targetDir), AI_DEV_KIT_VERSION_METADATA_FILE);
29216
29341
  }
29217
29342
  function readAiDevKitVersionMetadata(targetDir) {
29218
29343
  const metadataPath = getAiDevKitVersionMetadataPath(targetDir);
29219
- if (!fs5.existsSync(metadataPath)) {
29344
+ if (!fs6.existsSync(metadataPath)) {
29220
29345
  return void 0;
29221
29346
  }
29222
29347
  try {
29223
29348
  const data = JSON.parse(
29224
- fs5.readFileSync(metadataPath, "utf8")
29349
+ fs6.readFileSync(metadataPath, "utf8")
29225
29350
  );
29226
29351
  if (data.env !== "production" && data.env !== "rnd" || !isValidDevKitVersion(data.version) || typeof data.source_url !== "string" || typeof data.installed_at !== "string") {
29227
29352
  return void 0;
@@ -29233,8 +29358,8 @@ function readAiDevKitVersionMetadata(targetDir) {
29233
29358
  }
29234
29359
  function writeAiDevKitVersionMetadata(targetDir, metadata) {
29235
29360
  const metadataPath = getAiDevKitVersionMetadataPath(targetDir);
29236
- fs5.mkdirSync(path6.dirname(metadataPath), { recursive: true });
29237
- fs5.writeFileSync(metadataPath, `${JSON.stringify(metadata, null, 2)}
29361
+ fs6.mkdirSync(path7.dirname(metadataPath), { recursive: true });
29362
+ fs6.writeFileSync(metadataPath, `${JSON.stringify(metadata, null, 2)}
29238
29363
  `, "utf8");
29239
29364
  }
29240
29365
  async function fetchAiDevKitVersions(options = {}) {
@@ -29289,7 +29414,7 @@ async function resolveAiDevKitDownload(options = {}) {
29289
29414
  }
29290
29415
  async function checkAiDevKitUpdate(targetDir, options = {}) {
29291
29416
  var _a3;
29292
- const resolvedTargetDir = path6.resolve(targetDir);
29417
+ const resolvedTargetDir = path7.resolve(targetDir);
29293
29418
  const installed = readAiDevKitVersionMetadata(resolvedTargetDir);
29294
29419
  const download = await resolveAiDevKitDownload({
29295
29420
  environment: options.environment,
@@ -29307,24 +29432,24 @@ async function checkAiDevKitUpdate(targetDir, options = {}) {
29307
29432
  };
29308
29433
  }
29309
29434
  function listPresentDevKitManagedEntries(targetDir) {
29310
- const resolvedTargetDir = path6.resolve(targetDir);
29435
+ const resolvedTargetDir = path7.resolve(targetDir);
29311
29436
  return DEV_KIT_MANAGED_ENTRY_CANDIDATES.filter(
29312
- (entry) => fs5.existsSync(path6.join(resolvedTargetDir, entry))
29437
+ (entry) => fs6.existsSync(path7.join(resolvedTargetDir, entry))
29313
29438
  );
29314
29439
  }
29315
29440
  async function installAiDevKit(options = {}) {
29316
29441
  var _a3;
29317
- const targetDir = path6.resolve(options.targetDir || ".");
29318
- fs5.mkdirSync(targetDir, { recursive: true });
29442
+ const targetDir = path7.resolve(options.targetDir || ".");
29443
+ fs6.mkdirSync(targetDir, { recursive: true });
29319
29444
  const download = options.sourceDir ? void 0 : options.url ? void 0 : await resolveAiDevKitDownload({
29320
29445
  environment: options.environment,
29321
29446
  fetchImpl: options.fetchImpl,
29322
29447
  versionCheckTimeoutMs: options.versionCheckTimeoutMs
29323
29448
  });
29324
29449
  const downloadUrl = options.url || (download == null ? void 0 : download.url) || resolveDefaultAiDevKitUrl(options.environment);
29325
- const preparedSource = options.sourceDir ? path6.resolve(options.sourceDir) : await downloadAndExtractDevKit(downloadUrl, options.fetchImpl, options.downloadTimeoutMs);
29450
+ const preparedSource = options.sourceDir ? path7.resolve(options.sourceDir) : await downloadAndExtractDevKit(downloadUrl, options.fetchImpl, options.downloadTimeoutMs);
29326
29451
  const sourceDir = resolveDevKitRoot(preparedSource);
29327
- const entries = fs5.readdirSync(sourceDir, { withFileTypes: true });
29452
+ const entries = fs6.readdirSync(sourceDir, { withFileTypes: true });
29328
29453
  const installedEntries = [];
29329
29454
  const skippedEntries = [];
29330
29455
  if (options.replaceManagedEntries) {
@@ -29338,7 +29463,7 @@ async function installAiDevKit(options = {}) {
29338
29463
  skippedEntries.push(entry.name);
29339
29464
  continue;
29340
29465
  }
29341
- copyEntry(path6.join(sourceDir, entry.name), path6.join(targetDir, entry.name), {
29466
+ copyEntry(path7.join(sourceDir, entry.name), path7.join(targetDir, entry.name), {
29342
29467
  preserveExisting: options.preserveExisting
29343
29468
  });
29344
29469
  installedEntries.push(entry.name);
@@ -29352,7 +29477,7 @@ async function installAiDevKit(options = {}) {
29352
29477
  installedEntries.push(entry);
29353
29478
  }
29354
29479
  }
29355
- const stagedGitignorePath = path6.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
29480
+ const stagedGitignorePath = path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
29356
29481
  writeDevKitStagedGitignore(stagedGitignorePath, [
29357
29482
  ...installedEntries,
29358
29483
  ...listPresentSkillInstallerOutputEntries(targetDir)
@@ -29368,7 +29493,7 @@ async function installAiDevKit(options = {}) {
29368
29493
  sourceDir,
29369
29494
  installedEntries: installedEntries.sort(),
29370
29495
  skippedEntries: skippedEntries.sort(),
29371
- gitignorePath: path6.join(targetDir, ".gitignore"),
29496
+ gitignorePath: path7.join(targetDir, ".gitignore"),
29372
29497
  stagedGitignorePath,
29373
29498
  skillInstaller,
29374
29499
  download,
@@ -29376,11 +29501,11 @@ async function installAiDevKit(options = {}) {
29376
29501
  };
29377
29502
  }
29378
29503
  function inspectAiDevKitSkillInstallStatus(targetDir) {
29379
- const resolvedTargetDir = path6.resolve(targetDir);
29504
+ const resolvedTargetDir = path7.resolve(targetDir);
29380
29505
  const targets = SKILL_INSTALLER_OUTPUT_ENTRIES.map((entry) => {
29381
- const skillsDir = path6.join(resolvedTargetDir, entry, "skills");
29382
- const present = fs5.existsSync(skillsDir) && fs5.statSync(skillsDir).isDirectory();
29383
- const skillCount = present ? fs5.readdirSync(skillsDir, { withFileTypes: true }).filter((item) => item.isDirectory() || item.isSymbolicLink()).length : 0;
29506
+ const skillsDir = path7.join(resolvedTargetDir, entry, "skills");
29507
+ const present = fs6.existsSync(skillsDir) && fs6.statSync(skillsDir).isDirectory();
29508
+ const skillCount = present ? fs6.readdirSync(skillsDir, { withFileTypes: true }).filter((item) => item.isDirectory() || item.isSymbolicLink()).length : 0;
29384
29509
  return {
29385
29510
  name: entry.replace(/^\./, ""),
29386
29511
  path: skillsDir,
@@ -29403,73 +29528,15 @@ function createDevKitGitignoreBlock(entries) {
29403
29528
  return [DEV_KIT_IGNORE_BEGIN, ...ignoreEntries, DEV_KIT_IGNORE_END].join("\n");
29404
29529
  }
29405
29530
  function writeDevKitStagedGitignore(stagedGitignorePath, entries) {
29406
- fs5.writeFileSync(stagedGitignorePath, `${createDevKitGitignoreBlock(entries)}
29531
+ fs6.writeFileSync(stagedGitignorePath, `${createDevKitGitignoreBlock(entries)}
29407
29532
  `, "utf8");
29408
29533
  }
29409
29534
  function ensureMakerAssetPolicyInstructionFiles(targetDir) {
29410
- const resolvedTargetDir = path6.resolve(targetDir);
29411
- fs5.mkdirSync(resolvedTargetDir, { recursive: true });
29412
- const agentsPath = path6.join(resolvedTargetDir, AGENTS_INSTRUCTION_FILE);
29413
- const existingAgents = fs5.existsSync(agentsPath) ? fs5.readFileSync(agentsPath, "utf8") : "";
29414
- fs5.writeFileSync(agentsPath, prependMakerAssetPolicyBlock(existingAgents), "utf8");
29415
- return [AGENTS_INSTRUCTION_FILE];
29416
- }
29417
- function prependMakerAssetPolicyBlock(existing) {
29418
- const withoutOldBlock = removeMakerAssetPolicyBlock(existing).trimStart();
29419
- const block = createMakerAssetPolicyBlock();
29420
- return [block, withoutOldBlock].filter((part) => part.length > 0).join("\n\n");
29421
- }
29422
- function removeMakerAssetPolicyBlock(content) {
29423
- return content.replace(
29424
- new RegExp(
29425
- `${escapeRegExp(MAKER_ASSET_POLICY_BEGIN)}[\\s\\S]*?${escapeRegExp(
29426
- MAKER_ASSET_POLICY_END
29427
- )}\\n?`,
29428
- "g"
29429
- ),
29430
- ""
29431
- ).replace(/^# TapTap Maker Project Asset Tool Policy\n\n(?=\s*)/, "");
29432
- }
29433
- function createMakerAssetPolicyBlock() {
29434
- return [
29435
- "# TapTap Maker Project Asset Tool Policy",
29436
- "",
29437
- MAKER_ASSET_POLICY_BEGIN,
29438
- "",
29439
- "This is a bound TapTap Maker project. For game asset generation or editing in this project,",
29440
- "the local AI/Agent MUST use Maker MCP proxy tools first:",
29441
- "",
29442
- "- `generate_image` for one image asset.",
29443
- "- `batch_generate_images` for multiple image assets.",
29444
- "- `edit_image` for modifying existing project images.",
29445
- "- `create_video_task` for game video assets or referenced image/video generation.",
29446
- "- `text_to_music` for game music or audio assets.",
29447
- "- `create_3d_model_task` for game 3D model assets.",
29448
- "- `query_3d_model_task` for polling 3D model tasks.",
29449
- "",
29450
- "Before calling `edit_image`, resolve dragged or referenced images to a local project image path",
29451
- "or CDN URL first. If the user references an attached/local image, inspect the attachment or",
29452
- "workspace file path before calling the tool.",
29453
- "If the image is under `assets/image`, pass that path. If only a file name is given, search",
29454
- "`assets/image` for the matching file. Do not call `edit_image` without an image path or CDN URL.",
29455
- "",
29456
- "This policy overrides imagegen, built-in image tools, built-in video tools, built-in audio",
29457
- "tools, and other client-native media generation for Maker game assets.",
29458
- "",
29459
- "DO NOT invoke imagegen or native media tools for Maker game assets when the Maker proxy tool is",
29460
- "callable. If the required Maker proxy tool is not exposed in the current AI session, stop and",
29461
- "tell the user to restart/check the Maker MCP session. DO NOT fall back to generic imagegen or",
29462
- "native media generation unless the user explicitly asks to leave the Maker asset workflow.",
29463
- "",
29464
- "Generated assets must stay in the Maker project asset workflow under `assets/image`,",
29465
- "`assets/video`, `assets/audio`, or `assets/model`, with CDN mappings preserved for later edits",
29466
- "and builds.",
29467
- "",
29468
- MAKER_ASSET_POLICY_END
29469
- ].join("\n");
29535
+ updateMakerAgentsPolicy(targetDir);
29536
+ return [MAKER_AGENTS_FILE];
29470
29537
  }
29471
29538
  function mergeDevKitGitignoreBlock(gitignorePath, block) {
29472
- const existing = fs5.existsSync(gitignorePath) ? fs5.readFileSync(gitignorePath, "utf8") : "";
29539
+ const existing = fs6.existsSync(gitignorePath) ? fs6.readFileSync(gitignorePath, "utf8") : "";
29473
29540
  const withoutOldBlock = existing.replace(
29474
29541
  new RegExp(
29475
29542
  `${escapeRegExp(DEV_KIT_IGNORE_BEGIN)}[\\s\\S]*?${escapeRegExp(DEV_KIT_IGNORE_END)}\\n?`,
@@ -29478,38 +29545,38 @@ function mergeDevKitGitignoreBlock(gitignorePath, block) {
29478
29545
  ""
29479
29546
  ).trimEnd();
29480
29547
  const next = [withoutOldBlock, block, ""].filter((part) => part.length > 0).join("\n\n");
29481
- fs5.writeFileSync(gitignorePath, next, "utf8");
29548
+ fs6.writeFileSync(gitignorePath, next, "utf8");
29482
29549
  }
29483
29550
  function finalizeStagedDevKitGitignore(targetDir) {
29484
- const stagedGitignorePath = path6.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
29485
- if (!fs5.existsSync(stagedGitignorePath)) {
29551
+ const stagedGitignorePath = path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
29552
+ if (!fs6.existsSync(stagedGitignorePath)) {
29486
29553
  return false;
29487
29554
  }
29488
- const block = fs5.readFileSync(stagedGitignorePath, "utf8").trim();
29555
+ const block = fs6.readFileSync(stagedGitignorePath, "utf8").trim();
29489
29556
  if (block.length > 0) {
29490
- mergeDevKitGitignoreBlock(path6.join(targetDir, ".gitignore"), block);
29557
+ mergeDevKitGitignoreBlock(path7.join(targetDir, ".gitignore"), block);
29491
29558
  }
29492
- fs5.rmSync(stagedGitignorePath, { force: true });
29559
+ fs6.rmSync(stagedGitignorePath, { force: true });
29493
29560
  return true;
29494
29561
  }
29495
29562
  function copyEntry(source, target, options = {}) {
29496
- const stat = fs5.statSync(source);
29563
+ const stat = fs6.statSync(source);
29497
29564
  if (stat.isDirectory()) {
29498
- fs5.mkdirSync(target, { recursive: true });
29499
- for (const child of fs5.readdirSync(source)) {
29565
+ fs6.mkdirSync(target, { recursive: true });
29566
+ for (const child of fs6.readdirSync(source)) {
29500
29567
  if (child === ".DS_Store") {
29501
29568
  continue;
29502
29569
  }
29503
- copyEntry(path6.join(source, child), path6.join(target, child), options);
29570
+ copyEntry(path7.join(source, child), path7.join(target, child), options);
29504
29571
  }
29505
29572
  return;
29506
29573
  }
29507
29574
  if (stat.isFile()) {
29508
- if (options.preserveExisting && fs5.existsSync(target)) {
29575
+ if (options.preserveExisting && fs6.existsSync(target)) {
29509
29576
  return;
29510
29577
  }
29511
- fs5.mkdirSync(path6.dirname(target), { recursive: true });
29512
- fs5.copyFileSync(source, target);
29578
+ fs6.mkdirSync(path7.dirname(target), { recursive: true });
29579
+ fs6.copyFileSync(source, target);
29513
29580
  }
29514
29581
  }
29515
29582
  function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
@@ -29519,11 +29586,11 @@ function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
29519
29586
  candidates.add(entry);
29520
29587
  }
29521
29588
  }
29522
- for (const entry of readManagedGitignoreEntries(path6.join(targetDir, ".gitignore"))) {
29589
+ for (const entry of readManagedGitignoreEntries(path7.join(targetDir, ".gitignore"))) {
29523
29590
  candidates.add(entry);
29524
29591
  }
29525
29592
  for (const entry of readManagedGitignoreEntries(
29526
- path6.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE)
29593
+ path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE)
29527
29594
  )) {
29528
29595
  candidates.add(entry);
29529
29596
  }
@@ -29534,14 +29601,14 @@ function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
29534
29601
  if (!DEV_KIT_MANAGED_ENTRY_CANDIDATES.includes(entry)) {
29535
29602
  continue;
29536
29603
  }
29537
- fs5.rmSync(path6.join(targetDir, entry), { recursive: true, force: true });
29604
+ fs6.rmSync(path7.join(targetDir, entry), { recursive: true, force: true });
29538
29605
  }
29539
29606
  }
29540
29607
  function readManagedGitignoreEntries(gitignorePath) {
29541
- if (!fs5.existsSync(gitignorePath)) {
29608
+ if (!fs6.existsSync(gitignorePath)) {
29542
29609
  return [];
29543
29610
  }
29544
- const content = fs5.readFileSync(gitignorePath, "utf8");
29611
+ const content = fs6.readFileSync(gitignorePath, "utf8");
29545
29612
  const blockPattern = new RegExp(
29546
29613
  `${escapeRegExp(DEV_KIT_IGNORE_BEGIN)}\\n([\\s\\S]*?)\\n${escapeRegExp(DEV_KIT_IGNORE_END)}`,
29547
29614
  "g"
@@ -29560,8 +29627,8 @@ function readManagedGitignoreEntries(gitignorePath) {
29560
29627
  }
29561
29628
  function installAiDevKitSkills(targetDir, options = {}) {
29562
29629
  var _a3;
29563
- const toolsDir = path6.join(targetDir, "tools");
29564
- if (!fs5.existsSync(toolsDir) || !fs5.statSync(toolsDir).isDirectory()) {
29630
+ const toolsDir = path7.join(targetDir, "tools");
29631
+ if (!fs6.existsSync(toolsDir) || !fs6.statSync(toolsDir).isDirectory()) {
29565
29632
  return {
29566
29633
  ok: false,
29567
29634
  status: "skipped",
@@ -29573,8 +29640,8 @@ function installAiDevKitSkills(targetDir, options = {}) {
29573
29640
  }
29574
29641
  const isWindows = process.platform === "win32";
29575
29642
  const scriptName = isWindows ? "install-skills.ps1" : "install-skills.sh";
29576
- const scriptPath = path6.join(toolsDir, scriptName);
29577
- if (!fs5.existsSync(scriptPath)) {
29643
+ const scriptPath = path7.join(toolsDir, scriptName);
29644
+ if (!fs6.existsSync(scriptPath)) {
29578
29645
  return {
29579
29646
  ok: false,
29580
29647
  status: "skipped",
@@ -29636,7 +29703,7 @@ function runDevKitSkillInstallerForInstall(targetDir, options = {}) {
29636
29703
  }
29637
29704
  function listPresentSkillInstallerOutputEntries(targetDir) {
29638
29705
  return SKILL_INSTALLER_OUTPUT_ENTRIES.filter(
29639
- (entry) => fs5.existsSync(path6.join(targetDir, entry))
29706
+ (entry) => fs6.existsSync(path7.join(targetDir, entry))
29640
29707
  );
29641
29708
  }
29642
29709
  function getAiDevKitVersionsUrl(environment) {
@@ -29668,16 +29735,16 @@ function writeResolvedDevKitVersionMetadata(targetDir, environment, sourceUrl, c
29668
29735
  return metadata;
29669
29736
  }
29670
29737
  async function downloadAndExtractDevKit(url2, fetchImpl = fetch, timeoutMs = DEFAULT_DOWNLOAD_FETCH_TIMEOUT_MS) {
29671
- const tempDir = fs5.mkdtempSync(path6.join(os3.tmpdir(), "taptap-maker-ai-dev-kit-"));
29672
- const zipPath = path6.join(tempDir, "ai-dev-kit.zip");
29738
+ const tempDir = fs6.mkdtempSync(path7.join(os3.tmpdir(), "taptap-maker-ai-dev-kit-"));
29739
+ const zipPath = path7.join(tempDir, "ai-dev-kit.zip");
29673
29740
  const response = await fetchWithTimeout(fetchImpl, url2, {}, timeoutMs, "AI dev kit download");
29674
29741
  if (!response.ok) {
29675
29742
  throw new Error(`AI dev kit download failed: HTTP ${response.status} ${response.statusText}`);
29676
29743
  }
29677
29744
  const payload = Buffer.from(await response.arrayBuffer());
29678
- fs5.writeFileSync(zipPath, payload);
29745
+ fs6.writeFileSync(zipPath, payload);
29679
29746
  extractZip(zipPath, tempDir);
29680
- fs5.rmSync(zipPath, { force: true });
29747
+ fs6.rmSync(zipPath, { force: true });
29681
29748
  return tempDir;
29682
29749
  }
29683
29750
  function extractZip(zipPath, targetDir, label = "AI dev kit") {
@@ -29805,11 +29872,11 @@ function shellQuote(value) {
29805
29872
  return `'${value.replace(/'/g, "'\\''")}'`;
29806
29873
  }
29807
29874
  function resolveDevKitRoot(sourceDir) {
29808
- const directEntries = fs5.existsSync(sourceDir) ? fs5.readdirSync(sourceDir) : [];
29875
+ const directEntries = fs6.existsSync(sourceDir) ? fs6.readdirSync(sourceDir) : [];
29809
29876
  if (looksLikeDevKitRoot(sourceDir)) {
29810
29877
  return sourceDir;
29811
29878
  }
29812
- const childDirs = directEntries.map((entry) => path6.join(sourceDir, entry)).filter((entryPath) => fs5.existsSync(entryPath) && fs5.statSync(entryPath).isDirectory());
29879
+ const childDirs = directEntries.map((entry) => path7.join(sourceDir, entry)).filter((entryPath) => fs6.existsSync(entryPath) && fs6.statSync(entryPath).isDirectory());
29813
29880
  for (const childDir of childDirs) {
29814
29881
  if (looksLikeDevKitRoot(childDir)) {
29815
29882
  return childDir;
@@ -29818,7 +29885,7 @@ function resolveDevKitRoot(sourceDir) {
29818
29885
  throw new Error(`AI dev kit root not found under ${sourceDir}`);
29819
29886
  }
29820
29887
  function looksLikeDevKitRoot(dir) {
29821
- return fs5.existsSync(path6.join(dir, "engine-docs")) || fs5.existsSync(path6.join(dir, ".emmylua")) || fs5.existsSync(path6.join(dir, "urhox-libs"));
29888
+ return fs6.existsSync(path7.join(dir, "engine-docs")) || fs6.existsSync(path7.join(dir, ".emmylua")) || fs6.existsSync(path7.join(dir, "urhox-libs"));
29822
29889
  }
29823
29890
  function formatIgnoreEntry(entry) {
29824
29891
  if (entry === ".DS_Store") {
@@ -29965,7 +30032,7 @@ async function createMakerProject(options) {
29965
30032
  }
29966
30033
  async function cloneMakerProject(options) {
29967
30034
  var _a3, _b, _c, _d, _e, _f, _g, _h;
29968
- const target = path7.resolve(options.targetDir);
30035
+ const target = path8.resolve(options.targetDir);
29969
30036
  ensureTargetCanBindApp(target, options.appId);
29970
30037
  const warnings = createPreCloneWarnings(target);
29971
30038
  (_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
@@ -30131,7 +30198,7 @@ async function pushMakerProject(options) {
30131
30198
  phase: "prepare",
30132
30199
  message: "Preparing Maker project push"
30133
30200
  });
30134
- const requestedCwd = path7.resolve(options.cwd);
30201
+ const requestedCwd = path8.resolve(options.cwd);
30135
30202
  const workspace = resolveUsableMakerGitWorkspace(requestedCwd);
30136
30203
  const cwd = workspace.projectRoot;
30137
30204
  const project = loadProjectConfig(cwd);
@@ -30762,7 +30829,7 @@ function makeAuthenticatedGitUrl(gitUrl, pat) {
30762
30829
  return gitUrl.replace(/^https:\/\//, `https://git:${encodeURIComponent(pat)}@`);
30763
30830
  }
30764
30831
  async function fetchAndCheckoutTarget(target, authUrl, pat, onProgress) {
30765
- if (fs6.existsSync(target) && hasDirectoryEntries(target)) {
30832
+ if (fs7.existsSync(target) && hasDirectoryEntries(target)) {
30766
30833
  onProgress == null ? void 0 : onProgress({
30767
30834
  progress: 10,
30768
30835
  total: 100,
@@ -30809,23 +30876,23 @@ function emitFirstCloneWaitNotice(onProgress, phase) {
30809
30876
  });
30810
30877
  }
30811
30878
  function hasDirectoryEntries(target) {
30812
- if (!fs6.existsSync(target)) {
30879
+ if (!fs7.existsSync(target)) {
30813
30880
  return false;
30814
30881
  }
30815
- return fs6.readdirSync(target).length > 0;
30882
+ return fs7.readdirSync(target).length > 0;
30816
30883
  }
30817
30884
  function listLocalFiles(root) {
30818
- if (!fs6.existsSync(root)) {
30885
+ if (!fs7.existsSync(root)) {
30819
30886
  return [];
30820
30887
  }
30821
30888
  const files = [];
30822
30889
  const visit = (dir, relativeDir) => {
30823
- for (const entry of fs6.readdirSync(dir, { withFileTypes: true })) {
30890
+ for (const entry of fs7.readdirSync(dir, { withFileTypes: true })) {
30824
30891
  const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
30825
30892
  if (entry.name === ".git" || relativePath === ".maker-mcp" || relativePath.startsWith(".maker-mcp/") || entry.name === ".DS_Store") {
30826
30893
  continue;
30827
30894
  }
30828
- const fullPath = path7.join(dir, entry.name);
30895
+ const fullPath = path8.join(dir, entry.name);
30829
30896
  if (entry.isDirectory()) {
30830
30897
  visit(fullPath, relativePath);
30831
30898
  continue;
@@ -30839,10 +30906,10 @@ function listLocalFiles(root) {
30839
30906
  return files;
30840
30907
  }
30841
30908
  function listPreCloneNoticeFiles(root) {
30842
- if (!fs6.existsSync(root)) {
30909
+ if (!fs7.existsSync(root)) {
30843
30910
  return [];
30844
30911
  }
30845
- return fs6.readdirSync(root, { withFileTypes: true }).filter((entry) => !isIgnorablePreCloneEntry(entry.name)).map((entry) => entry.name).sort();
30912
+ return fs7.readdirSync(root, { withFileTypes: true }).filter((entry) => !isIgnorablePreCloneEntry(entry.name)).map((entry) => entry.name).sort();
30846
30913
  }
30847
30914
  function createPreCloneWarnings(target) {
30848
30915
  const preCloneLocalFiles = listPreCloneNoticeFiles(target);
@@ -30965,7 +31032,7 @@ function ensureOwnGitRoot(repoDir) {
30965
31032
  );
30966
31033
  }
30967
31034
  function inspectMakerDirectoryGitStatus(cwd) {
30968
- const targetDir = path7.resolve(cwd);
31035
+ const targetDir = path8.resolve(cwd);
30969
31036
  const gitRoot = resolveGitRoot(targetDir);
30970
31037
  const gitDir = resolveGitDir(targetDir);
30971
31038
  const makerBinding = findMakerProjectBinding(targetDir);
@@ -31038,16 +31105,16 @@ function formatMakerGitRootMismatch(status) {
31038
31105
  }
31039
31106
  function findMakerProjectBinding(startDir) {
31040
31107
  var _a3;
31041
- let current = path7.resolve(startDir);
31108
+ let current = path8.resolve(startDir);
31042
31109
  while (current.length > 0) {
31043
31110
  const configPath = getProjectConfigPath(current);
31044
- if (fs6.existsSync(configPath) && ((_a3 = loadProjectConfig(current)) == null ? void 0 : _a3.project_id)) {
31111
+ if (fs7.existsSync(configPath) && ((_a3 = loadProjectConfig(current)) == null ? void 0 : _a3.project_id)) {
31045
31112
  return {
31046
31113
  projectRoot: current,
31047
31114
  configPath
31048
31115
  };
31049
31116
  }
31050
- const parent = path7.dirname(current);
31117
+ const parent = path8.dirname(current);
31051
31118
  if (parent === current) {
31052
31119
  return null;
31053
31120
  }
@@ -31057,7 +31124,7 @@ function findMakerProjectBinding(startDir) {
31057
31124
  }
31058
31125
  function resolveGitRoot(cwd) {
31059
31126
  try {
31060
- return path7.resolve(readGitSync(["-C", cwd, "rev-parse", "--show-toplevel"]).trim());
31127
+ return path8.resolve(readGitSync(["-C", cwd, "rev-parse", "--show-toplevel"]).trim());
31061
31128
  } catch {
31062
31129
  return void 0;
31063
31130
  }
@@ -31065,7 +31132,7 @@ function resolveGitRoot(cwd) {
31065
31132
  function resolveGitDir(cwd) {
31066
31133
  try {
31067
31134
  const gitDir = readGitSync(["-C", cwd, "rev-parse", "--git-dir"]).trim();
31068
- return path7.isAbsolute(gitDir) ? path7.resolve(gitDir) : path7.resolve(cwd, gitDir);
31135
+ return path8.isAbsolute(gitDir) ? path8.resolve(gitDir) : path8.resolve(cwd, gitDir);
31069
31136
  } catch {
31070
31137
  return void 0;
31071
31138
  }
@@ -31074,9 +31141,9 @@ function samePath(left, right) {
31074
31141
  return normalizePathForCompare(left) === normalizePathForCompare(right);
31075
31142
  }
31076
31143
  function normalizePathForCompare(value) {
31077
- const resolved = path7.resolve(value);
31144
+ const resolved = path8.resolve(value);
31078
31145
  try {
31079
- return fs6.realpathSync.native(resolved);
31146
+ return fs7.realpathSync.native(resolved);
31080
31147
  } catch {
31081
31148
  return resolved;
31082
31149
  }
@@ -31442,8 +31509,8 @@ async function requestTapAuthWithPat(manualPat, environment, options = {}) {
31442
31509
 
31443
31510
  // src/maker/system/python.ts
31444
31511
  import { spawnSync as spawnSync4 } from "node:child_process";
31445
- import fs7 from "node:fs";
31446
- import path8 from "node:path";
31512
+ import fs8 from "node:fs";
31513
+ import path9 from "node:path";
31447
31514
  var PYTHON_INFO_SCRIPT = [
31448
31515
  "import json, sys",
31449
31516
  'print(json.dumps({"executable": sys.executable, "version": ".".join(map(str, sys.version_info[:3]))}))'
@@ -31452,16 +31519,16 @@ var DEFAULT_PYTHON_VERSION = "3.12";
31452
31519
  var MINIMUM_PYTHON_VERSION = "3.8";
31453
31520
  var RECOMMENDED_PYTHON_VERSION = "3.12";
31454
31521
  function getMakerPythonConfigPath() {
31455
- return path8.join(getMakerHome(), "python.json");
31522
+ return path9.join(getMakerHome(), "python.json");
31456
31523
  }
31457
31524
  function getMakerUvInstallRoot() {
31458
- return path8.join(getMakerHome(), "bin");
31525
+ return path9.join(getMakerHome(), "bin");
31459
31526
  }
31460
31527
  function getMakerUvPath(platform = process.platform) {
31461
- return path8.join(getMakerUvInstallRoot(), platform === "win32" ? "uv.exe" : "uv");
31528
+ return path9.join(getMakerUvInstallRoot(), platform === "win32" ? "uv.exe" : "uv");
31462
31529
  }
31463
31530
  function getMakerUvPythonInstallDir() {
31464
- return path8.join(getMakerHome(), "python", "uv");
31531
+ return path9.join(getMakerHome(), "python", "uv");
31465
31532
  }
31466
31533
  function checkMakerPythonEnvironment(options = {}) {
31467
31534
  const platform = options.platform || process.platform;
@@ -31477,7 +31544,7 @@ function checkMakerPythonEnvironment(options = {}) {
31477
31544
  pathCommand,
31478
31545
  uv: {
31479
31546
  path: uvPath,
31480
- installed: fs7.existsSync(uvPath),
31547
+ installed: fs8.existsSync(uvPath),
31481
31548
  version: readUvVersion(uvPath, runner)
31482
31549
  }
31483
31550
  };
@@ -31699,10 +31766,10 @@ function resultToEnvironment(result, base) {
31699
31766
  }
31700
31767
  function ensureUvInstalled(platform, runner) {
31701
31768
  const uvPath = getMakerUvPath(platform);
31702
- if (fs7.existsSync(uvPath)) {
31769
+ if (fs8.existsSync(uvPath)) {
31703
31770
  return uvPath;
31704
31771
  }
31705
- fs7.mkdirSync(getMakerUvInstallRoot(), { recursive: true });
31772
+ fs8.mkdirSync(getMakerUvInstallRoot(), { recursive: true });
31706
31773
  const env = {
31707
31774
  ...process.env,
31708
31775
  INSTALLER_NO_MODIFY_PATH: "1",
@@ -31725,13 +31792,13 @@ function ensureUvInstalled(platform, runner) {
31725
31792
  if (install.status !== 0) {
31726
31793
  throw new Error(formatSetupFailure("uv installer failed", install));
31727
31794
  }
31728
- if (!fs7.existsSync(uvPath)) {
31729
- const nestedUvPath = path8.join(
31795
+ if (!fs8.existsSync(uvPath)) {
31796
+ const nestedUvPath = path9.join(
31730
31797
  getMakerUvInstallRoot(),
31731
31798
  "bin",
31732
31799
  platform === "win32" ? "uv.exe" : "uv"
31733
31800
  );
31734
- if (fs7.existsSync(nestedUvPath)) {
31801
+ if (fs8.existsSync(nestedUvPath)) {
31735
31802
  return nestedUvPath;
31736
31803
  }
31737
31804
  throw new Error(`uv installer finished, but ${uvPath} was not created.`);
@@ -31742,11 +31809,11 @@ function createUvPythonEnv() {
31742
31809
  return {
31743
31810
  ...process.env,
31744
31811
  UV_PYTHON_INSTALL_DIR: getMakerUvPythonInstallDir(),
31745
- UV_CACHE_DIR: path8.join(getMakerHome(), "cache", "uv")
31812
+ UV_CACHE_DIR: path9.join(getMakerHome(), "cache", "uv")
31746
31813
  };
31747
31814
  }
31748
31815
  function readUvVersion(uvPath, runner) {
31749
- if (!fs7.existsSync(uvPath)) {
31816
+ if (!fs8.existsSync(uvPath)) {
31750
31817
  return void 0;
31751
31818
  }
31752
31819
  const result = runner(uvPath, ["--version"], { encoding: "utf8" });
@@ -31799,11 +31866,11 @@ function parseVersionTuple(version2) {
31799
31866
  }
31800
31867
  function loadPythonRuntimeConfig() {
31801
31868
  const configPath = getMakerPythonConfigPath();
31802
- if (!fs7.existsSync(configPath)) {
31869
+ if (!fs8.existsSync(configPath)) {
31803
31870
  return void 0;
31804
31871
  }
31805
31872
  try {
31806
- const data = JSON.parse(fs7.readFileSync(configPath, "utf8"));
31873
+ const data = JSON.parse(fs8.readFileSync(configPath, "utf8"));
31807
31874
  if (typeof data.python === "string" || data.status === "setup_failed") {
31808
31875
  return data;
31809
31876
  }
@@ -31822,8 +31889,8 @@ function savePythonRuntimeConfig(environment) {
31822
31889
  version: environment.version,
31823
31890
  saved_at: (/* @__PURE__ */ new Date()).toISOString()
31824
31891
  };
31825
- fs7.mkdirSync(path8.dirname(getMakerPythonConfigPath()), { recursive: true });
31826
- fs7.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31892
+ fs8.mkdirSync(path9.dirname(getMakerPythonConfigPath()), { recursive: true });
31893
+ fs8.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31827
31894
  }
31828
31895
  function savePythonSetupFailure(error2) {
31829
31896
  const config2 = {
@@ -31831,8 +31898,8 @@ function savePythonSetupFailure(error2) {
31831
31898
  error: error2 instanceof Error ? error2.message : String(error2),
31832
31899
  saved_at: (/* @__PURE__ */ new Date()).toISOString()
31833
31900
  };
31834
- fs7.mkdirSync(path8.dirname(getMakerPythonConfigPath()), { recursive: true });
31835
- fs7.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31901
+ fs8.mkdirSync(path9.dirname(getMakerPythonConfigPath()), { recursive: true });
31902
+ fs8.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31836
31903
  }
31837
31904
  function formatSetupFailure(message, result) {
31838
31905
  var _a3, _b, _c;
@@ -31847,8 +31914,8 @@ function formatSetupFailure(message, result) {
31847
31914
 
31848
31915
  // src/maker/system/luaLsp.ts
31849
31916
  import { spawnSync as spawnSync5 } from "node:child_process";
31850
- import fs8 from "node:fs";
31851
- import path9 from "node:path";
31917
+ import fs9 from "node:fs";
31918
+ import path10 from "node:path";
31852
31919
  var LUA_LSP_PACKAGE = "maker-lua-lsp";
31853
31920
  var LUA_LSP_IDES = "codex,cursor,claude";
31854
31921
  var LUA_LSP_SETUP_TIMEOUT_MS = 12e4;
@@ -31858,10 +31925,10 @@ var PYTHON_SCRIPTS_DIR_SCRIPT = [
31858
31925
  'print(sysconfig.get_path("scripts") or "")'
31859
31926
  ].join("; ");
31860
31927
  function getMakerLuaLspConfigPath() {
31861
- return path9.join(getMakerHome(), "lua-lsp.json");
31928
+ return path10.join(getMakerHome(), "lua-lsp.json");
31862
31929
  }
31863
31930
  function getMakerLuaLspVenvDir() {
31864
- return path9.join(getMakerHome(), "lua-lsp-venv");
31931
+ return path10.join(getMakerHome(), "lua-lsp-venv");
31865
31932
  }
31866
31933
  function checkMakerLuaLspEnvironment(options = {}) {
31867
31934
  const runner = options.spawn || spawnSync5;
@@ -31889,7 +31956,7 @@ function checkMakerLuaLspEnvironment(options = {}) {
31889
31956
  command: saved.command,
31890
31957
  version: version3,
31891
31958
  python: saved.python || python.python,
31892
- scriptsDir: path9.dirname(saved.command),
31959
+ scriptsDir: path10.dirname(saved.command),
31893
31960
  missing: [],
31894
31961
  nextAction: "maker-lua-lsp 已安装;本地 Lua 诊断可用。"
31895
31962
  };
@@ -32066,16 +32133,16 @@ function createLuaLspBase(platform) {
32066
32133
  }
32067
32134
  function resolveLuaLspCommand(python, platform, runner) {
32068
32135
  const venvCommand = getLuaLspVenvCommand(platform);
32069
- if (fs8.existsSync(venvCommand)) {
32070
- return { command: venvCommand, scriptsDir: path9.dirname(venvCommand) };
32136
+ if (fs9.existsSync(venvCommand)) {
32137
+ return { command: venvCommand, scriptsDir: path10.dirname(venvCommand) };
32071
32138
  }
32072
32139
  const scriptsDir = readPythonScriptsDir(python.python, runner);
32073
32140
  if (scriptsDir) {
32074
- const command = path9.join(
32141
+ const command = path10.join(
32075
32142
  scriptsDir,
32076
32143
  platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
32077
32144
  );
32078
- if (fs8.existsSync(command)) {
32145
+ if (fs9.existsSync(command)) {
32079
32146
  return { command, scriptsDir };
32080
32147
  }
32081
32148
  return { scriptsDir };
@@ -32099,23 +32166,23 @@ function ensureLuaLspVenv(python, platform, runner) {
32099
32166
  return { python: venvPython, scriptsDir, command };
32100
32167
  }
32101
32168
  function isLuaLspVenvComplete(platform) {
32102
- return fs8.existsSync(getLuaLspVenvPython(platform)) && fs8.existsSync(getLuaLspVenvConfigPath());
32169
+ return fs9.existsSync(getLuaLspVenvPython(platform)) && fs9.existsSync(getLuaLspVenvConfigPath());
32103
32170
  }
32104
32171
  function getLuaLspVenvConfigPath() {
32105
- return path9.join(getMakerLuaLspVenvDir(), "pyvenv.cfg");
32172
+ return path10.join(getMakerLuaLspVenvDir(), "pyvenv.cfg");
32106
32173
  }
32107
32174
  function getLuaLspVenvPython(platform) {
32108
- return path9.join(
32175
+ return path10.join(
32109
32176
  getMakerLuaLspVenvDir(),
32110
32177
  platform === "win32" ? "Scripts" : "bin",
32111
32178
  platform === "win32" ? "python.exe" : "python"
32112
32179
  );
32113
32180
  }
32114
32181
  function getLuaLspVenvScriptsDir(platform) {
32115
- return path9.join(getMakerLuaLspVenvDir(), platform === "win32" ? "Scripts" : "bin");
32182
+ return path10.join(getMakerLuaLspVenvDir(), platform === "win32" ? "Scripts" : "bin");
32116
32183
  }
32117
32184
  function getLuaLspVenvCommand(platform) {
32118
- return path9.join(
32185
+ return path10.join(
32119
32186
  getLuaLspVenvScriptsDir(platform),
32120
32187
  platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
32121
32188
  );
@@ -32163,11 +32230,11 @@ function formatLuaLspSetupFailure(platform, python, message, result, command, sc
32163
32230
  }
32164
32231
  function loadLuaLspRuntimeConfig() {
32165
32232
  const configPath = getMakerLuaLspConfigPath();
32166
- if (!fs8.existsSync(configPath)) {
32233
+ if (!fs9.existsSync(configPath)) {
32167
32234
  return void 0;
32168
32235
  }
32169
32236
  try {
32170
- return JSON.parse(fs8.readFileSync(configPath, "utf8"));
32237
+ return JSON.parse(fs9.readFileSync(configPath, "utf8"));
32171
32238
  } catch {
32172
32239
  return void 0;
32173
32240
  }
@@ -32180,13 +32247,13 @@ function saveLuaLspRuntimeConfig(environment) {
32180
32247
  error: environment.error,
32181
32248
  saved_at: (/* @__PURE__ */ new Date()).toISOString()
32182
32249
  };
32183
- fs8.mkdirSync(path9.dirname(getMakerLuaLspConfigPath()), { recursive: true });
32184
- fs8.writeFileSync(getMakerLuaLspConfigPath(), JSON.stringify(config2, null, 2), "utf8");
32250
+ fs9.mkdirSync(path10.dirname(getMakerLuaLspConfigPath()), { recursive: true });
32251
+ fs9.writeFileSync(getMakerLuaLspConfigPath(), JSON.stringify(config2, null, 2), "utf8");
32185
32252
  }
32186
32253
 
32187
32254
  // src/maker/cli/skill.ts
32188
- import fs9 from "node:fs";
32189
- import path10 from "node:path";
32255
+ import fs10 from "node:fs";
32256
+ import path11 from "node:path";
32190
32257
  import { fileURLToPath } from "node:url";
32191
32258
  var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
32192
32259
  var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
@@ -32205,7 +32272,7 @@ var BUNDLED_SKILLS = [
32205
32272
  function formatMakerSkillStatus(_options = {}) {
32206
32273
  const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
32207
32274
  name: skill.name,
32208
- path: path10.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
32275
+ path: path11.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
32209
32276
  }));
32210
32277
  return [
32211
32278
  "TapTap Maker workflow guide documents",
@@ -32223,27 +32290,26 @@ function formatMakerSkillStatus(_options = {}) {
32223
32290
  "Maker creative asset tool policy",
32224
32291
  `- entry: ${MAKER_LOCAL_SKILL_NAME} > Maker Creative Asset Tool Policy`,
32225
32292
  "- Prefer Maker MCP proxy tools over native AI image/video/audio tools for bound Maker projects.",
32226
- "- This policy overrides generic imagegen or native media skills for Maker game assets.",
32227
- "- Do not invoke imagegen, built-in image/video/audio tools, or other native media generation.",
32228
- "- Do not fall back to generic imagegen when Maker proxy tools are unavailable in the session.",
32293
+ "- If Maker proxy tools are missing, explain the session/configuration issue and available alternatives.",
32229
32294
  "- Use generate_image, batch_generate_images, edit_image for game image assets.",
32230
- "- Use create_video_task and text_to_music for game video/audio assets.",
32295
+ "- Use create_video_task, query_video_task, and text_to_music for game video/audio assets.",
32231
32296
  "- Use create_3d_model_task and query_3d_model_task for game 3D model assets.",
32232
- "- Generated assets are saved under assets/image, assets/video, assets/audio, or assets/model with CDN mappings.",
32233
- "- Before edit_image, resolve dragged or referenced images to a local project image path or CDN URL.",
32234
- "- If only a file name is given, search assets/image for the matching file before calling edit_image.",
32235
- "- Do not call edit_image without an image path or CDN URL.",
32297
+ "- Generated assets are saved under assets/image, assets/video, assets/audio, or assets/model with remote mappings.",
32298
+ "- Follow each tool schema for supported local path, remote URL, and data URL inputs.",
32299
+ "- Local proxy may convert resolvable local reference media to data URLs before forwarding.",
32300
+ "- Generated 3D outputs save original GLB/FBX and MDL zip under assets/model.",
32301
+ "- MDL zip contents are extracted into assets/Meshes, assets/Materials, assets/Textures, and assets/Prefabs.",
32236
32302
  "Maker initialization next_step: execute `taptap-maker init`.",
32237
32303
  "Load these documents when the current AI client supports reading local guide files."
32238
32304
  ].join("\n");
32239
32305
  }
32240
32306
  function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
32241
32307
  const candidates = [
32242
- path10.join(process.cwd(), "skills", skillName),
32308
+ path11.join(process.cwd(), "skills", skillName),
32243
32309
  getBundledSkillSourceDir(skillName)
32244
32310
  ].filter(Boolean);
32245
32311
  for (const candidate of candidates) {
32246
- if (fs9.existsSync(path10.join(candidate, "SKILL.md"))) {
32312
+ if (fs10.existsSync(path11.join(candidate, "SKILL.md"))) {
32247
32313
  return candidate;
32248
32314
  }
32249
32315
  }
@@ -32256,13 +32322,13 @@ function getBundledSkillSourceDir(skillName) {
32256
32322
  return null;
32257
32323
  }
32258
32324
  const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
32259
- const packageRoot = path10.dirname(path10.dirname(bundlePath));
32260
- return path10.join(packageRoot, "skills", skillName);
32325
+ const packageRoot = path11.dirname(path11.dirname(bundlePath));
32326
+ return path11.join(packageRoot, "skills", skillName);
32261
32327
  }
32262
32328
 
32263
32329
  // src/maker/server/runtimeLogs.ts
32264
- import fs10 from "node:fs";
32265
- import path11 from "node:path";
32330
+ import fs11 from "node:fs";
32331
+ import path12 from "node:path";
32266
32332
  var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
32267
32333
  var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
32268
32334
  var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
@@ -32403,19 +32469,19 @@ async function pullRuntimeLogs(options) {
32403
32469
  }
32404
32470
  function resetRuntimeLogs(projectRoot) {
32405
32471
  const runtimeDir = getRuntimeLogDir(projectRoot);
32406
- fs10.mkdirSync(runtimeDir, { recursive: true });
32472
+ fs11.mkdirSync(runtimeDir, { recursive: true });
32407
32473
  for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
32408
- fs10.rmSync(path11.join(runtimeDir, file2), { force: true });
32474
+ fs11.rmSync(path12.join(runtimeDir, file2), { force: true });
32409
32475
  }
32410
32476
  return runtimeDir;
32411
32477
  }
32412
32478
  function readRuntimeLogState(projectRoot) {
32413
32479
  const statePath = getRuntimeLogStatePath(projectRoot);
32414
- if (!fs10.existsSync(statePath)) {
32480
+ if (!fs11.existsSync(statePath)) {
32415
32481
  return null;
32416
32482
  }
32417
32483
  try {
32418
- const state = JSON.parse(fs10.readFileSync(statePath, "utf8"));
32484
+ const state = JSON.parse(fs11.readFileSync(statePath, "utf8"));
32419
32485
  return isRuntimeLogState(state) ? state : null;
32420
32486
  } catch {
32421
32487
  return null;
@@ -32443,9 +32509,9 @@ function normalizeRuntimeLogQueryResult(result) {
32443
32509
  };
32444
32510
  }
32445
32511
  function writeRuntimeLogRawResponse(projectRoot, raw) {
32446
- const rawPath = path11.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
32447
- fs10.mkdirSync(path11.dirname(rawPath), { recursive: true });
32448
- fs10.writeFileSync(
32512
+ const rawPath = path12.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
32513
+ fs11.mkdirSync(path12.dirname(rawPath), { recursive: true });
32514
+ fs11.writeFileSync(
32449
32515
  rawPath,
32450
32516
  `${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
32451
32517
  `,
@@ -32454,7 +32520,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
32454
32520
  return rawPath;
32455
32521
  }
32456
32522
  function appendRuntimeLogs(projectRoot, logs) {
32457
- fs10.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
32523
+ fs11.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
32458
32524
  if (logs.length === 0) {
32459
32525
  return { files: [], written: 0 };
32460
32526
  }
@@ -32462,7 +32528,7 @@ function appendRuntimeLogs(projectRoot, logs) {
32462
32528
  let written = 0;
32463
32529
  for (const log of logs) {
32464
32530
  const line = JSON.stringify(compactRuntimeLogEntry(log));
32465
- fs10.appendFileSync(filePath, `${line}
32531
+ fs11.appendFileSync(filePath, `${line}
32466
32532
  `, "utf8");
32467
32533
  written += 1;
32468
32534
  }
@@ -32470,11 +32536,11 @@ function appendRuntimeLogs(projectRoot, logs) {
32470
32536
  }
32471
32537
  function writeRuntimeLogState(projectRoot, state) {
32472
32538
  const statePath = getRuntimeLogStatePath(projectRoot);
32473
- fs10.mkdirSync(path11.dirname(statePath), { recursive: true });
32539
+ fs11.mkdirSync(path12.dirname(statePath), { recursive: true });
32474
32540
  const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
32475
- fs10.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
32541
+ fs11.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
32476
32542
  `, "utf8");
32477
- fs10.renameSync(tempPath, statePath);
32543
+ fs11.renameSync(tempPath, statePath);
32478
32544
  }
32479
32545
  function writeRuntimeLogFailureState(projectRoot, options) {
32480
32546
  const nowIso = new Date(options.nowMs()).toISOString();
@@ -32506,13 +32572,13 @@ function isNonRetryableRuntimeLogError(error2) {
32506
32572
  );
32507
32573
  }
32508
32574
  function getRuntimeLogDir(projectRoot) {
32509
- return path11.join(projectRoot, ".maker", "logs", "runtime");
32575
+ return path12.join(projectRoot, ".maker", "logs", "runtime");
32510
32576
  }
32511
32577
  function getRuntimeLogStatePath(projectRoot) {
32512
- return path11.join(getRuntimeLogDir(projectRoot), "state.json");
32578
+ return path12.join(getRuntimeLogDir(projectRoot), "state.json");
32513
32579
  }
32514
32580
  function getRuntimeLogPath(projectRoot) {
32515
- return path11.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
32581
+ return path12.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
32516
32582
  }
32517
32583
  function resolveNextRuntimeLogCursor(result) {
32518
32584
  const maxLogTime = result.logs.reduce((max, log) => {
@@ -32637,13 +32703,48 @@ function compactRuntimeLogEntry(entry) {
32637
32703
  }
32638
32704
 
32639
32705
  // src/maker/server/proxyAssets.ts
32640
- import fs11 from "node:fs";
32641
- import path12 from "node:path";
32706
+ import fs12 from "node:fs";
32707
+ import path13 from "node:path";
32642
32708
  var IMAGE_ASSET_DIRS = ["assets/image"];
32643
32709
  var VIDEO_ASSET_DIRS = ["assets/video"];
32644
32710
  var AUDIO_ASSET_DIRS = ["assets/audio"];
32645
32711
  var MODEL_ASSET_DIRS = ["assets/model"];
32646
32712
  var THREE_D_MODEL_VIEWS = ["front", "left", "back", "right"];
32713
+ var IMAGE_REFERENCE_MAX_BYTES = 10 * 1024 * 1024;
32714
+ var VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES = 30 * 1024 * 1024;
32715
+ var VIDEO_REFERENCE_MAX_BYTES = 50 * 1024 * 1024;
32716
+ var AUDIO_REFERENCE_MAX_BYTES = 15 * 1024 * 1024;
32717
+ var DATA_URL_MIME_BY_EXTENSION = {
32718
+ image: {
32719
+ ".gif": "image/gif",
32720
+ ".jpeg": "image/jpeg",
32721
+ ".jpg": "image/jpeg",
32722
+ ".png": "image/png",
32723
+ ".webp": "image/webp"
32724
+ },
32725
+ video: {
32726
+ ".mov": "video/quicktime",
32727
+ ".mp4": "video/mp4"
32728
+ },
32729
+ audio: {
32730
+ ".mp3": "audio/mpeg",
32731
+ ".wav": "audio/wav"
32732
+ }
32733
+ };
32734
+ var RemoteProxyToolResultError = class extends Error {
32735
+ constructor(toolName, result) {
32736
+ super(
32737
+ [
32738
+ `Remote proxy tool ${toolName} returned an error result.`,
32739
+ "",
32740
+ formatRemoteProxyToolResult(result)
32741
+ ].join("\n")
32742
+ );
32743
+ this.name = "RemoteProxyToolResultError";
32744
+ this.toolName = toolName;
32745
+ this.result = result;
32746
+ }
32747
+ };
32647
32748
  function prepareRemoteProxyToolArgs(options) {
32648
32749
  if (options.toolName === "edit_image") {
32649
32750
  return rewriteEditImageAssetArgs(options.targetDir, options.args);
@@ -32651,6 +32752,9 @@ function prepareRemoteProxyToolArgs(options) {
32651
32752
  if (options.toolName === "generate_image") {
32652
32753
  return normalizeImageReferenceAssetArgs(options.targetDir, options.args);
32653
32754
  }
32755
+ if (options.toolName === "batch_generate_images") {
32756
+ return normalizeBatchImageReferenceAssetArgs(options.targetDir, options.args);
32757
+ }
32654
32758
  if (options.toolName === "create_video_task") {
32655
32759
  return rewriteVideoReferenceAssetArgs(options.targetDir, options.args);
32656
32760
  }
@@ -32660,6 +32764,9 @@ function prepareRemoteProxyToolArgs(options) {
32660
32764
  return options.args;
32661
32765
  }
32662
32766
  async function materializeRemoteProxyToolAssets(options) {
32767
+ if (isRemoteProxyToolErrorResult(options.result)) {
32768
+ throw new RemoteProxyToolResultError(options.toolName, options.result);
32769
+ }
32663
32770
  if (!shouldMaterializeRemoteProxyTool(options.toolName)) {
32664
32771
  return options.result;
32665
32772
  }
@@ -32669,6 +32776,7 @@ async function materializeRemoteProxyToolAssets(options) {
32669
32776
  }
32670
32777
  let changed = false;
32671
32778
  const nextContent = [];
32779
+ const structuredPayloads = [];
32672
32780
  for (const item of content) {
32673
32781
  if (!isTextContent(item)) {
32674
32782
  nextContent.push(item);
@@ -32686,6 +32794,7 @@ async function materializeRemoteProxyToolAssets(options) {
32686
32794
  now: options.now ?? /* @__PURE__ */ new Date(),
32687
32795
  fetchImpl: options.fetchImpl ?? fetch
32688
32796
  });
32797
+ structuredPayloads.push(nextParsed);
32689
32798
  if (nextParsed === parsed) {
32690
32799
  nextContent.push(item);
32691
32800
  continue;
@@ -32696,6 +32805,14 @@ async function materializeRemoteProxyToolAssets(options) {
32696
32805
  text: JSON.stringify(nextParsed, null, 2)
32697
32806
  });
32698
32807
  }
32808
+ const structuredContent = structuredPayloads.length === 1 ? structuredPayloads[0] : { results: structuredPayloads };
32809
+ if (structuredPayloads.length > 0) {
32810
+ return {
32811
+ ...options.result,
32812
+ ...changed ? { content: nextContent } : {},
32813
+ structuredContent
32814
+ };
32815
+ }
32699
32816
  return changed ? { ...options.result, content: nextContent } : options.result;
32700
32817
  }
32701
32818
  function shouldMaterializeRemoteProxyTool(toolName) {
@@ -32704,6 +32821,7 @@ function shouldMaterializeRemoteProxyTool(toolName) {
32704
32821
  "batch_generate_images",
32705
32822
  "edit_image",
32706
32823
  "create_video_task",
32824
+ "query_video_task",
32707
32825
  "text_to_music",
32708
32826
  "create_3d_model_task",
32709
32827
  "query_3d_model_task"
@@ -32712,6 +32830,22 @@ function shouldMaterializeRemoteProxyTool(toolName) {
32712
32830
  function isTextContent(item) {
32713
32831
  return typeof item === "object" && item !== null && item.type === "text" && typeof item.text === "string";
32714
32832
  }
32833
+ function isRemoteProxyToolErrorResult(result) {
32834
+ return Boolean(result.isError);
32835
+ }
32836
+ function formatRemoteProxyToolResult(result) {
32837
+ return ["remote_result:", indent(formatUnknownForDiagnostics(result))].join("\n");
32838
+ }
32839
+ function formatUnknownForDiagnostics(value) {
32840
+ try {
32841
+ return JSON.stringify(value, null, 2) || String(value);
32842
+ } catch {
32843
+ return String(value);
32844
+ }
32845
+ }
32846
+ function indent(value) {
32847
+ return value.split("\n").map((line) => ` ${line}`).join("\n");
32848
+ }
32715
32849
  function parseJsonObject(text) {
32716
32850
  try {
32717
32851
  const parsed = JSON.parse(text);
@@ -32730,8 +32864,8 @@ async function materializeParsedProxyResult(options) {
32730
32864
  if (options.toolName === "edit_image") {
32731
32865
  return await materializeSingleImageResult(options, "edit_image");
32732
32866
  }
32733
- if (options.toolName === "create_video_task") {
32734
- return await materializeVideoResult(options);
32867
+ if (options.toolName === "create_video_task" || options.toolName === "query_video_task") {
32868
+ return await materializeVideoResult(options, options.toolName);
32735
32869
  }
32736
32870
  if (options.toolName === "text_to_music") {
32737
32871
  return await materializeMusicResult(options);
@@ -32795,14 +32929,27 @@ async function materializeBatchImageResult(options) {
32795
32929
  }
32796
32930
  return { ...options.payload, results };
32797
32931
  }
32798
- async function materializeVideoResult(options) {
32932
+ async function materializeVideoResult(options, toolName) {
32799
32933
  if (options.payload.status !== "succeeded") {
32800
32934
  return options.payload;
32801
32935
  }
32936
+ const taskId = stringField2(options.payload.task_id);
32937
+ const cdnUrl = stringField2(options.payload.cdn_url);
32938
+ const existing = findExistingMaterializedVideo(options.targetDir, {
32939
+ taskId,
32940
+ cdnUrl
32941
+ });
32942
+ if (existing) {
32943
+ return {
32944
+ ...options.payload,
32945
+ ...existing,
32946
+ download: { success: true }
32947
+ };
32948
+ }
32802
32949
  const materialized = await materializeAsset({
32803
32950
  targetDir: options.targetDir,
32804
- url: stringField2(options.payload.cdn_url),
32805
- baseName: stringField2(options.payload.task_id),
32951
+ url: cdnUrl,
32952
+ baseName: taskId,
32806
32953
  relativeDir: "assets/video",
32807
32954
  extension: "mp4",
32808
32955
  now: options.now,
@@ -32810,16 +32957,51 @@ async function materializeVideoResult(options) {
32810
32957
  });
32811
32958
  return materialized ? persistMaterializedAsset({
32812
32959
  targetDir: options.targetDir,
32813
- toolName: "create_video_task",
32960
+ toolName,
32814
32961
  payload: options.payload,
32815
32962
  materialized,
32816
32963
  cdnUrl: stringField2(options.payload.cdn_url),
32817
32964
  now: options.now,
32818
32965
  extraRegistryFields: {
32819
- taskId: stringField2(options.payload.task_id)
32966
+ taskId
32820
32967
  }
32821
32968
  }) : options.payload;
32822
32969
  }
32970
+ function findExistingMaterializedVideo(targetDir, options) {
32971
+ if (!options.taskId || !options.cdnUrl) {
32972
+ return void 0;
32973
+ }
32974
+ const registry2 = readGeneratedAssetRegistry(targetDir);
32975
+ for (const record2 of Object.values(registry2)) {
32976
+ const localPath = stringField2(record2.localPath);
32977
+ const recordCdnUrl = stringField2(record2.cdnUrl) || stringField2(record2.previewUrl);
32978
+ if (stringField2(record2.taskId) !== options.taskId || recordCdnUrl !== options.cdnUrl || !localPath.startsWith("assets/video/")) {
32979
+ continue;
32980
+ }
32981
+ const absolutePath = resolveExistingMaterializedAssetPath(targetDir, record2, localPath);
32982
+ if (absolutePath) {
32983
+ return { localPath, absolutePath };
32984
+ }
32985
+ }
32986
+ return void 0;
32987
+ }
32988
+ function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
32989
+ const candidates = [];
32990
+ const absolutePath = stringField2(record2.absolutePath);
32991
+ if (absolutePath && path13.isAbsolute(absolutePath)) {
32992
+ candidates.push(absolutePath);
32993
+ }
32994
+ candidates.push(path13.join(targetDir, ...localPath.split("/")));
32995
+ for (const candidate of candidates) {
32996
+ try {
32997
+ if (fs12.statSync(candidate).isFile()) {
32998
+ return candidate;
32999
+ }
33000
+ } catch {
33001
+ }
33002
+ }
33003
+ return void 0;
33004
+ }
32823
33005
  async function materializeMusicResult(options) {
32824
33006
  if (options.payload.success !== true) {
32825
33007
  return options.payload;
@@ -32924,6 +33106,39 @@ async function materialize3dFinalResult(options, toolName) {
32924
33106
  const modelCdnUrl = stringField2(options.payload.model_cdn_url);
32925
33107
  const renderedImageUrl = stringField2(options.payload.rendered_image_url);
32926
33108
  const mdlConversionError = stringField2(options.payload.mdl_conversion_error);
33109
+ const modelMaterialized = await materializeAsset({
33110
+ targetDir: options.targetDir,
33111
+ url: modelCdnUrl,
33112
+ baseName: taskId || "3d_model",
33113
+ relativeDir: MODEL_ASSET_DIRS[0],
33114
+ extension: extensionFromUrl(modelCdnUrl) || "glb",
33115
+ now: options.now,
33116
+ fetchImpl: options.fetchImpl
33117
+ });
33118
+ if (modelMaterialized) {
33119
+ changed = true;
33120
+ nextPayload.modelDownload = modelMaterialized.download;
33121
+ if ("localPath" in modelMaterialized) {
33122
+ nextPayload.modelLocalPath = modelMaterialized.localPath;
33123
+ nextPayload.modelAbsolutePath = modelMaterialized.absolutePath;
33124
+ if (modelCdnUrl) {
33125
+ upsertGeneratedAssetRecord(options.targetDir, modelMaterialized.localPath, {
33126
+ tool: toolName,
33127
+ name: taskId,
33128
+ assetKind: "model",
33129
+ cdnUrl: modelCdnUrl,
33130
+ previewUrl: renderedImageUrl || modelCdnUrl,
33131
+ localPath: modelMaterialized.localPath,
33132
+ absolutePath: modelMaterialized.absolutePath,
33133
+ createdAt: options.now.toISOString(),
33134
+ taskId,
33135
+ modelCdnUrl,
33136
+ renderedImageUrl,
33137
+ mdlConversionError
33138
+ });
33139
+ }
33140
+ }
33141
+ }
32927
33142
  const mdlUrl = stringField2(options.payload.mdl_cdn_url);
32928
33143
  const mdlMaterialized = await materializeAsset({
32929
33144
  targetDir: options.targetDir,
@@ -32942,7 +33157,7 @@ async function materialize3dFinalResult(options, toolName) {
32942
33157
  nextPayload.mdlAbsolutePath = mdlMaterialized.absolutePath;
32943
33158
  extractZip(
32944
33159
  mdlMaterialized.absolutePath,
32945
- path12.join(options.targetDir, "assets"),
33160
+ path13.join(options.targetDir, "assets"),
32946
33161
  "3D model asset"
32947
33162
  );
32948
33163
  nextPayload.mdlExtracted = true;
@@ -32951,6 +33166,7 @@ async function materialize3dFinalResult(options, toolName) {
32951
33166
  upsertGeneratedAssetRecord(options.targetDir, mdlMaterialized.localPath, {
32952
33167
  tool: toolName,
32953
33168
  name: taskId,
33169
+ assetKind: "mdl_zip",
32954
33170
  cdnUrl: mdlUrl,
32955
33171
  previewUrl: renderedImageUrl || mdlUrl,
32956
33172
  localPath: mdlMaterialized.localPath,
@@ -32983,6 +33199,7 @@ async function materialize3dFinalResult(options, toolName) {
32983
33199
  upsertGeneratedAssetRecord(options.targetDir, renderedImageMaterialized.localPath, {
32984
33200
  tool: toolName,
32985
33201
  name: `${taskId || "3d_model"}_render`,
33202
+ assetKind: "render",
32986
33203
  cdnUrl: renderedImageUrl,
32987
33204
  previewUrl: renderedImageUrl,
32988
33205
  localPath: renderedImageMaterialized.localPath,
@@ -33041,8 +33258,8 @@ async function materializeAsset(options) {
33041
33258
  };
33042
33259
  }
33043
33260
  const bytes = Buffer.from(await response.arrayBuffer());
33044
- fs11.mkdirSync(path12.dirname(absolutePath), { recursive: true });
33045
- fs11.writeFileSync(absolutePath, bytes);
33261
+ fs12.mkdirSync(path13.dirname(absolutePath), { recursive: true });
33262
+ fs12.writeFileSync(absolutePath, bytes);
33046
33263
  return { localPath: relativePath, absolutePath, download: { success: true } };
33047
33264
  } catch (error2) {
33048
33265
  return {
@@ -33056,12 +33273,12 @@ async function materializeAsset(options) {
33056
33273
  function createUniqueAssetPath(options) {
33057
33274
  const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
33058
33275
  for (let index = 1; index <= 9999; index += 1) {
33059
- const relativePath = path12.posix.join(
33276
+ const relativePath = path13.posix.join(
33060
33277
  options.relativeDir,
33061
33278
  `${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
33062
33279
  );
33063
- const absolutePath = path12.join(options.targetDir, ...relativePath.split("/"));
33064
- if (!fs11.existsSync(absolutePath)) {
33280
+ const absolutePath = path13.join(options.targetDir, ...relativePath.split("/"));
33281
+ if (!fs12.existsSync(absolutePath)) {
33065
33282
  return { relativePath, absolutePath };
33066
33283
  }
33067
33284
  }
@@ -33071,9 +33288,17 @@ function rewriteEditImageAssetArgs(targetDir, args) {
33071
33288
  const registry2 = readGeneratedAssetRegistry(targetDir);
33072
33289
  return {
33073
33290
  ...args,
33074
- image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, IMAGE_ASSET_DIRS),
33291
+ image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, {
33292
+ assetDirs: IMAGE_ASSET_DIRS,
33293
+ mediaKind: "image",
33294
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33295
+ }),
33075
33296
  reference_images: Array.isArray(args.reference_images) ? args.reference_images.map(
33076
- (item) => rewriteGeneratedAssetReference(targetDir, item, registry2, IMAGE_ASSET_DIRS)
33297
+ (item) => rewriteGeneratedAssetReference(targetDir, item, registry2, {
33298
+ assetDirs: IMAGE_ASSET_DIRS,
33299
+ mediaKind: "image",
33300
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33301
+ })
33077
33302
  ) : args.reference_images
33078
33303
  };
33079
33304
  }
@@ -33081,94 +33306,133 @@ function normalizeImageReferenceAssetArgs(targetDir, args) {
33081
33306
  const registry2 = readGeneratedAssetRegistry(targetDir);
33082
33307
  return {
33083
33308
  ...args,
33084
- image: normalizeLocalAssetReference(targetDir, args.image, registry2, IMAGE_ASSET_DIRS),
33309
+ image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, {
33310
+ assetDirs: IMAGE_ASSET_DIRS,
33311
+ mediaKind: "image",
33312
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33313
+ }),
33314
+ reference_image: rewriteGeneratedAssetReference(targetDir, args.reference_image, registry2, {
33315
+ assetDirs: IMAGE_ASSET_DIRS,
33316
+ mediaKind: "image",
33317
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33318
+ }),
33085
33319
  reference_images: Array.isArray(args.reference_images) ? args.reference_images.map(
33086
- (item) => normalizeLocalAssetReference(targetDir, item, registry2, IMAGE_ASSET_DIRS)
33320
+ (item) => rewriteGeneratedAssetReference(targetDir, item, registry2, {
33321
+ assetDirs: IMAGE_ASSET_DIRS,
33322
+ mediaKind: "image",
33323
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33324
+ })
33087
33325
  ) : args.reference_images
33088
33326
  };
33089
33327
  }
33328
+ function normalizeBatchImageReferenceAssetArgs(targetDir, args) {
33329
+ if (!Array.isArray(args.images)) {
33330
+ return args;
33331
+ }
33332
+ return {
33333
+ ...args,
33334
+ images: args.images.map(
33335
+ (item) => isRecord(item) ? normalizeImageReferenceAssetArgs(targetDir, item) : item
33336
+ )
33337
+ };
33338
+ }
33090
33339
  function rewriteVideoReferenceAssetArgs(targetDir, args) {
33091
33340
  const registry2 = readGeneratedAssetRegistry(targetDir);
33092
33341
  return {
33093
33342
  ...args,
33094
- images: rewriteUrlObjectArray(targetDir, args.images, registry2, IMAGE_ASSET_DIRS),
33095
- videos: rewriteUrlObjectArray(targetDir, args.videos, registry2, VIDEO_ASSET_DIRS),
33096
- audios: rewriteUrlObjectArray(targetDir, args.audios, registry2, AUDIO_ASSET_DIRS)
33343
+ images: rewriteUrlObjectArray(targetDir, args.images, registry2, {
33344
+ assetDirs: IMAGE_ASSET_DIRS,
33345
+ mediaKind: "image",
33346
+ maxBytes: VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES
33347
+ }),
33348
+ videos: rewriteUrlObjectArray(targetDir, args.videos, registry2, {
33349
+ assetDirs: VIDEO_ASSET_DIRS,
33350
+ mediaKind: "video",
33351
+ maxBytes: VIDEO_REFERENCE_MAX_BYTES
33352
+ }),
33353
+ audios: rewriteUrlObjectArray(targetDir, args.audios, registry2, {
33354
+ assetDirs: AUDIO_ASSET_DIRS,
33355
+ mediaKind: "audio",
33356
+ maxBytes: AUDIO_REFERENCE_MAX_BYTES
33357
+ })
33097
33358
  };
33098
33359
  }
33099
33360
  function rewrite3dModelAssetArgs(targetDir, args) {
33100
33361
  const registry2 = readGeneratedAssetRegistry(targetDir);
33362
+ const imageOptions = {
33363
+ assetDirs: IMAGE_ASSET_DIRS,
33364
+ mediaKind: "image",
33365
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33366
+ };
33101
33367
  return {
33102
33368
  ...args,
33103
- image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, IMAGE_ASSET_DIRS),
33369
+ image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, imageOptions),
33104
33370
  front_image: rewriteGeneratedAssetReference(
33105
33371
  targetDir,
33106
33372
  args.front_image,
33107
33373
  registry2,
33108
- IMAGE_ASSET_DIRS
33109
- ),
33110
- left_image: rewriteGeneratedAssetReference(
33111
- targetDir,
33112
- args.left_image,
33113
- registry2,
33114
- IMAGE_ASSET_DIRS
33115
- ),
33116
- back_image: rewriteGeneratedAssetReference(
33117
- targetDir,
33118
- args.back_image,
33119
- registry2,
33120
- IMAGE_ASSET_DIRS
33374
+ imageOptions
33121
33375
  ),
33376
+ left_image: rewriteGeneratedAssetReference(targetDir, args.left_image, registry2, imageOptions),
33377
+ back_image: rewriteGeneratedAssetReference(targetDir, args.back_image, registry2, imageOptions),
33122
33378
  right_image: rewriteGeneratedAssetReference(
33123
33379
  targetDir,
33124
33380
  args.right_image,
33125
33381
  registry2,
33126
- IMAGE_ASSET_DIRS
33382
+ imageOptions
33127
33383
  ),
33128
33384
  confirmed_image_paths: rewrite3dConfirmedImagePaths(
33129
33385
  targetDir,
33130
33386
  args.confirmed_image_paths,
33131
- registry2
33387
+ registry2,
33388
+ imageOptions
33132
33389
  )
33133
33390
  };
33134
33391
  }
33135
- function rewrite3dConfirmedImagePaths(targetDir, value, registry2) {
33392
+ function rewrite3dConfirmedImagePaths(targetDir, value, registry2, options) {
33136
33393
  if (!isRecord(value)) {
33137
33394
  return value;
33138
33395
  }
33139
33396
  return {
33140
33397
  ...value,
33141
- front: rewriteGeneratedAssetReference(targetDir, value.front, registry2, IMAGE_ASSET_DIRS),
33142
- left: rewriteGeneratedAssetReference(targetDir, value.left, registry2, IMAGE_ASSET_DIRS),
33143
- back: rewriteGeneratedAssetReference(targetDir, value.back, registry2, IMAGE_ASSET_DIRS),
33144
- right: rewriteGeneratedAssetReference(targetDir, value.right, registry2, IMAGE_ASSET_DIRS)
33398
+ front: rewriteGeneratedAssetReference(targetDir, value.front, registry2, options),
33399
+ left: rewriteGeneratedAssetReference(targetDir, value.left, registry2, options),
33400
+ back: rewriteGeneratedAssetReference(targetDir, value.back, registry2, options),
33401
+ right: rewriteGeneratedAssetReference(targetDir, value.right, registry2, options)
33145
33402
  };
33146
33403
  }
33147
- function rewriteUrlObjectArray(targetDir, value, registry2, assetDirs) {
33404
+ function rewriteUrlObjectArray(targetDir, value, registry2, options) {
33148
33405
  if (!Array.isArray(value)) {
33149
33406
  return value;
33150
33407
  }
33151
33408
  return value.map(
33152
33409
  (item) => isRecord(item) ? {
33153
33410
  ...item,
33154
- url: rewriteGeneratedAssetReference(targetDir, item.url, registry2, assetDirs)
33411
+ url: rewriteGeneratedAssetReference(targetDir, item.url, registry2, options)
33155
33412
  } : item
33156
33413
  );
33157
33414
  }
33158
- function rewriteGeneratedAssetReference(targetDir, value, registry2, assetDirs) {
33415
+ function rewriteGeneratedAssetReference(targetDir, value, registry2, options) {
33159
33416
  var _a3, _b;
33160
33417
  if (typeof value !== "string") {
33161
33418
  return value;
33162
33419
  }
33163
- const localPath = resolveLocalAssetReference(targetDir, value, registry2, assetDirs);
33164
- const cdnUrl = localPath ? ((_a3 = registry2[localPath]) == null ? void 0 : _a3.cdnUrl) || ((_b = registry2[localPath]) == null ? void 0 : _b.previewUrl) : void 0;
33165
- return cdnUrl || localPath || value;
33166
- }
33167
- function normalizeLocalAssetReference(targetDir, value, registry2, assetDirs) {
33168
- if (typeof value !== "string") {
33420
+ if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
33169
33421
  return value;
33170
33422
  }
33171
- return resolveLocalAssetReference(targetDir, value, registry2, assetDirs) || value;
33423
+ const localPath = resolveLocalAssetReference(targetDir, value, registry2, options.assetDirs);
33424
+ const cdnUrl = localPath ? ((_a3 = registry2[localPath]) == null ? void 0 : _a3.cdnUrl) || ((_b = registry2[localPath]) == null ? void 0 : _b.previewUrl) : void 0;
33425
+ if (cdnUrl) {
33426
+ return cdnUrl;
33427
+ }
33428
+ const dataUrl = localAssetReferenceToDataUrl({
33429
+ targetDir,
33430
+ value,
33431
+ localPath,
33432
+ mediaKind: options.mediaKind,
33433
+ maxBytes: options.maxBytes
33434
+ });
33435
+ return dataUrl || value;
33172
33436
  }
33173
33437
  function resolveLocalAssetReference(targetDir, value, registry2, assetDirs) {
33174
33438
  if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
@@ -33192,7 +33456,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
33192
33456
  if (!isKnownAssetPath(localPath, assetDirs)) {
33193
33457
  return false;
33194
33458
  }
33195
- const basename = path12.posix.basename(localPath);
33459
+ const basename = path13.posix.basename(localPath);
33196
33460
  const stem = basename.replace(/\.[^.]+$/, "");
33197
33461
  return basename === value || stem === value || record2.name === value || record2.taskId === value;
33198
33462
  });
@@ -33205,13 +33469,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
33205
33469
  }
33206
33470
  function findLocalAssetByName(targetDir, value, assetDirs) {
33207
33471
  var _a3;
33208
- const hasExtension = Boolean(path12.extname(value));
33472
+ const hasExtension = Boolean(path13.extname(value));
33209
33473
  const candidates = [];
33210
33474
  for (const assetDir of assetDirs) {
33211
- const absoluteDir = path12.join(targetDir, ...assetDir.split("/"));
33475
+ const absoluteDir = path13.join(targetDir, ...assetDir.split("/"));
33212
33476
  let entries;
33213
33477
  try {
33214
- entries = fs11.readdirSync(absoluteDir);
33478
+ entries = fs12.readdirSync(absoluteDir);
33215
33479
  } catch {
33216
33480
  continue;
33217
33481
  }
@@ -33220,11 +33484,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
33220
33484
  if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
33221
33485
  continue;
33222
33486
  }
33223
- const absolutePath = path12.join(absoluteDir, entry);
33487
+ const absolutePath = path13.join(absoluteDir, entry);
33224
33488
  try {
33225
33489
  candidates.push({
33226
- localPath: path12.posix.join(assetDir, entry),
33227
- mtimeMs: fs11.statSync(absolutePath).mtimeMs
33490
+ localPath: path13.posix.join(assetDir, entry),
33491
+ mtimeMs: fs12.statSync(absolutePath).mtimeMs
33228
33492
  });
33229
33493
  } catch {
33230
33494
  }
@@ -33234,7 +33498,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
33234
33498
  return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
33235
33499
  }
33236
33500
  function isKnownAssetPath(relativePath, assetDirs) {
33237
- if (relativePath.startsWith("../") || path12.isAbsolute(relativePath)) {
33501
+ if (relativePath.startsWith("../") || path13.isAbsolute(relativePath)) {
33238
33502
  return false;
33239
33503
  }
33240
33504
  return assetDirs.some(
@@ -33244,35 +33508,95 @@ function isKnownAssetPath(relativePath, assetDirs) {
33244
33508
  function isBareAssetName(value) {
33245
33509
  return !value.includes("/") && !value.includes("\\");
33246
33510
  }
33511
+ function localAssetReferenceToDataUrl(options) {
33512
+ const absolutePath = resolveLocalAssetAbsolutePath(options.targetDir, {
33513
+ value: options.value,
33514
+ localPath: options.localPath
33515
+ });
33516
+ if (!absolutePath) {
33517
+ return void 0;
33518
+ }
33519
+ const mime = dataUrlMimeForPath(absolutePath, options.mediaKind);
33520
+ if (!mime) {
33521
+ return void 0;
33522
+ }
33523
+ let stat;
33524
+ try {
33525
+ stat = fs12.statSync(absolutePath);
33526
+ } catch {
33527
+ return void 0;
33528
+ }
33529
+ if (!stat.isFile() || stat.size > options.maxBytes) {
33530
+ return void 0;
33531
+ }
33532
+ const bytes = fs12.readFileSync(absolutePath);
33533
+ return `data:${mime};base64,${bytes.toString("base64")}`;
33534
+ }
33535
+ function resolveLocalAssetAbsolutePath(targetDir, options) {
33536
+ const candidates = [];
33537
+ if (options.localPath) {
33538
+ const localPath = resolveProjectRelativePath(targetDir, options.localPath);
33539
+ if (localPath) {
33540
+ candidates.push(localPath);
33541
+ }
33542
+ }
33543
+ if (path13.isAbsolute(options.value)) {
33544
+ candidates.push(options.value);
33545
+ } else {
33546
+ const localPath = resolveProjectRelativePath(targetDir, options.value);
33547
+ if (localPath) {
33548
+ candidates.push(localPath);
33549
+ }
33550
+ }
33551
+ for (const candidate of candidates) {
33552
+ if (fs12.existsSync(candidate)) {
33553
+ return candidate;
33554
+ }
33555
+ }
33556
+ return void 0;
33557
+ }
33558
+ function resolveProjectRelativePath(targetDir, value) {
33559
+ const root = path13.resolve(targetDir);
33560
+ const absolutePath = path13.resolve(root, value);
33561
+ const relativePath = path13.relative(root, absolutePath);
33562
+ const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path13.sep}`) || path13.isAbsolute(relativePath);
33563
+ if (!escapesRoot) {
33564
+ return absolutePath;
33565
+ }
33566
+ return void 0;
33567
+ }
33568
+ function dataUrlMimeForPath(filePath, mediaKind) {
33569
+ return DATA_URL_MIME_BY_EXTENSION[mediaKind][path13.extname(filePath).toLowerCase()];
33570
+ }
33247
33571
  function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
33248
33572
  const registry2 = readGeneratedAssetRegistry(targetDir);
33249
33573
  registry2[localPath] = record2;
33250
33574
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
33251
- fs11.mkdirSync(path12.dirname(registryPath), { recursive: true });
33252
- fs11.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
33575
+ fs12.mkdirSync(path13.dirname(registryPath), { recursive: true });
33576
+ fs12.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
33253
33577
  `, "utf8");
33254
33578
  }
33255
33579
  function readGeneratedAssetRegistry(targetDir) {
33256
33580
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
33257
- if (!fs11.existsSync(registryPath)) {
33581
+ if (!fs12.existsSync(registryPath)) {
33258
33582
  return {};
33259
33583
  }
33260
33584
  try {
33261
- const parsed = JSON.parse(fs11.readFileSync(registryPath, "utf8"));
33585
+ const parsed = JSON.parse(fs12.readFileSync(registryPath, "utf8"));
33262
33586
  return isRecord(parsed) ? parsed : {};
33263
33587
  } catch {
33264
33588
  return {};
33265
33589
  }
33266
33590
  }
33267
33591
  function getGeneratedAssetRegistryPath(targetDir) {
33268
- return path12.join(targetDir, ".maker", "assets", "generated-assets.json");
33592
+ return path13.join(targetDir, ".maker", "assets", "generated-assets.json");
33269
33593
  }
33270
33594
  function normalizeAssetRegistryKey(targetDir, value) {
33271
33595
  if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
33272
33596
  return void 0;
33273
33597
  }
33274
- const relative = path12.isAbsolute(value) ? path12.relative(targetDir, value) : value;
33275
- return relative.split(path12.sep).join("/");
33598
+ const relative = path13.isAbsolute(value) ? path13.relative(targetDir, value) : value;
33599
+ return relative.split(path13.sep).join("/");
33276
33600
  }
33277
33601
  function isRecord(value) {
33278
33602
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -33301,7 +33625,7 @@ function extensionFromUrl(url2) {
33301
33625
  }
33302
33626
  try {
33303
33627
  const pathname = new URL(url2).pathname;
33304
- const extension = path12.extname(pathname).replace(/^\./, "").toLowerCase();
33628
+ const extension = path13.extname(pathname).replace(/^\./, "").toLowerCase();
33305
33629
  return extension || void 0;
33306
33630
  } catch {
33307
33631
  return void 0;
@@ -33309,7 +33633,7 @@ function extensionFromUrl(url2) {
33309
33633
  }
33310
33634
 
33311
33635
  // src/maker/server/mcp.ts
33312
- var VERSION = true ? "0.0.18-beta.1" : "dev";
33636
+ var VERSION = true ? "0.0.19-beta.1" : "dev";
33313
33637
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
33314
33638
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
33315
33639
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -33322,6 +33646,7 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
33322
33646
  "batch_generate_images",
33323
33647
  "edit_image",
33324
33648
  "create_video_task",
33649
+ "query_video_task",
33325
33650
  "text_to_music",
33326
33651
  "create_3d_model_task",
33327
33652
  "query_3d_model_task"
@@ -33338,7 +33663,7 @@ var MakerCloneFailedError = class extends Error {
33338
33663
  var tools = [
33339
33664
  {
33340
33665
  name: "maker_status_lite",
33341
- description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness, maker-lua-lsp readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets and override generic imagegen/native media tools, edit_image guidance to resolve dragged/referenced images to a local path or CDN URL before calling the tool, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
33666
+ description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness, maker-lua-lsp readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets, supported local path/remote URL/data URL inputs, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init. If the user explicitly asks to create a project/game in an unbound directory, prioritize taptap-maker init --create over same-name app matching.",
33342
33667
  inputSchema: {
33343
33668
  type: "object",
33344
33669
  properties: {
@@ -33417,7 +33742,7 @@ var resources = [
33417
33742
  {
33418
33743
  uri: "maker://status",
33419
33744
  name: "Maker status",
33420
- description: "Local TapTap Maker project status, including Git, PAT/TapTap auth, project binding, AI dev kit status, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
33745
+ description: "Local TapTap Maker project status, including Git, PAT/TapTap auth, project binding, AI dev kit status, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init. If the user explicitly asks to create a project/game in an unbound directory, prioritize taptap-maker init --create over same-name app matching.",
33421
33746
  mimeType: "text/plain"
33422
33747
  }
33423
33748
  ];
@@ -33429,7 +33754,9 @@ async function listMakerTools(options) {
33429
33754
  serverUrl: options.serverUrl,
33430
33755
  env: options.env
33431
33756
  }));
33432
- remoteTools = filterExposedRemoteProxyTools(await listedRemoteTools());
33757
+ remoteTools = filterExposedRemoteProxyTools(await listedRemoteTools()).map(
33758
+ decorateRemoteProxyToolDefinition
33759
+ );
33433
33760
  } catch {
33434
33761
  remoteTools = [];
33435
33762
  }
@@ -33441,6 +33768,54 @@ function filterExposedRemoteProxyTools(toolsToFilter) {
33441
33768
  const exposedToolNames = new Set(MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES);
33442
33769
  return toolsToFilter.filter((tool) => exposedToolNames.has(tool.name));
33443
33770
  }
33771
+ function decorateRemoteProxyToolDefinition(tool) {
33772
+ const guidance = remoteProxyToolGuidance(tool.name);
33773
+ if (!guidance) {
33774
+ return tool;
33775
+ }
33776
+ return {
33777
+ ...tool,
33778
+ description: [tool.description, guidance].filter(Boolean).join("\n\n")
33779
+ };
33780
+ }
33781
+ function remoteProxyToolGuidance(toolName) {
33782
+ const failurePolicy = "If this Maker proxy tool fails or returns isError, include the full remote_result/error payload from the server so developers can diagnose the issue.";
33783
+ const localMediaSizeHint = "Large local/data URL media can be slow or fail: image inputs are commonly limited to about 10 MB, video-task image inputs to about 30 MB, video inputs to about 50 MB, and audio inputs to about 15 MB.";
33784
+ switch (toolName) {
33785
+ case "generate_image":
33786
+ case "batch_generate_images":
33787
+ return [
33788
+ "**Maker asset workflow hint:** In a bound Maker project, prefer this Maker MCP proxy tool for Maker project assets. Successful results are downloaded into the Maker project and recorded with remote mapping for later edits or video references.",
33789
+ localMediaSizeHint,
33790
+ failurePolicy
33791
+ ].join(" ");
33792
+ case "edit_image":
33793
+ return [
33794
+ "**Maker asset workflow hint:** In a bound Maker project, prefer this Maker MCP proxy tool for image editing.",
33795
+ localMediaSizeHint,
33796
+ failurePolicy
33797
+ ].join(" ");
33798
+ case "create_video_task":
33799
+ return [
33800
+ "**Maker asset workflow hint:** Prefer this Maker MCP proxy tool for Maker video generation. Image, video, and audio references may use remote URLs, existing data URLs, or resolvable local files that the local proxy can forward as data URLs.",
33801
+ localMediaSizeHint,
33802
+ failurePolicy
33803
+ ].join(" ");
33804
+ case "query_video_task":
33805
+ return [
33806
+ "**Maker asset workflow hint:** Prefer this Maker MCP proxy tool to refresh video task status, release completed task quota, and materialize successful video results into the Maker project.",
33807
+ "Use this Maker MCP proxy tool to refresh video task status when create_video_task returns a task_id or reports video concurrency limits.",
33808
+ failurePolicy
33809
+ ].join(" ");
33810
+ case "text_to_music":
33811
+ return [
33812
+ "**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.",
33813
+ failurePolicy
33814
+ ].join(" ");
33815
+ default:
33816
+ return void 0;
33817
+ }
33818
+ }
33444
33819
  function isExposedRemoteProxyTool(name) {
33445
33820
  return MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES.includes(name);
33446
33821
  }
@@ -33515,15 +33890,7 @@ async function callRemoteProxyTool(options) {
33515
33890
  },
33516
33891
  void 0,
33517
33892
  {
33518
- timeout: DEFAULT_BUILD_TIMEOUT_MS,
33519
- resetTimeoutOnProgress: true,
33520
- onprogress: options.progressToken ? (progress) => {
33521
- options.extra.sendNotification({
33522
- method: "notifications/progress",
33523
- params: { progressToken: options.progressToken, ...progress }
33524
- }).catch(() => {
33525
- });
33526
- } : void 0
33893
+ ...createRemoteProxyCallToolOptions(options.progressToken, options.extra)
33527
33894
  }
33528
33895
  );
33529
33896
  } finally {
@@ -33552,6 +33919,24 @@ async function callRemoteProxyTool(options) {
33552
33919
  result
33553
33920
  });
33554
33921
  }
33922
+ function createRemoteProxyProgressHandler(progressToken, extra) {
33923
+ if (progressToken === void 0) {
33924
+ return () => {
33925
+ };
33926
+ }
33927
+ return (progress) => {
33928
+ extra.sendNotification({
33929
+ method: "notifications/progress",
33930
+ params: { progressToken, ...progress }
33931
+ }).catch(() => {
33932
+ });
33933
+ };
33934
+ }
33935
+ function createRemoteProxyCallToolOptions(progressToken, extra) {
33936
+ return {
33937
+ onprogress: createRemoteProxyProgressHandler(progressToken, extra)
33938
+ };
33939
+ }
33555
33940
  async function startMakerMcpServer() {
33556
33941
  const server = new Server(
33557
33942
  {
@@ -33704,7 +34089,7 @@ async function formatStatus(options = {}) {
33704
34089
  const env = getMakerEnvironment(void 0, targetDir);
33705
34090
  const identify = identifyMakerProject({ cwd: targetDir });
33706
34091
  const mcpCwd = process.cwd();
33707
- const mcpCwdIdentify = path13.resolve(mcpCwd) === path13.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
34092
+ const mcpCwdIdentify = path14.resolve(mcpCwd) === path14.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
33708
34093
  const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
33709
34094
  const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
33710
34095
  const pat = loadPat();
@@ -33773,6 +34158,8 @@ async function formatStatus(options = {}) {
33773
34158
  "",
33774
34159
  tapAuthRefreshText,
33775
34160
  "",
34161
+ identify.projectRoot ? formatMakerAgentsPolicyStatus(identify.projectRoot) : "",
34162
+ "",
33776
34163
  identify.projectRoot ? await formatAiDevKitStatus(identify.projectRoot, {
33777
34164
  environment: env,
33778
34165
  skipVersionCheck: options.skipRemoteSync
@@ -33824,10 +34211,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
33824
34211
  if (!options.projectRoot) {
33825
34212
  return "";
33826
34213
  }
33827
- const mcpCwd = path13.resolve(options.mcpCwd);
33828
- const targetDir = path13.resolve(options.targetDir);
33829
- const projectRoot = path13.resolve(options.projectRoot);
33830
- const mcpProjectRoot = options.mcpProjectRoot ? path13.resolve(options.mcpProjectRoot) : void 0;
34214
+ const mcpCwd = path14.resolve(options.mcpCwd);
34215
+ const targetDir = path14.resolve(options.targetDir);
34216
+ const projectRoot = path14.resolve(options.projectRoot);
34217
+ const mcpProjectRoot = options.mcpProjectRoot ? path14.resolve(options.mcpProjectRoot) : void 0;
33831
34218
  if (mcpProjectRoot === projectRoot) {
33832
34219
  return "";
33833
34220
  }
@@ -33948,7 +34335,7 @@ function formatMakerRemoteSyncStatusLines(status) {
33948
34335
  ((_a3 = status.failure) == null ? void 0 : _a3.retryable) !== void 0 ? `- failure_retryable: ${status.failure.retryable ? "yes" : "no"}` : "",
33949
34336
  ((_b = status.failure) == null ? void 0 : _b.retryReason) ? `- failure_retry_reason: ${status.failure.retryReason}` : "",
33950
34337
  ((_c = status.failure) == null ? void 0 : _c.stderr) ? `- failure_stderr:
33951
- ${indent(status.failure.stderr)}` : "",
34338
+ ${indent2(status.failure.stderr)}` : "",
33952
34339
  `- next_action: ${status.nextAction}`
33953
34340
  ].filter(Boolean);
33954
34341
  }
@@ -33989,7 +34376,7 @@ function formatAiDialogueDirectoryHint(targetDir) {
33989
34376
  }
33990
34377
  function resolveMakerToolTargetDir(targetDir) {
33991
34378
  if (targetDir) {
33992
- return path13.resolve(targetDir);
34379
+ return path14.resolve(targetDir);
33993
34380
  }
33994
34381
  return process.cwd();
33995
34382
  }
@@ -34031,8 +34418,10 @@ async function formatAutoProjectListFromPat() {
34031
34418
  const projects = await listMakerProjects();
34032
34419
  return [
34033
34420
  "本地已有 Maker PAT,当前目录尚未绑定 Maker 项目。",
34421
+ "绑定项目时必须先提醒用户:0,创建新项目 / 0. Create a new Maker project。",
34422
+ "即使发现和当前目录同名的 Maker app,也不能只推荐同名 app;必须同时展示创建新项目选项。",
34034
34423
  "当前目录未绑定时,先展示下面的 Maker Apps 预览和总数;选择、解释和 clone 顺序请参考 taptap-maker-local workflow guide document。",
34035
- "用户选择 app 后,next_step: 执行 `taptap-maker init`。",
34424
+ "用户选择 0/new 或已有 app 后,next_step: 执行 `taptap-maker init`。",
34036
34425
  "",
34037
34426
  formatStatusProjectList(projects)
34038
34427
  ].join("\n");
@@ -34064,7 +34453,8 @@ function formatStatusProjectList(projects) {
34064
34453
  return [
34065
34454
  "No Maker apps found.",
34066
34455
  "",
34067
- "请确认 Maker PAT 是否有效,或等待 Maker app list 接口对齐。"
34456
+ "0,创建新项目 / 0. Create a new Maker project",
34457
+ "当前账号没有可展示的 Maker app。用户要开始新项目时,直接引导其执行 `taptap-maker init`,并在交互中选择 `0`/`new` 创建项目。"
34068
34458
  ].join("\n");
34069
34459
  }
34070
34460
  const visibleProjects = sortStatusProjectsByRecentActivity(projects).slice(
@@ -34077,6 +34467,8 @@ function formatStatusProjectList(projects) {
34077
34467
  "",
34078
34468
  hiddenCount > 0 ? `为了保持友好的可读性,默认最多展示 ${visibleProjects.length} 个 app;如需完整列表,可以选择显示全部。` : "已显示全部 app;请询问用户选择。",
34079
34469
  hiddenCount > 0 ? "如需完整列表,请运行 taptap-maker apps --json 查看全部 app。" : void 0,
34470
+ "0,创建新项目 / 0. Create a new Maker project",
34471
+ "AI 必须把上面这一行作为可选项展示给用户;即使压缩 app 列表,也不要删除创建项目入口。",
34080
34472
  "AI 展示建议:如果聊天或客户端宽度足够,可把 app 预览整理成两列紧凑布局;每个 app 保留序号、app_id、名称,以及可用的最近活跃时间或 user_id。窄屏保持单列。选择 app 前先获取用户确认。",
34081
34473
  "",
34082
34474
  ...visibleProjects.map(
@@ -34089,14 +34481,14 @@ function formatStatusProjectList(projects) {
34089
34481
  ].filter((line) => line !== void 0).join("\n");
34090
34482
  }
34091
34483
  function formatClonePartialStateLines(targetDir) {
34092
- const resolvedTargetDir = path13.resolve(targetDir);
34484
+ const resolvedTargetDir = path14.resolve(targetDir);
34093
34485
  const identify = identifyMakerProject({ cwd: resolvedTargetDir });
34094
34486
  const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
34095
34487
  const devKitStatus = inspectAiDevKit(resolvedTargetDir);
34096
- const stagedDevKitGitignorePath = path13.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
34488
+ const stagedDevKitGitignorePath = path14.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
34097
34489
  const projectBound = Boolean(identify.projectId);
34098
34490
  const gitInitialized = Boolean(
34099
- gitStatus.isOwnGitRoot || fs12.existsSync(path13.join(resolvedTargetDir, ".git"))
34491
+ gitStatus.isOwnGitRoot || fs13.existsSync(path14.join(resolvedTargetDir, ".git"))
34100
34492
  );
34101
34493
  const safeToRetry = !projectBound;
34102
34494
  return [
@@ -34110,7 +34502,7 @@ function formatClonePartialStateLines(targetDir) {
34110
34502
  identify.configPath ? `- config: ${identify.configPath}` : "",
34111
34503
  `- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
34112
34504
  `- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
34113
- `- staged_dev_kit_gitignore: ${fs12.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
34505
+ `- staged_dev_kit_gitignore: ${fs13.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
34114
34506
  `- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
34115
34507
  safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
34116
34508
  ].filter(Boolean);
@@ -34156,6 +34548,8 @@ function createRemoteProxyContext(options) {
34156
34548
  },
34157
34549
  options: {
34158
34550
  verbose: true,
34551
+ reset_timeout_on_progress: true,
34552
+ force_inject_progress_token: true,
34159
34553
  exposed_tools: options.exposedTools
34160
34554
  }
34161
34555
  };
@@ -34177,15 +34571,27 @@ function createRemoteProxyContext(options) {
34177
34571
  };
34178
34572
  }
34179
34573
  function resolveEmbeddedProxyCommand(options) {
34180
- const makerEntry = (options == null ? void 0 : options.makerEntry) ?? process.argv[1];
34574
+ const currentEntry = process.argv[1];
34575
+ const makerEntry = (options == null ? void 0 : options.makerEntry) || (isUsableEmbeddedMakerEntry(currentEntry) ? currentEntry : void 0) || resolveBundledMakerEntry();
34181
34576
  if (!makerEntry) {
34182
34577
  throw new Error("Cannot resolve current taptap-maker entry for embedded MCP proxy.");
34183
34578
  }
34184
34579
  return {
34185
34580
  command: process.execPath,
34186
- args: [path13.resolve(makerEntry), "__maker-proxy"]
34581
+ args: [path14.resolve(makerEntry), "__maker-proxy"]
34187
34582
  };
34188
34583
  }
34584
+ function resolveBundledMakerEntry() {
34585
+ const bundledEntry = path14.resolve(__dirname, "../../../bin/taptap-maker");
34586
+ return fs13.existsSync(bundledEntry) ? bundledEntry : void 0;
34587
+ }
34588
+ function isUsableEmbeddedMakerEntry(entry) {
34589
+ if (!entry) {
34590
+ return false;
34591
+ }
34592
+ const normalized = entry.replace(/\\/g, "/");
34593
+ return /(?:^|\/)(?:taptap-maker(?:\.cmd)?|maker\.(?:c|m)?js)$/.test(normalized);
34594
+ }
34189
34595
  function createToolProgressReporter(progressToken, extra, operationName) {
34190
34596
  var _a3;
34191
34597
  const startedAt = Date.now();
@@ -34524,18 +34930,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
34524
34930
  }
34525
34931
  }
34526
34932
  async function startRuntimeLogWatch(buildResult) {
34527
- const runtimeDir = path13.join(buildResult.projectRoot, ".maker", "logs", "runtime");
34528
- fs12.mkdirSync(runtimeDir, { recursive: true });
34529
- const stdoutLog = path13.join(runtimeDir, "watcher.out.log");
34530
- const stderrLog = path13.join(runtimeDir, "watcher.err.log");
34531
- const pidFile = path13.join(runtimeDir, "watcher.pid");
34933
+ const runtimeDir = path14.join(buildResult.projectRoot, ".maker", "logs", "runtime");
34934
+ fs13.mkdirSync(runtimeDir, { recursive: true });
34935
+ const stdoutLog = path14.join(runtimeDir, "watcher.out.log");
34936
+ const stderrLog = path14.join(runtimeDir, "watcher.err.log");
34937
+ const pidFile = path14.join(runtimeDir, "watcher.pid");
34532
34938
  const previous = stopExistingRuntimeLogWatcher(pidFile);
34533
- const outFd = fs12.openSync(stdoutLog, "a");
34534
- const errFd = fs12.openSync(stderrLog, "a");
34939
+ const outFd = fs13.openSync(stdoutLog, "a");
34940
+ const errFd = fs13.openSync(stderrLog, "a");
34535
34941
  const command = formatRuntimeLogWatchCommand(buildResult);
34536
34942
  if (previous.previousStopError) {
34537
- fs12.closeSync(outFd);
34538
- fs12.closeSync(errFd);
34943
+ fs13.closeSync(outFd);
34944
+ fs13.closeSync(errFd);
34539
34945
  return {
34540
34946
  started: false,
34541
34947
  command: command.text,
@@ -34598,18 +35004,18 @@ async function startRuntimeLogWatch(buildResult) {
34598
35004
  ...previous
34599
35005
  };
34600
35006
  } finally {
34601
- fs12.closeSync(outFd);
34602
- fs12.closeSync(errFd);
35007
+ fs13.closeSync(outFd);
35008
+ fs13.closeSync(errFd);
34603
35009
  }
34604
35010
  }
34605
35011
  function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34606
- if (!fs12.existsSync(pidFile)) {
35012
+ if (!fs13.existsSync(pidFile)) {
34607
35013
  return {};
34608
35014
  }
34609
35015
  const pidState = readRuntimeLogWatcherPidState(pidFile);
34610
35016
  const pid = pidState == null ? void 0 : pidState.pid;
34611
35017
  if (!Number.isInteger(pid) || pid <= 0) {
34612
- fs12.rmSync(pidFile, { force: true });
35018
+ fs13.rmSync(pidFile, { force: true });
34613
35019
  return {};
34614
35020
  }
34615
35021
  try {
@@ -34617,7 +35023,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34617
35023
  const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
34618
35024
  const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
34619
35025
  if (!verifiedCommand) {
34620
- fs12.rmSync(pidFile, { force: true });
35026
+ fs13.rmSync(pidFile, { force: true });
34621
35027
  return {
34622
35028
  previousPid: pid,
34623
35029
  previousStopped: false,
@@ -34627,7 +35033,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34627
35033
  process.kill(pid, "SIGTERM");
34628
35034
  const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
34629
35035
  if (stopped) {
34630
- fs12.rmSync(pidFile, { force: true });
35036
+ fs13.rmSync(pidFile, { force: true });
34631
35037
  return { previousPid: pid, previousStopped: true };
34632
35038
  }
34633
35039
  return {
@@ -34636,7 +35042,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34636
35042
  previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
34637
35043
  };
34638
35044
  } catch (error2) {
34639
- fs12.rmSync(pidFile, { force: true });
35045
+ fs13.rmSync(pidFile, { force: true });
34640
35046
  const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
34641
35047
  if (code === "ESRCH") {
34642
35048
  return { previousPid: pid, previousStopped: false };
@@ -34649,7 +35055,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34649
35055
  }
34650
35056
  }
34651
35057
  function readRuntimeLogWatcherPidState(pidFile) {
34652
- const raw = fs12.readFileSync(pidFile, "utf8").trim();
35058
+ const raw = fs13.readFileSync(pidFile, "utf8").trim();
34653
35059
  if (!raw) {
34654
35060
  return null;
34655
35061
  }
@@ -34665,7 +35071,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
34665
35071
  }
34666
35072
  }
34667
35073
  function writeRuntimeLogWatcherPidFile(pidFile, state) {
34668
- fs12.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
35074
+ fs13.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
34669
35075
  `, "utf8");
34670
35076
  }
34671
35077
  function getProcessCommand(pid) {
@@ -34751,10 +35157,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
34751
35157
  };
34752
35158
  }
34753
35159
  function resolveMakerCliEntry() {
34754
- return process.argv[1] || path13.resolve(process.cwd(), "dist", "maker.js");
35160
+ return process.argv[1] || path14.resolve(process.cwd(), "dist", "maker.js");
34755
35161
  }
34756
35162
  function getRuntimeLogFilePath(projectRoot) {
34757
- return path13.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
35163
+ return path14.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
34758
35164
  }
34759
35165
  async function refreshMakerPreview(buildResult) {
34760
35166
  const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
@@ -34887,7 +35293,7 @@ function createBuildArgs(projectRoot, options) {
34887
35293
  if (options.scriptsPath) {
34888
35294
  buildArgs.scriptsPath = options.scriptsPath;
34889
35295
  }
34890
- if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs12.existsSync(path13.join(projectRoot, "scripts", "main.lua"))) {
35296
+ if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs13.existsSync(path14.join(projectRoot, "scripts", "main.lua"))) {
34891
35297
  buildArgs.entry = "main.lua";
34892
35298
  buildArgs.scriptsPath = "scripts";
34893
35299
  }
@@ -34899,7 +35305,7 @@ function createBuildArgs(projectRoot, options) {
34899
35305
  }
34900
35306
  if (options.multiplayer) {
34901
35307
  buildArgs.multiplayer = options.multiplayer;
34902
- } else if (!fs12.existsSync(path13.join(projectRoot, ".project", "settings.json"))) {
35308
+ } else if (!fs13.existsSync(path14.join(projectRoot, ".project", "settings.json"))) {
34903
35309
  buildArgs.multiplayer = { enabled: false };
34904
35310
  }
34905
35311
  return buildArgs;
@@ -34952,7 +35358,7 @@ function formatBuildResult(result, progressSummary) {
34952
35358
  ...formatMakerBuildFailureLines(result.buildFailure),
34953
35359
  "",
34954
35360
  "remote_result:",
34955
- indent(result.buildResult.resultText)
35361
+ indent2(result.buildResult.resultText)
34956
35362
  ].filter(Boolean).join("\n");
34957
35363
  }
34958
35364
  if (result.mode === "submit_failed_before_build") {
@@ -35031,7 +35437,7 @@ function formatBuildResult(result, progressSummary) {
35031
35437
  if (submitLines.length > 0) {
35032
35438
  lines.push(...submitLines);
35033
35439
  }
35034
- lines.push("remote_result:", indent(result.resultText));
35440
+ lines.push("remote_result:", indent2(result.resultText));
35035
35441
  return lines.join("\n");
35036
35442
  }
35037
35443
  function formatPreviewRefreshLines(result) {
@@ -35074,11 +35480,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
35074
35480
  ((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
35075
35481
  `- watch_command: ${command}`,
35076
35482
  ((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
35077
- `- local_file: ${path13.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
35483
+ `- local_file: ${path14.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
35078
35484
  ((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
35079
35485
  ((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
35080
35486
  ((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
35081
- `- state_file: ${path13.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
35487
+ `- state_file: ${path14.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
35082
35488
  ((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
35083
35489
  ((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
35084
35490
  ((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
@@ -35122,7 +35528,7 @@ function formatMakerBuildFailureLines(failure) {
35122
35528
  `- error_name: ${failure.name}`,
35123
35529
  `- message: ${failure.message}`,
35124
35530
  failure.stack ? `- stack:
35125
- ${indent(failure.stack)}` : ""
35531
+ ${indent2(failure.stack)}` : ""
35126
35532
  ].filter(Boolean);
35127
35533
  }
35128
35534
  function formatMakerFailureLines(failure) {
@@ -35136,9 +35542,9 @@ function formatMakerFailureLines(failure) {
35136
35542
  `- exit_code: ${failure.exitCode ?? "(none)"}`,
35137
35543
  failure.command ? `- command: ${failure.command}` : "",
35138
35544
  failure.stderr ? `- stderr:
35139
- ${indent(failure.stderr)}` : "",
35545
+ ${indent2(failure.stderr)}` : "",
35140
35546
  failure.stdout ? `- stdout:
35141
- ${indent(failure.stdout)}` : "",
35547
+ ${indent2(failure.stdout)}` : "",
35142
35548
  `- next_action: ${failure.nextAction}`
35143
35549
  ].filter(Boolean);
35144
35550
  }
@@ -35170,44 +35576,105 @@ function formatToolException(toolName, error2) {
35170
35576
  ...formatClonePartialStateLines(error2.targetDir),
35171
35577
  "",
35172
35578
  "debug:",
35173
- originalStack ? indent(originalStack) : indent(message),
35579
+ originalStack ? indent2(originalStack) : indent2(message),
35174
35580
  "",
35175
35581
  "next_action: 请根据 partial_state 判断是否直接重试;不要删除用户文件。若用户不懂目录状态,优先建议新建独立目录重新 clone。"
35176
35582
  ].join("\n");
35177
35583
  }
35584
+ if (error2 instanceof RemoteProxyToolResultError) {
35585
+ return [
35586
+ "✗ Maker MCP proxy tool failed",
35587
+ "",
35588
+ `- tool: ${toolName}`,
35589
+ "- reason: remote_proxy_tool_result_error",
35590
+ `- error_name: ${error2.name}`,
35591
+ `- message: ${firstLine(error2.message)}`,
35592
+ "",
35593
+ formatRemoteProxyToolResult(error2.result),
35594
+ "",
35595
+ "next_action: 远端 proxy tool 已返回失败结果;请把 remote_result 原样反馈给开发者,方便排查 server 返回内容。"
35596
+ ].join("\n");
35597
+ }
35178
35598
  return [
35179
35599
  "✗ Maker MCP tool failed",
35180
35600
  "",
35181
35601
  `- tool: ${toolName}`,
35182
35602
  `- error_name: ${error2 instanceof Error ? error2.name : typeof error2}`,
35183
35603
  `- message: ${message}`,
35604
+ ...formatUnknownExceptionDetailLines(error2),
35184
35605
  "",
35185
35606
  "debug:",
35186
- stack ? indent(stack) : indent(message),
35607
+ stack ? indent2(stack) : indent2(message),
35187
35608
  "",
35188
35609
  "next_action: 请把上面的完整错误反馈给开发者;如果本地已有 commit 但 push 未完成,不要重复 commit,直接重试 maker_build_current_directory。"
35189
35610
  ].join("\n");
35190
35611
  }
35191
- function indent(value) {
35612
+ function firstLine(value) {
35613
+ return value.split("\n")[0] || value;
35614
+ }
35615
+ function formatUnknownExceptionDetailLines(error2) {
35616
+ if (!(error2 instanceof Error)) {
35617
+ return [];
35618
+ }
35619
+ const details = errorOwnDiagnosticFields(error2);
35620
+ if (Object.keys(details).length === 0) {
35621
+ return [];
35622
+ }
35623
+ return ["", "error_details:", indent2(formatDiagnosticJson(details))];
35624
+ }
35625
+ function errorOwnDiagnosticFields(error2) {
35626
+ const details = {};
35627
+ for (const key of Object.getOwnPropertyNames(error2)) {
35628
+ if (key === "name" || key === "message" || key === "stack") {
35629
+ continue;
35630
+ }
35631
+ details[key] = sanitizeDiagnosticValue(error2[key]);
35632
+ }
35633
+ return details;
35634
+ }
35635
+ function sanitizeDiagnosticValue(value) {
35636
+ if (Array.isArray(value)) {
35637
+ return value.map((item) => sanitizeDiagnosticValue(item));
35638
+ }
35639
+ if (value && typeof value === "object") {
35640
+ const result = {};
35641
+ for (const [key, nestedValue] of Object.entries(value)) {
35642
+ result[key] = isSensitiveDiagnosticKey(key) ? "<redacted>" : sanitizeDiagnosticValue(nestedValue);
35643
+ }
35644
+ return result;
35645
+ }
35646
+ return value;
35647
+ }
35648
+ function isSensitiveDiagnosticKey(key) {
35649
+ return /token|secret|mac[_-]?key|authorization|cookie|(^|[_-])pat($|[_-])/i.test(key);
35650
+ }
35651
+ function formatDiagnosticJson(value) {
35652
+ try {
35653
+ return JSON.stringify(value, null, 2);
35654
+ } catch {
35655
+ return String(value);
35656
+ }
35657
+ }
35658
+ function indent2(value) {
35192
35659
  return value.split("\n").map((line) => ` ${line}`).join("\n");
35193
35660
  }
35194
35661
 
35195
35662
  // src/maker/cli/commands.ts
35196
35663
  import { spawnSync as spawnSync8 } from "node:child_process";
35197
- import crypto2 from "node:crypto";
35198
- import fs13 from "node:fs";
35664
+ import crypto3 from "node:crypto";
35665
+ import fs14 from "node:fs";
35199
35666
  import os4 from "node:os";
35200
- import path14 from "node:path";
35667
+ import path15 from "node:path";
35201
35668
  import readline from "node:readline/promises";
35202
35669
  import { stdin as input, stdout as output } from "node:process";
35203
35670
 
35204
35671
  // src/maker/auth/cliLogin.ts
35205
35672
  import { spawnSync as spawnSync7 } from "node:child_process";
35206
- import crypto from "node:crypto";
35673
+ import crypto2 from "node:crypto";
35207
35674
  var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
35208
35675
  var DEFAULT_POLL_INTERVAL_MS = 1e3;
35209
35676
  function createCliLoginCode() {
35210
- return crypto.randomBytes(24).toString("base64url");
35677
+ return crypto2.randomBytes(24).toString("base64url");
35211
35678
  }
35212
35679
  function getMakerCliLoginUrl(code, env) {
35213
35680
  const url2 = new URL("/pat-tokens", getMakerWebUrl(env));
@@ -35345,7 +35812,7 @@ function formatError2(error2) {
35345
35812
  // src/maker/cli/commands.ts
35346
35813
  var DEFAULT_MCP_NAME = "taptap-maker";
35347
35814
  var MAKER_NPM_PACKAGE = "@taptap/maker";
35348
- var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp"]);
35815
+ var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
35349
35816
  var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
35350
35817
  "json",
35351
35818
  "skip_confirm",
@@ -35404,6 +35871,14 @@ async function runMakerCli(argv) {
35404
35871
  await runMcpVerify(parsed, ctx);
35405
35872
  return;
35406
35873
  }
35874
+ if (command === "agents" && subcommand === "update") {
35875
+ await runAgentsUpdate(parsed, ctx);
35876
+ return;
35877
+ }
35878
+ if (command === "upgrade") {
35879
+ await runUpgrade(parsed, ctx);
35880
+ return;
35881
+ }
35407
35882
  if (command === "dev-kit" && subcommand === "update") {
35408
35883
  await runDevKitUpdate(parsed, ctx);
35409
35884
  return;
@@ -35469,7 +35944,7 @@ function toOptionKey(value) {
35469
35944
  }
35470
35945
  async function runInit(parsed, ctx) {
35471
35946
  rejectPackageOption(parsed);
35472
- const targetDir = path14.resolve(stringOption(parsed, "target_dir") || process.cwd());
35947
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
35473
35948
  const env = makerEnvOption(parsed);
35474
35949
  const skipConfirm = booleanOption(parsed, "skip_confirm");
35475
35950
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -35563,7 +36038,7 @@ async function runInit(parsed, ctx) {
35563
36038
  }
35564
36039
  async function runDoctor(parsed, ctx) {
35565
36040
  var _a3, _b;
35566
- const targetDir = path14.resolve(stringOption(parsed, "target_dir") || process.cwd());
36041
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
35567
36042
  const env = makerEnvOption(parsed);
35568
36043
  const git = checkGitEnvironment();
35569
36044
  const python = checkMakerPythonEnvironment();
@@ -35575,6 +36050,7 @@ async function runDoctor(parsed, ctx) {
35575
36050
  const projectRoot = identify.projectRoot || targetDir;
35576
36051
  const devKit = inspectAiDevKit(projectRoot);
35577
36052
  const devKitUpdate = await checkAiDevKitUpdate(projectRoot, { environment: env });
36053
+ const agentsPolicy = isProjectBound ? inspectMakerAgentsPolicy(projectRoot) : void 0;
35578
36054
  const orphanProcessCheck = inspectMakerOrphanProcesses();
35579
36055
  const mcpToolsAvailability = inspectMakerMcpToolsAvailability({
35580
36056
  makerProjectDir: identify.projectRoot
@@ -35590,6 +36066,7 @@ async function runDoctor(parsed, ctx) {
35590
36066
  python,
35591
36067
  lua_lsp: luaLsp,
35592
36068
  project: identify,
36069
+ agents_policy: agentsPolicy,
35593
36070
  dev_kit: devKit,
35594
36071
  dev_kit_update: devKitUpdate,
35595
36072
  mcp_tools_availability: mcpToolsAvailability,
@@ -35618,6 +36095,7 @@ async function runDoctor(parsed, ctx) {
35618
36095
  `- target_dir: ${targetDir}`,
35619
36096
  `- project_id: ${identify.projectId || "(none)"}`,
35620
36097
  identify.configPath ? `- config: ${identify.configPath}` : "",
36098
+ isProjectBound ? formatMakerAgentsPolicyStatus(projectRoot) : "",
35621
36099
  "",
35622
36100
  "AI dev kit",
35623
36101
  `- ready: ${devKit.ready ? "yes" : "no"}`,
@@ -35637,9 +36115,9 @@ async function runDoctor(parsed, ctx) {
35637
36115
  );
35638
36116
  }
35639
36117
  function inspectMakerMcpToolsAvailability(options) {
35640
- const aiPwd = path14.resolve(process.cwd());
36118
+ const aiPwd = path15.resolve(process.cwd());
35641
36119
  const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
35642
- const makerProjectDir = options.makerProjectDir ? path14.resolve(options.makerProjectDir) : void 0;
36120
+ const makerProjectDir = options.makerProjectDir ? path15.resolve(options.makerProjectDir) : void 0;
35643
36121
  if (!makerProjectDir) {
35644
36122
  return {
35645
36123
  tools_visibility: "refresh_ai_client_if_missing",
@@ -35681,9 +36159,9 @@ function samePath2(left, right) {
35681
36159
  return normalizePathForCompare2(left) === normalizePathForCompare2(right);
35682
36160
  }
35683
36161
  function normalizePathForCompare2(value) {
35684
- const resolved = path14.resolve(value);
36162
+ const resolved = path15.resolve(value);
35685
36163
  try {
35686
- return fs13.realpathSync.native(resolved);
36164
+ return fs14.realpathSync.native(resolved);
35687
36165
  } catch {
35688
36166
  return resolved;
35689
36167
  }
@@ -36001,7 +36479,7 @@ async function runPatSet(parsed, ctx) {
36001
36479
  }
36002
36480
  async function resolvePatSet(parsed, ctx) {
36003
36481
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
36004
- const pat = fs13.readFileSync(0, "utf8").trim();
36482
+ const pat = fs14.readFileSync(0, "utf8").trim();
36005
36483
  if (!pat) {
36006
36484
  throw new Error("No PAT found on stdin.");
36007
36485
  }
@@ -36031,7 +36509,7 @@ async function runMcpInstall(parsed, ctx) {
36031
36509
  env: makerEnvOption(parsed),
36032
36510
  pkg: MAKER_NPM_PACKAGE,
36033
36511
  mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
36034
- cwd: explicitTargetDir ? path14.resolve(explicitTargetDir) : void 0
36512
+ cwd: explicitTargetDir ? path15.resolve(explicitTargetDir) : void 0
36035
36513
  });
36036
36514
  if (ctx.json) {
36037
36515
  writeJson(results);
@@ -36081,7 +36559,7 @@ async function runMcpVerify(parsed, ctx) {
36081
36559
  payload.explanation ? `- explanation: ${payload.explanation}` : "",
36082
36560
  payload.error ? `- error: ${payload.error}` : "",
36083
36561
  payload.stderr ? `- stderr:
36084
- ${indent2(payload.stderr)}` : "",
36562
+ ${indent3(payload.stderr)}` : "",
36085
36563
  payload.next_steps ? ["Next steps:", ...payload.next_steps.map((step, index) => `${index + 1}. ${step}`)].join(
36086
36564
  "\n"
36087
36565
  ) : "",
@@ -36089,6 +36567,65 @@ ${indent2(payload.stderr)}` : "",
36089
36567
  ].filter(Boolean).join("\n")
36090
36568
  );
36091
36569
  }
36570
+ async function runAgentsUpdate(parsed, ctx) {
36571
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
36572
+ const result = updateMakerAgentsPolicy(targetDir);
36573
+ if (ctx.json) {
36574
+ writeJson(result);
36575
+ return;
36576
+ }
36577
+ process.stdout.write(
36578
+ [
36579
+ result.changed ? "✓ AGENTS.md managed policy updated" : "✓ AGENTS.md managed policy current",
36580
+ `- path: ${result.path}`,
36581
+ `- previous_status: ${result.previousStatus}`,
36582
+ `- expected_hash: sha256:${result.expectedHash}`,
36583
+ ""
36584
+ ].join("\n")
36585
+ );
36586
+ }
36587
+ async function runUpgrade(parsed, ctx) {
36588
+ rejectPackageOption(parsed);
36589
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
36590
+ const env = makerEnvOption(parsed);
36591
+ const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
36592
+ const installResults = installMcpConfigs({
36593
+ ides: ides.length > 0 ? ides : ["codex", "cursor", "claude"],
36594
+ env,
36595
+ pkg: MAKER_NPM_PACKAGE,
36596
+ mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
36597
+ cwd: targetDir
36598
+ });
36599
+ const identify = identifyMakerProject({ cwd: targetDir });
36600
+ const agentsResult = identify.projectRoot ? updateMakerAgentsPolicy(identify.projectRoot) : void 0;
36601
+ const payload = {
36602
+ target_dir: targetDir,
36603
+ env,
36604
+ mcp_install: installResults,
36605
+ agents_policy: agentsResult,
36606
+ restart_required: true
36607
+ };
36608
+ if (ctx.json) {
36609
+ writeJson(payload);
36610
+ return;
36611
+ }
36612
+ process.stdout.write(
36613
+ [
36614
+ "TapTap Maker upgrade completed",
36615
+ "",
36616
+ ...installResults.map((result) => result.message),
36617
+ "",
36618
+ agentsResult ? [
36619
+ agentsResult.changed ? "✓ AGENTS.md managed policy updated" : "✓ AGENTS.md managed policy current",
36620
+ `- path: ${agentsResult.path}`,
36621
+ `- previous_status: ${agentsResult.previousStatus}`
36622
+ ].join("\n") : "AGENTS.md managed policy skipped: current directory is not bound to a Maker project.",
36623
+ "",
36624
+ "Restart or reconnect the AI client MCP session so the updated server and AGENTS.md are loaded.",
36625
+ ""
36626
+ ].join("\n")
36627
+ );
36628
+ }
36092
36629
  function classifyMcpVerifyFailure(result) {
36093
36630
  if (result.status === 0) {
36094
36631
  return void 0;
@@ -36134,7 +36671,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
36134
36671
  ];
36135
36672
  }
36136
36673
  async function runDevKitUpdate(parsed, ctx) {
36137
- const targetDir = path14.resolve(stringOption(parsed, "target_dir") || process.cwd());
36674
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
36138
36675
  const result = await installAiDevKit({
36139
36676
  targetDir,
36140
36677
  preserveExisting: false,
@@ -36146,7 +36683,7 @@ async function runDevKitUpdate(parsed, ctx) {
36146
36683
  emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
36147
36684
  }
36148
36685
  async function runLogsWatch(parsed, ctx) {
36149
- const targetDir = path14.resolve(stringOption(parsed, "target_dir") || process.cwd());
36686
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
36150
36687
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
36151
36688
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
36152
36689
  const maxPolls = numberOption(parsed, "max_polls");
@@ -36156,9 +36693,9 @@ async function runLogsWatch(parsed, ctx) {
36156
36693
  serverUrl: stringOption(parsed, "server_url"),
36157
36694
  env: makerEnvOption(parsed)
36158
36695
  });
36159
- const runtimeDir = path14.join(proxy.projectRoot, ".maker", "logs", "runtime");
36160
- const runtimeLog = path14.join(runtimeDir, "runtime.log");
36161
- const pidFile = path14.join(runtimeDir, "watcher.pid");
36696
+ const runtimeDir = path15.join(proxy.projectRoot, ".maker", "logs", "runtime");
36697
+ const runtimeLog = path15.join(runtimeDir, "runtime.log");
36698
+ const pidFile = path15.join(runtimeDir, "watcher.pid");
36162
36699
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
36163
36700
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
36164
36701
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -36203,10 +36740,10 @@ async function runLogsWatch(parsed, ctx) {
36203
36740
  }
36204
36741
  }
36205
36742
  function registerRuntimeLogWatcherProcess(pidFile) {
36206
- fs13.mkdirSync(path14.dirname(pidFile), { recursive: true });
36743
+ fs14.mkdirSync(path15.dirname(pidFile), { recursive: true });
36207
36744
  const existingPid = readPidFile(pidFile);
36208
36745
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
36209
- fs13.writeFileSync(
36746
+ fs14.writeFileSync(
36210
36747
  pidFile,
36211
36748
  `${JSON.stringify(
36212
36749
  {
@@ -36224,10 +36761,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
36224
36761
  return previous;
36225
36762
  }
36226
36763
  function readPidFile(pidFile) {
36227
- if (!fs13.existsSync(pidFile)) {
36764
+ if (!fs14.existsSync(pidFile)) {
36228
36765
  return void 0;
36229
36766
  }
36230
- const raw = fs13.readFileSync(pidFile, "utf8").trim();
36767
+ const raw = fs14.readFileSync(pidFile, "utf8").trim();
36231
36768
  let pid = Number(raw);
36232
36769
  if (!Number.isInteger(pid) || pid <= 0) {
36233
36770
  try {
@@ -36247,7 +36784,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
36247
36784
  }
36248
36785
  cleaned = true;
36249
36786
  if (readPidFile(pidFile) === process.pid) {
36250
- fs13.rmSync(pidFile, { force: true });
36787
+ fs14.rmSync(pidFile, { force: true });
36251
36788
  }
36252
36789
  };
36253
36790
  process.once("exit", cleanup);
@@ -36325,7 +36862,9 @@ async function resolveProjectSelection(parsed, projects, options) {
36325
36862
  for (; ; ) {
36326
36863
  process.stdout.write(`${formatMakerProjectList(orderedProjects, { showAll })}
36327
36864
  `);
36328
- const answer = await promptRequired("Choose app by index, app_id, 'new', or 'all' to show all");
36865
+ const answer = await promptRequired(
36866
+ "Choose app by index, app_id, '0'/'new' to 创建新项目 / Create a new Maker project, or 'all' to show all"
36867
+ );
36329
36868
  const normalized = answer.trim().toLowerCase();
36330
36869
  if (["a", "all"].includes(normalized)) {
36331
36870
  if (showAll) {
@@ -36396,7 +36935,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
36396
36935
  onStart: (event) => emitSkillInstallerStart(ctx, event)
36397
36936
  });
36398
36937
  writeDevKitStagedGitignore(
36399
- path14.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
36938
+ path15.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
36400
36939
  listPresentDevKitManagedEntries(targetDir)
36401
36940
  );
36402
36941
  if (options.finalizeGitignore) {
@@ -36413,7 +36952,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
36413
36952
  );
36414
36953
  } catch (error2) {
36415
36954
  writeDevKitStagedGitignore(
36416
- path14.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
36955
+ path15.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
36417
36956
  listPresentDevKitManagedEntries(targetDir)
36418
36957
  );
36419
36958
  if (options.finalizeGitignore) {
@@ -36501,23 +37040,27 @@ function installMcpConfig(ide, options) {
36501
37040
  }
36502
37041
  function installMcpConfigUnsafe(ide, options) {
36503
37042
  if (ide === "codex") {
36504
- const configPath = path14.join(os4.homedir(), ".codex", "config.toml");
36505
- mergeCodexMcpConfig(configPath, options);
37043
+ const configPath = path15.join(os4.homedir(), ".codex", "config.toml");
37044
+ const write = mergeCodexMcpConfig(configPath, options);
36506
37045
  return {
36507
37046
  ide,
36508
37047
  ok: true,
36509
37048
  path: configPath,
36510
- message: `✓ Codex MCP config updated: ${configPath}`
37049
+ changed: write.changed,
37050
+ backupPath: write.backupPath,
37051
+ message: formatMcpInstallMessage("Codex", configPath, write)
36511
37052
  };
36512
37053
  }
36513
37054
  if (ide === "cursor") {
36514
- const configPath = path14.join(os4.homedir(), ".cursor", "mcp.json");
36515
- mergeJsonMcpConfig(configPath, options);
37055
+ const configPath = path15.join(os4.homedir(), ".cursor", "mcp.json");
37056
+ const write = mergeJsonMcpConfig(configPath, options);
36516
37057
  return {
36517
37058
  ide,
36518
37059
  ok: true,
36519
37060
  path: configPath,
36520
- message: `✓ Cursor MCP config updated: ${configPath}`
37061
+ changed: write.changed,
37062
+ backupPath: write.backupPath,
37063
+ message: formatMcpInstallMessage("Cursor", configPath, write)
36521
37064
  };
36522
37065
  }
36523
37066
  if (ide === "claude") {
@@ -36527,30 +37070,29 @@ function installMcpConfigUnsafe(ide, options) {
36527
37070
  return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
36528
37071
  }
36529
37072
  }
36530
- const configPath = path14.join(os4.homedir(), ".claude.json");
36531
- mergeJsonMcpConfig(configPath, options);
37073
+ const configPath = path15.join(os4.homedir(), ".claude.json");
37074
+ const write = mergeJsonMcpConfig(configPath, options);
36532
37075
  return {
36533
37076
  ide,
36534
37077
  ok: true,
36535
37078
  path: configPath,
36536
- message: `✓ Claude fallback MCP config updated: ${configPath}`
37079
+ changed: write.changed,
37080
+ backupPath: write.backupPath,
37081
+ message: formatMcpInstallMessage("Claude fallback", configPath, write)
36537
37082
  };
36538
37083
  }
36539
37084
  return { ide, ok: false, message: `Skipped unknown IDE: ${ide}` };
36540
37085
  }
36541
37086
  function mergeJsonMcpConfig(configPath, options) {
36542
- backupIfExists(configPath);
36543
37087
  const existing = readJsonObject(configPath);
36544
37088
  const mcpServers = asObject(existing.mcpServers);
36545
37089
  mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
36546
37090
  existing.mcpServers = mcpServers;
36547
- fs13.mkdirSync(path14.dirname(configPath), { recursive: true });
36548
- fs13.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
36549
- `, "utf8");
37091
+ return writeConfigWithTapTapBackupIfChanged(configPath, `${JSON.stringify(existing, null, 2)}
37092
+ `);
36550
37093
  }
36551
37094
  function mergeCodexMcpConfig(configPath, options) {
36552
- const backupPath = backupIfExists(configPath);
36553
- const existing = fs13.existsSync(configPath) ? fs13.readFileSync(configPath, "utf8") : "";
37095
+ const existing = fs14.existsSync(configPath) ? fs14.readFileSync(configPath, "utf8") : "";
36554
37096
  const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
36555
37097
  const withoutOld = existing.replace(sectionPattern, "").trimEnd();
36556
37098
  const launch = getNpxCliCommand(options.pkg);
@@ -36564,18 +37106,20 @@ function mergeCodexMcpConfig(configPath, options) {
36564
37106
  `TAPTAP_MCP_ENV = "${options.env}"`,
36565
37107
  ""
36566
37108
  ].join("\n");
36567
- fs13.mkdirSync(path14.dirname(configPath), { recursive: true });
36568
- fs13.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
36569
- const updated = fs13.readFileSync(configPath, "utf8");
36570
- const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
36571
- if (duplicates.length > 0) {
36572
- restoreBackup(configPath, backupPath);
36573
- throw new Error(
36574
- `Codex MCP config update would create duplicate table(s): ${duplicates.join(
36575
- ", "
36576
- )}. Restored previous config.`
36577
- );
36578
- }
37109
+ return writeConfigWithTapTapBackupIfChanged(
37110
+ configPath,
37111
+ [withoutOld, section].filter(Boolean).join("\n\n"),
37112
+ (updated) => {
37113
+ const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
37114
+ if (duplicates.length > 0) {
37115
+ throw new Error(
37116
+ `Codex MCP config update would create duplicate table(s): ${duplicates.join(
37117
+ ", "
37118
+ )}. Restored previous config.`
37119
+ );
37120
+ }
37121
+ }
37122
+ );
36579
37123
  }
36580
37124
  function createCodexMcpSectionPattern(mcpName) {
36581
37125
  const keyPattern = createCodexMcpKeyPattern(mcpName);
@@ -36683,10 +37227,10 @@ function rejectPackageOption(parsed) {
36683
37227
  }
36684
37228
  }
36685
37229
  function readJsonObject(filePath) {
36686
- if (!fs13.existsSync(filePath)) {
37230
+ if (!fs14.existsSync(filePath)) {
36687
37231
  return {};
36688
37232
  }
36689
- return JSON.parse(fs13.readFileSync(filePath, "utf8"));
37233
+ return JSON.parse(fs14.readFileSync(filePath, "utf8"));
36690
37234
  }
36691
37235
  function asObject(value) {
36692
37236
  if (value && typeof value === "object" && !Array.isArray(value)) {
@@ -36694,27 +37238,44 @@ function asObject(value) {
36694
37238
  }
36695
37239
  return {};
36696
37240
  }
36697
- function backupIfExists(filePath) {
36698
- if (!fs13.existsSync(filePath)) {
36699
- return void 0;
37241
+ function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
37242
+ const existed = fs14.existsSync(filePath);
37243
+ const previousContent = existed ? fs14.readFileSync(filePath, "utf8") : void 0;
37244
+ if (previousContent === nextContent) {
37245
+ return { changed: false };
37246
+ }
37247
+ const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
37248
+ fs14.mkdirSync(path15.dirname(filePath), { recursive: true });
37249
+ if (previousContent !== void 0 && backupPath) {
37250
+ fs14.writeFileSync(backupPath, previousContent, "utf8");
37251
+ }
37252
+ try {
37253
+ fs14.writeFileSync(filePath, nextContent, "utf8");
37254
+ validate == null ? void 0 : validate(fs14.readFileSync(filePath, "utf8"));
37255
+ return { changed: true, backupPath };
37256
+ } catch (error2) {
37257
+ if (previousContent !== void 0) {
37258
+ fs14.writeFileSync(filePath, previousContent, "utf8");
37259
+ } else {
37260
+ fs14.rmSync(filePath, { force: true });
37261
+ }
37262
+ throw error2;
36700
37263
  }
36701
- const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
36702
- const backupPath = `${filePath}.bak.${stamp}`;
36703
- fs13.copyFileSync(filePath, backupPath);
36704
- return backupPath;
36705
37264
  }
36706
- function restoreBackup(filePath, backupPath) {
36707
- if (backupPath) {
36708
- fs13.copyFileSync(backupPath, filePath);
36709
- return;
37265
+ function formatMcpInstallMessage(label, configPath, write) {
37266
+ if (!write.changed) {
37267
+ return `✓ ${label} MCP config unchanged: ${configPath}`;
36710
37268
  }
36711
- fs13.rmSync(filePath, { force: true });
37269
+ return [
37270
+ `✓ ${label} MCP config updated: ${configPath}`,
37271
+ write.backupPath ? ` Backup: ${write.backupPath}` : ""
37272
+ ].filter(Boolean).join("\n");
36712
37273
  }
36713
37274
  function saveInitState(targetDir, state) {
36714
- fs13.mkdirSync(getMakerHome(), { recursive: true });
36715
- const key = crypto2.createHash("sha256").update(path14.resolve(targetDir)).digest("hex").slice(0, 16);
36716
- fs13.writeFileSync(
36717
- path14.join(getMakerHome(), `init-state-${key}.json`),
37275
+ fs14.mkdirSync(getMakerHome(), { recursive: true });
37276
+ const key = crypto3.createHash("sha256").update(path15.resolve(targetDir)).digest("hex").slice(0, 16);
37277
+ fs14.writeFileSync(
37278
+ path15.join(getMakerHome(), `init-state-${key}.json`),
36718
37279
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
36719
37280
  `,
36720
37281
  "utf8"
@@ -36753,7 +37314,7 @@ function rejectRemovedAppsPaginationOptions(parsed) {
36753
37314
  }
36754
37315
  function formatMakerProjectList(projects, options = {}) {
36755
37316
  if (projects.length === 0) {
36756
- return ["No Maker apps found.", "", "0. Create a new Maker project"].join("\n");
37317
+ return ["No Maker apps found.", "", "0,创建新项目 / 0. Create a new Maker project"].join("\n");
36757
37318
  }
36758
37319
  const sortedProjects = sortProjectsByRecentActivity(projects);
36759
37320
  const showAll = options.showAll === true;
@@ -36762,10 +37323,11 @@ function formatMakerProjectList(projects, options = {}) {
36762
37323
  return [
36763
37324
  `Maker apps (${projects.length})`,
36764
37325
  hiddenCount > 0 ? `Showing ${visibleProjects.length} most recently active apps, sorted by last activity. ${hiddenCount} more hidden. Run \`taptap-maker apps --all\` to show all, or use \`--json\` for the complete machine-readable list.` : `Showing all ${visibleProjects.length} Maker apps, sorted by last activity.`,
37326
+ "0,创建新项目 / 0. Create a new Maker project",
36765
37327
  "",
36766
37328
  ...visibleProjects.map((project, index) => formatProjectListItem(project, index)),
36767
37329
  "",
36768
- "0. Create a new Maker project"
37330
+ "0,创建新项目 / 0. Create a new Maker project"
36769
37331
  ].filter((line) => line !== "").join("\n");
36770
37332
  }
36771
37333
  function emit(ctx, step, message, data) {
@@ -36826,7 +37388,7 @@ function formatUnknownCommand(command) {
36826
37388
  return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
36827
37389
  }
36828
37390
  function isKnownSubcommand(command, subcommand) {
36829
- return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "dev-kit" && subcommand === "update" || command === "logs" && subcommand === "watch" || command === "python" && (subcommand === "doctor" || subcommand === "setup" || subcommand === "path") || command === "lua-lsp" && (subcommand === "doctor" || subcommand === "setup");
37391
+ return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "agents" && subcommand === "update" || command === "upgrade" || command === "dev-kit" && subcommand === "update" || command === "logs" && subcommand === "watch" || command === "python" && (subcommand === "doctor" || subcommand === "setup" || subcommand === "path") || command === "lua-lsp" && (subcommand === "doctor" || subcommand === "setup");
36830
37392
  }
36831
37393
  function stringOption(parsed, key) {
36832
37394
  const value = parsed.options[key];
@@ -36861,7 +37423,7 @@ function makerEnvOption(parsed) {
36861
37423
  return env;
36862
37424
  }
36863
37425
  const targetDir = stringOption(parsed, "target_dir");
36864
- return getMakerEnvironment(void 0, targetDir ? path14.resolve(targetDir) : process.cwd());
37426
+ return getMakerEnvironment(void 0, targetDir ? path15.resolve(targetDir) : process.cwd());
36865
37427
  }
36866
37428
  function mcpVerifyModeOption(parsed) {
36867
37429
  const mode = stringOption(parsed, "mode") || "npx";
@@ -36888,7 +37450,7 @@ function escapeToml(value) {
36888
37450
  function isTomlBareKey(value) {
36889
37451
  return /^[A-Za-z0-9_-]+$/.test(value);
36890
37452
  }
36891
- function indent2(value) {
37453
+ function indent3(value) {
36892
37454
  return value.split("\n").map((line) => ` ${line}`).join("\n");
36893
37455
  }
36894
37456
  function formatShellCommand(parts) {
@@ -36920,6 +37482,9 @@ function printHelp() {
36920
37482
  " taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
36921
37483
  " [--target-dir DIR] [--json]",
36922
37484
  " taptap-maker mcp verify [--mode npx|self] [--json]",
37485
+ " taptap-maker agents update [--target-dir DIR] [--json]",
37486
+ " taptap-maker upgrade [--ide codex,cursor,claude] [--env rnd|production]",
37487
+ " [--target-dir DIR] [--json]",
36923
37488
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
36924
37489
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
36925
37490
  "",
@@ -36940,6 +37505,7 @@ function formatCliError(error2) {
36940
37505
  }
36941
37506
 
36942
37507
  // src/mcp-proxy/config.ts
37508
+ var DEFAULT_TOOL_CALL_TIMEOUT_MS = 60 * 60 * 1e3;
36943
37509
  function readStdin() {
36944
37510
  return new Promise((resolve, reject) => {
36945
37511
  const chunks = [];
@@ -37063,8 +37629,7 @@ function applyDefaults(config2) {
37063
37629
  verbose,
37064
37630
  reconnect_interval: ((_b = config2.options) == null ? void 0 : _b.reconnect_interval) ?? 5e3,
37065
37631
  request_timeout: ((_c = config2.options) == null ? void 0 : _c.request_timeout) ?? 3e4,
37066
- tool_call_timeout: ((_d = config2.options) == null ? void 0 : _d.tool_call_timeout) ?? 3e5,
37067
- // 5 分钟
37632
+ tool_call_timeout: ((_d = config2.options) == null ? void 0 : _d.tool_call_timeout) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS,
37068
37633
  reset_timeout_on_progress: ((_e = config2.options) == null ? void 0 : _e.reset_timeout_on_progress) ?? true,
37069
37634
  health_check_interval: ((_f = config2.options) == null ? void 0 : _f.health_check_interval) ?? 3e4,
37070
37635
  enable_cookie_sticky: ((_g = config2.options) == null ? void 0 : _g.enable_cookie_sticky) ?? true,
@@ -37110,13 +37675,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
37110
37675
  }
37111
37676
 
37112
37677
  // node_modules/pkce-challenge/dist/index.node.js
37113
- var crypto3;
37678
+ var crypto4;
37114
37679
  var _a2;
37115
- crypto3 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
37680
+ crypto4 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
37116
37681
  globalThis.crypto ?? // Node.js >18
37117
37682
  import("node:crypto").then((m) => m.webcrypto);
37118
37683
  async function getRandomValues(size) {
37119
- return (await crypto3).getRandomValues(new Uint8Array(size));
37684
+ return (await crypto4).getRandomValues(new Uint8Array(size));
37120
37685
  }
37121
37686
  async function random(size) {
37122
37687
  const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
@@ -37132,7 +37697,7 @@ async function generateVerifier(length) {
37132
37697
  return await random(length);
37133
37698
  }
37134
37699
  async function generateChallenge(code_verifier) {
37135
- const buffer = await (await crypto3).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
37700
+ const buffer = await (await crypto4).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
37136
37701
  return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
37137
37702
  }
37138
37703
  async function pkceChallenge(length) {
@@ -38487,8 +39052,8 @@ var StreamableHTTPClientTransport = class {
38487
39052
  };
38488
39053
 
38489
39054
  // src/mcp-proxy/proxy.ts
38490
- import * as path16 from "node:path";
38491
- import * as crypto5 from "node:crypto";
39055
+ import * as path17 from "node:path";
39056
+ import * as crypto6 from "node:crypto";
38492
39057
 
38493
39058
  // src/mcp-proxy/cookieJar.ts
38494
39059
  var CookieJar = class {
@@ -38669,9 +39234,9 @@ function createCookieFetch(cookieJar) {
38669
39234
  }
38670
39235
 
38671
39236
  // src/core/utils/logWriter.ts
38672
- import * as fs14 from "node:fs";
38673
- import * as path15 from "node:path";
38674
- import * as crypto4 from "node:crypto";
39237
+ import * as fs15 from "node:fs";
39238
+ import * as path16 from "node:path";
39239
+ import * as crypto5 from "node:crypto";
38675
39240
 
38676
39241
  // src/core/types/log.ts
38677
39242
  var LOG_LEVEL_PRIORITY = {
@@ -38711,7 +39276,7 @@ var LogWriter = class {
38711
39276
  return;
38712
39277
  }
38713
39278
  try {
38714
- await fs14.promises.mkdir(this.config.logDir, { recursive: true });
39279
+ await fs15.promises.mkdir(this.config.logDir, { recursive: true });
38715
39280
  await this.cleanupOldLogs();
38716
39281
  this.initialized = true;
38717
39282
  } catch (error2) {
@@ -38734,7 +39299,7 @@ var LogWriter = class {
38734
39299
  */
38735
39300
  getLogFilePath(date5) {
38736
39301
  const d = date5 || this.getCurrentDate();
38737
- return path15.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
39302
+ return path16.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
38738
39303
  }
38739
39304
  /**
38740
39305
  * 获取或创建写入流
@@ -38749,7 +39314,7 @@ var LogWriter = class {
38749
39314
  }
38750
39315
  this.currentDate = date5;
38751
39316
  try {
38752
- this.writeStream = fs14.createWriteStream(this.getLogFilePath(date5), {
39317
+ this.writeStream = fs15.createWriteStream(this.getLogFilePath(date5), {
38753
39318
  flags: "a",
38754
39319
  encoding: "utf8"
38755
39320
  });
@@ -38801,11 +39366,11 @@ var LogWriter = class {
38801
39366
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
38802
39367
  try {
38803
39368
  const filePath = this.getLogFilePath();
38804
- const dir = path15.dirname(filePath);
38805
- if (!fs14.existsSync(dir)) {
38806
- fs14.mkdirSync(dir, { recursive: true });
39369
+ const dir = path16.dirname(filePath);
39370
+ if (!fs15.existsSync(dir)) {
39371
+ fs15.mkdirSync(dir, { recursive: true });
38807
39372
  }
38808
- fs14.appendFileSync(filePath, message, "utf8");
39373
+ fs15.appendFileSync(filePath, message, "utf8");
38809
39374
  } catch {
38810
39375
  }
38811
39376
  }
@@ -38816,7 +39381,7 @@ var LogWriter = class {
38816
39381
  async cleanupOldLogs() {
38817
39382
  if (this.config.maxDays <= 0) return;
38818
39383
  try {
38819
- const files = await fs14.promises.readdir(this.config.logDir);
39384
+ const files = await fs15.promises.readdir(this.config.logDir);
38820
39385
  const cutoffDate = /* @__PURE__ */ new Date();
38821
39386
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
38822
39387
  const prefix = this.config.prefix;
@@ -38831,7 +39396,7 @@ var LogWriter = class {
38831
39396
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
38832
39397
  const fileDate = new Date(year, month - 1, day);
38833
39398
  if (fileDate < cutoffDate) {
38834
- await fs14.promises.unlink(path15.join(this.config.logDir, file2));
39399
+ await fs15.promises.unlink(path16.join(this.config.logDir, file2));
38835
39400
  process.stderr.write(`[LogWriter] Deleted old log: ${file2}
38836
39401
  `);
38837
39402
  }
@@ -38905,10 +39470,10 @@ var TapTapMCPProxy = class {
38905
39470
  const { user_id, project_id } = this.config.tenant;
38906
39471
  let logDir;
38907
39472
  if (user_id && project_id) {
38908
- logDir = path16.join(logRoot, "proxy", user_id, project_id);
39473
+ logDir = path17.join(logRoot, "proxy", user_id, project_id);
38909
39474
  } else {
38910
- const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
38911
- logDir = path16.join(logRoot, "proxy", kidHash);
39475
+ const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
39476
+ logDir = path17.join(logRoot, "proxy", kidHash);
38912
39477
  }
38913
39478
  return new LogWriter({
38914
39479
  logDir,
@@ -39362,7 +39927,7 @@ var TapTapMCPProxy = class {
39362
39927
  void 0,
39363
39928
  // resultSchema
39364
39929
  {
39365
- timeout: ((_b = this.config.options) == null ? void 0 : _b.tool_call_timeout) ?? 3e5,
39930
+ timeout: ((_b = this.config.options) == null ? void 0 : _b.tool_call_timeout) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS,
39366
39931
  resetTimeoutOnProgress: ((_c = this.config.options) == null ? void 0 : _c.reset_timeout_on_progress) ?? true,
39367
39932
  onprogress: req.onprogress
39368
39933
  }
@@ -39448,7 +40013,7 @@ var TapTapMCPProxy = class {
39448
40013
  }
39449
40014
  const progressToken = (_c = request.params._meta) == null ? void 0 : _c.progressToken;
39450
40015
  const callToolOptions = {
39451
- timeout: ((_d = this.config.options) == null ? void 0 : _d.tool_call_timeout) ?? 3e5,
40016
+ timeout: ((_d = this.config.options) == null ? void 0 : _d.tool_call_timeout) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS,
39452
40017
  resetTimeoutOnProgress: ((_e = this.config.options) == null ? void 0 : _e.reset_timeout_on_progress) ?? true
39453
40018
  };
39454
40019
  const forceInjectProgressToken = ((_f = this.config.options) == null ? void 0 : _f.force_inject_progress_token) ?? false;
@@ -39580,10 +40145,14 @@ function printHelp2() {
39580
40145
  " taptap-maker pat set [--pat-stdin] [--json]",
39581
40146
  " taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
39582
40147
  " taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
40148
+ " [--target-dir DIR]",
39583
40149
  " [--json] # alias for mcp install",
39584
40150
  " taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
39585
- " [--json]",
40151
+ " [--target-dir DIR] [--json]",
39586
40152
  " taptap-maker mcp verify [--mode npx|self] [--json]",
40153
+ " taptap-maker agents update [--target-dir DIR] [--json]",
40154
+ " taptap-maker upgrade [--ide codex,cursor,claude] [--env rnd|production]",
40155
+ " [--target-dir DIR] [--json]",
39587
40156
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
39588
40157
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
39589
40158
  "",