export const shellLifecycleManagementDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.shellManagement.manageLifecycle",
        kind: "runtime",
        required: true,
        description: "Runtime-owned shell lifecycle management port exposed through BaseToolExecutorPort.shell.manageLifecycle",
    },
    {
        dependencyId: "runtime.governancePlane.toolInvocationGrant",
        kind: "permission",
        required: true,
        description: "Runtime governance decision carried in context.guard for real lifecycle dispatch",
    },
    {
        dependencyId: "runtime.shellSessionOwnership",
        kind: "runtime",
        required: true,
        description: "Runtime owns shell session lifecycle, handles, approval, and resource cleanup",
    },
];
export function createHostExecutorShellLifecycleManagementProvider(executor) {
    const run = executor?.shell?.manageLifecycle;
    if (run === undefined)
        return undefined;
    return async (request, context) => {
        const result = await run({
            target: (request.target ?? {}),
            context: context,
        });
        if (!result.ok)
            throw new Error(result.error.message);
        return result.output;
    };
}
