Files
whetstone_DSL/editor/src/graduation/MultiPlanAlternativeGenerator.h
Bill 484d9e3f8c Sprint 64: Cost-Aware Transpilation Planning — Steps 869-878
Adds cost modeling and budget enforcement for transpilation runs:
- PortingCostModel: LOC + ambiguity → compute/review/total cost + tier (step 869)
- ReviewEffortEstimator: ambiguity/risk → minutes + complexity label (step 870)
- ComputeCostEstimator: prior run history → avg duration/tokens (step 871)
- MultiPlanAlternativeGenerator: cheap/balanced/rigorous profiles (step 872)
- BudgetPolicyEnforcer: approve/requires_token/rejected decisions (step 873)
- CostQualityTradeoffReport: efficiency-based plan recommendation (step 874)
- whetstone_plan_transpilation_run MCP tool (step 875)
- whetstone_estimate_porting_cost MCP tool (step 876)
- CostTelemetryIntegration: cost error tracking + over-budget count (step 877)
- Sprint64IntegrationSummary (step 878)

All 10 steps passing (94 tests). Policy: over-budget plans require
explicit reviewer approval token.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 18:49:04 -07:00

34 lines
1.2 KiB
C++

#pragma once
// Step 872: Multi-plan alternative generator.
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
struct TranspilationPlanAlternative {
std::string planId;
std::string profile; // "cheap", "balanced", "rigorous"
float estimatedCost = 0.0f;
float estimatedQuality = 0.0f;
bool requiresReview = false;
};
class MultiPlanAlternativeGenerator {
public:
static std::vector<TranspilationPlanAlternative> generate(
const std::string& pairId, float baseCost) {
(void)pairId;
std::vector<TranspilationPlanAlternative> plans;
plans.push_back({"plan-cheap", "cheap", baseCost * 0.5f, 0.6f, false});
plans.push_back({"plan-balanced", "balanced", baseCost, 0.8f, false});
plans.push_back({"plan-rigorous", "rigorous", baseCost * 2.0f, 0.95f, true});
return plans;
}
static nlohmann::json toJson(const TranspilationPlanAlternative& p) {
return {{"plan_id", p.planId}, {"profile", p.profile},
{"estimated_cost", p.estimatedCost},
{"estimated_quality", p.estimatedQuality},
{"requires_review", p.requiresReview}};
}
};