docs(tui): explain when terminal threads appear on the web (#8753)

* docs(tui): explain when terminal threads appear on the web

* docs(tui): require a shared PostgreSQL schema
This commit is contained in:
Hu Hongwei 2026-11-28 16:40:52 +08:00 committed by GitHub
parent bfa469d514
commit 75e4c79029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 11 deletions

View File

@ -166,17 +166,20 @@ have no Textual dependency and are unit-tested directly with synthetic `StreamEv
## Web UI visibility (shared persistence)
The Web UI lists conversations from the `threads_meta` SQL table (filtered by
`user_id`), **not** from the checkpointer. An embedded run only writes the
checkpointer, so a TUI thread would otherwise be invisible in the sidebar.
With SQLite or PostgreSQL, the Web UI lists conversations from `threads_meta`,
filtered by user. The TUI writes a row for the local `default` user on the first
turn and syncs the generated title afterward. The write is best effort and can
happen while the Gateway is stopped. The sidebar shows the thread when the
Gateway reads the same database for the `default` user. With the `memory`
backend, the TUI still works and skips this metadata write.
`persistence.py` closes that gap: on the first turn of a thread it writes a
`threads_meta` row — owned by the local default user (`"default"`) — into the
**same** database the Gateway reads, and syncs the generated title afterward.
This requires only the shared `threads_meta` store (built via
`deerflow.persistence.engine.init_engine_from_config`), **not** the Gateway
process. When the database backend is `memory` (no SQL store) the writer
degrades to a silent no-op and the TUI still works.
With PostgreSQL, the TUI and Gateway must also use the same schema
(`database.postgres_schema`).
SQLite resolves a relative `database.sqlite_dir` from each process's working
directory. `make dev` starts the Gateway from `backend/`, so launch the TUI from
`backend/` as well to use the same relative path. You can also configure an
absolute `database.sqlite_dir` that both processes can access.
All DB work runs on one long-lived background event loop, because a SQLAlchemy
async engine is bound to the loop that created it.

View File

@ -25,7 +25,16 @@ deerflow --recursion-limit 250 --print "task" # override the headless agent-loop
Headless `--print` and `--json` exit with status `1` when the run fails, including provider errors returned as fallback messages. `--print` still writes the fallback text to stdout; `--json` appends a terminal error record.
A keyboard-driven chat surface with a streaming transcript (Markdown-rendered answers), compact tool-activity cards, a `/` slash-command palette, display-only `/clear`, `/goal` goal management, `/model` and `/threads` pickers, input history, PageUp/PageDown transcript navigation, and `Esc` / `Ctrl+C` interrupt. The composer preserves line breaks and indentation in pasted code, stack traces, and multi-paragraph prompts; `Enter` sends the complete document. Transcript refreshes preserve your reading position after you scroll upward and resume following new output when you return to the bottom. `/clear` removes rows from the current terminal display without deleting the thread or its persisted conversation; `/new` and `/clear` ask you to wait during an active run instead of resetting in-flight display state. Sessions opened in the TUI also appear in the Web UI sidebar — it writes the shared thread store under the local default user, so terminal and web stay in sync **without running the Gateway**.
A keyboard-driven chat surface with a streaming transcript (Markdown-rendered answers), compact tool-activity cards, a `/` slash-command palette, display-only `/clear`, `/goal` goal management, `/model` and `/threads` pickers, input history, PageUp/PageDown transcript navigation, and `Esc` / `Ctrl+C` interrupt. The composer preserves line breaks and indentation in pasted code, stack traces, and multi-paragraph prompts; `Enter` sends the complete document. Transcript refreshes preserve your reading position after you scroll upward and resume following new output when you return to the bottom. `/clear` removes rows from the current terminal display without deleting the thread or its persisted conversation; `/new` and `/clear` ask you to wait during an active run instead of resetting in-flight display state.
TUI conversations can appear in the Web UI sidebar when the Gateway uses the
same SQLite or PostgreSQL database and the Web UI is using the local `default`
user. For a local `make dev` Gateway with a relative SQLite path, launch the TUI
from `backend/` so both processes find the same database. See
[Web UI visibility](../../backend/docs/TUI.md#web-ui-visibility-shared-persistence).
With PostgreSQL, the TUI and Gateway must also use the same schema
(`database.postgres_schema`).
TUI slash commands accept Unicode whitespace before their arguments, including
spaces, tabs, line breaks, and nonbreaking spaces. A separator closes the slash