refactor: move llmExtract, extractMeta, buildDescriptor, types to workflow-util-role

workflow-role-llm now only contains LLM-as-agent specifics:
  - createRole (wires agent + extract)
  - createLlmAdapter (OpenAI chat completions agent)

workflow-util-role now provides all role infrastructure:
  - decorators (decorateRole, withDryRun, onFail)
  - llmExtract / extractMetaOrThrow (structured extraction)
  - buildDescriptorFromRoles (zod → JSON Schema)
  - LlmProvider, LlmMessage types
This commit is contained in:
2026-05-06 08:13:27 +00:00
parent 6e62c7458d
commit c04e7c31af
23 changed files with 53 additions and 35 deletions
@@ -7,7 +7,7 @@ import { promisify } from "node:util";
import type { AgentFn, ThreadContext } from "@uncaged/workflow";
import { START } from "@uncaged/workflow";
import * as roleLlm from "@uncaged/workflow-role-llm";
import * as utilRole from "@uncaged/workflow-util-role";
import { createCommitterRole } from "../src/committer.js";
import { gitExec } from "../src/git-exec.js";
@@ -83,7 +83,7 @@ describe("createCommitterRole", () => {
const { repo } = await setupRepoWithRemote();
await appendFile(join(repo, "README.md"), "\nmore\n", "utf8");
const spy = spyOn(roleLlm, "extractMetaOrThrow").mockResolvedValue({
const spy = spyOn(utilRole, "extractMetaOrThrow").mockResolvedValue({
branch: "feat/test-commit",
message: "feat: add more",
});
@@ -10,7 +10,6 @@
},
"dependencies": {
"@uncaged/workflow": "workspace:*",
"@uncaged/workflow-role-llm": "workspace:*",
"@uncaged/workflow-util-role": "workspace:*",
"zod": "^4.0.0"
}
@@ -1,7 +1,11 @@
import type { AgentFn, Role, RoleResult, ThreadContext } from "@uncaged/workflow";
import type { LlmProvider } from "@uncaged/workflow-role-llm";
import { extractMetaOrThrow } from "@uncaged/workflow-role-llm";
import { decorateRole, onFail, withDryRun } from "@uncaged/workflow-util-role";
import {
decorateRole,
extractMetaOrThrow,
type LlmProvider,
onFail,
withDryRun,
} from "@uncaged/workflow-util-role";
import * as z from "zod/v4";
import { gitExec } from "./git-exec.js";
@@ -6,9 +6,5 @@
"composite": true
},
"include": ["src/**/*.ts"],
"references": [
{ "path": "../workflow" },
{ "path": "../workflow-role-llm" },
{ "path": "../workflow-util-role" }
]
"references": [{ "path": "../workflow" }, { "path": "../workflow-util-role" }]
}