@taptap/maker 0.0.18 → 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,68 +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 should prefer Maker MCP proxy tools when they are available:",
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
- "- `query_video_task` for refreshing video task status and fetching completed videos.",
29447
- "- `text_to_music` for game music or audio assets.",
29448
- "",
29449
- "Follow each Maker tool schema for supported local path, remote URL, and data URL inputs.",
29450
- "If the user references attached/local media, inspect the attachment or workspace file path",
29451
- "before calling the tool. Local proxy may convert resolvable local reference media to data URLs",
29452
- "before forwarding to the remote Maker MCP server.",
29453
- "",
29454
- "If the required Maker proxy tool is not exposed in the current AI session, explain that the",
29455
- "Maker proxy tool is unavailable and suggest checking/reconnecting the Maker MCP session.",
29456
- "Other client media tools may still be usable when their output is passed back through a supported",
29457
- "local path, remote URL, or data URL input.",
29458
- "",
29459
- "Generated Maker proxy assets should stay in the Maker project asset workflow under",
29460
- "`assets/image`, `assets/video`, or `assets/audio`, with remote mappings preserved for later",
29461
- "edits and builds.",
29462
- "",
29463
- MAKER_ASSET_POLICY_END
29464
- ].join("\n");
29535
+ updateMakerAgentsPolicy(targetDir);
29536
+ return [MAKER_AGENTS_FILE];
29465
29537
  }
29466
29538
  function mergeDevKitGitignoreBlock(gitignorePath, block) {
29467
- const existing = fs5.existsSync(gitignorePath) ? fs5.readFileSync(gitignorePath, "utf8") : "";
29539
+ const existing = fs6.existsSync(gitignorePath) ? fs6.readFileSync(gitignorePath, "utf8") : "";
29468
29540
  const withoutOldBlock = existing.replace(
29469
29541
  new RegExp(
29470
29542
  `${escapeRegExp(DEV_KIT_IGNORE_BEGIN)}[\\s\\S]*?${escapeRegExp(DEV_KIT_IGNORE_END)}\\n?`,
@@ -29473,38 +29545,38 @@ function mergeDevKitGitignoreBlock(gitignorePath, block) {
29473
29545
  ""
29474
29546
  ).trimEnd();
29475
29547
  const next = [withoutOldBlock, block, ""].filter((part) => part.length > 0).join("\n\n");
29476
- fs5.writeFileSync(gitignorePath, next, "utf8");
29548
+ fs6.writeFileSync(gitignorePath, next, "utf8");
29477
29549
  }
29478
29550
  function finalizeStagedDevKitGitignore(targetDir) {
29479
- const stagedGitignorePath = path6.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
29480
- if (!fs5.existsSync(stagedGitignorePath)) {
29551
+ const stagedGitignorePath = path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
29552
+ if (!fs6.existsSync(stagedGitignorePath)) {
29481
29553
  return false;
29482
29554
  }
29483
- const block = fs5.readFileSync(stagedGitignorePath, "utf8").trim();
29555
+ const block = fs6.readFileSync(stagedGitignorePath, "utf8").trim();
29484
29556
  if (block.length > 0) {
29485
- mergeDevKitGitignoreBlock(path6.join(targetDir, ".gitignore"), block);
29557
+ mergeDevKitGitignoreBlock(path7.join(targetDir, ".gitignore"), block);
29486
29558
  }
29487
- fs5.rmSync(stagedGitignorePath, { force: true });
29559
+ fs6.rmSync(stagedGitignorePath, { force: true });
29488
29560
  return true;
29489
29561
  }
29490
29562
  function copyEntry(source, target, options = {}) {
29491
- const stat = fs5.statSync(source);
29563
+ const stat = fs6.statSync(source);
29492
29564
  if (stat.isDirectory()) {
29493
- fs5.mkdirSync(target, { recursive: true });
29494
- for (const child of fs5.readdirSync(source)) {
29565
+ fs6.mkdirSync(target, { recursive: true });
29566
+ for (const child of fs6.readdirSync(source)) {
29495
29567
  if (child === ".DS_Store") {
29496
29568
  continue;
29497
29569
  }
29498
- copyEntry(path6.join(source, child), path6.join(target, child), options);
29570
+ copyEntry(path7.join(source, child), path7.join(target, child), options);
29499
29571
  }
29500
29572
  return;
29501
29573
  }
29502
29574
  if (stat.isFile()) {
29503
- if (options.preserveExisting && fs5.existsSync(target)) {
29575
+ if (options.preserveExisting && fs6.existsSync(target)) {
29504
29576
  return;
29505
29577
  }
29506
- fs5.mkdirSync(path6.dirname(target), { recursive: true });
29507
- fs5.copyFileSync(source, target);
29578
+ fs6.mkdirSync(path7.dirname(target), { recursive: true });
29579
+ fs6.copyFileSync(source, target);
29508
29580
  }
29509
29581
  }
29510
29582
  function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
@@ -29514,11 +29586,11 @@ function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
29514
29586
  candidates.add(entry);
29515
29587
  }
29516
29588
  }
29517
- for (const entry of readManagedGitignoreEntries(path6.join(targetDir, ".gitignore"))) {
29589
+ for (const entry of readManagedGitignoreEntries(path7.join(targetDir, ".gitignore"))) {
29518
29590
  candidates.add(entry);
29519
29591
  }
29520
29592
  for (const entry of readManagedGitignoreEntries(
29521
- path6.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE)
29593
+ path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE)
29522
29594
  )) {
29523
29595
  candidates.add(entry);
29524
29596
  }
@@ -29529,14 +29601,14 @@ function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
29529
29601
  if (!DEV_KIT_MANAGED_ENTRY_CANDIDATES.includes(entry)) {
29530
29602
  continue;
29531
29603
  }
29532
- fs5.rmSync(path6.join(targetDir, entry), { recursive: true, force: true });
29604
+ fs6.rmSync(path7.join(targetDir, entry), { recursive: true, force: true });
29533
29605
  }
29534
29606
  }
