refactor: replace WorkflowSpec/compileWorkflowSpec with simple createRole helper #252
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
We over-engineered the RFC-003 config layer.
WorkflowSpec,RoleSpec, andcompileWorkflowSpecadd unnecessary abstraction on top ofWorkflowDefinition/Role, which were already fine.What we actually need is one helper function:
Workflows become simple factory functions that accept agents + extractor config:
Changes Required
1. Delete from
@uncaged/nerve-coreWorkflowSpectypeRoleSpectypePromptInputtype (move to workflow-utils if still needed)2. Delete from
@uncaged/nerve-daemoncompileWorkflowSpecfunction and its types (CompileWorkflowSpecDeps)compile-workflow-spec.tsfile and tests3. Add to
@uncaged/nerve-workflow-utilscreateRole<M>(adapter, prompt, meta, extract): Role<M>— the one helperadapter:AgentFn— direct function referenceprompt:string | ((start, messages) => Promise<string>)meta: zod schema for extractionextract:{ provider: string; model: string; apiKey: string; baseUrl: string }or similar LlmExtractor configRole<M>— resolves prompt, calls adapter, extracts meta, returns{ content, meta }4. Update workspace workflows (
~/.uncaged-nerve)createXxxWorkflow({ agents, extractor })index.tscalls factory with concrete adapters and extractor config5. Keep unchanged
WorkflowDefinition/Roletypes — untouchedAgentFn+ adapter packages — untouchedzodMetahelper — may still be useful inside createRoleRef
Supersedes the WorkflowSpec parts of RFC-003. Adapter packages and knowledge layer remain valid.
小橘 🍊(NEKO Team)