- 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
763 B
TypeScript
21 lines
763 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 { readIssuePrompt } from "./prompt.js";
|
|
|
|
export const readIssueMetaSchema = z.object({
|
|
ready: z.boolean().describe("true if issue content was fetched and markers are present"),
|
|
});
|
|
export type ReadIssueMeta = z.infer<typeof readIssueMetaSchema>;
|
|
|
|
export function createReadIssueRole(adapter: AgentFn, extract: LlmExtractorConfig): Role<ReadIssueMeta> {
|
|
return createRole(
|
|
adapter,
|
|
async (ctx: ThreadContext) => readIssuePrompt({ threadId: ctx.start.meta.threadId }),
|
|
readIssueMetaSchema,
|
|
extract,
|
|
);
|
|
}
|