29535
29607
  function readManagedGitignoreEntries(gitignorePath) {
29536
- if (!fs5.existsSync(gitignorePath)) {
29608
+ if (!fs6.existsSync(gitignorePath)) {
29537
29609
  return [];
29538
29610
  }
29539
- const content = fs5.readFileSync(gitignorePath, "utf8");
29611
+ const content = fs6.readFileSync(gitignorePath, "utf8");
29540
29612
  const blockPattern = new RegExp(
29541
29613
  `${escapeRegExp(DEV_KIT_IGNORE_BEGIN)}\\n([\\s\\S]*?)\\n${escapeRegExp(DEV_KIT_IGNORE_END)}`,
29542
29614
  "g"
@@ -29555,8 +29627,8 @@ function readManagedGitignoreEntries(gitignorePath) {
29555
29627
  }
29556
29628
  function installAiDevKitSkills(targetDir, options = {}) {
29557
29629
  var _a3;
29558
- const toolsDir = path6.join(targetDir, "tools");
29559
- if (!fs5.existsSync(toolsDir) || !fs5.statSync(toolsDir).isDirectory()) {
29630
+ const toolsDir = path7.join(targetDir, "tools");
29631
+ if (!fs6.existsSync(toolsDir) || !fs6.statSync(toolsDir).isDirectory()) {
29560
29632
  return {
29561
29633
  ok: false,
29562
29634
  status: "skipped",
@@ -29568,8 +29640,8 @@ function installAiDevKitSkills(targetDir, options = {}) {
29568
29640
  }
29569
29641
  const isWindows = process.platform === "win32";
29570
29642
  const scriptName = isWindows ? "install-skills.ps1" : "install-skills.sh";
29571
- const scriptPath = path6.join(toolsDir, scriptName);
29572
- if (!fs5.existsSync(scriptPath)) {
29643
+ const scriptPath = path7.join(toolsDir, scriptName);
29644
+ if (!fs6.existsSync(scriptPath)) {
29573
29645
  return {
29574
29646
  ok: false,
29575
29647
  status: "skipped",
@@ -29631,7 +29703,7 @@ function runDevKitSkillInstallerForInstall(targetDir, options = {}) {
29631
29703
  }
29632
29704
  function listPresentSkillInstallerOutputEntries(targetDir) {
29633
29705
  return SKILL_INSTALLER_OUTPUT_ENTRIES.filter(
29634
- (entry) => fs5.existsSync(path6.join(targetDir, entry))
29706
+ (entry) => fs6.existsSync(path7.join(targetDir, entry))
29635
29707
  );
29636
29708
  }
29637
29709
  function getAiDevKitVersionsUrl(environment) {
@@ -29663,19 +29735,19 @@ function writeResolvedDevKitVersionMetadata(targetDir, environment, sourceUrl, c
29663
29735
  return metadata;
29664
29736
  }
29665
29737
  async function downloadAndExtractDevKit(url2, fetchImpl = fetch, timeoutMs = DEFAULT_DOWNLOAD_FETCH_TIMEOUT_MS) {
29666
- const tempDir = fs5.mkdtempSync(path6.join(os3.tmpdir(), "taptap-maker-ai-dev-kit-"));
29667
- 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");
29668
29740
  const response = await fetchWithTimeout(fetchImpl, url2, {}, timeoutMs, "AI dev kit download");
29669
29741
  if (!response.ok) {
29670
29742
  throw new Error(`AI dev kit download failed: HTTP ${response.status} ${response.statusText}`);
29671
29743
  }
29672
29744
  const payload = Buffer.from(await response.arrayBuffer());
29673
- fs5.writeFileSync(zipPath, payload);
29745
+ fs6.writeFileSync(zipPath, payload);
29674
29746
  extractZip(zipPath, tempDir);
29675
- fs5.rmSync(zipPath, { force: true });
29747
+ fs6.rmSync(zipPath, { force: true });
29676
29748
  return tempDir;
29677
29749
  }
29678
- function extractZip(zipPath, targetDir) {
29750
+ function extractZip(zipPath, targetDir, label = "AI dev kit") {
29679
29751
  if (process.platform === "win32") {
29680
29752
  const result = spawnSync2(
29681
29753
  "powershell.exe",
@@ -29692,11 +29764,11 @@ function extractZip(zipPath, targetDir) {
29692
29764
  { encoding: "utf8" }
29693
29765
  );
29694
29766
  if (result.status !== 0) {
29695
- throw new Error(`Failed to extract AI dev kit zip: ${formatSpawnFailure(result)}`);
29767
+ throw new Error(`Failed to extract ${label} zip: ${formatSpawnFailure(result)}`);
29696
29768
  }
29697
29769
  return;
29698
29770
  }
29699
- const unzipResult = spawnSync2("unzip", ["-q", zipPath, "-d", targetDir], { encoding: "utf8" });
29771
+ const unzipResult = spawnSync2("unzip", ["-oq", zipPath, "-d", targetDir], { encoding: "utf8" });
29700
29772
  if (unzipResult.status === 0) {
29701
29773
  return;
29702
29774
  }
@@ -29714,7 +29786,7 @@ function extractZip(zipPath, targetDir) {
29714
29786
  }
29715
29787
  throw new Error(
29716
29788
  [
29717
- `Failed to extract AI dev kit zip: unzip: ${formatSpawnFailure(unzipResult)}`,
29789
+ `Failed to extract ${label} zip: unzip: ${formatSpawnFailure(unzipResult)}`,
29718
29790
  ...pythonFailures
29719
29791
  ].join("; ")
29720
29792
  );
@@ -29800,11 +29872,11 @@ function shellQuote(value) {
29800
29872
  return `'${value.replace(/'/g, "'\\''")}'`;
29801
29873
  }
29802
29874
  function resolveDevKitRoot(sourceDir) {
29803
- const directEntries = fs5.existsSync(sourceDir) ? fs5.readdirSync(sourceDir) : [];
29875
+ const directEntries = fs6.existsSync(sourceDir) ? fs6.readdirSync(sourceDir) : [];
29804
29876
  if (looksLikeDevKitRoot(sourceDir)) {
29805
29877
  return sourceDir;
29806
29878
  }
29807
- 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());
29808
29880
  for (const childDir of childDirs) {
29809
29881
  if (looksLikeDevKitRoot(childDir)) {
29810
29882
  return childDir;
@@ -29813,7 +29885,7 @@ function resolveDevKitRoot(sourceDir) {
29813
29885
  throw new Error(`AI dev kit root not found under ${sourceDir}`);
29814
29886
  }
29815
29887
  function looksLikeDevKitRoot(dir) {
29816
- 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"));
29817
29889
  }
29818
29890
  function formatIgnoreEntry(entry) {
29819
29891
  if (entry === ".DS_Store") {
@@ -29929,9 +30001,38 @@ async function listMakerProjects(options) {
29929
30001
  }
29930
30002
  return normalizeProjectsResponse(json2);
29931
30003
  }
30004
+ async function createMakerProject(options) {
30005
+ const name = options.name.trim();
30006
+ if (!name) {
30007
+ throw new Error("Maker project name is required.");
30008
+ }
30009
+ const response = await fetch(`${getMakerApiBase()}/apps`, {
30010
+ method: "POST",
30011
+ headers: {
30012
+ Authorization: `Bearer ${options.pat}`,
30013
+ Accept: "application/json",
30014
+ "Content-Type": "application/json"
30015
+ },
30016
+ body: JSON.stringify({
30017
+ name,
30018
+ gameType: options.gameType || "sce"
30019
+ })
30020
+ });
30021
+ const json2 = await response.json();
30022
+ if (!response.ok) {
30023
+ throw new Error(`Maker project create failed: HTTP ${response.status} ${JSON.stringify(json2)}`);
30024
+ }
30025
+ const body = json2;
30026
+ const projects = normalizeProjectsResponse(body.app ? { apps: [body.app] } : json2);
30027
+ const project = projects[0];
30028
+ if (!(project == null ? void 0 : project.id)) {
30029
+ throw new Error(`Maker project create returned no app id: ${JSON.stringify(json2)}`);
30030
+ }
30031
+ return project;
30032
+ }
29932
30033
  async function cloneMakerProject(options) {
29933
30034
  var _a3, _b, _c, _d, _e, _f, _g, _h;
29934
- const target = path7.resolve(options.targetDir);
30035
+ const target = path8.resolve(options.targetDir);
29935
30036
  ensureTargetCanBindApp(target, options.appId);
29936
30037
  const warnings = createPreCloneWarnings(target);
29937
30038
  (_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
@@ -30097,7 +30198,7 @@ async function pushMakerProject(options) {
30097
30198
  phase: "prepare",
30098
30199
  message: "Preparing Maker project push"
30099
30200
  });
30100
- const requestedCwd = path7.resolve(options.cwd);
30201
+ const requestedCwd = path8.resolve(options.cwd);
30101
30202
  const workspace = resolveUsableMakerGitWorkspace(requestedCwd);
30102
30203
  const cwd = workspace.projectRoot;
30103
30204
  const project = loadProjectConfig(cwd);
@@ -30728,7 +30829,7 @@ function makeAuthenticatedGitUrl(gitUrl, pat) {
30728
30829
  return gitUrl.replace(/^https:\/\//, `https://git:${encodeURIComponent(pat)}@`);
30729
30830
  }
30730
30831
  async function fetchAndCheckoutTarget(target, authUrl, pat, onProgress) {
30731
- if (fs6.existsSync(target) && hasDirectoryEntries(target)) {
30832
+ if (fs7.existsSync(target) && hasDirectoryEntries(target)) {
30732
30833
  onProgress == null ? void 0 : onProgress({
30733
30834
  progress: 10,
30734
30835
  total: 100,
@@ -30775,23 +30876,23 @@ function emitFirstCloneWaitNotice(onProgress, phase) {
30775
30876
  });
30776
30877
  }
30777
30878
  function hasDirectoryEntries(target) {
30778
- if (!fs6.existsSync(target)) {
30879
+ if (!fs7.existsSync(target)) {
30779
30880
  return false;
30780
30881
  }
30781
- return fs6.readdirSync(target).length > 0;
30882
+ return fs7.readdirSync(target).length > 0;
30782
30883
  }
30783
30884
  function listLocalFiles(root) {
30784
- if (!fs6.existsSync(root)) {
30885
+ if (!fs7.existsSync(root)) {
30785
30886
  return [];
30786
30887
  }
30787
30888
  const files = [];
30788
30889
  const visit = (dir, relativeDir) => {
30789
- for (const entry of fs6.readdirSync(dir, { withFileTypes: true })) {
30890
+ for (const entry of fs7.readdirSync(dir, { withFileTypes: true })) {
30790
30891
  const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
30791
30892
  if (entry.name === ".git" || relativePath === ".maker-mcp" || relativePath.startsWith(".maker-mcp/") || entry.name === ".DS_Store") {
30792
30893
  continue;
30793
30894
  }
30794
- const fullPath = path7.join(dir, entry.name);
30895
+ const fullPath = path8.join(dir, entry.name);
30795
30896
  if (entry.isDirectory()) {
30796
30897
  visit(fullPath, relativePath);
30797
30898
  continue;
@@ -30805,10 +30906,10 @@ function listLocalFiles(root) {
30805
30906
  return files;
30806
30907
  }
30807
30908
  function listPreCloneNoticeFiles(root) {
30808
- if (!fs6.existsSync(root)) {
30909
+ if (!fs7.existsSync(root)) {
30809
30910
  return [];
30810
30911
  }
30811
- 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();
30812
30913
  }
30813
30914
  function createPreCloneWarnings(target) {
30814
30915
  const preCloneLocalFiles = listPreCloneNoticeFiles(target);
@@ -30931,7 +31032,7 @@ function ensureOwnGitRoot(repoDir) {
30931
31032
  );
30932
31033
  }
30933
31034
  function inspectMakerDirectoryGitStatus(cwd) {
30934
- const targetDir = path7.resolve(cwd);
31035
+ const targetDir = path8.resolve(cwd);
30935
31036
  const gitRoot = resolveGitRoot(targetDir);
30936
31037
  const gitDir = resolveGitDir(targetDir);
30937
31038
  const makerBinding = findMakerProjectBinding(targetDir);
@@ -31004,16 +31105,16 @@ function formatMakerGitRootMismatch(status) {
31004
31105
  }
31005
31106
  function findMakerProjectBinding(startDir) {
31006
31107
  var _a3;
31007
- let current = path7.resolve(startDir);
31108
+ let current = path8.resolve(startDir);
31008
31109
  while (current.length > 0) {
31009
31110
  const configPath = getProjectConfigPath(current);
31010
- 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)) {
31011
31112
  return {
31012
31113
  projectRoot: current,
31013
31114
  configPath
31014
31115
  };
31015
31116
  }
31016
- const parent = path7.dirname(current);
31117
+ const parent = path8.dirname(current);
31017
31118
  if (parent === current) {
31018
31119
  return null;
31019
31120
  }
@@ -31023,7 +31124,7 @@ function findMakerProjectBinding(startDir) {
31023
31124
  }
31024
31125
  function resolveGitRoot(cwd) {
31025
31126
  try {
31026
- return path7.resolve(readGitSync(["-C", cwd, "rev-parse", "--show-toplevel"]).trim());
31127
+ return path8.resolve(readGitSync(["-C", cwd, "rev-parse", "--show-toplevel"]).trim());
31027
31128
  } catch {
31028
31129
  return void 0;
31029
31130
  }
@@ -31031,7 +31132,7 @@ function resolveGitRoot(cwd) {
31031
31132
  function resolveGitDir(cwd) {
31032
31133
  try {
31033
31134
  const gitDir = readGitSync(["-C", cwd, "rev-parse", "--git-dir"]).trim();
31034
- return path7.isAbsolute(gitDir) ? path7.resolve(gitDir) : path7.resolve(cwd, gitDir);
31135
+ return path8.isAbsolute(gitDir) ? path8.resolve(gitDir) : path8.resolve(cwd, gitDir);
31035
31136
  } catch {
31036
31137
  return void 0;
31037
31138
  }
@@ -31040,9 +31141,9 @@ function samePath(left, right) {
31040
31141
  return normalizePathForCompare(left) === normalizePathForCompare(right);
31041
31142
  }
31042
31143
  function normalizePathForCompare(value) {
31043
- const resolved = path7.resolve(value);
31144
+ const resolved = path8.resolve(value);
31044
31145
  try {
31045
- return fs6.realpathSync.native(resolved);
31146
+ return fs7.realpathSync.native(resolved);
31046
31147
  } catch {
31047
31148
  return resolved;
31048
31149
  }
@@ -31408,8 +31509,8 @@ async function requestTapAuthWithPat(manualPat, environment, options = {}) {
31408
31509
 
31409
31510
  // src/maker/system/python.ts
31410
31511
  import { spawnSync as spawnSync4 } from "node:child_process";
31411
- import fs7 from "node:fs";
31412
- import path8 from "node:path";
31512
+ import fs8 from "node:fs";
31513
+ import path9 from "node:path";
31413
31514
  var PYTHON_INFO_SCRIPT = [
31414
31515
  "import json, sys",
31415
31516
  'print(json.dumps({"executable": sys.executable, "version": ".".join(map(str, sys.version_info[:3]))}))'
@@ -31418,16 +31519,16 @@ var DEFAULT_PYTHON_VERSION = "3.12";
31418
31519
  var MINIMUM_PYTHON_VERSION = "3.8";
31419
31520
  var RECOMMENDED_PYTHON_VERSION = "3.12";
31420
31521
  function getMakerPythonConfigPath() {
31421
- return path8.join(getMakerHome(), "python.json");
31522
+ return path9.join(getMakerHome(), "python.json");
31422
31523
  }
31423
31524
  function getMakerUvInstallRoot() {
31424
- return path8.join(getMakerHome(), "bin");
31525
+ return path9.join(getMakerHome(), "bin");
31425
31526
  }
31426
31527
  function getMakerUvPath(platform = process.platform) {
31427
- return path8.join(getMakerUvInstallRoot(), platform === "win32" ? "uv.exe" : "uv");
31528
+ return path9.join(getMakerUvInstallRoot(), platform === "win32" ? "uv.exe" : "uv");
31428
31529
  }
31429
31530
  function getMakerUvPythonInstallDir() {
31430
- return path8.join(getMakerHome(), "python", "uv");
31531
+ return path9.join(getMakerHome(), "python", "uv");
31431
31532
  }
31432
31533
  function checkMakerPythonEnvironment(options = {}) {
31433
31534
  const platform = options.platform || process.platform;
@@ -31443,7 +31544,7 @@ function checkMakerPythonEnvironment(options = {}) {
31443
31544
  pathCommand,
31444
31545
  uv: {
31445
31546
  path: uvPath,
31446
- installed: fs7.existsSync(uvPath),
31547
+ installed: fs8.existsSync(uvPath),
31447
31548
  version: readUvVersion(uvPath, runner)
31448
31549
  }
31449
31550
  };
@@ -31665,10 +31766,10 @@ function resultToEnvironment(result, base) {
31665
31766
  }
31666
31767
  function ensureUvInstalled(platform, runner) {
31667
31768
  const uvPath = getMakerUvPath(platform);
31668
- if (fs7.existsSync(uvPath)) {
31769
+ if (fs8.existsSync(uvPath)) {
31669
31770
  return uvPath;
31670
31771
  }
31671
- fs7.mkdirSync(getMakerUvInstallRoot(), { recursive: true });
31772
+ fs8.mkdirSync(getMakerUvInstallRoot(), { recursive: true });
31672
31773
  const env = {
31673
31774
  ...process.env,
31674
31775
  INSTALLER_NO_MODIFY_PATH: "1",
@@ -31691,13 +31792,13 @@ function ensureUvInstalled(platform, runner) {
31691
31792
  if (install.status !== 0) {
31692
31793
  throw new Error(formatSetupFailure("uv installer failed", install));
31693
31794
  }
31694
- if (!fs7.existsSync(uvPath)) {
31695
- const nestedUvPath = path8.join(
31795
+ if (!fs8.existsSync(uvPath)) {
31796
+ const nestedUvPath = path9.join(
31696
31797
  getMakerUvInstallRoot(),
31697
31798
  "bin",
31698
31799
  platform === "win32" ? "uv.exe" : "uv"
31699
31800
  );
31700
- if (fs7.existsSync(nestedUvPath)) {
31801
+ if (fs8.existsSync(nestedUvPath)) {
31701
31802
  return nestedUvPath;
31702
31803
  }
31703
31804
  throw new Error(`uv installer finished, but ${uvPath} was not created.`);
@@ -31708,11 +31809,11 @@ function createUvPythonEnv() {
31708
31809
  return {
31709
31810
  ...process.env,
31710
31811
  UV_PYTHON_INSTALL_DIR: getMakerUvPythonInstallDir(),
31711
- UV_CACHE_DIR: path8.join(getMakerHome(), "cache", "uv")
31812
+ UV_CACHE_DIR: path9.join(getMakerHome(), "cache", "uv")
31712
31813
  };
31713
31814
  }
31714
31815
  function readUvVersion(uvPath, runner) {
31715
- if (!fs7.existsSync(uvPath)) {
31816
+ if (!fs8.existsSync(uvPath)) {
31716
31817
  return void 0;
31717
31818
  }
31718
31819
  const result = runner(uvPath, ["--version"], { encoding: "utf8" });
@@ -31765,11 +31866,11 @@ function parseVersionTuple(version2) {
31765
31866
  }
31766
31867
  function loadPythonRuntimeConfig() {
31767
31868
  const configPath = getMakerPythonConfigPath();
31768
- if (!fs7.existsSync(configPath)) {
31869
+ if (!fs8.existsSync(configPath)) {
31769
31870
  return void 0;
31770
31871
  }
31771
31872
  try {
31772
- const data = JSON.parse(fs7.readFileSync(configPath, "utf8"));
31873
+ const data = JSON.parse(fs8.readFileSync(configPath, "utf8"));
31773
31874
  if (typeof data.python === "string" || data.status === "setup_failed") {
31774
31875
  return data;
31775
31876
  }
@@ -31788,8 +31889,8 @@ function savePythonRuntimeConfig(environment) {
31788
31889
  version: environment.version,
31789
31890
  saved_at: (/* @__PURE__ */ new Date()).toISOString()
31790
31891
  };
31791
- fs7.mkdirSync(path8.dirname(getMakerPythonConfigPath()), { recursive: true });
31792
- 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");
31793
31894
  }
31794
31895
  function savePythonSetupFailure(error2) {
31795
31896
  const config2 = {
@@ -31797,8 +31898,8 @@ function savePythonSetupFailure(error2) {
31797
31898
  error: error2 instanceof Error ? error2.message : String(error2),
31798
31899
  saved_at: (/* @__PURE__ */ new Date()).toISOString()
31799
31900
  };
31800
- fs7.mkdirSync(path8.dirname(getMakerPythonConfigPath()), { recursive: true });
31801
- 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");
31802
31903
  }
31803
31904
  function formatSetupFailure(message, result) {
31804
31905
  var _a3, _b, _c;
@@ -31813,8 +31914,8 @@ function formatSetupFailure(message, result) {
31813
31914
 
31814
31915
  // src/maker/system/luaLsp.ts
31815
31916
  import { spawnSync as spawnSync5 } from "node:child_process";
31816
- import fs8 from "node:fs";
31817
- import path9 from "node:path";
31917
+ import fs9 from "node:fs";
31918
+ import path10 from "node:path";
31818
31919
  var LUA_LSP_PACKAGE = "maker-lua-lsp";
31819
31920
  var LUA_LSP_IDES = "codex,cursor,claude";
31820
31921
  var LUA_LSP_SETUP_TIMEOUT_MS = 12e4;
@@ -31824,10 +31925,10 @@ var PYTHON_SCRIPTS_DIR_SCRIPT = [
31824
31925
  'print(sysconfig.get_path("scripts") or "")'
31825
31926
  ].join("; ");
31826
31927
  function getMakerLuaLspConfigPath() {
31827
- return path9.join(getMakerHome(), "lua-lsp.json");
31928
+ return path10.join(getMakerHome(), "lua-lsp.json");
31828
31929
  }
31829
31930
  function getMakerLuaLspVenvDir() {
31830
- return path9.join(getMakerHome(), "lua-lsp-venv");
31931
+ return path10.join(getMakerHome(), "lua-lsp-venv");
31831
31932
  }
31832
31933
  function checkMakerLuaLspEnvironment(options = {}) {
31833
31934
  const runner = options.spawn || spawnSync5;
@@ -31855,7 +31956,7 @@ function checkMakerLuaLspEnvironment(options = {}) {
31855
31956
  command: saved.command,
31856
31957
  version: version3,
31857
31958
  python: saved.python || python.python,
31858
- scriptsDir: path9.dirname(saved.command),
31959
+ scriptsDir: path10.dirname(saved.command),
31859
31960
  missing: [],
31860
31961
  nextAction: "maker-lua-lsp 已安装;本地 Lua 诊断可用。"
31861
31962
  };
@@ -32032,16 +32133,16 @@ function createLuaLspBase(platform) {
32032
32133
  }
32033
32134
  function resolveLuaLspCommand(python, platform, runner) {
32034
32135
  const venvCommand = getLuaLspVenvCommand(platform);
32035
- if (fs8.existsSync(venvCommand)) {
32036
- return { command: venvCommand, scriptsDir: path9.dirname(venvCommand) };
32136
+ if (fs9.existsSync(venvCommand)) {
32137
+ return { command: venvCommand, scriptsDir: path10.dirname(venvCommand) };
32037
32138
  }
32038
32139
  const scriptsDir = readPythonScriptsDir(python.python, runner);
32039
32140
  if (scriptsDir) {
32040
- const command = path9.join(
32141
+ const command = path10.join(
32041
32142
  scriptsDir,
32042
32143
  platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
32043
32144
  );
32044
- if (fs8.existsSync(command)) {
32145
+ if (fs9.existsSync(command)) {
32045
32146
  return { command, scriptsDir };
32046
32147
  }
32047
32148
  return { scriptsDir };
@@ -32065,23 +32166,23 @@ function ensureLuaLspVenv(python, platform, runner) {
32065
32166
  return { python: venvPython, scriptsDir, command };
32066
32167
  }
32067
32168
  function isLuaLspVenvComplete(platform) {
32068
- return fs8.existsSync(getLuaLspVenvPython(platform)) && fs8.existsSync(getLuaLspVenvConfigPath());
32169
+ return fs9.existsSync(getLuaLspVenvPython(platform)) && fs9.existsSync(getLuaLspVenvConfigPath());
32069
32170
  }
32070
32171
  function getLuaLspVenvConfigPath() {
32071
- return path9.join(getMakerLuaLspVenvDir(), "pyvenv.cfg");
32172
+ return path10.join(getMakerLuaLspVenvDir(), "pyvenv.cfg");
32072
32173
  }
32073
32174
  function getLuaLspVenvPython(platform) {
32074
- return path9.join(
32175
+ return path10.join(
32075
32176
  getMakerLuaLspVenvDir(),
32076
32177
  platform === "win32" ? "Scripts" : "bin",
32077
32178
  platform === "win32" ? "python.exe" : "python"
32078
32179
  );
32079
32180
  }
32080
32181
  function getLuaLspVenvScriptsDir(platform) {
32081
- return path9.join(getMakerLuaLspVenvDir(), platform === "win32" ? "Scripts" : "bin");
32182
+ return path10.join(getMakerLuaLspVenvDir(), platform === "win32" ? "Scripts" : "bin");
32082
32183
  }
32083
32184
  function getLuaLspVenvCommand(platform) {
32084
- return path9.join(
32185
+ return path10.join(
32085
32186
  getLuaLspVenvScriptsDir(platform),
32086
32187
  platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
32087
32188
  );
@@ -32129,11 +32230,11 @@ function formatLuaLspSetupFailure(platform, python, message, result, command, sc
32129
32230
  }
32130
32231
  function loadLuaLspRuntimeConfig() {
32131
32232
  const configPath = getMakerLuaLspConfigPath();
32132
- if (!fs8.existsSync(configPath)) {
32233
+ if (!fs9.existsSync(configPath)) {
32133
32234
  return void 0;
32134
32235
  }
32135
32236
  try {
32136
- return JSON.parse(fs8.readFileSync(configPath, "utf8"));
32237
+ return JSON.parse(fs9.readFileSync(configPath, "utf8"));
32137
32238
  } catch {
32138
32239
  return void 0;
32139
32240
  }
@@ -32146,13 +32247,13 @@ function saveLuaLspRuntimeConfig(environment) {
32146
32247
  error: environment.error,
32147
32248
  saved_at: (/* @__PURE__ */ new Date()).toISOString()
32148
32249
  };
32149
- fs8.mkdirSync(path9.dirname(getMakerLuaLspConfigPath()), { recursive: true });
32150
- 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");
32151
32252
  }
32152
32253
 
32153
32254
  // src/maker/cli/skill.ts
32154
- import fs9 from "node:fs";
32155
- import path10 from "node:path";
32255
+ import fs10 from "node:fs";
32256
+ import path11 from "node:path";
32156
32257
  import { fileURLToPath } from "node:url";
32157
32258
  var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
32158
32259
  var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
@@ -32171,7 +32272,7 @@ var BUNDLED_SKILLS = [
32171
32272
  function formatMakerSkillStatus(_options = {}) {
32172
32273
  const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
32173
32274
  name: skill.name,
32174
- path: path10.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
32275
+ path: path11.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
32175
32276
  }));
32176
32277
  return [
32177
32278
  "TapTap Maker workflow guide documents",
@@ -32192,20 +32293,23 @@ function formatMakerSkillStatus(_options = {}) {
32192
32293
  "- If Maker proxy tools are missing, explain the session/configuration issue and available alternatives.",
32193
32294
  "- Use generate_image, batch_generate_images, edit_image for game image assets.",
32194
32295
  "- Use create_video_task, query_video_task, and text_to_music for game video/audio assets.",
32195
- "- Generated assets are saved under assets/image, assets/video, or assets/audio with remote mappings.",
32296
+ "- Use create_3d_model_task and query_3d_model_task for game 3D model assets.",
32297
+ "- Generated assets are saved under assets/image, assets/video, assets/audio, or assets/model with remote mappings.",
32196
32298
  "- Follow each tool schema for supported local path, remote URL, and data URL inputs.",
32197
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.",
32198
32302
  "Maker initialization next_step: execute `taptap-maker init`.",
32199
32303
  "Load these documents when the current AI client supports reading local guide files."
32200
32304
  ].join("\n");
32201
32305
  }
32202
32306
  function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
32203
32307
  const candidates = [
32204
- path10.join(process.cwd(), "skills", skillName),
32308
+ path11.join(process.cwd(), "skills", skillName),
32205
32309
  getBundledSkillSourceDir(skillName)
32206
32310
  ].filter(Boolean);
32207
32311
  for (const candidate of candidates) {
32208
- if (fs9.existsSync(path10.join(candidate, "SKILL.md"))) {
32312
+ if (fs10.existsSync(path11.join(candidate, "SKILL.md"))) {
32209
32313
  return candidate;
32210
32314
  }
32211
32315
  }
@@ -32218,13 +32322,13 @@ function getBundledSkillSourceDir(skillName) {
32218
32322
  return null;
32219
32323
  }
32220
32324
  const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
32221
- const packageRoot = path10.dirname(path10.dirname(bundlePath));
32222
- return path10.join(packageRoot, "skills", skillName);
32325
+ const packageRoot = path11.dirname(path11.dirname(bundlePath));
32326
+ return path11.join(packageRoot, "skills", skillName);
32223
32327
  }
32224
32328
 
32225
32329
  // src/maker/server/runtimeLogs.ts
32226
- import fs10 from "node:fs";
32227
- import path11 from "node:path";
32330
+ import fs11 from "node:fs";
32331
+ import path12 from "node:path";
32228
32332
  var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
32229
32333
  var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
32230
32334
  var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
@@ -32365,19 +32469,19 @@ async function pullRuntimeLogs(options) {
32365
32469
  }
32366
32470
  function resetRuntimeLogs(projectRoot) {
32367
32471
  const runtimeDir = getRuntimeLogDir(projectRoot);
32368
- fs10.mkdirSync(runtimeDir, { recursive: true });
32472
+ fs11.mkdirSync(runtimeDir, { recursive: true });
32369
32473
  for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
32370
- fs10.rmSync(path11.join(runtimeDir, file2), { force: true });
32474
+ fs11.rmSync(path12.join(runtimeDir, file2), { force: true });
32371
32475
  }
32372
32476
  return runtimeDir;
32373
32477
  }
32374
32478
  function readRuntimeLogState(projectRoot) {
32375
32479
  const statePath = getRuntimeLogStatePath(projectRoot);
32376
- if (!fs10.existsSync(statePath)) {
32480
+ if (!fs11.existsSync(statePath)) {
32377
32481
  return null;
32378
32482
  }
32379
32483
  try {
32380
- const state = JSON.parse(fs10.readFileSync(statePath, "utf8"));
32484
+ const state = JSON.parse(fs11.readFileSync(statePath, "utf8"));
32381
32485
  return isRuntimeLogState(state) ? state : null;
32382
32486
  } catch {
32383
32487
  return null;
@@ -32405,9 +32509,9 @@ function normalizeRuntimeLogQueryResult(result) {
32405
32509
  };
32406
32510
  }
32407
32511
  function writeRuntimeLogRawResponse(projectRoot, raw) {
32408
- const rawPath = path11.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
32409
- fs10.mkdirSync(path11.dirname(rawPath), { recursive: true });
32410
- 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(
32411
32515
  rawPath,
32412
32516
  `${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
32413
32517
  `,
@@ -32416,7 +32520,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
32416
32520
  return rawPath;
32417
32521
  }
32418
32522
  function appendRuntimeLogs(projectRoot, logs) {
32419
- fs10.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
32523
+ fs11.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
32420
32524
  if (logs.length === 0) {
32421
32525
  return { files: [], written: 0 };
32422
32526
  }
@@ -32424,7 +32528,7 @@ function appendRuntimeLogs(projectRoot, logs) {
32424
32528
  let written = 0;
32425
32529
  for (const log of logs) {
32426
32530
  const line = JSON.stringify(compactRuntimeLogEntry(log));
32427
- fs10.appendFileSync(filePath, `${line}
32531
+ fs11.appendFileSync(filePath, `${line}
32428
32532
  `, "utf8");
32429
32533
  written += 1;
32430
32534
  }
@@ -32432,11 +32536,11 @@ function appendRuntimeLogs(projectRoot, logs) {
32432
32536
  }
32433
32537
  function writeRuntimeLogState(projectRoot, state) {
32434
32538
  const statePath = getRuntimeLogStatePath(projectRoot);
32435
- fs10.mkdirSync(path11.dirname(statePath), { recursive: true });
32539
+ fs11.mkdirSync(path12.dirname(statePath), { recursive: true });
32436
32540
  const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
32437
- fs10.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
32541
+ fs11.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
32438
32542
  `, "utf8");
32439
- fs10.renameSync(tempPath, statePath);
32543
+ fs11.renameSync(tempPath, statePath);
32440
32544
  }
32441
32545
  function writeRuntimeLogFailureState(projectRoot, options) {
32442
32546
  const nowIso = new Date(options.nowMs()).toISOString();
@@ -32468,13 +32572,13 @@ function isNonRetryableRuntimeLogError(error2) {
32468
32572
  );
32469
32573
  }
32470
32574
  function getRuntimeLogDir(projectRoot) {
32471
- return path11.join(projectRoot, ".maker", "logs", "runtime");
32575
+ return path12.join(projectRoot, ".maker", "logs", "runtime");
32472
32576
  }
32473
32577
  function getRuntimeLogStatePath(projectRoot) {
32474
- return path11.join(getRuntimeLogDir(projectRoot), "state.json");
32578
+ return path12.join(getRuntimeLogDir(projectRoot), "state.json");
32475
32579
  }
32476
32580
  function getRuntimeLogPath(projectRoot) {
32477
- return path11.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
32581
+ return path12.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
32478
32582
  }
32479
32583
  function resolveNextRuntimeLogCursor(result) {
32480
32584
  const maxLogTime = result.logs.reduce((max, log) => {
@@ -32599,11 +32703,13 @@ function compactRuntimeLogEntry(entry) {
32599
32703
  }
32600
32704
 
32601
32705
  // src/maker/server/proxyAssets.ts
32602
- import fs11 from "node:fs";
32603
- import path12 from "node:path";
32706
+ import fs12 from "node:fs";
32707
+ import path13 from "node:path";
32604
32708
  var IMAGE_ASSET_DIRS = ["assets/image"];
32605
32709
  var VIDEO_ASSET_DIRS = ["assets/video"];
32606
32710
  var AUDIO_ASSET_DIRS = ["assets/audio"];
32711
+ var MODEL_ASSET_DIRS = ["assets/model"];
32712
+ var THREE_D_MODEL_VIEWS = ["front", "left", "back", "right"];
32607
32713
  var IMAGE_REFERENCE_MAX_BYTES = 10 * 1024 * 1024;
32608
32714
  var VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES = 30 * 1024 * 1024;
32609
32715
  var VIDEO_REFERENCE_MAX_BYTES = 50 * 1024 * 1024;
@@ -32652,6 +32758,9 @@ function prepareRemoteProxyToolArgs(options) {
32652
32758
  if (options.toolName === "create_video_task") {
32653
32759
  return rewriteVideoReferenceAssetArgs(options.targetDir, options.args);
32654
32760
  }
32761
+ if (options.toolName === "create_3d_model_task") {
32762
+ return rewrite3dModelAssetArgs(options.targetDir, options.args);
32763
+ }
32655
32764
  return options.args;
32656
32765
  }
32657
32766
  async function materializeRemoteProxyToolAssets(options) {
@@ -32667,6 +32776,7 @@ async function materializeRemoteProxyToolAssets(options) {
32667
32776
  }
32668
32777
  let changed = false;
32669
32778
  const nextContent = [];
32779
+ const structuredPayloads = [];
32670
32780
  for (const item of content) {
32671
32781
  if (!isTextContent(item)) {
32672
32782
  nextContent.push(item);
@@ -32684,6 +32794,7 @@ async function materializeRemoteProxyToolAssets(options) {
32684
32794
  now: options.now ?? /* @__PURE__ */ new Date(),
32685
32795
  fetchImpl: options.fetchImpl ?? fetch
32686
32796
  });
32797
+ structuredPayloads.push(nextParsed);
32687
32798
  if (nextParsed === parsed) {
32688
32799
  nextContent.push(item);
32689
32800
  continue;
@@ -32694,6 +32805,14 @@ async function materializeRemoteProxyToolAssets(options) {
32694
32805
  text: JSON.stringify(nextParsed, null, 2)
32695
32806
  });
32696
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
+ }
32697
32816
  return changed ? { ...options.result, content: nextContent } : options.result;
32698
32817
  }
32699
32818
  function shouldMaterializeRemoteProxyTool(toolName) {
@@ -32703,7 +32822,9 @@ function shouldMaterializeRemoteProxyTool(toolName) {
32703
32822
  "edit_image",
32704
32823
  "create_video_task",
32705
32824
  "query_video_task",
32706
- "text_to_music"
32825
+ "text_to_music",
32826
+ "create_3d_model_task",
32827
+ "query_3d_model_task"
32707
32828
  ].includes(toolName);
32708
32829
  }
32709
32830
  function isTextContent(item) {
@@ -32749,6 +32870,9 @@ async function materializeParsedProxyResult(options) {
32749
32870
  if (options.toolName === "text_to_music") {
32750
32871
  return await materializeMusicResult(options);
32751
32872
  }
32873
+ if (options.toolName === "create_3d_model_task" || options.toolName === "query_3d_model_task") {
32874
+ return await materialize3dModelResult(options, options.toolName);
32875
+ }
32752
32876
  return options.payload;
32753
32877
  }
32754
32878
  async function materializeSingleImageResult(options, toolName) {
@@ -32864,13 +32988,13 @@ function findExistingMaterializedVideo(targetDir, options) {
32864
32988
  function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
32865
32989
  const candidates = [];
32866
32990
  const absolutePath = stringField2(record2.absolutePath);
32867
- if (absolutePath && path12.isAbsolute(absolutePath)) {
32991
+ if (absolutePath && path13.isAbsolute(absolutePath)) {
32868
32992
  candidates.push(absolutePath);
32869
32993
  }
32870
- candidates.push(path12.join(targetDir, ...localPath.split("/")));
32994
+ candidates.push(path13.join(targetDir, ...localPath.split("/")));
32871
32995
  for (const candidate of candidates) {
32872
32996
  try {
32873
- if (fs11.statSync(candidate).isFile()) {
32997
+ if (fs12.statSync(candidate).isFile()) {
32874
32998
  return candidate;
32875
32999
  }
32876
33000
  } catch {
@@ -32910,6 +33034,190 @@ async function materializeMusicResult(options) {
32910
33034
  })
32911
33035
  } : options.payload;
32912
33036
  }
33037
+ async function materialize3dModelResult(options, toolName) {
33038
+ if (options.payload.phase === 1) {
33039
+ return await materialize3dPreviewResult(options);
33040
+ }
33041
+ return await materialize3dFinalResult(options, toolName);
33042
+ }
33043
+ async function materialize3dPreviewResult(options) {
33044
+ if (!isRecord(options.payload.preview_urls)) {
33045
+ return options.payload;
33046
+ }
33047
+ let changed = false;
33048
+ const previewAssets = {};
33049
+ const taskId = get3dTaskId(options.payload);
33050
+ const mode = stringField2(options.payload.mode);
33051
+ for (const view of THREE_D_MODEL_VIEWS) {
33052
+ const url2 = stringField2(options.payload.preview_urls[view]);
33053
+ const materialized = await materializeAsset({
33054
+ targetDir: options.targetDir,
33055
+ url: url2,
33056
+ baseName: `${taskId || "3d_model"}_${view}`,
33057
+ relativeDir: "assets/image",
33058
+ extension: extensionFromUrl(url2) || "png",
33059
+ now: options.now,
33060
+ fetchImpl: options.fetchImpl
33061
+ });
33062
+ if (!materialized) {
33063
+ continue;
33064
+ }
33065
+ changed = true;
33066
+ previewAssets[view] = { ...materialized, cdnUrl: url2 };
33067
+ if ("localPath" in materialized && url2) {
33068
+ upsertGeneratedAssetRecord(options.targetDir, materialized.localPath, {
33069
+ tool: "create_3d_model_task",
33070
+ name: `${taskId || "3d_model"}_${view}`,
33071
+ cdnUrl: url2,
33072
+ previewUrl: url2,
33073
+ localPath: materialized.localPath,
33074
+ absolutePath: materialized.absolutePath,
33075
+ createdAt: options.now.toISOString(),
33076
+ taskId,
33077
+ mode,
33078
+ phase: 1,
33079
+ view
33080
+ });
33081
+ }
33082
+ }
33083
+ return {
33084
+ ...options.payload,
33085
+ ...changed ? { preview_assets: previewAssets } : {},
33086
+ ...create3dPreviewReviewGuidance()
33087
+ };
33088
+ }
33089
+ function create3dPreviewReviewGuidance() {
33090
+ return {
33091
+ workflow_state: "awaiting_user_review",
33092
+ user_review_required: true,
33093
+ next_action: "Show the four-view previews to the user and ask whether they approve them or want changes.",
33094
+ approval_next_step: "If the user approves, continue the original 3D model generation flow by calling create_3d_model_task again with the approved four-view images.",
33095
+ revision_next_step: "If the user requests changes, call create_3d_model_task again with the requested changes to regenerate the four-view previews before model generation.",
33096
+ agent_instruction: "Do not stop after phase 1. The 3D model is not complete until the user approves the four-view previews and final model generation finishes."
33097
+ };
33098
+ }
33099
+ async function materialize3dFinalResult(options, toolName) {
33100
+ if (options.payload.status !== "success") {
33101
+ return options.payload;
33102
+ }
33103
+ let changed = false;
33104
+ const nextPayload = { ...options.payload };
33105
+ const taskId = get3dTaskId(options.payload);
33106
+ const modelCdnUrl = stringField2(options.payload.model_cdn_url);
33107
+ const renderedImageUrl = stringField2(options.payload.rendered_image_url);
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
+ }
33142
+ const mdlUrl = stringField2(options.payload.mdl_cdn_url);
33143
+ const mdlMaterialized = await materializeAsset({
33144
+ targetDir: options.targetDir,
33145
+ url: mdlUrl,
33146
+ baseName: taskId || "3d_model",
33147
+ relativeDir: MODEL_ASSET_DIRS[0],
33148
+ extension: extensionFromUrl(mdlUrl) || "zip",
33149
+ now: options.now,
33150
+ fetchImpl: options.fetchImpl
33151
+ });
33152
+ if (mdlMaterialized) {
33153
+ changed = true;
33154
+ nextPayload.mdlDownload = mdlMaterialized.download;
33155
+ if ("localPath" in mdlMaterialized) {
33156
+ nextPayload.mdlLocalPath = mdlMaterialized.localPath;
33157
+ nextPayload.mdlAbsolutePath = mdlMaterialized.absolutePath;
33158
+ extractZip(
33159
+ mdlMaterialized.absolutePath,
33160
+ path13.join(options.targetDir, "assets"),
33161
+ "3D model asset"
33162
+ );
33163
+ nextPayload.mdlExtracted = true;
33164
+ nextPayload.mdlExtractedTo = "assets";
33165
+ if (mdlUrl) {
33166
+ upsertGeneratedAssetRecord(options.targetDir, mdlMaterialized.localPath, {
33167
+ tool: toolName,
33168
+ name: taskId,
33169
+ assetKind: "mdl_zip",
33170
+ cdnUrl: mdlUrl,
33171
+ previewUrl: renderedImageUrl || mdlUrl,
33172
+ localPath: mdlMaterialized.localPath,
33173
+ absolutePath: mdlMaterialized.absolutePath,
33174
+ createdAt: options.now.toISOString(),
33175
+ taskId,
33176
+ modelCdnUrl,
33177
+ renderedImageUrl,
33178
+ mdlConversionError
33179
+ });
33180
+ }
33181
+ }
33182
+ }
33183
+ const renderedImageMaterialized = await materializeAsset({
33184
+ targetDir: options.targetDir,
33185
+ url: renderedImageUrl,
33186
+ baseName: `${taskId || "3d_model"}_render`,
33187
+ relativeDir: "assets/image",
33188
+ extension: extensionFromUrl(renderedImageUrl) || "png",
33189
+ now: options.now,
33190
+ fetchImpl: options.fetchImpl
33191
+ });
33192
+ if (renderedImageMaterialized) {
33193
+ changed = true;
33194
+ nextPayload.renderedImageDownload = renderedImageMaterialized.download;
33195
+ if ("localPath" in renderedImageMaterialized) {
33196
+ nextPayload.renderedImageLocalPath = renderedImageMaterialized.localPath;
33197
+ nextPayload.renderedImageAbsolutePath = renderedImageMaterialized.absolutePath;
33198
+ if (renderedImageUrl) {
33199
+ upsertGeneratedAssetRecord(options.targetDir, renderedImageMaterialized.localPath, {
33200
+ tool: toolName,
33201
+ name: `${taskId || "3d_model"}_render`,
33202
+ assetKind: "render",
33203
+ cdnUrl: renderedImageUrl,
33204
+ previewUrl: renderedImageUrl,
33205
+ localPath: renderedImageMaterialized.localPath,
33206
+ absolutePath: renderedImageMaterialized.absolutePath,
33207
+ createdAt: options.now.toISOString(),
33208
+ taskId,
33209
+ modelCdnUrl,
33210
+ renderedImageUrl,
33211
+ mdlConversionError
33212
+ });
33213
+ }
33214
+ }
33215
+ }
33216
+ return changed ? nextPayload : options.payload;
33217
+ }
33218
+ function get3dTaskId(payload) {
33219
+ return stringField2(payload.task_id) || stringField2(payload.taskId);
33220
+ }
32913
33221
  function persistMaterializedAsset(options) {
32914
33222
  const nextPayload = { ...options.payload, ...options.materialized };
32915
33223
  if (!("localPath" in options.materialized) || !options.cdnUrl) {
@@ -32950,8 +33258,8 @@ async function materializeAsset(options) {
32950
33258
  };
32951
33259
  }
32952
33260
  const bytes = Buffer.from(await response.arrayBuffer());
32953
- fs11.mkdirSync(path12.dirname(absolutePath), { recursive: true });
32954
- fs11.writeFileSync(absolutePath, bytes);
33261
+ fs12.mkdirSync(path13.dirname(absolutePath), { recursive: true });
33262
+ fs12.writeFileSync(absolutePath, bytes);
32955
33263
  return { localPath: relativePath, absolutePath, download: { success: true } };
32956
33264
  } catch (error2) {
32957
33265
  return {
@@ -32965,12 +33273,12 @@ async function materializeAsset(options) {
32965
33273
  function createUniqueAssetPath(options) {
32966
33274
  const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
32967
33275
  for (let index = 1; index <= 9999; index += 1) {
32968
- const relativePath = path12.posix.join(
33276
+ const relativePath = path13.posix.join(
32969
33277
  options.relativeDir,
32970
33278
  `${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
32971
33279
  );
32972
- const absolutePath = path12.join(options.targetDir, ...relativePath.split("/"));
32973
- if (!fs11.existsSync(absolutePath)) {
33280
+ const absolutePath = path13.join(options.targetDir, ...relativePath.split("/"));
33281
+ if (!fs12.existsSync(absolutePath)) {
32974
33282
  return { relativePath, absolutePath };
32975
33283
  }
32976
33284
  }
@@ -33049,6 +33357,50 @@ function rewriteVideoReferenceAssetArgs(targetDir, args) {
33049
33357
  })
33050
33358
  };
33051
33359
  }
33360
+ function rewrite3dModelAssetArgs(targetDir, args) {
33361
+ const registry2 = readGeneratedAssetRegistry(targetDir);
33362
+ const imageOptions = {
33363
+ assetDirs: IMAGE_ASSET_DIRS,
33364
+ mediaKind: "image",
33365
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33366
+ };
33367
+ return {
33368
+ ...args,
33369
+ image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, imageOptions),
33370
+ front_image: rewriteGeneratedAssetReference(
33371
+ targetDir,
33372
+ args.front_image,
33373
+ registry2,
33374
+ imageOptions
33375
+ ),
33376
+ left_image: rewriteGeneratedAssetReference(targetDir, args.left_image, registry2, imageOptions),
33377
+ back_image: rewriteGeneratedAssetReference(targetDir, args.back_image, registry2, imageOptions),
33378
+ right_image: rewriteGeneratedAssetReference(
33379
+ targetDir,
33380
+ args.right_image,
33381
+ registry2,
33382
+ imageOptions
33383
+ ),
33384
+ confirmed_image_paths: rewrite3dConfirmedImagePaths(
33385
+ targetDir,
33386
+ args.confirmed_image_paths,
33387
+ registry2,
33388
+ imageOptions
33389
+ )
33390
+ };
33391
+ }
33392
+ function rewrite3dConfirmedImagePaths(targetDir, value, registry2, options) {
33393
+ if (!isRecord(value)) {
33394
+ return value;
33395
+ }
33396
+ return {
33397
+ ...value,
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)
33402
+ };
33403
+ }
33052
33404
  function rewriteUrlObjectArray(targetDir, value, registry2, options) {
33053
33405
  if (!Array.isArray(value)) {
33054
33406
  return value;
@@ -33104,7 +33456,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
33104
33456
  if (!isKnownAssetPath(localPath, assetDirs)) {
33105
33457
  return false;
33106
33458
  }
33107
- const basename = path12.posix.basename(localPath);
33459
+ const basename = path13.posix.basename(localPath);
33108
33460
  const stem = basename.replace(/\.[^.]+$/, "");
33109
33461
  return basename === value || stem === value || record2.name === value || record2.taskId === value;
33110
33462
  });
@@ -33117,13 +33469,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
33117
33469
  }
33118
33470
  function findLocalAssetByName(targetDir, value, assetDirs) {
33119
33471
  var _a3;
33120
- const hasExtension = Boolean(path12.extname(value));
33472
+ const hasExtension = Boolean(path13.extname(value));
33121
33473
  const candidates = [];
33122
33474
  for (const assetDir of assetDirs) {
33123
- const absoluteDir = path12.join(targetDir, ...assetDir.split("/"));
33475
+ const absoluteDir = path13.join(targetDir, ...assetDir.split("/"));
33124
33476
  let entries;
33125
33477
  try {
33126
- entries = fs11.readdirSync(absoluteDir);
33478
+ entries = fs12.readdirSync(absoluteDir);
33127
33479
  } catch {
33128
33480
  continue;
33129
33481
  }
@@ -33132,11 +33484,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
33132
33484
  if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
33133
33485
  continue;
33134
33486
  }
33135
- const absolutePath = path12.join(absoluteDir, entry);
33487
+ const absolutePath = path13.join(absoluteDir, entry);
33136
33488
  try {
33137
33489
  candidates.push({
33138
- localPath: path12.posix.join(assetDir, entry),
33139
- mtimeMs: fs11.statSync(absolutePath).mtimeMs
33490
+ localPath: path13.posix.join(assetDir, entry),
33491
+ mtimeMs: fs12.statSync(absolutePath).mtimeMs
33140
33492
  });
33141
33493
  } catch {
33142
33494
  }
@@ -33146,7 +33498,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
33146
33498
  return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
33147
33499
  }
33148
33500
  function isKnownAssetPath(relativePath, assetDirs) {
33149
- if (relativePath.startsWith("../") || path12.isAbsolute(relativePath)) {
33501
+ if (relativePath.startsWith("../") || path13.isAbsolute(relativePath)) {
33150
33502
  return false;
33151
33503
  }
33152
33504
  return assetDirs.some(
@@ -33170,14 +33522,14 @@ function localAssetReferenceToDataUrl(options) {
33170
33522
  }
33171
33523
  let stat;
33172
33524
  try {
33173
- stat = fs11.statSync(absolutePath);
33525
+ stat = fs12.statSync(absolutePath);
33174
33526
  } catch {
33175
33527
  return void 0;
33176
33528
  }
33177
33529
  if (!stat.isFile() || stat.size > options.maxBytes) {
33178
33530
  return void 0;
33179
33531
  }
33180
- const bytes = fs11.readFileSync(absolutePath);
33532
+ const bytes = fs12.readFileSync(absolutePath);
33181
33533
  return `data:${mime};base64,${bytes.toString("base64")}`;
33182
33534
  }
33183
33535
  function resolveLocalAssetAbsolutePath(targetDir, options) {
@@ -33188,7 +33540,7 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
33188
33540
  candidates.push(localPath);
33189
33541
  }
33190
33542
  }
33191
- if (path12.isAbsolute(options.value)) {
33543
+ if (path13.isAbsolute(options.value)) {
33192
33544
  candidates.push(options.value);
33193
33545
  } else {
33194
33546
  const localPath = resolveProjectRelativePath(targetDir, options.value);
@@ -33197,54 +33549,54 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
33197
33549
  }
33198
33550
  }
33199
33551
  for (const candidate of candidates) {
33200
- if (fs11.existsSync(candidate)) {
33552
+ if (fs12.existsSync(candidate)) {
33201
33553
  return candidate;
33202
33554
  }
33203
33555
  }
33204
33556
  return void 0;
33205
33557
  }
33206
33558
  function resolveProjectRelativePath(targetDir, value) {
33207
- const root = path12.resolve(targetDir);
33208
- const absolutePath = path12.resolve(root, value);
33209
- const relativePath = path12.relative(root, absolutePath);
33210
- const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path12.sep}`) || path12.isAbsolute(relativePath);
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);
33211
33563
  if (!escapesRoot) {
33212
33564
  return absolutePath;
33213
33565
  }
33214
33566
  return void 0;
33215
33567
  }
33216
33568
  function dataUrlMimeForPath(filePath, mediaKind) {
33217
- return DATA_URL_MIME_BY_EXTENSION[mediaKind][path12.extname(filePath).toLowerCase()];
33569
+ return DATA_URL_MIME_BY_EXTENSION[mediaKind][path13.extname(filePath).toLowerCase()];
33218
33570
  }
33219
33571
  function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
33220
33572
  const registry2 = readGeneratedAssetRegistry(targetDir);
33221
33573
  registry2[localPath] = record2;
33222
33574
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
33223
- fs11.mkdirSync(path12.dirname(registryPath), { recursive: true });
33224
- 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)}
33225
33577
  `, "utf8");
33226
33578
  }
33227
33579
  function readGeneratedAssetRegistry(targetDir) {
33228
33580
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
33229
- if (!fs11.existsSync(registryPath)) {
33581
+ if (!fs12.existsSync(registryPath)) {
33230
33582
  return {};
33231
33583
  }
33232
33584
  try {
33233
- const parsed = JSON.parse(fs11.readFileSync(registryPath, "utf8"));
33585
+ const parsed = JSON.parse(fs12.readFileSync(registryPath, "utf8"));
33234
33586
  return isRecord(parsed) ? parsed : {};
33235
33587
  } catch {
33236
33588
  return {};
33237
33589
  }
33238
33590
  }
33239
33591
  function getGeneratedAssetRegistryPath(targetDir) {
33240
- return path12.join(targetDir, ".maker", "assets", "generated-assets.json");
33592
+ return path13.join(targetDir, ".maker", "assets", "generated-assets.json");
33241
33593
  }
33242
33594
  function normalizeAssetRegistryKey(targetDir, value) {
33243
33595
  if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
33244
33596
  return void 0;
33245
33597
  }
33246
- const relative = path12.isAbsolute(value) ? path12.relative(targetDir, value) : value;
33247
- return relative.split(path12.sep).join("/");
33598
+ const relative = path13.isAbsolute(value) ? path13.relative(targetDir, value) : value;
33599
+ return relative.split(path13.sep).join("/");
33248
33600
  }
33249
33601
  function isRecord(value) {
33250
33602
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -33273,7 +33625,7 @@ function extensionFromUrl(url2) {
33273
33625
  }
33274
33626
  try {
33275
33627
  const pathname = new URL(url2).pathname;
33276
- const extension = path12.extname(pathname).replace(/^\./, "").toLowerCase();
33628
+ const extension = path13.extname(pathname).replace(/^\./, "").toLowerCase();
33277
33629
  return extension || void 0;
33278
33630
  } catch {
33279
33631
  return void 0;
@@ -33281,9 +33633,8 @@ function extensionFromUrl(url2) {
33281
33633
  }
33282
33634
 
33283
33635
  // src/maker/server/mcp.ts
33284
- var VERSION = true ? "0.0.18" : "dev";
33636
+ var VERSION = true ? "0.0.19-beta.1" : "dev";
33285
33637
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
33286
- var REMOTE_PROXY_FORWARD_TIMEOUT_MS = 60 * 60 * 1e3;
33287
33638
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
33288
33639
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
33289
33640
  var PREVIEW_REFRESH_TIMEOUT_MS = 15 * 1e3;
@@ -33296,7 +33647,9 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
33296
33647
  "edit_image",
33297
33648
  "create_video_task",
33298
33649
  "query_video_task",
33299
- "text_to_music"
33650
+ "text_to_music",
33651
+ "create_3d_model_task",
33652
+ "query_3d_model_task"
33300
33653
  ];
33301
33654
  var MakerCloneFailedError = class extends Error {
33302
33655
  constructor(targetDir, originalError) {
@@ -33310,7 +33663,7 @@ var MakerCloneFailedError = class extends Error {
33310
33663
  var tools = [
33311
33664
  {
33312
33665
  name: "maker_status_lite",
33313
- 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 media inputs, 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.",
33314
33667
  inputSchema: {
33315
33668
  type: "object",
33316
33669
  properties: {
@@ -33389,7 +33742,7 @@ var resources = [
33389
33742
  {
33390
33743
  uri: "maker://status",
33391
33744
  name: "Maker status",
33392
- 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.",
33393
33746
  mimeType: "text/plain"
33394
33747
  }
33395
33748
  ];
@@ -33537,9 +33890,7 @@ async function callRemoteProxyTool(options) {
33537
33890
  },
33538
33891
  void 0,
33539
33892
  {
33540
- timeout: REMOTE_PROXY_FORWARD_TIMEOUT_MS,
33541
- resetTimeoutOnProgress: true,
33542
- onprogress: createRemoteProxyProgressHandler(options.progressToken, options.extra)
33893
+ ...createRemoteProxyCallToolOptions(options.progressToken, options.extra)
33543
33894
  }
33544
33895
  );
33545
33896
  } finally {
@@ -33581,6 +33932,11 @@ function createRemoteProxyProgressHandler(progressToken, extra) {
33581
33932
  });
33582
33933
  };
33583
33934
  }
33935
+ function createRemoteProxyCallToolOptions(progressToken, extra) {
33936
+ return {
33937
+ onprogress: createRemoteProxyProgressHandler(progressToken, extra)
33938
+ };
33939
+ }
33584
33940
  async function startMakerMcpServer() {
33585
33941
  const server = new Server(
33586
33942
  {
@@ -33733,7 +34089,7 @@ async function formatStatus(options = {}) {
33733
34089
  const env = getMakerEnvironment(void 0, targetDir);
33734
34090
  const identify = identifyMakerProject({ cwd: targetDir });
33735
34091
  const mcpCwd = process.cwd();
33736
- 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 });
33737
34093
  const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
33738
34094
  const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
33739
34095
  const pat = loadPat();
@@ -33802,6 +34158,8 @@ async function formatStatus(options = {}) {
33802
34158
  "",
33803
34159
  tapAuthRefreshText,
33804
34160
  "",
34161
+ identify.projectRoot ? formatMakerAgentsPolicyStatus(identify.projectRoot) : "",
34162
+ "",
33805
34163
  identify.projectRoot ? await formatAiDevKitStatus(identify.projectRoot, {
33806
34164
  environment: env,
33807
34165
  skipVersionCheck: options.skipRemoteSync
@@ -33853,10 +34211,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
33853
34211
  if (!options.projectRoot) {
33854
34212
  return "";
33855
34213
  }
33856
- const mcpCwd = path13.resolve(options.mcpCwd);
33857
- const targetDir = path13.resolve(options.targetDir);
33858
- const projectRoot = path13.resolve(options.projectRoot);
33859
- 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;
33860
34218
  if (mcpProjectRoot === projectRoot) {
33861
34219
  return "";
33862
34220
  }
@@ -34018,7 +34376,7 @@ function formatAiDialogueDirectoryHint(targetDir) {
34018
34376
  }
34019
34377
  function resolveMakerToolTargetDir(targetDir) {
34020
34378
  if (targetDir) {
34021
- return path13.resolve(targetDir);
34379
+ return path14.resolve(targetDir);
34022
34380
  }
34023
34381
  return process.cwd();
34024
34382
  }
@@ -34060,8 +34418,10 @@ async function formatAutoProjectListFromPat() {
34060
34418
  const projects = await listMakerProjects();
34061
34419
  return [
34062
34420
  "本地已有 Maker PAT,当前目录尚未绑定 Maker 项目。",
34421
+ "绑定项目时必须先提醒用户:0,创建新项目 / 0. Create a new Maker project。",
34422
+ "即使发现和当前目录同名的 Maker app,也不能只推荐同名 app;必须同时展示创建新项目选项。",
34063
34423
  "当前目录未绑定时,先展示下面的 Maker Apps 预览和总数;选择、解释和 clone 顺序请参考 taptap-maker-local workflow guide document。",
34064
- "用户选择 app 后,next_step: 执行 `taptap-maker init`。",
34424
+ "用户选择 0/new 或已有 app 后,next_step: 执行 `taptap-maker init`。",
34065
34425
  "",
34066
34426
  formatStatusProjectList(projects)
34067
34427
  ].join("\n");
@@ -34093,7 +34453,8 @@ function formatStatusProjectList(projects) {
34093
34453
  return [
34094
34454
  "No Maker apps found.",
34095
34455
  "",
34096
- "请确认 Maker PAT 是否有效,或等待 Maker app list 接口对齐。"
34456
+ "0,创建新项目 / 0. Create a new Maker project",
34457
+ "当前账号没有可展示的 Maker app。用户要开始新项目时,直接引导其执行 `taptap-maker init`,并在交互中选择 `0`/`new` 创建项目。"
34097
34458
  ].join("\n");
34098
34459
  }
34099
34460
  const visibleProjects = sortStatusProjectsByRecentActivity(projects).slice(
@@ -34106,6 +34467,8 @@ function formatStatusProjectList(projects) {
34106
34467
  "",
34107
34468
  hiddenCount > 0 ? `为了保持友好的可读性,默认最多展示 ${visibleProjects.length} 个 app;如需完整列表,可以选择显示全部。` : "已显示全部 app;请询问用户选择。",
34108
34469
  hiddenCount > 0 ? "如需完整列表,请运行 taptap-maker apps --json 查看全部 app。" : void 0,
34470
+ "0,创建新项目 / 0. Create a new Maker project",
34471
+ "AI 必须把上面这一行作为可选项展示给用户;即使压缩 app 列表,也不要删除创建项目入口。",
34109
34472
  "AI 展示建议:如果聊天或客户端宽度足够,可把 app 预览整理成两列紧凑布局;每个 app 保留序号、app_id、名称,以及可用的最近活跃时间或 user_id。窄屏保持单列。选择 app 前先获取用户确认。",
34110
34473
  "",
34111
34474
  ...visibleProjects.map(
@@ -34118,14 +34481,14 @@ function formatStatusProjectList(projects) {
34118
34481
  ].filter((line) => line !== void 0).join("\n");
34119
34482
  }
34120
34483
  function formatClonePartialStateLines(targetDir) {
34121
- const resolvedTargetDir = path13.resolve(targetDir);
34484
+ const resolvedTargetDir = path14.resolve(targetDir);
34122
34485
  const identify = identifyMakerProject({ cwd: resolvedTargetDir });
34123
34486
  const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
34124
34487
  const devKitStatus = inspectAiDevKit(resolvedTargetDir);
34125
- const stagedDevKitGitignorePath = path13.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
34488
+ const stagedDevKitGitignorePath = path14.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
34126
34489
  const projectBound = Boolean(identify.projectId);
34127
34490
  const gitInitialized = Boolean(
34128
- gitStatus.isOwnGitRoot || fs12.existsSync(path13.join(resolvedTargetDir, ".git"))
34491
+ gitStatus.isOwnGitRoot || fs13.existsSync(path14.join(resolvedTargetDir, ".git"))
34129
34492
  );
34130
34493
  const safeToRetry = !projectBound;
34131
34494
  return [
@@ -34139,7 +34502,7 @@ function formatClonePartialStateLines(targetDir) {
34139
34502
  identify.configPath ? `- config: ${identify.configPath}` : "",
34140
34503
  `- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
34141
34504
  `- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
34142
- `- staged_dev_kit_gitignore: ${fs12.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
34505
+ `- staged_dev_kit_gitignore: ${fs13.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
34143
34506
  `- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
34144
34507
  safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
34145
34508
  ].filter(Boolean);
@@ -34208,15 +34571,27 @@ function createRemoteProxyContext(options) {
34208
34571
  };
34209
34572
  }
34210
34573
  function resolveEmbeddedProxyCommand(options) {
34211
- 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();
34212
34576
  if (!makerEntry) {
34213
34577
  throw new Error("Cannot resolve current taptap-maker entry for embedded MCP proxy.");
34214
34578
  }
34215
34579
  return {
34216
34580
  command: process.execPath,
34217
- args: [path13.resolve(makerEntry), "__maker-proxy"]
34581
+ args: [path14.resolve(makerEntry), "__maker-proxy"]
34218
34582
  };
34219
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
+ }
34220
34595
  function createToolProgressReporter(progressToken, extra, operationName) {
34221
34596
  var _a3;
34222
34597
  const startedAt = Date.now();
@@ -34555,18 +34930,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
34555
34930
  }
34556
34931
  }
34557
34932
  async function startRuntimeLogWatch(buildResult) {
34558
- const runtimeDir = path13.join(buildResult.projectRoot, ".maker", "logs", "runtime");
34559
- fs12.mkdirSync(runtimeDir, { recursive: true });
34560
- const stdoutLog = path13.join(runtimeDir, "watcher.out.log");
34561
- const stderrLog = path13.join(runtimeDir, "watcher.err.log");
34562
- 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");
34563
34938
  const previous = stopExistingRuntimeLogWatcher(pidFile);
34564
- const outFd = fs12.openSync(stdoutLog, "a");
34565
- const errFd = fs12.openSync(stderrLog, "a");
34939
+ const outFd = fs13.openSync(stdoutLog, "a");
34940
+ const errFd = fs13.openSync(stderrLog, "a");
34566
34941
  const command = formatRuntimeLogWatchCommand(buildResult);
34567
34942
  if (previous.previousStopError) {
34568
- fs12.closeSync(outFd);
34569
- fs12.closeSync(errFd);
34943
+ fs13.closeSync(outFd);
34944
+ fs13.closeSync(errFd);
34570
34945
  return {
34571
34946
  started: false,
34572
34947
  command: command.text,
@@ -34629,18 +35004,18 @@ async function startRuntimeLogWatch(buildResult) {
34629
35004
  ...previous
34630
35005
  };
34631
35006
  } finally {
34632
- fs12.closeSync(outFd);
34633
- fs12.closeSync(errFd);
35007
+ fs13.closeSync(outFd);
35008
+ fs13.closeSync(errFd);
34634
35009
  }
34635
35010
  }
34636
35011
  function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34637
- if (!fs12.existsSync(pidFile)) {
35012
+ if (!fs13.existsSync(pidFile)) {
34638
35013
  return {};
34639
35014
  }
34640
35015
  const pidState = readRuntimeLogWatcherPidState(pidFile);
34641
35016
  const pid = pidState == null ? void 0 : pidState.pid;
34642
35017
  if (!Number.isInteger(pid) || pid <= 0) {
34643
- fs12.rmSync(pidFile, { force: true });
35018
+ fs13.rmSync(pidFile, { force: true });
34644
35019
  return {};
34645
35020
  }
34646
35021
  try {
@@ -34648,7 +35023,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34648
35023
  const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
34649
35024
  const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
34650
35025
  if (!verifiedCommand) {
34651
- fs12.rmSync(pidFile, { force: true });
35026
+ fs13.rmSync(pidFile, { force: true });
34652
35027
  return {
34653
35028
  previousPid: pid,
34654
35029
  previousStopped: false,
@@ -34658,7 +35033,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34658
35033
  process.kill(pid, "SIGTERM");
34659
35034
  const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
34660
35035
  if (stopped) {
34661
- fs12.rmSync(pidFile, { force: true });
35036
+ fs13.rmSync(pidFile, { force: true });
34662
35037
  return { previousPid: pid, previousStopped: true };
34663
35038
  }
34664
35039
  return {
@@ -34667,7 +35042,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34667
35042
  previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
34668
35043
  };
34669
35044
  } catch (error2) {
34670
- fs12.rmSync(pidFile, { force: true });
35045
+ fs13.rmSync(pidFile, { force: true });
34671
35046
  const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
34672
35047
  if (code === "ESRCH") {
34673
35048
  return { previousPid: pid, previousStopped: false };
@@ -34680,7 +35055,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
34680
35055
  }
34681
35056
  }
34682
35057
  function readRuntimeLogWatcherPidState(pidFile) {
34683
- const raw = fs12.readFileSync(pidFile, "utf8").trim();
35058
+ const raw = fs13.readFileSync(pidFile, "utf8").trim();
34684
35059
  if (!raw) {
34685
35060
  return null;
34686
35061
  }
@@ -34696,7 +35071,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
34696
35071
  }
34697
35072
  }
34698
35073
  function writeRuntimeLogWatcherPidFile(pidFile, state) {
34699
- fs12.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
35074
+ fs13.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
34700
35075
  `, "utf8");
34701
35076
  }
34702
35077
  function getProcessCommand(pid) {
@@ -34782,10 +35157,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
34782
35157
  };
34783
35158
  }
34784
35159
  function resolveMakerCliEntry() {
34785
- return process.argv[1] || path13.resolve(process.cwd(), "dist", "maker.js");
35160
+ return process.argv[1] || path14.resolve(process.cwd(), "dist", "maker.js");
34786
35161
  }
34787
35162
  function getRuntimeLogFilePath(projectRoot) {
34788
- return path13.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
35163
+ return path14.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
34789
35164
  }
34790
35165
  async function refreshMakerPreview(buildResult) {
34791
35166
  const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
@@ -34918,7 +35293,7 @@ function createBuildArgs(projectRoot, options) {
34918
35293
  if (options.scriptsPath) {
34919
35294
  buildArgs.scriptsPath = options.scriptsPath;
34920
35295
  }
34921
- 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"))) {
34922
35297
  buildArgs.entry = "main.lua";
34923
35298
  buildArgs.scriptsPath = "scripts";
34924
35299
  }
@@ -34930,7 +35305,7 @@ function createBuildArgs(projectRoot, options) {
34930
35305
  }
34931
35306
  if (options.multiplayer) {
34932
35307
  buildArgs.multiplayer = options.multiplayer;
34933
- } else if (!fs12.existsSync(path13.join(projectRoot, ".project", "settings.json"))) {
35308
+ } else if (!fs13.existsSync(path14.join(projectRoot, ".project", "settings.json"))) {
34934
35309
  buildArgs.multiplayer = { enabled: false };
34935
35310
  }
34936
35311
  return buildArgs;
@@ -35105,11 +35480,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
35105
35480
  ((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
35106
35481
  `- watch_command: ${command}`,
35107
35482
  ((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
35108
- `- local_file: ${path13.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
35483
+ `- local_file: ${path14.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
35109
35484
  ((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
35110
35485
  ((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
35111
35486
  ((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
35112
- `- state_file: ${path13.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
35487
+ `- state_file: ${path14.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
35113
35488
  ((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
35114
35489
  ((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
35115
35490
  ((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
@@ -35286,20 +35661,20 @@ function indent2(value) {
35286
35661
 
35287
35662
  // src/maker/cli/commands.ts
35288
35663
  import { spawnSync as spawnSync8 } from "node:child_process";
35289
- import crypto2 from "node:crypto";
35290
- import fs13 from "node:fs";
35664
+ import crypto3 from "node:crypto";
35665
+ import fs14 from "node:fs";
35291
35666
  import os4 from "node:os";
35292
- import path14 from "node:path";
35667
+ import path15 from "node:path";
35293
35668
  import readline from "node:readline/promises";
35294
35669
  import { stdin as input, stdout as output } from "node:process";
35295
35670
 
35296
35671
  // src/maker/auth/cliLogin.ts
35297
35672
  import { spawnSync as spawnSync7 } from "node:child_process";
35298
- import crypto from "node:crypto";
35673
+ import crypto2 from "node:crypto";
35299
35674
  var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
35300
35675
  var DEFAULT_POLL_INTERVAL_MS = 1e3;
35301
35676
  function createCliLoginCode() {
35302
- return crypto.randomBytes(24).toString("base64url");
35677
+ return crypto2.randomBytes(24).toString("base64url");
35303
35678
  }
35304
35679
  function getMakerCliLoginUrl(code, env) {
35305
35680
  const url2 = new URL("/pat-tokens", getMakerWebUrl(env));
@@ -35437,7 +35812,7 @@ function formatError2(error2) {
35437
35812
  // src/maker/cli/commands.ts
35438
35813
  var DEFAULT_MCP_NAME = "taptap-maker";
35439
35814
  var MAKER_NPM_PACKAGE = "@taptap/maker";
35440
- 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"]);
35441
35816
  var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
35442
35817
  "json",
35443
35818
  "skip_confirm",
@@ -35446,6 +35821,7 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
35446
35821
  "pat_from_stdin",
35447
35822
  "reset",
35448
35823
  "all",
35824
+ "create",
35449
35825
  "h",
35450
35826
  "help"
35451
35827
  ]);
@@ -35495,6 +35871,14 @@ async function runMakerCli(argv) {
35495
35871
  await runMcpVerify(parsed, ctx);
35496
35872
  return;
35497
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
+ }
35498
35882
  if (command === "dev-kit" && subcommand === "update") {
35499
35883
  await runDevKitUpdate(parsed, ctx);
35500
35884
  return;
@@ -35560,7 +35944,7 @@ function toOptionKey(value) {
35560
35944
  }
35561
35945
  async function runInit(parsed, ctx) {
35562
35946
  rejectPackageOption(parsed);
35563
- const targetDir = path14.resolve(stringOption(parsed, "target_dir") || process.cwd());
35947
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
35564
35948
  const env = makerEnvOption(parsed);
35565
35949
  const skipConfirm = booleanOption(parsed, "skip_confirm");
35566
35950
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -35591,6 +35975,7 @@ async function runInit(parsed, ctx) {
35591
35975
  });
35592
35976
  const selected = await resolveProjectSelection(parsed, projects, {
35593
35977
  existingProjectConfig,
35978
+ pat,
35594
35979
  skipConfirm
35595
35980
  });
35596
35981
  emit(ctx, "app", "Maker app selected", {
@@ -35653,7 +36038,7 @@ async function runInit(parsed, ctx) {
35653
36038
  }
35654
36039
  async function runDoctor(parsed, ctx) {
35655
36040
  var _a3, _b;
35656
- const targetDir = path14.resolve(stringOption(parsed, "target_dir") || process.cwd());
36041
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
35657
36042
  const env = makerEnvOption(parsed);
35658
36043
  const git = checkGitEnvironment();
35659
36044
  const python = checkMakerPythonEnvironment();
@@ -35665,6 +36050,7 @@ async function runDoctor(parsed, ctx) {
35665
36050
  const projectRoot = identify.projectRoot || targetDir;
35666
36051
  const devKit = inspectAiDevKit(projectRoot);
35667
36052
  const devKitUpdate = await checkAiDevKitUpdate(projectRoot, { environment: env });
36053
+ const agentsPolicy = isProjectBound ? inspectMakerAgentsPolicy(projectRoot) : void 0;
35668
36054
  const orphanProcessCheck = inspectMakerOrphanProcesses();
35669
36055
  const mcpToolsAvailability = inspectMakerMcpToolsAvailability({
35670
36056
  makerProjectDir: identify.projectRoot
@@ -35680,6 +36066,7 @@ async function runDoctor(parsed, ctx) {
35680
36066
  python,
35681
36067
  lua_lsp: luaLsp,
35682
36068
  project: identify,
36069
+ agents_policy: agentsPolicy,
35683
36070
  dev_kit: devKit,
35684
36071
  dev_kit_update: devKitUpdate,
35685
36072
  mcp_tools_availability: mcpToolsAvailability,
@@ -35708,6 +36095,7 @@ async function runDoctor(parsed, ctx) {
35708
36095
  `- target_dir: ${targetDir}`,
35709
36096
  `- project_id: ${identify.projectId || "(none)"}`,
35710
36097
  identify.configPath ? `- config: ${identify.configPath}` : "",
36098
+ isProjectBound ? formatMakerAgentsPolicyStatus(projectRoot) : "",
35711
36099
  "",
35712
36100
  "AI dev kit",
35713
36101
  `- ready: ${devKit.ready ? "yes" : "no"}`,
@@ -35727,9 +36115,9 @@ async function runDoctor(parsed, ctx) {
35727
36115
  );
35728
36116
  }
35729
36117
  function inspectMakerMcpToolsAvailability(options) {
35730
- const aiPwd = path14.resolve(process.cwd());
36118
+ const aiPwd = path15.resolve(process.cwd());
35731
36119
  const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
35732
- const makerProjectDir = options.makerProjectDir ? path14.resolve(options.makerProjectDir) : void 0;
36120
+ const makerProjectDir = options.makerProjectDir ? path15.resolve(options.makerProjectDir) : void 0;
35733
36121
  if (!makerProjectDir) {
35734
36122
  return {
35735
36123
  tools_visibility: "refresh_ai_client_if_missing",
@@ -35771,9 +36159,9 @@ function samePath2(left, right) {
35771
36159
  return normalizePathForCompare2(left) === normalizePathForCompare2(right);
35772
36160
  }
35773
36161
  function normalizePathForCompare2(value) {
35774
- const resolved = path14.resolve(value);
36162
+ const resolved = path15.resolve(value);
35775
36163
  try {
35776
- return fs13.realpathSync.native(resolved);
36164
+ return fs14.realpathSync.native(resolved);
35777
36165
  } catch {
35778
36166
  return resolved;
35779
36167
  }
@@ -36091,7 +36479,7 @@ async function runPatSet(parsed, ctx) {
36091
36479
  }
36092
36480
  async function resolvePatSet(parsed, ctx) {
36093
36481
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
36094
- const pat = fs13.readFileSync(0, "utf8").trim();
36482
+ const pat = fs14.readFileSync(0, "utf8").trim();
36095
36483
  if (!pat) {
36096
36484
  throw new Error("No PAT found on stdin.");
36097
36485
  }
@@ -36121,7 +36509,7 @@ async function runMcpInstall(parsed, ctx) {
36121
36509
  env: makerEnvOption(parsed),
36122
36510
  pkg: MAKER_NPM_PACKAGE,
36123
36511
  mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
36124
- cwd: explicitTargetDir ? path14.resolve(explicitTargetDir) : void 0
36512
+ cwd: explicitTargetDir ? path15.resolve(explicitTargetDir) : void 0
36125
36513
  });
36126
36514
  if (ctx.json) {
36127
36515
  writeJson(results);
@@ -36179,6 +36567,65 @@ ${indent3(payload.stderr)}` : "",
36179
36567
  ].filter(Boolean).join("\n")
36180
36568
  );
36181
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
+ }
36182
36629
  function classifyMcpVerifyFailure(result) {
36183
36630
  if (result.status === 0) {
36184
36631
  return void 0;
@@ -36224,7 +36671,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
36224
36671
  ];
36225
36672
  }
36226
36673
  async function runDevKitUpdate(parsed, ctx) {
36227
- const targetDir = path14.resolve(stringOption(parsed, "target_dir") || process.cwd());
36674
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
36228
36675
  const result = await installAiDevKit({
36229
36676
  targetDir,
36230
36677
  preserveExisting: false,
@@ -36236,7 +36683,7 @@ async function runDevKitUpdate(parsed, ctx) {
36236
36683
  emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
36237
36684
  }
36238
36685
  async function runLogsWatch(parsed, ctx) {
36239
- const targetDir = path14.resolve(stringOption(parsed, "target_dir") || process.cwd());
36686
+ const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
36240
36687
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
36241
36688
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
36242
36689
  const maxPolls = numberOption(parsed, "max_polls");
@@ -36246,9 +36693,9 @@ async function runLogsWatch(parsed, ctx) {
36246
36693
  serverUrl: stringOption(parsed, "server_url"),
36247
36694
  env: makerEnvOption(parsed)
36248
36695
  });
36249
- const runtimeDir = path14.join(proxy.projectRoot, ".maker", "logs", "runtime");
36250
- const runtimeLog = path14.join(runtimeDir, "runtime.log");
36251
- 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");
36252
36699
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
36253
36700
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
36254
36701
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -36293,10 +36740,10 @@ async function runLogsWatch(parsed, ctx) {
36293
36740
  }
36294
36741
  }
36295
36742
  function registerRuntimeLogWatcherProcess(pidFile) {
36296
- fs13.mkdirSync(path14.dirname(pidFile), { recursive: true });
36743
+ fs14.mkdirSync(path15.dirname(pidFile), { recursive: true });
36297
36744
  const existingPid = readPidFile(pidFile);
36298
36745
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
36299
- fs13.writeFileSync(
36746
+ fs14.writeFileSync(
36300
36747
  pidFile,
36301
36748
  `${JSON.stringify(
36302
36749
  {
@@ -36314,10 +36761,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
36314
36761
  return previous;
36315
36762
  }
36316
36763
  function readPidFile(pidFile) {
36317
- if (!fs13.existsSync(pidFile)) {
36764
+ if (!fs14.existsSync(pidFile)) {
36318
36765
  return void 0;
36319
36766
  }
36320
- const raw = fs13.readFileSync(pidFile, "utf8").trim();
36767
+ const raw = fs14.readFileSync(pidFile, "utf8").trim();
36321
36768
  let pid = Number(raw);
36322
36769
  if (!Number.isInteger(pid) || pid <= 0) {
36323
36770
  try {
@@ -36337,7 +36784,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
36337
36784
  }
36338
36785
  cleaned = true;
36339
36786
  if (readPidFile(pidFile) === process.pid) {
36340
- fs13.rmSync(pidFile, { force: true });
36787
+ fs14.rmSync(pidFile, { force: true });
36341
36788
  }
36342
36789
  };
36343
36790
  process.once("exit", cleanup);
@@ -36381,6 +36828,13 @@ async function resolvePat(parsed, ctx) {
36381
36828
  async function resolveProjectSelection(parsed, projects, options) {
36382
36829
  var _a3;
36383
36830
  const appId = stringOption(parsed, "app_id") || parsed.positionals[0];
36831
+ const createNewProject = booleanOption(parsed, "create");
36832
+ if (createNewProject && appId) {
36833
+ throw new Error("Cannot use --create together with --app-id or a positional app id.");
36834
+ }
36835
+ if (createNewProject) {
36836
+ return createProjectFromInit(parsed, options);
36837
+ }
36384
36838
  if (appId) {
36385
36839
  return projects.find((project) => project.id === appId) || { id: appId };
36386
36840
  }
@@ -36393,7 +36847,12 @@ async function resolveProjectSelection(parsed, projects, options) {
36393
36847
  };
36394
36848
  }
36395
36849
  if (projects.length === 0) {
36396
- throw new Error("No Maker apps found for this PAT.");
36850
+ if (options.skipConfirm) {
36851
+ throw new Error("No Maker apps found for this PAT. Use --create --name to create one.");
36852
+ }
36853
+ process.stdout.write(`${formatMakerProjectList(projects)}
36854
+ `);
36855
+ return createProjectFromInit(parsed, options);
36397
36856
  }
36398
36857
  if (options.skipConfirm) {
36399
36858
  throw new Error("Missing --app-id in non-interactive init mode.");
@@ -36403,7 +36862,9 @@ async function resolveProjectSelection(parsed, projects, options) {
36403
36862
  for (; ; ) {
36404
36863
  process.stdout.write(`${formatMakerProjectList(orderedProjects, { showAll })}
36405
36864
  `);
36406
- const answer = await promptRequired("Choose app by index, app_id, 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
+ );
36407
36868
  const normalized = answer.trim().toLowerCase();
36408
36869
  if (["a", "all"].includes(normalized)) {
36409
36870
  if (showAll) {
@@ -36413,6 +36874,9 @@ async function resolveProjectSelection(parsed, projects, options) {
36413
36874
  }
36414
36875
  continue;
36415
36876
  }
36877
+ if (["0", "n", "new", "create"].includes(normalized)) {
36878
+ return createProjectFromInit(parsed, options);
36879
+ }
36416
36880
  const visibleCount = showAll ? orderedProjects.length : Math.min(MAKER_PROJECT_DEFAULT_TEXT_LIMIT, orderedProjects.length);
36417
36881
  const byIndex = Number(answer);
36418
36882
  if (Number.isInteger(byIndex) && byIndex >= 1 && byIndex <= visibleCount) {
@@ -36425,6 +36889,31 @@ async function resolveProjectSelection(parsed, projects, options) {
36425
36889
  return selected;
36426
36890
  }
36427
36891
  }
36892
+ async function createProjectFromInit(parsed, options) {
36893
+ var _a3;
36894
+ const existingProjectId = (_a3 = options.existingProjectConfig) == null ? void 0 : _a3.project_id;
36895
+ if (existingProjectId) {
36896
+ throw new Error(
36897
+ [
36898
+ `Current directory is already bound to Maker project ${existingProjectId}.`,
36899
+ "A Maker workspace directory can only be bound to one project at a time.",
36900
+ "Please create/open a new empty directory before creating a new Maker project."
36901
+ ].join("\n")
36902
+ );
36903
+ }
36904
+ const name = stringOption(parsed, "name") || stringOption(parsed, "project_name");
36905
+ if (!name && options.skipConfirm) {
36906
+ throw new Error("Missing --name in non-interactive create mode.");
36907
+ }
36908
+ const projectName = name || await promptRequired("Enter new Maker project name");
36909
+ return createMakerProject({
36910
+ name: projectName,
36911
+ gameType: "sce",
36912
+ pat: options.pat
36913
+ }).catch((error2) => {
36914
+ throw appendPatRecoveryUrl(error2, parsed);
36915
+ });
36916
+ }
36428
36917
  function ensureInitTargetCanRecordProject(targetDir, existingProjectId, selectedProjectId) {
36429
36918
  if (!existingProjectId || existingProjectId === selectedProjectId) {
36430
36919
  return;
@@ -36446,7 +36935,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
36446
36935
  onStart: (event) => emitSkillInstallerStart(ctx, event)
36447
36936
  });
36448
36937
  writeDevKitStagedGitignore(
36449
- path14.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
36938
+ path15.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
36450
36939
  listPresentDevKitManagedEntries(targetDir)
36451
36940
  );
36452
36941
  if (options.finalizeGitignore) {
@@ -36463,7 +36952,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
36463
36952
  );
36464
36953
  } catch (error2) {
36465
36954
  writeDevKitStagedGitignore(
36466
- path14.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
36955
+ path15.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
36467
36956
  listPresentDevKitManagedEntries(targetDir)
36468
36957
  );
36469
36958
  if (options.finalizeGitignore) {
@@ -36551,23 +37040,27 @@ function installMcpConfig(ide, options) {
36551
37040
  }
36552
37041
  function installMcpConfigUnsafe(ide, options) {
36553
37042
  if (ide === "codex") {
36554
- const configPath = path14.join(os4.homedir(), ".codex", "config.toml");
36555
- mergeCodexMcpConfig(configPath, options);
37043
+ const configPath = path15.join(os4.homedir(), ".codex", "config.toml");
37044
+ const write = mergeCodexMcpConfig(configPath, options);
36556
37045
  return {
36557
37046
  ide,
36558
37047
  ok: true,
36559
37048
  path: configPath,
36560
- message: `✓ Codex MCP config updated: ${configPath}`
37049
+ changed: write.changed,
37050
+ backupPath: write.backupPath,
37051
+ message: formatMcpInstallMessage("Codex", configPath, write)
36561
37052
  };
36562
37053
  }
36563
37054
  if (ide === "cursor") {
36564
- const configPath = path14.join(os4.homedir(), ".cursor", "mcp.json");
36565
- mergeJsonMcpConfig(configPath, options);
37055
+ const configPath = path15.join(os4.homedir(), ".cursor", "mcp.json");
37056
+ const write = mergeJsonMcpConfig(configPath, options);
36566
37057
  return {
36567
37058
  ide,
36568
37059
  ok: true,
36569
37060
  path: configPath,
36570
- message: `✓ Cursor MCP config updated: ${configPath}`
37061
+ changed: write.changed,
37062
+ backupPath: write.backupPath,
37063
+ message: formatMcpInstallMessage("Cursor", configPath, write)
36571
37064
  };
36572
37065
  }
36573
37066
  if (ide === "claude") {
@@ -36577,30 +37070,29 @@ function installMcpConfigUnsafe(ide, options) {
36577
37070
  return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
36578
37071
  }
36579
37072
  }
36580
- const configPath = path14.join(os4.homedir(), ".claude.json");
36581
- mergeJsonMcpConfig(configPath, options);
37073
+ const configPath = path15.join(os4.homedir(), ".claude.json");
37074
+ const write = mergeJsonMcpConfig(configPath, options);
36582
37075
  return {
36583
37076
  ide,
36584
37077
  ok: true,
36585
37078
  path: configPath,
36586
- message: `✓ Claude fallback MCP config updated: ${configPath}`
37079
+ changed: write.changed,
37080
+ backupPath: write.backupPath,
37081
+ message: formatMcpInstallMessage("Claude fallback", configPath, write)
36587
37082
  };
36588
37083
  }
36589
37084
  return { ide, ok: false, message: `Skipped unknown IDE: ${ide}` };
36590
37085
  }
36591
37086
  function mergeJsonMcpConfig(configPath, options) {
36592
- backupIfExists(configPath);
36593
37087
  const existing = readJsonObject(configPath);
36594
37088
  const mcpServers = asObject(existing.mcpServers);
36595
37089
  mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
36596
37090
  existing.mcpServers = mcpServers;
36597
- fs13.mkdirSync(path14.dirname(configPath), { recursive: true });
36598
- fs13.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
36599
- `, "utf8");
37091
+ return writeConfigWithTapTapBackupIfChanged(configPath, `${JSON.stringify(existing, null, 2)}
37092
+ `);
36600
37093
  }
36601
37094
  function mergeCodexMcpConfig(configPath, options) {
36602
- const backupPath = backupIfExists(configPath);
36603
- const existing = fs13.existsSync(configPath) ? fs13.readFileSync(configPath, "utf8") : "";
37095
+ const existing = fs14.existsSync(configPath) ? fs14.readFileSync(configPath, "utf8") : "";
36604
37096
  const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
36605
37097
  const withoutOld = existing.replace(sectionPattern, "").trimEnd();
36606
37098
  const launch = getNpxCliCommand(options.pkg);
@@ -36614,18 +37106,20 @@ function mergeCodexMcpConfig(configPath, options) {
36614
37106
  `TAPTAP_MCP_ENV = "${options.env}"`,
36615
37107
  ""
36616
37108
  ].join("\n");
36617
- fs13.mkdirSync(path14.dirname(configPath), { recursive: true });
36618
- fs13.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
36619
- const updated = fs13.readFileSync(configPath, "utf8");
36620
- const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
36621
- if (duplicates.length > 0) {
36622
- restoreBackup(configPath, backupPath);
36623
- throw new Error(
36624
- `Codex MCP config update would create duplicate table(s): ${duplicates.join(
36625
- ", "
36626
- )}. Restored previous config.`
36627
- );
36628
- }
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
+ );
36629
37123
  }
36630
37124
  function createCodexMcpSectionPattern(mcpName) {
36631
37125
  const keyPattern = createCodexMcpKeyPattern(mcpName);
@@ -36733,10 +37227,10 @@ function rejectPackageOption(parsed) {
36733
37227
  }
36734
37228
  }
36735
37229
  function readJsonObject(filePath) {
36736
- if (!fs13.existsSync(filePath)) {
37230
+ if (!fs14.existsSync(filePath)) {
36737
37231
  return {};
36738
37232
  }
36739
- return JSON.parse(fs13.readFileSync(filePath, "utf8"));
37233
+ return JSON.parse(fs14.readFileSync(filePath, "utf8"));
36740
37234
  }
36741
37235
  function asObject(value) {
36742
37236
  if (value && typeof value === "object" && !Array.isArray(value)) {
@@ -36744,27 +37238,44 @@ function asObject(value) {
36744
37238
  }
36745
37239
  return {};
36746
37240
  }
36747
- function backupIfExists(filePath) {
36748
- if (!fs13.existsSync(filePath)) {
36749
- 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;
36750
37263
  }
36751
- const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
36752
- const backupPath = `${filePath}.bak.${stamp}`;
36753
- fs13.copyFileSync(filePath, backupPath);
36754
- return backupPath;
36755
37264
  }
36756
- function restoreBackup(filePath, backupPath) {
36757
- if (backupPath) {
36758
- fs13.copyFileSync(backupPath, filePath);
36759
- return;
37265
+ function formatMcpInstallMessage(label, configPath, write) {
37266
+ if (!write.changed) {
37267
+ return `✓ ${label} MCP config unchanged: ${configPath}`;
36760
37268
  }
36761
- fs13.rmSync(filePath, { force: true });
37269
+ return [
37270
+ `✓ ${label} MCP config updated: ${configPath}`,
37271
+ write.backupPath ? ` Backup: ${write.backupPath}` : ""
37272
+ ].filter(Boolean).join("\n");
36762
37273
  }
36763
37274
  function saveInitState(targetDir, state) {
36764
- fs13.mkdirSync(getMakerHome(), { recursive: true });
36765
- const key = crypto2.createHash("sha256").update(path14.resolve(targetDir)).digest("hex").slice(0, 16);
36766
- fs13.writeFileSync(
36767
- 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`),
36768
37279
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
36769
37280
  `,
36770
37281
  "utf8"
@@ -36803,7 +37314,7 @@ function rejectRemovedAppsPaginationOptions(parsed) {
36803
37314
  }
36804
37315
  function formatMakerProjectList(projects, options = {}) {
36805
37316
  if (projects.length === 0) {
36806
- return "No Maker apps found.";
37317
+ return ["No Maker apps found.", "", "0,创建新项目 / 0. Create a new Maker project"].join("\n");
36807
37318
  }
36808
37319
  const sortedProjects = sortProjectsByRecentActivity(projects);
36809
37320
  const showAll = options.showAll === true;
@@ -36812,8 +37323,11 @@ function formatMakerProjectList(projects, options = {}) {
36812
37323
  return [
36813
37324
  `Maker apps (${projects.length})`,
36814
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",
36815
37327
  "",
36816
- ...visibleProjects.map((project, index) => formatProjectListItem(project, index))
37328
+ ...visibleProjects.map((project, index) => formatProjectListItem(project, index)),
37329
+ "",
37330
+ "0,创建新项目 / 0. Create a new Maker project"
36817
37331
  ].filter((line) => line !== "").join("\n");
36818
37332
  }
36819
37333
  function emit(ctx, step, message, data) {
@@ -36874,7 +37388,7 @@ function formatUnknownCommand(command) {
36874
37388
  return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
36875
37389
  }
36876
37390
  function isKnownSubcommand(command, subcommand) {
36877
- 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");
36878
37392
  }
36879
37393
  function stringOption(parsed, key) {
36880
37394
  const value = parsed.options[key];
@@ -36909,7 +37423,7 @@ function makerEnvOption(parsed) {
36909
37423
  return env;
36910
37424
  }
36911
37425
  const targetDir = stringOption(parsed, "target_dir");
36912
- return getMakerEnvironment(void 0, targetDir ? path14.resolve(targetDir) : process.cwd());
37426
+ return getMakerEnvironment(void 0, targetDir ? path15.resolve(targetDir) : process.cwd());
36913
37427
  }
36914
37428
  function mcpVerifyModeOption(parsed) {
36915
37429
  const mode = stringOption(parsed, "mode") || "npx";
@@ -36948,6 +37462,7 @@ function printHelp() {
36948
37462
  "Usage:",
36949
37463
  " taptap-maker Start MCP server mode",
36950
37464
  " taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
37465
+ " [--create --name NAME]",
36951
37466
  " [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
36952
37467
  " [--json]",
36953
37468
  " taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
@@ -36967,6 +37482,9 @@ function printHelp() {
36967
37482
  " taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
36968
37483
  " [--target-dir DIR] [--json]",
36969
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]",
36970
37488
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
36971
37489
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
36972
37490
  "",
@@ -37157,13 +37675,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
37157
37675
  }
37158
37676
 
37159
37677
  // node_modules/pkce-challenge/dist/index.node.js
37160
- var crypto3;
37678
+ var crypto4;
37161
37679
  var _a2;
37162
- 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
37163
37681
  globalThis.crypto ?? // Node.js >18
37164
37682
  import("node:crypto").then((m) => m.webcrypto);
37165
37683
  async function getRandomValues(size) {
37166
- return (await crypto3).getRandomValues(new Uint8Array(size));
37684
+ return (await crypto4).getRandomValues(new Uint8Array(size));
37167
37685
  }
37168
37686
  async function random(size) {
37169
37687
  const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
@@ -37179,7 +37697,7 @@ async function generateVerifier(length) {
37179
37697
  return await random(length);
37180
37698
  }
37181
37699
  async function generateChallenge(code_verifier) {
37182
- 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));
37183
37701
  return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
37184
37702
  }
37185
37703
  async function pkceChallenge(length) {
@@ -38534,8 +39052,8 @@ var StreamableHTTPClientTransport = class {
38534
39052
  };
38535
39053
 
38536
39054
  // src/mcp-proxy/proxy.ts
38537
- import * as path16 from "node:path";
38538
- import * as crypto5 from "node:crypto";
39055
+ import * as path17 from "node:path";
39056
+ import * as crypto6 from "node:crypto";
38539
39057
 
38540
39058
  // src/mcp-proxy/cookieJar.ts
38541
39059
  var CookieJar = class {
@@ -38716,9 +39234,9 @@ function createCookieFetch(cookieJar) {
38716
39234
  }
38717
39235
 
38718
39236
  // src/core/utils/logWriter.ts
38719
- import * as fs14 from "node:fs";
38720
- import * as path15 from "node:path";
38721
- 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";
38722
39240
 
38723
39241
  // src/core/types/log.ts
38724
39242
  var LOG_LEVEL_PRIORITY = {
@@ -38758,7 +39276,7 @@ var LogWriter = class {
38758
39276
  return;
38759
39277
  }
38760
39278
  try {
38761
- await fs14.promises.mkdir(this.config.logDir, { recursive: true });
39279
+ await fs15.promises.mkdir(this.config.logDir, { recursive: true });
38762
39280
  await this.cleanupOldLogs();
38763
39281
  this.initialized = true;
38764
39282
  } catch (error2) {
@@ -38781,7 +39299,7 @@ var LogWriter = class {
38781
39299
  */
38782
39300
  getLogFilePath(date5) {
38783
39301
  const d = date5 || this.getCurrentDate();
38784
- return path15.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
39302
+ return path16.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
38785
39303
  }
38786
39304
  /**
38787
39305
  * 获取或创建写入流
@@ -38796,7 +39314,7 @@ var LogWriter = class {
38796
39314
  }
38797
39315
  this.currentDate = date5;
38798
39316
  try {
38799
- this.writeStream = fs14.createWriteStream(this.getLogFilePath(date5), {
39317
+ this.writeStream = fs15.createWriteStream(this.getLogFilePath(date5), {
38800
39318
  flags: "a",
38801
39319
  encoding: "utf8"
38802
39320
  });
@@ -38848,11 +39366,11 @@ var LogWriter = class {
38848
39366
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
38849
39367
  try {
38850
39368
  const filePath = this.getLogFilePath();
38851
- const dir = path15.dirname(filePath);
38852
- if (!fs14.existsSync(dir)) {
38853
- fs14.mkdirSync(dir, { recursive: true });
39369
+ const dir = path16.dirname(filePath);
39370
+ if (!fs15.existsSync(dir)) {
39371
+ fs15.mkdirSync(dir, { recursive: true });
38854
39372
  }
38855
- fs14.appendFileSync(filePath, message, "utf8");
39373
+ fs15.appendFileSync(filePath, message, "utf8");
38856
39374
  } catch {
38857
39375
  }
38858
39376
  }
@@ -38863,7 +39381,7 @@ var LogWriter = class {
38863
39381
  async cleanupOldLogs() {
38864
39382
  if (this.config.maxDays <= 0) return;
38865
39383
  try {
38866
- const files = await fs14.promises.readdir(this.config.logDir);
39384
+ const files = await fs15.promises.readdir(this.config.logDir);
38867
39385
  const cutoffDate = /* @__PURE__ */ new Date();
38868
39386
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
38869
39387
  const prefix = this.config.prefix;
@@ -38878,7 +39396,7 @@ var LogWriter = class {
38878
39396
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
38879
39397
  const fileDate = new Date(year, month - 1, day);
38880
39398
  if (fileDate < cutoffDate) {
38881
- await fs14.promises.unlink(path15.join(this.config.logDir, file2));
39399
+ await fs15.promises.unlink(path16.join(this.config.logDir, file2));
38882
39400
  process.stderr.write(`[LogWriter] Deleted old log: ${file2}
38883
39401
  `);
38884
39402
  }
@@ -38952,10 +39470,10 @@ var TapTapMCPProxy = class {
38952
39470
  const { user_id, project_id } = this.config.tenant;
38953
39471
  let logDir;
38954
39472
  if (user_id && project_id) {
38955
- logDir = path16.join(logRoot, "proxy", user_id, project_id);
39473
+ logDir = path17.join(logRoot, "proxy", user_id, project_id);
38956
39474
  } else {
38957
- const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
38958
- 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);
38959
39477
  }
38960
39478
  return new LogWriter({
38961
39479
  logDir,
@@ -39612,6 +40130,7 @@ function printHelp2() {
39612
40130
  "Usage:",
39613
40131
  " taptap-maker Start MCP server mode",
39614
40132
  " taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
40133
+ " [--create --name NAME]",
39615
40134
  " [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
39616
40135
  " [--json]",
39617
40136
  " taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
@@ -39626,10 +40145,14 @@ function printHelp2() {
39626
40145
  " taptap-maker pat set [--pat-stdin] [--json]",
39627
40146
  " taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
39628
40147
  " taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
40148
+ " [--target-dir DIR]",
39629
40149
  " [--json] # alias for mcp install",
39630
40150
  " taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
39631
- " [--json]",
40151
+ " [--target-dir DIR] [--json]",
39632
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]",
39633
40156
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
39634
40157
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
39635
40158
  "",