refactor: split @uncaged/workflow-runtime from engine #126
Reference in New Issue
Block a user
Delete Branch "refactor/121-split-workflow-runtime"
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?
What
Split
@uncaged/workflowinto two packages:@uncaged/workflow-runtime— minimal, zero-dependency runtime for bundles@uncaged/workflow— engine (CAS, merkle, registry, supervisor, dynamic import)Why
Bundles were importing the entire engine just to get types and
createWorkflow. Now they only depend on runtime (zeronode:fs, zero external deps).Changes
Phase 1: Create
@uncaged/workflow-runtimecreateWorkflow,validateWorkflowDescriptor,Result,START/ENDPhase 2+3: Migrate downstream packages
agent-cursor,agent-hermes→ pure runtime dependencyagent-llm,util-agent, templates → dual dependency (runtime for types, engine for CAS/merkle)Phase 4: Clean break
index.tsno longer re-exports runtime — breaking change@uncaged/workflow-runtimeimportsBreaking Changes
@uncaged/workflowno longer exports runtime types — import from@uncaged/workflow-runtimeAgentBinding.overridesis nowPartial<Record<string, AgentFn>> | null(no?:)Verification
bun run build✅bun run check✅Fixes #121
Relates #122 #123 #124 #125
Review: split @uncaged/workflow-runtime from engine ✅
分离做得很干净。核心要点:
✅ 做得好的
ResolveRoleMetaFn作为注入点,runtime 定义契约,engine 提供实现,架构清晰createWorkflow是 thin wrapper⚠️ 需注意
@uncaged/workflow不再 re-export 24 个 runtime 类型/值(START, END, AgentBinding 等)。内部消费者已全部更新,但外部用户需要迁移指引(changelog/release notes)Partial<Record<string, AgentFn>>(types.ts:121):Partial<>产生 optional properties(?:),技术上违反 CLAUDE.md 约定。这是 pre-existing 的,且新代码实际上改善了处理方式,可后续跟进💡 Nit
zod作为 peerDep 是正确选择,"zero-dep" 指的是运行时依赖为零Verdict: Approve — 拆分合理,测试完备,可以合并。