refactor(agents): migrate LLM/Hermes/Cursor to createAgentAdapter #262
Reference in New Issue
Block a user
Delete Branch "feat/261-adapter-migration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Migrate three adapters from
createTextAdapter(TextProducerFn)tocreateAgentAdapter<Opt>(AgentFn<Opt>, ExtractOptionsFn<Opt>).Changes
AgentFn<{ prompt: string }>, extract trivially passes prompt throughAgentFn<{ prompt: string }>, config validation moved to extractAgentFn<{ prompt: string; workspace: string }>, workspace extraction moved to extract fn — AgentFn only receives resolved optionscreateTextAdapter/TextProducerFnretained for other consumersTesting
bun run build✅bun run test— 104 pass / 0 fail ✅Ref
Phase 2 of #252. Closes #261.
- 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 #252LGTM ✅
三个 adapter 迁移干净:AgentFn 纯逻辑 + extract 关注点分离。Cursor workspace 提升到 config 层是好设计,bundle-entry 也跟着精简了。