/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { CommandKind, } from './types.js';
import { getRuntimeApi } from '../contexts/RuntimeContext.js';
export const modelCommand = {
    name: 'model',
    description: 'select or switch model',
    kind: CommandKind.BUILT_IN,
    action: async (context, args) => {
        const modelName = args?.trim();
        // Always use provider model dialog if no model specified
        if (!modelName) {
            return {
                type: 'dialog',
                dialog: 'providerModel',
            };
        }
        // Switch model in provider
        try {
            const runtime = getRuntimeApi();
            const result = await runtime.setActiveModel(modelName);
            return {
                type: 'message',
                messageType: 'info',
                content: `Switched from ${result.previousModel ?? 'unknown'} to ${result.nextModel} in provider '${result.providerName}'`,
            };
        }
        catch (error) {
            return {
                type: 'message',
                messageType: 'error',
                content: `Failed to switch model: ${error instanceof Error ? error.message : String(error)}`,
            };
        }
    },
};
//# sourceMappingURL=modelCommand.js.map