@taptap/maker 0.0.32-beta.1 → 0.0.32-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/maker.js +2112 -454
- package/docs/MAKER_MCP_CONNECTION_TROUBLESHOOTING.md +28 -5
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +30 -21
package/dist/maker.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// TapTap Maker MCP - Standalone Bundle
|
|
3
|
+
// TapTap Maker MCP version: 0.0.32-beta.3
|
|
3
4
|
import { createRequire } from 'node:module';
|
|
4
5
|
const require = createRequire(import.meta.url);
|
|
5
6
|
const __MAKER_BUNDLE_URL__ = import.meta.url;
|
|
@@ -3233,8 +3234,8 @@ var require_utils = __commonJS({
|
|
|
3233
3234
|
}
|
|
3234
3235
|
return ind;
|
|
3235
3236
|
}
|
|
3236
|
-
function removeDotSegments(
|
|
3237
|
-
let input2 =
|
|
3237
|
+
function removeDotSegments(path29) {
|
|
3238
|
+
let input2 = path29;
|
|
3238
3239
|
const output2 = [];
|
|
3239
3240
|
let nextSlash = -1;
|
|
3240
3241
|
let len = 0;
|
|
@@ -3433,8 +3434,8 @@ var require_schemes = __commonJS({
|
|
|
3433
3434
|
wsComponent.secure = void 0;
|
|
3434
3435
|
}
|
|
3435
3436
|
if (wsComponent.resourceName) {
|
|
3436
|
-
const [
|
|
3437
|
-
wsComponent.path =
|
|
3437
|
+
const [path29, query] = wsComponent.resourceName.split("?");
|
|
3438
|
+
wsComponent.path = path29 && path29 !== "/" ? path29 : void 0;
|
|
3438
3439
|
wsComponent.query = query;
|
|
3439
3440
|
wsComponent.resourceName = void 0;
|
|
3440
3441
|
}
|
|
@@ -12491,12 +12492,12 @@ var require_dist = __commonJS({
|
|
|
12491
12492
|
throw new Error(`Unknown format "${name}"`);
|
|
12492
12493
|
return f;
|
|
12493
12494
|
};
|
|
12494
|
-
function addFormats(ajv, list,
|
|
12495
|
+
function addFormats(ajv, list, fs27, exportName) {
|
|
12495
12496
|
var _a3;
|
|
12496
12497
|
var _b;
|
|
12497
12498
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
12498
12499
|
for (const f of list)
|
|
12499
|
-
ajv.addFormat(f,
|
|
12500
|
+
ajv.addFormat(f, fs27[f]);
|
|
12500
12501
|
}
|
|
12501
12502
|
module.exports = exports = formatsPlugin;
|
|
12502
12503
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -12509,8 +12510,8 @@ var require_windows = __commonJS({
|
|
|
12509
12510
|
"node_modules/isexe/windows.js"(exports, module) {
|
|
12510
12511
|
module.exports = isexe;
|
|
12511
12512
|
isexe.sync = sync;
|
|
12512
|
-
var
|
|
12513
|
-
function checkPathExt(
|
|
12513
|
+
var fs27 = __require("fs");
|
|
12514
|
+
function checkPathExt(path29, options) {
|
|
12514
12515
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
12515
12516
|
if (!pathext) {
|
|
12516
12517
|
return true;
|
|
@@ -12521,25 +12522,25 @@ var require_windows = __commonJS({
|
|
|
12521
12522
|
}
|
|
12522
12523
|
for (var i = 0; i < pathext.length; i++) {
|
|
12523
12524
|
var p = pathext[i].toLowerCase();
|
|
12524
|
-
if (p &&
|
|
12525
|
+
if (p && path29.substr(-p.length).toLowerCase() === p) {
|
|
12525
12526
|
return true;
|
|
12526
12527
|
}
|
|
12527
12528
|
}
|
|
12528
12529
|
return false;
|
|
12529
12530
|
}
|
|
12530
|
-
function checkStat(stat,
|
|
12531
|
+
function checkStat(stat, path29, options) {
|
|
12531
12532
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12532
12533
|
return false;
|
|
12533
12534
|
}
|
|
12534
|
-
return checkPathExt(
|
|
12535
|
+
return checkPathExt(path29, options);
|
|
12535
12536
|
}
|
|
12536
|
-
function isexe(
|
|
12537
|
-
|
|
12538
|
-
cb(er, er ? false : checkStat(stat,
|
|
12537
|
+
function isexe(path29, options, cb) {
|
|
12538
|
+
fs27.stat(path29, function(er, stat) {
|
|
12539
|
+
cb(er, er ? false : checkStat(stat, path29, options));
|
|
12539
12540
|
});
|
|
12540
12541
|
}
|
|
12541
|
-
function sync(
|
|
12542
|
-
return checkStat(
|
|
12542
|
+
function sync(path29, options) {
|
|
12543
|
+
return checkStat(fs27.statSync(path29), path29, options);
|
|
12543
12544
|
}
|
|
12544
12545
|
}
|
|
12545
12546
|
});
|
|
@@ -12549,14 +12550,14 @@ var require_mode = __commonJS({
|
|
|
12549
12550
|
"node_modules/isexe/mode.js"(exports, module) {
|
|
12550
12551
|
module.exports = isexe;
|
|
12551
12552
|
isexe.sync = sync;
|
|
12552
|
-
var
|
|
12553
|
-
function isexe(
|
|
12554
|
-
|
|
12553
|
+
var fs27 = __require("fs");
|
|
12554
|
+
function isexe(path29, options, cb) {
|
|
12555
|
+
fs27.stat(path29, function(er, stat) {
|
|
12555
12556
|
cb(er, er ? false : checkStat(stat, options));
|
|
12556
12557
|
});
|
|
12557
12558
|
}
|
|
12558
|
-
function sync(
|
|
12559
|
-
return checkStat(
|
|
12559
|
+
function sync(path29, options) {
|
|
12560
|
+
return checkStat(fs27.statSync(path29), options);
|
|
12560
12561
|
}
|
|
12561
12562
|
function checkStat(stat, options) {
|
|
12562
12563
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -12580,7 +12581,7 @@ var require_mode = __commonJS({
|
|
|
12580
12581
|
// node_modules/isexe/index.js
|
|
12581
12582
|
var require_isexe = __commonJS({
|
|
12582
12583
|
"node_modules/isexe/index.js"(exports, module) {
|
|
12583
|
-
var
|
|
12584
|
+
var fs27 = __require("fs");
|
|
12584
12585
|
var core;
|
|
12585
12586
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
12586
12587
|
core = require_windows();
|
|
@@ -12589,7 +12590,7 @@ var require_isexe = __commonJS({
|
|
|
12589
12590
|
}
|
|
12590
12591
|
module.exports = isexe;
|
|
12591
12592
|
isexe.sync = sync;
|
|
12592
|
-
function isexe(
|
|
12593
|
+
function isexe(path29, options, cb) {
|
|
12593
12594
|
if (typeof options === "function") {
|
|
12594
12595
|
cb = options;
|
|
12595
12596
|
options = {};
|
|
@@ -12599,7 +12600,7 @@ var require_isexe = __commonJS({
|
|
|
12599
12600
|
throw new TypeError("callback not provided");
|
|
12600
12601
|
}
|
|
12601
12602
|
return new Promise(function(resolve, reject) {
|
|
12602
|
-
isexe(
|
|
12603
|
+
isexe(path29, options || {}, function(er, is) {
|
|
12603
12604
|
if (er) {
|
|
12604
12605
|
reject(er);
|
|
12605
12606
|
} else {
|
|
@@ -12608,7 +12609,7 @@ var require_isexe = __commonJS({
|
|
|
12608
12609
|
});
|
|
12609
12610
|
});
|
|
12610
12611
|
}
|
|
12611
|
-
core(
|
|
12612
|
+
core(path29, options || {}, function(er, is) {
|
|
12612
12613
|
if (er) {
|
|
12613
12614
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
12614
12615
|
er = null;
|
|
@@ -12618,9 +12619,9 @@ var require_isexe = __commonJS({
|
|
|
12618
12619
|
cb(er, is);
|
|
12619
12620
|
});
|
|
12620
12621
|
}
|
|
12621
|
-
function sync(
|
|
12622
|
+
function sync(path29, options) {
|
|
12622
12623
|
try {
|
|
12623
|
-
return core.sync(
|
|
12624
|
+
return core.sync(path29, options || {});
|
|
12624
12625
|
} catch (er) {
|
|
12625
12626
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
12626
12627
|
return false;
|
|
@@ -12636,7 +12637,7 @@ var require_isexe = __commonJS({
|
|
|
12636
12637
|
var require_which = __commonJS({
|
|
12637
12638
|
"node_modules/which/which.js"(exports, module) {
|
|
12638
12639
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
12639
|
-
var
|
|
12640
|
+
var path29 = __require("path");
|
|
12640
12641
|
var COLON = isWindows ? ";" : ":";
|
|
12641
12642
|
var isexe = require_isexe();
|
|
12642
12643
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -12674,7 +12675,7 @@ var require_which = __commonJS({
|
|
|
12674
12675
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
12675
12676
|
const ppRaw = pathEnv[i];
|
|
12676
12677
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12677
|
-
const pCmd =
|
|
12678
|
+
const pCmd = path29.join(pathPart, cmd);
|
|
12678
12679
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12679
12680
|
resolve(subStep(p, i, 0));
|
|
12680
12681
|
});
|
|
@@ -12701,7 +12702,7 @@ var require_which = __commonJS({
|
|
|
12701
12702
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
12702
12703
|
const ppRaw = pathEnv[i];
|
|
12703
12704
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12704
|
-
const pCmd =
|
|
12705
|
+
const pCmd = path29.join(pathPart, cmd);
|
|
12705
12706
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12706
12707
|
for (let j = 0; j < pathExt.length; j++) {
|
|
12707
12708
|
const cur = p + pathExt[j];
|
|
@@ -12749,7 +12750,7 @@ var require_path_key = __commonJS({
|
|
|
12749
12750
|
var require_resolveCommand = __commonJS({
|
|
12750
12751
|
"node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
12751
12752
|
"use strict";
|
|
12752
|
-
var
|
|
12753
|
+
var path29 = __require("path");
|
|
12753
12754
|
var which = require_which();
|
|
12754
12755
|
var getPathKey = require_path_key();
|
|
12755
12756
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -12767,7 +12768,7 @@ var require_resolveCommand = __commonJS({
|
|
|
12767
12768
|
try {
|
|
12768
12769
|
resolved = which.sync(parsed.command, {
|
|
12769
12770
|
path: env[getPathKey({ env })],
|
|
12770
|
-
pathExt: withoutPathExt ?
|
|
12771
|
+
pathExt: withoutPathExt ? path29.delimiter : void 0
|
|
12771
12772
|
});
|
|
12772
12773
|
} catch (e) {
|
|
12773
12774
|
} finally {
|
|
@@ -12776,7 +12777,7 @@ var require_resolveCommand = __commonJS({
|
|
|
12776
12777
|
}
|
|
12777
12778
|
}
|
|
12778
12779
|
if (resolved) {
|
|
12779
|
-
resolved =
|
|
12780
|
+
resolved = path29.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
12780
12781
|
}
|
|
12781
12782
|
return resolved;
|
|
12782
12783
|
}
|
|
@@ -12830,8 +12831,8 @@ var require_shebang_command = __commonJS({
|
|
|
12830
12831
|
if (!match) {
|
|
12831
12832
|
return null;
|
|
12832
12833
|
}
|
|
12833
|
-
const [
|
|
12834
|
-
const binary =
|
|
12834
|
+
const [path29, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12835
|
+
const binary = path29.split("/").pop();
|
|
12835
12836
|
if (binary === "env") {
|
|
12836
12837
|
return argument;
|
|
12837
12838
|
}
|
|
@@ -12844,16 +12845,16 @@ var require_shebang_command = __commonJS({
|
|
|
12844
12845
|
var require_readShebang = __commonJS({
|
|
12845
12846
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
12846
12847
|
"use strict";
|
|
12847
|
-
var
|
|
12848
|
+
var fs27 = __require("fs");
|
|
12848
12849
|
var shebangCommand = require_shebang_command();
|
|
12849
12850
|
function readShebang(command) {
|
|
12850
12851
|
const size = 150;
|
|
12851
12852
|
const buffer = Buffer.alloc(size);
|
|
12852
12853
|
let fd;
|
|
12853
12854
|
try {
|
|
12854
|
-
fd =
|
|
12855
|
-
|
|
12856
|
-
|
|
12855
|
+
fd = fs27.openSync(command, "r");
|
|
12856
|
+
fs27.readSync(fd, buffer, 0, size, 0);
|
|
12857
|
+
fs27.closeSync(fd);
|
|
12857
12858
|
} catch (e) {
|
|
12858
12859
|
}
|
|
12859
12860
|
return shebangCommand(buffer.toString());
|
|
@@ -12866,7 +12867,7 @@ var require_readShebang = __commonJS({
|
|
|
12866
12867
|
var require_parse = __commonJS({
|
|
12867
12868
|
"node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
12868
12869
|
"use strict";
|
|
12869
|
-
var
|
|
12870
|
+
var path29 = __require("path");
|
|
12870
12871
|
var resolveCommand = require_resolveCommand();
|
|
12871
12872
|
var escape2 = require_escape();
|
|
12872
12873
|
var readShebang = require_readShebang();
|
|
@@ -12891,7 +12892,7 @@ var require_parse = __commonJS({
|
|
|
12891
12892
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
12892
12893
|
if (parsed.options.forceShell || needsShell) {
|
|
12893
12894
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
12894
|
-
parsed.command =
|
|
12895
|
+
parsed.command = path29.normalize(parsed.command);
|
|
12895
12896
|
parsed.command = escape2.command(parsed.command);
|
|
12896
12897
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
12897
12898
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -13014,10 +13015,10 @@ var require_identity = __commonJS({
|
|
|
13014
13015
|
var NODE_TYPE = Symbol.for("yaml.node.type");
|
|
13015
13016
|
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
|
|
13016
13017
|
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
|
|
13017
|
-
var
|
|
13018
|
+
var isMap3 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
|
|
13018
13019
|
var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
|
|
13019
13020
|
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
|
|
13020
|
-
var
|
|
13021
|
+
var isSeq3 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
|
|
13021
13022
|
function isCollection(node) {
|
|
13022
13023
|
if (node && typeof node === "object")
|
|
13023
13024
|
switch (node[NODE_TYPE]) {
|
|
@@ -13050,11 +13051,11 @@ var require_identity = __commonJS({
|
|
|
13050
13051
|
exports.isAlias = isAlias;
|
|
13051
13052
|
exports.isCollection = isCollection;
|
|
13052
13053
|
exports.isDocument = isDocument;
|
|
13053
|
-
exports.isMap =
|
|
13054
|
+
exports.isMap = isMap3;
|
|
13054
13055
|
exports.isNode = isNode;
|
|
13055
13056
|
exports.isPair = isPair;
|
|
13056
13057
|
exports.isScalar = isScalar;
|
|
13057
|
-
exports.isSeq =
|
|
13058
|
+
exports.isSeq = isSeq3;
|
|
13058
13059
|
}
|
|
13059
13060
|
});
|
|
13060
13061
|
|
|
@@ -13078,17 +13079,17 @@ var require_visit = __commonJS({
|
|
|
13078
13079
|
visit.BREAK = BREAK;
|
|
13079
13080
|
visit.SKIP = SKIP;
|
|
13080
13081
|
visit.REMOVE = REMOVE;
|
|
13081
|
-
function visit_(key, node, visitor,
|
|
13082
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
13082
|
+
function visit_(key, node, visitor, path29) {
|
|
13083
|
+
const ctrl = callVisitor(key, node, visitor, path29);
|
|
13083
13084
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
13084
|
-
replaceNode(key,
|
|
13085
|
-
return visit_(key, ctrl, visitor,
|
|
13085
|
+
replaceNode(key, path29, ctrl);
|
|
13086
|
+
return visit_(key, ctrl, visitor, path29);
|
|
13086
13087
|
}
|
|
13087
13088
|
if (typeof ctrl !== "symbol") {
|
|
13088
13089
|
if (identity.isCollection(node)) {
|
|
13089
|
-
|
|
13090
|
+
path29 = Object.freeze(path29.concat(node));
|
|
13090
13091
|
for (let i = 0; i < node.items.length; ++i) {
|
|
13091
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
13092
|
+
const ci = visit_(i, node.items[i], visitor, path29);
|
|
13092
13093
|
if (typeof ci === "number")
|
|
13093
13094
|
i = ci - 1;
|
|
13094
13095
|
else if (ci === BREAK)
|
|
@@ -13099,13 +13100,13 @@ var require_visit = __commonJS({
|
|
|
13099
13100
|
}
|
|
13100
13101
|
}
|
|
13101
13102
|
} else if (identity.isPair(node)) {
|
|
13102
|
-
|
|
13103
|
-
const ck = visit_("key", node.key, visitor,
|
|
13103
|
+
path29 = Object.freeze(path29.concat(node));
|
|
13104
|
+
const ck = visit_("key", node.key, visitor, path29);
|
|
13104
13105
|
if (ck === BREAK)
|
|
13105
13106
|
return BREAK;
|
|
13106
13107
|
else if (ck === REMOVE)
|
|
13107
13108
|
node.key = null;
|
|
13108
|
-
const cv = visit_("value", node.value, visitor,
|
|
13109
|
+
const cv = visit_("value", node.value, visitor, path29);
|
|
13109
13110
|
if (cv === BREAK)
|
|
13110
13111
|
return BREAK;
|
|
13111
13112
|
else if (cv === REMOVE)
|
|
@@ -13126,17 +13127,17 @@ var require_visit = __commonJS({
|
|
|
13126
13127
|
visitAsync.BREAK = BREAK;
|
|
13127
13128
|
visitAsync.SKIP = SKIP;
|
|
13128
13129
|
visitAsync.REMOVE = REMOVE;
|
|
13129
|
-
async function visitAsync_(key, node, visitor,
|
|
13130
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
13130
|
+
async function visitAsync_(key, node, visitor, path29) {
|
|
13131
|
+
const ctrl = await callVisitor(key, node, visitor, path29);
|
|
13131
13132
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
13132
|
-
replaceNode(key,
|
|
13133
|
-
return visitAsync_(key, ctrl, visitor,
|
|
13133
|
+
replaceNode(key, path29, ctrl);
|
|
13134
|
+
return visitAsync_(key, ctrl, visitor, path29);
|
|
13134
13135
|
}
|
|
13135
13136
|
if (typeof ctrl !== "symbol") {
|
|
13136
13137
|
if (identity.isCollection(node)) {
|
|
13137
|
-
|
|
13138
|
+
path29 = Object.freeze(path29.concat(node));
|
|
13138
13139
|
for (let i = 0; i < node.items.length; ++i) {
|
|
13139
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
13140
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path29);
|
|
13140
13141
|
if (typeof ci === "number")
|
|
13141
13142
|
i = ci - 1;
|
|
13142
13143
|
else if (ci === BREAK)
|
|
@@ -13147,13 +13148,13 @@ var require_visit = __commonJS({
|
|
|
13147
13148
|
}
|
|
13148
13149
|
}
|
|
13149
13150
|
} else if (identity.isPair(node)) {
|
|
13150
|
-
|
|
13151
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
13151
|
+
path29 = Object.freeze(path29.concat(node));
|
|
13152
|
+
const ck = await visitAsync_("key", node.key, visitor, path29);
|
|
13152
13153
|
if (ck === BREAK)
|
|
13153
13154
|
return BREAK;
|
|
13154
13155
|
else if (ck === REMOVE)
|
|
13155
13156
|
node.key = null;
|
|
13156
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
13157
|
+
const cv = await visitAsync_("value", node.value, visitor, path29);
|
|
13157
13158
|
if (cv === BREAK)
|
|
13158
13159
|
return BREAK;
|
|
13159
13160
|
else if (cv === REMOVE)
|
|
@@ -13180,24 +13181,24 @@ var require_visit = __commonJS({
|
|
|
13180
13181
|
}
|
|
13181
13182
|
return visitor;
|
|
13182
13183
|
}
|
|
13183
|
-
function callVisitor(key, node, visitor,
|
|
13184
|
+
function callVisitor(key, node, visitor, path29) {
|
|
13184
13185
|
var _a3, _b, _c, _d, _e;
|
|
13185
13186
|
if (typeof visitor === "function")
|
|
13186
|
-
return visitor(key, node,
|
|
13187
|
+
return visitor(key, node, path29);
|
|
13187
13188
|
if (identity.isMap(node))
|
|
13188
|
-
return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node,
|
|
13189
|
+
return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node, path29);
|
|
13189
13190
|
if (identity.isSeq(node))
|
|
13190
|
-
return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node,
|
|
13191
|
+
return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node, path29);
|
|
13191
13192
|
if (identity.isPair(node))
|
|
13192
|
-
return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node,
|
|
13193
|
+
return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node, path29);
|
|
13193
13194
|
if (identity.isScalar(node))
|
|
13194
|
-
return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node,
|
|
13195
|
+
return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path29);
|
|
13195
13196
|
if (identity.isAlias(node))
|
|
13196
|
-
return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node,
|
|
13197
|
+
return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node, path29);
|
|
13197
13198
|
return void 0;
|
|
13198
13199
|
}
|
|
13199
|
-
function replaceNode(key,
|
|
13200
|
-
const parent =
|
|
13200
|
+
function replaceNode(key, path29, node) {
|
|
13201
|
+
const parent = path29[path29.length - 1];
|
|
13201
13202
|
if (identity.isCollection(parent)) {
|
|
13202
13203
|
parent.items[key] = node;
|
|
13203
13204
|
} else if (identity.isPair(parent)) {
|
|
@@ -13809,10 +13810,10 @@ var require_Collection = __commonJS({
|
|
|
13809
13810
|
var createNode = require_createNode();
|
|
13810
13811
|
var identity = require_identity();
|
|
13811
13812
|
var Node = require_Node();
|
|
13812
|
-
function collectionFromPath(schema,
|
|
13813
|
+
function collectionFromPath(schema, path29, value) {
|
|
13813
13814
|
let v = value;
|
|
13814
|
-
for (let i =
|
|
13815
|
-
const k =
|
|
13815
|
+
for (let i = path29.length - 1; i >= 0; --i) {
|
|
13816
|
+
const k = path29[i];
|
|
13816
13817
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
13817
13818
|
const a = [];
|
|
13818
13819
|
a[k] = v;
|
|
@@ -13831,7 +13832,7 @@ var require_Collection = __commonJS({
|
|
|
13831
13832
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
13832
13833
|
});
|
|
13833
13834
|
}
|
|
13834
|
-
var isEmptyPath = (
|
|
13835
|
+
var isEmptyPath = (path29) => path29 == null || typeof path29 === "object" && !!path29[Symbol.iterator]().next().done;
|
|
13835
13836
|
var Collection = class extends Node.NodeBase {
|
|
13836
13837
|
constructor(type, schema) {
|
|
13837
13838
|
super(type);
|
|
@@ -13861,11 +13862,11 @@ var require_Collection = __commonJS({
|
|
|
13861
13862
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
13862
13863
|
* that already exists in the map.
|
|
13863
13864
|
*/
|
|
13864
|
-
addIn(
|
|
13865
|
-
if (isEmptyPath(
|
|
13865
|
+
addIn(path29, value) {
|
|
13866
|
+
if (isEmptyPath(path29))
|
|
13866
13867
|
this.add(value);
|
|
13867
13868
|
else {
|
|
13868
|
-
const [key, ...rest] =
|
|
13869
|
+
const [key, ...rest] = path29;
|
|
13869
13870
|
const node = this.get(key, true);
|
|
13870
13871
|
if (identity.isCollection(node))
|
|
13871
13872
|
node.addIn(rest, value);
|
|
@@ -13879,8 +13880,8 @@ var require_Collection = __commonJS({
|
|
|
13879
13880
|
* Removes a value from the collection.
|
|
13880
13881
|
* @returns `true` if the item was found and removed.
|
|
13881
13882
|
*/
|
|
13882
|
-
deleteIn(
|
|
13883
|
-
const [key, ...rest] =
|
|
13883
|
+
deleteIn(path29) {
|
|
13884
|
+
const [key, ...rest] = path29;
|
|
13884
13885
|
if (rest.length === 0)
|
|
13885
13886
|
return this.delete(key);
|
|
13886
13887
|
const node = this.get(key, true);
|
|
@@ -13894,8 +13895,8 @@ var require_Collection = __commonJS({
|
|
|
13894
13895
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
13895
13896
|
* `true` (collections are always returned intact).
|
|
13896
13897
|
*/
|
|
13897
|
-
getIn(
|
|
13898
|
-
const [key, ...rest] =
|
|
13898
|
+
getIn(path29, keepScalar) {
|
|
13899
|
+
const [key, ...rest] = path29;
|
|
13899
13900
|
const node = this.get(key, true);
|
|
13900
13901
|
if (rest.length === 0)
|
|
13901
13902
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -13913,8 +13914,8 @@ var require_Collection = __commonJS({
|
|
|
13913
13914
|
/**
|
|
13914
13915
|
* Checks if the collection includes a value with the key `key`.
|
|
13915
13916
|
*/
|
|
13916
|
-
hasIn(
|
|
13917
|
-
const [key, ...rest] =
|
|
13917
|
+
hasIn(path29) {
|
|
13918
|
+
const [key, ...rest] = path29;
|
|
13918
13919
|
if (rest.length === 0)
|
|
13919
13920
|
return this.has(key);
|
|
13920
13921
|
const node = this.get(key, true);
|
|
@@ -13924,8 +13925,8 @@ var require_Collection = __commonJS({
|
|
|
13924
13925
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
13925
13926
|
* boolean to add/remove the item from the set.
|
|
13926
13927
|
*/
|
|
13927
|
-
setIn(
|
|
13928
|
-
const [key, ...rest] =
|
|
13928
|
+
setIn(path29, value) {
|
|
13929
|
+
const [key, ...rest] = path29;
|
|
13929
13930
|
if (rest.length === 0) {
|
|
13930
13931
|
this.set(key, value);
|
|
13931
13932
|
} else {
|
|
@@ -16439,9 +16440,9 @@ var require_Document = __commonJS({
|
|
|
16439
16440
|
this.contents.add(value);
|
|
16440
16441
|
}
|
|
16441
16442
|
/** Adds a value to the document. */
|
|
16442
|
-
addIn(
|
|
16443
|
+
addIn(path29, value) {
|
|
16443
16444
|
if (assertCollection(this.contents))
|
|
16444
|
-
this.contents.addIn(
|
|
16445
|
+
this.contents.addIn(path29, value);
|
|
16445
16446
|
}
|
|
16446
16447
|
/**
|
|
16447
16448
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -16516,14 +16517,14 @@ var require_Document = __commonJS({
|
|
|
16516
16517
|
* Removes a value from the document.
|
|
16517
16518
|
* @returns `true` if the item was found and removed.
|
|
16518
16519
|
*/
|
|
16519
|
-
deleteIn(
|
|
16520
|
-
if (Collection.isEmptyPath(
|
|
16520
|
+
deleteIn(path29) {
|
|
16521
|
+
if (Collection.isEmptyPath(path29)) {
|
|
16521
16522
|
if (this.contents == null)
|
|
16522
16523
|
return false;
|
|
16523
16524
|
this.contents = null;
|
|
16524
16525
|
return true;
|
|
16525
16526
|
}
|
|
16526
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
16527
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path29) : false;
|
|
16527
16528
|
}
|
|
16528
16529
|
/**
|
|
16529
16530
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -16538,10 +16539,10 @@ var require_Document = __commonJS({
|
|
|
16538
16539
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
16539
16540
|
* `true` (collections are always returned intact).
|
|
16540
16541
|
*/
|
|
16541
|
-
getIn(
|
|
16542
|
-
if (Collection.isEmptyPath(
|
|
16542
|
+
getIn(path29, keepScalar) {
|
|
16543
|
+
if (Collection.isEmptyPath(path29))
|
|
16543
16544
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
16544
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
16545
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path29, keepScalar) : void 0;
|
|
16545
16546
|
}
|
|
16546
16547
|
/**
|
|
16547
16548
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -16552,10 +16553,10 @@ var require_Document = __commonJS({
|
|
|
16552
16553
|
/**
|
|
16553
16554
|
* Checks if the document includes a value at `path`.
|
|
16554
16555
|
*/
|
|
16555
|
-
hasIn(
|
|
16556
|
-
if (Collection.isEmptyPath(
|
|
16556
|
+
hasIn(path29) {
|
|
16557
|
+
if (Collection.isEmptyPath(path29))
|
|
16557
16558
|
return this.contents !== void 0;
|
|
16558
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
16559
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path29) : false;
|
|
16559
16560
|
}
|
|
16560
16561
|
/**
|
|
16561
16562
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -16572,13 +16573,13 @@ var require_Document = __commonJS({
|
|
|
16572
16573
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
16573
16574
|
* boolean to add/remove the item from the set.
|
|
16574
16575
|
*/
|
|
16575
|
-
setIn(
|
|
16576
|
-
if (Collection.isEmptyPath(
|
|
16576
|
+
setIn(path29, value) {
|
|
16577
|
+
if (Collection.isEmptyPath(path29)) {
|
|
16577
16578
|
this.contents = value;
|
|
16578
16579
|
} else if (this.contents == null) {
|
|
16579
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
16580
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path29), value);
|
|
16580
16581
|
} else if (assertCollection(this.contents)) {
|
|
16581
|
-
this.contents.setIn(
|
|
16582
|
+
this.contents.setIn(path29, value);
|
|
16582
16583
|
}
|
|
16583
16584
|
}
|
|
16584
16585
|
/**
|
|
@@ -17164,9 +17165,9 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17164
17165
|
var isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq");
|
|
17165
17166
|
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
|
|
17166
17167
|
var _a3;
|
|
17167
|
-
const
|
|
17168
|
-
const fcName =
|
|
17169
|
-
const NodeClass = (tag == null ? void 0 : tag.nodeClass) ?? (
|
|
17168
|
+
const isMap3 = fc.start.source === "{";
|
|
17169
|
+
const fcName = isMap3 ? "flow map" : "flow sequence";
|
|
17170
|
+
const NodeClass = (tag == null ? void 0 : tag.nodeClass) ?? (isMap3 ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq);
|
|
17170
17171
|
const coll = new NodeClass(ctx.schema);
|
|
17171
17172
|
coll.flow = true;
|
|
17172
17173
|
const atRoot = ctx.atRoot;
|
|
@@ -17202,7 +17203,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17202
17203
|
offset = props.end;
|
|
17203
17204
|
continue;
|
|
17204
17205
|
}
|
|
17205
|
-
if (!
|
|
17206
|
+
if (!isMap3 && ctx.options.strict && utilContainsNewline.containsNewline(key))
|
|
17206
17207
|
onError(
|
|
17207
17208
|
key,
|
|
17208
17209
|
// checked by containsNewline()
|
|
@@ -17242,7 +17243,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17242
17243
|
}
|
|
17243
17244
|
}
|
|
17244
17245
|
}
|
|
17245
|
-
if (!
|
|
17246
|
+
if (!isMap3 && !sep && !props.found) {
|
|
17246
17247
|
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep, null, props, onError);
|
|
17247
17248
|
coll.items.push(valueNode);
|
|
17248
17249
|
offset = valueNode.range[2];
|
|
@@ -17265,7 +17266,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17265
17266
|
startOnNewline: false
|
|
17266
17267
|
});
|
|
17267
17268
|
if (valueProps.found) {
|
|
17268
|
-
if (!
|
|
17269
|
+
if (!isMap3 && !props.found && ctx.options.strict) {
|
|
17269
17270
|
if (sep)
|
|
17270
17271
|
for (const st of sep) {
|
|
17271
17272
|
if (st === valueProps.found)
|
|
@@ -17297,7 +17298,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17297
17298
|
const pair = new Pair.Pair(keyNode, valueNode);
|
|
17298
17299
|
if (ctx.options.keepSourceTokens)
|
|
17299
17300
|
pair.srcToken = collItem;
|
|
17300
|
-
if (
|
|
17301
|
+
if (isMap3) {
|
|
17301
17302
|
const map2 = coll;
|
|
17302
17303
|
if (utilMapIncludes.mapIncludes(ctx, map2.items, keyNode))
|
|
17303
17304
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
@@ -17313,7 +17314,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17313
17314
|
offset = valueNode ? valueNode.range[2] : valueProps.end;
|
|
17314
17315
|
}
|
|
17315
17316
|
}
|
|
17316
|
-
const expectedEnd =
|
|
17317
|
+
const expectedEnd = isMap3 ? "}" : "]";
|
|
17317
17318
|
const [ce, ...ee] = fc.end;
|
|
17318
17319
|
let cePos = offset;
|
|
17319
17320
|
if ((ce == null ? void 0 : ce.source) === expectedEnd)
|
|
@@ -18541,9 +18542,9 @@ var require_cst_visit = __commonJS({
|
|
|
18541
18542
|
visit.BREAK = BREAK;
|
|
18542
18543
|
visit.SKIP = SKIP;
|
|
18543
18544
|
visit.REMOVE = REMOVE;
|
|
18544
|
-
visit.itemAtPath = (cst,
|
|
18545
|
+
visit.itemAtPath = (cst, path29) => {
|
|
18545
18546
|
let item = cst;
|
|
18546
|
-
for (const [field, index] of
|
|
18547
|
+
for (const [field, index] of path29) {
|
|
18547
18548
|
const tok = item == null ? void 0 : item[field];
|
|
18548
18549
|
if (tok && "items" in tok) {
|
|
18549
18550
|
item = tok.items[index];
|
|
@@ -18552,23 +18553,23 @@ var require_cst_visit = __commonJS({
|
|
|
18552
18553
|
}
|
|
18553
18554
|
return item;
|
|
18554
18555
|
};
|
|
18555
|
-
visit.parentCollection = (cst,
|
|
18556
|
-
const parent = visit.itemAtPath(cst,
|
|
18557
|
-
const field =
|
|
18556
|
+
visit.parentCollection = (cst, path29) => {
|
|
18557
|
+
const parent = visit.itemAtPath(cst, path29.slice(0, -1));
|
|
18558
|
+
const field = path29[path29.length - 1][0];
|
|
18558
18559
|
const coll = parent == null ? void 0 : parent[field];
|
|
18559
18560
|
if (coll && "items" in coll)
|
|
18560
18561
|
return coll;
|
|
18561
18562
|
throw new Error("Parent collection not found");
|
|
18562
18563
|
};
|
|
18563
|
-
function _visit(
|
|
18564
|
-
let ctrl = visitor(item,
|
|
18564
|
+
function _visit(path29, item, visitor) {
|
|
18565
|
+
let ctrl = visitor(item, path29);
|
|
18565
18566
|
if (typeof ctrl === "symbol")
|
|
18566
18567
|
return ctrl;
|
|
18567
18568
|
for (const field of ["key", "value"]) {
|
|
18568
18569
|
const token = item[field];
|
|
18569
18570
|
if (token && "items" in token) {
|
|
18570
18571
|
for (let i = 0; i < token.items.length; ++i) {
|
|
18571
|
-
const ci = _visit(Object.freeze(
|
|
18572
|
+
const ci = _visit(Object.freeze(path29.concat([[field, i]])), token.items[i], visitor);
|
|
18572
18573
|
if (typeof ci === "number")
|
|
18573
18574
|
i = ci - 1;
|
|
18574
18575
|
else if (ci === BREAK)
|
|
@@ -18579,10 +18580,10 @@ var require_cst_visit = __commonJS({
|
|
|
18579
18580
|
}
|
|
18580
18581
|
}
|
|
18581
18582
|
if (typeof ctrl === "function" && field === "key")
|
|
18582
|
-
ctrl = ctrl(item,
|
|
18583
|
+
ctrl = ctrl(item, path29);
|
|
18583
18584
|
}
|
|
18584
18585
|
}
|
|
18585
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
18586
|
+
return typeof ctrl === "function" ? ctrl(item, path29) : ctrl;
|
|
18586
18587
|
}
|
|
18587
18588
|
exports.visit = visit;
|
|
18588
18589
|
}
|
|
@@ -19869,14 +19870,14 @@ var require_parser = __commonJS({
|
|
|
19869
19870
|
case "scalar":
|
|
19870
19871
|
case "single-quoted-scalar":
|
|
19871
19872
|
case "double-quoted-scalar": {
|
|
19872
|
-
const
|
|
19873
|
+
const fs27 = this.flowScalar(this.type);
|
|
19873
19874
|
if (atNextItem || it.value) {
|
|
19874
|
-
map2.items.push({ start, key:
|
|
19875
|
+
map2.items.push({ start, key: fs27, sep: [] });
|
|
19875
19876
|
this.onKeyLine = true;
|
|
19876
19877
|
} else if (it.sep) {
|
|
19877
|
-
this.stack.push(
|
|
19878
|
+
this.stack.push(fs27);
|
|
19878
19879
|
} else {
|
|
19879
|
-
Object.assign(it, { key:
|
|
19880
|
+
Object.assign(it, { key: fs27, sep: [] });
|
|
19880
19881
|
this.onKeyLine = true;
|
|
19881
19882
|
}
|
|
19882
19883
|
return;
|
|
@@ -20005,13 +20006,13 @@ var require_parser = __commonJS({
|
|
|
20005
20006
|
case "scalar":
|
|
20006
20007
|
case "single-quoted-scalar":
|
|
20007
20008
|
case "double-quoted-scalar": {
|
|
20008
|
-
const
|
|
20009
|
+
const fs27 = this.flowScalar(this.type);
|
|
20009
20010
|
if (!it || it.value)
|
|
20010
|
-
fc.items.push({ start: [], key:
|
|
20011
|
+
fc.items.push({ start: [], key: fs27, sep: [] });
|
|
20011
20012
|
else if (it.sep)
|
|
20012
|
-
this.stack.push(
|
|
20013
|
+
this.stack.push(fs27);
|
|
20013
20014
|
else
|
|
20014
|
-
Object.assign(it, { key:
|
|
20015
|
+
Object.assign(it, { key: fs27, sep: [] });
|
|
20015
20016
|
return;
|
|
20016
20017
|
}
|
|
20017
20018
|
case "flow-map-end":
|
|
@@ -20200,7 +20201,7 @@ var require_public_api = __commonJS({
|
|
|
20200
20201
|
return docs;
|
|
20201
20202
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
20202
20203
|
}
|
|
20203
|
-
function
|
|
20204
|
+
function parseDocument3(source, options = {}) {
|
|
20204
20205
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
20205
20206
|
const parser$1 = new parser.Parser(lineCounter2 == null ? void 0 : lineCounter2.addNewLine);
|
|
20206
20207
|
const composer$1 = new composer.Composer(options);
|
|
@@ -20226,7 +20227,7 @@ var require_public_api = __commonJS({
|
|
|
20226
20227
|
} else if (options === void 0 && reviver && typeof reviver === "object") {
|
|
20227
20228
|
options = reviver;
|
|
20228
20229
|
}
|
|
20229
|
-
const doc =
|
|
20230
|
+
const doc = parseDocument3(src, options);
|
|
20230
20231
|
if (!doc)
|
|
20231
20232
|
return null;
|
|
20232
20233
|
doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
|
|
@@ -20262,7 +20263,7 @@ var require_public_api = __commonJS({
|
|
|
20262
20263
|
}
|
|
20263
20264
|
exports.parse = parse3;
|
|
20264
20265
|
exports.parseAllDocuments = parseAllDocuments;
|
|
20265
|
-
exports.parseDocument =
|
|
20266
|
+
exports.parseDocument = parseDocument3;
|
|
20266
20267
|
exports.stringify = stringify;
|
|
20267
20268
|
}
|
|
20268
20269
|
});
|
|
@@ -20684,8 +20685,8 @@ function getErrorMap() {
|
|
|
20684
20685
|
|
|
20685
20686
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
20686
20687
|
var makeIssue = (params) => {
|
|
20687
|
-
const { data, path:
|
|
20688
|
-
const fullPath = [...
|
|
20688
|
+
const { data, path: path29, errorMaps, issueData } = params;
|
|
20689
|
+
const fullPath = [...path29, ...issueData.path || []];
|
|
20689
20690
|
const fullIssue = {
|
|
20690
20691
|
...issueData,
|
|
20691
20692
|
path: fullPath
|
|
@@ -20800,11 +20801,11 @@ var errorUtil;
|
|
|
20800
20801
|
|
|
20801
20802
|
// node_modules/zod/v3/types.js
|
|
20802
20803
|
var ParseInputLazyPath = class {
|
|
20803
|
-
constructor(parent, value,
|
|
20804
|
+
constructor(parent, value, path29, key) {
|
|
20804
20805
|
this._cachedPath = [];
|
|
20805
20806
|
this.parent = parent;
|
|
20806
20807
|
this.data = value;
|
|
20807
|
-
this._path =
|
|
20808
|
+
this._path = path29;
|
|
20808
20809
|
this._key = key;
|
|
20809
20810
|
}
|
|
20810
20811
|
get path() {
|
|
@@ -24453,10 +24454,10 @@ function mergeDefs(...defs) {
|
|
|
24453
24454
|
function cloneDef(schema) {
|
|
24454
24455
|
return mergeDefs(schema._zod.def);
|
|
24455
24456
|
}
|
|
24456
|
-
function getElementAtPath(obj,
|
|
24457
|
-
if (!
|
|
24457
|
+
function getElementAtPath(obj, path29) {
|
|
24458
|
+
if (!path29)
|
|
24458
24459
|
return obj;
|
|
24459
|
-
return
|
|
24460
|
+
return path29.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
24460
24461
|
}
|
|
24461
24462
|
function promiseAllObject(promisesObj) {
|
|
24462
24463
|
const keys = Object.keys(promisesObj);
|
|
@@ -24841,11 +24842,11 @@ function aborted(x, startIndex = 0) {
|
|
|
24841
24842
|
}
|
|
24842
24843
|
return false;
|
|
24843
24844
|
}
|
|
24844
|
-
function prefixIssues(
|
|
24845
|
+
function prefixIssues(path29, issues) {
|
|
24845
24846
|
return issues.map((iss) => {
|
|
24846
24847
|
var _a3;
|
|
24847
24848
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
24848
|
-
iss.path.unshift(
|
|
24849
|
+
iss.path.unshift(path29);
|
|
24849
24850
|
return iss;
|
|
24850
24851
|
});
|
|
24851
24852
|
}
|
|
@@ -36590,6 +36591,10 @@ function createMakerAgentsPolicyBody() {
|
|
|
36590
36591
|
"# TapTap Maker Project Asset Tool Policy",
|
|
36591
36592
|
"",
|
|
36592
36593
|
"This is a bound TapTap Maker project.",
|
|
36594
|
+
"Do not use TapTap Developer Center documentation or docs for other TapTap game platforms",
|
|
36595
|
+
"when developing or debugging this Maker game; use Maker MCP and the project-local",
|
|
36596
|
+
"`AGENTS.md`, `engine-docs/`, `examples/`, `templates/`, `urhox-libs/`, and installed Maker",
|
|
36597
|
+
"skills as the sources of truth.",
|
|
36593
36598
|
"",
|
|
36594
36599
|
MAKER_PROJECT_POLICY_ROUTING_INDEX,
|
|
36595
36600
|
"",
|
|
@@ -36681,7 +36686,7 @@ function createMakerAgentsPolicyBody() {
|
|
|
36681
36686
|
" `mcp report --ide <client> --target-dir <project> --context-stdin --consent --json`.",
|
|
36682
36687
|
"- This preserves the configured package version and the absolute Windows node.exe/npm-cli.js.",
|
|
36683
36688
|
"- Only with a known exact installed version, fallback to",
|
|
36684
|
-
" `npx -y --package @taptap/maker@0.0.32-beta.
|
|
36689
|
+
" `npx -y --package @taptap/maker@0.0.32-beta.3 taptap-maker mcp report ...`.",
|
|
36685
36690
|
"- Never use an unversioned npm package, or assume `taptap-maker`/`npx` is globally available.",
|
|
36686
36691
|
"- Never include the complete conversation, project source, other MCP server entries, PAT/token",
|
|
36687
36692
|
" values, or full environment variables. Normalize the user home path to `~`.",
|
|
@@ -36713,6 +36718,11 @@ function createMakerAgentsPolicyBody() {
|
|
|
36713
36718
|
"- `batch_generate_images` for multiple image assets.",
|
|
36714
36719
|
"- `edit_image` for modifying existing project images.",
|
|
36715
36720
|
"- `create_video_task` for game video assets or referenced image/video generation.",
|
|
36721
|
+
"- Only call `create_video_task` after the user explicitly requests video generation; do not",
|
|
36722
|
+
" generate video proactively while implementing gameplay or filling asset gaps.",
|
|
36723
|
+
'- When duration exceeds 10 seconds or `model="2.5"`, show the rough credit estimate and',
|
|
36724
|
+
" upstream-token billing disclaimer, wait for explicit confirmation, then repeat the same",
|
|
36725
|
+
" request with `user_confirmed=true`.",
|
|
36716
36726
|
"- `query_video_task` for refreshing video task status and fetching completed videos.",
|
|
36717
36727
|
"- `text_to_music` for game music.",
|
|
36718
36728
|
"- `text_to_sound_effect` for one sound effect.",
|
|
@@ -37889,12 +37899,12 @@ function getBlockingRemoteSyncFailure(status) {
|
|
|
37889
37899
|
};
|
|
37890
37900
|
}
|
|
37891
37901
|
function includeMandatoryMakerSubmitFiles(cwd, files) {
|
|
37892
|
-
const
|
|
37902
|
+
const unique2 = new Set(files);
|
|
37893
37903
|
const changedFiles = parseGitStatusFiles(readGitSync(["-C", cwd, "status", "--porcelain", "-z"]));
|
|
37894
37904
|
if (changedFiles.includes(".gitignore")) {
|
|
37895
|
-
|
|
37905
|
+
unique2.add(".gitignore");
|
|
37896
37906
|
}
|
|
37897
|
-
return [...
|
|
37907
|
+
return [...unique2];
|
|
37898
37908
|
}
|
|
37899
37909
|
async function readMakerProjectLocalChanges(cwd) {
|
|
37900
37910
|
ensureGitAvailable();
|
|
@@ -38195,7 +38205,16 @@ function getMakerGitRetryDecision(message) {
|
|
|
38195
38205
|
)) {
|
|
38196
38206
|
return { retry: true, reason: "network_or_timeout" };
|
|
38197
38207
|
}
|
|
38198
|
-
if (/
|
|
38208
|
+
if (/curl\s+92\b|HTTP\/2 stream.*not closed cleanly|HTTP\/2.{0,80}(?:not supported|unsupported)|(?:server|remote).{0,80}does not support HTTP\/2/i.test(
|
|
38209
|
+
text
|
|
38210
|
+
)) {
|
|
38211
|
+
return {
|
|
38212
|
+
retry: true,
|
|
38213
|
+
reason: "http2_transport_error",
|
|
38214
|
+
fallbackHttpVersion: "HTTP/1.1"
|
|
38215
|
+
};
|
|
38216
|
+
}
|
|
38217
|
+
if (/connection reset|connection refused|connection closed|remote end hung up|unexpected disconnect|early EOF|RPC failed|index-pack failed|SSL_ERROR_SYSCALL|curl\s+(?:18|28|35|52|55|56)/i.test(
|
|
38199
38218
|
text
|
|
38200
38219
|
)) {
|
|
38201
38220
|
return { retry: true, reason: "connection_interrupted" };
|
|
@@ -38276,10 +38295,14 @@ function pushGit(args, cwd, onProgress) {
|
|
|
38276
38295
|
});
|
|
38277
38296
|
}
|
|
38278
38297
|
function pushGitWithTransientRetry(args, cwd, onProgress) {
|
|
38279
|
-
return
|
|
38280
|
-
|
|
38281
|
-
onProgress
|
|
38282
|
-
|
|
38298
|
+
return runMakerGitNetworkOperationWithTransientRetry(
|
|
38299
|
+
args,
|
|
38300
|
+
(effectiveArgs) => pushGit(effectiveArgs, cwd, onProgress),
|
|
38301
|
+
{
|
|
38302
|
+
stage: "push",
|
|
38303
|
+
onProgress
|
|
38304
|
+
}
|
|
38305
|
+
);
|
|
38283
38306
|
}
|
|
38284
38307
|
async function resolveMakerProjectUserId(options) {
|
|
38285
38308
|
var _a3;
|
|
@@ -38729,10 +38752,15 @@ function readGit(args, cwd) {
|
|
|
38729
38752
|
});
|
|
38730
38753
|
}
|
|
38731
38754
|
async function runGitWithTransientRetry(args, options) {
|
|
38732
|
-
|
|
38733
|
-
|
|
38734
|
-
|
|
38735
|
-
|
|
38755
|
+
const stage = args[0] || "git";
|
|
38756
|
+
return runMakerGitNetworkOperationWithTransientRetry(
|
|
38757
|
+
args,
|
|
38758
|
+
(effectiveArgs) => runGit(effectiveArgs, { ...options, stage }),
|
|
38759
|
+
{
|
|
38760
|
+
stage,
|
|
38761
|
+
onProgress: options.onProgress
|
|
38762
|
+
}
|
|
38763
|
+
);
|
|
38736
38764
|
}
|
|
38737
38765
|
async function runGitCaptureWithTransientRetry(args, options = {}) {
|
|
38738
38766
|
return runWithTransientRetry(() => runGitCapture(args, options), {
|
|
@@ -38741,7 +38769,7 @@ async function runGitCaptureWithTransientRetry(args, options = {}) {
|
|
|
38741
38769
|
});
|
|
38742
38770
|
}
|
|
38743
38771
|
async function runWithTransientRetry(operation, options) {
|
|
38744
|
-
var _a3;
|
|
38772
|
+
var _a3, _b;
|
|
38745
38773
|
let retries = 0;
|
|
38746
38774
|
const maxRetries = 5;
|
|
38747
38775
|
for (; ; ) {
|
|
@@ -38757,7 +38785,8 @@ async function runWithTransientRetry(operation, options) {
|
|
|
38757
38785
|
throw appendRetryExhausted(error2, retries, decision);
|
|
38758
38786
|
}
|
|
38759
38787
|
retries += 1;
|
|
38760
|
-
(_a3 = options.
|
|
38788
|
+
(_a3 = options.onRetry) == null ? void 0 : _a3.call(options, decision);
|
|
38789
|
+
(_b = options.onProgress) == null ? void 0 : _b.call(options, {
|
|
38761
38790
|
phase: options.stage,
|
|
38762
38791
|
message: formatGitRetryProgressMessage(options.stage, decision, retries, maxRetries)
|
|
38763
38792
|
});
|
|
@@ -38765,8 +38794,25 @@ async function runWithTransientRetry(operation, options) {
|
|
|
38765
38794
|
}
|
|
38766
38795
|
}
|
|
38767
38796
|
}
|
|
38797
|
+
async function runMakerGitNetworkOperationWithTransientRetry(args, operation, options) {
|
|
38798
|
+
let fallbackHttpVersion;
|
|
38799
|
+
return runWithTransientRetry(
|
|
38800
|
+
() => operation(
|
|
38801
|
+
fallbackHttpVersion ? ["-c", `http.version=${fallbackHttpVersion}`, ...args] : [...args]
|
|
38802
|
+
),
|
|
38803
|
+
{
|
|
38804
|
+
...options,
|
|
38805
|
+
onRetry: (decision) => {
|
|
38806
|
+
fallbackHttpVersion = decision.fallbackHttpVersion || fallbackHttpVersion;
|
|
38807
|
+
}
|
|
38808
|
+
}
|
|
38809
|
+
);
|
|
38810
|
+
}
|
|
38768
38811
|
function formatGitRetryProgressMessage(stage, decision, retries, maxRetries) {
|
|
38769
38812
|
const reason = decision.reason || "temporary_remote_failure";
|
|
38813
|
+
if (reason === "http2_transport_error") {
|
|
38814
|
+
return `Maker git HTTP/2 transport failed; retrying with command-local HTTP/1.1 ${retries}/${maxRetries}. Please keep this running.`;
|
|
38815
|
+
}
|
|
38770
38816
|
const prefix = (stage === "clone" || stage === "fetch") && reason === "remote_http_5xx" ? "Maker server may still be preparing the repository" : "Maker git remote is temporarily unavailable";
|
|
38771
38817
|
return `${prefix} (${reason}); retrying ${retries}/${maxRetries}. Please keep this running.`;
|
|
38772
38818
|
}
|
|
@@ -38867,7 +38913,7 @@ function runGit(args, options) {
|
|
|
38867
38913
|
reject(
|
|
38868
38914
|
new MakerGitError(
|
|
38869
38915
|
createGitFailure({
|
|
38870
|
-
stage: args[0] || "git",
|
|
38916
|
+
stage: options.stage || args[0] || "git",
|
|
38871
38917
|
command: `${gitCommand} ${args.join(" ")}`,
|
|
38872
38918
|
exitCode: code,
|
|
38873
38919
|
stdout: options.quiet ? "" : stdout,
|
|
@@ -38881,7 +38927,7 @@ function runGit(args, options) {
|
|
|
38881
38927
|
reject(
|
|
38882
38928
|
new MakerGitError(
|
|
38883
38929
|
createGitFailure({
|
|
38884
|
-
stage: args[0] || "git",
|
|
38930
|
+
stage: options.stage || args[0] || "git",
|
|
38885
38931
|
command: `${gitCommand} ${args.join(" ")}`,
|
|
38886
38932
|
exitCode: null,
|
|
38887
38933
|
stdout: options.quiet ? "" : stdout,
|
|
@@ -39683,9 +39729,35 @@ function saveLuaLspRuntimeConfig(environment) {
|
|
|
39683
39729
|
import fs10 from "node:fs";
|
|
39684
39730
|
import path11 from "node:path";
|
|
39685
39731
|
import { fileURLToPath } from "node:url";
|
|
39732
|
+
|
|
39733
|
+
// src/maker/pluginDistribution.ts
|
|
39734
|
+
function hasMakerPluginDistribution(distribution = process.env.TAPTAP_MAKER_DISTRIBUTION) {
|
|
39735
|
+
return Boolean(distribution == null ? void 0 : distribution.trim());
|
|
39736
|
+
}
|
|
39737
|
+
function resolveMakerPluginDistribution(distribution = process.env.TAPTAP_MAKER_DISTRIBUTION) {
|
|
39738
|
+
if (distribution === "codex_plugin") {
|
|
39739
|
+
return { id: distribution, client: "codex", displayName: "Codex" };
|
|
39740
|
+
}
|
|
39741
|
+
if (distribution === "workbuddy_plugin") {
|
|
39742
|
+
return { id: distribution, client: "workbuddy", displayName: "WorkBuddy" };
|
|
39743
|
+
}
|
|
39744
|
+
if (distribution === "dsh_plugin") {
|
|
39745
|
+
return { id: distribution, client: "dsh", displayName: "DSH" };
|
|
39746
|
+
}
|
|
39747
|
+
return void 0;
|
|
39748
|
+
}
|
|
39749
|
+
function formatMakerPluginUpdateAction(distribution) {
|
|
39750
|
+
if (distribution.client === "dsh") {
|
|
39751
|
+
return "Update the installed DSH plugin via `dsh plugin --profile <profile> update @taptap/dsh-maker`; do not install or upgrade the standalone npm package.";
|
|
39752
|
+
}
|
|
39753
|
+
return `Update the installed ${distribution.displayName} plugin through its marketplace; do not install or upgrade the standalone npm package.`;
|
|
39754
|
+
}
|
|
39755
|
+
|
|
39756
|
+
// src/maker/cli/skill.ts
|
|
39686
39757
|
var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
|
|
39687
39758
|
var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
|
|
39688
39759
|
var UPDATE_TAPTAP_MCP_SKILL_NAME = "update-taptap-mcp";
|
|
39760
|
+
var MAKER_PLUGIN_LIFECYCLE_SKILL_NAME = "taptap-maker-plugin-lifecycle";
|
|
39689
39761
|
var BUNDLED_SKILLS = [
|
|
39690
39762
|
{
|
|
39691
39763
|
name: MAKER_LOCAL_SKILL_NAME
|
|
@@ -39698,7 +39770,10 @@ var BUNDLED_SKILLS = [
|
|
|
39698
39770
|
}
|
|
39699
39771
|
];
|
|
39700
39772
|
function formatMakerSkillStatus(_options = {}) {
|
|
39701
|
-
const
|
|
39773
|
+
const pluginDistribution = resolveMakerPluginDistribution();
|
|
39774
|
+
const clientPluginDistribution = pluginDistribution && pluginDistribution.client !== "dsh" ? pluginDistribution : void 0;
|
|
39775
|
+
const bundledSkills = clientPluginDistribution ? [...BUNDLED_SKILLS, { name: MAKER_PLUGIN_LIFECYCLE_SKILL_NAME }] : BUNDLED_SKILLS;
|
|
39776
|
+
const skillDocuments = bundledSkills.map((skill) => ({
|
|
39702
39777
|
name: skill.name,
|
|
39703
39778
|
path: path11.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
|
|
39704
39779
|
}));
|
|
@@ -39708,6 +39783,27 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
39708
39783
|
...skillDocuments.map((skill) => `- ${skill.name}: ${skill.path}`),
|
|
39709
39784
|
"",
|
|
39710
39785
|
"Use these documents as reading references for Maker local workflows.",
|
|
39786
|
+
...clientPluginDistribution ? [
|
|
39787
|
+
"",
|
|
39788
|
+
`Maker ${clientPluginDistribution.displayName} plugin lifecycle`,
|
|
39789
|
+
`- entry: ${MAKER_PLUGIN_LIFECYCLE_SKILL_NAME}`,
|
|
39790
|
+
`- Inspect a legacy ${clientPluginDistribution.displayName} Maker MCP registration before first use.`,
|
|
39791
|
+
...clientPluginDistribution.client === "codex" ? [
|
|
39792
|
+
"- Automatically disable an active legacy Codex Maker MCP; the plugin installation request is the authorization.",
|
|
39793
|
+
"- Verify the legacy registration is disabled or absent before reporting the plugin ready.",
|
|
39794
|
+
"- Require explicit confirmation only when restoring the old MCP during plugin removal."
|
|
39795
|
+
] : ["- Require explicit confirmation before disabling or restoring it."],
|
|
39796
|
+
"- Initialize with `taptap-maker init --skip-mcp-install`; the plugin already provides MCP.",
|
|
39797
|
+
`- ${formatMakerPluginUpdateAction(clientPluginDistribution)}`
|
|
39798
|
+
] : [],
|
|
39799
|
+
...(pluginDistribution == null ? void 0 : pluginDistribution.client) === "dsh" ? [
|
|
39800
|
+
"",
|
|
39801
|
+
"Maker DSH plugin lifecycle",
|
|
39802
|
+
"- Inspect a legacy DSH L1 MCP registration with `taptap-maker plugin inspect --client dsh` before first use.",
|
|
39803
|
+
"- Migrate/disable it with `taptap-maker plugin migrate --client dsh --confirm`; restore with `taptap-maker plugin restore --client dsh --confirm`.",
|
|
39804
|
+
"- Initialize with `taptap-maker init --skip-mcp-install`; the DSH plugin already provides MCP.",
|
|
39805
|
+
`- ${formatMakerPluginUpdateAction(pluginDistribution)}`
|
|
39806
|
+
] : [],
|
|
39711
39807
|
"",
|
|
39712
39808
|
"Maker Git workflow policy",
|
|
39713
39809
|
`- entry: ${MAKER_LOCAL_SKILL_NAME} > Maker Git Workflow Policy`,
|
|
@@ -39721,6 +39817,8 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
39721
39817
|
"- Follow the selected tool schema when one of these tools is used.",
|
|
39722
39818
|
"- Use generate_image, batch_generate_images, edit_image for game image assets.",
|
|
39723
39819
|
"- Use create_video_task and query_video_task for game video assets.",
|
|
39820
|
+
"- Only call create_video_task after the user explicitly requests video generation; do not generate video proactively while implementing or filling asset gaps.",
|
|
39821
|
+
'- When duration exceeds 10 seconds or model="2.5", show the rough credit estimate and upstream-token billing disclaimer, wait for explicit confirmation, then repeat the same request with user_confirmed=true.',
|
|
39724
39822
|
"- Use text_to_music for game music.",
|
|
39725
39823
|
"- Use text_to_sound_effect for one sound effect.",
|
|
39726
39824
|
"- Use batch_sound_effects for multiple sound effects.",
|
|
@@ -39753,7 +39851,7 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
39753
39851
|
" mcp report --ide <client> --target-dir <project> --context-stdin --consent --json",
|
|
39754
39852
|
"- Never use an unversioned npm package; preserve the configured version and Windows absolute launcher.",
|
|
39755
39853
|
"- A manual_required result never blocks troubleshooting or the original Maker task.",
|
|
39756
|
-
"Maker initialization next_step: execute `taptap-maker init`.",
|
|
39854
|
+
pluginDistribution ? "Maker initialization next_step: execute `taptap-maker init --skip-mcp-install` through the bundled plugin CLI." : "Maker initialization next_step: execute `taptap-maker init`.",
|
|
39757
39855
|
"Load these documents when the current AI client supports reading local guide files."
|
|
39758
39856
|
].join("\n");
|
|
39759
39857
|
}
|
|
@@ -40227,6 +40325,9 @@ function decideMakerPackageUpdate(currentVersion, policy) {
|
|
|
40227
40325
|
async function checkMakerPackageUpdate(options) {
|
|
40228
40326
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
40229
40327
|
const currentVersion = options.currentVersion;
|
|
40328
|
+
if (hasMakerPluginDistribution()) {
|
|
40329
|
+
return buildPluginManagedStatus(currentVersion);
|
|
40330
|
+
}
|
|
40230
40331
|
if (currentVersion === "dev") {
|
|
40231
40332
|
return {
|
|
40232
40333
|
status: "skipped",
|
|
@@ -40285,6 +40386,9 @@ async function checkMakerPackageUpdate(options) {
|
|
|
40285
40386
|
async function getMakerPackageUpdateStatus(options) {
|
|
40286
40387
|
var _a3, _b;
|
|
40287
40388
|
const currentVersion = options.currentVersion;
|
|
40389
|
+
if (hasMakerPluginDistribution()) {
|
|
40390
|
+
return buildPluginManagedStatus(currentVersion);
|
|
40391
|
+
}
|
|
40288
40392
|
if (currentVersion === "dev") {
|
|
40289
40393
|
return {
|
|
40290
40394
|
status: "skipped",
|
|
@@ -40336,6 +40440,9 @@ async function getMakerPackageUpdateStatus(options) {
|
|
|
40336
40440
|
}
|
|
40337
40441
|
var backgroundCheck;
|
|
40338
40442
|
function startMakerPackageUpdateCheck(options) {
|
|
40443
|
+
if (hasMakerPluginDistribution()) {
|
|
40444
|
+
return;
|
|
40445
|
+
}
|
|
40339
40446
|
const key = `${options.currentVersion}
|
|
40340
40447
|
${resolvePolicyUrl(options.policyUrl)}`;
|
|
40341
40448
|
if ((backgroundCheck == null ? void 0 : backgroundCheck.key) === key) {
|
|
@@ -40369,7 +40476,7 @@ function formatMakerPackageUpdateStatus(status) {
|
|
|
40369
40476
|
}
|
|
40370
40477
|
if (status.blacklist_match) {
|
|
40371
40478
|
lines.push(`- blacklist_match: ${status.blacklist_match}`);
|
|
40372
|
-
} else if (status.status !== "skipped") {
|
|
40479
|
+
} else if (status.status !== "skipped" && status.status !== "managed_by_plugin") {
|
|
40373
40480
|
lines.push("- blacklist_match: no");
|
|
40374
40481
|
}
|
|
40375
40482
|
if (status.checked_at) {
|
|
@@ -40398,6 +40505,13 @@ function formatMakerPackageUpdateStatus(status) {
|
|
|
40398
40505
|
}
|
|
40399
40506
|
return lines.join("\n");
|
|
40400
40507
|
}
|
|
40508
|
+
function buildPluginManagedStatus(currentVersion) {
|
|
40509
|
+
return {
|
|
40510
|
+
status: "managed_by_plugin",
|
|
40511
|
+
current_version: currentVersion,
|
|
40512
|
+
restart_required: false
|
|
40513
|
+
};
|
|
40514
|
+
}
|
|
40401
40515
|
function formatUnavailableNonBlockingError(previousError, backgroundRefresh) {
|
|
40402
40516
|
if (backgroundRefresh) {
|
|
40403
40517
|
return previousError ? `${previousError}; background retry started.` : "Maker package version check is running in the background.";
|
|
@@ -41369,7 +41483,7 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
41369
41483
|
// src/maker/server/diagnosticRedaction.ts
|
|
41370
41484
|
function isSensitiveDiagnosticKey(key) {
|
|
41371
41485
|
const normalized = key.replace(/[-\s]/gu, "_").toLowerCase();
|
|
41372
|
-
return /(?:^|_)(?:authorization|cookie|password|passwd|passphrase|pat|token|secret)$/u.test(
|
|
41486
|
+
return /(?:^|_)(?:authorization|cookie|password|passwd|passphrase|pat|token|secret|signature|sig|credential|credentials)$/u.test(
|
|
41373
41487
|
normalized
|
|
41374
41488
|
) || /(?:^|_)(?:access|refresh|id|api|auth|bearer|personal_access)?_?token$/u.test(normalized) || /(?:^|_)(?:client|app|api|mac)?_?secret$/u.test(normalized) || /(?:^|_)(?:api|auth|mac|private)?_?key$/u.test(normalized) || /(?:^|_)pat$/u.test(normalized);
|
|
41375
41489
|
}
|
|
@@ -41410,11 +41524,11 @@ function sanitizeDiagnosticText(value) {
|
|
|
41410
41524
|
}
|
|
41411
41525
|
} catch {
|
|
41412
41526
|
}
|
|
41413
|
-
return value.replace(/\b(authorization|cookie)\b\s*:\s*[^\r\n]*/giu, "$1: <redacted>").replace(
|
|
41414
|
-
/(^|[\s,;])(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key))\s+(?:"[^"]*"|'[^']*'|[^\s
|
|
41527
|
+
return value.replace(/\b([A-Za-z][A-Za-z0-9+.-]*:\/\/)[^/?#\s@]+@/gu, "$1<redacted>@").replace(/\b(authorization|cookie)\b\s*:\s*[^\r\n]*/giu, "$1: <redacted>").replace(
|
|
41528
|
+
/(^|[\s,;])(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|signature|sig|credential|credentials|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key))\s+(?:"[^"]*"|'[^']*'|(?:(?![&,;][A-Za-z][A-Za-z0-9_.-]*\s*[:=])[^\s])+)/gimu,
|
|
41415
41529
|
"$1$2 <redacted>"
|
|
41416
41530
|
).replace(
|
|
41417
|
-
/\b((?:[A-Za-z][A-Za-z0-9_-]*[_-])?(?:authorization|cookie|password|passwd|passphrase|pat|token|secret|(?:api|auth|mac|private)[_-]?key))\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s
|
|
41531
|
+
/\b((?:[A-Za-z][A-Za-z0-9_-]*[_-])?(?:authorization|cookie|password|passwd|passphrase|pat|token|secret|signature|sig|credential|credentials|(?:api|auth|mac|private)[_-]?key))\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|(?:(?![&,;][A-Za-z][A-Za-z0-9_.-]*\s*[:=])[^\s])+)/giu,
|
|
41418
41532
|
"$1=<redacted>"
|
|
41419
41533
|
).replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{16,}(?=$|[\s,;'"()\x5B\x5D{}])/giu, "Bearer <redacted>").replace(/\beyJ[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+){2}\b/gu, "<redacted>");
|
|
41420
41534
|
}
|
|
@@ -41476,6 +41590,19 @@ var RemoteProxyToolResultError = class extends Error {
|
|
|
41476
41590
|
this.result = result;
|
|
41477
41591
|
}
|
|
41478
41592
|
};
|
|
41593
|
+
var RemoteProxyToolCallError = class extends Error {
|
|
41594
|
+
constructor(toolName, executionState, error2) {
|
|
41595
|
+
const originalMessage = error2 instanceof Error ? error2.message : String(error2);
|
|
41596
|
+
super(
|
|
41597
|
+
`Remote proxy tool ${toolName} failed with execution_state=${executionState}; automatic retry is disabled. ${originalMessage}`
|
|
41598
|
+
);
|
|
41599
|
+
this.automaticRetry = false;
|
|
41600
|
+
this.name = "RemoteProxyToolCallError";
|
|
41601
|
+
this.toolName = toolName;
|
|
41602
|
+
this.executionState = executionState;
|
|
41603
|
+
this.originalError = error2;
|
|
41604
|
+
}
|
|
41605
|
+
};
|
|
41479
41606
|
function prepareRemoteProxyToolArgs(options) {
|
|
41480
41607
|
if (options.toolName === "audition_voices_for_character") {
|
|
41481
41608
|
return validateVoiceAuditionArgs(options.args);
|
|
@@ -41513,7 +41640,10 @@ function validateVoiceAuditionArgs(args) {
|
|
|
41513
41640
|
}
|
|
41514
41641
|
async function materializeRemoteProxyToolAssets(options) {
|
|
41515
41642
|
if (isRemoteProxyToolErrorResult(options.result)) {
|
|
41516
|
-
throw new RemoteProxyToolResultError(
|
|
41643
|
+
throw new RemoteProxyToolResultError(
|
|
41644
|
+
options.toolName,
|
|
41645
|
+
addRemoteProxyErrorExecutionState(options.result)
|
|
41646
|
+
);
|
|
41517
41647
|
}
|
|
41518
41648
|
if (!shouldMaterializeRemoteProxyTool(options.toolName)) {
|
|
41519
41649
|
return options.result;
|
|
@@ -41563,6 +41693,24 @@ async function materializeRemoteProxyToolAssets(options) {
|
|
|
41563
41693
|
}
|
|
41564
41694
|
return changed ? { ...options.result, content: nextContent } : options.result;
|
|
41565
41695
|
}
|
|
41696
|
+
function addRemoteProxyErrorExecutionState(result) {
|
|
41697
|
+
const resultWithStructuredContent = result;
|
|
41698
|
+
const existingStructuredContent = resultWithStructuredContent.structuredContent;
|
|
41699
|
+
const existingRecord = isRecord2(existingStructuredContent) ? existingStructuredContent : void 0;
|
|
41700
|
+
const topLevelState = result.execution_state;
|
|
41701
|
+
const explicitState = normalizeRemoteProxyExecutionState(existingRecord == null ? void 0 : existingRecord.execution_state) ?? normalizeRemoteProxyExecutionState(topLevelState);
|
|
41702
|
+
return {
|
|
41703
|
+
...result,
|
|
41704
|
+
structuredContent: {
|
|
41705
|
+
...existingRecord || (existingStructuredContent === void 0 ? {} : { remote_structured_content: existingStructuredContent }),
|
|
41706
|
+
execution_state: explicitState ?? "unknown",
|
|
41707
|
+
automatic_retry: false
|
|
41708
|
+
}
|
|
41709
|
+
};
|
|
41710
|
+
}
|
|
41711
|
+
function normalizeRemoteProxyExecutionState(value) {
|
|
41712
|
+
return value === "not_executed" || value === "unknown" ? value : void 0;
|
|
41713
|
+
}
|
|
41566
41714
|
function shouldMaterializeRemoteProxyTool(toolName) {
|
|
41567
41715
|
return [
|
|
41568
41716
|
"generate_image",
|
|
@@ -43311,9 +43459,15 @@ var MAKER_STATUS_LITE_PUBLIC_DESCRIPTION = [
|
|
|
43311
43459
|
].join(" ");
|
|
43312
43460
|
var MAKER_BUILD_CURRENT_DIRECTORY_PUBLIC_DESCRIPTION = [
|
|
43313
43461
|
"Submit and remotely build the current bound Maker project. First read maker://status or maker_status_lite and resolve exactly one bound Maker project.",
|
|
43462
|
+
"`Need to call maker_build_current_directory` is a normal project build prerequisite, not an MCP connectivity failure or issue-report trigger.",
|
|
43314
43463
|
"Use this tool for explicit Maker build, preview, submit, or push requests. Code tests and lint do not trigger this remote workflow unless the user also explicitly asks to build, run, or preview the Maker game.",
|
|
43315
43464
|
"Normal mode commits local changes when needed, pushes existing or new commits, and then starts the remote build; a clean workspace creates the required wake-up commit.",
|
|
43316
43465
|
"Unsafe remote-sync or branch states stop before commit and push. A push failure stops before build, while a build failure after a successful push means the code is already on Maker remote; follow the structured result for recovery.",
|
|
43466
|
+
"On failure, read failure_stage, code_submit_status, and remote_build_status before explaining whether project validation, code submit/push, or remote build failed.",
|
|
43467
|
+
'Known local authentication or project-context preparation failures use failure_stage="local_build_context" and remote_build_status="not_started"; follow the returned login or init recovery instead of describing a remote build failure.',
|
|
43468
|
+
'When an error explicitly reports a local PowerShell, CLI, or Git process blocked by sandbox policy, EPERM, or EACCES, ask the user to check the AI client sandbox and suggest Full Access mode ("完全访问模式") only for a trusted project. For remote Git or remote build failures, inspect the returned Git, code, and resource diagnostics first and mention sandbox access only if local commands are also blocked. Treat sandbox as a check, not a confirmed cause, for otherwise unclassified local execution failures. Follow the returned fix directly for known project-validation or project-context errors.',
|
|
43469
|
+
"If the host reports `MCP error -32001: Request timed out`, treat it only as a timeout signal: timeout alone is not evidence of a Maker server failure. Do not claim a Maker server outage without HTTP 5xx, server logs, or service-status evidence.",
|
|
43470
|
+
"Do not retry the build blindly. Run Maker doctor for the project through the active client launcher (`taptap-maker doctor --target-dir <PROJECT_DIR>` is the standalone CLI equivalent) for read-only host and project checks, then inspect the actual active client MCP command, args, cwd/Roots, session and tool registration, request timeout, and Node runtime. Doctor cannot inspect the active client configuration itself.",
|
|
43317
43471
|
"After a successful build, read runtime_logs.local_file for gameplay diagnostics and runtime_logs.state_file for watcher health when those fields are returned.",
|
|
43318
43472
|
"Do not combine Maker submission with generic branch, PR/MR, or separate commit/push workflows.",
|
|
43319
43473
|
"Set confirm_remote_build_without_submit=true only after the user explicitly requests building the already committed remote version without submitting local changes."
|
|
@@ -43338,7 +43492,10 @@ var MAKER_REMOTE_PROXY_PUBLIC_DESCRIPTIONS = {
|
|
|
43338
43492
|
"The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present."
|
|
43339
43493
|
].join(" "),
|
|
43340
43494
|
create_video_task: [
|
|
43341
|
-
"Create a video generation task.
|
|
43495
|
+
"Create a video generation task only after the user explicitly requests video generation. Do not proactively or automatically generate videos while designing gameplay, implementing features, filling asset gaps, or self-improving the game.",
|
|
43496
|
+
'Estimate the intended duration before calling. The confirmation estimate is 200 credits per second for model="2.0" and 300 credits per second for model="2.5"; it is only a rough estimate, while actual billing follows upstream token usage.',
|
|
43497
|
+
'When duration exceeds 10 seconds or model="2.5" is used, show the estimate and billing disclaimer, wait for explicit user confirmation, then repeat the same request with user_confirmed=true. Default model="2.0" with omitted duration or duration=-1 does not require confirmation.',
|
|
43498
|
+
"The remote service normally performs server-side polling and waits for the final result in this call.",
|
|
43342
43499
|
"If the wait budget expires, the result returns a task_id; continue other work and use query_video_task no sooner than 120 seconds later.",
|
|
43343
43500
|
"Mode-specific inputs and limits are defined by the input schema. Image, video, and audio references may use local project files, HTTP(S) URLs, or data URLs supported by the schema.",
|
|
43344
43501
|
"Keep image references at 30 MiB or less, video references at 50 MiB or less, and audio references at 15 MiB or less.",
|
|
@@ -43421,6 +43578,11 @@ var MAKER_REMOTE_PROXY_PUBLIC_DESCRIPTIONS = {
|
|
|
43421
43578
|
"Session-log mode returns its own saved paths and progress information; use the returned result to continue when more history is available."
|
|
43422
43579
|
].join(" ")
|
|
43423
43580
|
};
|
|
43581
|
+
var MAKER_REMOTE_PROXY_RETRY_GUIDANCE = [
|
|
43582
|
+
"This tool is not retried automatically by the local Maker runtime.",
|
|
43583
|
+
"If its response is interrupted after dispatch, its execution state may be unknown.",
|
|
43584
|
+
"For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly."
|
|
43585
|
+
].join(" ");
|
|
43424
43586
|
|
|
43425
43587
|
// src/maker/server/remoteProxyToolSnapshot.json
|
|
43426
43588
|
var remoteProxyToolSnapshot_default = {
|
|
@@ -43446,7 +43608,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43446
43608
|
tools: [
|
|
43447
43609
|
{
|
|
43448
43610
|
name: "generate_image",
|
|
43449
|
-
description: "Generate one new image asset for a Maker game. Use batch_generate_images for multiple new images and edit_image to modify an existing image. Optional reference images may guide style or content; supported sources, generation controls, and final target_size requirements are defined by the input schema. Keep each reference image supplied through local paths or data URLs at 10 MiB or less. The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present.",
|
|
43611
|
+
description: "Generate one new image asset for a Maker game. Use batch_generate_images for multiple new images and edit_image to modify an existing image. Optional reference images may guide style or content; supported sources, generation controls, and final target_size requirements are defined by the input schema. Keep each reference image supplied through local paths or data URLs at 10 MiB or less. The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
43450
43612
|
inputSchema: {
|
|
43451
43613
|
type: "object",
|
|
43452
43614
|
properties: {
|
|
@@ -43502,7 +43664,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43502
43664
|
quality: {
|
|
43503
43665
|
type: "string",
|
|
43504
43666
|
enum: ["low", "medium", "high", "auto"],
|
|
43505
|
-
description: 'Image quality
|
|
43667
|
+
description: 'Image quality. One of "low", "medium", "high", "auto" (default). GPT Image 2 uses this setting; other models may ignore it.'
|
|
43506
43668
|
},
|
|
43507
43669
|
target_dir: {
|
|
43508
43670
|
type: "string",
|
|
@@ -43514,7 +43676,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43514
43676
|
},
|
|
43515
43677
|
{
|
|
43516
43678
|
name: "batch_generate_images",
|
|
43517
|
-
description: "Generate two or more new image assets in parallel in one call. Use generate_image for one new image and edit_image to modify an existing image. Each image request uses the fields and constraints defined by the input schema. Keep each reference image supplied through local paths or data URLs at 10 MiB or less. A batch may partially succeed; preserve successful images and report failed items with their returned errors. The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present.",
|
|
43679
|
+
description: "Generate two or more new image assets in parallel in one call. Use generate_image for one new image and edit_image to modify an existing image. Each image request uses the fields and constraints defined by the input schema. Keep each reference image supplied through local paths or data URLs at 10 MiB or less. A batch may partially succeed; preserve successful images and report failed items with their returned errors. The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
43518
43680
|
inputSchema: {
|
|
43519
43681
|
type: "object",
|
|
43520
43682
|
properties: {
|
|
@@ -43576,7 +43738,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43576
43738
|
quality: {
|
|
43577
43739
|
type: "string",
|
|
43578
43740
|
enum: ["low", "medium", "high", "auto"],
|
|
43579
|
-
description: 'Image quality
|
|
43741
|
+
description: 'Image quality. One of "low", "medium", "high", "auto" (default). GPT Image 2 uses this setting; other models may ignore it.'
|
|
43580
43742
|
}
|
|
43581
43743
|
},
|
|
43582
43744
|
required: ["prompt", "name", "target_size"]
|
|
@@ -43592,7 +43754,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43592
43754
|
},
|
|
43593
43755
|
{
|
|
43594
43756
|
name: "edit_image",
|
|
43595
|
-
description: "Modify an existing image from text instructions. Use generate_image for one new image and batch_generate_images for multiple new images. The required original image accepts a local Maker project path, an HTTP(S) URL, or an image data URL. Additional reference images and output controls are defined by the input schema. Keep each local-path or data URL image at 10 MiB or less. The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present.",
|
|
43757
|
+
description: "Modify an existing image from text instructions. Use generate_image for one new image and batch_generate_images for multiple new images. The required original image accepts a local Maker project path, an HTTP(S) URL, or an image data URL. Additional reference images and output controls are defined by the input schema. Keep each local-path or data URL image at 10 MiB or less. The local proxy attempts to materialize successful results into the Maker project and retain remote mapping; use returned workspace/local paths when present. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
43596
43758
|
inputSchema: {
|
|
43597
43759
|
type: "object",
|
|
43598
43760
|
properties: {
|
|
@@ -43648,7 +43810,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43648
43810
|
quality: {
|
|
43649
43811
|
type: "string",
|
|
43650
43812
|
enum: ["low", "medium", "high", "auto"],
|
|
43651
|
-
description: 'Image quality
|
|
43813
|
+
description: 'Image quality. One of "low", "medium", "high", "auto" (default). GPT Image 2 uses this setting; other models may ignore it.'
|
|
43652
43814
|
},
|
|
43653
43815
|
target_dir: {
|
|
43654
43816
|
type: "string",
|
|
@@ -43660,7 +43822,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43660
43822
|
},
|
|
43661
43823
|
{
|
|
43662
43824
|
name: "create_3d_asset",
|
|
43663
|
-
description: 'Manage the complete Maker 3D asset lifecycle. Use action="start" to begin, action="query" to check progress, action="get_options" to inspect step options, action="continue" after review, and action="post_process" for supported follow-up operations. Use direct generation when no review checkpoint is needed, and reviewed generation when the user needs a preview before final generation. For reviewed generation, show every returned preview and wait for explicit user approval before action="continue"; never approve a review step automatically. Supported prompt, image, strategy, quality, and post-processing fields are defined by the input schema. Local image inputs are normalized for the remote service. The local proxy attempts to materialize completed model delivery under assets/model and review images under assets/image; use local_delivery, preview_assets, and other returned local paths when present.',
|
|
43825
|
+
description: 'Manage the complete Maker 3D asset lifecycle. Use action="start" to begin, action="query" to check progress, action="get_options" to inspect step options, action="continue" after review, and action="post_process" for supported follow-up operations. Use direct generation when no review checkpoint is needed, and reviewed generation when the user needs a preview before final generation. For reviewed generation, show every returned preview and wait for explicit user approval before action="continue"; never approve a review step automatically. Supported prompt, image, strategy, quality, and post-processing fields are defined by the input schema. Local image inputs are normalized for the remote service. The local proxy attempts to materialize completed model delivery under assets/model and review images under assets/image; use local_delivery, preview_assets, and other returned local paths when present. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.',
|
|
43664
43826
|
inputSchema: {
|
|
43665
43827
|
type: "object",
|
|
43666
43828
|
properties: {
|
|
@@ -43744,7 +43906,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43744
43906
|
},
|
|
43745
43907
|
{
|
|
43746
43908
|
name: "text_to_music",
|
|
43747
|
-
description: "Generate AI music for a Maker game, including background music or vocal tracks; do not use this tool for sound effects. The remote call polls server-side every 20 seconds and may wait up to 50 minutes. If generation is still running when the call times out, the result includes the task ID for operational tracking. Simple and custom generation controls are defined by the input schema. The local proxy attempts to materialize successful audio and metadata into the Maker project and record them for later Maker references; use returned local paths when present.",
|
|
43909
|
+
description: "Generate AI music for a Maker game, including background music or vocal tracks; do not use this tool for sound effects. The remote call polls server-side every 20 seconds and may wait up to 50 minutes. If generation is still running when the call times out, the result includes the task ID for operational tracking. Simple and custom generation controls are defined by the input schema. The local proxy attempts to materialize successful audio and metadata into the Maker project and record them for later Maker references; use returned local paths when present. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
43748
43910
|
inputSchema: {
|
|
43749
43911
|
type: "object",
|
|
43750
43912
|
properties: {
|
|
@@ -43794,7 +43956,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43794
43956
|
},
|
|
43795
43957
|
{
|
|
43796
43958
|
name: "create_video_task",
|
|
43797
|
-
description:
|
|
43959
|
+
description: 'Create a video generation task only after the user explicitly requests video generation. Do not proactively or automatically generate videos while designing gameplay, implementing features, filling asset gaps, or self-improving the game. Estimate the intended duration before calling. The confirmation estimate is 200 credits per second for model="2.0" and 300 credits per second for model="2.5"; it is only a rough estimate, while actual billing follows upstream token usage. When duration exceeds 10 seconds or model="2.5" is used, show the estimate and billing disclaimer, wait for explicit user confirmation, then repeat the same request with user_confirmed=true. Default model="2.0" with omitted duration or duration=-1 does not require confirmation. The remote service normally performs server-side polling and waits for the final result in this call. If the wait budget expires, the result returns a task_id; continue other work and use query_video_task no sooner than 120 seconds later. Mode-specific inputs and limits are defined by the input schema. Image, video, and audio references may use local project files, HTTP(S) URLs, or data URLs supported by the schema. Keep image references at 30 MiB or less, video references at 50 MiB or less, and audio references at 15 MiB or less. The local proxy attempts to materialize successful video results into the Maker project; prefer returned workspace paths when present, unless the user needs an external share URL. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.',
|
|
43798
43960
|
inputSchema: {
|
|
43799
43961
|
type: "object",
|
|
43800
43962
|
properties: {
|
|
@@ -43806,7 +43968,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43806
43968
|
model: {
|
|
43807
43969
|
type: "string",
|
|
43808
43970
|
enum: ["2.0", "2.5"],
|
|
43809
|
-
description: 'Seedance 模型版本,默认 "2.0"。\n- "2.0": Seedance 2.0 fast。duration 4-15s,参考图最多 9 张、参考视频 3 个、参考音频 3 个,音频不能单独输入。\n- "2.5": Seedance 2.5,效果与可控性更强、成本更高。duration 4-30s,参考图最多 30 张、参考视频 10 个、参考音频 10 个,支持仅传音频驱动生成。\n需要超过 15s 时长、大量参考素材或纯音频驱动时用 "2.5"
|
|
43971
|
+
description: 'Seedance 模型版本,默认 "2.0"。\n- "2.0": Seedance 2.0 fast。duration 4-15s,参考图最多 9 张、参考视频 3 个、参考音频 3 个,音频不能单独输入。\n- "2.5": Seedance 2.5,效果与可控性更强、成本更高。duration 4-30s,参考图最多 30 张、参考视频 10 个、参考音频 10 个,支持仅传音频驱动生成。\n需要超过 15s 时长、大量参考素材或纯音频驱动时用 "2.5",其余场景保持默认。使用 "2.5" 前须向开发者展示积分预估并二次确认。'
|
|
43810
43972
|
},
|
|
43811
43973
|
prompt: {
|
|
43812
43974
|
type: "string",
|
|
@@ -43885,7 +44047,11 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43885
44047
|
},
|
|
43886
44048
|
duration: {
|
|
43887
44049
|
type: "integer",
|
|
43888
|
-
description: '视频时长(秒)。model="2.0" 支持 4-15,model="2.5" 支持 4-30;也可传 -1。不建议设为 -1
|
|
44050
|
+
description: '视频时长(秒)。model="2.0" 支持 4-15,model="2.5" 支持 4-30;也可传 -1。明确传入超过 10 秒时,先按档位单价向开发者展示粗估并二次确认(2.0 为 200 积分/秒,2.5 为 300 积分/秒;仅供确认参考,实际按上游 token 扣费),再设 user_confirmed=true。不建议设为 -1;模型会自主选择时长。默认 2.0 下未指定或 -1 不触发确认。\nmodel="2.5" 以参考视频做视频编辑时只接受 -1(输出时长跟随输入视频),且输入视频时长需在 4-30s 内。'
|
|
44051
|
+
},
|
|
44052
|
+
user_confirmed: {
|
|
44053
|
+
type: "boolean",
|
|
44054
|
+
description: '仅当开发者已确认本次粗估(含「实际按上游 token 扣费」说明)后设为 true。触发条件:明确传入 duration 超过 10 秒,或使用 model="2.5"。未确认时不要传 true。默认 2.0 且时长未超过 10 秒时无需此参数。'
|
|
43889
44055
|
},
|
|
43890
44056
|
return_last_frame: {
|
|
43891
44057
|
type: "boolean",
|
|
@@ -43913,7 +44079,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43913
44079
|
},
|
|
43914
44080
|
{
|
|
43915
44081
|
name: "query_video_task",
|
|
43916
|
-
description: "Query video task status by task_id after create_video_task returns a pending task or reports a concurrency limit. If the task is still pending or running, continue other work and query again no sooner than 120 seconds later; do not poll continuously. Querying a completed task releases its task quota. The local proxy attempts to materialize successful video and last-frame results into the Maker project. Prefer workspace_video_path and workspace_last_frame_path when present; mention CDN URLs only when the user needs an external share link.",
|
|
44082
|
+
description: "Query video task status by task_id after create_video_task returns a pending task or reports a concurrency limit. If the task is still pending or running, continue other work and query again no sooner than 120 seconds later; do not poll continuously. Querying a completed task releases its task quota. The local proxy attempts to materialize successful video and last-frame results into the Maker project. Prefer workspace_video_path and workspace_last_frame_path when present; mention CDN URLs only when the user needs an external share link. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
43917
44083
|
inputSchema: {
|
|
43918
44084
|
type: "object",
|
|
43919
44085
|
properties: {
|
|
@@ -43935,7 +44101,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43935
44101
|
},
|
|
43936
44102
|
{
|
|
43937
44103
|
name: "text_to_sound_effect",
|
|
43938
|
-
description: "Generate one game sound effect from a Chinese or English description with Doubao Seed Audio. Each call produces one output of at most 120 seconds. Split longer audio across multiple generations because this tool does not stitch outputs. duration_seconds is an approximate target and the actual duration may differ. The local proxy attempts to materialize successful audio in the provider original format under assets/audio/sfx and record it for later Maker references; use returned local paths when present.",
|
|
44104
|
+
description: "Generate one game sound effect from a Chinese or English description with Doubao Seed Audio. Each call produces one output of at most 120 seconds. Split longer audio across multiple generations because this tool does not stitch outputs. duration_seconds is an approximate target and the actual duration may differ. The local proxy attempts to materialize successful audio in the provider original format under assets/audio/sfx and record it for later Maker references; use returned local paths when present. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
43939
44105
|
inputSchema: {
|
|
43940
44106
|
type: "object",
|
|
43941
44107
|
properties: {
|
|
@@ -43968,7 +44134,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
43968
44134
|
},
|
|
43969
44135
|
{
|
|
43970
44136
|
name: "batch_sound_effects",
|
|
43971
|
-
description: "Generate multiple game sound effects with Doubao Seed Audio in one batch. Each item is an independent output of at most 120 seconds. Split longer audio across items or calls because this tool does not stitch outputs. The result preserves per-item failures while the local proxy attempts to materialize successful audio in the provider original format under assets/audio/sfx and record it for later Maker references; use returned local paths when present.",
|
|
44137
|
+
description: "Generate multiple game sound effects with Doubao Seed Audio in one batch. Each item is an independent output of at most 120 seconds. Split longer audio across items or calls because this tool does not stitch outputs. The result preserves per-item failures while the local proxy attempts to materialize successful audio in the provider original format under assets/audio/sfx and record it for later Maker references; use returned local paths when present. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
43972
44138
|
inputSchema: {
|
|
43973
44139
|
type: "object",
|
|
43974
44140
|
properties: {
|
|
@@ -44008,7 +44174,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
44008
44174
|
},
|
|
44009
44175
|
{
|
|
44010
44176
|
name: "text_to_dialogue",
|
|
44011
|
-
description: "Generate final character dialogue audio with ElevenLabs Eleven v3. Each character needs a confirmed ElevenLabs voice mapping in .project/elevenlabs-voice-mapping.json; when one is missing, call audition_voices_for_character and then confirm_character_voice before retrying. Use stability from 0 to 1 (default 0.5) to tune variation. Eleven v3 supports audio tags such as [sad] and [laughing] plus punctuation-based pacing. The local proxy attempts to materialize successful dialogue under assets/audio/voice; use returned local paths when present.",
|
|
44177
|
+
description: "Generate final character dialogue audio with ElevenLabs Eleven v3. Each character needs a confirmed ElevenLabs voice mapping in .project/elevenlabs-voice-mapping.json; when one is missing, call audition_voices_for_character and then confirm_character_voice before retrying. Use stability from 0 to 1 (default 0.5) to tune variation. Eleven v3 supports audio tags such as [sad] and [laughing] plus punctuation-based pacing. The local proxy attempts to materialize successful dialogue under assets/audio/voice; use returned local paths when present. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
44012
44178
|
inputSchema: {
|
|
44013
44179
|
type: "object",
|
|
44014
44180
|
properties: {
|
|
@@ -44054,7 +44220,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
44054
44220
|
},
|
|
44055
44221
|
{
|
|
44056
44222
|
name: "audition_voices_for_character",
|
|
44057
|
-
description: "Create 1 to 3 temporary ElevenLabs Voice Design previews for one game character. Prepare a detailed character description and an audition line of at least 100 characters that matches the character personality and speaking style. candidate_count accepts 1 to 3 and defaults to 3. Show every returned preview to the user and wait for an explicit choice before calling confirm_character_voice. Complete audition and confirmation for one character before starting another in the same project; do not run them in parallel. Preview files are temporary and are not saved as final game assets.",
|
|
44223
|
+
description: "Create 1 to 3 temporary ElevenLabs Voice Design previews for one game character. Prepare a detailed character description and an audition line of at least 100 characters that matches the character personality and speaking style. candidate_count accepts 1 to 3 and defaults to 3. Show every returned preview to the user and wait for an explicit choice before calling confirm_character_voice. Complete audition and confirmation for one character before starting another in the same project; do not run them in parallel. Preview files are temporary and are not saved as final game assets. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
44058
44224
|
inputSchema: {
|
|
44059
44225
|
type: "object",
|
|
44060
44226
|
properties: {
|
|
@@ -44088,7 +44254,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
44088
44254
|
},
|
|
44089
44255
|
{
|
|
44090
44256
|
name: "confirm_character_voice",
|
|
44091
|
-
description: "Confirm an ElevenLabs Voice Design selection, create the permanent voice, and persist the character voice mapping for later text_to_dialogue calls. Call this tool only after audition_voices_for_character and only after the user explicitly selects a candidate or explicitly accepts the recommended candidate. Omit selected_index only after the user explicitly accepts the recommendation; absence of a user choice is not acceptance. Confirmation consumes one ElevenLabs Voice Slot. Process one character at a time and do not call this tool in parallel for the same project.",
|
|
44257
|
+
description: "Confirm an ElevenLabs Voice Design selection, create the permanent voice, and persist the character voice mapping for later text_to_dialogue calls. Call this tool only after audition_voices_for_character and only after the user explicitly selects a candidate or explicitly accepts the recommended candidate. Omit selected_index only after the user explicitly accepts the recommendation; absence of a user choice is not acceptance. Confirmation consumes one ElevenLabs Voice Slot. Process one character at a time and do not call this tool in parallel for the same project. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
44092
44258
|
inputSchema: {
|
|
44093
44259
|
type: "object",
|
|
44094
44260
|
properties: {
|
|
@@ -44110,7 +44276,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
44110
44276
|
},
|
|
44111
44277
|
{
|
|
44112
44278
|
name: "generate_test_qrcode",
|
|
44113
|
-
description: "Generate a mobile test QR code only when the user explicitly requests a test QR code or scan test, or when get_ad_config reports missing app_id or developer_id and requests this recovery step. Do not call this tool automatically during initialization, build, or publish workflows. When an explicit build is needed, use maker_build_current_directory separately. Call without confirmed_screen_orientation first. Reuse an existing project orientation; only when the tool reports it missing, ask the user in a separate conversation turn to choose landscape or portrait and then retry. An existing orientation is immutable. This operation may upload a test version, create the TapTap app identity, and return a displayable QR code.",
|
|
44279
|
+
description: "Generate a mobile test QR code only when the user explicitly requests a test QR code or scan test, or when get_ad_config reports missing app_id or developer_id and requests this recovery step. Do not call this tool automatically during initialization, build, or publish workflows. When an explicit build is needed, use maker_build_current_directory separately. Call without confirmed_screen_orientation first. Reuse an existing project orientation; only when the tool reports it missing, ask the user in a separate conversation turn to choose landscape or portrait and then retry. An existing orientation is immutable. This operation may upload a test version, create the TapTap app identity, and return a displayable QR code. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
44114
44280
|
inputSchema: {
|
|
44115
44281
|
type: "object",
|
|
44116
44282
|
properties: {
|
|
@@ -44129,7 +44295,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
44129
44295
|
},
|
|
44130
44296
|
{
|
|
44131
44297
|
name: "add_test_whitelist",
|
|
44132
|
-
description: "Add one TapTap user to the current game test whitelist. Use this only after maker_build_current_directory has initialized the project and generate_test_qrcode has established the TapTap app identity. Call it only with the TapTap user_id explicitly provided by the user; never infer an account ID.",
|
|
44298
|
+
description: "Add one TapTap user to the current game test whitelist. Use this only after maker_build_current_directory has initialized the project and generate_test_qrcode has established the TapTap app identity. Call it only with the TapTap user_id explicitly provided by the user; never infer an account ID. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
44133
44299
|
inputSchema: {
|
|
44134
44300
|
type: "object",
|
|
44135
44301
|
properties: {
|
|
@@ -44147,7 +44313,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
44147
44313
|
},
|
|
44148
44314
|
{
|
|
44149
44315
|
name: "get_ad_config",
|
|
44150
|
-
description: "For any ad-related request, read maker://ads-integration-guide first. After Maker project status confirms the primary local project configs are initialized, use this as the first remote step. It is the source of truth for current ad activation and configuration, and synchronizes the result into .project/settings.json at @runtime.ad. The local preflight does not call the remote tool while project.json or settings.json is missing. Missing local configs do not authorize an automatic build. Use maker_build_current_directory only for an explicit user build, submit, or preview request, then check project status again. If configs remain missing, report the limitation and do not rebuild automatically. Do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks, and only implement or test ad behavior after the returned configuration is usable. If app_id or developer_id is missing, call generate_test_qrcode once and then retry this tool. If ad.status != 1, report warning and ad.url, follow the returned next_action, and retry only after the user completes that step.",
|
|
44316
|
+
description: "For any ad-related request, read maker://ads-integration-guide first. After Maker project status confirms the primary local project configs are initialized, use this as the first remote step. It is the source of truth for current ad activation and configuration, and synchronizes the result into .project/settings.json at @runtime.ad. The local preflight does not call the remote tool while project.json or settings.json is missing. Missing local configs do not authorize an automatic build. Use maker_build_current_directory only for an explicit user build, submit, or preview request, then check project status again. If configs remain missing, report the limitation and do not rebuild automatically. Do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks, and only implement or test ad behavior after the returned configuration is usable. If app_id or developer_id is missing, call generate_test_qrcode once and then retry this tool. If ad.status != 1, report warning and ad.url, follow the returned next_action, and retry only after the user completes that step. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
44151
44317
|
inputSchema: {
|
|
44152
44318
|
type: "object",
|
|
44153
44319
|
properties: {
|
|
@@ -44161,7 +44327,7 @@ var remoteProxyToolSnapshot_default = {
|
|
|
44161
44327
|
},
|
|
44162
44328
|
{
|
|
44163
44329
|
name: "get_debug_feedbacks",
|
|
44164
|
-
description: "Fetch online player feedback for the current Maker project, or query server and Lua session logs when game_session_id is provided. The default feedback mode fetches unprocessed records and marks the returned records as processed. For a read-only feedback query, set fetch_and_mark_processed=false; use the input schema to select other filters or an exact feedback record. Downloaded feedback attachments are saved in the local project. Read only the returned local_dir, local_log_paths, and local_screenshot_paths; do not treat remote attachment paths as local files. Session-log mode returns its own saved paths and progress information; use the returned result to continue when more history is available.",
|
|
44330
|
+
description: "Fetch online player feedback for the current Maker project, or query server and Lua session logs when game_session_id is provided. The default feedback mode fetches unprocessed records and marks the returned records as processed. For a read-only feedback query, set fetch_and_mark_processed=false; use the input schema to select other filters or an exact feedback record. Downloaded feedback attachments are saved in the local project. Read only the returned local_dir, local_log_paths, and local_screenshot_paths; do not treat remote attachment paths as local files. Session-log mode returns its own saved paths and progress information; use the returned result to continue when more history is available. This tool is not retried automatically by the local Maker runtime. If its response is interrupted after dispatch, its execution state may be unknown. For generation, usage, or state-changing operations, verify remote output, state, and usage before deciding whether to retry explicitly.",
|
|
44165
44331
|
inputSchema: {
|
|
44166
44332
|
type: "object",
|
|
44167
44333
|
properties: {
|
|
@@ -44258,7 +44424,7 @@ Received: ${configJson.substring(0, 100)}...`
|
|
|
44258
44424
|
return applyDefaults(config2);
|
|
44259
44425
|
}
|
|
44260
44426
|
function validateConfig(config2) {
|
|
44261
|
-
var _a3;
|
|
44427
|
+
var _a3, _b;
|
|
44262
44428
|
const errors = [];
|
|
44263
44429
|
if (!config2.server) {
|
|
44264
44430
|
errors.push("- Missing required field: server");
|
|
@@ -44306,13 +44472,23 @@ function validateConfig(config2) {
|
|
|
44306
44472
|
errors.push("- options.exposed_tools values must be non-empty strings");
|
|
44307
44473
|
}
|
|
44308
44474
|
}
|
|
44475
|
+
if (((_b = config2.options) == null ? void 0 : _b.replayable_tools) !== void 0) {
|
|
44476
|
+
const replayableTools = config2.options.replayable_tools;
|
|
44477
|
+
if (!Array.isArray(replayableTools)) {
|
|
44478
|
+
errors.push("- options.replayable_tools must be an array of tool names");
|
|
44479
|
+
} else if (!replayableTools.every(
|
|
44480
|
+
(toolName) => typeof toolName === "string" && toolName.trim().length > 0
|
|
44481
|
+
)) {
|
|
44482
|
+
errors.push("- options.replayable_tools values must be non-empty strings");
|
|
44483
|
+
}
|
|
44484
|
+
}
|
|
44309
44485
|
if (errors.length > 0) {
|
|
44310
44486
|
throw new Error("Invalid configuration:\n" + errors.join("\n"));
|
|
44311
44487
|
}
|
|
44312
44488
|
}
|
|
44313
44489
|
var DEFAULT_LOG_ROOT = "/tmp/taptap-mcp/logs";
|
|
44314
44490
|
function applyDefaults(config2) {
|
|
44315
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
44491
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
44316
44492
|
const verbose = ((_a3 = config2.options) == null ? void 0 : _a3.verbose) ?? false;
|
|
44317
44493
|
return {
|
|
44318
44494
|
server: {
|
|
@@ -44334,15 +44510,17 @@ function applyDefaults(config2) {
|
|
|
44334
44510
|
reset_timeout_on_progress: ((_e = config2.options) == null ? void 0 : _e.reset_timeout_on_progress) ?? true,
|
|
44335
44511
|
health_check_interval: ((_f = config2.options) == null ? void 0 : _f.health_check_interval) ?? 3e4,
|
|
44336
44512
|
enable_cookie_sticky: ((_g = config2.options) == null ? void 0 : _g.enable_cookie_sticky) ?? true,
|
|
44337
|
-
|
|
44338
|
-
|
|
44339
|
-
|
|
44513
|
+
disable_standalone_sse: ((_h = config2.options) == null ? void 0 : _h.disable_standalone_sse) ?? false,
|
|
44514
|
+
inject_params_per_call: ((_i = config2.options) == null ? void 0 : _i.inject_params_per_call) ?? true,
|
|
44515
|
+
force_inject_progress_token: ((_j = config2.options) == null ? void 0 : _j.force_inject_progress_token) ?? false,
|
|
44516
|
+
exposed_tools: (_k = config2.options) == null ? void 0 : _k.exposed_tools,
|
|
44517
|
+
replayable_tools: (_l = config2.options) == null ? void 0 : _l.replayable_tools,
|
|
44340
44518
|
log: {
|
|
44341
|
-
root: ((
|
|
44342
|
-
enabled: ((
|
|
44519
|
+
root: ((_n = (_m = config2.options) == null ? void 0 : _m.log) == null ? void 0 : _n.root) ?? DEFAULT_LOG_ROOT,
|
|
44520
|
+
enabled: ((_p = (_o = config2.options) == null ? void 0 : _o.log) == null ? void 0 : _p.enabled) ?? false,
|
|
44343
44521
|
// verbose=true 时自动使用 debug 级别
|
|
44344
|
-
level: verbose ? "debug" : ((
|
|
44345
|
-
max_days: ((
|
|
44522
|
+
level: verbose ? "debug" : ((_r = (_q = config2.options) == null ? void 0 : _q.log) == null ? void 0 : _r.level) ?? "info",
|
|
44523
|
+
max_days: ((_t = (_s = config2.options) == null ? void 0 : _s.log) == null ? void 0 : _t.max_days) ?? 7
|
|
44346
44524
|
}
|
|
44347
44525
|
}
|
|
44348
44526
|
};
|
|
@@ -44352,7 +44530,7 @@ function applyDefaults(config2) {
|
|
|
44352
44530
|
var MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
|
|
44353
44531
|
var MAKER_MCP_TRACKING_SOURCE = "local_mcp";
|
|
44354
44532
|
var MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
|
|
44355
|
-
var MAKER_MCP_VERSION = "0.0.32-beta.
|
|
44533
|
+
var MAKER_MCP_VERSION = "0.0.32-beta.3".trim() ? "0.0.32-beta.3".trim() : "dev";
|
|
44356
44534
|
var TRACKING_ERROR_MAX_LENGTH = 500;
|
|
44357
44535
|
function buildMakerMcpTrackingPayload(event) {
|
|
44358
44536
|
var _a3, _b, _c;
|
|
@@ -44639,11 +44817,11 @@ function createMakerRemoteProxyManager(options = {}) {
|
|
|
44639
44817
|
cachedTools.set(key, tools2);
|
|
44640
44818
|
return tools2;
|
|
44641
44819
|
},
|
|
44642
|
-
async callTool(context, request, requestOptions) {
|
|
44643
|
-
return await run(
|
|
44644
|
-
|
|
44645
|
-
|
|
44646
|
-
);
|
|
44820
|
+
async callTool(context, request, requestOptions, onDispatch) {
|
|
44821
|
+
return await run(context, async (client) => {
|
|
44822
|
+
onDispatch == null ? void 0 : onDispatch();
|
|
44823
|
+
return await client.callTool(request, void 0, requestOptions);
|
|
44824
|
+
});
|
|
44647
44825
|
},
|
|
44648
44826
|
getCachedTools(context) {
|
|
44649
44827
|
return cachedTools.get(createContextKey(context));
|
|
@@ -44665,7 +44843,7 @@ function createMakerRemoteProxyManager(options = {}) {
|
|
|
44665
44843
|
}
|
|
44666
44844
|
|
|
44667
44845
|
// src/maker/server/mcp.ts
|
|
44668
|
-
var VERSION = true ? "0.0.32-beta.
|
|
44846
|
+
var VERSION = true ? "0.0.32-beta.3" : "dev";
|
|
44669
44847
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
44670
44848
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
44671
44849
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -44914,11 +45092,23 @@ async function callRemoteProxyTool(options) {
|
|
|
44914
45092
|
const requestOptions = createRemoteProxyCallToolOptions(options.progressToken, options.extra);
|
|
44915
45093
|
const callTool = options.manager ? async () => {
|
|
44916
45094
|
proxy = createProxy();
|
|
44917
|
-
|
|
44918
|
-
|
|
44919
|
-
|
|
44920
|
-
|
|
44921
|
-
|
|
45095
|
+
let dispatched = false;
|
|
45096
|
+
try {
|
|
45097
|
+
return await options.manager.callTool(
|
|
45098
|
+
proxy,
|
|
45099
|
+
{ name: options.name, arguments: finalArgs },
|
|
45100
|
+
requestOptions,
|
|
45101
|
+
() => {
|
|
45102
|
+
dispatched = true;
|
|
45103
|
+
}
|
|
45104
|
+
);
|
|
45105
|
+
} catch (error2) {
|
|
45106
|
+
throw new RemoteProxyToolCallError(
|
|
45107
|
+
options.name,
|
|
45108
|
+
dispatched ? "unknown" : "not_executed",
|
|
45109
|
+
error2
|
|
45110
|
+
);
|
|
45111
|
+
}
|
|
44922
45112
|
} : async () => {
|
|
44923
45113
|
const transport = trackMakerChildTransport(
|
|
44924
45114
|
new StdioClientTransport({
|
|
@@ -44939,6 +45129,12 @@ async function callRemoteProxyTool(options) {
|
|
|
44939
45129
|
);
|
|
44940
45130
|
try {
|
|
44941
45131
|
await client.connect(transport);
|
|
45132
|
+
} catch (error2) {
|
|
45133
|
+
await client.close().catch(() => {
|
|
45134
|
+
});
|
|
45135
|
+
throw new RemoteProxyToolCallError(options.name, "not_executed", error2);
|
|
45136
|
+
}
|
|
45137
|
+
try {
|
|
44942
45138
|
return await client.callTool(
|
|
44943
45139
|
{
|
|
44944
45140
|
name: options.name,
|
|
@@ -44949,25 +45145,14 @@ async function callRemoteProxyTool(options) {
|
|
|
44949
45145
|
...requestOptions
|
|
44950
45146
|
}
|
|
44951
45147
|
);
|
|
45148
|
+
} catch (error2) {
|
|
45149
|
+
throw new RemoteProxyToolCallError(options.name, "unknown", error2);
|
|
44952
45150
|
} finally {
|
|
44953
45151
|
await client.close().catch(() => {
|
|
44954
45152
|
});
|
|
44955
45153
|
}
|
|
44956
45154
|
};
|
|
44957
|
-
const result = await
|
|
44958
|
-
onRetry: options.progressToken ? (event) => {
|
|
44959
|
-
options.extra.sendNotification({
|
|
44960
|
-
method: "notifications/progress",
|
|
44961
|
-
params: {
|
|
44962
|
-
progressToken: options.progressToken,
|
|
44963
|
-
progress: event.attempt,
|
|
44964
|
-
total: event.attempts,
|
|
44965
|
-
message: event.message
|
|
44966
|
-
}
|
|
44967
|
-
}).catch(() => {
|
|
44968
|
-
});
|
|
44969
|
-
} : void 0
|
|
44970
|
-
});
|
|
45155
|
+
const result = await callTool();
|
|
44971
45156
|
return await materializeRemoteProxyToolAssets({
|
|
44972
45157
|
toolName: options.name,
|
|
44973
45158
|
targetDir: proxy.projectRoot,
|
|
@@ -45352,6 +45537,8 @@ function installMakerServerExitHandlers(remoteProxyManager) {
|
|
|
45352
45537
|
async function formatStatus(options = {}) {
|
|
45353
45538
|
var _a3;
|
|
45354
45539
|
const detail = options.detail === true;
|
|
45540
|
+
const distribution = process.env.TAPTAP_MAKER_DISTRIBUTION;
|
|
45541
|
+
const pluginDistribution = resolveMakerPluginDistribution(distribution);
|
|
45355
45542
|
const projectContext = await resolveMakerProjectContext({
|
|
45356
45543
|
targetDir: options.targetDir,
|
|
45357
45544
|
listClientRoots: options.listClientRoots,
|
|
@@ -45374,7 +45561,7 @@ async function formatStatus(options = {}) {
|
|
|
45374
45561
|
allowRemoteFetch: false,
|
|
45375
45562
|
...detail ? {} : { backgroundRefresh: false }
|
|
45376
45563
|
});
|
|
45377
|
-
const packageUpdateText = detail ?
|
|
45564
|
+
const packageUpdateText = detail ? formatMakerPackageUpdateStatusForDistribution(packageUpdateStatus, distribution) : "";
|
|
45378
45565
|
const projectInitialization = identify.projectRoot ? inspectMakerProjectInitialization(identify.projectRoot) : void 0;
|
|
45379
45566
|
const projectHealth = identify.projectRoot ? inspectMakerProjectHealth(identify.projectRoot, "status") : void 0;
|
|
45380
45567
|
const projectInitializationText = projectInitialization ? formatMakerProjectInitializationStatus(projectInitialization) : "";
|
|
@@ -45410,8 +45597,9 @@ async function formatStatus(options = {}) {
|
|
|
45410
45597
|
`- lua_lsp: ${luaLsp.status}`,
|
|
45411
45598
|
"Maker MCP package update",
|
|
45412
45599
|
`- status: ${packageUpdateStatus.status}`,
|
|
45600
|
+
pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
|
|
45413
45601
|
packageUpdateStatus.target_version ? `- target_version: ${packageUpdateStatus.target_version}` : "",
|
|
45414
|
-
packageUpdateStatus.next_action ? `- next_action: ${packageUpdateStatus.next_action}` : "",
|
|
45602
|
+
pluginDistribution && packageUpdateStatus.status !== "managed_by_plugin" ? `- next_action: ${formatMakerPluginUpdateAction(pluginDistribution)}` : packageUpdateStatus.next_action ? `- next_action: ${packageUpdateStatus.next_action}` : "",
|
|
45415
45603
|
projectInitialization ? `- project_initialization: ${projectInitialization.status}` : "",
|
|
45416
45604
|
projectHealth ? `- project_health: ${projectHealth.status}` : "",
|
|
45417
45605
|
formatMakerClientRootsSummary(projectContext.roots),
|
|
@@ -45437,6 +45625,7 @@ async function formatStatus(options = {}) {
|
|
|
45437
45625
|
"TapTap Maker MCP status",
|
|
45438
45626
|
"",
|
|
45439
45627
|
`- version: ${VERSION}`,
|
|
45628
|
+
pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
|
|
45440
45629
|
`- env: ${env}`,
|
|
45441
45630
|
`- project_context_source: ${projectContext.source}`,
|
|
45442
45631
|
summaryText
|
|
@@ -45446,6 +45635,7 @@ async function formatStatus(options = {}) {
|
|
|
45446
45635
|
"TapTap Maker MCP status",
|
|
45447
45636
|
"",
|
|
45448
45637
|
`- version: ${VERSION}`,
|
|
45638
|
+
pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
|
|
45449
45639
|
`- env: ${env}`,
|
|
45450
45640
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
45451
45641
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
@@ -45506,6 +45696,21 @@ async function formatStatus(options = {}) {
|
|
|
45506
45696
|
projectSection
|
|
45507
45697
|
].filter(Boolean).join("\n");
|
|
45508
45698
|
}
|
|
45699
|
+
function formatMakerPackageUpdateStatusForDistribution(status, distribution) {
|
|
45700
|
+
const formatted = formatMakerPackageUpdateStatus(status);
|
|
45701
|
+
const pluginDistribution = resolveMakerPluginDistribution(distribution);
|
|
45702
|
+
if (!pluginDistribution) {
|
|
45703
|
+
return formatted;
|
|
45704
|
+
}
|
|
45705
|
+
const lines = [
|
|
45706
|
+
...formatted.split("\n").filter((line) => !line.startsWith("- next_action:")),
|
|
45707
|
+
`- distribution: ${pluginDistribution.id}`
|
|
45708
|
+
];
|
|
45709
|
+
if (status.status !== "managed_by_plugin") {
|
|
45710
|
+
lines.push(`- next_action: ${formatMakerPluginUpdateAction(pluginDistribution)}`);
|
|
45711
|
+
}
|
|
45712
|
+
return lines.join("\n");
|
|
45713
|
+
}
|
|
45509
45714
|
function formatAuthNextStep(options) {
|
|
45510
45715
|
if (!options.hasTapAuth) {
|
|
45511
45716
|
if (options.hasPat) {
|
|
@@ -45705,7 +45910,8 @@ async function formatMakerProxyToolsStatusSafely(options) {
|
|
|
45705
45910
|
`- missing_tools: ${MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES.join(", ")}`,
|
|
45706
45911
|
"- build_available: no",
|
|
45707
45912
|
`- failure_message: ${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
45708
|
-
"-
|
|
45913
|
+
"- build_retry_policy: up to 5 total attempts, 30s apart",
|
|
45914
|
+
"- proxy_tool_retry_policy: single attempt; never replayed automatically",
|
|
45709
45915
|
"- next_action: Maker proxy 连接失败;远端 proxy tools 和 build 构建都不可用。请检查网络、PAT/TapTap token、Maker MCP 环境和远端服务后重试。"
|
|
45710
45916
|
].join("\n");
|
|
45711
45917
|
}
|
|
@@ -46206,7 +46412,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
46206
46412
|
function createRemoteProxyContext(options) {
|
|
46207
46413
|
const identify = identifyMakerProject({ cwd: options.targetDir });
|
|
46208
46414
|
if (!identify.projectRoot || !identify.projectId) {
|
|
46209
|
-
throw new
|
|
46415
|
+
throw new MakerBuildContextError(
|
|
46210
46416
|
`${options.targetDir} is not bound to a Maker project. Run taptap-maker init first.`
|
|
46211
46417
|
);
|
|
46212
46418
|
}
|
|
@@ -46215,7 +46421,7 @@ function createRemoteProxyContext(options) {
|
|
|
46215
46421
|
const env = getMakerEnvironment(options.env, identify.projectRoot);
|
|
46216
46422
|
const tapAuth = loadTapAuth();
|
|
46217
46423
|
if (!tapAuth) {
|
|
46218
|
-
throw new
|
|
46424
|
+
throw new MakerBuildContextError("Tap auth not found. Run `taptap-maker login` first.");
|
|
46219
46425
|
}
|
|
46220
46426
|
let userId = projectConfig == null ? void 0 : projectConfig.user_id;
|
|
46221
46427
|
if (!userId) {
|
|
@@ -46223,7 +46429,7 @@ function createRemoteProxyContext(options) {
|
|
|
46223
46429
|
userId = jwt2 ? getUserIdFromMakerJwt(jwt2) : void 0;
|
|
46224
46430
|
}
|
|
46225
46431
|
if (!userId) {
|
|
46226
|
-
throw new
|
|
46432
|
+
throw new MakerBuildContextError(
|
|
46227
46433
|
"Cannot resolve user_id. Re-run taptap-maker init with PAT so the project config can cache user_id."
|
|
46228
46434
|
);
|
|
46229
46435
|
}
|
|
@@ -46246,7 +46452,9 @@ function createRemoteProxyContext(options) {
|
|
|
46246
46452
|
verbose: true,
|
|
46247
46453
|
reset_timeout_on_progress: true,
|
|
46248
46454
|
force_inject_progress_token: true,
|
|
46249
|
-
|
|
46455
|
+
disable_standalone_sse: true,
|
|
46456
|
+
exposed_tools: options.exposedTools,
|
|
46457
|
+
replayable_tools: ["build"]
|
|
46250
46458
|
}
|
|
46251
46459
|
};
|
|
46252
46460
|
const proxyConfigJson = JSON.stringify(proxyCfg);
|
|
@@ -46379,6 +46587,12 @@ var RemoteBuildFailedError = class extends Error {
|
|
|
46379
46587
|
this.buildResult = buildResult;
|
|
46380
46588
|
}
|
|
46381
46589
|
};
|
|
46590
|
+
var MakerBuildContextError = class extends Error {
|
|
46591
|
+
constructor(message) {
|
|
46592
|
+
super(message);
|
|
46593
|
+
this.name = "MakerBuildContextError";
|
|
46594
|
+
}
|
|
46595
|
+
};
|
|
46382
46596
|
async function buildCurrentDirectory(options) {
|
|
46383
46597
|
var _a3;
|
|
46384
46598
|
const localChanges = await readMakerProjectLocalChanges(options.targetDir);
|
|
@@ -46430,12 +46644,23 @@ async function buildCurrentDirectory(options) {
|
|
|
46430
46644
|
try {
|
|
46431
46645
|
buildResult = await runRemoteBuildCurrentDirectory(options, localChanges.projectRoot);
|
|
46432
46646
|
} catch (error2) {
|
|
46647
|
+
const buildFailure = toMakerBuildFailure(error2);
|
|
46648
|
+
if (error2 instanceof MakerBuildContextError) {
|
|
46649
|
+
return {
|
|
46650
|
+
mode: "build_context_failed_before_remote",
|
|
46651
|
+
projectRoot: localChanges.projectRoot,
|
|
46652
|
+
projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
|
|
46653
|
+
codeSubmitStatus: "succeeded",
|
|
46654
|
+
submitResult,
|
|
46655
|
+
buildFailure
|
|
46656
|
+
};
|
|
46657
|
+
}
|
|
46433
46658
|
return {
|
|
46434
46659
|
mode: "build_failed_after_submit",
|
|
46435
46660
|
projectRoot: localChanges.projectRoot,
|
|
46436
46661
|
projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
|
|
46437
46662
|
submitResult,
|
|
46438
|
-
buildFailure
|
|
46663
|
+
buildFailure
|
|
46439
46664
|
};
|
|
46440
46665
|
}
|
|
46441
46666
|
return {
|
|
@@ -46456,6 +46681,17 @@ async function buildCurrentDirectory(options) {
|
|
|
46456
46681
|
buildFailure: toMakerBuildFailure(error2)
|
|
46457
46682
|
};
|
|
46458
46683
|
}
|
|
46684
|
+
const buildFailure = toMakerBuildFailure(error2);
|
|
46685
|
+
if (error2 instanceof MakerBuildContextError) {
|
|
46686
|
+
const identify = identifyMakerProject({ cwd: options.targetDir });
|
|
46687
|
+
return {
|
|
46688
|
+
mode: "build_context_failed_before_remote",
|
|
46689
|
+
projectRoot: identify.projectRoot || path18.resolve(options.targetDir),
|
|
46690
|
+
projectId: identify.projectId || "unknown",
|
|
46691
|
+
codeSubmitStatus: "skipped_by_user",
|
|
46692
|
+
buildFailure
|
|
46693
|
+
};
|
|
46694
|
+
}
|
|
46459
46695
|
throw error2;
|
|
46460
46696
|
}
|
|
46461
46697
|
}
|
|
@@ -47045,12 +47281,14 @@ function formatRemoteToolResult(result) {
|
|
|
47045
47281
|
}).join("\n");
|
|
47046
47282
|
}
|
|
47047
47283
|
function formatBuildResult(result, progressSummary) {
|
|
47284
|
+
var _a3;
|
|
47048
47285
|
if (result.mode === "remote_build_failed") {
|
|
47049
47286
|
return [
|
|
47050
47287
|
"✗ Remote Maker build failed",
|
|
47051
47288
|
"",
|
|
47052
47289
|
`- project_root: ${result.projectRoot}`,
|
|
47053
47290
|
`- project_id: ${result.projectId}`,
|
|
47291
|
+
...formatBuildFailureStageLines("remote_build", "skipped_by_user", "failed"),
|
|
47054
47292
|
`- maker_url: ${result.buildResult.makerUrl || formatMakerAppWebUrl(result.buildResult.projectId, result.buildResult.env)}`,
|
|
47055
47293
|
`- project_path: ${result.buildResult.projectPath}`,
|
|
47056
47294
|
`- timeout_ms: ${result.buildResult.timeoutMs}`,
|
|
@@ -47059,6 +47297,10 @@ function formatBuildResult(result, progressSummary) {
|
|
|
47059
47297
|
"",
|
|
47060
47298
|
...formatMakerBuildFailureLines(result.buildFailure),
|
|
47061
47299
|
"",
|
|
47300
|
+
...formatRemoteBuildDiagnosisLines(result.buildFailure, result.projectRoot),
|
|
47301
|
+
"",
|
|
47302
|
+
...formatBuildLocalExecutionCheckLines({ context: "remote_build" }),
|
|
47303
|
+
"",
|
|
47062
47304
|
"remote_result:",
|
|
47063
47305
|
indent2(String(sanitizeRemoteDiagnosticValue(result.buildResult.resultText)))
|
|
47064
47306
|
].filter(Boolean).join("\n");
|
|
@@ -47069,6 +47311,7 @@ function formatBuildResult(result, progressSummary) {
|
|
|
47069
47311
|
"",
|
|
47070
47312
|
`- project_root: ${result.projectRoot}`,
|
|
47071
47313
|
`- project_id: ${result.projectId}`,
|
|
47314
|
+
...formatBuildFailureStageLines("code_submit", "failed", "not_started"),
|
|
47072
47315
|
`- branch: ${result.submitResult.branch}`,
|
|
47073
47316
|
`- status: ${result.submitResult.status}`,
|
|
47074
47317
|
`- committed: ${result.submitResult.committed ? "yes" : "no"}`,
|
|
@@ -47083,8 +47326,10 @@ function formatBuildResult(result, progressSummary) {
|
|
|
47083
47326
|
"",
|
|
47084
47327
|
...formatPushRecoveryLines(result.submitResult),
|
|
47085
47328
|
"",
|
|
47086
|
-
...formatMakerFailureLines(result.submitResult.failure)
|
|
47087
|
-
|
|
47329
|
+
...formatMakerFailureLines(result.submitResult.failure),
|
|
47330
|
+
"",
|
|
47331
|
+
...formatBuildLocalExecutionCheckLines({ failure: result.submitResult.failure })
|
|
47332
|
+
] : ["", ...formatBuildLocalExecutionCheckLines()]
|
|
47088
47333
|
].filter(Boolean).join("\n");
|
|
47089
47334
|
}
|
|
47090
47335
|
if (result.mode === "settings_invalid_before_build") {
|
|
@@ -47093,6 +47338,7 @@ function formatBuildResult(result, progressSummary) {
|
|
|
47093
47338
|
"",
|
|
47094
47339
|
`- project_root: ${result.projectRoot}`,
|
|
47095
47340
|
`- project_id: ${result.projectId}`,
|
|
47341
|
+
...formatBuildFailureStageLines("project_validation", "not_started", "not_started"),
|
|
47096
47342
|
...formatProgressSummary(progressSummary),
|
|
47097
47343
|
"",
|
|
47098
47344
|
formatMakerProjectSettingsStatus(result.settingsStatus)
|
|
@@ -47104,17 +47350,41 @@ function formatBuildResult(result, progressSummary) {
|
|
|
47104
47350
|
"",
|
|
47105
47351
|
`- project_root: ${result.projectRoot}`,
|
|
47106
47352
|
`- project_id: ${result.projectId}`,
|
|
47353
|
+
...formatBuildFailureStageLines("project_validation", "not_started", "not_started"),
|
|
47107
47354
|
...formatProgressSummary(progressSummary),
|
|
47108
47355
|
"",
|
|
47109
47356
|
formatMakerProjectHealthStatus(result.projectHealth)
|
|
47110
47357
|
].filter(Boolean).join("\n");
|
|
47111
47358
|
}
|
|
47359
|
+
if (result.mode === "build_context_failed_before_remote") {
|
|
47360
|
+
return [
|
|
47361
|
+
result.codeSubmitStatus === "succeeded" ? "✗ Maker project submitted, but local build context preparation failed; remote build was not started" : "✗ Local build context preparation failed; remote build was not started",
|
|
47362
|
+
"",
|
|
47363
|
+
`- project_root: ${result.projectRoot}`,
|
|
47364
|
+
`- project_id: ${result.projectId}`,
|
|
47365
|
+
...formatBuildFailureStageLines(
|
|
47366
|
+
"local_build_context",
|
|
47367
|
+
result.codeSubmitStatus,
|
|
47368
|
+
"not_started"
|
|
47369
|
+
),
|
|
47370
|
+
result.submitResult ? `- branch: ${result.submitResult.branch}` : "",
|
|
47371
|
+
result.submitResult ? `- status: ${result.submitResult.status}` : "",
|
|
47372
|
+
result.submitResult ? `- committed: ${result.submitResult.committed ? "yes" : "no"}` : "",
|
|
47373
|
+
((_a3 = result.submitResult) == null ? void 0 : _a3.commitHash) ? `- commit_hash: ${result.submitResult.commitHash}` : "",
|
|
47374
|
+
...formatProgressSummary(progressSummary),
|
|
47375
|
+
"",
|
|
47376
|
+
...formatMakerBuildFailureLines(result.buildFailure),
|
|
47377
|
+
"",
|
|
47378
|
+
...formatLocalBuildContextDiagnosisLines(result.buildFailure)
|
|
47379
|
+
].filter(Boolean).join("\n");
|
|
47380
|
+
}
|
|
47112
47381
|
if (result.mode === "build_failed_after_submit") {
|
|
47113
47382
|
return [
|
|
47114
47383
|
"✗ Maker project submitted, but remote Maker build failed",
|
|
47115
47384
|
"",
|
|
47116
47385
|
`- project_root: ${result.projectRoot}`,
|
|
47117
47386
|
`- project_id: ${result.projectId}`,
|
|
47387
|
+
...formatBuildFailureStageLines("remote_build", "succeeded", "failed"),
|
|
47118
47388
|
`- branch: ${result.submitResult.branch}`,
|
|
47119
47389
|
`- status: ${result.submitResult.status}`,
|
|
47120
47390
|
`- committed: ${result.submitResult.committed ? "yes" : "no"}`,
|
|
@@ -47124,7 +47394,11 @@ function formatBuildResult(result, progressSummary) {
|
|
|
47124
47394
|
result.submitResult.transientRetries ? `- transient_git_retries: ${result.submitResult.transientRetries}` : "",
|
|
47125
47395
|
...formatProgressSummary(progressSummary),
|
|
47126
47396
|
"",
|
|
47127
|
-
...formatMakerBuildFailureLines(result.buildFailure)
|
|
47397
|
+
...formatMakerBuildFailureLines(result.buildFailure),
|
|
47398
|
+
"",
|
|
47399
|
+
...formatRemoteBuildDiagnosisLines(result.buildFailure, result.projectRoot),
|
|
47400
|
+
"",
|
|
47401
|
+
...formatBuildLocalExecutionCheckLines({ context: "remote_build" })
|
|
47128
47402
|
].filter(Boolean).join("\n");
|
|
47129
47403
|
}
|
|
47130
47404
|
const submitLines = result.submitResult ? [
|
|
@@ -47244,6 +47518,110 @@ ${indent2(formatDiagnosticJson(details))}` : "",
|
|
|
47244
47518
|
${indent2(String(sanitizeRemoteDiagnosticValue(failure.stack)))}` : ""
|
|
47245
47519
|
].filter(Boolean);
|
|
47246
47520
|
}
|
|
47521
|
+
function formatBuildFailureStageLines(failureStage, codeSubmitStatus, remoteBuildStatus) {
|
|
47522
|
+
return [
|
|
47523
|
+
`- failure_stage: ${failureStage}`,
|
|
47524
|
+
`- code_submit_status: ${codeSubmitStatus}`,
|
|
47525
|
+
`- remote_build_status: ${remoteBuildStatus}`
|
|
47526
|
+
];
|
|
47527
|
+
}
|
|
47528
|
+
function formatBuildLocalExecutionCheckLines(options = {}) {
|
|
47529
|
+
if (options.context === "remote_build") {
|
|
47530
|
+
return [
|
|
47531
|
+
"local_execution_check:",
|
|
47532
|
+
"- restriction_signal: not_detected",
|
|
47533
|
+
"- diagnostic_priority: remote_build_error_first",
|
|
47534
|
+
"- sandbox_check_condition: only_if_local_commands_are_also_blocked",
|
|
47535
|
+
'- fallback_check: If Windows PowerShell, CLI, Git, or MCP commands are also blocked locally, ask the user to check the AI client sandbox/access setting and enable Full Access mode ("完全访问模式") only for a trusted project.',
|
|
47536
|
+
"- evidence_rule: A remote build failure is not evidence of a local sandbox restriction."
|
|
47537
|
+
];
|
|
47538
|
+
}
|
|
47539
|
+
const restrictionSignal = options.failure ? hasLocalExecutionRestrictionSignal(options.failure) : false;
|
|
47540
|
+
if (options.failure && !restrictionSignal && isRemoteGitFailure(options.failure)) {
|
|
47541
|
+
return [
|
|
47542
|
+
"local_execution_check:",
|
|
47543
|
+
"- restriction_signal: not_detected",
|
|
47544
|
+
"- diagnostic_priority: remote_git_error_first",
|
|
47545
|
+
"- sandbox_check_condition: only_if_local_commands_are_also_blocked",
|
|
47546
|
+
'- fallback_check: If Windows PowerShell, CLI, Git, or MCP commands are also blocked locally, ask the user to check the AI client sandbox/access setting and enable Full Access mode ("完全访问模式") only for a trusted project.',
|
|
47547
|
+
"- evidence_rule: A remote Git failure is not evidence of a local sandbox restriction."
|
|
47548
|
+
];
|
|
47549
|
+
}
|
|
47550
|
+
return [
|
|
47551
|
+
"local_execution_check:",
|
|
47552
|
+
`- restriction_signal: ${restrictionSignal ? "detected" : "not_detected"}`,
|
|
47553
|
+
restrictionSignal ? "- assessment: The current error reports a sandbox or local access restriction; code execution may be blocked before Maker can complete the build workflow." : "- assessment: Maker cannot inspect the AI client access-mode setting, so the current build failure does not confirm whether local execution is restricted.",
|
|
47554
|
+
"- windows_check: Check whether the AI client is running Windows PowerShell, CLI, Git, or MCP commands in a sandbox or restricted mode.",
|
|
47555
|
+
restrictionSignal ? '- next_action: For a trusted project, enable Full Access mode ("完全访问模式") in the AI client, reconnect MCP, and retry only after confirming local commands can execute.' : '- next_action: Check the AI client sandbox/access setting. For a trusted project, enable Full Access mode ("完全访问模式"), reconnect MCP, and retry after confirming local commands can execute.',
|
|
47556
|
+
"- evidence_rule: This is a diagnostic check, not proof that sandbox restrictions caused this failure."
|
|
47557
|
+
];
|
|
47558
|
+
}
|
|
47559
|
+
function hasLocalExecutionRestrictionSignal(failure) {
|
|
47560
|
+
const localText = gitFailureSearchText(failure).split(/\r?\n/u).filter((line) => !/^\s*remote:/iu.test(line)).join("\n");
|
|
47561
|
+
const hasLocalProcessMarker = /\bPowerShell(?:\.exe)?\b|\bspawn\s+(?:(?:[^\r\n]{0,160})[\\/])?(?:git(?:\.exe)?|PowerShell(?:\.exe)?)\b/iu.test(
|
|
47562
|
+
localText
|
|
47563
|
+
);
|
|
47564
|
+
const hasRestrictionMarker = /sandbox|沙盒|blocked|disabled|not permitted|EPERM|EACCES/iu.test(
|
|
47565
|
+
localText
|
|
47566
|
+
);
|
|
47567
|
+
return hasLocalProcessMarker && hasRestrictionMarker;
|
|
47568
|
+
}
|
|
47569
|
+
function isRemoteGitFailure(failure) {
|
|
47570
|
+
return [
|
|
47571
|
+
"remote_transient",
|
|
47572
|
+
"remote_rejected",
|
|
47573
|
+
"auth",
|
|
47574
|
+
"branch_not_allowed",
|
|
47575
|
+
"forbidden_path"
|
|
47576
|
+
].includes(failure.classification) || /(?:^|\n)\s*remote:/iu.test(gitFailureSearchText(failure));
|
|
47577
|
+
}
|
|
47578
|
+
function gitFailureSearchText(failure) {
|
|
47579
|
+
return [failure.message, failure.stderr, failure.stdout].filter(Boolean).join("\n");
|
|
47580
|
+
}
|
|
47581
|
+
function formatRemoteBuildDiagnosisLines(failure, projectRoot) {
|
|
47582
|
+
const isRequestTimeout = isMcpRequestTimeoutFailure(failure);
|
|
47583
|
+
return [
|
|
47584
|
+
"remote_build_diagnosis:",
|
|
47585
|
+
isRequestTimeout ? "- failure_signal: mcp_request_timeout" : "",
|
|
47586
|
+
"- root_cause: unconfirmed",
|
|
47587
|
+
isRequestTimeout ? "- maker_server_fault_confirmed: no" : "",
|
|
47588
|
+
"- inspect_first: returned build_failure and any remote_result for code or resource diagnostics",
|
|
47589
|
+
"- diagnostic_action_modified_local_project_files: no",
|
|
47590
|
+
...isRequestTimeout ? ["", ...formatMcpTimeoutLocalDiagnosticLines(projectRoot)] : []
|
|
47591
|
+
].filter(Boolean);
|
|
47592
|
+
}
|
|
47593
|
+
function formatLocalBuildContextDiagnosisLines(failure) {
|
|
47594
|
+
return [
|
|
47595
|
+
"local_build_context_diagnosis:",
|
|
47596
|
+
"- root_cause: known_local_context",
|
|
47597
|
+
"- remote_request_status: not_started",
|
|
47598
|
+
`- next_action: ${failure.message}`
|
|
47599
|
+
];
|
|
47600
|
+
}
|
|
47601
|
+
function isMcpRequestTimeoutFailure(failure) {
|
|
47602
|
+
return /MCP error\s+-32001:\s*Request timed out/iu.test(failure.message);
|
|
47603
|
+
}
|
|
47604
|
+
function formatMcpTimeoutLocalDiagnosticLines(projectRoot) {
|
|
47605
|
+
const processCwd = process.cwd();
|
|
47606
|
+
const cwdAlignment = normalizePathForCompare2(processCwd) === normalizePathForCompare2(projectRoot) ? "same_project" : "different_from_project";
|
|
47607
|
+
return [
|
|
47608
|
+
"mcp_timeout_local_diagnostics:",
|
|
47609
|
+
"- mode: read_only",
|
|
47610
|
+
`- project_root: ${projectRoot}`,
|
|
47611
|
+
`- mcp_process_cwd: ${processCwd}`,
|
|
47612
|
+
`- cwd_alignment: ${cwdAlignment}`,
|
|
47613
|
+
`- node_version: ${process.version}`,
|
|
47614
|
+
`- platform: ${process.platform}/${process.arch}`,
|
|
47615
|
+
`- node_exec_path: ${process.execPath}`,
|
|
47616
|
+
"- active_client_config: not_checked",
|
|
47617
|
+
"- active_client_session: not_checked",
|
|
47618
|
+
"- limitation: Maker MCP cannot inspect the active AI client's command, args, workspace Roots, session, or request timeout.",
|
|
47619
|
+
"- next_action_1: Run Maker doctor for project_root through the active client launcher; standalone CLI equivalent: `taptap-maker doctor --target-dir <PROJECT_DIR>`.",
|
|
47620
|
+
"- next_action_2: Inspect the actual active client MCP command, args, cwd/Roots, session and tool registration, request timeout, and Node runtime.",
|
|
47621
|
+
"- evidence_rule: Do not claim a Maker server outage without HTTP 5xx, server logs, or service status evidence.",
|
|
47622
|
+
"- retry_rule: Do not retry the build blindly; diagnose the failed boundary first."
|
|
47623
|
+
];
|
|
47624
|
+
}
|
|
47247
47625
|
function buildFailureDiagnosticFields(failure) {
|
|
47248
47626
|
const details = {};
|
|
47249
47627
|
for (const [key, value] of Object.entries(failure)) {
|
|
@@ -47274,6 +47652,7 @@ ${indent2(failure.stdout)}` : "",
|
|
|
47274
47652
|
function formatToolException(toolName, error2) {
|
|
47275
47653
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
47276
47654
|
const stack = error2 instanceof Error ? error2.stack : void 0;
|
|
47655
|
+
const buildLocalExecutionCheckLines = toolName === "maker_build_current_directory" && !isKnownBuildContextError(error2) ? ["", ...formatBuildLocalExecutionCheckLines()] : [];
|
|
47277
47656
|
if (error2 instanceof MakerGitNotFoundError) {
|
|
47278
47657
|
return [
|
|
47279
47658
|
"✗ Maker MCP tool stopped",
|
|
@@ -47283,7 +47662,8 @@ function formatToolException(toolName, error2) {
|
|
|
47283
47662
|
"",
|
|
47284
47663
|
message,
|
|
47285
47664
|
"",
|
|
47286
|
-
"next_action: 请只引导用户安装 Git;在 `git --version` 可用之前,不要继续调用 clone、fetch、commit 或 push。"
|
|
47665
|
+
"next_action: 请只引导用户安装 Git;在 `git --version` 可用之前,不要继续调用 clone、fetch、commit 或 push。",
|
|
47666
|
+
...buildLocalExecutionCheckLines
|
|
47287
47667
|
].join("\n");
|
|
47288
47668
|
}
|
|
47289
47669
|
if (error2 instanceof MakerCloneFailedError) {
|
|
@@ -47353,9 +47733,19 @@ function formatToolException(toolName, error2) {
|
|
|
47353
47733
|
"debug:",
|
|
47354
47734
|
stack ? indent2(stack) : indent2(message),
|
|
47355
47735
|
"",
|
|
47356
|
-
"next_action: 请把上面的完整错误反馈给开发者;如果本地已有 commit 但 push 未完成,不要重复 commit,直接重试 maker_build_current_directory。"
|
|
47736
|
+
"next_action: 请把上面的完整错误反馈给开发者;如果本地已有 commit 但 push 未完成,不要重复 commit,直接重试 maker_build_current_directory。",
|
|
47737
|
+
...buildLocalExecutionCheckLines
|
|
47357
47738
|
].join("\n");
|
|
47358
47739
|
}
|
|
47740
|
+
function isKnownBuildContextError(error2) {
|
|
47741
|
+
if (error2 instanceof MakerBuildContextError || error2 instanceof MakerProjectContextAmbiguousError) {
|
|
47742
|
+
return true;
|
|
47743
|
+
}
|
|
47744
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
47745
|
+
return /target_dir must be a string when provided|is not bound to a Maker project|must be an independent Git repository before build or submit|is bound to a Maker project but is not a Git repository/iu.test(
|
|
47746
|
+
message
|
|
47747
|
+
);
|
|
47748
|
+
}
|
|
47359
47749
|
function stripNestedMcpErrorPrefixes(message) {
|
|
47360
47750
|
const prefix = /^MCP error -?\d+:\s*/i;
|
|
47361
47751
|
let concise = message.trim();
|
|
@@ -47454,10 +47844,10 @@ function indent2(value) {
|
|
|
47454
47844
|
|
|
47455
47845
|
// src/maker/cli/commands.ts
|
|
47456
47846
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
47457
|
-
import
|
|
47458
|
-
import
|
|
47459
|
-
import
|
|
47460
|
-
import
|
|
47847
|
+
import crypto5 from "node:crypto";
|
|
47848
|
+
import fs25 from "node:fs";
|
|
47849
|
+
import os8 from "node:os";
|
|
47850
|
+
import path26 from "node:path";
|
|
47461
47851
|
import readline from "node:readline/promises";
|
|
47462
47852
|
import { stdin as input, stdout as output } from "node:process";
|
|
47463
47853
|
import { pathToFileURL } from "node:url";
|
|
@@ -47676,6 +48066,7 @@ var SELF_RUNTIME_DIRECTORIES = [
|
|
|
47676
48066
|
"skills/update-taptap-mcp"
|
|
47677
48067
|
];
|
|
47678
48068
|
var SELF_RUNTIME_FILES = ["dist/maker.js", "docs/MAKER_MCP_CONNECTION_TROUBLESHOOTING.md"];
|
|
48069
|
+
var SELF_RUNTIME_COPY_FALLBACK_CODES = /* @__PURE__ */ new Set(["EIO", "EACCES", "EPERM"]);
|
|
47679
48070
|
function resolveMakerPackageSpec(packageName, currentVersion) {
|
|
47680
48071
|
return PUBLISHED_VERSION_PATTERN.test(currentVersion) ? `${packageName}@${currentVersion}` : packageName;
|
|
47681
48072
|
}
|
|
@@ -47704,9 +48095,10 @@ function materializeMakerSelfLauncher(options) {
|
|
|
47704
48095
|
fs18.copyFileSync(sourcePath, targetPath);
|
|
47705
48096
|
}
|
|
47706
48097
|
for (const relativePath of SELF_RUNTIME_DIRECTORIES) {
|
|
47707
|
-
|
|
47708
|
-
|
|
47709
|
-
|
|
48098
|
+
copySelfRuntimeDirectory(
|
|
48099
|
+
path19.join(sourceRoot, relativePath),
|
|
48100
|
+
path19.join(runtimeRoot, relativePath)
|
|
48101
|
+
);
|
|
47710
48102
|
}
|
|
47711
48103
|
}
|
|
47712
48104
|
const stableBundle = path19.join(runtimeRoot, "dist", "maker.js");
|
|
@@ -47717,6 +48109,29 @@ function materializeMakerSelfLauncher(options) {
|
|
|
47717
48109
|
commandAndArgs: [execPath, stableBundle]
|
|
47718
48110
|
};
|
|
47719
48111
|
}
|
|
48112
|
+
function copySelfRuntimeDirectory(sourcePath, targetPath) {
|
|
48113
|
+
try {
|
|
48114
|
+
fs18.cpSync(sourcePath, targetPath, { recursive: true });
|
|
48115
|
+
} catch (error2) {
|
|
48116
|
+
const code = typeof error2 === "object" && error2 !== null && "code" in error2 ? String(error2.code) : void 0;
|
|
48117
|
+
if (!code || !SELF_RUNTIME_COPY_FALLBACK_CODES.has(code)) {
|
|
48118
|
+
throw error2;
|
|
48119
|
+
}
|
|
48120
|
+
copyDirectoryEntries(sourcePath, targetPath);
|
|
48121
|
+
}
|
|
48122
|
+
}
|
|
48123
|
+
function copyDirectoryEntries(sourcePath, targetPath) {
|
|
48124
|
+
fs18.mkdirSync(targetPath, { recursive: true });
|
|
48125
|
+
for (const entry of fs18.readdirSync(sourcePath, { withFileTypes: true })) {
|
|
48126
|
+
const sourceEntry = path19.join(sourcePath, entry.name);
|
|
48127
|
+
const targetEntry = path19.join(targetPath, entry.name);
|
|
48128
|
+
if (entry.isDirectory()) {
|
|
48129
|
+
copyDirectoryEntries(sourceEntry, targetEntry);
|
|
48130
|
+
} else {
|
|
48131
|
+
fs18.copyFileSync(sourceEntry, targetEntry);
|
|
48132
|
+
}
|
|
48133
|
+
}
|
|
48134
|
+
}
|
|
47720
48135
|
function resolveMakerMcpLauncher(options) {
|
|
47721
48136
|
const platform = options.platform ?? process.platform;
|
|
47722
48137
|
if (platform !== "win32") {
|
|
@@ -47882,6 +48297,7 @@ import { spawnSync as spawnSync7 } from "node:child_process";
|
|
|
47882
48297
|
import fs20 from "node:fs";
|
|
47883
48298
|
import os5 from "node:os";
|
|
47884
48299
|
import path21 from "node:path";
|
|
48300
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
47885
48301
|
|
|
47886
48302
|
// src/maker/cli/dshMcpConfig.ts
|
|
47887
48303
|
var import_yaml = __toESM(require_dist2());
|
|
@@ -48140,6 +48556,25 @@ function parseMakerMcpReportContext(input2) {
|
|
|
48140
48556
|
error_message: trimmed
|
|
48141
48557
|
};
|
|
48142
48558
|
}
|
|
48559
|
+
function validateMakerMcpReportContext(context) {
|
|
48560
|
+
var _a3, _b;
|
|
48561
|
+
const errorMessage = ((_a3 = context.error_message) == null ? void 0 : _a3.trim()) || "";
|
|
48562
|
+
const hasErrorCode = typeof context.error_code === "number" || typeof context.error_code === "string" && context.error_code.trim().length > 0;
|
|
48563
|
+
const hasFailedOperation = Boolean((_b = context.failed_operation) == null ? void 0 : _b.trim());
|
|
48564
|
+
if (errorMessage === "Need to call maker_build_current_directory" && !hasErrorCode) {
|
|
48565
|
+
return {
|
|
48566
|
+
ok: false,
|
|
48567
|
+
reason: "This is an expected Maker project build prerequisite, not an MCP connectivity failure."
|
|
48568
|
+
};
|
|
48569
|
+
}
|
|
48570
|
+
if (hasErrorCode || hasFailedOperation || errorMessage) {
|
|
48571
|
+
return { ok: true };
|
|
48572
|
+
}
|
|
48573
|
+
return {
|
|
48574
|
+
ok: false,
|
|
48575
|
+
reason: "Report context must include at least one of error_code, failed_operation, or error_message."
|
|
48576
|
+
};
|
|
48577
|
+
}
|
|
48143
48578
|
function extractMakerMcpServerConfig(config2, mcpName) {
|
|
48144
48579
|
const container = isRecord4(config2.mcpServers) ? config2.mcpServers : isRecord4(config2.mcp) ? config2.mcp : void 0;
|
|
48145
48580
|
const server = container == null ? void 0 : container[mcpName];
|
|
@@ -48171,6 +48606,40 @@ function inspectMakerMcpClientConfig(options) {
|
|
|
48171
48606
|
const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
|
|
48172
48607
|
return { ide, status, entries };
|
|
48173
48608
|
}
|
|
48609
|
+
function resolveMakerMcpReportRuntime(options) {
|
|
48610
|
+
const pluginDistribution = resolveMakerPluginDistribution(options.distribution);
|
|
48611
|
+
if (!pluginDistribution) {
|
|
48612
|
+
return void 0;
|
|
48613
|
+
}
|
|
48614
|
+
if (!options.bundleUrl) {
|
|
48615
|
+
throw new Error(
|
|
48616
|
+
`${pluginDistribution.displayName} plugin diagnostics require the active Maker bundle URL.`
|
|
48617
|
+
);
|
|
48618
|
+
}
|
|
48619
|
+
const bundlePath = path21.resolve(fileURLToPath4(options.bundleUrl));
|
|
48620
|
+
const pluginRoot = path21.dirname(path21.dirname(bundlePath));
|
|
48621
|
+
const execPath = options.execPath ?? process.execPath;
|
|
48622
|
+
return {
|
|
48623
|
+
distribution: pluginDistribution.id,
|
|
48624
|
+
client: pluginDistribution.client,
|
|
48625
|
+
config_source: {
|
|
48626
|
+
format: "json",
|
|
48627
|
+
paths: [path21.join(pluginRoot, ".mcp.json")],
|
|
48628
|
+
mcp_name: "taptap-maker-plugin"
|
|
48629
|
+
},
|
|
48630
|
+
launcher: {
|
|
48631
|
+
kind: "self_runtime",
|
|
48632
|
+
command: execPath,
|
|
48633
|
+
args: [bundlePath],
|
|
48634
|
+
commandAndArgs: [execPath, bundlePath]
|
|
48635
|
+
},
|
|
48636
|
+
cwd: pluginRoot,
|
|
48637
|
+
env: {
|
|
48638
|
+
TAPTAP_MAKER_DISTRIBUTION: pluginDistribution.id,
|
|
48639
|
+
TAPTAP_MCP_CLIENT_IDE: pluginDistribution.client
|
|
48640
|
+
}
|
|
48641
|
+
};
|
|
48642
|
+
}
|
|
48174
48643
|
function buildMakerMcpIssue(options) {
|
|
48175
48644
|
const context = sanitizePublicValue(options.context, options.homeDir);
|
|
48176
48645
|
const diagnostics = sanitizePublicValue(
|
|
@@ -48203,7 +48672,7 @@ function buildMakerMcpIssue(options) {
|
|
|
48203
48672
|
return { title, body };
|
|
48204
48673
|
}
|
|
48205
48674
|
async function collectMakerMcpIssueDiagnostics(options) {
|
|
48206
|
-
var _a3;
|
|
48675
|
+
var _a3, _b;
|
|
48207
48676
|
const platform = options.platform || process.platform;
|
|
48208
48677
|
const homeDir = options.homeDir || os5.homedir();
|
|
48209
48678
|
const processCwd = path21.resolve(options.processCwd || process.cwd());
|
|
@@ -48220,7 +48689,7 @@ async function collectMakerMcpIssueDiagnostics(options) {
|
|
|
48220
48689
|
};
|
|
48221
48690
|
const client = (_a3 = options.ide) == null ? void 0 : _a3.trim().toLowerCase();
|
|
48222
48691
|
const environment = options.environment || process.env;
|
|
48223
|
-
const clientConfig = client ? inspectMakerMcpClientConfig({
|
|
48692
|
+
const clientConfig = client ? options.configSource ? inspectMakerMcpConfigSource(client, options.configSource) : inspectMakerMcpClientConfig({
|
|
48224
48693
|
ide: client,
|
|
48225
48694
|
homeDir,
|
|
48226
48695
|
platform,
|
|
@@ -48252,10 +48721,14 @@ async function collectMakerMcpIssueDiagnostics(options) {
|
|
|
48252
48721
|
http_proxy_configured: hasEnvironmentValue(environment, "HTTP_PROXY"),
|
|
48253
48722
|
https_proxy_configured: hasEnvironmentValue(environment, "HTTPS_PROXY"),
|
|
48254
48723
|
no_proxy_configured: hasEnvironmentValue(environment, "NO_PROXY")
|
|
48255
|
-
}
|
|
48724
|
+
},
|
|
48725
|
+
...options.distribution ? { distribution: options.distribution } : {}
|
|
48256
48726
|
};
|
|
48257
48727
|
if (client === "workbuddy") {
|
|
48258
|
-
diagnostics.workbuddy_trust = inspectWorkBuddyTrust(
|
|
48728
|
+
diagnostics.workbuddy_trust = inspectWorkBuddyTrust(
|
|
48729
|
+
homeDir,
|
|
48730
|
+
((_b = options.configSource) == null ? void 0 : _b.mcp_name) || MAKER_MCP_NAME
|
|
48731
|
+
);
|
|
48259
48732
|
}
|
|
48260
48733
|
return diagnostics;
|
|
48261
48734
|
}
|
|
@@ -48313,10 +48786,12 @@ function getMcpConfigPaths(options) {
|
|
|
48313
48786
|
}
|
|
48314
48787
|
return void 0;
|
|
48315
48788
|
}
|
|
48316
|
-
function inspectMcpConfigFile(configPath, ide, mcpName) {
|
|
48789
|
+
function inspectMcpConfigFile(configPath, ide, mcpName, format) {
|
|
48317
48790
|
try {
|
|
48318
|
-
const
|
|
48319
|
-
|
|
48791
|
+
const resolvedFormat = format ?? (ide === "codex" ? "codex_toml" : ide === "dsh" ? "dsh" : ide === "opencode" ? "jsonc" : "json");
|
|
48792
|
+
const content = fs20.readFileSync(configPath, "utf8");
|
|
48793
|
+
const server = resolvedFormat === "codex_toml" ? extractCodexMcpServerConfig(content, mcpName) : resolvedFormat === "dsh" ? extractDshMcpServerConfig(content, mcpName, configPath) : extractMakerMcpServerConfig(
|
|
48794
|
+
parseJsonConfig(content, resolvedFormat === "jsonc"),
|
|
48320
48795
|
mcpName
|
|
48321
48796
|
);
|
|
48322
48797
|
return server ? { path: configPath, status: "found", server } : { path: configPath, status: "missing_entry" };
|
|
@@ -48324,6 +48799,11 @@ function inspectMcpConfigFile(configPath, ide, mcpName) {
|
|
|
48324
48799
|
return { path: configPath, status: "unreadable" };
|
|
48325
48800
|
}
|
|
48326
48801
|
}
|
|
48802
|
+
function inspectMakerMcpConfigSource(ide, source) {
|
|
48803
|
+
const entries = source.paths.filter((configPath) => fs20.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
|
|
48804
|
+
const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
|
|
48805
|
+
return { ide, status, entries };
|
|
48806
|
+
}
|
|
48327
48807
|
function extractDshMcpServerConfig(content, mcpName, source) {
|
|
48328
48808
|
const plugin = findDshMakerPluginEntry(content, mcpName, source);
|
|
48329
48809
|
if (!plugin) {
|
|
@@ -48529,7 +49009,7 @@ function runGitHubIssueCreate(args, input2) {
|
|
|
48529
49009
|
stderr: typeof result.stderr === "string" ? result.stderr : ""
|
|
48530
49010
|
};
|
|
48531
49011
|
}
|
|
48532
|
-
function inspectWorkBuddyTrust(homeDir) {
|
|
49012
|
+
function inspectWorkBuddyTrust(homeDir, mcpName) {
|
|
48533
49013
|
const emptyCounts = {
|
|
48534
49014
|
accounts_checked: 0,
|
|
48535
49015
|
trusted_accounts: 0,
|
|
@@ -48563,9 +49043,9 @@ function inspectWorkBuddyTrust(homeDir) {
|
|
|
48563
49043
|
counts.unreadable_accounts += 1;
|
|
48564
49044
|
continue;
|
|
48565
49045
|
}
|
|
48566
|
-
const enabled = asStringArray(state.enabled).includes(
|
|
48567
|
-
const userDisabled = asStringArray(state.userDisabled).includes(
|
|
48568
|
-
const everConnected = asStringArray(state.everConnected).includes(
|
|
49046
|
+
const enabled = asStringArray(state.enabled).includes(mcpName);
|
|
49047
|
+
const userDisabled = asStringArray(state.userDisabled).includes(mcpName);
|
|
49048
|
+
const everConnected = asStringArray(state.everConnected).includes(mcpName);
|
|
48569
49049
|
if (!enabled && !userDisabled && !everConnected) {
|
|
48570
49050
|
continue;
|
|
48571
49051
|
}
|
|
@@ -48730,18 +49210,18 @@ function sanitizeCommandArguments(args) {
|
|
|
48730
49210
|
});
|
|
48731
49211
|
}
|
|
48732
49212
|
function isSensitiveCliFlag(value) {
|
|
48733
|
-
return /^--(?:[a-z0-9]+[-_])*(?:pat|token|secret|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key)$/iu.test(
|
|
49213
|
+
return /^--(?:[a-z0-9]+[-_])*(?:pat|token|secret|signature|sig|credential|credentials|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key)$/iu.test(
|
|
48734
49214
|
value
|
|
48735
49215
|
);
|
|
48736
49216
|
}
|
|
48737
49217
|
function redactReportText(value) {
|
|
48738
49218
|
return value.replace(
|
|
48739
|
-
/(^|[\s,;])(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key))\s+(?:"[^"]*"|'[^']*'|[^\s
|
|
49219
|
+
/(^|[\s,;])(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|signature|sig|credential|credentials|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key))\s+(?:"[^"]*"|'[^']*'|(?:(?![&,;][A-Za-z][A-Za-z0-9_.-]*\s*[:=])[^\s])+)/gimu,
|
|
48740
49220
|
"$1$2 <redacted>"
|
|
48741
49221
|
).replace(
|
|
48742
|
-
/(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key)=)([^\s]+)/giu,
|
|
49222
|
+
/(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|signature|sig|credential|credentials|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key)=)([^\s]+)/giu,
|
|
48743
49223
|
"$1<redacted>"
|
|
48744
|
-
).replace(/\b([A-Za-z][A-Za-z0-9+.-]*:\/\/)([^@\s
|
|
49224
|
+
).replace(/\b([A-Za-z][A-Za-z0-9+.-]*:\/\/)([^@\s/?#]+)@/gu, "$1<redacted>@").replace(/\bgithub_pat_[A-Za-z0-9_]{20,}\b/gu, "<redacted>").replace(/\bgh[pousr]_[A-Za-z0-9]{20,}\b/gu, "<redacted>");
|
|
48745
49225
|
}
|
|
48746
49226
|
function stripControlCharacters(value) {
|
|
48747
49227
|
return Array.from(value, (character) => {
|
|
@@ -48750,11 +49230,1063 @@ function stripControlCharacters(value) {
|
|
|
48750
49230
|
}).join("");
|
|
48751
49231
|
}
|
|
48752
49232
|
|
|
49233
|
+
// src/maker/cli/pluginMigration.ts
|
|
49234
|
+
import fs22 from "node:fs";
|
|
49235
|
+
import os6 from "node:os";
|
|
49236
|
+
import path23 from "node:path";
|
|
49237
|
+
import crypto3 from "node:crypto";
|
|
49238
|
+
|
|
49239
|
+
// src/maker/cli/codexMcpConfig.ts
|
|
49240
|
+
function findCodexMcpTables(content, mcpName) {
|
|
49241
|
+
const mainPath = `mcp_servers.${mcpName}`;
|
|
49242
|
+
return findTomlTables(content).flatMap((table) => {
|
|
49243
|
+
const normalizedPath = normalizeCodexMcpTablePath(table.path, mcpName);
|
|
49244
|
+
if (!normalizedPath) {
|
|
49245
|
+
return [];
|
|
49246
|
+
}
|
|
49247
|
+
return [
|
|
49248
|
+
{
|
|
49249
|
+
headerStart: table.headerStart,
|
|
49250
|
+
bodyStart: table.bodyStart,
|
|
49251
|
+
bodyEnd: table.bodyEnd,
|
|
49252
|
+
normalizedPath,
|
|
49253
|
+
isMain: normalizedPath === mainPath
|
|
49254
|
+
}
|
|
49255
|
+
];
|
|
49256
|
+
});
|
|
49257
|
+
}
|
|
49258
|
+
function removeCodexMcpTables(content, mcpName) {
|
|
49259
|
+
const tables = findCodexMcpTables(content, mcpName);
|
|
49260
|
+
return [...tables].reverse().reduce(
|
|
49261
|
+
(updated, table) => `${updated.slice(0, table.headerStart)}${updated.slice(table.bodyEnd)}`,
|
|
49262
|
+
content
|
|
49263
|
+
);
|
|
49264
|
+
}
|
|
49265
|
+
function findCodexMcpTableDuplicates(text, mcpName) {
|
|
49266
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49267
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
49268
|
+
for (const table of findCodexMcpTables(text, mcpName)) {
|
|
49269
|
+
if (seen.has(table.normalizedPath)) {
|
|
49270
|
+
duplicates.add(table.normalizedPath);
|
|
49271
|
+
} else {
|
|
49272
|
+
seen.add(table.normalizedPath);
|
|
49273
|
+
}
|
|
49274
|
+
}
|
|
49275
|
+
return Array.from(duplicates);
|
|
49276
|
+
}
|
|
49277
|
+
function findTomlBooleanAssignment(content, start, end, key) {
|
|
49278
|
+
const keyPattern = escapeRegExp3(key);
|
|
49279
|
+
let multiline;
|
|
49280
|
+
for (const line of splitTomlLines(content, start, end)) {
|
|
49281
|
+
if (!multiline) {
|
|
49282
|
+
const match = new RegExp(`^\\s*${keyPattern}\\s*=\\s*(true|false)\\s*(?:#.*)?$`).exec(
|
|
49283
|
+
line.text
|
|
49284
|
+
);
|
|
49285
|
+
if ((match == null ? void 0 : match.index) !== void 0) {
|
|
49286
|
+
const relativeValueStart = match.index + match[0].indexOf(match[1]);
|
|
49287
|
+
return {
|
|
49288
|
+
value: match[1] === "true",
|
|
49289
|
+
valueStart: line.start + relativeValueStart,
|
|
49290
|
+
valueEnd: line.start + relativeValueStart + match[1].length
|
|
49291
|
+
};
|
|
49292
|
+
}
|
|
49293
|
+
}
|
|
49294
|
+
multiline = scanTomlLine(line.text, multiline);
|
|
49295
|
+
}
|
|
49296
|
+
return void 0;
|
|
49297
|
+
}
|
|
49298
|
+
function escapeTomlString(value) {
|
|
49299
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
49300
|
+
}
|
|
49301
|
+
function findTomlTables(content) {
|
|
49302
|
+
const tables = [];
|
|
49303
|
+
let multiline;
|
|
49304
|
+
for (const line of splitTomlLines(content)) {
|
|
49305
|
+
if (!multiline) {
|
|
49306
|
+
const match = /^\s*\[([^\]]+)\]\s*(?:#.*)?$/.exec(line.text);
|
|
49307
|
+
if (match) {
|
|
49308
|
+
const previous = tables[tables.length - 1];
|
|
49309
|
+
if (previous) {
|
|
49310
|
+
previous.bodyEnd = line.start;
|
|
49311
|
+
}
|
|
49312
|
+
tables.push({
|
|
49313
|
+
headerStart: line.start,
|
|
49314
|
+
bodyStart: line.end,
|
|
49315
|
+
bodyEnd: content.length,
|
|
49316
|
+
path: match[1]
|
|
49317
|
+
});
|
|
49318
|
+
}
|
|
49319
|
+
}
|
|
49320
|
+
multiline = scanTomlLine(line.text, multiline);
|
|
49321
|
+
}
|
|
49322
|
+
return tables;
|
|
49323
|
+
}
|
|
49324
|
+
function splitTomlLines(content, start = 0, end = content.length) {
|
|
49325
|
+
const lines = [];
|
|
49326
|
+
let lineStart = start;
|
|
49327
|
+
while (lineStart < end) {
|
|
49328
|
+
const newline = content.indexOf("\n", lineStart);
|
|
49329
|
+
const nextLineStart = newline === -1 || newline >= end ? end : newline + 1;
|
|
49330
|
+
let lineEnd = newline === -1 || newline >= end ? end : newline;
|
|
49331
|
+
if (lineEnd > lineStart && content[lineEnd - 1] === "\r") {
|
|
49332
|
+
lineEnd -= 1;
|
|
49333
|
+
}
|
|
49334
|
+
lines.push({
|
|
49335
|
+
start: lineStart,
|
|
49336
|
+
end: lineEnd,
|
|
49337
|
+
text: content.slice(lineStart, lineEnd)
|
|
49338
|
+
});
|
|
49339
|
+
lineStart = nextLineStart;
|
|
49340
|
+
}
|
|
49341
|
+
return lines;
|
|
49342
|
+
}
|
|
49343
|
+
function scanTomlLine(line, initial) {
|
|
49344
|
+
let multiline = initial;
|
|
49345
|
+
let index = 0;
|
|
49346
|
+
while (index < line.length) {
|
|
49347
|
+
if (multiline === "basic") {
|
|
49348
|
+
const closing = findUnescapedTripleQuote(line, index, '"""');
|
|
49349
|
+
if (closing === -1) {
|
|
49350
|
+
return multiline;
|
|
49351
|
+
}
|
|
49352
|
+
multiline = void 0;
|
|
49353
|
+
index = closing + 3;
|
|
49354
|
+
continue;
|
|
49355
|
+
}
|
|
49356
|
+
if (multiline === "literal") {
|
|
49357
|
+
const closing = line.indexOf("'''", index);
|
|
49358
|
+
if (closing === -1) {
|
|
49359
|
+
return multiline;
|
|
49360
|
+
}
|
|
49361
|
+
multiline = void 0;
|
|
49362
|
+
index = closing + 3;
|
|
49363
|
+
continue;
|
|
49364
|
+
}
|
|
49365
|
+
const character = line[index];
|
|
49366
|
+
if (character === "#") {
|
|
49367
|
+
return void 0;
|
|
49368
|
+
}
|
|
49369
|
+
if (line.startsWith('"""', index)) {
|
|
49370
|
+
multiline = "basic";
|
|
49371
|
+
index += 3;
|
|
49372
|
+
continue;
|
|
49373
|
+
}
|
|
49374
|
+
if (line.startsWith("'''", index)) {
|
|
49375
|
+
multiline = "literal";
|
|
49376
|
+
index += 3;
|
|
49377
|
+
continue;
|
|
49378
|
+
}
|
|
49379
|
+
if (character === '"') {
|
|
49380
|
+
index = skipBasicString(line, index + 1);
|
|
49381
|
+
continue;
|
|
49382
|
+
}
|
|
49383
|
+
if (character === "'") {
|
|
49384
|
+
const closing = line.indexOf("'", index + 1);
|
|
49385
|
+
index = closing === -1 ? line.length : closing + 1;
|
|
49386
|
+
continue;
|
|
49387
|
+
}
|
|
49388
|
+
index += 1;
|
|
49389
|
+
}
|
|
49390
|
+
return multiline;
|
|
49391
|
+
}
|
|
49392
|
+
function findUnescapedTripleQuote(line, start, delimiter) {
|
|
49393
|
+
let match = line.indexOf(delimiter, start);
|
|
49394
|
+
while (match !== -1) {
|
|
49395
|
+
let backslashes = 0;
|
|
49396
|
+
for (let index = match - 1; index >= 0 && line[index] === "\\"; index -= 1) {
|
|
49397
|
+
backslashes += 1;
|
|
49398
|
+
}
|
|
49399
|
+
if (backslashes % 2 === 0) {
|
|
49400
|
+
return match;
|
|
49401
|
+
}
|
|
49402
|
+
match = line.indexOf(delimiter, match + delimiter.length);
|
|
49403
|
+
}
|
|
49404
|
+
return -1;
|
|
49405
|
+
}
|
|
49406
|
+
function skipBasicString(line, start) {
|
|
49407
|
+
let escaped = false;
|
|
49408
|
+
for (let index = start; index < line.length; index += 1) {
|
|
49409
|
+
if (escaped) {
|
|
49410
|
+
escaped = false;
|
|
49411
|
+
continue;
|
|
49412
|
+
}
|
|
49413
|
+
if (line[index] === "\\") {
|
|
49414
|
+
escaped = true;
|
|
49415
|
+
continue;
|
|
49416
|
+
}
|
|
49417
|
+
if (line[index] === '"') {
|
|
49418
|
+
return index + 1;
|
|
49419
|
+
}
|
|
49420
|
+
}
|
|
49421
|
+
return line.length;
|
|
49422
|
+
}
|
|
49423
|
+
function normalizeCodexMcpTablePath(tablePath, mcpName) {
|
|
49424
|
+
const keyPattern = createCodexMcpKeyPattern(mcpName);
|
|
49425
|
+
const match = new RegExp(`^mcp_servers\\.${keyPattern}(\\..+)?$`).exec(tablePath);
|
|
49426
|
+
if (!match) {
|
|
49427
|
+
return void 0;
|
|
49428
|
+
}
|
|
49429
|
+
return `mcp_servers.${mcpName}${match[1] || ""}`;
|
|
49430
|
+
}
|
|
49431
|
+
function createCodexMcpKeyPattern(mcpName) {
|
|
49432
|
+
const quotedKey = `"${escapeRegExp3(mcpName)}"`;
|
|
49433
|
+
if (!/^[A-Za-z0-9_-]+$/.test(mcpName)) {
|
|
49434
|
+
return quotedKey;
|
|
49435
|
+
}
|
|
49436
|
+
return `(?:${quotedKey}|${escapeRegExp3(mcpName)})`;
|
|
49437
|
+
}
|
|
49438
|
+
function escapeRegExp3(value) {
|
|
49439
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
49440
|
+
}
|
|
49441
|
+
|
|
49442
|
+
// src/maker/cli/configWrite.ts
|
|
49443
|
+
import fs21 from "node:fs";
|
|
49444
|
+
import path22 from "node:path";
|
|
49445
|
+
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
49446
|
+
const existed = fs21.existsSync(filePath);
|
|
49447
|
+
const previousContent = existed ? fs21.readFileSync(filePath, "utf8") : void 0;
|
|
49448
|
+
if (previousContent === nextContent) {
|
|
49449
|
+
return { changed: false };
|
|
49450
|
+
}
|
|
49451
|
+
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
49452
|
+
fs21.mkdirSync(path22.dirname(filePath), { recursive: true });
|
|
49453
|
+
if (previousContent !== void 0 && backupPath) {
|
|
49454
|
+
fs21.writeFileSync(backupPath, previousContent, "utf8");
|
|
49455
|
+
}
|
|
49456
|
+
try {
|
|
49457
|
+
fs21.writeFileSync(filePath, nextContent, "utf8");
|
|
49458
|
+
validate == null ? void 0 : validate(fs21.readFileSync(filePath, "utf8"));
|
|
49459
|
+
return { changed: true, backupPath };
|
|
49460
|
+
} catch (error2) {
|
|
49461
|
+
if (previousContent !== void 0) {
|
|
49462
|
+
fs21.writeFileSync(filePath, previousContent, "utf8");
|
|
49463
|
+
} else {
|
|
49464
|
+
fs21.rmSync(filePath, { force: true });
|
|
49465
|
+
}
|
|
49466
|
+
throw error2;
|
|
49467
|
+
}
|
|
49468
|
+
}
|
|
49469
|
+
|
|
49470
|
+
// src/maker/cli/pluginMigration.ts
|
|
49471
|
+
function inspectCodexLegacyMakerMcp(options = {}) {
|
|
49472
|
+
const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
|
|
49473
|
+
if (!fs22.existsSync(configPath)) {
|
|
49474
|
+
return createInspection(configPath, "not_found", 0);
|
|
49475
|
+
}
|
|
49476
|
+
const content = fs22.readFileSync(configPath, "utf8");
|
|
49477
|
+
const registrations = findCodexMakerMainTables(content);
|
|
49478
|
+
if (registrations.length === 0) {
|
|
49479
|
+
return createInspection(configPath, "not_found", 0);
|
|
49480
|
+
}
|
|
49481
|
+
if (registrations.length > 1) {
|
|
49482
|
+
return createInspection(configPath, "ambiguous", registrations.length);
|
|
49483
|
+
}
|
|
49484
|
+
const enabled = registrations[0].enabled;
|
|
49485
|
+
return {
|
|
49486
|
+
...createInspection(configPath, enabled ? "active" : "disabled", 1),
|
|
49487
|
+
enabled
|
|
49488
|
+
};
|
|
49489
|
+
}
|
|
49490
|
+
function migrateCodexLegacyMakerMcp(options = {}) {
|
|
49491
|
+
const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
|
|
49492
|
+
const makerHome = options.makerHome ?? getMakerHome();
|
|
49493
|
+
const statePath = getCodexPluginMigrationStatePath(makerHome);
|
|
49494
|
+
const inspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
49495
|
+
if (inspection.status === "not_found") {
|
|
49496
|
+
return { ...inspection, action: "not_found", changed: false };
|
|
49497
|
+
}
|
|
49498
|
+
if (inspection.status === "ambiguous") {
|
|
49499
|
+
throw new Error(
|
|
49500
|
+
`Codex Maker MCP migration found ${inspection.registration_count} equivalent registrations; resolve the duplicate tables before migrating.`
|
|
49501
|
+
);
|
|
49502
|
+
}
|
|
49503
|
+
if (inspection.status === "disabled") {
|
|
49504
|
+
const state2 = readMigrationState(statePath);
|
|
49505
|
+
const content = fs22.readFileSync(configPath, "utf8");
|
|
49506
|
+
const registration2 = findCodexMakerMainTables(content)[0];
|
|
49507
|
+
const owned = (state2 == null ? void 0 : state2.config_path) === configPath && sha256(readCodexMakerRegistration(content, registration2)) === state2.migrated_registration_sha256;
|
|
49508
|
+
return {
|
|
49509
|
+
...inspection,
|
|
49510
|
+
action: owned ? "already_migrated" : "already_disabled",
|
|
49511
|
+
changed: false,
|
|
49512
|
+
...owned ? { state_path: statePath } : {}
|
|
49513
|
+
};
|
|
49514
|
+
}
|
|
49515
|
+
if (!options.confirm) {
|
|
49516
|
+
throw new Error("Disabling the legacy Codex Maker MCP requires explicit confirmation.");
|
|
49517
|
+
}
|
|
49518
|
+
const previousContent = fs22.readFileSync(configPath, "utf8");
|
|
49519
|
+
const registration = findCodexMakerMainTables(previousContent)[0];
|
|
49520
|
+
const nextContent = disableCodexMakerRegistration(previousContent, registration);
|
|
49521
|
+
const state = {
|
|
49522
|
+
schema_version: 2,
|
|
49523
|
+
client: "codex",
|
|
49524
|
+
config_path: configPath,
|
|
49525
|
+
previous_enabled: registration.enabledExplicitly ? "true" : "implicit",
|
|
49526
|
+
original_registration_sha256: sha256(readCodexMakerRegistration(previousContent, registration)),
|
|
49527
|
+
migrated_registration_sha256: sha256(
|
|
49528
|
+
readCodexMakerRegistration(nextContent, findCodexMakerMainTables(nextContent)[0])
|
|
49529
|
+
),
|
|
49530
|
+
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
49531
|
+
};
|
|
49532
|
+
fs22.mkdirSync(path23.dirname(statePath), { recursive: true });
|
|
49533
|
+
const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
|
|
49534
|
+
const migratedInspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
49535
|
+
if (migratedInspection.status !== "disabled") {
|
|
49536
|
+
throw new Error("Codex Maker MCP migration validation did not find a disabled registration.");
|
|
49537
|
+
}
|
|
49538
|
+
fs22.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
49539
|
+
`, "utf8");
|
|
49540
|
+
});
|
|
49541
|
+
return {
|
|
49542
|
+
...inspectCodexLegacyMakerMcp({ configPath }),
|
|
49543
|
+
action: "disabled",
|
|
49544
|
+
changed: write.changed,
|
|
49545
|
+
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49546
|
+
state_path: statePath
|
|
49547
|
+
};
|
|
49548
|
+
}
|
|
49549
|
+
function restoreCodexLegacyMakerMcp(options = {}) {
|
|
49550
|
+
const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
|
|
49551
|
+
const makerHome = options.makerHome ?? getMakerHome();
|
|
49552
|
+
const statePath = getCodexPluginMigrationStatePath(makerHome);
|
|
49553
|
+
const inspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
49554
|
+
const state = readMigrationState(statePath);
|
|
49555
|
+
if (!state || state.config_path !== configPath) {
|
|
49556
|
+
return { ...inspection, action: "not_owned", changed: false };
|
|
49557
|
+
}
|
|
49558
|
+
if (!options.confirm) {
|
|
49559
|
+
throw new Error("Restoring the legacy Codex Maker MCP requires explicit confirmation.");
|
|
49560
|
+
}
|
|
49561
|
+
if (inspection.status === "ambiguous") {
|
|
49562
|
+
throw new Error(
|
|
49563
|
+
`Codex Maker MCP restoration found ${inspection.registration_count} equivalent registrations; resolve the duplicate tables before restoring.`
|
|
49564
|
+
);
|
|
49565
|
+
}
|
|
49566
|
+
if (inspection.status === "not_found") {
|
|
49567
|
+
throw new Error(
|
|
49568
|
+
"The migrated Codex Maker MCP registration no longer exists and cannot be restored."
|
|
49569
|
+
);
|
|
49570
|
+
}
|
|
49571
|
+
const previousContent = fs22.readFileSync(configPath, "utf8");
|
|
49572
|
+
const registration = findCodexMakerMainTables(previousContent)[0];
|
|
49573
|
+
const registrationSha256 = sha256(readCodexMakerRegistration(previousContent, registration));
|
|
49574
|
+
if (inspection.status === "active") {
|
|
49575
|
+
if (registrationSha256 !== state.original_registration_sha256) {
|
|
49576
|
+
return { ...inspection, action: "not_owned", changed: false };
|
|
49577
|
+
}
|
|
49578
|
+
fs22.unlinkSync(statePath);
|
|
49579
|
+
return { ...inspection, action: "already_restored", changed: false };
|
|
49580
|
+
}
|
|
49581
|
+
if (registrationSha256 !== state.migrated_registration_sha256) {
|
|
49582
|
+
return { ...inspection, action: "not_owned", changed: false };
|
|
49583
|
+
}
|
|
49584
|
+
const nextContent = restoreCodexMakerRegistration(previousContent, registration, state);
|
|
49585
|
+
const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
|
|
49586
|
+
const restoredInspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
49587
|
+
if (restoredInspection.status !== "active") {
|
|
49588
|
+
throw new Error(
|
|
49589
|
+
"Codex Maker MCP restoration validation did not find an active registration."
|
|
49590
|
+
);
|
|
49591
|
+
}
|
|
49592
|
+
const restoredContent = fs22.readFileSync(configPath, "utf8");
|
|
49593
|
+
const restoredRegistration = findCodexMakerMainTables(restoredContent)[0];
|
|
49594
|
+
if (sha256(readCodexMakerRegistration(restoredContent, restoredRegistration)) !== state.original_registration_sha256) {
|
|
49595
|
+
throw new Error("Codex Maker MCP restoration changed the migrated registration identity.");
|
|
49596
|
+
}
|
|
49597
|
+
fs22.unlinkSync(statePath);
|
|
49598
|
+
});
|
|
49599
|
+
return {
|
|
49600
|
+
...inspectCodexLegacyMakerMcp({ configPath }),
|
|
49601
|
+
action: "restored",
|
|
49602
|
+
changed: write.changed,
|
|
49603
|
+
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49604
|
+
state_path: statePath
|
|
49605
|
+
};
|
|
49606
|
+
}
|
|
49607
|
+
function findCodexMakerMainTables(content) {
|
|
49608
|
+
return findCodexMcpTables(content, "taptap-maker").filter((table) => table.isMain).map((table) => {
|
|
49609
|
+
const enabledAssignment = findTomlBooleanAssignment(
|
|
49610
|
+
content,
|
|
49611
|
+
table.bodyStart,
|
|
49612
|
+
table.bodyEnd,
|
|
49613
|
+
"enabled"
|
|
49614
|
+
);
|
|
49615
|
+
return {
|
|
49616
|
+
headerStart: table.headerStart,
|
|
49617
|
+
bodyStart: table.bodyStart,
|
|
49618
|
+
bodyEnd: table.bodyEnd,
|
|
49619
|
+
enabled: (enabledAssignment == null ? void 0 : enabledAssignment.value) !== false,
|
|
49620
|
+
enabledExplicitly: Boolean(enabledAssignment),
|
|
49621
|
+
...enabledAssignment ? {
|
|
49622
|
+
enabledValueStart: enabledAssignment.valueStart,
|
|
49623
|
+
enabledValueEnd: enabledAssignment.valueEnd
|
|
49624
|
+
} : {}
|
|
49625
|
+
};
|
|
49626
|
+
});
|
|
49627
|
+
}
|
|
49628
|
+
function disableCodexMakerRegistration(content, registration) {
|
|
49629
|
+
if (registration.enabledValueStart !== void 0 && registration.enabledValueEnd !== void 0) {
|
|
49630
|
+
return `${content.slice(0, registration.enabledValueStart)}false${content.slice(
|
|
49631
|
+
registration.enabledValueEnd
|
|
49632
|
+
)}`;
|
|
49633
|
+
}
|
|
49634
|
+
return `${content.slice(0, registration.bodyStart)}
|
|
49635
|
+
enabled = false${content.slice(
|
|
49636
|
+
registration.bodyStart
|
|
49637
|
+
)}`;
|
|
49638
|
+
}
|
|
49639
|
+
function restoreCodexMakerRegistration(content, registration, state) {
|
|
49640
|
+
if (state.previous_enabled === "true") {
|
|
49641
|
+
if (registration.enabledValueStart === void 0 || registration.enabledValueEnd === void 0) {
|
|
49642
|
+
throw new Error("The migrated Codex Maker MCP enabled value is missing.");
|
|
49643
|
+
}
|
|
49644
|
+
return `${content.slice(0, registration.enabledValueStart)}true${content.slice(
|
|
49645
|
+
registration.enabledValueEnd
|
|
49646
|
+
)}`;
|
|
49647
|
+
}
|
|
49648
|
+
const insertedLine = "\nenabled = false";
|
|
49649
|
+
if (!content.startsWith(insertedLine, registration.bodyStart)) {
|
|
49650
|
+
throw new Error("The plugin-owned Codex Maker MCP disabled marker was modified.");
|
|
49651
|
+
}
|
|
49652
|
+
return `${content.slice(0, registration.bodyStart)}${content.slice(
|
|
49653
|
+
registration.bodyStart + insertedLine.length
|
|
49654
|
+
)}`;
|
|
49655
|
+
}
|
|
49656
|
+
function readCodexMakerRegistration(content, registration) {
|
|
49657
|
+
return content.slice(registration.headerStart, registration.bodyEnd).trimEnd();
|
|
49658
|
+
}
|
|
49659
|
+
function getCodexPluginMigrationStatePath(makerHome) {
|
|
49660
|
+
return path23.join(makerHome, "plugin-migrations", "codex.json");
|
|
49661
|
+
}
|
|
49662
|
+
function readMigrationState(statePath) {
|
|
49663
|
+
if (!fs22.existsSync(statePath)) {
|
|
49664
|
+
return void 0;
|
|
49665
|
+
}
|
|
49666
|
+
try {
|
|
49667
|
+
const state = JSON.parse(fs22.readFileSync(statePath, "utf8"));
|
|
49668
|
+
return (state == null ? void 0 : state.schema_version) === 2 && state.client === "codex" ? state : void 0;
|
|
49669
|
+
} catch {
|
|
49670
|
+
return void 0;
|
|
49671
|
+
}
|
|
49672
|
+
}
|
|
49673
|
+
function sha256(content) {
|
|
49674
|
+
return crypto3.createHash("sha256").update(content).digest("hex");
|
|
49675
|
+
}
|
|
49676
|
+
function createInspection(configPath, status, registrationCount) {
|
|
49677
|
+
return {
|
|
49678
|
+
client: "codex",
|
|
49679
|
+
status,
|
|
49680
|
+
config_path: configPath,
|
|
49681
|
+
registration_count: registrationCount
|
|
49682
|
+
};
|
|
49683
|
+
}
|
|
49684
|
+
function inspectWorkBuddyLegacyMakerMcp(options = {}) {
|
|
49685
|
+
const configPaths = getWorkBuddyConfigPaths(options.configPaths);
|
|
49686
|
+
const registrations = findWorkBuddyMakerRegistrations(configPaths);
|
|
49687
|
+
const registrationPaths = registrations.map((entry) => entry.configPath);
|
|
49688
|
+
if (registrations.length === 0) {
|
|
49689
|
+
return createWorkBuddyInspection(configPaths[0], "not_found", []);
|
|
49690
|
+
}
|
|
49691
|
+
const activeRegistrations = registrations.filter((entry) => entry.registration.disabled !== true);
|
|
49692
|
+
if (activeRegistrations.length > 1) {
|
|
49693
|
+
return createWorkBuddyInspection(configPaths[0], "ambiguous", registrationPaths);
|
|
49694
|
+
}
|
|
49695
|
+
if (activeRegistrations.length === 0) {
|
|
49696
|
+
return {
|
|
49697
|
+
...createWorkBuddyInspection(registrations[0].configPath, "disabled", registrationPaths),
|
|
49698
|
+
enabled: false
|
|
49699
|
+
};
|
|
49700
|
+
}
|
|
49701
|
+
const active = activeRegistrations[0];
|
|
49702
|
+
return {
|
|
49703
|
+
...createWorkBuddyInspection(active.configPath, "active", registrationPaths),
|
|
49704
|
+
enabled: true
|
|
49705
|
+
};
|
|
49706
|
+
}
|
|
49707
|
+
function migrateWorkBuddyLegacyMakerMcp(options = {}) {
|
|
49708
|
+
const configPaths = getWorkBuddyConfigPaths(options.configPaths);
|
|
49709
|
+
const makerHome = options.makerHome ?? getMakerHome();
|
|
49710
|
+
const statePath = getWorkBuddyPluginMigrationStatePath(makerHome);
|
|
49711
|
+
const inspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
49712
|
+
if (inspection.status === "not_found") {
|
|
49713
|
+
return { ...inspection, action: "not_found", changed: false };
|
|
49714
|
+
}
|
|
49715
|
+
if (inspection.status === "ambiguous") {
|
|
49716
|
+
throw new Error(
|
|
49717
|
+
`WorkBuddy Maker MCP migration found registrations in multiple config files: ${inspection.config_paths.join(", ")}`
|
|
49718
|
+
);
|
|
49719
|
+
}
|
|
49720
|
+
const registrations = findWorkBuddyMakerRegistrations(configPaths);
|
|
49721
|
+
if (inspection.status === "disabled") {
|
|
49722
|
+
const state2 = readWorkBuddyMigrationState(statePath);
|
|
49723
|
+
const current2 = state2 ? registrations.find((entry) => entry.configPath === state2.config_path) : registrations[0];
|
|
49724
|
+
const owned = Boolean(
|
|
49725
|
+
state2 && current2 && hashWorkBuddyRegistration(current2.registration) === state2.migrated_registration_sha256
|
|
49726
|
+
);
|
|
49727
|
+
return {
|
|
49728
|
+
...inspection,
|
|
49729
|
+
...owned && current2 ? { config_path: current2.configPath } : {},
|
|
49730
|
+
action: owned ? "already_migrated" : "already_disabled",
|
|
49731
|
+
changed: false,
|
|
49732
|
+
...owned ? { state_path: statePath } : {}
|
|
49733
|
+
};
|
|
49734
|
+
}
|
|
49735
|
+
if (!options.confirm) {
|
|
49736
|
+
throw new Error("Disabling the legacy WorkBuddy Maker MCP requires explicit confirmation.");
|
|
49737
|
+
}
|
|
49738
|
+
const current = registrations.find((entry) => entry.configPath === inspection.config_path);
|
|
49739
|
+
if (!current) {
|
|
49740
|
+
throw new Error("The active WorkBuddy Maker MCP registration could not be resolved.");
|
|
49741
|
+
}
|
|
49742
|
+
const originalRegistration = { ...current.registration };
|
|
49743
|
+
const previousDisabled = Object.prototype.hasOwnProperty.call(originalRegistration, "disabled") ? false : "missing";
|
|
49744
|
+
const migratedRegistration = { ...originalRegistration, disabled: true };
|
|
49745
|
+
setWorkBuddyMakerRegistration(current.config, migratedRegistration);
|
|
49746
|
+
const nextContent = `${JSON.stringify(current.config, null, 2)}
|
|
49747
|
+
`;
|
|
49748
|
+
const state = {
|
|
49749
|
+
schema_version: 1,
|
|
49750
|
+
client: "workbuddy",
|
|
49751
|
+
config_path: current.configPath,
|
|
49752
|
+
previous_disabled: previousDisabled,
|
|
49753
|
+
original_registration_sha256: hashWorkBuddyRegistration(originalRegistration),
|
|
49754
|
+
migrated_registration_sha256: hashWorkBuddyRegistration(migratedRegistration),
|
|
49755
|
+
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
49756
|
+
};
|
|
49757
|
+
fs22.mkdirSync(path23.dirname(statePath), { recursive: true });
|
|
49758
|
+
const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
|
|
49759
|
+
const migrated = findWorkBuddyMakerRegistrations(configPaths).find(
|
|
49760
|
+
(entry) => entry.configPath === current.configPath
|
|
49761
|
+
);
|
|
49762
|
+
if (!migrated || hashWorkBuddyRegistration(migrated.registration) !== state.migrated_registration_sha256) {
|
|
49763
|
+
throw new Error(
|
|
49764
|
+
"WorkBuddy Maker MCP migration validation did not find the disabled registration."
|
|
49765
|
+
);
|
|
49766
|
+
}
|
|
49767
|
+
fs22.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
49768
|
+
`, "utf8");
|
|
49769
|
+
});
|
|
49770
|
+
const migratedInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
49771
|
+
return {
|
|
49772
|
+
...migratedInspection,
|
|
49773
|
+
config_path: current.configPath,
|
|
49774
|
+
action: "disabled",
|
|
49775
|
+
changed: write.changed,
|
|
49776
|
+
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49777
|
+
state_path: statePath
|
|
49778
|
+
};
|
|
49779
|
+
}
|
|
49780
|
+
function restoreWorkBuddyLegacyMakerMcp(options = {}) {
|
|
49781
|
+
const configPaths = getWorkBuddyConfigPaths(options.configPaths);
|
|
49782
|
+
const makerHome = options.makerHome ?? getMakerHome();
|
|
49783
|
+
const statePath = getWorkBuddyPluginMigrationStatePath(makerHome);
|
|
49784
|
+
const inspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
49785
|
+
const state = readWorkBuddyMigrationState(statePath);
|
|
49786
|
+
if (!state) {
|
|
49787
|
+
return { ...inspection, action: "not_owned", changed: false };
|
|
49788
|
+
}
|
|
49789
|
+
if (!options.confirm) {
|
|
49790
|
+
throw new Error("Restoring the legacy WorkBuddy Maker MCP requires explicit confirmation.");
|
|
49791
|
+
}
|
|
49792
|
+
if (inspection.status === "ambiguous") {
|
|
49793
|
+
throw new Error(
|
|
49794
|
+
`WorkBuddy Maker MCP restoration found registrations in multiple config files: ${inspection.config_paths.join(", ")}`
|
|
49795
|
+
);
|
|
49796
|
+
}
|
|
49797
|
+
if (inspection.status === "not_found") {
|
|
49798
|
+
throw new Error(
|
|
49799
|
+
"The migrated WorkBuddy Maker MCP registration no longer exists and cannot be restored."
|
|
49800
|
+
);
|
|
49801
|
+
}
|
|
49802
|
+
const current = findWorkBuddyMakerRegistrations(configPaths).find(
|
|
49803
|
+
(entry) => entry.configPath === state.config_path
|
|
49804
|
+
);
|
|
49805
|
+
if (!current) {
|
|
49806
|
+
throw new Error(
|
|
49807
|
+
"The migrated WorkBuddy Maker MCP registration no longer exists and cannot be restored."
|
|
49808
|
+
);
|
|
49809
|
+
}
|
|
49810
|
+
const registrationSha256 = hashWorkBuddyRegistration(current.registration);
|
|
49811
|
+
const currentEnabled = current.registration.disabled !== true;
|
|
49812
|
+
if (currentEnabled) {
|
|
49813
|
+
if (registrationSha256 !== state.original_registration_sha256) {
|
|
49814
|
+
return {
|
|
49815
|
+
...inspection,
|
|
49816
|
+
config_path: current.configPath,
|
|
49817
|
+
action: "not_owned",
|
|
49818
|
+
changed: false
|
|
49819
|
+
};
|
|
49820
|
+
}
|
|
49821
|
+
fs22.unlinkSync(statePath);
|
|
49822
|
+
return {
|
|
49823
|
+
...inspection,
|
|
49824
|
+
config_path: current.configPath,
|
|
49825
|
+
action: "already_restored",
|
|
49826
|
+
changed: false
|
|
49827
|
+
};
|
|
49828
|
+
}
|
|
49829
|
+
if (registrationSha256 !== state.migrated_registration_sha256) {
|
|
49830
|
+
return { ...inspection, config_path: current.configPath, action: "not_owned", changed: false };
|
|
49831
|
+
}
|
|
49832
|
+
const restoredRegistration = { ...current.registration };
|
|
49833
|
+
if (state.previous_disabled === "missing") {
|
|
49834
|
+
delete restoredRegistration.disabled;
|
|
49835
|
+
} else {
|
|
49836
|
+
restoredRegistration.disabled = false;
|
|
49837
|
+
}
|
|
49838
|
+
setWorkBuddyMakerRegistration(current.config, restoredRegistration);
|
|
49839
|
+
const nextContent = `${JSON.stringify(current.config, null, 2)}
|
|
49840
|
+
`;
|
|
49841
|
+
const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
|
|
49842
|
+
const restoredInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
49843
|
+
if (restoredInspection.status !== "active") {
|
|
49844
|
+
throw new Error(
|
|
49845
|
+
"WorkBuddy Maker MCP restoration validation did not find an active registration."
|
|
49846
|
+
);
|
|
49847
|
+
}
|
|
49848
|
+
const restored = findWorkBuddyMakerRegistrations(configPaths).find(
|
|
49849
|
+
(entry) => entry.configPath === state.config_path
|
|
49850
|
+
);
|
|
49851
|
+
if (!restored || hashWorkBuddyRegistration(restored.registration) !== state.original_registration_sha256) {
|
|
49852
|
+
throw new Error("WorkBuddy Maker MCP restoration changed the registration identity.");
|
|
49853
|
+
}
|
|
49854
|
+
fs22.unlinkSync(statePath);
|
|
49855
|
+
});
|
|
49856
|
+
return {
|
|
49857
|
+
...inspectWorkBuddyLegacyMakerMcp({ configPaths }),
|
|
49858
|
+
config_path: current.configPath,
|
|
49859
|
+
action: "restored",
|
|
49860
|
+
changed: write.changed,
|
|
49861
|
+
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49862
|
+
state_path: statePath
|
|
49863
|
+
};
|
|
49864
|
+
}
|
|
49865
|
+
function getWorkBuddyConfigPaths(configPaths) {
|
|
49866
|
+
return configPaths ?? [
|
|
49867
|
+
path23.join(os6.homedir(), ".workbuddy", "mcp.json"),
|
|
49868
|
+
path23.join(os6.homedir(), ".workbuddy", ".mcp.json")
|
|
49869
|
+
];
|
|
49870
|
+
}
|
|
49871
|
+
function findWorkBuddyMakerRegistrations(configPaths) {
|
|
49872
|
+
const registrations = [];
|
|
49873
|
+
for (const configPath of configPaths) {
|
|
49874
|
+
if (!fs22.existsSync(configPath)) {
|
|
49875
|
+
continue;
|
|
49876
|
+
}
|
|
49877
|
+
let config2;
|
|
49878
|
+
try {
|
|
49879
|
+
config2 = JSON.parse(fs22.readFileSync(configPath, "utf8"));
|
|
49880
|
+
} catch (error2) {
|
|
49881
|
+
throw new Error(
|
|
49882
|
+
`Cannot parse WorkBuddy MCP config ${configPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
49883
|
+
);
|
|
49884
|
+
}
|
|
49885
|
+
if (!isRecord5(config2)) {
|
|
49886
|
+
throw new Error(`WorkBuddy MCP config must contain a JSON object: ${configPath}`);
|
|
49887
|
+
}
|
|
49888
|
+
const servers = config2.mcpServers;
|
|
49889
|
+
if (servers === void 0) {
|
|
49890
|
+
continue;
|
|
49891
|
+
}
|
|
49892
|
+
if (!isRecord5(servers)) {
|
|
49893
|
+
throw new Error(`WorkBuddy MCP config mcpServers must be an object: ${configPath}`);
|
|
49894
|
+
}
|
|
49895
|
+
const registration = servers["taptap-maker"];
|
|
49896
|
+
if (registration === void 0) {
|
|
49897
|
+
continue;
|
|
49898
|
+
}
|
|
49899
|
+
if (!isRecord5(registration)) {
|
|
49900
|
+
throw new Error(`WorkBuddy taptap-maker MCP registration must be an object: ${configPath}`);
|
|
49901
|
+
}
|
|
49902
|
+
registrations.push({ configPath, config: config2, registration });
|
|
49903
|
+
}
|
|
49904
|
+
return registrations;
|
|
49905
|
+
}
|
|
49906
|
+
function setWorkBuddyMakerRegistration(config2, registration) {
|
|
49907
|
+
const servers = config2.mcpServers;
|
|
49908
|
+
if (!isRecord5(servers)) {
|
|
49909
|
+
throw new Error("WorkBuddy MCP config mcpServers must be an object.");
|
|
49910
|
+
}
|
|
49911
|
+
servers["taptap-maker"] = registration;
|
|
49912
|
+
}
|
|
49913
|
+
function getWorkBuddyPluginMigrationStatePath(makerHome) {
|
|
49914
|
+
return path23.join(makerHome, "plugin-migrations", "workbuddy.json");
|
|
49915
|
+
}
|
|
49916
|
+
function readWorkBuddyMigrationState(statePath) {
|
|
49917
|
+
if (!fs22.existsSync(statePath)) {
|
|
49918
|
+
return void 0;
|
|
49919
|
+
}
|
|
49920
|
+
try {
|
|
49921
|
+
const state = JSON.parse(fs22.readFileSync(statePath, "utf8"));
|
|
49922
|
+
return (state == null ? void 0 : state.schema_version) === 1 && state.client === "workbuddy" ? state : void 0;
|
|
49923
|
+
} catch {
|
|
49924
|
+
return void 0;
|
|
49925
|
+
}
|
|
49926
|
+
}
|
|
49927
|
+
function hashWorkBuddyRegistration(registration) {
|
|
49928
|
+
return sha256(JSON.stringify(registration));
|
|
49929
|
+
}
|
|
49930
|
+
function createWorkBuddyInspection(configPath, status, configPaths) {
|
|
49931
|
+
return {
|
|
49932
|
+
client: "workbuddy",
|
|
49933
|
+
status,
|
|
49934
|
+
config_path: configPath,
|
|
49935
|
+
config_paths: configPaths,
|
|
49936
|
+
registration_count: configPaths.length
|
|
49937
|
+
};
|
|
49938
|
+
}
|
|
49939
|
+
function isRecord5(value) {
|
|
49940
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
49941
|
+
}
|
|
49942
|
+
|
|
49943
|
+
// src/maker/cli/dshPluginMigration.ts
|
|
49944
|
+
var import_yaml2 = __toESM(require_dist2());
|
|
49945
|
+
import fs23 from "node:fs";
|
|
49946
|
+
import os7 from "node:os";
|
|
49947
|
+
import path24 from "node:path";
|
|
49948
|
+
import crypto4 from "node:crypto";
|
|
49949
|
+
var DSH_MAKER_MCP_NAME = "taptap-maker";
|
|
49950
|
+
function inspectDshLegacyMakerMcp(options = {}) {
|
|
49951
|
+
const registrations = findDshMakerRegistrations(options.dshHome);
|
|
49952
|
+
const configPaths = unique(registrations.map((entry) => entry.configPath));
|
|
49953
|
+
if (registrations.length === 0) {
|
|
49954
|
+
return createDshInspection("not_found", [], configPaths);
|
|
49955
|
+
}
|
|
49956
|
+
if (registrations.length > 1) {
|
|
49957
|
+
return createDshInspection("ambiguous", configPaths, configPaths);
|
|
49958
|
+
}
|
|
49959
|
+
return createDshInspection("active", [registrations[0].configPath], configPaths);
|
|
49960
|
+
}
|
|
49961
|
+
function migrateDshLegacyMakerMcp(options = {}) {
|
|
49962
|
+
const makerHome = getMakerHome();
|
|
49963
|
+
const statePath = getDshPluginMigrationStatePath(makerHome);
|
|
49964
|
+
const registrations = findDshMakerRegistrations(options.dshHome);
|
|
49965
|
+
const inspection = inspectDshLegacyMakerMcp(options);
|
|
49966
|
+
if (inspection.status === "not_found") {
|
|
49967
|
+
return { ...inspection, action: "not_found", changed: false };
|
|
49968
|
+
}
|
|
49969
|
+
if (inspection.status === "ambiguous") {
|
|
49970
|
+
throw new Error(
|
|
49971
|
+
`DSH Maker MCP migration found ${inspection.registration_count} registrations in ${inspection.config_paths.join(", ")}; resolve the duplicates before migrating.`
|
|
49972
|
+
);
|
|
49973
|
+
}
|
|
49974
|
+
if (!options.confirm) {
|
|
49975
|
+
throw new Error(
|
|
49976
|
+
"Removing the legacy DSH Maker MCP registration requires explicit confirmation."
|
|
49977
|
+
);
|
|
49978
|
+
}
|
|
49979
|
+
const registration = registrations[0];
|
|
49980
|
+
const previousContent = fs23.readFileSync(registration.configPath, "utf8");
|
|
49981
|
+
const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
|
|
49982
|
+
if (document.errors.length > 0) {
|
|
49983
|
+
throw new Error(`Invalid YAML in ${registration.configPath}: ${document.errors[0].message}`);
|
|
49984
|
+
}
|
|
49985
|
+
removeDshMakerRegistration(document, registration);
|
|
49986
|
+
const nextContent = document.toString({ lineWidth: 0 });
|
|
49987
|
+
const state = {
|
|
49988
|
+
schema_version: 1,
|
|
49989
|
+
client: "dsh",
|
|
49990
|
+
config_path: registration.configPath,
|
|
49991
|
+
removed_registration: registration.registration,
|
|
49992
|
+
removed_registration_sha256: sha2562(JSON.stringify(registration.registration)),
|
|
49993
|
+
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
49994
|
+
};
|
|
49995
|
+
fs23.mkdirSync(path24.dirname(statePath), { recursive: true });
|
|
49996
|
+
const write = writeConfigWithTapTapBackupIfChanged(registration.configPath, nextContent, () => {
|
|
49997
|
+
const after = findDshMakerRegistrations(options.dshHome);
|
|
49998
|
+
if (after.some((entry) => entry.configPath === registration.configPath)) {
|
|
49999
|
+
throw new Error("DSH Maker MCP migration validation still found a registration.");
|
|
50000
|
+
}
|
|
50001
|
+
fs23.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
50002
|
+
`, "utf8");
|
|
50003
|
+
});
|
|
50004
|
+
return {
|
|
50005
|
+
...inspectDshLegacyMakerMcp(options),
|
|
50006
|
+
action: "removed",
|
|
50007
|
+
changed: write.changed,
|
|
50008
|
+
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
50009
|
+
state_path: statePath
|
|
50010
|
+
};
|
|
50011
|
+
}
|
|
50012
|
+
function restoreDshLegacyMakerMcp(options = {}) {
|
|
50013
|
+
const makerHome = getMakerHome();
|
|
50014
|
+
const statePath = getDshPluginMigrationStatePath(makerHome);
|
|
50015
|
+
const inspection = inspectDshLegacyMakerMcp(options);
|
|
50016
|
+
const state = readDshMigrationState(statePath);
|
|
50017
|
+
if (!state) {
|
|
50018
|
+
return { ...inspection, action: "not_owned", changed: false };
|
|
50019
|
+
}
|
|
50020
|
+
if (!options.confirm) {
|
|
50021
|
+
throw new Error(
|
|
50022
|
+
"Restoring the legacy DSH Maker MCP registration requires explicit confirmation."
|
|
50023
|
+
);
|
|
50024
|
+
}
|
|
50025
|
+
if (inspection.status === "ambiguous") {
|
|
50026
|
+
throw new Error(
|
|
50027
|
+
`DSH Maker MCP restoration found ${inspection.registration_count} registrations; resolve the duplicates before restoring.`
|
|
50028
|
+
);
|
|
50029
|
+
}
|
|
50030
|
+
if (inspection.status === "active") {
|
|
50031
|
+
const current = findDshMakerRegistrations(options.dshHome)[0];
|
|
50032
|
+
const currentSha = sha2562(JSON.stringify(current.registration));
|
|
50033
|
+
if (currentSha === state.removed_registration_sha256) {
|
|
50034
|
+
fs23.rmSync(statePath, { force: true });
|
|
50035
|
+
return { ...inspection, action: "already_restored", changed: false, state_path: statePath };
|
|
50036
|
+
}
|
|
50037
|
+
return { ...inspection, action: "not_owned", changed: false };
|
|
50038
|
+
}
|
|
50039
|
+
const configPath = state.config_path;
|
|
50040
|
+
const previousContent = fs23.readFileSync(configPath, "utf8");
|
|
50041
|
+
const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
|
|
50042
|
+
if (document.errors.length > 0) {
|
|
50043
|
+
throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
|
|
50044
|
+
}
|
|
50045
|
+
reinsertDshMakerRegistration(document, state.removed_registration);
|
|
50046
|
+
const nextContent = document.toString({ lineWidth: 0 });
|
|
50047
|
+
const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
|
|
50048
|
+
const restored = findDshMakerRegistrations(options.dshHome);
|
|
50049
|
+
const match = restored.find((entry) => entry.configPath === configPath);
|
|
50050
|
+
if (!match || sha2562(JSON.stringify(match.registration)) !== state.removed_registration_sha256) {
|
|
50051
|
+
throw new Error("DSH Maker MCP restoration changed the registration identity.");
|
|
50052
|
+
}
|
|
50053
|
+
fs23.rmSync(statePath, { force: true });
|
|
50054
|
+
});
|
|
50055
|
+
return {
|
|
50056
|
+
...inspectDshLegacyMakerMcp(options),
|
|
50057
|
+
action: "restored",
|
|
50058
|
+
changed: write.changed,
|
|
50059
|
+
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
50060
|
+
state_path: statePath
|
|
50061
|
+
};
|
|
50062
|
+
}
|
|
50063
|
+
function findDshMakerRegistrations(dshHome) {
|
|
50064
|
+
const resolvedDshHome = dshHome || getDshHome();
|
|
50065
|
+
const configPaths = listDshMcpConfigPaths({ homeDir: os7.homedir(), dshHome: resolvedDshHome });
|
|
50066
|
+
const registrations = [];
|
|
50067
|
+
for (const configPath of configPaths) {
|
|
50068
|
+
if (!fs23.existsSync(configPath)) {
|
|
50069
|
+
continue;
|
|
50070
|
+
}
|
|
50071
|
+
const content = fs23.readFileSync(configPath, "utf8");
|
|
50072
|
+
const document = (0, import_yaml2.parseDocument)(content, { prettyErrors: true });
|
|
50073
|
+
if (document.errors.length > 0) {
|
|
50074
|
+
throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
|
|
50075
|
+
}
|
|
50076
|
+
const candidates = findDshMakerCandidates(document);
|
|
50077
|
+
for (const candidate of candidates) {
|
|
50078
|
+
registrations.push({ configPath, ...candidate });
|
|
50079
|
+
}
|
|
50080
|
+
}
|
|
50081
|
+
return registrations;
|
|
50082
|
+
}
|
|
50083
|
+
function findDshMakerCandidates(document) {
|
|
50084
|
+
const candidates = [];
|
|
50085
|
+
const top = document.contents;
|
|
50086
|
+
if (!(0, import_yaml2.isSeq)(top)) {
|
|
50087
|
+
return candidates;
|
|
50088
|
+
}
|
|
50089
|
+
top.items.forEach((rawPatch, patchIndex) => {
|
|
50090
|
+
const patchNode = rawPatch;
|
|
50091
|
+
const patch = patchNode.toJSON();
|
|
50092
|
+
if (Array.isArray(patch == null ? void 0 : patch.insert)) {
|
|
50093
|
+
const insertNode = (0, import_yaml2.isMap)(patchNode) ? patchNode.get("insert", true) : void 0;
|
|
50094
|
+
if (!(0, import_yaml2.isSeq)(insertNode)) {
|
|
50095
|
+
return;
|
|
50096
|
+
}
|
|
50097
|
+
insertNode.items.forEach((rawRow, insertIndex) => {
|
|
50098
|
+
const rowNode = rawRow;
|
|
50099
|
+
const row = rowNode.toJSON();
|
|
50100
|
+
if (isDshMakerPluginCandidate(row)) {
|
|
50101
|
+
candidates.push({
|
|
50102
|
+
patchIndex,
|
|
50103
|
+
insertIndex,
|
|
50104
|
+
registration: row
|
|
50105
|
+
});
|
|
50106
|
+
}
|
|
50107
|
+
});
|
|
50108
|
+
return;
|
|
50109
|
+
}
|
|
50110
|
+
if (isDshMakerPluginCandidate(patch)) {
|
|
50111
|
+
candidates.push({
|
|
50112
|
+
patchIndex,
|
|
50113
|
+
registration: patch
|
|
50114
|
+
});
|
|
50115
|
+
}
|
|
50116
|
+
});
|
|
50117
|
+
return candidates;
|
|
50118
|
+
}
|
|
50119
|
+
function removeDshMakerRegistration(document, registration) {
|
|
50120
|
+
const top = document.contents;
|
|
50121
|
+
if (!(0, import_yaml2.isSeq)(top)) {
|
|
50122
|
+
throw new Error("DSH config top-level value must be a plugin array.");
|
|
50123
|
+
}
|
|
50124
|
+
if (registration.insertIndex !== void 0) {
|
|
50125
|
+
const patchNode = top.items[registration.patchIndex];
|
|
50126
|
+
const insertNode = (0, import_yaml2.isMap)(patchNode) ? patchNode.get("insert", true) : void 0;
|
|
50127
|
+
if (!(0, import_yaml2.isSeq)(insertNode)) {
|
|
50128
|
+
throw new Error("Invalid DSH insert patch.");
|
|
50129
|
+
}
|
|
50130
|
+
insertNode.items.splice(registration.insertIndex, 1);
|
|
50131
|
+
if (insertNode.items.length === 0) {
|
|
50132
|
+
top.items.splice(registration.patchIndex, 1);
|
|
50133
|
+
}
|
|
50134
|
+
return;
|
|
50135
|
+
}
|
|
50136
|
+
top.items.splice(registration.patchIndex, 1);
|
|
50137
|
+
}
|
|
50138
|
+
function reinsertDshMakerRegistration(document, registration) {
|
|
50139
|
+
const top = document.contents;
|
|
50140
|
+
if (!(0, import_yaml2.isSeq)(top)) {
|
|
50141
|
+
throw new Error("DSH config top-level value must be a plugin array.");
|
|
50142
|
+
}
|
|
50143
|
+
top.items.push(document.createNode({ insert: [registration] }));
|
|
50144
|
+
}
|
|
50145
|
+
function isDshMakerPluginCandidate(value) {
|
|
50146
|
+
if (!isRecord6(value)) {
|
|
50147
|
+
return false;
|
|
50148
|
+
}
|
|
50149
|
+
if (value.id === DSH_MAKER_PLUGIN_ID) {
|
|
50150
|
+
return true;
|
|
50151
|
+
}
|
|
50152
|
+
const config2 = isRecord6(value.config) ? value.config : void 0;
|
|
50153
|
+
return value.name === DSH_MCP_PLUGIN_NAME && (config2 == null ? void 0 : config2.serverName) === DSH_MAKER_MCP_NAME;
|
|
50154
|
+
}
|
|
50155
|
+
function getDshPluginMigrationStatePath(makerHome) {
|
|
50156
|
+
return path24.join(makerHome, "plugin-migrations", "dsh.json");
|
|
50157
|
+
}
|
|
50158
|
+
function readDshMigrationState(statePath) {
|
|
50159
|
+
if (!fs23.existsSync(statePath)) {
|
|
50160
|
+
return void 0;
|
|
50161
|
+
}
|
|
50162
|
+
try {
|
|
50163
|
+
const state = JSON.parse(fs23.readFileSync(statePath, "utf8"));
|
|
50164
|
+
return (state == null ? void 0 : state.schema_version) === 1 && state.client === "dsh" ? state : void 0;
|
|
50165
|
+
} catch {
|
|
50166
|
+
return void 0;
|
|
50167
|
+
}
|
|
50168
|
+
}
|
|
50169
|
+
function createDshInspection(status, primaryPaths, allPaths) {
|
|
50170
|
+
return {
|
|
50171
|
+
client: "dsh",
|
|
50172
|
+
status,
|
|
50173
|
+
config_path: primaryPaths[0] ?? "",
|
|
50174
|
+
config_paths: allPaths,
|
|
50175
|
+
registration_count: primaryPaths.length
|
|
50176
|
+
};
|
|
50177
|
+
}
|
|
50178
|
+
function sha2562(content) {
|
|
50179
|
+
return crypto4.createHash("sha256").update(content).digest("hex");
|
|
50180
|
+
}
|
|
50181
|
+
function isRecord6(value) {
|
|
50182
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
50183
|
+
}
|
|
50184
|
+
function unique(values) {
|
|
50185
|
+
return [...new Set(values)];
|
|
50186
|
+
}
|
|
50187
|
+
|
|
50188
|
+
// src/maker/cli/workBuddyProjectSkills.ts
|
|
50189
|
+
import fs24 from "node:fs";
|
|
50190
|
+
import path25 from "node:path";
|
|
50191
|
+
function syncWorkBuddyProjectSkills(targetDir, options = {}) {
|
|
50192
|
+
const platform = options.platform ?? process.platform;
|
|
50193
|
+
const projectDir = path25.resolve(targetDir);
|
|
50194
|
+
const sourceDir = path25.join(projectDir, ".installer", "skills");
|
|
50195
|
+
const workBuddySkillsDir = path25.join(projectDir, ".workbuddy", "skills");
|
|
50196
|
+
const result = {
|
|
50197
|
+
status: "skipped",
|
|
50198
|
+
sourceDir,
|
|
50199
|
+
targetDir: workBuddySkillsDir,
|
|
50200
|
+
installedSkills: [],
|
|
50201
|
+
skippedSkills: []
|
|
50202
|
+
};
|
|
50203
|
+
if (!isDirectory(sourceDir)) {
|
|
50204
|
+
result.reason = "source_not_found";
|
|
50205
|
+
return result;
|
|
50206
|
+
}
|
|
50207
|
+
const sourceSkills = fs24.readdirSync(sourceDir, { withFileTypes: true }).filter(
|
|
50208
|
+
(entry) => entry.isDirectory() && fs24.existsSync(path25.join(sourceDir, entry.name, "SKILL.md"))
|
|
50209
|
+
).map((entry) => entry.name).sort();
|
|
50210
|
+
for (const sourceSkillName of sourceSkills) {
|
|
50211
|
+
const workBuddySkillName = `taptap-maker-${sourceSkillName}`;
|
|
50212
|
+
const workBuddySkillDir = path25.join(workBuddySkillsDir, workBuddySkillName);
|
|
50213
|
+
if (pathEntryExists(workBuddySkillDir)) {
|
|
50214
|
+
result.skippedSkills.push(workBuddySkillName);
|
|
50215
|
+
continue;
|
|
50216
|
+
}
|
|
50217
|
+
fs24.mkdirSync(workBuddySkillsDir, { recursive: true });
|
|
50218
|
+
installSkillContents(path25.join(sourceDir, sourceSkillName), workBuddySkillDir, platform);
|
|
50219
|
+
result.installedSkills.push(workBuddySkillName);
|
|
50220
|
+
}
|
|
50221
|
+
if (result.installedSkills.length > 0) {
|
|
50222
|
+
result.status = "installed";
|
|
50223
|
+
}
|
|
50224
|
+
return result;
|
|
50225
|
+
}
|
|
50226
|
+
function installSkillContents(sourceDir, targetDir, platform) {
|
|
50227
|
+
fs24.mkdirSync(targetDir);
|
|
50228
|
+
try {
|
|
50229
|
+
for (const entry of fs24.readdirSync(sourceDir)) {
|
|
50230
|
+
linkOrCopyEntry(path25.join(sourceDir, entry), path25.join(targetDir, entry), platform);
|
|
50231
|
+
}
|
|
50232
|
+
} catch (error2) {
|
|
50233
|
+
fs24.rmSync(targetDir, { recursive: true, force: true });
|
|
50234
|
+
throw error2;
|
|
50235
|
+
}
|
|
50236
|
+
}
|
|
50237
|
+
function linkOrCopyEntry(source, target, platform) {
|
|
50238
|
+
const stat = fs24.statSync(source);
|
|
50239
|
+
if (platform === "win32" && stat.isFile()) {
|
|
50240
|
+
fs24.copyFileSync(source, target);
|
|
50241
|
+
return;
|
|
50242
|
+
}
|
|
50243
|
+
try {
|
|
50244
|
+
const linkTarget = platform === "win32" ? source : path25.relative(path25.dirname(target), source);
|
|
50245
|
+
const linkType = stat.isDirectory() ? platform === "win32" ? "junction" : "dir" : "file";
|
|
50246
|
+
fs24.symlinkSync(linkTarget, target, linkType);
|
|
50247
|
+
} catch (error2) {
|
|
50248
|
+
try {
|
|
50249
|
+
fs24.cpSync(source, target, { recursive: stat.isDirectory() });
|
|
50250
|
+
} catch (copyError) {
|
|
50251
|
+
throw new Error(
|
|
50252
|
+
`Failed to install WorkBuddy project skill entry ${source}: ${formatError3(error2)}; copy fallback: ${formatError3(copyError)}`
|
|
50253
|
+
);
|
|
50254
|
+
}
|
|
50255
|
+
}
|
|
50256
|
+
}
|
|
50257
|
+
function isDirectory(value) {
|
|
50258
|
+
try {
|
|
50259
|
+
return fs24.statSync(value).isDirectory();
|
|
50260
|
+
} catch {
|
|
50261
|
+
return false;
|
|
50262
|
+
}
|
|
50263
|
+
}
|
|
50264
|
+
function pathEntryExists(value) {
|
|
50265
|
+
try {
|
|
50266
|
+
fs24.lstatSync(value);
|
|
50267
|
+
return true;
|
|
50268
|
+
} catch {
|
|
50269
|
+
return false;
|
|
50270
|
+
}
|
|
50271
|
+
}
|
|
50272
|
+
function formatError3(error2) {
|
|
50273
|
+
return error2 instanceof Error ? error2.message : String(error2);
|
|
50274
|
+
}
|
|
50275
|
+
|
|
48753
50276
|
// src/maker/cli/commands.ts
|
|
48754
|
-
var VERSION2 = true ? "0.0.32-beta.
|
|
50277
|
+
var VERSION2 = true ? "0.0.32-beta.3" : "dev";
|
|
48755
50278
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
48756
50279
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
48757
|
-
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
|
|
50280
|
+
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
|
|
50281
|
+
"pat",
|
|
50282
|
+
"mcp",
|
|
50283
|
+
"dev-kit",
|
|
50284
|
+
"logs",
|
|
50285
|
+
"python",
|
|
50286
|
+
"lua-lsp",
|
|
50287
|
+
"agents",
|
|
50288
|
+
"plugin"
|
|
50289
|
+
]);
|
|
48758
50290
|
var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
48759
50291
|
"json",
|
|
48760
50292
|
"skip_confirm",
|
|
@@ -48765,6 +50297,7 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
48765
50297
|
"all",
|
|
48766
50298
|
"create",
|
|
48767
50299
|
"consent",
|
|
50300
|
+
"confirm",
|
|
48768
50301
|
"context_stdin",
|
|
48769
50302
|
"h",
|
|
48770
50303
|
"help"
|
|
@@ -48823,6 +50356,10 @@ async function runMakerCli(argv) {
|
|
|
48823
50356
|
await runAgentsUpdate(parsed, ctx);
|
|
48824
50357
|
return;
|
|
48825
50358
|
}
|
|
50359
|
+
if (command === "plugin") {
|
|
50360
|
+
runPluginLifecycle(parsed, ctx);
|
|
50361
|
+
return;
|
|
50362
|
+
}
|
|
48826
50363
|
if (command === "upgrade") {
|
|
48827
50364
|
await runUpgrade(parsed, ctx);
|
|
48828
50365
|
return;
|
|
@@ -48845,6 +50382,57 @@ async function runMakerCli(argv) {
|
|
|
48845
50382
|
}
|
|
48846
50383
|
throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
|
|
48847
50384
|
}
|
|
50385
|
+
function runPluginLifecycle(parsed, ctx) {
|
|
50386
|
+
const subcommand = parsed.command[1];
|
|
50387
|
+
const client = stringOption(parsed, "client") || "codex";
|
|
50388
|
+
if (client !== "codex" && client !== "workbuddy" && client !== "dsh") {
|
|
50389
|
+
throw new Error(
|
|
50390
|
+
`Unsupported Maker plugin client: ${client}. Supported clients: codex, workbuddy, dsh.`
|
|
50391
|
+
);
|
|
50392
|
+
}
|
|
50393
|
+
if (subcommand === "inspect") {
|
|
50394
|
+
writePluginLifecycleResult(
|
|
50395
|
+
ctx,
|
|
50396
|
+
client === "codex" ? inspectCodexLegacyMakerMcp() : client === "workbuddy" ? inspectWorkBuddyLegacyMakerMcp() : inspectDshLegacyMakerMcp()
|
|
50397
|
+
);
|
|
50398
|
+
return;
|
|
50399
|
+
}
|
|
50400
|
+
if (subcommand === "migrate") {
|
|
50401
|
+
writePluginLifecycleResult(
|
|
50402
|
+
ctx,
|
|
50403
|
+
client === "codex" ? migrateCodexLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : client === "workbuddy" ? migrateWorkBuddyLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : migrateDshLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") })
|
|
50404
|
+
);
|
|
50405
|
+
return;
|
|
50406
|
+
}
|
|
50407
|
+
if (subcommand === "restore") {
|
|
50408
|
+
writePluginLifecycleResult(
|
|
50409
|
+
ctx,
|
|
50410
|
+
client === "codex" ? restoreCodexLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : client === "workbuddy" ? restoreWorkBuddyLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : restoreDshLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") })
|
|
50411
|
+
);
|
|
50412
|
+
return;
|
|
50413
|
+
}
|
|
50414
|
+
throw new Error("Unknown Maker plugin command. Use inspect, migrate, or restore.");
|
|
50415
|
+
}
|
|
50416
|
+
function writePluginLifecycleResult(ctx, result) {
|
|
50417
|
+
if (ctx.json) {
|
|
50418
|
+
writeJson(result);
|
|
50419
|
+
return;
|
|
50420
|
+
}
|
|
50421
|
+
process.stdout.write(
|
|
50422
|
+
[
|
|
50423
|
+
"TapTap Maker plugin migration",
|
|
50424
|
+
"",
|
|
50425
|
+
`- client: ${result.client}`,
|
|
50426
|
+
`- legacy_mcp_status: ${result.status}`,
|
|
50427
|
+
`- config_path: ${result.config_path}`,
|
|
50428
|
+
..."config_paths" in result && result.config_paths.length > 1 ? [`- config_paths: ${result.config_paths.join(", ")}`] : [],
|
|
50429
|
+
`- registration_count: ${result.registration_count}`,
|
|
50430
|
+
..."action" in result ? [`- action: ${result.action}`, `- changed: ${result.changed}`] : [],
|
|
50431
|
+
..."backup_path" in result && result.backup_path ? [`- backup_path: ${result.backup_path}`] : [],
|
|
50432
|
+
""
|
|
50433
|
+
].join("\n")
|
|
50434
|
+
);
|
|
50435
|
+
}
|
|
48848
50436
|
function parseArgs(argv) {
|
|
48849
50437
|
const command = [];
|
|
48850
50438
|
const positionals = [];
|
|
@@ -48892,7 +50480,7 @@ function toOptionKey(value) {
|
|
|
48892
50480
|
}
|
|
48893
50481
|
async function runInit(parsed, ctx) {
|
|
48894
50482
|
rejectPackageOption(parsed);
|
|
48895
|
-
const targetDir =
|
|
50483
|
+
const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
48896
50484
|
const env = makerEnvOption(parsed);
|
|
48897
50485
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
48898
50486
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -49007,7 +50595,7 @@ async function runInit(parsed, ctx) {
|
|
|
49007
50595
|
}
|
|
49008
50596
|
async function runDoctor(parsed, ctx) {
|
|
49009
50597
|
var _a3, _b;
|
|
49010
|
-
const targetDir =
|
|
50598
|
+
const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
49011
50599
|
const env = makerEnvOption(parsed);
|
|
49012
50600
|
const git = checkGitEnvironment();
|
|
49013
50601
|
const python = checkMakerPythonEnvironment();
|
|
@@ -49098,8 +50686,8 @@ async function runDoctor(parsed, ctx) {
|
|
|
49098
50686
|
);
|
|
49099
50687
|
}
|
|
49100
50688
|
function inspectMakerDoctorExecutionContext(options) {
|
|
49101
|
-
const doctorCwd =
|
|
49102
|
-
const makerProjectDir = options.makerProjectDir ?
|
|
50689
|
+
const doctorCwd = path26.resolve(process.cwd());
|
|
50690
|
+
const makerProjectDir = options.makerProjectDir ? path26.resolve(options.makerProjectDir) : void 0;
|
|
49103
50691
|
if (!makerProjectDir) {
|
|
49104
50692
|
return {
|
|
49105
50693
|
active_client_session: "not_checked",
|
|
@@ -49134,9 +50722,9 @@ function samePath2(left, right) {
|
|
|
49134
50722
|
return normalizePathForCompare3(left) === normalizePathForCompare3(right);
|
|
49135
50723
|
}
|
|
49136
50724
|
function normalizePathForCompare3(value) {
|
|
49137
|
-
const resolved =
|
|
50725
|
+
const resolved = path26.resolve(value);
|
|
49138
50726
|
try {
|
|
49139
|
-
return
|
|
50727
|
+
return fs25.realpathSync.native(resolved);
|
|
49140
50728
|
} catch {
|
|
49141
50729
|
return resolved;
|
|
49142
50730
|
}
|
|
@@ -49454,7 +51042,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
49454
51042
|
}
|
|
49455
51043
|
async function resolvePatSet(parsed, ctx) {
|
|
49456
51044
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
49457
|
-
const pat =
|
|
51045
|
+
const pat = fs25.readFileSync(0, "utf8").trim();
|
|
49458
51046
|
if (!pat) {
|
|
49459
51047
|
throw new Error("No PAT found on stdin.");
|
|
49460
51048
|
}
|
|
@@ -49509,17 +51097,17 @@ async function prepareMcpLauncher(options) {
|
|
|
49509
51097
|
if (options.mode === "self") {
|
|
49510
51098
|
launcher = materializeMakerSelfLauncher({
|
|
49511
51099
|
version: VERSION2,
|
|
49512
|
-
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL(
|
|
51100
|
+
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL(path26.resolve(process.cwd(), "dist", "maker.js")).href,
|
|
49513
51101
|
makerHome: getMakerHome()
|
|
49514
51102
|
});
|
|
49515
51103
|
} else {
|
|
49516
51104
|
const packageSpec = resolveMakerPackageSpec(MAKER_NPM_PACKAGE, VERSION2);
|
|
49517
51105
|
launcher = resolveMakerMcpLauncher({ packageName: packageSpec });
|
|
49518
51106
|
const configuredCache = process.env.npm_config_cache || process.env.NPM_CONFIG_CACHE;
|
|
49519
|
-
const npmCacheDir =
|
|
49520
|
-
configuredCache ||
|
|
51107
|
+
const npmCacheDir = path26.resolve(
|
|
51108
|
+
configuredCache || path26.join(getMakerHome(), "cache", "npm")
|
|
49521
51109
|
);
|
|
49522
|
-
|
|
51110
|
+
fs25.mkdirSync(npmCacheDir, { recursive: true });
|
|
49523
51111
|
launcherEnv = { npm_config_cache: npmCacheDir };
|
|
49524
51112
|
}
|
|
49525
51113
|
} catch (error2) {
|
|
@@ -49652,14 +51240,58 @@ ${indent3(payload.stderr)}` : "",
|
|
|
49652
51240
|
}
|
|
49653
51241
|
async function runMcpReport(parsed, ctx) {
|
|
49654
51242
|
rejectPackageOption(parsed);
|
|
49655
|
-
const targetDir =
|
|
51243
|
+
const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
49656
51244
|
const contextInput = booleanOption(parsed, "context_stdin") ? await readStdinText() : "";
|
|
49657
51245
|
const context = parseMakerMcpReportContext(contextInput);
|
|
51246
|
+
const contextValidation = validateMakerMcpReportContext(context);
|
|
51247
|
+
if (!contextValidation.ok) {
|
|
51248
|
+
const payload = {
|
|
51249
|
+
status: "invalid_context",
|
|
51250
|
+
reason: contextValidation.reason,
|
|
51251
|
+
issue_url: "https://github.com/taptap/instant-games-open-mcp/issues/new"
|
|
51252
|
+
};
|
|
51253
|
+
if (ctx.json) {
|
|
51254
|
+
writeJson(payload);
|
|
51255
|
+
return;
|
|
51256
|
+
}
|
|
51257
|
+
process.stdout.write(
|
|
51258
|
+
[
|
|
51259
|
+
"Maker MCP issue report was not prepared: actionable error context is missing.",
|
|
51260
|
+
`Reason: ${payload.reason}`,
|
|
51261
|
+
`Manual issue URL: ${payload.issue_url}`,
|
|
51262
|
+
""
|
|
51263
|
+
].join("\n")
|
|
51264
|
+
);
|
|
51265
|
+
return;
|
|
51266
|
+
}
|
|
51267
|
+
const reportRuntime = resolveMakerMcpReportRuntime({
|
|
51268
|
+
distribution: process.env.TAPTAP_MAKER_DISTRIBUTION,
|
|
51269
|
+
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : void 0
|
|
51270
|
+
});
|
|
49658
51271
|
const diagnostics = await collectMakerMcpIssueDiagnostics({
|
|
49659
|
-
ide: stringOption(parsed, "ide"),
|
|
51272
|
+
ide: stringOption(parsed, "ide") || (reportRuntime == null ? void 0 : reportRuntime.client),
|
|
49660
51273
|
targetDir,
|
|
49661
51274
|
makerVersion: VERSION2,
|
|
51275
|
+
configSource: reportRuntime == null ? void 0 : reportRuntime.config_source,
|
|
51276
|
+
distribution: reportRuntime == null ? void 0 : reportRuntime.distribution,
|
|
49662
51277
|
verify: async () => {
|
|
51278
|
+
if (reportRuntime) {
|
|
51279
|
+
const verification = await verifyMakerMcpLauncher(reportRuntime.launcher, {
|
|
51280
|
+
cwd: reportRuntime.cwd,
|
|
51281
|
+
env: reportRuntime.env,
|
|
51282
|
+
timeoutMs: 15e3
|
|
51283
|
+
});
|
|
51284
|
+
return {
|
|
51285
|
+
ok: verification.ok,
|
|
51286
|
+
stage: verification.stage,
|
|
51287
|
+
launcher_kind: verification.launcherKind,
|
|
51288
|
+
command: verification.command,
|
|
51289
|
+
tools: verification.toolNames,
|
|
51290
|
+
stderr: verification.stderr,
|
|
51291
|
+
error: verification.error,
|
|
51292
|
+
failure_type: verification.failureType
|
|
51293
|
+
};
|
|
51294
|
+
}
|
|
49663
51295
|
const prepared = await prepareMcpLauncher({
|
|
49664
51296
|
env: makerEnvOption(parsed),
|
|
49665
51297
|
mode: "self"
|
|
@@ -49682,7 +51314,7 @@ async function runMcpReport(parsed, ctx) {
|
|
|
49682
51314
|
const issue3 = buildMakerMcpIssue({
|
|
49683
51315
|
context,
|
|
49684
51316
|
diagnostics,
|
|
49685
|
-
homeDir:
|
|
51317
|
+
homeDir: os8.homedir()
|
|
49686
51318
|
});
|
|
49687
51319
|
const submission = booleanOption(parsed, "consent") ? submitMakerMcpIssue(issue3) : {
|
|
49688
51320
|
status: "consent_required",
|
|
@@ -49709,7 +51341,7 @@ async function runMcpReport(parsed, ctx) {
|
|
|
49709
51341
|
);
|
|
49710
51342
|
}
|
|
49711
51343
|
async function runAgentsUpdate(parsed, ctx) {
|
|
49712
|
-
const targetDir =
|
|
51344
|
+
const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
49713
51345
|
const result = updateMakerAgentsPolicy(targetDir);
|
|
49714
51346
|
if (ctx.json) {
|
|
49715
51347
|
writeJson(result);
|
|
@@ -49728,21 +51360,25 @@ async function runAgentsUpdate(parsed, ctx) {
|
|
|
49728
51360
|
async function runUpgrade(parsed, ctx) {
|
|
49729
51361
|
rejectPackageOption(parsed);
|
|
49730
51362
|
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
49731
|
-
const targetDir =
|
|
51363
|
+
const targetDir = path26.resolve(explicitTargetDir || process.cwd());
|
|
49732
51364
|
const env = makerEnvOption(parsed);
|
|
49733
51365
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
49734
|
-
const
|
|
49735
|
-
|
|
49736
|
-
|
|
49737
|
-
|
|
51366
|
+
const pluginDistribution = resolveMakerPluginDistribution();
|
|
51367
|
+
let installResults = [];
|
|
51368
|
+
if (!pluginDistribution) {
|
|
51369
|
+
const prepared = await prepareMcpLauncher({ env, mode: mcpLauncherOption(parsed) });
|
|
51370
|
+
if (!prepared.ok) {
|
|
51371
|
+
writeMcpLauncherFailure(ctx, prepared);
|
|
51372
|
+
return;
|
|
51373
|
+
}
|
|
51374
|
+
installResults = installMcpConfigs({
|
|
51375
|
+
ides: ides.length > 0 ? ides : getDefaultMcpInstallIdes(),
|
|
51376
|
+
env: makerMcpConfigEnvOption(parsed),
|
|
51377
|
+
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
51378
|
+
launcher: prepared.launcher,
|
|
51379
|
+
launcherEnv: prepared.launcherEnv
|
|
51380
|
+
});
|
|
49738
51381
|
}
|
|
49739
|
-
const installResults = installMcpConfigs({
|
|
49740
|
-
ides: ides.length > 0 ? ides : getDefaultMcpInstallIdes(),
|
|
49741
|
-
env: makerMcpConfigEnvOption(parsed),
|
|
49742
|
-
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
49743
|
-
launcher: prepared.launcher,
|
|
49744
|
-
launcherEnv: prepared.launcherEnv
|
|
49745
|
-
});
|
|
49746
51382
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
49747
51383
|
const agentsResult = identify.projectRoot ? updateMakerAgentsPolicy(identify.projectRoot) : void 0;
|
|
49748
51384
|
const payload = {
|
|
@@ -49753,7 +51389,8 @@ async function runUpgrade(parsed, ctx) {
|
|
|
49753
51389
|
agents_policy: agentsResult,
|
|
49754
51390
|
restart_required: false,
|
|
49755
51391
|
apply_mode: "next_mcp_start",
|
|
49756
|
-
current_session: "preserved"
|
|
51392
|
+
current_session: "preserved",
|
|
51393
|
+
plugin_distribution: pluginDistribution == null ? void 0 : pluginDistribution.id
|
|
49757
51394
|
};
|
|
49758
51395
|
if (!payload.ok) {
|
|
49759
51396
|
process.exitCode = 1;
|
|
@@ -49764,9 +51401,9 @@ async function runUpgrade(parsed, ctx) {
|
|
|
49764
51401
|
}
|
|
49765
51402
|
process.stdout.write(
|
|
49766
51403
|
[
|
|
49767
|
-
payload.ok ? "TapTap Maker upgrade completed" : "TapTap Maker upgrade completed with errors",
|
|
51404
|
+
pluginDistribution ? "TapTap Maker project policy update completed" : payload.ok ? "TapTap Maker upgrade completed" : "TapTap Maker upgrade completed with errors",
|
|
49768
51405
|
"",
|
|
49769
|
-
...installResults.map((result) => result.message),
|
|
51406
|
+
...pluginDistribution ? [`✓ Standalone MCP registration unchanged (${pluginDistribution.displayName} plugin)`] : installResults.map((result) => result.message),
|
|
49770
51407
|
"",
|
|
49771
51408
|
agentsResult ? [
|
|
49772
51409
|
agentsResult.changed ? "✓ AGENTS.md managed policy updated" : "✓ AGENTS.md managed policy current",
|
|
@@ -49774,8 +51411,8 @@ async function runUpgrade(parsed, ctx) {
|
|
|
49774
51411
|
`- previous_status: ${agentsResult.previousStatus}`
|
|
49775
51412
|
].join("\n") : "AGENTS.md managed policy skipped: current directory is not bound to a Maker project.",
|
|
49776
51413
|
"",
|
|
49777
|
-
"Current MCP session remains unchanged and continues using the existing version.",
|
|
49778
|
-
"The updated package and AGENTS.md will take effect on the next MCP start or user-requested reconnect.",
|
|
51414
|
+
pluginDistribution ? formatMakerPluginUpdateAction(pluginDistribution) : "Current MCP session remains unchanged and continues using the existing version.",
|
|
51415
|
+
pluginDistribution ? "The updated AGENTS.md policy is available to the current project." : "The updated package and AGENTS.md will take effect on the next MCP start or user-requested reconnect.",
|
|
49779
51416
|
""
|
|
49780
51417
|
].join("\n")
|
|
49781
51418
|
);
|
|
@@ -49812,19 +51449,20 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
49812
51449
|
];
|
|
49813
51450
|
}
|
|
49814
51451
|
async function runDevKitUpdate(parsed, ctx) {
|
|
49815
|
-
const targetDir =
|
|
51452
|
+
const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
49816
51453
|
const result = await installAiDevKit({
|
|
49817
51454
|
targetDir,
|
|
49818
51455
|
preserveExisting: false,
|
|
49819
51456
|
replaceManagedEntries: true,
|
|
49820
51457
|
environment: makerEnvOption(parsed)
|
|
49821
51458
|
});
|
|
51459
|
+
syncWorkBuddyDevKitSkills(targetDir, ctx);
|
|
49822
51460
|
finalizeStagedDevKitGitignore(targetDir);
|
|
49823
51461
|
emit(ctx, "dev_kit", formatDevKitInstallMessage("AI dev kit updated", result), result);
|
|
49824
51462
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
49825
51463
|
}
|
|
49826
51464
|
async function runLogsWatch(parsed, ctx) {
|
|
49827
|
-
const targetDir =
|
|
51465
|
+
const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
49828
51466
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
49829
51467
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
49830
51468
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -49834,9 +51472,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
49834
51472
|
serverUrl: stringOption(parsed, "server_url"),
|
|
49835
51473
|
env: makerEnvOption(parsed)
|
|
49836
51474
|
});
|
|
49837
|
-
const runtimeDir =
|
|
49838
|
-
const runtimeLog =
|
|
49839
|
-
const pidFile =
|
|
51475
|
+
const runtimeDir = path26.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
51476
|
+
const runtimeLog = path26.join(runtimeDir, "runtime.log");
|
|
51477
|
+
const pidFile = path26.join(runtimeDir, "watcher.pid");
|
|
49840
51478
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
49841
51479
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
49842
51480
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -49881,10 +51519,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
49881
51519
|
}
|
|
49882
51520
|
}
|
|
49883
51521
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
49884
|
-
|
|
51522
|
+
fs25.mkdirSync(path26.dirname(pidFile), { recursive: true });
|
|
49885
51523
|
const existingPid = readPidFile(pidFile);
|
|
49886
51524
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
49887
|
-
|
|
51525
|
+
fs25.writeFileSync(
|
|
49888
51526
|
pidFile,
|
|
49889
51527
|
`${JSON.stringify(
|
|
49890
51528
|
{
|
|
@@ -49902,10 +51540,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
49902
51540
|
return previous;
|
|
49903
51541
|
}
|
|
49904
51542
|
function readPidFile(pidFile) {
|
|
49905
|
-
if (!
|
|
51543
|
+
if (!fs25.existsSync(pidFile)) {
|
|
49906
51544
|
return void 0;
|
|
49907
51545
|
}
|
|
49908
|
-
const raw =
|
|
51546
|
+
const raw = fs25.readFileSync(pidFile, "utf8").trim();
|
|
49909
51547
|
let pid = Number(raw);
|
|
49910
51548
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
49911
51549
|
try {
|
|
@@ -49925,7 +51563,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
49925
51563
|
}
|
|
49926
51564
|
cleaned = true;
|
|
49927
51565
|
if (readPidFile(pidFile) === process.pid) {
|
|
49928
|
-
|
|
51566
|
+
fs25.rmSync(pidFile, { force: true });
|
|
49929
51567
|
}
|
|
49930
51568
|
};
|
|
49931
51569
|
process.once("exit", cleanup);
|
|
@@ -50076,9 +51714,10 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
50076
51714
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
50077
51715
|
});
|
|
50078
51716
|
writeDevKitStagedGitignore(
|
|
50079
|
-
|
|
51717
|
+
path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
50080
51718
|
listPresentDevKitManagedEntries(targetDir)
|
|
50081
51719
|
);
|
|
51720
|
+
syncWorkBuddyDevKitSkills(targetDir, ctx);
|
|
50082
51721
|
if (options.finalizeGitignore) {
|
|
50083
51722
|
finalizeStagedDevKitGitignore(targetDir);
|
|
50084
51723
|
}
|
|
@@ -50093,7 +51732,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
50093
51732
|
);
|
|
50094
51733
|
} catch (error2) {
|
|
50095
51734
|
writeDevKitStagedGitignore(
|
|
50096
|
-
|
|
51735
|
+
path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
50097
51736
|
listPresentDevKitManagedEntries(targetDir)
|
|
50098
51737
|
);
|
|
50099
51738
|
if (options.finalizeGitignore) {
|
|
@@ -50114,6 +51753,7 @@ ${detail}`, {
|
|
|
50114
51753
|
environment: options.environment,
|
|
50115
51754
|
onSkillInstallerStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
50116
51755
|
});
|
|
51756
|
+
syncWorkBuddyDevKitSkills(targetDir, ctx);
|
|
50117
51757
|
if (options.finalizeGitignore) {
|
|
50118
51758
|
finalizeStagedDevKitGitignore(targetDir);
|
|
50119
51759
|
}
|
|
@@ -50131,6 +51771,38 @@ ${detail}`, {
|
|
|
50131
51771
|
});
|
|
50132
51772
|
}
|
|
50133
51773
|
}
|
|
51774
|
+
function syncWorkBuddyDevKitSkills(targetDir, ctx) {
|
|
51775
|
+
var _a3;
|
|
51776
|
+
if (((_a3 = resolveMakerPluginDistribution()) == null ? void 0 : _a3.client) !== "workbuddy") {
|
|
51777
|
+
return;
|
|
51778
|
+
}
|
|
51779
|
+
try {
|
|
51780
|
+
const result = syncWorkBuddyProjectSkills(targetDir);
|
|
51781
|
+
const managedSkillPaths = [...result.installedSkills, ...result.skippedSkills].map(
|
|
51782
|
+
(skillName) => path26.join(".workbuddy", "skills", skillName)
|
|
51783
|
+
);
|
|
51784
|
+
if (managedSkillPaths.length > 0) {
|
|
51785
|
+
writeDevKitStagedGitignore(path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
|
|
51786
|
+
...listPresentDevKitManagedEntries(targetDir),
|
|
51787
|
+
...managedSkillPaths
|
|
51788
|
+
]);
|
|
51789
|
+
}
|
|
51790
|
+
if (result.installedSkills.length > 0) {
|
|
51791
|
+
emit(
|
|
51792
|
+
ctx,
|
|
51793
|
+
"dev_kit",
|
|
51794
|
+
`WorkBuddy project skills installed: ${result.installedSkills.length}`,
|
|
51795
|
+
result
|
|
51796
|
+
);
|
|
51797
|
+
}
|
|
51798
|
+
} catch (error2) {
|
|
51799
|
+
const detail = error2 instanceof Error ? error2.message : String(error2);
|
|
51800
|
+
emit(ctx, "dev_kit_warning", `WorkBuddy project skills install failed
|
|
51801
|
+
${detail}`, {
|
|
51802
|
+
error: detail
|
|
51803
|
+
});
|
|
51804
|
+
}
|
|
51805
|
+
}
|
|
50134
51806
|
function formatDevKitInstallMessage(message, result) {
|
|
50135
51807
|
if (!result.skillInstaller) {
|
|
50136
51808
|
return message;
|
|
@@ -50187,12 +51859,12 @@ function installMcpConfig(ide, options) {
|
|
|
50187
51859
|
}
|
|
50188
51860
|
function installMcpConfigUnsafe(ide, options) {
|
|
50189
51861
|
if (ide === "codex") {
|
|
50190
|
-
const configPath =
|
|
51862
|
+
const configPath = path26.join(os8.homedir(), ".codex", "config.toml");
|
|
50191
51863
|
const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
|
|
50192
51864
|
return [createMcpInstallResult(ide, "Codex", configPath, write)];
|
|
50193
51865
|
}
|
|
50194
51866
|
if (ide === "cursor") {
|
|
50195
|
-
const configPath =
|
|
51867
|
+
const configPath = path26.join(os8.homedir(), ".cursor", "mcp.json");
|
|
50196
51868
|
const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
|
|
50197
51869
|
return [createMcpInstallResult(ide, "Cursor", configPath, write)];
|
|
50198
51870
|
}
|
|
@@ -50209,7 +51881,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
50209
51881
|
}
|
|
50210
51882
|
];
|
|
50211
51883
|
}
|
|
50212
|
-
const configPath =
|
|
51884
|
+
const configPath = path26.join(os8.homedir(), ".claude.json");
|
|
50213
51885
|
const write = mergeJsonMcpConfig(configPath, claudeOptions);
|
|
50214
51886
|
return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
|
|
50215
51887
|
}
|
|
@@ -50223,7 +51895,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
50223
51895
|
}
|
|
50224
51896
|
if (ide === "opencode") {
|
|
50225
51897
|
const configPath = getOpenCodeMcpConfigPath();
|
|
50226
|
-
if (!
|
|
51898
|
+
if (!fs25.existsSync(configPath)) {
|
|
50227
51899
|
return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
|
|
50228
51900
|
}
|
|
50229
51901
|
const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
|
|
@@ -50306,13 +51978,13 @@ function getDefaultMcpInstallIdes() {
|
|
|
50306
51978
|
if (getTraeMcpInstallPaths().length > 0) {
|
|
50307
51979
|
ides.push("trae");
|
|
50308
51980
|
}
|
|
50309
|
-
if (
|
|
51981
|
+
if (fs25.existsSync(getOpenCodeMcpConfigPath())) {
|
|
50310
51982
|
ides.push("opencode");
|
|
50311
51983
|
}
|
|
50312
51984
|
if (getWorkBuddyMcpInstallPaths().length > 0) {
|
|
50313
51985
|
ides.push("workbuddy");
|
|
50314
51986
|
}
|
|
50315
|
-
if (
|
|
51987
|
+
if (fs25.existsSync(getDshHome())) {
|
|
50316
51988
|
ides.push("dsh");
|
|
50317
51989
|
}
|
|
50318
51990
|
return ides;
|
|
@@ -50326,7 +51998,7 @@ function getExistingTraeUserConfigPaths(paths) {
|
|
|
50326
51998
|
const seen = /* @__PURE__ */ new Set();
|
|
50327
51999
|
return paths.filter((configPath) => {
|
|
50328
52000
|
const key = normalizeConfigPathKey(configPath);
|
|
50329
|
-
if (seen.has(key) || !
|
|
52001
|
+
if (seen.has(key) || !fs25.existsSync(path26.dirname(configPath))) {
|
|
50330
52002
|
return false;
|
|
50331
52003
|
}
|
|
50332
52004
|
seen.add(key);
|
|
@@ -50337,7 +52009,7 @@ function getExistingConfigPaths(paths) {
|
|
|
50337
52009
|
const seen = /* @__PURE__ */ new Set();
|
|
50338
52010
|
return paths.filter((configPath) => {
|
|
50339
52011
|
const key = normalizeConfigPathKey(configPath);
|
|
50340
|
-
if (seen.has(key) || !
|
|
52012
|
+
if (seen.has(key) || !fs25.existsSync(configPath)) {
|
|
50341
52013
|
return false;
|
|
50342
52014
|
}
|
|
50343
52015
|
seen.add(key);
|
|
@@ -50345,62 +52017,62 @@ function getExistingConfigPaths(paths) {
|
|
|
50345
52017
|
});
|
|
50346
52018
|
}
|
|
50347
52019
|
function normalizeConfigPathKey(configPath) {
|
|
50348
|
-
const resolved =
|
|
52020
|
+
const resolved = path26.resolve(configPath);
|
|
50349
52021
|
return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
|
|
50350
52022
|
}
|
|
50351
52023
|
function getTraeSoloMcpConfigPaths() {
|
|
50352
52024
|
if (process.platform === "win32") {
|
|
50353
|
-
const roaming = process.env.APPDATA ||
|
|
52025
|
+
const roaming = process.env.APPDATA || path26.join(os8.homedir(), "AppData", "Roaming");
|
|
50354
52026
|
return [
|
|
50355
|
-
|
|
50356
|
-
|
|
52027
|
+
path26.join(roaming, "TRAE SOLO", "User", "mcp.json"),
|
|
52028
|
+
path26.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
|
|
50357
52029
|
];
|
|
50358
52030
|
}
|
|
50359
|
-
const appSupport =
|
|
52031
|
+
const appSupport = path26.join(os8.homedir(), "Library", "Application Support");
|
|
50360
52032
|
return [
|
|
50361
|
-
|
|
50362
|
-
|
|
52033
|
+
path26.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
|
|
52034
|
+
path26.join(appSupport, "TRAE SOLO", "User", "mcp.json")
|
|
50363
52035
|
];
|
|
50364
52036
|
}
|
|
50365
52037
|
function getTraeUnverifiedMcpConfigPaths() {
|
|
50366
52038
|
if (process.platform === "win32") {
|
|
50367
|
-
const roaming = process.env.APPDATA ||
|
|
52039
|
+
const roaming = process.env.APPDATA || path26.join(os8.homedir(), "AppData", "Roaming");
|
|
50368
52040
|
return [
|
|
50369
|
-
|
|
50370
|
-
|
|
50371
|
-
|
|
52041
|
+
path26.join(roaming, "Trae", "User", "mcp.json"),
|
|
52042
|
+
path26.join(roaming, "TRAE", "User", "mcp.json"),
|
|
52043
|
+
path26.join(roaming, "Trae CN", "User", "mcp.json")
|
|
50372
52044
|
];
|
|
50373
52045
|
}
|
|
50374
|
-
const appSupport =
|
|
52046
|
+
const appSupport = path26.join(os8.homedir(), "Library", "Application Support");
|
|
50375
52047
|
return [
|
|
50376
|
-
|
|
50377
|
-
|
|
50378
|
-
|
|
52048
|
+
path26.join(appSupport, "Trae", "User", "mcp.json"),
|
|
52049
|
+
path26.join(appSupport, "TRAE", "User", "mcp.json"),
|
|
52050
|
+
path26.join(appSupport, "Trae CN", "User", "mcp.json")
|
|
50379
52051
|
];
|
|
50380
52052
|
}
|
|
50381
52053
|
function getOpenCodeMcpConfigPath() {
|
|
50382
|
-
return
|
|
52054
|
+
return path26.join(os8.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
50383
52055
|
}
|
|
50384
52056
|
function getWorkBuddyHome() {
|
|
50385
|
-
return
|
|
52057
|
+
return path26.join(os8.homedir(), ".workbuddy");
|
|
50386
52058
|
}
|
|
50387
52059
|
function getWorkBuddyMcpInstallPaths(options = {}) {
|
|
50388
|
-
const primary =
|
|
50389
|
-
if (
|
|
52060
|
+
const primary = path26.join(getWorkBuddyHome(), "mcp.json");
|
|
52061
|
+
if (fs25.existsSync(primary) || options.createPrimary) {
|
|
50390
52062
|
return [primary];
|
|
50391
52063
|
}
|
|
50392
|
-
const legacy =
|
|
50393
|
-
if (
|
|
52064
|
+
const legacy = path26.join(getWorkBuddyHome(), ".mcp.json");
|
|
52065
|
+
if (fs25.existsSync(legacy)) {
|
|
50394
52066
|
return [legacy];
|
|
50395
52067
|
}
|
|
50396
52068
|
return [];
|
|
50397
52069
|
}
|
|
50398
52070
|
function inspectWorkBuddyTrustState(mcpName) {
|
|
50399
52071
|
const workbuddyHome = getWorkBuddyHome();
|
|
50400
|
-
const connectorsDir =
|
|
52072
|
+
const connectorsDir = path26.join(workbuddyHome, "connectors");
|
|
50401
52073
|
const accounts = [];
|
|
50402
52074
|
const stateFiles = [];
|
|
50403
|
-
if (!
|
|
52075
|
+
if (!fs25.existsSync(connectorsDir)) {
|
|
50404
52076
|
return {
|
|
50405
52077
|
status: "not_found",
|
|
50406
52078
|
mcp_name: mcpName,
|
|
@@ -50410,12 +52082,12 @@ function inspectWorkBuddyTrustState(mcpName) {
|
|
|
50410
52082
|
accounts
|
|
50411
52083
|
};
|
|
50412
52084
|
}
|
|
50413
|
-
for (const entry of
|
|
52085
|
+
for (const entry of fs25.readdirSync(connectorsDir, { withFileTypes: true })) {
|
|
50414
52086
|
if (!entry.isDirectory()) {
|
|
50415
52087
|
continue;
|
|
50416
52088
|
}
|
|
50417
|
-
const statePath =
|
|
50418
|
-
if (!
|
|
52089
|
+
const statePath = path26.join(connectorsDir, entry.name, "connector-states.json");
|
|
52090
|
+
if (!fs25.existsSync(statePath)) {
|
|
50419
52091
|
continue;
|
|
50420
52092
|
}
|
|
50421
52093
|
stateFiles.push(statePath);
|
|
@@ -50494,7 +52166,7 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
50494
52166
|
);
|
|
50495
52167
|
}
|
|
50496
52168
|
function mergeOpenCodeMcpConfig(configPath, options) {
|
|
50497
|
-
const rawContent =
|
|
52169
|
+
const rawContent = fs25.readFileSync(configPath, "utf8");
|
|
50498
52170
|
const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
|
|
50499
52171
|
const existing = readJsonObject(configPath, { jsonc: true });
|
|
50500
52172
|
const mcp = asObject(existing.mcp);
|
|
@@ -50526,20 +52198,21 @@ function mergeOpenCodeMcpConfig(configPath, options) {
|
|
|
50526
52198
|
return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
|
|
50527
52199
|
}
|
|
50528
52200
|
function mergeCodexMcpConfig(configPath, options) {
|
|
50529
|
-
const existing =
|
|
50530
|
-
const
|
|
50531
|
-
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
52201
|
+
const existing = fs25.existsSync(configPath) ? fs25.readFileSync(configPath, "utf8") : "";
|
|
52202
|
+
const withoutOld = removeCodexMcpTables(existing, options.mcpName).trimEnd();
|
|
50532
52203
|
const launch = options.launcher;
|
|
50533
52204
|
const envValues = createMcpEnvironmentValues(options.env, options.clientIde, options.launcherEnv);
|
|
50534
52205
|
const envSection = Object.keys(envValues).length === 0 ? [] : [
|
|
50535
52206
|
"",
|
|
50536
52207
|
`[mcp_servers."${options.mcpName}".env]`,
|
|
50537
|
-
...Object.entries(envValues).map(
|
|
52208
|
+
...Object.entries(envValues).map(
|
|
52209
|
+
([key, value]) => `${key} = "${escapeTomlString(value)}"`
|
|
52210
|
+
)
|
|
50538
52211
|
];
|
|
50539
52212
|
const section = [
|
|
50540
52213
|
`[mcp_servers."${options.mcpName}"]`,
|
|
50541
|
-
`command = "${
|
|
50542
|
-
`args = [${launch.args.map((arg) => `"${
|
|
52214
|
+
`command = "${escapeTomlString(launch.command)}"`,
|
|
52215
|
+
`args = [${launch.args.map((arg) => `"${escapeTomlString(arg)}"`).join(", ")}]`,
|
|
50543
52216
|
...envSection,
|
|
50544
52217
|
""
|
|
50545
52218
|
].join("\n");
|
|
@@ -50558,48 +52231,8 @@ function mergeCodexMcpConfig(configPath, options) {
|
|
|
50558
52231
|
}
|
|
50559
52232
|
);
|
|
50560
52233
|
}
|
|
50561
|
-
function createCodexMcpSectionPattern(mcpName) {
|
|
50562
|
-
const keyPattern = createCodexMcpKeyPattern(mcpName);
|
|
50563
|
-
return new RegExp(
|
|
50564
|
-
`\\n?\\[mcp_servers\\.${keyPattern}(?:\\.[^\\]]+)?\\][\\s\\S]*?(?=\\n\\[(?!mcp_servers\\.${keyPattern}(?:\\.|\\]))|$)`,
|
|
50565
|
-
"g"
|
|
50566
|
-
);
|
|
50567
|
-
}
|
|
50568
|
-
function createCodexMcpKeyPattern(mcpName) {
|
|
50569
|
-
const quotedKey = `"${escapeRegExp3(mcpName)}"`;
|
|
50570
|
-
if (!isTomlBareKey(mcpName)) {
|
|
50571
|
-
return quotedKey;
|
|
50572
|
-
}
|
|
50573
|
-
return `(?:${quotedKey}|${escapeRegExp3(mcpName)})`;
|
|
50574
|
-
}
|
|
50575
|
-
function findCodexMcpTableDuplicates(text, mcpName) {
|
|
50576
|
-
const seen = /* @__PURE__ */ new Set();
|
|
50577
|
-
const duplicates = /* @__PURE__ */ new Set();
|
|
50578
|
-
const headerPattern = /^\s*\[([^\]]+)\]\s*$/gm;
|
|
50579
|
-
let match;
|
|
50580
|
-
while ((match = headerPattern.exec(text)) !== null) {
|
|
50581
|
-
const normalized = normalizeCodexMcpTablePath(match[1], mcpName);
|
|
50582
|
-
if (!normalized) {
|
|
50583
|
-
continue;
|
|
50584
|
-
}
|
|
50585
|
-
if (seen.has(normalized)) {
|
|
50586
|
-
duplicates.add(normalized);
|
|
50587
|
-
continue;
|
|
50588
|
-
}
|
|
50589
|
-
seen.add(normalized);
|
|
50590
|
-
}
|
|
50591
|
-
return Array.from(duplicates);
|
|
50592
|
-
}
|
|
50593
|
-
function normalizeCodexMcpTablePath(tablePath, mcpName) {
|
|
50594
|
-
const keyPattern = createCodexMcpKeyPattern(mcpName);
|
|
50595
|
-
const match = new RegExp(`^mcp_servers\\.${keyPattern}(\\..+)?$`).exec(tablePath);
|
|
50596
|
-
if (!match) {
|
|
50597
|
-
return void 0;
|
|
50598
|
-
}
|
|
50599
|
-
return `mcp_servers.${mcpName}${match[1] || ""}`;
|
|
50600
|
-
}
|
|
50601
52234
|
function tryClaudeMcpAdd(options) {
|
|
50602
|
-
const configPath =
|
|
52235
|
+
const configPath = path26.join(os8.homedir(), ".claude.json");
|
|
50603
52236
|
try {
|
|
50604
52237
|
const existing = readJsonObject(configPath);
|
|
50605
52238
|
const server = asObject(asObject(existing.mcpServers)[options.mcpName]);
|
|
@@ -50692,10 +52325,10 @@ function rejectPackageOption(parsed) {
|
|
|
50692
52325
|
}
|
|
50693
52326
|
}
|
|
50694
52327
|
function readJsonObject(filePath, options = {}) {
|
|
50695
|
-
if (!
|
|
52328
|
+
if (!fs25.existsSync(filePath)) {
|
|
50696
52329
|
return {};
|
|
50697
52330
|
}
|
|
50698
|
-
const raw =
|
|
52331
|
+
const raw = fs25.readFileSync(filePath, "utf8");
|
|
50699
52332
|
try {
|
|
50700
52333
|
const normalized = normalizeJsonConfigContent(raw, options);
|
|
50701
52334
|
const parsed = JSON.parse(normalized);
|
|
@@ -50714,30 +52347,6 @@ function asObject(value) {
|
|
|
50714
52347
|
}
|
|
50715
52348
|
return {};
|
|
50716
52349
|
}
|
|
50717
|
-
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
50718
|
-
const existed = fs21.existsSync(filePath);
|
|
50719
|
-
const previousContent = existed ? fs21.readFileSync(filePath, "utf8") : void 0;
|
|
50720
|
-
if (previousContent === nextContent) {
|
|
50721
|
-
return { changed: false };
|
|
50722
|
-
}
|
|
50723
|
-
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
50724
|
-
fs21.mkdirSync(path22.dirname(filePath), { recursive: true });
|
|
50725
|
-
if (previousContent !== void 0 && backupPath) {
|
|
50726
|
-
fs21.writeFileSync(backupPath, previousContent, "utf8");
|
|
50727
|
-
}
|
|
50728
|
-
try {
|
|
50729
|
-
fs21.writeFileSync(filePath, nextContent, "utf8");
|
|
50730
|
-
validate == null ? void 0 : validate(fs21.readFileSync(filePath, "utf8"));
|
|
50731
|
-
return { changed: true, backupPath };
|
|
50732
|
-
} catch (error2) {
|
|
50733
|
-
if (previousContent !== void 0) {
|
|
50734
|
-
fs21.writeFileSync(filePath, previousContent, "utf8");
|
|
50735
|
-
} else {
|
|
50736
|
-
fs21.rmSync(filePath, { force: true });
|
|
50737
|
-
}
|
|
50738
|
-
throw error2;
|
|
50739
|
-
}
|
|
50740
|
-
}
|
|
50741
52350
|
function validateJsonMcpServersConfig(content, options) {
|
|
50742
52351
|
const parsed = parseGeneratedJsonObject(content);
|
|
50743
52352
|
const server = asObject(asObject(parsed.mcpServers)[options.mcpName]);
|
|
@@ -50891,10 +52500,10 @@ function formatMcpInstallMessage(label, configPath, write) {
|
|
|
50891
52500
|
].filter(Boolean).join("\n");
|
|
50892
52501
|
}
|
|
50893
52502
|
function saveInitState(targetDir, state) {
|
|
50894
|
-
|
|
50895
|
-
const key =
|
|
50896
|
-
|
|
50897
|
-
|
|
52503
|
+
fs25.mkdirSync(getMakerHome(), { recursive: true });
|
|
52504
|
+
const key = crypto5.createHash("sha256").update(path26.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
52505
|
+
fs25.writeFileSync(
|
|
52506
|
+
path26.join(getMakerHome(), `init-state-${key}.json`),
|
|
50898
52507
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
50899
52508
|
`,
|
|
50900
52509
|
"utf8"
|
|
@@ -51042,7 +52651,7 @@ function makerEnvOption(parsed) {
|
|
|
51042
52651
|
return env;
|
|
51043
52652
|
}
|
|
51044
52653
|
const targetDir = stringOption(parsed, "target_dir");
|
|
51045
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
52654
|
+
return getMakerEnvironment(void 0, targetDir ? path26.resolve(targetDir) : process.cwd());
|
|
51046
52655
|
}
|
|
51047
52656
|
function makerMcpConfigEnvOption(parsed) {
|
|
51048
52657
|
return stringOption(parsed, "env") === "rnd" ? "rnd" : "production";
|
|
@@ -51073,15 +52682,6 @@ function mask(value) {
|
|
|
51073
52682
|
}
|
|
51074
52683
|
return `${value.slice(0, 6)}...${value.slice(-4)}`;
|
|
51075
52684
|
}
|
|
51076
|
-
function escapeRegExp3(value) {
|
|
51077
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
51078
|
-
}
|
|
51079
|
-
function escapeToml(value) {
|
|
51080
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
51081
|
-
}
|
|
51082
|
-
function isTomlBareKey(value) {
|
|
51083
|
-
return /^[A-Za-z0-9_-]+$/.test(value);
|
|
51084
|
-
}
|
|
51085
52685
|
function indent3(value) {
|
|
51086
52686
|
return value.split("\n").map((line) => ` ${line}`).join("\n");
|
|
51087
52687
|
}
|
|
@@ -51123,6 +52723,9 @@ function printHelp() {
|
|
|
51123
52723
|
" [--context-stdin] [--consent] [--json]",
|
|
51124
52724
|
" # Run only after the user agrees to submit",
|
|
51125
52725
|
" taptap-maker agents update [--target-dir DIR] [--json]",
|
|
52726
|
+
" taptap-maker plugin inspect --client codex|workbuddy|dsh [--json]",
|
|
52727
|
+
" taptap-maker plugin migrate --client codex|workbuddy|dsh --confirm [--json]",
|
|
52728
|
+
" taptap-maker plugin restore --client codex|workbuddy|dsh --confirm [--json]",
|
|
51126
52729
|
" taptap-maker upgrade [--launcher self|npx] [--target-dir DIR] [--json]",
|
|
51127
52730
|
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
51128
52731
|
" taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
|
|
@@ -51192,13 +52795,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
51192
52795
|
}
|
|
51193
52796
|
|
|
51194
52797
|
// node_modules/pkce-challenge/dist/index.node.js
|
|
51195
|
-
var
|
|
52798
|
+
var crypto6;
|
|
51196
52799
|
var _a2;
|
|
51197
|
-
|
|
52800
|
+
crypto6 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
|
|
51198
52801
|
globalThis.crypto ?? // Node.js >18
|
|
51199
52802
|
import("node:crypto").then((m) => m.webcrypto);
|
|
51200
52803
|
async function getRandomValues(size) {
|
|
51201
|
-
return (await
|
|
52804
|
+
return (await crypto6).getRandomValues(new Uint8Array(size));
|
|
51202
52805
|
}
|
|
51203
52806
|
async function random(size) {
|
|
51204
52807
|
const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
@@ -51214,7 +52817,7 @@ async function generateVerifier(length) {
|
|
|
51214
52817
|
return await random(length);
|
|
51215
52818
|
}
|
|
51216
52819
|
async function generateChallenge(code_verifier) {
|
|
51217
|
-
const buffer = await (await
|
|
52820
|
+
const buffer = await (await crypto6).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
51218
52821
|
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
51219
52822
|
}
|
|
51220
52823
|
async function pkceChallenge(length) {
|
|
@@ -52569,8 +54172,8 @@ var StreamableHTTPClientTransport = class {
|
|
|
52569
54172
|
};
|
|
52570
54173
|
|
|
52571
54174
|
// src/mcp-proxy/proxy.ts
|
|
52572
|
-
import * as
|
|
52573
|
-
import * as
|
|
54175
|
+
import * as path28 from "node:path";
|
|
54176
|
+
import * as crypto8 from "node:crypto";
|
|
52574
54177
|
|
|
52575
54178
|
// src/mcp-proxy/cookieJar.ts
|
|
52576
54179
|
var CookieJar = class {
|
|
@@ -52735,10 +54338,13 @@ var CookieJar = class {
|
|
|
52735
54338
|
return this.cookies.size > 0;
|
|
52736
54339
|
}
|
|
52737
54340
|
};
|
|
52738
|
-
function createCookieFetch(cookieJar) {
|
|
54341
|
+
function createCookieFetch(cookieJar, options = {}) {
|
|
52739
54342
|
return async (input2, init) => {
|
|
54343
|
+
if (options.rejectStandaloneSse && isStandaloneSseRequest(input2, init)) {
|
|
54344
|
+
return new Response(null, { status: 405, statusText: "Method Not Allowed" });
|
|
54345
|
+
}
|
|
52740
54346
|
const modifiedInit = { ...init };
|
|
52741
|
-
const cookieHeader = cookieJar.getCookieHeader();
|
|
54347
|
+
const cookieHeader = options.enableCookies === false ? void 0 : cookieJar.getCookieHeader();
|
|
52742
54348
|
if (cookieHeader) {
|
|
52743
54349
|
const headers = new Headers(modifiedInit.headers);
|
|
52744
54350
|
headers.set("Cookie", cookieHeader);
|
|
@@ -52749,11 +54355,22 @@ function createCookieFetch(cookieJar) {
|
|
|
52749
54355
|
return response;
|
|
52750
54356
|
};
|
|
52751
54357
|
}
|
|
54358
|
+
function isStandaloneSseRequest(input2, init) {
|
|
54359
|
+
var _a3;
|
|
54360
|
+
const method = ((init == null ? void 0 : init.method) || (input2 instanceof Request ? input2.method : "GET")).toUpperCase();
|
|
54361
|
+
if (method !== "GET") {
|
|
54362
|
+
return false;
|
|
54363
|
+
}
|
|
54364
|
+
const headers = new Headers(
|
|
54365
|
+
(init == null ? void 0 : init.headers) || (input2 instanceof Request ? input2.headers : void 0)
|
|
54366
|
+
);
|
|
54367
|
+
return ((_a3 = headers.get("accept")) == null ? void 0 : _a3.split(",").some((value) => value.trim().split(";", 1)[0].toLowerCase() === "text/event-stream")) === true;
|
|
54368
|
+
}
|
|
52752
54369
|
|
|
52753
54370
|
// src/core/utils/logWriter.ts
|
|
52754
|
-
import * as
|
|
52755
|
-
import * as
|
|
52756
|
-
import * as
|
|
54371
|
+
import * as fs26 from "node:fs";
|
|
54372
|
+
import * as path27 from "node:path";
|
|
54373
|
+
import * as crypto7 from "node:crypto";
|
|
52757
54374
|
|
|
52758
54375
|
// src/core/types/log.ts
|
|
52759
54376
|
var LOG_LEVEL_PRIORITY = {
|
|
@@ -52793,7 +54410,7 @@ var LogWriter = class {
|
|
|
52793
54410
|
return;
|
|
52794
54411
|
}
|
|
52795
54412
|
try {
|
|
52796
|
-
await
|
|
54413
|
+
await fs26.promises.mkdir(this.config.logDir, { recursive: true });
|
|
52797
54414
|
await this.cleanupOldLogs();
|
|
52798
54415
|
this.initialized = true;
|
|
52799
54416
|
} catch (error2) {
|
|
@@ -52816,7 +54433,7 @@ var LogWriter = class {
|
|
|
52816
54433
|
*/
|
|
52817
54434
|
getLogFilePath(date5) {
|
|
52818
54435
|
const d = date5 || this.getCurrentDate();
|
|
52819
|
-
return
|
|
54436
|
+
return path27.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
52820
54437
|
}
|
|
52821
54438
|
/**
|
|
52822
54439
|
* 获取或创建写入流
|
|
@@ -52831,7 +54448,7 @@ var LogWriter = class {
|
|
|
52831
54448
|
}
|
|
52832
54449
|
this.currentDate = date5;
|
|
52833
54450
|
try {
|
|
52834
|
-
this.writeStream =
|
|
54451
|
+
this.writeStream = fs26.createWriteStream(this.getLogFilePath(date5), {
|
|
52835
54452
|
flags: "a",
|
|
52836
54453
|
encoding: "utf8"
|
|
52837
54454
|
});
|
|
@@ -52883,11 +54500,11 @@ var LogWriter = class {
|
|
|
52883
54500
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
52884
54501
|
try {
|
|
52885
54502
|
const filePath = this.getLogFilePath();
|
|
52886
|
-
const dir =
|
|
52887
|
-
if (!
|
|
52888
|
-
|
|
54503
|
+
const dir = path27.dirname(filePath);
|
|
54504
|
+
if (!fs26.existsSync(dir)) {
|
|
54505
|
+
fs26.mkdirSync(dir, { recursive: true });
|
|
52889
54506
|
}
|
|
52890
|
-
|
|
54507
|
+
fs26.appendFileSync(filePath, message, "utf8");
|
|
52891
54508
|
} catch {
|
|
52892
54509
|
}
|
|
52893
54510
|
}
|
|
@@ -52898,7 +54515,7 @@ var LogWriter = class {
|
|
|
52898
54515
|
async cleanupOldLogs() {
|
|
52899
54516
|
if (this.config.maxDays <= 0) return;
|
|
52900
54517
|
try {
|
|
52901
|
-
const files = await
|
|
54518
|
+
const files = await fs26.promises.readdir(this.config.logDir);
|
|
52902
54519
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
52903
54520
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
52904
54521
|
const prefix = this.config.prefix;
|
|
@@ -52913,7 +54530,7 @@ var LogWriter = class {
|
|
|
52913
54530
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
52914
54531
|
const fileDate = new Date(year, month - 1, day);
|
|
52915
54532
|
if (fileDate < cutoffDate) {
|
|
52916
|
-
await
|
|
54533
|
+
await fs26.promises.unlink(path27.join(this.config.logDir, file2));
|
|
52917
54534
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
52918
54535
|
`);
|
|
52919
54536
|
}
|
|
@@ -52952,12 +54569,23 @@ var VERSION3 = typeof __PROXY_VERSION__ !== "undefined" ? __PROXY_VERSION__ : "d
|
|
|
52952
54569
|
var LOCAL_PROXY_TAG = "local";
|
|
52953
54570
|
var DEFAULT_RECONNECT_INTERVAL_MS = 5e3;
|
|
52954
54571
|
var MAX_RECONNECT_INTERVAL_MS = 60 * 1e3;
|
|
54572
|
+
function createNonReplayableToolResult(name, executionState) {
|
|
54573
|
+
const text = executionState === "not_executed" ? `${name} was not sent because the upstream MCP connection is unavailable. It was not executed. Automatic retry is disabled; retry explicitly after the connection recovers.` : `${name} may have completed before the upstream MCP response was interrupted. Its execution state is unknown. Automatic retry is disabled; verify remote output, state, and usage before deciding whether to retry explicitly.`;
|
|
54574
|
+
return {
|
|
54575
|
+
isError: true,
|
|
54576
|
+
content: [{ type: "text", text }],
|
|
54577
|
+
structuredContent: {
|
|
54578
|
+
execution_state: executionState,
|
|
54579
|
+
automatic_retry: false
|
|
54580
|
+
}
|
|
54581
|
+
};
|
|
54582
|
+
}
|
|
52955
54583
|
function convertMcpApplicationErrorToToolResult(error2) {
|
|
52956
54584
|
if (!(error2 instanceof Error)) {
|
|
52957
54585
|
return void 0;
|
|
52958
54586
|
}
|
|
52959
54587
|
const data = error2.data;
|
|
52960
|
-
if (!
|
|
54588
|
+
if (!isRecord7(data) || !("remote_result" in data) || data.remote_result === void 0) {
|
|
52961
54589
|
return void 0;
|
|
52962
54590
|
}
|
|
52963
54591
|
return {
|
|
@@ -52974,7 +54602,7 @@ function convertMcpApplicationErrorToToolResult(error2) {
|
|
|
52974
54602
|
]
|
|
52975
54603
|
};
|
|
52976
54604
|
}
|
|
52977
|
-
function
|
|
54605
|
+
function isRecord7(value) {
|
|
52978
54606
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
52979
54607
|
}
|
|
52980
54608
|
function formatProxyDiagnosticValue(value) {
|
|
@@ -53034,10 +54662,10 @@ var TapTapMCPProxy = class {
|
|
|
53034
54662
|
const { user_id, project_id } = this.config.tenant;
|
|
53035
54663
|
let logDir;
|
|
53036
54664
|
if (user_id && project_id) {
|
|
53037
|
-
logDir =
|
|
54665
|
+
logDir = path28.join(logRoot, "proxy", user_id, project_id);
|
|
53038
54666
|
} else {
|
|
53039
|
-
const kidHash =
|
|
53040
|
-
logDir =
|
|
54667
|
+
const kidHash = crypto8.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
54668
|
+
logDir = path28.join(logRoot, "proxy", kidHash);
|
|
53041
54669
|
}
|
|
53042
54670
|
return new LogWriter({
|
|
53043
54671
|
logDir,
|
|
@@ -53194,18 +54822,30 @@ var TapTapMCPProxy = class {
|
|
|
53194
54822
|
throw new McpError(ErrorCode.MethodNotFound, `Tool is not exposed by this proxy: ${name}`);
|
|
53195
54823
|
}
|
|
53196
54824
|
}
|
|
54825
|
+
isToolReplayable(name) {
|
|
54826
|
+
var _a3;
|
|
54827
|
+
const replayableTools = (_a3 = this.config.options) == null ? void 0 : _a3.replayable_tools;
|
|
54828
|
+
return replayableTools === void 0 || replayableTools.includes(name);
|
|
54829
|
+
}
|
|
53197
54830
|
/**
|
|
53198
54831
|
* 连接到 TapTap MCP Server
|
|
53199
54832
|
*/
|
|
53200
54833
|
async connectToServer() {
|
|
53201
|
-
var _a3, _b, _c;
|
|
54834
|
+
var _a3, _b, _c, _d, _e;
|
|
53202
54835
|
this.log("info", `Connecting to ${this.config.server.url}...`);
|
|
53203
54836
|
try {
|
|
53204
54837
|
const cookieEnabled = ((_a3 = this.config.options) == null ? void 0 : _a3.enable_cookie_sticky) ?? true;
|
|
53205
|
-
const
|
|
53206
|
-
|
|
54838
|
+
const standaloneSseDisabled = ((_b = this.config.options) == null ? void 0 : _b.disable_standalone_sse) ?? false;
|
|
54839
|
+
const customFetch = cookieEnabled || standaloneSseDisabled ? createCookieFetch(this.cookieJar, {
|
|
54840
|
+
enableCookies: cookieEnabled,
|
|
54841
|
+
rejectStandaloneSse: standaloneSseDisabled
|
|
54842
|
+
}) : void 0;
|
|
54843
|
+
if (cookieEnabled && ((_c = this.config.options) == null ? void 0 : _c.verbose)) {
|
|
53207
54844
|
this.log("debug", "Cookie sticky session enabled");
|
|
53208
54845
|
}
|
|
54846
|
+
if (standaloneSseDisabled && ((_d = this.config.options) == null ? void 0 : _d.verbose)) {
|
|
54847
|
+
this.log("debug", "Standalone SSE disabled; using POST response streams");
|
|
54848
|
+
}
|
|
53209
54849
|
const sessionHeaders = this.buildSessionHeaders();
|
|
53210
54850
|
const transport = new StreamableHTTPClientTransport(new URL(this.config.server.url), {
|
|
53211
54851
|
fetch: customFetch,
|
|
@@ -53219,7 +54859,7 @@ var TapTapMCPProxy = class {
|
|
|
53219
54859
|
this.connected = true;
|
|
53220
54860
|
this.sessionValidated = true;
|
|
53221
54861
|
this.lastValidationTime = Date.now();
|
|
53222
|
-
this.reconnectDelayMs = ((
|
|
54862
|
+
this.reconnectDelayMs = ((_e = this.config.options) == null ? void 0 : _e.reconnect_interval) ?? DEFAULT_RECONNECT_INTERVAL_MS;
|
|
53223
54863
|
this.log("info", "✅ Connected and session validated");
|
|
53224
54864
|
this.startHealthCheck();
|
|
53225
54865
|
if (this.reconnecting) {
|
|
@@ -53499,6 +55139,10 @@ var TapTapMCPProxy = class {
|
|
|
53499
55139
|
this.log("info", `Processing ${this.pendingRequests.length} pending requests...`);
|
|
53500
55140
|
while (this.pendingRequests.length > 0) {
|
|
53501
55141
|
const req = this.pendingRequests.shift();
|
|
55142
|
+
if (!this.isToolReplayable(req.name)) {
|
|
55143
|
+
req.resolve(createNonReplayableToolResult(req.name, req.executionState ?? "unknown"));
|
|
55144
|
+
continue;
|
|
55145
|
+
}
|
|
53502
55146
|
if (now - req.timestamp > timeout) {
|
|
53503
55147
|
req.reject(new Error("Request timeout while waiting for reconnection"));
|
|
53504
55148
|
continue;
|
|
@@ -53632,6 +55276,9 @@ var TapTapMCPProxy = class {
|
|
|
53632
55276
|
}
|
|
53633
55277
|
}
|
|
53634
55278
|
if (!this.connected) {
|
|
55279
|
+
if (!this.isToolReplayable(name)) {
|
|
55280
|
+
return createNonReplayableToolResult(name, "not_executed");
|
|
55281
|
+
}
|
|
53635
55282
|
if (this.reconnecting) {
|
|
53636
55283
|
this.log("info", `⏳ Queueing request: ${name} (reconnecting...)`);
|
|
53637
55284
|
return new Promise((resolve, reject) => {
|
|
@@ -53641,6 +55288,7 @@ var TapTapMCPProxy = class {
|
|
|
53641
55288
|
resolve,
|
|
53642
55289
|
reject,
|
|
53643
55290
|
timestamp: Date.now(),
|
|
55291
|
+
executionState: "not_executed",
|
|
53644
55292
|
onprogress: callToolOptions.onprogress
|
|
53645
55293
|
});
|
|
53646
55294
|
});
|
|
@@ -53672,6 +55320,9 @@ var TapTapMCPProxy = class {
|
|
|
53672
55320
|
if (!this.reconnecting) {
|
|
53673
55321
|
this.log("info", "Triggering immediate reconnection...");
|
|
53674
55322
|
this.reconnectToServer();
|
|
55323
|
+
if (!this.isToolReplayable(name)) {
|
|
55324
|
+
return createNonReplayableToolResult(name, "unknown");
|
|
55325
|
+
}
|
|
53675
55326
|
this.log("info", `⏳ Queueing current request: ${name}`);
|
|
53676
55327
|
return new Promise((resolve, reject) => {
|
|
53677
55328
|
this.pendingRequests.push({
|
|
@@ -53680,10 +55331,14 @@ var TapTapMCPProxy = class {
|
|
|
53680
55331
|
resolve,
|
|
53681
55332
|
reject,
|
|
53682
55333
|
timestamp: Date.now(),
|
|
55334
|
+
executionState: "unknown",
|
|
53683
55335
|
onprogress: callToolOptions.onprogress
|
|
53684
55336
|
});
|
|
53685
55337
|
});
|
|
53686
55338
|
}
|
|
55339
|
+
if (!this.isToolReplayable(name)) {
|
|
55340
|
+
return createNonReplayableToolResult(name, "unknown");
|
|
55341
|
+
}
|
|
53687
55342
|
}
|
|
53688
55343
|
throw error2;
|
|
53689
55344
|
}
|
|
@@ -53759,6 +55414,9 @@ function printHelp2() {
|
|
|
53759
55414
|
" [--context-stdin] [--consent] [--json]",
|
|
53760
55415
|
" # Run only after the user agrees to submit",
|
|
53761
55416
|
" taptap-maker agents update [--target-dir DIR] [--json]",
|
|
55417
|
+
" taptap-maker plugin inspect --client codex|workbuddy [--json]",
|
|
55418
|
+
" taptap-maker plugin migrate --client codex|workbuddy --confirm [--json]",
|
|
55419
|
+
" taptap-maker plugin restore --client codex|workbuddy --confirm [--json]",
|
|
53762
55420
|
" taptap-maker upgrade [--launcher self|npx] [--target-dir DIR] [--json]",
|
|
53763
55421
|
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
53764
55422
|
" taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
|