"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskRegistry = void 0;
class TaskRegistry {
    tasks = new Map();
    register(taskId, taskInfo) {
        this.tasks.set(taskId, taskInfo);
    }
    get(taskId) {
        return this.tasks.get(taskId);
    }
    update(taskId, updates) {
        const task = this.tasks.get(taskId);
        if (task) {
            Object.assign(task, updates);
        }
    }
    delete(taskId) {
        return this.tasks.delete(taskId);
    }
    has(taskId) {
        return this.tasks.has(taskId);
    }
    getAll() {
        return Array.from(this.tasks.values());
    }
    getEntries() {
        return Array.from(this.tasks.entries());
    }
    getMap() {
        return this.tasks;
    }
    clear() {
        this.tasks.clear();
    }
    count() {
        return this.tasks.size;
    }
    displaySingleTask(task) {
        console.log(`\n📋 Task Details: ${task.taskId}`);
        console.log("─".repeat(50));
        console.log(`Agent: ${task.agentName}`);
        console.log(`Status: ${task.status}`);
        console.log(`Initial Input: ${task.initialInput}`);
        console.log(`Start Time: ${new Date(task.startTime).toLocaleString()}`);
        if (task.endTime) {
            console.log(`End Time: ${new Date(task.endTime).toLocaleString()}`);
            console.log(`Duration: ${Math.round((task.endTime - task.startTime) / 1000)}s`);
        }
        else {
            console.log(`Running for: ${Math.round((Date.now() - task.startTime) / 1000)}s`);
        }
        console.log(`Total Cost: $${task.totalCost.toFixed(3)}`);
        console.log("─".repeat(50));
    }
}
exports.TaskRegistry = TaskRegistry;
//# sourceMappingURL=TaskRegistry.js.map