Files
united-workforce/packages/workflow-runtime
xiaoju 1e9900bed3 feat(#194): Phase 2 — Engine layer Merkle call stack wiring
- Protocol: AgentFnResult = string | { output, childThread }, RoleOutput.childThread,
  ThreadContext.bundleHash for parent state lookup
- Runtime: create-workflow normalizes AgentFnResult, propagates childThread in RoleOutput
- Engine: ExecuteThreadOptions.parentStateHash, appendStateForStep writes childThread,
  putStartNode uses parentStateHash
- workflowAsAgent: reads parent head state from threads.json, passes parentStateHash
  to child, returns { output, childThread: rootHash }
- Integration test: 4 cases verifying bidirectional Merkle links (306 lines)

Phase 2 of #194 (Merkle Call Stack). Closes #196.

小橘 <xiaoju@shazhou.work>
2026-05-12 02:10:06 +00:00
..

@uncaged/workflow-runtime

Workflow author API: createWorkflow plus re-exports of protocol workflow types.

What This Package Does

Bundle code imports createWorkflow to turn a WorkflowDefinition plus AgentBinding into a WorkflowFn generator. It re-exports the protocol types and constants most authors need so workflows rarely import @uncaged/workflow-protocol directly.

Key Exports

From src/index.ts:

  • Functions: createWorkflow, ok, err
  • Types: AgentBinding, AgentContext, AgentFn, CasStore, ExtractContext, ExtractFn, LlmProvider, Moderator, ModeratorContext, Result, RoleDefinition, RoleMeta, RoleOutput, RoleStep, StartStep, ThreadContext, WorkflowCompletion, WorkflowDefinition, WorkflowDescriptor, WorkflowFn, WorkflowResult, WorkflowRoleDescriptor, WorkflowRoleSchema, WorkflowRuntime
  • Constants: END, START

Dependencies

  • Workspace: @uncaged/workflow-protocol — contract types and helpers
  • Peer: zod ^4 — matches schema usage on role definitions

Usage

import { createWorkflow, type WorkflowDefinition, type AgentBinding } from "@uncaged/workflow-runtime";

export const run = createWorkflow(myDefinition, myBinding);