Skip to content

feat(workflows): Remove DurableTask dependency #798

@WhitWaldo

Description

@WhitWaldo

Summary

Rewrite the Dapr JS SDK Workflow implementation to communicate directly with the Dapr sidecar's Workflow gRPC API, removing the current dependency on the DurableTask framework internals.

Background

The current workflow implementation in the JS SDK is built on top of an internal durabletask package (src/workflow/internal/durabletask/) that directly implements the DurableTask protocol — including its own orchestration replay logic, protobuf definitions, task hub worker, and gRPC transport. This approach:

  • Couples the SDK tightly to DurableTask implementation details (proto definitions, replay semantics, orchestration state machine)
  • Requires maintaining a complex internal framework that duplicates logic already handled by the Dapr sidecar
  • Makes it harder to adopt new Dapr Workflow API features as they are added at the sidecar level
  • Increases the SDK's surface area and maintenance burden significantly

Proposed Change

Rewrite the workflow subsystem to use the Dapr sidecar's native Workflow gRPC API directly (the same API used by DaprWorkflowClient for management operations). This means:

  1. Remove src/workflow/internal/durabletask/ — the orchestration replay engine, proto files, task hub worker, and all DurableTask-specific types
  2. Implement workflow runtime against the Dapr Workflow API — register workflows and activities via the sidecar's streaming API, receive work items, and report completions through the sidecar
  3. Preserve the public APIWorkflowRuntime, WorkflowContext, WorkflowActivityContext, DaprWorkflowClient, and all user-facing types should remain backward-compatible
  4. Use ConnectRPC/gRPC consistent with the rest of the SDK's client infrastructure

Current Architecture

WorkflowRuntime → TaskHubGrpcWorker → DurableTask gRPC protocol → Dapr sidecar WorkflowContext → OrchestrationContext (replay engine)

Target Architecture

WorkflowRuntime → Dapr Workflow gRPC API → Dapr sidecar WorkflowContext → Lightweight wrapper over sidecar-managed state

Acceptance Criteria

  • src/workflow/internal/durabletask/ is removed
  • Workflow runtime communicates with Dapr sidecar via the native Workflow API
  • All existing public API types and method signatures remain backward-compatible
  • Existing workflow e2e tests pass without modification (or with minimal test infrastructure changes)
  • Proto file copying in build scripts (build-copy-workflow-proto) is no longer needed
  • Package size is reduced

Dependencies

  • Dapr sidecar Workflow API must support all operations currently used by the DurableTask worker (work item streaming, completion reporting, timer scheduling, external event handling, sub-orchestration, continue-as-new)

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions