Skip to content

feat: mediate mode + incremental operations engine + various fixes#9

Merged
web4zn merged 6 commits into
mainfrom
opencode
May 9, 2026
Merged

feat: mediate mode + incremental operations engine + various fixes#9
web4zn merged 6 commits into
mainfrom
opencode

Conversation

@web4zn
Copy link
Copy Markdown
Owner

@web4zn web4zn commented May 9, 2026

Summary

Mediate Mode: Agent handles conversations directly (@ agent button in header)

  • Mode toggle in UI header (✨ enhance / 🤖 Agent)
  • Messages route to Agent Worker instead of Chat API
  • Agent runs ReAct loop: readMindmap → generateMindmapOps → answer

Incremental Operations Engine:

  • add_child / update / delete_leaf / add_root replace full tree generation
  • editedByUser protection at per-operation level
  • LLM can assign node IDs for cross-reference
  • add_child parentId optional (defaults to first root)

Chat & Memory Optimization:

  • Chat history limited to last 6 messages
  • Agent materials limited to last 3 messages
  • Error/duplicate message filtering
  • Streaming chat (streamChat)

Fixes:

  • agentMode state reset on mode switch
  • 401 error shown in chat UI
  • Tool results passed as raw JSON to LLM for visibility
  • System prompt uses contextual flow instead of rigid steps

Files Changed

  • 5 modified, 5 new in this PR series
  • +~700 lines

web4zn added 6 commits May 9, 2026 23:01
- Mode toggle UI: ✨ enhance / 🤖 Agent switch in header
- MEDIATE_MESSAGE protocol: user message routes to Worker
- Agent runs ReAct loop (readMindmap → generateMindmapOps) then answers
- Streaming response via STREAM_TOKEN/STREAM_DONE events
- Agent activity panel hidden in mediate mode
- parentId optional in add_child — falls back to first root when empty
- Falls back to label match when ID doesn't match
- Updated Worker tool schema and system prompt to guide LLM
- add_child/add_root support optional 'id' field
- LLM assigns IDs like 'python', 'rust-vs-cangjie' for parentId reference
- Falls back to deriveNodeId if no ID provided
- Mode toggle UI: ✨ enhance / 🤖 Agent switch in header
- Mediate mode routes messages to Agent Worker instead of Chat API
- Agent runs ReAct loop: readMindmap → generateMindmapOps → answer
- Tool results passed as raw JSON in messages for LLM visibility
- Error handling: 401 shown in chat, mode switch resets state
- Fix: add_child parentId optional, LLM can assign node IDs
- Fix: system prompt uses contextual flow instead of rigid steps
@web4zn web4zn merged commit 92b481e into main May 9, 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