Skip to content

[Architecture] SharedStore type mismatch: Map vs Record between workflow and types definition #8

@coderabbitai

Description

@coderabbitai

Summary

src/pocketflow/workflow.ts creates results as new Map<string, AgentResult>(), but src/agents/types.ts defines SharedStore.results as Record<string, AgentResult>. These are not compatible and will cause runtime errors when code accesses store.results via Record-style dot notation on a Map.

Locations

  • src/pocketflow/workflow.ts line: results: new Map<string, AgentResult>()
  • src/agents/types.ts: results: Record<string, AgentResult>
  • src/pocketflow/nodes/async-parallel-batch.ts: store.results.set(r.agentName, r) — uses Map API

Recommended Fix

Align the type. Since Map is used throughout the node implementations, update SharedStore:

results: Map<string, AgentResult>

Backlink: #1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions