/** * buildMessageApiChart — PROOF of the locked "messageAPI merge-tree" shape * (MENTAL_MODEL.md ★ LOCKED DESIGN), LLM-only (no tools subflow yet). * * This is Step 1 of the agreed build order: prove the Context-selector → * slot subflows → messageAPI stage → Call-LLM tree works + renders, BEFORE * bringing it to the Agent (Step 2 adds the tools subflow + the loop). * * Chart shape (LLM-only): * * Seed * → Context (SELECTOR stage — picks which slots to engineer) * ├─ sf-system-prompt ┐ (selected branches run in parallel) * └─ sf-messages ──────┴─→ messageAPI stage (the join point) * → Call-LLM * * WHY a selector (not a plain fork): "Context = Selector stage" — it RETURNS * the list of slot branch ids to engineer this iteration, and `select()` * captures evidence (which slots + why). That is what will unify Static and * Dynamic agent in ONE chart later: Static picks only `messages` per loop; * Dynamic also picks `system-prompt` (and `tools`) when they re-engineer. * The picked-set IS the lit/unlit-pill signal. For this LLM-only proof the * selector picks BOTH slots (a one-shot call engineers everything once). * * WHY messageAPI is a REAL stage: it assembles the LLM request bulk that the * agent's `callLLM` builds invisibly today (callLLM.ts:132) — `systemPrompt` * (separate field) + `messages` (the conversation, incl. tool-results) → the * message-API payload. Making it a stage makes that assembly visible + * inspectable in Lens/Trace. (Tools is a separate field added at Call-LLM — * it joins in Step 2.) * * Slots are REAL subflows (reused verbatim: buildSystemPromptSlot / * buildMessagesSlot) writing the convention INJECTION_KEYS, so ContextRecorder * emits context.injected and Lens renders them — no bespoke collapser. */ import type { FlowChart } from 'footprintjs'; import type { LLMProvider } from '../../adapters/types.js'; export interface MessageApiChartDeps { readonly provider: LLMProvider; readonly model: string; readonly systemPrompt: string; readonly structureRecorders?: readonly import('footprintjs').StructureRecorder[]; } /** * Build the LLM-only messageAPI merge-tree chart. */ export declare function buildMessageApiChart(deps: MessageApiChartDeps): FlowChart;