refactor: pass store via AgentContext, eliminate duplicate store instances #340

Merged
xiaomo merged 1 commits from refactor/pass-store-via-context into main 2026-05-18 16:05:38 +00:00
Owner

What

Agents now receive store via ctx.store instead of creating their own.

Why

Previously agent-kit and uwf-agent-hermes each created separate createFsStore() instances pointing to the same directory — separate in-memory caches, fragile.

Changes

  • AgentContext gains store: Store
  • context.ts passes store into ctx
  • uwf-agent-hermes uses ctx.store
  • mock-agent.ts uses ctx.store
  • Remove createAgentStore/resolveStorageRoot from public exports

Refs #337

## What Agents now receive `store` via `ctx.store` instead of creating their own. ## Why Previously agent-kit and uwf-agent-hermes each created separate `createFsStore()` instances pointing to the same directory — separate in-memory caches, fragile. ## Changes - `AgentContext` gains `store: Store` - `context.ts` passes store into ctx - `uwf-agent-hermes` uses `ctx.store` - `mock-agent.ts` uses `ctx.store` - Remove `createAgentStore`/`resolveStorageRoot` from public exports Refs #337
xiaoju added 1 commit 2026-05-18 16:04:45 +00:00
Expose the store created during context build on AgentContext so agents
reuse the same in-memory cache instead of opening a second store.

Co-authored-by: Cursor <cursoragent@cursor.com>
xiaomo approved these changes 2026-05-18 16:05:37 +00:00
xiaomo left a comment
Owner

LGTM store 通过 ctx 传递,不再重复创建。类型也从 Awaited<ReturnType<...>> 简化为直接 Store/AgentStore,可读性好多了。

LGTM ✅ store 通过 ctx 传递,不再重复创建。类型也从 Awaited<ReturnType<...>> 简化为直接 Store/AgentStore,可读性好多了。
xiaomo merged commit 072d900fcb into main 2026-05-18 16:05:38 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#340