export const shellCommandExecutionDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.shellExecutor",
        kind: "runtime",
        required: true,
        description: "Runtime-provided shell executor exposed through BaseToolExecutorPort.shell.run",
    },
    {
        dependencyId: "runtime.governancePlane.toolInvocationGrant",
        kind: "permission",
        required: true,
        description: "Runtime governance decision carried in ShellToolContext.guard",
    },
    {
        dependencyId: "runtime.capabilityExposure.shellOutputEnvelope",
        kind: "runtime",
        required: true,
        description: "Runtime output envelope for stdout, stderr, exit code, and audit material",
    },
];
export function createHostExecutorShellCommandExecutionProvider(executor) {
    const run = executor?.shell?.run;
    if (run === undefined) {
        return undefined;
    }
    return async (request, _context) => {
        const result = await run({
            command: request.command,
            args: request.args,
            cwd: request.cwd,
            timeoutMs: request.timeoutMs,
            stdin: request.stdin,
        });
        if (!result.ok) {
            const error = new Error(result.error.message);
            error.name = result.error.code;
            throw error;
        }
        return result.output;
    };
}
