feat(FN-3097): wire plugin prompt contributions into execution surfaces
- Add plugin prompt contribution support across executor, triage, reviewer, and heartbeat instruction builders - Thread plugin runner context into execution prompt assembly and preserve source issue commit reference hints - Expand engine tests to cover prompt contribution injection behavior and regression scenarios - Update architecture and plugin authoring docs with prompt surface integration details Fusion-Task-Id: FN-3097
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
resolveAgentInstructionsWithRatings,
|
||||
buildAgentChatPrompt,
|
||||
buildSystemPromptWithInstructions,
|
||||
buildPluginPromptSection,
|
||||
ensureDefaultHeartbeatProcedureFile,
|
||||
resolveAgentHeartbeatProcedure,
|
||||
} from "../agent-instructions.js";
|
||||
@@ -555,6 +556,38 @@ describe("buildSystemPromptWithInstructions", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildPluginPromptSection", () => {
|
||||
it("returns empty string when pluginRunner is undefined", () => {
|
||||
expect(buildPluginPromptSection("triage", undefined)).toBe("");
|
||||
});
|
||||
|
||||
it("returns empty string when no contributions match", () => {
|
||||
const pluginRunner = {
|
||||
getPromptContributionsForSurface: vi.fn().mockReturnValue([]),
|
||||
};
|
||||
|
||||
expect(buildPluginPromptSection("triage", pluginRunner as any)).toBe("");
|
||||
});
|
||||
|
||||
it("formats grouped plugin sections and prepend-before-append ordering", () => {
|
||||
const pluginRunner = {
|
||||
getPromptContributionsForSurface: vi.fn().mockReturnValue([
|
||||
{ pluginId: "plugin-b", contribution: { surface: "triage", content: "append B1" }, config: {} },
|
||||
{ pluginId: "plugin-a", contribution: { surface: "triage", content: "prepend A1", position: "prepend" }, config: {} },
|
||||
{ pluginId: "plugin-a", contribution: { surface: "triage", content: "prepend A2", position: "prepend" }, config: {} },
|
||||
{ pluginId: "plugin-c", contribution: { surface: "triage", content: "append C1", position: "append" }, config: {} },
|
||||
]),
|
||||
};
|
||||
|
||||
const result = buildPluginPromptSection("triage", pluginRunner as any);
|
||||
|
||||
expect(result).toContain("## Plugin: plugin-a\n\nprepend A1\n\nprepend A2");
|
||||
expect(result).toContain("## Plugin: plugin-b\n\nappend B1");
|
||||
expect(result).toContain("## Plugin: plugin-c\n\nappend C1");
|
||||
expect(result.indexOf("## Plugin: plugin-a")).toBeLessThan(result.indexOf("## Plugin: plugin-b"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("diagnostics logging", () => {
|
||||
let testDir: string;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user