fix(uwf-agent-hermes): consume outputFormatInstruction in prompt

buildHermesPrompt was ignoring ctx.outputFormatInstruction — the
deliverable format and scope constraint were injected into context
but never passed to the agent.

Now prepends it before systemPrompt (deliverable-first principle).

Refs #355
This commit is contained in:
2026-05-19 06:23:13 +00:00
parent a991393053
commit c0ac4ade09
+5 -1
View File
@@ -35,7 +35,11 @@ function buildHistorySummary(steps: AgentContext["steps"]): string {
export function buildHermesPrompt(ctx: AgentContext): string {
const roleDef = ctx.workflow.roles[ctx.role];
const systemPrompt = roleDef?.systemPrompt ?? "";
const parts: string[] = [systemPrompt, "", "## Task", ctx.start.prompt];
const parts: string[] = [];
if (ctx.outputFormatInstruction !== undefined && ctx.outputFormatInstruction !== "") {
parts.push(ctx.outputFormatInstruction, "");
}
parts.push(systemPrompt, "", "## Task", ctx.start.prompt);
const historyBlock = buildHistorySummary(ctx.steps);
if (historyBlock !== "") {
parts.push("", historyBlock);