Skip to content

refactor: extract ReActRunner/BaseAgent, add Zod validation, fix agent bugs#11

Merged
web4zn merged 1 commit into
mainfrom
opencode
May 10, 2026
Merged

refactor: extract ReActRunner/BaseAgent, add Zod validation, fix agent bugs#11
web4zn merged 1 commit into
mainfrom
opencode

Conversation

@web4zn
Copy link
Copy Markdown
Owner

@web4zn web4zn commented May 10, 2026

Summary

  • Extract ReActRunner from agent.worker.ts (335 to 145 lines) �� separates message routing from ReAct loop logic
  • Add BaseAgent abstraction for future multi-agent support (with tests)
  • Add Zod schema validation �� LLM output validated before applying, preventing data corruption (14 tests)
  • Extract system prompt from useMindmapAgent.ts into dedicated system-prompt.ts
  • Split tool definitions to agent-tools.def.ts

Bug Fixes

  • Agent mode routing: handleSend and handleRegenerate now correctly check agentMode from store at call time
  • applyOne matched flag: fixed variable scoping in add_child tree recursion
  • Button nesting in MindMapPanel/ModelSelector
  • Textarea forwardRef for auto-resize support
  • Button forwardRef

Tests

  • 91 tests passing (14 new: schema + BaseAgent)
  • No regressions

Specs

  • New capabilities: agent-core, agent-schema added to openspec/specs/
  • Change archived

…t mode bugs

- Extract ReActRunner from agent.worker.ts (335→145 lines)
- Add BaseAgent class for future agent extensions
- Add Zod schema validation for mindmap operations (14 tests)
- Extract system prompt to dedicated file
- Split tool definitions to agent-tools.def.ts
- Fix: agent mode not routing to MEDIATE_MESSAGE (handleSend/Regenerate)
- Fix: applyOne matched flag scoping in recursive calls
- Fix: button nesting warnings in MindMapPanel/ModelSelector
- Fix: Textarea forwardRef/Button forwardRef
- Sync agent-core and agent-schema specs to openspec/specs/
@web4zn web4zn merged commit 21a654e into main May 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant