diff --git a/packages/prompt-variance/src/assemble.test.ts b/packages/prompt-variance/src/assemble.test.ts deleted file mode 100644 index a0c0aeeca..000000000 --- a/packages/prompt-variance/src/assemble.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { describe, expect, test } from "bun:test"; -import { assemble } from "./assemble.js"; -import { claudeRow, defaultRow, gptRow, grokRow, museRow } from "./rows.js"; - -const SECTIONS = ["contract", "Tools (names only): read_file", "context"]; - -describe("assemble", () => { - test("joins sections with the residual as the last section", () => { - const out = assemble(SECTIONS, grokRow); - expect(out).toContain("contract"); - expect(out.trimEnd().endsWith(grokRow.residual)).toBe(true); - }); - - test("a row without residual leaves the sections unchanged", () => { - expect(assemble(SECTIONS, defaultRow)).toBe(SECTIONS.join("\n\n")); - }); - - test("muse residual closes the prompt like the shipped tail append", () => { - const out = assemble(SECTIONS, museRow); - expect(out.trimEnd().endsWith(museRow.residual)).toBe(true); - }); - - test("claude and gpt residuals close the prompt the same way", () => { - expect( - assemble(SECTIONS, claudeRow).trimEnd().endsWith(claudeRow.residual), - ).toBe(true); - expect(assemble(SECTIONS, gptRow).trimEnd().endsWith(gptRow.residual)).toBe( - true, - ); - }); - - test("tool mounting is out of scope: assemble returns a string, not tool names", () => { - const out = assemble(SECTIONS, grokRow); - expect(typeof out).toBe("string"); - }); -}); diff --git a/packages/prompt-variance/src/assemble.ts b/packages/prompt-variance/src/assemble.ts deleted file mode 100644 index fd56fc1df..000000000 --- a/packages/prompt-variance/src/assemble.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { PromptVarianceRow } from "./rows.js"; - -/** - * Append a family variance row's residual at the tail of the assembled - * sections (CL-8269). An empty residual leaves the sections unchanged. - * Residuals render last so they cannot disturb the cached prompt prefix. - * Tool mounting is out of scope: run.ts applies - * ModelFamilyPolicy.advertisedToolDeny at mount time. - */ -export function assemble( - sections: readonly string[], - familyRow: PromptVarianceRow, -): string { - if (familyRow.residual.length === 0) return sections.join("\n\n"); - return [...sections, familyRow.residual].join("\n\n"); -} diff --git a/packages/prompt-variance/src/index.ts b/packages/prompt-variance/src/index.ts index 43b010f03..b46dd9fe4 100644 --- a/packages/prompt-variance/src/index.ts +++ b/packages/prompt-variance/src/index.ts @@ -1,5 +1,3 @@ -export { assemble } from "./assemble.js"; -export { resolvePromptVariance } from "./resolve.js"; export { claudeRow, defaultRow, diff --git a/packages/prompt-variance/src/resolve.test.ts b/packages/prompt-variance/src/resolve.test.ts deleted file mode 100644 index 8e071683c..000000000 --- a/packages/prompt-variance/src/resolve.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { describe, expect, test } from "bun:test"; -import { resolvePromptVariance } from "./resolve.js"; -import { grokRow } from "./rows.js"; - -describe("resolvePromptVariance", () => { - test("resolves each family to its row", () => { - expect(resolvePromptVariance({ family: "default" }).id).toBe("default"); - expect(resolvePromptVariance({ family: "muse" }).id).toBe("muse"); - expect(resolvePromptVariance({ family: "grok" }).id).toBe("grok"); - expect(resolvePromptVariance({ family: "claude" }).id).toBe("claude"); - expect(resolvePromptVariance({ family: "gpt" }).id).toBe("gpt"); - }); - - test("grok keeps its finish-bias residual on leaves", () => { - const row = resolvePromptVariance({ family: "grok", orchestrator: false }); - expect(row.residual).toBe(grokRow.residual); - }); - - test("grok on orchestrators falls back to the default row", () => { - const row = resolvePromptVariance({ family: "grok", orchestrator: true }); - expect(row.id).toBe("default"); - expect(row.residual).toBe(""); - }); - - test("claude keeps its task_guidance block on leaves, not orchestrators", () => { - expect( - resolvePromptVariance({ family: "claude", orchestrator: false }).residual, - ).toContain(""); - const orch = resolvePromptVariance({ - family: "claude", - orchestrator: true, - }); - expect(orch.id).toBe("default"); - expect(orch.residual).toBe(""); - }); - - test("muse keeps its residual on leaves and orchestrators alike", () => { - expect( - resolvePromptVariance({ family: "muse", orchestrator: false }).residual, - ).not.toBe(""); - expect( - resolvePromptVariance({ family: "muse", orchestrator: true }).residual, - ).not.toBe(""); - }); - - test("gpt keeps its narrate-before-tools nudge on leaves and orchestrators alike", () => { - expect( - resolvePromptVariance({ family: "gpt", orchestrator: false }).residual, - ).toContain("Narrate before tools"); - expect( - resolvePromptVariance({ family: "gpt", orchestrator: true }).residual, - ).toContain("Narrate before tools"); - }); -}); diff --git a/packages/prompt-variance/src/resolve.ts b/packages/prompt-variance/src/resolve.ts deleted file mode 100644 index d3e7d100d..000000000 --- a/packages/prompt-variance/src/resolve.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { - defaultRow, - FAMILY_ROWS, - type PromptVarianceFamily, - type PromptVarianceRow, -} from "./rows.js"; - -/** - * Resolve the variance row for a family, mirroring the leaves-only gates in - * the model family policy: the grok finish-bias residual and the claude - * task_guidance block only make sense on leaf workers, so orchestrators - * fall back to the default row. Muse keeps its residual on both — the - * constructors append the same text at the tail either way — and gpt keeps - * its narrate-before-tools nudge on primaries and leaves alike. - */ -export function resolvePromptVariance(input: { - family: PromptVarianceFamily; - orchestrator?: boolean; -}): PromptVarianceRow { - if (input.orchestrator === true) { - if (input.family === "grok" || input.family === "claude") { - return defaultRow; - } - } - return FAMILY_ROWS[input.family]; -} diff --git a/scripts/dead-export-allowlist.txt b/scripts/dead-export-allowlist.txt index 34948e783..0ef6a8492 100644 --- a/scripts/dead-export-allowlist.txt +++ b/scripts/dead-export-allowlist.txt @@ -58,8 +58,6 @@ packages/opencode-go/src/models.ts: readonly # to the exact ts-prune flags so a new dead export in this barrel fails the # guard instead of hiding under a whole-file exemption. Remove each entry # with the export it names if the public surface shrinks. -packages/prompt-variance/src/index.ts: assemble -packages/prompt-variance/src/index.ts: resolvePromptVariance packages/prompt-variance/src/index.ts: defaultRow packages/prompt-variance/src/index.ts: FAMILY_IDS packages/prompt-variance/src/index.ts: FAMILY_ROWS