"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VoiceModule = void 0;
const BaseChatModule_1 = require("./BaseChatModule");
const microphone_1 = require("../../microphone");
class VoiceModule extends BaseChatModule_1.BaseChatModule {
    name = "voice";
    description = "Voice input functionality";
    getCommands() {
        return [
            {
                name: "voice",
                description: "Toggle voice input mode",
                handler: this.handleVoiceCommand.bind(this),
            },
        ];
    }
    getModes() {
        return [
            {
                name: "voice",
                description: "Voice input mode",
                active: false,
            },
        ];
    }
    async handleVoiceCommand(args) {
        const voiceMode = this.chatService?.getMode("voice");
        const context = this.chatService?.getContext();
        if (!voiceMode)
            return;
        voiceMode.active = !voiceMode.active;
        const newVoiceMode = !context?.voiceMode;
        this.chatService?.setContext({ voiceMode: newVoiceMode });
        console.log(`Voice mode: ${newVoiceMode ? "enabled" : "disabled"}`);
    }
    async getVoiceInput(prompt) {
        try {
            console.log("🎤 Listening... (Press Enter to record)");
            const value = await (0, microphone_1.voiceToText)();
            return value;
        }
        catch (error) {
            console.error("Error getting voice input:", error);
            return "";
        }
    }
    async handleInput(input, context) {
        const voiceMode = this.chatService?.getMode("voice");
        if (!voiceMode?.active) {
            return false;
        }
        return false;
    }
}
exports.VoiceModule = VoiceModule;
//# sourceMappingURL=VoiceModule.js.map