import { tmpdir } from 'node:os';
import { buildSandboxCommand } from './sandbox.js';
import { createHostContainer } from './host-container.js';
function toSandboxEnv(env) {
    const sandboxEnv = Object.create(null);
    for (const [key, value] of Object.entries(env)) {
        if (value !== undefined) {
            sandboxEnv[key] = value;
        }
    }
    return sandboxEnv;
}
export async function createSandboxContainer(options = {}) {
    return createHostContainer(options, ({ command, env, home }) => {
        return buildSandboxCommand({
            home,
            writablePaths: [home, tmpdir()],
            env: toSandboxEnv(env),
        }, command);
    });
}
export const createContainer = createSandboxContainer;
//# sourceMappingURL=sandbox-container.js.map