import { buildOmniPracticeAuditMetadata, createOmniBaseToolDefinition, createOmniCoreHandler, injectRuntimeInvocationMetadata, jsonSchema, selectOmniProviderPractice, } from '../../_shared/baseToolAdapter.js';
import { anthropicOmniAudioFormatConversionPractice } from './anthropic.js';
import { deepmindOmniAudioFormatConversionPractice } from './deepmind.js';
import { createOmniAudioFormatConversionRuntimeProvider, omniAudioFormatConversionDependencyDeclarations } from './dependencies.js';
import { openaiOmniAudioFormatConversionPractice } from './openai.js';
import { executeOmniAudioFormatConversionCore, } from './core.js';
export const omniAudioFormatConversionPractices = [
    anthropicOmniAudioFormatConversionPractice,
    openaiOmniAudioFormatConversionPractice,
    deepmindOmniAudioFormatConversionPractice,
];
export function selectOmniAudioFormatConversionPractice(dependencies = {}) {
    return selectOmniProviderPractice(omniAudioFormatConversionPractices, dependencies, {
        providerName: 'praxis-native',
        source: { kind: 'praxis-native', label: 'Praxis runtime omni executor' },
        directCliSupport: false,
        sideEffectPolicy: 'runtime-governed',
        notes: [
            'Fallback practice uses BaseToolExecutorPort.omni.transformMedia.',
            'No media bytes, uploads, model endpoint selection, or codec work is performed inside omniBase.',
        ],
        createProvider: createOmniAudioFormatConversionRuntimeProvider,
    });
}
export const omniAudioFormatConversionDefinition = createOmniBaseToolDefinition({
    toolId: "omni.audioFormatConversion",
    title: "Convert audio format",
    description: "Prepare an audio format conversion request for the runtime-owned omni media pipeline.",
    summary: "Prepare an audio format conversion request for the runtime-owned omni media pipeline.",
    storageGroup: "audioTransformer",
    riskLevel: "risky",
    permissionHints: ["omni:audio:read", "omni:audio:write"],
    dependencies: omniAudioFormatConversionDependencyDeclarations,
    inputSchema: jsonSchema("omni.audioFormatConversion.input", {
        type: 'object',
        additionalProperties: false,
        properties: {
            target: { type: 'object', additionalProperties: true },
            context: { type: 'object', additionalProperties: true },
        },
    }),
    outputSchema: jsonSchema("omni.audioFormatConversion.output", { type: 'object', additionalProperties: true }),
    metadata: { omniRuntimePort: 'BaseToolExecutorPort.omni.transformMedia' },
});
export async function executeOmniAudioFormatConversion(request, dependencies = {}) {
    const selection = selectOmniAudioFormatConversionPractice({ ...dependencies, executor: dependencies.executor ?? request.executor });
    const auditMetadata = buildOmniPracticeAuditMetadata(selection);
    return executeOmniAudioFormatConversionCore({
        ...(request.input ?? {}),
        context: injectRuntimeInvocationMetadata(auditMetadata, request.input?.context, request),
        provider: selection.provider,
    });
}
export const omniAudioFormatConversionHandler = createOmniCoreHandler(omniAudioFormatConversionDefinition, executeOmniAudioFormatConversion);
