export const cameraSelectDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.computeruse.selectDevice",
        kind: "runtime",
        required: true,
        description: "Runtime-owned camera device selection support exposed through BaseToolExecutorPort.computeruse.selectDevice.",
    },
    {
        dependencyId: "runtime.governancePlane.toolInvocationGrant",
        kind: "permission",
        required: true,
        description: "dryRun:false requires an affirmative runtime guard before camera selection.",
    },
    {
        dependencyId: "runtime.devicePolicy.camera",
        kind: "runtime",
        required: true,
        description: "Runtime owns device inventory, OS policy, active camera selection, privacy cleanup, and lease coupling.",
    },
];
export function createRuntimeCameraSelectProvider(executor) {
    const selectDevice = executor?.computeruse?.selectDevice;
    if (selectDevice === undefined)
        return undefined;
    return async (request) => {
        const result = await selectDevice({
            resource: "camera",
            deviceId: request.target.deviceId,
            metadata: {
                runtimeId: request.context.runtimeId,
                sessionId: request.context.sessionId,
                invocationId: request.context.invocationId,
                purpose: request.target.purpose,
                availableDeviceCount: request.target.availableDevices?.length,
                auditMetadata: request.context.auditMetadata,
            },
        });
        if (!result.ok) {
            throw new Error(result.error.message);
        }
        return {
            selected: result.output.selected,
            deviceId: result.output.deviceId,
            metadata: {
                ...(result.output.metadata ?? {}),
                ...(result.metadata ?? {}),
            },
        };
    };
}
