@taptap/maker 0.0.23 → 0.0.24-beta.2
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 +615 -228
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +21 -2
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(path20) {
|
|
3237
|
+
let input2 = path20;
|
|
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 [path20, query] = wsComponent.resourceName.split("?");
|
|
3437
|
+
wsComponent.path = path20 && path20 !== "/" ? path20 : 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, fs18, 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, fs18[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 fs18 = __require("fs");
|
|
12513
|
+
function checkPathExt(path20, 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 && path20.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, path20, options) {
|
|
12531
12531
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12532
12532
|
return false;
|
|
12533
12533
|
}
|
|
12534
|
-
return checkPathExt(
|
|
12534
|
+
return checkPathExt(path20, options);
|
|
12535
12535
|
}
|
|
12536
|
-
function isexe(
|
|
12537
|
-
|
|
12538
|
-
cb(er, er ? false : checkStat(stat,
|
|
12536
|
+
function isexe(path20, options, cb) {
|
|
12537
|
+
fs18.stat(path20, function(er, stat) {
|
|
12538
|
+
cb(er, er ? false : checkStat(stat, path20, options));
|
|
12539
12539
|
});
|
|
12540
12540
|
}
|
|
12541
|
-
function sync(
|
|
12542
|
-
return checkStat(
|
|
12541
|
+
function sync(path20, options) {
|
|
12542
|
+
return checkStat(fs18.statSync(path20), path20, 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 fs18 = __require("fs");
|
|
12553
|
+
function isexe(path20, options, cb) {
|
|
12554
|
+
fs18.stat(path20, 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(path20, options) {
|
|
12559
|
+
return checkStat(fs18.statSync(path20), 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 fs18 = __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(path20, 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(path20, 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(path20, 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(path20, options) {
|
|
12622
12622
|
try {
|
|
12623
|
-
return core.sync(
|
|
12623
|
+
return core.sync(path20, 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 path20 = __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 = path20.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 = path20.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 path20 = __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 ? path20.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 = path20.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 [path20, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12834
|
+
const binary = path20.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 fs18 = __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 = fs18.openSync(command, "r");
|
|
12855
|
+
fs18.readSync(fd, buffer, 0, size, 0);
|
|
12856
|
+
fs18.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 path20 = __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 = path20.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 fs15 from "node:fs";
|
|
13007
|
+
import path16 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: path20, errorMaps, issueData } = params;
|
|
13370
|
+
const fullPath = [...path20, ...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, path20, key) {
|
|
13486
13486
|
this._cachedPath = [];
|
|
13487
13487
|
this.parent = parent;
|
|
13488
13488
|
this.data = value;
|
|
13489
|
-
this._path =
|
|
13489
|
+
this._path = path20;
|
|
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, path20) {
|
|
17139
|
+
if (!path20)
|
|
17140
17140
|
return obj;
|
|
17141
|
-
return
|
|
17141
|
+
return path20.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(path20, 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(path20);
|
|
17531
17531
|
return iss;
|
|
17532
17532
|
});
|
|
17533
17533
|
}
|
|
@@ -29241,8 +29241,46 @@ function createMakerAgentsPolicyBody() {
|
|
|
29241
29241
|
return [
|
|
29242
29242
|
"# TapTap Maker Project Asset Tool Policy",
|
|
29243
29243
|
"",
|
|
29244
|
-
"This is a bound TapTap Maker project.
|
|
29245
|
-
"
|
|
29244
|
+
"This is a bound TapTap Maker project.",
|
|
29245
|
+
"",
|
|
29246
|
+
"Maker build workflow:",
|
|
29247
|
+
"",
|
|
29248
|
+
"- For user requests such as 构建, build, 预览, 跑一下, 查看结果, 看看效果, 验证游戏效果,",
|
|
29249
|
+
" 提交, 提交代码, 推送, or push, call `maker_build_current_directory`.",
|
|
29250
|
+
"- Do not tell the user to open the Maker web page and click a build button as the default flow.",
|
|
29251
|
+
"- Do not use generic Git commit, push, branch, PR, or MR workflows for Maker submit/build",
|
|
29252
|
+
" requests. Follow the result returned by `maker_build_current_directory`.",
|
|
29253
|
+
"",
|
|
29254
|
+
"Generic code checks such as 验证代码, 跑测试, lint, or 检查实现 should not trigger a Maker",
|
|
29255
|
+
"remote build unless the user explicitly asks to build, run, or preview the Maker game.",
|
|
29256
|
+
"",
|
|
29257
|
+
"Maker ad workflow:",
|
|
29258
|
+
"",
|
|
29259
|
+
"- For any ad-related request or code touching ads, first call `get_ad_config` before reading",
|
|
29260
|
+
" local SDK docs, editing ad code, or testing ad behavior. Triggers include 广告, 激励视频,",
|
|
29261
|
+
" 播放广告, ad ID, ad placement, ad status, ad config, and `ShowRewardVideoAd`.",
|
|
29262
|
+
"- Treat `get_ad_config` as the source of truth for current project ad activation status and",
|
|
29263
|
+
" ad config. Do not infer ad readiness from local SDK docs, `.maker-mcp/config.json`, or",
|
|
29264
|
+
" runtime callbacks.",
|
|
29265
|
+
"- If `.project/project.json` is missing, build once with `maker_build_current_directory` to",
|
|
29266
|
+
" initialize the project, then call `get_ad_config` again. Implement or test ad code only",
|
|
29267
|
+
" after the config is available.",
|
|
29268
|
+
"- If `get_ad_config` reports missing `app_id` or `developer_id`, call",
|
|
29269
|
+
" `generate_test_qrcode` once to generate test QR code metadata, then call `get_ad_config`",
|
|
29270
|
+
" again. Do not use publish-only tools for this recovery path.",
|
|
29271
|
+
"",
|
|
29272
|
+
"Maker feedback workflow:",
|
|
29273
|
+
"",
|
|
29274
|
+
"- For user requests about online player feedback, problem reports, issue reports, debug",
|
|
29275
|
+
" feedback, real-device logs, screenshots, 问题反馈, 问题上报, 真机日志, or 玩家反馈, call",
|
|
29276
|
+
" the Maker proxy `get_debug_feedbacks` tool when it is available.",
|
|
29277
|
+
"- Use local runtime log files only for the current local build/runtime session. Do not use",
|
|
29278
|
+
" local logs as a substitute for remote player-submitted feedback.",
|
|
29279
|
+
"- Follow the remote tool schema and return the feedback records, logs, screenshots, and",
|
|
29280
|
+
" full error payloads as provided by the remote Maker MCP server.",
|
|
29281
|
+
"",
|
|
29282
|
+
"For game asset generation or editing in this project, the local AI/Agent should prefer",
|
|
29283
|
+
"Maker MCP proxy tools when they are available:",
|
|
29246
29284
|
"",
|
|
29247
29285
|
"- `generate_image` for one image asset.",
|
|
29248
29286
|
"- `batch_generate_images` for multiple image assets.",
|
|
@@ -32303,13 +32341,19 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
32303
32341
|
"- Do not create branches, task branches, PR/MR, or generic git commit/push flows.",
|
|
32304
32342
|
"- Use maker_build_current_directory for submit, push, and build.",
|
|
32305
32343
|
"",
|
|
32306
|
-
"Maker
|
|
32344
|
+
"Maker proxy tool policy",
|
|
32307
32345
|
`- entry: ${MAKER_LOCAL_SKILL_NAME} > Maker Creative Asset Tool Policy`,
|
|
32308
32346
|
"- Prefer Maker MCP proxy tools over native AI image/video/audio tools for bound Maker projects.",
|
|
32309
32347
|
"- If Maker proxy tools are missing, explain the session/configuration issue and available alternatives.",
|
|
32310
32348
|
"- Use generate_image, batch_generate_images, edit_image for game image assets.",
|
|
32311
32349
|
"- Use create_video_task, query_video_task, and text_to_music for game video/audio assets.",
|
|
32312
32350
|
"- Use create_3d_model_task and query_3d_model_task for game 3D model assets.",
|
|
32351
|
+
"- For any ad-related request, call get_ad_config first to get ad activation status and ad config.",
|
|
32352
|
+
"- Do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks.",
|
|
32353
|
+
"- If .project/project.json is missing, build once with maker_build_current_directory, then call get_ad_config again.",
|
|
32354
|
+
"- If get_ad_config reports missing app_id or developer_id, call generate_test_qrcode once, then call get_ad_config again.",
|
|
32355
|
+
"- For online player feedback, issue reports, real-device logs, or screenshots, call get_debug_feedbacks.",
|
|
32356
|
+
"- Use local runtime logs only for the current local build/runtime session.",
|
|
32313
32357
|
"- Generated assets are saved under assets/image, assets/video, assets/audio, or assets/model with remote mappings.",
|
|
32314
32358
|
"- Follow each tool schema for supported local path, remote URL, and data URL inputs.",
|
|
32315
32359
|
"- Local proxy may convert resolvable local reference media to data URLs before forwarding.",
|
|
@@ -33193,9 +33237,107 @@ function compareNumericPrereleaseIdentifier(left, right) {
|
|
|
33193
33237
|
return normalizedLeft.localeCompare(normalizedRight);
|
|
33194
33238
|
}
|
|
33195
33239
|
|
|
33196
|
-
// src/maker/
|
|
33240
|
+
// src/maker/projectInitialization.ts
|
|
33197
33241
|
import fs13 from "node:fs";
|
|
33198
33242
|
import path14 from "node:path";
|
|
33243
|
+
function inspectMakerProjectInitialization(projectRoot) {
|
|
33244
|
+
const resolvedProjectRoot = path14.resolve(projectRoot);
|
|
33245
|
+
const projectJsonPath = path14.join(resolvedProjectRoot, ".project", "project.json");
|
|
33246
|
+
const baseStatus = {
|
|
33247
|
+
projectRoot: resolvedProjectRoot,
|
|
33248
|
+
projectJsonPath
|
|
33249
|
+
};
|
|
33250
|
+
if (!fs13.existsSync(projectJsonPath)) {
|
|
33251
|
+
return {
|
|
33252
|
+
...baseStatus,
|
|
33253
|
+
status: "missing_project_json"
|
|
33254
|
+
};
|
|
33255
|
+
}
|
|
33256
|
+
let projectJson;
|
|
33257
|
+
try {
|
|
33258
|
+
projectJson = JSON.parse(fs13.readFileSync(projectJsonPath, "utf8"));
|
|
33259
|
+
} catch (error2) {
|
|
33260
|
+
return {
|
|
33261
|
+
...baseStatus,
|
|
33262
|
+
status: "invalid_project_json",
|
|
33263
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
33264
|
+
};
|
|
33265
|
+
}
|
|
33266
|
+
const missingFields = ["app_id", "developer_id"].filter(
|
|
33267
|
+
(field) => !hasNonEmptyIdentityField(projectJson, field)
|
|
33268
|
+
);
|
|
33269
|
+
if (missingFields.length > 0) {
|
|
33270
|
+
return {
|
|
33271
|
+
...baseStatus,
|
|
33272
|
+
status: "missing_taptap_identity",
|
|
33273
|
+
missingFields
|
|
33274
|
+
};
|
|
33275
|
+
}
|
|
33276
|
+
return {
|
|
33277
|
+
...baseStatus,
|
|
33278
|
+
status: "ready"
|
|
33279
|
+
};
|
|
33280
|
+
}
|
|
33281
|
+
function formatMakerProjectInitializationStatus(status) {
|
|
33282
|
+
var _a3;
|
|
33283
|
+
if (status.status === "ready") {
|
|
33284
|
+
return "";
|
|
33285
|
+
}
|
|
33286
|
+
if (status.status === "missing_taptap_identity") {
|
|
33287
|
+
return [
|
|
33288
|
+
"Maker project initialization",
|
|
33289
|
+
"",
|
|
33290
|
+
"- status: missing_taptap_identity",
|
|
33291
|
+
`- config: ${status.projectJsonPath}`,
|
|
33292
|
+
`- missing_fields: ${((_a3 = status.missingFields) == null ? void 0 : _a3.join(", ")) || "app_id, developer_id"}`,
|
|
33293
|
+
"- impact: get_ad_config cannot fetch ad activation status until TapTap app identity metadata exists.",
|
|
33294
|
+
"- next_action: 先调用 generate_test_qrcode 一次生成测试二维码元数据,再重试 get_ad_config;不要为这个恢复流程调用发布类工具。"
|
|
33295
|
+
].join("\n");
|
|
33296
|
+
}
|
|
33297
|
+
if (status.status === "invalid_project_json") {
|
|
33298
|
+
return [
|
|
33299
|
+
"Maker project initialization",
|
|
33300
|
+
"",
|
|
33301
|
+
"- status: invalid_project_json",
|
|
33302
|
+
`- config: ${status.projectJsonPath}`,
|
|
33303
|
+
status.error ? `- error: ${status.error}` : "",
|
|
33304
|
+
"- impact: get_ad_config and other remote project-config tools cannot parse project metadata yet.",
|
|
33305
|
+
"- next_action: 检查 .project/project.json 内容;必要时先调用 maker_build_current_directory 重新生成项目配置。"
|
|
33306
|
+
].filter(Boolean).join("\n");
|
|
33307
|
+
}
|
|
33308
|
+
if (status.status === "missing_project_json") {
|
|
33309
|
+
return [
|
|
33310
|
+
"Maker project initialization",
|
|
33311
|
+
"",
|
|
33312
|
+
"- status: missing_project_json",
|
|
33313
|
+
`- config: ${status.projectJsonPath}`,
|
|
33314
|
+
"- impact: get_ad_config and other remote project-config tools cannot read project metadata yet.",
|
|
33315
|
+
"- next_action: 先调用 maker_build_current_directory 构建一次,生成 .project/project.json 后再重试。"
|
|
33316
|
+
].join("\n");
|
|
33317
|
+
}
|
|
33318
|
+
return "";
|
|
33319
|
+
}
|
|
33320
|
+
function hasNonEmptyIdentityField(value, fieldName) {
|
|
33321
|
+
if (!value || typeof value !== "object") {
|
|
33322
|
+
return false;
|
|
33323
|
+
}
|
|
33324
|
+
const record2 = value;
|
|
33325
|
+
if (isNonEmptyStringLike(record2[fieldName])) {
|
|
33326
|
+
return true;
|
|
33327
|
+
}
|
|
33328
|
+
const taptapPublish = record2.taptap_publish;
|
|
33329
|
+
if (!taptapPublish || typeof taptapPublish !== "object" || Array.isArray(taptapPublish)) {
|
|
33330
|
+
return false;
|
|
33331
|
+
}
|
|
33332
|
+
return isNonEmptyStringLike(taptapPublish[fieldName]);
|
|
33333
|
+
}
|
|
33334
|
+
function isNonEmptyStringLike(value) {
|
|
33335
|
+
return value !== void 0 && value !== null && String(value).trim() !== "";
|
|
33336
|
+
}
|
|
33337
|
+
|
|
33338
|
+
// src/maker/server/proxyAssets.ts
|
|
33339
|
+
import fs14 from "node:fs";
|
|
33340
|
+
import path15 from "node:path";
|
|
33199
33341
|
var IMAGE_ASSET_DIRS = ["assets/image"];
|
|
33200
33342
|
var VIDEO_ASSET_DIRS = ["assets/video"];
|
|
33201
33343
|
var AUDIO_ASSET_DIRS = ["assets/audio"];
|
|
@@ -33205,6 +33347,7 @@ var IMAGE_REFERENCE_MAX_BYTES = 10 * 1024 * 1024;
|
|
|
33205
33347
|
var VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES = 30 * 1024 * 1024;
|
|
33206
33348
|
var VIDEO_REFERENCE_MAX_BYTES = 50 * 1024 * 1024;
|
|
33207
33349
|
var AUDIO_REFERENCE_MAX_BYTES = 15 * 1024 * 1024;
|
|
33350
|
+
var DEBUG_FEEDBACK_PATH_HINT = "Use local_dir/local_log_paths/local_screenshot_paths when they are returned. If only local_candidate_* is present, it is a possible project-relative location and must not be treated as a downloaded local file.";
|
|
33208
33351
|
var DATA_URL_MIME_BY_EXTENSION = {
|
|
33209
33352
|
image: {
|
|
33210
33353
|
".gif": "image/gif",
|
|
@@ -33315,7 +33458,8 @@ function shouldMaterializeRemoteProxyTool(toolName) {
|
|
|
33315
33458
|
"query_video_task",
|
|
33316
33459
|
"text_to_music",
|
|
33317
33460
|
"create_3d_model_task",
|
|
33318
|
-
"query_3d_model_task"
|
|
33461
|
+
"query_3d_model_task",
|
|
33462
|
+
"get_debug_feedbacks"
|
|
33319
33463
|
].includes(toolName);
|
|
33320
33464
|
}
|
|
33321
33465
|
function isTextContent(item) {
|
|
@@ -33364,8 +33508,217 @@ async function materializeParsedProxyResult(options) {
|
|
|
33364
33508
|
if (options.toolName === "create_3d_model_task" || options.toolName === "query_3d_model_task") {
|
|
33365
33509
|
return await materialize3dModelResult(options, options.toolName);
|
|
33366
33510
|
}
|
|
33511
|
+
if (options.toolName === "get_debug_feedbacks") {
|
|
33512
|
+
return await materializeDebugFeedbackResult(options);
|
|
33513
|
+
}
|
|
33367
33514
|
return options.payload;
|
|
33368
33515
|
}
|
|
33516
|
+
async function materializeDebugFeedbackResult(options) {
|
|
33517
|
+
if (options.payload.success !== true) {
|
|
33518
|
+
return options.payload;
|
|
33519
|
+
}
|
|
33520
|
+
const feedbacks = getDebugFeedbackItems(options.payload);
|
|
33521
|
+
const remoteSaveDir = getDebugFeedbackSaveDir(options.payload);
|
|
33522
|
+
if (feedbacks.length === 0 && !remoteSaveDir) {
|
|
33523
|
+
return options.payload;
|
|
33524
|
+
}
|
|
33525
|
+
const nextFeedbacks = [];
|
|
33526
|
+
for (const feedback of feedbacks) {
|
|
33527
|
+
const remoteDir = stringField2(feedback.dir);
|
|
33528
|
+
const localCandidateDir = remoteDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteDir) : void 0;
|
|
33529
|
+
const materialized = await materializeDebugFeedbackArtifacts({
|
|
33530
|
+
targetDir: options.targetDir,
|
|
33531
|
+
feedback,
|
|
33532
|
+
fetchImpl: options.fetchImpl
|
|
33533
|
+
});
|
|
33534
|
+
nextFeedbacks.push({
|
|
33535
|
+
...feedback,
|
|
33536
|
+
...localCandidateDir ? { local_candidate_dir: localCandidateDir } : {},
|
|
33537
|
+
...materialized
|
|
33538
|
+
});
|
|
33539
|
+
}
|
|
33540
|
+
const localCandidateSaveDir = remoteSaveDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteSaveDir) : feedbacks.some(hasDebugFeedbackArtifactUrls) ? path15.join(options.targetDir, "logs", "feed_back") : void 0;
|
|
33541
|
+
const filesVerifiedLocally = nextFeedbacks.some(
|
|
33542
|
+
(feedback) => numberField2(feedback.artifacts_downloaded) > 0
|
|
33543
|
+
);
|
|
33544
|
+
return {
|
|
33545
|
+
...replaceDebugFeedbackItems(options.payload, nextFeedbacks),
|
|
33546
|
+
local_path_hint: {
|
|
33547
|
+
remote_save_dir: remoteSaveDir,
|
|
33548
|
+
local_candidate_save_dir: localCandidateSaveDir,
|
|
33549
|
+
local_project_dir: options.targetDir,
|
|
33550
|
+
files_verified_locally: filesVerifiedLocally,
|
|
33551
|
+
note: DEBUG_FEEDBACK_PATH_HINT
|
|
33552
|
+
}
|
|
33553
|
+
};
|
|
33554
|
+
}
|
|
33555
|
+
async function materializeDebugFeedbackArtifacts(options) {
|
|
33556
|
+
const feedbackId = stringField2(options.feedback.feedback_id) || String(options.feedback.feedback_id || "");
|
|
33557
|
+
if (!feedbackId) {
|
|
33558
|
+
return {};
|
|
33559
|
+
}
|
|
33560
|
+
const logUrls = stringArrayField(options.feedback.log_file_urls);
|
|
33561
|
+
const screenshotUrls = stringArrayField(options.feedback.screenshots);
|
|
33562
|
+
const extraUrls = stringArrayField(options.feedback.download_urls).filter(
|
|
33563
|
+
(url2) => !logUrls.includes(url2) && !screenshotUrls.includes(url2)
|
|
33564
|
+
);
|
|
33565
|
+
if (logUrls.length === 0 && screenshotUrls.length === 0 && extraUrls.length === 0) {
|
|
33566
|
+
return {};
|
|
33567
|
+
}
|
|
33568
|
+
const localDir = path15.join(options.targetDir, "logs", "feed_back", `feedback_${feedbackId}`);
|
|
33569
|
+
const localLogPaths = [];
|
|
33570
|
+
const localScreenshotPaths = [];
|
|
33571
|
+
const localDownloadPaths = [];
|
|
33572
|
+
const errors = [];
|
|
33573
|
+
for (const [index, url2] of logUrls.entries()) {
|
|
33574
|
+
const result = await downloadDebugFeedbackArtifact({
|
|
33575
|
+
url: url2,
|
|
33576
|
+
directory: path15.join(localDir, "logs"),
|
|
33577
|
+
fallbackName: `log_${index + 1}.log`,
|
|
33578
|
+
fetchImpl: options.fetchImpl
|
|
33579
|
+
});
|
|
33580
|
+
if (result.success) {
|
|
33581
|
+
localLogPaths.push(result.path);
|
|
33582
|
+
} else {
|
|
33583
|
+
errors.push(result.error);
|
|
33584
|
+
}
|
|
33585
|
+
}
|
|
33586
|
+
for (const [index, url2] of screenshotUrls.entries()) {
|
|
33587
|
+
const result = await downloadDebugFeedbackArtifact({
|
|
33588
|
+
url: url2,
|
|
33589
|
+
directory: path15.join(localDir, "screenshots"),
|
|
33590
|
+
fallbackName: `screenshot_${index + 1}.png`,
|
|
33591
|
+
fetchImpl: options.fetchImpl
|
|
33592
|
+
});
|
|
33593
|
+
if (result.success) {
|
|
33594
|
+
localScreenshotPaths.push(result.path);
|
|
33595
|
+
} else {
|
|
33596
|
+
errors.push(result.error);
|
|
33597
|
+
}
|
|
33598
|
+
}
|
|
33599
|
+
for (const [index, url2] of extraUrls.entries()) {
|
|
33600
|
+
const result = await downloadDebugFeedbackArtifact({
|
|
33601
|
+
url: url2,
|
|
33602
|
+
directory: path15.join(localDir, "downloads"),
|
|
33603
|
+
fallbackName: `artifact_${index + 1}`,
|
|
33604
|
+
fetchImpl: options.fetchImpl
|
|
33605
|
+
});
|
|
33606
|
+
if (result.success) {
|
|
33607
|
+
localDownloadPaths.push(result.path);
|
|
33608
|
+
} else {
|
|
33609
|
+
errors.push(result.error);
|
|
33610
|
+
}
|
|
33611
|
+
}
|
|
33612
|
+
return {
|
|
33613
|
+
local_dir: localDir,
|
|
33614
|
+
local_log_paths: localLogPaths,
|
|
33615
|
+
local_screenshot_paths: localScreenshotPaths,
|
|
33616
|
+
local_download_paths: localDownloadPaths,
|
|
33617
|
+
artifacts_downloaded: localLogPaths.length + localScreenshotPaths.length + localDownloadPaths.length,
|
|
33618
|
+
artifact_download_errors: errors
|
|
33619
|
+
};
|
|
33620
|
+
}
|
|
33621
|
+
async function downloadDebugFeedbackArtifact(options) {
|
|
33622
|
+
try {
|
|
33623
|
+
const response = await options.fetchImpl(options.url);
|
|
33624
|
+
if (!response.ok) {
|
|
33625
|
+
return {
|
|
33626
|
+
success: false,
|
|
33627
|
+
error: `${options.url}: HTTP ${response.status}`
|
|
33628
|
+
};
|
|
33629
|
+
}
|
|
33630
|
+
fs14.mkdirSync(options.directory, { recursive: true });
|
|
33631
|
+
const filePath = allocateDebugFeedbackArtifactPath(
|
|
33632
|
+
options.directory,
|
|
33633
|
+
options.url,
|
|
33634
|
+
options.fallbackName
|
|
33635
|
+
);
|
|
33636
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
33637
|
+
fs14.writeFileSync(filePath, bytes);
|
|
33638
|
+
return { success: true, path: filePath };
|
|
33639
|
+
} catch (error2) {
|
|
33640
|
+
return {
|
|
33641
|
+
success: false,
|
|
33642
|
+
error: `${options.url}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
33643
|
+
};
|
|
33644
|
+
}
|
|
33645
|
+
}
|
|
33646
|
+
function allocateDebugFeedbackArtifactPath(directory, url2, fallbackName) {
|
|
33647
|
+
const rawName = fileNameFromUrl(url2) || fallbackName;
|
|
33648
|
+
const rawExtension = path15.extname(rawName);
|
|
33649
|
+
const finalExtension = rawExtension && rawExtension !== "." ? rawExtension.replace(/[^A-Za-z0-9.]/g, "_") : "";
|
|
33650
|
+
const rawStem = finalExtension ? rawName.slice(0, -rawExtension.length) : rawName;
|
|
33651
|
+
const stem = sanitizeAssetBaseName(rawStem);
|
|
33652
|
+
for (let index = 1; index <= 9999; index += 1) {
|
|
33653
|
+
const suffix = index === 1 ? "" : `_${index}`;
|
|
33654
|
+
const candidate = path15.join(directory, `${stem}${suffix}${finalExtension}`);
|
|
33655
|
+
if (!fs14.existsSync(candidate)) {
|
|
33656
|
+
return candidate;
|
|
33657
|
+
}
|
|
33658
|
+
}
|
|
33659
|
+
throw new Error(`Unable to allocate debug feedback artifact path for ${stem}${finalExtension}`);
|
|
33660
|
+
}
|
|
33661
|
+
function fileNameFromUrl(url2) {
|
|
33662
|
+
try {
|
|
33663
|
+
const pathname = new URL(url2).pathname;
|
|
33664
|
+
const name = decodeURIComponent(path15.basename(pathname));
|
|
33665
|
+
return name && name !== "/" ? name : void 0;
|
|
33666
|
+
} catch {
|
|
33667
|
+
return void 0;
|
|
33668
|
+
}
|
|
33669
|
+
}
|
|
33670
|
+
function hasDebugFeedbackArtifactUrls(feedback) {
|
|
33671
|
+
return stringArrayField(feedback.log_file_urls).length > 0 || stringArrayField(feedback.screenshots).length > 0 || stringArrayField(feedback.download_urls).length > 0;
|
|
33672
|
+
}
|
|
33673
|
+
function getDebugFeedbackSaveDir(payload) {
|
|
33674
|
+
const summary = payload.summary;
|
|
33675
|
+
return stringField2(payload.save_dir) || (isRecord(summary) ? stringField2(summary.save_dir) : void 0);
|
|
33676
|
+
}
|
|
33677
|
+
function resolveDebugFeedbackCandidatePath(targetDir, remotePath) {
|
|
33678
|
+
if (path15.isAbsolute(remotePath)) {
|
|
33679
|
+
return void 0;
|
|
33680
|
+
}
|
|
33681
|
+
const trimmedRemotePath = remotePath.replace(/[\\/]+$/, "");
|
|
33682
|
+
return path15.normalize(path15.join(targetDir, trimmedRemotePath || "."));
|
|
33683
|
+
}
|
|
33684
|
+
function replaceDebugFeedbackItems(payload, nextFeedbacks) {
|
|
33685
|
+
const summary = payload.summary;
|
|
33686
|
+
if (isRecord(summary) && Array.isArray(summary.feedbacks)) {
|
|
33687
|
+
return {
|
|
33688
|
+
...payload,
|
|
33689
|
+
summary: {
|
|
33690
|
+
...summary,
|
|
33691
|
+
feedbacks: nextFeedbacks
|
|
33692
|
+
}
|
|
33693
|
+
};
|
|
33694
|
+
}
|
|
33695
|
+
if (Array.isArray(payload.feedbacks)) {
|
|
33696
|
+
return {
|
|
33697
|
+
...payload,
|
|
33698
|
+
feedbacks: nextFeedbacks
|
|
33699
|
+
};
|
|
33700
|
+
}
|
|
33701
|
+
if (Array.isArray(payload.list)) {
|
|
33702
|
+
return {
|
|
33703
|
+
...payload,
|
|
33704
|
+
list: nextFeedbacks
|
|
33705
|
+
};
|
|
33706
|
+
}
|
|
33707
|
+
return payload;
|
|
33708
|
+
}
|
|
33709
|
+
function getDebugFeedbackItems(payload) {
|
|
33710
|
+
const summary = payload.summary;
|
|
33711
|
+
if (isRecord(summary) && Array.isArray(summary.feedbacks)) {
|
|
33712
|
+
return summary.feedbacks.filter(isRecord);
|
|
33713
|
+
}
|
|
33714
|
+
if (Array.isArray(payload.feedbacks)) {
|
|
33715
|
+
return payload.feedbacks.filter(isRecord);
|
|
33716
|
+
}
|
|
33717
|
+
if (Array.isArray(payload.list)) {
|
|
33718
|
+
return payload.list.filter(isRecord);
|
|
33719
|
+
}
|
|
33720
|
+
return [];
|
|
33721
|
+
}
|
|
33369
33722
|
async function materializeSingleImageResult(options, toolName) {
|
|
33370
33723
|
if (options.payload.success !== true) {
|
|
33371
33724
|
return options.payload;
|
|
@@ -33479,13 +33832,13 @@ function findExistingMaterializedVideo(targetDir, options) {
|
|
|
33479
33832
|
function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
|
|
33480
33833
|
const candidates = [];
|
|
33481
33834
|
const absolutePath = stringField2(record2.absolutePath);
|
|
33482
|
-
if (absolutePath &&
|
|
33835
|
+
if (absolutePath && path15.isAbsolute(absolutePath)) {
|
|
33483
33836
|
candidates.push(absolutePath);
|
|
33484
33837
|
}
|
|
33485
|
-
candidates.push(
|
|
33838
|
+
candidates.push(path15.join(targetDir, ...localPath.split("/")));
|
|
33486
33839
|
for (const candidate of candidates) {
|
|
33487
33840
|
try {
|
|
33488
|
-
if (
|
|
33841
|
+
if (fs14.statSync(candidate).isFile()) {
|
|
33489
33842
|
return candidate;
|
|
33490
33843
|
}
|
|
33491
33844
|
} catch {
|
|
@@ -33650,7 +34003,7 @@ async function materialize3dFinalResult(options, toolName) {
|
|
|
33650
34003
|
try {
|
|
33651
34004
|
extractZip(
|
|
33652
34005
|
mdlMaterialized.absolutePath,
|
|
33653
|
-
|
|
34006
|
+
path15.join(options.targetDir, "assets"),
|
|
33654
34007
|
"3D model asset"
|
|
33655
34008
|
);
|
|
33656
34009
|
nextPayload.mdlExtracted = true;
|
|
@@ -33757,8 +34110,8 @@ async function materializeAsset(options) {
|
|
|
33757
34110
|
};
|
|
33758
34111
|
}
|
|
33759
34112
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
33760
|
-
|
|
33761
|
-
|
|
34113
|
+
fs14.mkdirSync(path15.dirname(absolutePath), { recursive: true });
|
|
34114
|
+
fs14.writeFileSync(absolutePath, bytes);
|
|
33762
34115
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
33763
34116
|
} catch (error2) {
|
|
33764
34117
|
return {
|
|
@@ -33772,12 +34125,12 @@ async function materializeAsset(options) {
|
|
|
33772
34125
|
function createUniqueAssetPath(options) {
|
|
33773
34126
|
const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
|
|
33774
34127
|
for (let index = 1; index <= 9999; index += 1) {
|
|
33775
|
-
const relativePath =
|
|
34128
|
+
const relativePath = path15.posix.join(
|
|
33776
34129
|
options.relativeDir,
|
|
33777
34130
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
33778
34131
|
);
|
|
33779
|
-
const absolutePath =
|
|
33780
|
-
if (!
|
|
34132
|
+
const absolutePath = path15.join(options.targetDir, ...relativePath.split("/"));
|
|
34133
|
+
if (!fs14.existsSync(absolutePath)) {
|
|
33781
34134
|
return { relativePath, absolutePath };
|
|
33782
34135
|
}
|
|
33783
34136
|
}
|
|
@@ -33955,7 +34308,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
33955
34308
|
if (!isKnownAssetPath(localPath, assetDirs)) {
|
|
33956
34309
|
return false;
|
|
33957
34310
|
}
|
|
33958
|
-
const basename =
|
|
34311
|
+
const basename = path15.posix.basename(localPath);
|
|
33959
34312
|
const stem = basename.replace(/\.[^.]+$/, "");
|
|
33960
34313
|
return basename === value || stem === value || record2.name === value || record2.taskId === value;
|
|
33961
34314
|
});
|
|
@@ -33968,13 +34321,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
33968
34321
|
}
|
|
33969
34322
|
function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
33970
34323
|
var _a3;
|
|
33971
|
-
const hasExtension = Boolean(
|
|
34324
|
+
const hasExtension = Boolean(path15.extname(value));
|
|
33972
34325
|
const candidates = [];
|
|
33973
34326
|
for (const assetDir of assetDirs) {
|
|
33974
|
-
const absoluteDir =
|
|
34327
|
+
const absoluteDir = path15.join(targetDir, ...assetDir.split("/"));
|
|
33975
34328
|
let entries;
|
|
33976
34329
|
try {
|
|
33977
|
-
entries =
|
|
34330
|
+
entries = fs14.readdirSync(absoluteDir);
|
|
33978
34331
|
} catch {
|
|
33979
34332
|
continue;
|
|
33980
34333
|
}
|
|
@@ -33983,11 +34336,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
33983
34336
|
if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
|
|
33984
34337
|
continue;
|
|
33985
34338
|
}
|
|
33986
|
-
const absolutePath =
|
|
34339
|
+
const absolutePath = path15.join(absoluteDir, entry);
|
|
33987
34340
|
try {
|
|
33988
34341
|
candidates.push({
|
|
33989
|
-
localPath:
|
|
33990
|
-
mtimeMs:
|
|
34342
|
+
localPath: path15.posix.join(assetDir, entry),
|
|
34343
|
+
mtimeMs: fs14.statSync(absolutePath).mtimeMs
|
|
33991
34344
|
});
|
|
33992
34345
|
} catch {
|
|
33993
34346
|
}
|
|
@@ -33997,7 +34350,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
33997
34350
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
|
|
33998
34351
|
}
|
|
33999
34352
|
function isKnownAssetPath(relativePath, assetDirs) {
|
|
34000
|
-
if (relativePath.startsWith("../") ||
|
|
34353
|
+
if (relativePath.startsWith("../") || path15.isAbsolute(relativePath)) {
|
|
34001
34354
|
return false;
|
|
34002
34355
|
}
|
|
34003
34356
|
return assetDirs.some(
|
|
@@ -34021,14 +34374,14 @@ function localAssetReferenceToDataUrl(options) {
|
|
|
34021
34374
|
}
|
|
34022
34375
|
let stat;
|
|
34023
34376
|
try {
|
|
34024
|
-
stat =
|
|
34377
|
+
stat = fs14.statSync(absolutePath);
|
|
34025
34378
|
} catch {
|
|
34026
34379
|
return void 0;
|
|
34027
34380
|
}
|
|
34028
34381
|
if (!stat.isFile() || stat.size > options.maxBytes) {
|
|
34029
34382
|
return void 0;
|
|
34030
34383
|
}
|
|
34031
|
-
const bytes =
|
|
34384
|
+
const bytes = fs14.readFileSync(absolutePath);
|
|
34032
34385
|
return `data:${mime};base64,${bytes.toString("base64")}`;
|
|
34033
34386
|
}
|
|
34034
34387
|
function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
@@ -34039,7 +34392,7 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
|
34039
34392
|
candidates.push(localPath);
|
|
34040
34393
|
}
|
|
34041
34394
|
}
|
|
34042
|
-
if (
|
|
34395
|
+
if (path15.isAbsolute(options.value)) {
|
|
34043
34396
|
candidates.push(options.value);
|
|
34044
34397
|
} else {
|
|
34045
34398
|
const localPath = resolveProjectRelativePath(targetDir, options.value);
|
|
@@ -34048,54 +34401,54 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
|
34048
34401
|
}
|
|
34049
34402
|
}
|
|
34050
34403
|
for (const candidate of candidates) {
|
|
34051
|
-
if (
|
|
34404
|
+
if (fs14.existsSync(candidate)) {
|
|
34052
34405
|
return candidate;
|
|
34053
34406
|
}
|
|
34054
34407
|
}
|
|
34055
34408
|
return void 0;
|
|
34056
34409
|
}
|
|
34057
34410
|
function resolveProjectRelativePath(targetDir, value) {
|
|
34058
|
-
const root =
|
|
34059
|
-
const absolutePath =
|
|
34060
|
-
const relativePath =
|
|
34061
|
-
const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${
|
|
34411
|
+
const root = path15.resolve(targetDir);
|
|
34412
|
+
const absolutePath = path15.resolve(root, value);
|
|
34413
|
+
const relativePath = path15.relative(root, absolutePath);
|
|
34414
|
+
const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path15.sep}`) || path15.isAbsolute(relativePath);
|
|
34062
34415
|
if (!escapesRoot) {
|
|
34063
34416
|
return absolutePath;
|
|
34064
34417
|
}
|
|
34065
34418
|
return void 0;
|
|
34066
34419
|
}
|
|
34067
34420
|
function dataUrlMimeForPath(filePath, mediaKind) {
|
|
34068
|
-
return DATA_URL_MIME_BY_EXTENSION[mediaKind][
|
|
34421
|
+
return DATA_URL_MIME_BY_EXTENSION[mediaKind][path15.extname(filePath).toLowerCase()];
|
|
34069
34422
|
}
|
|
34070
34423
|
function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
|
|
34071
34424
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
34072
34425
|
registry2[localPath] = record2;
|
|
34073
34426
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
34074
|
-
|
|
34075
|
-
|
|
34427
|
+
fs14.mkdirSync(path15.dirname(registryPath), { recursive: true });
|
|
34428
|
+
fs14.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
|
|
34076
34429
|
`, "utf8");
|
|
34077
34430
|
}
|
|
34078
34431
|
function readGeneratedAssetRegistry(targetDir) {
|
|
34079
34432
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
34080
|
-
if (!
|
|
34433
|
+
if (!fs14.existsSync(registryPath)) {
|
|
34081
34434
|
return {};
|
|
34082
34435
|
}
|
|
34083
34436
|
try {
|
|
34084
|
-
const parsed = JSON.parse(
|
|
34437
|
+
const parsed = JSON.parse(fs14.readFileSync(registryPath, "utf8"));
|
|
34085
34438
|
return isRecord(parsed) ? parsed : {};
|
|
34086
34439
|
} catch {
|
|
34087
34440
|
return {};
|
|
34088
34441
|
}
|
|
34089
34442
|
}
|
|
34090
34443
|
function getGeneratedAssetRegistryPath(targetDir) {
|
|
34091
|
-
return
|
|
34444
|
+
return path15.join(targetDir, ".maker", "assets", "generated-assets.json");
|
|
34092
34445
|
}
|
|
34093
34446
|
function normalizeAssetRegistryKey(targetDir, value) {
|
|
34094
34447
|
if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
|
|
34095
34448
|
return void 0;
|
|
34096
34449
|
}
|
|
34097
|
-
const relative =
|
|
34098
|
-
return relative.split(
|
|
34450
|
+
const relative = path15.isAbsolute(value) ? path15.relative(targetDir, value) : value;
|
|
34451
|
+
return relative.split(path15.sep).join("/");
|
|
34099
34452
|
}
|
|
34100
34453
|
function isRecord(value) {
|
|
34101
34454
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -34103,9 +34456,19 @@ function isRecord(value) {
|
|
|
34103
34456
|
function stringField2(value) {
|
|
34104
34457
|
return typeof value === "string" && value.trim() ? value : void 0;
|
|
34105
34458
|
}
|
|
34459
|
+
function stringArrayField(value) {
|
|
34460
|
+
return Array.isArray(value) ? value.filter((item) => Boolean(stringField2(item))) : [];
|
|
34461
|
+
}
|
|
34462
|
+
function numberField2(value) {
|
|
34463
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
34464
|
+
}
|
|
34106
34465
|
function sanitizeAssetBaseName(value) {
|
|
34107
|
-
const sanitized = value.trim().replace(/\s+/g, "_").replace(/[/\\:*?"<>|]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
|
|
34108
|
-
|
|
34466
|
+
const sanitized = replaceControlCharacters(value).trim().replace(/\s+/g, "_").replace(/[/\\:*?"<>|]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").replace(/[. ]+$/g, "");
|
|
34467
|
+
const safeName = sanitized || "asset";
|
|
34468
|
+
return /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(safeName) ? `_${safeName}` : safeName;
|
|
34469
|
+
}
|
|
34470
|
+
function replaceControlCharacters(value) {
|
|
34471
|
+
return Array.from(value).map((character) => character.charCodeAt(0) < 32 ? "_" : character).join("");
|
|
34109
34472
|
}
|
|
34110
34473
|
function formatAssetTimestamp(date5) {
|
|
34111
34474
|
const pad = (value) => String(value).padStart(2, "0");
|
|
@@ -34124,7 +34487,7 @@ function extensionFromUrl(url2) {
|
|
|
34124
34487
|
}
|
|
34125
34488
|
try {
|
|
34126
34489
|
const pathname = new URL(url2).pathname;
|
|
34127
|
-
const extension =
|
|
34490
|
+
const extension = path15.extname(pathname).replace(/^\./, "").toLowerCase();
|
|
34128
34491
|
return extension || void 0;
|
|
34129
34492
|
} catch {
|
|
34130
34493
|
return void 0;
|
|
@@ -34275,7 +34638,7 @@ function applyDefaults(config2) {
|
|
|
34275
34638
|
}
|
|
34276
34639
|
|
|
34277
34640
|
// src/maker/server/mcp.ts
|
|
34278
|
-
var VERSION = true ? "0.0.
|
|
34641
|
+
var VERSION = true ? "0.0.24-beta.2" : "dev";
|
|
34279
34642
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
34280
34643
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
34281
34644
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -34291,7 +34654,10 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
|
|
|
34291
34654
|
"query_video_task",
|
|
34292
34655
|
"text_to_music",
|
|
34293
34656
|
"create_3d_model_task",
|
|
34294
|
-
"query_3d_model_task"
|
|
34657
|
+
"query_3d_model_task",
|
|
34658
|
+
"generate_test_qrcode",
|
|
34659
|
+
"get_ad_config",
|
|
34660
|
+
"get_debug_feedbacks"
|
|
34295
34661
|
];
|
|
34296
34662
|
var MakerCloneFailedError = class extends Error {
|
|
34297
34663
|
constructor(targetDir, originalError) {
|
|
@@ -34436,7 +34802,7 @@ function decorateRemoteProxyToolInputSchema(inputSchema) {
|
|
|
34436
34802
|
...properties,
|
|
34437
34803
|
target_dir: {
|
|
34438
34804
|
type: "string",
|
|
34439
|
-
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
|
|
34805
|
+
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."
|
|
34440
34806
|
}
|
|
34441
34807
|
}
|
|
34442
34808
|
};
|
|
@@ -34478,6 +34844,21 @@ function remoteProxyToolGuidance(toolName) {
|
|
|
34478
34844
|
"**Maker asset workflow hint:** Prefer this Maker MCP proxy tool for Maker music generation so generated audio can be materialized into the project and recorded for later Maker references.",
|
|
34479
34845
|
failurePolicy
|
|
34480
34846
|
].join(" ");
|
|
34847
|
+
case "get_ad_config":
|
|
34848
|
+
return [
|
|
34849
|
+
"**Maker hint:** Trigger this tool for any ad-related request (广告, 激励视频, 播放广告, ad ID, ad placement, ShowRewardVideoAd, ad status, or ad config). Call it first to get the current Maker project ad activation status and ad config; do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks. If .project/project.json is missing, build the project once with maker_build_current_directory to initialize it, then call this tool again. If this tool says app_id or developer_id is missing, call generate_test_qrcode once to generate test QR code metadata, then call this tool again.",
|
|
34850
|
+
failurePolicy
|
|
34851
|
+
].join(" ");
|
|
34852
|
+
case "generate_test_qrcode":
|
|
34853
|
+
return [
|
|
34854
|
+
"**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. It has no business parameters; follow the remote schema and report the returned QR code or failure payload.",
|
|
34855
|
+
failurePolicy
|
|
34856
|
+
].join(" ");
|
|
34857
|
+
case "get_debug_feedbacks":
|
|
34858
|
+
return [
|
|
34859
|
+
"**Maker hint:** Fetch online player feedback for the current Maker project. When logs or screenshots can be downloaded, this tool saves them under logs/feed_back/feedback_<id>/ in the local Maker project and returns local_dir/local_log_paths/local_screenshot_paths. Read those returned local paths before diagnosing the issue. Do not guess drive letters or fixed directories; only treat attachments as local files when local_* paths are returned.",
|
|
34860
|
+
failurePolicy
|
|
34861
|
+
].join(" ");
|
|
34481
34862
|
default:
|
|
34482
34863
|
return void 0;
|
|
34483
34864
|
}
|
|
@@ -34775,7 +35156,7 @@ async function formatStatus(options = {}) {
|
|
|
34775
35156
|
const env = getMakerEnvironment(void 0, targetDir);
|
|
34776
35157
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
34777
35158
|
const mcpCwd = process.cwd();
|
|
34778
|
-
const mcpCwdIdentify =
|
|
35159
|
+
const mcpCwdIdentify = path16.resolve(mcpCwd) === path16.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
|
|
34779
35160
|
const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
|
|
34780
35161
|
const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
|
|
34781
35162
|
const pat = loadPat();
|
|
@@ -34807,6 +35188,9 @@ async function formatStatus(options = {}) {
|
|
|
34807
35188
|
allowRemoteFetch: false
|
|
34808
35189
|
})
|
|
34809
35190
|
);
|
|
35191
|
+
const projectInitializationText = identify.projectRoot ? formatMakerProjectInitializationStatus(
|
|
35192
|
+
inspectMakerProjectInitialization(identify.projectRoot)
|
|
35193
|
+
) : "";
|
|
34810
35194
|
const projectSection = identify.projectId ? [
|
|
34811
35195
|
"目标目录已绑定 Maker 项目。",
|
|
34812
35196
|
"请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
|
|
@@ -34837,7 +35221,7 @@ async function formatStatus(options = {}) {
|
|
|
34837
35221
|
packageUpdateText,
|
|
34838
35222
|
"",
|
|
34839
35223
|
formatMakerGitDirectoryStatus(gitDirectoryStatus),
|
|
34840
|
-
"",
|
|
35224
|
+
...projectInitializationText ? ["", projectInitializationText, ""] : [""],
|
|
34841
35225
|
formatMakerClientRootsStatus(projectContext.roots),
|
|
34842
35226
|
"",
|
|
34843
35227
|
projectContext.source === "client_roots" ? "" : formatMakerToolRegistrationCwdStatus({
|
|
@@ -34908,10 +35292,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
|
|
|
34908
35292
|
if (!options.projectRoot) {
|
|
34909
35293
|
return "";
|
|
34910
35294
|
}
|
|
34911
|
-
const mcpCwd =
|
|
34912
|
-
const targetDir =
|
|
34913
|
-
const projectRoot =
|
|
34914
|
-
const mcpProjectRoot = options.mcpProjectRoot ?
|
|
35295
|
+
const mcpCwd = path16.resolve(options.mcpCwd);
|
|
35296
|
+
const targetDir = path16.resolve(options.targetDir);
|
|
35297
|
+
const projectRoot = path16.resolve(options.projectRoot);
|
|
35298
|
+
const mcpProjectRoot = options.mcpProjectRoot ? path16.resolve(options.mcpProjectRoot) : void 0;
|
|
34915
35299
|
if (mcpProjectRoot === projectRoot) {
|
|
34916
35300
|
return "";
|
|
34917
35301
|
}
|
|
@@ -35084,7 +35468,7 @@ function createServerClientRootsProvider(server) {
|
|
|
35084
35468
|
async function resolveMakerProjectContext(options = {}) {
|
|
35085
35469
|
if (options.targetDir) {
|
|
35086
35470
|
return {
|
|
35087
|
-
targetDir:
|
|
35471
|
+
targetDir: path16.resolve(options.targetDir),
|
|
35088
35472
|
source: "explicit_target_dir",
|
|
35089
35473
|
roots: { status: "not_requested", roots: [] }
|
|
35090
35474
|
};
|
|
@@ -35179,7 +35563,7 @@ function rootToLocalPath(root) {
|
|
|
35179
35563
|
if (url2.protocol !== "file:") {
|
|
35180
35564
|
return void 0;
|
|
35181
35565
|
}
|
|
35182
|
-
return
|
|
35566
|
+
return path16.resolve(fileURLToPath2(url2));
|
|
35183
35567
|
} catch {
|
|
35184
35568
|
return void 0;
|
|
35185
35569
|
}
|
|
@@ -35193,14 +35577,14 @@ function uniquePaths(values) {
|
|
|
35193
35577
|
continue;
|
|
35194
35578
|
}
|
|
35195
35579
|
seen.add(normalized);
|
|
35196
|
-
result.push(
|
|
35580
|
+
result.push(path16.resolve(value));
|
|
35197
35581
|
}
|
|
35198
35582
|
return result;
|
|
35199
35583
|
}
|
|
35200
35584
|
function normalizePathForCompare2(value) {
|
|
35201
|
-
const resolved =
|
|
35585
|
+
const resolved = path16.resolve(value);
|
|
35202
35586
|
try {
|
|
35203
|
-
return
|
|
35587
|
+
return fs15.realpathSync.native(resolved);
|
|
35204
35588
|
} catch {
|
|
35205
35589
|
return resolved;
|
|
35206
35590
|
}
|
|
@@ -35349,14 +35733,14 @@ function formatStatusProjectList(projects) {
|
|
|
35349
35733
|
].filter((line) => line !== void 0).join("\n");
|
|
35350
35734
|
}
|
|
35351
35735
|
function formatClonePartialStateLines(targetDir) {
|
|
35352
|
-
const resolvedTargetDir =
|
|
35736
|
+
const resolvedTargetDir = path16.resolve(targetDir);
|
|
35353
35737
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
35354
35738
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
35355
35739
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
35356
|
-
const stagedDevKitGitignorePath =
|
|
35740
|
+
const stagedDevKitGitignorePath = path16.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
35357
35741
|
const projectBound = Boolean(identify.projectId);
|
|
35358
35742
|
const gitInitialized = Boolean(
|
|
35359
|
-
gitStatus.isOwnGitRoot ||
|
|
35743
|
+
gitStatus.isOwnGitRoot || fs15.existsSync(path16.join(resolvedTargetDir, ".git"))
|
|
35360
35744
|
);
|
|
35361
35745
|
const safeToRetry = !projectBound;
|
|
35362
35746
|
return [
|
|
@@ -35370,7 +35754,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
35370
35754
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
35371
35755
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
35372
35756
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
35373
|
-
`- staged_dev_kit_gitignore: ${
|
|
35757
|
+
`- staged_dev_kit_gitignore: ${fs15.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
35374
35758
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
35375
35759
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
35376
35760
|
].filter(Boolean);
|
|
@@ -35446,12 +35830,12 @@ function resolveEmbeddedProxyCommand(options) {
|
|
|
35446
35830
|
}
|
|
35447
35831
|
return {
|
|
35448
35832
|
command: process.execPath,
|
|
35449
|
-
args: [
|
|
35833
|
+
args: [path16.resolve(makerEntry), "__maker-proxy"]
|
|
35450
35834
|
};
|
|
35451
35835
|
}
|
|
35452
35836
|
function resolveBundledMakerEntry() {
|
|
35453
|
-
const bundledEntry =
|
|
35454
|
-
return
|
|
35837
|
+
const bundledEntry = path16.resolve(__dirname, "../../../bin/taptap-maker");
|
|
35838
|
+
return fs15.existsSync(bundledEntry) ? bundledEntry : void 0;
|
|
35455
35839
|
}
|
|
35456
35840
|
function isUsableEmbeddedMakerEntry(entry) {
|
|
35457
35841
|
if (!entry) {
|
|
@@ -35777,18 +36161,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
35777
36161
|
}
|
|
35778
36162
|
}
|
|
35779
36163
|
async function startRuntimeLogWatch(buildResult) {
|
|
35780
|
-
const runtimeDir =
|
|
35781
|
-
|
|
35782
|
-
const stdoutLog =
|
|
35783
|
-
const stderrLog =
|
|
35784
|
-
const pidFile =
|
|
36164
|
+
const runtimeDir = path16.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
36165
|
+
fs15.mkdirSync(runtimeDir, { recursive: true });
|
|
36166
|
+
const stdoutLog = path16.join(runtimeDir, "watcher.out.log");
|
|
36167
|
+
const stderrLog = path16.join(runtimeDir, "watcher.err.log");
|
|
36168
|
+
const pidFile = path16.join(runtimeDir, "watcher.pid");
|
|
35785
36169
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
35786
|
-
const outFd =
|
|
35787
|
-
const errFd =
|
|
36170
|
+
const outFd = fs15.openSync(stdoutLog, "a");
|
|
36171
|
+
const errFd = fs15.openSync(stderrLog, "a");
|
|
35788
36172
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
35789
36173
|
if (previous.previousStopError) {
|
|
35790
|
-
|
|
35791
|
-
|
|
36174
|
+
fs15.closeSync(outFd);
|
|
36175
|
+
fs15.closeSync(errFd);
|
|
35792
36176
|
return {
|
|
35793
36177
|
started: false,
|
|
35794
36178
|
command: command.text,
|
|
@@ -35851,18 +36235,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
35851
36235
|
...previous
|
|
35852
36236
|
};
|
|
35853
36237
|
} finally {
|
|
35854
|
-
|
|
35855
|
-
|
|
36238
|
+
fs15.closeSync(outFd);
|
|
36239
|
+
fs15.closeSync(errFd);
|
|
35856
36240
|
}
|
|
35857
36241
|
}
|
|
35858
36242
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
35859
|
-
if (!
|
|
36243
|
+
if (!fs15.existsSync(pidFile)) {
|
|
35860
36244
|
return {};
|
|
35861
36245
|
}
|
|
35862
36246
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
35863
36247
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
35864
36248
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
35865
|
-
|
|
36249
|
+
fs15.rmSync(pidFile, { force: true });
|
|
35866
36250
|
return {};
|
|
35867
36251
|
}
|
|
35868
36252
|
try {
|
|
@@ -35870,7 +36254,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
35870
36254
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
35871
36255
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
35872
36256
|
if (!verifiedCommand) {
|
|
35873
|
-
|
|
36257
|
+
fs15.rmSync(pidFile, { force: true });
|
|
35874
36258
|
return {
|
|
35875
36259
|
previousPid: pid,
|
|
35876
36260
|
previousStopped: false,
|
|
@@ -35880,7 +36264,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
35880
36264
|
process.kill(pid, "SIGTERM");
|
|
35881
36265
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
35882
36266
|
if (stopped) {
|
|
35883
|
-
|
|
36267
|
+
fs15.rmSync(pidFile, { force: true });
|
|
35884
36268
|
return { previousPid: pid, previousStopped: true };
|
|
35885
36269
|
}
|
|
35886
36270
|
return {
|
|
@@ -35889,7 +36273,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
35889
36273
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
35890
36274
|
};
|
|
35891
36275
|
} catch (error2) {
|
|
35892
|
-
|
|
36276
|
+
fs15.rmSync(pidFile, { force: true });
|
|
35893
36277
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
35894
36278
|
if (code === "ESRCH") {
|
|
35895
36279
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -35902,7 +36286,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
35902
36286
|
}
|
|
35903
36287
|
}
|
|
35904
36288
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
35905
|
-
const raw =
|
|
36289
|
+
const raw = fs15.readFileSync(pidFile, "utf8").trim();
|
|
35906
36290
|
if (!raw) {
|
|
35907
36291
|
return null;
|
|
35908
36292
|
}
|
|
@@ -35918,7 +36302,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
35918
36302
|
}
|
|
35919
36303
|
}
|
|
35920
36304
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
35921
|
-
|
|
36305
|
+
fs15.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
35922
36306
|
`, "utf8");
|
|
35923
36307
|
}
|
|
35924
36308
|
function getProcessCommand(pid) {
|
|
@@ -36004,10 +36388,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
36004
36388
|
};
|
|
36005
36389
|
}
|
|
36006
36390
|
function resolveMakerCliEntry() {
|
|
36007
|
-
return process.argv[1] ||
|
|
36391
|
+
return process.argv[1] || path16.resolve(process.cwd(), "dist", "maker.js");
|
|
36008
36392
|
}
|
|
36009
36393
|
function getRuntimeLogFilePath(projectRoot) {
|
|
36010
|
-
return
|
|
36394
|
+
return path16.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
36011
36395
|
}
|
|
36012
36396
|
async function refreshMakerPreview(buildResult) {
|
|
36013
36397
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -36141,7 +36525,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
36141
36525
|
if (options.scriptsPath) {
|
|
36142
36526
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
36143
36527
|
}
|
|
36144
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
36528
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs15.existsSync(path16.join(projectRoot, "scripts", "main.lua"))) {
|
|
36145
36529
|
buildArgs.entry = "main.lua";
|
|
36146
36530
|
buildArgs.scriptsPath = "scripts";
|
|
36147
36531
|
}
|
|
@@ -36153,7 +36537,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
36153
36537
|
}
|
|
36154
36538
|
if (options.multiplayer) {
|
|
36155
36539
|
buildArgs.multiplayer = options.multiplayer;
|
|
36156
|
-
} else if (!
|
|
36540
|
+
} else if (!fs15.existsSync(path16.join(projectRoot, ".project", "settings.json"))) {
|
|
36157
36541
|
buildArgs.multiplayer = { enabled: false };
|
|
36158
36542
|
}
|
|
36159
36543
|
return buildArgs;
|
|
@@ -36315,11 +36699,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
36315
36699
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
36316
36700
|
`- watch_command: ${command}`,
|
|
36317
36701
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
36318
|
-
`- local_file: ${
|
|
36702
|
+
`- local_file: ${path16.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
36319
36703
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
36320
36704
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
36321
36705
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
36322
|
-
`- state_file: ${
|
|
36706
|
+
`- state_file: ${path16.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
36323
36707
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
36324
36708
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
36325
36709
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -36510,9 +36894,9 @@ function indent2(value) {
|
|
|
36510
36894
|
// src/maker/cli/commands.ts
|
|
36511
36895
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
36512
36896
|
import crypto3 from "node:crypto";
|
|
36513
|
-
import
|
|
36897
|
+
import fs16 from "node:fs";
|
|
36514
36898
|
import os4 from "node:os";
|
|
36515
|
-
import
|
|
36899
|
+
import path17 from "node:path";
|
|
36516
36900
|
import readline from "node:readline/promises";
|
|
36517
36901
|
import { stdin as input, stdout as output } from "node:process";
|
|
36518
36902
|
|
|
@@ -36658,7 +37042,7 @@ function formatError2(error2) {
|
|
|
36658
37042
|
}
|
|
36659
37043
|
|
|
36660
37044
|
// src/maker/cli/commands.ts
|
|
36661
|
-
var VERSION2 = true ? "0.0.
|
|
37045
|
+
var VERSION2 = true ? "0.0.24-beta.2" : "dev";
|
|
36662
37046
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
36663
37047
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
36664
37048
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
@@ -36793,7 +37177,7 @@ function toOptionKey(value) {
|
|
|
36793
37177
|
}
|
|
36794
37178
|
async function runInit(parsed, ctx) {
|
|
36795
37179
|
rejectPackageOption(parsed);
|
|
36796
|
-
const targetDir =
|
|
37180
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36797
37181
|
const env = makerEnvOption(parsed);
|
|
36798
37182
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
36799
37183
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -36886,7 +37270,7 @@ async function runInit(parsed, ctx) {
|
|
|
36886
37270
|
}
|
|
36887
37271
|
async function runDoctor(parsed, ctx) {
|
|
36888
37272
|
var _a3, _b;
|
|
36889
|
-
const targetDir =
|
|
37273
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36890
37274
|
const env = makerEnvOption(parsed);
|
|
36891
37275
|
const git = checkGitEnvironment();
|
|
36892
37276
|
const python = checkMakerPythonEnvironment();
|
|
@@ -36908,6 +37292,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
36908
37292
|
const mcpToolsAvailability = inspectMakerMcpToolsAvailability({
|
|
36909
37293
|
makerProjectDir: identify.projectRoot
|
|
36910
37294
|
});
|
|
37295
|
+
const projectInitialization = isProjectBound ? inspectMakerProjectInitialization(projectRoot) : void 0;
|
|
36911
37296
|
const workBuddyTrust = shouldShowWorkBuddyTrustInspection() ? inspectWorkBuddyTrustState(DEFAULT_MCP_NAME) : void 0;
|
|
36912
37297
|
if (ctx.json) {
|
|
36913
37298
|
writeJson({
|
|
@@ -36924,6 +37309,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
36924
37309
|
dev_kit: devKit,
|
|
36925
37310
|
dev_kit_update: devKitUpdate,
|
|
36926
37311
|
package_update: packageUpdate,
|
|
37312
|
+
project_initialization: projectInitialization,
|
|
36927
37313
|
mcp_tools_availability: mcpToolsAvailability,
|
|
36928
37314
|
...workBuddyTrust ? { workbuddy_trust: workBuddyTrust } : {},
|
|
36929
37315
|
orphan_process_check: orphanProcessCheck
|
|
@@ -36951,6 +37337,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
36951
37337
|
`- target_dir: ${targetDir}`,
|
|
36952
37338
|
`- project_id: ${identify.projectId || "(none)"}`,
|
|
36953
37339
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
37340
|
+
projectInitialization ? formatMakerProjectInitializationStatus(projectInitialization) : "",
|
|
36954
37341
|
isProjectBound ? formatMakerAgentsPolicyStatus(projectRoot) : "",
|
|
36955
37342
|
"",
|
|
36956
37343
|
"AI dev kit",
|
|
@@ -36974,9 +37361,9 @@ async function runDoctor(parsed, ctx) {
|
|
|
36974
37361
|
);
|
|
36975
37362
|
}
|
|
36976
37363
|
function inspectMakerMcpToolsAvailability(options) {
|
|
36977
|
-
const aiPwd =
|
|
37364
|
+
const aiPwd = path17.resolve(process.cwd());
|
|
36978
37365
|
const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
|
|
36979
|
-
const makerProjectDir = options.makerProjectDir ?
|
|
37366
|
+
const makerProjectDir = options.makerProjectDir ? path17.resolve(options.makerProjectDir) : void 0;
|
|
36980
37367
|
if (!makerProjectDir) {
|
|
36981
37368
|
return {
|
|
36982
37369
|
tools_visibility: "refresh_ai_client_if_missing",
|
|
@@ -37018,9 +37405,9 @@ function samePath2(left, right) {
|
|
|
37018
37405
|
return normalizePathForCompare3(left) === normalizePathForCompare3(right);
|
|
37019
37406
|
}
|
|
37020
37407
|
function normalizePathForCompare3(value) {
|
|
37021
|
-
const resolved =
|
|
37408
|
+
const resolved = path17.resolve(value);
|
|
37022
37409
|
try {
|
|
37023
|
-
return
|
|
37410
|
+
return fs16.realpathSync.native(resolved);
|
|
37024
37411
|
} catch {
|
|
37025
37412
|
return resolved;
|
|
37026
37413
|
}
|
|
@@ -37338,7 +37725,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
37338
37725
|
}
|
|
37339
37726
|
async function resolvePatSet(parsed, ctx) {
|
|
37340
37727
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
37341
|
-
const pat =
|
|
37728
|
+
const pat = fs16.readFileSync(0, "utf8").trim();
|
|
37342
37729
|
if (!pat) {
|
|
37343
37730
|
throw new Error("No PAT found on stdin.");
|
|
37344
37731
|
}
|
|
@@ -37368,7 +37755,7 @@ async function runMcpInstall(parsed, ctx) {
|
|
|
37368
37755
|
env: makerEnvOption(parsed),
|
|
37369
37756
|
pkg: MAKER_NPM_PACKAGE,
|
|
37370
37757
|
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
37371
|
-
cwd: explicitTargetDir ?
|
|
37758
|
+
cwd: explicitTargetDir ? path17.resolve(explicitTargetDir) : void 0
|
|
37372
37759
|
});
|
|
37373
37760
|
if (ctx.json) {
|
|
37374
37761
|
writeJson(results);
|
|
@@ -37427,7 +37814,7 @@ ${indent3(payload.stderr)}` : "",
|
|
|
37427
37814
|
);
|
|
37428
37815
|
}
|
|
37429
37816
|
async function runAgentsUpdate(parsed, ctx) {
|
|
37430
|
-
const targetDir =
|
|
37817
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
37431
37818
|
const result = updateMakerAgentsPolicy(targetDir);
|
|
37432
37819
|
if (ctx.json) {
|
|
37433
37820
|
writeJson(result);
|
|
@@ -37446,7 +37833,7 @@ async function runAgentsUpdate(parsed, ctx) {
|
|
|
37446
37833
|
async function runUpgrade(parsed, ctx) {
|
|
37447
37834
|
rejectPackageOption(parsed);
|
|
37448
37835
|
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
37449
|
-
const targetDir =
|
|
37836
|
+
const targetDir = path17.resolve(explicitTargetDir || process.cwd());
|
|
37450
37837
|
const env = makerEnvOption(parsed);
|
|
37451
37838
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
37452
37839
|
const installResults = installMcpConfigs({
|
|
@@ -37531,7 +37918,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
37531
37918
|
];
|
|
37532
37919
|
}
|
|
37533
37920
|
async function runDevKitUpdate(parsed, ctx) {
|
|
37534
|
-
const targetDir =
|
|
37921
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
37535
37922
|
const result = await installAiDevKit({
|
|
37536
37923
|
targetDir,
|
|
37537
37924
|
preserveExisting: false,
|
|
@@ -37543,7 +37930,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
37543
37930
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
37544
37931
|
}
|
|
37545
37932
|
async function runLogsWatch(parsed, ctx) {
|
|
37546
|
-
const targetDir =
|
|
37933
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
37547
37934
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
37548
37935
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
37549
37936
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -37553,9 +37940,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
37553
37940
|
serverUrl: stringOption(parsed, "server_url"),
|
|
37554
37941
|
env: makerEnvOption(parsed)
|
|
37555
37942
|
});
|
|
37556
|
-
const runtimeDir =
|
|
37557
|
-
const runtimeLog =
|
|
37558
|
-
const pidFile =
|
|
37943
|
+
const runtimeDir = path17.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
37944
|
+
const runtimeLog = path17.join(runtimeDir, "runtime.log");
|
|
37945
|
+
const pidFile = path17.join(runtimeDir, "watcher.pid");
|
|
37559
37946
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
37560
37947
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
37561
37948
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -37600,10 +37987,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
37600
37987
|
}
|
|
37601
37988
|
}
|
|
37602
37989
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
37603
|
-
|
|
37990
|
+
fs16.mkdirSync(path17.dirname(pidFile), { recursive: true });
|
|
37604
37991
|
const existingPid = readPidFile(pidFile);
|
|
37605
37992
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
37606
|
-
|
|
37993
|
+
fs16.writeFileSync(
|
|
37607
37994
|
pidFile,
|
|
37608
37995
|
`${JSON.stringify(
|
|
37609
37996
|
{
|
|
@@ -37621,10 +38008,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
37621
38008
|
return previous;
|
|
37622
38009
|
}
|
|
37623
38010
|
function readPidFile(pidFile) {
|
|
37624
|
-
if (!
|
|
38011
|
+
if (!fs16.existsSync(pidFile)) {
|
|
37625
38012
|
return void 0;
|
|
37626
38013
|
}
|
|
37627
|
-
const raw =
|
|
38014
|
+
const raw = fs16.readFileSync(pidFile, "utf8").trim();
|
|
37628
38015
|
let pid = Number(raw);
|
|
37629
38016
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
37630
38017
|
try {
|
|
@@ -37644,7 +38031,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
37644
38031
|
}
|
|
37645
38032
|
cleaned = true;
|
|
37646
38033
|
if (readPidFile(pidFile) === process.pid) {
|
|
37647
|
-
|
|
38034
|
+
fs16.rmSync(pidFile, { force: true });
|
|
37648
38035
|
}
|
|
37649
38036
|
};
|
|
37650
38037
|
process.once("exit", cleanup);
|
|
@@ -37795,7 +38182,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
37795
38182
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
37796
38183
|
});
|
|
37797
38184
|
writeDevKitStagedGitignore(
|
|
37798
|
-
|
|
38185
|
+
path17.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
37799
38186
|
listPresentDevKitManagedEntries(targetDir)
|
|
37800
38187
|
);
|
|
37801
38188
|
if (options.finalizeGitignore) {
|
|
@@ -37812,7 +38199,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
37812
38199
|
);
|
|
37813
38200
|
} catch (error2) {
|
|
37814
38201
|
writeDevKitStagedGitignore(
|
|
37815
|
-
|
|
38202
|
+
path17.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
37816
38203
|
listPresentDevKitManagedEntries(targetDir)
|
|
37817
38204
|
);
|
|
37818
38205
|
if (options.finalizeGitignore) {
|
|
@@ -37902,12 +38289,12 @@ function installMcpConfig(ide, options) {
|
|
|
37902
38289
|
}
|
|
37903
38290
|
function installMcpConfigUnsafe(ide, options) {
|
|
37904
38291
|
if (ide === "codex") {
|
|
37905
|
-
const configPath =
|
|
38292
|
+
const configPath = path17.join(os4.homedir(), ".codex", "config.toml");
|
|
37906
38293
|
const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
|
|
37907
38294
|
return [createMcpInstallResult(ide, "Codex", configPath, write)];
|
|
37908
38295
|
}
|
|
37909
38296
|
if (ide === "cursor") {
|
|
37910
|
-
const configPath =
|
|
38297
|
+
const configPath = path17.join(os4.homedir(), ".cursor", "mcp.json");
|
|
37911
38298
|
const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
|
|
37912
38299
|
return [createMcpInstallResult(ide, "Cursor", configPath, write)];
|
|
37913
38300
|
}
|
|
@@ -37925,7 +38312,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
37925
38312
|
];
|
|
37926
38313
|
}
|
|
37927
38314
|
}
|
|
37928
|
-
const configPath =
|
|
38315
|
+
const configPath = path17.join(os4.homedir(), ".claude.json");
|
|
37929
38316
|
const write = mergeJsonMcpConfig(configPath, claudeOptions);
|
|
37930
38317
|
return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
|
|
37931
38318
|
}
|
|
@@ -37939,7 +38326,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
37939
38326
|
}
|
|
37940
38327
|
if (ide === "opencode") {
|
|
37941
38328
|
const configPath = getOpenCodeMcpConfigPath();
|
|
37942
|
-
if (!
|
|
38329
|
+
if (!fs16.existsSync(configPath)) {
|
|
37943
38330
|
return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
|
|
37944
38331
|
}
|
|
37945
38332
|
const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
|
|
@@ -38007,7 +38394,7 @@ function getDefaultMcpInstallIdes() {
|
|
|
38007
38394
|
if (getTraeMcpInstallPaths().length > 0) {
|
|
38008
38395
|
ides.push("trae");
|
|
38009
38396
|
}
|
|
38010
|
-
if (
|
|
38397
|
+
if (fs16.existsSync(getOpenCodeMcpConfigPath())) {
|
|
38011
38398
|
ides.push("opencode");
|
|
38012
38399
|
}
|
|
38013
38400
|
if (getWorkBuddyMcpInstallPaths().length > 0) {
|
|
@@ -38024,7 +38411,7 @@ function getExistingTraeUserConfigPaths(paths) {
|
|
|
38024
38411
|
const seen = /* @__PURE__ */ new Set();
|
|
38025
38412
|
return paths.filter((configPath) => {
|
|
38026
38413
|
const key = normalizeConfigPathKey(configPath);
|
|
38027
|
-
if (seen.has(key) || !
|
|
38414
|
+
if (seen.has(key) || !fs16.existsSync(path17.dirname(configPath))) {
|
|
38028
38415
|
return false;
|
|
38029
38416
|
}
|
|
38030
38417
|
seen.add(key);
|
|
@@ -38035,7 +38422,7 @@ function getExistingConfigPaths(paths) {
|
|
|
38035
38422
|
const seen = /* @__PURE__ */ new Set();
|
|
38036
38423
|
return paths.filter((configPath) => {
|
|
38037
38424
|
const key = normalizeConfigPathKey(configPath);
|
|
38038
|
-
if (seen.has(key) || !
|
|
38425
|
+
if (seen.has(key) || !fs16.existsSync(configPath)) {
|
|
38039
38426
|
return false;
|
|
38040
38427
|
}
|
|
38041
38428
|
seen.add(key);
|
|
@@ -38043,65 +38430,65 @@ function getExistingConfigPaths(paths) {
|
|
|
38043
38430
|
});
|
|
38044
38431
|
}
|
|
38045
38432
|
function normalizeConfigPathKey(configPath) {
|
|
38046
|
-
const resolved =
|
|
38433
|
+
const resolved = path17.resolve(configPath);
|
|
38047
38434
|
return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
|
|
38048
38435
|
}
|
|
38049
38436
|
function getTraeSoloMcpConfigPaths() {
|
|
38050
38437
|
if (process.platform === "win32") {
|
|
38051
|
-
const roaming = process.env.APPDATA ||
|
|
38438
|
+
const roaming = process.env.APPDATA || path17.join(os4.homedir(), "AppData", "Roaming");
|
|
38052
38439
|
return [
|
|
38053
|
-
|
|
38054
|
-
|
|
38440
|
+
path17.join(roaming, "TRAE SOLO", "User", "mcp.json"),
|
|
38441
|
+
path17.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
|
|
38055
38442
|
];
|
|
38056
38443
|
}
|
|
38057
|
-
const appSupport =
|
|
38444
|
+
const appSupport = path17.join(os4.homedir(), "Library", "Application Support");
|
|
38058
38445
|
return [
|
|
38059
|
-
|
|
38060
|
-
|
|
38446
|
+
path17.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
|
|
38447
|
+
path17.join(appSupport, "TRAE SOLO", "User", "mcp.json")
|
|
38061
38448
|
];
|
|
38062
38449
|
}
|
|
38063
38450
|
function getTraeUnverifiedMcpConfigPaths() {
|
|
38064
38451
|
if (process.platform === "win32") {
|
|
38065
|
-
const roaming = process.env.APPDATA ||
|
|
38452
|
+
const roaming = process.env.APPDATA || path17.join(os4.homedir(), "AppData", "Roaming");
|
|
38066
38453
|
return [
|
|
38067
|
-
|
|
38068
|
-
|
|
38069
|
-
|
|
38454
|
+
path17.join(roaming, "Trae", "User", "mcp.json"),
|
|
38455
|
+
path17.join(roaming, "TRAE", "User", "mcp.json"),
|
|
38456
|
+
path17.join(roaming, "Trae CN", "User", "mcp.json")
|
|
38070
38457
|
];
|
|
38071
38458
|
}
|
|
38072
|
-
const appSupport =
|
|
38459
|
+
const appSupport = path17.join(os4.homedir(), "Library", "Application Support");
|
|
38073
38460
|
return [
|
|
38074
|
-
|
|
38075
|
-
|
|
38076
|
-
|
|
38461
|
+
path17.join(appSupport, "Trae", "User", "mcp.json"),
|
|
38462
|
+
path17.join(appSupport, "TRAE", "User", "mcp.json"),
|
|
38463
|
+
path17.join(appSupport, "Trae CN", "User", "mcp.json")
|
|
38077
38464
|
];
|
|
38078
38465
|
}
|
|
38079
38466
|
function getOpenCodeMcpConfigPath() {
|
|
38080
|
-
return
|
|
38467
|
+
return path17.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
38081
38468
|
}
|
|
38082
38469
|
function getWorkBuddyHome() {
|
|
38083
|
-
return
|
|
38470
|
+
return path17.join(os4.homedir(), ".workbuddy");
|
|
38084
38471
|
}
|
|
38085
38472
|
function shouldShowWorkBuddyTrustInspection() {
|
|
38086
|
-
return
|
|
38473
|
+
return fs16.existsSync(getWorkBuddyHome());
|
|
38087
38474
|
}
|
|
38088
38475
|
function getWorkBuddyMcpInstallPaths(options = {}) {
|
|
38089
|
-
const primary =
|
|
38090
|
-
if (
|
|
38476
|
+
const primary = path17.join(getWorkBuddyHome(), "mcp.json");
|
|
38477
|
+
if (fs16.existsSync(primary) || options.createPrimary) {
|
|
38091
38478
|
return [primary];
|
|
38092
38479
|
}
|
|
38093
|
-
const legacy =
|
|
38094
|
-
if (
|
|
38480
|
+
const legacy = path17.join(getWorkBuddyHome(), ".mcp.json");
|
|
38481
|
+
if (fs16.existsSync(legacy)) {
|
|
38095
38482
|
return [legacy];
|
|
38096
38483
|
}
|
|
38097
38484
|
return [];
|
|
38098
38485
|
}
|
|
38099
38486
|
function inspectWorkBuddyTrustState(mcpName) {
|
|
38100
38487
|
const workbuddyHome = getWorkBuddyHome();
|
|
38101
|
-
const connectorsDir =
|
|
38488
|
+
const connectorsDir = path17.join(workbuddyHome, "connectors");
|
|
38102
38489
|
const accounts = [];
|
|
38103
38490
|
const stateFiles = [];
|
|
38104
|
-
if (!
|
|
38491
|
+
if (!fs16.existsSync(connectorsDir)) {
|
|
38105
38492
|
return {
|
|
38106
38493
|
status: "not_found",
|
|
38107
38494
|
mcp_name: mcpName,
|
|
@@ -38111,12 +38498,12 @@ function inspectWorkBuddyTrustState(mcpName) {
|
|
|
38111
38498
|
accounts
|
|
38112
38499
|
};
|
|
38113
38500
|
}
|
|
38114
|
-
for (const entry of
|
|
38501
|
+
for (const entry of fs16.readdirSync(connectorsDir, { withFileTypes: true })) {
|
|
38115
38502
|
if (!entry.isDirectory()) {
|
|
38116
38503
|
continue;
|
|
38117
38504
|
}
|
|
38118
|
-
const statePath =
|
|
38119
|
-
if (!
|
|
38505
|
+
const statePath = path17.join(connectorsDir, entry.name, "connector-states.json");
|
|
38506
|
+
if (!fs16.existsSync(statePath)) {
|
|
38120
38507
|
continue;
|
|
38121
38508
|
}
|
|
38122
38509
|
stateFiles.push(statePath);
|
|
@@ -38191,7 +38578,7 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
38191
38578
|
);
|
|
38192
38579
|
}
|
|
38193
38580
|
function mergeOpenCodeMcpConfig(configPath, options) {
|
|
38194
|
-
const rawContent =
|
|
38581
|
+
const rawContent = fs16.readFileSync(configPath, "utf8");
|
|
38195
38582
|
const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
|
|
38196
38583
|
const existing = readJsonObject(configPath, { jsonc: true });
|
|
38197
38584
|
const mcp = asObject(existing.mcp);
|
|
@@ -38218,7 +38605,7 @@ function mergeOpenCodeMcpConfig(configPath, options) {
|
|
|
38218
38605
|
return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
|
|
38219
38606
|
}
|
|
38220
38607
|
function mergeCodexMcpConfig(configPath, options) {
|
|
38221
|
-
const existing =
|
|
38608
|
+
const existing = fs16.existsSync(configPath) ? fs16.readFileSync(configPath, "utf8") : "";
|
|
38222
38609
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
38223
38610
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
38224
38611
|
const launch = getNpxCliCommand(options.pkg);
|
|
@@ -38388,10 +38775,10 @@ function rejectPackageOption(parsed) {
|
|
|
38388
38775
|
}
|
|
38389
38776
|
}
|
|
38390
38777
|
function readJsonObject(filePath, options = {}) {
|
|
38391
|
-
if (!
|
|
38778
|
+
if (!fs16.existsSync(filePath)) {
|
|
38392
38779
|
return {};
|
|
38393
38780
|
}
|
|
38394
|
-
const raw =
|
|
38781
|
+
const raw = fs16.readFileSync(filePath, "utf8");
|
|
38395
38782
|
try {
|
|
38396
38783
|
const normalized = normalizeJsonConfigContent(raw, options);
|
|
38397
38784
|
const parsed = JSON.parse(normalized);
|
|
@@ -38411,25 +38798,25 @@ function asObject(value) {
|
|
|
38411
38798
|
return {};
|
|
38412
38799
|
}
|
|
38413
38800
|
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
38414
|
-
const existed =
|
|
38415
|
-
const previousContent = existed ?
|
|
38801
|
+
const existed = fs16.existsSync(filePath);
|
|
38802
|
+
const previousContent = existed ? fs16.readFileSync(filePath, "utf8") : void 0;
|
|
38416
38803
|
if (previousContent === nextContent) {
|
|
38417
38804
|
return { changed: false };
|
|
38418
38805
|
}
|
|
38419
38806
|
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
38420
|
-
|
|
38807
|
+
fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
|
|
38421
38808
|
if (previousContent !== void 0 && backupPath) {
|
|
38422
|
-
|
|
38809
|
+
fs16.writeFileSync(backupPath, previousContent, "utf8");
|
|
38423
38810
|
}
|
|
38424
38811
|
try {
|
|
38425
|
-
|
|
38426
|
-
validate == null ? void 0 : validate(
|
|
38812
|
+
fs16.writeFileSync(filePath, nextContent, "utf8");
|
|
38813
|
+
validate == null ? void 0 : validate(fs16.readFileSync(filePath, "utf8"));
|
|
38427
38814
|
return { changed: true, backupPath };
|
|
38428
38815
|
} catch (error2) {
|
|
38429
38816
|
if (previousContent !== void 0) {
|
|
38430
|
-
|
|
38817
|
+
fs16.writeFileSync(filePath, previousContent, "utf8");
|
|
38431
38818
|
} else {
|
|
38432
|
-
|
|
38819
|
+
fs16.rmSync(filePath, { force: true });
|
|
38433
38820
|
}
|
|
38434
38821
|
throw error2;
|
|
38435
38822
|
}
|
|
@@ -38576,10 +38963,10 @@ function formatMcpInstallMessage(label, configPath, write) {
|
|
|
38576
38963
|
].filter(Boolean).join("\n");
|
|
38577
38964
|
}
|
|
38578
38965
|
function saveInitState(targetDir, state) {
|
|
38579
|
-
|
|
38580
|
-
const key = crypto3.createHash("sha256").update(
|
|
38581
|
-
|
|
38582
|
-
|
|
38966
|
+
fs16.mkdirSync(getMakerHome(), { recursive: true });
|
|
38967
|
+
const key = crypto3.createHash("sha256").update(path17.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
38968
|
+
fs16.writeFileSync(
|
|
38969
|
+
path17.join(getMakerHome(), `init-state-${key}.json`),
|
|
38583
38970
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
38584
38971
|
`,
|
|
38585
38972
|
"utf8"
|
|
@@ -38727,7 +39114,7 @@ function makerEnvOption(parsed) {
|
|
|
38727
39114
|
return env;
|
|
38728
39115
|
}
|
|
38729
39116
|
const targetDir = stringOption(parsed, "target_dir");
|
|
38730
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
39117
|
+
return getMakerEnvironment(void 0, targetDir ? path17.resolve(targetDir) : process.cwd());
|
|
38731
39118
|
}
|
|
38732
39119
|
function mcpVerifyModeOption(parsed) {
|
|
38733
39120
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -40231,7 +40618,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
40231
40618
|
};
|
|
40232
40619
|
|
|
40233
40620
|
// src/mcp-proxy/proxy.ts
|
|
40234
|
-
import * as
|
|
40621
|
+
import * as path19 from "node:path";
|
|
40235
40622
|
import * as crypto6 from "node:crypto";
|
|
40236
40623
|
|
|
40237
40624
|
// src/mcp-proxy/cookieJar.ts
|
|
@@ -40413,8 +40800,8 @@ function createCookieFetch(cookieJar) {
|
|
|
40413
40800
|
}
|
|
40414
40801
|
|
|
40415
40802
|
// src/core/utils/logWriter.ts
|
|
40416
|
-
import * as
|
|
40417
|
-
import * as
|
|
40803
|
+
import * as fs17 from "node:fs";
|
|
40804
|
+
import * as path18 from "node:path";
|
|
40418
40805
|
import * as crypto5 from "node:crypto";
|
|
40419
40806
|
|
|
40420
40807
|
// src/core/types/log.ts
|
|
@@ -40455,7 +40842,7 @@ var LogWriter = class {
|
|
|
40455
40842
|
return;
|
|
40456
40843
|
}
|
|
40457
40844
|
try {
|
|
40458
|
-
await
|
|
40845
|
+
await fs17.promises.mkdir(this.config.logDir, { recursive: true });
|
|
40459
40846
|
await this.cleanupOldLogs();
|
|
40460
40847
|
this.initialized = true;
|
|
40461
40848
|
} catch (error2) {
|
|
@@ -40478,7 +40865,7 @@ var LogWriter = class {
|
|
|
40478
40865
|
*/
|
|
40479
40866
|
getLogFilePath(date5) {
|
|
40480
40867
|
const d = date5 || this.getCurrentDate();
|
|
40481
|
-
return
|
|
40868
|
+
return path18.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
40482
40869
|
}
|
|
40483
40870
|
/**
|
|
40484
40871
|
* 获取或创建写入流
|
|
@@ -40493,7 +40880,7 @@ var LogWriter = class {
|
|
|
40493
40880
|
}
|
|
40494
40881
|
this.currentDate = date5;
|
|
40495
40882
|
try {
|
|
40496
|
-
this.writeStream =
|
|
40883
|
+
this.writeStream = fs17.createWriteStream(this.getLogFilePath(date5), {
|
|
40497
40884
|
flags: "a",
|
|
40498
40885
|
encoding: "utf8"
|
|
40499
40886
|
});
|
|
@@ -40545,11 +40932,11 @@ var LogWriter = class {
|
|
|
40545
40932
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
40546
40933
|
try {
|
|
40547
40934
|
const filePath = this.getLogFilePath();
|
|
40548
|
-
const dir =
|
|
40549
|
-
if (!
|
|
40550
|
-
|
|
40935
|
+
const dir = path18.dirname(filePath);
|
|
40936
|
+
if (!fs17.existsSync(dir)) {
|
|
40937
|
+
fs17.mkdirSync(dir, { recursive: true });
|
|
40551
40938
|
}
|
|
40552
|
-
|
|
40939
|
+
fs17.appendFileSync(filePath, message, "utf8");
|
|
40553
40940
|
} catch {
|
|
40554
40941
|
}
|
|
40555
40942
|
}
|
|
@@ -40560,7 +40947,7 @@ var LogWriter = class {
|
|
|
40560
40947
|
async cleanupOldLogs() {
|
|
40561
40948
|
if (this.config.maxDays <= 0) return;
|
|
40562
40949
|
try {
|
|
40563
|
-
const files = await
|
|
40950
|
+
const files = await fs17.promises.readdir(this.config.logDir);
|
|
40564
40951
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
40565
40952
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
40566
40953
|
const prefix = this.config.prefix;
|
|
@@ -40575,7 +40962,7 @@ var LogWriter = class {
|
|
|
40575
40962
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
40576
40963
|
const fileDate = new Date(year, month - 1, day);
|
|
40577
40964
|
if (fileDate < cutoffDate) {
|
|
40578
|
-
await
|
|
40965
|
+
await fs17.promises.unlink(path18.join(this.config.logDir, file2));
|
|
40579
40966
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
40580
40967
|
`);
|
|
40581
40968
|
}
|
|
@@ -40649,10 +41036,10 @@ var TapTapMCPProxy = class {
|
|
|
40649
41036
|
const { user_id, project_id } = this.config.tenant;
|
|
40650
41037
|
let logDir;
|
|
40651
41038
|
if (user_id && project_id) {
|
|
40652
|
-
logDir =
|
|
41039
|
+
logDir = path19.join(logRoot, "proxy", user_id, project_id);
|
|
40653
41040
|
} else {
|
|
40654
41041
|
const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
40655
|
-
logDir =
|
|
41042
|
+
logDir = path19.join(logRoot, "proxy", kidHash);
|
|
40656
41043
|
}
|
|
40657
41044
|
return new LogWriter({
|
|
40658
41045
|
logDir,
|