@taptap/maker 0.0.34-beta.4 → 0.0.34-beta.6
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 +937 -754
- package/docs/MAKER_CONSOLE.md +9 -4
- package/docs/MAKER_LOCAL_PREVIEW.md +28 -0
- package/docs/MAKER_MCP_CONNECTION_TROUBLESHOOTING.md +5 -5
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +20 -1
package/dist/maker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// TapTap Maker MCP - Standalone Bundle
|
|
3
|
-
// TapTap Maker MCP version: 0.0.34-beta.
|
|
3
|
+
// TapTap Maker MCP version: 0.0.34-beta.6
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
6
|
const __MAKER_BUNDLE_URL__ = import.meta.url;
|
|
@@ -449,8 +449,8 @@ var init_parseUtil = __esm({
|
|
|
449
449
|
init_errors();
|
|
450
450
|
init_en();
|
|
451
451
|
makeIssue = (params) => {
|
|
452
|
-
const { data, path:
|
|
453
|
-
const fullPath = [...
|
|
452
|
+
const { data, path: path56, errorMaps, issueData } = params;
|
|
453
|
+
const fullPath = [...path56, ...issueData.path || []];
|
|
454
454
|
const fullIssue = {
|
|
455
455
|
...issueData,
|
|
456
456
|
path: fullPath
|
|
@@ -730,11 +730,11 @@ var init_types = __esm({
|
|
|
730
730
|
init_parseUtil();
|
|
731
731
|
init_util();
|
|
732
732
|
ParseInputLazyPath = class {
|
|
733
|
-
constructor(parent, value,
|
|
733
|
+
constructor(parent, value, path56, key) {
|
|
734
734
|
this._cachedPath = [];
|
|
735
735
|
this.parent = parent;
|
|
736
736
|
this.data = value;
|
|
737
|
-
this._path =
|
|
737
|
+
this._path = path56;
|
|
738
738
|
this._key = key;
|
|
739
739
|
}
|
|
740
740
|
get path() {
|
|
@@ -4243,10 +4243,10 @@ function mergeDefs(...defs) {
|
|
|
4243
4243
|
function cloneDef(schema) {
|
|
4244
4244
|
return mergeDefs(schema._zod.def);
|
|
4245
4245
|
}
|
|
4246
|
-
function getElementAtPath(obj,
|
|
4247
|
-
if (!
|
|
4246
|
+
function getElementAtPath(obj, path56) {
|
|
4247
|
+
if (!path56)
|
|
4248
4248
|
return obj;
|
|
4249
|
-
return
|
|
4249
|
+
return path56.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
4250
4250
|
}
|
|
4251
4251
|
function promiseAllObject(promisesObj) {
|
|
4252
4252
|
const keys = Object.keys(promisesObj);
|
|
@@ -4559,11 +4559,11 @@ function aborted(x, startIndex = 0) {
|
|
|
4559
4559
|
}
|
|
4560
4560
|
return false;
|
|
4561
4561
|
}
|
|
4562
|
-
function prefixIssues(
|
|
4562
|
+
function prefixIssues(path56, issues) {
|
|
4563
4563
|
return issues.map((iss) => {
|
|
4564
4564
|
var _a3;
|
|
4565
4565
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
4566
|
-
iss.path.unshift(
|
|
4566
|
+
iss.path.unshift(path56);
|
|
4567
4567
|
return iss;
|
|
4568
4568
|
});
|
|
4569
4569
|
}
|
|
@@ -17726,8 +17726,8 @@ var require_utils = __commonJS({
|
|
|
17726
17726
|
}
|
|
17727
17727
|
return ind;
|
|
17728
17728
|
}
|
|
17729
|
-
function removeDotSegments(
|
|
17730
|
-
let input2 =
|
|
17729
|
+
function removeDotSegments(path56) {
|
|
17730
|
+
let input2 = path56;
|
|
17731
17731
|
const output2 = [];
|
|
17732
17732
|
let nextSlash = -1;
|
|
17733
17733
|
let len = 0;
|
|
@@ -17926,8 +17926,8 @@ var require_schemes = __commonJS({
|
|
|
17926
17926
|
wsComponent.secure = void 0;
|
|
17927
17927
|
}
|
|
17928
17928
|
if (wsComponent.resourceName) {
|
|
17929
|
-
const [
|
|
17930
|
-
wsComponent.path =
|
|
17929
|
+
const [path56, query] = wsComponent.resourceName.split("?");
|
|
17930
|
+
wsComponent.path = path56 && path56 !== "/" ? path56 : void 0;
|
|
17931
17931
|
wsComponent.query = query;
|
|
17932
17932
|
wsComponent.resourceName = void 0;
|
|
17933
17933
|
}
|
|
@@ -26984,12 +26984,12 @@ var require_dist = __commonJS({
|
|
|
26984
26984
|
throw new Error(`Unknown format "${name}"`);
|
|
26985
26985
|
return f;
|
|
26986
26986
|
};
|
|
26987
|
-
function addFormats(ajv, list,
|
|
26987
|
+
function addFormats(ajv, list, fs53, exportName) {
|
|
26988
26988
|
var _a3;
|
|
26989
26989
|
var _b;
|
|
26990
26990
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
26991
26991
|
for (const f of list)
|
|
26992
|
-
ajv.addFormat(f,
|
|
26992
|
+
ajv.addFormat(f, fs53[f]);
|
|
26993
26993
|
}
|
|
26994
26994
|
module.exports = exports = formatsPlugin;
|
|
26995
26995
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -28546,8 +28546,8 @@ var require_windows = __commonJS({
|
|
|
28546
28546
|
"node_modules/isexe/windows.js"(exports, module) {
|
|
28547
28547
|
module.exports = isexe;
|
|
28548
28548
|
isexe.sync = sync;
|
|
28549
|
-
var
|
|
28550
|
-
function checkPathExt(
|
|
28549
|
+
var fs53 = __require("fs");
|
|
28550
|
+
function checkPathExt(path56, options3) {
|
|
28551
28551
|
var pathext = options3.pathExt !== void 0 ? options3.pathExt : process.env.PATHEXT;
|
|
28552
28552
|
if (!pathext) {
|
|
28553
28553
|
return true;
|
|
@@ -28558,25 +28558,25 @@ var require_windows = __commonJS({
|
|
|
28558
28558
|
}
|
|
28559
28559
|
for (var i = 0; i < pathext.length; i++) {
|
|
28560
28560
|
var p = pathext[i].toLowerCase();
|
|
28561
|
-
if (p &&
|
|
28561
|
+
if (p && path56.substr(-p.length).toLowerCase() === p) {
|
|
28562
28562
|
return true;
|
|
28563
28563
|
}
|
|
28564
28564
|
}
|
|
28565
28565
|
return false;
|
|
28566
28566
|
}
|
|
28567
|
-
function checkStat(stat,
|
|
28567
|
+
function checkStat(stat, path56, options3) {
|
|
28568
28568
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
28569
28569
|
return false;
|
|
28570
28570
|
}
|
|
28571
|
-
return checkPathExt(
|
|
28571
|
+
return checkPathExt(path56, options3);
|
|
28572
28572
|
}
|
|
28573
|
-
function isexe(
|
|
28574
|
-
|
|
28575
|
-
cb(er, er ? false : checkStat(stat,
|
|
28573
|
+
function isexe(path56, options3, cb) {
|
|
28574
|
+
fs53.stat(path56, function(er, stat) {
|
|
28575
|
+
cb(er, er ? false : checkStat(stat, path56, options3));
|
|
28576
28576
|
});
|
|
28577
28577
|
}
|
|
28578
|
-
function sync(
|
|
28579
|
-
return checkStat(
|
|
28578
|
+
function sync(path56, options3) {
|
|
28579
|
+
return checkStat(fs53.statSync(path56), path56, options3);
|
|
28580
28580
|
}
|
|
28581
28581
|
}
|
|
28582
28582
|
});
|
|
@@ -28586,14 +28586,14 @@ var require_mode = __commonJS({
|
|
|
28586
28586
|
"node_modules/isexe/mode.js"(exports, module) {
|
|
28587
28587
|
module.exports = isexe;
|
|
28588
28588
|
isexe.sync = sync;
|
|
28589
|
-
var
|
|
28590
|
-
function isexe(
|
|
28591
|
-
|
|
28589
|
+
var fs53 = __require("fs");
|
|
28590
|
+
function isexe(path56, options3, cb) {
|
|
28591
|
+
fs53.stat(path56, function(er, stat) {
|
|
28592
28592
|
cb(er, er ? false : checkStat(stat, options3));
|
|
28593
28593
|
});
|
|
28594
28594
|
}
|
|
28595
|
-
function sync(
|
|
28596
|
-
return checkStat(
|
|
28595
|
+
function sync(path56, options3) {
|
|
28596
|
+
return checkStat(fs53.statSync(path56), options3);
|
|
28597
28597
|
}
|
|
28598
28598
|
function checkStat(stat, options3) {
|
|
28599
28599
|
return stat.isFile() && checkMode(stat, options3);
|
|
@@ -28617,7 +28617,7 @@ var require_mode = __commonJS({
|
|
|
28617
28617
|
// node_modules/isexe/index.js
|
|
28618
28618
|
var require_isexe = __commonJS({
|
|
28619
28619
|
"node_modules/isexe/index.js"(exports, module) {
|
|
28620
|
-
var
|
|
28620
|
+
var fs53 = __require("fs");
|
|
28621
28621
|
var core;
|
|
28622
28622
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
28623
28623
|
core = require_windows();
|
|
@@ -28626,7 +28626,7 @@ var require_isexe = __commonJS({
|
|
|
28626
28626
|
}
|
|
28627
28627
|
module.exports = isexe;
|
|
28628
28628
|
isexe.sync = sync;
|
|
28629
|
-
function isexe(
|
|
28629
|
+
function isexe(path56, options3, cb) {
|
|
28630
28630
|
if (typeof options3 === "function") {
|
|
28631
28631
|
cb = options3;
|
|
28632
28632
|
options3 = {};
|
|
@@ -28636,7 +28636,7 @@ var require_isexe = __commonJS({
|
|
|
28636
28636
|
throw new TypeError("callback not provided");
|
|
28637
28637
|
}
|
|
28638
28638
|
return new Promise(function(resolve, reject) {
|
|
28639
|
-
isexe(
|
|
28639
|
+
isexe(path56, options3 || {}, function(er, is) {
|
|
28640
28640
|
if (er) {
|
|
28641
28641
|
reject(er);
|
|
28642
28642
|
} else {
|
|
@@ -28645,7 +28645,7 @@ var require_isexe = __commonJS({
|
|
|
28645
28645
|
});
|
|
28646
28646
|
});
|
|
28647
28647
|
}
|
|
28648
|
-
core(
|
|
28648
|
+
core(path56, options3 || {}, function(er, is) {
|
|
28649
28649
|
if (er) {
|
|
28650
28650
|
if (er.code === "EACCES" || options3 && options3.ignoreErrors) {
|
|
28651
28651
|
er = null;
|
|
@@ -28655,9 +28655,9 @@ var require_isexe = __commonJS({
|
|
|
28655
28655
|
cb(er, is);
|
|
28656
28656
|
});
|
|
28657
28657
|
}
|
|
28658
|
-
function sync(
|
|
28658
|
+
function sync(path56, options3) {
|
|
28659
28659
|
try {
|
|
28660
|
-
return core.sync(
|
|
28660
|
+
return core.sync(path56, options3 || {});
|
|
28661
28661
|
} catch (er) {
|
|
28662
28662
|
if (options3 && options3.ignoreErrors || er.code === "EACCES") {
|
|
28663
28663
|
return false;
|
|
@@ -28673,7 +28673,7 @@ var require_isexe = __commonJS({
|
|
|
28673
28673
|
var require_which = __commonJS({
|
|
28674
28674
|
"node_modules/which/which.js"(exports, module) {
|
|
28675
28675
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
28676
|
-
var
|
|
28676
|
+
var path56 = __require("path");
|
|
28677
28677
|
var COLON = isWindows ? ";" : ":";
|
|
28678
28678
|
var isexe = require_isexe();
|
|
28679
28679
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -28711,7 +28711,7 @@ var require_which = __commonJS({
|
|
|
28711
28711
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
28712
28712
|
const ppRaw = pathEnv[i];
|
|
28713
28713
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
28714
|
-
const pCmd =
|
|
28714
|
+
const pCmd = path56.join(pathPart, cmd);
|
|
28715
28715
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
28716
28716
|
resolve(subStep(p, i, 0));
|
|
28717
28717
|
});
|
|
@@ -28738,7 +28738,7 @@ var require_which = __commonJS({
|
|
|
28738
28738
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
28739
28739
|
const ppRaw = pathEnv[i];
|
|
28740
28740
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
28741
|
-
const pCmd =
|
|
28741
|
+
const pCmd = path56.join(pathPart, cmd);
|
|
28742
28742
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
28743
28743
|
for (let j = 0; j < pathExt.length; j++) {
|
|
28744
28744
|
const cur = p + pathExt[j];
|
|
@@ -28786,7 +28786,7 @@ var require_path_key = __commonJS({
|
|
|
28786
28786
|
var require_resolveCommand = __commonJS({
|
|
28787
28787
|
"node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
28788
28788
|
"use strict";
|
|
28789
|
-
var
|
|
28789
|
+
var path56 = __require("path");
|
|
28790
28790
|
var which = require_which();
|
|
28791
28791
|
var getPathKey = require_path_key();
|
|
28792
28792
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -28804,7 +28804,7 @@ var require_resolveCommand = __commonJS({
|
|
|
28804
28804
|
try {
|
|
28805
28805
|
resolved = which.sync(parsed.command, {
|
|
28806
28806
|
path: env[getPathKey({ env })],
|
|
28807
|
-
pathExt: withoutPathExt ?
|
|
28807
|
+
pathExt: withoutPathExt ? path56.delimiter : void 0
|
|
28808
28808
|
});
|
|
28809
28809
|
} catch (e) {
|
|
28810
28810
|
} finally {
|
|
@@ -28813,7 +28813,7 @@ var require_resolveCommand = __commonJS({
|
|
|
28813
28813
|
}
|
|
28814
28814
|
}
|
|
28815
28815
|
if (resolved) {
|
|
28816
|
-
resolved =
|
|
28816
|
+
resolved = path56.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
28817
28817
|
}
|
|
28818
28818
|
return resolved;
|
|
28819
28819
|
}
|
|
@@ -28867,8 +28867,8 @@ var require_shebang_command = __commonJS({
|
|
|
28867
28867
|
if (!match) {
|
|
28868
28868
|
return null;
|
|
28869
28869
|
}
|
|
28870
|
-
const [
|
|
28871
|
-
const binary =
|
|
28870
|
+
const [path56, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
28871
|
+
const binary = path56.split("/").pop();
|
|
28872
28872
|
if (binary === "env") {
|
|
28873
28873
|
return argument;
|
|
28874
28874
|
}
|
|
@@ -28881,16 +28881,16 @@ var require_shebang_command = __commonJS({
|
|
|
28881
28881
|
var require_readShebang = __commonJS({
|
|
28882
28882
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
28883
28883
|
"use strict";
|
|
28884
|
-
var
|
|
28884
|
+
var fs53 = __require("fs");
|
|
28885
28885
|
var shebangCommand = require_shebang_command();
|
|
28886
28886
|
function readShebang(command) {
|
|
28887
28887
|
const size = 150;
|
|
28888
28888
|
const buffer = Buffer.alloc(size);
|
|
28889
28889
|
let fd;
|
|
28890
28890
|
try {
|
|
28891
|
-
fd =
|
|
28892
|
-
|
|
28893
|
-
|
|
28891
|
+
fd = fs53.openSync(command, "r");
|
|
28892
|
+
fs53.readSync(fd, buffer, 0, size, 0);
|
|
28893
|
+
fs53.closeSync(fd);
|
|
28894
28894
|
} catch (e) {
|
|
28895
28895
|
}
|
|
28896
28896
|
return shebangCommand(buffer.toString());
|
|
@@ -28903,7 +28903,7 @@ var require_readShebang = __commonJS({
|
|
|
28903
28903
|
var require_parse = __commonJS({
|
|
28904
28904
|
"node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
28905
28905
|
"use strict";
|
|
28906
|
-
var
|
|
28906
|
+
var path56 = __require("path");
|
|
28907
28907
|
var resolveCommand = require_resolveCommand();
|
|
28908
28908
|
var escape3 = require_escape();
|
|
28909
28909
|
var readShebang = require_readShebang();
|
|
@@ -28928,7 +28928,7 @@ var require_parse = __commonJS({
|
|
|
28928
28928
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
28929
28929
|
if (parsed.options.forceShell || needsShell) {
|
|
28930
28930
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
28931
|
-
parsed.command =
|
|
28931
|
+
parsed.command = path56.normalize(parsed.command);
|
|
28932
28932
|
parsed.command = escape3.command(parsed.command);
|
|
28933
28933
|
parsed.args = parsed.args.map((arg) => escape3.argument(arg, needsDoubleEscapeMetaChars));
|
|
28934
28934
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -30627,7 +30627,7 @@ function createMakerAgentsPolicyBody() {
|
|
|
30627
30627
|
" `mcp report --ide <client> --target-dir <project> --context-stdin --consent --json`.",
|
|
30628
30628
|
"- This preserves the configured package version and the absolute Windows node.exe/npm-cli.js.",
|
|
30629
30629
|
"- Only with a known exact installed version, fallback to",
|
|
30630
|
-
" `npx -y --package @taptap/maker@0.0.34-beta.
|
|
30630
|
+
" `npx -y --package @taptap/maker@0.0.34-beta.6 taptap-maker mcp report ...`.",
|
|
30631
30631
|
"- Never use an unversioned npm package, or assume `taptap-maker`/`npx` is globally available.",
|
|
30632
30632
|
"- Never include the complete conversation, project source, other MCP server entries, PAT/token",
|
|
30633
30633
|
" values, or full environment variables. Normalize the user home path to `~`.",
|
|
@@ -39355,7 +39355,7 @@ var init_tracking = __esm({
|
|
|
39355
39355
|
MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
|
|
39356
39356
|
MAKER_MCP_TRACKING_SOURCE = "local_mcp";
|
|
39357
39357
|
MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
|
|
39358
|
-
MAKER_MCP_VERSION = "0.0.34-beta.
|
|
39358
|
+
MAKER_MCP_VERSION = "0.0.34-beta.6".trim() ? "0.0.34-beta.6".trim() : "dev";
|
|
39359
39359
|
TRACKING_ERROR_MAX_LENGTH = 500;
|
|
39360
39360
|
}
|
|
39361
39361
|
});
|
|
@@ -42667,7 +42667,7 @@ var init_mcp = __esm({
|
|
|
42667
42667
|
init_remoteProxyManager();
|
|
42668
42668
|
init_proxyAssets();
|
|
42669
42669
|
init_diagnosticRedaction();
|
|
42670
|
-
VERSION = true ? "0.0.34-beta.
|
|
42670
|
+
VERSION = true ? "0.0.34-beta.6" : "dev";
|
|
42671
42671
|
DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
42672
42672
|
DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
42673
42673
|
DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -42954,7 +42954,7 @@ function readPreviewRecord(project) {
|
|
|
42954
42954
|
const filename2 = path24.join(previewDirectory(project), "session.json");
|
|
42955
42955
|
if (!fs23.existsSync(filename2)) return void 0;
|
|
42956
42956
|
const record2 = JSON.parse(fs23.readFileSync(filename2, "utf8"));
|
|
42957
|
-
if (record2.project_realpath !== project || record2.protocol_version !== PREVIEW_PROTOCOL_VERSION || !/^[a-f0-9]{64}$/.test(record2.token) || !Number.isInteger(record2.port) || record2.port < 0 || record2.port > 65535 || !Number.isInteger(record2.supervisor_pid) || record2.supervisor_pid < 0 || record2.runtime_pid !== void 0 && (!Number.isInteger(record2.runtime_pid) || record2.runtime_pid < 0) || !/^[0-9a-f-]{36}$/.test(record2.session_id) || !record2.supervisor_id || !Number.isSafeInteger(record2.reload_id) || record2.reload_id < 0 || !record2.started_at || record2.launch_deadline !== void 0 && (!Number.isSafeInteger(record2.launch_deadline) || record2.launch_deadline <= 0) || !path24.isAbsolute(record2.executable)) {
|
|
42957
|
+
if (record2.project_realpath !== project || record2.protocol_version !== PREVIEW_PROTOCOL_VERSION || !/^[a-f0-9]{64}$/.test(record2.token) || !Number.isInteger(record2.port) || record2.port < 0 || record2.port > 65535 || !Number.isInteger(record2.supervisor_pid) || record2.supervisor_pid < 0 || record2.runtime_pid !== void 0 && (!Number.isInteger(record2.runtime_pid) || record2.runtime_pid < 0) || record2.runtime_launch_pending !== void 0 && typeof record2.runtime_launch_pending !== "boolean" || !/^[0-9a-f-]{36}$/.test(record2.session_id) || !record2.supervisor_id || !Number.isSafeInteger(record2.reload_id) || record2.reload_id < 0 || !record2.started_at || record2.launch_deadline !== void 0 && (!Number.isSafeInteger(record2.launch_deadline) || record2.launch_deadline <= 0) || !path24.isAbsolute(record2.executable)) {
|
|
42958
42958
|
throw new Error("Invalid preview session record; refusing to manage an unverified process.");
|
|
42959
42959
|
}
|
|
42960
42960
|
return record2;
|
|
@@ -49755,17 +49755,17 @@ var require_codegen3 = __commonJS({
|
|
|
49755
49755
|
var require_fs = __commonJS({
|
|
49756
49756
|
"node_modules/protobufjs/src/util/fs.js"(exports, module) {
|
|
49757
49757
|
"use strict";
|
|
49758
|
-
var
|
|
49758
|
+
var fs53 = null;
|
|
49759
49759
|
try {
|
|
49760
|
-
|
|
49760
|
+
fs53 = __require(
|
|
49761
49761
|
/* webpackIgnore: true */
|
|
49762
49762
|
"fs"
|
|
49763
49763
|
);
|
|
49764
|
-
if (!
|
|
49765
|
-
|
|
49764
|
+
if (!fs53 || !fs53.readFile || !fs53.readFileSync)
|
|
49765
|
+
fs53 = null;
|
|
49766
49766
|
} catch (e) {
|
|
49767
49767
|
}
|
|
49768
|
-
module.exports =
|
|
49768
|
+
module.exports = fs53;
|
|
49769
49769
|
}
|
|
49770
49770
|
});
|
|
49771
49771
|
|
|
@@ -49775,7 +49775,7 @@ var require_fetch = __commonJS({
|
|
|
49775
49775
|
"use strict";
|
|
49776
49776
|
module.exports = fetch2;
|
|
49777
49777
|
var asPromise = require_aspromise();
|
|
49778
|
-
var
|
|
49778
|
+
var fs53 = require_fs();
|
|
49779
49779
|
function fetch2(filename2, options3, callback) {
|
|
49780
49780
|
if (typeof options3 === "function") {
|
|
49781
49781
|
callback = options3;
|
|
@@ -49784,8 +49784,8 @@ var require_fetch = __commonJS({
|
|
|
49784
49784
|
options3 = {};
|
|
49785
49785
|
if (!callback)
|
|
49786
49786
|
return asPromise(fetch2, this, filename2, options3);
|
|
49787
|
-
if (!options3.xhr &&
|
|
49788
|
-
return
|
|
49787
|
+
if (!options3.xhr && fs53 && fs53.readFile)
|
|
49788
|
+
return fs53.readFile(filename2, function fetchReadFileCallback(err, contents) {
|
|
49789
49789
|
return err && typeof XMLHttpRequest !== "undefined" ? fetch2.xhr(filename2, options3, callback) : err ? callback(err) : callback(null, options3.binary ? contents : contents.toString("utf8"));
|
|
49790
49790
|
});
|
|
49791
49791
|
return fetch2.xhr(filename2, options3, callback);
|
|
@@ -49823,13 +49823,13 @@ var require_fetch = __commonJS({
|
|
|
49823
49823
|
var require_path = __commonJS({
|
|
49824
49824
|
"node_modules/protobufjs/src/util/path.js"(exports) {
|
|
49825
49825
|
"use strict";
|
|
49826
|
-
var
|
|
49826
|
+
var path56 = exports;
|
|
49827
49827
|
var urlRe = /^[a-zA-Z][a-zA-Z0-9+.-]+:\/\//;
|
|
49828
|
-
function normalizeUrl(
|
|
49829
|
-
if (typeof URL === "undefined" || !urlRe.test(
|
|
49828
|
+
function normalizeUrl(path57) {
|
|
49829
|
+
if (typeof URL === "undefined" || !urlRe.test(path57))
|
|
49830
49830
|
return null;
|
|
49831
49831
|
try {
|
|
49832
|
-
return new URL(
|
|
49832
|
+
return new URL(path57).href;
|
|
49833
49833
|
} catch (e) {
|
|
49834
49834
|
return null;
|
|
49835
49835
|
}
|
|
@@ -49849,8 +49849,8 @@ var require_path = __commonJS({
|
|
|
49849
49849
|
* @param {string} path Path to test
|
|
49850
49850
|
* @returns {boolean} `true` if path is absolute
|
|
49851
49851
|
*/
|
|
49852
|
-
|
|
49853
|
-
return /^(?:\/|\w+:|\\\\\w+)/.test(
|
|
49852
|
+
path56.isAbsolute = function isAbsolute2(path57) {
|
|
49853
|
+
return /^(?:\/|\w+:|\\\\\w+)/.test(path57);
|
|
49854
49854
|
}
|
|
49855
49855
|
);
|
|
49856
49856
|
var normalize = (
|
|
@@ -49859,18 +49859,18 @@ var require_path = __commonJS({
|
|
|
49859
49859
|
* @param {string} path Path to normalize
|
|
49860
49860
|
* @returns {string} Normalized path
|
|
49861
49861
|
*/
|
|
49862
|
-
|
|
49863
|
-
var normalizedUrl = normalizeUrl(
|
|
49862
|
+
path56.normalize = function normalize2(path57) {
|
|
49863
|
+
var normalizedUrl = normalizeUrl(path57);
|
|
49864
49864
|
if (normalizedUrl)
|
|
49865
49865
|
return normalizedUrl;
|
|
49866
|
-
var firstTwoCharacters =
|
|
49866
|
+
var firstTwoCharacters = path57.substring(0, 2);
|
|
49867
49867
|
var uncPrefix = "";
|
|
49868
49868
|
if (firstTwoCharacters === "\\\\") {
|
|
49869
49869
|
uncPrefix = firstTwoCharacters;
|
|
49870
|
-
|
|
49870
|
+
path57 = path57.substring(2);
|
|
49871
49871
|
}
|
|
49872
|
-
|
|
49873
|
-
var parts =
|
|
49872
|
+
path57 = path57.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
49873
|
+
var parts = path57.split("/"), absolute = isAbsolute(path57), prefix = "";
|
|
49874
49874
|
if (absolute)
|
|
49875
49875
|
prefix = parts.shift() + "/";
|
|
49876
49876
|
for (var i = 0; i < parts.length; ) {
|
|
@@ -49889,7 +49889,7 @@ var require_path = __commonJS({
|
|
|
49889
49889
|
return uncPrefix + prefix + parts.join("/");
|
|
49890
49890
|
}
|
|
49891
49891
|
);
|
|
49892
|
-
|
|
49892
|
+
path56.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
49893
49893
|
var resolvedUrl = resolveUrl(originPath, includePath);
|
|
49894
49894
|
if (resolvedUrl)
|
|
49895
49895
|
return resolvedUrl;
|
|
@@ -50062,18 +50062,18 @@ var require_namespace = __commonJS({
|
|
|
50062
50062
|
object3.onRemove(this);
|
|
50063
50063
|
return clearCache(this);
|
|
50064
50064
|
};
|
|
50065
|
-
Namespace.prototype.define = function define2(
|
|
50066
|
-
if (util2.isString(
|
|
50067
|
-
|
|
50068
|
-
else if (!Array.isArray(
|
|
50065
|
+
Namespace.prototype.define = function define2(path56, json2) {
|
|
50066
|
+
if (util2.isString(path56))
|
|
50067
|
+
path56 = path56.split(".");
|
|
50068
|
+
else if (!Array.isArray(path56))
|
|
50069
50069
|
throw TypeError("illegal path");
|
|
50070
|
-
if (
|
|
50070
|
+
if (path56 && path56.length && path56[0] === "")
|
|
50071
50071
|
throw Error("path must be relative");
|
|
50072
|
-
if (
|
|
50072
|
+
if (path56.length > util2.recursionLimit)
|
|
50073
50073
|
throw Error("max depth exceeded");
|
|
50074
50074
|
var ptr = this;
|
|
50075
|
-
while (
|
|
50076
|
-
var part =
|
|
50075
|
+
while (path56.length > 0) {
|
|
50076
|
+
var part = path56.shift();
|
|
50077
50077
|
if (ptr.nested && ptr.nested[part]) {
|
|
50078
50078
|
ptr = ptr.nested[part];
|
|
50079
50079
|
if (!(ptr instanceof Namespace))
|
|
@@ -50109,22 +50109,22 @@ var require_namespace = __commonJS({
|
|
|
50109
50109
|
});
|
|
50110
50110
|
return this;
|
|
50111
50111
|
};
|
|
50112
|
-
Namespace.prototype.lookup = function lookup(
|
|
50112
|
+
Namespace.prototype.lookup = function lookup(path56, filterTypes, parentAlreadyChecked) {
|
|
50113
50113
|
if (typeof filterTypes === "boolean") {
|
|
50114
50114
|
parentAlreadyChecked = filterTypes;
|
|
50115
50115
|
filterTypes = void 0;
|
|
50116
50116
|
} else if (filterTypes && !Array.isArray(filterTypes))
|
|
50117
50117
|
filterTypes = [filterTypes];
|
|
50118
|
-
if (util2.isString(
|
|
50119
|
-
if (
|
|
50118
|
+
if (util2.isString(path56) && path56.length) {
|
|
50119
|
+
if (path56 === ".")
|
|
50120
50120
|
return this.root;
|
|
50121
|
-
|
|
50122
|
-
} else if (!
|
|
50121
|
+
path56 = path56.split(".");
|
|
50122
|
+
} else if (!path56.length)
|
|
50123
50123
|
return this;
|
|
50124
|
-
var flatPath =
|
|
50125
|
-
if (
|
|
50126
|
-
return this.root.lookup(
|
|
50127
|
-
var found = this._lookupImpl(
|
|
50124
|
+
var flatPath = path56.join(".");
|
|
50125
|
+
if (path56[0] === "")
|
|
50126
|
+
return this.root.lookup(path56.slice(1), filterTypes);
|
|
50127
|
+
var found = this._lookupImpl(path56, flatPath);
|
|
50128
50128
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
50129
50129
|
return found;
|
|
50130
50130
|
}
|
|
@@ -50136,7 +50136,7 @@ var require_namespace = __commonJS({
|
|
|
50136
50136
|
return null;
|
|
50137
50137
|
var current = this;
|
|
50138
50138
|
while (current.parent) {
|
|
50139
|
-
found = current.parent._lookupImpl(
|
|
50139
|
+
found = current.parent._lookupImpl(path56, flatPath);
|
|
50140
50140
|
if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) {
|
|
50141
50141
|
return found;
|
|
50142
50142
|
}
|
|
@@ -50144,22 +50144,22 @@ var require_namespace = __commonJS({
|
|
|
50144
50144
|
}
|
|
50145
50145
|
return null;
|
|
50146
50146
|
};
|
|
50147
|
-
Namespace.prototype._lookupImpl = function lookup(
|
|
50147
|
+
Namespace.prototype._lookupImpl = function lookup(path56, flatPath) {
|
|
50148
50148
|
if (Object.prototype.hasOwnProperty.call(this._lookupCache, flatPath)) {
|
|
50149
50149
|
return this._lookupCache[flatPath];
|
|
50150
50150
|
}
|
|
50151
|
-
var found = this.get(
|
|
50151
|
+
var found = this.get(path56[0]);
|
|
50152
50152
|
var exact = null;
|
|
50153
50153
|
if (found) {
|
|
50154
|
-
if (
|
|
50154
|
+
if (path56.length === 1) {
|
|
50155
50155
|
exact = found;
|
|
50156
50156
|
} else if (found instanceof Namespace) {
|
|
50157
|
-
|
|
50158
|
-
exact = found._lookupImpl(
|
|
50157
|
+
path56 = path56.slice(1);
|
|
50158
|
+
exact = found._lookupImpl(path56, path56.join("."));
|
|
50159
50159
|
}
|
|
50160
50160
|
} else {
|
|
50161
50161
|
for (var i = 0; i < this.nestedArray.length; ++i)
|
|
50162
|
-
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(
|
|
50162
|
+
if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path56, flatPath))) {
|
|
50163
50163
|
exact = found;
|
|
50164
50164
|
break;
|
|
50165
50165
|
}
|
|
@@ -50167,28 +50167,28 @@ var require_namespace = __commonJS({
|
|
|
50167
50167
|
this._lookupCache[flatPath] = exact;
|
|
50168
50168
|
return exact;
|
|
50169
50169
|
};
|
|
50170
|
-
Namespace.prototype.lookupType = function lookupType(
|
|
50171
|
-
var found = this.lookup(
|
|
50170
|
+
Namespace.prototype.lookupType = function lookupType(path56) {
|
|
50171
|
+
var found = this.lookup(path56, [Type]);
|
|
50172
50172
|
if (!found)
|
|
50173
|
-
throw Error("no such type: " +
|
|
50173
|
+
throw Error("no such type: " + path56);
|
|
50174
50174
|
return found;
|
|
50175
50175
|
};
|
|
50176
|
-
Namespace.prototype.lookupEnum = function lookupEnum(
|
|
50177
|
-
var found = this.lookup(
|
|
50176
|
+
Namespace.prototype.lookupEnum = function lookupEnum(path56) {
|
|
50177
|
+
var found = this.lookup(path56, [Enum]);
|
|
50178
50178
|
if (!found)
|
|
50179
|
-
throw Error("no such Enum '" +
|
|
50179
|
+
throw Error("no such Enum '" + path56 + "' in " + this);
|
|
50180
50180
|
return found;
|
|
50181
50181
|
};
|
|
50182
|
-
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(
|
|
50183
|
-
var found = this.lookup(
|
|
50182
|
+
Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path56) {
|
|
50183
|
+
var found = this.lookup(path56, [Type, Enum]);
|
|
50184
50184
|
if (!found)
|
|
50185
|
-
throw Error("no such Type or Enum '" +
|
|
50185
|
+
throw Error("no such Type or Enum '" + path56 + "' in " + this);
|
|
50186
50186
|
return found;
|
|
50187
50187
|
};
|
|
50188
|
-
Namespace.prototype.lookupService = function lookupService(
|
|
50189
|
-
var found = this.lookup(
|
|
50188
|
+
Namespace.prototype.lookupService = function lookupService(path56) {
|
|
50189
|
+
var found = this.lookup(path56, [Service]);
|
|
50190
50190
|
if (!found)
|
|
50191
|
-
throw Error("no such Service '" +
|
|
50191
|
+
throw Error("no such Service '" + path56 + "' in " + this);
|
|
50192
50192
|
return found;
|
|
50193
50193
|
};
|
|
50194
50194
|
Namespace._configure = function(Type_, Service_, Enum_) {
|
|
@@ -51805,13 +51805,13 @@ var require_util3 = __commonJS({
|
|
|
51805
51805
|
Object.defineProperty(object3, "$type", { value: enm, enumerable: false });
|
|
51806
51806
|
return enm;
|
|
51807
51807
|
};
|
|
51808
|
-
util2.setProperty = function setProperty(dst,
|
|
51809
|
-
function setProp(dst2,
|
|
51810
|
-
var part =
|
|
51808
|
+
util2.setProperty = function setProperty(dst, path56, value, ifNotSet) {
|
|
51809
|
+
function setProp(dst2, path57, value2) {
|
|
51810
|
+
var part = path57.shift();
|
|
51811
51811
|
if (util2.isUnsafeProperty(part))
|
|
51812
51812
|
return dst2;
|
|
51813
|
-
if (
|
|
51814
|
-
dst2[part] = setProp(dst2[part] || {},
|
|
51813
|
+
if (path57.length > 0) {
|
|
51814
|
+
dst2[part] = setProp(dst2[part] || {}, path57, value2);
|
|
51815
51815
|
} else {
|
|
51816
51816
|
var prevValue = dst2[part];
|
|
51817
51817
|
if (prevValue && ifNotSet)
|
|
@@ -51824,12 +51824,12 @@ var require_util3 = __commonJS({
|
|
|
51824
51824
|
}
|
|
51825
51825
|
if (typeof dst !== "object")
|
|
51826
51826
|
throw TypeError("dst must be an object");
|
|
51827
|
-
if (!
|
|
51827
|
+
if (!path56)
|
|
51828
51828
|
throw TypeError("path must be specified");
|
|
51829
|
-
|
|
51830
|
-
if (
|
|
51829
|
+
path56 = path56.split(".");
|
|
51830
|
+
if (path56.length > util2.recursionLimit)
|
|
51831
51831
|
throw Error("max depth exceeded");
|
|
51832
|
-
return setProp(dst,
|
|
51832
|
+
return setProp(dst, path56, value);
|
|
51833
51833
|
};
|
|
51834
51834
|
Object.defineProperty(util2, "decorateRoot", {
|
|
51835
51835
|
get: function() {
|
|
@@ -52409,12 +52409,12 @@ var require_object = __commonJS({
|
|
|
52409
52409
|
*/
|
|
52410
52410
|
fullName: {
|
|
52411
52411
|
get: function() {
|
|
52412
|
-
var
|
|
52412
|
+
var path56 = [this.name], ptr = this.parent;
|
|
52413
52413
|
while (ptr) {
|
|
52414
|
-
|
|
52414
|
+
path56.unshift(ptr.name);
|
|
52415
52415
|
ptr = ptr.parent;
|
|
52416
52416
|
}
|
|
52417
|
-
return
|
|
52417
|
+
return path56.join(".");
|
|
52418
52418
|
}
|
|
52419
52419
|
}
|
|
52420
52420
|
});
|
|
@@ -54385,6 +54385,7 @@ let viewEpoch = 0;
|
|
|
54385
54385
|
let state = {projects: [], tasks: []};
|
|
54386
54386
|
let loaded = false;
|
|
54387
54387
|
let fortuneTimer;
|
|
54388
|
+
let fortuneReady = false;
|
|
54388
54389
|
function fortuneMode() {
|
|
54389
54390
|
return document.documentElement.dataset.theme === 'light' ? 'light' : 'dark';
|
|
54390
54391
|
}
|
|
@@ -54431,8 +54432,22 @@ function loadFortuneFrame(reload) {
|
|
|
54431
54432
|
frame.dataset.mode = fortuneMode();
|
|
54432
54433
|
frame.src = fortuneUrl();
|
|
54433
54434
|
}
|
|
54435
|
+
function revealFortune() {
|
|
54436
|
+
fortuneReady = true;
|
|
54437
|
+
$('fortune-panel').hidden = true;
|
|
54438
|
+
$('fortune-panel').classList.remove('fortune-preload');
|
|
54439
|
+
$('fortune-corner').hidden = false;
|
|
54440
|
+
}
|
|
54441
|
+
function beginFortuneLoad(reload) {
|
|
54442
|
+
fortuneReady = false;
|
|
54443
|
+
$('fortune-corner').hidden = true;
|
|
54444
|
+
$('fortune-panel').hidden = true;
|
|
54445
|
+
$('fortune-panel').classList.add('fortune-preload');
|
|
54446
|
+
loadFortuneFrame(reload);
|
|
54447
|
+
}
|
|
54434
54448
|
function openFortune() {
|
|
54435
54449
|
clearTimeout(fortuneTimer);
|
|
54450
|
+
if (!fortuneReady) return;
|
|
54436
54451
|
const panel = $('fortune-panel');
|
|
54437
54452
|
if (!panel) return;
|
|
54438
54453
|
if (panel.parentElement !== document.body) document.body.append(panel);
|
|
@@ -54622,7 +54637,8 @@ function renderVersionPicker() {
|
|
|
54622
54637
|
const managed = state.distribution && state.distribution !== 'standalone';
|
|
54623
54638
|
const updating = updateSubmitting || state.update?.status === 'running';
|
|
54624
54639
|
const newer = versionCatalog?.updateAvailable === true;
|
|
54625
|
-
const label = updating ? '更新中…' :
|
|
54640
|
+
const label = updating ? '更新中…' : versionQuery ? '检查版本中…' :
|
|
54641
|
+
current + (managed ? '(插件管理)' : newer ? '(有新版本)' : '');
|
|
54626
54642
|
replace(picker,[]);
|
|
54627
54643
|
const active = node('option',label); active.value = ''; picker.append(active);
|
|
54628
54644
|
if (!managed) {
|
|
@@ -54674,6 +54690,7 @@ async function selectMakerVersion(event) {
|
|
|
54674
54690
|
let detail = null;
|
|
54675
54691
|
let preview = null;
|
|
54676
54692
|
let previewError = '';
|
|
54693
|
+
let previewLoading = false;
|
|
54677
54694
|
const logViews = new Map();
|
|
54678
54695
|
function logView() {
|
|
54679
54696
|
if (!logViews.has(selected)) logViews.set(selected,{tab:'build',runtime:'',loading:false,wrap:false,cleared:{}});
|
|
@@ -54710,6 +54727,20 @@ function consoleLogText() {
|
|
|
54710
54727
|
return [output,details].filter(Boolean).join('\n\n') ||
|
|
54711
54728
|
(view.tab === 'runtime' ? '点击刷新读取运行时日志' : snapshot.id ? '等待任务输出' : '暂无日志');
|
|
54712
54729
|
}
|
|
54730
|
+
function logLineClass(line) {
|
|
54731
|
+
if (/(?:^|\b)(?:error|fatal|失败|错误|异常)(?:\b|$)/i.test(line)) return 'log-line log-error';
|
|
54732
|
+
if (/(?:^|\b)(?:warn(?:ing)?|警告|注意)(?:\b|$)/i.test(line)) return 'log-line log-warning';
|
|
54733
|
+
return 'log-line';
|
|
54734
|
+
}
|
|
54735
|
+
function renderLogLines(output) {
|
|
54736
|
+
const fragment = document.createDocumentFragment();
|
|
54737
|
+
const lines = String(output || '').split('\n');
|
|
54738
|
+
lines.forEach((line,index) => {
|
|
54739
|
+
fragment.append(node('span',line,logLineClass(line)));
|
|
54740
|
+
if (index < lines.length - 1) fragment.append(document.createTextNode('\n'));
|
|
54741
|
+
});
|
|
54742
|
+
return fragment;
|
|
54743
|
+
}
|
|
54713
54744
|
function renderConsoleLogs() {
|
|
54714
54745
|
const host = $('console-logs');
|
|
54715
54746
|
if (!host) return;
|
|
@@ -54726,11 +54757,12 @@ function renderConsoleLogs() {
|
|
|
54726
54757
|
const wrap = node('label','自动换行','theme');
|
|
54727
54758
|
const checkbox = node('input'); checkbox.type = 'checkbox'; checkbox.checked = view.wrap;
|
|
54728
54759
|
checkbox.addEventListener('change',() => { view.wrap = checkbox.checked; renderConsoleLogs(); }); wrap.append(checkbox);
|
|
54729
|
-
actions.append(wrap,button('刷新',() => { if(view.tab === 'runtime') void loadLogs(); else void pollState().then(renderConsoleLogs).catch(e=>notify(e.message)); },{disabled:offline || view.loading}),
|
|
54730
|
-
button('清理日志',clearConsoleLogs,{icon:'trash',disabled:view.loading}),
|
|
54731
|
-
button('复制',async () => { try { await navigator.clipboard.writeText(consoleLogText()); announce('日志已复制'); } catch (_) { notify('复制失败,请手动选择日志复制'); } }));
|
|
54732
|
-
toolbar.append(
|
|
54733
|
-
const output = node('pre',
|
|
54760
|
+
actions.append(wrap,button(view.loading ? '读取中' : '刷新',() => { if(view.tab === 'runtime') void loadLogs(); else void pollState().then(renderConsoleLogs).catch(e=>notify(e.message)); },{icon:'refresh',iconOnly:true,className:'icon-button',loading:view.loading,disabled:offline || view.loading}),
|
|
54761
|
+
button('清理日志',clearConsoleLogs,{icon:'trash',iconOnly:true,className:'icon-button',disabled:view.loading}),
|
|
54762
|
+
button('复制',async () => { try { await navigator.clipboard.writeText(consoleLogText()); announce('日志已复制'); } catch (_) { notify('复制失败,请手动选择日志复制'); } },{icon:'copy',iconOnly:true,className:'icon-button'}));
|
|
54763
|
+
toolbar.append(node('h2','日志'),actions);
|
|
54764
|
+
const output = node('pre',undefined,'console-log-output' + (view.wrap ? ' wrap' : ''));
|
|
54765
|
+
output.append(renderLogLines(consoleLogText()));
|
|
54734
54766
|
output.id = 'console-log-output'; output.setAttribute('role','tabpanel'); output.tabIndex = 0;
|
|
54735
54767
|
const previous = $('console-log-output');
|
|
54736
54768
|
const top = previous?.scrollTop || 0, left = previous?.scrollLeft || 0;
|
|
@@ -54808,13 +54840,16 @@ function icon(name) {
|
|
|
54808
54840
|
return svg;
|
|
54809
54841
|
}
|
|
54810
54842
|
function button(label, handler, options = {}) {
|
|
54811
|
-
const b = node('button', options.iconOnly ? undefined : label,
|
|
54843
|
+
const b = node('button', options.iconOnly ? undefined : label,
|
|
54844
|
+
[options.className, options.loading ? 'is-loading' : ''].filter(Boolean).join(' '));
|
|
54812
54845
|
b.type = 'button';
|
|
54813
|
-
b.disabled = Boolean(options.disabled);
|
|
54846
|
+
b.disabled = Boolean(options.disabled || options.loading);
|
|
54814
54847
|
b.title = label;
|
|
54815
54848
|
b.setAttribute('aria-label', label);
|
|
54816
|
-
if (options.
|
|
54849
|
+
if (options.loading) b.prepend(node('span',undefined,'loading-spinner'));
|
|
54850
|
+
else if (options.icon) b.prepend(icon(options.icon));
|
|
54817
54851
|
if (options.focus) b.dataset.focus = options.focus;
|
|
54852
|
+
if (options.loading) b.setAttribute('aria-busy','true');
|
|
54818
54853
|
b.addEventListener('click', handler);
|
|
54819
54854
|
return b;
|
|
54820
54855
|
}
|
|
@@ -54884,6 +54919,10 @@ function tasksFor(key) {
|
|
|
54884
54919
|
return Array.from(tasks.values()).sort((a,b) => String(b.startedAt).localeCompare(String(a.startedAt))).slice(0,10);
|
|
54885
54920
|
}
|
|
54886
54921
|
function busy(key = selected) { return pending.has(key) || tasksFor(key).some(t => t.status === 'running'); }
|
|
54922
|
+
function actionBusy(action, key = selected) {
|
|
54923
|
+
return pendingActions.get(key) === action ||
|
|
54924
|
+
tasksFor(key).some(task => task.action === action && task.status === 'running');
|
|
54925
|
+
}
|
|
54887
54926
|
function selectionMatches(key, epoch) { return key === selected && epoch === selectionEpoch; }
|
|
54888
54927
|
function notify(message, tone = 'error') {
|
|
54889
54928
|
$('feedback-text').textContent = text(message);
|
|
@@ -54962,10 +55001,14 @@ function updateChrome() {
|
|
|
54962
55001
|
}
|
|
54963
55002
|
function headingActionButtons() {
|
|
54964
55003
|
const actions = previewActions(preview);
|
|
55004
|
+
const previewBusy = actionBusy('preview.start') || actionBusy('preview.refresh') ||
|
|
55005
|
+
actionBusy('preview.install') || actionBusy('preview.stop');
|
|
55006
|
+
const qrcodeBusy = actionBusy('qrcode');
|
|
54965
55007
|
const local = button('本地预览',() => {
|
|
54966
55008
|
const action = previewActions(preview)[0];
|
|
54967
55009
|
if (action) void runProjectAction(action);
|
|
54968
|
-
},{className:'preview-button',icon:'monitor',
|
|
55010
|
+
},{className:'preview-button',icon:'monitor',loading:previewBusy,
|
|
55011
|
+
disabled:offline || busy() || !actions.length,focus:'heading-preview'});
|
|
54969
55012
|
local.title = actions.length ? '本地预览 · ' + actionLabels[actions[0]] :
|
|
54970
55013
|
'本地预览 · ' + (previewError || text(preview?.error,previewLabel()));
|
|
54971
55014
|
const checking = pendingActions.get(selected) === 'lua-lsp.check' ||
|
|
@@ -54979,7 +55022,7 @@ function headingActionButtons() {
|
|
|
54979
55022
|
build.setAttribute('aria-busy',String(presentation.active || checking));
|
|
54980
55023
|
const primary = node('div',undefined,'actions heading-primary');
|
|
54981
55024
|
primary.append(local,build,button('测试二维码',() => void runProjectAction('qrcode'),{
|
|
54982
|
-
icon:'qrcode',disabled:offline || busy(),focus:'heading-qrcode'
|
|
55025
|
+
icon:'qrcode',loading:qrcodeBusy,disabled:offline || busy(),focus:'heading-qrcode'
|
|
54983
55026
|
}));
|
|
54984
55027
|
const secondary = node('div',undefined,'actions heading-secondary');
|
|
54985
55028
|
secondary.append(luaCheckOption());
|
|
@@ -55472,8 +55515,9 @@ function explainQrcode(title, message) {
|
|
|
55472
55515
|
}
|
|
55473
55516
|
function showQrcode(task) {
|
|
55474
55517
|
const source = qrcodeImageSource(task);
|
|
55475
|
-
|
|
55476
|
-
|
|
55518
|
+
const dialog = $('qrcode-result');
|
|
55519
|
+
if (!source || task.projectKey !== selected || (consoleDialogOpen() && !dialog?.open)) return;
|
|
55520
|
+
const image = $('qrcode-result-image'), status = $('qrcode-result-status');
|
|
55477
55521
|
const retry = $('qrcode-result-reload'), original = $('qrcode-result-original');
|
|
55478
55522
|
$('qrcode-result-project').textContent = '项目:' + task.projectName;
|
|
55479
55523
|
original.hidden = source.startsWith('data:');
|
|
@@ -55490,7 +55534,21 @@ function showQrcode(task) {
|
|
|
55490
55534
|
image.src = source;
|
|
55491
55535
|
};
|
|
55492
55536
|
retry.onclick = loadImage;
|
|
55537
|
+
if (dialog.removeAttribute) dialog.removeAttribute('aria-busy');
|
|
55493
55538
|
loadImage();
|
|
55539
|
+
if (!dialog.open) dialog.showModal();
|
|
55540
|
+
}
|
|
55541
|
+
function showQrcodeLoading(project) {
|
|
55542
|
+
const dialog = $('qrcode-result');
|
|
55543
|
+
if (!dialog || consoleDialogOpen()) return;
|
|
55544
|
+
$('qrcode-result-project').textContent = '项目:' + text(project?.name, '当前项目');
|
|
55545
|
+
$('qrcode-result-status').hidden = false;
|
|
55546
|
+
$('qrcode-result-status').textContent = '正在生成测试二维码,请稍候…';
|
|
55547
|
+
$('qrcode-result-status').className = 'pending';
|
|
55548
|
+
$('qrcode-result-image').hidden = true;
|
|
55549
|
+
$('qrcode-result-reload').hidden = true;
|
|
55550
|
+
$('qrcode-result-original').hidden = true;
|
|
55551
|
+
dialog.setAttribute('aria-busy','true');
|
|
55494
55552
|
dialog.showModal();
|
|
55495
55553
|
}
|
|
55496
55554
|
const handledQrcodeTasks = new Set();
|
|
@@ -55499,10 +55557,21 @@ function handleQrcodeCompletion(task) {
|
|
|
55499
55557
|
handledQrcodeTasks.has(task.id)) return;
|
|
55500
55558
|
handledQrcodeTasks.add(task.id);
|
|
55501
55559
|
while (handledQrcodeTasks.size > 100) handledQrcodeTasks.delete(handledQrcodeTasks.values().next().value);
|
|
55502
|
-
if (consoleDialogOpen()) return;
|
|
55560
|
+
if (consoleDialogOpen() && !$('qrcode-result')?.open) return;
|
|
55503
55561
|
if (task.status === 'succeeded') {
|
|
55504
55562
|
if (qrcodeImageSource(task)) showQrcode(task);
|
|
55505
|
-
else
|
|
55563
|
+
else {
|
|
55564
|
+
if ($('qrcode-result')?.open) {
|
|
55565
|
+
if ($('qrcode-result').removeAttribute) $('qrcode-result').removeAttribute('aria-busy');
|
|
55566
|
+
$('qrcode-result-status').hidden = false;
|
|
55567
|
+
$('qrcode-result-status').textContent = '二维码任务已完成,但未返回可显示的二维码图片,请查看任务结果。';
|
|
55568
|
+
$('qrcode-result-status').className = 'pending';
|
|
55569
|
+
}
|
|
55570
|
+
notify('二维码工具已返回,请在任务结果中查看链接。','warning');
|
|
55571
|
+
}
|
|
55572
|
+
} else if ($('qrcode-result')?.open) {
|
|
55573
|
+
$('qrcode-result').close();
|
|
55574
|
+
if ($('qrcode-result').removeAttribute) $('qrcode-result').removeAttribute('aria-busy');
|
|
55506
55575
|
} else if (task.interaction?.kind === 'select_developer' && !busy(task.projectKey)) {
|
|
55507
55576
|
void runAction('qrcode',{sourceTaskId:task.id});
|
|
55508
55577
|
}
|
|
@@ -55757,7 +55826,8 @@ function updateBuild() {
|
|
|
55757
55826
|
summary.append(node('span','Runtime · ' + (preview?.install_state === 'ready' ? '已安装' :
|
|
55758
55827
|
preview?.install_state === 'missing' ? '未安装' : '待检测'),
|
|
55759
55828
|
preview?.install_state === 'ready' ? 'good' : preview?.install_state === 'missing' ? 'pending' : 'muted'));
|
|
55760
|
-
summary.append(node('span',previewError ? '检测失败' : previewInfo.stateLabel,
|
|
55829
|
+
summary.append(node('span',previewLoading ? '检测中…' : previewError ? '检测失败' : previewInfo.stateLabel,
|
|
55830
|
+
previewLoading ? 'pending' : previewInfo.tone));
|
|
55761
55831
|
if (previewInfo.errorCount) summary.append(node('span',previewInfo.errorCount + ' 条日志错误','bad'));
|
|
55762
55832
|
const localChildren = [node('h2','本地预览'),summary];
|
|
55763
55833
|
localChildren.push(renderWindowSettings());
|
|
@@ -55773,11 +55843,14 @@ function updateBuild() {
|
|
|
55773
55843
|
}
|
|
55774
55844
|
if (preview?.supported === false) localChildren.push(node('p','当前平台不支持本地预览','bad'));
|
|
55775
55845
|
const actions = node('div',undefined,'actions preview-controls');
|
|
55776
|
-
previewActions(preview).forEach(action => actions.append(button(
|
|
55777
|
-
|
|
55778
|
-
|
|
55779
|
-
|
|
55780
|
-
|
|
55846
|
+
previewActions(preview).forEach(action => actions.append(button(
|
|
55847
|
+
actionBusy(action) ? actionLabels[action] + '中' : actionLabels[action],
|
|
55848
|
+
() => void runAction(action),{
|
|
55849
|
+
loading:actionBusy(action),disabled:offline || busy(),focus:action,
|
|
55850
|
+
...(action === 'preview.refresh' ? {icon:'refresh'} : {})
|
|
55851
|
+
})));
|
|
55852
|
+
actions.append(button(previewLoading ? '检测中' : '检测预览状态',() => void refreshPreview(),{
|
|
55853
|
+
icon:'refresh',iconOnly:true,className:'icon-button',loading:previewLoading,focus:'preview-status'}));
|
|
55781
55854
|
actions.append(button('查看运行日志',() => void loadLogs(),{focus:'preview-logs'}));
|
|
55782
55855
|
localChildren.push(actions);
|
|
55783
55856
|
replace($('preview-panel'),localChildren);
|
|
@@ -55790,6 +55863,8 @@ function updateBuild() {
|
|
|
55790
55863
|
async function refreshPreview() {
|
|
55791
55864
|
const key = selected, epoch = selectionEpoch;
|
|
55792
55865
|
if (!key || !currentProject()?.valid) return;
|
|
55866
|
+
previewLoading = true;
|
|
55867
|
+
if (page === 'build') updateBuild();
|
|
55793
55868
|
try {
|
|
55794
55869
|
const result = await api(projectPath(key,'/preview'));
|
|
55795
55870
|
if (!selectionMatches(key,epoch)) return;
|
|
@@ -55802,6 +55877,11 @@ async function refreshPreview() {
|
|
|
55802
55877
|
preview = null; previewError = error.message;
|
|
55803
55878
|
if (page === 'build') updateBuild();
|
|
55804
55879
|
if (page === 'overview') renderOverview();
|
|
55880
|
+
} finally {
|
|
55881
|
+
if (selectionMatches(key,epoch)) {
|
|
55882
|
+
previewLoading = false;
|
|
55883
|
+
if (page === 'build') updateBuild();
|
|
55884
|
+
}
|
|
55805
55885
|
}
|
|
55806
55886
|
}
|
|
55807
55887
|
async function loadLogs() {
|
|
@@ -55961,6 +56041,10 @@ async function runAction(action, options = {}) {
|
|
|
55961
56041
|
const task = await api('/api/tasks',{method:'POST',body:{projectKey:key,action,...choice}});
|
|
55962
56042
|
if (task.projectKey !== key) throw new Error('任务项目与请求不一致,请检查任务状态。');
|
|
55963
56043
|
rememberTask(task);
|
|
56044
|
+
if (selectionMatches(key,epoch)) {
|
|
56045
|
+
if (task.status === 'running') showQrcodeLoading(project);
|
|
56046
|
+
else if (task.status === 'succeeded') handleQrcodeCompletion(task);
|
|
56047
|
+
}
|
|
55964
56048
|
void pollTask(task.id,key,epoch);
|
|
55965
56049
|
return;
|
|
55966
56050
|
}
|
|
@@ -55983,11 +56067,14 @@ async function runAction(action, options = {}) {
|
|
|
55983
56067
|
if (luaCheckBlocksBuild(check)) {
|
|
55984
56068
|
if (selectionMatches(key,epoch)) {
|
|
55985
56069
|
selectLog('lua');
|
|
55986
|
-
|
|
56070
|
+
announce('Lua 检查未通过,已停止构建,请查看下方 Lua 检查日志。');
|
|
55987
56071
|
}
|
|
55988
56072
|
return;
|
|
55989
56073
|
}
|
|
55990
|
-
if (selectionMatches(key,epoch) && check?.status === 'failed')
|
|
56074
|
+
if (selectionMatches(key,epoch) && check?.status === 'failed') {
|
|
56075
|
+
selectLog('lua');
|
|
56076
|
+
announce('Lua 检查不可用,已继续构建,请查看下方 Lua 检查日志。');
|
|
56077
|
+
}
|
|
55991
56078
|
pendingActions.set(key,'build');
|
|
55992
56079
|
updateChrome(); updateBuild();
|
|
55993
56080
|
}
|
|
@@ -56280,12 +56367,23 @@ document.addEventListener('DOMContentLoaded',async () => {
|
|
|
56280
56367
|
const value = theme.checked ? 'dark' : 'light';
|
|
56281
56368
|
document.documentElement.dataset.theme = value;
|
|
56282
56369
|
pluginSessions.forEach(session => sendPluginTheme(session));
|
|
56283
|
-
if ($('fortune-frame').getAttribute('src'))
|
|
56370
|
+
if ($('fortune-frame').getAttribute('src')) {
|
|
56371
|
+
beginFortuneLoad(true);
|
|
56372
|
+
}
|
|
56284
56373
|
try { localStorage.setItem('maker-console-theme',value); } catch (_) { notify('无法保存主题设置'); }
|
|
56285
56374
|
});
|
|
56286
56375
|
$('projects-button').append(icon('folder'));
|
|
56287
|
-
$('fortune-
|
|
56288
|
-
$('fortune-
|
|
56376
|
+
const fortunePanel = $('fortune-panel');
|
|
56377
|
+
const fortuneFrame = $('fortune-frame');
|
|
56378
|
+
fortunePanel.classList.add('fortune-preload');
|
|
56379
|
+
fortunePanel.hidden = true;
|
|
56380
|
+
fortuneFrame.addEventListener('load',revealFortune);
|
|
56381
|
+
fortuneFrame.addEventListener('error',() => {
|
|
56382
|
+
fortuneReady = false;
|
|
56383
|
+
$('fortune-corner').hidden = true;
|
|
56384
|
+
fortunePanel.hidden = true;
|
|
56385
|
+
});
|
|
56386
|
+
beginFortuneLoad();
|
|
56289
56387
|
bindFortuneHover($('fortune-toggle'));
|
|
56290
56388
|
bindFortuneHover($('fortune-panel'));
|
|
56291
56389
|
$('fortune-toggle').addEventListener('click',event => {
|
|
@@ -56346,8 +56444,10 @@ button.is-building:disabled{opacity:1;cursor:wait}
|
|
|
56346
56444
|
.build-progress-label{font-size:12px;margin-top:6px;text-align:right}
|
|
56347
56445
|
@keyframes build-spin{to{transform:rotate(360deg)}}
|
|
56348
56446
|
@keyframes build-travel{from{transform:translateX(-100%)}to{transform:translateX(386%)}}
|
|
56447
|
+
.loading-spinner{display:inline-block;width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;flex:none}
|
|
56448
|
+
.is-loading{cursor:wait!important}
|
|
56349
56449
|
@media(prefers-reduced-motion:no-preference){
|
|
56350
|
-
.is-building .icon,.build-spinner{animation:build-spin 1.2s linear infinite}
|
|
56450
|
+
.is-building .icon,.build-spinner,.loading-spinner{animation:build-spin 1.2s linear infinite}
|
|
56351
56451
|
.build-progress.indeterminate span{animation:build-travel 1.8s ease-in-out infinite}
|
|
56352
56452
|
.build-progress.determinate span{transition:width .25s ease}
|
|
56353
56453
|
}
|
|
@@ -56363,9 +56463,9 @@ button#fortune-toggle{border:0;background:none;color:#f5e6a3;font-size:12px;font
|
|
|
56363
56463
|
:root[data-theme="light"] button#fortune-toggle{color:#c4a017}
|
|
56364
56464
|
button#fortune-toggle:hover,button#fortune-toggle[aria-expanded="true"]{color:var(--yellow);background:none;border-color:transparent}
|
|
56365
56465
|
#fortune-panel{position:fixed;z-index:30;overflow:hidden;border:0;border-radius:6px;background:transparent;box-shadow:0 8px 28px #0005}
|
|
56466
|
+
#fortune-panel.fortune-preload{opacity:0;pointer-events:none;left:0;top:0;width:1px;height:1px}
|
|
56366
56467
|
#fortune-panel[hidden]{display:none!important}
|
|
56367
56468
|
#fortune-panel iframe{display:block;width:100%;height:100%;border:0}
|
|
56368
|
-
#fortune-retry{position:absolute;right:4px;top:4px;z-index:1;width:32px;height:32px;padding:4px}
|
|
56369
56469
|
.document-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin-bottom:18px}
|
|
56370
56470
|
.document-toolbar input{flex:1;min-width:160px;max-width:360px}
|
|
56371
56471
|
.document-toolbar [aria-selected="true"]{color:var(--accent);border-bottom:2px solid var(--accent)}
|
|
@@ -56463,6 +56563,9 @@ pre{white-space:pre-wrap;tab-size:2;margin:10px 0 0;background:var(--code);paddi
|
|
|
56463
56563
|
.console-log-toolbar [aria-selected="true"]{color:var(--accent);border-bottom:2px solid var(--accent)}
|
|
56464
56564
|
.console-logs .console-log-output{height:360px;max-height:60vh;width:100%;max-width:100%;overflow:auto;white-space:pre;overflow-wrap:normal;word-break:normal;margin:0}
|
|
56465
56565
|
.console-logs .console-log-output.wrap{white-space:pre-wrap;overflow-wrap:anywhere}
|
|
56566
|
+
.console-log-output .log-line{color:var(--text)}
|
|
56567
|
+
.console-log-output .log-error{color:var(--red)}
|
|
56568
|
+
.console-log-output .log-warning{color:var(--yellow)}
|
|
56466
56569
|
button.link.bad{color:var(--red)}button.link.good{color:var(--green)}button.link.pending{color:var(--accent)}
|
|
56467
56570
|
.preview-status-summary{display:flex;flex-wrap:wrap;align-items:center;gap:8px 20px;padding:12px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
|
|
56468
56571
|
.preview-status-summary span{font-weight:600}
|
|
@@ -56562,13 +56665,12 @@ function getConsoleHtml() {
|
|
|
56562
56665
|
<section id="plugin-views" aria-label="插件工作区" hidden></section>
|
|
56563
56666
|
<div id="announcement" role="status" aria-live="polite" class="context" hidden></div>
|
|
56564
56667
|
<footer><div class="footer-start"><span id="version">Maker 本地服务</span>
|
|
56565
|
-
<section id="fortune-corner" aria-label="开发者日签">
|
|
56668
|
+
<section id="fortune-corner" aria-label="开发者日签" hidden>
|
|
56566
56669
|
<button id="fortune-toggle" type="button" aria-expanded="false" aria-controls="fortune-panel">独立游戏开发日签</button>
|
|
56567
56670
|
</section>
|
|
56568
56671
|
</div><span id="footer-path"></span></footer>
|
|
56569
56672
|
<div id="fortune-panel" hidden>
|
|
56570
|
-
<
|
|
56571
|
-
<iframe id="fortune-frame" title="gDEV日签 · 独立游戏开发者老黄历" sandbox="allow-scripts allow-same-origin" referrerpolicy="no-referrer"></iframe>
|
|
56673
|
+
<iframe id="fortune-frame" title="gDEV日签 · 独立游戏开发者老黄历" sandbox="allow-scripts allow-same-origin" loading="eager" referrerpolicy="no-referrer"></iframe>
|
|
56572
56674
|
</div>
|
|
56573
56675
|
<dialog id="confirm" aria-labelledby="confirm-title" aria-describedby="confirm-message">
|
|
56574
56676
|
<form method="dialog">
|
|
@@ -56727,17 +56829,17 @@ var require_visit = __commonJS({
|
|
|
56727
56829
|
visit.BREAK = BREAK;
|
|
56728
56830
|
visit.SKIP = SKIP;
|
|
56729
56831
|
visit.REMOVE = REMOVE;
|
|
56730
|
-
function visit_(key, node, visitor,
|
|
56731
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
56832
|
+
function visit_(key, node, visitor, path56) {
|
|
56833
|
+
const ctrl = callVisitor(key, node, visitor, path56);
|
|
56732
56834
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
56733
|
-
replaceNode(key,
|
|
56734
|
-
return visit_(key, ctrl, visitor,
|
|
56835
|
+
replaceNode(key, path56, ctrl);
|
|
56836
|
+
return visit_(key, ctrl, visitor, path56);
|
|
56735
56837
|
}
|
|
56736
56838
|
if (typeof ctrl !== "symbol") {
|
|
56737
56839
|
if (identity.isCollection(node)) {
|
|
56738
|
-
|
|
56840
|
+
path56 = Object.freeze(path56.concat(node));
|
|
56739
56841
|
for (let i = 0; i < node.items.length; ++i) {
|
|
56740
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
56842
|
+
const ci = visit_(i, node.items[i], visitor, path56);
|
|
56741
56843
|
if (typeof ci === "number")
|
|
56742
56844
|
i = ci - 1;
|
|
56743
56845
|
else if (ci === BREAK)
|
|
@@ -56748,13 +56850,13 @@ var require_visit = __commonJS({
|
|
|
56748
56850
|
}
|
|
56749
56851
|
}
|
|
56750
56852
|
} else if (identity.isPair(node)) {
|
|
56751
|
-
|
|
56752
|
-
const ck = visit_("key", node.key, visitor,
|
|
56853
|
+
path56 = Object.freeze(path56.concat(node));
|
|
56854
|
+
const ck = visit_("key", node.key, visitor, path56);
|
|
56753
56855
|
if (ck === BREAK)
|
|
56754
56856
|
return BREAK;
|
|
56755
56857
|
else if (ck === REMOVE)
|
|
56756
56858
|
node.key = null;
|
|
56757
|
-
const cv = visit_("value", node.value, visitor,
|
|
56859
|
+
const cv = visit_("value", node.value, visitor, path56);
|
|
56758
56860
|
if (cv === BREAK)
|
|
56759
56861
|
return BREAK;
|
|
56760
56862
|
else if (cv === REMOVE)
|
|
@@ -56775,17 +56877,17 @@ var require_visit = __commonJS({
|
|
|
56775
56877
|
visitAsync.BREAK = BREAK;
|
|
56776
56878
|
visitAsync.SKIP = SKIP;
|
|
56777
56879
|
visitAsync.REMOVE = REMOVE;
|
|
56778
|
-
async function visitAsync_(key, node, visitor,
|
|
56779
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
56880
|
+
async function visitAsync_(key, node, visitor, path56) {
|
|
56881
|
+
const ctrl = await callVisitor(key, node, visitor, path56);
|
|
56780
56882
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
56781
|
-
replaceNode(key,
|
|
56782
|
-
return visitAsync_(key, ctrl, visitor,
|
|
56883
|
+
replaceNode(key, path56, ctrl);
|
|
56884
|
+
return visitAsync_(key, ctrl, visitor, path56);
|
|
56783
56885
|
}
|
|
56784
56886
|
if (typeof ctrl !== "symbol") {
|
|
56785
56887
|
if (identity.isCollection(node)) {
|
|
56786
|
-
|
|
56888
|
+
path56 = Object.freeze(path56.concat(node));
|
|
56787
56889
|
for (let i = 0; i < node.items.length; ++i) {
|
|
56788
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
56890
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path56);
|
|
56789
56891
|
if (typeof ci === "number")
|
|
56790
56892
|
i = ci - 1;
|
|
56791
56893
|
else if (ci === BREAK)
|
|
@@ -56796,13 +56898,13 @@ var require_visit = __commonJS({
|
|
|
56796
56898
|
}
|
|
56797
56899
|
}
|
|
56798
56900
|
} else if (identity.isPair(node)) {
|
|
56799
|
-
|
|
56800
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
56901
|
+
path56 = Object.freeze(path56.concat(node));
|
|
56902
|
+
const ck = await visitAsync_("key", node.key, visitor, path56);
|
|
56801
56903
|
if (ck === BREAK)
|
|
56802
56904
|
return BREAK;
|
|
56803
56905
|
else if (ck === REMOVE)
|
|
56804
56906
|
node.key = null;
|
|
56805
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
56907
|
+
const cv = await visitAsync_("value", node.value, visitor, path56);
|
|
56806
56908
|
if (cv === BREAK)
|
|
56807
56909
|
return BREAK;
|
|
56808
56910
|
else if (cv === REMOVE)
|
|
@@ -56829,24 +56931,24 @@ var require_visit = __commonJS({
|
|
|
56829
56931
|
}
|
|
56830
56932
|
return visitor;
|
|
56831
56933
|
}
|
|
56832
|
-
function callVisitor(key, node, visitor,
|
|
56934
|
+
function callVisitor(key, node, visitor, path56) {
|
|
56833
56935
|
var _a3, _b, _c, _d, _e;
|
|
56834
56936
|
if (typeof visitor === "function")
|
|
56835
|
-
return visitor(key, node,
|
|
56937
|
+
return visitor(key, node, path56);
|
|
56836
56938
|
if (identity.isMap(node))
|
|
56837
|
-
return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node,
|
|
56939
|
+
return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node, path56);
|
|
56838
56940
|
if (identity.isSeq(node))
|
|
56839
|
-
return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node,
|
|
56941
|
+
return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node, path56);
|
|
56840
56942
|
if (identity.isPair(node))
|
|
56841
|
-
return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node,
|
|
56943
|
+
return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node, path56);
|
|
56842
56944
|
if (identity.isScalar(node))
|
|
56843
|
-
return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node,
|
|
56945
|
+
return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path56);
|
|
56844
56946
|
if (identity.isAlias(node))
|
|
56845
|
-
return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node,
|
|
56947
|
+
return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node, path56);
|
|
56846
56948
|
return void 0;
|
|
56847
56949
|
}
|
|
56848
|
-
function replaceNode(key,
|
|
56849
|
-
const parent =
|
|
56950
|
+
function replaceNode(key, path56, node) {
|
|
56951
|
+
const parent = path56[path56.length - 1];
|
|
56850
56952
|
if (identity.isCollection(parent)) {
|
|
56851
56953
|
parent.items[key] = node;
|
|
56852
56954
|
} else if (identity.isPair(parent)) {
|
|
@@ -57458,10 +57560,10 @@ var require_Collection = __commonJS({
|
|
|
57458
57560
|
var createNode = require_createNode();
|
|
57459
57561
|
var identity = require_identity();
|
|
57460
57562
|
var Node = require_Node();
|
|
57461
|
-
function collectionFromPath(schema,
|
|
57563
|
+
function collectionFromPath(schema, path56, value) {
|
|
57462
57564
|
let v = value;
|
|
57463
|
-
for (let i =
|
|
57464
|
-
const k =
|
|
57565
|
+
for (let i = path56.length - 1; i >= 0; --i) {
|
|
57566
|
+
const k = path56[i];
|
|
57465
57567
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
57466
57568
|
const a = [];
|
|
57467
57569
|
a[k] = v;
|
|
@@ -57480,7 +57582,7 @@ var require_Collection = __commonJS({
|
|
|
57480
57582
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
57481
57583
|
});
|
|
57482
57584
|
}
|
|
57483
|
-
var isEmptyPath = (
|
|
57585
|
+
var isEmptyPath = (path56) => path56 == null || typeof path56 === "object" && !!path56[Symbol.iterator]().next().done;
|
|
57484
57586
|
var Collection = class extends Node.NodeBase {
|
|
57485
57587
|
constructor(type, schema) {
|
|
57486
57588
|
super(type);
|
|
@@ -57510,11 +57612,11 @@ var require_Collection = __commonJS({
|
|
|
57510
57612
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
57511
57613
|
* that already exists in the map.
|
|
57512
57614
|
*/
|
|
57513
|
-
addIn(
|
|
57514
|
-
if (isEmptyPath(
|
|
57615
|
+
addIn(path56, value) {
|
|
57616
|
+
if (isEmptyPath(path56))
|
|
57515
57617
|
this.add(value);
|
|
57516
57618
|
else {
|
|
57517
|
-
const [key, ...rest] =
|
|
57619
|
+
const [key, ...rest] = path56;
|
|
57518
57620
|
const node = this.get(key, true);
|
|
57519
57621
|
if (identity.isCollection(node))
|
|
57520
57622
|
node.addIn(rest, value);
|
|
@@ -57528,8 +57630,8 @@ var require_Collection = __commonJS({
|
|
|
57528
57630
|
* Removes a value from the collection.
|
|
57529
57631
|
* @returns `true` if the item was found and removed.
|
|
57530
57632
|
*/
|
|
57531
|
-
deleteIn(
|
|
57532
|
-
const [key, ...rest] =
|
|
57633
|
+
deleteIn(path56) {
|
|
57634
|
+
const [key, ...rest] = path56;
|
|
57533
57635
|
if (rest.length === 0)
|
|
57534
57636
|
return this.delete(key);
|
|
57535
57637
|
const node = this.get(key, true);
|
|
@@ -57543,8 +57645,8 @@ var require_Collection = __commonJS({
|
|
|
57543
57645
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
57544
57646
|
* `true` (collections are always returned intact).
|
|
57545
57647
|
*/
|
|
57546
|
-
getIn(
|
|
57547
|
-
const [key, ...rest] =
|
|
57648
|
+
getIn(path56, keepScalar) {
|
|
57649
|
+
const [key, ...rest] = path56;
|
|
57548
57650
|
const node = this.get(key, true);
|
|
57549
57651
|
if (rest.length === 0)
|
|
57550
57652
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -57562,8 +57664,8 @@ var require_Collection = __commonJS({
|
|
|
57562
57664
|
/**
|
|
57563
57665
|
* Checks if the collection includes a value with the key `key`.
|
|
57564
57666
|
*/
|
|
57565
|
-
hasIn(
|
|
57566
|
-
const [key, ...rest] =
|
|
57667
|
+
hasIn(path56) {
|
|
57668
|
+
const [key, ...rest] = path56;
|
|
57567
57669
|
if (rest.length === 0)
|
|
57568
57670
|
return this.has(key);
|
|
57569
57671
|
const node = this.get(key, true);
|
|
@@ -57573,8 +57675,8 @@ var require_Collection = __commonJS({
|
|
|
57573
57675
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
57574
57676
|
* boolean to add/remove the item from the set.
|
|
57575
57677
|
*/
|
|
57576
|
-
setIn(
|
|
57577
|
-
const [key, ...rest] =
|
|
57678
|
+
setIn(path56, value) {
|
|
57679
|
+
const [key, ...rest] = path56;
|
|
57578
57680
|
if (rest.length === 0) {
|
|
57579
57681
|
this.set(key, value);
|
|
57580
57682
|
} else {
|
|
@@ -60088,9 +60190,9 @@ var require_Document = __commonJS({
|
|
|
60088
60190
|
this.contents.add(value);
|
|
60089
60191
|
}
|
|
60090
60192
|
/** Adds a value to the document. */
|
|
60091
|
-
addIn(
|
|
60193
|
+
addIn(path56, value) {
|
|
60092
60194
|
if (assertCollection(this.contents))
|
|
60093
|
-
this.contents.addIn(
|
|
60195
|
+
this.contents.addIn(path56, value);
|
|
60094
60196
|
}
|
|
60095
60197
|
/**
|
|
60096
60198
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -60165,14 +60267,14 @@ var require_Document = __commonJS({
|
|
|
60165
60267
|
* Removes a value from the document.
|
|
60166
60268
|
* @returns `true` if the item was found and removed.
|
|
60167
60269
|
*/
|
|
60168
|
-
deleteIn(
|
|
60169
|
-
if (Collection.isEmptyPath(
|
|
60270
|
+
deleteIn(path56) {
|
|
60271
|
+
if (Collection.isEmptyPath(path56)) {
|
|
60170
60272
|
if (this.contents == null)
|
|
60171
60273
|
return false;
|
|
60172
60274
|
this.contents = null;
|
|
60173
60275
|
return true;
|
|
60174
60276
|
}
|
|
60175
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
60277
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path56) : false;
|
|
60176
60278
|
}
|
|
60177
60279
|
/**
|
|
60178
60280
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -60187,10 +60289,10 @@ var require_Document = __commonJS({
|
|
|
60187
60289
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
60188
60290
|
* `true` (collections are always returned intact).
|
|
60189
60291
|
*/
|
|
60190
|
-
getIn(
|
|
60191
|
-
if (Collection.isEmptyPath(
|
|
60292
|
+
getIn(path56, keepScalar) {
|
|
60293
|
+
if (Collection.isEmptyPath(path56))
|
|
60192
60294
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
60193
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
60295
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path56, keepScalar) : void 0;
|
|
60194
60296
|
}
|
|
60195
60297
|
/**
|
|
60196
60298
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -60201,10 +60303,10 @@ var require_Document = __commonJS({
|
|
|
60201
60303
|
/**
|
|
60202
60304
|
* Checks if the document includes a value at `path`.
|
|
60203
60305
|
*/
|
|
60204
|
-
hasIn(
|
|
60205
|
-
if (Collection.isEmptyPath(
|
|
60306
|
+
hasIn(path56) {
|
|
60307
|
+
if (Collection.isEmptyPath(path56))
|
|
60206
60308
|
return this.contents !== void 0;
|
|
60207
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
60309
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path56) : false;
|
|
60208
60310
|
}
|
|
60209
60311
|
/**
|
|
60210
60312
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -60221,13 +60323,13 @@ var require_Document = __commonJS({
|
|
|
60221
60323
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
60222
60324
|
* boolean to add/remove the item from the set.
|
|
60223
60325
|
*/
|
|
60224
|
-
setIn(
|
|
60225
|
-
if (Collection.isEmptyPath(
|
|
60326
|
+
setIn(path56, value) {
|
|
60327
|
+
if (Collection.isEmptyPath(path56)) {
|
|
60226
60328
|
this.contents = value;
|
|
60227
60329
|
} else if (this.contents == null) {
|
|
60228
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
60330
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path56), value);
|
|
60229
60331
|
} else if (assertCollection(this.contents)) {
|
|
60230
|
-
this.contents.setIn(
|
|
60332
|
+
this.contents.setIn(path56, value);
|
|
60231
60333
|
}
|
|
60232
60334
|
}
|
|
60233
60335
|
/**
|
|
@@ -62190,9 +62292,9 @@ var require_cst_visit = __commonJS({
|
|
|
62190
62292
|
visit.BREAK = BREAK;
|
|
62191
62293
|
visit.SKIP = SKIP;
|
|
62192
62294
|
visit.REMOVE = REMOVE;
|
|
62193
|
-
visit.itemAtPath = (cst,
|
|
62295
|
+
visit.itemAtPath = (cst, path56) => {
|
|
62194
62296
|
let item = cst;
|
|
62195
|
-
for (const [field, index] of
|
|
62297
|
+
for (const [field, index] of path56) {
|
|
62196
62298
|
const tok = item == null ? void 0 : item[field];
|
|
62197
62299
|
if (tok && "items" in tok) {
|
|
62198
62300
|
item = tok.items[index];
|
|
@@ -62201,23 +62303,23 @@ var require_cst_visit = __commonJS({
|
|
|
62201
62303
|
}
|
|
62202
62304
|
return item;
|
|
62203
62305
|
};
|
|
62204
|
-
visit.parentCollection = (cst,
|
|
62205
|
-
const parent = visit.itemAtPath(cst,
|
|
62206
|
-
const field =
|
|
62306
|
+
visit.parentCollection = (cst, path56) => {
|
|
62307
|
+
const parent = visit.itemAtPath(cst, path56.slice(0, -1));
|
|
62308
|
+
const field = path56[path56.length - 1][0];
|
|
62207
62309
|
const coll = parent == null ? void 0 : parent[field];
|
|
62208
62310
|
if (coll && "items" in coll)
|
|
62209
62311
|
return coll;
|
|
62210
62312
|
throw new Error("Parent collection not found");
|
|
62211
62313
|
};
|
|
62212
|
-
function _visit(
|
|
62213
|
-
let ctrl = visitor(item,
|
|
62314
|
+
function _visit(path56, item, visitor) {
|
|
62315
|
+
let ctrl = visitor(item, path56);
|
|
62214
62316
|
if (typeof ctrl === "symbol")
|
|
62215
62317
|
return ctrl;
|
|
62216
62318
|
for (const field of ["key", "value"]) {
|
|
62217
62319
|
const token = item[field];
|
|
62218
62320
|
if (token && "items" in token) {
|
|
62219
62321
|
for (let i = 0; i < token.items.length; ++i) {
|
|
62220
|
-
const ci = _visit(Object.freeze(
|
|
62322
|
+
const ci = _visit(Object.freeze(path56.concat([[field, i]])), token.items[i], visitor);
|
|
62221
62323
|
if (typeof ci === "number")
|
|
62222
62324
|
i = ci - 1;
|
|
62223
62325
|
else if (ci === BREAK)
|
|
@@ -62228,10 +62330,10 @@ var require_cst_visit = __commonJS({
|
|
|
62228
62330
|
}
|
|
62229
62331
|
}
|
|
62230
62332
|
if (typeof ctrl === "function" && field === "key")
|
|
62231
|
-
ctrl = ctrl(item,
|
|
62333
|
+
ctrl = ctrl(item, path56);
|
|
62232
62334
|
}
|
|
62233
62335
|
}
|
|
62234
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
62336
|
+
return typeof ctrl === "function" ? ctrl(item, path56) : ctrl;
|
|
62235
62337
|
}
|
|
62236
62338
|
exports.visit = visit;
|
|
62237
62339
|
}
|
|
@@ -63518,14 +63620,14 @@ var require_parser = __commonJS({
|
|
|
63518
63620
|
case "scalar":
|
|
63519
63621
|
case "single-quoted-scalar":
|
|
63520
63622
|
case "double-quoted-scalar": {
|
|
63521
|
-
const
|
|
63623
|
+
const fs53 = this.flowScalar(this.type);
|
|
63522
63624
|
if (atNextItem || it.value) {
|
|
63523
|
-
map2.items.push({ start, key:
|
|
63625
|
+
map2.items.push({ start, key: fs53, sep: [] });
|
|
63524
63626
|
this.onKeyLine = true;
|
|
63525
63627
|
} else if (it.sep) {
|
|
63526
|
-
this.stack.push(
|
|
63628
|
+
this.stack.push(fs53);
|
|
63527
63629
|
} else {
|
|
63528
|
-
Object.assign(it, { key:
|
|
63630
|
+
Object.assign(it, { key: fs53, sep: [] });
|
|
63529
63631
|
this.onKeyLine = true;
|
|
63530
63632
|
}
|
|
63531
63633
|
return;
|
|
@@ -63654,13 +63756,13 @@ var require_parser = __commonJS({
|
|
|
63654
63756
|
case "scalar":
|
|
63655
63757
|
case "single-quoted-scalar":
|
|
63656
63758
|
case "double-quoted-scalar": {
|
|
63657
|
-
const
|
|
63759
|
+
const fs53 = this.flowScalar(this.type);
|
|
63658
63760
|
if (!it || it.value)
|
|
63659
|
-
fc.items.push({ start: [], key:
|
|
63761
|
+
fc.items.push({ start: [], key: fs53, sep: [] });
|
|
63660
63762
|
else if (it.sep)
|
|
63661
|
-
this.stack.push(
|
|
63763
|
+
this.stack.push(fs53);
|
|
63662
63764
|
else
|
|
63663
|
-
Object.assign(it, { key:
|
|
63765
|
+
Object.assign(it, { key: fs53, sep: [] });
|
|
63664
63766
|
return;
|
|
63665
63767
|
}
|
|
63666
63768
|
case "flow-map-end":
|
|
@@ -64026,7 +64128,7 @@ var require_pend = __commonJS({
|
|
|
64026
64128
|
// node_modules/yauzl/fd-slicer.js
|
|
64027
64129
|
var require_fd_slicer = __commonJS({
|
|
64028
64130
|
"node_modules/yauzl/fd-slicer.js"(exports) {
|
|
64029
|
-
var
|
|
64131
|
+
var fs53 = __require("fs");
|
|
64030
64132
|
var util2 = __require("util");
|
|
64031
64133
|
var stream = __require("stream");
|
|
64032
64134
|
var Readable2 = stream.Readable;
|
|
@@ -64046,7 +64148,7 @@ var require_fd_slicer = __commonJS({
|
|
|
64046
64148
|
FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
|
|
64047
64149
|
var self2 = this;
|
|
64048
64150
|
self2.pend.go(function(cb) {
|
|
64049
|
-
|
|
64151
|
+
fs53.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
|
|
64050
64152
|
cb();
|
|
64051
64153
|
callback(err, bytesRead, buffer2);
|
|
64052
64154
|
});
|
|
@@ -64063,7 +64165,7 @@ var require_fd_slicer = __commonJS({
|
|
|
64063
64165
|
self2.refCount -= 1;
|
|
64064
64166
|
if (self2.refCount < 0) throw new Error("invalid unref");
|
|
64065
64167
|
if (self2.refCount > 0) return;
|
|
64066
|
-
|
|
64168
|
+
fs53.close(self2.fd, onCloseDone);
|
|
64067
64169
|
function onCloseDone(err) {
|
|
64068
64170
|
if (err) {
|
|
64069
64171
|
self2.emit("error", err);
|
|
@@ -64095,7 +64197,7 @@ var require_fd_slicer = __commonJS({
|
|
|
64095
64197
|
}
|
|
64096
64198
|
self2.context.pend.go(function(cb) {
|
|
64097
64199
|
var buffer = Buffer.allocUnsafe(toRead);
|
|
64098
|
-
|
|
64200
|
+
fs53.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
|
|
64099
64201
|
if (err) {
|
|
64100
64202
|
self2.destroy(err);
|
|
64101
64203
|
} else if (bytesRead === 0) {
|
|
@@ -64455,7 +64557,7 @@ var require_crc32 = __commonJS({
|
|
|
64455
64557
|
// node_modules/yauzl/index.js
|
|
64456
64558
|
var require_yauzl = __commonJS({
|
|
64457
64559
|
"node_modules/yauzl/index.js"(exports) {
|
|
64458
|
-
var
|
|
64560
|
+
var fs53 = __require("fs");
|
|
64459
64561
|
var zlib = __require("zlib");
|
|
64460
64562
|
var fd_slicer = require_fd_slicer();
|
|
64461
64563
|
var util2 = __require("util");
|
|
@@ -64480,9 +64582,9 @@ var require_yauzl = __commonJS({
|
|
|
64480
64582
|
exports.Entry = Entry;
|
|
64481
64583
|
exports.LocalFileHeader = LocalFileHeader;
|
|
64482
64584
|
exports.RandomAccessReader = RandomAccessReader;
|
|
64483
|
-
function openPromise(
|
|
64585
|
+
function openPromise(path56, options3) {
|
|
64484
64586
|
return new Promise((resolve, reject) => {
|
|
64485
|
-
open(
|
|
64587
|
+
open(path56, { ...options3, lazyEntries: true }, function(err, zipfile) {
|
|
64486
64588
|
if (err) return reject(err);
|
|
64487
64589
|
resolve(zipfile);
|
|
64488
64590
|
});
|
|
@@ -64512,7 +64614,7 @@ var require_yauzl = __commonJS({
|
|
|
64512
64614
|
});
|
|
64513
64615
|
});
|
|
64514
64616
|
}
|
|
64515
|
-
function open(
|
|
64617
|
+
function open(path56, options3, callback) {
|
|
64516
64618
|
if (typeof options3 === "function") {
|
|
64517
64619
|
callback = options3;
|
|
64518
64620
|
options3 = null;
|
|
@@ -64524,10 +64626,10 @@ var require_yauzl = __commonJS({
|
|
|
64524
64626
|
if (options3.validateEntrySizes == null) options3.validateEntrySizes = true;
|
|
64525
64627
|
if (options3.strictFileNames == null) options3.strictFileNames = false;
|
|
64526
64628
|
if (callback == null) callback = defaultCallback;
|
|
64527
|
-
|
|
64629
|
+
fs53.open(path56, "r", function(err, fd) {
|
|
64528
64630
|
if (err) return callback(err);
|
|
64529
64631
|
fromFd(fd, options3, function(err2, zipfile) {
|
|
64530
|
-
if (err2)
|
|
64632
|
+
if (err2) fs53.close(fd, defaultCallback);
|
|
64531
64633
|
callback(err2, zipfile);
|
|
64532
64634
|
});
|
|
64533
64635
|
});
|
|
@@ -64544,7 +64646,7 @@ var require_yauzl = __commonJS({
|
|
|
64544
64646
|
if (options3.validateEntrySizes == null) options3.validateEntrySizes = true;
|
|
64545
64647
|
if (options3.strictFileNames == null) options3.strictFileNames = false;
|
|
64546
64648
|
if (callback == null) callback = defaultCallback;
|
|
64547
|
-
|
|
64649
|
+
fs53.fstat(fd, function(err, stats) {
|
|
64548
64650
|
if (err) return callback(err);
|
|
64549
64651
|
var reader = new fd_slicer.FdSlicer(fd);
|
|
64550
64652
|
fromRandomAccessReader(reader, stats.size, options3, callback);
|
|
@@ -65318,9 +65420,9 @@ init_mcp();
|
|
|
65318
65420
|
init_config();
|
|
65319
65421
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
65320
65422
|
import crypto5 from "node:crypto";
|
|
65321
|
-
import
|
|
65322
|
-
import
|
|
65323
|
-
import
|
|
65423
|
+
import fs51 from "node:fs";
|
|
65424
|
+
import os12 from "node:os";
|
|
65425
|
+
import path53 from "node:path";
|
|
65324
65426
|
import readline from "node:readline/promises";
|
|
65325
65427
|
import { stdin as input, stdout as output } from "node:process";
|
|
65326
65428
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
@@ -65480,21 +65582,21 @@ init_runtimeLogs();
|
|
|
65480
65582
|
|
|
65481
65583
|
// src/maker/cli/preview.ts
|
|
65482
65584
|
init_protocol2();
|
|
65483
|
-
import
|
|
65484
|
-
import
|
|
65585
|
+
import fs36 from "node:fs";
|
|
65586
|
+
import path37 from "node:path";
|
|
65485
65587
|
import { randomBytes as randomBytes3, randomUUID as randomUUID6 } from "node:crypto";
|
|
65486
65588
|
|
|
65487
65589
|
// src/maker/preview/installation.ts
|
|
65488
65590
|
init_python();
|
|
65489
65591
|
init_protocol2();
|
|
65490
|
-
import
|
|
65491
|
-
import
|
|
65592
|
+
import fs33 from "node:fs";
|
|
65593
|
+
import path34 from "node:path";
|
|
65492
65594
|
import { createHash as createHash5, randomUUID as randomUUID5 } from "node:crypto";
|
|
65493
65595
|
|
|
65494
65596
|
// src/maker/preview/runtime.ts
|
|
65495
65597
|
init_protocol2();
|
|
65496
|
-
import
|
|
65497
|
-
import
|
|
65598
|
+
import fs31 from "node:fs";
|
|
65599
|
+
import path32 from "node:path";
|
|
65498
65600
|
import { spawn as spawn6 } from "node:child_process";
|
|
65499
65601
|
import { StringDecoder } from "node:string_decoder";
|
|
65500
65602
|
|
|
@@ -66276,13 +66378,46 @@ function requestPreviewServer(project, auth2, signal, options3 = {}) {
|
|
|
66276
66378
|
});
|
|
66277
66379
|
}
|
|
66278
66380
|
|
|
66381
|
+
// src/maker/preview/sourceAlias.ts
|
|
66382
|
+
import fs30 from "node:fs";
|
|
66383
|
+
import os5 from "node:os";
|
|
66384
|
+
import path31 from "node:path";
|
|
66385
|
+
function createPreviewSourceAlias(source, platform = process.platform, temporaryDirectory = os5.tmpdir()) {
|
|
66386
|
+
if (platform !== "win32") return { source, close: () => {
|
|
66387
|
+
} };
|
|
66388
|
+
const target = fs30.realpathSync(source);
|
|
66389
|
+
const directory = fs30.mkdtempSync(path31.join(temporaryDirectory, "maker-preview-"));
|
|
66390
|
+
const alias = path31.join(directory, "source");
|
|
66391
|
+
try {
|
|
66392
|
+
if (alias.length > 180)
|
|
66393
|
+
throw new Error("Windows preview needs a shorter TEMP directory (Runtime path limit).");
|
|
66394
|
+
fs30.symlinkSync(target, alias, "junction");
|
|
66395
|
+
} catch (error2) {
|
|
66396
|
+
fs30.rmdirSync(directory);
|
|
66397
|
+
throw error2;
|
|
66398
|
+
}
|
|
66399
|
+
let closed = false;
|
|
66400
|
+
return {
|
|
66401
|
+
source: alias,
|
|
66402
|
+
close: () => {
|
|
66403
|
+
if (closed) return;
|
|
66404
|
+
if (!fs30.lstatSync(alias).isSymbolicLink() || fs30.realpathSync(alias) !== target)
|
|
66405
|
+
throw new Error("Preview source alias changed; refusing cleanup.");
|
|
66406
|
+
fs30.unlinkSync(alias);
|
|
66407
|
+
fs30.rmdirSync(directory);
|
|
66408
|
+
closed = true;
|
|
66409
|
+
}
|
|
66410
|
+
};
|
|
66411
|
+
}
|
|
66412
|
+
|
|
66279
66413
|
// src/maker/preview/runtime.ts
|
|
66280
66414
|
var PREVIEW_TIMEOUT_MS = 3e4;
|
|
66415
|
+
var RUNTIME_STARTUP_SETTLE_MS = 3e3;
|
|
66281
66416
|
async function probeRuntime(executable, signal) {
|
|
66282
66417
|
if (signal == null ? void 0 : signal.aborted) throw new Error("CANCELLED");
|
|
66283
|
-
if (!
|
|
66418
|
+
if (!path32.isAbsolute(executable) || !fs31.statSync(executable).isFile())
|
|
66284
66419
|
throw new Error("Runtime must be an absolute executable file.");
|
|
66285
|
-
|
|
66420
|
+
fs31.accessSync(executable, process.platform === "win32" ? fs31.constants.R_OK : fs31.constants.X_OK);
|
|
66286
66421
|
return {
|
|
66287
66422
|
protocol_version: 0,
|
|
66288
66423
|
runtime_version: "unknown",
|
|
@@ -66303,12 +66438,14 @@ async function preflightPreview(_executable, project, signal) {
|
|
|
66303
66438
|
};
|
|
66304
66439
|
}
|
|
66305
66440
|
var PreviewRuntime = class {
|
|
66306
|
-
constructor(executable, identity, directory, changed, timeout = PREVIEW_TIMEOUT_MS) {
|
|
66441
|
+
constructor(executable, identity, directory, changed, timeout = PREVIEW_TIMEOUT_MS, launching = () => {
|
|
66442
|
+
}) {
|
|
66307
66443
|
this.executable = executable;
|
|
66308
66444
|
this.identity = identity;
|
|
66309
66445
|
this.directory = directory;
|
|
66310
66446
|
this.changed = changed;
|
|
66311
66447
|
this.timeout = timeout;
|
|
66448
|
+
this.launching = launching;
|
|
66312
66449
|
this.stopping = false;
|
|
66313
66450
|
this.abort = new AbortController();
|
|
66314
66451
|
this.closed = Promise.resolve();
|
|
@@ -66353,11 +66490,11 @@ var PreviewRuntime = class {
|
|
|
66353
66490
|
let cacheRoot;
|
|
66354
66491
|
if (this.launchMode === "loopback_manifest") {
|
|
66355
66492
|
this.assets = await startPreviewAssetServer(source, this.abort.signal);
|
|
66356
|
-
cacheRoot =
|
|
66493
|
+
cacheRoot = path32.join(storage, "runtime-cache");
|
|
66357
66494
|
try {
|
|
66358
|
-
|
|
66359
|
-
this.assetCache =
|
|
66360
|
-
|
|
66495
|
+
fs31.mkdirSync(cacheRoot, { recursive: true, mode: 448 });
|
|
66496
|
+
this.assetCache = path32.join(
|
|
66497
|
+
fs31.realpathSync(cacheRoot),
|
|
66361
66498
|
this.assets.url.slice("http://".length).replace(":", "_")
|
|
66362
66499
|
);
|
|
66363
66500
|
} catch (error2) {
|
|
@@ -66371,10 +66508,13 @@ var PreviewRuntime = class {
|
|
|
66371
66508
|
}
|
|
66372
66509
|
let child;
|
|
66373
66510
|
try {
|
|
66511
|
+
this.sourceAlias = createPreviewSourceAlias(source);
|
|
66512
|
+
const runtimeSource = this.sourceAlias.source;
|
|
66513
|
+
this.launching();
|
|
66374
66514
|
child = spawn6(
|
|
66375
66515
|
this.executable,
|
|
66376
66516
|
[
|
|
66377
|
-
...this.assets ? ["-game_url=" + this.assets.url] : [entry, "-tapcode_dir=" +
|
|
66517
|
+
...this.assets ? ["-game_url=" + this.assets.url] : [entry, "-tapcode_dir=" + runtimeSource],
|
|
66378
66518
|
...cacheRoot ? ["-game_path=" + cacheRoot] : [],
|
|
66379
66519
|
"-skip_login",
|
|
66380
66520
|
...server ? previewNetworkArgs(server) : [],
|
|
@@ -66383,10 +66523,11 @@ var PreviewRuntime = class {
|
|
|
66383
66523
|
"-width=" + window2.width,
|
|
66384
66524
|
"-height=" + window2.height
|
|
66385
66525
|
],
|
|
66386
|
-
{ cwd:
|
|
66526
|
+
{ cwd: runtimeSource, stdio: ["pipe", "pipe", "pipe"], windowsHide: false }
|
|
66387
66527
|
);
|
|
66388
66528
|
} catch (error2) {
|
|
66389
66529
|
await ((_b = this.assets) == null ? void 0 : _b.close());
|
|
66530
|
+
this.clearSourceAlias();
|
|
66390
66531
|
throw error2;
|
|
66391
66532
|
}
|
|
66392
66533
|
this.child = child;
|
|
@@ -66394,52 +66535,78 @@ var PreviewRuntime = class {
|
|
|
66394
66535
|
(resolve) => child.once("close", () => {
|
|
66395
66536
|
void (async () => {
|
|
66396
66537
|
var _a4;
|
|
66397
|
-
|
|
66538
|
+
try {
|
|
66539
|
+
await ((_a4 = this.assets) == null ? void 0 : _a4.close());
|
|
66540
|
+
} catch (error2) {
|
|
66541
|
+
this.recordError(String(error2));
|
|
66542
|
+
}
|
|
66398
66543
|
this.clearAssetCache();
|
|
66399
|
-
this.
|
|
66400
|
-
|
|
66544
|
+
this.clearSourceAlias();
|
|
66545
|
+
try {
|
|
66546
|
+
this.changed(this.stopping || child.exitCode === 0 ? "stopped" : "failed");
|
|
66547
|
+
} catch (error2) {
|
|
66548
|
+
this.recordError(String(error2));
|
|
66549
|
+
} finally {
|
|
66550
|
+
resolve();
|
|
66551
|
+
}
|
|
66401
66552
|
})();
|
|
66402
66553
|
})
|
|
66403
66554
|
);
|
|
66404
66555
|
child.on("error", (error2) => {
|
|
66405
66556
|
this.recordError(error2.message);
|
|
66406
|
-
|
|
66557
|
+
try {
|
|
66558
|
+
this.changed("failed");
|
|
66559
|
+
} catch (persistenceError) {
|
|
66560
|
+
this.recordError(String(persistenceError));
|
|
66561
|
+
}
|
|
66407
66562
|
});
|
|
66408
66563
|
this.consume(child.stdout);
|
|
66409
66564
|
this.consume(child.stderr);
|
|
66410
|
-
|
|
66411
|
-
|
|
66412
|
-
|
|
66413
|
-
|
|
66414
|
-
|
|
66415
|
-
|
|
66416
|
-
|
|
66417
|
-
|
|
66418
|
-
|
|
66419
|
-
|
|
66420
|
-
|
|
66421
|
-
};
|
|
66422
|
-
const exited = () => failed(new Error("Runtime exited during startup. Read preview logs."));
|
|
66423
|
-
const deadline = setTimeout(
|
|
66424
|
-
() => failed(new Error("TIMEOUT: Runtime process did not start.")),
|
|
66425
|
-
this.timeout
|
|
66426
|
-
);
|
|
66427
|
-
child.once("error", failed);
|
|
66428
|
-
child.once("close", exited);
|
|
66429
|
-
child.once("spawn", () => {
|
|
66430
|
-
settle = setTimeout(() => {
|
|
66565
|
+
try {
|
|
66566
|
+
if (child.pid) this.launching(child.pid);
|
|
66567
|
+
await new Promise((resolve, reject) => {
|
|
66568
|
+
let settle;
|
|
66569
|
+
const cleanup = () => {
|
|
66570
|
+
clearTimeout(deadline);
|
|
66571
|
+
clearTimeout(settle);
|
|
66572
|
+
child.removeListener("error", failed);
|
|
66573
|
+
child.removeListener("close", exited);
|
|
66574
|
+
};
|
|
66575
|
+
const failed = (error2) => {
|
|
66431
66576
|
cleanup();
|
|
66432
|
-
|
|
66433
|
-
|
|
66434
|
-
|
|
66435
|
-
|
|
66436
|
-
|
|
66437
|
-
|
|
66577
|
+
reject(error2);
|
|
66578
|
+
};
|
|
66579
|
+
const exited = () => failed(new Error("Runtime exited during startup. Read preview logs."));
|
|
66580
|
+
const deadline = setTimeout(
|
|
66581
|
+
() => failed(new Error("TIMEOUT: Runtime process did not start.")),
|
|
66582
|
+
this.timeout
|
|
66583
|
+
);
|
|
66584
|
+
child.once("error", failed);
|
|
66585
|
+
child.once("close", exited);
|
|
66586
|
+
child.once("spawn", () => {
|
|
66587
|
+
settle = setTimeout(() => {
|
|
66588
|
+
cleanup();
|
|
66589
|
+
if (this.stopping || !this.processAlive)
|
|
66590
|
+
reject(new Error("CANCELLED: preview stopped."));
|
|
66591
|
+
else {
|
|
66592
|
+
try {
|
|
66593
|
+
this.changed("running");
|
|
66594
|
+
resolve();
|
|
66595
|
+
} catch (error2) {
|
|
66596
|
+
failed(error2);
|
|
66597
|
+
}
|
|
66598
|
+
}
|
|
66599
|
+
}, RUNTIME_STARTUP_SETTLE_MS);
|
|
66600
|
+
});
|
|
66438
66601
|
});
|
|
66439
|
-
}
|
|
66440
|
-
|
|
66602
|
+
} catch (error2) {
|
|
66603
|
+
try {
|
|
66604
|
+
await this.stop();
|
|
66605
|
+
} catch (cleanupError) {
|
|
66606
|
+
throw new Error(String(error2) + "; Runtime cleanup is unverified: " + String(cleanupError));
|
|
66607
|
+
}
|
|
66441
66608
|
throw error2;
|
|
66442
|
-
}
|
|
66609
|
+
}
|
|
66443
66610
|
}
|
|
66444
66611
|
recordError(message) {
|
|
66445
66612
|
this.errors.push(String(sanitizeDiagnosticValue(message)).slice(0, 16384));
|
|
@@ -66448,15 +66615,24 @@ var PreviewRuntime = class {
|
|
|
66448
66615
|
clearAssetCache() {
|
|
66449
66616
|
if (!this.assetCache) return;
|
|
66450
66617
|
try {
|
|
66451
|
-
const parent =
|
|
66452
|
-
if (
|
|
66453
|
-
|
|
66454
|
-
if (!
|
|
66618
|
+
const parent = path32.dirname(this.assetCache);
|
|
66619
|
+
if (fs31.existsSync(parent) && fs31.realpathSync(parent) === parent) {
|
|
66620
|
+
fs31.rmSync(this.assetCache, { recursive: true, force: true });
|
|
66621
|
+
if (!fs31.readdirSync(parent).length) fs31.rmdirSync(parent);
|
|
66455
66622
|
}
|
|
66456
66623
|
} catch {
|
|
66457
66624
|
this.recordError("Could not remove this round of local preview download cache.");
|
|
66458
66625
|
}
|
|
66459
66626
|
}
|
|
66627
|
+
clearSourceAlias() {
|
|
66628
|
+
var _a3;
|
|
66629
|
+
try {
|
|
66630
|
+
(_a3 = this.sourceAlias) == null ? void 0 : _a3.close();
|
|
66631
|
+
this.sourceAlias = void 0;
|
|
66632
|
+
} catch (error2) {
|
|
66633
|
+
this.recordError(String(error2));
|
|
66634
|
+
}
|
|
66635
|
+
}
|
|
66460
66636
|
consume(stream) {
|
|
66461
66637
|
const decoder = new StringDecoder("utf8");
|
|
66462
66638
|
let buffer = "";
|
|
@@ -66523,8 +66699,8 @@ var PreviewRuntime = class {
|
|
|
66523
66699
|
};
|
|
66524
66700
|
|
|
66525
66701
|
// src/maker/preview/runtimeResources.ts
|
|
66526
|
-
import
|
|
66527
|
-
import
|
|
66702
|
+
import fs32 from "node:fs";
|
|
66703
|
+
import path33 from "node:path";
|
|
66528
66704
|
var FALLBACK_FONT = "MiSans-Regular.ttf";
|
|
66529
66705
|
function defaultFontCandidates(platform) {
|
|
66530
66706
|
if (platform === "darwin") {
|
|
@@ -66536,44 +66712,44 @@ function defaultFontCandidates(platform) {
|
|
|
66536
66712
|
if (platform === "win32") {
|
|
66537
66713
|
const windows = process.env.WINDIR || process.env.SystemRoot || "C:\\Windows";
|
|
66538
66714
|
return [
|
|
66539
|
-
|
|
66540
|
-
|
|
66541
|
-
|
|
66715
|
+
path33.join(windows, "Fonts", "Deng.ttf"),
|
|
66716
|
+
path33.join(windows, "Fonts", "Dengb.ttf"),
|
|
66717
|
+
path33.join(windows, "Fonts", "msyh.ttc")
|
|
66542
66718
|
];
|
|
66543
66719
|
}
|
|
66544
66720
|
return [];
|
|
66545
66721
|
}
|
|
66546
66722
|
function existingFile(filename2) {
|
|
66547
66723
|
try {
|
|
66548
|
-
return
|
|
66724
|
+
return fs32.statSync(filename2).isFile();
|
|
66549
66725
|
} catch {
|
|
66550
66726
|
return false;
|
|
66551
66727
|
}
|
|
66552
66728
|
}
|
|
66553
66729
|
function ensurePreviewRuntimeResources(executable, options3 = {}) {
|
|
66554
|
-
const runtimeRoot =
|
|
66555
|
-
const fonts =
|
|
66556
|
-
const legacyFonts =
|
|
66730
|
+
const runtimeRoot = path33.dirname(fs32.realpathSync(executable));
|
|
66731
|
+
const fonts = path33.join(runtimeRoot, "Res", "Fonts");
|
|
66732
|
+
const legacyFonts = path33.join(runtimeRoot, "Data", "Fonts");
|
|
66557
66733
|
for (const directory of [
|
|
66558
|
-
|
|
66734
|
+
path33.join(runtimeRoot, "Data", "LuaScripts"),
|
|
66559
66735
|
legacyFonts,
|
|
66560
66736
|
fonts,
|
|
66561
|
-
|
|
66737
|
+
path33.join(runtimeRoot, "CoreData")
|
|
66562
66738
|
]) {
|
|
66563
|
-
|
|
66739
|
+
fs32.mkdirSync(directory, { recursive: true });
|
|
66564
66740
|
}
|
|
66565
|
-
const target =
|
|
66566
|
-
if (
|
|
66741
|
+
const target = path33.join(fonts, FALLBACK_FONT);
|
|
66742
|
+
if (fs32.existsSync(target)) return { fallbackFont: "existing", warnings: [] };
|
|
66567
66743
|
const platform = options3.platform || process.platform;
|
|
66568
66744
|
const candidates = [
|
|
66569
|
-
|
|
66745
|
+
path33.join(legacyFonts, FALLBACK_FONT),
|
|
66570
66746
|
...options3.fontCandidates || defaultFontCandidates(platform)
|
|
66571
66747
|
];
|
|
66572
66748
|
const copyErrors = [];
|
|
66573
66749
|
for (const candidate of candidates) {
|
|
66574
66750
|
if (!existingFile(candidate)) continue;
|
|
66575
66751
|
try {
|
|
66576
|
-
|
|
66752
|
+
fs32.copyFileSync(candidate, target, fs32.constants.COPYFILE_EXCL);
|
|
66577
66753
|
return { fallbackFont: "copied", fallbackFontSource: candidate, warnings: [] };
|
|
66578
66754
|
} catch (error2) {
|
|
66579
66755
|
if (error2.code === "EEXIST") {
|
|
@@ -66807,10 +66983,10 @@ function processPresence(pid) {
|
|
|
66807
66983
|
|
|
66808
66984
|
// src/maker/preview/installation.ts
|
|
66809
66985
|
function readInstallation(filename2) {
|
|
66810
|
-
if (!
|
|
66986
|
+
if (!fs33.existsSync(filename2)) return void 0;
|
|
66811
66987
|
try {
|
|
66812
|
-
const value = JSON.parse(
|
|
66813
|
-
if (value.install_state !== "ready" || !value.executable || !
|
|
66988
|
+
const value = JSON.parse(fs33.readFileSync(filename2, "utf8"));
|
|
66989
|
+
if (value.install_state !== "ready" || !value.executable || !path34.isAbsolute(value.executable) || !fs33.statSync(value.executable).isFile()) {
|
|
66814
66990
|
return void 0;
|
|
66815
66991
|
}
|
|
66816
66992
|
return value;
|
|
@@ -66819,27 +66995,27 @@ function readInstallation(filename2) {
|
|
|
66819
66995
|
}
|
|
66820
66996
|
}
|
|
66821
66997
|
function isInside(directory, filename2) {
|
|
66822
|
-
const relative =
|
|
66823
|
-
return relative !== "" && !relative.startsWith(".." +
|
|
66998
|
+
const relative = path34.relative(directory, filename2);
|
|
66999
|
+
return relative !== "" && !relative.startsWith(".." + path34.sep) && !path34.isAbsolute(relative);
|
|
66824
67000
|
}
|
|
66825
67001
|
function legacyPreviewInstallation(project) {
|
|
66826
67002
|
var _a3;
|
|
66827
|
-
const root2 =
|
|
66828
|
-
if (!
|
|
66829
|
-
const entries =
|
|
67003
|
+
const root2 = path34.dirname(previewDirectory(project));
|
|
67004
|
+
if (!fs33.existsSync(root2)) return void 0;
|
|
67005
|
+
const entries = fs33.readdirSync(root2, { withFileTypes: true }).filter((entry) => entry.isDirectory() && /^[a-f0-9]{64}$/.test(entry.name));
|
|
66830
67006
|
const candidates = [];
|
|
66831
67007
|
for (const entry of entries) {
|
|
66832
|
-
const directory =
|
|
66833
|
-
const filename2 =
|
|
67008
|
+
const directory = path34.join(root2, entry.name);
|
|
67009
|
+
const filename2 = path34.join(directory, "installation.json");
|
|
66834
67010
|
const installation = readInstallation(filename2);
|
|
66835
67011
|
if (!(installation == null ? void 0 : installation.executable)) continue;
|
|
66836
67012
|
try {
|
|
66837
|
-
const executable =
|
|
66838
|
-
const managedDirectory =
|
|
67013
|
+
const executable = fs33.realpathSync(installation.executable);
|
|
67014
|
+
const managedDirectory = fs33.realpathSync(directory);
|
|
66839
67015
|
if (!isInside(managedDirectory, executable)) continue;
|
|
66840
67016
|
candidates.push({
|
|
66841
67017
|
installation: { ...installation, executable },
|
|
66842
|
-
modified: Date.parse(installation.installed_at || "") ||
|
|
67018
|
+
modified: Date.parse(installation.installed_at || "") || fs33.statSync(filename2).mtimeMs
|
|
66843
67019
|
});
|
|
66844
67020
|
} catch {
|
|
66845
67021
|
}
|
|
@@ -66848,7 +67024,7 @@ function legacyPreviewInstallation(project) {
|
|
|
66848
67024
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.installation;
|
|
66849
67025
|
}
|
|
66850
67026
|
function previewInstallation(project) {
|
|
66851
|
-
const filename2 =
|
|
67027
|
+
const filename2 = path34.join(runtimeDirectory(), "installation.json");
|
|
66852
67028
|
const current = readInstallation(filename2);
|
|
66853
67029
|
if (current) return current;
|
|
66854
67030
|
const legacy = legacyPreviewInstallation(project);
|
|
@@ -66867,31 +67043,31 @@ function previewInstallation(project) {
|
|
|
66867
67043
|
}
|
|
66868
67044
|
}
|
|
66869
67045
|
async function withFileLock(directory, name, busyMessage, action) {
|
|
66870
|
-
|
|
66871
|
-
const filename2 =
|
|
67046
|
+
fs33.mkdirSync(directory, { recursive: true, mode: 448 });
|
|
67047
|
+
const filename2 = path34.join(directory, name);
|
|
66872
67048
|
let descriptor;
|
|
66873
67049
|
try {
|
|
66874
|
-
descriptor =
|
|
67050
|
+
descriptor = fs33.openSync(filename2, "wx", 384);
|
|
66875
67051
|
} catch {
|
|
66876
67052
|
throw new Error(
|
|
66877
67053
|
busyMessage + " If an interrupted command left a lock, verify it exited before removing " + filename2
|
|
66878
67054
|
);
|
|
66879
67055
|
}
|
|
66880
67056
|
try {
|
|
66881
|
-
|
|
67057
|
+
fs33.writeFileSync(
|
|
66882
67058
|
descriptor,
|
|
66883
67059
|
JSON.stringify({ pid: process.pid, created_at: (/* @__PURE__ */ new Date()).toISOString() })
|
|
66884
67060
|
);
|
|
66885
67061
|
return await action();
|
|
66886
67062
|
} finally {
|
|
66887
|
-
|
|
66888
|
-
|
|
67063
|
+
fs33.closeSync(descriptor);
|
|
67064
|
+
fs33.unlinkSync(filename2);
|
|
66889
67065
|
}
|
|
66890
67066
|
}
|
|
66891
67067
|
async function withPreviewLock(project, action) {
|
|
66892
67068
|
const directory = previewDirectory(project);
|
|
66893
|
-
|
|
66894
|
-
const filename2 =
|
|
67069
|
+
fs33.mkdirSync(directory, { recursive: true, mode: 448 });
|
|
67070
|
+
const filename2 = path34.join(fs33.realpathSync(directory), "operation.lock");
|
|
66895
67071
|
const busy = () => new Error("Another preview operation is in progress. Please retry after it finishes.");
|
|
66896
67072
|
const release = await claimRecoveryMutex(filename2, busy);
|
|
66897
67073
|
const identity = JSON.stringify({
|
|
@@ -66901,8 +67077,8 @@ async function withPreviewLock(project, action) {
|
|
|
66901
67077
|
});
|
|
66902
67078
|
let owned = false;
|
|
66903
67079
|
try {
|
|
66904
|
-
if (
|
|
66905
|
-
const previous =
|
|
67080
|
+
if (fs33.existsSync(filename2)) {
|
|
67081
|
+
const previous = fs33.readFileSync(filename2, "utf8");
|
|
66906
67082
|
let pid;
|
|
66907
67083
|
try {
|
|
66908
67084
|
pid = JSON.parse(previous).pid;
|
|
@@ -66912,9 +67088,9 @@ async function withPreviewLock(project, action) {
|
|
|
66912
67088
|
throw new Error(
|
|
66913
67089
|
"Preview operation ownership is still active or unverified. Confirm the previous command has exited before removing only: " + filename2
|
|
66914
67090
|
);
|
|
66915
|
-
|
|
67091
|
+
fs33.unlinkSync(filename2);
|
|
66916
67092
|
}
|
|
66917
|
-
|
|
67093
|
+
fs33.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
|
|
66918
67094
|
owned = true;
|
|
66919
67095
|
return await action();
|
|
66920
67096
|
} finally {
|
|
@@ -66927,7 +67103,7 @@ async function withPreviewLock(project, action) {
|
|
|
66927
67103
|
}
|
|
66928
67104
|
function removeOwnedPreviewLock(filename2, identity) {
|
|
66929
67105
|
try {
|
|
66930
|
-
if (
|
|
67106
|
+
if (fs33.readFileSync(filename2, "utf8") === identity) fs33.unlinkSync(filename2);
|
|
66931
67107
|
} catch (error2) {
|
|
66932
67108
|
if (error2.code !== "ENOENT") throw error2;
|
|
66933
67109
|
}
|
|
@@ -66941,17 +67117,17 @@ async function withRuntimeInstallLock(action) {
|
|
|
66941
67117
|
);
|
|
66942
67118
|
}
|
|
66943
67119
|
function activePreviewRuntimeDirectories(project) {
|
|
66944
|
-
const root2 =
|
|
66945
|
-
if (!
|
|
67120
|
+
const root2 = path34.dirname(previewDirectory(project));
|
|
67121
|
+
if (!fs33.existsSync(root2)) return [];
|
|
66946
67122
|
const protectedDirectories = [];
|
|
66947
|
-
for (const entry of
|
|
67123
|
+
for (const entry of fs33.readdirSync(root2, { withFileTypes: true })) {
|
|
66948
67124
|
if (!entry.isDirectory() || !/^[a-f0-9]{64}$/.test(entry.name)) continue;
|
|
66949
|
-
const filename2 =
|
|
66950
|
-
if (!
|
|
67125
|
+
const filename2 = path34.join(root2, entry.name, "session.json");
|
|
67126
|
+
if (!fs33.existsSync(filename2)) continue;
|
|
66951
67127
|
try {
|
|
66952
|
-
const record2 = JSON.parse(
|
|
66953
|
-
if (record2.state !== "stopped" && record2.executable &&
|
|
66954
|
-
protectedDirectories.push(
|
|
67128
|
+
const record2 = JSON.parse(fs33.readFileSync(filename2, "utf8"));
|
|
67129
|
+
if (record2.state !== "stopped" && record2.executable && path34.isAbsolute(record2.executable)) {
|
|
67130
|
+
protectedDirectories.push(path34.dirname(record2.executable));
|
|
66955
67131
|
}
|
|
66956
67132
|
} catch {
|
|
66957
67133
|
}
|
|
@@ -66977,12 +67153,12 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
66977
67153
|
}
|
|
66978
67154
|
}
|
|
66979
67155
|
const directory = runtimeDirectory();
|
|
66980
|
-
const unresolved =
|
|
66981
|
-
(entry) => entry.isDirectory() && entry.name.startsWith("runtime-") &&
|
|
67156
|
+
const unresolved = fs33.existsSync(directory) && fs33.readdirSync(directory, { withFileTypes: true }).find(
|
|
67157
|
+
(entry) => entry.isDirectory() && entry.name.startsWith("runtime-") && fs33.existsSync(path34.join(directory, entry.name, UNVERIFIED_CLEANUP_MARKER))
|
|
66982
67158
|
);
|
|
66983
67159
|
if (unresolved) {
|
|
66984
67160
|
throw new Error(
|
|
66985
|
-
"The previous installer cleanup is unverified. Confirm its processes have exited before removing only the marked directory: " +
|
|
67161
|
+
"The previous installer cleanup is unverified. Confirm its processes have exited before removing only the marked directory: " + path34.join(directory, unresolved.name)
|
|
66986
67162
|
);
|
|
66987
67163
|
}
|
|
66988
67164
|
const python = checkMakerPythonEnvironment();
|
|
@@ -66991,10 +67167,10 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
66991
67167
|
"Runtime installation needs Python and curl. Run taptap-maker python setup with host approval, then retry."
|
|
66992
67168
|
);
|
|
66993
67169
|
}
|
|
66994
|
-
const staging =
|
|
66995
|
-
|
|
66996
|
-
const installer =
|
|
66997
|
-
|
|
67170
|
+
const staging = path34.join(directory, "runtime-" + randomUUID5());
|
|
67171
|
+
fs33.mkdirSync(staging, { recursive: true, mode: 448 });
|
|
67172
|
+
const installer = path34.join(staging, "install-urhox-runtime.py");
|
|
67173
|
+
fs33.writeFileSync(installer, PREVIEW_INSTALLER_SOURCE, { mode: 384 });
|
|
66998
67174
|
const platform = process.platform === "win32" ? "win32" : "darwin";
|
|
66999
67175
|
try {
|
|
67000
67176
|
await runPreviewInstaller(
|
|
@@ -67007,14 +67183,14 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
67007
67183
|
signal
|
|
67008
67184
|
}
|
|
67009
67185
|
);
|
|
67010
|
-
const executable =
|
|
67011
|
-
|
|
67186
|
+
const executable = fs33.realpathSync(
|
|
67187
|
+
path34.join(staging, platform === "win32" ? "UrhoXRuntime.exe" : "UrhoXRuntime")
|
|
67012
67188
|
);
|
|
67013
67189
|
const resources2 = ensurePreviewRuntimeResources(executable);
|
|
67014
67190
|
const runtime = await probeRuntime(executable, signal);
|
|
67015
|
-
const archive =
|
|
67191
|
+
const archive = path34.join(staging, "UrhoXRuntime.zip");
|
|
67016
67192
|
const hash2 = createHash5("sha256");
|
|
67017
|
-
for await (const chunk of
|
|
67193
|
+
for await (const chunk of fs33.createReadStream(archive)) hash2.update(chunk);
|
|
67018
67194
|
const installation = {
|
|
67019
67195
|
install_state: "ready",
|
|
67020
67196
|
executable,
|
|
@@ -67024,19 +67200,19 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
67024
67200
|
warnings: resources2.warnings
|
|
67025
67201
|
};
|
|
67026
67202
|
const protectedDirectories = [staging, ...activePreviewRuntimeDirectories(project)];
|
|
67027
|
-
if (previous.executable) protectedDirectories.push(
|
|
67203
|
+
if (previous.executable) protectedDirectories.push(path34.dirname(previous.executable));
|
|
67028
67204
|
installation.warnings = [
|
|
67029
67205
|
...installation.warnings || [],
|
|
67030
67206
|
...trimPreviewCache(directory, "runtime-", 2, protectedDirectories)
|
|
67031
67207
|
];
|
|
67032
|
-
writePrivateJson(
|
|
67208
|
+
writePrivateJson(path34.join(directory, "installation.json"), installation);
|
|
67033
67209
|
return installation;
|
|
67034
67210
|
} catch (error2) {
|
|
67035
67211
|
const cleanupUnverified = error2.cleanupVerified === false;
|
|
67036
|
-
if (!cleanupUnverified)
|
|
67212
|
+
if (!cleanupUnverified) fs33.rmSync(staging, { recursive: true, force: true });
|
|
67037
67213
|
else
|
|
67038
|
-
|
|
67039
|
-
|
|
67214
|
+
fs33.writeFileSync(
|
|
67215
|
+
path34.join(staging, UNVERIFIED_CLEANUP_MARKER),
|
|
67040
67216
|
"Installer process ownership must be verified before cleanup.\n",
|
|
67041
67217
|
{ mode: 384 }
|
|
67042
67218
|
);
|
|
@@ -67048,10 +67224,10 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
67048
67224
|
|
|
67049
67225
|
// src/maker/preview/session.ts
|
|
67050
67226
|
init_protocol2();
|
|
67051
|
-
import
|
|
67052
|
-
import
|
|
67227
|
+
import fs34 from "node:fs";
|
|
67228
|
+
import path35 from "node:path";
|
|
67053
67229
|
import http2 from "node:http";
|
|
67054
|
-
import
|
|
67230
|
+
import os6 from "node:os";
|
|
67055
67231
|
import { timingSafeEqual } from "node:crypto";
|
|
67056
67232
|
init_diagnosticRedaction();
|
|
67057
67233
|
var PreviewSession = class {
|
|
@@ -67076,10 +67252,10 @@ var PreviewSession = class {
|
|
|
67076
67252
|
if ((current == null ? void 0 : current.session_id) !== this.record.session_id || current.supervisor_id !== this.record.supervisor_id)
|
|
67077
67253
|
return;
|
|
67078
67254
|
writePrivateJson(
|
|
67079
|
-
|
|
67255
|
+
path35.join(previewDirectory(this.record.project_realpath), "session.json"),
|
|
67080
67256
|
this.record
|
|
67081
67257
|
);
|
|
67082
|
-
writePrivateJson(
|
|
67258
|
+
writePrivateJson(path35.join(previewRoundDirectory(this.record), "result.json"), this.status());
|
|
67083
67259
|
}
|
|
67084
67260
|
}
|
|
67085
67261
|
status() {
|
|
@@ -67184,12 +67360,17 @@ var PreviewSession = class {
|
|
|
67184
67360
|
if (this.runtime !== runtime || this.stopping) return;
|
|
67185
67361
|
if (state === "stopped" && this.record.state === "reloading") return;
|
|
67186
67362
|
this.setState(state);
|
|
67363
|
+
},
|
|
67364
|
+
void 0,
|
|
67365
|
+
(pid) => {
|
|
67366
|
+
this.record.runtime_launch_pending = pid === void 0;
|
|
67367
|
+
this.setState(this.record.state);
|
|
67187
67368
|
}
|
|
67188
67369
|
);
|
|
67189
67370
|
this.runtime = runtime;
|
|
67190
67371
|
await runtime.start(
|
|
67191
67372
|
String(this.preflight.entry),
|
|
67192
|
-
|
|
67373
|
+
path35.join(previewDirectory(this.record.project_realpath), "storage"),
|
|
67193
67374
|
this.preflight.window
|
|
67194
67375
|
);
|
|
67195
67376
|
if (this.stopping) throw new Error("CANCELLED");
|
|
@@ -67208,7 +67389,7 @@ var PreviewSession = class {
|
|
|
67208
67389
|
} finally {
|
|
67209
67390
|
try {
|
|
67210
67391
|
trimPreviewEvidence(
|
|
67211
|
-
|
|
67392
|
+
path35.join(previewDirectory(this.record.project_realpath), "sessions"),
|
|
67212
67393
|
this.record.session_id,
|
|
67213
67394
|
this.record.reload_id
|
|
67214
67395
|
);
|
|
@@ -67376,7 +67557,7 @@ async function runPreviewSupervisor(project, sessionId) {
|
|
|
67376
67557
|
try {
|
|
67377
67558
|
const current = readPreviewRecord(project);
|
|
67378
67559
|
if ((current == null ? void 0 : current.session_id) === record2.session_id && current.supervisor_id === record2.supervisor_id && current.reload_id === record2.reload_id) {
|
|
67379
|
-
writePrivateJson(
|
|
67560
|
+
writePrivateJson(path35.join(previewRoundDirectory(record2), "result.json"), {
|
|
67380
67561
|
...session.status(),
|
|
67381
67562
|
supervisor_retired: true
|
|
67382
67563
|
});
|
|
@@ -67452,7 +67633,8 @@ async function runPreviewSupervisor(project, sessionId) {
|
|
|
67452
67633
|
record2.port = address.port;
|
|
67453
67634
|
record2.supervisor_pid = process.pid;
|
|
67454
67635
|
record2.runtime_pid = 0;
|
|
67455
|
-
|
|
67636
|
+
record2.runtime_launch_pending = false;
|
|
67637
|
+
writePrivateJson(path35.join(previewDirectory(project), "session.json"), record2);
|
|
67456
67638
|
const idleTimer = setInterval(() => {
|
|
67457
67639
|
if (record2.state === "stopped") void shutdown();
|
|
67458
67640
|
else if (session.canRetireFailure) void shutdown(true);
|
|
@@ -67486,10 +67668,10 @@ async function previewStatus(project) {
|
|
|
67486
67668
|
};
|
|
67487
67669
|
} catch {
|
|
67488
67670
|
const stopped = record2.state === "stopped";
|
|
67489
|
-
const filename2 =
|
|
67671
|
+
const filename2 = path35.join(previewRoundDirectory(record2), "result.json");
|
|
67490
67672
|
let evidence = {};
|
|
67491
|
-
if (
|
|
67492
|
-
const saved = JSON.parse(
|
|
67673
|
+
if (fs34.existsSync(filename2)) {
|
|
67674
|
+
const saved = JSON.parse(fs34.readFileSync(filename2, "utf8"));
|
|
67493
67675
|
if (samePreviewIdentity(saved, record2)) {
|
|
67494
67676
|
evidence = { ...saved };
|
|
67495
67677
|
delete evidence.token;
|
|
@@ -67499,8 +67681,9 @@ async function previewStatus(project) {
|
|
|
67499
67681
|
const runtimePid = Number(record2.runtime_pid || evidence.runtime_pid || 0);
|
|
67500
67682
|
const unpublished = record2.state === "starting" && !record2.port && !record2.supervisor_pid && !record2.runtime_pid;
|
|
67501
67683
|
const expiredLaunch = unpublished && record2.launch_deadline !== void 0 && Date.now() >= record2.launch_deadline;
|
|
67502
|
-
const beforeBoot =
|
|
67503
|
-
const
|
|
67684
|
+
const beforeBoot = record2.state === "starting" && Date.parse(record2.started_at) < Date.now() - os6.uptime() * 1e3 - 6e4 && (record2.supervisor_pid === 0 || processPresence(record2.supervisor_pid) === "missing") && (runtimePid === 0 || processPresence(runtimePid) === "missing");
|
|
67685
|
+
const interruptedStartup = record2.state === "starting" && record2.port > 0 && record2.supervisor_pid > 0 && record2.runtime_launch_pending === false && processPresence(record2.supervisor_pid) === "missing" && (runtimePid === 0 || processPresence(runtimePid) === "missing");
|
|
67686
|
+
const staleSessionRecovered = expiredLaunch || beforeBoot || interruptedStartup || !retiredFailure && (record2.state === "running" || record2.state === "failed") && sameSupervisorEvidence(evidence, record2) && processPresence(record2.supervisor_pid) === "missing" && runtimePid > 0 && processPresence(runtimePid) === "missing";
|
|
67504
67687
|
if (staleSessionRecovered) {
|
|
67505
67688
|
evidence = {
|
|
67506
67689
|
...evidence,
|
|
@@ -67512,7 +67695,7 @@ async function previewStatus(project) {
|
|
|
67512
67695
|
runtime_pid: 0,
|
|
67513
67696
|
supervisor_retired: true,
|
|
67514
67697
|
stale_session_recovered: true,
|
|
67515
|
-
error: expiredLaunch ? "本地预览启动超时,未启动游戏。可以重新点击“本地预览”。" : "Previous preview processes are no longer running. The stale session was retired safely."
|
|
67698
|
+
error: expiredLaunch ? "本地预览启动超时,未启动游戏。可以重新点击“本地预览”。" : interruptedStartup ? "本地预览启动已中断,已确认相关进程不存在。可以重新点击“本地预览”。" : "Previous preview processes are no longer running. The stale session was retired safely."
|
|
67516
67699
|
};
|
|
67517
67700
|
}
|
|
67518
67701
|
return {
|
|
@@ -67543,8 +67726,8 @@ init_diagnosticRedaction();
|
|
|
67543
67726
|
|
|
67544
67727
|
// src/maker/system/backgroundProcess.ts
|
|
67545
67728
|
import { spawn as spawn8 } from "node:child_process";
|
|
67546
|
-
import
|
|
67547
|
-
import
|
|
67729
|
+
import fs35 from "node:fs";
|
|
67730
|
+
import path36 from "node:path";
|
|
67548
67731
|
var WINDOWS_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
67549
67732
|
"APPDATA",
|
|
67550
67733
|
"COMSPEC",
|
|
@@ -67579,9 +67762,9 @@ var WINDOWS_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
|
67579
67762
|
"WINDIR"
|
|
67580
67763
|
]);
|
|
67581
67764
|
function openBackgroundProcessLog(filename2) {
|
|
67582
|
-
|
|
67583
|
-
const oversized =
|
|
67584
|
-
return
|
|
67765
|
+
fs35.mkdirSync(path36.dirname(filename2), { recursive: true, mode: 448 });
|
|
67766
|
+
const oversized = fs35.existsSync(filename2) && fs35.statSync(filename2).size > 1024 * 1024;
|
|
67767
|
+
return fs35.openSync(filename2, oversized ? "w" : "a", 384);
|
|
67585
67768
|
}
|
|
67586
67769
|
function selectWindowsBackgroundEnvironment(env) {
|
|
67587
67770
|
return Object.fromEntries(
|
|
@@ -67623,7 +67806,7 @@ async function launchBackgroundProcess(options3) {
|
|
|
67623
67806
|
var _a3, _b, _c;
|
|
67624
67807
|
if ((_a3 = options3.signal) == null ? void 0 : _a3.aborted) throw new Error("CANCELLED: background launch.");
|
|
67625
67808
|
if ((options3.platform ?? process.platform) !== "win32") return directLaunch(options3);
|
|
67626
|
-
|
|
67809
|
+
fs35.closeSync(openBackgroundProcessLog(options3.logFile));
|
|
67627
67810
|
const scripts = buildWindowsBackgroundLaunchScripts(options3);
|
|
67628
67811
|
const broker = spawn8(
|
|
67629
67812
|
"powershell.exe",
|
|
@@ -67696,7 +67879,7 @@ function directLaunch(options3) {
|
|
|
67696
67879
|
env: options3.env
|
|
67697
67880
|
});
|
|
67698
67881
|
} finally {
|
|
67699
|
-
|
|
67882
|
+
fs35.closeSync(stderr);
|
|
67700
67883
|
}
|
|
67701
67884
|
let launchFailure;
|
|
67702
67885
|
child.once("error", (error2) => {
|
|
@@ -67800,7 +67983,7 @@ async function runPreviewCli(action, options3) {
|
|
|
67800
67983
|
);
|
|
67801
67984
|
} else {
|
|
67802
67985
|
if (action === "stop") {
|
|
67803
|
-
writePrivateJson(
|
|
67986
|
+
writePrivateJson(path37.join(previewDirectory(project), "stop.json"), {
|
|
67804
67987
|
request_id: randomUUID6()
|
|
67805
67988
|
});
|
|
67806
67989
|
}
|
|
@@ -67879,8 +68062,8 @@ async function runPreviewCli(action, options3) {
|
|
|
67879
68062
|
process.exitCode = 1;
|
|
67880
68063
|
}
|
|
67881
68064
|
async function startPreview(project, options3, signal) {
|
|
67882
|
-
const stopFile =
|
|
67883
|
-
const readStop = () =>
|
|
68065
|
+
const stopFile = path37.join(previewDirectory(project), "stop.json");
|
|
68066
|
+
const readStop = () => fs36.existsSync(stopFile) ? fs36.readFileSync(stopFile, "utf8") : "";
|
|
67884
68067
|
const stopGeneration = readStop();
|
|
67885
68068
|
const checkCancelled = () => {
|
|
67886
68069
|
if (signal.aborted || readStop() !== stopGeneration)
|
|
@@ -67914,9 +68097,9 @@ async function startPreview(project, options3, signal) {
|
|
|
67914
68097
|
install_state: "missing",
|
|
67915
68098
|
error: "Runtime is missing. With host approval, run taptap-maker preview install --target-dir <PROJECT_ABSOLUTE_PATH>, then retry start."
|
|
67916
68099
|
};
|
|
67917
|
-
if (!
|
|
68100
|
+
if (!path37.isAbsolute(configured))
|
|
67918
68101
|
throw new Error("--runtime must be an absolute executable path.");
|
|
67919
|
-
const executable =
|
|
68102
|
+
const executable = fs36.realpathSync(configured);
|
|
67920
68103
|
const resourceWarnings = externalRuntime ? [] : ensurePreviewRuntimeResources(executable).warnings;
|
|
67921
68104
|
const runtime = await probeRuntime(executable, signal);
|
|
67922
68105
|
checkCancelled();
|
|
@@ -67936,14 +68119,14 @@ async function startPreview(project, options3, signal) {
|
|
|
67936
68119
|
state: "starting",
|
|
67937
68120
|
runtime
|
|
67938
68121
|
};
|
|
67939
|
-
writePrivateJson(
|
|
68122
|
+
writePrivateJson(path37.join(previewDirectory(project), "session.json"), record2);
|
|
67940
68123
|
const launch = await launchPreviewSupervisorProcess({
|
|
67941
68124
|
execPath: process.execPath,
|
|
67942
68125
|
execArgv: process.execArgv,
|
|
67943
68126
|
entry: process.argv[1],
|
|
67944
68127
|
project,
|
|
67945
68128
|
sessionId: record2.session_id,
|
|
67946
|
-
cwd:
|
|
68129
|
+
cwd: path37.dirname(executable),
|
|
67947
68130
|
logFile: previewSupervisorLogPath(project),
|
|
67948
68131
|
env: process.env,
|
|
67949
68132
|
signal
|
|
@@ -67988,7 +68171,7 @@ async function startPreview(project, options3, signal) {
|
|
|
67988
68171
|
} else {
|
|
67989
68172
|
if (launch.stopUnpublished()) {
|
|
67990
68173
|
record2.state = "stopped";
|
|
67991
|
-
writePrivateJson(
|
|
68174
|
+
writePrivateJson(path37.join(previewDirectory(project), "session.json"), record2);
|
|
67992
68175
|
} else {
|
|
67993
68176
|
throw new Error(
|
|
67994
68177
|
String(error2) + "; supervisor exit is unverified. Inspect " + previewSupervisorLogPath(project)
|
|
@@ -68000,8 +68183,8 @@ async function startPreview(project, options3, signal) {
|
|
|
68000
68183
|
}
|
|
68001
68184
|
|
|
68002
68185
|
// src/maker/console/cli.ts
|
|
68003
|
-
import
|
|
68004
|
-
import
|
|
68186
|
+
import fs44 from "node:fs";
|
|
68187
|
+
import path46 from "node:path";
|
|
68005
68188
|
import { spawn as spawn11 } from "node:child_process";
|
|
68006
68189
|
import { createHash as createHash8, randomUUID as randomUUID8 } from "node:crypto";
|
|
68007
68190
|
init_storage();
|
|
@@ -68014,8 +68197,8 @@ init_projectSettings();
|
|
|
68014
68197
|
init_qrcodePreflight();
|
|
68015
68198
|
init_qrcodeInteraction();
|
|
68016
68199
|
init_git();
|
|
68017
|
-
import
|
|
68018
|
-
import
|
|
68200
|
+
import fs37 from "node:fs";
|
|
68201
|
+
import path38 from "node:path";
|
|
68019
68202
|
import { execFile as execFile2 } from "node:child_process";
|
|
68020
68203
|
import { promisify as promisify2 } from "node:util";
|
|
68021
68204
|
|
|
@@ -68039,17 +68222,17 @@ var ConsoleError = class extends Error {
|
|
|
68039
68222
|
// src/maker/console/projects.ts
|
|
68040
68223
|
var exec = promisify2(execFile2);
|
|
68041
68224
|
function objectFile2(filename2) {
|
|
68042
|
-
const stat =
|
|
68225
|
+
const stat = fs37.statSync(filename2);
|
|
68043
68226
|
if (!stat.isFile() || stat.size > 2 * 1024 * 1024)
|
|
68044
68227
|
throw new ConsoleError("Project configuration exceeds the supported size.");
|
|
68045
|
-
const data = JSON.parse(
|
|
68228
|
+
const data = JSON.parse(fs37.readFileSync(filename2, "utf8"));
|
|
68046
68229
|
if (!data || typeof data !== "object" || Array.isArray(data))
|
|
68047
68230
|
throw new ConsoleError("Invalid project configuration.");
|
|
68048
68231
|
return data;
|
|
68049
68232
|
}
|
|
68050
68233
|
function optionalConfig(root2, file3) {
|
|
68051
68234
|
try {
|
|
68052
|
-
return objectFile2(
|
|
68235
|
+
return objectFile2(path38.join(root2, ".project", file3));
|
|
68053
68236
|
} catch {
|
|
68054
68237
|
return {};
|
|
68055
68238
|
}
|
|
@@ -68092,7 +68275,7 @@ var ConsoleProjects = class {
|
|
|
68092
68275
|
const error2 = entry.error;
|
|
68093
68276
|
const config2 = error2 ? {} : optionalConfig(entry.path, "project.json");
|
|
68094
68277
|
const title = (_b = text((_a3 = config2.taptap_publish) == null ? void 0 : _a3.title)) == null ? void 0 : _b.trim();
|
|
68095
|
-
const name = title && title !== "<game title, required>" ? title :
|
|
68278
|
+
const name = title && title !== "<game title, required>" ? title : path38.basename(entry.path) + (error2 ? "" : "(未发布)");
|
|
68096
68279
|
return {
|
|
68097
68280
|
key: entry.key,
|
|
68098
68281
|
projectid: entry.binding,
|
|
@@ -68128,7 +68311,7 @@ var ConsoleProjects = class {
|
|
|
68128
68311
|
const entry = config2["entry@server"] || resources2["entry@server"];
|
|
68129
68312
|
const normalized = typeof entry === "string" ? entry.replace(/\\/g, "/").replace(/^\.\//, "") : "";
|
|
68130
68313
|
const entries = normalized ? [normalized, "scripts/" + normalized, "assets/" + normalized] : [];
|
|
68131
|
-
const directories = entries.map((file3) =>
|
|
68314
|
+
const directories = entries.map((file3) => path38.posix.dirname(file3)).filter((dir) => ![".", "scripts", "assets"].includes(dir));
|
|
68132
68315
|
const raw = (await inspectGit(["status", "--porcelain=v1", "-z", "--untracked-files=all"])).split("\0");
|
|
68133
68316
|
const files = /* @__PURE__ */ new Set();
|
|
68134
68317
|
for (let i = 0; i < raw.length && raw[i]; i++) {
|
|
@@ -68145,7 +68328,7 @@ var ConsoleProjects = class {
|
|
|
68145
68328
|
const meta3 = source + ".meta";
|
|
68146
68329
|
const current = (() => {
|
|
68147
68330
|
try {
|
|
68148
|
-
return objectFile2(
|
|
68331
|
+
return objectFile2(path38.join(project.path, meta3));
|
|
68149
68332
|
} catch {
|
|
68150
68333
|
return {};
|
|
68151
68334
|
}
|
|
@@ -68532,8 +68715,8 @@ init_privateJson();
|
|
|
68532
68715
|
init_diagnosticRedaction();
|
|
68533
68716
|
init_qrcodePreflight();
|
|
68534
68717
|
init_qrcodeInteraction();
|
|
68535
|
-
import
|
|
68536
|
-
import
|
|
68718
|
+
import fs38 from "node:fs";
|
|
68719
|
+
import path39 from "node:path";
|
|
68537
68720
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
68538
68721
|
var ConsoleTasks = class {
|
|
68539
68722
|
constructor(projects, execute, historyFile, onSettled = () => {
|
|
@@ -68544,10 +68727,10 @@ var ConsoleTasks = class {
|
|
|
68544
68727
|
this.onSettled = onSettled;
|
|
68545
68728
|
this.tasks = /* @__PURE__ */ new Map();
|
|
68546
68729
|
this.running = /* @__PURE__ */ new Set();
|
|
68547
|
-
if (historyFile &&
|
|
68548
|
-
if (
|
|
68730
|
+
if (historyFile && fs38.existsSync(historyFile)) {
|
|
68731
|
+
if (fs38.statSync(historyFile).size > 40 * 1024 * 1024)
|
|
68549
68732
|
throw new ConsoleError("Console task history exceeds the supported size.");
|
|
68550
|
-
const data = JSON.parse(
|
|
68733
|
+
const data = JSON.parse(fs38.readFileSync(historyFile, "utf8"));
|
|
68551
68734
|
if (!Array.isArray(data) || data.length > 100)
|
|
68552
68735
|
throw new ConsoleError("Invalid console task history.");
|
|
68553
68736
|
for (const task of data) {
|
|
@@ -68709,7 +68892,7 @@ var ConsoleTasks = class {
|
|
|
68709
68892
|
persist() {
|
|
68710
68893
|
this.pruneHistory();
|
|
68711
68894
|
if (this.historyFile) {
|
|
68712
|
-
|
|
68895
|
+
fs38.mkdirSync(path39.dirname(this.historyFile), { recursive: true, mode: 448 });
|
|
68713
68896
|
while (Buffer.byteLength(JSON.stringify(Array.from(this.tasks.values()))) > 40 * 1024 * 1024) {
|
|
68714
68897
|
const oldest = this.list().reverse().find((task) => task.status !== "running");
|
|
68715
68898
|
if (!oldest) throw new ConsoleError("Active console history exceeds the supported size.");
|
|
@@ -68725,8 +68908,8 @@ init_diagnosticRedaction();
|
|
|
68725
68908
|
init_luaLsp();
|
|
68726
68909
|
|
|
68727
68910
|
// src/maker/console/integrations/framecrate.ts
|
|
68728
|
-
import
|
|
68729
|
-
import
|
|
68911
|
+
import fs39 from "node:fs";
|
|
68912
|
+
import path40 from "node:path";
|
|
68730
68913
|
import { pathToFileURL } from "node:url";
|
|
68731
68914
|
import { spawn as spawn10 } from "node:child_process";
|
|
68732
68915
|
var FramecrateLauncher = class {
|
|
@@ -68764,7 +68947,7 @@ var FramecrateLauncher = class {
|
|
|
68764
68947
|
throw new ConsoleError("FrameCrate requires the exact console host origin.");
|
|
68765
68948
|
}
|
|
68766
68949
|
}
|
|
68767
|
-
if (!
|
|
68950
|
+
if (!path40.isAbsolute(projectPath) || fs39.realpathSync(projectPath) !== projectPath)
|
|
68768
68951
|
throw new ConsoleError("FrameCrate requires a validated project realpath.");
|
|
68769
68952
|
const existing = this.sessions.get(projectPath);
|
|
68770
68953
|
if (existing) {
|
|
@@ -68782,7 +68965,7 @@ var FramecrateLauncher = class {
|
|
|
68782
68965
|
);
|
|
68783
68966
|
const env = this.options.env ?? process.env;
|
|
68784
68967
|
const configured = (_a3 = env.FRAMECRATE_STUDIO_DIR) == null ? void 0 : _a3.trim();
|
|
68785
|
-
if (!configured || !
|
|
68968
|
+
if (!configured || !path40.isAbsolute(configured))
|
|
68786
68969
|
throw new ConsoleError(
|
|
68787
68970
|
"FrameCrate unavailable: set FRAMECRATE_STUDIO_DIR to the absolute path of an installed studio, then reopen the console.",
|
|
68788
68971
|
409
|
|
@@ -68791,10 +68974,10 @@ var FramecrateLauncher = class {
|
|
|
68791
68974
|
let entry;
|
|
68792
68975
|
let loader;
|
|
68793
68976
|
try {
|
|
68794
|
-
root2 =
|
|
68795
|
-
entry =
|
|
68796
|
-
loader =
|
|
68797
|
-
if (!
|
|
68977
|
+
root2 = fs39.realpathSync(configured);
|
|
68978
|
+
entry = path40.join(root2, "server/main.ts");
|
|
68979
|
+
loader = path40.join(root2, "node_modules/tsx/dist/loader.mjs");
|
|
68980
|
+
if (!fs39.statSync(entry).isFile() || !fs39.statSync(loader).isFile()) throw new Error();
|
|
68798
68981
|
} catch {
|
|
68799
68982
|
throw new ConsoleError(
|
|
68800
68983
|
"FrameCrate unavailable: FRAMECRATE_STUDIO_DIR must contain server/main.ts and node_modules/tsx/dist/loader.mjs. No installer is provided.",
|
|
@@ -68991,14 +69174,14 @@ var ConsolePlugins = class {
|
|
|
68991
69174
|
|
|
68992
69175
|
// src/maker/console/updates.ts
|
|
68993
69176
|
import { execFile as execFile3 } from "node:child_process";
|
|
68994
|
-
import
|
|
68995
|
-
import
|
|
69177
|
+
import fs41 from "node:fs";
|
|
69178
|
+
import path42 from "node:path";
|
|
68996
69179
|
|
|
68997
69180
|
// src/maker/cli/mcpLauncher.ts
|
|
68998
69181
|
init_client2();
|
|
68999
69182
|
init_stdio3();
|
|
69000
|
-
import
|
|
69001
|
-
import
|
|
69183
|
+
import fs40 from "node:fs";
|
|
69184
|
+
import path41 from "node:path";
|
|
69002
69185
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
69003
69186
|
var DEFAULT_VERIFY_TIMEOUT_MS = 9e4;
|
|
69004
69187
|
var VERIFY_CLIENT_VERSION = "1.0.0";
|
|
@@ -69025,33 +69208,33 @@ function materializeMakerSelfLauncher(options3) {
|
|
|
69025
69208
|
throw new Error(`Invalid Maker runtime version: ${options3.version}`);
|
|
69026
69209
|
}
|
|
69027
69210
|
const execPath = options3.execPath ?? process.execPath;
|
|
69028
|
-
if (!
|
|
69211
|
+
if (!path41.isAbsolute(execPath) || !fs40.existsSync(execPath)) {
|
|
69029
69212
|
throw new Error("Maker self launcher requires an existing absolute Node executable.");
|
|
69030
69213
|
}
|
|
69031
69214
|
const sourceBundle = fileURLToPath3(options3.bundleUrl);
|
|
69032
|
-
const sourceRoot =
|
|
69033
|
-
const runtimeRoot =
|
|
69215
|
+
const sourceRoot = path41.dirname(path41.dirname(sourceBundle));
|
|
69216
|
+
const runtimeRoot = path41.join(path41.resolve(options3.makerHome), "mcp-runtime", options3.version);
|
|
69034
69217
|
for (const relativePath of [...SELF_RUNTIME_FILES, ...SELF_RUNTIME_DIRECTORIES]) {
|
|
69035
|
-
const sourcePath =
|
|
69036
|
-
if (!
|
|
69218
|
+
const sourcePath = path41.join(sourceRoot, relativePath);
|
|
69219
|
+
if (!fs40.existsSync(sourcePath)) {
|
|
69037
69220
|
throw new Error(`Maker self runtime source is incomplete: ${sourcePath}`);
|
|
69038
69221
|
}
|
|
69039
69222
|
}
|
|
69040
|
-
if (
|
|
69223
|
+
if (path41.resolve(sourceRoot) !== path41.resolve(runtimeRoot)) {
|
|
69041
69224
|
for (const relativePath of SELF_RUNTIME_FILES) {
|
|
69042
|
-
const sourcePath =
|
|
69043
|
-
const targetPath =
|
|
69044
|
-
|
|
69045
|
-
|
|
69225
|
+
const sourcePath = path41.join(sourceRoot, relativePath);
|
|
69226
|
+
const targetPath = path41.join(runtimeRoot, relativePath);
|
|
69227
|
+
fs40.mkdirSync(path41.dirname(targetPath), { recursive: true });
|
|
69228
|
+
fs40.copyFileSync(sourcePath, targetPath);
|
|
69046
69229
|
}
|
|
69047
69230
|
for (const relativePath of SELF_RUNTIME_DIRECTORIES) {
|
|
69048
69231
|
copySelfRuntimeDirectory(
|
|
69049
|
-
|
|
69050
|
-
|
|
69232
|
+
path41.join(sourceRoot, relativePath),
|
|
69233
|
+
path41.join(runtimeRoot, relativePath)
|
|
69051
69234
|
);
|
|
69052
69235
|
}
|
|
69053
69236
|
}
|
|
69054
|
-
const stableBundle =
|
|
69237
|
+
const stableBundle = path41.join(runtimeRoot, "dist", "maker.js");
|
|
69055
69238
|
return {
|
|
69056
69239
|
kind: "self_runtime",
|
|
69057
69240
|
command: execPath,
|
|
@@ -69061,7 +69244,7 @@ function materializeMakerSelfLauncher(options3) {
|
|
|
69061
69244
|
}
|
|
69062
69245
|
function copySelfRuntimeDirectory(sourcePath, targetPath) {
|
|
69063
69246
|
try {
|
|
69064
|
-
|
|
69247
|
+
fs40.cpSync(sourcePath, targetPath, { recursive: true });
|
|
69065
69248
|
} catch (error2) {
|
|
69066
69249
|
const code = typeof error2 === "object" && error2 !== null && "code" in error2 ? String(error2.code) : void 0;
|
|
69067
69250
|
if (!code || !SELF_RUNTIME_COPY_FALLBACK_CODES.has(code)) {
|
|
@@ -69071,14 +69254,14 @@ function copySelfRuntimeDirectory(sourcePath, targetPath) {
|
|
|
69071
69254
|
}
|
|
69072
69255
|
}
|
|
69073
69256
|
function copyDirectoryEntries(sourcePath, targetPath) {
|
|
69074
|
-
|
|
69075
|
-
for (const entry of
|
|
69076
|
-
const sourceEntry =
|
|
69077
|
-
const targetEntry =
|
|
69257
|
+
fs40.mkdirSync(targetPath, { recursive: true });
|
|
69258
|
+
for (const entry of fs40.readdirSync(sourcePath, { withFileTypes: true })) {
|
|
69259
|
+
const sourceEntry = path41.join(sourcePath, entry.name);
|
|
69260
|
+
const targetEntry = path41.join(targetPath, entry.name);
|
|
69078
69261
|
if (entry.isDirectory()) {
|
|
69079
69262
|
copyDirectoryEntries(sourceEntry, targetEntry);
|
|
69080
69263
|
} else {
|
|
69081
|
-
|
|
69264
|
+
fs40.copyFileSync(sourceEntry, targetEntry);
|
|
69082
69265
|
}
|
|
69083
69266
|
}
|
|
69084
69267
|
}
|
|
@@ -69093,10 +69276,10 @@ function resolveMakerMcpLauncher(options3) {
|
|
|
69093
69276
|
commandAndArgs: ["npx", ...args]
|
|
69094
69277
|
};
|
|
69095
69278
|
}
|
|
69096
|
-
const existsSync2 = options3.existsSync ??
|
|
69279
|
+
const existsSync2 = options3.existsSync ?? fs40.existsSync;
|
|
69097
69280
|
const execPath = options3.execPath ?? process.execPath;
|
|
69098
69281
|
const npmExecPath = options3.npmExecPath ?? process.env.npm_execpath;
|
|
69099
|
-
const windowsPath =
|
|
69282
|
+
const windowsPath = path41.win32;
|
|
69100
69283
|
const npmCliCandidates = uniqueStrings([
|
|
69101
69284
|
npmExecPath,
|
|
69102
69285
|
windowsPath.join(windowsPath.dirname(execPath), "node_modules", "npm", "bin", "npm-cli.js")
|
|
@@ -69264,8 +69447,8 @@ function runConsoleUpgrade(version2) {
|
|
|
69264
69447
|
if (!VERSION2.test(version2)) throw new Error("无效版本号");
|
|
69265
69448
|
const launcher = resolveMakerMcpLauncher({ packageName: `@taptap/maker@${version2}` });
|
|
69266
69449
|
const home2 = getMakerHome();
|
|
69267
|
-
const cache =
|
|
69268
|
-
|
|
69450
|
+
const cache = path42.join(home2, "cache", "npm");
|
|
69451
|
+
fs41.mkdirSync(cache, { recursive: true });
|
|
69269
69452
|
return new Promise((resolve, reject) => {
|
|
69270
69453
|
execFile3(
|
|
69271
69454
|
launcher.command,
|
|
@@ -69351,8 +69534,8 @@ var ConsoleUpdates = class {
|
|
|
69351
69534
|
};
|
|
69352
69535
|
|
|
69353
69536
|
// src/maker/console/documents.ts
|
|
69354
|
-
import
|
|
69355
|
-
import
|
|
69537
|
+
import fs42 from "node:fs";
|
|
69538
|
+
import path43 from "node:path";
|
|
69356
69539
|
import { createHash as createHash6 } from "node:crypto";
|
|
69357
69540
|
|
|
69358
69541
|
// node_modules/marked/lib/marked.esm.js
|
|
@@ -71458,8 +71641,8 @@ var GROUPS = [
|
|
|
71458
71641
|
["templates", "示例与模板"]
|
|
71459
71642
|
];
|
|
71460
71643
|
function inside2(root2, file3) {
|
|
71461
|
-
const relative =
|
|
71462
|
-
return relative !== ".." && !relative.startsWith(`..${
|
|
71644
|
+
const relative = path43.relative(root2, file3);
|
|
71645
|
+
return relative !== ".." && !relative.startsWith(`..${path43.sep}`) && !path43.isAbsolute(relative);
|
|
71463
71646
|
}
|
|
71464
71647
|
var ConsoleDocuments = class {
|
|
71465
71648
|
constructor(packageRoot) {
|
|
@@ -71470,34 +71653,34 @@ var ConsoleDocuments = class {
|
|
|
71470
71653
|
const seen = /* @__PURE__ */ new Set();
|
|
71471
71654
|
let visited = 0;
|
|
71472
71655
|
const collect = (base, source, relative, kind, category) => {
|
|
71473
|
-
if (!
|
|
71474
|
-
const root2 =
|
|
71656
|
+
if (!fs42.existsSync(base)) return;
|
|
71657
|
+
const root2 = fs42.realpathSync(base);
|
|
71475
71658
|
const walk = (filename2, depth) => {
|
|
71476
71659
|
var _a3, _b;
|
|
71477
71660
|
if (depth > 7 || visited++ > 6e3 || entries.length >= MAX_ENTRIES) return;
|
|
71478
71661
|
try {
|
|
71479
|
-
const real =
|
|
71662
|
+
const real = fs42.realpathSync(filename2);
|
|
71480
71663
|
if (!inside2(root2, real)) return;
|
|
71481
|
-
const stat =
|
|
71664
|
+
const stat = fs42.statSync(real);
|
|
71482
71665
|
if (stat.isDirectory()) {
|
|
71483
|
-
if (
|
|
71484
|
-
for (const name of
|
|
71666
|
+
if (fs42.lstatSync(filename2).isSymbolicLink()) return;
|
|
71667
|
+
for (const name of fs42.readdirSync(filename2).sort()) {
|
|
71485
71668
|
if (name === "node_modules" || name === ".git") continue;
|
|
71486
|
-
walk(
|
|
71669
|
+
walk(path43.join(filename2, name), depth + 1);
|
|
71487
71670
|
}
|
|
71488
71671
|
} else if (stat.isFile() && /\.md$/i.test(filename2) && stat.size <= MAX_FILE && !seen.has(real)) {
|
|
71489
71672
|
seen.add(real);
|
|
71490
|
-
const relativePath =
|
|
71491
|
-
const descriptor =
|
|
71673
|
+
const relativePath = path43.relative(root2, filename2).split(path43.sep).join("/");
|
|
71674
|
+
const descriptor = fs42.openSync(real, "r");
|
|
71492
71675
|
const buffer = Buffer.alloc(Math.min(8192, stat.size));
|
|
71493
71676
|
let content;
|
|
71494
71677
|
try {
|
|
71495
|
-
content = buffer.subarray(0,
|
|
71678
|
+
content = buffer.subarray(0, fs42.readSync(descriptor, buffer, 0, buffer.length, 0)).toString("utf8");
|
|
71496
71679
|
} finally {
|
|
71497
|
-
|
|
71680
|
+
fs42.closeSync(descriptor);
|
|
71498
71681
|
}
|
|
71499
71682
|
const heading = (_b = (_a3 = content.match(/^#\s+(.+)$/m)) == null ? void 0 : _a3[1]) == null ? void 0 : _b.trim();
|
|
71500
|
-
const fallback =
|
|
71683
|
+
const fallback = path43.basename(filename2).toLowerCase() === "skill.md" ? path43.basename(path43.dirname(filename2)) : path43.basename(filename2, path43.extname(filename2));
|
|
71501
71684
|
entries.push({
|
|
71502
71685
|
id: createHash6("sha256").update(source + ":" + relativePath).digest("hex"),
|
|
71503
71686
|
title: (heading || fallback).slice(0, 160),
|
|
@@ -71512,7 +71695,7 @@ var ConsoleDocuments = class {
|
|
|
71512
71695
|
} catch {
|
|
71513
71696
|
}
|
|
71514
71697
|
};
|
|
71515
|
-
walk(
|
|
71698
|
+
walk(path43.join(root2, relative), 0);
|
|
71516
71699
|
};
|
|
71517
71700
|
for (const filename2 of [
|
|
71518
71701
|
"MAKER_CONSOLE.md",
|
|
@@ -71564,10 +71747,10 @@ var ConsoleDocuments = class {
|
|
|
71564
71747
|
if (!entry) throw new ConsoleError("文档不存在或已移除,请刷新目录。", 404);
|
|
71565
71748
|
let content = entry.content;
|
|
71566
71749
|
if (content === void 0) {
|
|
71567
|
-
const real =
|
|
71568
|
-
if (!inside2(entry.root, real) ||
|
|
71750
|
+
const real = fs42.realpathSync(entry.filename);
|
|
71751
|
+
if (!inside2(entry.root, real) || fs42.statSync(real).size > MAX_FILE)
|
|
71569
71752
|
throw new ConsoleError("文档无法安全读取。", 403);
|
|
71570
|
-
content =
|
|
71753
|
+
content = fs42.readFileSync(real, "utf8");
|
|
71571
71754
|
}
|
|
71572
71755
|
return {
|
|
71573
71756
|
id,
|
|
@@ -71580,7 +71763,7 @@ var ConsoleDocuments = class {
|
|
|
71580
71763
|
|
|
71581
71764
|
// src/maker/console/folderPicker.ts
|
|
71582
71765
|
import { execFile as execFile4 } from "node:child_process";
|
|
71583
|
-
import
|
|
71766
|
+
import path44 from "node:path";
|
|
71584
71767
|
async function chooseProjectDirectory(platform = process.platform, signal) {
|
|
71585
71768
|
let command;
|
|
71586
71769
|
let args;
|
|
@@ -71598,7 +71781,7 @@ async function chooseProjectDirectory(platform = process.platform, signal) {
|
|
|
71598
71781
|
].join("\n")
|
|
71599
71782
|
];
|
|
71600
71783
|
} else if (platform === "win32") {
|
|
71601
|
-
command =
|
|
71784
|
+
command = path44.win32.join(
|
|
71602
71785
|
process.env.SystemRoot || "C:\\Windows",
|
|
71603
71786
|
"System32",
|
|
71604
71787
|
"WindowsPowerShell",
|
|
@@ -71663,8 +71846,8 @@ async function chooseProjectDirectory(platform = process.platform, signal) {
|
|
|
71663
71846
|
}
|
|
71664
71847
|
|
|
71665
71848
|
// src/maker/console/projectDiscovery.ts
|
|
71666
|
-
import
|
|
71667
|
-
import
|
|
71849
|
+
import fs43 from "node:fs";
|
|
71850
|
+
import path45 from "node:path";
|
|
71668
71851
|
var EXCLUDED = /* @__PURE__ */ new Set([
|
|
71669
71852
|
".git",
|
|
71670
71853
|
"node_modules",
|
|
@@ -71679,7 +71862,7 @@ var EXCLUDED = /* @__PURE__ */ new Set([
|
|
|
71679
71862
|
"System Volume Information"
|
|
71680
71863
|
]);
|
|
71681
71864
|
async function discoverConsoleProjects(directory, registry2) {
|
|
71682
|
-
const root2 = await
|
|
71865
|
+
const root2 = await fs43.promises.realpath(directory);
|
|
71683
71866
|
const known = new Set(registry2.list().map((project) => project.path));
|
|
71684
71867
|
const result = { added: 0, existing: 0, skipped: 0, limited: false };
|
|
71685
71868
|
const deadline = Date.now() + 1e4;
|
|
@@ -71692,8 +71875,8 @@ async function discoverConsoleProjects(directory, registry2) {
|
|
|
71692
71875
|
}
|
|
71693
71876
|
const current = queue.shift();
|
|
71694
71877
|
visited++;
|
|
71695
|
-
const marker =
|
|
71696
|
-
if (
|
|
71878
|
+
const marker = path45.join(current.directory, ".maker-mcp/config.json");
|
|
71879
|
+
if (fs43.existsSync(marker) || fs43.existsSync(path45.join(current.directory, ".project/project.json"))) {
|
|
71697
71880
|
try {
|
|
71698
71881
|
const project = registry2.add(current.directory);
|
|
71699
71882
|
if (known.has(project.path)) result.existing++;
|
|
@@ -71707,7 +71890,7 @@ async function discoverConsoleProjects(directory, registry2) {
|
|
|
71707
71890
|
}
|
|
71708
71891
|
}
|
|
71709
71892
|
try {
|
|
71710
|
-
const entries = await
|
|
71893
|
+
const entries = await fs43.promises.opendir(current.directory);
|
|
71711
71894
|
for await (const entry of entries) {
|
|
71712
71895
|
if (++visited >= 5e3 || Date.now() >= deadline) {
|
|
71713
71896
|
result.limited = true;
|
|
@@ -71719,7 +71902,7 @@ async function discoverConsoleProjects(directory, registry2) {
|
|
|
71719
71902
|
continue;
|
|
71720
71903
|
}
|
|
71721
71904
|
queue.push({
|
|
71722
|
-
directory:
|
|
71905
|
+
directory: path45.join(current.directory, entry.name),
|
|
71723
71906
|
depth: current.depth + 1
|
|
71724
71907
|
});
|
|
71725
71908
|
}
|
|
@@ -72077,13 +72260,13 @@ async function readBody(request2) {
|
|
|
72077
72260
|
}
|
|
72078
72261
|
|
|
72079
72262
|
// src/maker/console/cli.ts
|
|
72080
|
-
var VERSION3 = false ? "dev" : "0.0.34-beta.
|
|
72263
|
+
var VERSION3 = false ? "dev" : "0.0.34-beta.6";
|
|
72081
72264
|
var CONSOLE_PROTOCOL_VERSION = 2;
|
|
72082
72265
|
function home() {
|
|
72083
|
-
return
|
|
72266
|
+
return path46.join(getMakerHome(), "console");
|
|
72084
72267
|
}
|
|
72085
72268
|
function sessionPath() {
|
|
72086
|
-
return
|
|
72269
|
+
return path46.join(home(), "session.json");
|
|
72087
72270
|
}
|
|
72088
72271
|
function createConsoleLauncherIdentity(version2, developmentSource) {
|
|
72089
72272
|
return createHash8("sha256").update(
|
|
@@ -72102,15 +72285,15 @@ function ensureCompatibleConsoleLauncher(actual, expected) {
|
|
|
72102
72285
|
}
|
|
72103
72286
|
}
|
|
72104
72287
|
function launcherIdentity() {
|
|
72105
|
-
const entry =
|
|
72288
|
+
const entry = fs44.realpathSync(process.argv[1]);
|
|
72106
72289
|
return createConsoleLauncherIdentity(VERSION3, {
|
|
72107
72290
|
entry,
|
|
72108
|
-
mtimeMs:
|
|
72291
|
+
mtimeMs: fs44.statSync(entry).mtimeMs
|
|
72109
72292
|
});
|
|
72110
72293
|
}
|
|
72111
72294
|
function readSession() {
|
|
72112
|
-
if (!
|
|
72113
|
-
const session = JSON.parse(
|
|
72295
|
+
if (!fs44.existsSync(sessionPath())) return void 0;
|
|
72296
|
+
const session = JSON.parse(fs44.readFileSync(sessionPath(), "utf8"));
|
|
72114
72297
|
if (session.schema !== 1 || !/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}$/.test(session.origin) || Number(new URL(session.origin).port) > 65535 || !/^[a-f0-9-]{36}$/.test(session.instanceId) || !Number.isInteger(session.pid) || session.pid <= 0 || typeof session.launcher !== "string" || session.draining !== void 0 && typeof session.draining !== "boolean")
|
|
72115
72298
|
throw new ConsoleError(
|
|
72116
72299
|
"Invalid local console session. Refusing to contact an unknown service."
|
|
@@ -72187,9 +72370,9 @@ async function runConsoleSupervisor() {
|
|
|
72187
72370
|
registry: registry2,
|
|
72188
72371
|
html: getConsoleHtml2(),
|
|
72189
72372
|
version: VERSION3,
|
|
72190
|
-
packageRoot:
|
|
72373
|
+
packageRoot: path46.dirname(path46.dirname(path46.resolve(process.argv[1]))),
|
|
72191
72374
|
distribution: process.env.TAPTAP_MAKER_DISTRIBUTION,
|
|
72192
|
-
historyFile:
|
|
72375
|
+
historyFile: path46.join(home(), "tasks.json"),
|
|
72193
72376
|
instanceId,
|
|
72194
72377
|
execute: createConsoleExecutor({ entry: process.argv[1] }),
|
|
72195
72378
|
onDraining: () => {
|
|
@@ -72214,7 +72397,7 @@ async function runConsoleSupervisor() {
|
|
|
72214
72397
|
const cleanup = () => {
|
|
72215
72398
|
var _a3;
|
|
72216
72399
|
try {
|
|
72217
|
-
if (((_a3 = readSession()) == null ? void 0 : _a3.instanceId) === instanceId)
|
|
72400
|
+
if (((_a3 = readSession()) == null ? void 0 : _a3.instanceId) === instanceId) fs44.unlinkSync(sessionPath());
|
|
72218
72401
|
} catch {
|
|
72219
72402
|
}
|
|
72220
72403
|
release();
|
|
@@ -72237,11 +72420,11 @@ async function runConsoleSupervisor() {
|
|
|
72237
72420
|
}
|
|
72238
72421
|
}
|
|
72239
72422
|
async function claimConsoleServerLock(directory) {
|
|
72240
|
-
|
|
72241
|
-
return claimOwnedLock(
|
|
72423
|
+
fs44.mkdirSync(directory, { recursive: true, mode: 448 });
|
|
72424
|
+
return claimOwnedLock(path46.join(directory, "server.lock"));
|
|
72242
72425
|
}
|
|
72243
72426
|
async function claimOwnedLock(filename2) {
|
|
72244
|
-
filename2 =
|
|
72427
|
+
filename2 = path46.join(fs44.realpathSync(path46.dirname(filename2)), path46.basename(filename2));
|
|
72245
72428
|
const identity = `${process.pid}:${randomUUID8()}`;
|
|
72246
72429
|
const recoveryFilename = filename2 + ".recovery";
|
|
72247
72430
|
const releaseMutex = await claimRecoveryMutex2(filename2);
|
|
@@ -72249,10 +72432,10 @@ async function claimOwnedLock(filename2) {
|
|
|
72249
72432
|
claimRecoveryGuard(recoveryFilename, identity);
|
|
72250
72433
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
72251
72434
|
try {
|
|
72252
|
-
|
|
72435
|
+
fs44.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
|
|
72253
72436
|
return () => {
|
|
72254
72437
|
try {
|
|
72255
|
-
if (
|
|
72438
|
+
if (fs44.readFileSync(filename2, "utf8") === identity) fs44.unlinkSync(filename2);
|
|
72256
72439
|
} catch {
|
|
72257
72440
|
}
|
|
72258
72441
|
};
|
|
@@ -72260,7 +72443,7 @@ async function claimOwnedLock(filename2) {
|
|
|
72260
72443
|
if (error2.code !== "EEXIST") throw error2;
|
|
72261
72444
|
let previous;
|
|
72262
72445
|
try {
|
|
72263
|
-
previous =
|
|
72446
|
+
previous = fs44.readFileSync(filename2, "utf8");
|
|
72264
72447
|
} catch (cause) {
|
|
72265
72448
|
if (cause.code === "ENOENT") continue;
|
|
72266
72449
|
throw cause;
|
|
@@ -72275,7 +72458,7 @@ async function claimOwnedLock(filename2) {
|
|
|
72275
72458
|
} catch (cause) {
|
|
72276
72459
|
if (cause.code === "ESRCH") {
|
|
72277
72460
|
try {
|
|
72278
|
-
if (
|
|
72461
|
+
if (fs44.readFileSync(filename2, "utf8") === previous) fs44.unlinkSync(filename2);
|
|
72279
72462
|
} catch (error3) {
|
|
72280
72463
|
if (error3.code !== "ENOENT") throw error3;
|
|
72281
72464
|
}
|
|
@@ -72307,19 +72490,19 @@ function claimRecoveryGuard(filename2, identity) {
|
|
|
72307
72490
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
72308
72491
|
let descriptor;
|
|
72309
72492
|
try {
|
|
72310
|
-
descriptor =
|
|
72493
|
+
descriptor = fs44.openSync(filename2, "wx", 384);
|
|
72311
72494
|
} catch (error2) {
|
|
72312
72495
|
if (error2.code !== "EEXIST") throw error2;
|
|
72313
72496
|
if (reclaimStaleRecoveryGuard(filename2)) continue;
|
|
72314
72497
|
throw new ConsoleError("Console ownership recovery is already in progress.", 409);
|
|
72315
72498
|
}
|
|
72316
72499
|
try {
|
|
72317
|
-
|
|
72500
|
+
fs44.writeFileSync(descriptor, identity, "utf8");
|
|
72318
72501
|
} catch (error2) {
|
|
72319
|
-
|
|
72502
|
+
fs44.unlinkSync(filename2);
|
|
72320
72503
|
throw error2;
|
|
72321
72504
|
} finally {
|
|
72322
|
-
|
|
72505
|
+
fs44.closeSync(descriptor);
|
|
72323
72506
|
}
|
|
72324
72507
|
return;
|
|
72325
72508
|
}
|
|
@@ -72329,8 +72512,8 @@ function reclaimStaleRecoveryGuard(filename2) {
|
|
|
72329
72512
|
let content;
|
|
72330
72513
|
let modified;
|
|
72331
72514
|
try {
|
|
72332
|
-
content =
|
|
72333
|
-
modified =
|
|
72515
|
+
content = fs44.readFileSync(filename2, "utf8");
|
|
72516
|
+
modified = fs44.statSync(filename2).mtimeMs;
|
|
72334
72517
|
} catch (error2) {
|
|
72335
72518
|
return error2.code === "ENOENT";
|
|
72336
72519
|
}
|
|
@@ -72338,8 +72521,8 @@ function reclaimStaleRecoveryGuard(filename2) {
|
|
|
72338
72521
|
const stale = Number.isInteger(pid) && pid > 0 ? processPresence(pid) === "missing" : content === "" && Date.now() - modified >= 2e3;
|
|
72339
72522
|
if (!stale) return false;
|
|
72340
72523
|
try {
|
|
72341
|
-
if (
|
|
72342
|
-
|
|
72524
|
+
if (fs44.readFileSync(filename2, "utf8") === content && fs44.statSync(filename2).mtimeMs === modified) {
|
|
72525
|
+
fs44.unlinkSync(filename2);
|
|
72343
72526
|
return true;
|
|
72344
72527
|
}
|
|
72345
72528
|
} catch (error2) {
|
|
@@ -72349,19 +72532,19 @@ function reclaimStaleRecoveryGuard(filename2) {
|
|
|
72349
72532
|
}
|
|
72350
72533
|
function removeOwnedFile(filename2, identity) {
|
|
72351
72534
|
try {
|
|
72352
|
-
if (
|
|
72535
|
+
if (fs44.readFileSync(filename2, "utf8") === identity) fs44.unlinkSync(filename2);
|
|
72353
72536
|
} catch {
|
|
72354
72537
|
}
|
|
72355
72538
|
}
|
|
72356
72539
|
async function ensureSession() {
|
|
72357
72540
|
var _a3;
|
|
72358
|
-
|
|
72541
|
+
fs44.mkdirSync(home(), { recursive: true, mode: 448 });
|
|
72359
72542
|
const existing = await availableSession();
|
|
72360
72543
|
if (existing) {
|
|
72361
72544
|
ensureCompatibleConsoleLauncher(existing.launcher, launcherIdentity());
|
|
72362
72545
|
return existing;
|
|
72363
72546
|
}
|
|
72364
|
-
const lock =
|
|
72547
|
+
const lock = path46.join(home(), "launch.lock");
|
|
72365
72548
|
let releaseLaunch;
|
|
72366
72549
|
for (let attempt = 0; attempt < 60; attempt++) {
|
|
72367
72550
|
try {
|
|
@@ -72390,7 +72573,7 @@ async function ensureSession() {
|
|
|
72390
72573
|
execArgv: process.execArgv,
|
|
72391
72574
|
entry: process.argv[1],
|
|
72392
72575
|
cwd: home(),
|
|
72393
|
-
logFile:
|
|
72576
|
+
logFile: path46.join(home(), "server.log"),
|
|
72394
72577
|
env: process.env
|
|
72395
72578
|
});
|
|
72396
72579
|
for (let attempt = 0; attempt < 80; attempt++) {
|
|
@@ -72453,7 +72636,7 @@ async function runConsoleCli(action, options3) {
|
|
|
72453
72636
|
if (action !== "open") throw new ConsoleError("Use console open|status|stop.");
|
|
72454
72637
|
const target = typeof options3.target_dir === "string" ? options3.target_dir : void 0;
|
|
72455
72638
|
if (target) {
|
|
72456
|
-
if (!
|
|
72639
|
+
if (!path46.isAbsolute(target))
|
|
72457
72640
|
throw new ConsoleError("--target-dir must be an absolute project path.");
|
|
72458
72641
|
const { previewProject: previewProject2 } = await Promise.resolve().then(() => (init_protocol2(), protocol_exports));
|
|
72459
72642
|
previewProject2(target);
|
|
@@ -72684,16 +72867,16 @@ init_diagnosticRedaction();
|
|
|
72684
72867
|
init_identify();
|
|
72685
72868
|
init_pluginDistribution();
|
|
72686
72869
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
72687
|
-
import
|
|
72688
|
-
import
|
|
72689
|
-
import
|
|
72870
|
+
import fs46 from "node:fs";
|
|
72871
|
+
import os8 from "node:os";
|
|
72872
|
+
import path48 from "node:path";
|
|
72690
72873
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
72691
72874
|
|
|
72692
72875
|
// src/maker/cli/dshMcpConfig.ts
|
|
72693
72876
|
var import_yaml = __toESM(require_dist2());
|
|
72694
|
-
import
|
|
72695
|
-
import
|
|
72696
|
-
import
|
|
72877
|
+
import fs45 from "node:fs";
|
|
72878
|
+
import os7 from "node:os";
|
|
72879
|
+
import path47 from "node:path";
|
|
72697
72880
|
var DSH_MCP_PLUGIN_NAME = "@deepseek-ai/dsh-mcp-client";
|
|
72698
72881
|
var DSH_MAKER_PLUGIN_ID = "mcp-taptap-maker";
|
|
72699
72882
|
var DSH_MAKER_TOOL_CALL_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
@@ -72701,10 +72884,10 @@ function getDshHome(options3 = {}) {
|
|
|
72701
72884
|
var _a3;
|
|
72702
72885
|
const configured = (_a3 = (options3.environment || process.env).DSH_HOME) == null ? void 0 : _a3.trim();
|
|
72703
72886
|
if (configured) {
|
|
72704
|
-
const expanded = configured === "~" ? options3.homeDir ||
|
|
72705
|
-
return
|
|
72887
|
+
const expanded = configured === "~" ? options3.homeDir || os7.homedir() : configured.startsWith("~/") || configured.startsWith("~\\") ? path47.join(options3.homeDir || os7.homedir(), configured.slice(2)) : configured;
|
|
72888
|
+
return path47.resolve(expanded);
|
|
72706
72889
|
}
|
|
72707
|
-
return
|
|
72890
|
+
return path47.join(options3.homeDir || os7.homedir(), ".dsh");
|
|
72708
72891
|
}
|
|
72709
72892
|
function createDshMakerPluginConfig(options3) {
|
|
72710
72893
|
return {
|
|
@@ -72722,8 +72905,8 @@ function createDshMakerPluginConfig(options3) {
|
|
|
72722
72905
|
};
|
|
72723
72906
|
}
|
|
72724
72907
|
function mergeDshMakerMcpConfig(configPath, desired) {
|
|
72725
|
-
const existed =
|
|
72726
|
-
const previousContent = existed ?
|
|
72908
|
+
const existed = fs45.existsSync(configPath);
|
|
72909
|
+
const previousContent = existed ? fs45.readFileSync(configPath, "utf8") : "[]\n";
|
|
72727
72910
|
const document = parseDshDocument(previousContent, configPath);
|
|
72728
72911
|
const sequence = ensurePluginSequence(document, configPath);
|
|
72729
72912
|
const candidates = findDshMakerPluginCandidates(
|
|
@@ -72782,7 +72965,7 @@ function findDshMakerPluginEntry(content, mcpName, source = "DSH config") {
|
|
|
72782
72965
|
}
|
|
72783
72966
|
function getDshMcpInstallPaths(options3) {
|
|
72784
72967
|
const dshHome = getDshHome(options3);
|
|
72785
|
-
const homePatchPath =
|
|
72968
|
+
const homePatchPath = path47.join(dshHome, "cordis.patch.yml");
|
|
72786
72969
|
const homeHasMaker = dshConfigFileHasMaker(homePatchPath, options3.mcpName);
|
|
72787
72970
|
const profilePatchPaths = listDshProfilePatchPathsForInstall(dshHome).filter(
|
|
72788
72971
|
(configPath) => dshConfigFileHasMaker(configPath, options3.mcpName)
|
|
@@ -72798,22 +72981,22 @@ function getDshMcpInstallPaths(options3) {
|
|
|
72798
72981
|
return profilePatchPaths.length > 0 ? profilePatchPaths : [homePatchPath];
|
|
72799
72982
|
}
|
|
72800
72983
|
function listDshProfilePatchPathsForInstall(dshHome) {
|
|
72801
|
-
const profilesDir =
|
|
72984
|
+
const profilesDir = path47.join(dshHome, "profiles");
|
|
72802
72985
|
let entries;
|
|
72803
72986
|
try {
|
|
72804
|
-
entries =
|
|
72987
|
+
entries = fs45.readdirSync(profilesDir, { withFileTypes: true });
|
|
72805
72988
|
} catch (error2) {
|
|
72806
72989
|
if (isMissingPathError(error2)) {
|
|
72807
72990
|
return [];
|
|
72808
72991
|
}
|
|
72809
72992
|
throw error2;
|
|
72810
72993
|
}
|
|
72811
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().map((profileName) =>
|
|
72994
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().map((profileName) => path47.join(profilesDir, profileName, "cordis.patch.yml"));
|
|
72812
72995
|
}
|
|
72813
72996
|
function dshConfigFileHasMaker(configPath, mcpName) {
|
|
72814
72997
|
let content;
|
|
72815
72998
|
try {
|
|
72816
|
-
content =
|
|
72999
|
+
content = fs45.readFileSync(configPath, "utf8");
|
|
72817
73000
|
} catch (error2) {
|
|
72818
73001
|
if (isMissingPathError(error2)) {
|
|
72819
73002
|
return false;
|
|
@@ -72826,21 +73009,21 @@ function isMissingPathError(error2) {
|
|
|
72826
73009
|
return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
|
|
72827
73010
|
}
|
|
72828
73011
|
function listDshMcpConfigPaths(options3) {
|
|
72829
|
-
const dshHome = options3.dshHome ||
|
|
72830
|
-
const paths = [
|
|
72831
|
-
const profilesDir =
|
|
72832
|
-
if (!
|
|
73012
|
+
const dshHome = options3.dshHome || path47.join(options3.homeDir, ".dsh");
|
|
73013
|
+
const paths = [path47.join(dshHome, "cordis.patch.yml")];
|
|
73014
|
+
const profilesDir = path47.join(dshHome, "profiles");
|
|
73015
|
+
if (!fs45.existsSync(profilesDir)) {
|
|
72833
73016
|
return paths;
|
|
72834
73017
|
}
|
|
72835
73018
|
let profileNames = [];
|
|
72836
73019
|
try {
|
|
72837
|
-
profileNames =
|
|
73020
|
+
profileNames = fs45.readdirSync(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().slice(0, 50);
|
|
72838
73021
|
} catch {
|
|
72839
73022
|
return paths;
|
|
72840
73023
|
}
|
|
72841
73024
|
for (const profileName of profileNames) {
|
|
72842
|
-
const profileDir =
|
|
72843
|
-
paths.push(
|
|
73025
|
+
const profileDir = path47.join(profilesDir, profileName);
|
|
73026
|
+
paths.push(path47.join(profileDir, "cordis.patch.yml"), path47.join(profileDir, "cordis.yml"));
|
|
72844
73027
|
}
|
|
72845
73028
|
return paths;
|
|
72846
73029
|
}
|
|
@@ -72892,14 +73075,14 @@ function findDshMakerPluginCandidates(patches, mcpName) {
|
|
|
72892
73075
|
}
|
|
72893
73076
|
function writeDshConfigWithBackup(configPath, previousContent, existed, nextContent, desired) {
|
|
72894
73077
|
const backupPath = existed ? `${configPath}.taptap-maker.bak.latest` : void 0;
|
|
72895
|
-
|
|
73078
|
+
fs45.mkdirSync(path47.dirname(configPath), { recursive: true });
|
|
72896
73079
|
if (backupPath) {
|
|
72897
|
-
|
|
73080
|
+
fs45.writeFileSync(backupPath, previousContent, "utf8");
|
|
72898
73081
|
}
|
|
72899
73082
|
try {
|
|
72900
|
-
|
|
73083
|
+
fs45.writeFileSync(configPath, nextContent, "utf8");
|
|
72901
73084
|
const written = findDshMakerPluginEntry(
|
|
72902
|
-
|
|
73085
|
+
fs45.readFileSync(configPath, "utf8"),
|
|
72903
73086
|
desired.config.serverName,
|
|
72904
73087
|
configPath
|
|
72905
73088
|
);
|
|
@@ -72911,9 +73094,9 @@ function writeDshConfigWithBackup(configPath, previousContent, existed, nextCont
|
|
|
72911
73094
|
return { changed: true, backupPath };
|
|
72912
73095
|
} catch (error2) {
|
|
72913
73096
|
if (existed) {
|
|
72914
|
-
|
|
73097
|
+
fs45.writeFileSync(configPath, previousContent, "utf8");
|
|
72915
73098
|
} else {
|
|
72916
|
-
|
|
73099
|
+
fs45.rmSync(configPath, { force: true });
|
|
72917
73100
|
}
|
|
72918
73101
|
throw error2;
|
|
72919
73102
|
}
|
|
@@ -72992,7 +73175,7 @@ function inspectMakerMcpClientConfig(options3) {
|
|
|
72992
73175
|
if (!configPaths) {
|
|
72993
73176
|
return { ide, status: "unsupported", entries: [] };
|
|
72994
73177
|
}
|
|
72995
|
-
const entries = configPaths.filter((configPath) =>
|
|
73178
|
+
const entries = configPaths.filter((configPath) => fs46.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, options3.mcpName || MAKER_MCP_NAME));
|
|
72996
73179
|
const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
|
|
72997
73180
|
return { ide, status, entries };
|
|
72998
73181
|
}
|
|
@@ -73006,15 +73189,15 @@ function resolveMakerMcpReportRuntime(options3) {
|
|
|
73006
73189
|
`${pluginDistribution.displayName} plugin diagnostics require the active Maker bundle URL.`
|
|
73007
73190
|
);
|
|
73008
73191
|
}
|
|
73009
|
-
const bundlePath =
|
|
73010
|
-
const pluginRoot =
|
|
73192
|
+
const bundlePath = path48.resolve(fileURLToPath4(options3.bundleUrl));
|
|
73193
|
+
const pluginRoot = path48.dirname(path48.dirname(bundlePath));
|
|
73011
73194
|
const execPath = options3.execPath ?? process.execPath;
|
|
73012
73195
|
return {
|
|
73013
73196
|
distribution: pluginDistribution.id,
|
|
73014
73197
|
client: pluginDistribution.client,
|
|
73015
73198
|
config_source: {
|
|
73016
73199
|
format: "json",
|
|
73017
|
-
paths: [
|
|
73200
|
+
paths: [path48.join(pluginRoot, ".mcp.json")],
|
|
73018
73201
|
mcp_name: "taptap-maker-plugin"
|
|
73019
73202
|
},
|
|
73020
73203
|
launcher: {
|
|
@@ -73064,9 +73247,9 @@ function buildMakerMcpIssue(options3) {
|
|
|
73064
73247
|
async function collectMakerMcpIssueDiagnostics(options3) {
|
|
73065
73248
|
var _a3, _b;
|
|
73066
73249
|
const platform = options3.platform || process.platform;
|
|
73067
|
-
const homeDir = options3.homeDir ||
|
|
73068
|
-
const processCwd =
|
|
73069
|
-
const targetDir =
|
|
73250
|
+
const homeDir = options3.homeDir || os8.homedir();
|
|
73251
|
+
const processCwd = path48.resolve(options3.processCwd || process.cwd());
|
|
73252
|
+
const targetDir = path48.resolve(options3.targetDir);
|
|
73070
73253
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
73071
73254
|
const projectContext = identify.projectRoot ? {
|
|
73072
73255
|
status: "bound",
|
|
@@ -73146,29 +73329,29 @@ function submitMakerMcpIssue(issue3, options3 = {}) {
|
|
|
73146
73329
|
function getMcpConfigPaths(options3) {
|
|
73147
73330
|
const { ide, homeDir, platform } = options3;
|
|
73148
73331
|
if (ide === "codex") {
|
|
73149
|
-
return [
|
|
73332
|
+
return [path48.join(homeDir, ".codex", "config.toml")];
|
|
73150
73333
|
}
|
|
73151
73334
|
if (ide === "cursor") {
|
|
73152
|
-
return [
|
|
73335
|
+
return [path48.join(homeDir, ".cursor", "mcp.json")];
|
|
73153
73336
|
}
|
|
73154
73337
|
if (ide === "claude") {
|
|
73155
|
-
return [
|
|
73338
|
+
return [path48.join(homeDir, ".claude.json")];
|
|
73156
73339
|
}
|
|
73157
73340
|
if (ide === "opencode") {
|
|
73158
|
-
return [
|
|
73341
|
+
return [path48.join(homeDir, ".config", "opencode", "opencode.jsonc")];
|
|
73159
73342
|
}
|
|
73160
73343
|
if (ide === "workbuddy") {
|
|
73161
|
-
const primary =
|
|
73162
|
-
if (
|
|
73344
|
+
const primary = path48.join(homeDir, ".workbuddy", "mcp.json");
|
|
73345
|
+
if (fs46.existsSync(primary)) {
|
|
73163
73346
|
return [primary];
|
|
73164
73347
|
}
|
|
73165
|
-
const legacy =
|
|
73166
|
-
return
|
|
73348
|
+
const legacy = path48.join(homeDir, ".workbuddy", ".mcp.json");
|
|
73349
|
+
return fs46.existsSync(legacy) ? [legacy] : [primary];
|
|
73167
73350
|
}
|
|
73168
73351
|
if (ide === "trae") {
|
|
73169
|
-
const root2 = platform === "win32" ? options3.appData ||
|
|
73352
|
+
const root2 = platform === "win32" ? options3.appData || path48.join(homeDir, "AppData", "Roaming") : path48.join(homeDir, "Library", "Application Support");
|
|
73170
73353
|
return ["TRAE SOLO", "TRAE SOLO CN", "Trae", "TRAE", "Trae CN"].map(
|
|
73171
|
-
(name) =>
|
|
73354
|
+
(name) => path48.join(root2, name, "User", "mcp.json")
|
|
73172
73355
|
);
|
|
73173
73356
|
}
|
|
73174
73357
|
if (ide === "dsh") {
|
|
@@ -73179,7 +73362,7 @@ function getMcpConfigPaths(options3) {
|
|
|
73179
73362
|
function inspectMcpConfigFile(configPath, ide, mcpName, format) {
|
|
73180
73363
|
try {
|
|
73181
73364
|
const resolvedFormat = format ?? (ide === "codex" ? "codex_toml" : ide === "dsh" ? "dsh" : ide === "opencode" ? "jsonc" : "json");
|
|
73182
|
-
const content =
|
|
73365
|
+
const content = fs46.readFileSync(configPath, "utf8");
|
|
73183
73366
|
const server = resolvedFormat === "codex_toml" ? extractCodexMcpServerConfig(content, mcpName) : resolvedFormat === "dsh" ? extractDshMcpServerConfig(content, mcpName, configPath) : extractMakerMcpServerConfig(
|
|
73184
73367
|
parseJsonConfig(content, resolvedFormat === "jsonc"),
|
|
73185
73368
|
mcpName
|
|
@@ -73190,7 +73373,7 @@ function inspectMcpConfigFile(configPath, ide, mcpName, format) {
|
|
|
73190
73373
|
}
|
|
73191
73374
|
}
|
|
73192
73375
|
function inspectMakerMcpConfigSource(ide, source) {
|
|
73193
|
-
const entries = source.paths.filter((configPath) =>
|
|
73376
|
+
const entries = source.paths.filter((configPath) => fs46.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
|
|
73194
73377
|
const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
|
|
73195
73378
|
return { ide, status, entries };
|
|
73196
73379
|
}
|
|
@@ -73407,13 +73590,13 @@ function inspectWorkBuddyTrust(homeDir, mcpName) {
|
|
|
73407
73590
|
pending_accounts: 0,
|
|
73408
73591
|
unreadable_accounts: 0
|
|
73409
73592
|
};
|
|
73410
|
-
const connectorsDir =
|
|
73411
|
-
if (!
|
|
73593
|
+
const connectorsDir = path48.join(homeDir, ".workbuddy", "connectors");
|
|
73594
|
+
if (!fs46.existsSync(connectorsDir)) {
|
|
73412
73595
|
return { status: "not_found", ...emptyCounts };
|
|
73413
73596
|
}
|
|
73414
73597
|
let entries;
|
|
73415
73598
|
try {
|
|
73416
|
-
entries =
|
|
73599
|
+
entries = fs46.readdirSync(connectorsDir, { withFileTypes: true });
|
|
73417
73600
|
} catch {
|
|
73418
73601
|
return { status: "unreadable", ...emptyCounts };
|
|
73419
73602
|
}
|
|
@@ -73422,12 +73605,12 @@ function inspectWorkBuddyTrust(homeDir, mcpName) {
|
|
|
73422
73605
|
if (!entry.isDirectory()) {
|
|
73423
73606
|
continue;
|
|
73424
73607
|
}
|
|
73425
|
-
const statePath =
|
|
73426
|
-
if (!
|
|
73608
|
+
const statePath = path48.join(connectorsDir, entry.name, "connector-states.json");
|
|
73609
|
+
if (!fs46.existsSync(statePath)) {
|
|
73427
73610
|
continue;
|
|
73428
73611
|
}
|
|
73429
73612
|
try {
|
|
73430
|
-
const state = JSON.parse(
|
|
73613
|
+
const state = JSON.parse(fs46.readFileSync(statePath, "utf8"));
|
|
73431
73614
|
if (!isRecord4(state)) {
|
|
73432
73615
|
counts.accounts_checked += 1;
|
|
73433
73616
|
counts.unreadable_accounts += 1;
|
|
@@ -73622,9 +73805,9 @@ function stripControlCharacters(value) {
|
|
|
73622
73805
|
|
|
73623
73806
|
// src/maker/cli/pluginMigration.ts
|
|
73624
73807
|
init_storage();
|
|
73625
|
-
import
|
|
73626
|
-
import
|
|
73627
|
-
import
|
|
73808
|
+
import fs48 from "node:fs";
|
|
73809
|
+
import os9 from "node:os";
|
|
73810
|
+
import path50 from "node:path";
|
|
73628
73811
|
import crypto3 from "node:crypto";
|
|
73629
73812
|
|
|
73630
73813
|
// src/maker/cli/codexMcpConfig.ts
|
|
@@ -73831,28 +74014,28 @@ function escapeRegExp3(value) {
|
|
|
73831
74014
|
}
|
|
73832
74015
|
|
|
73833
74016
|
// src/maker/cli/configWrite.ts
|
|
73834
|
-
import
|
|
73835
|
-
import
|
|
74017
|
+
import fs47 from "node:fs";
|
|
74018
|
+
import path49 from "node:path";
|
|
73836
74019
|
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate2) {
|
|
73837
|
-
const existed =
|
|
73838
|
-
const previousContent = existed ?
|
|
74020
|
+
const existed = fs47.existsSync(filePath);
|
|
74021
|
+
const previousContent = existed ? fs47.readFileSync(filePath, "utf8") : void 0;
|
|
73839
74022
|
if (previousContent === nextContent) {
|
|
73840
74023
|
return { changed: false };
|
|
73841
74024
|
}
|
|
73842
74025
|
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
73843
|
-
|
|
74026
|
+
fs47.mkdirSync(path49.dirname(filePath), { recursive: true });
|
|
73844
74027
|
if (previousContent !== void 0 && backupPath) {
|
|
73845
|
-
|
|
74028
|
+
fs47.writeFileSync(backupPath, previousContent, "utf8");
|
|
73846
74029
|
}
|
|
73847
74030
|
try {
|
|
73848
|
-
|
|
73849
|
-
validate2 == null ? void 0 : validate2(
|
|
74031
|
+
fs47.writeFileSync(filePath, nextContent, "utf8");
|
|
74032
|
+
validate2 == null ? void 0 : validate2(fs47.readFileSync(filePath, "utf8"));
|
|
73850
74033
|
return { changed: true, backupPath };
|
|
73851
74034
|
} catch (error2) {
|
|
73852
74035
|
if (previousContent !== void 0) {
|
|
73853
|
-
|
|
74036
|
+
fs47.writeFileSync(filePath, previousContent, "utf8");
|
|
73854
74037
|
} else {
|
|
73855
|
-
|
|
74038
|
+
fs47.rmSync(filePath, { force: true });
|
|
73856
74039
|
}
|
|
73857
74040
|
throw error2;
|
|
73858
74041
|
}
|
|
@@ -73860,11 +74043,11 @@ function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate2)
|
|
|
73860
74043
|
|
|
73861
74044
|
// src/maker/cli/pluginMigration.ts
|
|
73862
74045
|
function inspectCodexLegacyMakerMcp(options3 = {}) {
|
|
73863
|
-
const configPath = options3.configPath ??
|
|
73864
|
-
if (!
|
|
74046
|
+
const configPath = options3.configPath ?? path50.join(os9.homedir(), ".codex", "config.toml");
|
|
74047
|
+
if (!fs48.existsSync(configPath)) {
|
|
73865
74048
|
return createInspection(configPath, "not_found", 0);
|
|
73866
74049
|
}
|
|
73867
|
-
const content =
|
|
74050
|
+
const content = fs48.readFileSync(configPath, "utf8");
|
|
73868
74051
|
const registrations = findCodexMakerMainTables(content);
|
|
73869
74052
|
if (registrations.length === 0) {
|
|
73870
74053
|
return createInspection(configPath, "not_found", 0);
|
|
@@ -73879,7 +74062,7 @@ function inspectCodexLegacyMakerMcp(options3 = {}) {
|
|
|
73879
74062
|
};
|
|
73880
74063
|
}
|
|
73881
74064
|
function migrateCodexLegacyMakerMcp(options3 = {}) {
|
|
73882
|
-
const configPath = options3.configPath ??
|
|
74065
|
+
const configPath = options3.configPath ?? path50.join(os9.homedir(), ".codex", "config.toml");
|
|
73883
74066
|
const makerHome = options3.makerHome ?? getMakerHome();
|
|
73884
74067
|
const statePath = getCodexPluginMigrationStatePath(makerHome);
|
|
73885
74068
|
const inspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
@@ -73893,7 +74076,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
|
|
|
73893
74076
|
}
|
|
73894
74077
|
if (inspection.status === "disabled") {
|
|
73895
74078
|
const state2 = readMigrationState(statePath);
|
|
73896
|
-
const content =
|
|
74079
|
+
const content = fs48.readFileSync(configPath, "utf8");
|
|
73897
74080
|
const registration2 = findCodexMakerMainTables(content)[0];
|
|
73898
74081
|
const owned = (state2 == null ? void 0 : state2.config_path) === configPath && sha256(readCodexMakerRegistration(content, registration2)) === state2.migrated_registration_sha256;
|
|
73899
74082
|
return {
|
|
@@ -73906,7 +74089,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
|
|
|
73906
74089
|
if (!options3.confirm) {
|
|
73907
74090
|
throw new Error("Disabling the legacy Codex Maker MCP requires explicit confirmation.");
|
|
73908
74091
|
}
|
|
73909
|
-
const previousContent =
|
|
74092
|
+
const previousContent = fs48.readFileSync(configPath, "utf8");
|
|
73910
74093
|
const registration = findCodexMakerMainTables(previousContent)[0];
|
|
73911
74094
|
const nextContent = disableCodexMakerRegistration(previousContent, registration);
|
|
73912
74095
|
const state = {
|
|
@@ -73920,13 +74103,13 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
|
|
|
73920
74103
|
),
|
|
73921
74104
|
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
73922
74105
|
};
|
|
73923
|
-
|
|
74106
|
+
fs48.mkdirSync(path50.dirname(statePath), { recursive: true });
|
|
73924
74107
|
const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
|
|
73925
74108
|
const migratedInspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
73926
74109
|
if (migratedInspection.status !== "disabled") {
|
|
73927
74110
|
throw new Error("Codex Maker MCP migration validation did not find a disabled registration.");
|
|
73928
74111
|
}
|
|
73929
|
-
|
|
74112
|
+
fs48.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
73930
74113
|
`, "utf8");
|
|
73931
74114
|
});
|
|
73932
74115
|
return {
|
|
@@ -73938,7 +74121,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
|
|
|
73938
74121
|
};
|
|
73939
74122
|
}
|
|
73940
74123
|
function restoreCodexLegacyMakerMcp(options3 = {}) {
|
|
73941
|
-
const configPath = options3.configPath ??
|
|
74124
|
+
const configPath = options3.configPath ?? path50.join(os9.homedir(), ".codex", "config.toml");
|
|
73942
74125
|
const makerHome = options3.makerHome ?? getMakerHome();
|
|
73943
74126
|
const statePath = getCodexPluginMigrationStatePath(makerHome);
|
|
73944
74127
|
const inspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
@@ -73959,14 +74142,14 @@ function restoreCodexLegacyMakerMcp(options3 = {}) {
|
|
|
73959
74142
|
"The migrated Codex Maker MCP registration no longer exists and cannot be restored."
|
|
73960
74143
|
);
|
|
73961
74144
|
}
|
|
73962
|
-
const previousContent =
|
|
74145
|
+
const previousContent = fs48.readFileSync(configPath, "utf8");
|
|
73963
74146
|
const registration = findCodexMakerMainTables(previousContent)[0];
|
|
73964
74147
|
const registrationSha256 = sha256(readCodexMakerRegistration(previousContent, registration));
|
|
73965
74148
|
if (inspection.status === "active") {
|
|
73966
74149
|
if (registrationSha256 !== state.original_registration_sha256) {
|
|
73967
74150
|
return { ...inspection, action: "not_owned", changed: false };
|
|
73968
74151
|
}
|
|
73969
|
-
|
|
74152
|
+
fs48.unlinkSync(statePath);
|
|
73970
74153
|
return { ...inspection, action: "already_restored", changed: false };
|
|
73971
74154
|
}
|
|
73972
74155
|
if (registrationSha256 !== state.migrated_registration_sha256) {
|
|
@@ -73980,12 +74163,12 @@ function restoreCodexLegacyMakerMcp(options3 = {}) {
|
|
|
73980
74163
|
"Codex Maker MCP restoration validation did not find an active registration."
|
|
73981
74164
|
);
|
|
73982
74165
|
}
|
|
73983
|
-
const restoredContent =
|
|
74166
|
+
const restoredContent = fs48.readFileSync(configPath, "utf8");
|
|
73984
74167
|
const restoredRegistration = findCodexMakerMainTables(restoredContent)[0];
|
|
73985
74168
|
if (sha256(readCodexMakerRegistration(restoredContent, restoredRegistration)) !== state.original_registration_sha256) {
|
|
73986
74169
|
throw new Error("Codex Maker MCP restoration changed the migrated registration identity.");
|
|
73987
74170
|
}
|
|
73988
|
-
|
|
74171
|
+
fs48.unlinkSync(statePath);
|
|
73989
74172
|
});
|
|
73990
74173
|
return {
|
|
73991
74174
|
...inspectCodexLegacyMakerMcp({ configPath }),
|
|
@@ -74048,14 +74231,14 @@ function readCodexMakerRegistration(content, registration) {
|
|
|
74048
74231
|
return content.slice(registration.headerStart, registration.bodyEnd).trimEnd();
|
|
74049
74232
|
}
|
|
74050
74233
|
function getCodexPluginMigrationStatePath(makerHome) {
|
|
74051
|
-
return
|
|
74234
|
+
return path50.join(makerHome, "plugin-migrations", "codex.json");
|
|
74052
74235
|
}
|
|
74053
74236
|
function readMigrationState(statePath) {
|
|
74054
|
-
if (!
|
|
74237
|
+
if (!fs48.existsSync(statePath)) {
|
|
74055
74238
|
return void 0;
|
|
74056
74239
|
}
|
|
74057
74240
|
try {
|
|
74058
|
-
const state = JSON.parse(
|
|
74241
|
+
const state = JSON.parse(fs48.readFileSync(statePath, "utf8"));
|
|
74059
74242
|
return (state == null ? void 0 : state.schema_version) === 2 && state.client === "codex" ? state : void 0;
|
|
74060
74243
|
} catch {
|
|
74061
74244
|
return void 0;
|
|
@@ -74145,7 +74328,7 @@ function migrateWorkBuddyLegacyMakerMcp(options3 = {}) {
|
|
|
74145
74328
|
migrated_registration_sha256: hashWorkBuddyRegistration(migratedRegistration),
|
|
74146
74329
|
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
74147
74330
|
};
|
|
74148
|
-
|
|
74331
|
+
fs48.mkdirSync(path50.dirname(statePath), { recursive: true });
|
|
74149
74332
|
const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
|
|
74150
74333
|
const migrated = findWorkBuddyMakerRegistrations(configPaths).find(
|
|
74151
74334
|
(entry) => entry.configPath === current.configPath
|
|
@@ -74155,7 +74338,7 @@ function migrateWorkBuddyLegacyMakerMcp(options3 = {}) {
|
|
|
74155
74338
|
"WorkBuddy Maker MCP migration validation did not find the disabled registration."
|
|
74156
74339
|
);
|
|
74157
74340
|
}
|
|
74158
|
-
|
|
74341
|
+
fs48.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
74159
74342
|
`, "utf8");
|
|
74160
74343
|
});
|
|
74161
74344
|
const migratedInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
@@ -74209,7 +74392,7 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
|
|
|
74209
74392
|
changed: false
|
|
74210
74393
|
};
|
|
74211
74394
|
}
|
|
74212
|
-
|
|
74395
|
+
fs48.unlinkSync(statePath);
|
|
74213
74396
|
return {
|
|
74214
74397
|
...inspection,
|
|
74215
74398
|
config_path: current.configPath,
|
|
@@ -74242,7 +74425,7 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
|
|
|
74242
74425
|
if (!restored || hashWorkBuddyRegistration(restored.registration) !== state.original_registration_sha256) {
|
|
74243
74426
|
throw new Error("WorkBuddy Maker MCP restoration changed the registration identity.");
|
|
74244
74427
|
}
|
|
74245
|
-
|
|
74428
|
+
fs48.unlinkSync(statePath);
|
|
74246
74429
|
});
|
|
74247
74430
|
return {
|
|
74248
74431
|
...inspectWorkBuddyLegacyMakerMcp({ configPaths }),
|
|
@@ -74255,19 +74438,19 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
|
|
|
74255
74438
|
}
|
|
74256
74439
|
function getWorkBuddyConfigPaths(configPaths) {
|
|
74257
74440
|
return configPaths ?? [
|
|
74258
|
-
|
|
74259
|
-
|
|
74441
|
+
path50.join(os9.homedir(), ".workbuddy", "mcp.json"),
|
|
74442
|
+
path50.join(os9.homedir(), ".workbuddy", ".mcp.json")
|
|
74260
74443
|
];
|
|
74261
74444
|
}
|
|
74262
74445
|
function findWorkBuddyMakerRegistrations(configPaths) {
|
|
74263
74446
|
const registrations = [];
|
|
74264
74447
|
for (const configPath of configPaths) {
|
|
74265
|
-
if (!
|
|
74448
|
+
if (!fs48.existsSync(configPath)) {
|
|
74266
74449
|
continue;
|
|
74267
74450
|
}
|
|
74268
74451
|
let config2;
|
|
74269
74452
|
try {
|
|
74270
|
-
config2 = JSON.parse(
|
|
74453
|
+
config2 = JSON.parse(fs48.readFileSync(configPath, "utf8"));
|
|
74271
74454
|
} catch (error2) {
|
|
74272
74455
|
throw new Error(
|
|
74273
74456
|
`Cannot parse WorkBuddy MCP config ${configPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
@@ -74302,14 +74485,14 @@ function setWorkBuddyMakerRegistration(config2, registration) {
|
|
|
74302
74485
|
servers["taptap-maker"] = registration;
|
|
74303
74486
|
}
|
|
74304
74487
|
function getWorkBuddyPluginMigrationStatePath(makerHome) {
|
|
74305
|
-
return
|
|
74488
|
+
return path50.join(makerHome, "plugin-migrations", "workbuddy.json");
|
|
74306
74489
|
}
|
|
74307
74490
|
function readWorkBuddyMigrationState(statePath) {
|
|
74308
|
-
if (!
|
|
74491
|
+
if (!fs48.existsSync(statePath)) {
|
|
74309
74492
|
return void 0;
|
|
74310
74493
|
}
|
|
74311
74494
|
try {
|
|
74312
|
-
const state = JSON.parse(
|
|
74495
|
+
const state = JSON.parse(fs48.readFileSync(statePath, "utf8"));
|
|
74313
74496
|
return (state == null ? void 0 : state.schema_version) === 1 && state.client === "workbuddy" ? state : void 0;
|
|
74314
74497
|
} catch {
|
|
74315
74498
|
return void 0;
|
|
@@ -74334,9 +74517,9 @@ function isRecord5(value) {
|
|
|
74334
74517
|
// src/maker/cli/dshPluginMigration.ts
|
|
74335
74518
|
var import_yaml2 = __toESM(require_dist2());
|
|
74336
74519
|
init_storage();
|
|
74337
|
-
import
|
|
74338
|
-
import
|
|
74339
|
-
import
|
|
74520
|
+
import fs49 from "node:fs";
|
|
74521
|
+
import os10 from "node:os";
|
|
74522
|
+
import path51 from "node:path";
|
|
74340
74523
|
import crypto4 from "node:crypto";
|
|
74341
74524
|
var DSH_MAKER_MCP_NAME = "taptap-maker";
|
|
74342
74525
|
function inspectDshLegacyMakerMcp(options3 = {}) {
|
|
@@ -74369,7 +74552,7 @@ function migrateDshLegacyMakerMcp(options3 = {}) {
|
|
|
74369
74552
|
);
|
|
74370
74553
|
}
|
|
74371
74554
|
const registration = registrations[0];
|
|
74372
|
-
const previousContent =
|
|
74555
|
+
const previousContent = fs49.readFileSync(registration.configPath, "utf8");
|
|
74373
74556
|
const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
|
|
74374
74557
|
if (document.errors.length > 0) {
|
|
74375
74558
|
throw new Error(`Invalid YAML in ${registration.configPath}: ${document.errors[0].message}`);
|
|
@@ -74384,13 +74567,13 @@ function migrateDshLegacyMakerMcp(options3 = {}) {
|
|
|
74384
74567
|
removed_registration_sha256: sha2562(JSON.stringify(registration.registration)),
|
|
74385
74568
|
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
74386
74569
|
};
|
|
74387
|
-
|
|
74570
|
+
fs49.mkdirSync(path51.dirname(statePath), { recursive: true });
|
|
74388
74571
|
const write = writeConfigWithTapTapBackupIfChanged(registration.configPath, nextContent, () => {
|
|
74389
74572
|
const after = findDshMakerRegistrations(options3.dshHome);
|
|
74390
74573
|
if (after.some((entry) => entry.configPath === registration.configPath)) {
|
|
74391
74574
|
throw new Error("DSH Maker MCP migration validation still found a registration.");
|
|
74392
74575
|
}
|
|
74393
|
-
|
|
74576
|
+
fs49.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
74394
74577
|
`, "utf8");
|
|
74395
74578
|
});
|
|
74396
74579
|
return {
|
|
@@ -74423,13 +74606,13 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
|
|
|
74423
74606
|
const current = findDshMakerRegistrations(options3.dshHome)[0];
|
|
74424
74607
|
const currentSha = sha2562(JSON.stringify(current.registration));
|
|
74425
74608
|
if (currentSha === state.removed_registration_sha256) {
|
|
74426
|
-
|
|
74609
|
+
fs49.rmSync(statePath, { force: true });
|
|
74427
74610
|
return { ...inspection, action: "already_restored", changed: false, state_path: statePath };
|
|
74428
74611
|
}
|
|
74429
74612
|
return { ...inspection, action: "not_owned", changed: false };
|
|
74430
74613
|
}
|
|
74431
74614
|
const configPath = state.config_path;
|
|
74432
|
-
const previousContent =
|
|
74615
|
+
const previousContent = fs49.readFileSync(configPath, "utf8");
|
|
74433
74616
|
const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
|
|
74434
74617
|
if (document.errors.length > 0) {
|
|
74435
74618
|
throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
|
|
@@ -74442,7 +74625,7 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
|
|
|
74442
74625
|
if (!match || sha2562(JSON.stringify(match.registration)) !== state.removed_registration_sha256) {
|
|
74443
74626
|
throw new Error("DSH Maker MCP restoration changed the registration identity.");
|
|
74444
74627
|
}
|
|
74445
|
-
|
|
74628
|
+
fs49.rmSync(statePath, { force: true });
|
|
74446
74629
|
});
|
|
74447
74630
|
return {
|
|
74448
74631
|
...inspectDshLegacyMakerMcp(options3),
|
|
@@ -74454,13 +74637,13 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
|
|
|
74454
74637
|
}
|
|
74455
74638
|
function findDshMakerRegistrations(dshHome) {
|
|
74456
74639
|
const resolvedDshHome = dshHome || getDshHome();
|
|
74457
|
-
const configPaths = listDshMcpConfigPaths({ homeDir:
|
|
74640
|
+
const configPaths = listDshMcpConfigPaths({ homeDir: os10.homedir(), dshHome: resolvedDshHome });
|
|
74458
74641
|
const registrations = [];
|
|
74459
74642
|
for (const configPath of configPaths) {
|
|
74460
|
-
if (!
|
|
74643
|
+
if (!fs49.existsSync(configPath)) {
|
|
74461
74644
|
continue;
|
|
74462
74645
|
}
|
|
74463
|
-
const content =
|
|
74646
|
+
const content = fs49.readFileSync(configPath, "utf8");
|
|
74464
74647
|
const document = (0, import_yaml2.parseDocument)(content, { prettyErrors: true });
|
|
74465
74648
|
if (document.errors.length > 0) {
|
|
74466
74649
|
throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
|
|
@@ -74545,14 +74728,14 @@ function isDshMakerPluginCandidate(value) {
|
|
|
74545
74728
|
return value.name === DSH_MCP_PLUGIN_NAME && (config2 == null ? void 0 : config2.serverName) === DSH_MAKER_MCP_NAME;
|
|
74546
74729
|
}
|
|
74547
74730
|
function getDshPluginMigrationStatePath(makerHome) {
|
|
74548
|
-
return
|
|
74731
|
+
return path51.join(makerHome, "plugin-migrations", "dsh.json");
|
|
74549
74732
|
}
|
|
74550
74733
|
function readDshMigrationState(statePath) {
|
|
74551
|
-
if (!
|
|
74734
|
+
if (!fs49.existsSync(statePath)) {
|
|
74552
74735
|
return void 0;
|
|
74553
74736
|
}
|
|
74554
74737
|
try {
|
|
74555
|
-
const state = JSON.parse(
|
|
74738
|
+
const state = JSON.parse(fs49.readFileSync(statePath, "utf8"));
|
|
74556
74739
|
return (state == null ? void 0 : state.schema_version) === 1 && state.client === "dsh" ? state : void 0;
|
|
74557
74740
|
} catch {
|
|
74558
74741
|
return void 0;
|
|
@@ -74593,9 +74776,9 @@ init_config();
|
|
|
74593
74776
|
init_fetchTimeout();
|
|
74594
74777
|
init_identify();
|
|
74595
74778
|
init_storage();
|
|
74596
|
-
import
|
|
74597
|
-
import
|
|
74598
|
-
import
|
|
74779
|
+
import fs50 from "node:fs";
|
|
74780
|
+
import os11 from "node:os";
|
|
74781
|
+
import path52 from "node:path";
|
|
74599
74782
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
74600
74783
|
import { Readable, Transform } from "node:stream";
|
|
74601
74784
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
@@ -74605,7 +74788,7 @@ var MAX_ARCHIVE_ENTRIES = 1e3;
|
|
|
74605
74788
|
var MAX_ARCHIVE_EXTRACTED_BYTES = 128 * 1024 * 1024;
|
|
74606
74789
|
async function pullMakerUserSkills(options3 = {}) {
|
|
74607
74790
|
var _a3, _b;
|
|
74608
|
-
const requestedDir =
|
|
74791
|
+
const requestedDir = path52.resolve(options3.targetDir || process.cwd());
|
|
74609
74792
|
const project = identifyMakerProject({ cwd: requestedDir });
|
|
74610
74793
|
if (!project.projectRoot) {
|
|
74611
74794
|
throw new Error(
|
|
@@ -74617,10 +74800,10 @@ async function pullMakerUserSkills(options3 = {}) {
|
|
|
74617
74800
|
if (!token) {
|
|
74618
74801
|
throw new Error("Maker authentication not found. Run `taptap-maker login` and try again.");
|
|
74619
74802
|
}
|
|
74620
|
-
const sourceDir =
|
|
74621
|
-
const tempDir =
|
|
74622
|
-
const archivePath =
|
|
74623
|
-
const stagingDir =
|
|
74803
|
+
const sourceDir = path52.join(project.projectRoot, ".installer", "skills");
|
|
74804
|
+
const tempDir = fs50.mkdtempSync(path52.join(os11.tmpdir(), "taptap-maker-user-skills-"));
|
|
74805
|
+
const archivePath = path52.join(tempDir, "user-skills.zip");
|
|
74806
|
+
const stagingDir = path52.join(tempDir, "skills");
|
|
74624
74807
|
try {
|
|
74625
74808
|
const response = await fetchWithTimeout(
|
|
74626
74809
|
options3.fetchImpl || fetch,
|
|
@@ -74652,7 +74835,7 @@ async function pullMakerUserSkills(options3 = {}) {
|
|
|
74652
74835
|
preservedSkills
|
|
74653
74836
|
};
|
|
74654
74837
|
} finally {
|
|
74655
|
-
|
|
74838
|
+
fs50.rmSync(tempDir, { recursive: true, force: true });
|
|
74656
74839
|
}
|
|
74657
74840
|
}
|
|
74658
74841
|
async function writeArchiveResponse(response, archivePath) {
|
|
@@ -74677,7 +74860,7 @@ async function writeArchiveResponse(response, archivePath) {
|
|
|
74677
74860
|
await pipeline2(
|
|
74678
74861
|
Readable.fromWeb(response.body),
|
|
74679
74862
|
limit,
|
|
74680
|
-
|
|
74863
|
+
fs50.createWriteStream(archivePath, { flags: "wx" })
|
|
74681
74864
|
);
|
|
74682
74865
|
}
|
|
74683
74866
|
function validateUserSkillArchivePath(entryPath) {
|
|
@@ -74692,7 +74875,7 @@ function validateUserSkillArchivePath(entryPath) {
|
|
|
74692
74875
|
return segments;
|
|
74693
74876
|
}
|
|
74694
74877
|
async function extractUserSkillsArchive(archivePath, stagingDir) {
|
|
74695
|
-
|
|
74878
|
+
fs50.mkdirSync(stagingDir, { recursive: true });
|
|
74696
74879
|
const zipFile = await import_yauzl.default.openPromise(archivePath, {
|
|
74697
74880
|
lazyEntries: true,
|
|
74698
74881
|
decodeStrings: true,
|
|
@@ -74712,7 +74895,7 @@ async function extractUserSkillsArchive(archivePath, stagingDir) {
|
|
|
74712
74895
|
);
|
|
74713
74896
|
}
|
|
74714
74897
|
const segments = validateUserSkillArchivePath(entry.fileName);
|
|
74715
|
-
if (segments.some((segment) =>
|
|
74898
|
+
if (segments.some((segment) => path52.basename(segment).startsWith(".nfs"))) {
|
|
74716
74899
|
continue;
|
|
74717
74900
|
}
|
|
74718
74901
|
const isDirectory2 = isZipDirectory(entry);
|
|
@@ -74734,24 +74917,24 @@ async function extractUserSkillsArchive(archivePath, stagingDir) {
|
|
|
74734
74917
|
}
|
|
74735
74918
|
seenPaths.add(collisionKey);
|
|
74736
74919
|
skillNames.add(segments[0]);
|
|
74737
|
-
const destination =
|
|
74920
|
+
const destination = path52.join(stagingDir, ...segments);
|
|
74738
74921
|
if (isDirectory2) {
|
|
74739
|
-
|
|
74922
|
+
fs50.mkdirSync(destination, { recursive: true });
|
|
74740
74923
|
continue;
|
|
74741
74924
|
}
|
|
74742
|
-
|
|
74925
|
+
fs50.mkdirSync(path52.dirname(destination), { recursive: true });
|
|
74743
74926
|
const input2 = await zipFile.openReadStreamPromise(entry);
|
|
74744
|
-
await pipeline2(input2,
|
|
74927
|
+
await pipeline2(input2, fs50.createWriteStream(destination, { flags: "wx" }));
|
|
74745
74928
|
}
|
|
74746
74929
|
} finally {
|
|
74747
74930
|
zipFile.close();
|
|
74748
74931
|
}
|
|
74749
74932
|
const installedSkills = [...skillNames].sort();
|
|
74750
74933
|
for (const skillName of installedSkills) {
|
|
74751
|
-
const definitionPath =
|
|
74934
|
+
const definitionPath = path52.join(stagingDir, skillName, "SKILL.md");
|
|
74752
74935
|
let definition;
|
|
74753
74936
|
try {
|
|
74754
|
-
definition =
|
|
74937
|
+
definition = fs50.lstatSync(definitionPath);
|
|
74755
74938
|
} catch {
|
|
74756
74939
|
throw new Error(`Maker user Skill "${skillName}" is missing SKILL.md.`);
|
|
74757
74940
|
}
|
|
@@ -74785,31 +74968,31 @@ function installUserSkills(projectRoot, stagingDir, skillNames) {
|
|
|
74785
74968
|
if (skillNames.length === 0) {
|
|
74786
74969
|
return;
|
|
74787
74970
|
}
|
|
74788
|
-
const installerDir =
|
|
74789
|
-
const sourceDir =
|
|
74790
|
-
const transactionDir =
|
|
74791
|
-
const preparedDir =
|
|
74792
|
-
const backupDir =
|
|
74971
|
+
const installerDir = path52.join(projectRoot, ".installer");
|
|
74972
|
+
const sourceDir = path52.join(installerDir, "skills");
|
|
74973
|
+
const transactionDir = path52.join(installerDir, `.user-skills-${randomUUID9()}`);
|
|
74974
|
+
const preparedDir = path52.join(transactionDir, "prepared");
|
|
74975
|
+
const backupDir = path52.join(transactionDir, "backup");
|
|
74793
74976
|
const completed = [];
|
|
74794
74977
|
let preserveTransaction = false;
|
|
74795
|
-
|
|
74796
|
-
|
|
74978
|
+
fs50.mkdirSync(preparedDir, { recursive: true });
|
|
74979
|
+
fs50.mkdirSync(sourceDir, { recursive: true });
|
|
74797
74980
|
try {
|
|
74798
74981
|
for (const skillName of skillNames) {
|
|
74799
|
-
|
|
74982
|
+
fs50.cpSync(path52.join(stagingDir, skillName), path52.join(preparedDir, skillName), {
|
|
74800
74983
|
recursive: true
|
|
74801
74984
|
});
|
|
74802
74985
|
}
|
|
74803
74986
|
for (const skillName of skillNames) {
|
|
74804
|
-
const target =
|
|
74805
|
-
const backup =
|
|
74987
|
+
const target = path52.join(sourceDir, skillName);
|
|
74988
|
+
const backup = path52.join(backupDir, skillName);
|
|
74806
74989
|
const hadExisting = pathExists(target);
|
|
74807
74990
|
if (hadExisting) {
|
|
74808
|
-
|
|
74809
|
-
|
|
74991
|
+
fs50.mkdirSync(path52.dirname(backup), { recursive: true });
|
|
74992
|
+
fs50.renameSync(target, backup);
|
|
74810
74993
|
}
|
|
74811
74994
|
completed.push({ target, backup, hadExisting });
|
|
74812
|
-
|
|
74995
|
+
fs50.renameSync(path52.join(preparedDir, skillName), target);
|
|
74813
74996
|
}
|
|
74814
74997
|
installUserSkillsForClients(projectRoot, skillNames);
|
|
74815
74998
|
} catch (error2) {
|
|
@@ -74823,7 +75006,7 @@ function installUserSkills(projectRoot, stagingDir, skillNames) {
|
|
|
74823
75006
|
throw new Error(`Failed to install Maker user Skills: ${formatError4(error2)}`);
|
|
74824
75007
|
} finally {
|
|
74825
75008
|
if (!preserveTransaction) {
|
|
74826
|
-
|
|
75009
|
+
fs50.rmSync(transactionDir, { recursive: true, force: true });
|
|
74827
75010
|
}
|
|
74828
75011
|
}
|
|
74829
75012
|
}
|
|
@@ -74831,27 +75014,27 @@ function installUserSkillsForClients(projectRoot, skillNames) {
|
|
|
74831
75014
|
if (skillNames.length === 0) {
|
|
74832
75015
|
return;
|
|
74833
75016
|
}
|
|
74834
|
-
const sourceRoot =
|
|
74835
|
-
const transactionDir =
|
|
75017
|
+
const sourceRoot = path52.join(projectRoot, ".installer", "skills");
|
|
75018
|
+
const transactionDir = path52.join(
|
|
74836
75019
|
projectRoot,
|
|
74837
75020
|
".installer",
|
|
74838
75021
|
`.user-skill-clients-${randomUUID9()}`
|
|
74839
75022
|
);
|
|
74840
|
-
const backupRoot =
|
|
75023
|
+
const backupRoot = path52.join(transactionDir, "backup");
|
|
74841
75024
|
const changed = [];
|
|
74842
75025
|
let preserveTransaction = false;
|
|
74843
75026
|
try {
|
|
74844
75027
|
for (const clientDir of USER_SKILL_CLIENT_DIRS) {
|
|
74845
|
-
const targetRoot =
|
|
74846
|
-
|
|
75028
|
+
const targetRoot = path52.join(projectRoot, clientDir, "skills");
|
|
75029
|
+
fs50.mkdirSync(targetRoot, { recursive: true });
|
|
74847
75030
|
for (const skillName of skillNames) {
|
|
74848
|
-
const source =
|
|
74849
|
-
const target =
|
|
74850
|
-
const backup =
|
|
75031
|
+
const source = path52.join(sourceRoot, skillName);
|
|
75032
|
+
const target = path52.join(targetRoot, skillName);
|
|
75033
|
+
const backup = path52.join(backupRoot, clientDir, skillName);
|
|
74851
75034
|
const hadExisting = pathExists(target);
|
|
74852
75035
|
if (hadExisting) {
|
|
74853
|
-
|
|
74854
|
-
|
|
75036
|
+
fs50.mkdirSync(path52.dirname(backup), { recursive: true });
|
|
75037
|
+
fs50.renameSync(target, backup);
|
|
74855
75038
|
}
|
|
74856
75039
|
changed.push({ target, backup, hadExisting });
|
|
74857
75040
|
linkOrCopySkill(source, target);
|
|
@@ -74868,7 +75051,7 @@ function installUserSkillsForClients(projectRoot, skillNames) {
|
|
|
74868
75051
|
throw new Error(`Failed to install Maker user Skills for AI clients: ${formatError4(error2)}`);
|
|
74869
75052
|
} finally {
|
|
74870
75053
|
if (!preserveTransaction) {
|
|
74871
|
-
|
|
75054
|
+
fs50.rmSync(transactionDir, { recursive: true, force: true });
|
|
74872
75055
|
}
|
|
74873
75056
|
}
|
|
74874
75057
|
}
|
|
@@ -74879,7 +75062,7 @@ function rollbackSkillChanges(changes) {
|
|
|
74879
75062
|
try {
|
|
74880
75063
|
removePathEntry(item.target);
|
|
74881
75064
|
if (item.hadExisting && pathExists(item.backup)) {
|
|
74882
|
-
|
|
75065
|
+
fs50.renameSync(item.backup, item.target);
|
|
74883
75066
|
}
|
|
74884
75067
|
} catch (error2) {
|
|
74885
75068
|
errors.push(`${item.target}: ${formatError4(error2)}`);
|
|
@@ -74889,12 +75072,12 @@ function rollbackSkillChanges(changes) {
|
|
|
74889
75072
|
}
|
|
74890
75073
|
function linkOrCopySkill(source, target) {
|
|
74891
75074
|
try {
|
|
74892
|
-
const linkTarget = process.platform === "win32" ? source :
|
|
74893
|
-
|
|
75075
|
+
const linkTarget = process.platform === "win32" ? source : path52.relative(path52.dirname(target), source);
|
|
75076
|
+
fs50.symlinkSync(linkTarget, target, process.platform === "win32" ? "junction" : "dir");
|
|
74894
75077
|
} catch (linkError) {
|
|
74895
75078
|
removePathEntry(target);
|
|
74896
75079
|
try {
|
|
74897
|
-
|
|
75080
|
+
fs50.cpSync(source, target, { recursive: true });
|
|
74898
75081
|
} catch (copyError) {
|
|
74899
75082
|
throw new Error(
|
|
74900
75083
|
`Failed to link ${source}: ${formatError4(linkError)}; copy fallback: ${formatError4(copyError)}`
|
|
@@ -74904,12 +75087,12 @@ function linkOrCopySkill(source, target) {
|
|
|
74904
75087
|
}
|
|
74905
75088
|
function removePathEntry(value) {
|
|
74906
75089
|
try {
|
|
74907
|
-
const stat =
|
|
75090
|
+
const stat = fs50.lstatSync(value);
|
|
74908
75091
|
if (stat.isSymbolicLink()) {
|
|
74909
|
-
|
|
75092
|
+
fs50.unlinkSync(value);
|
|
74910
75093
|
return;
|
|
74911
75094
|
}
|
|
74912
|
-
|
|
75095
|
+
fs50.rmSync(value, { recursive: true, force: true });
|
|
74913
75096
|
} catch (error2) {
|
|
74914
75097
|
if (error2.code !== "ENOENT") {
|
|
74915
75098
|
throw error2;
|
|
@@ -74918,7 +75101,7 @@ function removePathEntry(value) {
|
|
|
74918
75101
|
}
|
|
74919
75102
|
function listLocalSkills(sourceDir) {
|
|
74920
75103
|
try {
|
|
74921
|
-
return
|
|
75104
|
+
return fs50.readdirSync(sourceDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
|
|
74922
75105
|
} catch {
|
|
74923
75106
|
return [];
|
|
74924
75107
|
}
|
|
@@ -74934,7 +75117,7 @@ function createDownloadError(status) {
|
|
|
74934
75117
|
}
|
|
74935
75118
|
function pathExists(value) {
|
|
74936
75119
|
try {
|
|
74937
|
-
|
|
75120
|
+
fs50.lstatSync(value);
|
|
74938
75121
|
return true;
|
|
74939
75122
|
} catch {
|
|
74940
75123
|
return false;
|
|
@@ -74951,7 +75134,7 @@ function hasControlCharacter(value) {
|
|
|
74951
75134
|
}
|
|
74952
75135
|
|
|
74953
75136
|
// src/maker/cli/commands.ts
|
|
74954
|
-
var VERSION4 = true ? "0.0.34-beta.
|
|
75137
|
+
var VERSION4 = true ? "0.0.34-beta.6" : "dev";
|
|
74955
75138
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
74956
75139
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
74957
75140
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -75182,7 +75365,7 @@ function toOptionKey(value) {
|
|
|
75182
75365
|
}
|
|
75183
75366
|
async function runInit(parsed, ctx) {
|
|
75184
75367
|
rejectPackageOption(parsed);
|
|
75185
|
-
const targetDir =
|
|
75368
|
+
const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
75186
75369
|
const env = makerEnvOption(parsed);
|
|
75187
75370
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
75188
75371
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -75299,7 +75482,7 @@ async function runInit(parsed, ctx) {
|
|
|
75299
75482
|
}
|
|
75300
75483
|
async function runDoctor(parsed, ctx) {
|
|
75301
75484
|
var _a3, _b;
|
|
75302
|
-
const targetDir =
|
|
75485
|
+
const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
75303
75486
|
const env = makerEnvOption(parsed);
|
|
75304
75487
|
const git2 = checkGitEnvironment();
|
|
75305
75488
|
const python = checkMakerPythonEnvironment();
|
|
@@ -75390,8 +75573,8 @@ async function runDoctor(parsed, ctx) {
|
|
|
75390
75573
|
);
|
|
75391
75574
|
}
|
|
75392
75575
|
function inspectMakerDoctorExecutionContext(options3) {
|
|
75393
|
-
const doctorCwd =
|
|
75394
|
-
const makerProjectDir = options3.makerProjectDir ?
|
|
75576
|
+
const doctorCwd = path53.resolve(process.cwd());
|
|
75577
|
+
const makerProjectDir = options3.makerProjectDir ? path53.resolve(options3.makerProjectDir) : void 0;
|
|
75395
75578
|
if (!makerProjectDir) {
|
|
75396
75579
|
return {
|
|
75397
75580
|
active_client_session: "not_checked",
|
|
@@ -75426,9 +75609,9 @@ function samePath2(left, right) {
|
|
|
75426
75609
|
return normalizePathForCompare3(left) === normalizePathForCompare3(right);
|
|
75427
75610
|
}
|
|
75428
75611
|
function normalizePathForCompare3(value) {
|
|
75429
|
-
const resolved =
|
|
75612
|
+
const resolved = path53.resolve(value);
|
|
75430
75613
|
try {
|
|
75431
|
-
return
|
|
75614
|
+
return fs51.realpathSync.native(resolved);
|
|
75432
75615
|
} catch {
|
|
75433
75616
|
return resolved;
|
|
75434
75617
|
}
|
|
@@ -75746,7 +75929,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
75746
75929
|
}
|
|
75747
75930
|
async function resolvePatSet(parsed, ctx) {
|
|
75748
75931
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
75749
|
-
const pat =
|
|
75932
|
+
const pat = fs51.readFileSync(0, "utf8").trim();
|
|
75750
75933
|
if (!pat) {
|
|
75751
75934
|
throw new Error("No PAT found on stdin.");
|
|
75752
75935
|
}
|
|
@@ -75801,17 +75984,17 @@ async function prepareMcpLauncher(options3) {
|
|
|
75801
75984
|
if (options3.mode === "self") {
|
|
75802
75985
|
launcher = materializeMakerSelfLauncher({
|
|
75803
75986
|
version: VERSION4,
|
|
75804
|
-
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL2(
|
|
75987
|
+
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL2(path53.resolve(process.cwd(), "dist", "maker.js")).href,
|
|
75805
75988
|
makerHome: getMakerHome()
|
|
75806
75989
|
});
|
|
75807
75990
|
} else {
|
|
75808
75991
|
const packageSpec = resolveMakerPackageSpec(MAKER_NPM_PACKAGE, VERSION4);
|
|
75809
75992
|
launcher = resolveMakerMcpLauncher({ packageName: packageSpec });
|
|
75810
75993
|
const configuredCache = process.env.npm_config_cache || process.env.NPM_CONFIG_CACHE;
|
|
75811
|
-
const npmCacheDir =
|
|
75812
|
-
configuredCache ||
|
|
75994
|
+
const npmCacheDir = path53.resolve(
|
|
75995
|
+
configuredCache || path53.join(getMakerHome(), "cache", "npm")
|
|
75813
75996
|
);
|
|
75814
|
-
|
|
75997
|
+
fs51.mkdirSync(npmCacheDir, { recursive: true });
|
|
75815
75998
|
launcherEnv = { npm_config_cache: npmCacheDir };
|
|
75816
75999
|
}
|
|
75817
76000
|
} catch (error2) {
|
|
@@ -75944,7 +76127,7 @@ ${indent3(payload.stderr)}` : "",
|
|
|
75944
76127
|
}
|
|
75945
76128
|
async function runMcpReport(parsed, ctx) {
|
|
75946
76129
|
rejectPackageOption(parsed);
|
|
75947
|
-
const targetDir =
|
|
76130
|
+
const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
75948
76131
|
const contextInput = booleanOption(parsed, "context_stdin") ? await readStdinText() : "";
|
|
75949
76132
|
const context = parseMakerMcpReportContext(contextInput);
|
|
75950
76133
|
const contextValidation = validateMakerMcpReportContext(context);
|
|
@@ -76018,7 +76201,7 @@ async function runMcpReport(parsed, ctx) {
|
|
|
76018
76201
|
const issue3 = buildMakerMcpIssue({
|
|
76019
76202
|
context,
|
|
76020
76203
|
diagnostics,
|
|
76021
|
-
homeDir:
|
|
76204
|
+
homeDir: os12.homedir()
|
|
76022
76205
|
});
|
|
76023
76206
|
const submission = booleanOption(parsed, "consent") ? submitMakerMcpIssue(issue3) : {
|
|
76024
76207
|
status: "consent_required",
|
|
@@ -76045,7 +76228,7 @@ async function runMcpReport(parsed, ctx) {
|
|
|
76045
76228
|
);
|
|
76046
76229
|
}
|
|
76047
76230
|
async function runAgentsUpdate(parsed, ctx) {
|
|
76048
|
-
const targetDir =
|
|
76231
|
+
const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
76049
76232
|
const result = updateMakerAgentsPolicy(targetDir);
|
|
76050
76233
|
if (ctx.json) {
|
|
76051
76234
|
writeJson(result);
|
|
@@ -76064,7 +76247,7 @@ async function runAgentsUpdate(parsed, ctx) {
|
|
|
76064
76247
|
async function runUpgrade(parsed, ctx) {
|
|
76065
76248
|
rejectPackageOption(parsed);
|
|
76066
76249
|
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
76067
|
-
const targetDir =
|
|
76250
|
+
const targetDir = path53.resolve(explicitTargetDir || process.cwd());
|
|
76068
76251
|
const env = makerEnvOption(parsed);
|
|
76069
76252
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
76070
76253
|
const pluginDistribution = resolveMakerPluginDistribution();
|
|
@@ -76153,7 +76336,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
76153
76336
|
];
|
|
76154
76337
|
}
|
|
76155
76338
|
async function runDevKitUpdate(parsed, ctx) {
|
|
76156
|
-
const targetDir =
|
|
76339
|
+
const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
76157
76340
|
const result = await installAiDevKit({
|
|
76158
76341
|
targetDir,
|
|
76159
76342
|
preserveExisting: false,
|
|
@@ -76167,7 +76350,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
76167
76350
|
}
|
|
76168
76351
|
async function runUserSkillsPull(parsed, ctx) {
|
|
76169
76352
|
const result = await pullMakerUserSkills({
|
|
76170
|
-
targetDir:
|
|
76353
|
+
targetDir: path53.resolve(stringOption(parsed, "target_dir") || process.cwd()),
|
|
76171
76354
|
environment: makerEnvOption(parsed)
|
|
76172
76355
|
});
|
|
76173
76356
|
if (ctx.json) {
|
|
@@ -76186,7 +76369,7 @@ async function runUserSkillsPull(parsed, ctx) {
|
|
|
76186
76369
|
);
|
|
76187
76370
|
}
|
|
76188
76371
|
async function runLogsWatch(parsed, ctx) {
|
|
76189
|
-
const targetDir =
|
|
76372
|
+
const targetDir = path53.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
76190
76373
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
76191
76374
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? MAKER_TOOL_CALL_TIMEOUT_MS;
|
|
76192
76375
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -76196,9 +76379,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
76196
76379
|
serverUrl: stringOption(parsed, "server_url"),
|
|
76197
76380
|
env: makerEnvOption(parsed)
|
|
76198
76381
|
});
|
|
76199
|
-
const runtimeDir =
|
|
76200
|
-
const runtimeLog =
|
|
76201
|
-
const pidFile =
|
|
76382
|
+
const runtimeDir = path53.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
76383
|
+
const runtimeLog = path53.join(runtimeDir, "runtime.log");
|
|
76384
|
+
const pidFile = path53.join(runtimeDir, "watcher.pid");
|
|
76202
76385
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
76203
76386
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
76204
76387
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -76243,10 +76426,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
76243
76426
|
}
|
|
76244
76427
|
}
|
|
76245
76428
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
76246
|
-
|
|
76429
|
+
fs51.mkdirSync(path53.dirname(pidFile), { recursive: true });
|
|
76247
76430
|
const existingPid = readPidFile(pidFile);
|
|
76248
76431
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
76249
|
-
|
|
76432
|
+
fs51.writeFileSync(
|
|
76250
76433
|
pidFile,
|
|
76251
76434
|
`${JSON.stringify(
|
|
76252
76435
|
{
|
|
@@ -76264,10 +76447,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
76264
76447
|
return previous;
|
|
76265
76448
|
}
|
|
76266
76449
|
function readPidFile(pidFile) {
|
|
76267
|
-
if (!
|
|
76450
|
+
if (!fs51.existsSync(pidFile)) {
|
|
76268
76451
|
return void 0;
|
|
76269
76452
|
}
|
|
76270
|
-
const raw =
|
|
76453
|
+
const raw = fs51.readFileSync(pidFile, "utf8").trim();
|
|
76271
76454
|
let pid = Number(raw);
|
|
76272
76455
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
76273
76456
|
try {
|
|
@@ -76287,7 +76470,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
76287
76470
|
}
|
|
76288
76471
|
cleaned = true;
|
|
76289
76472
|
if (readPidFile(pidFile) === process.pid) {
|
|
76290
|
-
|
|
76473
|
+
fs51.rmSync(pidFile, { force: true });
|
|
76291
76474
|
}
|
|
76292
76475
|
};
|
|
76293
76476
|
process.once("exit", cleanup);
|
|
@@ -76438,7 +76621,7 @@ async function prepareDevKit(targetDir, ctx, options3 = {}) {
|
|
|
76438
76621
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
76439
76622
|
});
|
|
76440
76623
|
writeDevKitStagedGitignore(
|
|
76441
|
-
|
|
76624
|
+
path53.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
76442
76625
|
listPresentDevKitManagedEntries(targetDir)
|
|
76443
76626
|
);
|
|
76444
76627
|
syncWorkBuddyDevKitSkills(targetDir, ctx);
|
|
@@ -76456,7 +76639,7 @@ async function prepareDevKit(targetDir, ctx, options3 = {}) {
|
|
|
76456
76639
|
);
|
|
76457
76640
|
} catch (error2) {
|
|
76458
76641
|
writeDevKitStagedGitignore(
|
|
76459
|
-
|
|
76642
|
+
path53.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
76460
76643
|
listPresentDevKitManagedEntries(targetDir)
|
|
76461
76644
|
);
|
|
76462
76645
|
if (options3.finalizeGitignore) {
|
|
@@ -76503,10 +76686,10 @@ function syncWorkBuddyDevKitSkills(targetDir, ctx) {
|
|
|
76503
76686
|
try {
|
|
76504
76687
|
const result = syncWorkBuddyProjectSkills(targetDir);
|
|
76505
76688
|
const managedSkillPaths = [...result.installedSkills, ...result.skippedSkills].map(
|
|
76506
|
-
(skillName) =>
|
|
76689
|
+
(skillName) => path53.join(".workbuddy", "skills", skillName)
|
|
76507
76690
|
);
|
|
76508
76691
|
if (managedSkillPaths.length > 0) {
|
|
76509
|
-
writeDevKitStagedGitignore(
|
|
76692
|
+
writeDevKitStagedGitignore(path53.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
|
|
76510
76693
|
...listPresentDevKitManagedEntries(targetDir),
|
|
76511
76694
|
...managedSkillPaths
|
|
76512
76695
|
]);
|
|
@@ -76583,12 +76766,12 @@ function installMcpConfig(ide, options3) {
|
|
|
76583
76766
|
}
|
|
76584
76767
|
function installMcpConfigUnsafe(ide, options3) {
|
|
76585
76768
|
if (ide === "codex") {
|
|
76586
|
-
const configPath =
|
|
76769
|
+
const configPath = path53.join(os12.homedir(), ".codex", "config.toml");
|
|
76587
76770
|
const write = mergeCodexMcpConfig(configPath, withClientIde(options3, "codex"));
|
|
76588
76771
|
return [createMcpInstallResult(ide, "Codex", configPath, write)];
|
|
76589
76772
|
}
|
|
76590
76773
|
if (ide === "cursor") {
|
|
76591
|
-
const configPath =
|
|
76774
|
+
const configPath = path53.join(os12.homedir(), ".cursor", "mcp.json");
|
|
76592
76775
|
const write = mergeJsonMcpConfig(configPath, withClientIde(options3, "cursor"));
|
|
76593
76776
|
return [createMcpInstallResult(ide, "Cursor", configPath, write)];
|
|
76594
76777
|
}
|
|
@@ -76605,7 +76788,7 @@ function installMcpConfigUnsafe(ide, options3) {
|
|
|
76605
76788
|
}
|
|
76606
76789
|
];
|
|
76607
76790
|
}
|
|
76608
|
-
const configPath =
|
|
76791
|
+
const configPath = path53.join(os12.homedir(), ".claude.json");
|
|
76609
76792
|
const write = mergeJsonMcpConfig(configPath, claudeOptions);
|
|
76610
76793
|
return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
|
|
76611
76794
|
}
|
|
@@ -76619,7 +76802,7 @@ function installMcpConfigUnsafe(ide, options3) {
|
|
|
76619
76802
|
}
|
|
76620
76803
|
if (ide === "opencode") {
|
|
76621
76804
|
const configPath = getOpenCodeMcpConfigPath();
|
|
76622
|
-
if (!
|
|
76805
|
+
if (!fs51.existsSync(configPath)) {
|
|
76623
76806
|
return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
|
|
76624
76807
|
}
|
|
76625
76808
|
const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options3, "opencode"));
|
|
@@ -76702,13 +76885,13 @@ function getDefaultMcpInstallIdes() {
|
|
|
76702
76885
|
if (getTraeMcpInstallPaths().length > 0) {
|
|
76703
76886
|
ides.push("trae");
|
|
76704
76887
|
}
|
|
76705
|
-
if (
|
|
76888
|
+
if (fs51.existsSync(getOpenCodeMcpConfigPath())) {
|
|
76706
76889
|
ides.push("opencode");
|
|
76707
76890
|
}
|
|
76708
76891
|
if (getWorkBuddyMcpInstallPaths().length > 0) {
|
|
76709
76892
|
ides.push("workbuddy");
|
|
76710
76893
|
}
|
|
76711
|
-
if (
|
|
76894
|
+
if (fs51.existsSync(getDshHome())) {
|
|
76712
76895
|
ides.push("dsh");
|
|
76713
76896
|
}
|
|
76714
76897
|
return ides;
|
|
@@ -76722,7 +76905,7 @@ function getExistingTraeUserConfigPaths(paths) {
|
|
|
76722
76905
|
const seen = /* @__PURE__ */ new Set();
|
|
76723
76906
|
return paths.filter((configPath) => {
|
|
76724
76907
|
const key = normalizeConfigPathKey(configPath);
|
|
76725
|
-
if (seen.has(key) || !
|
|
76908
|
+
if (seen.has(key) || !fs51.existsSync(path53.dirname(configPath))) {
|
|
76726
76909
|
return false;
|
|
76727
76910
|
}
|
|
76728
76911
|
seen.add(key);
|
|
@@ -76733,7 +76916,7 @@ function getExistingConfigPaths(paths) {
|
|
|
76733
76916
|
const seen = /* @__PURE__ */ new Set();
|
|
76734
76917
|
return paths.filter((configPath) => {
|
|
76735
76918
|
const key = normalizeConfigPathKey(configPath);
|
|
76736
|
-
if (seen.has(key) || !
|
|
76919
|
+
if (seen.has(key) || !fs51.existsSync(configPath)) {
|
|
76737
76920
|
return false;
|
|
76738
76921
|
}
|
|
76739
76922
|
seen.add(key);
|
|
@@ -76741,62 +76924,62 @@ function getExistingConfigPaths(paths) {
|
|
|
76741
76924
|
});
|
|
76742
76925
|
}
|
|
76743
76926
|
function normalizeConfigPathKey(configPath) {
|
|
76744
|
-
const resolved =
|
|
76927
|
+
const resolved = path53.resolve(configPath);
|
|
76745
76928
|
return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
|
|
76746
76929
|
}
|
|
76747
76930
|
function getTraeSoloMcpConfigPaths() {
|
|
76748
76931
|
if (process.platform === "win32") {
|
|
76749
|
-
const roaming = process.env.APPDATA ||
|
|
76932
|
+
const roaming = process.env.APPDATA || path53.join(os12.homedir(), "AppData", "Roaming");
|
|
76750
76933
|
return [
|
|
76751
|
-
|
|
76752
|
-
|
|
76934
|
+
path53.join(roaming, "TRAE SOLO", "User", "mcp.json"),
|
|
76935
|
+
path53.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
|
|
76753
76936
|
];
|
|
76754
76937
|
}
|
|
76755
|
-
const appSupport =
|
|
76938
|
+
const appSupport = path53.join(os12.homedir(), "Library", "Application Support");
|
|
76756
76939
|
return [
|
|
76757
|
-
|
|
76758
|
-
|
|
76940
|
+
path53.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
|
|
76941
|
+
path53.join(appSupport, "TRAE SOLO", "User", "mcp.json")
|
|
76759
76942
|
];
|
|
76760
76943
|
}
|
|
76761
76944
|
function getTraeUnverifiedMcpConfigPaths() {
|
|
76762
76945
|
if (process.platform === "win32") {
|
|
76763
|
-
const roaming = process.env.APPDATA ||
|
|
76946
|
+
const roaming = process.env.APPDATA || path53.join(os12.homedir(), "AppData", "Roaming");
|
|
76764
76947
|
return [
|
|
76765
|
-
|
|
76766
|
-
|
|
76767
|
-
|
|
76948
|
+
path53.join(roaming, "Trae", "User", "mcp.json"),
|
|
76949
|
+
path53.join(roaming, "TRAE", "User", "mcp.json"),
|
|
76950
|
+
path53.join(roaming, "Trae CN", "User", "mcp.json")
|
|
76768
76951
|
];
|
|
76769
76952
|
}
|
|
76770
|
-
const appSupport =
|
|
76953
|
+
const appSupport = path53.join(os12.homedir(), "Library", "Application Support");
|
|
76771
76954
|
return [
|
|
76772
|
-
|
|
76773
|
-
|
|
76774
|
-
|
|
76955
|
+
path53.join(appSupport, "Trae", "User", "mcp.json"),
|
|
76956
|
+
path53.join(appSupport, "TRAE", "User", "mcp.json"),
|
|
76957
|
+
path53.join(appSupport, "Trae CN", "User", "mcp.json")
|
|
76775
76958
|
];
|
|
76776
76959
|
}
|
|
76777
76960
|
function getOpenCodeMcpConfigPath() {
|
|
76778
|
-
return
|
|
76961
|
+
return path53.join(os12.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
76779
76962
|
}
|
|
76780
76963
|
function getWorkBuddyHome() {
|
|
76781
|
-
return
|
|
76964
|
+
return path53.join(os12.homedir(), ".workbuddy");
|
|
76782
76965
|
}
|
|
76783
76966
|
function getWorkBuddyMcpInstallPaths(options3 = {}) {
|
|
76784
|
-
const primary =
|
|
76785
|
-
if (
|
|
76967
|
+
const primary = path53.join(getWorkBuddyHome(), "mcp.json");
|
|
76968
|
+
if (fs51.existsSync(primary) || options3.createPrimary) {
|
|
76786
76969
|
return [primary];
|
|
76787
76970
|
}
|
|
76788
|
-
const legacy =
|
|
76789
|
-
if (
|
|
76971
|
+
const legacy = path53.join(getWorkBuddyHome(), ".mcp.json");
|
|
76972
|
+
if (fs51.existsSync(legacy)) {
|
|
76790
76973
|
return [legacy];
|
|
76791
76974
|
}
|
|
76792
76975
|
return [];
|
|
76793
76976
|
}
|
|
76794
76977
|
function inspectWorkBuddyTrustState(mcpName) {
|
|
76795
76978
|
const workbuddyHome = getWorkBuddyHome();
|
|
76796
|
-
const connectorsDir =
|
|
76979
|
+
const connectorsDir = path53.join(workbuddyHome, "connectors");
|
|
76797
76980
|
const accounts = [];
|
|
76798
76981
|
const stateFiles = [];
|
|
76799
|
-
if (!
|
|
76982
|
+
if (!fs51.existsSync(connectorsDir)) {
|
|
76800
76983
|
return {
|
|
76801
76984
|
status: "not_found",
|
|
76802
76985
|
mcp_name: mcpName,
|
|
@@ -76806,12 +76989,12 @@ function inspectWorkBuddyTrustState(mcpName) {
|
|
|
76806
76989
|
accounts
|
|
76807
76990
|
};
|
|
76808
76991
|
}
|
|
76809
|
-
for (const entry of
|
|
76992
|
+
for (const entry of fs51.readdirSync(connectorsDir, { withFileTypes: true })) {
|
|
76810
76993
|
if (!entry.isDirectory()) {
|
|
76811
76994
|
continue;
|
|
76812
76995
|
}
|
|
76813
|
-
const statePath =
|
|
76814
|
-
if (!
|
|
76996
|
+
const statePath = path53.join(connectorsDir, entry.name, "connector-states.json");
|
|
76997
|
+
if (!fs51.existsSync(statePath)) {
|
|
76815
76998
|
continue;
|
|
76816
76999
|
}
|
|
76817
77000
|
stateFiles.push(statePath);
|
|
@@ -76890,7 +77073,7 @@ function mergeJsonMcpConfig(configPath, options3) {
|
|
|
76890
77073
|
);
|
|
76891
77074
|
}
|
|
76892
77075
|
function mergeOpenCodeMcpConfig(configPath, options3) {
|
|
76893
|
-
const rawContent =
|
|
77076
|
+
const rawContent = fs51.readFileSync(configPath, "utf8");
|
|
76894
77077
|
const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
|
|
76895
77078
|
const existing = readJsonObject(configPath, { jsonc: true });
|
|
76896
77079
|
const mcp = asObject(existing.mcp);
|
|
@@ -76922,7 +77105,7 @@ function mergeOpenCodeMcpConfig(configPath, options3) {
|
|
|
76922
77105
|
return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
|
|
76923
77106
|
}
|
|
76924
77107
|
function mergeCodexMcpConfig(configPath, options3) {
|
|
76925
|
-
const existing =
|
|
77108
|
+
const existing = fs51.existsSync(configPath) ? fs51.readFileSync(configPath, "utf8") : "";
|
|
76926
77109
|
const withoutOld = removeCodexMcpTables(existing, options3.mcpName).trimEnd();
|
|
76927
77110
|
const launch = options3.launcher;
|
|
76928
77111
|
const envValues = createMcpEnvironmentValues(options3.env, options3.clientIde, options3.launcherEnv);
|
|
@@ -76956,7 +77139,7 @@ function mergeCodexMcpConfig(configPath, options3) {
|
|
|
76956
77139
|
);
|
|
76957
77140
|
}
|
|
76958
77141
|
function tryClaudeMcpAdd(options3) {
|
|
76959
|
-
const configPath =
|
|
77142
|
+
const configPath = path53.join(os12.homedir(), ".claude.json");
|
|
76960
77143
|
try {
|
|
76961
77144
|
const existing = readJsonObject(configPath);
|
|
76962
77145
|
const server = asObject(asObject(existing.mcpServers)[options3.mcpName]);
|
|
@@ -77049,10 +77232,10 @@ function rejectPackageOption(parsed) {
|
|
|
77049
77232
|
}
|
|
77050
77233
|
}
|
|
77051
77234
|
function readJsonObject(filePath, options3 = {}) {
|
|
77052
|
-
if (!
|
|
77235
|
+
if (!fs51.existsSync(filePath)) {
|
|
77053
77236
|
return {};
|
|
77054
77237
|
}
|
|
77055
|
-
const raw =
|
|
77238
|
+
const raw = fs51.readFileSync(filePath, "utf8");
|
|
77056
77239
|
try {
|
|
77057
77240
|
const normalized = normalizeJsonConfigContent(raw, options3);
|
|
77058
77241
|
const parsed = JSON.parse(normalized);
|
|
@@ -77224,10 +77407,10 @@ function formatMcpInstallMessage(label, configPath, write) {
|
|
|
77224
77407
|
].filter(Boolean).join("\n");
|
|
77225
77408
|
}
|
|
77226
77409
|
function saveInitState(targetDir, state) {
|
|
77227
|
-
|
|
77228
|
-
const key = crypto5.createHash("sha256").update(
|
|
77229
|
-
|
|
77230
|
-
|
|
77410
|
+
fs51.mkdirSync(getMakerHome(), { recursive: true });
|
|
77411
|
+
const key = crypto5.createHash("sha256").update(path53.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
77412
|
+
fs51.writeFileSync(
|
|
77413
|
+
path53.join(getMakerHome(), `init-state-${key}.json`),
|
|
77231
77414
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
77232
77415
|
`,
|
|
77233
77416
|
"utf8"
|
|
@@ -77375,7 +77558,7 @@ function makerEnvOption(parsed) {
|
|
|
77375
77558
|
return env;
|
|
77376
77559
|
}
|
|
77377
77560
|
const targetDir = stringOption(parsed, "target_dir");
|
|
77378
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
77561
|
+
return getMakerEnvironment(void 0, targetDir ? path53.resolve(targetDir) : process.cwd());
|
|
77379
77562
|
}
|
|
77380
77563
|
function makerMcpConfigEnvOption(parsed) {
|
|
77381
77564
|
return stringOption(parsed, "env") === "rnd" ? "rnd" : "production";
|
|
@@ -79078,7 +79261,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
79078
79261
|
|
|
79079
79262
|
// src/mcp-proxy/proxy.ts
|
|
79080
79263
|
init_types2();
|
|
79081
|
-
import * as
|
|
79264
|
+
import * as path55 from "node:path";
|
|
79082
79265
|
import * as crypto8 from "node:crypto";
|
|
79083
79266
|
|
|
79084
79267
|
// src/mcp-proxy/cookieJar.ts
|
|
@@ -79274,8 +79457,8 @@ function isStandaloneSseRequest(input2, init) {
|
|
|
79274
79457
|
}
|
|
79275
79458
|
|
|
79276
79459
|
// src/core/utils/logWriter.ts
|
|
79277
|
-
import * as
|
|
79278
|
-
import * as
|
|
79460
|
+
import * as fs52 from "node:fs";
|
|
79461
|
+
import * as path54 from "node:path";
|
|
79279
79462
|
import * as crypto7 from "node:crypto";
|
|
79280
79463
|
|
|
79281
79464
|
// src/core/types/log.ts
|
|
@@ -79316,7 +79499,7 @@ var LogWriter = class {
|
|
|
79316
79499
|
return;
|
|
79317
79500
|
}
|
|
79318
79501
|
try {
|
|
79319
|
-
await
|
|
79502
|
+
await fs52.promises.mkdir(this.config.logDir, { recursive: true });
|
|
79320
79503
|
await this.cleanupOldLogs();
|
|
79321
79504
|
this.initialized = true;
|
|
79322
79505
|
} catch (error2) {
|
|
@@ -79339,7 +79522,7 @@ var LogWriter = class {
|
|
|
79339
79522
|
*/
|
|
79340
79523
|
getLogFilePath(date5) {
|
|
79341
79524
|
const d = date5 || this.getCurrentDate();
|
|
79342
|
-
return
|
|
79525
|
+
return path54.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
79343
79526
|
}
|
|
79344
79527
|
/**
|
|
79345
79528
|
* 获取或创建写入流
|
|
@@ -79354,7 +79537,7 @@ var LogWriter = class {
|
|
|
79354
79537
|
}
|
|
79355
79538
|
this.currentDate = date5;
|
|
79356
79539
|
try {
|
|
79357
|
-
this.writeStream =
|
|
79540
|
+
this.writeStream = fs52.createWriteStream(this.getLogFilePath(date5), {
|
|
79358
79541
|
flags: "a",
|
|
79359
79542
|
encoding: "utf8"
|
|
79360
79543
|
});
|
|
@@ -79406,11 +79589,11 @@ var LogWriter = class {
|
|
|
79406
79589
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
79407
79590
|
try {
|
|
79408
79591
|
const filePath = this.getLogFilePath();
|
|
79409
|
-
const dir =
|
|
79410
|
-
if (!
|
|
79411
|
-
|
|
79592
|
+
const dir = path54.dirname(filePath);
|
|
79593
|
+
if (!fs52.existsSync(dir)) {
|
|
79594
|
+
fs52.mkdirSync(dir, { recursive: true });
|
|
79412
79595
|
}
|
|
79413
|
-
|
|
79596
|
+
fs52.appendFileSync(filePath, message, "utf8");
|
|
79414
79597
|
} catch {
|
|
79415
79598
|
}
|
|
79416
79599
|
}
|
|
@@ -79421,7 +79604,7 @@ var LogWriter = class {
|
|
|
79421
79604
|
async cleanupOldLogs() {
|
|
79422
79605
|
if (this.config.maxDays <= 0) return;
|
|
79423
79606
|
try {
|
|
79424
|
-
const files = await
|
|
79607
|
+
const files = await fs52.promises.readdir(this.config.logDir);
|
|
79425
79608
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
79426
79609
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
79427
79610
|
const prefix = this.config.prefix;
|
|
@@ -79436,7 +79619,7 @@ var LogWriter = class {
|
|
|
79436
79619
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
79437
79620
|
const fileDate = new Date(year, month - 1, day);
|
|
79438
79621
|
if (fileDate < cutoffDate) {
|
|
79439
|
-
await
|
|
79622
|
+
await fs52.promises.unlink(path54.join(this.config.logDir, file3));
|
|
79440
79623
|
process.stderr.write(`[LogWriter] Deleted old log: ${file3}
|
|
79441
79624
|
`);
|
|
79442
79625
|
}
|
|
@@ -79570,10 +79753,10 @@ var TapTapMCPProxy = class {
|
|
|
79570
79753
|
const { user_id, project_id } = this.config.tenant;
|
|
79571
79754
|
let logDir;
|
|
79572
79755
|
if (user_id && project_id) {
|
|
79573
|
-
logDir =
|
|
79756
|
+
logDir = path55.join(logRoot, "proxy", user_id, project_id);
|
|
79574
79757
|
} else {
|
|
79575
79758
|
const kidHash = crypto8.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
79576
|
-
logDir =
|
|
79759
|
+
logDir = path55.join(logRoot, "proxy", kidHash);
|
|
79577
79760
|
}
|
|
79578
79761
|
return new LogWriter({
|
|
79579
79762
|
logDir,
|