mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(p2): name the TUI bundle with a sourceURL so stack traces stay small
The sandbox imports the bundle from a data: URL, which put the whole base64 bundle (~1.4 MB) into every stack frame. Chord formats a released reference's error stack, so /agents -> subagent and /clone exhausted the worker's 96 MB heap.
This commit is contained in:
parent
3a7bb6f48c
commit
4bb837c960
1 changed files with 5 additions and 1 deletions
|
|
@ -65,7 +65,11 @@ port.on("message", async (message) => {
|
|||
}
|
||||
});
|
||||
// Owner-approved dynamic import: the single self-contained server bundle is evaluated only from memory.
|
||||
const bundle = await import(`data:text/javascript;base64,${Buffer.from(source).toString("base64")}`);
|
||||
// The sourceURL names its frames: a data: URL would put the whole base64 bundle (megabytes) into every stack frame,
|
||||
// and formatting one stack (Chord makes a released reference's error stack text at once) exhausts the worker heap.
|
||||
const bundle = await import(
|
||||
`data:text/javascript;base64,${Buffer.from(`${source}\n//# sourceURL=p2-tui-bundle.mjs\n`).toString("base64")}`
|
||||
);
|
||||
await bundle.default({
|
||||
input,
|
||||
send,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue