refactor(agents): migrate LLM/Hermes/Cursor to createAgentAdapter #262

Merged
xiaomo merged 1 commits from feat/261-adapter-migration into main 2026-05-14 12:19:38 +00:00
Owner

What

Migrate three adapters from createTextAdapter(TextProducerFn) to createAgentAdapter<Opt>(AgentFn<Opt>, ExtractOptionsFn<Opt>).

Changes

  • LLM: AgentFn<{ prompt: string }>, extract trivially passes prompt through
  • Hermes: AgentFn<{ prompt: string }>, config validation moved to extract
  • Cursor: AgentFn<{ prompt: string; workspace: string }>, workspace extraction moved to extract fn — AgentFn only receives resolved options
  • All public API signatures preserved
  • createTextAdapter / TextProducerFn retained for other consumers

Testing

  • bun run build
  • bun run test — 104 pass / 0 fail
  • biome clean

Ref

Phase 2 of #252. Closes #261.

## What Migrate three adapters from `createTextAdapter(TextProducerFn)` to `createAgentAdapter<Opt>(AgentFn<Opt>, ExtractOptionsFn<Opt>)`. ## Changes - **LLM**: `AgentFn<{ prompt: string }>`, extract trivially passes prompt through - **Hermes**: `AgentFn<{ prompt: string }>`, config validation moved to extract - **Cursor**: `AgentFn<{ prompt: string; workspace: string }>`, workspace extraction moved to extract fn — AgentFn only receives resolved options - All public API signatures preserved - `createTextAdapter` / `TextProducerFn` retained for other consumers ## Testing - `bun run build` ✅ - `bun run test` — 104 pass / 0 fail ✅ - biome clean ✅ ## Ref Phase 2 of #252. Closes #261.
xiaoju added 1 commit 2026-05-14 10:22:59 +00:00
- LLM: AgentFn<{prompt}> + createAgentAdapter, chatCompletionText unchanged
- Hermes: AgentFn<{prompt}> + createAgentAdapter, config validation in extract
- Cursor: AgentFn<{prompt, workspace}> + createAgentAdapter, workspace
  extraction moved to extract fn, AgentFn itself only receives resolved options

All public API signatures preserved. createTextAdapter/TextProducerFn retained.

Closes #261, Phase 2 of #252
xiaomo approved these changes 2026-05-14 12:19:36 +00:00
xiaomo left a comment
Owner

LGTM

三个 adapter 迁移干净:AgentFn 纯逻辑 + extract 关注点分离。Cursor workspace 提升到 config 层是好设计,bundle-entry 也跟着精简了。

LGTM ✅ 三个 adapter 迁移干净:AgentFn 纯逻辑 + extract 关注点分离。Cursor workspace 提升到 config 层是好设计,bundle-entry 也跟着精简了。
xiaomo merged commit 56db22a908 into main 2026-05-14 12:19: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#262