@taptap/maker 0.0.26-beta.2 → 0.0.26-beta.4
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/README.md +1 -1
- package/dist/maker.js +780 -368
- package/docs/MAKER_MCP_CONNECTION_TROUBLESHOOTING.md +7 -0
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +10 -9
package/dist/maker.js
CHANGED
|
@@ -3233,8 +3233,8 @@ var require_utils = __commonJS({
|
|
|
3233
3233
|
}
|
|
3234
3234
|
return ind;
|
|
3235
3235
|
}
|
|
3236
|
-
function removeDotSegments(
|
|
3237
|
-
let input2 =
|
|
3236
|
+
function removeDotSegments(path22) {
|
|
3237
|
+
let input2 = path22;
|
|
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 [
|
|
3437
|
-
wsComponent.path =
|
|
3436
|
+
const [path22, query] = wsComponent.resourceName.split("?");
|
|
3437
|
+
wsComponent.path = path22 && path22 !== "/" ? path22 : 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,
|
|
12494
|
+
function addFormats(ajv, list, fs20, 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,
|
|
12499
|
+
ajv.addFormat(f, fs20[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
|
|
12513
|
-
function checkPathExt(
|
|
12512
|
+
var fs20 = __require("fs");
|
|
12513
|
+
function checkPathExt(path22, 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 &&
|
|
12524
|
+
if (p && path22.substr(-p.length).toLowerCase() === p) {
|
|
12525
12525
|
return true;
|
|
12526
12526
|
}
|
|
12527
12527
|
}
|
|
12528
12528
|
return false;
|
|
12529
12529
|
}
|
|
12530
|
-
function checkStat(stat,
|
|
12530
|
+
function checkStat(stat, path22, options) {
|
|
12531
12531
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12532
12532
|
return false;
|
|
12533
12533
|
}
|
|
12534
|
-
return checkPathExt(
|
|
12534
|
+
return checkPathExt(path22, options);
|
|
12535
12535
|
}
|
|
12536
|
-
function isexe(
|
|
12537
|
-
|
|
12538
|
-
cb(er, er ? false : checkStat(stat,
|
|
12536
|
+
function isexe(path22, options, cb) {
|
|
12537
|
+
fs20.stat(path22, function(er, stat) {
|
|
12538
|
+
cb(er, er ? false : checkStat(stat, path22, options));
|
|
12539
12539
|
});
|
|
12540
12540
|
}
|
|
12541
|
-
function sync(
|
|
12542
|
-
return checkStat(
|
|
12541
|
+
function sync(path22, options) {
|
|
12542
|
+
return checkStat(fs20.statSync(path22), path22, 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
|
|
12553
|
-
function isexe(
|
|
12554
|
-
|
|
12552
|
+
var fs20 = __require("fs");
|
|
12553
|
+
function isexe(path22, options, cb) {
|
|
12554
|
+
fs20.stat(path22, function(er, stat) {
|
|
12555
12555
|
cb(er, er ? false : checkStat(stat, options));
|
|
12556
12556
|
});
|
|
12557
12557
|
}
|
|
12558
|
-
function sync(
|
|
12559
|
-
return checkStat(
|
|
12558
|
+
function sync(path22, options) {
|
|
12559
|
+
return checkStat(fs20.statSync(path22), 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
|
|
12583
|
+
var fs20 = __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(
|
|
12592
|
+
function isexe(path22, 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(
|
|
12602
|
+
isexe(path22, 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(
|
|
12611
|
+
core(path22, 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(
|
|
12621
|
+
function sync(path22, options) {
|
|
12622
12622
|
try {
|
|
12623
|
-
return core.sync(
|
|
12623
|
+
return core.sync(path22, 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
|
|
12639
|
+
var path22 = __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 =
|
|
12677
|
+
const pCmd = path22.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 =
|
|
12704
|
+
const pCmd = path22.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
|
|
12752
|
+
var path22 = __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 ?
|
|
12770
|
+
pathExt: withoutPathExt ? path22.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 =
|
|
12779
|
+
resolved = path22.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 [
|
|
12834
|
-
const binary =
|
|
12833
|
+
const [path22, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12834
|
+
const binary = path22.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
|
|
12847
|
+
var fs20 = __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 =
|
|
12855
|
-
|
|
12856
|
-
|
|
12854
|
+
fd = fs20.openSync(command, "r");
|
|
12855
|
+
fs20.readSync(fd, buffer, 0, size, 0);
|
|
12856
|
+
fs20.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
|
|
12869
|
+
var path22 = __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 =
|
|
12894
|
+
parsed.command = path22.normalize(parsed.command);
|
|
12895
12895
|
parsed.command = escape2.command(parsed.command);
|
|
12896
12896
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
12897
12897
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -13003,8 +13003,8 @@ var require_cross_spawn = __commonJS({
|
|
|
13003
13003
|
|
|
13004
13004
|
// src/maker/server/mcp.ts
|
|
13005
13005
|
import { execFileSync, spawn as spawn4 } from "node:child_process";
|
|
13006
|
-
import
|
|
13007
|
-
import
|
|
13006
|
+
import fs17 from "node:fs";
|
|
13007
|
+
import path18 from "node:path";
|
|
13008
13008
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
13009
13009
|
|
|
13010
13010
|
// node_modules/zod/v3/helpers/util.js
|
|
@@ -13366,8 +13366,8 @@ function getErrorMap() {
|
|
|
13366
13366
|
|
|
13367
13367
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
13368
13368
|
var makeIssue = (params) => {
|
|
13369
|
-
const { data, path:
|
|
13370
|
-
const fullPath = [...
|
|
13369
|
+
const { data, path: path22, errorMaps, issueData } = params;
|
|
13370
|
+
const fullPath = [...path22, ...issueData.path || []];
|
|
13371
13371
|
const fullIssue = {
|
|
13372
13372
|
...issueData,
|
|
13373
13373
|
path: fullPath
|
|
@@ -13482,11 +13482,11 @@ var errorUtil;
|
|
|
13482
13482
|
|
|
13483
13483
|
// node_modules/zod/v3/types.js
|
|
13484
13484
|
var ParseInputLazyPath = class {
|
|
13485
|
-
constructor(parent, value,
|
|
13485
|
+
constructor(parent, value, path22, key) {
|
|
13486
13486
|
this._cachedPath = [];
|
|
13487
13487
|
this.parent = parent;
|
|
13488
13488
|
this.data = value;
|
|
13489
|
-
this._path =
|
|
13489
|
+
this._path = path22;
|
|
13490
13490
|
this._key = key;
|
|
13491
13491
|
}
|
|
13492
13492
|
get path() {
|
|
@@ -17135,10 +17135,10 @@ function mergeDefs(...defs) {
|
|
|
17135
17135
|
function cloneDef(schema) {
|
|
17136
17136
|
return mergeDefs(schema._zod.def);
|
|
17137
17137
|
}
|
|
17138
|
-
function getElementAtPath(obj,
|
|
17139
|
-
if (!
|
|
17138
|
+
function getElementAtPath(obj, path22) {
|
|
17139
|
+
if (!path22)
|
|
17140
17140
|
return obj;
|
|
17141
|
-
return
|
|
17141
|
+
return path22.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
17142
17142
|
}
|
|
17143
17143
|
function promiseAllObject(promisesObj) {
|
|
17144
17144
|
const keys = Object.keys(promisesObj);
|
|
@@ -17523,11 +17523,11 @@ function aborted(x, startIndex = 0) {
|
|
|
17523
17523
|
}
|
|
17524
17524
|
return false;
|
|
17525
17525
|
}
|
|
17526
|
-
function prefixIssues(
|
|
17526
|
+
function prefixIssues(path22, issues) {
|
|
17527
17527
|
return issues.map((iss) => {
|
|
17528
17528
|
var _a3;
|
|
17529
17529
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
17530
|
-
iss.path.unshift(
|
|
17530
|
+
iss.path.unshift(path22);
|
|
17531
17531
|
return iss;
|
|
17532
17532
|
});
|
|
17533
17533
|
}
|
|
@@ -29156,6 +29156,22 @@ async function fetchWithTimeout(fetchImpl, url2, init, timeoutMs, label) {
|
|
|
29156
29156
|
import crypto from "node:crypto";
|
|
29157
29157
|
import fs5 from "node:fs";
|
|
29158
29158
|
import path6 from "node:path";
|
|
29159
|
+
|
|
29160
|
+
// src/maker/capabilityRouting.ts
|
|
29161
|
+
var MAKER_CAPABILITY_ROUTING_INDEX = `TapTap Maker routing index:
|
|
29162
|
+
- Start or resume Maker work, or diagnose project/MCP readiness: read
|
|
29163
|
+
maker://status; use maker_status_lite when resources are unavailable.
|
|
29164
|
+
- Build, preview, run, submit, or push: after checking project status, use
|
|
29165
|
+
maker_build_current_directory.
|
|
29166
|
+
- Tap flows: test QR -> generate_test_qrcode; ads or ad code -> first check
|
|
29167
|
+
Maker project status, then use get_ad_config when primary configs are ready;
|
|
29168
|
+
online player feedback, logs, or screenshots -> get_debug_feedbacks.
|
|
29169
|
+
- Game assets: Maker MCP also provides image, video, music, sound-effect,
|
|
29170
|
+
dialogue/voice, and 3D generation tools when exposed.
|
|
29171
|
+
|
|
29172
|
+
Follow the selected tool schema and returned next_action.`;
|
|
29173
|
+
|
|
29174
|
+
// src/maker/cli/agentsPolicy.ts
|
|
29159
29175
|
var MAKER_AGENTS_FILE = "AGENTS.md";
|
|
29160
29176
|
var POLICY_VERSION = "3";
|
|
29161
29177
|
var POLICY_END = "<!-- <<< TapTap Maker managed AGENTS policy <<< -->";
|
|
@@ -29243,6 +29259,8 @@ function createMakerAgentsPolicyBody() {
|
|
|
29243
29259
|
"",
|
|
29244
29260
|
"This is a bound TapTap Maker project.",
|
|
29245
29261
|
"",
|
|
29262
|
+
MAKER_CAPABILITY_ROUTING_INDEX,
|
|
29263
|
+
"",
|
|
29246
29264
|
"Maker build workflow:",
|
|
29247
29265
|
"",
|
|
29248
29266
|
"- For user requests such as 构建, build, 预览, 跑一下, 查看结果, 看看效果, 验证游戏效果,",
|
|
@@ -29301,15 +29319,17 @@ function createMakerAgentsPolicyBody() {
|
|
|
29301
29319
|
"",
|
|
29302
29320
|
"Maker ad workflow:",
|
|
29303
29321
|
"",
|
|
29304
|
-
"- For any ad-related request or code touching ads, first
|
|
29322
|
+
"- For any ad-related request or code touching ads, first inspect Maker project status. Call",
|
|
29323
|
+
" `get_ad_config` only after primary local project configs are initialized and before reading",
|
|
29305
29324
|
" local SDK docs, editing ad code, or testing ad behavior. Triggers include 广告, 激励视频,",
|
|
29306
29325
|
" 播放广告, ad ID, ad placement, ad status, ad config, and `ShowRewardVideoAd`.",
|
|
29307
29326
|
"- Treat `get_ad_config` as the source of truth for current project ad activation status and",
|
|
29308
29327
|
" ad config. Do not infer ad readiness from local SDK docs, `.maker-mcp/config.json`, or",
|
|
29309
29328
|
" runtime callbacks.",
|
|
29310
|
-
"- If
|
|
29311
|
-
"
|
|
29312
|
-
"
|
|
29329
|
+
"- If primary local project configs are missing, keep ad config unavailable and do not call the",
|
|
29330
|
+
" remote tool. Build only for an explicit user build/submit/preview request. If a successful",
|
|
29331
|
+
" build still leaves local configs missing, explain the known limitation and do not rebuild",
|
|
29332
|
+
" automatically. Implement or test ad code only after the config is available.",
|
|
29313
29333
|
"- If `get_ad_config` reports missing `app_id` or `developer_id`, call",
|
|
29314
29334
|
" `generate_test_qrcode` once to generate test QR code metadata, then call `get_ad_config`",
|
|
29315
29335
|
" again. Do not use publish-only tools for this recovery path.",
|
|
@@ -32412,9 +32432,9 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
32412
32432
|
"- Voice audition previews are not saved to the project.",
|
|
32413
32433
|
"- Local MCP does not transcode generated audio to OGG.",
|
|
32414
32434
|
"- Use create_3d_asset with start/query/continue/post_process for game 3D model assets.",
|
|
32415
|
-
"- For any ad-related request, call get_ad_config
|
|
32435
|
+
"- For any ad-related request, inspect Maker project status first and call get_ad_config only after primary local project configs are initialized.",
|
|
32416
32436
|
"- Do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks.",
|
|
32417
|
-
"- If
|
|
32437
|
+
"- If primary local project configs are missing, keep ad config unavailable. Build only for an explicit user build/submit/preview request, and do not automatically rebuild when local configs remain missing after success.",
|
|
32418
32438
|
"- If get_ad_config reports missing app_id or developer_id, call generate_test_qrcode once, then call get_ad_config again.",
|
|
32419
32439
|
"- For online player feedback, issue reports, real-device logs, or screenshots, call get_debug_feedbacks.",
|
|
32420
32440
|
"- Use local runtime logs only for the current local build/runtime session.",
|
|
@@ -33377,7 +33397,7 @@ function formatMakerProjectInitializationStatus(status) {
|
|
|
33377
33397
|
"- status: missing_project_json",
|
|
33378
33398
|
`- config: ${status.projectJsonPath}`,
|
|
33379
33399
|
"- impact: get_ad_config and other remote project-config tools cannot read project metadata yet.",
|
|
33380
|
-
projectDirState === "
|
|
33400
|
+
projectDirState === "invalid" ? "- next_action: .project 路径异常;先恢复为正常目录,再检查或恢复 project.json。" : "- next_action: 本地主要配置尚未初始化;仅当用户明确要求构建、提交或预览时调用 maker_build_current_directory。构建成功后若本地仍缺少 .project/project.json,保持配置依赖功能不可用,不要自动重复构建。"
|
|
33381
33401
|
].join("\n");
|
|
33382
33402
|
}
|
|
33383
33403
|
return "";
|
|
@@ -33457,7 +33477,8 @@ function inspectMakerProjectHealth(projectRoot, mode = "status") {
|
|
|
33457
33477
|
const resourcesJsonExists = resourcesJsonState === "file";
|
|
33458
33478
|
const settingsJsonExists = settingsJsonState === "file";
|
|
33459
33479
|
const hasMisplacedConfig = issues.some((item) => item.code === "misplaced_config");
|
|
33460
|
-
|
|
33480
|
+
const hasNoPrimaryConfig = projectJsonState === "missing" && settingsJsonState === "missing";
|
|
33481
|
+
if (hasNoPrimaryConfig && !hasMisplacedConfig && issues.length === 0) {
|
|
33461
33482
|
return createHealthResult(
|
|
33462
33483
|
resolvedProjectRoot,
|
|
33463
33484
|
mode,
|
|
@@ -33468,15 +33489,10 @@ function inspectMakerProjectHealth(projectRoot, mode = "status") {
|
|
|
33468
33489
|
false
|
|
33469
33490
|
);
|
|
33470
33491
|
}
|
|
33471
|
-
addCanonicalFileIssue(projectJsonState, ".project/project.json", issues,
|
|
33472
|
-
addCanonicalFileIssue(
|
|
33473
|
-
resourcesJsonState,
|
|
33474
|
-
".project/resources.json",
|
|
33475
|
-
issues,
|
|
33476
|
-
mode === "qrcode" || projectDirExists
|
|
33477
|
-
);
|
|
33492
|
+
addCanonicalFileIssue(projectJsonState, ".project/project.json", issues, mode === "qrcode");
|
|
33493
|
+
addCanonicalFileIssue(resourcesJsonState, ".project/resources.json", issues, mode === "qrcode");
|
|
33478
33494
|
addCanonicalFileIssue(settingsJsonState, ".project/settings.json", issues, false);
|
|
33479
|
-
if (
|
|
33495
|
+
if (projectJsonExists && settingsJsonState === "missing") {
|
|
33480
33496
|
issues.push(
|
|
33481
33497
|
issue2(
|
|
33482
33498
|
"missing_settings_json",
|
|
@@ -33536,9 +33552,10 @@ function inspectMakerProjectHealth(projectRoot, mode = "status") {
|
|
|
33536
33552
|
}
|
|
33537
33553
|
}
|
|
33538
33554
|
const hasFatalIssues = issues.some((item) => item.severity === "error");
|
|
33539
|
-
const
|
|
33555
|
+
const hasCompletePrimaryConfig = projectJsonExists && settingsJsonExists;
|
|
33556
|
+
const status = hasMisplacedConfig ? "misplaced_config" : hasFatalIssues ? "error" : !hasCompletePrimaryConfig ? "not_initialized" : issues.length > 0 ? "warning" : "ready";
|
|
33540
33557
|
const canBuild = !issues.some((item) => item.severity === "error" && isBuildBlockingIssue(item));
|
|
33541
|
-
const canGenerateTestQrcode = canGenerateQrcode(project, resources2, issues);
|
|
33558
|
+
const canGenerateTestQrcode = canGenerateQrcode(project, resources2, settingsJsonExists, issues);
|
|
33542
33559
|
return createHealthResult(
|
|
33543
33560
|
resolvedProjectRoot,
|
|
33544
33561
|
mode,
|
|
@@ -33572,8 +33589,9 @@ function formatMakerProjectHealthStatus(health) {
|
|
|
33572
33589
|
if (settingsSection) {
|
|
33573
33590
|
lines.push("", settingsSection);
|
|
33574
33591
|
}
|
|
33592
|
+
const isMissingSettings = health.issues.some((item) => item.code === "missing_settings_json");
|
|
33575
33593
|
lines.push(
|
|
33576
|
-
health.canBuild && !health.canGenerateTestQrcode ? "- next_action: 可以继续构建;生成测试二维码前请完善 .project/project.json 发布配置。" : health.canBuild ? "- next_action: 可以继续构建;检查器不会自动移动或覆盖文件。" : "- next_action: 修复上面的规范路径或配置问题后再构建;检查器不会自动移动或覆盖文件。"
|
|
33594
|
+
health.canBuild && !health.canGenerateTestQrcode ? isMissingSettings ? "- next_action: 可以继续构建;生成测试二维码前需要 .project/settings.json。" : "- next_action: 可以继续构建;生成测试二维码前请完善 .project/project.json 发布配置。" : health.canBuild ? "- next_action: 可以继续构建;检查器不会自动移动或覆盖文件。" : "- next_action: 修复上面的规范路径或配置问题后再构建;检查器不会自动移动或覆盖文件。"
|
|
33577
33595
|
);
|
|
33578
33596
|
return lines.join("\n");
|
|
33579
33597
|
}
|
|
@@ -33816,18 +33834,25 @@ function isConfiguredTitle(value) {
|
|
|
33816
33834
|
const title = value.trim();
|
|
33817
33835
|
return !(title.startsWith("<") && title.endsWith(">") || title.startsWith("{") && title.endsWith("}"));
|
|
33818
33836
|
}
|
|
33819
|
-
function canGenerateQrcode(project, resources2, issues) {
|
|
33820
|
-
if (!isPlainObject3(project) || !isPlainObject3(resources2) || !isConfiguredString(project.project_id) || !isConfiguredString(project.version) || !hasProjectEntry(project, resources2, "qrcode") || !isPlainObject3(project.taptap_publish)) {
|
|
33837
|
+
function canGenerateQrcode(project, resources2, settingsExists, issues) {
|
|
33838
|
+
if (!isPlainObject3(project) || !isPlainObject3(resources2) || !settingsExists || !isConfiguredString(project.project_id) || !isConfiguredString(project.version) || !hasProjectEntry(project, resources2, "qrcode") || !isPlainObject3(project.taptap_publish)) {
|
|
33821
33839
|
return false;
|
|
33822
33840
|
}
|
|
33823
33841
|
const publish = project.taptap_publish;
|
|
33824
|
-
if (!isConfiguredTitle(publish.title) || !isConfiguredString(publish.category)
|
|
33842
|
+
if (!isConfiguredTitle(publish.title) || !isConfiguredString(publish.category)) {
|
|
33843
|
+
return false;
|
|
33844
|
+
}
|
|
33845
|
+
const orientation = publish.screen_orientation;
|
|
33846
|
+
if (orientation !== void 0 && orientation !== "landscape" && orientation !== "portrait") {
|
|
33825
33847
|
return false;
|
|
33826
33848
|
}
|
|
33827
33849
|
return !issues.some((item) => {
|
|
33828
33850
|
if (item.severity !== "error") {
|
|
33829
33851
|
return false;
|
|
33830
33852
|
}
|
|
33853
|
+
if (orientation === void 0 && item.code === "invalid_publish_field" && item.path === "taptap_publish.screen_orientation") {
|
|
33854
|
+
return false;
|
|
33855
|
+
}
|
|
33831
33856
|
if (item.path === "taptap_publish" || item.path.startsWith("taptap_publish.")) {
|
|
33832
33857
|
return true;
|
|
33833
33858
|
}
|
|
@@ -33935,10 +33960,100 @@ function sameStringSet(left, right) {
|
|
|
33935
33960
|
return left.length === right.length && right.every((item) => left.includes(item));
|
|
33936
33961
|
}
|
|
33937
33962
|
|
|
33938
|
-
// src/maker/
|
|
33963
|
+
// src/maker/qrcodePreflight.ts
|
|
33964
|
+
import { randomUUID } from "node:crypto";
|
|
33939
33965
|
import fs15 from "node:fs";
|
|
33940
33966
|
import path16 from "node:path";
|
|
33941
|
-
|
|
33967
|
+
function inspectMakerQrcodePreflight(projectRoot, confirmedOrientation) {
|
|
33968
|
+
const projectJsonPath = path16.join(path16.resolve(projectRoot), ".project", "project.json");
|
|
33969
|
+
let projectJsonText;
|
|
33970
|
+
let project;
|
|
33971
|
+
try {
|
|
33972
|
+
projectJsonText = fs15.readFileSync(projectJsonPath, "utf8");
|
|
33973
|
+
project = JSON.parse(projectJsonText);
|
|
33974
|
+
} catch (error2) {
|
|
33975
|
+
return {
|
|
33976
|
+
ok: false,
|
|
33977
|
+
message: [
|
|
33978
|
+
"Maker QR project configuration is not ready.",
|
|
33979
|
+
`- config: ${projectJsonPath}`,
|
|
33980
|
+
`- error: ${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
33981
|
+
"- next_action: Restore or initialize .project/project.json, then retry."
|
|
33982
|
+
].join("\n")
|
|
33983
|
+
};
|
|
33984
|
+
}
|
|
33985
|
+
const configuredOrientation = readConfiguredOrientation(project);
|
|
33986
|
+
if (configuredOrientation) {
|
|
33987
|
+
return { ok: true, orientation: configuredOrientation };
|
|
33988
|
+
}
|
|
33989
|
+
if (!isScreenOrientation(confirmedOrientation)) {
|
|
33990
|
+
return {
|
|
33991
|
+
ok: false,
|
|
33992
|
+
message: [
|
|
33993
|
+
"Maker QR orientation is not configured yet.",
|
|
33994
|
+
"- field: taptap_publish.screen_orientation",
|
|
33995
|
+
"- next_action: Ask the user in a separate conversation turn to choose landscape or portrait, then retry with confirmed_screen_orientation.",
|
|
33996
|
+
"- do_not: Do not infer or default the game orientation."
|
|
33997
|
+
].join("\n")
|
|
33998
|
+
};
|
|
33999
|
+
}
|
|
34000
|
+
if (!isRecord(project) || !isRecord(project.taptap_publish)) {
|
|
34001
|
+
return {
|
|
34002
|
+
ok: false,
|
|
34003
|
+
message: [
|
|
34004
|
+
"Maker QR project publishing configuration is not ready.",
|
|
34005
|
+
"- missing: taptap_publish",
|
|
34006
|
+
"- next_action: Restore or initialize the taptap_publish configuration, then retry."
|
|
34007
|
+
].join("\n")
|
|
34008
|
+
};
|
|
34009
|
+
}
|
|
34010
|
+
project.taptap_publish.screen_orientation = confirmedOrientation;
|
|
34011
|
+
const tempPath = `${projectJsonPath}.${randomUUID()}.tmp`;
|
|
34012
|
+
try {
|
|
34013
|
+
fs15.writeFileSync(tempPath, `${JSON.stringify(project, null, 2)}
|
|
34014
|
+
`, {
|
|
34015
|
+
encoding: "utf8",
|
|
34016
|
+
flag: "wx"
|
|
34017
|
+
});
|
|
34018
|
+
if (fs15.readFileSync(projectJsonPath, "utf8") !== projectJsonText) {
|
|
34019
|
+
throw new Error("Maker QR project configuration changed while saving; retry the operation.");
|
|
34020
|
+
}
|
|
34021
|
+
fs15.renameSync(tempPath, projectJsonPath);
|
|
34022
|
+
} catch (error2) {
|
|
34023
|
+
try {
|
|
34024
|
+
fs15.rmSync(tempPath, { force: true });
|
|
34025
|
+
} catch {
|
|
34026
|
+
}
|
|
34027
|
+
return {
|
|
34028
|
+
ok: false,
|
|
34029
|
+
message: [
|
|
34030
|
+
"Maker QR project orientation could not be saved.",
|
|
34031
|
+
`- config: ${projectJsonPath}`,
|
|
34032
|
+
`- error: ${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
34033
|
+
"- next_action: Fix the project configuration write error, then retry."
|
|
34034
|
+
].join("\n")
|
|
34035
|
+
};
|
|
34036
|
+
}
|
|
34037
|
+
return { ok: true, orientation: confirmedOrientation };
|
|
34038
|
+
}
|
|
34039
|
+
function readConfiguredOrientation(project) {
|
|
34040
|
+
if (!isRecord(project) || !isRecord(project.taptap_publish)) {
|
|
34041
|
+
return void 0;
|
|
34042
|
+
}
|
|
34043
|
+
const orientation = project.taptap_publish.screen_orientation;
|
|
34044
|
+
return isScreenOrientation(orientation) ? orientation : void 0;
|
|
34045
|
+
}
|
|
34046
|
+
function isScreenOrientation(value) {
|
|
34047
|
+
return value === "landscape" || value === "portrait";
|
|
34048
|
+
}
|
|
34049
|
+
function isRecord(value) {
|
|
34050
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
34051
|
+
}
|
|
34052
|
+
|
|
34053
|
+
// src/maker/server/proxyAssets.ts
|
|
34054
|
+
import fs16 from "node:fs";
|
|
34055
|
+
import path17 from "node:path";
|
|
34056
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
33942
34057
|
|
|
33943
34058
|
// src/maker/server/diagnosticRedaction.ts
|
|
33944
34059
|
function isSensitiveDiagnosticKey(key) {
|
|
@@ -34071,7 +34186,7 @@ function prepareRemoteProxyToolArgs(options) {
|
|
|
34071
34186
|
}
|
|
34072
34187
|
function validateVoiceAuditionArgs(args) {
|
|
34073
34188
|
const voiceProfile = args.voice_profile;
|
|
34074
|
-
const gender =
|
|
34189
|
+
const gender = isRecord2(voiceProfile) ? voiceProfile.gender : void 0;
|
|
34075
34190
|
if (gender !== "male" && gender !== "female") {
|
|
34076
34191
|
throw new Error(
|
|
34077
34192
|
"voice_profile.gender is required for character voice audition and must be male or female. Extract it from character_description or the character settings before retrying."
|
|
@@ -34235,7 +34350,7 @@ async function materializeDebugFeedbackResult(options) {
|
|
|
34235
34350
|
...materialized
|
|
34236
34351
|
});
|
|
34237
34352
|
}
|
|
34238
|
-
const localCandidateSaveDir = remoteSaveDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteSaveDir) : feedbacks.some(hasDebugFeedbackArtifactUrls) ?
|
|
34353
|
+
const localCandidateSaveDir = remoteSaveDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteSaveDir) : feedbacks.some(hasDebugFeedbackArtifactUrls) ? path17.join(options.targetDir, "logs", "feed_back") : void 0;
|
|
34239
34354
|
const filesVerifiedLocally = nextFeedbacks.some(
|
|
34240
34355
|
(feedback) => numberField2(feedback.artifacts_downloaded) > 0
|
|
34241
34356
|
);
|
|
@@ -34263,7 +34378,7 @@ async function materializeDebugFeedbackArtifacts(options) {
|
|
|
34263
34378
|
if (logUrls.length === 0 && screenshotUrls.length === 0 && extraUrls.length === 0) {
|
|
34264
34379
|
return {};
|
|
34265
34380
|
}
|
|
34266
|
-
const localDir =
|
|
34381
|
+
const localDir = path17.join(options.targetDir, "logs", "feed_back", `feedback_${feedbackId}`);
|
|
34267
34382
|
const localLogPaths = [];
|
|
34268
34383
|
const localScreenshotPaths = [];
|
|
34269
34384
|
const localDownloadPaths = [];
|
|
@@ -34271,7 +34386,7 @@ async function materializeDebugFeedbackArtifacts(options) {
|
|
|
34271
34386
|
for (const [index, url2] of logUrls.entries()) {
|
|
34272
34387
|
const result = await downloadDebugFeedbackArtifact({
|
|
34273
34388
|
url: url2,
|
|
34274
|
-
directory:
|
|
34389
|
+
directory: path17.join(localDir, "logs"),
|
|
34275
34390
|
fallbackName: `log_${index + 1}.log`,
|
|
34276
34391
|
fetchImpl: options.fetchImpl
|
|
34277
34392
|
});
|
|
@@ -34284,7 +34399,7 @@ async function materializeDebugFeedbackArtifacts(options) {
|
|
|
34284
34399
|
for (const [index, url2] of screenshotUrls.entries()) {
|
|
34285
34400
|
const result = await downloadDebugFeedbackArtifact({
|
|
34286
34401
|
url: url2,
|
|
34287
|
-
directory:
|
|
34402
|
+
directory: path17.join(localDir, "screenshots"),
|
|
34288
34403
|
fallbackName: `screenshot_${index + 1}.png`,
|
|
34289
34404
|
fetchImpl: options.fetchImpl
|
|
34290
34405
|
});
|
|
@@ -34297,7 +34412,7 @@ async function materializeDebugFeedbackArtifacts(options) {
|
|
|
34297
34412
|
for (const [index, url2] of extraUrls.entries()) {
|
|
34298
34413
|
const result = await downloadDebugFeedbackArtifact({
|
|
34299
34414
|
url: url2,
|
|
34300
|
-
directory:
|
|
34415
|
+
directory: path17.join(localDir, "downloads"),
|
|
34301
34416
|
fallbackName: `artifact_${index + 1}`,
|
|
34302
34417
|
fetchImpl: options.fetchImpl
|
|
34303
34418
|
});
|
|
@@ -34325,14 +34440,14 @@ async function downloadDebugFeedbackArtifact(options) {
|
|
|
34325
34440
|
error: `${options.url}: HTTP ${response.status}`
|
|
34326
34441
|
};
|
|
34327
34442
|
}
|
|
34328
|
-
|
|
34443
|
+
fs16.mkdirSync(options.directory, { recursive: true });
|
|
34329
34444
|
const filePath = allocateDebugFeedbackArtifactPath(
|
|
34330
34445
|
options.directory,
|
|
34331
34446
|
options.url,
|
|
34332
34447
|
options.fallbackName
|
|
34333
34448
|
);
|
|
34334
34449
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
34335
|
-
|
|
34450
|
+
fs16.writeFileSync(filePath, bytes);
|
|
34336
34451
|
return { success: true, path: filePath };
|
|
34337
34452
|
} catch (error2) {
|
|
34338
34453
|
return {
|
|
@@ -34343,14 +34458,14 @@ async function downloadDebugFeedbackArtifact(options) {
|
|
|
34343
34458
|
}
|
|
34344
34459
|
function allocateDebugFeedbackArtifactPath(directory, url2, fallbackName) {
|
|
34345
34460
|
const rawName = fileNameFromUrl(url2) || fallbackName;
|
|
34346
|
-
const rawExtension =
|
|
34461
|
+
const rawExtension = path17.extname(rawName);
|
|
34347
34462
|
const finalExtension = rawExtension && rawExtension !== "." ? rawExtension.replace(/[^A-Za-z0-9.]/g, "_") : "";
|
|
34348
34463
|
const rawStem = finalExtension ? rawName.slice(0, -rawExtension.length) : rawName;
|
|
34349
34464
|
const stem = sanitizeAssetBaseName(rawStem);
|
|
34350
34465
|
for (let index = 1; index <= 9999; index += 1) {
|
|
34351
34466
|
const suffix = index === 1 ? "" : `_${index}`;
|
|
34352
|
-
const candidate =
|
|
34353
|
-
if (!
|
|
34467
|
+
const candidate = path17.join(directory, `${stem}${suffix}${finalExtension}`);
|
|
34468
|
+
if (!fs16.existsSync(candidate)) {
|
|
34354
34469
|
return candidate;
|
|
34355
34470
|
}
|
|
34356
34471
|
}
|
|
@@ -34359,7 +34474,7 @@ function allocateDebugFeedbackArtifactPath(directory, url2, fallbackName) {
|
|
|
34359
34474
|
function fileNameFromUrl(url2) {
|
|
34360
34475
|
try {
|
|
34361
34476
|
const pathname = new URL(url2).pathname;
|
|
34362
|
-
const name = decodeURIComponent(
|
|
34477
|
+
const name = decodeURIComponent(path17.basename(pathname));
|
|
34363
34478
|
return name && name !== "/" ? name : void 0;
|
|
34364
34479
|
} catch {
|
|
34365
34480
|
return void 0;
|
|
@@ -34370,18 +34485,18 @@ function hasDebugFeedbackArtifactUrls(feedback) {
|
|
|
34370
34485
|
}
|
|
34371
34486
|
function getDebugFeedbackSaveDir(payload) {
|
|
34372
34487
|
const summary = payload.summary;
|
|
34373
|
-
return stringField2(payload.save_dir) || (
|
|
34488
|
+
return stringField2(payload.save_dir) || (isRecord2(summary) ? stringField2(summary.save_dir) : void 0);
|
|
34374
34489
|
}
|
|
34375
34490
|
function resolveDebugFeedbackCandidatePath(targetDir, remotePath) {
|
|
34376
|
-
if (
|
|
34491
|
+
if (path17.isAbsolute(remotePath)) {
|
|
34377
34492
|
return void 0;
|
|
34378
34493
|
}
|
|
34379
34494
|
const trimmedRemotePath = remotePath.replace(/[\\/]+$/, "");
|
|
34380
|
-
return
|
|
34495
|
+
return path17.normalize(path17.join(targetDir, trimmedRemotePath || "."));
|
|
34381
34496
|
}
|
|
34382
34497
|
function replaceDebugFeedbackItems(payload, nextFeedbacks) {
|
|
34383
34498
|
const summary = payload.summary;
|
|
34384
|
-
if (
|
|
34499
|
+
if (isRecord2(summary) && Array.isArray(summary.feedbacks)) {
|
|
34385
34500
|
return {
|
|
34386
34501
|
...payload,
|
|
34387
34502
|
summary: {
|
|
@@ -34406,14 +34521,14 @@ function replaceDebugFeedbackItems(payload, nextFeedbacks) {
|
|
|
34406
34521
|
}
|
|
34407
34522
|
function getDebugFeedbackItems(payload) {
|
|
34408
34523
|
const summary = payload.summary;
|
|
34409
|
-
if (
|
|
34410
|
-
return summary.feedbacks.filter(
|
|
34524
|
+
if (isRecord2(summary) && Array.isArray(summary.feedbacks)) {
|
|
34525
|
+
return summary.feedbacks.filter(isRecord2);
|
|
34411
34526
|
}
|
|
34412
34527
|
if (Array.isArray(payload.feedbacks)) {
|
|
34413
|
-
return payload.feedbacks.filter(
|
|
34528
|
+
return payload.feedbacks.filter(isRecord2);
|
|
34414
34529
|
}
|
|
34415
34530
|
if (Array.isArray(payload.list)) {
|
|
34416
|
-
return payload.list.filter(
|
|
34531
|
+
return payload.list.filter(isRecord2);
|
|
34417
34532
|
}
|
|
34418
34533
|
return [];
|
|
34419
34534
|
}
|
|
@@ -34445,7 +34560,7 @@ async function materializeBatchImageResult(options) {
|
|
|
34445
34560
|
}
|
|
34446
34561
|
const results = [];
|
|
34447
34562
|
for (const item of options.payload.results) {
|
|
34448
|
-
if (!
|
|
34563
|
+
if (!isRecord2(item) || item.success !== true) {
|
|
34449
34564
|
results.push(item);
|
|
34450
34565
|
continue;
|
|
34451
34566
|
}
|
|
@@ -34530,13 +34645,13 @@ function findExistingMaterializedVideo(targetDir, options) {
|
|
|
34530
34645
|
function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
|
|
34531
34646
|
const candidates = [];
|
|
34532
34647
|
const absolutePath = stringField2(record2.absolutePath);
|
|
34533
|
-
if (absolutePath &&
|
|
34648
|
+
if (absolutePath && path17.isAbsolute(absolutePath)) {
|
|
34534
34649
|
candidates.push(absolutePath);
|
|
34535
34650
|
}
|
|
34536
|
-
candidates.push(
|
|
34651
|
+
candidates.push(path17.join(targetDir, ...localPath.split("/")));
|
|
34537
34652
|
for (const candidate of candidates) {
|
|
34538
34653
|
try {
|
|
34539
|
-
if (
|
|
34654
|
+
if (fs16.statSync(candidate).isFile()) {
|
|
34540
34655
|
return candidate;
|
|
34541
34656
|
}
|
|
34542
34657
|
} catch {
|
|
@@ -34548,7 +34663,7 @@ async function materializeMusicResult(options) {
|
|
|
34548
34663
|
if (options.payload.success !== true) {
|
|
34549
34664
|
return options.payload;
|
|
34550
34665
|
}
|
|
34551
|
-
if (!
|
|
34666
|
+
if (!isRecord2(options.payload.music)) {
|
|
34552
34667
|
return options.payload;
|
|
34553
34668
|
}
|
|
34554
34669
|
const music = options.payload.music;
|
|
@@ -34580,7 +34695,7 @@ async function materializeAudioFilesResult(options, toolName) {
|
|
|
34580
34695
|
if (!Array.isArray(options.payload.audio_files)) return options.payload;
|
|
34581
34696
|
const audioFiles = [];
|
|
34582
34697
|
for (const rawItem of options.payload.audio_files) {
|
|
34583
|
-
if (!
|
|
34698
|
+
if (!isRecord2(rawItem)) {
|
|
34584
34699
|
audioFiles.push(rawItem);
|
|
34585
34700
|
continue;
|
|
34586
34701
|
}
|
|
@@ -34648,12 +34763,12 @@ function validateAudioAssetContract(options) {
|
|
|
34648
34763
|
if (!fileName || fileName === "." || fileName === ".." || fileName.includes("/") || fileName.includes("\\") || fileName.includes("\0")) {
|
|
34649
34764
|
return "suggestedFileName must be a safe basename.";
|
|
34650
34765
|
}
|
|
34651
|
-
if (
|
|
34766
|
+
if (path17.basename(fileName) !== fileName || fileName.endsWith(".") || fileName.endsWith(" ")) {
|
|
34652
34767
|
return "suggestedFileName must be a safe basename.";
|
|
34653
34768
|
}
|
|
34654
34769
|
const format = (_a3 = options.format) == null ? void 0 : _a3.toLowerCase();
|
|
34655
34770
|
const mimeType = (_b = options.mimeType) == null ? void 0 : _b.toLowerCase();
|
|
34656
|
-
const extension =
|
|
34771
|
+
const extension = path17.extname(fileName).toLowerCase();
|
|
34657
34772
|
const contract = {
|
|
34658
34773
|
mp3: { mimeType: "audio/mpeg", extension: ".mp3" },
|
|
34659
34774
|
wav: { mimeType: "audio/wav", extension: ".wav" },
|
|
@@ -34680,13 +34795,13 @@ function audioExtensionForItem(item, fileName) {
|
|
|
34680
34795
|
m4a: "m4a",
|
|
34681
34796
|
aac: "aac"
|
|
34682
34797
|
};
|
|
34683
|
-
return byFormat[format || ""] ||
|
|
34798
|
+
return byFormat[format || ""] || path17.extname(fileName).slice(1).toLowerCase() || "mp3";
|
|
34684
34799
|
}
|
|
34685
34800
|
async function materializeAudioAsset(options) {
|
|
34686
34801
|
const relativeDir = options.targetDirectory;
|
|
34687
|
-
const directory =
|
|
34802
|
+
const directory = path17.join(options.targetDir, ...relativeDir.split("/"));
|
|
34688
34803
|
try {
|
|
34689
|
-
|
|
34804
|
+
fs16.mkdirSync(directory, { recursive: true });
|
|
34690
34805
|
assertProjectDirectory(options.targetDir, directory);
|
|
34691
34806
|
} catch (error2) {
|
|
34692
34807
|
return {
|
|
@@ -34696,16 +34811,16 @@ async function materializeAudioAsset(options) {
|
|
|
34696
34811
|
}
|
|
34697
34812
|
};
|
|
34698
34813
|
}
|
|
34699
|
-
const baseName =
|
|
34814
|
+
const baseName = path17.basename(options.fileName, path17.extname(options.fileName));
|
|
34700
34815
|
let absolutePath;
|
|
34701
34816
|
let relativePath;
|
|
34702
34817
|
for (let index = 1; index <= 9999; index += 1) {
|
|
34703
34818
|
const suffix = index === 1 ? "" : `_${index}`;
|
|
34704
34819
|
const candidateName = `${baseName}${suffix}.${options.extension}`;
|
|
34705
|
-
const candidate =
|
|
34706
|
-
if (!
|
|
34820
|
+
const candidate = path17.join(directory, candidateName);
|
|
34821
|
+
if (!fs16.existsSync(candidate)) {
|
|
34707
34822
|
absolutePath = candidate;
|
|
34708
|
-
relativePath =
|
|
34823
|
+
relativePath = path17.posix.join(relativeDir, candidateName);
|
|
34709
34824
|
break;
|
|
34710
34825
|
}
|
|
34711
34826
|
}
|
|
@@ -34723,7 +34838,7 @@ async function materializeAudioAsset(options) {
|
|
|
34723
34838
|
if (bytes.length === 0) {
|
|
34724
34839
|
return { download: { success: false, error: "Asset download failed: empty response." } };
|
|
34725
34840
|
}
|
|
34726
|
-
|
|
34841
|
+
fs16.writeFileSync(absolutePath, bytes, { flag: "wx" });
|
|
34727
34842
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
34728
34843
|
} catch (error2) {
|
|
34729
34844
|
return {
|
|
@@ -34735,7 +34850,7 @@ async function materializeAudioAsset(options) {
|
|
|
34735
34850
|
}
|
|
34736
34851
|
}
|
|
34737
34852
|
async function materializeVoiceConfirmationResult(options) {
|
|
34738
|
-
if (options.payload.success !== true || !
|
|
34853
|
+
if (options.payload.success !== true || !isRecord2(options.payload.mapping)) {
|
|
34739
34854
|
return withoutVoiceConfirmationNextStepHint(options.payload);
|
|
34740
34855
|
}
|
|
34741
34856
|
const payload = withoutVoiceConfirmationNextStepHint(options.payload);
|
|
@@ -34763,7 +34878,7 @@ async function materializeVoiceConfirmationResult(options) {
|
|
|
34763
34878
|
};
|
|
34764
34879
|
}
|
|
34765
34880
|
}
|
|
34766
|
-
if (provider !== "doubao" || !
|
|
34881
|
+
if (provider !== "doubao" || !isRecord2(payload.referenceAudio)) {
|
|
34767
34882
|
return payload;
|
|
34768
34883
|
}
|
|
34769
34884
|
const referenceAudio = payload.referenceAudio;
|
|
@@ -34822,7 +34937,7 @@ async function materializeVoiceConfirmationResult(options) {
|
|
|
34822
34937
|
referenceAudio: {
|
|
34823
34938
|
...referenceAudio,
|
|
34824
34939
|
localPath: targetPath,
|
|
34825
|
-
absolutePath:
|
|
34940
|
+
absolutePath: path17.join(options.targetDir, ...targetPath.split("/")),
|
|
34826
34941
|
download: { success: true }
|
|
34827
34942
|
}
|
|
34828
34943
|
};
|
|
@@ -34853,7 +34968,7 @@ function validateDoubaoReferenceTarget(targetPath) {
|
|
|
34853
34968
|
if (!/^assets\/audio\/voice-reference\/[^/]+\.mp3$/.test(targetPath)) {
|
|
34854
34969
|
return "referenceAudio.targetPath must be assets/audio/voice-reference/<basename>.mp3.";
|
|
34855
34970
|
}
|
|
34856
|
-
const base =
|
|
34971
|
+
const base = path17.posix.basename(targetPath, ".mp3");
|
|
34857
34972
|
if (!base || base === "." || base === ".." || base.includes("\\") || base.includes("\0")) {
|
|
34858
34973
|
return "referenceAudio.targetPath contains an unsafe basename.";
|
|
34859
34974
|
}
|
|
@@ -34898,27 +35013,27 @@ function parseMp3Frame(bytes, offset) {
|
|
|
34898
35013
|
return length > 4 && offset + length <= bytes.length ? { length, version: version2, sampleRate } : void 0;
|
|
34899
35014
|
}
|
|
34900
35015
|
function mergeVoiceMappingFile(options) {
|
|
34901
|
-
const configPath =
|
|
35016
|
+
const configPath = path17.join(
|
|
34902
35017
|
options.targetDir,
|
|
34903
35018
|
".project",
|
|
34904
35019
|
options.provider === "doubao" ? "audio-voice-mapping.json" : "elevenlabs-voice-mapping.json"
|
|
34905
35020
|
);
|
|
34906
|
-
const referencePath = options.referenceAudio ?
|
|
34907
|
-
const configDirectory =
|
|
34908
|
-
const referenceDirectory = referencePath ?
|
|
34909
|
-
|
|
35021
|
+
const referencePath = options.referenceAudio ? path17.join(options.targetDir, ...options.referenceAudio.targetPath.split("/")) : void 0;
|
|
35022
|
+
const configDirectory = path17.dirname(configPath);
|
|
35023
|
+
const referenceDirectory = referencePath ? path17.dirname(referencePath) : void 0;
|
|
35024
|
+
fs16.mkdirSync(configDirectory, { recursive: true });
|
|
34910
35025
|
assertProjectDirectory(options.targetDir, configDirectory);
|
|
34911
35026
|
assertFileIsNotSymlink(configPath);
|
|
34912
35027
|
if (referenceDirectory) {
|
|
34913
|
-
|
|
35028
|
+
fs16.mkdirSync(referenceDirectory, { recursive: true });
|
|
34914
35029
|
assertProjectDirectory(options.targetDir, referenceDirectory);
|
|
34915
35030
|
assertFileIsNotSymlink(referencePath);
|
|
34916
35031
|
}
|
|
34917
35032
|
const oldConfig = snapshotFile(configPath);
|
|
34918
35033
|
const oldReference = referencePath ? snapshotFile(referencePath) : void 0;
|
|
34919
35034
|
const existing = readJsonFile2(configPath);
|
|
34920
|
-
const characters =
|
|
34921
|
-
const oldCharacter =
|
|
35035
|
+
const characters = isRecord2(existing == null ? void 0 : existing.characters) ? { ...existing.characters } : {};
|
|
35036
|
+
const oldCharacter = isRecord2(characters[options.characterName]) ? characters[options.characterName] : {};
|
|
34922
35037
|
const createdAt = stringField2(oldCharacter.created_at) || options.now.toISOString();
|
|
34923
35038
|
const character = {
|
|
34924
35039
|
...oldCharacter,
|
|
@@ -34941,7 +35056,7 @@ function mergeVoiceMappingFile(options) {
|
|
|
34941
35056
|
if (options.provider === "doubao") {
|
|
34942
35057
|
nextConfig.default_language = stringField2(existing == null ? void 0 : existing.default_language) || "cmn";
|
|
34943
35058
|
nextConfig.default_stability = typeof (existing == null ? void 0 : existing.default_stability) === "number" ? existing.default_stability : 0.5;
|
|
34944
|
-
nextConfig.special_voices =
|
|
35059
|
+
nextConfig.special_voices = isRecord2(existing == null ? void 0 : existing.special_voices) ? existing.special_voices : {};
|
|
34945
35060
|
} else {
|
|
34946
35061
|
delete nextConfig.default_language;
|
|
34947
35062
|
delete nextConfig.default_stability;
|
|
@@ -34949,20 +35064,20 @@ function mergeVoiceMappingFile(options) {
|
|
|
34949
35064
|
}
|
|
34950
35065
|
const configBytes = Buffer.from(`${JSON.stringify(nextConfig, null, 2)}
|
|
34951
35066
|
`, "utf8");
|
|
34952
|
-
const transactionId =
|
|
35067
|
+
const transactionId = randomUUID2();
|
|
34953
35068
|
const configTemp = `${configPath}.${transactionId}.tmp`;
|
|
34954
35069
|
const referenceTemp = referencePath ? `${referencePath}.${transactionId}.tmp` : void 0;
|
|
34955
35070
|
try {
|
|
34956
35071
|
if (referenceTemp && options.referenceAudio) {
|
|
34957
|
-
|
|
34958
|
-
|
|
35072
|
+
fs16.writeFileSync(referenceTemp, options.referenceAudio.bytes, { flag: "wx" });
|
|
35073
|
+
fs16.renameSync(referenceTemp, referencePath);
|
|
34959
35074
|
}
|
|
34960
|
-
|
|
34961
|
-
|
|
35075
|
+
fs16.writeFileSync(configTemp, configBytes, { flag: "wx" });
|
|
35076
|
+
fs16.renameSync(configTemp, configPath);
|
|
34962
35077
|
} catch (error2) {
|
|
34963
35078
|
try {
|
|
34964
|
-
if (
|
|
34965
|
-
if (referenceTemp &&
|
|
35079
|
+
if (fs16.existsSync(configTemp)) fs16.rmSync(configTemp, { force: true });
|
|
35080
|
+
if (referenceTemp && fs16.existsSync(referenceTemp)) fs16.rmSync(referenceTemp, { force: true });
|
|
34966
35081
|
restoreFile(configPath, oldConfig);
|
|
34967
35082
|
if (referencePath) restoreFile(referencePath, oldReference);
|
|
34968
35083
|
} catch {
|
|
@@ -34973,7 +35088,7 @@ function mergeVoiceMappingFile(options) {
|
|
|
34973
35088
|
function snapshotFile(filePath) {
|
|
34974
35089
|
try {
|
|
34975
35090
|
assertFileIsNotSymlink(filePath);
|
|
34976
|
-
return { exists: true, bytes:
|
|
35091
|
+
return { exists: true, bytes: fs16.readFileSync(filePath) };
|
|
34977
35092
|
} catch {
|
|
34978
35093
|
if (isSymlink(filePath)) {
|
|
34979
35094
|
throw new Error(`refusing to read symlinked file: ${filePath}`);
|
|
@@ -34984,25 +35099,25 @@ function snapshotFile(filePath) {
|
|
|
34984
35099
|
function restoreFile(filePath, snapshot) {
|
|
34985
35100
|
assertFileIsNotSymlink(filePath);
|
|
34986
35101
|
if (snapshot.exists && snapshot.bytes) {
|
|
34987
|
-
|
|
34988
|
-
|
|
35102
|
+
fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
|
|
35103
|
+
fs16.writeFileSync(filePath, snapshot.bytes);
|
|
34989
35104
|
} else {
|
|
34990
|
-
|
|
35105
|
+
fs16.rmSync(filePath, { force: true });
|
|
34991
35106
|
}
|
|
34992
35107
|
}
|
|
34993
35108
|
function readJsonFile2(filePath) {
|
|
34994
35109
|
assertFileIsNotSymlink(filePath);
|
|
34995
35110
|
try {
|
|
34996
|
-
const parsed = JSON.parse(
|
|
34997
|
-
return
|
|
35111
|
+
const parsed = JSON.parse(fs16.readFileSync(filePath, "utf8"));
|
|
35112
|
+
return isRecord2(parsed) ? parsed : void 0;
|
|
34998
35113
|
} catch {
|
|
34999
35114
|
return void 0;
|
|
35000
35115
|
}
|
|
35001
35116
|
}
|
|
35002
35117
|
async function materializeCreate3dAssetResult(options) {
|
|
35003
35118
|
var _a3;
|
|
35004
|
-
const payload =
|
|
35005
|
-
const modelFile = Array.isArray(payload.model_files) ? payload.model_files.find(
|
|
35119
|
+
const payload = isRecord2(options.payload.preview) ? await materializeCreate3dAssetPreviewResult(options) : options.payload;
|
|
35120
|
+
const modelFile = Array.isArray(payload.model_files) ? payload.model_files.find(isRecord2) : void 0;
|
|
35006
35121
|
if (!modelFile) {
|
|
35007
35122
|
return payload;
|
|
35008
35123
|
}
|
|
@@ -35113,8 +35228,8 @@ async function materializeCreate3dAssetModelFile(options) {
|
|
|
35113
35228
|
const targetDirectory = stringField2(options.modelFile.targetDirectory);
|
|
35114
35229
|
const suggestedFileName = stringField2(options.modelFile.suggestedFileName);
|
|
35115
35230
|
const targetAbsolutePath = targetDirectory ? resolveProjectRelativePath(options.targetDir, targetDirectory) : void 0;
|
|
35116
|
-
const modelAssetRoot =
|
|
35117
|
-
if (!targetDirectory || !targetAbsolutePath || !isKnownAssetPath(targetDirectory, MODEL_ASSET_DIRS) || !isPathWithinDirectory(modelAssetRoot, targetAbsolutePath) || !suggestedFileName ||
|
|
35231
|
+
const modelAssetRoot = path17.resolve(options.targetDir, MODEL_ASSET_DIRS[0]);
|
|
35232
|
+
if (!targetDirectory || !targetAbsolutePath || !isKnownAssetPath(targetDirectory, MODEL_ASSET_DIRS) || !isPathWithinDirectory(modelAssetRoot, targetAbsolutePath) || !suggestedFileName || path17.posix.basename(suggestedFileName) !== suggestedFileName || suggestedFileName.includes("\\")) {
|
|
35118
35233
|
return {
|
|
35119
35234
|
download: { success: false, error: "Invalid create_3d_asset local target path." }
|
|
35120
35235
|
};
|
|
@@ -35122,7 +35237,7 @@ async function materializeCreate3dAssetModelFile(options) {
|
|
|
35122
35237
|
if (options.materialization === "copy") {
|
|
35123
35238
|
return await materializeAssetAtPath({
|
|
35124
35239
|
url: options.remoteUrl,
|
|
35125
|
-
relativePath:
|
|
35240
|
+
relativePath: path17.posix.join(targetDirectory, suggestedFileName),
|
|
35126
35241
|
targetDir: options.targetDir,
|
|
35127
35242
|
fetchImpl: options.fetchImpl
|
|
35128
35243
|
});
|
|
@@ -35140,7 +35255,7 @@ async function materializeCreate3dAssetModelFile(options) {
|
|
|
35140
35255
|
url: options.remoteUrl,
|
|
35141
35256
|
baseName: options.assetId,
|
|
35142
35257
|
relativeDir: ".maker/assets/downloads",
|
|
35143
|
-
extension:
|
|
35258
|
+
extension: path17.extname(suggestedFileName).replace(/^\./, "") || "zip",
|
|
35144
35259
|
now: options.now,
|
|
35145
35260
|
fetchImpl: options.fetchImpl
|
|
35146
35261
|
});
|
|
@@ -35150,14 +35265,14 @@ async function materializeCreate3dAssetModelFile(options) {
|
|
|
35150
35265
|
};
|
|
35151
35266
|
}
|
|
35152
35267
|
try {
|
|
35153
|
-
|
|
35268
|
+
fs16.mkdirSync(targetAbsolutePath, { recursive: true });
|
|
35154
35269
|
extractZip(archive.absolutePath, targetAbsolutePath, "3D model asset");
|
|
35155
35270
|
const entrypointExtension = ((_a3 = stringField2(options.modelFile.entrypointExtension)) == null ? void 0 : _a3.toLowerCase()) || ".mdl";
|
|
35156
35271
|
const entrypoint = findFileByExtension(targetAbsolutePath, entrypointExtension);
|
|
35157
35272
|
if (!entrypoint) {
|
|
35158
35273
|
throw new Error(`3D model archive contains no ${entrypointExtension} entrypoint.`);
|
|
35159
35274
|
}
|
|
35160
|
-
const localPath =
|
|
35275
|
+
const localPath = path17.relative(options.targetDir, entrypoint).split(path17.sep).join("/");
|
|
35161
35276
|
return {
|
|
35162
35277
|
localPath,
|
|
35163
35278
|
absolutePath: entrypoint,
|
|
@@ -35171,7 +35286,7 @@ async function materializeCreate3dAssetModelFile(options) {
|
|
|
35171
35286
|
}
|
|
35172
35287
|
};
|
|
35173
35288
|
} finally {
|
|
35174
|
-
|
|
35289
|
+
fs16.rmSync(archive.absolutePath, { force: true });
|
|
35175
35290
|
}
|
|
35176
35291
|
}
|
|
35177
35292
|
async function materializeAssetAtPath(options) {
|
|
@@ -35186,8 +35301,8 @@ async function materializeAssetAtPath(options) {
|
|
|
35186
35301
|
download: { success: false, error: `Asset download failed: HTTP ${response.status}` }
|
|
35187
35302
|
};
|
|
35188
35303
|
}
|
|
35189
|
-
|
|
35190
|
-
|
|
35304
|
+
fs16.mkdirSync(path17.dirname(absolutePath), { recursive: true });
|
|
35305
|
+
fs16.writeFileSync(absolutePath, Buffer.from(await response.arrayBuffer()));
|
|
35191
35306
|
return { localPath: options.relativePath, absolutePath, download: { success: true } };
|
|
35192
35307
|
} catch (error2) {
|
|
35193
35308
|
return {
|
|
@@ -35199,9 +35314,9 @@ async function materializeAssetAtPath(options) {
|
|
|
35199
35314
|
}
|
|
35200
35315
|
}
|
|
35201
35316
|
function findFileByExtension(directory, extension) {
|
|
35202
|
-
const entries =
|
|
35317
|
+
const entries = fs16.readdirSync(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name));
|
|
35203
35318
|
for (const entry of entries) {
|
|
35204
|
-
const absolutePath =
|
|
35319
|
+
const absolutePath = path17.join(directory, entry.name);
|
|
35205
35320
|
if (entry.isDirectory()) {
|
|
35206
35321
|
const nested = findFileByExtension(absolutePath, extension);
|
|
35207
35322
|
if (nested) return nested;
|
|
@@ -35214,7 +35329,7 @@ function findFileByExtension(directory, extension) {
|
|
|
35214
35329
|
function findExistingCreate3dAssetDelivery(options) {
|
|
35215
35330
|
const registry2 = readGeneratedAssetRegistry(options.targetDir);
|
|
35216
35331
|
const match = Object.entries(registry2).find(([, record3]) => {
|
|
35217
|
-
return record3.tool === CREATE_3D_ASSET_PROXY_TOOL_NAME && record3.assetId === options.assetId && record3.cdnUrl === options.remoteUrl && typeof record3.absolutePath === "string" &&
|
|
35332
|
+
return record3.tool === CREATE_3D_ASSET_PROXY_TOOL_NAME && record3.assetId === options.assetId && record3.cdnUrl === options.remoteUrl && typeof record3.absolutePath === "string" && fs16.existsSync(record3.absolutePath);
|
|
35218
35333
|
});
|
|
35219
35334
|
if (!match) {
|
|
35220
35335
|
return void 0;
|
|
@@ -35313,8 +35428,8 @@ async function materializeAsset(options) {
|
|
|
35313
35428
|
};
|
|
35314
35429
|
}
|
|
35315
35430
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
35316
|
-
|
|
35317
|
-
|
|
35431
|
+
fs16.mkdirSync(path17.dirname(absolutePath), { recursive: true });
|
|
35432
|
+
fs16.writeFileSync(absolutePath, bytes);
|
|
35318
35433
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
35319
35434
|
} catch (error2) {
|
|
35320
35435
|
return {
|
|
@@ -35328,12 +35443,12 @@ async function materializeAsset(options) {
|
|
|
35328
35443
|
function createUniqueAssetPath(options) {
|
|
35329
35444
|
const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
|
|
35330
35445
|
for (let index = 1; index <= 9999; index += 1) {
|
|
35331
|
-
const relativePath =
|
|
35446
|
+
const relativePath = path17.posix.join(
|
|
35332
35447
|
options.relativeDir,
|
|
35333
35448
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
35334
35449
|
);
|
|
35335
|
-
const absolutePath =
|
|
35336
|
-
if (!
|
|
35450
|
+
const absolutePath = path17.join(options.targetDir, ...relativePath.split("/"));
|
|
35451
|
+
if (!fs16.existsSync(absolutePath)) {
|
|
35337
35452
|
return { relativePath, absolutePath };
|
|
35338
35453
|
}
|
|
35339
35454
|
}
|
|
@@ -35387,7 +35502,7 @@ function normalizeBatchImageReferenceAssetArgs(targetDir, args) {
|
|
|
35387
35502
|
return {
|
|
35388
35503
|
...args,
|
|
35389
35504
|
images: args.images.map(
|
|
35390
|
-
(item) =>
|
|
35505
|
+
(item) => isRecord2(item) ? normalizeImageReferenceAssetArgs(targetDir, item) : item
|
|
35391
35506
|
)
|
|
35392
35507
|
};
|
|
35393
35508
|
}
|
|
@@ -35413,7 +35528,7 @@ function rewriteVideoReferenceAssetArgs(targetDir, args) {
|
|
|
35413
35528
|
};
|
|
35414
35529
|
}
|
|
35415
35530
|
function rewriteCreate3dAssetArgs(targetDir, args) {
|
|
35416
|
-
if (!
|
|
35531
|
+
if (!isRecord2(args.payload) || !isRecord2(args.payload.images)) {
|
|
35417
35532
|
return args;
|
|
35418
35533
|
}
|
|
35419
35534
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
@@ -35444,13 +35559,13 @@ function rewriteTextToDialogueArgs(targetDir, args) {
|
|
|
35444
35559
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
35445
35560
|
const localElevenLabsMapping = readLocalElevenLabsVoiceMapping(targetDir);
|
|
35446
35561
|
const localDoubaoMapping = args.inputs.some(
|
|
35447
|
-
(value) =>
|
|
35562
|
+
(value) => isRecord2(value) && normalizeOptionalDialogueReference(value.reference_audio) === void 0 && normalizeOptionalDialogueReference(value.reference_audio_path) === void 0
|
|
35448
35563
|
) ? readLocalDoubaoVoiceMapping(targetDir) : void 0;
|
|
35449
35564
|
let referenceAudioInputBytes = 0;
|
|
35450
35565
|
return {
|
|
35451
35566
|
...args,
|
|
35452
35567
|
inputs: args.inputs.map((value, index) => {
|
|
35453
|
-
if (!
|
|
35568
|
+
if (!isRecord2(value)) {
|
|
35454
35569
|
return value;
|
|
35455
35570
|
}
|
|
35456
35571
|
let canonicalReference = normalizeOptionalDialogueReference(value.reference_audio);
|
|
@@ -35505,33 +35620,33 @@ async function prepareRemoteProxyToolArgsAsync(options) {
|
|
|
35505
35620
|
return prepareRemoteProxyToolArgs(options);
|
|
35506
35621
|
}
|
|
35507
35622
|
function readLocalDoubaoVoiceMapping(targetDir) {
|
|
35508
|
-
const mappingPath =
|
|
35509
|
-
if (!
|
|
35510
|
-
assertProjectDirectory(targetDir,
|
|
35623
|
+
const mappingPath = path17.join(targetDir, ".project", "audio-voice-mapping.json");
|
|
35624
|
+
if (!fs16.existsSync(mappingPath)) return void 0;
|
|
35625
|
+
assertProjectDirectory(targetDir, path17.dirname(mappingPath));
|
|
35511
35626
|
const mapping = readJsonFile2(mappingPath);
|
|
35512
35627
|
return (mapping == null ? void 0 : mapping.provider) === "doubao" ? mapping : void 0;
|
|
35513
35628
|
}
|
|
35514
35629
|
function readLocalElevenLabsVoiceMapping(targetDir) {
|
|
35515
|
-
const mappingPath =
|
|
35516
|
-
if (!
|
|
35517
|
-
assertProjectDirectory(targetDir,
|
|
35630
|
+
const mappingPath = path17.join(targetDir, ".project", "elevenlabs-voice-mapping.json");
|
|
35631
|
+
if (!fs16.existsSync(mappingPath)) return void 0;
|
|
35632
|
+
assertProjectDirectory(targetDir, path17.dirname(mappingPath));
|
|
35518
35633
|
const mapping = readJsonFile2(mappingPath);
|
|
35519
35634
|
return (mapping == null ? void 0 : mapping.provider) === "elevenlabs" ? mapping : void 0;
|
|
35520
35635
|
}
|
|
35521
35636
|
function resolveLocalElevenLabsVoiceId(characterName, mapping) {
|
|
35522
35637
|
if (typeof characterName !== "string" || !mapping) return void 0;
|
|
35523
35638
|
const characters = mapping.characters;
|
|
35524
|
-
if (!
|
|
35639
|
+
if (!isRecord2(characters)) return void 0;
|
|
35525
35640
|
const character = characters[characterName];
|
|
35526
|
-
if (!
|
|
35641
|
+
if (!isRecord2(character) || character.provider !== "elevenlabs") return void 0;
|
|
35527
35642
|
return stringField2(character.voice_id);
|
|
35528
35643
|
}
|
|
35529
35644
|
function resolveLocalDoubaoMappingReference(options) {
|
|
35530
35645
|
if (typeof options.characterName !== "string" || !options.mapping) return void 0;
|
|
35531
35646
|
const characters = options.mapping.characters;
|
|
35532
|
-
if (!
|
|
35647
|
+
if (!isRecord2(characters)) return void 0;
|
|
35533
35648
|
const character = characters[options.characterName];
|
|
35534
|
-
if (!
|
|
35649
|
+
if (!isRecord2(character) || character.provider !== "doubao") return void 0;
|
|
35535
35650
|
const referencePath = stringField2(character.reference_audio_path);
|
|
35536
35651
|
if (!referencePath) return void 0;
|
|
35537
35652
|
try {
|
|
@@ -35581,13 +35696,13 @@ function localDialogueAudioReferenceToDataUrl(options) {
|
|
|
35581
35696
|
if (!absolutePath) {
|
|
35582
35697
|
throw new Error(`local reference audio file was not found: ${options.value}`);
|
|
35583
35698
|
}
|
|
35584
|
-
const projectRoot =
|
|
35585
|
-
const realFile =
|
|
35586
|
-
const relative =
|
|
35587
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
35699
|
+
const projectRoot = fs16.realpathSync(path17.resolve(options.targetDir));
|
|
35700
|
+
const realFile = fs16.realpathSync(absolutePath);
|
|
35701
|
+
const relative = path17.relative(projectRoot, realFile);
|
|
35702
|
+
if (relative === ".." || relative.startsWith(`..${path17.sep}`) || path17.isAbsolute(relative)) {
|
|
35588
35703
|
throw new Error("local dialogue reference resolves outside the project target directory");
|
|
35589
35704
|
}
|
|
35590
|
-
const stat =
|
|
35705
|
+
const stat = fs16.statSync(realFile);
|
|
35591
35706
|
if (!stat.isFile()) {
|
|
35592
35707
|
throw new Error(`local reference audio path is not a file: ${options.value}`);
|
|
35593
35708
|
}
|
|
@@ -35598,26 +35713,26 @@ function localDialogueAudioReferenceToDataUrl(options) {
|
|
|
35598
35713
|
if (!mime) {
|
|
35599
35714
|
throw new Error("local reference audio format is unsupported.");
|
|
35600
35715
|
}
|
|
35601
|
-
return `data:${mime};base64,${
|
|
35716
|
+
return `data:${mime};base64,${fs16.readFileSync(realFile).toString("base64")}`;
|
|
35602
35717
|
}
|
|
35603
35718
|
function normalizeDialogueProjectReference(targetDir, value, registry2, index) {
|
|
35604
35719
|
if (typeof value !== "string" || !value.trim()) {
|
|
35605
35720
|
throw new Error(`inputs[${index}].reference_audio must be a non-empty project audio path.`);
|
|
35606
35721
|
}
|
|
35607
35722
|
let normalized = value.trim().replace(/^workspace\//, "");
|
|
35608
|
-
if (
|
|
35609
|
-
const relative =
|
|
35610
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
35723
|
+
if (path17.isAbsolute(normalized)) {
|
|
35724
|
+
const relative = path17.relative(path17.resolve(targetDir), path17.resolve(normalized));
|
|
35725
|
+
if (relative === ".." || relative.startsWith(`..${path17.sep}`) || path17.isAbsolute(relative)) {
|
|
35611
35726
|
throw new Error(`inputs[${index}].reference_audio must stay inside project assets/audio.`);
|
|
35612
35727
|
}
|
|
35613
|
-
normalized = relative.split(
|
|
35728
|
+
normalized = relative.split(path17.sep).join("/");
|
|
35614
35729
|
}
|
|
35615
35730
|
const localPath = resolveLocalAssetReference(targetDir, normalized, registry2, AUDIO_ASSET_DIRS);
|
|
35616
35731
|
if (localPath) {
|
|
35617
35732
|
normalized = localPath;
|
|
35618
35733
|
}
|
|
35619
35734
|
const segments = normalized.split("/");
|
|
35620
|
-
const extension =
|
|
35735
|
+
const extension = path17.extname(normalized).toLowerCase();
|
|
35621
35736
|
if (segments.some((segment) => segment === "" || segment === "." || segment === "..") || !isKnownAssetPath(normalized, AUDIO_ASSET_DIRS) || !AUDIO_MIME_BY_EXTENSION[extension]) {
|
|
35622
35737
|
throw new Error(`inputs[${index}].reference_audio must be an audio path under assets/audio.`);
|
|
35623
35738
|
}
|
|
@@ -35647,7 +35762,7 @@ function rewriteUrlObjectArray(targetDir, value, registry2, options) {
|
|
|
35647
35762
|
return value;
|
|
35648
35763
|
}
|
|
35649
35764
|
return value.map(
|
|
35650
|
-
(item) =>
|
|
35765
|
+
(item) => isRecord2(item) ? {
|
|
35651
35766
|
...item,
|
|
35652
35767
|
url: rewriteGeneratedAssetReference(targetDir, item.url, registry2, options)
|
|
35653
35768
|
} : item
|
|
@@ -35697,7 +35812,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
35697
35812
|
if (!isKnownAssetPath(localPath, assetDirs)) {
|
|
35698
35813
|
return false;
|
|
35699
35814
|
}
|
|
35700
|
-
const basename =
|
|
35815
|
+
const basename = path17.posix.basename(localPath);
|
|
35701
35816
|
const stem = basename.replace(/\.[^.]+$/, "");
|
|
35702
35817
|
return basename === value || stem === value || record2.name === value || record2.taskId === value;
|
|
35703
35818
|
});
|
|
@@ -35710,13 +35825,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
35710
35825
|
}
|
|
35711
35826
|
function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
35712
35827
|
var _a3;
|
|
35713
|
-
const hasExtension = Boolean(
|
|
35828
|
+
const hasExtension = Boolean(path17.extname(value));
|
|
35714
35829
|
const candidates = [];
|
|
35715
35830
|
for (const assetDir of assetDirs) {
|
|
35716
|
-
const absoluteDir =
|
|
35831
|
+
const absoluteDir = path17.join(targetDir, ...assetDir.split("/"));
|
|
35717
35832
|
let entries;
|
|
35718
35833
|
try {
|
|
35719
|
-
entries =
|
|
35834
|
+
entries = fs16.readdirSync(absoluteDir);
|
|
35720
35835
|
} catch {
|
|
35721
35836
|
continue;
|
|
35722
35837
|
}
|
|
@@ -35725,11 +35840,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
35725
35840
|
if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
|
|
35726
35841
|
continue;
|
|
35727
35842
|
}
|
|
35728
|
-
const absolutePath =
|
|
35843
|
+
const absolutePath = path17.join(absoluteDir, entry);
|
|
35729
35844
|
try {
|
|
35730
35845
|
candidates.push({
|
|
35731
|
-
localPath:
|
|
35732
|
-
mtimeMs:
|
|
35846
|
+
localPath: path17.posix.join(assetDir, entry),
|
|
35847
|
+
mtimeMs: fs16.statSync(absolutePath).mtimeMs
|
|
35733
35848
|
});
|
|
35734
35849
|
} catch {
|
|
35735
35850
|
}
|
|
@@ -35739,7 +35854,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
35739
35854
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
|
|
35740
35855
|
}
|
|
35741
35856
|
function isKnownAssetPath(relativePath, assetDirs) {
|
|
35742
|
-
if (relativePath.startsWith("../") ||
|
|
35857
|
+
if (relativePath.startsWith("../") || path17.isAbsolute(relativePath)) {
|
|
35743
35858
|
return false;
|
|
35744
35859
|
}
|
|
35745
35860
|
return assetDirs.some(
|
|
@@ -35763,14 +35878,14 @@ function localAssetReferenceToDataUrl(options) {
|
|
|
35763
35878
|
}
|
|
35764
35879
|
let stat;
|
|
35765
35880
|
try {
|
|
35766
|
-
stat =
|
|
35881
|
+
stat = fs16.statSync(absolutePath);
|
|
35767
35882
|
} catch {
|
|
35768
35883
|
return void 0;
|
|
35769
35884
|
}
|
|
35770
35885
|
if (!stat.isFile() || stat.size > options.maxBytes) {
|
|
35771
35886
|
return void 0;
|
|
35772
35887
|
}
|
|
35773
|
-
const bytes =
|
|
35888
|
+
const bytes = fs16.readFileSync(absolutePath);
|
|
35774
35889
|
return `data:${mime};base64,${bytes.toString("base64")}`;
|
|
35775
35890
|
}
|
|
35776
35891
|
function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
@@ -35781,7 +35896,7 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
|
35781
35896
|
candidates.push(localPath);
|
|
35782
35897
|
}
|
|
35783
35898
|
}
|
|
35784
|
-
if (
|
|
35899
|
+
if (path17.isAbsolute(options.value)) {
|
|
35785
35900
|
candidates.push(options.value);
|
|
35786
35901
|
} else {
|
|
35787
35902
|
const localPath = resolveProjectRelativePath(targetDir, options.value);
|
|
@@ -35790,67 +35905,67 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
|
35790
35905
|
}
|
|
35791
35906
|
}
|
|
35792
35907
|
for (const candidate of candidates) {
|
|
35793
|
-
if (
|
|
35908
|
+
if (fs16.existsSync(candidate)) {
|
|
35794
35909
|
return candidate;
|
|
35795
35910
|
}
|
|
35796
35911
|
}
|
|
35797
35912
|
return void 0;
|
|
35798
35913
|
}
|
|
35799
35914
|
function resolveProjectRelativePath(targetDir, value) {
|
|
35800
|
-
const root =
|
|
35801
|
-
const absolutePath =
|
|
35802
|
-
const relativePath =
|
|
35803
|
-
const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${
|
|
35915
|
+
const root = path17.resolve(targetDir);
|
|
35916
|
+
const absolutePath = path17.resolve(root, value);
|
|
35917
|
+
const relativePath = path17.relative(root, absolutePath);
|
|
35918
|
+
const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path17.sep}`) || path17.isAbsolute(relativePath);
|
|
35804
35919
|
if (!escapesRoot) {
|
|
35805
35920
|
return absolutePath;
|
|
35806
35921
|
}
|
|
35807
35922
|
return void 0;
|
|
35808
35923
|
}
|
|
35809
35924
|
function assertProjectDirectory(targetDir, directory) {
|
|
35810
|
-
const projectRoot =
|
|
35811
|
-
const realDirectory =
|
|
35812
|
-
const relative =
|
|
35813
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
35925
|
+
const projectRoot = fs16.realpathSync(path17.resolve(targetDir));
|
|
35926
|
+
const realDirectory = fs16.realpathSync(directory);
|
|
35927
|
+
const relative = path17.relative(projectRoot, realDirectory);
|
|
35928
|
+
if (relative === ".." || relative.startsWith(`..${path17.sep}`) || path17.isAbsolute(relative)) {
|
|
35814
35929
|
throw new Error("resolved directory escapes the project target directory");
|
|
35815
35930
|
}
|
|
35816
35931
|
}
|
|
35817
35932
|
function isPathWithinDirectory(rootDir, candidatePath) {
|
|
35818
|
-
const relativePath =
|
|
35819
|
-
return relativePath === "" || relativePath !== ".." && !relativePath.startsWith(`..${
|
|
35933
|
+
const relativePath = path17.relative(path17.resolve(rootDir), path17.resolve(candidatePath));
|
|
35934
|
+
return relativePath === "" || relativePath !== ".." && !relativePath.startsWith(`..${path17.sep}`) && !path17.isAbsolute(relativePath);
|
|
35820
35935
|
}
|
|
35821
35936
|
function dataUrlMimeForPath(filePath, mediaKind) {
|
|
35822
|
-
return DATA_URL_MIME_BY_EXTENSION[mediaKind][
|
|
35937
|
+
return DATA_URL_MIME_BY_EXTENSION[mediaKind][path17.extname(filePath).toLowerCase()];
|
|
35823
35938
|
}
|
|
35824
35939
|
function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
|
|
35825
35940
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
35826
|
-
const registryDirectory =
|
|
35827
|
-
|
|
35941
|
+
const registryDirectory = path17.dirname(registryPath);
|
|
35942
|
+
fs16.mkdirSync(registryDirectory, { recursive: true });
|
|
35828
35943
|
assertProjectDirectory(targetDir, registryDirectory);
|
|
35829
35944
|
assertFileIsNotSymlink(registryPath);
|
|
35830
35945
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
35831
35946
|
registry2[localPath] = record2;
|
|
35832
|
-
|
|
35947
|
+
fs16.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
|
|
35833
35948
|
`, "utf8");
|
|
35834
35949
|
}
|
|
35835
35950
|
function readGeneratedAssetRegistry(targetDir) {
|
|
35836
35951
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
35837
35952
|
assertFileIsNotSymlink(registryPath);
|
|
35838
|
-
if (!
|
|
35953
|
+
if (!fs16.existsSync(registryPath)) {
|
|
35839
35954
|
return {};
|
|
35840
35955
|
}
|
|
35841
35956
|
try {
|
|
35842
|
-
const parsed = JSON.parse(
|
|
35843
|
-
return
|
|
35957
|
+
const parsed = JSON.parse(fs16.readFileSync(registryPath, "utf8"));
|
|
35958
|
+
return isRecord2(parsed) ? parsed : {};
|
|
35844
35959
|
} catch {
|
|
35845
35960
|
return {};
|
|
35846
35961
|
}
|
|
35847
35962
|
}
|
|
35848
35963
|
function getGeneratedAssetRegistryPath(targetDir) {
|
|
35849
|
-
return
|
|
35964
|
+
return path17.join(targetDir, ".maker", "assets", "generated-assets.json");
|
|
35850
35965
|
}
|
|
35851
35966
|
function isSymlink(filePath) {
|
|
35852
35967
|
try {
|
|
35853
|
-
return
|
|
35968
|
+
return fs16.lstatSync(filePath).isSymbolicLink();
|
|
35854
35969
|
} catch {
|
|
35855
35970
|
return false;
|
|
35856
35971
|
}
|
|
@@ -35864,10 +35979,10 @@ function normalizeAssetRegistryKey(targetDir, value) {
|
|
|
35864
35979
|
if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
|
|
35865
35980
|
return void 0;
|
|
35866
35981
|
}
|
|
35867
|
-
const relative =
|
|
35868
|
-
return relative.split(
|
|
35982
|
+
const relative = path17.isAbsolute(value) ? path17.relative(targetDir, value) : value;
|
|
35983
|
+
return relative.split(path17.sep).join("/");
|
|
35869
35984
|
}
|
|
35870
|
-
function
|
|
35985
|
+
function isRecord2(value) {
|
|
35871
35986
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
35872
35987
|
}
|
|
35873
35988
|
function stringField2(value) {
|
|
@@ -35904,13 +36019,137 @@ function extensionFromUrl(url2) {
|
|
|
35904
36019
|
}
|
|
35905
36020
|
try {
|
|
35906
36021
|
const pathname = new URL(url2).pathname;
|
|
35907
|
-
const extension =
|
|
36022
|
+
const extension = path17.extname(pathname).replace(/^\./, "").toLowerCase();
|
|
35908
36023
|
return extension || void 0;
|
|
35909
36024
|
} catch {
|
|
35910
36025
|
return void 0;
|
|
35911
36026
|
}
|
|
35912
36027
|
}
|
|
35913
36028
|
|
|
36029
|
+
// src/maker/server/toolDescriptions.ts
|
|
36030
|
+
var MAKER_STATUS_LITE_PUBLIC_DESCRIPTION = [
|
|
36031
|
+
"Compatibility tool for clients that cannot read the maker://status resource; prefer the resource when it is available.",
|
|
36032
|
+
"Use it when starting or resuming Maker work, or when the current project context and readiness are uncertain.",
|
|
36033
|
+
"Pass target_dir when the project cannot be resolved from MCP Roots or the server working directory; if multiple Maker projects remain ambiguous, ask the user instead of guessing.",
|
|
36034
|
+
"By default the check may perform remote Git, package, dev-kit, proxy, and authentication probes. skip_remote_sync skips only remote Git and dev-kit freshness checks; it is not an offline or read-only mode.",
|
|
36035
|
+
"Follow the returned next_action and next_step."
|
|
36036
|
+
].join(" ");
|
|
36037
|
+
var MAKER_BUILD_CURRENT_DIRECTORY_PUBLIC_DESCRIPTION = [
|
|
36038
|
+
"Submit and remotely build the current bound Maker project. First read maker://status or maker_status_lite and resolve exactly one bound Maker project.",
|
|
36039
|
+
"Use this tool for explicit Maker build, preview, submit, or push requests. Code tests and lint do not trigger this remote workflow unless the user also explicitly asks to build, run, or preview the Maker game.",
|
|
36040
|
+
"Normal mode commits local changes when needed, pushes existing or new commits, and then starts the remote build; a clean workspace creates the required wake-up commit.",
|
|
36041
|
+
"Unsafe remote-sync or branch states stop before commit and push. A push failure stops before build, while a build failure after a successful push means the code is already on Maker remote; follow the structured result for recovery.",
|
|
36042
|
+
"After a successful build, read runtime_logs.local_file for gameplay diagnostics and runtime_logs.state_file for watcher health when those fields are returned.",
|
|
36043
|
+
"Do not combine Maker submission with generic branch, PR/MR, or separate commit/push workflows.",
|
|
36044
|
+
"Set confirm_remote_build_without_submit=true only after the user explicitly requests building the already committed remote version without submitting local changes."
|
|
36045
|
+
].join(" ");
|
|
36046
|
+
var MAKER_REMOTE_PROXY_PUBLIC_DESCRIPTIONS = {
|
|
36047
|
+
generate_image: [
|
|
36048
|
+
"Generate one new image asset for a Maker game. Use batch_generate_images for multiple new images and edit_image to modify an existing image.",
|
|
36049
|
+
"Optional reference images may guide style or content; supported sources, generation controls, and final target_size requirements are defined by the input schema.",
|
|
36050
|
+
"Keep each reference image supplied through local paths or data URLs at 10 MiB or less.",
|
|
36051
|
+
"The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present."
|
|
36052
|
+
].join(" "),
|
|
36053
|
+
batch_generate_images: [
|
|
36054
|
+
"Generate two or more new image assets in parallel in one call. Use generate_image for one new image and edit_image to modify an existing image.",
|
|
36055
|
+
"Each image request uses the fields and constraints defined by the input schema.",
|
|
36056
|
+
"Keep each reference image supplied through local paths or data URLs at 10 MiB or less. A batch may partially succeed; preserve successful images and report failed items with their returned errors.",
|
|
36057
|
+
"The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present."
|
|
36058
|
+
].join(" "),
|
|
36059
|
+
edit_image: [
|
|
36060
|
+
"Modify an existing image from text instructions. Use generate_image for one new image and batch_generate_images for multiple new images.",
|
|
36061
|
+
"The required original image accepts a local Maker project path, an HTTP(S) URL, or an image data URL. Additional reference images and output controls are defined by the input schema.",
|
|
36062
|
+
"Keep each local-path or data URL image at 10 MiB or less.",
|
|
36063
|
+
"The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present."
|
|
36064
|
+
].join(" "),
|
|
36065
|
+
create_video_task: [
|
|
36066
|
+
"Create a video generation task. The remote service normally performs server-side polling and waits for the final result in this call.",
|
|
36067
|
+
"If the wait budget expires, the result returns a task_id; continue other work and use query_video_task no sooner than 120 seconds later.",
|
|
36068
|
+
"Mode-specific inputs and limits are defined by the input schema. Image, video, and audio references may use local project files, HTTP(S) URLs, or data URLs supported by the schema.",
|
|
36069
|
+
"Keep image references at 30 MiB or less, video references at 50 MiB or less, and audio references at 15 MiB or less.",
|
|
36070
|
+
"The local proxy attempts to materialize successful video results into the Maker project; prefer returned workspace paths when present, unless the user needs an external share URL."
|
|
36071
|
+
].join(" "),
|
|
36072
|
+
query_video_task: [
|
|
36073
|
+
"Query video task status by task_id after create_video_task returns a pending task or reports a concurrency limit.",
|
|
36074
|
+
"If the task is still pending or running, continue other work and query again no sooner than 120 seconds later; do not poll continuously.",
|
|
36075
|
+
"Querying a completed task releases its task quota. The local proxy attempts to materialize successful video and last-frame results into the Maker project.",
|
|
36076
|
+
"Prefer workspace_video_path and workspace_last_frame_path when present; mention CDN URLs only when the user needs an external share link."
|
|
36077
|
+
].join(" "),
|
|
36078
|
+
text_to_music: [
|
|
36079
|
+
"Generate AI music for a Maker game, including background music or vocal tracks; do not use this tool for sound effects.",
|
|
36080
|
+
"The remote call polls server-side every 20 seconds and may wait up to 50 minutes. If generation is still running when the call times out, the result includes the task ID for operational tracking.",
|
|
36081
|
+
"Simple and custom generation controls are defined by the input schema.",
|
|
36082
|
+
"The local proxy attempts to materialize successful audio and metadata into the Maker project and record them for later Maker references; use returned local paths when present."
|
|
36083
|
+
].join(" "),
|
|
36084
|
+
text_to_sound_effect: [
|
|
36085
|
+
"Generate one game sound effect from a Chinese or English description.",
|
|
36086
|
+
"For the current Seed Audio provider, each call produces one output of at most 120 seconds. Split longer audio across multiple generations because this tool does not stitch outputs.",
|
|
36087
|
+
"duration_seconds is an approximate target and the actual duration may differ.",
|
|
36088
|
+
"The local proxy attempts to materialize successful audio in the provider original format under assets/audio/sfx and record it for later Maker references; use returned local paths when present."
|
|
36089
|
+
].join(" "),
|
|
36090
|
+
batch_sound_effects: [
|
|
36091
|
+
"Generate multiple game sound effects in one batch.",
|
|
36092
|
+
"For the current Seed Audio provider, each item is an independent output of at most 120 seconds. Split longer audio across items or calls because this tool does not stitch outputs.",
|
|
36093
|
+
"The result preserves per-item failures while the local proxy attempts to materialize successful audio in the provider original format under assets/audio/sfx and record it for later Maker references; use returned local paths when present."
|
|
36094
|
+
].join(" "),
|
|
36095
|
+
text_to_dialogue: [
|
|
36096
|
+
"Generate final character dialogue audio for a Maker game.",
|
|
36097
|
+
"Each input needs a confirmed voice mapping or a reference_audio override. When neither is available, call audition_voices_for_character and then confirm_character_voice before retrying.",
|
|
36098
|
+
"When reference_audio is omitted, the local proxy automatically reuses a confirmed local Doubao reference; the legacy provider still requires its confirmed voice mapping. Supported reference inputs and line-specific delivery controls are defined by the input schema.",
|
|
36099
|
+
"For Doubao, each input produces at most 120 seconds of audio. Split longer dialogue across inputs or calls because this tool does not stitch outputs.",
|
|
36100
|
+
"The local proxy attempts to materialize successful dialogue under assets/audio/voice; use returned local paths when present."
|
|
36101
|
+
].join(" "),
|
|
36102
|
+
audition_voices_for_character: [
|
|
36103
|
+
"Create temporary voice previews for one game character.",
|
|
36104
|
+
"Before calling, inspect the available character definition and relevant project context, then prepare a representative audition line that matches the character personality and speaking style.",
|
|
36105
|
+
"voice_profile.gender is required and must be passed explicitly as male or female.",
|
|
36106
|
+
"Doubao returns exactly three previews; the legacy provider follows candidate_count. Show every returned preview to the user and wait for an explicit choice before calling confirm_character_voice.",
|
|
36107
|
+
"Complete audition and confirmation for one character before starting another in the same project; do not run them in parallel.",
|
|
36108
|
+
"Preview files are temporary and are not saved as final game assets."
|
|
36109
|
+
].join(" "),
|
|
36110
|
+
confirm_character_voice: [
|
|
36111
|
+
"Confirm a voice selection and persist the character voice mapping for later text_to_dialogue calls.",
|
|
36112
|
+
"Call this tool only after audition_voices_for_character and only after the user explicitly selects a candidate or explicitly accepts the recommended candidate.",
|
|
36113
|
+
"Omit selected_index only after the user explicitly accepts the recommendation; absence of a user choice is not acceptance.",
|
|
36114
|
+
"Process one character at a time and do not call this tool in parallel for the same project."
|
|
36115
|
+
].join(" "),
|
|
36116
|
+
create_3d_asset: [
|
|
36117
|
+
'Manage the complete Maker 3D asset lifecycle. Use action="start" to begin, action="query" to check progress, action="get_options" to inspect step options, action="continue" after review, and action="post_process" for supported follow-up operations.',
|
|
36118
|
+
"Use direct generation when no review checkpoint is needed, and reviewed generation when the user needs a preview before final generation.",
|
|
36119
|
+
'For reviewed generation, show every returned preview and wait for explicit user approval before action="continue"; never approve a review step automatically.',
|
|
36120
|
+
"Supported prompt, image, strategy, quality, and post-processing fields are defined by the input schema.",
|
|
36121
|
+
"Local image inputs are normalized for the remote service. The local proxy attempts to materialize completed model delivery under assets/model and review images under assets/image; use local_delivery, preview_assets, and other returned local paths when present."
|
|
36122
|
+
].join(" "),
|
|
36123
|
+
generate_test_qrcode: [
|
|
36124
|
+
"Generate a mobile test QR code only when the user explicitly requests a test QR code or scan test, or when get_ad_config reports missing app_id or developer_id and requests this recovery step.",
|
|
36125
|
+
"Do not call this tool automatically during initialization, build, or publish workflows. When an explicit build is needed, use maker_build_current_directory separately.",
|
|
36126
|
+
"Call without confirmed_screen_orientation first. Reuse an existing project orientation; only when the tool reports it missing, ask the user in a separate conversation turn to choose landscape or portrait and then retry.",
|
|
36127
|
+
"An existing orientation is immutable. This operation may upload a test version, create the TapTap app identity, and return a displayable QR code."
|
|
36128
|
+
].join(" "),
|
|
36129
|
+
add_test_whitelist: [
|
|
36130
|
+
"Add one TapTap user to the current game test whitelist.",
|
|
36131
|
+
"Use this only after maker_build_current_directory has initialized the project and generate_test_qrcode has established the TapTap app identity.",
|
|
36132
|
+
"Call it only with the TapTap user_id explicitly provided by the user; never infer an account ID."
|
|
36133
|
+
].join(" "),
|
|
36134
|
+
get_ad_config: [
|
|
36135
|
+
"After Maker project status confirms the primary local project configs are initialized, use this as the first remote step for ad-related requests.",
|
|
36136
|
+
"It is the source of truth for current ad activation and configuration, and synchronizes the result into .project/settings.json at @runtime.ad.",
|
|
36137
|
+
"The local preflight does not call the remote tool while project.json or settings.json is missing. Missing local configs do not authorize an automatic build.",
|
|
36138
|
+
"Use maker_build_current_directory only for an explicit user build, submit, or preview request, then check project status again. If configs remain missing, report the limitation and do not rebuild automatically.",
|
|
36139
|
+
"Do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks, and only implement or test ad behavior after the returned configuration is usable.",
|
|
36140
|
+
"If app_id or developer_id is missing, call generate_test_qrcode once and then retry this tool. If ad.status != 1, report warning and ad.url, follow the returned next_action, and retry only after the user completes that step."
|
|
36141
|
+
].join(" "),
|
|
36142
|
+
get_debug_feedbacks: [
|
|
36143
|
+
"Fetch online player feedback for the current Maker project, or query server and Lua session logs when game_session_id is provided.",
|
|
36144
|
+
"The default feedback mode fetches unprocessed records and marks the returned records as processed. For a read-only feedback query, set fetch_and_mark_processed=false; use the input schema to select other filters or an exact feedback record.",
|
|
36145
|
+
"Downloaded feedback attachments are saved in the local project. Read only the returned local_dir, local_log_paths, and local_screenshot_paths; do not treat remote attachment paths as local files.",
|
|
36146
|
+
"Session-log mode returns its own saved paths and progress information; use the returned result to continue when more history is available."
|
|
36147
|
+
].join(" ")
|
|
36148
|
+
};
|
|
36149
|
+
function getMakerRemoteProxyPublicDescriptionOverride(toolName) {
|
|
36150
|
+
return MAKER_REMOTE_PROXY_PUBLIC_DESCRIPTIONS[toolName];
|
|
36151
|
+
}
|
|
36152
|
+
|
|
35914
36153
|
// src/mcp-proxy/config.ts
|
|
35915
36154
|
var DEFAULT_TOOL_CALL_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
35916
36155
|
function readStdin() {
|
|
@@ -36058,7 +36297,7 @@ function applyDefaults(config2) {
|
|
|
36058
36297
|
var MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
|
|
36059
36298
|
var MAKER_MCP_TRACKING_SOURCE = "local_mcp";
|
|
36060
36299
|
var MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
|
|
36061
|
-
var MAKER_MCP_VERSION = "0.0.26-beta.
|
|
36300
|
+
var MAKER_MCP_VERSION = "0.0.26-beta.4".trim() ? "0.0.26-beta.4".trim() : "dev";
|
|
36062
36301
|
var TRACKING_ERROR_MAX_LENGTH = 500;
|
|
36063
36302
|
function buildMakerMcpTrackingPayload(event) {
|
|
36064
36303
|
var _a3, _b, _c;
|
|
@@ -36135,7 +36374,7 @@ async function reportMakerMcpActivity(event) {
|
|
|
36135
36374
|
}
|
|
36136
36375
|
|
|
36137
36376
|
// src/maker/server/mcp.ts
|
|
36138
|
-
var VERSION = true ? "0.0.26-beta.
|
|
36377
|
+
var VERSION = true ? "0.0.26-beta.4" : "dev";
|
|
36139
36378
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
36140
36379
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
36141
36380
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -36157,12 +36396,13 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
|
|
|
36157
36396
|
"confirm_character_voice",
|
|
36158
36397
|
CREATE_3D_ASSET_PROXY_TOOL_NAME,
|
|
36159
36398
|
"generate_test_qrcode",
|
|
36399
|
+
"add_test_whitelist",
|
|
36160
36400
|
"get_ad_config",
|
|
36161
36401
|
"get_debug_feedbacks"
|
|
36162
36402
|
];
|
|
36163
36403
|
var MAKER_BUILD_MULTIPLAYER_SCHEMA = {
|
|
36164
36404
|
type: "object",
|
|
36165
|
-
description: "Optional Maker multiplayer config forwarded
|
|
36405
|
+
description: "Optional Maker multiplayer config forwarded only when explicitly provided and written by maker-tools to .project/settings.json @runtime.multiplayer. Missing local .project/settings.json does not imply single-player mode and does not inject enabled=false. First multiplayer build with entry_client/entry_server should pass multiplayer.enabled=true and any needed match/world fields in the same call. Explicit enabled=false remains supported for a user-confirmed single-player configuration. Later builds update only the provided fields and keep existing config for omitted fields. Runtime defaults: enabled=false, max_players=4, background_match=false.",
|
|
36166
36406
|
properties: {
|
|
36167
36407
|
enabled: {
|
|
36168
36408
|
type: "boolean",
|
|
@@ -36227,7 +36467,7 @@ var MakerCloneFailedError = class extends Error {
|
|
|
36227
36467
|
var tools = [
|
|
36228
36468
|
{
|
|
36229
36469
|
name: "maker_status_lite",
|
|
36230
|
-
description:
|
|
36470
|
+
description: MAKER_STATUS_LITE_PUBLIC_DESCRIPTION,
|
|
36231
36471
|
inputSchema: {
|
|
36232
36472
|
type: "object",
|
|
36233
36473
|
additionalProperties: false,
|
|
@@ -36245,7 +36485,7 @@ var tools = [
|
|
|
36245
36485
|
},
|
|
36246
36486
|
{
|
|
36247
36487
|
name: "maker_build_current_directory",
|
|
36248
|
-
description:
|
|
36488
|
+
description: MAKER_BUILD_CURRENT_DIRECTORY_PUBLIC_DESCRIPTION,
|
|
36249
36489
|
inputSchema: {
|
|
36250
36490
|
type: "object",
|
|
36251
36491
|
additionalProperties: false,
|
|
@@ -36331,11 +36571,12 @@ function filterExposedRemoteProxyTools(toolsToFilter) {
|
|
|
36331
36571
|
return toolsToFilter.filter((tool) => exposedToolNames.has(tool.name));
|
|
36332
36572
|
}
|
|
36333
36573
|
function decorateRemoteProxyToolDefinition(tool) {
|
|
36574
|
+
const publicDescription = getMakerRemoteProxyPublicDescriptionOverride(tool.name);
|
|
36334
36575
|
const guidance = remoteProxyToolGuidance(tool.name);
|
|
36335
36576
|
return {
|
|
36336
36577
|
...tool,
|
|
36337
36578
|
inputSchema: decorateRemoteProxyToolInputSchema(tool.inputSchema, tool.name),
|
|
36338
|
-
description: [tool.description, guidance].filter(Boolean).join("\n\n")
|
|
36579
|
+
description: publicDescription || [tool.description, guidance].filter(Boolean).join("\n\n")
|
|
36339
36580
|
};
|
|
36340
36581
|
}
|
|
36341
36582
|
function decorateRemoteProxyToolInputSchema(inputSchema, toolName) {
|
|
@@ -36343,12 +36584,20 @@ function decorateRemoteProxyToolInputSchema(inputSchema, toolName) {
|
|
|
36343
36584
|
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
36344
36585
|
const decoratedProperties = toolName === "text_to_dialogue" ? decorateTextToDialogueInputProperties(properties) : toolName === "audition_voices_for_character" ? decorateVoiceAuditionInputProperties(properties) : properties;
|
|
36345
36586
|
const required2 = Array.isArray(schema.required) ? schema.required : [];
|
|
36587
|
+
const decoratedRequired = toolName === "audition_voices_for_character" ? [.../* @__PURE__ */ new Set([...required2, "voice_profile"])] : required2;
|
|
36346
36588
|
return {
|
|
36347
36589
|
...schema,
|
|
36348
36590
|
type: schema.type || "object",
|
|
36349
|
-
|
|
36591
|
+
required: decoratedRequired,
|
|
36350
36592
|
properties: {
|
|
36351
36593
|
...decoratedProperties,
|
|
36594
|
+
...toolName === "generate_test_qrcode" ? {
|
|
36595
|
+
confirmed_screen_orientation: {
|
|
36596
|
+
type: "string",
|
|
36597
|
+
enum: ["landscape", "portrait"],
|
|
36598
|
+
description: "Local-only first-time orientation choice. Omit this when the project already has screen_orientation. Supply it only after the tool reports that orientation is missing and the user selects a value in a separate conversation turn. Existing project orientation is immutable and takes precedence. This value is not forwarded to the remote Maker tool."
|
|
36599
|
+
}
|
|
36600
|
+
} : {},
|
|
36352
36601
|
target_dir: {
|
|
36353
36602
|
type: "string",
|
|
36354
36603
|
description: "Optional local Maker project directory. This is a local Maker MCP private parameter used to resolve the current project for asset materialization and reference rewriting; it is not forwarded to the remote Maker tool."
|
|
@@ -36494,12 +36743,17 @@ function remoteProxyToolGuidance(toolName) {
|
|
|
36494
36743
|
].join(" ");
|
|
36495
36744
|
case "get_ad_config":
|
|
36496
36745
|
return [
|
|
36497
|
-
"**Maker hint:** Trigger this tool for
|
|
36746
|
+
"**Maker hint:** Trigger this tool for ad-related requests only after Maker project status shows the primary local configs are initialized. The local preflight keeps ad config unavailable and does not call the remote tool while project.json or settings.json is missing. Build only for an explicit user build, submit, or preview request; if local configs remain missing after a successful build, explain the known limitation and do not rebuild automatically. Do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks. If this tool says app_id or developer_id is missing after configs are ready, call generate_test_qrcode once to generate test QR code metadata, then call this tool again.",
|
|
36498
36747
|
failurePolicy
|
|
36499
36748
|
].join(" ");
|
|
36500
36749
|
case "generate_test_qrcode":
|
|
36501
36750
|
return [
|
|
36502
|
-
"**Maker hint:** Use this only when the user explicitly asks for a test QR code/mobile scan test, or as the recovery step after get_ad_config reports missing app_id or developer_id.
|
|
36751
|
+
"**Maker hint:** Use this only when the user explicitly asks for a test QR code/mobile scan test, or as the recovery step after get_ad_config reports missing app_id or developer_id. Call it without confirmed_screen_orientation first. If .project/project.json already has screen_orientation, reuse it and do not ask the user again. Only if it is missing, ask the user in a separate conversation turn to choose landscape or portrait, then retry with confirmed_screen_orientation. The local proxy records this first choice; an already configured orientation is immutable and always takes precedence. The private parameter is not forwarded to the remote Maker tool. Report the returned QR code or failure payload.",
|
|
36752
|
+
failurePolicy
|
|
36753
|
+
].join(" ");
|
|
36754
|
+
case "add_test_whitelist":
|
|
36755
|
+
return [
|
|
36756
|
+
"**Maker hint:** Use this after the project has been built and generate_test_qrcode has created the TapTap app identity. Call it only with the TapTap user_id explicitly provided by the user; do not infer an account ID.",
|
|
36503
36757
|
failurePolicy
|
|
36504
36758
|
].join(" ");
|
|
36505
36759
|
case "get_debug_feedbacks":
|
|
@@ -36628,11 +36882,22 @@ function createRemoteProxyProgressHandler(progressToken, extra) {
|
|
|
36628
36882
|
};
|
|
36629
36883
|
}
|
|
36630
36884
|
function inspectMakerProxyToolPreflight(toolName, targetDir) {
|
|
36631
|
-
if (toolName !== "generate_test_qrcode") {
|
|
36885
|
+
if (toolName !== "generate_test_qrcode" && toolName !== "get_ad_config" && toolName !== "add_test_whitelist") {
|
|
36632
36886
|
return void 0;
|
|
36633
36887
|
}
|
|
36634
36888
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
36635
|
-
return inspectMakerProjectHealth(
|
|
36889
|
+
return inspectMakerProjectHealth(
|
|
36890
|
+
identify.projectRoot || path18.resolve(targetDir),
|
|
36891
|
+
toolName === "generate_test_qrcode" ? "qrcode" : "status"
|
|
36892
|
+
);
|
|
36893
|
+
}
|
|
36894
|
+
function inspectMakerQrcodeToolPreflight(targetDir, confirmedOrientation) {
|
|
36895
|
+
const projectHealth = inspectMakerProxyToolPreflight("generate_test_qrcode", targetDir);
|
|
36896
|
+
if (!projectHealth.canGenerateTestQrcode) {
|
|
36897
|
+
return { ok: false, message: formatMakerProjectHealthStatus(projectHealth) };
|
|
36898
|
+
}
|
|
36899
|
+
const identify = identifyMakerProject({ cwd: targetDir });
|
|
36900
|
+
return inspectMakerQrcodePreflight(identify.projectRoot || targetDir, confirmedOrientation);
|
|
36636
36901
|
}
|
|
36637
36902
|
function createRemoteProxyCallToolOptions(progressToken, extra) {
|
|
36638
36903
|
return {
|
|
@@ -36652,7 +36917,8 @@ async function startMakerMcpServer() {
|
|
|
36652
36917
|
capabilities: {
|
|
36653
36918
|
tools: {},
|
|
36654
36919
|
resources: {}
|
|
36655
|
-
}
|
|
36920
|
+
},
|
|
36921
|
+
instructions: MAKER_CAPABILITY_ROUTING_INDEX
|
|
36656
36922
|
}
|
|
36657
36923
|
);
|
|
36658
36924
|
const listClientRoots = createServerClientRootsProvider(server);
|
|
@@ -36786,17 +37052,34 @@ async function startMakerMcpServer() {
|
|
|
36786
37052
|
return toolResult;
|
|
36787
37053
|
}
|
|
36788
37054
|
if (isExposedRemoteProxyTool(name)) {
|
|
36789
|
-
const
|
|
36790
|
-
|
|
36791
|
-
);
|
|
37055
|
+
const requestArgs = request.params.arguments || {};
|
|
37056
|
+
const { targetDir: targetDir2, remoteArgs } = splitRemoteProxyToolPrivateArgs(requestArgs, name);
|
|
36792
37057
|
const context = await resolveMakerProjectContext({
|
|
36793
37058
|
targetDir: targetDir2,
|
|
36794
37059
|
listClientRoots,
|
|
36795
37060
|
allowFallbackOnAmbiguousRoots: false
|
|
36796
37061
|
});
|
|
36797
37062
|
if (name === "generate_test_qrcode") {
|
|
37063
|
+
const preflight = inspectMakerQrcodeToolPreflight(
|
|
37064
|
+
context.targetDir,
|
|
37065
|
+
requestArgs.confirmed_screen_orientation
|
|
37066
|
+
);
|
|
37067
|
+
if (!preflight.ok) {
|
|
37068
|
+
const result2 = {
|
|
37069
|
+
isError: true,
|
|
37070
|
+
content: [{ type: "text", text: preflight.message }]
|
|
37071
|
+
};
|
|
37072
|
+
void reportMakerMcpActivityFromPromise(contextPromise, {
|
|
37073
|
+
toolName: name,
|
|
37074
|
+
requestId: extra.requestId,
|
|
37075
|
+
durationMs: Date.now() - startedAt,
|
|
37076
|
+
success: false
|
|
37077
|
+
});
|
|
37078
|
+
return result2;
|
|
37079
|
+
}
|
|
37080
|
+
} else if (name === "get_ad_config" || name === "add_test_whitelist") {
|
|
36798
37081
|
const projectHealth = inspectMakerProxyToolPreflight(name, context.targetDir);
|
|
36799
|
-
if (!projectHealth.
|
|
37082
|
+
if (projectHealth && (projectHealth.status === "not_initialized" || !projectHealth.canBuild)) {
|
|
36800
37083
|
const result2 = {
|
|
36801
37084
|
isError: true,
|
|
36802
37085
|
content: [
|
|
@@ -36945,7 +37228,7 @@ async function formatStatus(options = {}) {
|
|
|
36945
37228
|
const env = getMakerEnvironment(void 0, targetDir);
|
|
36946
37229
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
36947
37230
|
const mcpCwd = process.cwd();
|
|
36948
|
-
const mcpCwdIdentify =
|
|
37231
|
+
const mcpCwdIdentify = path18.resolve(mcpCwd) === path18.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
|
|
36949
37232
|
const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
|
|
36950
37233
|
const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
|
|
36951
37234
|
const pat = loadPat();
|
|
@@ -37083,10 +37366,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
|
|
|
37083
37366
|
if (!options.projectRoot) {
|
|
37084
37367
|
return "";
|
|
37085
37368
|
}
|
|
37086
|
-
const mcpCwd =
|
|
37087
|
-
const targetDir =
|
|
37088
|
-
const projectRoot =
|
|
37089
|
-
const mcpProjectRoot = options.mcpProjectRoot ?
|
|
37369
|
+
const mcpCwd = path18.resolve(options.mcpCwd);
|
|
37370
|
+
const targetDir = path18.resolve(options.targetDir);
|
|
37371
|
+
const projectRoot = path18.resolve(options.projectRoot);
|
|
37372
|
+
const mcpProjectRoot = options.mcpProjectRoot ? path18.resolve(options.mcpProjectRoot) : void 0;
|
|
37090
37373
|
if (mcpProjectRoot === projectRoot) {
|
|
37091
37374
|
return "";
|
|
37092
37375
|
}
|
|
@@ -37167,6 +37450,18 @@ function sleepMs(delayMs) {
|
|
|
37167
37450
|
});
|
|
37168
37451
|
}
|
|
37169
37452
|
function isRetryableMakerProxyError(error2) {
|
|
37453
|
+
if (hasRemoteDiagnostic(error2)) {
|
|
37454
|
+
return false;
|
|
37455
|
+
}
|
|
37456
|
+
if (isHttpClientError(error2)) {
|
|
37457
|
+
return false;
|
|
37458
|
+
}
|
|
37459
|
+
if (isExplicitProxyUnavailableError(error2) || isTransientHttpServerError(error2)) {
|
|
37460
|
+
return true;
|
|
37461
|
+
}
|
|
37462
|
+
if (isMcpBusinessError(error2)) {
|
|
37463
|
+
return false;
|
|
37464
|
+
}
|
|
37170
37465
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
37171
37466
|
if (/\bBUILD FAILED\b|validation|invalid arguments|bad request|forbidden|unauthorized/i.test(
|
|
37172
37467
|
message
|
|
@@ -37177,6 +37472,48 @@ function isRetryableMakerProxyError(error2) {
|
|
|
37177
37472
|
message
|
|
37178
37473
|
);
|
|
37179
37474
|
}
|
|
37475
|
+
function isExplicitProxyUnavailableError(error2) {
|
|
37476
|
+
return error2 instanceof Error && /TapTap MCP Server is currently unavailable|proxy .*reconnect|attempting to reconnect/i.test(
|
|
37477
|
+
error2.message
|
|
37478
|
+
);
|
|
37479
|
+
}
|
|
37480
|
+
function isTransientHttpServerError(error2) {
|
|
37481
|
+
if (!(error2 instanceof Error)) {
|
|
37482
|
+
return false;
|
|
37483
|
+
}
|
|
37484
|
+
const code = error2.code;
|
|
37485
|
+
if (typeof code === "number" && code >= 500 && code < 600) {
|
|
37486
|
+
return true;
|
|
37487
|
+
}
|
|
37488
|
+
return /\bHTTP\s+5\d\d\b|bad gateway|service unavailable|gateway timeout/i.test(error2.message);
|
|
37489
|
+
}
|
|
37490
|
+
function isHttpClientError(error2) {
|
|
37491
|
+
if (!(error2 instanceof Error)) {
|
|
37492
|
+
return false;
|
|
37493
|
+
}
|
|
37494
|
+
const code = error2.code;
|
|
37495
|
+
const numericCode = typeof code === "number" ? code : typeof code === "string" && /^4\d\d$/.test(code) ? Number(code) : void 0;
|
|
37496
|
+
return numericCode !== void 0 && numericCode >= 400 && numericCode < 500 || /\bHTTP\s+4\d\d\b/i.test(error2.message);
|
|
37497
|
+
}
|
|
37498
|
+
function isMcpBusinessError(error2) {
|
|
37499
|
+
if (!(error2 instanceof Error)) {
|
|
37500
|
+
return false;
|
|
37501
|
+
}
|
|
37502
|
+
const code = error2.code;
|
|
37503
|
+
if (typeof code === "number" && code < 0) {
|
|
37504
|
+
return code !== ErrorCode.ConnectionClosed && code !== ErrorCode.RequestTimeout;
|
|
37505
|
+
}
|
|
37506
|
+
return /\bmcp error -\d+:/i.test(error2.message) && !/not connected|session expired|connection closed|transport closed/i.test(error2.message);
|
|
37507
|
+
}
|
|
37508
|
+
function hasRemoteDiagnostic(error2) {
|
|
37509
|
+
if (!(error2 instanceof Error) || !isPlainRecord(error2.data)) {
|
|
37510
|
+
return false;
|
|
37511
|
+
}
|
|
37512
|
+
return Object.prototype.hasOwnProperty.call(
|
|
37513
|
+
error2.data,
|
|
37514
|
+
"remote_result"
|
|
37515
|
+
);
|
|
37516
|
+
}
|
|
37180
37517
|
function formatMakerRemoteSyncUnavailable(error2) {
|
|
37181
37518
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
37182
37519
|
return [
|
|
@@ -37259,7 +37596,7 @@ function createServerClientRootsProvider(server) {
|
|
|
37259
37596
|
async function resolveMakerProjectContext(options = {}) {
|
|
37260
37597
|
if (options.targetDir) {
|
|
37261
37598
|
return {
|
|
37262
|
-
targetDir:
|
|
37599
|
+
targetDir: path18.resolve(options.targetDir),
|
|
37263
37600
|
source: "explicit_target_dir",
|
|
37264
37601
|
roots: { status: "not_requested", roots: [] }
|
|
37265
37602
|
};
|
|
@@ -37354,7 +37691,7 @@ function rootToLocalPath(root) {
|
|
|
37354
37691
|
if (url2.protocol !== "file:") {
|
|
37355
37692
|
return void 0;
|
|
37356
37693
|
}
|
|
37357
|
-
return
|
|
37694
|
+
return path18.resolve(fileURLToPath2(url2));
|
|
37358
37695
|
} catch {
|
|
37359
37696
|
return void 0;
|
|
37360
37697
|
}
|
|
@@ -37368,14 +37705,14 @@ function uniquePaths(values) {
|
|
|
37368
37705
|
continue;
|
|
37369
37706
|
}
|
|
37370
37707
|
seen.add(normalized);
|
|
37371
|
-
result.push(
|
|
37708
|
+
result.push(path18.resolve(value));
|
|
37372
37709
|
}
|
|
37373
37710
|
return result;
|
|
37374
37711
|
}
|
|
37375
37712
|
function normalizePathForCompare2(value) {
|
|
37376
|
-
const resolved =
|
|
37713
|
+
const resolved = path18.resolve(value);
|
|
37377
37714
|
try {
|
|
37378
|
-
return
|
|
37715
|
+
return fs17.realpathSync.native(resolved);
|
|
37379
37716
|
} catch {
|
|
37380
37717
|
return resolved;
|
|
37381
37718
|
}
|
|
@@ -37409,10 +37746,13 @@ function formatMakerClientRootsStatus(roots) {
|
|
|
37409
37746
|
}
|
|
37410
37747
|
return lines.join("\n");
|
|
37411
37748
|
}
|
|
37412
|
-
function splitRemoteProxyToolPrivateArgs(args) {
|
|
37749
|
+
function splitRemoteProxyToolPrivateArgs(args, toolName) {
|
|
37413
37750
|
const remoteArgs = { ...args };
|
|
37414
37751
|
const targetDir = remoteArgs.target_dir;
|
|
37415
37752
|
delete remoteArgs.target_dir;
|
|
37753
|
+
if (toolName === "generate_test_qrcode") {
|
|
37754
|
+
delete remoteArgs.confirmed_screen_orientation;
|
|
37755
|
+
}
|
|
37416
37756
|
if (targetDir === void 0) {
|
|
37417
37757
|
return { remoteArgs };
|
|
37418
37758
|
}
|
|
@@ -37524,14 +37864,14 @@ function formatStatusProjectList(projects) {
|
|
|
37524
37864
|
].filter((line) => line !== void 0).join("\n");
|
|
37525
37865
|
}
|
|
37526
37866
|
function formatClonePartialStateLines(targetDir) {
|
|
37527
|
-
const resolvedTargetDir =
|
|
37867
|
+
const resolvedTargetDir = path18.resolve(targetDir);
|
|
37528
37868
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
37529
37869
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
37530
37870
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
37531
|
-
const stagedDevKitGitignorePath =
|
|
37871
|
+
const stagedDevKitGitignorePath = path18.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
37532
37872
|
const projectBound = Boolean(identify.projectId);
|
|
37533
37873
|
const gitInitialized = Boolean(
|
|
37534
|
-
gitStatus.isOwnGitRoot ||
|
|
37874
|
+
gitStatus.isOwnGitRoot || fs17.existsSync(path18.join(resolvedTargetDir, ".git"))
|
|
37535
37875
|
);
|
|
37536
37876
|
const safeToRetry = !projectBound;
|
|
37537
37877
|
return [
|
|
@@ -37545,7 +37885,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
37545
37885
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
37546
37886
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
37547
37887
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
37548
|
-
`- staged_dev_kit_gitignore: ${
|
|
37888
|
+
`- staged_dev_kit_gitignore: ${fs17.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
37549
37889
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
37550
37890
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
37551
37891
|
].filter(Boolean);
|
|
@@ -37621,12 +37961,12 @@ function resolveEmbeddedProxyCommand(options) {
|
|
|
37621
37961
|
}
|
|
37622
37962
|
return {
|
|
37623
37963
|
command: process.execPath,
|
|
37624
|
-
args: [
|
|
37964
|
+
args: [path18.resolve(makerEntry), "__maker-proxy"]
|
|
37625
37965
|
};
|
|
37626
37966
|
}
|
|
37627
37967
|
function resolveBundledMakerEntry() {
|
|
37628
|
-
const bundledEntry =
|
|
37629
|
-
return
|
|
37968
|
+
const bundledEntry = path18.resolve(__dirname, "../../../bin/taptap-maker");
|
|
37969
|
+
return fs17.existsSync(bundledEntry) ? bundledEntry : void 0;
|
|
37630
37970
|
}
|
|
37631
37971
|
function isUsableEmbeddedMakerEntry(entry) {
|
|
37632
37972
|
if (!entry) {
|
|
@@ -37973,18 +38313,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
37973
38313
|
}
|
|
37974
38314
|
}
|
|
37975
38315
|
async function startRuntimeLogWatch(buildResult) {
|
|
37976
|
-
const runtimeDir =
|
|
37977
|
-
|
|
37978
|
-
const stdoutLog =
|
|
37979
|
-
const stderrLog =
|
|
37980
|
-
const pidFile =
|
|
38316
|
+
const runtimeDir = path18.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
38317
|
+
fs17.mkdirSync(runtimeDir, { recursive: true });
|
|
38318
|
+
const stdoutLog = path18.join(runtimeDir, "watcher.out.log");
|
|
38319
|
+
const stderrLog = path18.join(runtimeDir, "watcher.err.log");
|
|
38320
|
+
const pidFile = path18.join(runtimeDir, "watcher.pid");
|
|
37981
38321
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
37982
|
-
const outFd =
|
|
37983
|
-
const errFd =
|
|
38322
|
+
const outFd = fs17.openSync(stdoutLog, "a");
|
|
38323
|
+
const errFd = fs17.openSync(stderrLog, "a");
|
|
37984
38324
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
37985
38325
|
if (previous.previousStopError) {
|
|
37986
|
-
|
|
37987
|
-
|
|
38326
|
+
fs17.closeSync(outFd);
|
|
38327
|
+
fs17.closeSync(errFd);
|
|
37988
38328
|
return {
|
|
37989
38329
|
started: false,
|
|
37990
38330
|
command: command.text,
|
|
@@ -38047,18 +38387,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
38047
38387
|
...previous
|
|
38048
38388
|
};
|
|
38049
38389
|
} finally {
|
|
38050
|
-
|
|
38051
|
-
|
|
38390
|
+
fs17.closeSync(outFd);
|
|
38391
|
+
fs17.closeSync(errFd);
|
|
38052
38392
|
}
|
|
38053
38393
|
}
|
|
38054
38394
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
38055
|
-
if (!
|
|
38395
|
+
if (!fs17.existsSync(pidFile)) {
|
|
38056
38396
|
return {};
|
|
38057
38397
|
}
|
|
38058
38398
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
38059
38399
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
38060
38400
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
38061
|
-
|
|
38401
|
+
fs17.rmSync(pidFile, { force: true });
|
|
38062
38402
|
return {};
|
|
38063
38403
|
}
|
|
38064
38404
|
try {
|
|
@@ -38066,7 +38406,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
38066
38406
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
38067
38407
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
38068
38408
|
if (!verifiedCommand) {
|
|
38069
|
-
|
|
38409
|
+
fs17.rmSync(pidFile, { force: true });
|
|
38070
38410
|
return {
|
|
38071
38411
|
previousPid: pid,
|
|
38072
38412
|
previousStopped: false,
|
|
@@ -38076,7 +38416,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
38076
38416
|
process.kill(pid, "SIGTERM");
|
|
38077
38417
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
38078
38418
|
if (stopped) {
|
|
38079
|
-
|
|
38419
|
+
fs17.rmSync(pidFile, { force: true });
|
|
38080
38420
|
return { previousPid: pid, previousStopped: true };
|
|
38081
38421
|
}
|
|
38082
38422
|
return {
|
|
@@ -38085,7 +38425,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
38085
38425
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
38086
38426
|
};
|
|
38087
38427
|
} catch (error2) {
|
|
38088
|
-
|
|
38428
|
+
fs17.rmSync(pidFile, { force: true });
|
|
38089
38429
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
38090
38430
|
if (code === "ESRCH") {
|
|
38091
38431
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -38098,7 +38438,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
38098
38438
|
}
|
|
38099
38439
|
}
|
|
38100
38440
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
38101
|
-
const raw =
|
|
38441
|
+
const raw = fs17.readFileSync(pidFile, "utf8").trim();
|
|
38102
38442
|
if (!raw) {
|
|
38103
38443
|
return null;
|
|
38104
38444
|
}
|
|
@@ -38114,7 +38454,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
38114
38454
|
}
|
|
38115
38455
|
}
|
|
38116
38456
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
38117
|
-
|
|
38457
|
+
fs17.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
38118
38458
|
`, "utf8");
|
|
38119
38459
|
}
|
|
38120
38460
|
function getProcessCommand(pid) {
|
|
@@ -38200,10 +38540,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
38200
38540
|
};
|
|
38201
38541
|
}
|
|
38202
38542
|
function resolveMakerCliEntry() {
|
|
38203
|
-
return process.argv[1] ||
|
|
38543
|
+
return process.argv[1] || path18.resolve(process.cwd(), "dist", "maker.js");
|
|
38204
38544
|
}
|
|
38205
38545
|
function getRuntimeLogFilePath(projectRoot) {
|
|
38206
|
-
return
|
|
38546
|
+
return path18.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
38207
38547
|
}
|
|
38208
38548
|
async function refreshMakerPreview(buildResult) {
|
|
38209
38549
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -38337,7 +38677,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
38337
38677
|
if (options.scriptsPath) {
|
|
38338
38678
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
38339
38679
|
}
|
|
38340
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
38680
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs17.existsSync(path18.join(projectRoot, "scripts", "main.lua"))) {
|
|
38341
38681
|
buildArgs.entry = "main.lua";
|
|
38342
38682
|
buildArgs.scriptsPath = "scripts";
|
|
38343
38683
|
}
|
|
@@ -38349,8 +38689,6 @@ function createBuildArgs(projectRoot, options) {
|
|
|
38349
38689
|
}
|
|
38350
38690
|
if (options.multiplayer) {
|
|
38351
38691
|
buildArgs.multiplayer = options.multiplayer;
|
|
38352
|
-
} else if (!options.entryClient && !options.entryServer && !fs16.existsSync(path17.join(projectRoot, ".project", "settings.json"))) {
|
|
38353
|
-
buildArgs.multiplayer = { enabled: false };
|
|
38354
38692
|
}
|
|
38355
38693
|
return buildArgs;
|
|
38356
38694
|
}
|
|
@@ -38530,11 +38868,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
38530
38868
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
38531
38869
|
`- watch_command: ${command}`,
|
|
38532
38870
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
38533
|
-
`- local_file: ${
|
|
38871
|
+
`- local_file: ${path18.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
38534
38872
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
38535
38873
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
38536
38874
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
38537
|
-
`- state_file: ${
|
|
38875
|
+
`- state_file: ${path18.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
38538
38876
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
38539
38877
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
38540
38878
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -38795,9 +39133,9 @@ function indent2(value) {
|
|
|
38795
39133
|
// src/maker/cli/commands.ts
|
|
38796
39134
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
38797
39135
|
import crypto3 from "node:crypto";
|
|
38798
|
-
import
|
|
39136
|
+
import fs18 from "node:fs";
|
|
38799
39137
|
import os4 from "node:os";
|
|
38800
|
-
import
|
|
39138
|
+
import path19 from "node:path";
|
|
38801
39139
|
import readline from "node:readline/promises";
|
|
38802
39140
|
import { stdin as input, stdout as output } from "node:process";
|
|
38803
39141
|
|
|
@@ -38943,7 +39281,7 @@ function formatError2(error2) {
|
|
|
38943
39281
|
}
|
|
38944
39282
|
|
|
38945
39283
|
// src/maker/cli/commands.ts
|
|
38946
|
-
var VERSION2 = true ? "0.0.26-beta.
|
|
39284
|
+
var VERSION2 = true ? "0.0.26-beta.4" : "dev";
|
|
38947
39285
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
38948
39286
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
38949
39287
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
@@ -39078,7 +39416,7 @@ function toOptionKey(value) {
|
|
|
39078
39416
|
}
|
|
39079
39417
|
async function runInit(parsed, ctx) {
|
|
39080
39418
|
rejectPackageOption(parsed);
|
|
39081
|
-
const targetDir =
|
|
39419
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39082
39420
|
const env = makerEnvOption(parsed);
|
|
39083
39421
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
39084
39422
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -39171,7 +39509,7 @@ async function runInit(parsed, ctx) {
|
|
|
39171
39509
|
}
|
|
39172
39510
|
async function runDoctor(parsed, ctx) {
|
|
39173
39511
|
var _a3, _b;
|
|
39174
|
-
const targetDir =
|
|
39512
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39175
39513
|
const env = makerEnvOption(parsed);
|
|
39176
39514
|
const git = checkGitEnvironment();
|
|
39177
39515
|
const python = checkMakerPythonEnvironment();
|
|
@@ -39265,9 +39603,9 @@ async function runDoctor(parsed, ctx) {
|
|
|
39265
39603
|
);
|
|
39266
39604
|
}
|
|
39267
39605
|
function inspectMakerMcpToolsAvailability(options) {
|
|
39268
|
-
const aiPwd =
|
|
39606
|
+
const aiPwd = path19.resolve(process.cwd());
|
|
39269
39607
|
const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
|
|
39270
|
-
const makerProjectDir = options.makerProjectDir ?
|
|
39608
|
+
const makerProjectDir = options.makerProjectDir ? path19.resolve(options.makerProjectDir) : void 0;
|
|
39271
39609
|
if (!makerProjectDir) {
|
|
39272
39610
|
return {
|
|
39273
39611
|
tools_visibility: "refresh_ai_client_if_missing",
|
|
@@ -39309,9 +39647,9 @@ function samePath2(left, right) {
|
|
|
39309
39647
|
return normalizePathForCompare3(left) === normalizePathForCompare3(right);
|
|
39310
39648
|
}
|
|
39311
39649
|
function normalizePathForCompare3(value) {
|
|
39312
|
-
const resolved =
|
|
39650
|
+
const resolved = path19.resolve(value);
|
|
39313
39651
|
try {
|
|
39314
|
-
return
|
|
39652
|
+
return fs18.realpathSync.native(resolved);
|
|
39315
39653
|
} catch {
|
|
39316
39654
|
return resolved;
|
|
39317
39655
|
}
|
|
@@ -39629,7 +39967,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
39629
39967
|
}
|
|
39630
39968
|
async function resolvePatSet(parsed, ctx) {
|
|
39631
39969
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
39632
|
-
const pat =
|
|
39970
|
+
const pat = fs18.readFileSync(0, "utf8").trim();
|
|
39633
39971
|
if (!pat) {
|
|
39634
39972
|
throw new Error("No PAT found on stdin.");
|
|
39635
39973
|
}
|
|
@@ -39659,7 +39997,7 @@ async function runMcpInstall(parsed, ctx) {
|
|
|
39659
39997
|
env: makerEnvOption(parsed),
|
|
39660
39998
|
pkg: MAKER_NPM_PACKAGE,
|
|
39661
39999
|
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
39662
|
-
cwd: explicitTargetDir ?
|
|
40000
|
+
cwd: explicitTargetDir ? path19.resolve(explicitTargetDir) : void 0
|
|
39663
40001
|
});
|
|
39664
40002
|
if (ctx.json) {
|
|
39665
40003
|
writeJson(results);
|
|
@@ -39718,7 +40056,7 @@ ${indent3(payload.stderr)}` : "",
|
|
|
39718
40056
|
);
|
|
39719
40057
|
}
|
|
39720
40058
|
async function runAgentsUpdate(parsed, ctx) {
|
|
39721
|
-
const targetDir =
|
|
40059
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39722
40060
|
const result = updateMakerAgentsPolicy(targetDir);
|
|
39723
40061
|
if (ctx.json) {
|
|
39724
40062
|
writeJson(result);
|
|
@@ -39737,7 +40075,7 @@ async function runAgentsUpdate(parsed, ctx) {
|
|
|
39737
40075
|
async function runUpgrade(parsed, ctx) {
|
|
39738
40076
|
rejectPackageOption(parsed);
|
|
39739
40077
|
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
39740
|
-
const targetDir =
|
|
40078
|
+
const targetDir = path19.resolve(explicitTargetDir || process.cwd());
|
|
39741
40079
|
const env = makerEnvOption(parsed);
|
|
39742
40080
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
39743
40081
|
const installResults = installMcpConfigs({
|
|
@@ -39822,7 +40160,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
39822
40160
|
];
|
|
39823
40161
|
}
|
|
39824
40162
|
async function runDevKitUpdate(parsed, ctx) {
|
|
39825
|
-
const targetDir =
|
|
40163
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39826
40164
|
const result = await installAiDevKit({
|
|
39827
40165
|
targetDir,
|
|
39828
40166
|
preserveExisting: false,
|
|
@@ -39834,7 +40172,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
39834
40172
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
39835
40173
|
}
|
|
39836
40174
|
async function runLogsWatch(parsed, ctx) {
|
|
39837
|
-
const targetDir =
|
|
40175
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39838
40176
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
39839
40177
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
39840
40178
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -39844,9 +40182,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
39844
40182
|
serverUrl: stringOption(parsed, "server_url"),
|
|
39845
40183
|
env: makerEnvOption(parsed)
|
|
39846
40184
|
});
|
|
39847
|
-
const runtimeDir =
|
|
39848
|
-
const runtimeLog =
|
|
39849
|
-
const pidFile =
|
|
40185
|
+
const runtimeDir = path19.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
40186
|
+
const runtimeLog = path19.join(runtimeDir, "runtime.log");
|
|
40187
|
+
const pidFile = path19.join(runtimeDir, "watcher.pid");
|
|
39850
40188
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
39851
40189
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
39852
40190
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -39891,10 +40229,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
39891
40229
|
}
|
|
39892
40230
|
}
|
|
39893
40231
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
39894
|
-
|
|
40232
|
+
fs18.mkdirSync(path19.dirname(pidFile), { recursive: true });
|
|
39895
40233
|
const existingPid = readPidFile(pidFile);
|
|
39896
40234
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
39897
|
-
|
|
40235
|
+
fs18.writeFileSync(
|
|
39898
40236
|
pidFile,
|
|
39899
40237
|
`${JSON.stringify(
|
|
39900
40238
|
{
|
|
@@ -39912,10 +40250,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
39912
40250
|
return previous;
|
|
39913
40251
|
}
|
|
39914
40252
|
function readPidFile(pidFile) {
|
|
39915
|
-
if (!
|
|
40253
|
+
if (!fs18.existsSync(pidFile)) {
|
|
39916
40254
|
return void 0;
|
|
39917
40255
|
}
|
|
39918
|
-
const raw =
|
|
40256
|
+
const raw = fs18.readFileSync(pidFile, "utf8").trim();
|
|
39919
40257
|
let pid = Number(raw);
|
|
39920
40258
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
39921
40259
|
try {
|
|
@@ -39935,7 +40273,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
39935
40273
|
}
|
|
39936
40274
|
cleaned = true;
|
|
39937
40275
|
if (readPidFile(pidFile) === process.pid) {
|
|
39938
|
-
|
|
40276
|
+
fs18.rmSync(pidFile, { force: true });
|
|
39939
40277
|
}
|
|
39940
40278
|
};
|
|
39941
40279
|
process.once("exit", cleanup);
|
|
@@ -40086,7 +40424,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
40086
40424
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
40087
40425
|
});
|
|
40088
40426
|
writeDevKitStagedGitignore(
|
|
40089
|
-
|
|
40427
|
+
path19.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
40090
40428
|
listPresentDevKitManagedEntries(targetDir)
|
|
40091
40429
|
);
|
|
40092
40430
|
if (options.finalizeGitignore) {
|
|
@@ -40103,7 +40441,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
40103
40441
|
);
|
|
40104
40442
|
} catch (error2) {
|
|
40105
40443
|
writeDevKitStagedGitignore(
|
|
40106
|
-
|
|
40444
|
+
path19.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
40107
40445
|
listPresentDevKitManagedEntries(targetDir)
|
|
40108
40446
|
);
|
|
40109
40447
|
if (options.finalizeGitignore) {
|
|
@@ -40193,12 +40531,12 @@ function installMcpConfig(ide, options) {
|
|
|
40193
40531
|
}
|
|
40194
40532
|
function installMcpConfigUnsafe(ide, options) {
|
|
40195
40533
|
if (ide === "codex") {
|
|
40196
|
-
const configPath =
|
|
40534
|
+
const configPath = path19.join(os4.homedir(), ".codex", "config.toml");
|
|
40197
40535
|
const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
|
|
40198
40536
|
return [createMcpInstallResult(ide, "Codex", configPath, write)];
|
|
40199
40537
|
}
|
|
40200
40538
|
if (ide === "cursor") {
|
|
40201
|
-
const configPath =
|
|
40539
|
+
const configPath = path19.join(os4.homedir(), ".cursor", "mcp.json");
|
|
40202
40540
|
const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
|
|
40203
40541
|
return [createMcpInstallResult(ide, "Cursor", configPath, write)];
|
|
40204
40542
|
}
|
|
@@ -40216,7 +40554,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
40216
40554
|
];
|
|
40217
40555
|
}
|
|
40218
40556
|
}
|
|
40219
|
-
const configPath =
|
|
40557
|
+
const configPath = path19.join(os4.homedir(), ".claude.json");
|
|
40220
40558
|
const write = mergeJsonMcpConfig(configPath, claudeOptions);
|
|
40221
40559
|
return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
|
|
40222
40560
|
}
|
|
@@ -40230,7 +40568,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
40230
40568
|
}
|
|
40231
40569
|
if (ide === "opencode") {
|
|
40232
40570
|
const configPath = getOpenCodeMcpConfigPath();
|
|
40233
|
-
if (!
|
|
40571
|
+
if (!fs18.existsSync(configPath)) {
|
|
40234
40572
|
return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
|
|
40235
40573
|
}
|
|
40236
40574
|
const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
|
|
@@ -40298,7 +40636,7 @@ function getDefaultMcpInstallIdes() {
|
|
|
40298
40636
|
if (getTraeMcpInstallPaths().length > 0) {
|
|
40299
40637
|
ides.push("trae");
|
|
40300
40638
|
}
|
|
40301
|
-
if (
|
|
40639
|
+
if (fs18.existsSync(getOpenCodeMcpConfigPath())) {
|
|
40302
40640
|
ides.push("opencode");
|
|
40303
40641
|
}
|
|
40304
40642
|
if (getWorkBuddyMcpInstallPaths().length > 0) {
|
|
@@ -40315,7 +40653,7 @@ function getExistingTraeUserConfigPaths(paths) {
|
|
|
40315
40653
|
const seen = /* @__PURE__ */ new Set();
|
|
40316
40654
|
return paths.filter((configPath) => {
|
|
40317
40655
|
const key = normalizeConfigPathKey(configPath);
|
|
40318
|
-
if (seen.has(key) || !
|
|
40656
|
+
if (seen.has(key) || !fs18.existsSync(path19.dirname(configPath))) {
|
|
40319
40657
|
return false;
|
|
40320
40658
|
}
|
|
40321
40659
|
seen.add(key);
|
|
@@ -40326,7 +40664,7 @@ function getExistingConfigPaths(paths) {
|
|
|
40326
40664
|
const seen = /* @__PURE__ */ new Set();
|
|
40327
40665
|
return paths.filter((configPath) => {
|
|
40328
40666
|
const key = normalizeConfigPathKey(configPath);
|
|
40329
|
-
if (seen.has(key) || !
|
|
40667
|
+
if (seen.has(key) || !fs18.existsSync(configPath)) {
|
|
40330
40668
|
return false;
|
|
40331
40669
|
}
|
|
40332
40670
|
seen.add(key);
|
|
@@ -40334,65 +40672,65 @@ function getExistingConfigPaths(paths) {
|
|
|
40334
40672
|
});
|
|
40335
40673
|
}
|
|
40336
40674
|
function normalizeConfigPathKey(configPath) {
|
|
40337
|
-
const resolved =
|
|
40675
|
+
const resolved = path19.resolve(configPath);
|
|
40338
40676
|
return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
|
|
40339
40677
|
}
|
|
40340
40678
|
function getTraeSoloMcpConfigPaths() {
|
|
40341
40679
|
if (process.platform === "win32") {
|
|
40342
|
-
const roaming = process.env.APPDATA ||
|
|
40680
|
+
const roaming = process.env.APPDATA || path19.join(os4.homedir(), "AppData", "Roaming");
|
|
40343
40681
|
return [
|
|
40344
|
-
|
|
40345
|
-
|
|
40682
|
+
path19.join(roaming, "TRAE SOLO", "User", "mcp.json"),
|
|
40683
|
+
path19.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
|
|
40346
40684
|
];
|
|
40347
40685
|
}
|
|
40348
|
-
const appSupport =
|
|
40686
|
+
const appSupport = path19.join(os4.homedir(), "Library", "Application Support");
|
|
40349
40687
|
return [
|
|
40350
|
-
|
|
40351
|
-
|
|
40688
|
+
path19.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
|
|
40689
|
+
path19.join(appSupport, "TRAE SOLO", "User", "mcp.json")
|
|
40352
40690
|
];
|
|
40353
40691
|
}
|
|
40354
40692
|
function getTraeUnverifiedMcpConfigPaths() {
|
|
40355
40693
|
if (process.platform === "win32") {
|
|
40356
|
-
const roaming = process.env.APPDATA ||
|
|
40694
|
+
const roaming = process.env.APPDATA || path19.join(os4.homedir(), "AppData", "Roaming");
|
|
40357
40695
|
return [
|
|
40358
|
-
|
|
40359
|
-
|
|
40360
|
-
|
|
40696
|
+
path19.join(roaming, "Trae", "User", "mcp.json"),
|
|
40697
|
+
path19.join(roaming, "TRAE", "User", "mcp.json"),
|
|
40698
|
+
path19.join(roaming, "Trae CN", "User", "mcp.json")
|
|
40361
40699
|
];
|
|
40362
40700
|
}
|
|
40363
|
-
const appSupport =
|
|
40701
|
+
const appSupport = path19.join(os4.homedir(), "Library", "Application Support");
|
|
40364
40702
|
return [
|
|
40365
|
-
|
|
40366
|
-
|
|
40367
|
-
|
|
40703
|
+
path19.join(appSupport, "Trae", "User", "mcp.json"),
|
|
40704
|
+
path19.join(appSupport, "TRAE", "User", "mcp.json"),
|
|
40705
|
+
path19.join(appSupport, "Trae CN", "User", "mcp.json")
|
|
40368
40706
|
];
|
|
40369
40707
|
}
|
|
40370
40708
|
function getOpenCodeMcpConfigPath() {
|
|
40371
|
-
return
|
|
40709
|
+
return path19.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
40372
40710
|
}
|
|
40373
40711
|
function getWorkBuddyHome() {
|
|
40374
|
-
return
|
|
40712
|
+
return path19.join(os4.homedir(), ".workbuddy");
|
|
40375
40713
|
}
|
|
40376
40714
|
function shouldShowWorkBuddyTrustInspection() {
|
|
40377
|
-
return
|
|
40715
|
+
return fs18.existsSync(getWorkBuddyHome());
|
|
40378
40716
|
}
|
|
40379
40717
|
function getWorkBuddyMcpInstallPaths(options = {}) {
|
|
40380
|
-
const primary =
|
|
40381
|
-
if (
|
|
40718
|
+
const primary = path19.join(getWorkBuddyHome(), "mcp.json");
|
|
40719
|
+
if (fs18.existsSync(primary) || options.createPrimary) {
|
|
40382
40720
|
return [primary];
|
|
40383
40721
|
}
|
|
40384
|
-
const legacy =
|
|
40385
|
-
if (
|
|
40722
|
+
const legacy = path19.join(getWorkBuddyHome(), ".mcp.json");
|
|
40723
|
+
if (fs18.existsSync(legacy)) {
|
|
40386
40724
|
return [legacy];
|
|
40387
40725
|
}
|
|
40388
40726
|
return [];
|
|
40389
40727
|
}
|
|
40390
40728
|
function inspectWorkBuddyTrustState(mcpName) {
|
|
40391
40729
|
const workbuddyHome = getWorkBuddyHome();
|
|
40392
|
-
const connectorsDir =
|
|
40730
|
+
const connectorsDir = path19.join(workbuddyHome, "connectors");
|
|
40393
40731
|
const accounts = [];
|
|
40394
40732
|
const stateFiles = [];
|
|
40395
|
-
if (!
|
|
40733
|
+
if (!fs18.existsSync(connectorsDir)) {
|
|
40396
40734
|
return {
|
|
40397
40735
|
status: "not_found",
|
|
40398
40736
|
mcp_name: mcpName,
|
|
@@ -40402,12 +40740,12 @@ function inspectWorkBuddyTrustState(mcpName) {
|
|
|
40402
40740
|
accounts
|
|
40403
40741
|
};
|
|
40404
40742
|
}
|
|
40405
|
-
for (const entry of
|
|
40743
|
+
for (const entry of fs18.readdirSync(connectorsDir, { withFileTypes: true })) {
|
|
40406
40744
|
if (!entry.isDirectory()) {
|
|
40407
40745
|
continue;
|
|
40408
40746
|
}
|
|
40409
|
-
const statePath =
|
|
40410
|
-
if (!
|
|
40747
|
+
const statePath = path19.join(connectorsDir, entry.name, "connector-states.json");
|
|
40748
|
+
if (!fs18.existsSync(statePath)) {
|
|
40411
40749
|
continue;
|
|
40412
40750
|
}
|
|
40413
40751
|
stateFiles.push(statePath);
|
|
@@ -40482,7 +40820,7 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
40482
40820
|
);
|
|
40483
40821
|
}
|
|
40484
40822
|
function mergeOpenCodeMcpConfig(configPath, options) {
|
|
40485
|
-
const rawContent =
|
|
40823
|
+
const rawContent = fs18.readFileSync(configPath, "utf8");
|
|
40486
40824
|
const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
|
|
40487
40825
|
const existing = readJsonObject(configPath, { jsonc: true });
|
|
40488
40826
|
const mcp = asObject(existing.mcp);
|
|
@@ -40509,7 +40847,7 @@ function mergeOpenCodeMcpConfig(configPath, options) {
|
|
|
40509
40847
|
return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
|
|
40510
40848
|
}
|
|
40511
40849
|
function mergeCodexMcpConfig(configPath, options) {
|
|
40512
|
-
const existing =
|
|
40850
|
+
const existing = fs18.existsSync(configPath) ? fs18.readFileSync(configPath, "utf8") : "";
|
|
40513
40851
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
40514
40852
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
40515
40853
|
const launch = getNpxCliCommand(options.pkg);
|
|
@@ -40679,10 +41017,10 @@ function rejectPackageOption(parsed) {
|
|
|
40679
41017
|
}
|
|
40680
41018
|
}
|
|
40681
41019
|
function readJsonObject(filePath, options = {}) {
|
|
40682
|
-
if (!
|
|
41020
|
+
if (!fs18.existsSync(filePath)) {
|
|
40683
41021
|
return {};
|
|
40684
41022
|
}
|
|
40685
|
-
const raw =
|
|
41023
|
+
const raw = fs18.readFileSync(filePath, "utf8");
|
|
40686
41024
|
try {
|
|
40687
41025
|
const normalized = normalizeJsonConfigContent(raw, options);
|
|
40688
41026
|
const parsed = JSON.parse(normalized);
|
|
@@ -40702,25 +41040,25 @@ function asObject(value) {
|
|
|
40702
41040
|
return {};
|
|
40703
41041
|
}
|
|
40704
41042
|
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
40705
|
-
const existed =
|
|
40706
|
-
const previousContent = existed ?
|
|
41043
|
+
const existed = fs18.existsSync(filePath);
|
|
41044
|
+
const previousContent = existed ? fs18.readFileSync(filePath, "utf8") : void 0;
|
|
40707
41045
|
if (previousContent === nextContent) {
|
|
40708
41046
|
return { changed: false };
|
|
40709
41047
|
}
|
|
40710
41048
|
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
40711
|
-
|
|
41049
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
40712
41050
|
if (previousContent !== void 0 && backupPath) {
|
|
40713
|
-
|
|
41051
|
+
fs18.writeFileSync(backupPath, previousContent, "utf8");
|
|
40714
41052
|
}
|
|
40715
41053
|
try {
|
|
40716
|
-
|
|
40717
|
-
validate == null ? void 0 : validate(
|
|
41054
|
+
fs18.writeFileSync(filePath, nextContent, "utf8");
|
|
41055
|
+
validate == null ? void 0 : validate(fs18.readFileSync(filePath, "utf8"));
|
|
40718
41056
|
return { changed: true, backupPath };
|
|
40719
41057
|
} catch (error2) {
|
|
40720
41058
|
if (previousContent !== void 0) {
|
|
40721
|
-
|
|
41059
|
+
fs18.writeFileSync(filePath, previousContent, "utf8");
|
|
40722
41060
|
} else {
|
|
40723
|
-
|
|
41061
|
+
fs18.rmSync(filePath, { force: true });
|
|
40724
41062
|
}
|
|
40725
41063
|
throw error2;
|
|
40726
41064
|
}
|
|
@@ -40867,10 +41205,10 @@ function formatMcpInstallMessage(label, configPath, write) {
|
|
|
40867
41205
|
].filter(Boolean).join("\n");
|
|
40868
41206
|
}
|
|
40869
41207
|
function saveInitState(targetDir, state) {
|
|
40870
|
-
|
|
40871
|
-
const key = crypto3.createHash("sha256").update(
|
|
40872
|
-
|
|
40873
|
-
|
|
41208
|
+
fs18.mkdirSync(getMakerHome(), { recursive: true });
|
|
41209
|
+
const key = crypto3.createHash("sha256").update(path19.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
41210
|
+
fs18.writeFileSync(
|
|
41211
|
+
path19.join(getMakerHome(), `init-state-${key}.json`),
|
|
40874
41212
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
40875
41213
|
`,
|
|
40876
41214
|
"utf8"
|
|
@@ -41018,7 +41356,7 @@ function makerEnvOption(parsed) {
|
|
|
41018
41356
|
return env;
|
|
41019
41357
|
}
|
|
41020
41358
|
const targetDir = stringOption(parsed, "target_dir");
|
|
41021
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
41359
|
+
return getMakerEnvironment(void 0, targetDir ? path19.resolve(targetDir) : process.cwd());
|
|
41022
41360
|
}
|
|
41023
41361
|
function mcpVerifyModeOption(parsed) {
|
|
41024
41362
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -42520,7 +42858,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
42520
42858
|
};
|
|
42521
42859
|
|
|
42522
42860
|
// src/mcp-proxy/proxy.ts
|
|
42523
|
-
import * as
|
|
42861
|
+
import * as path21 from "node:path";
|
|
42524
42862
|
import * as crypto6 from "node:crypto";
|
|
42525
42863
|
|
|
42526
42864
|
// src/mcp-proxy/cookieJar.ts
|
|
@@ -42702,8 +43040,8 @@ function createCookieFetch(cookieJar) {
|
|
|
42702
43040
|
}
|
|
42703
43041
|
|
|
42704
43042
|
// src/core/utils/logWriter.ts
|
|
42705
|
-
import * as
|
|
42706
|
-
import * as
|
|
43043
|
+
import * as fs19 from "node:fs";
|
|
43044
|
+
import * as path20 from "node:path";
|
|
42707
43045
|
import * as crypto5 from "node:crypto";
|
|
42708
43046
|
|
|
42709
43047
|
// src/core/types/log.ts
|
|
@@ -42744,7 +43082,7 @@ var LogWriter = class {
|
|
|
42744
43082
|
return;
|
|
42745
43083
|
}
|
|
42746
43084
|
try {
|
|
42747
|
-
await
|
|
43085
|
+
await fs19.promises.mkdir(this.config.logDir, { recursive: true });
|
|
42748
43086
|
await this.cleanupOldLogs();
|
|
42749
43087
|
this.initialized = true;
|
|
42750
43088
|
} catch (error2) {
|
|
@@ -42767,7 +43105,7 @@ var LogWriter = class {
|
|
|
42767
43105
|
*/
|
|
42768
43106
|
getLogFilePath(date5) {
|
|
42769
43107
|
const d = date5 || this.getCurrentDate();
|
|
42770
|
-
return
|
|
43108
|
+
return path20.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
42771
43109
|
}
|
|
42772
43110
|
/**
|
|
42773
43111
|
* 获取或创建写入流
|
|
@@ -42782,7 +43120,7 @@ var LogWriter = class {
|
|
|
42782
43120
|
}
|
|
42783
43121
|
this.currentDate = date5;
|
|
42784
43122
|
try {
|
|
42785
|
-
this.writeStream =
|
|
43123
|
+
this.writeStream = fs19.createWriteStream(this.getLogFilePath(date5), {
|
|
42786
43124
|
flags: "a",
|
|
42787
43125
|
encoding: "utf8"
|
|
42788
43126
|
});
|
|
@@ -42834,11 +43172,11 @@ var LogWriter = class {
|
|
|
42834
43172
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
42835
43173
|
try {
|
|
42836
43174
|
const filePath = this.getLogFilePath();
|
|
42837
|
-
const dir =
|
|
42838
|
-
if (!
|
|
42839
|
-
|
|
43175
|
+
const dir = path20.dirname(filePath);
|
|
43176
|
+
if (!fs19.existsSync(dir)) {
|
|
43177
|
+
fs19.mkdirSync(dir, { recursive: true });
|
|
42840
43178
|
}
|
|
42841
|
-
|
|
43179
|
+
fs19.appendFileSync(filePath, message, "utf8");
|
|
42842
43180
|
} catch {
|
|
42843
43181
|
}
|
|
42844
43182
|
}
|
|
@@ -42849,7 +43187,7 @@ var LogWriter = class {
|
|
|
42849
43187
|
async cleanupOldLogs() {
|
|
42850
43188
|
if (this.config.maxDays <= 0) return;
|
|
42851
43189
|
try {
|
|
42852
|
-
const files = await
|
|
43190
|
+
const files = await fs19.promises.readdir(this.config.logDir);
|
|
42853
43191
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
42854
43192
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
42855
43193
|
const prefix = this.config.prefix;
|
|
@@ -42864,7 +43202,7 @@ var LogWriter = class {
|
|
|
42864
43202
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
42865
43203
|
const fileDate = new Date(year, month - 1, day);
|
|
42866
43204
|
if (fileDate < cutoffDate) {
|
|
42867
|
-
await
|
|
43205
|
+
await fs19.promises.unlink(path20.join(this.config.logDir, file2));
|
|
42868
43206
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
42869
43207
|
`);
|
|
42870
43208
|
}
|
|
@@ -42903,6 +43241,53 @@ var VERSION3 = typeof __PROXY_VERSION__ !== "undefined" ? __PROXY_VERSION__ : "d
|
|
|
42903
43241
|
var LOCAL_PROXY_TAG = "local";
|
|
42904
43242
|
var DEFAULT_RECONNECT_INTERVAL_MS = 5e3;
|
|
42905
43243
|
var MAX_RECONNECT_INTERVAL_MS = 60 * 1e3;
|
|
43244
|
+
function convertMcpApplicationErrorToToolResult(error2) {
|
|
43245
|
+
if (!(error2 instanceof Error)) {
|
|
43246
|
+
return void 0;
|
|
43247
|
+
}
|
|
43248
|
+
const data = error2.data;
|
|
43249
|
+
if (!isRecord3(data) || !("remote_result" in data) || data.remote_result === void 0) {
|
|
43250
|
+
return void 0;
|
|
43251
|
+
}
|
|
43252
|
+
return {
|
|
43253
|
+
isError: true,
|
|
43254
|
+
content: [
|
|
43255
|
+
{
|
|
43256
|
+
type: "text",
|
|
43257
|
+
text: [
|
|
43258
|
+
error2.message,
|
|
43259
|
+
"remote_result:",
|
|
43260
|
+
formatProxyDiagnosticValue(data.remote_result)
|
|
43261
|
+
].join("\n")
|
|
43262
|
+
}
|
|
43263
|
+
]
|
|
43264
|
+
};
|
|
43265
|
+
}
|
|
43266
|
+
function isRecord3(value) {
|
|
43267
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43268
|
+
}
|
|
43269
|
+
function formatProxyDiagnosticValue(value) {
|
|
43270
|
+
if (typeof value === "string") {
|
|
43271
|
+
return value;
|
|
43272
|
+
}
|
|
43273
|
+
try {
|
|
43274
|
+
return JSON.stringify(value, null, 2) || String(value);
|
|
43275
|
+
} catch {
|
|
43276
|
+
return String(value);
|
|
43277
|
+
}
|
|
43278
|
+
}
|
|
43279
|
+
function isTransientHttpServerError2(error2) {
|
|
43280
|
+
const code = error2.code;
|
|
43281
|
+
if (typeof code === "number" && code >= 500 && code < 600) {
|
|
43282
|
+
return true;
|
|
43283
|
+
}
|
|
43284
|
+
return /\bHTTP\s+5\d\d\b|bad gateway|service unavailable|gateway timeout/i.test(error2.message);
|
|
43285
|
+
}
|
|
43286
|
+
function isHttpClientError2(error2) {
|
|
43287
|
+
const code = error2.code;
|
|
43288
|
+
const numericCode = typeof code === "number" ? code : typeof code === "string" && /^4\d\d$/.test(code) ? Number(code) : void 0;
|
|
43289
|
+
return numericCode !== void 0 && numericCode >= 400 && numericCode < 500 || /\bHTTP\s+4\d\d\b/i.test(error2.message);
|
|
43290
|
+
}
|
|
42906
43291
|
var TapTapMCPProxy = class {
|
|
42907
43292
|
constructor(config2) {
|
|
42908
43293
|
this.connected = false;
|
|
@@ -42938,10 +43323,10 @@ var TapTapMCPProxy = class {
|
|
|
42938
43323
|
const { user_id, project_id } = this.config.tenant;
|
|
42939
43324
|
let logDir;
|
|
42940
43325
|
if (user_id && project_id) {
|
|
42941
|
-
logDir =
|
|
43326
|
+
logDir = path21.join(logRoot, "proxy", user_id, project_id);
|
|
42942
43327
|
} else {
|
|
42943
43328
|
const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
42944
|
-
logDir =
|
|
43329
|
+
logDir = path21.join(logRoot, "proxy", kidHash);
|
|
42945
43330
|
}
|
|
42946
43331
|
return new LogWriter({
|
|
42947
43332
|
logDir,
|
|
@@ -43127,8 +43512,8 @@ var TapTapMCPProxy = class {
|
|
|
43127
43512
|
this.log("info", "✅ Connected and session validated");
|
|
43128
43513
|
this.startHealthCheck();
|
|
43129
43514
|
if (this.reconnecting) {
|
|
43130
|
-
await this.notifyReconnected();
|
|
43131
43515
|
await this.processPendingRequests();
|
|
43516
|
+
await this.notifyReconnected();
|
|
43132
43517
|
this.reconnecting = false;
|
|
43133
43518
|
}
|
|
43134
43519
|
} catch (error2) {
|
|
@@ -43333,6 +43718,15 @@ var TapTapMCPProxy = class {
|
|
|
43333
43718
|
*/
|
|
43334
43719
|
isNetworkError(error2) {
|
|
43335
43720
|
if (!(error2 instanceof Error)) return false;
|
|
43721
|
+
if (convertMcpApplicationErrorToToolResult(error2)) {
|
|
43722
|
+
return false;
|
|
43723
|
+
}
|
|
43724
|
+
if (isHttpClientError2(error2)) {
|
|
43725
|
+
return false;
|
|
43726
|
+
}
|
|
43727
|
+
if (isTransientHttpServerError2(error2)) {
|
|
43728
|
+
return true;
|
|
43729
|
+
}
|
|
43336
43730
|
const errorMsg = error2.message.toLowerCase();
|
|
43337
43731
|
const errorCode = error2.code;
|
|
43338
43732
|
const networkErrorCodes = [
|
|
@@ -43356,6 +43750,9 @@ var TapTapMCPProxy = class {
|
|
|
43356
43750
|
if (errorCode && networkErrorCodes.includes(errorCode)) {
|
|
43357
43751
|
return true;
|
|
43358
43752
|
}
|
|
43753
|
+
if (errorCode === ErrorCode.ConnectionClosed || errorCode === ErrorCode.RequestTimeout) {
|
|
43754
|
+
return true;
|
|
43755
|
+
}
|
|
43359
43756
|
if (errorMsg.includes("not connected") || this.isSessionInvalidError(error2)) {
|
|
43360
43757
|
return true;
|
|
43361
43758
|
}
|
|
@@ -43411,6 +43808,17 @@ var TapTapMCPProxy = class {
|
|
|
43411
43808
|
);
|
|
43412
43809
|
req.resolve(result);
|
|
43413
43810
|
} catch (error2) {
|
|
43811
|
+
const toolErrorResult = convertMcpApplicationErrorToToolResult(error2);
|
|
43812
|
+
if (toolErrorResult) {
|
|
43813
|
+
req.resolve(toolErrorResult);
|
|
43814
|
+
continue;
|
|
43815
|
+
}
|
|
43816
|
+
if (this.isNetworkError(error2)) {
|
|
43817
|
+
this.connected = false;
|
|
43818
|
+
this.sessionValidated = false;
|
|
43819
|
+
this.pendingRequests.unshift(req);
|
|
43820
|
+
throw error2;
|
|
43821
|
+
}
|
|
43414
43822
|
req.reject(error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
43415
43823
|
}
|
|
43416
43824
|
}
|
|
@@ -43543,6 +43951,10 @@ var TapTapMCPProxy = class {
|
|
|
43543
43951
|
);
|
|
43544
43952
|
return result;
|
|
43545
43953
|
} catch (error2) {
|
|
43954
|
+
const toolErrorResult = convertMcpApplicationErrorToToolResult(error2);
|
|
43955
|
+
if (toolErrorResult) {
|
|
43956
|
+
return toolErrorResult;
|
|
43957
|
+
}
|
|
43546
43958
|
if (this.isNetworkError(error2)) {
|
|
43547
43959
|
this.log("error", "❌ Network error detected, marking connection as lost");
|
|
43548
43960
|
this.connected = false;
|