@rubytech/create-maxy-code 0.1.331 → 0.1.333
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/dist/__tests__/watchdog-deferred-arming.test.js +62 -0
- package/dist/index.js +82 -11
- package/package.json +1 -1
- package/payload/platform/lib/mcp-spawn-tee/dist/index.d.ts +24 -24
- package/payload/platform/lib/mcp-spawn-tee/dist/index.js +109 -75
- package/payload/platform/lib/mcp-spawn-tee/dist/index.js.map +1 -1
- package/payload/platform/lib/mcp-spawn-tee/src/__tests__/spawn-tee.test.ts +56 -19
- package/payload/platform/lib/mcp-spawn-tee/src/index.ts +112 -77
- package/payload/platform/neo4j/schema.cypher +58 -4
- package/payload/platform/plugins/admin/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/aeo/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/browser/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/contacts/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/group-create.test.d.ts +2 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/group-create.test.d.ts.map +1 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/group-create.test.js +112 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/group-create.test.js.map +1 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/group-manage.test.d.ts +2 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/group-manage.test.d.ts.map +1 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/group-manage.test.js +102 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/__tests__/group-manage.test.js.map +1 -0
- package/payload/platform/plugins/contacts/mcp/dist/tools/group-create.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/group-create.js +7 -2
- package/payload/platform/plugins/contacts/mcp/dist/tools/group-create.js.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/group-manage.d.ts.map +1 -1
- package/payload/platform/plugins/contacts/mcp/dist/tools/group-manage.js +5 -4
- package/payload/platform/plugins/contacts/mcp/dist/tools/group-manage.js.map +1 -1
- package/payload/platform/plugins/email/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/memory/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/memory/references/schema-estate-agent.md +17 -5
- package/payload/platform/plugins/outlook/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/quickbooks/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/replicate/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/scheduling/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/telegram/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/url-get/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/whatsapp/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/work/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/plugins/workflows/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/platform/scripts/seed-neo4j.sh +18 -0
- package/payload/premium-plugins/writer-craft/lib/mcp-spawn-tee/index.js +109 -75
- package/payload/server/server.js +291 -213
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Contract for the hardware watchdog arming point.
|
|
2
|
+
//
|
|
3
|
+
// On a constrained Pi the installer's `RuntimeWatchdogSec=20s` drop-in,
|
|
4
|
+
// armed at install step 1, reboot-looped its own install: the heavy npm/swap
|
|
5
|
+
// steps stalled PID1 past 20s, the board reset, the relaunch stalled again.
|
|
6
|
+
// The fix arms the watchdog only as the final install action, once the heavy
|
|
7
|
+
// build/swap window is over, and applies it via `daemon-reexec` so it is
|
|
8
|
+
// actually active (RuntimeWatchdogUSec non-zero) without waiting for a reboot.
|
|
9
|
+
//
|
|
10
|
+
// Static-grep, not behaviour: the call site and the apply command live in the
|
|
11
|
+
// top-level install flow of index.ts, which executes real sudo/systemctl.
|
|
12
|
+
// Same pattern as base-toolchain-deps.test.ts — read src/index.ts at runtime
|
|
13
|
+
// as the authoritative source.
|
|
14
|
+
import test from "node:test";
|
|
15
|
+
import assert from "node:assert/strict";
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
import { dirname, resolve } from "node:path";
|
|
19
|
+
// dist/__tests__/watchdog-deferred-arming.test.js → ../../src/index.ts
|
|
20
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const INDEX_TS = resolve(here, "../../src/index.ts");
|
|
22
|
+
const SRC = readFileSync(INDEX_TS, "utf-8");
|
|
23
|
+
/** Body of configureHardwareWatchdog(), up to the next top-level function. */
|
|
24
|
+
function watchdogFnBody() {
|
|
25
|
+
const start = SRC.indexOf("function configureHardwareWatchdog");
|
|
26
|
+
assert.ok(start >= 0, "could not locate configureHardwareWatchdog in index.ts");
|
|
27
|
+
const end = SRC.indexOf("function installSystemDeps", start);
|
|
28
|
+
assert.ok(end > start, "could not bound configureHardwareWatchdog body");
|
|
29
|
+
return SRC.slice(start, end);
|
|
30
|
+
}
|
|
31
|
+
test("watchdog is armed after buildPlatform and installService, not at step 1", () => {
|
|
32
|
+
const watchdogCall = SRC.indexOf("configureHardwareWatchdog();");
|
|
33
|
+
const build = SRC.indexOf("buildPlatform();");
|
|
34
|
+
const service = SRC.indexOf("installService();");
|
|
35
|
+
assert.ok(watchdogCall >= 0, "no configureHardwareWatchdog() call in the install flow");
|
|
36
|
+
assert.ok(build >= 0 && service >= 0, "expected buildPlatform()/installService() calls");
|
|
37
|
+
assert.ok(watchdogCall > build, "watchdog must be armed after buildPlatform()");
|
|
38
|
+
assert.ok(watchdogCall > service, "watchdog must be armed after installService()");
|
|
39
|
+
// the old step-1 placement (immediately after installSystemDeps()) is gone
|
|
40
|
+
assert.equal(SRC.includes("installSystemDeps();\n configureHardwareWatchdog();"), false, "watchdog must not be armed at step 1, right after installSystemDeps()");
|
|
41
|
+
});
|
|
42
|
+
test("watchdog drop-in is applied with daemon-reexec, not daemon-reload", () => {
|
|
43
|
+
const body = watchdogFnBody();
|
|
44
|
+
// match the quoted systemctl argument so explanatory comments naming the old
|
|
45
|
+
// command do not skew the assertion.
|
|
46
|
+
assert.ok(body.includes('"daemon-reexec"'), "configureHardwareWatchdog must apply via daemon-reexec");
|
|
47
|
+
assert.equal(body.includes('"daemon-reload"'), false, "daemon-reload does not apply RuntimeWatchdogSec");
|
|
48
|
+
});
|
|
49
|
+
test("idempotent re-run only skips re-arming when the watchdog is live-armed", () => {
|
|
50
|
+
// A drop-in on disk does not prove the live PID1 has the watchdog active
|
|
51
|
+
// (prior daemon-reload, or a just-removed disable override). The function must
|
|
52
|
+
// read RuntimeWatchdogUSec and re-arm when it is 0, so the muvin remediation
|
|
53
|
+
// (drop-in present, previously disabled) actually arms.
|
|
54
|
+
const body = watchdogFnBody();
|
|
55
|
+
assert.ok(body.includes("RuntimeWatchdogUSec"), "must read live RuntimeWatchdogUSec before skipping the arm");
|
|
56
|
+
assert.ok(body.includes('"--value"'), "must read the live watchdog value, not just the drop-in content");
|
|
57
|
+
});
|
|
58
|
+
test("watchdog keeps the 20s runtime / 2min reboot values", () => {
|
|
59
|
+
const body = watchdogFnBody();
|
|
60
|
+
assert.ok(body.includes("RuntimeWatchdogSec=20s"), "RuntimeWatchdogSec stays 20s");
|
|
61
|
+
assert.ok(body.includes("RebootWatchdogSec=2min"), "RebootWatchdogSec stays 2min");
|
|
62
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -617,6 +617,53 @@ function writeChromiumBinaryPathFile() {
|
|
|
617
617
|
// warns, never aborts the install. Cannot recover a latched-off brownout (no
|
|
618
618
|
// power = no watchdog) — that needs the external power-cycler documented in
|
|
619
619
|
// deployment.md.
|
|
620
|
+
//
|
|
621
|
+
// Called as the FINAL install action (not step 1): RuntimeWatchdogSec=20s is a
|
|
622
|
+
// tight timer, and the heavy npm-install/swap-thrash steps stall PID1 past 20s
|
|
623
|
+
// on a constrained Pi. Arming early reboot-looped the install (the board reset
|
|
624
|
+
// mid-build, relaunched under the same load, reset again). Deferring the arm to
|
|
625
|
+
// after the build/swap window, then applying it with `daemon-reexec` so it is
|
|
626
|
+
// active immediately (RuntimeWatchdogUSec non-zero), keeps kernel-hang recovery
|
|
627
|
+
// without the loop.
|
|
628
|
+
// Disable the hardware watchdog drop-in for the duration of the install.
|
|
629
|
+
// configureHardwareWatchdog() writes /etc/systemd/system.conf.d/10-maxy-watchdog.conf
|
|
630
|
+
// (RuntimeWatchdogSec=20s) at the END of every install. That file persists
|
|
631
|
+
// across reboots, so on every install AFTER the first, PID1 already has the
|
|
632
|
+
// watchdog armed from boot. The heavy npm/Playwright/swap step in step [3/11]
|
|
633
|
+
// can stall PID1 past 20s on a constrained Pi, the SoC resets mid-install,
|
|
634
|
+
// boot resumes with the watchdog re-armed, the install never completes, and
|
|
635
|
+
// the box wedges (SSH never returns; observed on beacons).
|
|
636
|
+
//
|
|
637
|
+
// Neutralise the watchdog at install start by overwriting the drop-in with
|
|
638
|
+
// RuntimeWatchdogSec=0 and daemon-reexec to apply it immediately. Re-armed
|
|
639
|
+
// at install end by configureHardwareWatchdog(). If install fails between
|
|
640
|
+
// the two, the box is unarmed — recoverable, far better than reboot-loop.
|
|
641
|
+
function disableHardwareWatchdogForInstall() {
|
|
642
|
+
try {
|
|
643
|
+
if (!isLinux()) {
|
|
644
|
+
logFile(" hardware watchdog: disable-for-install skipped (not Linux)");
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
if (!existsSync("/dev/watchdog")) {
|
|
648
|
+
logFile(" hardware watchdog: disable-for-install skipped (/dev/watchdog absent)");
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
const disabled = "[Manager]\nRuntimeWatchdogSec=0\n";
|
|
652
|
+
const dropinDir = "/etc/systemd/system.conf.d";
|
|
653
|
+
const dropinPath = `${dropinDir}/10-maxy-watchdog.conf`;
|
|
654
|
+
const tmpPath = "/tmp/10-maxy-watchdog.conf";
|
|
655
|
+
writeFileSync(tmpPath, disabled);
|
|
656
|
+
console.log(" [privileged] disable hardware watchdog for install duration (RuntimeWatchdogSec=0)");
|
|
657
|
+
shell("mkdir", ["-p", dropinDir], { sudo: true });
|
|
658
|
+
shell("cp", [tmpPath, dropinPath], { sudo: true });
|
|
659
|
+
spawnSync("rm", ["-f", tmpPath]);
|
|
660
|
+
spawnSync("sudo", ["systemctl", "daemon-reexec"], { stdio: "inherit" });
|
|
661
|
+
logFile(` hardware watchdog: disabled for install (${dropinPath}, RuntimeWatchdogSec=0; re-armed at install end)`);
|
|
662
|
+
}
|
|
663
|
+
catch (err) {
|
|
664
|
+
console.error(` WARNING: failed to disable hardware watchdog for install: ${err instanceof Error ? err.message : String(err)}`);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
620
667
|
function configureHardwareWatchdog() {
|
|
621
668
|
try {
|
|
622
669
|
if (!isLinux()) {
|
|
@@ -640,18 +687,33 @@ function configureHardwareWatchdog() {
|
|
|
640
687
|
current = "";
|
|
641
688
|
}
|
|
642
689
|
}
|
|
643
|
-
if (current
|
|
644
|
-
|
|
690
|
+
if (current !== desired) {
|
|
691
|
+
const tmpPath = "/tmp/10-maxy-watchdog.conf";
|
|
692
|
+
writeFileSync(tmpPath, desired);
|
|
693
|
+
console.log(" [privileged] install systemd hardware watchdog drop-in (RuntimeWatchdogSec=20s RebootWatchdogSec=2min)");
|
|
694
|
+
shell("mkdir", ["-p", dropinDir], { sudo: true });
|
|
695
|
+
shell("cp", [tmpPath, dropinPath], { sudo: true });
|
|
696
|
+
spawnSync("rm", ["-f", tmpPath]);
|
|
697
|
+
}
|
|
698
|
+
// Arm now, idempotently. The drop-in being on disk does NOT mean the live
|
|
699
|
+
// PID1 has the watchdog active — a prior install that only ran daemon-reload,
|
|
700
|
+
// or a just-removed disable override (RuntimeWatchdogSec=0), leaves the file
|
|
701
|
+
// present but RuntimeWatchdogUSec=0. So read the live value and only skip the
|
|
702
|
+
// re-exec when the watchdog is genuinely armed already; otherwise daemon-reexec
|
|
703
|
+
// re-execs PID1 in place (host-wide; running services are preserved) to apply
|
|
704
|
+
// the system-manager setting. daemon-reload does not apply RuntimeWatchdogSec.
|
|
705
|
+
const liveUsec = spawnSync("systemctl", ["show", "-p", "RuntimeWatchdogUSec", "--value"], {
|
|
706
|
+
encoding: "utf-8",
|
|
707
|
+
stdio: "pipe",
|
|
708
|
+
timeout: 5_000,
|
|
709
|
+
});
|
|
710
|
+
const usec = (liveUsec.stdout ?? "").trim();
|
|
711
|
+
if (current === desired && usec !== "" && usec !== "0") {
|
|
712
|
+
logFile(` hardware watchdog: already active (${dropinPath}, RuntimeWatchdogUSec=${usec})`);
|
|
645
713
|
return;
|
|
646
714
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
console.log(" [privileged] install systemd hardware watchdog drop-in (RuntimeWatchdogSec=20s RebootWatchdogSec=2min)");
|
|
650
|
-
shell("mkdir", ["-p", dropinDir], { sudo: true });
|
|
651
|
-
shell("cp", [tmpPath, dropinPath], { sudo: true });
|
|
652
|
-
spawnSync("rm", ["-f", tmpPath]);
|
|
653
|
-
spawnSync("sudo", ["systemctl", "daemon-reload"], { stdio: "inherit" });
|
|
654
|
-
logFile(` hardware watchdog: enabled (wrote ${dropinPath}; arms on next boot or systemd re-exec)`);
|
|
715
|
+
spawnSync("sudo", ["systemctl", "daemon-reexec"], { stdio: "inherit" });
|
|
716
|
+
logFile(` hardware watchdog: enabled (${dropinPath}; armed now via daemon-reexec, after the build/swap window)`);
|
|
655
717
|
}
|
|
656
718
|
catch (err) {
|
|
657
719
|
console.error(` WARNING: failed to configure hardware watchdog: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -4255,8 +4317,12 @@ console.log("");
|
|
|
4255
4317
|
logDiagnostics("pre-flight");
|
|
4256
4318
|
logFile(` Neo4j instance: ${NEO4J_DEDICATED ? "dedicated" : "shared"} on bolt://localhost:${NEO4J_PORT}`);
|
|
4257
4319
|
try {
|
|
4320
|
+
// Disable any pre-existing hardware-watchdog drop-in BEFORE any heavy step.
|
|
4321
|
+
// configureHardwareWatchdog() re-arms it at install end. Without this, the
|
|
4322
|
+
// 20s deadline armed from boot reboots the box mid-install on every install
|
|
4323
|
+
// after the first.
|
|
4324
|
+
disableHardwareWatchdogForInstall();
|
|
4258
4325
|
installSystemDeps();
|
|
4259
|
-
configureHardwareWatchdog();
|
|
4260
4326
|
installNodejs();
|
|
4261
4327
|
installClaudeCode();
|
|
4262
4328
|
installNeo4j();
|
|
@@ -4314,6 +4380,11 @@ try {
|
|
|
4314
4380
|
const ok = freezing ? immutable : !immutable;
|
|
4315
4381
|
console.log(` [agent-guard] op=${ok ? op : `${op}-failed`} target=${target}`);
|
|
4316
4382
|
}
|
|
4383
|
+
// Arm the hardware watchdog as the final install action — after the heavy
|
|
4384
|
+
// build/swap window, so a tight watchdog can never reboot the box mid-install
|
|
4385
|
+
// (the reboot-loop this defends against). A partial/failed install exits
|
|
4386
|
+
// before this point and never writes the drop-in.
|
|
4387
|
+
configureHardwareWatchdog();
|
|
4317
4388
|
console.log("");
|
|
4318
4389
|
console.log("================================================================");
|
|
4319
4390
|
console.log("");
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* MCP spawn-tee —
|
|
3
|
+
* MCP spawn-tee — in-process stderr capture + lifecycle observability.
|
|
4
4
|
*
|
|
5
5
|
* Claude Code spawns each MCP server itself; the platform never holds a
|
|
6
|
-
* ChildProcess handle. This
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* is
|
|
6
|
+
* ChildProcess handle. This shim sits between Claude Code and the real MCP
|
|
7
|
+
* server: Claude Code runs `node <this> <real-entry>`, and the shim runs the
|
|
8
|
+
* real entry IN ITS OWN PROCESS via dynamic import() — one node runtime, not
|
|
9
|
+
* two. Before importing, it replaces process.stderr.write with a tee so every
|
|
10
|
+
* stderr byte the server writes is mirrored to the log sinks; stdin and stdout
|
|
11
|
+
* (the JSON-RPC channel) are never touched.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Claude Code CLI → shim (this file) = node running <real-entry> in-process
|
|
14
|
+
* stdin/stdout : untouched (JSON-RPC channel)
|
|
15
|
+
* stderr : process.stderr.write teed → per-date + per-session + passthrough
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
* child stdin/stdout : inherited (Claude Code pipe, untouched)
|
|
18
|
-
* child stderr : piped → per-date log + per-session log + passthrough
|
|
19
|
-
*
|
|
20
|
-
* Destinations (Task 706):
|
|
17
|
+
* Destinations (Task 706) — unchanged:
|
|
21
18
|
* - `${LOG_DIR}/mcp-<name>-stderr-<date>.log` — per-date raw (back-compat;
|
|
22
19
|
* the in-process mcp-stderr-tee and the [mcp-init-error] probe read it).
|
|
23
20
|
* - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — per-session raw + lifecycle
|
|
24
|
-
* lines
|
|
25
|
-
*
|
|
26
|
-
* (enumeration spawn) — then the per-date file is the fallback.
|
|
21
|
+
* lines. Authoritative sink. Absent when SESSION_ID is unset (enumeration
|
|
22
|
+
* spawn) — then the per-date file is the fallback.
|
|
27
23
|
* - `server.log` via the loopback log-ingest route — best-effort mirror of
|
|
28
|
-
* the [mcp-helper] lifecycle lines.
|
|
29
|
-
* the per-session file already holds the line (written synchronously).
|
|
24
|
+
* the [mcp-helper] lifecycle lines.
|
|
30
25
|
*
|
|
31
|
-
* Lifecycle lines, correlation key `session=<id8> server=<name
|
|
26
|
+
* Lifecycle lines, correlation key `session=<id8> server=<name>` — unchanged:
|
|
32
27
|
* [mcp-helper] op=spawn ... pid= entry=
|
|
33
28
|
* [mcp-helper] op=boot ... head=<first stderr bytes>
|
|
34
|
-
* [mcp-helper] op=exit ... code= signal= lifetimeMs= stderr-tail=
|
|
29
|
+
* [mcp-helper] op=exit ... code= signal= lifetimeMs= stderr-tail=
|
|
30
|
+
*
|
|
31
|
+
* Process model (Task 989): the shim IS the server's process. op=exit fires
|
|
32
|
+
* from process.on("exit"), so it covers a normal exit, a non-zero exit, an
|
|
33
|
+
* uncaught throw (code 1), and a catchable-signal exit (SIGTERM/SIGINT/SIGHUP,
|
|
34
|
+
* whose handlers record the signal name). An external SIGKILL is uncatchable
|
|
35
|
+
* and leaves no op=exit line — the per-session stderr tail already on disk and
|
|
36
|
+
* Claude Code's own transport-drop are the evidence for that death mode.
|
|
35
37
|
*
|
|
36
|
-
* The
|
|
37
|
-
* SIGTERM/SIGINT are forwarded to the child so a Claude Code shutdown does
|
|
38
|
-
* not orphan it; the child exit code/signal is propagated verbatim.
|
|
38
|
+
* The shim never writes to fd 1 (stdout) — that is the JSON-RPC channel.
|
|
39
39
|
*/
|
|
40
40
|
export {};
|
|
41
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
/**
|
|
4
|
-
* MCP spawn-tee —
|
|
4
|
+
* MCP spawn-tee — in-process stderr capture + lifecycle observability.
|
|
5
5
|
*
|
|
6
6
|
* Claude Code spawns each MCP server itself; the platform never holds a
|
|
7
|
-
* ChildProcess handle. This
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* is
|
|
7
|
+
* ChildProcess handle. This shim sits between Claude Code and the real MCP
|
|
8
|
+
* server: Claude Code runs `node <this> <real-entry>`, and the shim runs the
|
|
9
|
+
* real entry IN ITS OWN PROCESS via dynamic import() — one node runtime, not
|
|
10
|
+
* two. Before importing, it replaces process.stderr.write with a tee so every
|
|
11
|
+
* stderr byte the server writes is mirrored to the log sinks; stdin and stdout
|
|
12
|
+
* (the JSON-RPC channel) are never touched.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Claude Code CLI → shim (this file) = node running <real-entry> in-process
|
|
15
|
+
* stdin/stdout : untouched (JSON-RPC channel)
|
|
16
|
+
* stderr : process.stderr.write teed → per-date + per-session + passthrough
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
-
* child stdin/stdout : inherited (Claude Code pipe, untouched)
|
|
19
|
-
* child stderr : piped → per-date log + per-session log + passthrough
|
|
20
|
-
*
|
|
21
|
-
* Destinations (Task 706):
|
|
18
|
+
* Destinations (Task 706) — unchanged:
|
|
22
19
|
* - `${LOG_DIR}/mcp-<name>-stderr-<date>.log` — per-date raw (back-compat;
|
|
23
20
|
* the in-process mcp-stderr-tee and the [mcp-init-error] probe read it).
|
|
24
21
|
* - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — per-session raw + lifecycle
|
|
25
|
-
* lines
|
|
26
|
-
*
|
|
27
|
-
* (enumeration spawn) — then the per-date file is the fallback.
|
|
22
|
+
* lines. Authoritative sink. Absent when SESSION_ID is unset (enumeration
|
|
23
|
+
* spawn) — then the per-date file is the fallback.
|
|
28
24
|
* - `server.log` via the loopback log-ingest route — best-effort mirror of
|
|
29
|
-
* the [mcp-helper] lifecycle lines.
|
|
30
|
-
* the per-session file already holds the line (written synchronously).
|
|
25
|
+
* the [mcp-helper] lifecycle lines.
|
|
31
26
|
*
|
|
32
|
-
* Lifecycle lines, correlation key `session=<id8> server=<name
|
|
27
|
+
* Lifecycle lines, correlation key `session=<id8> server=<name>` — unchanged:
|
|
33
28
|
* [mcp-helper] op=spawn ... pid= entry=
|
|
34
29
|
* [mcp-helper] op=boot ... head=<first stderr bytes>
|
|
35
|
-
* [mcp-helper] op=exit ... code= signal= lifetimeMs= stderr-tail=
|
|
30
|
+
* [mcp-helper] op=exit ... code= signal= lifetimeMs= stderr-tail=
|
|
31
|
+
*
|
|
32
|
+
* Process model (Task 989): the shim IS the server's process. op=exit fires
|
|
33
|
+
* from process.on("exit"), so it covers a normal exit, a non-zero exit, an
|
|
34
|
+
* uncaught throw (code 1), and a catchable-signal exit (SIGTERM/SIGINT/SIGHUP,
|
|
35
|
+
* whose handlers record the signal name). An external SIGKILL is uncatchable
|
|
36
|
+
* and leaves no op=exit line — the per-session stderr tail already on disk and
|
|
37
|
+
* Claude Code's own transport-drop are the evidence for that death mode.
|
|
36
38
|
*
|
|
37
|
-
* The
|
|
38
|
-
* SIGTERM/SIGINT are forwarded to the child so a Claude Code shutdown does
|
|
39
|
-
* not orphan it; the child exit code/signal is propagated verbatim.
|
|
39
|
+
* The shim never writes to fd 1 (stdout) — that is the JSON-RPC channel.
|
|
40
40
|
*/
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
const node_child_process_1 = require("node:child_process");
|
|
43
42
|
const node_fs_1 = require("node:fs");
|
|
44
43
|
const node_path_1 = require("node:path");
|
|
44
|
+
const node_url_1 = require("node:url");
|
|
45
45
|
const SERVER_NAME = process.env.MCP_SPAWN_TEE_NAME ?? "unknown";
|
|
46
46
|
const LOG_DIR = process.env.LOG_DIR;
|
|
47
47
|
const SESSION_ID = process.env.SESSION_ID;
|
|
@@ -49,24 +49,37 @@ const PLATFORM_PORT = process.env.PLATFORM_PORT;
|
|
|
49
49
|
const ENTRY = process.argv[2];
|
|
50
50
|
const SESSION_ID8 = SESSION_ID ? SESSION_ID.slice(0, 8) : "—";
|
|
51
51
|
const spawnStamp = Date.now();
|
|
52
|
-
// Per-session raw + lifecycle log (Task 706).
|
|
53
|
-
//
|
|
52
|
+
// Per-session raw + lifecycle log (Task 706). Empty SESSION_ID (enumeration
|
|
53
|
+
// spawn) → undefined, and the per-date file is the fallback.
|
|
54
54
|
const perSessionPath = LOG_DIR && SESSION_ID
|
|
55
55
|
? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-${SESSION_ID}.log`)
|
|
56
56
|
: undefined;
|
|
57
57
|
const perDatePath = LOG_DIR
|
|
58
58
|
? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-stderr-${new Date(spawnStamp).toISOString().slice(0, 10)}.log`)
|
|
59
59
|
: undefined;
|
|
60
|
-
// Rolling tail of
|
|
60
|
+
// Rolling tail of entry stderr for op=exit. Capped so a chatty server cannot
|
|
61
61
|
// grow the buffer without bound.
|
|
62
62
|
const TAIL_CAP = 2048;
|
|
63
63
|
let stderrTail = "";
|
|
64
64
|
let bootEmitted = false;
|
|
65
|
+
let exitEmitted = false;
|
|
66
|
+
let exitSignal;
|
|
67
|
+
// The real stderr writer, captured before the tee replaces it. Lifecycle lines
|
|
68
|
+
// and stderr passthrough both go through this so they are never re-teed into
|
|
69
|
+
// the per-date sink nor recursed back into the patched writer.
|
|
70
|
+
const rawStderrWrite = process.stderr.write.bind(process.stderr);
|
|
71
|
+
// LOG_DIR is created once, lazily, on the first successful append — not per
|
|
72
|
+
// chunk. teeWrite runs on the server's own stderr hot path now, so a per-call
|
|
73
|
+
// mkdirSync would be two syscalls per log line for nothing.
|
|
74
|
+
let logDirReady = false;
|
|
65
75
|
function appendSafe(path, data) {
|
|
66
76
|
if (!path || !LOG_DIR)
|
|
67
77
|
return;
|
|
68
78
|
try {
|
|
69
|
-
(
|
|
79
|
+
if (!logDirReady) {
|
|
80
|
+
(0, node_fs_1.mkdirSync)(LOG_DIR, { recursive: true });
|
|
81
|
+
logDirReady = true;
|
|
82
|
+
}
|
|
70
83
|
(0, node_fs_1.appendFileSync)(path, data);
|
|
71
84
|
}
|
|
72
85
|
catch {
|
|
@@ -74,15 +87,16 @@ function appendSafe(path, data) {
|
|
|
74
87
|
}
|
|
75
88
|
}
|
|
76
89
|
// Best-effort mirror of a lifecycle line to server.log via the loopback
|
|
77
|
-
// log-ingest route. Fire-and-forget: the per-session file is authoritative,
|
|
78
|
-
//
|
|
90
|
+
// log-ingest route. Fire-and-forget: the per-session file is authoritative, so
|
|
91
|
+
// a dropped POST loses nothing. On the "exit" event the loop is stopping, so
|
|
92
|
+
// the op=exit mirror may not flush — the per-session line, written sync, holds.
|
|
79
93
|
function postToServerLog(suffix, level) {
|
|
80
94
|
if (!PLATFORM_PORT)
|
|
81
95
|
return;
|
|
82
96
|
try {
|
|
83
97
|
const ctrl = new AbortController();
|
|
84
98
|
const t = setTimeout(() => ctrl.abort(), 500);
|
|
85
|
-
t.unref?.(); // never let the abort timer keep the
|
|
99
|
+
t.unref?.(); // never let the abort timer keep the shim's event loop alive
|
|
86
100
|
void fetch(`http://127.0.0.1:${PLATFORM_PORT}/api/admin/log-ingest`, {
|
|
87
101
|
method: "POST",
|
|
88
102
|
headers: { "content-type": "application/json" },
|
|
@@ -95,14 +109,15 @@ function postToServerLog(suffix, level) {
|
|
|
95
109
|
}
|
|
96
110
|
}
|
|
97
111
|
// Emit one [mcp-helper] lifecycle line: authoritative per-session file (sync,
|
|
98
|
-
// survives process.exit), the
|
|
99
|
-
// visibility), and a best-effort server.log mirror.
|
|
100
|
-
// after the tag and carries no newline (the
|
|
112
|
+
// survives process.exit), the shim's own stderr via the RAW writer (journald /
|
|
113
|
+
// Claude Code visibility, never re-teed), and a best-effort server.log mirror.
|
|
114
|
+
// `suffix` is the line body after the tag and carries no newline (the
|
|
115
|
+
// log-ingest route rejects newlines).
|
|
101
116
|
function emitLifecycle(suffix, level) {
|
|
102
117
|
const line = `[mcp-helper] ${suffix}\n`;
|
|
103
118
|
appendSafe(perSessionPath, line);
|
|
104
119
|
try {
|
|
105
|
-
|
|
120
|
+
rawStderrWrite(line);
|
|
106
121
|
}
|
|
107
122
|
catch { /* stderr closed */ }
|
|
108
123
|
postToServerLog(suffix, level);
|
|
@@ -111,49 +126,68 @@ if (!ENTRY) {
|
|
|
111
126
|
emitLifecycle(`op=error session=${SESSION_ID8} server=${SERVER_NAME} reason="no entry given (argv[2] missing)"`, "error");
|
|
112
127
|
process.exit(2);
|
|
113
128
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
// Replace process.stderr.write with a tee: mirror every server stderr byte to
|
|
130
|
+
// the per-date and per-session sinks, keep a rolling tail for op=exit, emit
|
|
131
|
+
// op=boot on the first bytes, then pass the write through to the real stderr.
|
|
132
|
+
const teeWrite = ((...args) => {
|
|
133
|
+
const chunk = args[0];
|
|
134
|
+
appendSafe(perDatePath, chunk); // per-date raw (back-compat)
|
|
135
|
+
appendSafe(perSessionPath, chunk); // per-session raw (Task 706)
|
|
136
|
+
const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
|
|
137
|
+
stderrTail = (stderrTail + text).slice(-TAIL_CAP);
|
|
138
|
+
if (!bootEmitted) {
|
|
139
|
+
bootEmitted = true;
|
|
140
|
+
const head = text.split("\n")[0].slice(0, 200);
|
|
141
|
+
emitLifecycle(`op=boot session=${SESSION_ID8} server=${SERVER_NAME} head=${JSON.stringify(head)}`, "info");
|
|
142
|
+
}
|
|
143
|
+
return rawStderrWrite(...args); // passthrough
|
|
123
144
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
145
|
+
process.stderr.write = teeWrite;
|
|
146
|
+
// Catchable-signal handling. The shim drives the exit ONLY when it is the sole
|
|
147
|
+
// listener for the signal — i.e. the imported entry installed no handler of its
|
|
148
|
+
// own. In that case it records the signal (so op=exit carries signal=<sig>) and
|
|
149
|
+
// exits with 128+signum, mirroring the prior wrapper's exit-status convention.
|
|
150
|
+
//
|
|
151
|
+
// When the entry DID install a handler, the shim defers entirely and records
|
|
152
|
+
// nothing: the entry's handler decides the exit code, and op=exit reflects that
|
|
153
|
+
// exit verbatim. This matches the prior two-process model, where a child that
|
|
154
|
+
// caught the signal and exited cleanly was observed as code=0 signal=— (a clean
|
|
155
|
+
// self-exit), not as a signal death. Setting exitSignal here unconditionally
|
|
156
|
+
// would mislabel every graceful signal-driven shutdown as a signal kill.
|
|
157
|
+
function onSignal(sig, code) {
|
|
158
|
+
return () => {
|
|
159
|
+
if (process.listenerCount(sig) === 1) {
|
|
160
|
+
exitSignal = sig;
|
|
161
|
+
process.exit(code);
|
|
137
162
|
}
|
|
138
|
-
}
|
|
163
|
+
};
|
|
139
164
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
process.on("
|
|
143
|
-
process
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
165
|
+
process.on("SIGTERM", onSignal("SIGTERM", 143));
|
|
166
|
+
process.on("SIGINT", onSignal("SIGINT", 130));
|
|
167
|
+
process.on("SIGHUP", onSignal("SIGHUP", 129));
|
|
168
|
+
// op=exit, emitted once from the process "exit" event. Sync-only — the loop is
|
|
169
|
+
// stopping. When a catchable signal caused the exit, report code=— signal=<sig>
|
|
170
|
+
// to match the prior wrapper's format; otherwise code=<exit code> signal=—.
|
|
171
|
+
process.on("exit", (code) => {
|
|
172
|
+
if (exitEmitted)
|
|
173
|
+
return;
|
|
174
|
+
exitEmitted = true;
|
|
150
175
|
const lifetimeMs = Date.now() - spawnStamp;
|
|
151
176
|
const tail = stderrTail.slice(-200);
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
177
|
+
const codeField = exitSignal ? "—" : String(code);
|
|
178
|
+
const level = exitSignal || code !== 0 ? "error" : "info";
|
|
179
|
+
emitLifecycle(`op=exit session=${SESSION_ID8} server=${SERVER_NAME} pid=${process.pid} ` +
|
|
180
|
+
`code=${codeField} signal=${exitSignal ?? "—"} lifetimeMs=${lifetimeMs} stderr-tail=${JSON.stringify(tail)}`, level);
|
|
181
|
+
});
|
|
182
|
+
emitLifecycle(`op=spawn session=${SESSION_ID8} server=${SERVER_NAME} pid=${process.pid} entry=${ENTRY}`, "info");
|
|
183
|
+
// Run the real MCP server in THIS process. Dynamic import() (not top-level
|
|
184
|
+
// await — this file compiles to CommonJS) loads the ESM entry; a load-time
|
|
185
|
+
// failure mirrors the old child spawn-error path (op=error, exit 127). The
|
|
186
|
+
// op=exit handler is suppressed on this path so op=error stays the sole record.
|
|
187
|
+
import((0, node_url_1.pathToFileURL)(ENTRY).href).catch((err) => {
|
|
188
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
189
|
+
exitEmitted = true;
|
|
190
|
+
emitLifecycle(`op=error session=${SESSION_ID8} server=${SERVER_NAME} reason=${JSON.stringify(`import error: ${msg}`)}`, "error");
|
|
191
|
+
process.exit(127);
|
|
158
192
|
});
|
|
159
193
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;AAEH,qCAAoD;AACpD,yCAAoC;AACpC,uCAAyC;AAEzC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,SAAS,CAAC;AAChE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;AACpC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;AAC1C,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAChD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAE9B,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAA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