24 lines
726 B
TypeScript
24 lines
726 B
TypeScript
import type { LlmProvider } from "@uncaged/nerve-workflow-utils";
|
|
import { createCursorRole } from "@uncaged/nerve-workflow-utils";
|
|
import { coderPrompt } from "./prompt.js";
|
|
import { z } from "zod";
|
|
|
|
export const coderMetaSchema = z.object({
|
|
done: z.boolean().describe("true if the workflow files were created and build passes"),
|
|
});
|
|
export type CoderMeta = z.infer<typeof coderMetaSchema>;
|
|
|
|
export type BuildCoderDeps = {
|
|
provider: LlmProvider;
|
|
cwd: string;
|
|
};
|
|
|
|
export function buildCoderRole({ provider, cwd }: BuildCoderDeps) {
|
|
return createCursorRole<CoderMeta>({
|
|
cwd,
|
|
mode: "default",
|
|
prompt: async (threadId) => coderPrompt({ threadId }),
|
|
extract: { provider, schema: coderMetaSchema },
|
|
});
|
|
}
|