@taptap/maker 0.0.23-beta.1 → 0.0.24-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/maker.js +386 -224
- 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,102 @@ 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) => !hasNonEmptyField(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
|
+
return [
|
|
33309
|
+
"Maker project initialization",
|
|
33310
|
+
"",
|
|
33311
|
+
"- status: missing_project_json",
|
|
33312
|
+
`- config: ${status.projectJsonPath}`,
|
|
33313
|
+
"- impact: get_ad_config and other remote project-config tools cannot read project metadata yet.",
|
|
33314
|
+
"- next_action: 先调用 maker_build_current_directory 构建一次,生成 .project/project.json 后再重试。"
|
|
33315
|
+
].join("\n");
|
|
33316
|
+
}
|
|
33317
|
+
function hasNonEmptyField(value, fieldName) {
|
|
33318
|
+
if (!value || typeof value !== "object") {
|
|
33319
|
+
return false;
|
|
33320
|
+
}
|
|
33321
|
+
if (Object.prototype.hasOwnProperty.call(value, fieldName)) {
|
|
33322
|
+
const fieldValue = value[fieldName];
|
|
33323
|
+
if (fieldValue !== void 0 && fieldValue !== null && String(fieldValue).trim() !== "") {
|
|
33324
|
+
return true;
|
|
33325
|
+
}
|
|
33326
|
+
}
|
|
33327
|
+
if (Array.isArray(value)) {
|
|
33328
|
+
return value.some((item) => hasNonEmptyField(item, fieldName));
|
|
33329
|
+
}
|
|
33330
|
+
return Object.values(value).some((item) => hasNonEmptyField(item, fieldName));
|
|
33331
|
+
}
|
|
33332
|
+
|
|
33333
|
+
// src/maker/server/proxyAssets.ts
|
|
33334
|
+
import fs14 from "node:fs";
|
|
33335
|
+
import path15 from "node:path";
|
|
33199
33336
|
var IMAGE_ASSET_DIRS = ["assets/image"];
|
|
33200
33337
|
var VIDEO_ASSET_DIRS = ["assets/video"];
|
|
33201
33338
|
var AUDIO_ASSET_DIRS = ["assets/audio"];
|
|
@@ -33479,13 +33616,13 @@ function findExistingMaterializedVideo(targetDir, options) {
|
|
|
33479
33616
|
function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
|
|
33480
33617
|
const candidates = [];
|
|
33481
33618
|
const absolutePath = stringField2(record2.absolutePath);
|
|
33482
|
-
if (absolutePath &&
|
|
33619
|
+
if (absolutePath && path15.isAbsolute(absolutePath)) {
|
|
33483
33620
|
candidates.push(absolutePath);
|
|
33484
33621
|
}
|
|
33485
|
-
candidates.push(
|
|
33622
|
+
candidates.push(path15.join(targetDir, ...localPath.split("/")));
|
|
33486
33623
|
for (const candidate of candidates) {
|
|
33487
33624
|
try {
|
|
33488
|
-
if (
|
|
33625
|
+
if (fs14.statSync(candidate).isFile()) {
|
|
33489
33626
|
return candidate;
|
|
33490
33627
|
}
|
|
33491
33628
|
} catch {
|
|
@@ -33650,7 +33787,7 @@ async function materialize3dFinalResult(options, toolName) {
|
|
|
33650
33787
|
try {
|
|
33651
33788
|
extractZip(
|
|
33652
33789
|
mdlMaterialized.absolutePath,
|
|
33653
|
-
|
|
33790
|
+
path15.join(options.targetDir, "assets"),
|
|
33654
33791
|
"3D model asset"
|
|
33655
33792
|
);
|
|
33656
33793
|
nextPayload.mdlExtracted = true;
|
|
@@ -33757,8 +33894,8 @@ async function materializeAsset(options) {
|
|
|
33757
33894
|
};
|
|
33758
33895
|
}
|
|
33759
33896
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
33760
|
-
|
|
33761
|
-
|
|
33897
|
+
fs14.mkdirSync(path15.dirname(absolutePath), { recursive: true });
|
|
33898
|
+
fs14.writeFileSync(absolutePath, bytes);
|
|
33762
33899
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
33763
33900
|
} catch (error2) {
|
|
33764
33901
|
return {
|
|
@@ -33772,12 +33909,12 @@ async function materializeAsset(options) {
|
|
|
33772
33909
|
function createUniqueAssetPath(options) {
|
|
33773
33910
|
const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
|
|
33774
33911
|
for (let index = 1; index <= 9999; index += 1) {
|
|
33775
|
-
const relativePath =
|
|
33912
|
+
const relativePath = path15.posix.join(
|
|
33776
33913
|
options.relativeDir,
|
|
33777
33914
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
33778
33915
|
);
|
|
33779
|
-
const absolutePath =
|
|
33780
|
-
if (!
|
|
33916
|
+
const absolutePath = path15.join(options.targetDir, ...relativePath.split("/"));
|
|
33917
|
+
if (!fs14.existsSync(absolutePath)) {
|
|
33781
33918
|
return { relativePath, absolutePath };
|
|
33782
33919
|
}
|
|
33783
33920
|
}
|
|
@@ -33955,7 +34092,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
33955
34092
|
if (!isKnownAssetPath(localPath, assetDirs)) {
|
|
33956
34093
|
return false;
|
|
33957
34094
|
}
|
|
33958
|
-
const basename =
|
|
34095
|
+
const basename = path15.posix.basename(localPath);
|
|
33959
34096
|
const stem = basename.replace(/\.[^.]+$/, "");
|
|
33960
34097
|
return basename === value || stem === value || record2.name === value || record2.taskId === value;
|
|
33961
34098
|
});
|
|
@@ -33968,13 +34105,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
33968
34105
|
}
|
|
33969
34106
|
function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
33970
34107
|
var _a3;
|
|
33971
|
-
const hasExtension = Boolean(
|
|
34108
|
+
const hasExtension = Boolean(path15.extname(value));
|
|
33972
34109
|
const candidates = [];
|
|
33973
34110
|
for (const assetDir of assetDirs) {
|
|
33974
|
-
const absoluteDir =
|
|
34111
|
+
const absoluteDir = path15.join(targetDir, ...assetDir.split("/"));
|
|
33975
34112
|
let entries;
|
|
33976
34113
|
try {
|
|
33977
|
-
entries =
|
|
34114
|
+
entries = fs14.readdirSync(absoluteDir);
|
|
33978
34115
|
} catch {
|
|
33979
34116
|
continue;
|
|
33980
34117
|
}
|
|
@@ -33983,11 +34120,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
33983
34120
|
if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
|
|
33984
34121
|
continue;
|
|
33985
34122
|
}
|
|
33986
|
-
const absolutePath =
|
|
34123
|
+
const absolutePath = path15.join(absoluteDir, entry);
|
|
33987
34124
|
try {
|
|
33988
34125
|
candidates.push({
|
|
33989
|
-
localPath:
|
|
33990
|
-
mtimeMs:
|
|
34126
|
+
localPath: path15.posix.join(assetDir, entry),
|
|
34127
|
+
mtimeMs: fs14.statSync(absolutePath).mtimeMs
|
|
33991
34128
|
});
|
|
33992
34129
|
} catch {
|
|
33993
34130
|
}
|
|
@@ -33997,7 +34134,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
33997
34134
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
|
|
33998
34135
|
}
|
|
33999
34136
|
function isKnownAssetPath(relativePath, assetDirs) {
|
|
34000
|
-
if (relativePath.startsWith("../") ||
|
|
34137
|
+
if (relativePath.startsWith("../") || path15.isAbsolute(relativePath)) {
|
|
34001
34138
|
return false;
|
|
34002
34139
|
}
|
|
34003
34140
|
return assetDirs.some(
|
|
@@ -34021,14 +34158,14 @@ function localAssetReferenceToDataUrl(options) {
|
|
|
34021
34158
|
}
|
|
34022
34159
|
let stat;
|
|
34023
34160
|
try {
|
|
34024
|
-
stat =
|
|
34161
|
+
stat = fs14.statSync(absolutePath);
|
|
34025
34162
|
} catch {
|
|
34026
34163
|
return void 0;
|
|
34027
34164
|
}
|
|
34028
34165
|
if (!stat.isFile() || stat.size > options.maxBytes) {
|
|
34029
34166
|
return void 0;
|
|
34030
34167
|
}
|
|
34031
|
-
const bytes =
|
|
34168
|
+
const bytes = fs14.readFileSync(absolutePath);
|
|
34032
34169
|
return `data:${mime};base64,${bytes.toString("base64")}`;
|
|
34033
34170
|
}
|
|
34034
34171
|
function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
@@ -34039,7 +34176,7 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
|
34039
34176
|
candidates.push(localPath);
|
|
34040
34177
|
}
|
|
34041
34178
|
}
|
|
34042
|
-
if (
|
|
34179
|
+
if (path15.isAbsolute(options.value)) {
|
|
34043
34180
|
candidates.push(options.value);
|
|
34044
34181
|
} else {
|
|
34045
34182
|
const localPath = resolveProjectRelativePath(targetDir, options.value);
|
|
@@ -34048,54 +34185,54 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
|
34048
34185
|
}
|
|
34049
34186
|
}
|
|
34050
34187
|
for (const candidate of candidates) {
|
|
34051
|
-
if (
|
|
34188
|
+
if (fs14.existsSync(candidate)) {
|
|
34052
34189
|
return candidate;
|
|
34053
34190
|
}
|
|
34054
34191
|
}
|
|
34055
34192
|
return void 0;
|
|
34056
34193
|
}
|
|
34057
34194
|
function resolveProjectRelativePath(targetDir, value) {
|
|
34058
|
-
const root =
|
|
34059
|
-
const absolutePath =
|
|
34060
|
-
const relativePath =
|
|
34061
|
-
const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${
|
|
34195
|
+
const root = path15.resolve(targetDir);
|
|
34196
|
+
const absolutePath = path15.resolve(root, value);
|
|
34197
|
+
const relativePath = path15.relative(root, absolutePath);
|
|
34198
|
+
const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path15.sep}`) || path15.isAbsolute(relativePath);
|
|
34062
34199
|
if (!escapesRoot) {
|
|
34063
34200
|
return absolutePath;
|
|
34064
34201
|
}
|
|
34065
34202
|
return void 0;
|
|
34066
34203
|
}
|
|
34067
34204
|
function dataUrlMimeForPath(filePath, mediaKind) {
|
|
34068
|
-
return DATA_URL_MIME_BY_EXTENSION[mediaKind][
|
|
34205
|
+
return DATA_URL_MIME_BY_EXTENSION[mediaKind][path15.extname(filePath).toLowerCase()];
|
|
34069
34206
|
}
|
|
34070
34207
|
function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
|
|
34071
34208
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
34072
34209
|
registry2[localPath] = record2;
|
|
34073
34210
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
34074
|
-
|
|
34075
|
-
|
|
34211
|
+
fs14.mkdirSync(path15.dirname(registryPath), { recursive: true });
|
|
34212
|
+
fs14.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
|
|
34076
34213
|
`, "utf8");
|
|
34077
34214
|
}
|
|
34078
34215
|
function readGeneratedAssetRegistry(targetDir) {
|
|
34079
34216
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
34080
|
-
if (!
|
|
34217
|
+
if (!fs14.existsSync(registryPath)) {
|
|
34081
34218
|
return {};
|
|
34082
34219
|
}
|
|
34083
34220
|
try {
|
|
34084
|
-
const parsed = JSON.parse(
|
|
34221
|
+
const parsed = JSON.parse(fs14.readFileSync(registryPath, "utf8"));
|
|
34085
34222
|
return isRecord(parsed) ? parsed : {};
|
|
34086
34223
|
} catch {
|
|
34087
34224
|
return {};
|
|
34088
34225
|
}
|
|
34089
34226
|
}
|
|
34090
34227
|
function getGeneratedAssetRegistryPath(targetDir) {
|
|
34091
|
-
return
|
|
34228
|
+
return path15.join(targetDir, ".maker", "assets", "generated-assets.json");
|
|
34092
34229
|
}
|
|
34093
34230
|
function normalizeAssetRegistryKey(targetDir, value) {
|
|
34094
34231
|
if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
|
|
34095
34232
|
return void 0;
|
|
34096
34233
|
}
|
|
34097
|
-
const relative =
|
|
34098
|
-
return relative.split(
|
|
34234
|
+
const relative = path15.isAbsolute(value) ? path15.relative(targetDir, value) : value;
|
|
34235
|
+
return relative.split(path15.sep).join("/");
|
|
34099
34236
|
}
|
|
34100
34237
|
function isRecord(value) {
|
|
34101
34238
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -34124,7 +34261,7 @@ function extensionFromUrl(url2) {
|
|
|
34124
34261
|
}
|
|
34125
34262
|
try {
|
|
34126
34263
|
const pathname = new URL(url2).pathname;
|
|
34127
|
-
const extension =
|
|
34264
|
+
const extension = path15.extname(pathname).replace(/^\./, "").toLowerCase();
|
|
34128
34265
|
return extension || void 0;
|
|
34129
34266
|
} catch {
|
|
34130
34267
|
return void 0;
|
|
@@ -34275,7 +34412,7 @@ function applyDefaults(config2) {
|
|
|
34275
34412
|
}
|
|
34276
34413
|
|
|
34277
34414
|
// src/maker/server/mcp.ts
|
|
34278
|
-
var VERSION = true ? "0.0.
|
|
34415
|
+
var VERSION = true ? "0.0.24-beta.1" : "dev";
|
|
34279
34416
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
34280
34417
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
34281
34418
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -34291,7 +34428,10 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
|
|
|
34291
34428
|
"query_video_task",
|
|
34292
34429
|
"text_to_music",
|
|
34293
34430
|
"create_3d_model_task",
|
|
34294
|
-
"query_3d_model_task"
|
|
34431
|
+
"query_3d_model_task",
|
|
34432
|
+
"generate_test_qrcode",
|
|
34433
|
+
"get_ad_config",
|
|
34434
|
+
"get_debug_feedbacks"
|
|
34295
34435
|
];
|
|
34296
34436
|
var MakerCloneFailedError = class extends Error {
|
|
34297
34437
|
constructor(targetDir, originalError) {
|
|
@@ -34436,7 +34576,7 @@ function decorateRemoteProxyToolInputSchema(inputSchema) {
|
|
|
34436
34576
|
...properties,
|
|
34437
34577
|
target_dir: {
|
|
34438
34578
|
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
|
|
34579
|
+
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
34580
|
}
|
|
34441
34581
|
}
|
|
34442
34582
|
};
|
|
@@ -34478,6 +34618,21 @@ function remoteProxyToolGuidance(toolName) {
|
|
|
34478
34618
|
"**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
34619
|
failurePolicy
|
|
34480
34620
|
].join(" ");
|
|
34621
|
+
case "get_ad_config":
|
|
34622
|
+
return [
|
|
34623
|
+
"**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.",
|
|
34624
|
+
failurePolicy
|
|
34625
|
+
].join(" ");
|
|
34626
|
+
case "generate_test_qrcode":
|
|
34627
|
+
return [
|
|
34628
|
+
"**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.",
|
|
34629
|
+
failurePolicy
|
|
34630
|
+
].join(" ");
|
|
34631
|
+
case "get_debug_feedbacks":
|
|
34632
|
+
return [
|
|
34633
|
+
"**Maker hint:** Fetch remote player feedback for the current Maker project, including related device logs and screenshots when available.",
|
|
34634
|
+
failurePolicy
|
|
34635
|
+
].join(" ");
|
|
34481
34636
|
default:
|
|
34482
34637
|
return void 0;
|
|
34483
34638
|
}
|
|
@@ -34775,7 +34930,7 @@ async function formatStatus(options = {}) {
|
|
|
34775
34930
|
const env = getMakerEnvironment(void 0, targetDir);
|
|
34776
34931
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
34777
34932
|
const mcpCwd = process.cwd();
|
|
34778
|
-
const mcpCwdIdentify =
|
|
34933
|
+
const mcpCwdIdentify = path16.resolve(mcpCwd) === path16.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
|
|
34779
34934
|
const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
|
|
34780
34935
|
const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
|
|
34781
34936
|
const pat = loadPat();
|
|
@@ -34838,6 +34993,10 @@ async function formatStatus(options = {}) {
|
|
|
34838
34993
|
"",
|
|
34839
34994
|
formatMakerGitDirectoryStatus(gitDirectoryStatus),
|
|
34840
34995
|
"",
|
|
34996
|
+
identify.projectRoot ? formatMakerProjectInitializationStatus(
|
|
34997
|
+
inspectMakerProjectInitialization(identify.projectRoot)
|
|
34998
|
+
) : "",
|
|
34999
|
+
"",
|
|
34841
35000
|
formatMakerClientRootsStatus(projectContext.roots),
|
|
34842
35001
|
"",
|
|
34843
35002
|
projectContext.source === "client_roots" ? "" : formatMakerToolRegistrationCwdStatus({
|
|
@@ -34908,10 +35067,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
|
|
|
34908
35067
|
if (!options.projectRoot) {
|
|
34909
35068
|
return "";
|
|
34910
35069
|
}
|
|
34911
|
-
const mcpCwd =
|
|
34912
|
-
const targetDir =
|
|
34913
|
-
const projectRoot =
|
|
34914
|
-
const mcpProjectRoot = options.mcpProjectRoot ?
|
|
35070
|
+
const mcpCwd = path16.resolve(options.mcpCwd);
|
|
35071
|
+
const targetDir = path16.resolve(options.targetDir);
|
|
35072
|
+
const projectRoot = path16.resolve(options.projectRoot);
|
|
35073
|
+
const mcpProjectRoot = options.mcpProjectRoot ? path16.resolve(options.mcpProjectRoot) : void 0;
|
|
34915
35074
|
if (mcpProjectRoot === projectRoot) {
|
|
34916
35075
|
return "";
|
|
34917
35076
|
}
|
|
@@ -35084,7 +35243,7 @@ function createServerClientRootsProvider(server) {
|
|
|
35084
35243
|
async function resolveMakerProjectContext(options = {}) {
|
|
35085
35244
|
if (options.targetDir) {
|
|
35086
35245
|
return {
|
|
35087
|
-
targetDir:
|
|
35246
|
+
targetDir: path16.resolve(options.targetDir),
|
|
35088
35247
|
source: "explicit_target_dir",
|
|
35089
35248
|
roots: { status: "not_requested", roots: [] }
|
|
35090
35249
|
};
|
|
@@ -35179,7 +35338,7 @@ function rootToLocalPath(root) {
|
|
|
35179
35338
|
if (url2.protocol !== "file:") {
|
|
35180
35339
|
return void 0;
|
|
35181
35340
|
}
|
|
35182
|
-
return
|
|
35341
|
+
return path16.resolve(fileURLToPath2(url2));
|
|
35183
35342
|
} catch {
|
|
35184
35343
|
return void 0;
|
|
35185
35344
|
}
|
|
@@ -35193,14 +35352,14 @@ function uniquePaths(values) {
|
|
|
35193
35352
|
continue;
|
|
35194
35353
|
}
|
|
35195
35354
|
seen.add(normalized);
|
|
35196
|
-
result.push(
|
|
35355
|
+
result.push(path16.resolve(value));
|
|
35197
35356
|
}
|
|
35198
35357
|
return result;
|
|
35199
35358
|
}
|
|
35200
35359
|
function normalizePathForCompare2(value) {
|
|
35201
|
-
const resolved =
|
|
35360
|
+
const resolved = path16.resolve(value);
|
|
35202
35361
|
try {
|
|
35203
|
-
return
|
|
35362
|
+
return fs15.realpathSync.native(resolved);
|
|
35204
35363
|
} catch {
|
|
35205
35364
|
return resolved;
|
|
35206
35365
|
}
|
|
@@ -35349,14 +35508,14 @@ function formatStatusProjectList(projects) {
|
|
|
35349
35508
|
].filter((line) => line !== void 0).join("\n");
|
|
35350
35509
|
}
|
|
35351
35510
|
function formatClonePartialStateLines(targetDir) {
|
|
35352
|
-
const resolvedTargetDir =
|
|
35511
|
+
const resolvedTargetDir = path16.resolve(targetDir);
|
|
35353
35512
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
35354
35513
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
35355
35514
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
35356
|
-
const stagedDevKitGitignorePath =
|
|
35515
|
+
const stagedDevKitGitignorePath = path16.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
35357
35516
|
const projectBound = Boolean(identify.projectId);
|
|
35358
35517
|
const gitInitialized = Boolean(
|
|
35359
|
-
gitStatus.isOwnGitRoot ||
|
|
35518
|
+
gitStatus.isOwnGitRoot || fs15.existsSync(path16.join(resolvedTargetDir, ".git"))
|
|
35360
35519
|
);
|
|
35361
35520
|
const safeToRetry = !projectBound;
|
|
35362
35521
|
return [
|
|
@@ -35370,7 +35529,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
35370
35529
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
35371
35530
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
35372
35531
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
35373
|
-
`- staged_dev_kit_gitignore: ${
|
|
35532
|
+
`- staged_dev_kit_gitignore: ${fs15.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
35374
35533
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
35375
35534
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
35376
35535
|
].filter(Boolean);
|
|
@@ -35446,12 +35605,12 @@ function resolveEmbeddedProxyCommand(options) {
|
|
|
35446
35605
|
}
|
|
35447
35606
|
return {
|
|
35448
35607
|
command: process.execPath,
|
|
35449
|
-
args: [
|
|
35608
|
+
args: [path16.resolve(makerEntry), "__maker-proxy"]
|
|
35450
35609
|
};
|
|
35451
35610
|
}
|
|
35452
35611
|
function resolveBundledMakerEntry() {
|
|
35453
|
-
const bundledEntry =
|
|
35454
|
-
return
|
|
35612
|
+
const bundledEntry = path16.resolve(__dirname, "../../../bin/taptap-maker");
|
|
35613
|
+
return fs15.existsSync(bundledEntry) ? bundledEntry : void 0;
|
|
35455
35614
|
}
|
|
35456
35615
|
function isUsableEmbeddedMakerEntry(entry) {
|
|
35457
35616
|
if (!entry) {
|
|
@@ -35777,18 +35936,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
35777
35936
|
}
|
|
35778
35937
|
}
|
|
35779
35938
|
async function startRuntimeLogWatch(buildResult) {
|
|
35780
|
-
const runtimeDir =
|
|
35781
|
-
|
|
35782
|
-
const stdoutLog =
|
|
35783
|
-
const stderrLog =
|
|
35784
|
-
const pidFile =
|
|
35939
|
+
const runtimeDir = path16.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
35940
|
+
fs15.mkdirSync(runtimeDir, { recursive: true });
|
|
35941
|
+
const stdoutLog = path16.join(runtimeDir, "watcher.out.log");
|
|
35942
|
+
const stderrLog = path16.join(runtimeDir, "watcher.err.log");
|
|
35943
|
+
const pidFile = path16.join(runtimeDir, "watcher.pid");
|
|
35785
35944
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
35786
|
-
const outFd =
|
|
35787
|
-
const errFd =
|
|
35945
|
+
const outFd = fs15.openSync(stdoutLog, "a");
|
|
35946
|
+
const errFd = fs15.openSync(stderrLog, "a");
|
|
35788
35947
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
35789
35948
|
if (previous.previousStopError) {
|
|
35790
|
-
|
|
35791
|
-
|
|
35949
|
+
fs15.closeSync(outFd);
|
|
35950
|
+
fs15.closeSync(errFd);
|
|
35792
35951
|
return {
|
|
35793
35952
|
started: false,
|
|
35794
35953
|
command: command.text,
|
|
@@ -35851,18 +36010,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
35851
36010
|
...previous
|
|
35852
36011
|
};
|
|
35853
36012
|
} finally {
|
|
35854
|
-
|
|
35855
|
-
|
|
36013
|
+
fs15.closeSync(outFd);
|
|
36014
|
+
fs15.closeSync(errFd);
|
|
35856
36015
|
}
|
|
35857
36016
|
}
|
|
35858
36017
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
35859
|
-
if (!
|
|
36018
|
+
if (!fs15.existsSync(pidFile)) {
|
|
35860
36019
|
return {};
|
|
35861
36020
|
}
|
|
35862
36021
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
35863
36022
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
35864
36023
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
35865
|
-
|
|
36024
|
+
fs15.rmSync(pidFile, { force: true });
|
|
35866
36025
|
return {};
|
|
35867
36026
|
}
|
|
35868
36027
|
try {
|
|
@@ -35870,7 +36029,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
35870
36029
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
35871
36030
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
35872
36031
|
if (!verifiedCommand) {
|
|
35873
|
-
|
|
36032
|
+
fs15.rmSync(pidFile, { force: true });
|
|
35874
36033
|
return {
|
|
35875
36034
|
previousPid: pid,
|
|
35876
36035
|
previousStopped: false,
|
|
@@ -35880,7 +36039,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
35880
36039
|
process.kill(pid, "SIGTERM");
|
|
35881
36040
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
35882
36041
|
if (stopped) {
|
|
35883
|
-
|
|
36042
|
+
fs15.rmSync(pidFile, { force: true });
|
|
35884
36043
|
return { previousPid: pid, previousStopped: true };
|
|
35885
36044
|
}
|
|
35886
36045
|
return {
|
|
@@ -35889,7 +36048,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
35889
36048
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
35890
36049
|
};
|
|
35891
36050
|
} catch (error2) {
|
|
35892
|
-
|
|
36051
|
+
fs15.rmSync(pidFile, { force: true });
|
|
35893
36052
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
35894
36053
|
if (code === "ESRCH") {
|
|
35895
36054
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -35902,7 +36061,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
35902
36061
|
}
|
|
35903
36062
|
}
|
|
35904
36063
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
35905
|
-
const raw =
|
|
36064
|
+
const raw = fs15.readFileSync(pidFile, "utf8").trim();
|
|
35906
36065
|
if (!raw) {
|
|
35907
36066
|
return null;
|
|
35908
36067
|
}
|
|
@@ -35918,7 +36077,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
35918
36077
|
}
|
|
35919
36078
|
}
|
|
35920
36079
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
35921
|
-
|
|
36080
|
+
fs15.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
35922
36081
|
`, "utf8");
|
|
35923
36082
|
}
|
|
35924
36083
|
function getProcessCommand(pid) {
|
|
@@ -36004,10 +36163,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
36004
36163
|
};
|
|
36005
36164
|
}
|
|
36006
36165
|
function resolveMakerCliEntry() {
|
|
36007
|
-
return process.argv[1] ||
|
|
36166
|
+
return process.argv[1] || path16.resolve(process.cwd(), "dist", "maker.js");
|
|
36008
36167
|
}
|
|
36009
36168
|
function getRuntimeLogFilePath(projectRoot) {
|
|
36010
|
-
return
|
|
36169
|
+
return path16.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
36011
36170
|
}
|
|
36012
36171
|
async function refreshMakerPreview(buildResult) {
|
|
36013
36172
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -36141,7 +36300,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
36141
36300
|
if (options.scriptsPath) {
|
|
36142
36301
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
36143
36302
|
}
|
|
36144
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
36303
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs15.existsSync(path16.join(projectRoot, "scripts", "main.lua"))) {
|
|
36145
36304
|
buildArgs.entry = "main.lua";
|
|
36146
36305
|
buildArgs.scriptsPath = "scripts";
|
|
36147
36306
|
}
|
|
@@ -36153,7 +36312,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
36153
36312
|
}
|
|
36154
36313
|
if (options.multiplayer) {
|
|
36155
36314
|
buildArgs.multiplayer = options.multiplayer;
|
|
36156
|
-
} else if (!
|
|
36315
|
+
} else if (!fs15.existsSync(path16.join(projectRoot, ".project", "settings.json"))) {
|
|
36157
36316
|
buildArgs.multiplayer = { enabled: false };
|
|
36158
36317
|
}
|
|
36159
36318
|
return buildArgs;
|
|
@@ -36315,11 +36474,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
36315
36474
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
36316
36475
|
`- watch_command: ${command}`,
|
|
36317
36476
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
36318
|
-
`- local_file: ${
|
|
36477
|
+
`- local_file: ${path16.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
36319
36478
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
36320
36479
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
36321
36480
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
36322
|
-
`- state_file: ${
|
|
36481
|
+
`- state_file: ${path16.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
36323
36482
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
36324
36483
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
36325
36484
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -36510,9 +36669,9 @@ function indent2(value) {
|
|
|
36510
36669
|
// src/maker/cli/commands.ts
|
|
36511
36670
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
36512
36671
|
import crypto3 from "node:crypto";
|
|
36513
|
-
import
|
|
36672
|
+
import fs16 from "node:fs";
|
|
36514
36673
|
import os4 from "node:os";
|
|
36515
|
-
import
|
|
36674
|
+
import path17 from "node:path";
|
|
36516
36675
|
import readline from "node:readline/promises";
|
|
36517
36676
|
import { stdin as input, stdout as output } from "node:process";
|
|
36518
36677
|
|
|
@@ -36658,7 +36817,7 @@ function formatError2(error2) {
|
|
|
36658
36817
|
}
|
|
36659
36818
|
|
|
36660
36819
|
// src/maker/cli/commands.ts
|
|
36661
|
-
var VERSION2 = true ? "0.0.
|
|
36820
|
+
var VERSION2 = true ? "0.0.24-beta.1" : "dev";
|
|
36662
36821
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
36663
36822
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
36664
36823
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
@@ -36793,7 +36952,7 @@ function toOptionKey(value) {
|
|
|
36793
36952
|
}
|
|
36794
36953
|
async function runInit(parsed, ctx) {
|
|
36795
36954
|
rejectPackageOption(parsed);
|
|
36796
|
-
const targetDir =
|
|
36955
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36797
36956
|
const env = makerEnvOption(parsed);
|
|
36798
36957
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
36799
36958
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -36886,7 +37045,7 @@ async function runInit(parsed, ctx) {
|
|
|
36886
37045
|
}
|
|
36887
37046
|
async function runDoctor(parsed, ctx) {
|
|
36888
37047
|
var _a3, _b;
|
|
36889
|
-
const targetDir =
|
|
37048
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36890
37049
|
const env = makerEnvOption(parsed);
|
|
36891
37050
|
const git = checkGitEnvironment();
|
|
36892
37051
|
const python = checkMakerPythonEnvironment();
|
|
@@ -36908,6 +37067,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
36908
37067
|
const mcpToolsAvailability = inspectMakerMcpToolsAvailability({
|
|
36909
37068
|
makerProjectDir: identify.projectRoot
|
|
36910
37069
|
});
|
|
37070
|
+
const projectInitialization = isProjectBound ? inspectMakerProjectInitialization(projectRoot) : void 0;
|
|
36911
37071
|
const workBuddyTrust = shouldShowWorkBuddyTrustInspection() ? inspectWorkBuddyTrustState(DEFAULT_MCP_NAME) : void 0;
|
|
36912
37072
|
if (ctx.json) {
|
|
36913
37073
|
writeJson({
|
|
@@ -36924,6 +37084,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
36924
37084
|
dev_kit: devKit,
|
|
36925
37085
|
dev_kit_update: devKitUpdate,
|
|
36926
37086
|
package_update: packageUpdate,
|
|
37087
|
+
project_initialization: projectInitialization,
|
|
36927
37088
|
mcp_tools_availability: mcpToolsAvailability,
|
|
36928
37089
|
...workBuddyTrust ? { workbuddy_trust: workBuddyTrust } : {},
|
|
36929
37090
|
orphan_process_check: orphanProcessCheck
|
|
@@ -36951,6 +37112,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
36951
37112
|
`- target_dir: ${targetDir}`,
|
|
36952
37113
|
`- project_id: ${identify.projectId || "(none)"}`,
|
|
36953
37114
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
37115
|
+
projectInitialization ? formatMakerProjectInitializationStatus(projectInitialization) : "",
|
|
36954
37116
|
isProjectBound ? formatMakerAgentsPolicyStatus(projectRoot) : "",
|
|
36955
37117
|
"",
|
|
36956
37118
|
"AI dev kit",
|
|
@@ -36974,9 +37136,9 @@ async function runDoctor(parsed, ctx) {
|
|
|
36974
37136
|
);
|
|
36975
37137
|
}
|
|
36976
37138
|
function inspectMakerMcpToolsAvailability(options) {
|
|
36977
|
-
const aiPwd =
|
|
37139
|
+
const aiPwd = path17.resolve(process.cwd());
|
|
36978
37140
|
const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
|
|
36979
|
-
const makerProjectDir = options.makerProjectDir ?
|
|
37141
|
+
const makerProjectDir = options.makerProjectDir ? path17.resolve(options.makerProjectDir) : void 0;
|
|
36980
37142
|
if (!makerProjectDir) {
|
|
36981
37143
|
return {
|
|
36982
37144
|
tools_visibility: "refresh_ai_client_if_missing",
|
|
@@ -37018,9 +37180,9 @@ function samePath2(left, right) {
|
|
|
37018
37180
|
return normalizePathForCompare3(left) === normalizePathForCompare3(right);
|
|
37019
37181
|
}
|
|
37020
37182
|
function normalizePathForCompare3(value) {
|
|
37021
|
-
const resolved =
|
|
37183
|
+
const resolved = path17.resolve(value);
|
|
37022
37184
|
try {
|
|
37023
|
-
return
|
|
37185
|
+
return fs16.realpathSync.native(resolved);
|
|
37024
37186
|
} catch {
|
|
37025
37187
|
return resolved;
|
|
37026
37188
|
}
|
|
@@ -37338,7 +37500,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
37338
37500
|
}
|
|
37339
37501
|
async function resolvePatSet(parsed, ctx) {
|
|
37340
37502
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
37341
|
-
const pat =
|
|
37503
|
+
const pat = fs16.readFileSync(0, "utf8").trim();
|
|
37342
37504
|
if (!pat) {
|
|
37343
37505
|
throw new Error("No PAT found on stdin.");
|
|
37344
37506
|
}
|
|
@@ -37368,7 +37530,7 @@ async function runMcpInstall(parsed, ctx) {
|
|
|
37368
37530
|
env: makerEnvOption(parsed),
|
|
37369
37531
|
pkg: MAKER_NPM_PACKAGE,
|
|
37370
37532
|
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
37371
|
-
cwd: explicitTargetDir ?
|
|
37533
|
+
cwd: explicitTargetDir ? path17.resolve(explicitTargetDir) : void 0
|
|
37372
37534
|
});
|
|
37373
37535
|
if (ctx.json) {
|
|
37374
37536
|
writeJson(results);
|
|
@@ -37427,7 +37589,7 @@ ${indent3(payload.stderr)}` : "",
|
|
|
37427
37589
|
);
|
|
37428
37590
|
}
|
|
37429
37591
|
async function runAgentsUpdate(parsed, ctx) {
|
|
37430
|
-
const targetDir =
|
|
37592
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
37431
37593
|
const result = updateMakerAgentsPolicy(targetDir);
|
|
37432
37594
|
if (ctx.json) {
|
|
37433
37595
|
writeJson(result);
|
|
@@ -37446,7 +37608,7 @@ async function runAgentsUpdate(parsed, ctx) {
|
|
|
37446
37608
|
async function runUpgrade(parsed, ctx) {
|
|
37447
37609
|
rejectPackageOption(parsed);
|
|
37448
37610
|
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
37449
|
-
const targetDir =
|
|
37611
|
+
const targetDir = path17.resolve(explicitTargetDir || process.cwd());
|
|
37450
37612
|
const env = makerEnvOption(parsed);
|
|
37451
37613
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
37452
37614
|
const installResults = installMcpConfigs({
|
|
@@ -37531,7 +37693,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
37531
37693
|
];
|
|
37532
37694
|
}
|
|
37533
37695
|
async function runDevKitUpdate(parsed, ctx) {
|
|
37534
|
-
const targetDir =
|
|
37696
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
37535
37697
|
const result = await installAiDevKit({
|
|
37536
37698
|
targetDir,
|
|
37537
37699
|
preserveExisting: false,
|
|
@@ -37543,7 +37705,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
37543
37705
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
37544
37706
|
}
|
|
37545
37707
|
async function runLogsWatch(parsed, ctx) {
|
|
37546
|
-
const targetDir =
|
|
37708
|
+
const targetDir = path17.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
37547
37709
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
37548
37710
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
37549
37711
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -37553,9 +37715,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
37553
37715
|
serverUrl: stringOption(parsed, "server_url"),
|
|
37554
37716
|
env: makerEnvOption(parsed)
|
|
37555
37717
|
});
|
|
37556
|
-
const runtimeDir =
|
|
37557
|
-
const runtimeLog =
|
|
37558
|
-
const pidFile =
|
|
37718
|
+
const runtimeDir = path17.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
37719
|
+
const runtimeLog = path17.join(runtimeDir, "runtime.log");
|
|
37720
|
+
const pidFile = path17.join(runtimeDir, "watcher.pid");
|
|
37559
37721
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
37560
37722
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
37561
37723
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -37600,10 +37762,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
37600
37762
|
}
|
|
37601
37763
|
}
|
|
37602
37764
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
37603
|
-
|
|
37765
|
+
fs16.mkdirSync(path17.dirname(pidFile), { recursive: true });
|
|
37604
37766
|
const existingPid = readPidFile(pidFile);
|
|
37605
37767
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
37606
|
-
|
|
37768
|
+
fs16.writeFileSync(
|
|
37607
37769
|
pidFile,
|
|
37608
37770
|
`${JSON.stringify(
|
|
37609
37771
|
{
|
|
@@ -37621,10 +37783,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
37621
37783
|
return previous;
|
|
37622
37784
|
}
|
|
37623
37785
|
function readPidFile(pidFile) {
|
|
37624
|
-
if (!
|
|
37786
|
+
if (!fs16.existsSync(pidFile)) {
|
|
37625
37787
|
return void 0;
|
|
37626
37788
|
}
|
|
37627
|
-
const raw =
|
|
37789
|
+
const raw = fs16.readFileSync(pidFile, "utf8").trim();
|
|
37628
37790
|
let pid = Number(raw);
|
|
37629
37791
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
37630
37792
|
try {
|
|
@@ -37644,7 +37806,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
37644
37806
|
}
|
|
37645
37807
|
cleaned = true;
|
|
37646
37808
|
if (readPidFile(pidFile) === process.pid) {
|
|
37647
|
-
|
|
37809
|
+
fs16.rmSync(pidFile, { force: true });
|
|
37648
37810
|
}
|
|
37649
37811
|
};
|
|
37650
37812
|
process.once("exit", cleanup);
|
|
@@ -37795,7 +37957,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
37795
37957
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
37796
37958
|
});
|
|
37797
37959
|
writeDevKitStagedGitignore(
|
|
37798
|
-
|
|
37960
|
+
path17.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
37799
37961
|
listPresentDevKitManagedEntries(targetDir)
|
|
37800
37962
|
);
|
|
37801
37963
|
if (options.finalizeGitignore) {
|
|
@@ -37812,7 +37974,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
37812
37974
|
);
|
|
37813
37975
|
} catch (error2) {
|
|
37814
37976
|
writeDevKitStagedGitignore(
|
|
37815
|
-
|
|
37977
|
+
path17.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
37816
37978
|
listPresentDevKitManagedEntries(targetDir)
|
|
37817
37979
|
);
|
|
37818
37980
|
if (options.finalizeGitignore) {
|
|
@@ -37902,12 +38064,12 @@ function installMcpConfig(ide, options) {
|
|
|
37902
38064
|
}
|
|
37903
38065
|
function installMcpConfigUnsafe(ide, options) {
|
|
37904
38066
|
if (ide === "codex") {
|
|
37905
|
-
const configPath =
|
|
38067
|
+
const configPath = path17.join(os4.homedir(), ".codex", "config.toml");
|
|
37906
38068
|
const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
|
|
37907
38069
|
return [createMcpInstallResult(ide, "Codex", configPath, write)];
|
|
37908
38070
|
}
|
|
37909
38071
|
if (ide === "cursor") {
|
|
37910
|
-
const configPath =
|
|
38072
|
+
const configPath = path17.join(os4.homedir(), ".cursor", "mcp.json");
|
|
37911
38073
|
const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
|
|
37912
38074
|
return [createMcpInstallResult(ide, "Cursor", configPath, write)];
|
|
37913
38075
|
}
|
|
@@ -37925,7 +38087,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
37925
38087
|
];
|
|
37926
38088
|
}
|
|
37927
38089
|
}
|
|
37928
|
-
const configPath =
|
|
38090
|
+
const configPath = path17.join(os4.homedir(), ".claude.json");
|
|
37929
38091
|
const write = mergeJsonMcpConfig(configPath, claudeOptions);
|
|
37930
38092
|
return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
|
|
37931
38093
|
}
|
|
@@ -37939,7 +38101,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
37939
38101
|
}
|
|
37940
38102
|
if (ide === "opencode") {
|
|
37941
38103
|
const configPath = getOpenCodeMcpConfigPath();
|
|
37942
|
-
if (!
|
|
38104
|
+
if (!fs16.existsSync(configPath)) {
|
|
37943
38105
|
return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
|
|
37944
38106
|
}
|
|
37945
38107
|
const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
|
|
@@ -38007,7 +38169,7 @@ function getDefaultMcpInstallIdes() {
|
|
|
38007
38169
|
if (getTraeMcpInstallPaths().length > 0) {
|
|
38008
38170
|
ides.push("trae");
|
|
38009
38171
|
}
|
|
38010
|
-
if (
|
|
38172
|
+
if (fs16.existsSync(getOpenCodeMcpConfigPath())) {
|
|
38011
38173
|
ides.push("opencode");
|
|
38012
38174
|
}
|
|
38013
38175
|
if (getWorkBuddyMcpInstallPaths().length > 0) {
|
|
@@ -38024,7 +38186,7 @@ function getExistingTraeUserConfigPaths(paths) {
|
|
|
38024
38186
|
const seen = /* @__PURE__ */ new Set();
|
|
38025
38187
|
return paths.filter((configPath) => {
|
|
38026
38188
|
const key = normalizeConfigPathKey(configPath);
|
|
38027
|
-
if (seen.has(key) || !
|
|
38189
|
+
if (seen.has(key) || !fs16.existsSync(path17.dirname(configPath))) {
|
|
38028
38190
|
return false;
|
|
38029
38191
|
}
|
|
38030
38192
|
seen.add(key);
|
|
@@ -38035,7 +38197,7 @@ function getExistingConfigPaths(paths) {
|
|
|
38035
38197
|
const seen = /* @__PURE__ */ new Set();
|
|
38036
38198
|
return paths.filter((configPath) => {
|
|
38037
38199
|
const key = normalizeConfigPathKey(configPath);
|
|
38038
|
-
if (seen.has(key) || !
|
|
38200
|
+
if (seen.has(key) || !fs16.existsSync(configPath)) {
|
|
38039
38201
|
return false;
|
|
38040
38202
|
}
|
|
38041
38203
|
seen.add(key);
|
|
@@ -38043,65 +38205,65 @@ function getExistingConfigPaths(paths) {
|
|
|
38043
38205
|
});
|
|
38044
38206
|
}
|
|
38045
38207
|
function normalizeConfigPathKey(configPath) {
|
|
38046
|
-
const resolved =
|
|
38208
|
+
const resolved = path17.resolve(configPath);
|
|
38047
38209
|
return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
|
|
38048
38210
|
}
|
|
38049
38211
|
function getTraeSoloMcpConfigPaths() {
|
|
38050
38212
|
if (process.platform === "win32") {
|
|
38051
|
-
const roaming = process.env.APPDATA ||
|
|
38213
|
+
const roaming = process.env.APPDATA || path17.join(os4.homedir(), "AppData", "Roaming");
|
|
38052
38214
|
return [
|
|
38053
|
-
|
|
38054
|
-
|
|
38215
|
+
path17.join(roaming, "TRAE SOLO", "User", "mcp.json"),
|
|
38216
|
+
path17.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
|
|
38055
38217
|
];
|
|
38056
38218
|
}
|
|
38057
|
-
const appSupport =
|
|
38219
|
+
const appSupport = path17.join(os4.homedir(), "Library", "Application Support");
|
|
38058
38220
|
return [
|
|
38059
|
-
|
|
38060
|
-
|
|
38221
|
+
path17.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
|
|
38222
|
+
path17.join(appSupport, "TRAE SOLO", "User", "mcp.json")
|
|
38061
38223
|
];
|
|
38062
38224
|
}
|
|
38063
38225
|
function getTraeUnverifiedMcpConfigPaths() {
|
|
38064
38226
|
if (process.platform === "win32") {
|
|
38065
|
-
const roaming = process.env.APPDATA ||
|
|
38227
|
+
const roaming = process.env.APPDATA || path17.join(os4.homedir(), "AppData", "Roaming");
|
|
38066
38228
|
return [
|
|
38067
|
-
|
|
38068
|
-
|
|
38069
|
-
|
|
38229
|
+
path17.join(roaming, "Trae", "User", "mcp.json"),
|
|
38230
|
+
path17.join(roaming, "TRAE", "User", "mcp.json"),
|
|
38231
|
+
path17.join(roaming, "Trae CN", "User", "mcp.json")
|
|
38070
38232
|
];
|
|
38071
38233
|
}
|
|
38072
|
-
const appSupport =
|
|
38234
|
+
const appSupport = path17.join(os4.homedir(), "Library", "Application Support");
|
|
38073
38235
|
return [
|
|
38074
|
-
|
|
38075
|
-
|
|
38076
|
-
|
|
38236
|
+
path17.join(appSupport, "Trae", "User", "mcp.json"),
|
|
38237
|
+
path17.join(appSupport, "TRAE", "User", "mcp.json"),
|
|
38238
|
+
path17.join(appSupport, "Trae CN", "User", "mcp.json")
|
|
38077
38239
|
];
|
|
38078
38240
|
}
|
|
38079
38241
|
function getOpenCodeMcpConfigPath() {
|
|
38080
|
-
return
|
|
38242
|
+
return path17.join(os4.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
38081
38243
|
}
|
|
38082
38244
|
function getWorkBuddyHome() {
|
|
38083
|
-
return
|
|
38245
|
+
return path17.join(os4.homedir(), ".workbuddy");
|
|
38084
38246
|
}
|
|
38085
38247
|
function shouldShowWorkBuddyTrustInspection() {
|
|
38086
|
-
return
|
|
38248
|
+
return fs16.existsSync(getWorkBuddyHome());
|
|
38087
38249
|
}
|
|
38088
38250
|
function getWorkBuddyMcpInstallPaths(options = {}) {
|
|
38089
|
-
const primary =
|
|
38090
|
-
if (
|
|
38251
|
+
const primary = path17.join(getWorkBuddyHome(), "mcp.json");
|
|
38252
|
+
if (fs16.existsSync(primary) || options.createPrimary) {
|
|
38091
38253
|
return [primary];
|
|
38092
38254
|
}
|
|
38093
|
-
const legacy =
|
|
38094
|
-
if (
|
|
38255
|
+
const legacy = path17.join(getWorkBuddyHome(), ".mcp.json");
|
|
38256
|
+
if (fs16.existsSync(legacy)) {
|
|
38095
38257
|
return [legacy];
|
|
38096
38258
|
}
|
|
38097
38259
|
return [];
|
|
38098
38260
|
}
|
|
38099
38261
|
function inspectWorkBuddyTrustState(mcpName) {
|
|
38100
38262
|
const workbuddyHome = getWorkBuddyHome();
|
|
38101
|
-
const connectorsDir =
|
|
38263
|
+
const connectorsDir = path17.join(workbuddyHome, "connectors");
|
|
38102
38264
|
const accounts = [];
|
|
38103
38265
|
const stateFiles = [];
|
|
38104
|
-
if (!
|
|
38266
|
+
if (!fs16.existsSync(connectorsDir)) {
|
|
38105
38267
|
return {
|
|
38106
38268
|
status: "not_found",
|
|
38107
38269
|
mcp_name: mcpName,
|
|
@@ -38111,12 +38273,12 @@ function inspectWorkBuddyTrustState(mcpName) {
|
|
|
38111
38273
|
accounts
|
|
38112
38274
|
};
|
|
38113
38275
|
}
|
|
38114
|
-
for (const entry of
|
|
38276
|
+
for (const entry of fs16.readdirSync(connectorsDir, { withFileTypes: true })) {
|
|
38115
38277
|
if (!entry.isDirectory()) {
|
|
38116
38278
|
continue;
|
|
38117
38279
|
}
|
|
38118
|
-
const statePath =
|
|
38119
|
-
if (!
|
|
38280
|
+
const statePath = path17.join(connectorsDir, entry.name, "connector-states.json");
|
|
38281
|
+
if (!fs16.existsSync(statePath)) {
|
|
38120
38282
|
continue;
|
|
38121
38283
|
}
|
|
38122
38284
|
stateFiles.push(statePath);
|
|
@@ -38191,7 +38353,7 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
38191
38353
|
);
|
|
38192
38354
|
}
|
|
38193
38355
|
function mergeOpenCodeMcpConfig(configPath, options) {
|
|
38194
|
-
const rawContent =
|
|
38356
|
+
const rawContent = fs16.readFileSync(configPath, "utf8");
|
|
38195
38357
|
const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
|
|
38196
38358
|
const existing = readJsonObject(configPath, { jsonc: true });
|
|
38197
38359
|
const mcp = asObject(existing.mcp);
|
|
@@ -38218,7 +38380,7 @@ function mergeOpenCodeMcpConfig(configPath, options) {
|
|
|
38218
38380
|
return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
|
|
38219
38381
|
}
|
|
38220
38382
|
function mergeCodexMcpConfig(configPath, options) {
|
|
38221
|
-
const existing =
|
|
38383
|
+
const existing = fs16.existsSync(configPath) ? fs16.readFileSync(configPath, "utf8") : "";
|
|
38222
38384
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
38223
38385
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
38224
38386
|
const launch = getNpxCliCommand(options.pkg);
|
|
@@ -38388,10 +38550,10 @@ function rejectPackageOption(parsed) {
|
|
|
38388
38550
|
}
|
|
38389
38551
|
}
|
|
38390
38552
|
function readJsonObject(filePath, options = {}) {
|
|
38391
|
-
if (!
|
|
38553
|
+
if (!fs16.existsSync(filePath)) {
|
|
38392
38554
|
return {};
|
|
38393
38555
|
}
|
|
38394
|
-
const raw =
|
|
38556
|
+
const raw = fs16.readFileSync(filePath, "utf8");
|
|
38395
38557
|
try {
|
|
38396
38558
|
const normalized = normalizeJsonConfigContent(raw, options);
|
|
38397
38559
|
const parsed = JSON.parse(normalized);
|
|
@@ -38411,25 +38573,25 @@ function asObject(value) {
|
|
|
38411
38573
|
return {};
|
|
38412
38574
|
}
|
|
38413
38575
|
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
38414
|
-
const existed =
|
|
38415
|
-
const previousContent = existed ?
|
|
38576
|
+
const existed = fs16.existsSync(filePath);
|
|
38577
|
+
const previousContent = existed ? fs16.readFileSync(filePath, "utf8") : void 0;
|
|
38416
38578
|
if (previousContent === nextContent) {
|
|
38417
38579
|
return { changed: false };
|
|
38418
38580
|
}
|
|
38419
38581
|
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
38420
|
-
|
|
38582
|
+
fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
|
|
38421
38583
|
if (previousContent !== void 0 && backupPath) {
|
|
38422
|
-
|
|
38584
|
+
fs16.writeFileSync(backupPath, previousContent, "utf8");
|
|
38423
38585
|
}
|
|
38424
38586
|
try {
|
|
38425
|
-
|
|
38426
|
-
validate == null ? void 0 : validate(
|
|
38587
|
+
fs16.writeFileSync(filePath, nextContent, "utf8");
|
|
38588
|
+
validate == null ? void 0 : validate(fs16.readFileSync(filePath, "utf8"));
|
|
38427
38589
|
return { changed: true, backupPath };
|
|
38428
38590
|
} catch (error2) {
|
|
38429
38591
|
if (previousContent !== void 0) {
|
|
38430
|
-
|
|
38592
|
+
fs16.writeFileSync(filePath, previousContent, "utf8");
|
|
38431
38593
|
} else {
|
|
38432
|
-
|
|
38594
|
+
fs16.rmSync(filePath, { force: true });
|
|
38433
38595
|
}
|
|
38434
38596
|
throw error2;
|
|
38435
38597
|
}
|
|
@@ -38576,10 +38738,10 @@ function formatMcpInstallMessage(label, configPath, write) {
|
|
|
38576
38738
|
].filter(Boolean).join("\n");
|
|
38577
38739
|
}
|
|
38578
38740
|
function saveInitState(targetDir, state) {
|
|
38579
|
-
|
|
38580
|
-
const key = crypto3.createHash("sha256").update(
|
|
38581
|
-
|
|
38582
|
-
|
|
38741
|
+
fs16.mkdirSync(getMakerHome(), { recursive: true });
|
|
38742
|
+
const key = crypto3.createHash("sha256").update(path17.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
38743
|
+
fs16.writeFileSync(
|
|
38744
|
+
path17.join(getMakerHome(), `init-state-${key}.json`),
|
|
38583
38745
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
38584
38746
|
`,
|
|
38585
38747
|
"utf8"
|
|
@@ -38727,7 +38889,7 @@ function makerEnvOption(parsed) {
|
|
|
38727
38889
|
return env;
|
|
38728
38890
|
}
|
|
38729
38891
|
const targetDir = stringOption(parsed, "target_dir");
|
|
38730
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
38892
|
+
return getMakerEnvironment(void 0, targetDir ? path17.resolve(targetDir) : process.cwd());
|
|
38731
38893
|
}
|
|
38732
38894
|
function mcpVerifyModeOption(parsed) {
|
|
38733
38895
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -40231,7 +40393,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
40231
40393
|
};
|
|
40232
40394
|
|
|
40233
40395
|
// src/mcp-proxy/proxy.ts
|
|
40234
|
-
import * as
|
|
40396
|
+
import * as path19 from "node:path";
|
|
40235
40397
|
import * as crypto6 from "node:crypto";
|
|
40236
40398
|
|
|
40237
40399
|
// src/mcp-proxy/cookieJar.ts
|
|
@@ -40413,8 +40575,8 @@ function createCookieFetch(cookieJar) {
|
|
|
40413
40575
|
}
|
|
40414
40576
|
|
|
40415
40577
|
// src/core/utils/logWriter.ts
|
|
40416
|
-
import * as
|
|
40417
|
-
import * as
|
|
40578
|
+
import * as fs17 from "node:fs";
|
|
40579
|
+
import * as path18 from "node:path";
|
|
40418
40580
|
import * as crypto5 from "node:crypto";
|
|
40419
40581
|
|
|
40420
40582
|
// src/core/types/log.ts
|
|
@@ -40455,7 +40617,7 @@ var LogWriter = class {
|
|
|
40455
40617
|
return;
|
|
40456
40618
|
}
|
|
40457
40619
|
try {
|
|
40458
|
-
await
|
|
40620
|
+
await fs17.promises.mkdir(this.config.logDir, { recursive: true });
|
|
40459
40621
|
await this.cleanupOldLogs();
|
|
40460
40622
|
this.initialized = true;
|
|
40461
40623
|
} catch (error2) {
|
|
@@ -40478,7 +40640,7 @@ var LogWriter = class {
|
|
|
40478
40640
|
*/
|
|
40479
40641
|
getLogFilePath(date5) {
|
|
40480
40642
|
const d = date5 || this.getCurrentDate();
|
|
40481
|
-
return
|
|
40643
|
+
return path18.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
40482
40644
|
}
|
|
40483
40645
|
/**
|
|
40484
40646
|
* 获取或创建写入流
|
|
@@ -40493,7 +40655,7 @@ var LogWriter = class {
|
|
|
40493
40655
|
}
|
|
40494
40656
|
this.currentDate = date5;
|
|
40495
40657
|
try {
|
|
40496
|
-
this.writeStream =
|
|
40658
|
+
this.writeStream = fs17.createWriteStream(this.getLogFilePath(date5), {
|
|
40497
40659
|
flags: "a",
|
|
40498
40660
|
encoding: "utf8"
|
|
40499
40661
|
});
|
|
@@ -40545,11 +40707,11 @@ var LogWriter = class {
|
|
|
40545
40707
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
40546
40708
|
try {
|
|
40547
40709
|
const filePath = this.getLogFilePath();
|
|
40548
|
-
const dir =
|
|
40549
|
-
if (!
|
|
40550
|
-
|
|
40710
|
+
const dir = path18.dirname(filePath);
|
|
40711
|
+
if (!fs17.existsSync(dir)) {
|
|
40712
|
+
fs17.mkdirSync(dir, { recursive: true });
|
|
40551
40713
|
}
|
|
40552
|
-
|
|
40714
|
+
fs17.appendFileSync(filePath, message, "utf8");
|
|
40553
40715
|
} catch {
|
|
40554
40716
|
}
|
|
40555
40717
|
}
|
|
@@ -40560,7 +40722,7 @@ var LogWriter = class {
|
|
|
40560
40722
|
async cleanupOldLogs() {
|
|
40561
40723
|
if (this.config.maxDays <= 0) return;
|
|
40562
40724
|
try {
|
|
40563
|
-
const files = await
|
|
40725
|
+
const files = await fs17.promises.readdir(this.config.logDir);
|
|
40564
40726
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
40565
40727
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
40566
40728
|
const prefix = this.config.prefix;
|
|
@@ -40575,7 +40737,7 @@ var LogWriter = class {
|
|
|
40575
40737
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
40576
40738
|
const fileDate = new Date(year, month - 1, day);
|
|
40577
40739
|
if (fileDate < cutoffDate) {
|
|
40578
|
-
await
|
|
40740
|
+
await fs17.promises.unlink(path18.join(this.config.logDir, file2));
|
|
40579
40741
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
40580
40742
|
`);
|
|
40581
40743
|
}
|
|
@@ -40649,10 +40811,10 @@ var TapTapMCPProxy = class {
|
|
|
40649
40811
|
const { user_id, project_id } = this.config.tenant;
|
|
40650
40812
|
let logDir;
|
|
40651
40813
|
if (user_id && project_id) {
|
|
40652
|
-
logDir =
|
|
40814
|
+
logDir = path19.join(logRoot, "proxy", user_id, project_id);
|
|
40653
40815
|
} else {
|
|
40654
40816
|
const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
40655
|
-
logDir =
|
|
40817
|
+
logDir = path19.join(logRoot, "proxy", kidHash);
|
|
40656
40818
|
}
|
|
40657
40819
|
return new LogWriter({
|
|
40658
40820
|
logDir,
|