xonecas.io
64875
Mc

mini-coder / commit c19e1c0

refactor(llm-api): remove aggregated re-exports from turn.ts

turn.ts was re-exporting symbols from history-transforms.ts and
turn-context.ts so tests could import from one file. This made turn.ts
appear to contain code it doesn't and obscured the real module boundaries.

- turn.test.ts now imports from the actual source modules
- turn.ts retains only ContextPruningMode (public API used by many
  consumers) and CoreMessage (defined in turn.ts itself)

xonecas2026-03-14 c19e1c07c3676d1e253cc72489721813c157f8ee parent 5e8abb4

2 files changed

src/llm-api/turn.test.ts+8−6
@@ -1,17 +1,19 @@
11 import { describe, expect, test } from "bun:test";
2-import type { CoreMessage } from "./turn.ts";
32 import {
4- annotateAnthropicCacheBreakpoints,
5- applyContextPruning,
6- compactToolResultPayloads,
7- getMessageDiagnostics,
83 getReasoningDeltaFromStreamChunk,
94 isOpenAIGPT,
105 normalizeOpenAICompatibleToolCallInputs,
116 sanitizeGeminiToolMessages,
127 stripGPTCommentaryFromHistory,
138 stripOpenAIItemIdsFromHistory,
14-} from "./turn.ts";
9+} from "./history-transforms.ts";
10+import {
11+ annotateAnthropicCacheBreakpoints,
12+ applyContextPruning,
13+ compactToolResultPayloads,
14+ getMessageDiagnostics,
15+} from "./turn-context.ts";
16+import type { CoreMessage } from "./turn.ts";
1517
1618 describe("isOpenAIGPT", () => {
1719 test("matches openai/gpt-* models", () => {
src/llm-api/turn.ts+3−13
@@ -26,6 +26,8 @@ import {
2626 getMessageDiagnostics,
2727 getMessageStats,
2828 } from "./turn-context.ts";
29+
30+export type { ContextPruningMode } from "./turn-context.ts";
2931 import {
3032 mapStreamChunkToTurnEvent,
3133 shouldLogStreamChunk,
@@ -68,19 +70,7 @@ const mergeDeep = (
6870 return output;
6971 };
7072
71-export {
72- annotateAnthropicCacheBreakpoints,
73- applyContextPruning,
74- compactToolResultPayloads,
75- type ContextPruningMode,
76- getMessageDiagnostics,
77- getReasoningDeltaFromStreamChunk,
78- isOpenAIGPT,
79- normalizeOpenAICompatibleToolCallInputs,
80- sanitizeGeminiToolMessages,
81- stripGPTCommentaryFromHistory,
82- stripOpenAIItemIdsFromHistory,
83-};
73+
8474
8575 /**
8676 * Run a single agent turn against the model.