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:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user