refactor: systemPrompt → pure string, threadId injected by agent layer

- CreateRoleArgs.systemPrompt simplified to string (no more ctx callback)
- buildAgentPrompt injects real ctx.threadId in Tools section
- All four roles compute prompt at construction time from config only
- Removed duplicate ctx.threadId injection from reviewer/committer prompts

小橘 <xiaoju@shazhou.work>
This commit is contained in:
2026-05-06 12:25:41 +00:00
parent c9cdfe37db
commit fce2bf7441
9 changed files with 22 additions and 51 deletions
@@ -1,4 +1,4 @@
import type { AgentFn, Role, ThreadContext } from "@uncaged/workflow";
import type { AgentFn, Role } from "@uncaged/workflow";
import {
createRole,
decorateRole,
@@ -46,13 +46,9 @@ function resolveExtractDryRun(extractDryRun: boolean | null): boolean {
return extractDryRun === true;
}
function committerSystemPrompt(ctx: ThreadContext, config: CommitterConfig): string {
function committerSystemPrompt(config: CommitterConfig): string {
return `You are the git committer for this workflow. The project is at \`${config.cwd}\`.
## Context
Use \`uncaged-workflow thread ${ctx.threadId}\` to read the full workflow thread for context on what was done and why.
## Task
Create a branch, commit the changes, and push. Report whether the push succeeded or failed, the branch name, and the commit SHA.
@@ -77,7 +73,7 @@ export function createCommitterRole(
const inner: Role<CommitterMeta> = createRole({
name: "committer",
schema: committerMetaSchema,
systemPrompt: async (ctx) => committerSystemPrompt(ctx, config),
systemPrompt: committerSystemPrompt(config),
agent: adapter,
extract,
});