feat(cli): add attach-only Desktop target selection
Keep Python and Desktop installations independent while allowing bare interactive commands to choose a running Desktop target. Validate the versioned per-user rendezvous before opening its WebUI, and preserve every explicit Python CLI invocation. Desktop TUI attachment remains unavailable until its capability contract is published, so that selection fails explicitly without starting, replacing, or stopping a backend. Refs NAN-104. [skip ci]
This commit is contained in:
1 parent
c4a25c9a09
commit
8fe0c62d68
5 files changed
+882
No files matched your search
@@ -3,6 +3,8 @@ import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from nanobot.cli import entry
|
||||
from nanobot.cli.entry import _agent_invocation_args, _native_tui_candidate
|
||||
|
||||
@@ -82,6 +84,22 @@ def test_root_alias_dispatches_the_shared_agent_command(monkeypatch) -> None:
|
||||
}
|
||||
|
||||
|
||||
def test_desktop_handled_bare_invocation_does_not_start_python(monkeypatch) -> None:
|
||||
from nanobot.cli import desktop_target
|
||||
|
||||
monkeypatch.setattr(entry.sys, "argv", ["nanobot", "webui"])
|
||||
monkeypatch.setattr(entry, "set_cli_process_identity", lambda _args: None)
|
||||
monkeypatch.setattr(entry, "_configure_windows_console", lambda: None)
|
||||
monkeypatch.setattr(desktop_target, "dispatch_bare_desktop_target", lambda _args: 0)
|
||||
monkeypatch.setattr(
|
||||
entry,
|
||||
"_run_agent",
|
||||
lambda *_args, **_kwargs: pytest.fail("Python agent must not start"),
|
||||
)
|
||||
|
||||
entry.main()
|
||||
|
||||
|
||||
def test_native_agent_invocations_use_the_lightweight_entrypoint() -> None:
|
||||
assert _native_tui_candidate(["agent"])
|
||||
assert _native_tui_candidate(["agent", "--session", "websocket:chat"])
|
||||
|
||||
Reference in new issue
Block a user