@proxysoul/soulforge 2.18.3 → 2.18.5
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/index.js +270 -67
- package/dist/workers/intelligence.worker.js +649 -607
- package/package.json +1 -1
- package/scripts/launcher.mjs +31 -0
package/package.json
CHANGED
package/scripts/launcher.mjs
CHANGED
|
@@ -78,12 +78,43 @@ if (!existsSync(entry)) {
|
|
|
78
78
|
process.exit(1);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
// detached:true puts the child in its own process group (POSIX) / detaches
|
|
82
|
+
// from the parent console (Windows). The child's cleanup path calls
|
|
83
|
+
// `kill(-pid, SIGTERM)` to reap orphaned grandchildren — without a separate
|
|
84
|
+
// group that signal would also terminate this launcher, causing zsh/bash to
|
|
85
|
+
// print "terminated soulforge" and scroll past the child's exit banner.
|
|
81
86
|
const child = spawn(bun, [entry, ...process.argv.slice(2)], {
|
|
82
87
|
stdio: "inherit",
|
|
88
|
+
detached: !isWindows,
|
|
83
89
|
windowsHide: false,
|
|
84
90
|
});
|
|
91
|
+
|
|
92
|
+
// Forward terminal signals to the child's group. On POSIX with detached:true
|
|
93
|
+
// the TTY no longer broadcasts SIGINT to the child automatically, so we relay.
|
|
94
|
+
// On Windows the console still routes Ctrl+C/Break to the child; these
|
|
95
|
+
// handlers are harmless no-ops there (signal forwarding via process.kill on
|
|
96
|
+
// Windows just terminates — child handles its own console events).
|
|
97
|
+
const FORWARDED = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
98
|
+
for (const sig of FORWARDED) {
|
|
99
|
+
process.on(sig, () => {
|
|
100
|
+
try {
|
|
101
|
+
if (isWindows) {
|
|
102
|
+
// Windows: signal the child directly; no process-group concept.
|
|
103
|
+
child.kill(sig);
|
|
104
|
+
} else {
|
|
105
|
+
// POSIX: signal the child's process group so its own children get it too.
|
|
106
|
+
process.kill(-child.pid, sig);
|
|
107
|
+
}
|
|
108
|
+
} catch {
|
|
109
|
+
// Child already gone — let our own exit logic run.
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
85
114
|
child.on("exit", (code, signal) => {
|
|
86
115
|
if (signal) {
|
|
116
|
+
// Re-raise so the parent shell sees the correct exit status, but only
|
|
117
|
+
// for genuine signal terminations — clean exits with code 0 fall through.
|
|
87
118
|
process.kill(process.pid, signal);
|
|
88
119
|
} else {
|
|
89
120
|
process.exit(code ?? 0);
|