- 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
699 B
TypeScript
21 lines
699 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 { testPrompt } from "./prompt.js";
|
|
|
|
export const testMetaSchema = z.object({
|
|
passed: z.boolean().describe("true if all test commands passed"),
|
|
});
|
|
export type TestMeta = z.infer<typeof testMetaSchema>;
|
|
|
|
export function createTestRole(adapter: AgentFn, extract: LlmExtractorConfig): Role<TestMeta> {
|
|
return createRole(
|
|
adapter,
|
|
async (ctx: ThreadContext) => testPrompt({ threadId: ctx.start.meta.threadId }),
|
|
testMetaSchema,
|
|
extract,
|
|
);
|
|
}
|