refactor(pbl-v2): split the planner core from the loop; inject the LLM call path (#1069)

Implements #1062. Pure planner-core extracted from the loop's file; both planners receive their LLM entry as a parameter (call sites pass the real callLLM unchanged); operations/ split into kernel vs runtime with a lint-enforced boundary; planner prompts pinned byte-identical via fixtures generated from the pre-refactor implementation.
This commit is contained in:
wyuc
2026-08-06 05:28:56 -04:00
committed by GitHub
parent 9d2689439e
commit 3f5c51bdba
68 changed files with 1229 additions and 650 deletions
+5 -3
View File
@@ -42,8 +42,10 @@ import { createAnthropic } from '@ai-sdk/anthropic';
import { createOpenAI } from '@ai-sdk/openai';
import { generateText, type LanguageModel } from 'ai';
import { generatePBLV2Project, PlannerV2Error } from '@/lib/pbl/v2/agents/planner';
import { callLLM } from '@/lib/ai/llm';
import { generatePBLV2Project } from '@/lib/pbl/v2/agents/planner';
import { generatePBLV2ProjectSingleCall } from '@/lib/pbl/v2/agents/planner-single-call';
import { PlannerV2Error } from '@/lib/pbl/v2/agents/planner-core';
import { parseJsonResponse } from '@/lib/generation/json-repair';
import { buildCompareHtml } from './compare-html';
import type { PBLPlannerV2Input, PBLProjectV2 } from '@/lib/pbl/v2/types';
@@ -455,8 +457,8 @@ function runVariant(
thinkingConfig?: ThinkingConfig,
): Promise<PBLProjectV2> {
return variant === 'single-call'
? generatePBLV2ProjectSingleCall(input, model, undefined, thinkingConfig)
: generatePBLV2Project(input, model, undefined, thinkingConfig);
? generatePBLV2ProjectSingleCall(input, model, callLLM, undefined, thinkingConfig)
: generatePBLV2Project(input, model, callLLM, undefined, thinkingConfig);
}
async function runOne(