"use strict";
/**
 * Unified Context — Single Source of Truth
 *
 * Merges the best of MegaContext (typed, deterministic scaffolding)
 * with Brain (narrative, registry, scan memory, checkpoints).
 *
 * context.json can contain ANY combination of these sections.
 * PlanningMode and ContextSyncer work with whatever sections are present.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getContextSummary = getContextSummary;
exports.isMegaContext = isMegaContext;
exports.isBrainContext = isBrainContext;
/**
 * Helper: Extract human-readable summary from any context shape
 */
function getContextSummary(ctx) {
    return {
        name: ctx.project?.name || ctx.brain?.narrative?.split(".")[0] || "Unknown",
        description: ctx.project?.description || ctx.brain?.narrative || "",
        entities: ctx.database?.entities
            ? Object.keys(ctx.database.entities)
            : [],
        routes: ctx.routing?.routes
            ? Object.keys(ctx.routing.routes)
            : [],
        roles: ctx.auth?.roles
            ? ctx.auth.roles.map((r) => r.name)
            : [],
        components: ctx.brain?.registry?.components || [],
        checkpoints: ctx.brain?.checkpoints || [],
        capabilities: ctx.capabilities
            ? Object.keys(ctx.capabilities)
            : [],
    };
}
/**
 * Helper: Check if context has MegaContext fields (scaffold-ready)
 */
function isMegaContext(ctx) {
    return !!ctx.database?.entities && !!ctx.routing?.routes && !!ctx.auth?.roles;
}
/**
 * Helper: Check if context has Brain fields (scanned project)
 */
function isBrainContext(ctx) {
    return !!ctx.brain?.narrative || !!ctx.brain?.registry || !!ctx.architecture;
}
//# sourceMappingURL=unified-context.js.map