import { buildOmniPracticeAuditMetadata, createOmniBaseToolDefinition, createOmniCoreHandler, injectRuntimeInvocationMetadata, jsonSchema, selectOmniProviderPractice, } from '../../_shared/baseToolAdapter.js';
import { anthropicOmniGenerateAudioPractice } from './anthropic.js';
import { deepmindOmniGenerateAudioPractice } from './deepmind.js';
import { createOmniGenerateAudioRuntimeProvider, omniGenerateAudioDependencyDeclarations } from './dependencies.js';
import { openaiOmniGenerateAudioPractice } from './openai.js';
import { executeOmniGenerateAudioCore, } from './core.js';
export const omniGenerateAudioPractices = [
    anthropicOmniGenerateAudioPractice,
    openaiOmniGenerateAudioPractice,
    deepmindOmniGenerateAudioPractice,
];
export function selectOmniGenerateAudioPractice(dependencies = {}) {
    return selectOmniProviderPractice(omniGenerateAudioPractices, 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: createOmniGenerateAudioRuntimeProvider,
    });
}
export const omniGenerateAudioDefinition = createOmniBaseToolDefinition({
    toolId: "omni.generateAudio",
    title: "Generate audio",
    description: "Prepare an audio generation request for provider-backed runtime execution.",
    summary: "Prepare an audio generation request for provider-backed runtime execution.",
    storageGroup: "audioTransformer",
    riskLevel: "risky",
    permissionHints: ["provider:invoke", "omni:audio:generate", "omni:audio:write"],
    dependencies: omniGenerateAudioDependencyDeclarations,
    inputSchema: jsonSchema("omni.generateAudio.input", {
        type: 'object',
        additionalProperties: false,
        properties: {
            target: { type: 'object', additionalProperties: true },
            context: { type: 'object', additionalProperties: true },
        },
    }),
    outputSchema: jsonSchema("omni.generateAudio.output", { type: 'object', additionalProperties: true }),
    metadata: { omniRuntimePort: 'BaseToolExecutorPort.omni.transformMedia' },
});
export async function executeOmniGenerateAudio(request, dependencies = {}) {
    const selection = selectOmniGenerateAudioPractice({ ...dependencies, executor: dependencies.executor ?? request.executor });
    const auditMetadata = buildOmniPracticeAuditMetadata(selection);
    return executeOmniGenerateAudioCore({
        ...(request.input ?? {}),
        context: injectRuntimeInvocationMetadata(auditMetadata, request.input?.context, request),
        provider: selection.provider,
    });
}
export const omniGenerateAudioHandler = createOmniCoreHandler(omniGenerateAudioDefinition, executeOmniGenerateAudio);
