Static imports, no runtime file reads, bundler friendly.
Removed mustache dependency.
小橘 🍊(NEKO Team)
19 lines
754 B
TypeScript
19 lines
754 B
TypeScript
import { createCursorRole } from "@uncaged/nerve-workflow-utils";
|
|
import { resolveDashScopeProvider, NERVE_ROOT, SENSES_DIR } from "../shared.js";
|
|
import { coderMetaSchema } from "../types.js";
|
|
import type { SenseMeta } from "../types.js";
|
|
import { coderPrompt } from "./prompt.js";
|
|
|
|
export async function buildCoderRole() {
|
|
const provider = await resolveDashScopeProvider();
|
|
if (provider === null) {
|
|
throw new Error("Cannot create coder: set DASHSCOPE_API_KEY and DASHSCOPE_BASE_URL");
|
|
}
|
|
return createCursorRole<SenseMeta["coder"]>({
|
|
cwd: NERVE_ROOT,
|
|
mode: "default",
|
|
prompt: async (threadId) => coderPrompt({ threadId, sensesDir: SENSES_DIR, nerveRoot: NERVE_ROOT }),
|
|
extract: { provider, schema: coderMetaSchema },
|
|
});
|
|
}
|