@taptap/maker 0.0.17-beta.3 → 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 +51 -11
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/maker.js
CHANGED
|
@@ -28391,7 +28391,7 @@ 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/
|
|
28394
|
+
// src/core/utils/processLifecycle.ts
|
|
28395
28395
|
var DISCONNECTED_STDIO_CODES = /* @__PURE__ */ new Set([
|
|
28396
28396
|
"EPIPE",
|
|
28397
28397
|
"ERR_STREAM_DESTROYED",
|
|
@@ -28423,47 +28423,81 @@ function shouldExitForParentDeath(options) {
|
|
|
28423
28423
|
);
|
|
28424
28424
|
}
|
|
28425
28425
|
}
|
|
28426
|
-
function
|
|
28426
|
+
function installStdinExitHandler(options) {
|
|
28427
|
+
const stdin = options.stdin ?? process.stdin;
|
|
28428
|
+
const exit = options.exit ?? ((code) => process.exit(code));
|
|
28427
28429
|
let exiting = false;
|
|
28428
28430
|
const exitOnStdinClosed = () => {
|
|
28431
|
+
var _a3;
|
|
28429
28432
|
if (exiting) {
|
|
28430
28433
|
return;
|
|
28431
28434
|
}
|
|
28432
28435
|
exiting = true;
|
|
28433
|
-
|
|
28434
|
-
|
|
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();
|
|
28435
28442
|
exit(0);
|
|
28436
28443
|
};
|
|
28437
28444
|
stdin.once("end", exitOnStdinClosed);
|
|
28438
28445
|
stdin.once("close", exitOnStdinClosed);
|
|
28439
28446
|
}
|
|
28440
|
-
function installParentDeathWatchdog(
|
|
28447
|
+
function installParentDeathWatchdog(options) {
|
|
28441
28448
|
var _a3;
|
|
28442
28449
|
const initialPpid = options.initialPpid ?? process.ppid;
|
|
28443
28450
|
const getCurrentPpid = options.getCurrentPpid ?? (() => process.ppid);
|
|
28451
|
+
const platform = options.platform ?? process.platform;
|
|
28452
|
+
const probeParent = options.probeParent ?? (() => process.kill(initialPpid, 0));
|
|
28444
28453
|
const exit = options.exit ?? ((code) => process.exit(code));
|
|
28445
28454
|
let exiting = false;
|
|
28446
28455
|
const timer = setInterval(() => {
|
|
28456
|
+
var _a4;
|
|
28447
28457
|
if (exiting) {
|
|
28448
28458
|
return;
|
|
28449
28459
|
}
|
|
28450
28460
|
const shouldExit = shouldExitForParentDeath({
|
|
28451
28461
|
initialPpid,
|
|
28452
28462
|
currentPpid: getCurrentPpid(),
|
|
28453
|
-
platform
|
|
28454
|
-
probeParent
|
|
28463
|
+
platform,
|
|
28464
|
+
probeParent
|
|
28455
28465
|
});
|
|
28456
28466
|
if (!shouldExit) {
|
|
28457
28467
|
return;
|
|
28458
28468
|
}
|
|
28459
28469
|
exiting = true;
|
|
28460
|
-
|
|
28461
|
-
|
|
28470
|
+
(_a4 = options.log) == null ? void 0 : _a4.call(options, options.source, options.message);
|
|
28471
|
+
options.cleanup();
|
|
28462
28472
|
exit(0);
|
|
28463
28473
|
}, options.intervalMs ?? 15e3);
|
|
28464
28474
|
(_a3 = timer.unref) == null ? void 0 : _a3.call(timer);
|
|
28465
28475
|
return timer;
|
|
28466
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
|
+
}
|
|
28467
28501
|
function logLifecycleEvent(source, message) {
|
|
28468
28502
|
try {
|
|
28469
28503
|
appendMakerCrashLog(`lifecycle:${source}`, message);
|
|
@@ -33035,7 +33069,7 @@ function extensionFromUrl(url2) {
|
|
|
33035
33069
|
}
|
|
33036
33070
|
|
|
33037
33071
|
// src/maker/server/mcp.ts
|
|
33038
|
-
var VERSION = true ? "0.0.17-beta.
|
|
33072
|
+
var VERSION = true ? "0.0.17-beta.4" : "dev";
|
|
33039
33073
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
33040
33074
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
33041
33075
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -38612,6 +38646,12 @@ var TapTapMCPProxy = class {
|
|
|
38612
38646
|
`;
|
|
38613
38647
|
this.logWriter.writeSync(level, formattedMessage);
|
|
38614
38648
|
}
|
|
38649
|
+
logLifecycleEvent(source, message) {
|
|
38650
|
+
try {
|
|
38651
|
+
this.log("info", `lifecycle:${source}: ${message}`);
|
|
38652
|
+
} catch {
|
|
38653
|
+
}
|
|
38654
|
+
}
|
|
38615
38655
|
/**
|
|
38616
38656
|
* 启动 Proxy
|
|
38617
38657
|
*/
|
|
@@ -39228,7 +39268,7 @@ async function startEmbeddedProxy() {
|
|
|
39228
39268
|
process.exit(0);
|
|
39229
39269
|
};
|
|
39230
39270
|
installProxyStdinExitHandler(proxy);
|
|
39231
|
-
|
|
39271
|
+
installParentDeathWatchdog2(proxy);
|
|
39232
39272
|
process.on("SIGINT", () => cleanup("proxy-sigint"));
|
|
39233
39273
|
process.on("SIGTERM", () => cleanup("proxy-sigterm"));
|
|
39234
39274
|
}
|