export const windowScreenRecordingDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.computeruse.startRecording",
        kind: "runtime",
        required: true,
        description: "Runtime-owned computer-use recording support exposed through BaseToolExecutorPort.computeruse.startRecording.",
    },
    {
        dependencyId: "runtime.governancePlane.toolInvocationGrant",
        kind: "permission",
        required: true,
        description: "dryRun:false requires an affirmative runtime guard before window screen recording dispatch.",
    },
    {
        dependencyId: "runtime.recordingSession.screen",
        kind: "runtime",
        required: true,
        description: "Runtime owns window selection, recording streams, session handles, codecs, artifacts, privacy boundaries, and cleanup.",
    },
];
export function createRuntimeWindowScreenRecordingProvider(executor) {
    const startRecording = executor?.computeruse?.startRecording;
    if (startRecording === undefined)
        return undefined;
    return async (request) => {
        const result = await startRecording({
            resource: "screen",
            target: {
                target: "window",
                windowId: request.target.windowId,
                titleHint: request.target.titleHint,
                maxDurationMs: request.target.maxDurationMs,
                frameRate: request.target.frameRate,
                includeCursor: request.target.includeCursor,
                destinationHint: request.target.destinationHint,
            },
            outputFormat: request.target.outputFormat,
            metadata: {
                runtimeId: request.context.runtimeId,
                sessionId: request.context.sessionId,
                invocationId: request.context.invocationId,
                purpose: request.purpose,
                auditMetadata: request.context.auditMetadata,
            },
        });
        if (!result.ok) {
            throw new Error(result.error.message);
        }
        return {
            recordingId: result.output.recordingId,
            metadata: {
                ...(result.output.metadata ?? {}),
                ...(result.metadata ?? {}),
            },
        };
    };
}
