- Role: (start, messages) → (ctx: ThreadContext) - AgentFn prompt callbacks: (start) → (ctx) - ModeratorContext → ThreadContext - 13 files updated across knowledge-extraction and solve-issue workflows 小橘 <xiaoju@shazhou.work>
21 lines
733 B
TypeScript
21 lines
733 B
TypeScript
import type { AgentFn, Role, ThreadContext } from "@uncaged/nerve-core";
|
|
import type { LlmExtractorConfig } from "@uncaged/nerve-workflow-utils";
|
|
import { createRole } from "@uncaged/nerve-workflow-utils";
|
|
import { z } from "zod";
|
|
|
|
import { preparePrompt } from "./prompt.js";
|
|
|
|
export const prepareMetaSchema = z.object({
|
|
ready: z.boolean().describe("true if repo is ready and baseline build ok"),
|
|
});
|
|
export type PrepareMeta = z.infer<typeof prepareMetaSchema>;
|
|
|
|
export function createPrepareRole(adapter: AgentFn, extract: LlmExtractorConfig): Role<PrepareMeta> {
|
|
return createRole(
|
|
adapter,
|
|
async (ctx: ThreadContext) => preparePrompt({ threadId: ctx.start.meta.threadId }),
|
|
prepareMetaSchema,
|
|
extract,
|
|
);
|
|
}
|