@taptap/maker 0.0.34-beta.5 → 0.0.34-beta.7
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 +988 -419
- package/docs/MAKER_CONSOLE.md +32 -6
- package/docs/MAKER_LOCAL_PREVIEW.md +75 -21
- 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.7
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
6
|
const __MAKER_BUNDLE_URL__ = import.meta.url;
|
|
@@ -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.7 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 `~`.",
|
|
@@ -30738,16 +30738,33 @@ function syncProjectSkills(targetDir, options3) {
|
|
|
30738
30738
|
const sourceSkills = fs6.readdirSync(sourceDir, { withFileTypes: true }).filter(
|
|
30739
30739
|
(entry) => entry.isDirectory() && fs6.existsSync(path7.join(sourceDir, entry.name, "SKILL.md"))
|
|
30740
30740
|
).map((entry) => entry.name).sort();
|
|
30741
|
-
|
|
30742
|
-
|
|
30743
|
-
const
|
|
30744
|
-
|
|
30745
|
-
|
|
30746
|
-
|
|
30741
|
+
const installedSkillDirs = [];
|
|
30742
|
+
try {
|
|
30743
|
+
for (const sourceSkillName of sourceSkills) {
|
|
30744
|
+
const skillName = `${options3.prefix || ""}${sourceSkillName}`;
|
|
30745
|
+
const skillDir = path7.join(skillsDir, skillName);
|
|
30746
|
+
if (pathEntryExists(skillDir)) {
|
|
30747
|
+
result.skippedSkills.push(skillName);
|
|
30748
|
+
continue;
|
|
30749
|
+
}
|
|
30750
|
+
fs6.mkdirSync(skillsDir, { recursive: true });
|
|
30751
|
+
installSkillContents(path7.join(sourceDir, sourceSkillName), skillDir, platform);
|
|
30752
|
+
installedSkillDirs.push(skillDir);
|
|
30753
|
+
result.installedSkills.push(skillName);
|
|
30747
30754
|
}
|
|
30748
|
-
|
|
30749
|
-
|
|
30750
|
-
|
|
30755
|
+
} catch (error2) {
|
|
30756
|
+
const cleanupErrors = [];
|
|
30757
|
+
for (const skillDir of installedSkillDirs.reverse()) {
|
|
30758
|
+
try {
|
|
30759
|
+
fs6.rmSync(skillDir, { recursive: true, force: true });
|
|
30760
|
+
} catch (cleanupError) {
|
|
30761
|
+
cleanupErrors.push(cleanupError);
|
|
30762
|
+
}
|
|
30763
|
+
}
|
|
30764
|
+
if (cleanupErrors.length > 0) {
|
|
30765
|
+
throwWithCleanupFailures(error2, cleanupErrors);
|
|
30766
|
+
}
|
|
30767
|
+
throw error2;
|
|
30751
30768
|
}
|
|
30752
30769
|
if (result.installedSkills.length > 0) {
|
|
30753
30770
|
result.status = "installed";
|
|
@@ -30761,7 +30778,11 @@ function installSkillContents(sourceDir, targetDir, platform) {
|
|
|
30761
30778
|
linkOrCopyEntry(path7.join(sourceDir, entry), path7.join(targetDir, entry), platform);
|
|
30762
30779
|
}
|
|
30763
30780
|
} catch (error2) {
|
|
30764
|
-
|
|
30781
|
+
try {
|
|
30782
|
+
fs6.rmSync(targetDir, { recursive: true, force: true });
|
|
30783
|
+
} catch (cleanupError) {
|
|
30784
|
+
throwWithCleanupFailures(error2, [cleanupError]);
|
|
30785
|
+
}
|
|
30765
30786
|
throw error2;
|
|
30766
30787
|
}
|
|
30767
30788
|
}
|
|
@@ -30803,6 +30824,14 @@ function pathEntryExists(value) {
|
|
|
30803
30824
|
function formatError2(error2) {
|
|
30804
30825
|
return error2 instanceof Error ? error2.message : String(error2);
|
|
30805
30826
|
}
|
|
30827
|
+
function throwWithCleanupFailures(primaryError, cleanupErrors) {
|
|
30828
|
+
const details = cleanupErrors.map(formatError2).join("; ");
|
|
30829
|
+
if (primaryError instanceof Error) {
|
|
30830
|
+
primaryError.message = `${primaryError.message}; cleanup failures: ${details}`;
|
|
30831
|
+
throw primaryError;
|
|
30832
|
+
}
|
|
30833
|
+
throw new Error(`Primary failure: ${formatError2(primaryError)}; cleanup failures: ${details}`);
|
|
30834
|
+
}
|
|
30806
30835
|
var init_projectSkills = __esm({
|
|
30807
30836
|
"src/maker/cli/projectSkills.ts"() {
|
|
30808
30837
|
"use strict";
|
|
@@ -31129,11 +31158,25 @@ function readManagedGitignoreEntries(gitignorePath) {
|
|
|
31129
31158
|
return entries;
|
|
31130
31159
|
}
|
|
31131
31160
|
function installAiDevKitSkills(targetDir, options3 = {}) {
|
|
31161
|
+
let result;
|
|
31132
31162
|
try {
|
|
31133
|
-
|
|
31134
|
-
}
|
|
31135
|
-
|
|
31163
|
+
result = runAiDevKitSkillScript(targetDir, options3);
|
|
31164
|
+
} catch (error2) {
|
|
31165
|
+
try {
|
|
31166
|
+
syncProjectSkills(targetDir, { client: ".agents" });
|
|
31167
|
+
} catch (syncError) {
|
|
31168
|
+
if (error2 instanceof Error) {
|
|
31169
|
+
error2.message = `${error2.message}; .agents synchronization failed: ${formatError3(syncError)}`;
|
|
31170
|
+
throw error2;
|
|
31171
|
+
}
|
|
31172
|
+
throw new Error(
|
|
31173
|
+
`AI dev kit skill installer failed: ${formatError3(error2)}; .agents synchronization failed: ${formatError3(syncError)}`
|
|
31174
|
+
);
|
|
31175
|
+
}
|
|
31176
|
+
throw error2;
|
|
31136
31177
|
}
|
|
31178
|
+
syncProjectSkills(targetDir, { client: ".agents" });
|
|
31179
|
+
return result;
|
|
31137
31180
|
}
|
|
31138
31181
|
function runAiDevKitSkillScript(targetDir, options3) {
|
|
31139
31182
|
var _a3;
|
|
@@ -31312,6 +31355,9 @@ function formatSpawnFailure(result) {
|
|
|
31312
31355
|
var _a3;
|
|
31313
31356
|
return ((_a3 = result.error) == null ? void 0 : _a3.message) || String(result.stderr || "").trim() || String(result.stdout || "").trim() || `exit status ${result.status ?? "unknown"}`;
|
|
31314
31357
|
}
|
|
31358
|
+
function formatError3(error2) {
|
|
31359
|
+
return error2 instanceof Error ? error2.message : String(error2);
|
|
31360
|
+
}
|
|
31315
31361
|
function formatDevKitSkillInstallerFailure(options3) {
|
|
31316
31362
|
return [
|
|
31317
31363
|
"Failed to install AI dev kit skills",
|
|
@@ -32461,12 +32507,14 @@ async function withQrcodeFastForward(cwd, remoteRef, fastForward) {
|
|
|
32461
32507
|
const remote = git2(["rev-parse", remoteRef]).trim();
|
|
32462
32508
|
let baseEntry, remoteEntry, localText;
|
|
32463
32509
|
try {
|
|
32464
|
-
const
|
|
32465
|
-
const
|
|
32466
|
-
|
|
32467
|
-
|
|
32468
|
-
baseEntry = baseTree
|
|
32469
|
-
|
|
32510
|
+
const treeEntry = /^100644 blob ([a-f0-9]+)\t\.project\/project\.json\n$/;
|
|
32511
|
+
const baseTree = treeEntry.exec(git2(["ls-tree", head, "--", file2]));
|
|
32512
|
+
const remoteTree = treeEntry.exec(git2(["ls-tree", remote, "--", file2]));
|
|
32513
|
+
if (!baseTree || !remoteTree) return await fastForward(remote);
|
|
32514
|
+
baseEntry = `100644 ${baseTree[1]} 0 ${file2}
|
|
32515
|
+
`;
|
|
32516
|
+
remoteEntry = `100644 ${remoteTree[1]} 0 ${file2}
|
|
32517
|
+
`;
|
|
32470
32518
|
if (baseEntry === remoteEntry || git2(["ls-files", "--stage", "--", file2]) !== baseEntry)
|
|
32471
32519
|
return await fastForward(remote);
|
|
32472
32520
|
const filename2 = path13.join(cwd, file2);
|
|
@@ -39355,7 +39403,7 @@ var init_tracking = __esm({
|
|
|
39355
39403
|
MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
|
|
39356
39404
|
MAKER_MCP_TRACKING_SOURCE = "local_mcp";
|
|
39357
39405
|
MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
|
|
39358
|
-
MAKER_MCP_VERSION = "0.0.34-beta.
|
|
39406
|
+
MAKER_MCP_VERSION = "0.0.34-beta.7".trim() ? "0.0.34-beta.7".trim() : "dev";
|
|
39359
39407
|
TRACKING_ERROR_MAX_LENGTH = 500;
|
|
39360
39408
|
}
|
|
39361
39409
|
});
|
|
@@ -42667,7 +42715,7 @@ var init_mcp = __esm({
|
|
|
42667
42715
|
init_remoteProxyManager();
|
|
42668
42716
|
init_proxyAssets();
|
|
42669
42717
|
init_diagnosticRedaction();
|
|
42670
|
-
VERSION = true ? "0.0.34-beta.
|
|
42718
|
+
VERSION = true ? "0.0.34-beta.7" : "dev";
|
|
42671
42719
|
DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
42672
42720
|
DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
42673
42721
|
DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -42877,6 +42925,74 @@ var init_mcp = __esm({
|
|
|
42877
42925
|
// src/maker/preview/configuration.ts
|
|
42878
42926
|
import fs22 from "node:fs";
|
|
42879
42927
|
import path23 from "node:path";
|
|
42928
|
+
function hasStandardPreviewConfiguration(project) {
|
|
42929
|
+
return STANDARD_PREVIEW_CONFIGS.every(
|
|
42930
|
+
(name) => fs22.existsSync(path23.join(project, ".project", name + ".json"))
|
|
42931
|
+
);
|
|
42932
|
+
}
|
|
42933
|
+
function configuredServerEntry(root2, project, resources2) {
|
|
42934
|
+
const entry = project["entry@server"] ?? resources2["entry@server"];
|
|
42935
|
+
if (entry === void 0) return void 0;
|
|
42936
|
+
if (typeof entry !== "string" || !entry.trim() || path23.isAbsolute(entry) || path23.win32.isAbsolute(entry) || /^[A-Za-z]:/.test(entry))
|
|
42937
|
+
throw new Error("预览配置中的 entry@server 必须是相对路径。");
|
|
42938
|
+
const normalized = path23.posix.normalize(entry.replaceAll("\\", "/"));
|
|
42939
|
+
if (normalized === "." || normalized.startsWith("../") || normalized.includes("/../"))
|
|
42940
|
+
throw new Error("预览配置中的 entry@server 不能逃逸 scripts 目录。");
|
|
42941
|
+
const scripts = fs22.realpathSync(path23.join(root2, "scripts"));
|
|
42942
|
+
const candidate = path23.join(scripts, normalized);
|
|
42943
|
+
const resolved = fs22.realpathSync(candidate);
|
|
42944
|
+
const relative = path23.relative(scripts, resolved);
|
|
42945
|
+
if (!fs22.statSync(resolved).isFile() || relative.startsWith("..") || path23.isAbsolute(relative))
|
|
42946
|
+
throw new Error(`预览配置中的 entry@server 不存在: ${entry}`);
|
|
42947
|
+
return normalized;
|
|
42948
|
+
}
|
|
42949
|
+
function detectedServerEntry(project) {
|
|
42950
|
+
return ["server_main.lua", "server.lua"].find(
|
|
42951
|
+
(name) => fs22.existsSync(path23.join(project, "scripts", name))
|
|
42952
|
+
);
|
|
42953
|
+
}
|
|
42954
|
+
function networkEnabled(settings) {
|
|
42955
|
+
const runtime = settings["@runtime"];
|
|
42956
|
+
if (!runtime || typeof runtime !== "object") return false;
|
|
42957
|
+
const multiplayer = runtime.multiplayer;
|
|
42958
|
+
if (multiplayer && typeof multiplayer === "object") {
|
|
42959
|
+
if (multiplayer.enabled !== void 0) return Boolean(multiplayer.enabled);
|
|
42960
|
+
if (multiplayer.max_players !== void 0) return Number(multiplayer.max_players) > 0;
|
|
42961
|
+
return Boolean(
|
|
42962
|
+
multiplayer.persistent_world && typeof multiplayer.persistent_world === "object" && multiplayer.persistent_world.enabled
|
|
42963
|
+
);
|
|
42964
|
+
}
|
|
42965
|
+
return Number(runtime.max_players) > 0;
|
|
42966
|
+
}
|
|
42967
|
+
function hasResourceMetadata(directory) {
|
|
42968
|
+
if (!fs22.existsSync(directory)) return false;
|
|
42969
|
+
if (fs22.lstatSync(directory).isSymbolicLink()) return true;
|
|
42970
|
+
for (const item of fs22.readdirSync(directory, { withFileTypes: true })) {
|
|
42971
|
+
if (item.isSymbolicLink() || item.name.endsWith(".meta")) return true;
|
|
42972
|
+
if (item.isDirectory() && hasResourceMetadata(path23.join(directory, item.name))) return true;
|
|
42973
|
+
}
|
|
42974
|
+
return false;
|
|
42975
|
+
}
|
|
42976
|
+
function classifyPreviewProject(project, platform = process.platform) {
|
|
42977
|
+
const standard = hasStandardPreviewConfiguration(project);
|
|
42978
|
+
const projectConfig = readPreviewConfiguration(project, "project") || {};
|
|
42979
|
+
const resourcesConfig = readPreviewConfiguration(project, "resources") || {};
|
|
42980
|
+
const settingsConfig = readPreviewConfiguration(project, "settings") || {};
|
|
42981
|
+
const serverEntry = configuredServerEntry(project, projectConfig, resourcesConfig);
|
|
42982
|
+
const detectedEntry = detectedServerEntry(project);
|
|
42983
|
+
const hasServer = Boolean(serverEntry) || Boolean(detectedEntry);
|
|
42984
|
+
const network = networkEnabled(settingsConfig);
|
|
42985
|
+
const reason = !standard ? "missing_configuration" : network || hasServer ? "network_or_server" : platform === "win32" && fs22.existsSync(path23.join(project, "dist/latest.json")) ? "existing_windows_manifest" : Object.keys(resourcesConfig).some(
|
|
42986
|
+
(key) => !["$schema", "entry", "entry@client", "entry@server"].includes(key)
|
|
42987
|
+
) || Object.keys(settingsConfig).some((key) => !["$schema", "@runtime"].includes(key)) || hasResourceMetadata(path23.join(project, "scripts")) || hasResourceMetadata(path23.join(project, "assets")) ? "resource_manifest" : void 0;
|
|
42988
|
+
return {
|
|
42989
|
+
kind: hasServer ? "server" : network ? "network" : !standard ? "new_project" : "single_player",
|
|
42990
|
+
network_required: network || hasServer,
|
|
42991
|
+
preparation_required: Boolean(reason),
|
|
42992
|
+
...reason ? { preparation_reason: reason } : {},
|
|
42993
|
+
...serverEntry || detectedEntry ? { server_entry: serverEntry || detectedEntry } : {}
|
|
42994
|
+
};
|
|
42995
|
+
}
|
|
42880
42996
|
function readPreviewConfiguration(project, name) {
|
|
42881
42997
|
const filename2 = path23.join(project, ".project", name + ".json");
|
|
42882
42998
|
if (!fs22.existsSync(filename2)) {
|
|
@@ -42911,9 +43027,11 @@ function previewEntryName(project = {}, resources2 = {}) {
|
|
|
42911
43027
|
}
|
|
42912
43028
|
return "main.lua";
|
|
42913
43029
|
}
|
|
43030
|
+
var STANDARD_PREVIEW_CONFIGS;
|
|
42914
43031
|
var init_configuration = __esm({
|
|
42915
43032
|
"src/maker/preview/configuration.ts"() {
|
|
42916
43033
|
"use strict";
|
|
43034
|
+
STANDARD_PREVIEW_CONFIGS = ["project", "resources", "settings"];
|
|
42917
43035
|
}
|
|
42918
43036
|
});
|
|
42919
43037
|
|
|
@@ -45245,7 +45363,7 @@ var require_websocket = __commonJS({
|
|
|
45245
45363
|
var http4 = __require("http");
|
|
45246
45364
|
var net = __require("net");
|
|
45247
45365
|
var tls = __require("tls");
|
|
45248
|
-
var { randomBytes: randomBytes4, createHash:
|
|
45366
|
+
var { randomBytes: randomBytes4, createHash: createHash12 } = __require("crypto");
|
|
45249
45367
|
var { Duplex, Readable: Readable2 } = __require("stream");
|
|
45250
45368
|
var { URL: URL2 } = __require("url");
|
|
45251
45369
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -45913,7 +46031,7 @@ var require_websocket = __commonJS({
|
|
|
45913
46031
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
45914
46032
|
return;
|
|
45915
46033
|
}
|
|
45916
|
-
const digest =
|
|
46034
|
+
const digest = createHash12("sha1").update(key + GUID).digest("base64");
|
|
45917
46035
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
45918
46036
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
45919
46037
|
return;
|
|
@@ -46282,7 +46400,7 @@ var require_websocket_server = __commonJS({
|
|
|
46282
46400
|
var EventEmitter = __require("events");
|
|
46283
46401
|
var http4 = __require("http");
|
|
46284
46402
|
var { Duplex } = __require("stream");
|
|
46285
|
-
var { createHash:
|
|
46403
|
+
var { createHash: createHash12 } = __require("crypto");
|
|
46286
46404
|
var extension2 = require_extension();
|
|
46287
46405
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
46288
46406
|
var subprotocol2 = require_subprotocol();
|
|
@@ -46589,7 +46707,7 @@ var require_websocket_server = __commonJS({
|
|
|
46589
46707
|
);
|
|
46590
46708
|
}
|
|
46591
46709
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
46592
|
-
const digest =
|
|
46710
|
+
const digest = createHash12("sha1").update(key + GUID).digest("base64");
|
|
46593
46711
|
const headers = [
|
|
46594
46712
|
"HTTP/1.1 101 Switching Protocols",
|
|
46595
46713
|
"Upgrade: websocket",
|
|
@@ -54273,7 +54391,7 @@ var consoleIconLicense, consoleIcons;
|
|
|
54273
54391
|
var init_webIcons = __esm({
|
|
54274
54392
|
"src/maker/console/webIcons.ts"() {
|
|
54275
54393
|
"use strict";
|
|
54276
|
-
consoleIconLicense = `Lucide icon-node snapshot: lucide-vue-next v1.0.0
|
|
54394
|
+
consoleIconLicense = `Lucide icon-node snapshot: lucide-vue-next v1.0.0; copy/link: lucide v0.468.0
|
|
54277
54395
|
ISC License
|
|
54278
54396
|
Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2026 as part
|
|
54279
54397
|
of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2026.
|
|
@@ -54306,6 +54424,14 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
54306
54424
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54307
54425
|
SOFTWARE.`;
|
|
54308
54426
|
consoleIcons = {
|
|
54427
|
+
copy: [
|
|
54428
|
+
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }],
|
|
54429
|
+
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }]
|
|
54430
|
+
],
|
|
54431
|
+
link: [
|
|
54432
|
+
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }],
|
|
54433
|
+
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }]
|
|
54434
|
+
],
|
|
54309
54435
|
qrcode: [
|
|
54310
54436
|
["rect", { width: "5", height: "5", x: "3", y: "3", rx: "1" }],
|
|
54311
54437
|
["rect", { width: "5", height: "5", x: "16", y: "3", rx: "1" }],
|
|
@@ -54385,6 +54511,7 @@ let viewEpoch = 0;
|
|
|
54385
54511
|
let state = {projects: [], tasks: []};
|
|
54386
54512
|
let loaded = false;
|
|
54387
54513
|
let fortuneTimer;
|
|
54514
|
+
let fortuneReady = false;
|
|
54388
54515
|
function fortuneMode() {
|
|
54389
54516
|
return document.documentElement.dataset.theme === 'light' ? 'light' : 'dark';
|
|
54390
54517
|
}
|
|
@@ -54431,8 +54558,22 @@ function loadFortuneFrame(reload) {
|
|
|
54431
54558
|
frame.dataset.mode = fortuneMode();
|
|
54432
54559
|
frame.src = fortuneUrl();
|
|
54433
54560
|
}
|
|
54561
|
+
function revealFortune() {
|
|
54562
|
+
fortuneReady = true;
|
|
54563
|
+
$('fortune-panel').hidden = true;
|
|
54564
|
+
$('fortune-panel').classList.remove('fortune-preload');
|
|
54565
|
+
$('fortune-corner').hidden = false;
|
|
54566
|
+
}
|
|
54567
|
+
function beginFortuneLoad(reload) {
|
|
54568
|
+
fortuneReady = false;
|
|
54569
|
+
$('fortune-corner').hidden = true;
|
|
54570
|
+
$('fortune-panel').hidden = true;
|
|
54571
|
+
$('fortune-panel').classList.add('fortune-preload');
|
|
54572
|
+
loadFortuneFrame(reload);
|
|
54573
|
+
}
|
|
54434
54574
|
function openFortune() {
|
|
54435
54575
|
clearTimeout(fortuneTimer);
|
|
54576
|
+
if (!fortuneReady) return;
|
|
54436
54577
|
const panel = $('fortune-panel');
|
|
54437
54578
|
if (!panel) return;
|
|
54438
54579
|
if (panel.parentElement !== document.body) document.body.append(panel);
|
|
@@ -54447,6 +54588,12 @@ function bindFortuneHover(element) {
|
|
|
54447
54588
|
}
|
|
54448
54589
|
let documentTab = 'docs', documentSearch = '', documentItems = [], documentSelected = '';
|
|
54449
54590
|
let documentRequest = 0, documentDirectoryRequest = 0;
|
|
54591
|
+
function markdownText(value) {
|
|
54592
|
+
// Decode only entity-shaped fragments; all resulting content still uses textContent.
|
|
54593
|
+
return String(value || '').replace(/&(?:#[0-9]+|#x[0-9a-f]+|[a-z][a-z0-9]+);/gi, entity => {
|
|
54594
|
+
return new DOMParser().parseFromString('<body>' + entity + '</body>','text/html').body.textContent;
|
|
54595
|
+
});
|
|
54596
|
+
}
|
|
54450
54597
|
function markdownNodes(tokens) {
|
|
54451
54598
|
const fragment = document.createDocumentFragment();
|
|
54452
54599
|
for (const token of tokens || []) {
|
|
@@ -54456,10 +54603,10 @@ function markdownNodes(tokens) {
|
|
|
54456
54603
|
if (token.type === 'heading') { element = node('h' + Math.min(6,Math.max(1,token.depth))); element.append(children()); }
|
|
54457
54604
|
else if (token.type === 'paragraph' || token.type === 'text') {
|
|
54458
54605
|
element = node(token.type === 'paragraph' ? 'p' : 'span');
|
|
54459
|
-
if (token.tokens) element.append(children()); else element.textContent = token.text
|
|
54606
|
+
if (token.tokens) element.append(children()); else element.textContent = markdownText(token.text);
|
|
54460
54607
|
} else if (['strong','em','del'].includes(token.type)) { element = node(token.type); element.append(children()); }
|
|
54461
54608
|
else if (token.type === 'code') { element = node('pre'); element.append(node('code',token.text)); }
|
|
54462
|
-
else if (token.type === 'codespan') element = node('code',token.text);
|
|
54609
|
+
else if (token.type === 'codespan') element = node('code',markdownText(token.text));
|
|
54463
54610
|
else if (token.type === 'blockquote') { element = node('blockquote'); element.append(children()); }
|
|
54464
54611
|
else if (token.type === 'br' || token.type === 'hr') element = node(token.type);
|
|
54465
54612
|
else if (token.type === 'list') {
|
|
@@ -54496,8 +54643,8 @@ function markdownNodes(tokens) {
|
|
|
54496
54643
|
else announce('该链接不在当前文档目录中');
|
|
54497
54644
|
});
|
|
54498
54645
|
}
|
|
54499
|
-
} else if (token.type === 'image') element = node('span','[图片:' + (token.text || token.href
|
|
54500
|
-
else element = node('span',token.text || token.raw || '');
|
|
54646
|
+
} else if (token.type === 'image') element = node('span','[图片:' + markdownText(token.text || token.href) + ']','muted');
|
|
54647
|
+
else element = node('span',token.type === 'escape' ? markdownText(token.text) : token.text || token.raw || '');
|
|
54501
54648
|
fragment.append(element);
|
|
54502
54649
|
}
|
|
54503
54650
|
return fragment;
|
|
@@ -54528,7 +54675,7 @@ async function openDocument(item) {
|
|
|
54528
54675
|
header.append(fallback); fallback.focus(); fallback.select();
|
|
54529
54676
|
notify('无法访问剪贴板,请复制已选中的文档链接');
|
|
54530
54677
|
}
|
|
54531
|
-
}));
|
|
54678
|
+
},{icon:'link'}));
|
|
54532
54679
|
replace(reader,[header,node('p',item.source + ' · ' + item.relativePath,'muted')]);
|
|
54533
54680
|
if (item.purpose) {
|
|
54534
54681
|
const intro = node('section',undefined,'document-intro');
|
|
@@ -54578,7 +54725,7 @@ async function renderDocuments() {
|
|
|
54578
54725
|
const epoch = viewEpoch;
|
|
54579
54726
|
const request = ++documentDirectoryRequest;
|
|
54580
54727
|
const toolbar = node('div',undefined,'document-toolbar');
|
|
54581
|
-
const tabs = node('div',undefined,'actions'); tabs.setAttribute('role','tablist');
|
|
54728
|
+
const tabs = node('div',undefined,'actions document-tabs'); tabs.setAttribute('role','tablist');
|
|
54582
54729
|
[['docs','开发文档'],['project','项目文档'],['skills','Skill']].forEach(([kind,label]) => {
|
|
54583
54730
|
const tab = button(label,() => {
|
|
54584
54731
|
documentTab = kind; renderDocumentDirectory();
|
|
@@ -54591,7 +54738,7 @@ async function renderDocuments() {
|
|
|
54591
54738
|
const search = node('input'); search.id = 'document-search'; search.type = 'search'; search.placeholder = '搜索标题、用途或目录';
|
|
54592
54739
|
search.setAttribute('aria-label','搜索文档与 Skill'); search.value = documentSearch;
|
|
54593
54740
|
search.addEventListener('input',() => { documentSearch = search.value; renderDocumentDirectory(); });
|
|
54594
|
-
toolbar.append(tabs,search,button('刷新目录',() => void renderDocuments()));
|
|
54741
|
+
toolbar.append(tabs,search,button('刷新目录',() => void renderDocuments(),{icon:'refresh',iconOnly:true,className:'icon-button'}));
|
|
54595
54742
|
const layout = node('div',undefined,'document-layout');
|
|
54596
54743
|
const directory = node('aside'); directory.id = 'document-directory'; directory.setAttribute('aria-label','文档目录');
|
|
54597
54744
|
const reader = node('article'); reader.id = 'document-reader';
|
|
@@ -54731,7 +54878,7 @@ function renderConsoleLogs() {
|
|
|
54731
54878
|
if (!host) return;
|
|
54732
54879
|
const view = logView();
|
|
54733
54880
|
const toolbar = node('div',undefined,'console-log-toolbar');
|
|
54734
|
-
const tabs = node('div',undefined,'
|
|
54881
|
+
const tabs = node('div',undefined,'console-log-tabs');
|
|
54735
54882
|
tabs.setAttribute('role','tablist');
|
|
54736
54883
|
[['build','构建日志'],['lua','Lua 检查'],['runtime','Runtime 日志'],['qrcode','二维码']].forEach(([id,label]) => {
|
|
54737
54884
|
const tab = button(label,() => { view.tab = id; renderConsoleLogs(); if (id === 'runtime' && !view.runtime && !view.loading) void loadLogs(); });
|
|
@@ -54751,7 +54898,7 @@ function renderConsoleLogs() {
|
|
|
54751
54898
|
output.id = 'console-log-output'; output.setAttribute('role','tabpanel'); output.tabIndex = 0;
|
|
54752
54899
|
const previous = $('console-log-output');
|
|
54753
54900
|
const top = previous?.scrollTop || 0, left = previous?.scrollLeft || 0;
|
|
54754
|
-
replace(host,[
|
|
54901
|
+
replace(host,[toolbar,tabs,output]);
|
|
54755
54902
|
output.scrollTop = top; output.scrollLeft = left;
|
|
54756
54903
|
}
|
|
54757
54904
|
let git = null;
|
|
@@ -54774,10 +54921,48 @@ const pending = new Set();
|
|
|
54774
54921
|
const pendingActions = new Map();
|
|
54775
54922
|
const pluginSessions = new Map();
|
|
54776
54923
|
const acceptedTasks = new Map();
|
|
54924
|
+
const pendingReports = new Map();
|
|
54925
|
+
const offeredReports = new Set();
|
|
54926
|
+
function offerIssueReport(task) {
|
|
54927
|
+
if (!task.reportOffer || task.report || offeredReports.has(task.reportOffer.fingerprint)) return;
|
|
54928
|
+
pendingReports.set(task.id,task);
|
|
54929
|
+
if (pendingReports.size > 100) pendingReports.delete(pendingReports.keys().next().value);
|
|
54930
|
+
}
|
|
54931
|
+
function showPendingIssueReport() {
|
|
54932
|
+
if (offline || disposed || consoleDialogOpen()) return;
|
|
54933
|
+
const task = Array.from(pendingReports.values()).find(item => item.projectKey === selected);
|
|
54934
|
+
if (!task) return;
|
|
54935
|
+
pendingReports.delete(task.id);
|
|
54936
|
+
if (offeredReports.has(task.reportOffer.fingerprint)) return;
|
|
54937
|
+
offeredReports.add(task.reportOffer.fingerprint);
|
|
54938
|
+
const dialog = $('confirm');
|
|
54939
|
+
$('confirm-title').textContent = '提交问题反馈?';
|
|
54940
|
+
$('confirm-message').textContent = (task.action.startsWith('preview.') ? '本地预览遇到异常。' : '操作遇到异常。') +
|
|
54941
|
+
'是否提交问题反馈,帮助我们定位修复?将附带脱敏后的错误、日志和环境信息。';
|
|
54942
|
+
$('confirm-accept').textContent = '确认提交';
|
|
54943
|
+
dialog.returnValue = 'cancel';
|
|
54944
|
+
dialog.addEventListener('close',async () => {
|
|
54945
|
+
if (dialog.returnValue !== 'accept') return;
|
|
54946
|
+
try {
|
|
54947
|
+
const updated = await api('/api/tasks/' + encodeURIComponent(task.id) + '/report',{
|
|
54948
|
+
method:'POST',body:{consent:true}
|
|
54949
|
+
});
|
|
54950
|
+
rememberTask(updated);
|
|
54951
|
+
const index = state.tasks.findIndex(item => item.id === updated.id);
|
|
54952
|
+
if (index >= 0) state.tasks[index] = updated;
|
|
54953
|
+
if (updated.projectKey === selected) { updateChrome(); updateBuild(); notify('正在提交问题反馈…','info'); }
|
|
54954
|
+
} catch (error) { notify('问题反馈未提交:' + error.message); }
|
|
54955
|
+
},{once:true});
|
|
54956
|
+
dialog.showModal();
|
|
54957
|
+
}
|
|
54777
54958
|
const windowDrafts = new Map();
|
|
54778
54959
|
function rememberTask(task) {
|
|
54779
54960
|
const previous = acceptedTasks.get(task.id);
|
|
54780
54961
|
acceptedTasks.set(task.id,task);
|
|
54962
|
+
if (previous?.report?.status === 'running' && task.report?.status !== 'running' && task.projectKey === selected)
|
|
54963
|
+
notify(task.report?.status === 'created' ? '问题反馈已提交,谢谢。' :
|
|
54964
|
+
task.report?.status === 'unknown' ? '反馈提交结果未知,请勿重复提交。' :
|
|
54965
|
+
'反馈未能自动提交,请检查 GitHub CLI 登录状态及网络。',task.report?.status === 'created' ? 'success' : 'error');
|
|
54781
54966
|
const projectTasks = Array.from(acceptedTasks.values()).reverse()
|
|
54782
54967
|
.filter(item => item.projectKey === task.projectKey)
|
|
54783
54968
|
.sort((a,b) => String(b.startedAt).localeCompare(String(a.startedAt)));
|
|
@@ -54903,7 +55088,7 @@ function tasksFor(key) {
|
|
|
54903
55088
|
acceptedTasks.forEach(t => { if (t.projectKey === key && !tasks.has(t.id)) tasks.set(t.id, t); });
|
|
54904
55089
|
return Array.from(tasks.values()).sort((a,b) => String(b.startedAt).localeCompare(String(a.startedAt))).slice(0,10);
|
|
54905
55090
|
}
|
|
54906
|
-
function busy(key = selected) { return pending.has(key) || tasksFor(key).some(t => t.status === 'running'); }
|
|
55091
|
+
function busy(key = selected) { return pending.has(key) || tasksFor(key).some(t => t.status === 'running' || t.report?.status === 'running'); }
|
|
54907
55092
|
function actionBusy(action, key = selected) {
|
|
54908
55093
|
return pendingActions.get(key) === action ||
|
|
54909
55094
|
tasksFor(key).some(task => task.action === action && task.status === 'running');
|
|
@@ -54970,7 +55155,8 @@ function updateChrome() {
|
|
|
54970
55155
|
}
|
|
54971
55156
|
picker.value = currentProject() ? selected : '';
|
|
54972
55157
|
picker.disabled = !loaded || offline;
|
|
54973
|
-
$('context').textContent = currentProject() ?
|
|
55158
|
+
$('context').textContent = currentProject() ? text(detail?.git?.branch, '分支未提供') : '本地项目';
|
|
55159
|
+
$('context').title = currentProject()?.name || '本地项目';
|
|
54974
55160
|
$('footer-path').textContent = currentProject()?.path || '';
|
|
54975
55161
|
document.querySelectorAll('nav [data-page]').forEach(b => {
|
|
54976
55162
|
b.disabled = !loaded || (b.dataset.page !== 'documents' && !currentProject()?.valid);
|
|
@@ -54979,9 +55165,7 @@ function updateChrome() {
|
|
|
54979
55165
|
});
|
|
54980
55166
|
if ($('heading-actions')) replace($('heading-actions'),headingActionButtons());
|
|
54981
55167
|
if ($('overview-task')) {
|
|
54982
|
-
|
|
54983
|
-
replace($('overview-task'),[node('h2','最近任务'),
|
|
54984
|
-
latest ? taskBlock(latest) : node('p','暂无控制台任务','muted')]);
|
|
55168
|
+
replace($('overview-task'),overviewTasks());
|
|
54985
55169
|
}
|
|
54986
55170
|
}
|
|
54987
55171
|
function headingActionButtons() {
|
|
@@ -55002,17 +55186,14 @@ function headingActionButtons() {
|
|
|
55002
55186
|
const presentation = buildPresentation(task,pendingActions.get(selected) === 'build',offline);
|
|
55003
55187
|
const build = button(checking ? 'Lua 检查中' : presentation.active ? presentation.label : '构建',
|
|
55004
55188
|
() => void runProjectAction('build'),
|
|
55005
|
-
{className:'
|
|
55189
|
+
{className:'build-button' + (presentation.active || checking ? ' is-building' : ''),
|
|
55006
55190
|
icon:presentation.active || checking ? 'refresh' : 'hammer',disabled:offline || busy(),focus:'heading-build'});
|
|
55007
55191
|
build.setAttribute('aria-busy',String(presentation.active || checking));
|
|
55008
55192
|
const primary = node('div',undefined,'actions heading-primary');
|
|
55009
55193
|
primary.append(local,build,button('测试二维码',() => void runProjectAction('qrcode'),{
|
|
55010
55194
|
icon:'qrcode',loading:qrcodeBusy,disabled:offline || busy(),focus:'heading-qrcode'
|
|
55011
55195
|
}));
|
|
55012
|
-
|
|
55013
|
-
secondary.append(luaCheckOption());
|
|
55014
|
-
if (!presentation.active && task) secondary.append(node('span',presentation.label,'build-badge ' + presentation.tone));
|
|
55015
|
-
return [primary,secondary];
|
|
55196
|
+
return [primary];
|
|
55016
55197
|
}
|
|
55017
55198
|
function luaCheckOption() {
|
|
55018
55199
|
const label = node('label',undefined,'lua-check-option');
|
|
@@ -55335,6 +55516,12 @@ async function removeProject(key) {
|
|
|
55335
55516
|
} catch (error) { notify(error.message); }
|
|
55336
55517
|
finally { pending.delete(key); updateChrome(); if (page === 'projects') renderProjects(); }
|
|
55337
55518
|
}
|
|
55519
|
+
function overviewTasks() {
|
|
55520
|
+
const tasks = tasksFor(selected);
|
|
55521
|
+
const title = node('div',undefined,'section-heading');
|
|
55522
|
+
title.append(node('h2','最近任务'),node('span','保留最近 10 次','muted'));
|
|
55523
|
+
return [title,...(tasks.length ? tasks.map(task => taskBlock(task)) : [node('p','暂无控制台任务','muted')])];
|
|
55524
|
+
}
|
|
55338
55525
|
function renderOverview() {
|
|
55339
55526
|
const p = currentProject();
|
|
55340
55527
|
const title = heading(p.name,p.path,true);
|
|
@@ -55346,7 +55533,8 @@ function renderOverview() {
|
|
|
55346
55533
|
[['项目版本',config.version],['屏幕方向',orientation],['Git HEAD',detail.git?.head?.slice(0,10)],
|
|
55347
55534
|
['本地预览',previewLabel()]].forEach(([name,value]) => {
|
|
55348
55535
|
const metric = node('div',undefined,'metric');
|
|
55349
|
-
metric.append(node('div',name,'muted'),node('div',text(value),'value'
|
|
55536
|
+
metric.append(node('div',name,'muted'),node('div',text(value),'value' +
|
|
55537
|
+
(name === '本地预览' ? ' ' + previewPresentation(preview,previewError).tone : ''))); metrics.append(metric);
|
|
55350
55538
|
});
|
|
55351
55539
|
const runtime = runtimePresentation(preview,previewError);
|
|
55352
55540
|
const runtimeMetric = node('div',undefined,'metric runtime-metric');
|
|
@@ -55392,13 +55580,9 @@ function renderOverview() {
|
|
|
55392
55580
|
if (latestBuild?.status === 'failed') {
|
|
55393
55581
|
health.append(failureBanner('最近构建失败', buildFailureDetails(latestBuild) || buildFailureTitle(latestBuild)));
|
|
55394
55582
|
}
|
|
55395
|
-
const links = node('div',undefined,'actions preview-controls');
|
|
55396
|
-
links.append(button('构建与测试',() => navigate('build')),button('查看 Git',() => navigate('git')));
|
|
55397
|
-
health.append(links);
|
|
55398
55583
|
columns.append(configSection,health);
|
|
55399
55584
|
const recent = node('section',undefined,'task-history'); recent.id = 'overview-task';
|
|
55400
|
-
|
|
55401
|
-
recent.append(node('h2','最近任务'),latest ? taskBlock(latest) : node('p','暂无控制台任务','muted'));
|
|
55585
|
+
recent.append(...overviewTasks());
|
|
55402
55586
|
const serviceActions = node('div',undefined,'console-service-actions');
|
|
55403
55587
|
serviceActions.append(button('关闭Maker控制台',() => void shutdownConsole(),{
|
|
55404
55588
|
className:'console-shutdown',disabled:offline || shutdownPending,focus:'console-shutdown'
|
|
@@ -55613,8 +55797,9 @@ function runtimePresentation(status, error = '') {
|
|
|
55613
55797
|
}
|
|
55614
55798
|
return {label:'待检测',detail:'',tone:'muted'};
|
|
55615
55799
|
}
|
|
55616
|
-
function taskStartsOpen(task, open = false) {
|
|
55617
|
-
return Boolean(open || task?.
|
|
55800
|
+
function taskStartsOpen(task, open = false, latest = true) {
|
|
55801
|
+
return Boolean(open || task?.status === 'running' || (latest &&
|
|
55802
|
+
(task?.status === 'unknown' || (task?.status === 'failed' && task?.action !== 'lua-lsp.check'))));
|
|
55618
55803
|
}
|
|
55619
55804
|
function taskOutputText(task) {
|
|
55620
55805
|
const output = text(task?.output,'').trim();
|
|
@@ -55630,8 +55815,10 @@ function taskOutputText(task) {
|
|
|
55630
55815
|
}
|
|
55631
55816
|
function taskBlock(task, open = false) {
|
|
55632
55817
|
const failed = task.status === 'failed';
|
|
55818
|
+
const item = node('article',undefined,'task-item');
|
|
55819
|
+
const shortcuts = node('div',undefined,'actions task-shortcuts');
|
|
55633
55820
|
const d = node('details',undefined,'task' + (failed ? ' is-failed' : '')); d.dataset.key = task.id;
|
|
55634
|
-
d.open = taskStartsOpen(task,open);
|
|
55821
|
+
d.open = taskStartsOpen(task,open,tasksFor(task.projectKey)[0]?.id === task.id);
|
|
55635
55822
|
const summary = node('summary');
|
|
55636
55823
|
summary.dataset.focus = 'task-' + task.id;
|
|
55637
55824
|
summary.append(node('strong', actionLabels[task.action] || task.action),
|
|
@@ -55640,9 +55827,19 @@ function taskBlock(task, open = false) {
|
|
|
55640
55827
|
node('time',date(task.startedAt)));
|
|
55641
55828
|
const meta = node('p','项目:' + text(task.projectName) + ' · 任务:' + text(task.id),'task-meta muted');
|
|
55642
55829
|
d.append(summary,meta);
|
|
55830
|
+
if (task.report) {
|
|
55831
|
+
const labels = {running:'正在提交问题反馈…',created:'问题反馈已提交',unavailable:'反馈未能自动提交,请检查 GitHub CLI 登录状态及网络。',unknown:'反馈提交结果未知,请勿重复提交。'};
|
|
55832
|
+
shortcuts.append(node('span',labels[task.report.status] || '反馈状态未知','muted'));
|
|
55833
|
+
if (task.report.status === 'running') shortcuts.append(node('span',undefined,'loading-spinner'));
|
|
55834
|
+
if (task.report.status === 'created' && /^https:\/\/github\.com\/taptap\/instant-games-open-mcp\/issues\/\d+$/.test(task.report.issue_url || '')) {
|
|
55835
|
+
const link = node('a','查看反馈','preview-link');
|
|
55836
|
+
link.href = task.report.issue_url; link.target = '_blank'; link.rel = 'noopener noreferrer';
|
|
55837
|
+
shortcuts.append(link);
|
|
55838
|
+
}
|
|
55839
|
+
}
|
|
55643
55840
|
if (task.interaction?.kind === 'select_developer' && task.projectKey === selected &&
|
|
55644
55841
|
tasksFor(task.projectKey).find(item => item.action === 'qrcode')?.id === task.id) {
|
|
55645
|
-
|
|
55842
|
+
shortcuts.append(button('选择开发者并继续',() => void runAction('qrcode',{sourceTaskId:task.id}),{
|
|
55646
55843
|
disabled:offline || busy(task.projectKey)
|
|
55647
55844
|
}));
|
|
55648
55845
|
}
|
|
@@ -55660,11 +55857,11 @@ function taskBlock(task, open = false) {
|
|
|
55660
55857
|
const link = node('a','打开 Web 预览','preview-link');
|
|
55661
55858
|
link.href = previewUrl; link.target = '_blank'; link.rel = 'noopener noreferrer';
|
|
55662
55859
|
link.referrerPolicy = 'no-referrer';
|
|
55663
|
-
|
|
55860
|
+
shortcuts.append(link);
|
|
55664
55861
|
}
|
|
55665
55862
|
if (task.action === 'qrcode' && task.status === 'succeeded') {
|
|
55666
55863
|
const source = qrcodeImageSource(task);
|
|
55667
|
-
if (source)
|
|
55864
|
+
if (source) shortcuts.append(button('查看二维码',() => showQrcode(task),{icon:'qrcode',disabled:task.projectKey !== selected}));
|
|
55668
55865
|
const content = task.result?.result?.content;
|
|
55669
55866
|
for (const item of Array.isArray(content) ? content : []) {
|
|
55670
55867
|
if (item.type === 'image' && ['image/png','image/jpeg','image/webp'].includes(item.mimeType) &&
|
|
@@ -55692,7 +55889,8 @@ function taskBlock(task, open = false) {
|
|
|
55692
55889
|
const result = node('details'); result.dataset.key = 'result-' + task.id;
|
|
55693
55890
|
result.append(node('summary','完整结果'),node('pre',text(task.result))); d.append(result);
|
|
55694
55891
|
}
|
|
55695
|
-
|
|
55892
|
+
item.append(d,shortcuts);
|
|
55893
|
+
return item;
|
|
55696
55894
|
}
|
|
55697
55895
|
function windowDimensions(settings, info) {
|
|
55698
55896
|
const orientation = settings.orientation === 'project' ? info.projectOrientation || 'landscape' : settings.orientation;
|
|
@@ -55708,8 +55906,16 @@ function renderWindowSettings() {
|
|
|
55708
55906
|
draft = {settings:JSON.parse(JSON.stringify(info.settings)),dirty:false,saving:false};
|
|
55709
55907
|
windowDrafts.set(key,draft);
|
|
55710
55908
|
}
|
|
55909
|
+
const disclosure = node('details',undefined,'preview-window-disclosure');
|
|
55910
|
+
disclosure.dataset.key = 'preview-window-' + key;
|
|
55911
|
+
const summary = node('summary',undefined,'preview-window-summary');
|
|
55912
|
+
const effective = preview?.process_alive === true && preview?.preflight?.window || info.effective;
|
|
55913
|
+
summary.append(node('span',(effective.height > effective.width ? '竖屏' : '横屏') + ' · ' +
|
|
55914
|
+
effective.width + ' × ' + effective.height,'muted'),node('span','窗口设置'));
|
|
55915
|
+
if (draft.dirty) summary.append(node('span','未保存','pending'));
|
|
55916
|
+
else if (effective.width !== info.effective.width || effective.height !== info.effective.height)
|
|
55917
|
+
summary.append(node('span','已保存,刷新后生效','pending'));
|
|
55711
55918
|
const form = node('form',undefined,'preview-window-settings');
|
|
55712
|
-
form.append(node('h3','预览窗口设置','preview-window-title'));
|
|
55713
55919
|
const disabled = offline || busy(key) || draft.saving;
|
|
55714
55920
|
const selectField = (label, name, options, value, change) => {
|
|
55715
55921
|
const wrap = node('label',label);
|
|
@@ -55772,11 +55978,12 @@ function renderWindowSettings() {
|
|
|
55772
55978
|
} catch (error) { if (selectionMatches(key,epoch)) notify(error.message); }
|
|
55773
55979
|
finally { draft.saving = false; if (selectionMatches(key,epoch)) updateBuild(); }
|
|
55774
55980
|
});
|
|
55775
|
-
|
|
55981
|
+
disclosure.append(summary,form);
|
|
55982
|
+
return disclosure;
|
|
55776
55983
|
}
|
|
55777
55984
|
function renderBuild() {
|
|
55778
|
-
const title = heading('构建与测试',currentProject().
|
|
55779
|
-
const columns = node('div',undefined,'columns');
|
|
55985
|
+
const title = heading('构建与测试',currentProject().name,true);
|
|
55986
|
+
const columns = node('div',undefined,'columns build-columns');
|
|
55780
55987
|
const build = node('section'); build.id = 'build-panel';
|
|
55781
55988
|
const local = node('section'); local.id = 'preview-panel';
|
|
55782
55989
|
columns.append(build,local);
|
|
@@ -55794,16 +56001,20 @@ function updateBuild() {
|
|
|
55794
56001
|
const checkTask = tasks.find(t => t.action === 'lua-lsp.check');
|
|
55795
56002
|
const lua = luaLspPresentation(state.luaLsp);
|
|
55796
56003
|
const checkBlock = node('div',undefined,'lua-check-panel');
|
|
55797
|
-
|
|
56004
|
+
const checkActions = node('div',undefined,'actions lua-check-actions');
|
|
56005
|
+
checkActions.append(luaCheckOption());
|
|
55798
56006
|
if (checkTask) {
|
|
55799
56007
|
const summary = luaCheckSummary(checkTask,checking);
|
|
55800
|
-
|
|
55801
|
-
}
|
|
55802
|
-
const checkActions = node('div',undefined,'actions preview-controls');
|
|
56008
|
+
checkActions.append(button(summary,() => selectLog('lua'),{className:'link ' + (checkTask.status === 'failed' ? 'bad' : checkTask.status === 'succeeded' ? 'good' : 'pending')}));
|
|
56009
|
+
}
|
|
55803
56010
|
checkActions.append(button(checking ? '检查中' : 'Lua 检查',() => void runAction('lua-lsp.check'),{
|
|
55804
|
-
disabled:offline || busy(),focus:'lua-lsp.check'
|
|
56011
|
+
className:'link',icon:'refresh',disabled:offline || busy(),focus:'lua-lsp.check'
|
|
55805
56012
|
}));
|
|
55806
56013
|
checkBlock.append(checkActions);
|
|
56014
|
+
const lspStatus = node('div',undefined,'lsp-status');
|
|
56015
|
+
lspStatus.append(node('span','Lua LSP · ' + lua.label + (lua.detail ? ' · ' + lua.detail : ''), lua.tone),
|
|
56016
|
+
button('检查日志',() => selectLog('lua'),{className:'link'}));
|
|
56017
|
+
checkBlock.append(lspStatus);
|
|
55807
56018
|
const buildChildren = [node('h2','远端构建'),buildStatus,checkBlock];
|
|
55808
56019
|
replace($('build-panel'),buildChildren);
|
|
55809
56020
|
const previewInfo = previewPresentation(preview,previewError);
|
|
@@ -55813,13 +56024,10 @@ function updateBuild() {
|
|
|
55813
56024
|
preview?.install_state === 'ready' ? 'good' : preview?.install_state === 'missing' ? 'pending' : 'muted'));
|
|
55814
56025
|
summary.append(node('span',previewLoading ? '检测中…' : previewError ? '检测失败' : previewInfo.stateLabel,
|
|
55815
56026
|
previewLoading ? 'pending' : previewInfo.tone));
|
|
55816
|
-
if (previewInfo.errorCount) summary.append(
|
|
56027
|
+
if (previewInfo.errorCount) summary.append(button(previewInfo.errorCount + ' 条日志错误',
|
|
56028
|
+
() => void loadLogs(),{className:'link bad'}));
|
|
55817
56029
|
const localChildren = [node('h2','本地预览'),summary];
|
|
55818
|
-
localChildren.push(renderWindowSettings());
|
|
55819
56030
|
if (previewInfo.error) localChildren.push(node('p',previewInfo.error,'bad'));
|
|
55820
|
-
if (previewInfo.errorCount) localChildren.push(button(
|
|
55821
|
-
'Runtime 日志中有 ' + previewInfo.errorCount + ' 条错误 · 查看日志',
|
|
55822
|
-
() => void loadLogs(),{className:'link bad'}));
|
|
55823
56031
|
if (preview?.session_id) {
|
|
55824
56032
|
const diagnostics = node('details'); diagnostics.dataset.key = 'preview-diagnostics';
|
|
55825
56033
|
diagnostics.append(node('summary','诊断信息'),fields([['会话 ID',preview.session_id],
|
|
@@ -55828,16 +56036,18 @@ function updateBuild() {
|
|
|
55828
56036
|
}
|
|
55829
56037
|
if (preview?.supported === false) localChildren.push(node('p','当前平台不支持本地预览','bad'));
|
|
55830
56038
|
const actions = node('div',undefined,'actions preview-controls');
|
|
55831
|
-
previewActions(preview).
|
|
55832
|
-
|
|
55833
|
-
|
|
55834
|
-
|
|
55835
|
-
|
|
55836
|
-
})
|
|
56039
|
+
if (!previewActions(preview).includes('preview.stop'))
|
|
56040
|
+
actions.append(button('停止预览',() => {},{disabled:true}));
|
|
56041
|
+
previewActions(preview).filter(action => action !== 'preview.start').reverse().forEach(action => actions.append(button(
|
|
56042
|
+
actionBusy(action) ? actionLabels[action] + '中' : actionLabels[action],() => void runAction(action),{
|
|
56043
|
+
loading:actionBusy(action),disabled:offline || busy(),focus:action,
|
|
56044
|
+
...(action === 'preview.refresh' ? {icon:'refresh',iconOnly:true,className:'icon-button'} : {})
|
|
56045
|
+
})));
|
|
55837
56046
|
actions.append(button(previewLoading ? '检测中' : '检测预览状态',() => void refreshPreview(),{
|
|
55838
|
-
|
|
55839
|
-
actions.append(button('查看运行日志',() => void loadLogs(),{focus:'preview-logs'}));
|
|
56047
|
+
className:'link',loading:previewLoading,focus:'preview-status'}));
|
|
56048
|
+
actions.append(button('查看运行日志',() => void loadLogs(),{className:'link',focus:'preview-logs'}));
|
|
55840
56049
|
localChildren.push(actions);
|
|
56050
|
+
localChildren.push(renderWindowSettings());
|
|
55841
56051
|
replace($('preview-panel'),localChildren);
|
|
55842
56052
|
renderConsoleLogs();
|
|
55843
56053
|
const history = [node('h2','任务历史')];
|
|
@@ -55985,6 +56195,7 @@ function luaCheckBlocksBuild(task) {
|
|
|
55985
56195
|
async function runAction(action, options = {}) {
|
|
55986
56196
|
const key = selected, epoch = selectionEpoch;
|
|
55987
56197
|
const project = currentProject();
|
|
56198
|
+
let preflight = false;
|
|
55988
56199
|
if (!project?.valid || busy(key) || !Object.hasOwn(actionLabels,action)) return;
|
|
55989
56200
|
if (action === 'build' || action === 'lua-lsp.check') logView().tab = action === 'build' ? 'build' : 'lua';
|
|
55990
56201
|
pending.add(key); pendingActions.set(key,action); updateChrome(); updateBuild();
|
|
@@ -56035,6 +56246,7 @@ async function runAction(action, options = {}) {
|
|
|
56035
56246
|
}
|
|
56036
56247
|
if (action !== 'build' && action !== 'lua-lsp.check') {
|
|
56037
56248
|
const checkServerChanges = action === 'preview.start' || action === 'preview.refresh';
|
|
56249
|
+
preflight = ['preview.start','preview.refresh','preview.install'].includes(action);
|
|
56038
56250
|
const status = await api(projectPath(key,checkServerChanges ? '/preview?check_server_changes=1' : '/preview'));
|
|
56039
56251
|
if (selectionMatches(key,epoch)) preview = status;
|
|
56040
56252
|
if (!previewActions(status).includes(action)) throw new Error(text(status.error,'预览状态已改变,请重新检测后操作。'));
|
|
@@ -56087,6 +56299,21 @@ async function runAction(action, options = {}) {
|
|
|
56087
56299
|
}
|
|
56088
56300
|
} catch (error) {
|
|
56089
56301
|
if (selectionMatches(key,epoch)) notify(error.message);
|
|
56302
|
+
const reportablePreflight = /timeout|timed out|HTTP 5\d\d|internal.*error|unverifiable|unexpected|connection closed/i
|
|
56303
|
+
.test(String(error?.message || error));
|
|
56304
|
+
if (preflight && reportablePreflight && selectionMatches(key,epoch)) {
|
|
56305
|
+
try {
|
|
56306
|
+
const failed = await api('/api/tasks/failure',{
|
|
56307
|
+
method:'POST',
|
|
56308
|
+
body:{projectKey:key,action,error:String(error?.message || error)}
|
|
56309
|
+
});
|
|
56310
|
+
rememberTask(failed);
|
|
56311
|
+
offerIssueReport(failed);
|
|
56312
|
+
showPendingIssueReport();
|
|
56313
|
+
} catch {
|
|
56314
|
+
// The original preflight error remains visible when the local task record cannot be saved.
|
|
56315
|
+
}
|
|
56316
|
+
}
|
|
56090
56317
|
} finally {
|
|
56091
56318
|
pending.delete(key);
|
|
56092
56319
|
pendingActions.delete(key);
|
|
@@ -56103,6 +56330,7 @@ async function pollTask(id,key,epoch) {
|
|
|
56103
56330
|
const task = await api('/api/tasks/' + encodeURIComponent(id));
|
|
56104
56331
|
if (task.projectKey !== key || task.id !== id) throw new Error('任务身份不一致');
|
|
56105
56332
|
rememberTask(task);
|
|
56333
|
+
if (prior?.status === 'running' && task.status !== 'running') offerIssueReport(task);
|
|
56106
56334
|
const index = state.tasks.findIndex(t => t.id === id);
|
|
56107
56335
|
if (index >= 0) state.tasks[index] = task; else state.tasks.push(task);
|
|
56108
56336
|
if (!selectionMatches(key,epoch)) return task;
|
|
@@ -56112,6 +56340,7 @@ async function pollTask(id,key,epoch) {
|
|
|
56112
56340
|
await refreshPreview();
|
|
56113
56341
|
if (selectionMatches(key,epoch)) handleQrcodeCompletion(task);
|
|
56114
56342
|
}
|
|
56343
|
+
showPendingIssueReport();
|
|
56115
56344
|
return task;
|
|
56116
56345
|
} catch (error) { if (selectionMatches(key,epoch)) notify(error.message); }
|
|
56117
56346
|
}
|
|
@@ -56289,13 +56518,16 @@ async function pollState() {
|
|
|
56289
56518
|
Object.assign(task,prior);
|
|
56290
56519
|
} else if (prior) rememberTask(task);
|
|
56291
56520
|
if (task.projectKey === selected && previousTasks.get(task.id) === 'running' && task.status !== 'running') {
|
|
56521
|
+
offerIssueReport(task);
|
|
56292
56522
|
announce((actionLabels[task.action] || task.action) + ' · ' + text(task.projectName) + ' · ' + (statusLabels[task.status] || '结果未知'));
|
|
56293
56523
|
handleQrcodeCompletion(task);
|
|
56294
56524
|
}
|
|
56295
56525
|
});
|
|
56526
|
+
showPendingIssueReport();
|
|
56296
56527
|
$('version').textContent = 'Maker ' + text(state.version) + ' · ' + text(state.distribution,'独立发行') + ' · ' + text(state.platform);
|
|
56297
56528
|
renderVersionPicker();
|
|
56298
|
-
$('connection').textContent = '已连接
|
|
56529
|
+
$('connection').textContent = '已连接';
|
|
56530
|
+
$('connection').title = '最近连接:' + new Date().toLocaleTimeString('zh-CN');
|
|
56299
56531
|
$('connection').className = 'good';
|
|
56300
56532
|
lastStateError = '';
|
|
56301
56533
|
if (selected && !currentProject()?.valid && (page !== 'projects' || first || priorProjects !== JSON.stringify(state.projects))) {
|
|
@@ -56329,6 +56561,19 @@ async function poll() {
|
|
|
56329
56561
|
}
|
|
56330
56562
|
}
|
|
56331
56563
|
document.addEventListener('DOMContentLoaded',async () => {
|
|
56564
|
+
let makerMarkClicks = 0;
|
|
56565
|
+
let makerMarkTimer;
|
|
56566
|
+
$('maker-mark').addEventListener('click',() => {
|
|
56567
|
+
makerMarkClicks += 1;
|
|
56568
|
+
clearTimeout(makerMarkTimer);
|
|
56569
|
+
if (makerMarkClicks >= 3) {
|
|
56570
|
+
$('maker-mark').classList.add('maker-easter-egg');
|
|
56571
|
+
$('maker-mark').setAttribute('aria-label','Maker 控制台彩蛋已触发');
|
|
56572
|
+
makerMarkClicks = 0;
|
|
56573
|
+
return;
|
|
56574
|
+
}
|
|
56575
|
+
makerMarkTimer = setTimeout(() => { makerMarkClicks = 0; },1000);
|
|
56576
|
+
});
|
|
56332
56577
|
window.addEventListener('message',event => {
|
|
56333
56578
|
for (const session of pluginSessions.values()) {
|
|
56334
56579
|
if (!pluginMessageMatches(event,session)) continue;
|
|
@@ -56352,12 +56597,23 @@ document.addEventListener('DOMContentLoaded',async () => {
|
|
|
56352
56597
|
const value = theme.checked ? 'dark' : 'light';
|
|
56353
56598
|
document.documentElement.dataset.theme = value;
|
|
56354
56599
|
pluginSessions.forEach(session => sendPluginTheme(session));
|
|
56355
|
-
if ($('fortune-frame').getAttribute('src'))
|
|
56600
|
+
if ($('fortune-frame').getAttribute('src')) {
|
|
56601
|
+
beginFortuneLoad(true);
|
|
56602
|
+
}
|
|
56356
56603
|
try { localStorage.setItem('maker-console-theme',value); } catch (_) { notify('无法保存主题设置'); }
|
|
56357
56604
|
});
|
|
56358
56605
|
$('projects-button').append(icon('folder'));
|
|
56359
|
-
$('fortune-
|
|
56360
|
-
$('fortune-
|
|
56606
|
+
const fortunePanel = $('fortune-panel');
|
|
56607
|
+
const fortuneFrame = $('fortune-frame');
|
|
56608
|
+
fortunePanel.classList.add('fortune-preload');
|
|
56609
|
+
fortunePanel.hidden = true;
|
|
56610
|
+
fortuneFrame.addEventListener('load',revealFortune);
|
|
56611
|
+
fortuneFrame.addEventListener('error',() => {
|
|
56612
|
+
fortuneReady = false;
|
|
56613
|
+
$('fortune-corner').hidden = true;
|
|
56614
|
+
fortunePanel.hidden = true;
|
|
56615
|
+
});
|
|
56616
|
+
beginFortuneLoad();
|
|
56361
56617
|
bindFortuneHover($('fortune-toggle'));
|
|
56362
56618
|
bindFortuneHover($('fortune-panel'));
|
|
56363
56619
|
$('fortune-toggle').addEventListener('click',event => {
|
|
@@ -56396,7 +56652,7 @@ var init_webStyles = __esm({
|
|
|
56396
56652
|
"src/maker/console/webStyles.ts"() {
|
|
56397
56653
|
"use strict";
|
|
56398
56654
|
consoleStyles = String.raw`
|
|
56399
|
-
:root{color-scheme:dark;--bg:#
|
|
56655
|
+
:root{color-scheme:dark;--bg:#1b1e1f;--top:#232728;--border:#363b3c;--text:#ecefee;--muted:#9ca6a4;--yellow:#f5dc56;--accent:#f5dc56;--green:#78d4ad;--red:#f08b85;--soft:#303b36;--code:#16191a}
|
|
56400
56656
|
:root[data-theme="light"]{color-scheme:light;--bg:#fff;--top:#f3f5f4;--border:#dce2de;--text:#252e29;--muted:#64716a;--accent:#76600b;--green:#176c50;--red:#b3352c;--soft:#edf4ef;--code:#f5f7f6}
|
|
56401
56657
|
*{box-sizing:border-box}
|
|
56402
56658
|
body{margin:0;background:var(--bg);color:var(--text);font:14px/1.6 "PingFang SC","Microsoft YaHei",sans-serif;letter-spacing:0}
|
|
@@ -56405,11 +56661,12 @@ button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min
|
|
|
56405
56661
|
button:hover:not(:disabled){border-color:var(--muted);background:var(--soft)}
|
|
56406
56662
|
button:disabled{opacity:.5;cursor:not-allowed}
|
|
56407
56663
|
button.primary{background:var(--yellow);border-color:var(--yellow);color:#252820;font-weight:600}
|
|
56408
|
-
button.preview-button{color:var(--
|
|
56409
|
-
.
|
|
56664
|
+
button.preview-button{color:var(--accent);font-weight:700;border-color:#756b38;background:#302e22}
|
|
56665
|
+
:root[data-theme="light"] button.preview-button{background:#fcf6d7;border-color:#bcab57}
|
|
56666
|
+
.build-button{min-width:88px}
|
|
56410
56667
|
button.is-building:disabled{opacity:1;cursor:wait}
|
|
56411
56668
|
.build-badge{font-size:12px;white-space:nowrap}
|
|
56412
|
-
.build-status{padding:
|
|
56669
|
+
.build-status{padding:0;margin-bottom:16px;min-height:32px}
|
|
56413
56670
|
.build-status-title{display:flex;align-items:center;gap:8px}
|
|
56414
56671
|
.build-stage{font-size:13px;overflow-wrap:anywhere}
|
|
56415
56672
|
.build-progress{height:6px;width:100%;overflow:hidden;background:var(--border);margin-top:12px}
|
|
@@ -56426,27 +56683,29 @@ button.is-building:disabled{opacity:1;cursor:wait}
|
|
|
56426
56683
|
.build-progress.determinate span{transition:width .25s ease}
|
|
56427
56684
|
}
|
|
56428
56685
|
button.danger{color:var(--red)}
|
|
56429
|
-
.console-service-actions{display:flex;justify-content:flex-end;margin-top:24px;padding-top:16px
|
|
56430
|
-
button.console-shutdown{background:#
|
|
56686
|
+
.console-service-actions{display:flex;justify-content:flex-end;margin-top:24px;padding-top:16px}
|
|
56687
|
+
button.console-shutdown{background:#332525;color:#d3908e;border-color:#65413f;font-size:12px}
|
|
56431
56688
|
button.console-shutdown:hover:not(:disabled){background:#87353d;border-color:#87353d}
|
|
56432
56689
|
#maker-version-picker{font-size:12px;font-weight:400;max-width:240px;min-width:100px;padding:5px 8px}
|
|
56433
56690
|
.brand{flex-wrap:wrap}
|
|
56434
|
-
.footer-start{display:flex;align-items:center;gap:
|
|
56691
|
+
.footer-start{display:flex;align-items:center;gap:18px;flex-wrap:wrap;min-width:0}
|
|
56435
56692
|
#fortune-corner{position:relative;flex:none}
|
|
56436
|
-
button#fortune-toggle{border:0;background:none;color:#
|
|
56693
|
+
button#fortune-toggle{border:0;background:none;color:#b5aa78;font-size:11px;font-weight:400;padding:0;min-height:0;line-height:1.4;white-space:nowrap}
|
|
56437
56694
|
:root[data-theme="light"] button#fortune-toggle{color:#c4a017}
|
|
56438
56695
|
button#fortune-toggle:hover,button#fortune-toggle[aria-expanded="true"]{color:var(--yellow);background:none;border-color:transparent}
|
|
56439
56696
|
#fortune-panel{position:fixed;z-index:30;overflow:hidden;border:0;border-radius:6px;background:transparent;box-shadow:0 8px 28px #0005}
|
|
56440
56697
|
#fortune-panel[hidden]{display:none!important}
|
|
56698
|
+
#fortune-panel.fortune-preload{opacity:0;pointer-events:none;left:0;top:0;width:1px;height:1px}
|
|
56441
56699
|
#fortune-panel iframe{display:block;width:100%;height:100%;border:0}
|
|
56442
|
-
#fortune-retry{position:absolute;right:4px;top:4px;z-index:1;width:32px;height:32px;padding:4px}
|
|
56443
56700
|
.document-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin-bottom:18px}
|
|
56444
56701
|
.document-toolbar input{flex:1;min-width:160px;max-width:360px}
|
|
56445
|
-
.document-
|
|
56446
|
-
.document-
|
|
56447
|
-
|
|
56702
|
+
.document-tabs{border:1px solid var(--border);border-radius:5px;padding:3px;gap:3px}
|
|
56703
|
+
.document-tabs button{border:0;background:transparent;color:var(--muted);font-size:13px;min-height:30px;padding:4px 12px}
|
|
56704
|
+
.document-toolbar [aria-selected="true"]{color:var(--accent);background:var(--soft)}
|
|
56705
|
+
.document-layout{display:grid;grid-template-columns:235px minmax(0,1fr);border-top:1px solid var(--border);height:calc(100dvh - 260px);min-height:460px}
|
|
56706
|
+
#document-directory{padding:12px 18px 20px 0;border-right:1px solid var(--border);overflow:auto}
|
|
56448
56707
|
#document-directory h3{font-size:12px;color:var(--muted);margin:18px 0 8px}
|
|
56449
|
-
button.document-entry{display:block;width:100%;padding:7px 10px;overflow-wrap:anywhere;border-radius:
|
|
56708
|
+
button.document-entry{display:block;width:100%;padding:7px 10px;overflow-wrap:anywhere;border-radius:4px;font-size:13px}
|
|
56450
56709
|
button.document-entry[aria-current]{color:var(--accent);background:var(--soft);border-left:2px solid var(--accent)}
|
|
56451
56710
|
button.document-entry.document-featured{color:var(--accent);font-weight:700}
|
|
56452
56711
|
.document-intro{border-bottom:1px solid var(--border);padding-bottom:16px;margin-bottom:20px}
|
|
@@ -56456,7 +56715,7 @@ button.document-entry.document-featured{color:var(--accent);font-weight:700}
|
|
|
56456
56715
|
.document-reader-header h2{font-size:22px;margin:0;min-width:0;flex:1}
|
|
56457
56716
|
.document-reader-header button{flex-shrink:0}
|
|
56458
56717
|
.document-reader-header input{width:100%}
|
|
56459
|
-
#document-reader{min-width:0;padding:22px
|
|
56718
|
+
#document-reader{min-width:0;padding:22px 32px;overflow:auto;overflow-wrap:anywhere}
|
|
56460
56719
|
#document-reader>h2{font-size:22px;margin-top:0}
|
|
56461
56720
|
.markdown-content{line-height:1.85;max-width:920px}
|
|
56462
56721
|
.markdown-content h1{font-size:24px}.markdown-content h2{font-size:20px}.markdown-content h3{font-size:17px}
|
|
@@ -56465,27 +56724,33 @@ button.document-entry.document-featured{color:var(--accent);font-weight:700}
|
|
|
56465
56724
|
.markdown-content a{color:var(--green);text-decoration:underline}
|
|
56466
56725
|
.doc-table{overflow:auto}.doc-table table{border-collapse:collapse;width:100%}
|
|
56467
56726
|
.doc-table th,.doc-table td{border:1px solid var(--border);padding:8px;text-align:left}
|
|
56468
|
-
@media(max-width:700px){.document-layout{grid-template-columns:minmax(0,1fr)}#document-directory{max-height:220px;border-right:0;border-bottom:1px solid var(--border);padding-right:0}#document-reader{padding:18px 0;max-height:none}}
|
|
56727
|
+
@media(max-width:700px){.document-layout{grid-template-columns:minmax(0,1fr);height:auto}#document-directory{max-height:220px;border-right:0;border-bottom:1px solid var(--border);padding-right:0}#document-reader{padding:18px 0;max-height:none}}
|
|
56469
56728
|
button.icon-button{width:36px;flex-shrink:0;padding:8px}
|
|
56470
56729
|
button.link{background:none;border:0;padding:0;justify-content:flex-start;color:var(--text);text-align:left;min-width:0}
|
|
56471
56730
|
:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
|
|
56472
56731
|
.icon{width:16px;height:16px;flex:none}
|
|
56473
56732
|
input,select{border:1px solid var(--border);border-radius:4px;padding:7px 10px;background:var(--bg);color:var(--text)}
|
|
56474
|
-
input[type="checkbox"]{accent-color:var(--yellow);width:
|
|
56475
|
-
.top{display:flex;justify-content:space-between;gap:20px;align-items:center;padding:18px
|
|
56733
|
+
input[type="checkbox"]{accent-color:var(--yellow);width:14px;height:14px}
|
|
56734
|
+
.top{display:flex;justify-content:space-between;gap:20px;align-items:center;padding:18px 32px;background:var(--top);flex-wrap:wrap}
|
|
56476
56735
|
.brand{font-size:18px;font-weight:600;display:flex;gap:10px;align-items:center}
|
|
56477
|
-
.mark{width:28px;height:28px;display:grid;place-items:center;color:#252820;background:var(--yellow);border-radius:4px}
|
|
56736
|
+
.mark{width:28px;height:28px;display:grid;place-items:center;color:#252820;background:var(--yellow);border:0;border-radius:4px;padding:0;font:inherit;font-weight:800;cursor:pointer;transition:transform .2s ease,background .2s ease}
|
|
56737
|
+
.mark:active{transform:scale(.94)}
|
|
56738
|
+
.mark.maker-easter-egg{color:var(--yellow);background:transparent;border-radius:0;position:relative;overflow:visible;font-family:"Arial Rounded MT Bold","Trebuchet MS",sans-serif;font-size:25px;font-weight:900;letter-spacing:0;line-height:1;animation:maker-mark-reveal 1.5s ease both}
|
|
56739
|
+
@keyframes maker-mark-reveal{0%{transform:scale(.9);opacity:.35}55%{transform:scale(1.08)}100%{transform:scale(1);opacity:1}}
|
|
56740
|
+
@media(prefers-reduced-motion:reduce){.mark,.mark.maker-easter-egg{animation:none;transition:none}}
|
|
56478
56741
|
.toolbar,.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
|
56479
|
-
.toolbar select{max-width:380px;width:
|
|
56742
|
+
.toolbar select{max-width:380px;width:235px}
|
|
56480
56743
|
.theme{display:flex;gap:7px;align-items:center;font-size:12px;color:var(--muted);white-space:nowrap}
|
|
56481
|
-
|
|
56744
|
+
.navigation{display:flex;align-items:center;gap:24px;padding:0 32px;border-bottom:1px solid var(--border);background:var(--top)}
|
|
56745
|
+
nav{display:flex;gap:26px;min-width:0;flex:1;background:var(--top)}
|
|
56482
56746
|
nav button{background:none;border:0;border-bottom:2px solid transparent;border-radius:0;padding:10px 0;color:var(--muted)}
|
|
56483
56747
|
nav button[aria-current="page"]{color:var(--accent);border-bottom-color:var(--yellow)}
|
|
56484
|
-
.context,footer{padding:10px
|
|
56485
|
-
.context{
|
|
56748
|
+
.context,footer{padding:10px 32px;display:flex;gap:18px;justify-content:space-between;flex-wrap:wrap;font-size:12px;color:var(--muted)}
|
|
56749
|
+
.navigation .context{padding:0;justify-content:flex-end;font-size:12px;flex-shrink:0;max-width:40%}
|
|
56750
|
+
#connection.good:before{content:"";display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--green);margin-right:7px}
|
|
56486
56751
|
.context span{overflow-wrap:anywhere;min-width:0}
|
|
56487
|
-
main{padding:
|
|
56488
|
-
h1{font-size:
|
|
56752
|
+
main{padding:28px 32px;max-width:1480px;margin:0 auto;min-height:calc(100dvh - 180px)}
|
|
56753
|
+
h1{font-size:23px;font-weight:600;margin:0;overflow-wrap:anywhere}
|
|
56489
56754
|
h2{font-size:16px;font-weight:600;margin:0 0 14px}
|
|
56490
56755
|
h3{font-size:14px;font-weight:600;margin:0 0 6px}
|
|
56491
56756
|
p{margin:8px 0}
|
|
@@ -56493,7 +56758,6 @@ p{margin:8px 0}
|
|
|
56493
56758
|
.heading p{margin:2px 0 0}
|
|
56494
56759
|
#heading-actions{display:flex;flex-direction:column;align-items:flex-end;gap:10px;max-width:100%}
|
|
56495
56760
|
.heading-primary,.heading-secondary{justify-content:flex-end;max-width:100%}
|
|
56496
|
-
.heading-secondary{font-size:12px;gap:14px}
|
|
56497
56761
|
.qrcode-image{display:block;width:240px;max-width:100%;height:auto;margin:14px 0}
|
|
56498
56762
|
#qrcode-result{width:496px;max-height:calc(100dvh - 32px);overflow:auto}
|
|
56499
56763
|
.qrcode-scan-area{width:min(400px,100%,55dvh);aspect-ratio:1;margin:16px auto;background:#fff;display:grid;place-items:center;padding:12px}
|
|
@@ -56515,13 +56779,19 @@ p{margin:8px 0}
|
|
|
56515
56779
|
.failure-detail{margin:8px 0 0;max-height:280px}
|
|
56516
56780
|
.metrics{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));border-block:1px solid var(--border);margin-bottom:26px}
|
|
56517
56781
|
.lua-check-option{display:inline-flex;align-items:center;gap:8px;color:var(--muted);white-space:nowrap}
|
|
56518
|
-
.lua-check-panel{
|
|
56519
|
-
.
|
|
56520
|
-
.
|
|
56782
|
+
.lua-check-panel{font-size:12px}
|
|
56783
|
+
.lua-check-actions{gap:12px;min-height:36px}
|
|
56784
|
+
.lua-check-actions>button:last-child{margin-left:auto;color:var(--muted)}
|
|
56785
|
+
.lsp-status{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:12px;min-height:36px}
|
|
56786
|
+
.lsp-status>button{color:var(--muted)}
|
|
56787
|
+
.metric{padding:20px 12px 20px 0;min-width:0}
|
|
56788
|
+
.metric .value{font-size:18px;font-weight:600;overflow-wrap:anywhere;margin-top:6px}
|
|
56521
56789
|
.metric .muted{font-size:12px}
|
|
56522
56790
|
.runtime-detail{margin-top:3px;overflow-wrap:anywhere}
|
|
56523
56791
|
.runtime-metric button{margin-top:8px}
|
|
56524
56792
|
.columns{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:36px}
|
|
56793
|
+
.build-columns{padding:22px 0;border-block:1px solid var(--border)}
|
|
56794
|
+
.build-columns>section+section{padding-left:36px;border-left:1px solid var(--border)}
|
|
56525
56795
|
section{min-width:0}
|
|
56526
56796
|
dl{margin:0}
|
|
56527
56797
|
.row{display:flex;justify-content:space-between;gap:16px;padding:9px 0;border-bottom:1px solid var(--border);overflow-wrap:anywhere}
|
|
@@ -56532,19 +56802,27 @@ pre{white-space:pre-wrap;tab-size:2;margin:10px 0 0;background:var(--code);paddi
|
|
|
56532
56802
|
.feedback p{margin:0;white-space:pre-wrap}
|
|
56533
56803
|
.feedback[data-tone="warning"]{border-left-color:var(--yellow)}
|
|
56534
56804
|
.feedback[data-tone="success"]{border-left-color:var(--green)}
|
|
56535
|
-
.console-logs{width:100%;min-width:0;margin-top:24px
|
|
56805
|
+
.console-logs{width:100%;min-width:0;margin-top:24px}
|
|
56536
56806
|
.console-log-toolbar{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;margin-bottom:10px}
|
|
56537
|
-
.console-log-toolbar
|
|
56538
|
-
.console-
|
|
56807
|
+
.console-log-toolbar h2{margin:0}
|
|
56808
|
+
.console-log-tabs{display:flex;gap:22px;padding:0 16px;background:var(--top);border:1px solid var(--border);border-radius:4px 4px 0 0;overflow:auto}
|
|
56809
|
+
.console-log-tabs button{border:0;border-bottom:2px solid transparent;background:none;border-radius:0;font-size:12px;color:var(--muted);padding:10px 0;flex-shrink:0}
|
|
56810
|
+
.console-log-tabs [aria-selected="true"]{color:var(--accent);border-bottom-color:var(--accent)}
|
|
56811
|
+
.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;border-top:0;border-radius:0 0 4px 4px;line-height:1.9}
|
|
56539
56812
|
.console-logs .console-log-output.wrap{white-space:pre-wrap;overflow-wrap:anywhere}
|
|
56540
56813
|
.console-log-output .log-line{color:var(--text)}
|
|
56541
56814
|
.console-log-output .log-error{color:var(--red)}
|
|
56542
56815
|
.console-log-output .log-warning{color:var(--yellow)}
|
|
56543
56816
|
button.link.bad{color:var(--red)}button.link.good{color:var(--green)}button.link.pending{color:var(--accent)}
|
|
56544
|
-
.preview-status-summary{display:flex;flex-wrap:wrap;align-items:center;gap:8px
|
|
56545
|
-
.preview-status-summary
|
|
56546
|
-
.preview-window-
|
|
56547
|
-
.preview-window-
|
|
56817
|
+
.preview-status-summary{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;min-height:32px;font-size:13px}
|
|
56818
|
+
.preview-status-summary button{margin-left:auto}
|
|
56819
|
+
.preview-window-disclosure{margin-top:12px;font-size:12px}
|
|
56820
|
+
.preview-window-summary{display:flex;align-items:center;gap:10px;min-height:36px;flex-wrap:wrap;list-style:none}
|
|
56821
|
+
.preview-window-summary::-webkit-details-marker{display:none}
|
|
56822
|
+
.preview-window-summary>span:nth-child(2){margin-left:auto}
|
|
56823
|
+
.preview-window-summary:after{content:"⌄";color:var(--muted)}
|
|
56824
|
+
.preview-window-disclosure[open]>.preview-window-summary:after{content:"⌃"}
|
|
56825
|
+
.preview-window-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:12px 0 0;padding:14px 0 0;border-top:1px solid var(--border)}
|
|
56548
56826
|
.preview-window-settings label{display:flex;flex-direction:column;gap:6px;min-width:0}
|
|
56549
56827
|
.preview-window-settings input,.preview-window-settings select{width:100%;min-width:0;box-sizing:border-box}
|
|
56550
56828
|
.preview-window-footer{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
|
|
@@ -56559,13 +56837,23 @@ button.link.bad{color:var(--red)}button.link.good{color:var(--green)}button.link
|
|
|
56559
56837
|
.entry label{grid-column:1/-1}
|
|
56560
56838
|
.task-history{margin-top:28px;border-top:1px solid var(--border);padding-top:20px}
|
|
56561
56839
|
.build-detail,.preview-log-detail{margin-top:28px;border-top:1px solid var(--border);padding-top:20px;width:100%}
|
|
56562
|
-
.task{
|
|
56840
|
+
.task-item{display:flex;align-items:flex-start;gap:16px;border-bottom:1px solid var(--border);padding:13px 0}
|
|
56841
|
+
.task{flex:1;min-width:0}
|
|
56842
|
+
.task-shortcuts{flex-shrink:0;max-width:40%;justify-content:flex-end}
|
|
56843
|
+
.task-shortcuts:empty{display:none}
|
|
56844
|
+
.section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
|
|
56845
|
+
.section-heading h2{margin:0}.section-heading span{font-size:12px}
|
|
56563
56846
|
summary{cursor:pointer;overflow-wrap:anywhere}
|
|
56564
|
-
.task summary{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
|
|
56847
|
+
.task summary{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;min-height:36px;padding:6px 0;font-size:13px}
|
|
56848
|
+
.task summary:before{content:"›";color:var(--muted)}
|
|
56849
|
+
.task[open]>summary:before{content:"⌄"}
|
|
56565
56850
|
.task summary time{margin-left:auto;font-size:12px}
|
|
56566
56851
|
.task .task-meta{font-size:12px;margin-top:8px}
|
|
56567
56852
|
.status-line{min-height:48px;margin:0 0 15px;padding:12px 0;border-block:1px solid var(--border);overflow-wrap:anywhere}
|
|
56568
56853
|
.preview-controls{margin-top:14px}
|
|
56854
|
+
#preview-panel>.preview-controls{margin-top:12px;min-height:36px}
|
|
56855
|
+
#preview-panel>.preview-controls>.link:last-child{margin-left:auto;color:var(--muted);font-size:12px}
|
|
56856
|
+
#preview-panel>details:not(.preview-window-disclosure){margin-top:8px;font-size:12px;color:var(--muted)}
|
|
56569
56857
|
.git-scroll{overflow:auto}
|
|
56570
56858
|
.git-history{position:relative;min-width:420px}
|
|
56571
56859
|
.git-graph{position:absolute;inset:0 auto auto 0;pointer-events:none}
|
|
@@ -56577,7 +56865,8 @@ summary{cursor:pointer;overflow-wrap:anywhere}
|
|
|
56577
56865
|
.git-meta{display:flex;gap:14px;flex-wrap:wrap;margin-bottom:16px}
|
|
56578
56866
|
.git-detail{margin-top:24px;border-top:1px solid var(--border);padding-top:20px}
|
|
56579
56867
|
.file-list{padding-left:22px;overflow-wrap:anywhere}
|
|
56580
|
-
footer{border-top:1px solid var(--border);font-size:11px;align-items:center}
|
|
56868
|
+
footer{border-top:1px solid var(--border);font-size:11px;align-items:center;gap:12px}
|
|
56869
|
+
#footer-path{overflow-wrap:anywhere;min-width:0}
|
|
56581
56870
|
dialog{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:24px;width:440px;max-width:calc(100% - 32px)}
|
|
56582
56871
|
dialog::backdrop{background:#0009}
|
|
56583
56872
|
dialog h2{font-size:18px}dialog .actions{justify-content:flex-end;margin-top:22px}
|
|
@@ -56590,13 +56879,18 @@ nav{overflow-x:auto;white-space:nowrap}
|
|
|
56590
56879
|
.plugin-frame{display:block;width:100%;height:calc(100dvh - 205px);min-height:520px;border:0;background:var(--bg)}
|
|
56591
56880
|
[hidden]{display:none!important}
|
|
56592
56881
|
@media(max-width:720px){
|
|
56593
|
-
.top,main{padding:18px 16px}
|
|
56882
|
+
.top,main{padding:18px 16px}.navigation{padding-inline:16px;gap:0;flex-wrap:wrap}nav{gap:24px;width:100%;flex:auto}.context,footer{padding-inline:16px}
|
|
56883
|
+
.navigation .context{max-width:none;width:100%;padding:8px 0;justify-content:space-between}
|
|
56594
56884
|
.toolbar{width:100%}.toolbar select{flex:1;min-width:0;width:auto}.theme{margin-left:auto}
|
|
56595
56885
|
.columns{grid-template-columns:1fr;gap:28px}.metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
|
|
56886
|
+
.build-columns>section+section{padding-left:0;border-left:0;padding-top:20px;border-top:1px solid var(--border)}
|
|
56596
56887
|
.feedback{margin-inline:16px}button{min-height:42px}button.icon-button{width:42px}
|
|
56597
56888
|
.project-row{gap:10px}.project-row .actions{justify-content:flex-end}.entry{grid-template-columns:1fr}.entry input{font-size:16px}
|
|
56598
56889
|
.git-row{grid-template-columns:64px minmax(0,1fr);gap:8px;padding-block:8px}.git-row time{grid-column:2;text-align:left;font-size:11px}
|
|
56599
56890
|
.task summary time{margin-left:0;width:100%}h1{font-size:22px}
|
|
56891
|
+
.task-item{flex-wrap:wrap;gap:6px}.task-shortcuts{max-width:100%}
|
|
56892
|
+
.console-log-tabs{gap:18px;padding-inline:12px}
|
|
56893
|
+
.document-tabs button{min-height:36px}
|
|
56600
56894
|
.plugin-status{padding:10px 16px}.plugin-frame{height:calc(100dvh - 235px);min-height:480px}
|
|
56601
56895
|
}
|
|
56602
56896
|
@media(prefers-reduced-motion:no-preference){button{transition:background .12s,border-color .12s}}
|
|
@@ -56617,7 +56911,7 @@ function getConsoleHtml() {
|
|
|
56617
56911
|
<title>Maker 本地控制台</title><style>${consoleStyles}</style></head>
|
|
56618
56912
|
<body>
|
|
56619
56913
|
<header class="top">
|
|
56620
|
-
<div class="brand"><
|
|
56914
|
+
<div class="brand"><button class="mark" id="maker-mark" type="button" aria-label="Maker 控制台品牌标记">M</button>Maker 控制台
|
|
56621
56915
|
<select id="maker-version-picker" aria-label="Maker MCP 版本" disabled><option>版本加载中</option></select>
|
|
56622
56916
|
</div>
|
|
56623
56917
|
<div class="toolbar">
|
|
@@ -56626,6 +56920,7 @@ function getConsoleHtml() {
|
|
|
56626
56920
|
<label class="theme">深色<input id="theme" type="checkbox" role="switch" checked aria-label="深色模式"></label>
|
|
56627
56921
|
</div>
|
|
56628
56922
|
</header>
|
|
56923
|
+
<div class="navigation">
|
|
56629
56924
|
<nav aria-label="主导航">
|
|
56630
56925
|
<button data-page="overview">项目</button>
|
|
56631
56926
|
<button data-page="build">构建与测试</button>
|
|
@@ -56634,18 +56929,18 @@ function getConsoleHtml() {
|
|
|
56634
56929
|
<span id="plugin-tabs" class="plugin-tabs"></span>
|
|
56635
56930
|
</nav>
|
|
56636
56931
|
<div class="context"><span id="context">正在连接本地服务</span><span id="connection" role="status">连接中</span></div>
|
|
56932
|
+
</div>
|
|
56637
56933
|
<div id="feedback" class="feedback" role="alert" hidden><p id="feedback-text"></p><button id="dismiss">关闭</button></div>
|
|
56638
56934
|
<main id="view" aria-busy="true"><p class="empty">正在读取本地项目</p></main>
|
|
56639
56935
|
<section id="plugin-views" aria-label="插件工作区" hidden></section>
|
|
56640
56936
|
<div id="announcement" role="status" aria-live="polite" class="context" hidden></div>
|
|
56641
56937
|
<footer><div class="footer-start"><span id="version">Maker 本地服务</span>
|
|
56642
|
-
<section id="fortune-corner" aria-label="开发者日签">
|
|
56938
|
+
<section id="fortune-corner" aria-label="开发者日签" hidden>
|
|
56643
56939
|
<button id="fortune-toggle" type="button" aria-expanded="false" aria-controls="fortune-panel">独立游戏开发日签</button>
|
|
56644
56940
|
</section>
|
|
56645
56941
|
</div><span id="footer-path"></span></footer>
|
|
56646
56942
|
<div id="fortune-panel" hidden>
|
|
56647
|
-
<
|
|
56648
|
-
<iframe id="fortune-frame" title="gDEV日签 · 独立游戏开发者老黄历" sandbox="allow-scripts allow-same-origin" referrerpolicy="no-referrer"></iframe>
|
|
56943
|
+
<iframe id="fortune-frame" title="gDEV日签 · 独立游戏开发者老黄历" sandbox="allow-scripts allow-same-origin" loading="eager" referrerpolicy="no-referrer"></iframe>
|
|
56649
56944
|
</div>
|
|
56650
56945
|
<dialog id="confirm" aria-labelledby="confirm-title" aria-describedby="confirm-message">
|
|
56651
56946
|
<form method="dialog">
|
|
@@ -65396,7 +65691,7 @@ init_config();
|
|
|
65396
65691
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
65397
65692
|
import crypto5 from "node:crypto";
|
|
65398
65693
|
import fs51 from "node:fs";
|
|
65399
|
-
import
|
|
65694
|
+
import os13 from "node:os";
|
|
65400
65695
|
import path53 from "node:path";
|
|
65401
65696
|
import readline from "node:readline/promises";
|
|
65402
65697
|
import { stdin as input, stdout as output } from "node:process";
|
|
@@ -65455,7 +65750,7 @@ async function pollCliLoginResult(code, options3) {
|
|
|
65455
65750
|
let lastPollError;
|
|
65456
65751
|
for (; ; ) {
|
|
65457
65752
|
if (Date.now() >= deadline) {
|
|
65458
|
-
const suffix = lastPollError ? ` Last polling error: ${
|
|
65753
|
+
const suffix = lastPollError ? ` Last polling error: ${formatError4(lastPollError)}` : "";
|
|
65459
65754
|
throw new Error(
|
|
65460
65755
|
`Maker CLI login timed out. Run \`taptap-maker login\` and try again.${suffix}`
|
|
65461
65756
|
);
|
|
@@ -65541,7 +65836,7 @@ function delay(ms) {
|
|
|
65541
65836
|
setTimeout(resolve, ms);
|
|
65542
65837
|
});
|
|
65543
65838
|
}
|
|
65544
|
-
function
|
|
65839
|
+
function formatError4(error2) {
|
|
65545
65840
|
return error2 instanceof Error ? error2.message : String(error2);
|
|
65546
65841
|
}
|
|
65547
65842
|
|
|
@@ -65557,21 +65852,22 @@ init_runtimeLogs();
|
|
|
65557
65852
|
|
|
65558
65853
|
// src/maker/cli/preview.ts
|
|
65559
65854
|
init_protocol2();
|
|
65560
|
-
import
|
|
65561
|
-
import
|
|
65855
|
+
import fs35 from "node:fs";
|
|
65856
|
+
import path36 from "node:path";
|
|
65562
65857
|
import { randomBytes as randomBytes3, randomUUID as randomUUID6 } from "node:crypto";
|
|
65563
65858
|
|
|
65564
65859
|
// src/maker/preview/installation.ts
|
|
65565
65860
|
init_python();
|
|
65566
65861
|
init_protocol2();
|
|
65567
|
-
import
|
|
65568
|
-
import
|
|
65862
|
+
import fs32 from "node:fs";
|
|
65863
|
+
import path33 from "node:path";
|
|
65569
65864
|
import { createHash as createHash5, randomUUID as randomUUID5 } from "node:crypto";
|
|
65570
65865
|
|
|
65571
65866
|
// src/maker/preview/runtime.ts
|
|
65572
65867
|
init_protocol2();
|
|
65573
|
-
import
|
|
65574
|
-
import
|
|
65868
|
+
import fs30 from "node:fs";
|
|
65869
|
+
import path31 from "node:path";
|
|
65870
|
+
import os5 from "node:os";
|
|
65575
65871
|
import { spawn as spawn6 } from "node:child_process";
|
|
65576
65872
|
import { StringDecoder } from "node:string_decoder";
|
|
65577
65873
|
|
|
@@ -65766,6 +66062,22 @@ function inside(root2, relative) {
|
|
|
65766
66062
|
throw new Error("Prepared manifest path escapes its output directory.");
|
|
65767
66063
|
return filename2;
|
|
65768
66064
|
}
|
|
66065
|
+
function copyTree(source, target, signal) {
|
|
66066
|
+
if (signal == null ? void 0 : signal.aborted) throw new Error("CANCELLED");
|
|
66067
|
+
const stat = fs26.lstatSync(source);
|
|
66068
|
+
if (stat.isSymbolicLink())
|
|
66069
|
+
throw new Error(`Local prepare does not support symbolic links: ${source}`);
|
|
66070
|
+
if (stat.isDirectory()) {
|
|
66071
|
+
fs26.mkdirSync(target, { recursive: true, mode: 448 });
|
|
66072
|
+
for (const name of fs26.readdirSync(source)) {
|
|
66073
|
+
copyTree(path27.join(source, name), path27.join(target, name), signal);
|
|
66074
|
+
}
|
|
66075
|
+
return;
|
|
66076
|
+
}
|
|
66077
|
+
if (!stat.isFile()) throw new Error(`Local prepare does not support special files: ${source}`);
|
|
66078
|
+
fs26.mkdirSync(path27.dirname(target), { recursive: true, mode: 448 });
|
|
66079
|
+
fs26.copyFileSync(source, target);
|
|
66080
|
+
}
|
|
65769
66081
|
function validateProjectVersion(source) {
|
|
65770
66082
|
const filename2 = path27.join(source, ".project", "project.json");
|
|
65771
66083
|
if (!fs26.existsSync(filename2))
|
|
@@ -65848,8 +66160,7 @@ async function prepareProjectCopy(project, directory, signal) {
|
|
|
65848
66160
|
fs26.mkdirSync(source, { recursive: true, mode: 448 });
|
|
65849
66161
|
for (const name of ["scripts", "assets", ".project"]) {
|
|
65850
66162
|
const original = path27.join(project, name);
|
|
65851
|
-
if (fs26.existsSync(original))
|
|
65852
|
-
fs26.cpSync(original, path27.join(source, name), { recursive: true, dereference: true });
|
|
66163
|
+
if (fs26.existsSync(original)) copyTree(original, path27.join(source, name), signal);
|
|
65853
66164
|
}
|
|
65854
66165
|
const configDirectory = path27.join(source, ".project");
|
|
65855
66166
|
fs26.mkdirSync(configDirectory, { recursive: true });
|
|
@@ -65892,7 +66203,7 @@ async function prepareProjectCopy(project, directory, signal) {
|
|
|
65892
66203
|
const args = [builder, "--project", source, "--force-enhanced-refs", "--no-7z", "--no-compress"];
|
|
65893
66204
|
const cache = path27.join(previewDirectory(project), "public-index-cache");
|
|
65894
66205
|
const roundCache = path27.join(source, ".build", "manifest_cache");
|
|
65895
|
-
if (fs26.existsSync(cache))
|
|
66206
|
+
if (fs26.existsSync(cache)) copyTree(cache, roundCache, signal);
|
|
65896
66207
|
const log = path27.join(directory, "prepare.log");
|
|
65897
66208
|
try {
|
|
65898
66209
|
const output2 = await promisify(execFile)(python.python, args, {
|
|
@@ -65910,7 +66221,7 @@ async function prepareProjectCopy(project, directory, signal) {
|
|
|
65910
66221
|
throw new Error("Public source index download failed.");
|
|
65911
66222
|
if (output2.stdout.includes("[ERROR]")) throw new Error("ProjectBuilder reported an error.");
|
|
65912
66223
|
const result = validatePreparedPreview(source);
|
|
65913
|
-
if (fs26.existsSync(roundCache))
|
|
66224
|
+
if (fs26.existsSync(roundCache)) copyTree(roundCache, cache, signal);
|
|
65914
66225
|
return {
|
|
65915
66226
|
ok: true,
|
|
65916
66227
|
source_directory: source,
|
|
@@ -65937,6 +66248,9 @@ function previewPreparationDirectory(project) {
|
|
|
65937
66248
|
return path27.join(previewDirectory(project), "preparations", randomUUID4());
|
|
65938
66249
|
}
|
|
65939
66250
|
|
|
66251
|
+
// src/maker/preview/runtime.ts
|
|
66252
|
+
init_configuration();
|
|
66253
|
+
|
|
65940
66254
|
// src/maker/preview/assets.ts
|
|
65941
66255
|
import fs27 from "node:fs";
|
|
65942
66256
|
import path28 from "node:path";
|
|
@@ -66208,17 +66522,27 @@ var previewWire = {
|
|
|
66208
66522
|
};
|
|
66209
66523
|
|
|
66210
66524
|
// src/maker/preview/network.ts
|
|
66211
|
-
function
|
|
66525
|
+
function previewNetworkConfigured(source) {
|
|
66212
66526
|
var _a3;
|
|
66213
66527
|
const settings = readPreviewConfiguration(source, "settings");
|
|
66214
66528
|
const runtime = settings == null ? void 0 : settings["@runtime"];
|
|
66215
66529
|
const multiplayer = runtime == null ? void 0 : runtime.multiplayer;
|
|
66216
|
-
|
|
66217
|
-
|
|
66530
|
+
return Boolean(
|
|
66531
|
+
multiplayer ? multiplayer.enabled !== void 0 ? multiplayer.enabled : multiplayer.max_players !== void 0 ? multiplayer.max_players > 0 : Boolean((_a3 = multiplayer.persistent_world) == null ? void 0 : _a3.enabled) : (runtime == null ? void 0 : runtime.max_players) > 0
|
|
66532
|
+
);
|
|
66533
|
+
}
|
|
66534
|
+
function previewNetworkProject(source) {
|
|
66535
|
+
var _a3;
|
|
66536
|
+
if (!previewNetworkConfigured(source)) return void 0;
|
|
66218
66537
|
const project = readPreviewConfiguration(source, "project");
|
|
66219
66538
|
const latestPath = path30.join(source, "dist", "latest.json");
|
|
66220
66539
|
const latest = fs29.existsSync(latestPath) ? JSON.parse(fs29.readFileSync(latestPath, "utf8")) : void 0;
|
|
66221
|
-
if (typeof (project == null ? void 0 : project.project_id) !== "string" || !project.project_id.trim() || ((_a3 = project.author) == null ? void 0 : _a3.id) === "local-preview"
|
|
66540
|
+
if (typeof (project == null ? void 0 : project.project_id) !== "string" || !project.project_id.trim() || ((_a3 = project.author) == null ? void 0 : _a3.id) === "local-preview")
|
|
66541
|
+
throw new Error("联网预览缺少游戏配置,请先提交构建并生成一次测试二维码,再启动本地预览。");
|
|
66542
|
+
if (!latest) {
|
|
66543
|
+
throw new Error("联网预览缺少本地构建产物,请先完成本地准备并生成 latest.json。");
|
|
66544
|
+
}
|
|
66545
|
+
if (typeof latest.version !== "string" || !/^[a-z0-9][a-z0-9._+-]{0,127}$/i.test(latest.version))
|
|
66222
66546
|
throw new Error("联网预览缺少游戏配置,请先提交构建并生成一次测试二维码,再启动本地预览。");
|
|
66223
66547
|
return { projectId: project.project_id, version: latest.version };
|
|
66224
66548
|
}
|
|
@@ -66230,9 +66554,13 @@ function previewNetworkArgs(server) {
|
|
|
66230
66554
|
"-directConnectParams=" + Buffer.from(JSON.stringify(server)).toString("base64")
|
|
66231
66555
|
];
|
|
66232
66556
|
}
|
|
66233
|
-
async function preparePreviewServer(source, projectPath, signal) {
|
|
66557
|
+
async function preparePreviewServer(source, projectPath, signal, networkRequired = false) {
|
|
66234
66558
|
const project = previewNetworkProject(source);
|
|
66235
|
-
if (!project)
|
|
66559
|
+
if (!project) {
|
|
66560
|
+
if (networkRequired)
|
|
66561
|
+
throw new Error("项目已识别为联机/server 项目,但准备副本未保留有效联机配置。");
|
|
66562
|
+
return void 0;
|
|
66563
|
+
}
|
|
66236
66564
|
if (signal == null ? void 0 : signal.aborted) throw new Error("CANCELLED");
|
|
66237
66565
|
if (getMakerEnvironment(void 0, projectPath) !== "production")
|
|
66238
66566
|
throw new Error("当前环境暂不支持联网本地预览;请使用网页预览。");
|
|
@@ -66353,45 +66681,14 @@ function requestPreviewServer(project, auth2, signal, options3 = {}) {
|
|
|
66353
66681
|
});
|
|
66354
66682
|
}
|
|
66355
66683
|
|
|
66356
|
-
// src/maker/preview/sourceAlias.ts
|
|
66357
|
-
import fs30 from "node:fs";
|
|
66358
|
-
import os5 from "node:os";
|
|
66359
|
-
import path31 from "node:path";
|
|
66360
|
-
function createPreviewSourceAlias(source, platform = process.platform, temporaryDirectory = os5.tmpdir()) {
|
|
66361
|
-
if (platform !== "win32") return { source, close: () => {
|
|
66362
|
-
} };
|
|
66363
|
-
const target = fs30.realpathSync(source);
|
|
66364
|
-
const directory = fs30.mkdtempSync(path31.join(temporaryDirectory, "maker-preview-"));
|
|
66365
|
-
const alias = path31.join(directory, "source");
|
|
66366
|
-
try {
|
|
66367
|
-
if (alias.length > 180)
|
|
66368
|
-
throw new Error("Windows preview needs a shorter TEMP directory (Runtime path limit).");
|
|
66369
|
-
fs30.symlinkSync(target, alias, "junction");
|
|
66370
|
-
} catch (error2) {
|
|
66371
|
-
fs30.rmdirSync(directory);
|
|
66372
|
-
throw error2;
|
|
66373
|
-
}
|
|
66374
|
-
let closed = false;
|
|
66375
|
-
return {
|
|
66376
|
-
source: alias,
|
|
66377
|
-
close: () => {
|
|
66378
|
-
if (closed) return;
|
|
66379
|
-
if (!fs30.lstatSync(alias).isSymbolicLink() || fs30.realpathSync(alias) !== target)
|
|
66380
|
-
throw new Error("Preview source alias changed; refusing cleanup.");
|
|
66381
|
-
fs30.unlinkSync(alias);
|
|
66382
|
-
fs30.rmdirSync(directory);
|
|
66383
|
-
closed = true;
|
|
66384
|
-
}
|
|
66385
|
-
};
|
|
66386
|
-
}
|
|
66387
|
-
|
|
66388
66684
|
// src/maker/preview/runtime.ts
|
|
66389
66685
|
var PREVIEW_TIMEOUT_MS = 3e4;
|
|
66686
|
+
var RUNTIME_STARTUP_SETTLE_MS = 3e3;
|
|
66390
66687
|
async function probeRuntime(executable, signal) {
|
|
66391
66688
|
if (signal == null ? void 0 : signal.aborted) throw new Error("CANCELLED");
|
|
66392
|
-
if (!
|
|
66689
|
+
if (!path31.isAbsolute(executable) || !fs30.statSync(executable).isFile())
|
|
66393
66690
|
throw new Error("Runtime must be an absolute executable file.");
|
|
66394
|
-
|
|
66691
|
+
fs30.accessSync(executable, process.platform === "win32" ? fs30.constants.R_OK : fs30.constants.X_OK);
|
|
66395
66692
|
return {
|
|
66396
66693
|
protocol_version: 0,
|
|
66397
66694
|
runtime_version: "unknown",
|
|
@@ -66406,7 +66703,7 @@ async function preflightPreview(_executable, project, signal) {
|
|
|
66406
66703
|
entry: projectEntry(project),
|
|
66407
66704
|
window: previewWindow(project),
|
|
66408
66705
|
source_mode: false,
|
|
66409
|
-
|
|
66706
|
+
...classifyPreviewProject(project),
|
|
66410
66707
|
dependencies_verified: false,
|
|
66411
66708
|
warning: "Local client preview only. Cloud/server features and resource completeness are not verified."
|
|
66412
66709
|
};
|
|
@@ -66423,6 +66720,7 @@ var PreviewRuntime = class {
|
|
|
66423
66720
|
this.stopping = false;
|
|
66424
66721
|
this.abort = new AbortController();
|
|
66425
66722
|
this.closed = Promise.resolve();
|
|
66723
|
+
this.mode = "local_manifest";
|
|
66426
66724
|
this.errors = [];
|
|
66427
66725
|
this.artifacts = [];
|
|
66428
66726
|
this.logs = new PreviewLogs(directory);
|
|
@@ -66441,55 +66739,62 @@ var PreviewRuntime = class {
|
|
|
66441
66739
|
return false;
|
|
66442
66740
|
}
|
|
66443
66741
|
get launchMode() {
|
|
66444
|
-
return
|
|
66742
|
+
return this.mode;
|
|
66445
66743
|
}
|
|
66446
|
-
async start(entry,
|
|
66744
|
+
async start(entry, _storage, window2 = previewWindow(this.identity.project_realpath)) {
|
|
66447
66745
|
var _a3, _b;
|
|
66448
66746
|
requireManifestPreviewPlatform();
|
|
66449
|
-
|
|
66450
|
-
|
|
66451
|
-
|
|
66452
|
-
|
|
66453
|
-
|
|
66747
|
+
const project = this.identity.project_realpath;
|
|
66748
|
+
const classification = classifyPreviewProject(project);
|
|
66749
|
+
const requiresPreparation = classification.preparation_required;
|
|
66750
|
+
if (requiresPreparation)
|
|
66751
|
+
this.preparation = await preparePreviewProject(project, this.directory, this.abort.signal);
|
|
66454
66752
|
if (this.stopping) throw new Error("CANCELLED");
|
|
66455
|
-
const source = String(this.preparation.source_directory);
|
|
66456
|
-
entry = String(this.preparation.entry);
|
|
66753
|
+
const source = requiresPreparation ? String(this.preparation.source_directory) : project;
|
|
66754
|
+
if (requiresPreparation) entry = String(this.preparation.entry);
|
|
66457
66755
|
const server = await preparePreviewServer(
|
|
66458
66756
|
source,
|
|
66459
|
-
|
|
66460
|
-
this.abort.signal
|
|
66757
|
+
project,
|
|
66758
|
+
this.abort.signal,
|
|
66759
|
+
classification.network_required
|
|
66461
66760
|
);
|
|
66462
|
-
if (server)
|
|
66761
|
+
if (server) {
|
|
66762
|
+
this.logs.append("已获取线上测试服连接信息,本地客户端将通过 WebSocket 直连。");
|
|
66763
|
+
}
|
|
66463
66764
|
if (this.stopping) throw new Error("CANCELLED");
|
|
66464
66765
|
let cacheRoot;
|
|
66465
|
-
if (
|
|
66766
|
+
if (requiresPreparation) {
|
|
66466
66767
|
this.assets = await startPreviewAssetServer(source, this.abort.signal);
|
|
66467
|
-
|
|
66768
|
+
this.mode = "loopback_manifest";
|
|
66468
66769
|
try {
|
|
66469
|
-
|
|
66470
|
-
|
|
66471
|
-
|
|
66770
|
+
cacheRoot = process.platform === "win32" ? this.temporaryCache = fs30.realpathSync(
|
|
66771
|
+
fs30.mkdtempSync(path31.join(os5.tmpdir(), "maker-cache-"))
|
|
66772
|
+
) : path31.join(_storage, "runtime-cache");
|
|
66773
|
+
fs30.mkdirSync(cacheRoot, { recursive: true, mode: 448 });
|
|
66774
|
+
this.assetCache = path31.join(
|
|
66775
|
+
fs30.realpathSync(cacheRoot),
|
|
66472
66776
|
this.assets.url.slice("http://".length).replace(":", "_")
|
|
66473
66777
|
);
|
|
66474
66778
|
} catch (error2) {
|
|
66475
66779
|
await this.assets.close();
|
|
66780
|
+
this.assets = void 0;
|
|
66781
|
+
this.clearAssetCache();
|
|
66476
66782
|
throw error2;
|
|
66477
66783
|
}
|
|
66478
66784
|
}
|
|
66479
66785
|
if (this.stopping) {
|
|
66480
66786
|
await ((_a3 = this.assets) == null ? void 0 : _a3.close());
|
|
66787
|
+
this.clearAssetCache();
|
|
66481
66788
|
throw new Error("CANCELLED");
|
|
66482
66789
|
}
|
|
66483
66790
|
let child;
|
|
66484
66791
|
try {
|
|
66485
|
-
this.sourceAlias = createPreviewSourceAlias(source);
|
|
66486
|
-
const runtimeSource = this.sourceAlias.source;
|
|
66487
66792
|
this.launching();
|
|
66793
|
+
const runtimeArgs = this.assets ? ["-game_url=" + this.assets.url, "-game_path=" + cacheRoot] : [entry, "-tapcode_dir=" + source];
|
|
66488
66794
|
child = spawn6(
|
|
66489
66795
|
this.executable,
|
|
66490
66796
|
[
|
|
66491
|
-
...
|
|
66492
|
-
...cacheRoot ? ["-game_path=" + cacheRoot] : [],
|
|
66797
|
+
...runtimeArgs,
|
|
66493
66798
|
"-skip_login",
|
|
66494
66799
|
...server ? previewNetworkArgs(server) : [],
|
|
66495
66800
|
"-p=Res",
|
|
@@ -66497,11 +66802,11 @@ var PreviewRuntime = class {
|
|
|
66497
66802
|
"-width=" + window2.width,
|
|
66498
66803
|
"-height=" + window2.height
|
|
66499
66804
|
],
|
|
66500
|
-
{ cwd:
|
|
66805
|
+
{ cwd: source, stdio: ["pipe", "pipe", "pipe"], windowsHide: false }
|
|
66501
66806
|
);
|
|
66502
66807
|
} catch (error2) {
|
|
66503
66808
|
await ((_b = this.assets) == null ? void 0 : _b.close());
|
|
66504
|
-
this.
|
|
66809
|
+
this.clearAssetCache();
|
|
66505
66810
|
throw error2;
|
|
66506
66811
|
}
|
|
66507
66812
|
this.child = child;
|
|
@@ -66511,11 +66816,10 @@ var PreviewRuntime = class {
|
|
|
66511
66816
|
var _a4;
|
|
66512
66817
|
try {
|
|
66513
66818
|
await ((_a4 = this.assets) == null ? void 0 : _a4.close());
|
|
66819
|
+
this.clearAssetCache();
|
|
66514
66820
|
} catch (error2) {
|
|
66515
66821
|
this.recordError(String(error2));
|
|
66516
66822
|
}
|
|
66517
|
-
this.clearAssetCache();
|
|
66518
|
-
this.clearSourceAlias();
|
|
66519
66823
|
try {
|
|
66520
66824
|
this.changed(this.stopping || child.exitCode === 0 ? "stopped" : "failed");
|
|
66521
66825
|
} catch (error2) {
|
|
@@ -66570,7 +66874,7 @@ var PreviewRuntime = class {
|
|
|
66570
66874
|
failed(error2);
|
|
66571
66875
|
}
|
|
66572
66876
|
}
|
|
66573
|
-
},
|
|
66877
|
+
}, RUNTIME_STARTUP_SETTLE_MS);
|
|
66574
66878
|
});
|
|
66575
66879
|
});
|
|
66576
66880
|
} catch (error2) {
|
|
@@ -66587,26 +66891,31 @@ var PreviewRuntime = class {
|
|
|
66587
66891
|
if (this.errors.length > 100) this.errors.shift();
|
|
66588
66892
|
}
|
|
66589
66893
|
clearAssetCache() {
|
|
66894
|
+
if (this.temporaryCache) {
|
|
66895
|
+
try {
|
|
66896
|
+
if (fs30.existsSync(this.temporaryCache)) {
|
|
66897
|
+
if (fs30.lstatSync(this.temporaryCache).isSymbolicLink() || fs30.realpathSync(this.temporaryCache) !== this.temporaryCache)
|
|
66898
|
+
throw new Error("Preview cache ownership changed.");
|
|
66899
|
+
fs30.rmSync(this.temporaryCache, { recursive: true, force: true });
|
|
66900
|
+
}
|
|
66901
|
+
this.temporaryCache = void 0;
|
|
66902
|
+
this.assetCache = void 0;
|
|
66903
|
+
} catch {
|
|
66904
|
+
this.recordError("Could not remove this round of local preview download cache.");
|
|
66905
|
+
}
|
|
66906
|
+
return;
|
|
66907
|
+
}
|
|
66590
66908
|
if (!this.assetCache) return;
|
|
66591
66909
|
try {
|
|
66592
|
-
const parent =
|
|
66593
|
-
if (
|
|
66594
|
-
|
|
66595
|
-
if (!
|
|
66910
|
+
const parent = path31.dirname(this.assetCache);
|
|
66911
|
+
if (fs30.existsSync(parent) && fs30.realpathSync(parent) === parent) {
|
|
66912
|
+
fs30.rmSync(this.assetCache, { recursive: true, force: true });
|
|
66913
|
+
if (!fs30.readdirSync(parent).length) fs30.rmdirSync(parent);
|
|
66596
66914
|
}
|
|
66597
66915
|
} catch {
|
|
66598
66916
|
this.recordError("Could not remove this round of local preview download cache.");
|
|
66599
66917
|
}
|
|
66600
66918
|
}
|
|
66601
|
-
clearSourceAlias() {
|
|
66602
|
-
var _a3;
|
|
66603
|
-
try {
|
|
66604
|
-
(_a3 = this.sourceAlias) == null ? void 0 : _a3.close();
|
|
66605
|
-
this.sourceAlias = void 0;
|
|
66606
|
-
} catch (error2) {
|
|
66607
|
-
this.recordError(String(error2));
|
|
66608
|
-
}
|
|
66609
|
-
}
|
|
66610
66919
|
consume(stream) {
|
|
66611
66920
|
const decoder = new StringDecoder("utf8");
|
|
66612
66921
|
let buffer = "";
|
|
@@ -66641,11 +66950,12 @@ var PreviewRuntime = class {
|
|
|
66641
66950
|
};
|
|
66642
66951
|
}
|
|
66643
66952
|
async stop() {
|
|
66644
|
-
var _a3
|
|
66953
|
+
var _a3;
|
|
66645
66954
|
this.stopping = true;
|
|
66646
66955
|
this.abort.abort();
|
|
66647
66956
|
if (!this.processAlive) {
|
|
66648
66957
|
await ((_a3 = this.assets) == null ? void 0 : _a3.close());
|
|
66958
|
+
this.clearAssetCache();
|
|
66649
66959
|
return;
|
|
66650
66960
|
}
|
|
66651
66961
|
const child = this.child;
|
|
@@ -66667,14 +66977,13 @@ var PreviewRuntime = class {
|
|
|
66667
66977
|
} finally {
|
|
66668
66978
|
clearTimeout(force);
|
|
66669
66979
|
clearTimeout(deadline);
|
|
66670
|
-
await ((_b = this.assets) == null ? void 0 : _b.close());
|
|
66671
66980
|
}
|
|
66672
66981
|
}
|
|
66673
66982
|
};
|
|
66674
66983
|
|
|
66675
66984
|
// src/maker/preview/runtimeResources.ts
|
|
66676
|
-
import
|
|
66677
|
-
import
|
|
66985
|
+
import fs31 from "node:fs";
|
|
66986
|
+
import path32 from "node:path";
|
|
66678
66987
|
var FALLBACK_FONT = "MiSans-Regular.ttf";
|
|
66679
66988
|
function defaultFontCandidates(platform) {
|
|
66680
66989
|
if (platform === "darwin") {
|
|
@@ -66686,44 +66995,44 @@ function defaultFontCandidates(platform) {
|
|
|
66686
66995
|
if (platform === "win32") {
|
|
66687
66996
|
const windows = process.env.WINDIR || process.env.SystemRoot || "C:\\Windows";
|
|
66688
66997
|
return [
|
|
66689
|
-
|
|
66690
|
-
|
|
66691
|
-
|
|
66998
|
+
path32.join(windows, "Fonts", "Deng.ttf"),
|
|
66999
|
+
path32.join(windows, "Fonts", "Dengb.ttf"),
|
|
67000
|
+
path32.join(windows, "Fonts", "msyh.ttc")
|
|
66692
67001
|
];
|
|
66693
67002
|
}
|
|
66694
67003
|
return [];
|
|
66695
67004
|
}
|
|
66696
67005
|
function existingFile(filename2) {
|
|
66697
67006
|
try {
|
|
66698
|
-
return
|
|
67007
|
+
return fs31.statSync(filename2).isFile();
|
|
66699
67008
|
} catch {
|
|
66700
67009
|
return false;
|
|
66701
67010
|
}
|
|
66702
67011
|
}
|
|
66703
67012
|
function ensurePreviewRuntimeResources(executable, options3 = {}) {
|
|
66704
|
-
const runtimeRoot =
|
|
66705
|
-
const fonts =
|
|
66706
|
-
const legacyFonts =
|
|
67013
|
+
const runtimeRoot = path32.dirname(fs31.realpathSync(executable));
|
|
67014
|
+
const fonts = path32.join(runtimeRoot, "Res", "Fonts");
|
|
67015
|
+
const legacyFonts = path32.join(runtimeRoot, "Data", "Fonts");
|
|
66707
67016
|
for (const directory of [
|
|
66708
|
-
|
|
67017
|
+
path32.join(runtimeRoot, "Data", "LuaScripts"),
|
|
66709
67018
|
legacyFonts,
|
|
66710
67019
|
fonts,
|
|
66711
|
-
|
|
67020
|
+
path32.join(runtimeRoot, "CoreData")
|
|
66712
67021
|
]) {
|
|
66713
|
-
|
|
67022
|
+
fs31.mkdirSync(directory, { recursive: true });
|
|
66714
67023
|
}
|
|
66715
|
-
const target =
|
|
66716
|
-
if (
|
|
67024
|
+
const target = path32.join(fonts, FALLBACK_FONT);
|
|
67025
|
+
if (fs31.existsSync(target)) return { fallbackFont: "existing", warnings: [] };
|
|
66717
67026
|
const platform = options3.platform || process.platform;
|
|
66718
67027
|
const candidates = [
|
|
66719
|
-
|
|
67028
|
+
path32.join(legacyFonts, FALLBACK_FONT),
|
|
66720
67029
|
...options3.fontCandidates || defaultFontCandidates(platform)
|
|
66721
67030
|
];
|
|
66722
67031
|
const copyErrors = [];
|
|
66723
67032
|
for (const candidate of candidates) {
|
|
66724
67033
|
if (!existingFile(candidate)) continue;
|
|
66725
67034
|
try {
|
|
66726
|
-
|
|
67035
|
+
fs31.copyFileSync(candidate, target, fs31.constants.COPYFILE_EXCL);
|
|
66727
67036
|
return { fallbackFont: "copied", fallbackFontSource: candidate, warnings: [] };
|
|
66728
67037
|
} catch (error2) {
|
|
66729
67038
|
if (error2.code === "EEXIST") {
|
|
@@ -66957,10 +67266,10 @@ function processPresence(pid) {
|
|
|
66957
67266
|
|
|
66958
67267
|
// src/maker/preview/installation.ts
|
|
66959
67268
|
function readInstallation(filename2) {
|
|
66960
|
-
if (!
|
|
67269
|
+
if (!fs32.existsSync(filename2)) return void 0;
|
|
66961
67270
|
try {
|
|
66962
|
-
const value = JSON.parse(
|
|
66963
|
-
if (value.install_state !== "ready" || !value.executable || !
|
|
67271
|
+
const value = JSON.parse(fs32.readFileSync(filename2, "utf8"));
|
|
67272
|
+
if (value.install_state !== "ready" || !value.executable || !path33.isAbsolute(value.executable) || !fs32.statSync(value.executable).isFile()) {
|
|
66964
67273
|
return void 0;
|
|
66965
67274
|
}
|
|
66966
67275
|
return value;
|
|
@@ -66969,27 +67278,27 @@ function readInstallation(filename2) {
|
|
|
66969
67278
|
}
|
|
66970
67279
|
}
|
|
66971
67280
|
function isInside(directory, filename2) {
|
|
66972
|
-
const relative =
|
|
66973
|
-
return relative !== "" && !relative.startsWith(".." +
|
|
67281
|
+
const relative = path33.relative(directory, filename2);
|
|
67282
|
+
return relative !== "" && !relative.startsWith(".." + path33.sep) && !path33.isAbsolute(relative);
|
|
66974
67283
|
}
|
|
66975
67284
|
function legacyPreviewInstallation(project) {
|
|
66976
67285
|
var _a3;
|
|
66977
|
-
const root2 =
|
|
66978
|
-
if (!
|
|
66979
|
-
const entries =
|
|
67286
|
+
const root2 = path33.dirname(previewDirectory(project));
|
|
67287
|
+
if (!fs32.existsSync(root2)) return void 0;
|
|
67288
|
+
const entries = fs32.readdirSync(root2, { withFileTypes: true }).filter((entry) => entry.isDirectory() && /^[a-f0-9]{64}$/.test(entry.name));
|
|
66980
67289
|
const candidates = [];
|
|
66981
67290
|
for (const entry of entries) {
|
|
66982
|
-
const directory =
|
|
66983
|
-
const filename2 =
|
|
67291
|
+
const directory = path33.join(root2, entry.name);
|
|
67292
|
+
const filename2 = path33.join(directory, "installation.json");
|
|
66984
67293
|
const installation = readInstallation(filename2);
|
|
66985
67294
|
if (!(installation == null ? void 0 : installation.executable)) continue;
|
|
66986
67295
|
try {
|
|
66987
|
-
const executable =
|
|
66988
|
-
const managedDirectory =
|
|
67296
|
+
const executable = fs32.realpathSync(installation.executable);
|
|
67297
|
+
const managedDirectory = fs32.realpathSync(directory);
|
|
66989
67298
|
if (!isInside(managedDirectory, executable)) continue;
|
|
66990
67299
|
candidates.push({
|
|
66991
67300
|
installation: { ...installation, executable },
|
|
66992
|
-
modified: Date.parse(installation.installed_at || "") ||
|
|
67301
|
+
modified: Date.parse(installation.installed_at || "") || fs32.statSync(filename2).mtimeMs
|
|
66993
67302
|
});
|
|
66994
67303
|
} catch {
|
|
66995
67304
|
}
|
|
@@ -66998,7 +67307,7 @@ function legacyPreviewInstallation(project) {
|
|
|
66998
67307
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.installation;
|
|
66999
67308
|
}
|
|
67000
67309
|
function previewInstallation(project) {
|
|
67001
|
-
const filename2 =
|
|
67310
|
+
const filename2 = path33.join(runtimeDirectory(), "installation.json");
|
|
67002
67311
|
const current = readInstallation(filename2);
|
|
67003
67312
|
if (current) return current;
|
|
67004
67313
|
const legacy = legacyPreviewInstallation(project);
|
|
@@ -67017,31 +67326,31 @@ function previewInstallation(project) {
|
|
|
67017
67326
|
}
|
|
67018
67327
|
}
|
|
67019
67328
|
async function withFileLock(directory, name, busyMessage, action) {
|
|
67020
|
-
|
|
67021
|
-
const filename2 =
|
|
67329
|
+
fs32.mkdirSync(directory, { recursive: true, mode: 448 });
|
|
67330
|
+
const filename2 = path33.join(directory, name);
|
|
67022
67331
|
let descriptor;
|
|
67023
67332
|
try {
|
|
67024
|
-
descriptor =
|
|
67333
|
+
descriptor = fs32.openSync(filename2, "wx", 384);
|
|
67025
67334
|
} catch {
|
|
67026
67335
|
throw new Error(
|
|
67027
67336
|
busyMessage + " If an interrupted command left a lock, verify it exited before removing " + filename2
|
|
67028
67337
|
);
|
|
67029
67338
|
}
|
|
67030
67339
|
try {
|
|
67031
|
-
|
|
67340
|
+
fs32.writeFileSync(
|
|
67032
67341
|
descriptor,
|
|
67033
67342
|
JSON.stringify({ pid: process.pid, created_at: (/* @__PURE__ */ new Date()).toISOString() })
|
|
67034
67343
|
);
|
|
67035
67344
|
return await action();
|
|
67036
67345
|
} finally {
|
|
67037
|
-
|
|
67038
|
-
|
|
67346
|
+
fs32.closeSync(descriptor);
|
|
67347
|
+
fs32.unlinkSync(filename2);
|
|
67039
67348
|
}
|
|
67040
67349
|
}
|
|
67041
67350
|
async function withPreviewLock(project, action) {
|
|
67042
67351
|
const directory = previewDirectory(project);
|
|
67043
|
-
|
|
67044
|
-
const filename2 =
|
|
67352
|
+
fs32.mkdirSync(directory, { recursive: true, mode: 448 });
|
|
67353
|
+
const filename2 = path33.join(fs32.realpathSync(directory), "operation.lock");
|
|
67045
67354
|
const busy = () => new Error("Another preview operation is in progress. Please retry after it finishes.");
|
|
67046
67355
|
const release = await claimRecoveryMutex(filename2, busy);
|
|
67047
67356
|
const identity = JSON.stringify({
|
|
@@ -67051,8 +67360,8 @@ async function withPreviewLock(project, action) {
|
|
|
67051
67360
|
});
|
|
67052
67361
|
let owned = false;
|
|
67053
67362
|
try {
|
|
67054
|
-
if (
|
|
67055
|
-
const previous =
|
|
67363
|
+
if (fs32.existsSync(filename2)) {
|
|
67364
|
+
const previous = fs32.readFileSync(filename2, "utf8");
|
|
67056
67365
|
let pid;
|
|
67057
67366
|
try {
|
|
67058
67367
|
pid = JSON.parse(previous).pid;
|
|
@@ -67062,9 +67371,9 @@ async function withPreviewLock(project, action) {
|
|
|
67062
67371
|
throw new Error(
|
|
67063
67372
|
"Preview operation ownership is still active or unverified. Confirm the previous command has exited before removing only: " + filename2
|
|
67064
67373
|
);
|
|
67065
|
-
|
|
67374
|
+
fs32.unlinkSync(filename2);
|
|
67066
67375
|
}
|
|
67067
|
-
|
|
67376
|
+
fs32.writeFileSync(filename2, identity, { flag: "wx", mode: 384 });
|
|
67068
67377
|
owned = true;
|
|
67069
67378
|
return await action();
|
|
67070
67379
|
} finally {
|
|
@@ -67077,7 +67386,7 @@ async function withPreviewLock(project, action) {
|
|
|
67077
67386
|
}
|
|
67078
67387
|
function removeOwnedPreviewLock(filename2, identity) {
|
|
67079
67388
|
try {
|
|
67080
|
-
if (
|
|
67389
|
+
if (fs32.readFileSync(filename2, "utf8") === identity) fs32.unlinkSync(filename2);
|
|
67081
67390
|
} catch (error2) {
|
|
67082
67391
|
if (error2.code !== "ENOENT") throw error2;
|
|
67083
67392
|
}
|
|
@@ -67091,17 +67400,17 @@ async function withRuntimeInstallLock(action) {
|
|
|
67091
67400
|
);
|
|
67092
67401
|
}
|
|
67093
67402
|
function activePreviewRuntimeDirectories(project) {
|
|
67094
|
-
const root2 =
|
|
67095
|
-
if (!
|
|
67403
|
+
const root2 = path33.dirname(previewDirectory(project));
|
|
67404
|
+
if (!fs32.existsSync(root2)) return [];
|
|
67096
67405
|
const protectedDirectories = [];
|
|
67097
|
-
for (const entry of
|
|
67406
|
+
for (const entry of fs32.readdirSync(root2, { withFileTypes: true })) {
|
|
67098
67407
|
if (!entry.isDirectory() || !/^[a-f0-9]{64}$/.test(entry.name)) continue;
|
|
67099
|
-
const filename2 =
|
|
67100
|
-
if (!
|
|
67408
|
+
const filename2 = path33.join(root2, entry.name, "session.json");
|
|
67409
|
+
if (!fs32.existsSync(filename2)) continue;
|
|
67101
67410
|
try {
|
|
67102
|
-
const record2 = JSON.parse(
|
|
67103
|
-
if (record2.state !== "stopped" && record2.executable &&
|
|
67104
|
-
protectedDirectories.push(
|
|
67411
|
+
const record2 = JSON.parse(fs32.readFileSync(filename2, "utf8"));
|
|
67412
|
+
if (record2.state !== "stopped" && record2.executable && path33.isAbsolute(record2.executable)) {
|
|
67413
|
+
protectedDirectories.push(path33.dirname(record2.executable));
|
|
67105
67414
|
}
|
|
67106
67415
|
} catch {
|
|
67107
67416
|
}
|
|
@@ -67127,12 +67436,12 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
67127
67436
|
}
|
|
67128
67437
|
}
|
|
67129
67438
|
const directory = runtimeDirectory();
|
|
67130
|
-
const unresolved =
|
|
67131
|
-
(entry) => entry.isDirectory() && entry.name.startsWith("runtime-") &&
|
|
67439
|
+
const unresolved = fs32.existsSync(directory) && fs32.readdirSync(directory, { withFileTypes: true }).find(
|
|
67440
|
+
(entry) => entry.isDirectory() && entry.name.startsWith("runtime-") && fs32.existsSync(path33.join(directory, entry.name, UNVERIFIED_CLEANUP_MARKER))
|
|
67132
67441
|
);
|
|
67133
67442
|
if (unresolved) {
|
|
67134
67443
|
throw new Error(
|
|
67135
|
-
"The previous installer cleanup is unverified. Confirm its processes have exited before removing only the marked directory: " +
|
|
67444
|
+
"The previous installer cleanup is unverified. Confirm its processes have exited before removing only the marked directory: " + path33.join(directory, unresolved.name)
|
|
67136
67445
|
);
|
|
67137
67446
|
}
|
|
67138
67447
|
const python = checkMakerPythonEnvironment();
|
|
@@ -67141,10 +67450,10 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
67141
67450
|
"Runtime installation needs Python and curl. Run taptap-maker python setup with host approval, then retry."
|
|
67142
67451
|
);
|
|
67143
67452
|
}
|
|
67144
|
-
const staging =
|
|
67145
|
-
|
|
67146
|
-
const installer =
|
|
67147
|
-
|
|
67453
|
+
const staging = path33.join(directory, "runtime-" + randomUUID5());
|
|
67454
|
+
fs32.mkdirSync(staging, { recursive: true, mode: 448 });
|
|
67455
|
+
const installer = path33.join(staging, "install-urhox-runtime.py");
|
|
67456
|
+
fs32.writeFileSync(installer, PREVIEW_INSTALLER_SOURCE, { mode: 384 });
|
|
67148
67457
|
const platform = process.platform === "win32" ? "win32" : "darwin";
|
|
67149
67458
|
try {
|
|
67150
67459
|
await runPreviewInstaller(
|
|
@@ -67157,14 +67466,14 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
67157
67466
|
signal
|
|
67158
67467
|
}
|
|
67159
67468
|
);
|
|
67160
|
-
const executable =
|
|
67161
|
-
|
|
67469
|
+
const executable = fs32.realpathSync(
|
|
67470
|
+
path33.join(staging, platform === "win32" ? "UrhoXRuntime.exe" : "UrhoXRuntime")
|
|
67162
67471
|
);
|
|
67163
67472
|
const resources2 = ensurePreviewRuntimeResources(executable);
|
|
67164
67473
|
const runtime = await probeRuntime(executable, signal);
|
|
67165
|
-
const archive =
|
|
67474
|
+
const archive = path33.join(staging, "UrhoXRuntime.zip");
|
|
67166
67475
|
const hash2 = createHash5("sha256");
|
|
67167
|
-
for await (const chunk of
|
|
67476
|
+
for await (const chunk of fs32.createReadStream(archive)) hash2.update(chunk);
|
|
67168
67477
|
const installation = {
|
|
67169
67478
|
install_state: "ready",
|
|
67170
67479
|
executable,
|
|
@@ -67174,19 +67483,19 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
67174
67483
|
warnings: resources2.warnings
|
|
67175
67484
|
};
|
|
67176
67485
|
const protectedDirectories = [staging, ...activePreviewRuntimeDirectories(project)];
|
|
67177
|
-
if (previous.executable) protectedDirectories.push(
|
|
67486
|
+
if (previous.executable) protectedDirectories.push(path33.dirname(previous.executable));
|
|
67178
67487
|
installation.warnings = [
|
|
67179
67488
|
...installation.warnings || [],
|
|
67180
67489
|
...trimPreviewCache(directory, "runtime-", 2, protectedDirectories)
|
|
67181
67490
|
];
|
|
67182
|
-
writePrivateJson(
|
|
67491
|
+
writePrivateJson(path33.join(directory, "installation.json"), installation);
|
|
67183
67492
|
return installation;
|
|
67184
67493
|
} catch (error2) {
|
|
67185
67494
|
const cleanupUnverified = error2.cleanupVerified === false;
|
|
67186
|
-
if (!cleanupUnverified)
|
|
67495
|
+
if (!cleanupUnverified) fs32.rmSync(staging, { recursive: true, force: true });
|
|
67187
67496
|
else
|
|
67188
|
-
|
|
67189
|
-
|
|
67497
|
+
fs32.writeFileSync(
|
|
67498
|
+
path33.join(staging, UNVERIFIED_CLEANUP_MARKER),
|
|
67190
67499
|
"Installer process ownership must be verified before cleanup.\n",
|
|
67191
67500
|
{ mode: 384 }
|
|
67192
67501
|
);
|
|
@@ -67198,12 +67507,16 @@ async function installPreviewRuntime(project, signal, update = false) {
|
|
|
67198
67507
|
|
|
67199
67508
|
// src/maker/preview/session.ts
|
|
67200
67509
|
init_protocol2();
|
|
67201
|
-
import
|
|
67202
|
-
import
|
|
67510
|
+
import fs33 from "node:fs";
|
|
67511
|
+
import path34 from "node:path";
|
|
67203
67512
|
import http2 from "node:http";
|
|
67204
67513
|
import os6 from "node:os";
|
|
67205
67514
|
import { timingSafeEqual } from "node:crypto";
|
|
67206
67515
|
init_diagnosticRedaction();
|
|
67516
|
+
function previewErrorMessage(error2) {
|
|
67517
|
+
const message = error2 instanceof Error ? error2.message : "Unexpected preview error.";
|
|
67518
|
+
return String(sanitizeDiagnosticValue(message));
|
|
67519
|
+
}
|
|
67207
67520
|
var PreviewSession = class {
|
|
67208
67521
|
constructor(record2, save = true) {
|
|
67209
67522
|
this.record = record2;
|
|
@@ -67226,10 +67539,22 @@ var PreviewSession = class {
|
|
|
67226
67539
|
if ((current == null ? void 0 : current.session_id) !== this.record.session_id || current.supervisor_id !== this.record.supervisor_id)
|
|
67227
67540
|
return;
|
|
67228
67541
|
writePrivateJson(
|
|
67229
|
-
|
|
67542
|
+
path34.join(previewDirectory(this.record.project_realpath), "session.json"),
|
|
67230
67543
|
this.record
|
|
67231
67544
|
);
|
|
67232
|
-
writePrivateJson(
|
|
67545
|
+
writePrivateJson(path34.join(previewRoundDirectory(this.record), "result.json"), this.status());
|
|
67546
|
+
}
|
|
67547
|
+
}
|
|
67548
|
+
setTerminalState(state) {
|
|
67549
|
+
var _a3;
|
|
67550
|
+
try {
|
|
67551
|
+
this.setState(state);
|
|
67552
|
+
return true;
|
|
67553
|
+
} catch (error2) {
|
|
67554
|
+
const message = previewErrorMessage(error2);
|
|
67555
|
+
if (!((_a3 = this.failure) == null ? void 0 : _a3.includes(message)))
|
|
67556
|
+
this.failure = [this.failure, "Preview state persistence failed: " + message].filter(Boolean).join("; ");
|
|
67557
|
+
return false;
|
|
67233
67558
|
}
|
|
67234
67559
|
}
|
|
67235
67560
|
status() {
|
|
@@ -67249,7 +67574,7 @@ var PreviewSession = class {
|
|
|
67249
67574
|
executable: this.record.executable,
|
|
67250
67575
|
runtime_version: this.record.runtime.runtime_version,
|
|
67251
67576
|
capabilities: this.record.runtime.capabilities,
|
|
67252
|
-
launch_mode: ((_c = this.runtime) == null ? void 0 : _c.launchMode) ??
|
|
67577
|
+
launch_mode: ((_c = this.runtime) == null ? void 0 : _c.launchMode) ?? "local_manifest",
|
|
67253
67578
|
preparation: (_d = this.runtime) == null ? void 0 : _d.preparation,
|
|
67254
67579
|
ready: false,
|
|
67255
67580
|
screenshots_supported: false,
|
|
@@ -67306,8 +67631,8 @@ var PreviewSession = class {
|
|
|
67306
67631
|
async launch(reload) {
|
|
67307
67632
|
var _a3;
|
|
67308
67633
|
this.failure = void 0;
|
|
67309
|
-
this.setState(reload ? "reloading" : "starting");
|
|
67310
67634
|
try {
|
|
67635
|
+
this.setState(reload ? "reloading" : "starting");
|
|
67311
67636
|
if (reload) {
|
|
67312
67637
|
await ((_a3 = this.runtime) == null ? void 0 : _a3.stop());
|
|
67313
67638
|
this.runtime = void 0;
|
|
@@ -67333,7 +67658,8 @@ var PreviewSession = class {
|
|
|
67333
67658
|
(state) => {
|
|
67334
67659
|
if (this.runtime !== runtime || this.stopping) return;
|
|
67335
67660
|
if (state === "stopped" && this.record.state === "reloading") return;
|
|
67336
|
-
this.setState(state);
|
|
67661
|
+
if (state === "running") this.setState(state);
|
|
67662
|
+
else this.setTerminalState(state);
|
|
67337
67663
|
},
|
|
67338
67664
|
void 0,
|
|
67339
67665
|
(pid) => {
|
|
@@ -67344,7 +67670,7 @@ var PreviewSession = class {
|
|
|
67344
67670
|
this.runtime = runtime;
|
|
67345
67671
|
await runtime.start(
|
|
67346
67672
|
String(this.preflight.entry),
|
|
67347
|
-
|
|
67673
|
+
path34.join(previewDirectory(this.record.project_realpath), "storage"),
|
|
67348
67674
|
this.preflight.window
|
|
67349
67675
|
);
|
|
67350
67676
|
if (this.stopping) throw new Error("CANCELLED");
|
|
@@ -67353,8 +67679,8 @@ var PreviewSession = class {
|
|
|
67353
67679
|
...reload ? { warning: "Preview restarted; in-memory game state was lost." } : {}
|
|
67354
67680
|
};
|
|
67355
67681
|
} catch (error2) {
|
|
67356
|
-
this.failure =
|
|
67357
|
-
this.
|
|
67682
|
+
this.failure = previewErrorMessage(error2);
|
|
67683
|
+
this.setTerminalState(this.stopping ? "stopped" : "failed");
|
|
67358
67684
|
return {
|
|
67359
67685
|
...this.status(),
|
|
67360
67686
|
ok: false,
|
|
@@ -67363,7 +67689,7 @@ var PreviewSession = class {
|
|
|
67363
67689
|
} finally {
|
|
67364
67690
|
try {
|
|
67365
67691
|
trimPreviewEvidence(
|
|
67366
|
-
|
|
67692
|
+
path34.join(previewDirectory(this.record.project_realpath), "sessions"),
|
|
67367
67693
|
this.record.session_id,
|
|
67368
67694
|
this.record.reload_id
|
|
67369
67695
|
);
|
|
@@ -67381,14 +67707,14 @@ var PreviewSession = class {
|
|
|
67381
67707
|
await ((_a3 = this.runtime) == null ? void 0 : _a3.stop());
|
|
67382
67708
|
await this.operation;
|
|
67383
67709
|
} catch (error2) {
|
|
67384
|
-
this.failure =
|
|
67385
|
-
this.
|
|
67710
|
+
this.failure = previewErrorMessage(error2);
|
|
67711
|
+
this.setTerminalState("failed");
|
|
67386
67712
|
return { ...this.status(), ok: false, result: "TIMEOUT" };
|
|
67387
67713
|
} finally {
|
|
67388
67714
|
this.pendingStops--;
|
|
67389
67715
|
}
|
|
67390
|
-
this.
|
|
67391
|
-
return { ...this.status(), ok:
|
|
67716
|
+
const persisted = this.setTerminalState("stopped");
|
|
67717
|
+
return { ...this.status(), ok: persisted };
|
|
67392
67718
|
}
|
|
67393
67719
|
async handle(action, options3 = {}, signal) {
|
|
67394
67720
|
var _a3, _b, _c, _d;
|
|
@@ -67512,32 +67838,33 @@ async function runPreviewSupervisor(project, sessionId) {
|
|
|
67512
67838
|
const shutdown = async (retireFailure = false) => {
|
|
67513
67839
|
if (shuttingDown || retireFailure && !session.canRetireFailure) return;
|
|
67514
67840
|
shuttingDown = true;
|
|
67515
|
-
|
|
67516
|
-
|
|
67517
|
-
|
|
67518
|
-
|
|
67519
|
-
return;
|
|
67841
|
+
try {
|
|
67842
|
+
if (!retireFailure) {
|
|
67843
|
+
const result = await session.stop();
|
|
67844
|
+
if (!result.ok && (result.state !== "stopped" || result.process_alive !== false)) return;
|
|
67520
67845
|
}
|
|
67521
|
-
|
|
67522
|
-
|
|
67523
|
-
|
|
67524
|
-
|
|
67525
|
-
|
|
67526
|
-
|
|
67527
|
-
|
|
67528
|
-
|
|
67529
|
-
|
|
67530
|
-
|
|
67531
|
-
|
|
67532
|
-
|
|
67533
|
-
|
|
67534
|
-
|
|
67535
|
-
|
|
67536
|
-
|
|
67537
|
-
}
|
|
67846
|
+
clearInterval(idleTimer);
|
|
67847
|
+
clearTimeout(closeTimer);
|
|
67848
|
+
await new Promise((resolve) => {
|
|
67849
|
+
server.close(() => resolve());
|
|
67850
|
+
server.closeIdleConnections();
|
|
67851
|
+
});
|
|
67852
|
+
process.removeListener("SIGINT", onSignal);
|
|
67853
|
+
process.removeListener("SIGTERM", onSignal);
|
|
67854
|
+
if (retireFailure && session.canRetireFailure) {
|
|
67855
|
+
try {
|
|
67856
|
+
const current = readPreviewRecord(project);
|
|
67857
|
+
if ((current == null ? void 0 : current.session_id) === record2.session_id && current.supervisor_id === record2.supervisor_id && current.reload_id === record2.reload_id) {
|
|
67858
|
+
writePrivateJson(path34.join(previewRoundDirectory(record2), "result.json"), {
|
|
67859
|
+
...session.status(),
|
|
67860
|
+
supervisor_retired: true
|
|
67861
|
+
});
|
|
67862
|
+
}
|
|
67863
|
+
} catch {
|
|
67538
67864
|
}
|
|
67539
|
-
} catch {
|
|
67540
67865
|
}
|
|
67866
|
+
} finally {
|
|
67867
|
+
shuttingDown = false;
|
|
67541
67868
|
}
|
|
67542
67869
|
};
|
|
67543
67870
|
const onSignal = () => {
|
|
@@ -67584,7 +67911,7 @@ async function runPreviewSupervisor(project, sessionId) {
|
|
|
67584
67911
|
JSON.stringify({
|
|
67585
67912
|
...session.status(),
|
|
67586
67913
|
ok: false,
|
|
67587
|
-
error:
|
|
67914
|
+
error: previewErrorMessage(error2)
|
|
67588
67915
|
})
|
|
67589
67916
|
);
|
|
67590
67917
|
}
|
|
@@ -67608,7 +67935,7 @@ async function runPreviewSupervisor(project, sessionId) {
|
|
|
67608
67935
|
record2.supervisor_pid = process.pid;
|
|
67609
67936
|
record2.runtime_pid = 0;
|
|
67610
67937
|
record2.runtime_launch_pending = false;
|
|
67611
|
-
writePrivateJson(
|
|
67938
|
+
writePrivateJson(path34.join(previewDirectory(project), "session.json"), record2);
|
|
67612
67939
|
const idleTimer = setInterval(() => {
|
|
67613
67940
|
if (record2.state === "stopped") void shutdown();
|
|
67614
67941
|
else if (session.canRetireFailure) void shutdown(true);
|
|
@@ -67642,10 +67969,10 @@ async function previewStatus(project) {
|
|
|
67642
67969
|
};
|
|
67643
67970
|
} catch {
|
|
67644
67971
|
const stopped = record2.state === "stopped";
|
|
67645
|
-
const filename2 =
|
|
67972
|
+
const filename2 = path34.join(previewRoundDirectory(record2), "result.json");
|
|
67646
67973
|
let evidence = {};
|
|
67647
|
-
if (
|
|
67648
|
-
const saved = JSON.parse(
|
|
67974
|
+
if (fs33.existsSync(filename2)) {
|
|
67975
|
+
const saved = JSON.parse(fs33.readFileSync(filename2, "utf8"));
|
|
67649
67976
|
if (samePreviewIdentity(saved, record2)) {
|
|
67650
67977
|
evidence = { ...saved };
|
|
67651
67978
|
delete evidence.token;
|
|
@@ -67700,8 +68027,8 @@ init_diagnosticRedaction();
|
|
|
67700
68027
|
|
|
67701
68028
|
// src/maker/system/backgroundProcess.ts
|
|
67702
68029
|
import { spawn as spawn8 } from "node:child_process";
|
|
67703
|
-
import
|
|
67704
|
-
import
|
|
68030
|
+
import fs34 from "node:fs";
|
|
68031
|
+
import path35 from "node:path";
|
|
67705
68032
|
var WINDOWS_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
67706
68033
|
"APPDATA",
|
|
67707
68034
|
"COMSPEC",
|
|
@@ -67736,9 +68063,9 @@ var WINDOWS_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
|
67736
68063
|
"WINDIR"
|
|
67737
68064
|
]);
|
|
67738
68065
|
function openBackgroundProcessLog(filename2) {
|
|
67739
|
-
|
|
67740
|
-
const oversized =
|
|
67741
|
-
return
|
|
68066
|
+
fs34.mkdirSync(path35.dirname(filename2), { recursive: true, mode: 448 });
|
|
68067
|
+
const oversized = fs34.existsSync(filename2) && fs34.statSync(filename2).size > 1024 * 1024;
|
|
68068
|
+
return fs34.openSync(filename2, oversized ? "w" : "a", 384);
|
|
67742
68069
|
}
|
|
67743
68070
|
function selectWindowsBackgroundEnvironment(env) {
|
|
67744
68071
|
return Object.fromEntries(
|
|
@@ -67780,7 +68107,7 @@ async function launchBackgroundProcess(options3) {
|
|
|
67780
68107
|
var _a3, _b, _c;
|
|
67781
68108
|
if ((_a3 = options3.signal) == null ? void 0 : _a3.aborted) throw new Error("CANCELLED: background launch.");
|
|
67782
68109
|
if ((options3.platform ?? process.platform) !== "win32") return directLaunch(options3);
|
|
67783
|
-
|
|
68110
|
+
fs34.closeSync(openBackgroundProcessLog(options3.logFile));
|
|
67784
68111
|
const scripts = buildWindowsBackgroundLaunchScripts(options3);
|
|
67785
68112
|
const broker = spawn8(
|
|
67786
68113
|
"powershell.exe",
|
|
@@ -67853,7 +68180,7 @@ function directLaunch(options3) {
|
|
|
67853
68180
|
env: options3.env
|
|
67854
68181
|
});
|
|
67855
68182
|
} finally {
|
|
67856
|
-
|
|
68183
|
+
fs34.closeSync(stderr);
|
|
67857
68184
|
}
|
|
67858
68185
|
let launchFailure;
|
|
67859
68186
|
child.once("error", (error2) => {
|
|
@@ -67957,7 +68284,7 @@ async function runPreviewCli(action, options3) {
|
|
|
67957
68284
|
);
|
|
67958
68285
|
} else {
|
|
67959
68286
|
if (action === "stop") {
|
|
67960
|
-
writePrivateJson(
|
|
68287
|
+
writePrivateJson(path36.join(previewDirectory(project), "stop.json"), {
|
|
67961
68288
|
request_id: randomUUID6()
|
|
67962
68289
|
});
|
|
67963
68290
|
}
|
|
@@ -68036,8 +68363,8 @@ async function runPreviewCli(action, options3) {
|
|
|
68036
68363
|
process.exitCode = 1;
|
|
68037
68364
|
}
|
|
68038
68365
|
async function startPreview(project, options3, signal) {
|
|
68039
|
-
const stopFile =
|
|
68040
|
-
const readStop = () =>
|
|
68366
|
+
const stopFile = path36.join(previewDirectory(project), "stop.json");
|
|
68367
|
+
const readStop = () => fs35.existsSync(stopFile) ? fs35.readFileSync(stopFile, "utf8") : "";
|
|
68041
68368
|
const stopGeneration = readStop();
|
|
68042
68369
|
const checkCancelled = () => {
|
|
68043
68370
|
if (signal.aborted || readStop() !== stopGeneration)
|
|
@@ -68071,9 +68398,9 @@ async function startPreview(project, options3, signal) {
|
|
|
68071
68398
|
install_state: "missing",
|
|
68072
68399
|
error: "Runtime is missing. With host approval, run taptap-maker preview install --target-dir <PROJECT_ABSOLUTE_PATH>, then retry start."
|
|
68073
68400
|
};
|
|
68074
|
-
if (!
|
|
68401
|
+
if (!path36.isAbsolute(configured))
|
|
68075
68402
|
throw new Error("--runtime must be an absolute executable path.");
|
|
68076
|
-
const executable =
|
|
68403
|
+
const executable = fs35.realpathSync(configured);
|
|
68077
68404
|
const resourceWarnings = externalRuntime ? [] : ensurePreviewRuntimeResources(executable).warnings;
|
|
68078
68405
|
const runtime = await probeRuntime(executable, signal);
|
|
68079
68406
|
checkCancelled();
|
|
@@ -68093,14 +68420,14 @@ async function startPreview(project, options3, signal) {
|
|
|
68093
68420
|
state: "starting",
|
|
68094
68421
|
runtime
|
|
68095
68422
|
};
|
|
68096
|
-
writePrivateJson(
|
|
68423
|
+
writePrivateJson(path36.join(previewDirectory(project), "session.json"), record2);
|
|
68097
68424
|
const launch = await launchPreviewSupervisorProcess({
|
|
68098
68425
|
execPath: process.execPath,
|
|
68099
68426
|
execArgv: process.execArgv,
|
|
68100
68427
|
entry: process.argv[1],
|
|
68101
68428
|
project,
|
|
68102
68429
|
sessionId: record2.session_id,
|
|
68103
|
-
cwd:
|
|
68430
|
+
cwd: path36.dirname(executable),
|
|
68104
68431
|
logFile: previewSupervisorLogPath(project),
|
|
68105
68432
|
env: process.env,
|
|
68106
68433
|
signal
|
|
@@ -68145,7 +68472,7 @@ async function startPreview(project, options3, signal) {
|
|
|
68145
68472
|
} else {
|
|
68146
68473
|
if (launch.stopUnpublished()) {
|
|
68147
68474
|
record2.state = "stopped";
|
|
68148
|
-
writePrivateJson(
|
|
68475
|
+
writePrivateJson(path36.join(previewDirectory(project), "session.json"), record2);
|
|
68149
68476
|
} else {
|
|
68150
68477
|
throw new Error(
|
|
68151
68478
|
String(error2) + "; supervisor exit is unverified. Inspect " + previewSupervisorLogPath(project)
|
|
@@ -68160,7 +68487,7 @@ async function startPreview(project, options3, signal) {
|
|
|
68160
68487
|
import fs44 from "node:fs";
|
|
68161
68488
|
import path46 from "node:path";
|
|
68162
68489
|
import { spawn as spawn11 } from "node:child_process";
|
|
68163
|
-
import { createHash as
|
|
68490
|
+
import { createHash as createHash9, randomUUID as randomUUID8 } from "node:crypto";
|
|
68164
68491
|
init_storage();
|
|
68165
68492
|
init_projectRegistry();
|
|
68166
68493
|
init_privateJson();
|
|
@@ -68171,8 +68498,8 @@ init_projectSettings();
|
|
|
68171
68498
|
init_qrcodePreflight();
|
|
68172
68499
|
init_qrcodeInteraction();
|
|
68173
68500
|
init_git();
|
|
68174
|
-
import
|
|
68175
|
-
import
|
|
68501
|
+
import fs36 from "node:fs";
|
|
68502
|
+
import path37 from "node:path";
|
|
68176
68503
|
import { execFile as execFile2 } from "node:child_process";
|
|
68177
68504
|
import { promisify as promisify2 } from "node:util";
|
|
68178
68505
|
|
|
@@ -68196,17 +68523,17 @@ var ConsoleError = class extends Error {
|
|
|
68196
68523
|
// src/maker/console/projects.ts
|
|
68197
68524
|
var exec = promisify2(execFile2);
|
|
68198
68525
|
function objectFile2(filename2) {
|
|
68199
|
-
const stat =
|
|
68526
|
+
const stat = fs36.statSync(filename2);
|
|
68200
68527
|
if (!stat.isFile() || stat.size > 2 * 1024 * 1024)
|
|
68201
68528
|
throw new ConsoleError("Project configuration exceeds the supported size.");
|
|
68202
|
-
const data = JSON.parse(
|
|
68529
|
+
const data = JSON.parse(fs36.readFileSync(filename2, "utf8"));
|
|
68203
68530
|
if (!data || typeof data !== "object" || Array.isArray(data))
|
|
68204
68531
|
throw new ConsoleError("Invalid project configuration.");
|
|
68205
68532
|
return data;
|
|
68206
68533
|
}
|
|
68207
68534
|
function optionalConfig(root2, file3) {
|
|
68208
68535
|
try {
|
|
68209
|
-
return objectFile2(
|
|
68536
|
+
return objectFile2(path37.join(root2, ".project", file3));
|
|
68210
68537
|
} catch {
|
|
68211
68538
|
return {};
|
|
68212
68539
|
}
|
|
@@ -68249,7 +68576,7 @@ var ConsoleProjects = class {
|
|
|
68249
68576
|
const error2 = entry.error;
|
|
68250
68577
|
const config2 = error2 ? {} : optionalConfig(entry.path, "project.json");
|
|
68251
68578
|
const title = (_b = text((_a3 = config2.taptap_publish) == null ? void 0 : _a3.title)) == null ? void 0 : _b.trim();
|
|
68252
|
-
const name = title && title !== "<game title, required>" ? title :
|
|
68579
|
+
const name = title && title !== "<game title, required>" ? title : path37.basename(entry.path) + (error2 ? "" : "(未发布)");
|
|
68253
68580
|
return {
|
|
68254
68581
|
key: entry.key,
|
|
68255
68582
|
projectid: entry.binding,
|
|
@@ -68285,7 +68612,7 @@ var ConsoleProjects = class {
|
|
|
68285
68612
|
const entry = config2["entry@server"] || resources2["entry@server"];
|
|
68286
68613
|
const normalized = typeof entry === "string" ? entry.replace(/\\/g, "/").replace(/^\.\//, "") : "";
|
|
68287
68614
|
const entries = normalized ? [normalized, "scripts/" + normalized, "assets/" + normalized] : [];
|
|
68288
|
-
const directories = entries.map((file3) =>
|
|
68615
|
+
const directories = entries.map((file3) => path37.posix.dirname(file3)).filter((dir) => ![".", "scripts", "assets"].includes(dir));
|
|
68289
68616
|
const raw = (await inspectGit(["status", "--porcelain=v1", "-z", "--untracked-files=all"])).split("\0");
|
|
68290
68617
|
const files = /* @__PURE__ */ new Set();
|
|
68291
68618
|
for (let i = 0; i < raw.length && raw[i]; i++) {
|
|
@@ -68302,7 +68629,7 @@ var ConsoleProjects = class {
|
|
|
68302
68629
|
const meta3 = source + ".meta";
|
|
68303
68630
|
const current = (() => {
|
|
68304
68631
|
try {
|
|
68305
|
-
return objectFile2(
|
|
68632
|
+
return objectFile2(path37.join(project.path, meta3));
|
|
68306
68633
|
} catch {
|
|
68307
68634
|
return {};
|
|
68308
68635
|
}
|
|
@@ -68472,10 +68799,12 @@ function createConsoleExecutor(options3) {
|
|
|
68472
68799
|
signal,
|
|
68473
68800
|
confirmedOrientation,
|
|
68474
68801
|
publication,
|
|
68475
|
-
confirmedBuild
|
|
68802
|
+
confirmedBuild,
|
|
68803
|
+
reportContext
|
|
68476
68804
|
}) => {
|
|
68477
|
-
if (![...CONSOLE_ACTIONS, "preview.status", "preview.logs"].includes(action))
|
|
68805
|
+
if (![...CONSOLE_ACTIONS, "preview.status", "preview.logs", "issue.report"].includes(action))
|
|
68478
68806
|
throw new Error("Unsupported console CLI action.");
|
|
68807
|
+
if (action === "issue.report" && !reportContext) throw new Error("Report context is required.");
|
|
68479
68808
|
if (signal == null ? void 0 : signal.aborted) return { ok: false, error: "Console query cancelled before launch." };
|
|
68480
68809
|
if (action === "lua-lsp.check") {
|
|
68481
68810
|
const result = await checkMakerLuaLspProject(project);
|
|
@@ -68486,7 +68815,7 @@ function createConsoleExecutor(options3) {
|
|
|
68486
68815
|
...!result.ok ? { error: result.error || result.summary } : {}
|
|
68487
68816
|
});
|
|
68488
68817
|
}
|
|
68489
|
-
const command = action === "build" || action === "qrcode" ? [action] : ["preview", action.slice("preview.".length)];
|
|
68818
|
+
const command = action === "issue.report" ? ["mcp", "report", "--context-stdin", "--consent"] : action === "build" || action === "qrcode" ? [action] : ["preview", action.slice("preview.".length)];
|
|
68490
68819
|
if (action === "qrcode" && confirmedOrientation)
|
|
68491
68820
|
command.push("--confirmed-screen-orientation", confirmedOrientation);
|
|
68492
68821
|
if (action === "qrcode") {
|
|
@@ -68530,9 +68859,14 @@ function createConsoleExecutor(options3) {
|
|
|
68530
68859
|
detached: ownsProcessGroup,
|
|
68531
68860
|
windowsHide: true,
|
|
68532
68861
|
shell: false,
|
|
68533
|
-
stdio: ["ignore", "pipe", "pipe", "ipc"],
|
|
68862
|
+
stdio: [action === "issue.report" ? "pipe" : "ignore", "pipe", "pipe", "ipc"],
|
|
68534
68863
|
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
68535
68864
|
});
|
|
68865
|
+
if (action === "issue.report") {
|
|
68866
|
+
child.stdin.on("error", () => {
|
|
68867
|
+
});
|
|
68868
|
+
child.stdin.end(JSON.stringify(reportContext));
|
|
68869
|
+
}
|
|
68536
68870
|
const childStdout = child.stdout;
|
|
68537
68871
|
const childStderr = child.stderr;
|
|
68538
68872
|
let stdout = "";
|
|
@@ -68572,7 +68906,7 @@ function createConsoleExecutor(options3) {
|
|
|
68572
68906
|
timedOut = true;
|
|
68573
68907
|
terminate();
|
|
68574
68908
|
},
|
|
68575
|
-
action === "build" || action === "qrcode" ? 65 * 60 * 1e3 : action === "preview.status" || action === "preview.logs" ? 3e4 : 7 * 60 * 1e3
|
|
68909
|
+
action === "build" || action === "qrcode" ? 65 * 60 * 1e3 : action === "preview.status" || action === "preview.logs" || action === "issue.report" ? 3e4 : 7 * 60 * 1e3
|
|
68576
68910
|
);
|
|
68577
68911
|
const cleanup = () => {
|
|
68578
68912
|
finished = true;
|
|
@@ -68647,6 +68981,17 @@ function createConsoleExecutor(options3) {
|
|
|
68647
68981
|
}
|
|
68648
68982
|
try {
|
|
68649
68983
|
const result = JSON.parse(stdout);
|
|
68984
|
+
if (action === "issue.report") {
|
|
68985
|
+
const created = code === 0 && (result == null ? void 0 : result.status) === "created" && typeof result.issue_url === "string" && /^https:\/\/github\.com\/taptap\/instant-games-open-mcp\/issues\/\d+$/.test(
|
|
68986
|
+
result.issue_url
|
|
68987
|
+
);
|
|
68988
|
+
resolve({
|
|
68989
|
+
ok: created,
|
|
68990
|
+
status: created ? "created" : "unavailable",
|
|
68991
|
+
...created ? { issue_url: result.issue_url } : {}
|
|
68992
|
+
});
|
|
68993
|
+
return;
|
|
68994
|
+
}
|
|
68650
68995
|
if (!result || typeof result !== "object" || typeof result.ok !== "boolean")
|
|
68651
68996
|
throw new Error("Missing CLI result status.");
|
|
68652
68997
|
resolve(
|
|
@@ -68682,7 +69027,7 @@ function launchConsoleServerProcess(options3) {
|
|
|
68682
69027
|
|
|
68683
69028
|
// src/maker/console/server.ts
|
|
68684
69029
|
import http3 from "node:http";
|
|
68685
|
-
import { createHash as
|
|
69030
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
68686
69031
|
|
|
68687
69032
|
// src/maker/console/tasks.ts
|
|
68688
69033
|
init_privateJson();
|
|
@@ -68692,6 +69037,107 @@ init_qrcodeInteraction();
|
|
|
68692
69037
|
import fs38 from "node:fs";
|
|
68693
69038
|
import path39 from "node:path";
|
|
68694
69039
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
69040
|
+
|
|
69041
|
+
// src/maker/console/issueReport.ts
|
|
69042
|
+
init_protocol2();
|
|
69043
|
+
init_diagnosticRedaction();
|
|
69044
|
+
import fs37 from "node:fs";
|
|
69045
|
+
import os7 from "node:os";
|
|
69046
|
+
import path38 from "node:path";
|
|
69047
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
69048
|
+
function consoleReportOffer(task) {
|
|
69049
|
+
if (!["failed", "unknown"].includes(task.status)) return;
|
|
69050
|
+
if (task.action === "lua-lsp.check" || task.interaction || task.recovery) return;
|
|
69051
|
+
const error2 = task.error || "";
|
|
69052
|
+
if (/找不到本地预览入口|Runtime is missing|taptap-maker login|PAT.*(?:expired|invalid)|HTTP 40[13]|cancelled|canceled|用户取消|Please commit your changes|CONFLICT|Need to call maker_build_current_directory|Invalid.*config|配置.*(?:损坏|缺失)|requires a bound Maker project/i.test(
|
|
69053
|
+
error2
|
|
69054
|
+
))
|
|
69055
|
+
return;
|
|
69056
|
+
const preview = ["preview.start", "preview.refresh", "preview.install"].includes(task.action);
|
|
69057
|
+
if (!preview && !/timeout|timed out|HTTP 5\d\d|internal.*error|unverifiable|verifiable JSON|unexpected|connection closed/i.test(
|
|
69058
|
+
error2
|
|
69059
|
+
))
|
|
69060
|
+
return;
|
|
69061
|
+
const category = preview ? "runtime" : task.action === "build" || task.action === "qrcode" ? "build" : "console";
|
|
69062
|
+
const stable = error2.replace(/[a-f0-9]{8}-[a-f0-9-]{27,}/gi, "<id>").replace(/[a-f0-9]{64}/gi, "<hash>").replace(/\b\d+\b/g, "<n>");
|
|
69063
|
+
return {
|
|
69064
|
+
category,
|
|
69065
|
+
fingerprint: createHash6("sha256").update(task.projectKey + ":" + task.action + ":" + stable).digest("hex")
|
|
69066
|
+
};
|
|
69067
|
+
}
|
|
69068
|
+
function logTail(root2, relative) {
|
|
69069
|
+
let fd;
|
|
69070
|
+
try {
|
|
69071
|
+
if (fs37.lstatSync(root2).isSymbolicLink()) return "[日志不可用]";
|
|
69072
|
+
const file3 = path38.join(fs37.realpathSync(root2), relative);
|
|
69073
|
+
if (fs37.realpathSync(file3) !== file3 || !fs37.lstatSync(file3).isFile()) return "[日志不可用]";
|
|
69074
|
+
fd = fs37.openSync(file3, fs37.constants.O_RDONLY | (fs37.constants.O_NOFOLLOW || 0));
|
|
69075
|
+
const stat = fs37.fstatSync(fd);
|
|
69076
|
+
if (!stat.isFile()) return "[日志不可用]";
|
|
69077
|
+
const offset = Math.max(0, stat.size - 6e3);
|
|
69078
|
+
const buffer = Buffer.alloc(Math.min(stat.size, 6e3));
|
|
69079
|
+
fs37.readSync(fd, buffer, 0, buffer.length, offset);
|
|
69080
|
+
let text2 = buffer.toString("utf8");
|
|
69081
|
+
if (offset) text2 = text2.includes("\n") ? text2.slice(text2.indexOf("\n") + 1) : "";
|
|
69082
|
+
return (offset ? "[日志仅含尾部]\n" : "") + String(sanitizeDiagnosticValue(text2));
|
|
69083
|
+
} catch {
|
|
69084
|
+
return "[日志不存在或无法读取]";
|
|
69085
|
+
} finally {
|
|
69086
|
+
if (fd !== void 0) fs37.closeSync(fd);
|
|
69087
|
+
}
|
|
69088
|
+
}
|
|
69089
|
+
function consoleReportContext(task, project) {
|
|
69090
|
+
var _a3;
|
|
69091
|
+
const offer = consoleReportOffer(task);
|
|
69092
|
+
const directory = previewDirectory(project);
|
|
69093
|
+
let preview = { status: "unavailable" };
|
|
69094
|
+
const logs = {};
|
|
69095
|
+
if (task.action.startsWith("preview.")) {
|
|
69096
|
+
try {
|
|
69097
|
+
const record2 = readPreviewRecord(project);
|
|
69098
|
+
const result = task.result;
|
|
69099
|
+
const sameSession = (result == null ? void 0 : result.session_id) ? result.session_id === (record2 == null ? void 0 : record2.session_id) && (result.reload_id === void 0 || result.reload_id === (record2 == null ? void 0 : record2.reload_id)) : record2 && Date.parse(record2.started_at) >= Date.parse(task.startedAt) && Date.parse(record2.started_at) <= Date.parse(task.finishedAt || (/* @__PURE__ */ new Date()).toISOString());
|
|
69100
|
+
if (record2 && sameSession) {
|
|
69101
|
+
logs.supervisor = logTail(directory, "supervisor.log");
|
|
69102
|
+
preview = {
|
|
69103
|
+
state: record2.state,
|
|
69104
|
+
session_id: record2.session_id,
|
|
69105
|
+
reload_id: record2.reload_id,
|
|
69106
|
+
supervisor_pid: record2.supervisor_pid,
|
|
69107
|
+
runtime_pid: record2.runtime_pid,
|
|
69108
|
+
runtime_launch_pending: record2.runtime_launch_pending,
|
|
69109
|
+
runtime: record2.runtime,
|
|
69110
|
+
executable: record2.executable
|
|
69111
|
+
};
|
|
69112
|
+
const round = path38.join("sessions", record2.session_id, String(record2.reload_id));
|
|
69113
|
+
logs.prepare = logTail(directory, path38.join(round, "prepare.log"));
|
|
69114
|
+
logs.runtime = logTail(directory, path38.join(round, "runtime.log"));
|
|
69115
|
+
}
|
|
69116
|
+
if (!record2) logs.supervisor = logTail(directory, "supervisor.log");
|
|
69117
|
+
} catch {
|
|
69118
|
+
}
|
|
69119
|
+
}
|
|
69120
|
+
return {
|
|
69121
|
+
source: "console",
|
|
69122
|
+
category: (offer == null ? void 0 : offer.category) || "console",
|
|
69123
|
+
summary: `${process.platform} ${task.action} 失败:${(task.error || "执行结果未知").split("\n")[0].slice(0, 160)}`,
|
|
69124
|
+
failed_operation: task.action,
|
|
69125
|
+
error_message: (_a3 = task.error) == null ? void 0 : _a3.slice(0, 3e3),
|
|
69126
|
+
reproduction_steps: ["在 Maker 控制台选择项目", `执行 ${task.action}`, "出现异常或结果未知"],
|
|
69127
|
+
error_data: {
|
|
69128
|
+
task_id: task.id,
|
|
69129
|
+
started_at: task.startedAt,
|
|
69130
|
+
finished_at: task.finishedAt,
|
|
69131
|
+
status: task.status,
|
|
69132
|
+
os_release: os7.release(),
|
|
69133
|
+
preview,
|
|
69134
|
+
logs,
|
|
69135
|
+
output: task.output.slice(-2e3)
|
|
69136
|
+
}
|
|
69137
|
+
};
|
|
69138
|
+
}
|
|
69139
|
+
|
|
69140
|
+
// src/maker/console/tasks.ts
|
|
68695
69141
|
var ConsoleTasks = class {
|
|
68696
69142
|
constructor(projects, execute, historyFile, onSettled = () => {
|
|
68697
69143
|
}) {
|
|
@@ -68701,6 +69147,7 @@ var ConsoleTasks = class {
|
|
|
68701
69147
|
this.onSettled = onSettled;
|
|
68702
69148
|
this.tasks = /* @__PURE__ */ new Map();
|
|
68703
69149
|
this.running = /* @__PURE__ */ new Set();
|
|
69150
|
+
var _a3;
|
|
68704
69151
|
if (historyFile && fs38.existsSync(historyFile)) {
|
|
68705
69152
|
if (fs38.statSync(historyFile).size > 40 * 1024 * 1024)
|
|
68706
69153
|
throw new ConsoleError("Console task history exceeds the supported size.");
|
|
@@ -68709,6 +69156,7 @@ var ConsoleTasks = class {
|
|
|
68709
69156
|
throw new ConsoleError("Invalid console task history.");
|
|
68710
69157
|
for (const task of data) {
|
|
68711
69158
|
if (!task.id || !CONSOLE_ACTIONS.includes(task.action)) continue;
|
|
69159
|
+
if (((_a3 = task.report) == null ? void 0 : _a3.status) === "running") task.report = { status: "unknown" };
|
|
68712
69160
|
if (task.status === "running") {
|
|
68713
69161
|
task.status = "unknown";
|
|
68714
69162
|
task.error = "Console restarted before the operation result was recorded. Check the result before retrying.";
|
|
@@ -68721,14 +69169,21 @@ var ConsoleTasks = class {
|
|
|
68721
69169
|
}
|
|
68722
69170
|
}
|
|
68723
69171
|
pruneHistory() {
|
|
69172
|
+
var _a3;
|
|
68724
69173
|
const counts = /* @__PURE__ */ new Map();
|
|
68725
69174
|
for (const task of Array.from(this.tasks.values()).reverse()) {
|
|
68726
69175
|
const count = (counts.get(task.projectKey) || 0) + 1;
|
|
68727
69176
|
counts.set(task.projectKey, count);
|
|
68728
|
-
if (count > 10 && task.status !== "running"
|
|
69177
|
+
if (count > 10 && task.status !== "running" && ((_a3 = task.report) == null ? void 0 : _a3.status) !== "running")
|
|
69178
|
+
this.tasks.delete(task.id);
|
|
68729
69179
|
}
|
|
68730
69180
|
while (this.tasks.size > 100) {
|
|
68731
|
-
const old = Array.from(this.tasks.values()).find(
|
|
69181
|
+
const old = Array.from(this.tasks.values()).find(
|
|
69182
|
+
(task) => {
|
|
69183
|
+
var _a4;
|
|
69184
|
+
return task.status !== "running" && ((_a4 = task.report) == null ? void 0 : _a4.status) !== "running";
|
|
69185
|
+
}
|
|
69186
|
+
);
|
|
68732
69187
|
if (!old) break;
|
|
68733
69188
|
this.tasks.delete(old.id);
|
|
68734
69189
|
}
|
|
@@ -68740,12 +69195,13 @@ var ConsoleTasks = class {
|
|
|
68740
69195
|
const result = task.result;
|
|
68741
69196
|
const interaction = task.action === "qrcode" && ["failed", "unknown"].includes(task.status) ? parseQrcodeInteraction(result == null ? void 0 : result.error) || parseQrcodeInteraction(task.error) : void 0;
|
|
68742
69197
|
const recovery = task.action === "qrcode" && ["failed", "unknown"].includes(task.status) ? parseQrcodeRecovery(result == null ? void 0 : result.error) || parseQrcodeRecovery(task.error) : void 0;
|
|
68743
|
-
|
|
69198
|
+
const described = {
|
|
68744
69199
|
...task,
|
|
68745
69200
|
interaction,
|
|
68746
69201
|
recovery,
|
|
68747
69202
|
...interaction || recovery ? { status: "unknown" } : {}
|
|
68748
69203
|
};
|
|
69204
|
+
return { ...described, reportOffer: consoleReportOffer(described) };
|
|
68749
69205
|
}
|
|
68750
69206
|
get(id) {
|
|
68751
69207
|
const task = this.tasks.get(id);
|
|
@@ -68753,7 +69209,86 @@ var ConsoleTasks = class {
|
|
|
68753
69209
|
return this.describe(task);
|
|
68754
69210
|
}
|
|
68755
69211
|
busy(key) {
|
|
68756
|
-
return this.list().some(
|
|
69212
|
+
return this.list().some(
|
|
69213
|
+
(task) => {
|
|
69214
|
+
var _a3;
|
|
69215
|
+
return task.projectKey === key && (task.status === "running" || ((_a3 = task.report) == null ? void 0 : _a3.status) === "running");
|
|
69216
|
+
}
|
|
69217
|
+
);
|
|
69218
|
+
}
|
|
69219
|
+
get active() {
|
|
69220
|
+
return this.running.size > 0;
|
|
69221
|
+
}
|
|
69222
|
+
report(id, consent) {
|
|
69223
|
+
if (consent !== true) throw new ConsoleError("Explicit report consent is required.");
|
|
69224
|
+
const described = this.get(id);
|
|
69225
|
+
if (!described.reportOffer)
|
|
69226
|
+
throw new ConsoleError("This task is not eligible for issue reporting.");
|
|
69227
|
+
const task = this.tasks.get(id);
|
|
69228
|
+
if (task.report) return this.describe(task);
|
|
69229
|
+
const project = this.projects.resolve(task.projectKey);
|
|
69230
|
+
if (task.projectPath !== project.path || task.projectid !== project.projectid)
|
|
69231
|
+
throw new ConsoleError("Project binding changed since this operation.");
|
|
69232
|
+
if (this.running.size >= 4) throw new ConsoleError("Too many active operations.", 409);
|
|
69233
|
+
task.report = { status: "running" };
|
|
69234
|
+
try {
|
|
69235
|
+
this.persist();
|
|
69236
|
+
} catch (error2) {
|
|
69237
|
+
delete task.report;
|
|
69238
|
+
throw error2;
|
|
69239
|
+
}
|
|
69240
|
+
const operation = Promise.resolve().then(async () => {
|
|
69241
|
+
try {
|
|
69242
|
+
const result = await this.execute({
|
|
69243
|
+
action: "issue.report",
|
|
69244
|
+
project: project.path,
|
|
69245
|
+
reportContext: consoleReportContext(described, project.path),
|
|
69246
|
+
onOutput: () => {
|
|
69247
|
+
}
|
|
69248
|
+
});
|
|
69249
|
+
const created = result.ok && result.status === "created" && typeof result.issue_url === "string" && /^https:\/\/github\.com\/taptap\/instant-games-open-mcp\/issues\/\d+$/.test(
|
|
69250
|
+
result.issue_url
|
|
69251
|
+
);
|
|
69252
|
+
task.report = created ? { status: "created", issue_url: result.issue_url } : { status: result.unknown ? "unknown" : "unavailable" };
|
|
69253
|
+
} catch {
|
|
69254
|
+
task.report = { status: "unknown" };
|
|
69255
|
+
} finally {
|
|
69256
|
+
this.onSettled();
|
|
69257
|
+
try {
|
|
69258
|
+
this.persist();
|
|
69259
|
+
} catch {
|
|
69260
|
+
}
|
|
69261
|
+
}
|
|
69262
|
+
});
|
|
69263
|
+
this.running.add(operation);
|
|
69264
|
+
void operation.finally(() => this.running.delete(operation)).catch(() => {
|
|
69265
|
+
});
|
|
69266
|
+
return this.describe(task);
|
|
69267
|
+
}
|
|
69268
|
+
recordFailure(key, action, error2) {
|
|
69269
|
+
if (!CONSOLE_ACTIONS.includes(action)) throw new ConsoleError("Unsupported console action.");
|
|
69270
|
+
const project = this.projects.resolve(key);
|
|
69271
|
+
const task = {
|
|
69272
|
+
id: randomUUID7(),
|
|
69273
|
+
projectKey: key,
|
|
69274
|
+
projectName: project.name,
|
|
69275
|
+
projectPath: project.path,
|
|
69276
|
+
projectid: project.projectid,
|
|
69277
|
+
action,
|
|
69278
|
+
status: "failed",
|
|
69279
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
69280
|
+
finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
69281
|
+
output: "",
|
|
69282
|
+
error: String(sanitizeDiagnosticValue(error2)).slice(0, 8192)
|
|
69283
|
+
};
|
|
69284
|
+
this.tasks.set(task.id, task);
|
|
69285
|
+
try {
|
|
69286
|
+
this.persist();
|
|
69287
|
+
} catch (error3) {
|
|
69288
|
+
this.tasks.delete(task.id);
|
|
69289
|
+
throw error3;
|
|
69290
|
+
}
|
|
69291
|
+
return this.describe(task);
|
|
68757
69292
|
}
|
|
68758
69293
|
start(key, action, confirmedOrientation, publication, confirmedBuild, sourceTaskId) {
|
|
68759
69294
|
var _a3;
|
|
@@ -68843,7 +69378,9 @@ var ConsoleTasks = class {
|
|
|
68843
69378
|
} catch (error2) {
|
|
68844
69379
|
task.status = "failed";
|
|
68845
69380
|
task.error = String(
|
|
68846
|
-
sanitizeDiagnosticValue(
|
|
69381
|
+
sanitizeDiagnosticValue(
|
|
69382
|
+
error2 instanceof Error ? error2.message : "Unexpected console task error."
|
|
69383
|
+
)
|
|
68847
69384
|
).slice(0, 8192);
|
|
68848
69385
|
} finally {
|
|
68849
69386
|
task.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -68868,7 +69405,10 @@ var ConsoleTasks = class {
|
|
|
68868
69405
|
if (this.historyFile) {
|
|
68869
69406
|
fs38.mkdirSync(path39.dirname(this.historyFile), { recursive: true, mode: 448 });
|
|
68870
69407
|
while (Buffer.byteLength(JSON.stringify(Array.from(this.tasks.values()))) > 40 * 1024 * 1024) {
|
|
68871
|
-
const oldest = this.list().reverse().find((task) =>
|
|
69408
|
+
const oldest = this.list().reverse().find((task) => {
|
|
69409
|
+
var _a3;
|
|
69410
|
+
return task.status !== "running" && ((_a3 = task.report) == null ? void 0 : _a3.status) !== "running";
|
|
69411
|
+
});
|
|
68872
69412
|
if (!oldest) throw new ConsoleError("Active console history exceeds the supported size.");
|
|
68873
69413
|
this.tasks.delete(oldest.id);
|
|
68874
69414
|
}
|
|
@@ -69510,7 +70050,7 @@ var ConsoleUpdates = class {
|
|
|
69510
70050
|
// src/maker/console/documents.ts
|
|
69511
70051
|
import fs42 from "node:fs";
|
|
69512
70052
|
import path43 from "node:path";
|
|
69513
|
-
import { createHash as
|
|
70053
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
69514
70054
|
|
|
69515
70055
|
// node_modules/marked/lib/marked.esm.js
|
|
69516
70056
|
function _getDefaults() {
|
|
@@ -71656,7 +72196,7 @@ var ConsoleDocuments = class {
|
|
|
71656
72196
|
const heading = (_b = (_a3 = content.match(/^#\s+(.+)$/m)) == null ? void 0 : _a3[1]) == null ? void 0 : _b.trim();
|
|
71657
72197
|
const fallback = path43.basename(filename2).toLowerCase() === "skill.md" ? path43.basename(path43.dirname(filename2)) : path43.basename(filename2, path43.extname(filename2));
|
|
71658
72198
|
entries.push({
|
|
71659
|
-
id:
|
|
72199
|
+
id: createHash7("sha256").update(source + ":" + relativePath).digest("hex"),
|
|
71660
72200
|
title: (heading || fallback).slice(0, 160),
|
|
71661
72201
|
kind,
|
|
71662
72202
|
category,
|
|
@@ -71935,8 +72475,8 @@ async function startConsoleServer(options3) {
|
|
|
71935
72475
|
readers.delete(pending);
|
|
71936
72476
|
}
|
|
71937
72477
|
}
|
|
71938
|
-
const scriptHashes = [...options3.html.matchAll(/<script>([\s\S]*?)<\/script>/
|
|
71939
|
-
(match) => `'sha256-${
|
|
72478
|
+
const scriptHashes = [...options3.html.matchAll(/<script>([\s\S]*?)<\/script>/gi)].map(
|
|
72479
|
+
(match) => `'sha256-${createHash8("sha256").update(match[1]).digest("base64")}'`
|
|
71940
72480
|
);
|
|
71941
72481
|
const server = http3.createServer(async (request2, response) => {
|
|
71942
72482
|
const json2 = (status, value) => {
|
|
@@ -72072,14 +72612,30 @@ async function startConsoleServer(options3) {
|
|
|
72072
72612
|
json2(202, task2);
|
|
72073
72613
|
return;
|
|
72074
72614
|
}
|
|
72615
|
+
if (request2.method === "POST" && url2.pathname === "/api/tasks/failure") {
|
|
72616
|
+
const body = await bodyForMutation();
|
|
72617
|
+
if (typeof body.projectKey !== "string" || typeof body.action !== "string" || typeof body.error !== "string")
|
|
72618
|
+
throw new ConsoleError("Project, action, and error are required.");
|
|
72619
|
+
const task2 = tasks.recordFailure(body.projectKey, body.action, body.error);
|
|
72620
|
+
touch();
|
|
72621
|
+
json2(202, task2);
|
|
72622
|
+
return;
|
|
72623
|
+
}
|
|
72075
72624
|
if (request2.method === "POST" && url2.pathname === "/api/shutdown") {
|
|
72076
72625
|
await bodyForMutation();
|
|
72077
|
-
if (selectingFolder || updates.job.status === "running" || tasks.
|
|
72626
|
+
if (selectingFolder || updates.job.status === "running" || tasks.active)
|
|
72078
72627
|
throw new ConsoleError("Wait for active tasks before stopping the console.", 409);
|
|
72079
72628
|
json2(200, { ok: true });
|
|
72080
72629
|
setImmediate(() => void close());
|
|
72081
72630
|
return;
|
|
72082
72631
|
}
|
|
72632
|
+
const report = url2.pathname.match(/^\/api\/tasks\/([a-f0-9-]+)\/report$/);
|
|
72633
|
+
if (request2.method === "POST" && report) {
|
|
72634
|
+
const body = await bodyForMutation();
|
|
72635
|
+
json2(202, tasks.report(report[1], body.consent));
|
|
72636
|
+
touch();
|
|
72637
|
+
return;
|
|
72638
|
+
}
|
|
72083
72639
|
const task = url2.pathname.match(/^\/api\/tasks\/([a-f0-9-]+)$/);
|
|
72084
72640
|
if (request2.method === "GET" && task) {
|
|
72085
72641
|
json2(200, tasks.get(task[1]));
|
|
@@ -72150,7 +72706,9 @@ async function startConsoleServer(options3) {
|
|
|
72150
72706
|
} catch (error2) {
|
|
72151
72707
|
if (!response.headersSent)
|
|
72152
72708
|
json2(error2 instanceof ConsoleError ? error2.status : 400, {
|
|
72153
|
-
error: sanitizeDiagnosticValue(
|
|
72709
|
+
error: sanitizeDiagnosticValue(
|
|
72710
|
+
error2 instanceof Error ? error2.message : "Unexpected console error."
|
|
72711
|
+
)
|
|
72154
72712
|
});
|
|
72155
72713
|
}
|
|
72156
72714
|
});
|
|
@@ -72174,7 +72732,7 @@ async function startConsoleServer(options3) {
|
|
|
72174
72732
|
origin = `http://127.0.0.1:${address.port}`;
|
|
72175
72733
|
const idleTimer = setInterval(
|
|
72176
72734
|
() => {
|
|
72177
|
-
if (now() - lastActivity >= idleMs && !selectingFolder && updates.job.status !== "running" && !tasks.
|
|
72735
|
+
if (now() - lastActivity >= idleMs && !selectingFolder && updates.job.status !== "running" && !tasks.active && !plugins.active)
|
|
72178
72736
|
void close();
|
|
72179
72737
|
},
|
|
72180
72738
|
Math.min(3e4, idleMs)
|
|
@@ -72234,7 +72792,7 @@ async function readBody(request2) {
|
|
|
72234
72792
|
}
|
|
72235
72793
|
|
|
72236
72794
|
// src/maker/console/cli.ts
|
|
72237
|
-
var VERSION3 = false ? "dev" : "0.0.34-beta.
|
|
72795
|
+
var VERSION3 = false ? "dev" : "0.0.34-beta.7";
|
|
72238
72796
|
var CONSOLE_PROTOCOL_VERSION = 2;
|
|
72239
72797
|
function home() {
|
|
72240
72798
|
return path46.join(getMakerHome(), "console");
|
|
@@ -72243,7 +72801,7 @@ function sessionPath() {
|
|
|
72243
72801
|
return path46.join(home(), "session.json");
|
|
72244
72802
|
}
|
|
72245
72803
|
function createConsoleLauncherIdentity(version2, developmentSource) {
|
|
72246
|
-
return
|
|
72804
|
+
return createHash9("sha256").update(
|
|
72247
72805
|
JSON.stringify({
|
|
72248
72806
|
protocol: CONSOLE_PROTOCOL_VERSION,
|
|
72249
72807
|
version: version2,
|
|
@@ -72842,14 +73400,14 @@ init_identify();
|
|
|
72842
73400
|
init_pluginDistribution();
|
|
72843
73401
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
72844
73402
|
import fs46 from "node:fs";
|
|
72845
|
-
import
|
|
73403
|
+
import os9 from "node:os";
|
|
72846
73404
|
import path48 from "node:path";
|
|
72847
73405
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
72848
73406
|
|
|
72849
73407
|
// src/maker/cli/dshMcpConfig.ts
|
|
72850
73408
|
var import_yaml = __toESM(require_dist2());
|
|
72851
73409
|
import fs45 from "node:fs";
|
|
72852
|
-
import
|
|
73410
|
+
import os8 from "node:os";
|
|
72853
73411
|
import path47 from "node:path";
|
|
72854
73412
|
var DSH_MCP_PLUGIN_NAME = "@deepseek-ai/dsh-mcp-client";
|
|
72855
73413
|
var DSH_MAKER_PLUGIN_ID = "mcp-taptap-maker";
|
|
@@ -72858,10 +73416,10 @@ function getDshHome(options3 = {}) {
|
|
|
72858
73416
|
var _a3;
|
|
72859
73417
|
const configured = (_a3 = (options3.environment || process.env).DSH_HOME) == null ? void 0 : _a3.trim();
|
|
72860
73418
|
if (configured) {
|
|
72861
|
-
const expanded = configured === "~" ? options3.homeDir ||
|
|
73419
|
+
const expanded = configured === "~" ? options3.homeDir || os8.homedir() : configured.startsWith("~/") || configured.startsWith("~\\") ? path47.join(options3.homeDir || os8.homedir(), configured.slice(2)) : configured;
|
|
72862
73420
|
return path47.resolve(expanded);
|
|
72863
73421
|
}
|
|
72864
|
-
return path47.join(options3.homeDir ||
|
|
73422
|
+
return path47.join(options3.homeDir || os8.homedir(), ".dsh");
|
|
72865
73423
|
}
|
|
72866
73424
|
function createDshMakerPluginConfig(options3) {
|
|
72867
73425
|
return {
|
|
@@ -73086,6 +73644,12 @@ function deepEqual(left, right) {
|
|
|
73086
73644
|
var MAKER_MCP_NAME = "taptap-maker";
|
|
73087
73645
|
var GITHUB_REPOSITORY = "taptap/instant-games-open-mcp";
|
|
73088
73646
|
var GITHUB_NEW_ISSUE_URL = `https://github.com/${GITHUB_REPOSITORY}/issues/new`;
|
|
73647
|
+
var MAKER_ISSUE_CATEGORIES = {
|
|
73648
|
+
mcp: "Maker MCP",
|
|
73649
|
+
console: "控制台",
|
|
73650
|
+
runtime: "UrhoX Runtime",
|
|
73651
|
+
build: "构建"
|
|
73652
|
+
};
|
|
73089
73653
|
function parseMakerMcpReportContext(input2) {
|
|
73090
73654
|
const trimmed = input2.trim();
|
|
73091
73655
|
if (!trimmed) {
|
|
@@ -73194,16 +73758,17 @@ function buildMakerMcpIssue(options3) {
|
|
|
73194
73758
|
options3.homeDir
|
|
73195
73759
|
);
|
|
73196
73760
|
const summary = stripControlCharacters(sanitizePublicText(context.summary, options3.homeDir)).replace(/\s+/gu, " ").trim() || "Maker MCP problem report";
|
|
73197
|
-
const
|
|
73761
|
+
const category = context.category && Object.prototype.hasOwnProperty.call(MAKER_ISSUE_CATEGORIES, context.category) ? MAKER_ISSUE_CATEGORIES[context.category] : MAKER_ISSUE_CATEGORIES.mcp;
|
|
73762
|
+
const title = `[${category}] ${summary}`.slice(0, 120);
|
|
73198
73763
|
const body = [
|
|
73199
73764
|
"<!-- maker-mcp-auto-report -->",
|
|
73200
|
-
"> 由 TapTap Maker AI 故障上报流程自动生成;凭证和用户主目录已经脱敏。",
|
|
73765
|
+
context.source === "console" ? "> 由 TapTap Maker 控制台故障上报流程自动生成;凭证和用户主目录已经脱敏。" : "> 由 TapTap Maker AI 故障上报流程自动生成;凭证和用户主目录已经脱敏。",
|
|
73201
73766
|
"",
|
|
73202
73767
|
"## 问题摘要",
|
|
73203
73768
|
"",
|
|
73204
73769
|
summary,
|
|
73205
73770
|
"",
|
|
73206
|
-
"## AI 会话与错误上下文",
|
|
73771
|
+
context.source === "console" ? "## 控制台操作与错误上下文" : "## AI 会话与错误上下文",
|
|
73207
73772
|
"",
|
|
73208
73773
|
fencedJson(context, 24e3),
|
|
73209
73774
|
"",
|
|
@@ -73221,7 +73786,7 @@ function buildMakerMcpIssue(options3) {
|
|
|
73221
73786
|
async function collectMakerMcpIssueDiagnostics(options3) {
|
|
73222
73787
|
var _a3, _b;
|
|
73223
73788
|
const platform = options3.platform || process.platform;
|
|
73224
|
-
const homeDir = options3.homeDir ||
|
|
73789
|
+
const homeDir = options3.homeDir || os9.homedir();
|
|
73225
73790
|
const processCwd = path48.resolve(options3.processCwd || process.cwd());
|
|
73226
73791
|
const targetDir = path48.resolve(options3.targetDir);
|
|
73227
73792
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
@@ -73714,6 +74279,9 @@ function pickMakerMcpReportContext(parsed) {
|
|
|
73714
74279
|
const context = {
|
|
73715
74280
|
summary: typeof parsed.summary === "string" && parsed.summary.trim() ? parsed.summary.trim() : "Maker MCP problem report"
|
|
73716
74281
|
};
|
|
74282
|
+
if (typeof parsed.category === "string" && Object.prototype.hasOwnProperty.call(MAKER_ISSUE_CATEGORIES, parsed.category))
|
|
74283
|
+
context.category = parsed.category;
|
|
74284
|
+
if (parsed.source === "console") context.source = "console";
|
|
73717
74285
|
for (const key of [
|
|
73718
74286
|
"error_message",
|
|
73719
74287
|
"failed_operation",
|
|
@@ -73780,7 +74348,7 @@ function stripControlCharacters(value) {
|
|
|
73780
74348
|
// src/maker/cli/pluginMigration.ts
|
|
73781
74349
|
init_storage();
|
|
73782
74350
|
import fs48 from "node:fs";
|
|
73783
|
-
import
|
|
74351
|
+
import os10 from "node:os";
|
|
73784
74352
|
import path50 from "node:path";
|
|
73785
74353
|
import crypto3 from "node:crypto";
|
|
73786
74354
|
|
|
@@ -74017,7 +74585,7 @@ function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate2)
|
|
|
74017
74585
|
|
|
74018
74586
|
// src/maker/cli/pluginMigration.ts
|
|
74019
74587
|
function inspectCodexLegacyMakerMcp(options3 = {}) {
|
|
74020
|
-
const configPath = options3.configPath ?? path50.join(
|
|
74588
|
+
const configPath = options3.configPath ?? path50.join(os10.homedir(), ".codex", "config.toml");
|
|
74021
74589
|
if (!fs48.existsSync(configPath)) {
|
|
74022
74590
|
return createInspection(configPath, "not_found", 0);
|
|
74023
74591
|
}
|
|
@@ -74036,7 +74604,7 @@ function inspectCodexLegacyMakerMcp(options3 = {}) {
|
|
|
74036
74604
|
};
|
|
74037
74605
|
}
|
|
74038
74606
|
function migrateCodexLegacyMakerMcp(options3 = {}) {
|
|
74039
|
-
const configPath = options3.configPath ?? path50.join(
|
|
74607
|
+
const configPath = options3.configPath ?? path50.join(os10.homedir(), ".codex", "config.toml");
|
|
74040
74608
|
const makerHome = options3.makerHome ?? getMakerHome();
|
|
74041
74609
|
const statePath = getCodexPluginMigrationStatePath(makerHome);
|
|
74042
74610
|
const inspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
@@ -74095,7 +74663,7 @@ function migrateCodexLegacyMakerMcp(options3 = {}) {
|
|
|
74095
74663
|
};
|
|
74096
74664
|
}
|
|
74097
74665
|
function restoreCodexLegacyMakerMcp(options3 = {}) {
|
|
74098
|
-
const configPath = options3.configPath ?? path50.join(
|
|
74666
|
+
const configPath = options3.configPath ?? path50.join(os10.homedir(), ".codex", "config.toml");
|
|
74099
74667
|
const makerHome = options3.makerHome ?? getMakerHome();
|
|
74100
74668
|
const statePath = getCodexPluginMigrationStatePath(makerHome);
|
|
74101
74669
|
const inspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
@@ -74412,8 +74980,8 @@ function restoreWorkBuddyLegacyMakerMcp(options3 = {}) {
|
|
|
74412
74980
|
}
|
|
74413
74981
|
function getWorkBuddyConfigPaths(configPaths) {
|
|
74414
74982
|
return configPaths ?? [
|
|
74415
|
-
path50.join(
|
|
74416
|
-
path50.join(
|
|
74983
|
+
path50.join(os10.homedir(), ".workbuddy", "mcp.json"),
|
|
74984
|
+
path50.join(os10.homedir(), ".workbuddy", ".mcp.json")
|
|
74417
74985
|
];
|
|
74418
74986
|
}
|
|
74419
74987
|
function findWorkBuddyMakerRegistrations(configPaths) {
|
|
@@ -74492,7 +75060,7 @@ function isRecord5(value) {
|
|
|
74492
75060
|
var import_yaml2 = __toESM(require_dist2());
|
|
74493
75061
|
init_storage();
|
|
74494
75062
|
import fs49 from "node:fs";
|
|
74495
|
-
import
|
|
75063
|
+
import os11 from "node:os";
|
|
74496
75064
|
import path51 from "node:path";
|
|
74497
75065
|
import crypto4 from "node:crypto";
|
|
74498
75066
|
var DSH_MAKER_MCP_NAME = "taptap-maker";
|
|
@@ -74611,7 +75179,7 @@ function restoreDshLegacyMakerMcp(options3 = {}) {
|
|
|
74611
75179
|
}
|
|
74612
75180
|
function findDshMakerRegistrations(dshHome) {
|
|
74613
75181
|
const resolvedDshHome = dshHome || getDshHome();
|
|
74614
|
-
const configPaths = listDshMcpConfigPaths({ homeDir:
|
|
75182
|
+
const configPaths = listDshMcpConfigPaths({ homeDir: os11.homedir(), dshHome: resolvedDshHome });
|
|
74615
75183
|
const registrations = [];
|
|
74616
75184
|
for (const configPath of configPaths) {
|
|
74617
75185
|
if (!fs49.existsSync(configPath)) {
|
|
@@ -74751,7 +75319,7 @@ init_fetchTimeout();
|
|
|
74751
75319
|
init_identify();
|
|
74752
75320
|
init_storage();
|
|
74753
75321
|
import fs50 from "node:fs";
|
|
74754
|
-
import
|
|
75322
|
+
import os12 from "node:os";
|
|
74755
75323
|
import path52 from "node:path";
|
|
74756
75324
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
74757
75325
|
import { Readable, Transform } from "node:stream";
|
|
@@ -74775,7 +75343,7 @@ async function pullMakerUserSkills(options3 = {}) {
|
|
|
74775
75343
|
throw new Error("Maker authentication not found. Run `taptap-maker login` and try again.");
|
|
74776
75344
|
}
|
|
74777
75345
|
const sourceDir = path52.join(project.projectRoot, ".installer", "skills");
|
|
74778
|
-
const tempDir = fs50.mkdtempSync(path52.join(
|
|
75346
|
+
const tempDir = fs50.mkdtempSync(path52.join(os12.tmpdir(), "taptap-maker-user-skills-"));
|
|
74779
75347
|
const archivePath = path52.join(tempDir, "user-skills.zip");
|
|
74780
75348
|
const stagingDir = path52.join(tempDir, "skills");
|
|
74781
75349
|
try {
|
|
@@ -74974,10 +75542,10 @@ function installUserSkills(projectRoot, stagingDir, skillNames) {
|
|
|
74974
75542
|
if (rollbackErrors.length > 0) {
|
|
74975
75543
|
preserveTransaction = true;
|
|
74976
75544
|
throw new Error(
|
|
74977
|
-
`Failed to install Maker user Skills: ${
|
|
75545
|
+
`Failed to install Maker user Skills: ${formatError5(error2)}; rollback incomplete, backups were preserved at ${transactionDir}: ${rollbackErrors.join("; ")}`
|
|
74978
75546
|
);
|
|
74979
75547
|
}
|
|
74980
|
-
throw new Error(`Failed to install Maker user Skills: ${
|
|
75548
|
+
throw new Error(`Failed to install Maker user Skills: ${formatError5(error2)}`);
|
|
74981
75549
|
} finally {
|
|
74982
75550
|
if (!preserveTransaction) {
|
|
74983
75551
|
fs50.rmSync(transactionDir, { recursive: true, force: true });
|
|
@@ -75019,10 +75587,10 @@ function installUserSkillsForClients(projectRoot, skillNames) {
|
|
|
75019
75587
|
if (rollbackErrors.length > 0) {
|
|
75020
75588
|
preserveTransaction = true;
|
|
75021
75589
|
throw new Error(
|
|
75022
|
-
`Failed to install Maker user Skills for AI clients: ${
|
|
75590
|
+
`Failed to install Maker user Skills for AI clients: ${formatError5(error2)}; rollback incomplete, backups were preserved at ${transactionDir}: ` + rollbackErrors.join("; ")
|
|
75023
75591
|
);
|
|
75024
75592
|
}
|
|
75025
|
-
throw new Error(`Failed to install Maker user Skills for AI clients: ${
|
|
75593
|
+
throw new Error(`Failed to install Maker user Skills for AI clients: ${formatError5(error2)}`);
|
|
75026
75594
|
} finally {
|
|
75027
75595
|
if (!preserveTransaction) {
|
|
75028
75596
|
fs50.rmSync(transactionDir, { recursive: true, force: true });
|
|
@@ -75039,7 +75607,7 @@ function rollbackSkillChanges(changes) {
|
|
|
75039
75607
|
fs50.renameSync(item.backup, item.target);
|
|
75040
75608
|
}
|
|
75041
75609
|
} catch (error2) {
|
|
75042
|
-
errors.push(`${item.target}: ${
|
|
75610
|
+
errors.push(`${item.target}: ${formatError5(error2)}`);
|
|
75043
75611
|
}
|
|
75044
75612
|
}
|
|
75045
75613
|
return errors;
|
|
@@ -75054,7 +75622,7 @@ function linkOrCopySkill(source, target) {
|
|
|
75054
75622
|
fs50.cpSync(source, target, { recursive: true });
|
|
75055
75623
|
} catch (copyError) {
|
|
75056
75624
|
throw new Error(
|
|
75057
|
-
`Failed to link ${source}: ${
|
|
75625
|
+
`Failed to link ${source}: ${formatError5(linkError)}; copy fallback: ${formatError5(copyError)}`
|
|
75058
75626
|
);
|
|
75059
75627
|
}
|
|
75060
75628
|
}
|
|
@@ -75097,7 +75665,7 @@ function pathExists(value) {
|
|
|
75097
75665
|
return false;
|
|
75098
75666
|
}
|
|
75099
75667
|
}
|
|
75100
|
-
function
|
|
75668
|
+
function formatError5(error2) {
|
|
75101
75669
|
return error2 instanceof Error ? error2.message : String(error2);
|
|
75102
75670
|
}
|
|
75103
75671
|
function hasControlCharacter(value) {
|
|
@@ -75108,7 +75676,7 @@ function hasControlCharacter(value) {
|
|
|
75108
75676
|
}
|
|
75109
75677
|
|
|
75110
75678
|
// src/maker/cli/commands.ts
|
|
75111
|
-
var VERSION4 = true ? "0.0.34-beta.
|
|
75679
|
+
var VERSION4 = true ? "0.0.34-beta.7" : "dev";
|
|
75112
75680
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
75113
75681
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
75114
75682
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -76125,17 +76693,18 @@ async function runMcpReport(parsed, ctx) {
|
|
|
76125
76693
|
);
|
|
76126
76694
|
return;
|
|
76127
76695
|
}
|
|
76128
|
-
const reportRuntime = resolveMakerMcpReportRuntime({
|
|
76696
|
+
const reportRuntime = context.source === "console" ? void 0 : resolveMakerMcpReportRuntime({
|
|
76129
76697
|
distribution: process.env.TAPTAP_MAKER_DISTRIBUTION,
|
|
76130
76698
|
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : void 0
|
|
76131
76699
|
});
|
|
76132
76700
|
const diagnostics = await collectMakerMcpIssueDiagnostics({
|
|
76133
|
-
ide: stringOption(parsed, "ide") || (reportRuntime == null ? void 0 : reportRuntime.client),
|
|
76701
|
+
ide: context.source === "console" ? void 0 : stringOption(parsed, "ide") || (reportRuntime == null ? void 0 : reportRuntime.client),
|
|
76134
76702
|
targetDir,
|
|
76135
76703
|
makerVersion: VERSION4,
|
|
76136
76704
|
configSource: reportRuntime == null ? void 0 : reportRuntime.config_source,
|
|
76137
|
-
distribution: reportRuntime == null ? void 0 : reportRuntime.distribution,
|
|
76705
|
+
distribution: process.env.TAPTAP_MAKER_DISTRIBUTION || (reportRuntime == null ? void 0 : reportRuntime.distribution),
|
|
76138
76706
|
verify: async () => {
|
|
76707
|
+
if (context.source === "console") return { status: "not_applicable" };
|
|
76139
76708
|
if (reportRuntime) {
|
|
76140
76709
|
const verification = await verifyMakerMcpLauncher(reportRuntime.launcher, {
|
|
76141
76710
|
cwd: reportRuntime.cwd,
|
|
@@ -76175,7 +76744,7 @@ async function runMcpReport(parsed, ctx) {
|
|
|
76175
76744
|
const issue3 = buildMakerMcpIssue({
|
|
76176
76745
|
context,
|
|
76177
76746
|
diagnostics,
|
|
76178
|
-
homeDir:
|
|
76747
|
+
homeDir: os13.homedir()
|
|
76179
76748
|
});
|
|
76180
76749
|
const submission = booleanOption(parsed, "consent") ? submitMakerMcpIssue(issue3) : {
|
|
76181
76750
|
status: "consent_required",
|
|
@@ -76740,12 +77309,12 @@ function installMcpConfig(ide, options3) {
|
|
|
76740
77309
|
}
|
|
76741
77310
|
function installMcpConfigUnsafe(ide, options3) {
|
|
76742
77311
|
if (ide === "codex") {
|
|
76743
|
-
const configPath = path53.join(
|
|
77312
|
+
const configPath = path53.join(os13.homedir(), ".codex", "config.toml");
|
|
76744
77313
|
const write = mergeCodexMcpConfig(configPath, withClientIde(options3, "codex"));
|
|
76745
77314
|
return [createMcpInstallResult(ide, "Codex", configPath, write)];
|
|
76746
77315
|
}
|
|
76747
77316
|
if (ide === "cursor") {
|
|
76748
|
-
const configPath = path53.join(
|
|
77317
|
+
const configPath = path53.join(os13.homedir(), ".cursor", "mcp.json");
|
|
76749
77318
|
const write = mergeJsonMcpConfig(configPath, withClientIde(options3, "cursor"));
|
|
76750
77319
|
return [createMcpInstallResult(ide, "Cursor", configPath, write)];
|
|
76751
77320
|
}
|
|
@@ -76762,7 +77331,7 @@ function installMcpConfigUnsafe(ide, options3) {
|
|
|
76762
77331
|
}
|
|
76763
77332
|
];
|
|
76764
77333
|
}
|
|
76765
|
-
const configPath = path53.join(
|
|
77334
|
+
const configPath = path53.join(os13.homedir(), ".claude.json");
|
|
76766
77335
|
const write = mergeJsonMcpConfig(configPath, claudeOptions);
|
|
76767
77336
|
return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
|
|
76768
77337
|
}
|
|
@@ -76903,13 +77472,13 @@ function normalizeConfigPathKey(configPath) {
|
|
|
76903
77472
|
}
|
|
76904
77473
|
function getTraeSoloMcpConfigPaths() {
|
|
76905
77474
|
if (process.platform === "win32") {
|
|
76906
|
-
const roaming = process.env.APPDATA || path53.join(
|
|
77475
|
+
const roaming = process.env.APPDATA || path53.join(os13.homedir(), "AppData", "Roaming");
|
|
76907
77476
|
return [
|
|
76908
77477
|
path53.join(roaming, "TRAE SOLO", "User", "mcp.json"),
|
|
76909
77478
|
path53.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
|
|
76910
77479
|
];
|
|
76911
77480
|
}
|
|
76912
|
-
const appSupport = path53.join(
|
|
77481
|
+
const appSupport = path53.join(os13.homedir(), "Library", "Application Support");
|
|
76913
77482
|
return [
|
|
76914
77483
|
path53.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
|
|
76915
77484
|
path53.join(appSupport, "TRAE SOLO", "User", "mcp.json")
|
|
@@ -76917,14 +77486,14 @@ function getTraeSoloMcpConfigPaths() {
|
|
|
76917
77486
|
}
|
|
76918
77487
|
function getTraeUnverifiedMcpConfigPaths() {
|
|
76919
77488
|
if (process.platform === "win32") {
|
|
76920
|
-
const roaming = process.env.APPDATA || path53.join(
|
|
77489
|
+
const roaming = process.env.APPDATA || path53.join(os13.homedir(), "AppData", "Roaming");
|
|
76921
77490
|
return [
|
|
76922
77491
|
path53.join(roaming, "Trae", "User", "mcp.json"),
|
|
76923
77492
|
path53.join(roaming, "TRAE", "User", "mcp.json"),
|
|
76924
77493
|
path53.join(roaming, "Trae CN", "User", "mcp.json")
|
|
76925
77494
|
];
|
|
76926
77495
|
}
|
|
76927
|
-
const appSupport = path53.join(
|
|
77496
|
+
const appSupport = path53.join(os13.homedir(), "Library", "Application Support");
|
|
76928
77497
|
return [
|
|
76929
77498
|
path53.join(appSupport, "Trae", "User", "mcp.json"),
|
|
76930
77499
|
path53.join(appSupport, "TRAE", "User", "mcp.json"),
|
|
@@ -76932,10 +77501,10 @@ function getTraeUnverifiedMcpConfigPaths() {
|
|
|
76932
77501
|
];
|
|
76933
77502
|
}
|
|
76934
77503
|
function getOpenCodeMcpConfigPath() {
|
|
76935
|
-
return path53.join(
|
|
77504
|
+
return path53.join(os13.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
76936
77505
|
}
|
|
76937
77506
|
function getWorkBuddyHome() {
|
|
76938
|
-
return path53.join(
|
|
77507
|
+
return path53.join(os13.homedir(), ".workbuddy");
|
|
76939
77508
|
}
|
|
76940
77509
|
function getWorkBuddyMcpInstallPaths(options3 = {}) {
|
|
76941
77510
|
const primary = path53.join(getWorkBuddyHome(), "mcp.json");
|
|
@@ -77113,7 +77682,7 @@ function mergeCodexMcpConfig(configPath, options3) {
|
|
|
77113
77682
|
);
|
|
77114
77683
|
}
|
|
77115
77684
|
function tryClaudeMcpAdd(options3) {
|
|
77116
|
-
const configPath = path53.join(
|
|
77685
|
+
const configPath = path53.join(os13.homedir(), ".claude.json");
|
|
77117
77686
|
try {
|
|
77118
77687
|
const existing = readJsonObject(configPath);
|
|
77119
77688
|
const server = asObject(asObject(existing.mcpServers)[options3.mcpName]);
|