@taptap/maker 0.0.26-beta.2 → 0.0.26-beta.3
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 +651 -367
- 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.3".trim() ? "0.0.26-beta.3".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.3" : "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
|
}
|
|
@@ -37259,7 +37542,7 @@ function createServerClientRootsProvider(server) {
|
|
|
37259
37542
|
async function resolveMakerProjectContext(options = {}) {
|
|
37260
37543
|
if (options.targetDir) {
|
|
37261
37544
|
return {
|
|
37262
|
-
targetDir:
|
|
37545
|
+
targetDir: path18.resolve(options.targetDir),
|
|
37263
37546
|
source: "explicit_target_dir",
|
|
37264
37547
|
roots: { status: "not_requested", roots: [] }
|
|
37265
37548
|
};
|
|
@@ -37354,7 +37637,7 @@ function rootToLocalPath(root) {
|
|
|
37354
37637
|
if (url2.protocol !== "file:") {
|
|
37355
37638
|
return void 0;
|
|
37356
37639
|
}
|
|
37357
|
-
return
|
|
37640
|
+
return path18.resolve(fileURLToPath2(url2));
|
|
37358
37641
|
} catch {
|
|
37359
37642
|
return void 0;
|
|
37360
37643
|
}
|
|
@@ -37368,14 +37651,14 @@ function uniquePaths(values) {
|
|
|
37368
37651
|
continue;
|
|
37369
37652
|
}
|
|
37370
37653
|
seen.add(normalized);
|
|
37371
|
-
result.push(
|
|
37654
|
+
result.push(path18.resolve(value));
|
|
37372
37655
|
}
|
|
37373
37656
|
return result;
|
|
37374
37657
|
}
|
|
37375
37658
|
function normalizePathForCompare2(value) {
|
|
37376
|
-
const resolved =
|
|
37659
|
+
const resolved = path18.resolve(value);
|
|
37377
37660
|
try {
|
|
37378
|
-
return
|
|
37661
|
+
return fs17.realpathSync.native(resolved);
|
|
37379
37662
|
} catch {
|
|
37380
37663
|
return resolved;
|
|
37381
37664
|
}
|
|
@@ -37409,10 +37692,13 @@ function formatMakerClientRootsStatus(roots) {
|
|
|
37409
37692
|
}
|
|
37410
37693
|
return lines.join("\n");
|
|
37411
37694
|
}
|
|
37412
|
-
function splitRemoteProxyToolPrivateArgs(args) {
|
|
37695
|
+
function splitRemoteProxyToolPrivateArgs(args, toolName) {
|
|
37413
37696
|
const remoteArgs = { ...args };
|
|
37414
37697
|
const targetDir = remoteArgs.target_dir;
|
|
37415
37698
|
delete remoteArgs.target_dir;
|
|
37699
|
+
if (toolName === "generate_test_qrcode") {
|
|
37700
|
+
delete remoteArgs.confirmed_screen_orientation;
|
|
37701
|
+
}
|
|
37416
37702
|
if (targetDir === void 0) {
|
|
37417
37703
|
return { remoteArgs };
|
|
37418
37704
|
}
|
|
@@ -37524,14 +37810,14 @@ function formatStatusProjectList(projects) {
|
|
|
37524
37810
|
].filter((line) => line !== void 0).join("\n");
|
|
37525
37811
|
}
|
|
37526
37812
|
function formatClonePartialStateLines(targetDir) {
|
|
37527
|
-
const resolvedTargetDir =
|
|
37813
|
+
const resolvedTargetDir = path18.resolve(targetDir);
|
|
37528
37814
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
37529
37815
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
37530
37816
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
37531
|
-
const stagedDevKitGitignorePath =
|
|
37817
|
+
const stagedDevKitGitignorePath = path18.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
37532
37818
|
const projectBound = Boolean(identify.projectId);
|
|
37533
37819
|
const gitInitialized = Boolean(
|
|
37534
|
-
gitStatus.isOwnGitRoot ||
|
|
37820
|
+
gitStatus.isOwnGitRoot || fs17.existsSync(path18.join(resolvedTargetDir, ".git"))
|
|
37535
37821
|
);
|
|
37536
37822
|
const safeToRetry = !projectBound;
|
|
37537
37823
|
return [
|
|
@@ -37545,7 +37831,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
37545
37831
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
37546
37832
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
37547
37833
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
37548
|
-
`- staged_dev_kit_gitignore: ${
|
|
37834
|
+
`- staged_dev_kit_gitignore: ${fs17.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
37549
37835
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
37550
37836
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
37551
37837
|
].filter(Boolean);
|
|
@@ -37621,12 +37907,12 @@ function resolveEmbeddedProxyCommand(options) {
|
|
|
37621
37907
|
}
|
|
37622
37908
|
return {
|
|
37623
37909
|
command: process.execPath,
|
|
37624
|
-
args: [
|
|
37910
|
+
args: [path18.resolve(makerEntry), "__maker-proxy"]
|
|
37625
37911
|
};
|
|
37626
37912
|
}
|
|
37627
37913
|
function resolveBundledMakerEntry() {
|
|
37628
|
-
const bundledEntry =
|
|
37629
|
-
return
|
|
37914
|
+
const bundledEntry = path18.resolve(__dirname, "../../../bin/taptap-maker");
|
|
37915
|
+
return fs17.existsSync(bundledEntry) ? bundledEntry : void 0;
|
|
37630
37916
|
}
|
|
37631
37917
|
function isUsableEmbeddedMakerEntry(entry) {
|
|
37632
37918
|
if (!entry) {
|
|
@@ -37973,18 +38259,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
37973
38259
|
}
|
|
37974
38260
|
}
|
|
37975
38261
|
async function startRuntimeLogWatch(buildResult) {
|
|
37976
|
-
const runtimeDir =
|
|
37977
|
-
|
|
37978
|
-
const stdoutLog =
|
|
37979
|
-
const stderrLog =
|
|
37980
|
-
const pidFile =
|
|
38262
|
+
const runtimeDir = path18.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
38263
|
+
fs17.mkdirSync(runtimeDir, { recursive: true });
|
|
38264
|
+
const stdoutLog = path18.join(runtimeDir, "watcher.out.log");
|
|
38265
|
+
const stderrLog = path18.join(runtimeDir, "watcher.err.log");
|
|
38266
|
+
const pidFile = path18.join(runtimeDir, "watcher.pid");
|
|
37981
38267
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
37982
|
-
const outFd =
|
|
37983
|
-
const errFd =
|
|
38268
|
+
const outFd = fs17.openSync(stdoutLog, "a");
|
|
38269
|
+
const errFd = fs17.openSync(stderrLog, "a");
|
|
37984
38270
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
37985
38271
|
if (previous.previousStopError) {
|
|
37986
|
-
|
|
37987
|
-
|
|
38272
|
+
fs17.closeSync(outFd);
|
|
38273
|
+
fs17.closeSync(errFd);
|
|
37988
38274
|
return {
|
|
37989
38275
|
started: false,
|
|
37990
38276
|
command: command.text,
|
|
@@ -38047,18 +38333,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
38047
38333
|
...previous
|
|
38048
38334
|
};
|
|
38049
38335
|
} finally {
|
|
38050
|
-
|
|
38051
|
-
|
|
38336
|
+
fs17.closeSync(outFd);
|
|
38337
|
+
fs17.closeSync(errFd);
|
|
38052
38338
|
}
|
|
38053
38339
|
}
|
|
38054
38340
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
38055
|
-
if (!
|
|
38341
|
+
if (!fs17.existsSync(pidFile)) {
|
|
38056
38342
|
return {};
|
|
38057
38343
|
}
|
|
38058
38344
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
38059
38345
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
38060
38346
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
38061
|
-
|
|
38347
|
+
fs17.rmSync(pidFile, { force: true });
|
|
38062
38348
|
return {};
|
|
38063
38349
|
}
|
|
38064
38350
|
try {
|
|
@@ -38066,7 +38352,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
38066
38352
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
38067
38353
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
38068
38354
|
if (!verifiedCommand) {
|
|
38069
|
-
|
|
38355
|
+
fs17.rmSync(pidFile, { force: true });
|
|
38070
38356
|
return {
|
|
38071
38357
|
previousPid: pid,
|
|
38072
38358
|
previousStopped: false,
|
|
@@ -38076,7 +38362,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
38076
38362
|
process.kill(pid, "SIGTERM");
|
|
38077
38363
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
38078
38364
|
if (stopped) {
|
|
38079
|
-
|
|
38365
|
+
fs17.rmSync(pidFile, { force: true });
|
|
38080
38366
|
return { previousPid: pid, previousStopped: true };
|
|
38081
38367
|
}
|
|
38082
38368
|
return {
|
|
@@ -38085,7 +38371,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
38085
38371
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
38086
38372
|
};
|
|
38087
38373
|
} catch (error2) {
|
|
38088
|
-
|
|
38374
|
+
fs17.rmSync(pidFile, { force: true });
|
|
38089
38375
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
38090
38376
|
if (code === "ESRCH") {
|
|
38091
38377
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -38098,7 +38384,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
38098
38384
|
}
|
|
38099
38385
|
}
|
|
38100
38386
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
38101
|
-
const raw =
|
|
38387
|
+
const raw = fs17.readFileSync(pidFile, "utf8").trim();
|
|
38102
38388
|
if (!raw) {
|
|
38103
38389
|
return null;
|
|
38104
38390
|
}
|
|
@@ -38114,7 +38400,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
38114
38400
|
}
|
|
38115
38401
|
}
|
|
38116
38402
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
38117
|
-
|
|
38403
|
+
fs17.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
38118
38404
|
`, "utf8");
|
|
38119
38405
|
}
|
|
38120
38406
|
function getProcessCommand(pid) {
|
|
@@ -38200,10 +38486,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
38200
38486
|
};
|
|
38201
38487
|
}
|
|
38202
38488
|
function resolveMakerCliEntry() {
|
|
38203
|
-
return process.argv[1] ||
|
|
38489
|
+
return process.argv[1] || path18.resolve(process.cwd(), "dist", "maker.js");
|
|
38204
38490
|
}
|
|
38205
38491
|
function getRuntimeLogFilePath(projectRoot) {
|
|
38206
|
-
return
|
|
38492
|
+
return path18.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
38207
38493
|
}
|
|
38208
38494
|
async function refreshMakerPreview(buildResult) {
|
|
38209
38495
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -38337,7 +38623,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
38337
38623
|
if (options.scriptsPath) {
|
|
38338
38624
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
38339
38625
|
}
|
|
38340
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
38626
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs17.existsSync(path18.join(projectRoot, "scripts", "main.lua"))) {
|
|
38341
38627
|
buildArgs.entry = "main.lua";
|
|
38342
38628
|
buildArgs.scriptsPath = "scripts";
|
|
38343
38629
|
}
|
|
@@ -38349,8 +38635,6 @@ function createBuildArgs(projectRoot, options) {
|
|
|
38349
38635
|
}
|
|
38350
38636
|
if (options.multiplayer) {
|
|
38351
38637
|
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
38638
|
}
|
|
38355
38639
|
return buildArgs;
|
|
38356
38640
|
}
|
|
@@ -38530,11 +38814,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
38530
38814
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
38531
38815
|
`- watch_command: ${command}`,
|
|
38532
38816
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
38533
|
-
`- local_file: ${
|
|
38817
|
+
`- local_file: ${path18.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
38534
38818
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
38535
38819
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
38536
38820
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
38537
|
-
`- state_file: ${
|
|
38821
|
+
`- state_file: ${path18.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
38538
38822
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
38539
38823
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
38540
38824
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -38795,9 +39079,9 @@ function indent2(value) {
|
|
|
38795
39079
|
// src/maker/cli/commands.ts
|
|
38796
39080
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
38797
39081
|
import crypto3 from "node:crypto";
|
|
38798
|
-
import
|
|
39082
|
+
import fs18 from "node:fs";
|
|
38799
39083
|
import os4 from "node:os";
|
|
38800
|
-
import
|
|
39084
|
+
import path19 from "node:path";
|
|
38801
39085
|
import readline from "node:readline/promises";
|
|
38802
39086
|
import { stdin as input, stdout as output } from "node:process";
|
|
38803
39087
|
|
|
@@ -38943,7 +39227,7 @@ function formatError2(error2) {
|
|
|
38943
39227
|
}
|
|
38944
39228
|
|
|
38945
39229
|
// src/maker/cli/commands.ts
|
|
38946
|
-
var VERSION2 = true ? "0.0.26-beta.
|
|
39230
|
+
var VERSION2 = true ? "0.0.26-beta.3" : "dev";
|
|
38947
39231
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
38948
39232
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
38949
39233
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
@@ -39078,7 +39362,7 @@ function toOptionKey(value) {
|
|
|
39078
39362
|
}
|
|
39079
39363
|
async function runInit(parsed, ctx) {
|
|
39080
39364
|
rejectPackageOption(parsed);
|
|
39081
|
-
const targetDir =
|
|
39365
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39082
39366
|
const env = makerEnvOption(parsed);
|
|
39083
39367
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
39084
39368
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -39171,7 +39455,7 @@ async function runInit(parsed, ctx) {
|
|
|
39171
39455
|
}
|
|
39172
39456
|
async function runDoctor(parsed, ctx) {
|
|
39173
39457
|
var _a3, _b;
|
|
39174
|
-
const targetDir =
|
|
39458
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39175
39459
|
const env = makerEnvOption(parsed);
|
|
39176
39460
|
const git = checkGitEnvironment();
|
|
39177
39461
|
const python = checkMakerPythonEnvironment();
|
|
@@ -39265,9 +39549,9 @@ async function runDoctor(parsed, ctx) {
|
|
|
39265
39549
|
);
|
|
39266
39550
|
}
|
|
39267
39551
|
function inspectMakerMcpToolsAvailability(options) {
|
|
39268
|
-
const aiPwd =
|
|
39552
|
+
const aiPwd = path19.resolve(process.cwd());
|
|
39269
39553
|
const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
|
|
39270
|
-
const makerProjectDir = options.makerProjectDir ?
|
|
39554
|
+
const makerProjectDir = options.makerProjectDir ? path19.resolve(options.makerProjectDir) : void 0;
|
|
39271
39555
|
if (!makerProjectDir) {
|
|
39272
39556
|
return {
|
|
39273
39557
|
tools_visibility: "refresh_ai_client_if_missing",
|
|
@@ -39309,9 +39593,9 @@ function samePath2(left, right) {
|
|
|
39309
39593
|
return normalizePathForCompare3(left) === normalizePathForCompare3(right);
|
|
39310
39594
|
}
|
|
39311
39595
|
function normalizePathForCompare3(value) {
|
|
39312
|
-
const resolved =
|
|
39596
|
+
const resolved = path19.resolve(value);
|
|
39313
39597
|
try {
|
|
39314
|
-
return
|
|
39598
|
+
return fs18.realpathSync.native(resolved);
|
|
39315
39599
|
} catch {
|
|
39316
39600
|
return resolved;
|
|
39317
39601
|
}
|
|
@@ -39629,7 +39913,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
39629
39913
|
}
|
|
39630
39914
|
async function resolvePatSet(parsed, ctx) {
|
|
39631
39915
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
39632
|
-
const pat =
|
|
39916
|
+
const pat = fs18.readFileSync(0, "utf8").trim();
|
|
39633
39917
|
if (!pat) {
|
|
39634
39918
|
throw new Error("No PAT found on stdin.");
|
|
39635
39919
|
}
|
|
@@ -39659,7 +39943,7 @@ async function runMcpInstall(parsed, ctx) {
|
|
|
39659
39943
|
env: makerEnvOption(parsed),
|
|
39660
39944
|
pkg: MAKER_NPM_PACKAGE,
|
|
39661
39945
|
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
39662
|
-
cwd: explicitTargetDir ?
|
|
39946
|
+
cwd: explicitTargetDir ? path19.resolve(explicitTargetDir) : void 0
|
|
39663
39947
|
});
|
|
39664
39948
|
if (ctx.json) {
|
|
39665
39949
|
writeJson(results);
|
|
@@ -39718,7 +40002,7 @@ ${indent3(payload.stderr)}` : "",
|
|
|
39718
40002
|
);
|
|
39719
40003
|
}
|
|
39720
40004
|
async function runAgentsUpdate(parsed, ctx) {
|
|
39721
|
-
const targetDir =
|
|
40005
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39722
40006
|
const result = updateMakerAgentsPolicy(targetDir);
|
|
39723
40007
|
if (ctx.json) {
|
|
39724
40008
|
writeJson(result);
|
|
@@ -39737,7 +40021,7 @@ async function runAgentsUpdate(parsed, ctx) {
|
|
|
39737
40021
|
async function runUpgrade(parsed, ctx) {
|
|
39738
40022
|
rejectPackageOption(parsed);
|
|
39739
40023
|
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
39740
|
-
const targetDir =
|
|
40024
|
+
const targetDir = path19.resolve(explicitTargetDir || process.cwd());
|
|
39741
40025
|
const env = makerEnvOption(parsed);
|
|
39742
40026
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
39743
40027
|
const installResults = installMcpConfigs({
|
|
@@ -39822,7 +40106,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
39822
40106
|
];
|
|
39823
40107
|
}
|
|
39824
40108
|
async function runDevKitUpdate(parsed, ctx) {
|
|
39825
|
-
const targetDir =
|
|
40109
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39826
40110
|
const result = await installAiDevKit({
|
|
39827
40111
|
targetDir,
|
|
39828
40112
|
preserveExisting: false,
|
|
@@ -39834,7 +40118,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
39834
40118
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
39835
40119
|
}
|
|
39836
40120
|
async function runLogsWatch(parsed, ctx) {
|
|
39837
|
-
const targetDir =
|
|
40121
|
+
const targetDir = path19.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
39838
40122
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
39839
40123
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
39840
40124
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -39844,9 +40128,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
39844
40128
|
serverUrl: stringOption(parsed, "server_url"),
|
|
39845
40129
|
env: makerEnvOption(parsed)
|
|
39846
40130
|
});
|
|
39847
|
-
const runtimeDir =
|
|
39848
|
-
const runtimeLog =
|
|
39849
|
-
const pidFile =
|
|
40131
|
+
const runtimeDir = path19.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
40132
|
+
const runtimeLog = path19.join(runtimeDir, "runtime.log");
|
|
40133
|
+
const pidFile = path19.join(runtimeDir, "watcher.pid");
|
|
39850
40134
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
39851
40135
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
39852
40136
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -39891,10 +40175,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
39891
40175
|
}
|
|
39892
40176
|
}
|
|
39893
40177
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
39894
|
-
|
|
40178
|
+
fs18.mkdirSync(path19.dirname(pidFile), { recursive: true });
|
|
39895
40179
|
const existingPid = readPidFile(pidFile);
|
|
39896
40180
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
39897
|
-
|
|
40181
|
+
fs18.writeFileSync(
|
|
39898
40182
|
pidFile,
|
|
39899
40183
|
`${JSON.stringify(
|
|
39900
40184
|
{
|
|
@@ -39912,10 +40196,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
39912
40196
|
return previous;
|
|
39913
40197
|
}
|
|
39914
40198
|
function readPidFile(pidFile) {
|
|
39915
|
-
if (!
|
|
40199
|
+
if (!fs18.existsSync(pidFile)) {
|
|
39916
40200
|
return void 0;
|
|
39917
40201
|
}
|
|
39918
|
-
const raw =
|
|
40202
|
+
const raw = fs18.readFileSync(pidFile, "utf8").trim();
|
|
39919
40203
|
let pid = Number(raw);
|
|
39920
40204
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
39921
40205
|
try {
|
|
@@ -39935,7 +40219,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
39935
40219
|
}
|
|
39936
40220
|
cleaned = true;
|
|
39937
40221
|
if (readPidFile(pidFile) === process.pid) {
|
|
39938
|
-
|
|
40222
|
+
fs18.rmSync(pidFile, { force: true });
|
|
39939
40223
|
}
|
|
39940
40224
|
};
|
|
39941
40225
|
process.once("exit", cleanup);
|
|
@@ -40086,7 +40370,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
40086
40370
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
40087
40371
|
});
|
|
40088
40372
|
writeDevKitStagedGitignore(
|
|
40089
|
-
|
|
40373
|
+
path19.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
40090
40374
|
listPresentDevKitManagedEntries(targetDir)
|
|
40091
40375
|
);
|
|
40092
40376
|
if (options.finalizeGitignore) {
|
|
@@ -40103,7 +40387,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
40103
40387
|
);
|
|
40104
40388
|
} catch (error2) {
|
|
40105
40389
|
writeDevKitStagedGitignore(
|
|
40106
|
-
|
|
40390
|
+
path19.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
40107
40391
|
listPresentDevKitManagedEntries(targetDir)
|
|
40108
40392
|
);
|
|
40109
40393
|
if (options.finalizeGitignore) {
|
|
@@ -40193,12 +40477,12 @@ function installMcpConfig(ide, options) {
|
|
|
40193
40477
|
}
|
|
40194
40478
|
function installMcpConfigUnsafe(ide, options) {
|
|
40195
40479
|
if (ide === "codex") {
|
|
40196
|
-
const configPath =
|
|
40480
|
+
const configPath = path19.join(os4.homedir(), ".codex", "config.toml");
|
|
40197
40481
|
const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
|
|
40198
40482
|
return [createMcpInstallResult(ide, "Codex", configPath, write)];
|
|
40199
40483
|
}
|
|
40200
40484
|
if (ide === "cursor") {
|
|
40201
|
-
const configPath =
|
|
40485
|
+
const configPath = path19.join(os4.homedir(), ".cursor", "mcp.json");
|
|
40202
40486
|
const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
|
|
40203
40487
|
return [createMcpInstallResult(ide, "Cursor", configPath, write)];
|
|
40204
40488
|
}
|
|
@@ -40216,7 +40500,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
40216
40500
|
];
|
|
40217
40501
|
}
|
|
40218
40502
|
}
|
|
40219
|
-
const configPath =
|
|
40503
|
+
const configPath = path19.join(os4.homedir(), ".claude.json");
|
|
40220
40504
|
const write = mergeJsonMcpConfig(configPath, claudeOptions);
|
|
40221
40505
|
return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
|
|
40222
40506
|
}
|
|
@@ -40230,7 +40514,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
40230
40514
|
}
|
|
40231
40515
|
if (ide === "opencode") {
|
|
40232
40516
|
const configPath = getOpenCodeMcpConfigPath();
|
|
40233
|
-
if (!
|
|
40517
|
+
if (!fs18.existsSync(configPath)) {
|
|
40234
40518
|
return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
|
|
40235
40519
|
}
|
|
40236
40520
|
const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
|
|
@@ -40298,7 +40582,7 @@ function getDefaultMcpInstallIdes() {
|
|
|
40298
40582
|
if (getTraeMcpInstallPaths().length > 0) {
|
|
40299
40583
|
ides.push("trae");
|
|
40300
40584
|
}
|
|
40301
|
-
if (
|
|
40585
|
+
if (fs18.existsSync(getOpenCodeMcpConfigPath())) {
|
|
40302
40586
|
ides.push("opencode");
|
|
40303
40587
|
}
|
|
40304
40588
|
if (getWorkBuddyMcpInstallPaths().length > 0) {
|
|
@@ -40315,7 +40599,7 @@ function getExistingTraeUserConfigPaths(paths) {
|
|
|
40315
40599
|
const seen = /* @__PURE__ */ new Set();
|
|
40316
40600
|
return paths.filter((configPath) => {
|
|
40317
40601
|
const key = normalizeConfigPathKey(configPath);
|
|
40318
|
-
if (seen.has(key) || !
|
|
40602
|
+
if (seen.has(key) || !fs18.existsSync(path19.dirname(configPath))) {
|
|
40319
40603
|
return false;
|
|
40320
40604
|
}
|
|
40321
40605
|
seen.add(key);
|
|
@@ -40326,7 +40610,7 @@ function getExistingConfigPaths(paths) {
|
|
|
40326
40610
|
const seen = /* @__PURE__ */ new Set();
|
|
40327
40611
|
return paths.filter((configPath) => {
|
|
40328
40612
|
const key = normalizeConfigPathKey(configPath);
|
|
40329
|
-
if (seen.has(key) || !
|
|
40613
|
+
if (seen.has(key) || !fs18.existsSync(configPath)) {
|
|
40330
40614
|
return false;
|
|
40331
40615
|
}
|
|
40332
40616
|
seen.add(key);
|
|
@@ -40334,65 +40618,65 @@ function getExistingConfigPaths(paths) {
|
|
|
40334
40618
|
});
|
|
40335
40619
|
}
|
|
40336
40620
|
function normalizeConfigPathKey(configPath) {
|
|
40337
|
-
const resolved =
|
|
40621
|
+
const resolved = path19.resolve(configPath);
|
|
40338
40622
|
return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
|
|
40339
40623
|
}
|
|
40340
40624
|
function getTraeSoloMcpConfigPaths() {
|
|
40341
40625
|
if (process.platform === "win32") {
|
|
40342
|
-
const roaming = process.env.APPDATA ||
|
|
40626
|
+
const roaming = process.env.APPDATA || path19.join(os4.homedir(), "AppData", "Roaming");
|
|
40343
40627
|
return [
|
|
40344
|
-
|
|
40345
|
-
|
|
40628
|
+
path19.join(roaming, "TRAE SOLO", "User", "mcp.json"),
|
|
40629
|
+
path19.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
|
|
40346
40630
|
];
|
|
40347
40631
|
}
|
|
40348
|
-
const appSupport =
|
|
40632
|
+
const appSupport = path19.join(os4.homedir(), "Library", "Application Support");
|
|
40349
40633
|
return [
|
|
40350
|
-
|
|
40351
|
-
|
|
40634
|
+
path19.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
|
|
40635
|
+
path19.join(appSupport, "TRAE SOLO", "User", "mcp.json")
|
|
40352
40636
|
];
|
|
40353
40637
|
}
|
|
40354
40638
|
function getTraeUnverifiedMcpConfigPaths() {
|
|
40355
40639
|
if (process.platform === "win32") {
|
|
40356
|
-
const roaming = process.env.APPDATA ||
|
|
40640
|
+
const roaming = process.env.APPDATA || path19.join(os4.homedir(), "AppData", "Roaming");
|
|
40357
40641
|
return [
|
|
40358
|
-
|
|
40359
|
-
|
|
40360
|
-
|
|
40642
|
+
path19.join(roaming, "Trae", "User", "mcp.json"),
|
|
40643
|
+
path19.join(roaming, "TRAE", "User", "mcp.json"),
|
|
40644
|
+
path19.join(roaming, "Trae CN", "User", "mcp.json")
|
|
40361
40645
|
];
|
|
40362
40646
|
}
|
|
40363
|
-
const appSupport =
|
|
40647
|
+
const appSupport = path19.join(os4.homedir(), "Library", "Application Support");
|
|
40364
40648
|
return [
|
|
40365
|
-
|
|
40366
|
-
|
|
40367
|
-
|
|
40649
|
+
path19.join(appSupport, "Trae", "User", "mcp.json"),
|
|
40650
|
+
path19.join(appSupport, "TRAE", "User", "mcp.json"),
|
|
40651
|
+
path19.join(appSupport, "Trae CN", "User", "mcp.json")
|
|
40368
40652
|
];
|
|
40369
40653
|
}
|
|
40370
40654
|
function getOpenCodeMcpConfigPath() {
|
|
40371
|
-
return
|
|
40655
|
+
return path19.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
40372
40656
|
}
|
|
40373
40657
|
function getWorkBuddyHome() {
|
|
40374
|
-
return
|
|
40658
|
+
return path19.join(os4.homedir(), ".workbuddy");
|
|
40375
40659
|
}
|
|
40376
40660
|
function shouldShowWorkBuddyTrustInspection() {
|
|
40377
|
-
return
|
|
40661
|
+
return fs18.existsSync(getWorkBuddyHome());
|
|
40378
40662
|
}
|
|
40379
40663
|
function getWorkBuddyMcpInstallPaths(options = {}) {
|
|
40380
|
-
const primary =
|
|
40381
|
-
if (
|
|
40664
|
+
const primary = path19.join(getWorkBuddyHome(), "mcp.json");
|
|
40665
|
+
if (fs18.existsSync(primary) || options.createPrimary) {
|
|
40382
40666
|
return [primary];
|
|
40383
40667
|
}
|
|
40384
|
-
const legacy =
|
|
40385
|
-
if (
|
|
40668
|
+
const legacy = path19.join(getWorkBuddyHome(), ".mcp.json");
|
|
40669
|
+
if (fs18.existsSync(legacy)) {
|
|
40386
40670
|
return [legacy];
|
|
40387
40671
|
}
|
|
40388
40672
|
return [];
|
|
40389
40673
|
}
|
|
40390
40674
|
function inspectWorkBuddyTrustState(mcpName) {
|
|
40391
40675
|
const workbuddyHome = getWorkBuddyHome();
|
|
40392
|
-
const connectorsDir =
|
|
40676
|
+
const connectorsDir = path19.join(workbuddyHome, "connectors");
|
|
40393
40677
|
const accounts = [];
|
|
40394
40678
|
const stateFiles = [];
|
|
40395
|
-
if (!
|
|
40679
|
+
if (!fs18.existsSync(connectorsDir)) {
|
|
40396
40680
|
return {
|
|
40397
40681
|
status: "not_found",
|
|
40398
40682
|
mcp_name: mcpName,
|
|
@@ -40402,12 +40686,12 @@ function inspectWorkBuddyTrustState(mcpName) {
|
|
|
40402
40686
|
accounts
|
|
40403
40687
|
};
|
|
40404
40688
|
}
|
|
40405
|
-
for (const entry of
|
|
40689
|
+
for (const entry of fs18.readdirSync(connectorsDir, { withFileTypes: true })) {
|
|
40406
40690
|
if (!entry.isDirectory()) {
|
|
40407
40691
|
continue;
|
|
40408
40692
|
}
|
|
40409
|
-
const statePath =
|
|
40410
|
-
if (!
|
|
40693
|
+
const statePath = path19.join(connectorsDir, entry.name, "connector-states.json");
|
|
40694
|
+
if (!fs18.existsSync(statePath)) {
|
|
40411
40695
|
continue;
|
|
40412
40696
|
}
|
|
40413
40697
|
stateFiles.push(statePath);
|
|
@@ -40482,7 +40766,7 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
40482
40766
|
);
|
|
40483
40767
|
}
|
|
40484
40768
|
function mergeOpenCodeMcpConfig(configPath, options) {
|
|
40485
|
-
const rawContent =
|
|
40769
|
+
const rawContent = fs18.readFileSync(configPath, "utf8");
|
|
40486
40770
|
const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
|
|
40487
40771
|
const existing = readJsonObject(configPath, { jsonc: true });
|
|
40488
40772
|
const mcp = asObject(existing.mcp);
|
|
@@ -40509,7 +40793,7 @@ function mergeOpenCodeMcpConfig(configPath, options) {
|
|
|
40509
40793
|
return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
|
|
40510
40794
|
}
|
|
40511
40795
|
function mergeCodexMcpConfig(configPath, options) {
|
|
40512
|
-
const existing =
|
|
40796
|
+
const existing = fs18.existsSync(configPath) ? fs18.readFileSync(configPath, "utf8") : "";
|
|
40513
40797
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
40514
40798
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
40515
40799
|
const launch = getNpxCliCommand(options.pkg);
|
|
@@ -40679,10 +40963,10 @@ function rejectPackageOption(parsed) {
|
|
|
40679
40963
|
}
|
|
40680
40964
|
}
|
|
40681
40965
|
function readJsonObject(filePath, options = {}) {
|
|
40682
|
-
if (!
|
|
40966
|
+
if (!fs18.existsSync(filePath)) {
|
|
40683
40967
|
return {};
|
|
40684
40968
|
}
|
|
40685
|
-
const raw =
|
|
40969
|
+
const raw = fs18.readFileSync(filePath, "utf8");
|
|
40686
40970
|
try {
|
|
40687
40971
|
const normalized = normalizeJsonConfigContent(raw, options);
|
|
40688
40972
|
const parsed = JSON.parse(normalized);
|
|
@@ -40702,25 +40986,25 @@ function asObject(value) {
|
|
|
40702
40986
|
return {};
|
|
40703
40987
|
}
|
|
40704
40988
|
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
40705
|
-
const existed =
|
|
40706
|
-
const previousContent = existed ?
|
|
40989
|
+
const existed = fs18.existsSync(filePath);
|
|
40990
|
+
const previousContent = existed ? fs18.readFileSync(filePath, "utf8") : void 0;
|
|
40707
40991
|
if (previousContent === nextContent) {
|
|
40708
40992
|
return { changed: false };
|
|
40709
40993
|
}
|
|
40710
40994
|
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
40711
|
-
|
|
40995
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
40712
40996
|
if (previousContent !== void 0 && backupPath) {
|
|
40713
|
-
|
|
40997
|
+
fs18.writeFileSync(backupPath, previousContent, "utf8");
|
|
40714
40998
|
}
|
|
40715
40999
|
try {
|
|
40716
|
-
|
|
40717
|
-
validate == null ? void 0 : validate(
|
|
41000
|
+
fs18.writeFileSync(filePath, nextContent, "utf8");
|
|
41001
|
+
validate == null ? void 0 : validate(fs18.readFileSync(filePath, "utf8"));
|
|
40718
41002
|
return { changed: true, backupPath };
|
|
40719
41003
|
} catch (error2) {
|
|
40720
41004
|
if (previousContent !== void 0) {
|
|
40721
|
-
|
|
41005
|
+
fs18.writeFileSync(filePath, previousContent, "utf8");
|
|
40722
41006
|
} else {
|
|
40723
|
-
|
|
41007
|
+
fs18.rmSync(filePath, { force: true });
|
|
40724
41008
|
}
|
|
40725
41009
|
throw error2;
|
|
40726
41010
|
}
|
|
@@ -40867,10 +41151,10 @@ function formatMcpInstallMessage(label, configPath, write) {
|
|
|
40867
41151
|
].filter(Boolean).join("\n");
|
|
40868
41152
|
}
|
|
40869
41153
|
function saveInitState(targetDir, state) {
|
|
40870
|
-
|
|
40871
|
-
const key = crypto3.createHash("sha256").update(
|
|
40872
|
-
|
|
40873
|
-
|
|
41154
|
+
fs18.mkdirSync(getMakerHome(), { recursive: true });
|
|
41155
|
+
const key = crypto3.createHash("sha256").update(path19.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
41156
|
+
fs18.writeFileSync(
|
|
41157
|
+
path19.join(getMakerHome(), `init-state-${key}.json`),
|
|
40874
41158
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
40875
41159
|
`,
|
|
40876
41160
|
"utf8"
|
|
@@ -41018,7 +41302,7 @@ function makerEnvOption(parsed) {
|
|
|
41018
41302
|
return env;
|
|
41019
41303
|
}
|
|
41020
41304
|
const targetDir = stringOption(parsed, "target_dir");
|
|
41021
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
41305
|
+
return getMakerEnvironment(void 0, targetDir ? path19.resolve(targetDir) : process.cwd());
|
|
41022
41306
|
}
|
|
41023
41307
|
function mcpVerifyModeOption(parsed) {
|
|
41024
41308
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -42520,7 +42804,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
42520
42804
|
};
|
|
42521
42805
|
|
|
42522
42806
|
// src/mcp-proxy/proxy.ts
|
|
42523
|
-
import * as
|
|
42807
|
+
import * as path21 from "node:path";
|
|
42524
42808
|
import * as crypto6 from "node:crypto";
|
|
42525
42809
|
|
|
42526
42810
|
// src/mcp-proxy/cookieJar.ts
|
|
@@ -42702,8 +42986,8 @@ function createCookieFetch(cookieJar) {
|
|
|
42702
42986
|
}
|
|
42703
42987
|
|
|
42704
42988
|
// src/core/utils/logWriter.ts
|
|
42705
|
-
import * as
|
|
42706
|
-
import * as
|
|
42989
|
+
import * as fs19 from "node:fs";
|
|
42990
|
+
import * as path20 from "node:path";
|
|
42707
42991
|
import * as crypto5 from "node:crypto";
|
|
42708
42992
|
|
|
42709
42993
|
// src/core/types/log.ts
|
|
@@ -42744,7 +43028,7 @@ var LogWriter = class {
|
|
|
42744
43028
|
return;
|
|
42745
43029
|
}
|
|
42746
43030
|
try {
|
|
42747
|
-
await
|
|
43031
|
+
await fs19.promises.mkdir(this.config.logDir, { recursive: true });
|
|
42748
43032
|
await this.cleanupOldLogs();
|
|
42749
43033
|
this.initialized = true;
|
|
42750
43034
|
} catch (error2) {
|
|
@@ -42767,7 +43051,7 @@ var LogWriter = class {
|
|
|
42767
43051
|
*/
|
|
42768
43052
|
getLogFilePath(date5) {
|
|
42769
43053
|
const d = date5 || this.getCurrentDate();
|
|
42770
|
-
return
|
|
43054
|
+
return path20.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
42771
43055
|
}
|
|
42772
43056
|
/**
|
|
42773
43057
|
* 获取或创建写入流
|
|
@@ -42782,7 +43066,7 @@ var LogWriter = class {
|
|
|
42782
43066
|
}
|
|
42783
43067
|
this.currentDate = date5;
|
|
42784
43068
|
try {
|
|
42785
|
-
this.writeStream =
|
|
43069
|
+
this.writeStream = fs19.createWriteStream(this.getLogFilePath(date5), {
|
|
42786
43070
|
flags: "a",
|
|
42787
43071
|
encoding: "utf8"
|
|
42788
43072
|
});
|
|
@@ -42834,11 +43118,11 @@ var LogWriter = class {
|
|
|
42834
43118
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
42835
43119
|
try {
|
|
42836
43120
|
const filePath = this.getLogFilePath();
|
|
42837
|
-
const dir =
|
|
42838
|
-
if (!
|
|
42839
|
-
|
|
43121
|
+
const dir = path20.dirname(filePath);
|
|
43122
|
+
if (!fs19.existsSync(dir)) {
|
|
43123
|
+
fs19.mkdirSync(dir, { recursive: true });
|
|
42840
43124
|
}
|
|
42841
|
-
|
|
43125
|
+
fs19.appendFileSync(filePath, message, "utf8");
|
|
42842
43126
|
} catch {
|
|
42843
43127
|
}
|
|
42844
43128
|
}
|
|
@@ -42849,7 +43133,7 @@ var LogWriter = class {
|
|
|
42849
43133
|
async cleanupOldLogs() {
|
|
42850
43134
|
if (this.config.maxDays <= 0) return;
|
|
42851
43135
|
try {
|
|
42852
|
-
const files = await
|
|
43136
|
+
const files = await fs19.promises.readdir(this.config.logDir);
|
|
42853
43137
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
42854
43138
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
42855
43139
|
const prefix = this.config.prefix;
|
|
@@ -42864,7 +43148,7 @@ var LogWriter = class {
|
|
|
42864
43148
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
42865
43149
|
const fileDate = new Date(year, month - 1, day);
|
|
42866
43150
|
if (fileDate < cutoffDate) {
|
|
42867
|
-
await
|
|
43151
|
+
await fs19.promises.unlink(path20.join(this.config.logDir, file2));
|
|
42868
43152
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
42869
43153
|
`);
|
|
42870
43154
|
}
|
|
@@ -42938,10 +43222,10 @@ var TapTapMCPProxy = class {
|
|
|
42938
43222
|
const { user_id, project_id } = this.config.tenant;
|
|
42939
43223
|
let logDir;
|
|
42940
43224
|
if (user_id && project_id) {
|
|
42941
|
-
logDir =
|
|
43225
|
+
logDir = path21.join(logRoot, "proxy", user_id, project_id);
|
|
42942
43226
|
} else {
|
|
42943
43227
|
const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
42944
|
-
logDir =
|
|
43228
|
+
logDir = path21.join(logRoot, "proxy", kidHash);
|
|
42945
43229
|
}
|
|
42946
43230
|
return new LogWriter({
|
|
42947
43231
|
logDir,
|