mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-20 11:20:35 +00:00
* docs: turn README into an index and move reference detail to docs/guide The README had grown to 393 KB because every change appended its notes there. The text moves verbatim into 18 topic guides under docs/guide/; only headings are re-leveled and relative links re-pointed. The README keeps the introduction, a quick start and a guide index. Contributor test notes move to CONTRIBUTING.md. * docs: send user docs to topic guides and budget the root README The rule 'update README.md for user-facing changes' is what grew the README. Guidance now points to docs/guide/, and check_agent_guidance.py fails when the root README exceeds 16 KiB (AG003). * chore: remove unreferenced screenshots and finished plan notes pr-build/ holds two PR screenshots (3 MB) from #1986. plans/ holds the plan for the merged #4049. docs/SKILL_NAME_CONFLICT_FIX.md is a February change note. Nothing references them. * docs: route always-loaded AGENTS.md files to scoped guides * docs(agents): cut scoped guides to scope, verify, traps, decisions Each AGENTS.md keeps four kinds of content: the scope of the directory, the verification commands, traps a local test run does not show, and decisions the code cannot state. Values, field lists, function inventories, test names, issue numbers and history are deleted, because the code, the tests and git state them. Search and fetch providers share one community guide. Four guides with no remaining content are removed. The size check now allows 6 KiB per file (hard limit 8 KiB) and 24 KiB per chain (hard limit 32 KiB). * style: format frontend guide table and guidance test imports --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2.9 KiB
2.9 KiB
Terminal UI (deerflow/tui/)
The deerflow console script: a terminal UI and headless --print / --json
modes over DeerFlowClient. It is a shell over the embedded client and does not
change agent behavior. User guide: docs/TUI.md.
Verify
cd backend
python -m pytest tests -q -k "tui"
Every layer except app.py and widgets/ is free of Textual and is tested with
plain pytest. The app is tested through Textual's pilot with a fake session.
Structure
- Keep logic in the pure layers.
view_state.reduceandruntime.translatehold the behavior;app.pymarshals actions to the UI thread. - Keep the client import lazy in
cli.py, so help and launch planning do not load the agent stack.textualis optional, and the script falls back to headless help without it. - An assistant delta is appended as given. The client sends incremental text only, so a delta that repeats the row's ending is new text, not a resend.
- A provider failure arrives as a flagged message, not an exception. The headless modes exit with status 1 on it.
- The command registry excludes the slash names that the agent runtime reserves, in the picker and in the resolver.
Runs and threads
- Reserve the run identity and the busy state when input is accepted, before the worker starts. Each run owns its cancellation flag. If the worker cannot start, clear the reservation and give the text back to the composer.
- A worker callback checks the run identity and the thread ID on delivery. A cancelled, finished or superseded run must not update the view.
- An interrupted worker streams until its next event, so a long tool step still checkpoints. Until it returns, reject a send on its thread: the run that checkpoints last would drop the other turn.
- Reject a thread switch during a run twice: before the picker opens, and when its callback applies, because the callback can outlive the idle state.
- Run workers are daemon threads, not Textual thread workers. Asyncio's default executor is joined when the app exits, and quitting would hang until the step ended.
- A finished run still writes its title to its own thread after the UI has moved on. Keep that write off the UI thread.
Web UI visibility
persistence.pywrites athreads_metarow for the default user, because the Web UI lists threads from that table and not from the checkpointer. The write is best effort.- All database work runs on one long-lived background loop. A SQLAlchemy async engine is bound to the loop that created it.
- A bridge timeout requests cooperative cancellation. It does not roll back a committed write.
Composer
- Slash arguments keep their whitespace. A skill submission keeps its line breaks and indentation.
- When history returns
None, leave the composer untouched, including its cursor and undo state. An empty string is a valid saved draft.