export const executionMonitoringDependencyDeclarations = [
    { dependencyId: "runtime.execEngine.shellInteraction.monitorExecution", kind: "runtime", required: true, description: "Runtime-owned shell interaction port exposed through BaseToolExecutorPort.shell.monitorExecution" },
    { dependencyId: "runtime.governancePlane.toolInvocationGrant", kind: "permission", required: true, description: "Runtime governance decision carried in context.guard for real interaction dispatch" },
    { dependencyId: "runtime.shellSessionOwnership", kind: "runtime", required: true, description: "Runtime owns shell session/process lifecycle and validates session scope before side effects" },
];
export function createHostExecutorShellExecutionMonitoringProvider(executor) {
    const run = executor?.shell?.monitorExecution;
    if (run === undefined)
        return undefined;
    return async (request, context) => {
        const result = await run({
            target: (request.target ?? {}),
            observation: (request.observation ?? undefined),
            staleAfterMs: request.staleAfterMs,
            context: context,
        });
        if (!result.ok)
            throw new Error(result.error.message);
        return result.output;
    };
}
