diff --git a/packages/workflow-util-agent/src/create-text-adapter.ts b/packages/workflow-util-agent/src/create-text-adapter.ts deleted file mode 100644 index e3a3f57..0000000 --- a/packages/workflow-util-agent/src/create-text-adapter.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { putContentNodeWithRefs } from "@uncaged/workflow-cas"; -import type { - AdapterFn, - RoleResult, - ThreadContext, - WorkflowRuntime, -} from "@uncaged/workflow-runtime"; -import type * as z from "zod/v4"; - -export type { WorkflowRuntime } from "@uncaged/workflow-runtime"; - -/** - * Result from a text-producing agent (CLI spawn, LLM call, etc.). - * `output` is the raw text; `childThread` links to a spawned sub-workflow. - */ -export type TextAdapterResult = { - output: string; - childThread: string | null; -}; - -/** - * A function that produces raw text output given the thread context and - * the system prompt for the current role. - */ -export type TextProducerFn = ( - ctx: ThreadContext, - prompt: string, - runtime: WorkflowRuntime, -) => Promise; - -/** - * Creates an {@link AdapterFn} from a text-producing function. - * - * The adapter: - * 1. Calls the producer with thread context + system prompt - * 2. Stores output in CAS - * 3. Runs the extract phase to produce typed meta - * 4. Returns `{ meta, childThread }` - */ -export function createTextAdapter(producer: TextProducerFn): AdapterFn { - return (prompt: string, schema: z.ZodType) => { - return async (ctx: ThreadContext, runtime: WorkflowRuntime): Promise> => { - const result = await producer(ctx, prompt, runtime); - const output = typeof result === "string" ? result : result.output; - const childThread = typeof result === "string" ? null : result.childThread; - const contentHash = await putContentNodeWithRefs(runtime.cas, output, []); - const extracted = await runtime.extract( - schema as z.ZodType>, - contentHash, - ); - return { meta: extracted.meta as T, childThread }; - }; - }; -} diff --git a/packages/workflow-util-agent/src/index.ts b/packages/workflow-util-agent/src/index.ts index f65afd2..88d0daf 100644 --- a/packages/workflow-util-agent/src/index.ts +++ b/packages/workflow-util-agent/src/index.ts @@ -1,7 +1,5 @@ export { buildAgentPrompt, buildThreadInput } from "./build-agent-prompt.js"; export type { ExtractOptionsFn } from "./create-agent-adapter.js"; export { createAgentAdapter, createSimpleAgentAdapter } from "./create-agent-adapter.js"; -export type { TextAdapterResult, TextProducerFn } from "./create-text-adapter.js"; -export { createTextAdapter } from "./create-text-adapter.js"; export type { SpawnCliConfig, SpawnCliError, SpawnCliResult } from "./spawn-cli.js"; export { spawnCli } from "./spawn-cli.js";