@taptap/maker 0.0.17-beta.2 → 0.0.17-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/maker.js +82 -13
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/maker.js
CHANGED
|
@@ -28391,8 +28391,14 @@ function positiveInteger(value) {
|
|
|
28391
28391
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
|
|
28392
28392
|
}
|
|
28393
28393
|
|
|
28394
|
-
// src/
|
|
28395
|
-
var DISCONNECTED_STDIO_CODES = /* @__PURE__ */ new Set([
|
|
28394
|
+
// src/core/utils/processLifecycle.ts
|
|
28395
|
+
var DISCONNECTED_STDIO_CODES = /* @__PURE__ */ new Set([
|
|
28396
|
+
"EPIPE",
|
|
28397
|
+
"ERR_STREAM_DESTROYED",
|
|
28398
|
+
"ECONNRESET",
|
|
28399
|
+
"EIO",
|
|
28400
|
+
"ENXIO"
|
|
28401
|
+
]);
|
|
28396
28402
|
function isDisconnectedStdioError(error2) {
|
|
28397
28403
|
if (!error2 || typeof error2 !== "object") {
|
|
28398
28404
|
return false;
|
|
@@ -28417,47 +28423,81 @@ function shouldExitForParentDeath(options) {
|
|
|
28417
28423
|
);
|
|
28418
28424
|
}
|
|
28419
28425
|
}
|
|
28420
|
-
function
|
|
28426
|
+
function installStdinExitHandler(options) {
|
|
28427
|
+
const stdin = options.stdin ?? process.stdin;
|
|
28428
|
+
const exit = options.exit ?? ((code) => process.exit(code));
|
|
28421
28429
|
let exiting = false;
|
|
28422
28430
|
const exitOnStdinClosed = () => {
|
|
28431
|
+
var _a3;
|
|
28423
28432
|
if (exiting) {
|
|
28424
28433
|
return;
|
|
28425
28434
|
}
|
|
28426
28435
|
exiting = true;
|
|
28427
|
-
|
|
28428
|
-
|
|
28436
|
+
if (options.onClosed) {
|
|
28437
|
+
options.onClosed(options.source, options.message);
|
|
28438
|
+
return;
|
|
28439
|
+
}
|
|
28440
|
+
(_a3 = options.log) == null ? void 0 : _a3.call(options, options.source, options.message);
|
|
28441
|
+
options.cleanup();
|
|
28429
28442
|
exit(0);
|
|
28430
28443
|
};
|
|
28431
28444
|
stdin.once("end", exitOnStdinClosed);
|
|
28432
28445
|
stdin.once("close", exitOnStdinClosed);
|
|
28433
28446
|
}
|
|
28434
|
-
function installParentDeathWatchdog(
|
|
28447
|
+
function installParentDeathWatchdog(options) {
|
|
28435
28448
|
var _a3;
|
|
28436
28449
|
const initialPpid = options.initialPpid ?? process.ppid;
|
|
28437
28450
|
const getCurrentPpid = options.getCurrentPpid ?? (() => process.ppid);
|
|
28451
|
+
const platform = options.platform ?? process.platform;
|
|
28452
|
+
const probeParent = options.probeParent ?? (() => process.kill(initialPpid, 0));
|
|
28438
28453
|
const exit = options.exit ?? ((code) => process.exit(code));
|
|
28439
28454
|
let exiting = false;
|
|
28440
28455
|
const timer = setInterval(() => {
|
|
28456
|
+
var _a4;
|
|
28441
28457
|
if (exiting) {
|
|
28442
28458
|
return;
|
|
28443
28459
|
}
|
|
28444
28460
|
const shouldExit = shouldExitForParentDeath({
|
|
28445
28461
|
initialPpid,
|
|
28446
28462
|
currentPpid: getCurrentPpid(),
|
|
28447
|
-
platform
|
|
28448
|
-
probeParent
|
|
28463
|
+
platform,
|
|
28464
|
+
probeParent
|
|
28449
28465
|
});
|
|
28450
28466
|
if (!shouldExit) {
|
|
28451
28467
|
return;
|
|
28452
28468
|
}
|
|
28453
28469
|
exiting = true;
|
|
28454
|
-
|
|
28455
|
-
|
|
28470
|
+
(_a4 = options.log) == null ? void 0 : _a4.call(options, options.source, options.message);
|
|
28471
|
+
options.cleanup();
|
|
28456
28472
|
exit(0);
|
|
28457
28473
|
}, options.intervalMs ?? 15e3);
|
|
28458
28474
|
(_a3 = timer.unref) == null ? void 0 : _a3.call(timer);
|
|
28459
28475
|
return timer;
|
|
28460
28476
|
}
|
|
28477
|
+
|
|
28478
|
+
// src/maker/lifecycle.ts
|
|
28479
|
+
function installProxyStdinExitHandler(proxy, stdin = process.stdin, exit = (code) => process.exit(code)) {
|
|
28480
|
+
installStdinExitHandler({
|
|
28481
|
+
stdin,
|
|
28482
|
+
cleanup: () => proxy.cleanup(),
|
|
28483
|
+
exit,
|
|
28484
|
+
log: logLifecycleEvent,
|
|
28485
|
+
source: "proxy-stdin-closed",
|
|
28486
|
+
message: "Embedded Maker proxy stdin closed; exiting."
|
|
28487
|
+
});
|
|
28488
|
+
}
|
|
28489
|
+
function installParentDeathWatchdog2(proxy, options = {}) {
|
|
28490
|
+
return installParentDeathWatchdog({
|
|
28491
|
+
cleanup: () => proxy.cleanup(),
|
|
28492
|
+
exit: options.exit,
|
|
28493
|
+
log: logLifecycleEvent,
|
|
28494
|
+
source: "proxy-parent-dead",
|
|
28495
|
+
message: "Embedded Maker proxy parent process is gone; exiting.",
|
|
28496
|
+
intervalMs: options.intervalMs,
|
|
28497
|
+
initialPpid: options.initialPpid,
|
|
28498
|
+
getCurrentPpid: options.getCurrentPpid
|
|
28499
|
+
});
|
|
28500
|
+
}
|
|
28461
28501
|
function logLifecycleEvent(source, message) {
|
|
28462
28502
|
try {
|
|
28463
28503
|
appendMakerCrashLog(`lifecycle:${source}`, message);
|
|
@@ -33029,7 +33069,7 @@ function extensionFromUrl(url2) {
|
|
|
33029
33069
|
}
|
|
33030
33070
|
|
|
33031
33071
|
// src/maker/server/mcp.ts
|
|
33032
|
-
var VERSION = true ? "0.0.17-beta.
|
|
33072
|
+
var VERSION = true ? "0.0.17-beta.4" : "dev";
|
|
33033
33073
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
33034
33074
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
33035
33075
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -35085,6 +35125,10 @@ async function runMakerCli(argv) {
|
|
|
35085
35125
|
printHelp();
|
|
35086
35126
|
return;
|
|
35087
35127
|
}
|
|
35128
|
+
if (parsed.options.help || parsed.options.h) {
|
|
35129
|
+
printHelp();
|
|
35130
|
+
return;
|
|
35131
|
+
}
|
|
35088
35132
|
if (command === "init") {
|
|
35089
35133
|
await runInit(parsed, ctx);
|
|
35090
35134
|
return;
|
|
@@ -36463,13 +36507,22 @@ async function promptRequired(label) {
|
|
|
36463
36507
|
throw new Error(`${label} is required in non-interactive mode.`);
|
|
36464
36508
|
}
|
|
36465
36509
|
const rl = readline.createInterface({ input, output });
|
|
36510
|
+
let settled = false;
|
|
36511
|
+
const closed = new Promise((_, reject) => {
|
|
36512
|
+
rl.once("close", () => {
|
|
36513
|
+
if (!settled) {
|
|
36514
|
+
reject(new Error(`${label} input closed before a value was provided.`));
|
|
36515
|
+
}
|
|
36516
|
+
});
|
|
36517
|
+
});
|
|
36466
36518
|
try {
|
|
36467
|
-
const answer = await rl.question(`${label}: `);
|
|
36519
|
+
const answer = await Promise.race([rl.question(`${label}: `), closed]);
|
|
36468
36520
|
if (!answer.trim()) {
|
|
36469
36521
|
throw new Error(`${label} cannot be empty.`);
|
|
36470
36522
|
}
|
|
36471
36523
|
return answer.trim();
|
|
36472
36524
|
} finally {
|
|
36525
|
+
settled = true;
|
|
36473
36526
|
rl.close();
|
|
36474
36527
|
}
|
|
36475
36528
|
}
|
|
@@ -38593,6 +38646,12 @@ var TapTapMCPProxy = class {
|
|
|
38593
38646
|
`;
|
|
38594
38647
|
this.logWriter.writeSync(level, formattedMessage);
|
|
38595
38648
|
}
|
|
38649
|
+
logLifecycleEvent(source, message) {
|
|
38650
|
+
try {
|
|
38651
|
+
this.log("info", `lifecycle:${source}: ${message}`);
|
|
38652
|
+
} catch {
|
|
38653
|
+
}
|
|
38654
|
+
}
|
|
38596
38655
|
/**
|
|
38597
38656
|
* 启动 Proxy
|
|
38598
38657
|
*/
|
|
@@ -39209,7 +39268,7 @@ async function startEmbeddedProxy() {
|
|
|
39209
39268
|
process.exit(0);
|
|
39210
39269
|
};
|
|
39211
39270
|
installProxyStdinExitHandler(proxy);
|
|
39212
|
-
|
|
39271
|
+
installParentDeathWatchdog2(proxy);
|
|
39213
39272
|
process.on("SIGINT", () => cleanup("proxy-sigint"));
|
|
39214
39273
|
process.on("SIGTERM", () => cleanup("proxy-sigterm"));
|
|
39215
39274
|
}
|
|
@@ -39258,6 +39317,7 @@ main().catch((error2) => {
|
|
|
39258
39317
|
function installCrashLogging() {
|
|
39259
39318
|
installStdioErrorHandler(process.stdout, "stdout-error");
|
|
39260
39319
|
installStdioErrorHandler(process.stderr, "stderr-error");
|
|
39320
|
+
installStdinErrorHandler();
|
|
39261
39321
|
let handlingFatalError = false;
|
|
39262
39322
|
process.on("uncaughtException", (error2) => {
|
|
39263
39323
|
logCrash("uncaughtException", error2);
|
|
@@ -39300,6 +39360,15 @@ function installStdioErrorHandler(stream, source) {
|
|
|
39300
39360
|
}
|
|
39301
39361
|
});
|
|
39302
39362
|
}
|
|
39363
|
+
function installStdinErrorHandler() {
|
|
39364
|
+
process.stdin.on("error", (error2) => {
|
|
39365
|
+
logCrash("stdin-error", error2);
|
|
39366
|
+
if (isDisconnectedStdioError(error2)) {
|
|
39367
|
+
logLifecycleEvent("stdin-error-disconnected", "Maker stdin became unreadable; exiting.");
|
|
39368
|
+
process.exit(0);
|
|
39369
|
+
}
|
|
39370
|
+
});
|
|
39371
|
+
}
|
|
39303
39372
|
function safeWriteStderr(message) {
|
|
39304
39373
|
try {
|
|
39305
39374
|
process.stderr.write(message);
|