CUDALibraryProfile, CUDASymbolCatalog, ProjectStackDeclarator, ProofPipelineRunner, Sprint290IntegrationSummary. 25/25 tests passing. End-to-end proof: "GPU matrix multiply. JSON result serialization." -> cublas for compute.matrix, nlohmann_json for serialization.json. Phase 6: Library Dispatch COMPLETE (Sprints 286-290, steps 1958-1982). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
69 lines
2.2 KiB
C++
69 lines
2.2 KiB
C++
#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 <sstream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
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<EnrichedExecutionContract> run(const std::string& specText) const {
|
|
std::vector<EnrichedExecutionContract> results;
|
|
TaskitemLibraryAnnotator annotator;
|
|
|
|
// Split specText on '.'
|
|
std::vector<std::string> 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<unsigned char>(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
|