Adds the optional Textual interactive chat TUI behind the bare nexus command and nexus tui.
Streams replies and status events, supports conversation switching, model selection, stop/cancel, and gated tool approval/denial.
Preserves error output and conversation identity across denied or interrupted streams.
Prioritizes interrupt and quit key bindings so silent streams can always be cancelled.
Dependency
Stacked on the portable packaging PR and, transitively, #5. Merge in that order; this PR then reduces to the eight TUI-specific files shown by the commit boundary.
Verification
24 focused CLI/TUI tests passed.
The complete packaging/TUI focused set passed earlier with 47 tests.
The built wheel contains nexusos_cli/tui_app.py and the compiled web UI.
## Summary
- Adds the optional Textual interactive chat TUI behind the bare nexus command and nexus tui.
- Streams replies and status events, supports conversation switching, model selection, stop/cancel, and gated tool approval/denial.
- Preserves error output and conversation identity across denied or interrupted streams.
- Prioritizes interrupt and quit key bindings so silent streams can always be cancelled.
## Dependency
Stacked on the portable packaging PR and, transitively, #5. Merge in that order; this PR then reduces to the eight TUI-specific files shown by the commit boundary.
## Verification
- 24 focused CLI/TUI tests passed.
- The complete packaging/TUI focused set passed earlier with 47 tests.
- The built wheel contains nexusos_cli/tui_app.py and the compiled web UI.
Repair vector rows left behind by older databases at store startup. Keep the existing single-statement delete path from main and avoid reintroducing the redundant batched helper.
Separate bind and client addresses, include Ollama's response body in HTTP failures, and strip inline <think> blocks from complete and streamed replies.
The CLI shipped from `management/`, which also holds desktop-only pieces (the
Tk control panel, the XFCE panel wiring, the shell wrappers). Packaging that
directory meant the wheel either dragged in tkinter or shipped a broken import.
Split it: `nexusos_cli/` is what the wheel ships and what `nexus`/`ncp`/
`nexusos` dispatch to, `management/` keeps the desktop half.
Alongside the move:
* hatch_build.py decides the interface/web/dist include at build time. dist/
is gitignored, so a static force-include aborts `pip install -e .` on a
fresh clone - before the reader reaches the `npm run build` step. Editable
installs now skip a missing dist; wheels and sdists hard-error naming the
command to run.
* synapse/proc_util.py gives frontend_manager and ncp process inspection and
termination without psutil, which became an optional extra when the wheel
landed. It routes around Windows having no signals, where os.kill(pid, 15)
is an unblockable TerminateProcess rather than a polite request.
* nexusos_cli/monitor.py adds `ncp monitor`, an ASCII dashboard with no curses
or rich dependency so it works in Termux, plain SSH and Windows Terminal.
Collector and renderer are separate so tests feed fixtures, no stack needed.
* tests/test_packaging_deps.py fails the gate when synapse or nexusos_cli
import a distribution pyproject does not declare, and when an optional
dependency is imported at module scope instead of lazily.
* bin/check.sh now builds the wheel, twine-checks it, and asserts the compiled
UI and seed playbooks are actually inside it. A wheel that builds but ships
no dist/ serves a blank page, which only shows up after release.
tests/test_nexus_api.py moves to tests/ with the module it covers.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Add a Textual chat interface with threaded SSE streaming, slash commands, interrupt handling, and bare nexus dispatch. Package it behind the tui extra, document usage, and cover command routing, dependencies, and headless interaction with tests.
Keep stream failures in the persistent transcript instead of clearing them with the live preview. Use each tool request's capability token to deny actions immediately until the TUI has an interactive approval flow, and cover both behaviors with focused regressions.
Capture each stream's conversation ID before starting its worker so /new cannot redirect a later action denial. Add a headless regression that mutates the active conversation while a tool request is in flight.
Move chat streaming onto a cancellable async task so Ctrl+C interrupts a pending socket read on macOS instead of waiting for the 120-second read timeout. Add a headless silent-stream regression that verifies prompt recovery and a successful next message.
Declare Ctrl+C and Ctrl+D as priority Textual bindings so the focused prompt cannot consume them. Drive exit and silent-stream cancellation regressions through Pilot key events instead of calling action handlers directly.
Closing as superseded by #13: this branch carried forward as-is, plus a fix for a real bug found in review - _finish_stream appended a completed reply to self.history, whatever list that name currently pointed at, rather than the conversation the stream was actually answering. /new reassigns self.history to a fresh list, so a stream still running when that happened finished by silently appending the old conversation's trailing reply into the new one's context. conversation_id was already captured by closure for exactly this reason (the tool-denial path); self.history needed the same treatment. Covered by a new regression test. Merged onto main.
The approve/deny handshake, cancellation, and token handling all held up under review with no changes needed - solid work.
Closing as superseded by #13: this branch carried forward as-is, plus a fix for a real bug found in review - `_finish_stream` appended a completed reply to `self.history`, whatever list that name currently pointed at, rather than the conversation the stream was actually answering. `/new` reassigns `self.history` to a fresh list, so a stream still running when that happened finished by silently appending the old conversation's trailing reply into the new one's context. `conversation_id` was already captured by closure for exactly this reason (the tool-denial path); `self.history` needed the same treatment. Covered by a new regression test. Merged onto main.
The approve/deny handshake, cancellation, and token handling all held up under review with no changes needed - solid work.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Dependency
Stacked on the portable packaging PR and, transitively, #5. Merge in that order; this PR then reduces to the eight TUI-specific files shown by the commit boundary.
Verification
Closing as superseded by #13: this branch carried forward as-is, plus a fix for a real bug found in review -
_finish_streamappended a completed reply toself.history, whatever list that name currently pointed at, rather than the conversation the stream was actually answering./newreassignsself.historyto a fresh list, so a stream still running when that happened finished by silently appending the old conversation's trailing reply into the new one's context.conversation_idwas already captured by closure for exactly this reason (the tool-denial path);self.historyneeded the same treatment. Covered by a new regression test. Merged onto main.The approve/deny handshake, cancellation, and token handling all held up under review with no changes needed - solid work.
Pull request closed