export const omniViewImageDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.omni.transformMedia",
        kind: "runtime",
        required: true,
        description: "Runtime-owned omni media support exposed through BaseToolExecutorPort.omni.transformMedia.",
    },
    {
        dependencyId: "runtime.governancePlane.toolInvocationGrant",
        kind: "permission",
        required: true,
        description: "dryRun:false requires an affirmative runtime guard before provider dispatch.",
    },
    {
        dependencyId: "runtime.modelAdapter.mediaLowering",
        kind: "runtime",
        required: false,
        description: "Runtime/modelAdapter owns provider-specific image bytes, artifact refs, and model input lowering.",
    },
];
export function createRuntimeOmniViewImageProvider(executor) {
    const transformMedia = executor?.omni?.transformMedia;
    if (transformMedia === undefined)
        return undefined;
    return async (request) => {
        const result = await transformMedia({
            operation: request.operation,
            inputArtifactId: request.target.imageRef,
            parameters: {
                imagePath: request.target.imagePath,
                mediaType: request.target.mediaType,
                detail: request.target.detail,
                maxBytes: request.target.maxBytes,
                runtimeId: request.context.runtimeId,
                sessionId: request.context.sessionId,
                invocationId: request.context.invocationId,
                auditMetadata: request.context.auditMetadata,
            },
        });
        if (!result.ok) {
            throw Object.assign(new Error(result.error.message), { code: result.error.code });
        }
        return {
            artifactId: result.output.artifactId,
            mimeType: result.output.mimeType,
            metadata: result.metadata,
        };
    };
}
