import { buildOmniPracticeAuditMetadata, createOmniBaseToolDefinition, createOmniCoreHandler, injectRuntimeInvocationMetadata, jsonSchema, selectOmniProviderPractice, } from '../../_shared/baseToolAdapter.js';
import { anthropicOmniListenAudioPractice } from './anthropic.js';
import { deepmindOmniListenAudioPractice } from './deepmind.js';
import { createOmniListenAudioRuntimeProvider, omniListenAudioDependencyDeclarations } from './dependencies.js';
import { openaiOmniListenAudioPractice } from './openai.js';
import { executeOmniListenAudioCore, } from './core.js';
export const omniListenAudioPractices = [
    anthropicOmniListenAudioPractice,
    openaiOmniListenAudioPractice,
    deepmindOmniListenAudioPractice,
];
export function selectOmniListenAudioPractice(dependencies = {}) {
    return selectOmniProviderPractice(omniListenAudioPractices, 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: createOmniListenAudioRuntimeProvider,
    });
}
export const omniListenAudioDefinition = createOmniBaseToolDefinition({
    toolId: "omni.listenAudio",
    title: "Listen to audio",
    description: "Prepare an audio understanding request while leaving decoding and provider lowering to runtime.",
    summary: "Prepare an audio understanding request while leaving decoding and provider lowering to runtime.",
    storageGroup: "audioTransformer",
    riskLevel: "normal",
    permissionHints: ["omni:audio:read", "provider:invoke"],
    dependencies: omniListenAudioDependencyDeclarations,
    inputSchema: jsonSchema("omni.listenAudio.input", {
        type: 'object',
        additionalProperties: false,
        properties: {
            target: { type: 'object', additionalProperties: true },
            context: { type: 'object', additionalProperties: true },
        },
    }),
    outputSchema: jsonSchema("omni.listenAudio.output", { type: 'object', additionalProperties: true }),
    metadata: { omniRuntimePort: 'BaseToolExecutorPort.omni.transformMedia' },
});
export async function executeOmniListenAudio(request, dependencies = {}) {
    const selection = selectOmniListenAudioPractice({ ...dependencies, executor: dependencies.executor ?? request.executor });
    const auditMetadata = buildOmniPracticeAuditMetadata(selection);
    return executeOmniListenAudioCore({
        ...(request.input ?? {}),
        context: injectRuntimeInvocationMetadata(auditMetadata, request.input?.context, request),
        provider: selection.provider,
    });
}
export const omniListenAudioHandler = createOmniCoreHandler(omniListenAudioDefinition, executeOmniListenAudio);
