export function createThreadSuiteMemoryEvents(inventory, options, semanticDiscovery, synthesis) {
    if (options.profile === "lite")
        return [];
    const generatedAt = new Date().toISOString();
    const staleAfter = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30).toISOString();
    return buildCapsules(inventory, semanticDiscovery, synthesis).map((capsule) => ({
        type: capsule.type,
        summary: capsule.summary,
        content: capsule.content,
        priority: capsule.priority,
        filePaths: capsule.filePaths,
        tags: ["threadsuite", capsule.category, ...capsule.tags],
        metadata: {
            threadsuiteProfile: options.profile,
            category: capsule.category,
            confidence: inventory.confidence,
            generatedAt,
            staleAfter,
            ...capsule.metadata,
        },
    }));
}
function buildCapsules(inventory, semanticDiscovery, synthesis) {
    if (synthesis?.memoryCapsules.length) {
        return synthesis.memoryCapsules.map((capsule) => ({
            type: "context_candidate",
            category: capsule.category,
            summary: capsule.summary,
            content: capsule.content,
            priority: 4,
            filePaths: capsule.evidence,
            tags: ["synthesis", "evidence-backed"],
            metadata: { evidenceCount: capsule.evidence.length },
        }));
    }
    return [
        {
            type: "context_candidate",
            category: "project_identity",
            summary: `ThreadSuite detected ${inventory.projectType} project with ${inventory.confidence} confidence`,
            content: buildProjectIdentityContent(inventory),
            priority: 4,
            filePaths: inventory.manifests.map((manifest) => manifest.path),
            tags: ["project-identity", "inferred"],
            metadata: { projectType: inventory.projectType },
        },
        {
            type: "handoff",
            category: "current_goal",
            summary: `ThreadSuite project purpose: ${semanticDiscovery.projectPurpose.value}`,
            content: `Purpose evidence: ${semanticDiscovery.projectPurpose.sources.join(", ") || "unknown"}. Bootstrap continuity, context, ADRs, memory capsules, and project index before broad exploration.`,
            priority: 4,
            filePaths: ["STATE.md", "ACTIVE_QUEUE.md", "CONTEXT.md"],
            tags: ["goal", "continuity"],
        },
        {
            type: "handoff",
            category: "active_queue_summary",
            summary: "ThreadSuite queue starts with reviewing generated project context",
            content: "Review generated CONTEXT.md, proposed ADRs, validation strategy, and inferred facts before acceptance.",
            priority: 3,
            filePaths: ["ACTIVE_QUEUE.md"],
            tags: ["queue", "next-action"],
        },
        {
            type: "context_candidate",
            category: "validation_contract",
            summary: "ThreadSuite validation should start lightweight and non-destructive",
            content: semanticDiscovery.commands.length > 0
                ? `Detected commands: ${semanticDiscovery.commands.map((command) => `${command.name}=${command.command}`).join("; ")}`
                : "Validation is pending. Prefer lightweight checks and explicit user approval before heavy builds/tests.",
            priority: 3,
            filePaths: inventory.manifests.map((manifest) => manifest.path),
            tags: ["validation", "safety"],
        },
        {
            type: "decision_candidate",
            category: "user_preferences",
            summary: "ThreadSuite should be complete by default and lite only by request",
            content: "User preference: default `/threadsuite` gives the agent all useful safe infrastructure; `/threadsuite lite` is the smaller path.",
            priority: 4,
            filePaths: [],
            tags: ["preference", "decision"],
        },
        {
            type: "context_candidate",
            category: "important_paths",
            summary: "ThreadSuite indexed important project paths and entrypoints",
            content: buildImportantPathsContent(inventory, semanticDiscovery),
            priority: 3,
            filePaths: [
                ...inventory.sourceRoots,
                ...inventory.testRoots,
                ...inventory.documents.map((document) => document.path),
            ],
            tags: ["paths", "project-structure"],
        },
        {
            type: "adr_candidate",
            category: "accepted_decisions",
            summary: "ThreadSuite found ADR sources for decision review",
            content: buildFileListContent("ADR files", inventory.adrFiles),
            priority: 3,
            filePaths: inventory.adrFiles.map((file) => file.path),
            tags: ["adr", "decisions"],
            metadata: { adrFileCount: inventory.adrFiles.length },
        },
        {
            type: "open_question",
            category: "open_questions",
            summary: "ThreadSuite inferred facts need user review",
            content: "Open question: which generated context facts and ADR candidates should be accepted as authoritative?",
            priority: 3,
            filePaths: ["CONTEXT.md", "docs/adr/"],
            tags: ["review", "inferred"],
        },
        {
            type: "blocker",
            category: "known_blockers",
            summary: "ThreadSuite has no known runtime blockers after bootstrap",
            content: "No blocker detected by inventory. Validation and user review are still pending.",
            priority: 2,
            filePaths: [],
            tags: ["blockers", "status"],
        },
        {
            type: "file_modified",
            category: "recent_changes",
            summary: "ThreadSuite generated project intelligence scaffolding",
            content: "Generated or updated project index, operating memory, context files, ADR candidates, and memory capsules according to profile.",
            priority: 3,
            filePaths: [".threadwell/project-index.json", ".threadwell/continuity/operating-memory.json"],
            tags: ["recent-change", "generated"],
        },
    ];
}
function buildProjectIdentityContent(inventory) {
    return [
        "ThreadSuite inferred project identity from bounded inventory.",
        `Project type: ${inventory.projectType}`,
        `Confidence: ${inventory.confidence}`,
        "Manifests:",
        ...formatFileLines(inventory.manifests),
    ].join("\n");
}
function buildImportantPathsContent(inventory, semanticDiscovery) {
    return [
        "Source roots:",
        ...formatList(inventory.sourceRoots),
        "Test roots:",
        ...formatList(inventory.testRoots),
        "Important documents:",
        ...formatFileLines(inventory.documents),
        "Entrypoints:",
        ...formatList(semanticDiscovery.entrypoints.map((entrypoint) => `${entrypoint.path}: ${entrypoint.value}`)),
    ].join("\n");
}
function buildFileListContent(title, files) {
    return [title, ...formatFileLines(files)].join("\n");
}
function formatFileLines(files) {
    return files.length > 0 ? files.map((file) => `- ${file.path} (${file.sizeBytes} bytes)`) : ["- none detected"];
}
function formatList(items) {
    return items.length > 0 ? items.map((item) => `- ${item}`) : ["- none detected"];
}
//# sourceMappingURL=memory-bootstrap.js.map