"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PromptToIntentAgent = void 0;
const AICore_1 = require("../../core/ai/AICore");
class PromptToIntentAgent {
    constructor() {
        this.name = "PromptToIntentAgent";
        this.description = "Converts natural language prompts into structured intents with feature targets and operation plans.";
        this.personality = "A sharp product manager who translates ambiguous requests into precise technical requirements.";
        this.llmProvider = "github-models";
        this.expertise = ["Natural Language Understanding", "Intent Classification", "Requirement Analysis", "Prompt Engineering"];
    }
    getAICore() {
        if (!this.ai) {
            try {
                this.ai = AICore_1.AICore.getInstance();
            }
            catch {
                this.ai = AICore_1.AICore.getInstance({
                    workingDirectory: process.cwd(),
                    fallbackEnabled: true,
                });
            }
        }
        return this.ai;
    }
    async run(input) {
        const aiCore = this.getAICore();
        try {
            const result = await aiCore.generateStructuredText(`You are analyzing a developer prompt to convert it into a structured intent.

PROMPT: "${input.prompt}"

Classify the intent type:
- "feature": adding new functionality
- "fix": bug fix or error resolution
- "refactor": restructuring without changing behavior
- "document": documentation changes
- "test": test additions or modifications
- "config": configuration changes
- "unknown": cannot determine

Identify target features (from context clues), suggest operations, priority, and confidence (0-1).`, `{
          "intentType": "feature | fix | refactor | document | test | config | unknown",
          "targetFeatures": ["string"],
          "operations": ["string"],
          "priority": "high | medium | low",
          "confidence": 0.0,
          "reasoning": "string"
        }`);
            return {
                originalPrompt: input.prompt,
                intentType: result.intentType,
                targetFeatures: result.targetFeatures || [],
                operations: result.operations || [],
                priority: result.priority,
                confidence: result.confidence,
                reasoning: result.reasoning,
            };
        }
        catch (error) {
            return {
                originalPrompt: input.prompt,
                intentType: "unknown",
                targetFeatures: [],
                operations: [],
                priority: "medium",
                confidence: 0,
                reasoning: `Failed to analyze prompt: ${error.message}`,
            };
        }
    }
    async validate(input) {
        return !!input.prompt && input.prompt.trim().length > 0;
    }
}
exports.PromptToIntentAgent = PromptToIntentAgent;
//# sourceMappingURL=PromptToIntentAgent.js.map