mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 17:53:39 +00:00
Add opt-in aggregate Linux process-tree memory containment to the managed tooling runner. Own the invocation-specific scope through verified cleanup before releasing its resource claim; preserve uncapped caller behavior. Validated real-kernel OOM, descendant cleanup, signals, cancellation and packaged launcher behavior; focused lifecycle/preload tests and exact-head CI/security gates passed. Related: #160010.
21 lines
788 B
TypeScript
21 lines
788 B
TypeScript
import { extname } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
export const managedMemoryEntrypoint = {
|
|
currentModuleUrl: import.meta.url,
|
|
sourceWorkerName: "managed-memory-launcher",
|
|
sourceExtension: ".mts",
|
|
distWorkerPath: "tooling/managed-memory-launcher.js",
|
|
} as const;
|
|
|
|
/** Resolve the standalone launcher in source checkouts and packaged tooling. */
|
|
export function resolveManagedMemoryEntrypointUrl(): URL {
|
|
const current = new URL(import.meta.url);
|
|
const distIndex = current.pathname.lastIndexOf("/dist/");
|
|
return distIndex < 0
|
|
? new URL(`./managed-memory-launcher${extname(fileURLToPath(current))}`, current)
|
|
: new URL(
|
|
current.pathname.slice(0, distIndex + 6) + managedMemoryEntrypoint.distWorkerPath,
|
|
current,
|
|
);
|
|
}
|