#pragma once // Step 1981: ProofPipelineRunner // Runs the full Phase 6 pipeline on a project spec string. // Splits specText on '.', classifies each sentence, looks up libraries via // ProjectStackDeclarator, annotates via TaskitemLibraryAnnotator. // Returns only enriched contracts (skips unknown domains and empty sentences). #include "TaskitemLibraryAnnotator.h" #include "ProjectStackDeclarator.h" #include #include #include namespace whetstone { class ProofPipelineRunner { public: ProofPipelineRunner(ProjectStackDeclarator declarator, LibraryCapabilityLedger ledger, LibrarySymbolCatalog catalog) : declarator_(std::move(declarator)) , ledger_(std::move(ledger)) , catalog_(std::move(catalog)) {} std::vector run(const std::string& specText) const { std::vector results; TaskitemLibraryAnnotator annotator; // Split specText on '.' std::vector sentences; std::string token; std::istringstream ss(specText); while (std::getline(ss, token, '.')) { sentences.push_back(token); } for (const auto& sentence : sentences) { // Skip empty or whitespace-only sentences bool blank = true; for (char c : sentence) { if (!std::isspace(static_cast(c))) { blank = false; break; } } if (blank) continue; // Get qualifying libraries from the declared stack auto classifier = OperationClassifier::withDefaultTaxonomy(); auto cr = classifier.classify(sentence); if (!cr.isKnown) continue; auto libs = declarator_.librariesForDomain(cr.domain, ledger_); if (libs.empty()) continue; auto ec = annotator.annotate(sentence, libs, ledger_, catalog_); if (ec.isEnriched()) { results.push_back(ec); } } return results; } private: ProjectStackDeclarator declarator_; LibraryCapabilityLedger ledger_; LibrarySymbolCatalog catalog_; }; } // namespace whetstone