"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.doDashboard = doDashboard;
exports.doPerf = doPerf;
const utils_1 = require("../utils");
const project = (0, utils_1.getProjectName)();
function doDashboard() {
    (0, utils_1.printHeader)('Cell Dashboard');
    const endpoints = [
        { name: 'Memory Stats', path: '/memory/stats' },
        { name: 'Behavior Summary', path: `/behavior/summary?project=${project}` },
        { name: 'Recent Sessions', path: `/session/history?project=${project}&limit=3` },
    ];
    Promise.all(endpoints.map(e => (0, utils_1.httpGet)(e.path).catch(() => null))).then(results => {
        for (let i = 0; i < endpoints.length; i++) {
            const result = results[i];
            if (result) {
                console.log(utils_1.C.bold(`  ${endpoints[i].name}:`));
                if (typeof result === 'object') {
                    for (const [key, value] of Object.entries(result)) {
                        if (typeof value === 'object' && value !== null) {
                            console.log(`    ${key}: ${JSON.stringify(value).substring(0, 100)}`);
                        }
                        else {
                            console.log(`    ${key}: ${value}`);
                        }
                    }
                }
                console.log();
            }
        }
    }).catch(() => (0, utils_1.printWarning)('Failed to load dashboard'));
}
function doPerf() {
    (0, utils_1.printHeader)('Cell Performance');
    (0, utils_1.httpGet)('/daemon/health').then((result) => {
        console.log(utils_1.C.bold('  Daemon Health:'));
        console.log(`    Status: ${result.status}`);
        console.log(`    Uptime: ${result.uptime}s`);
        console.log(`    Memory: ${result.memory?.rss || 'N/A'}`);
        console.log(`    Modules: ${result.modules || 0}`);
        console.log(`    Watchdog: ${result.watchdog || 'N/A'}`);
    }).catch(() => (0, utils_1.printWarning)('Failed to get daemon health'));
}
//# sourceMappingURL=dashboard.js.map