Deepen Agent, compaction, switching and TUI modules
- Agent: make session/usage/provider/model/system/max_tokens/compact_at private; add set_provider, set_model, replace_session, fork, clear, fit_window. Fixes stale context-token reading after resume/new session. - hx-core::compact: ContextMeter, plan/apply and estimate_tokens split out of agent.rs, testable without provider or session. - hx-core::switch: Switcher shared by TUI and RPC for model/provider switches; RPC set_model now also refits the compaction threshold. - hx-tui: status.rs (footer, /usage as pure functions), popup.rs, and Picker::key returning an Act. - tests/tui_smoke.py: resolve the temp dir (macOS /var symlink) and match the resume via the OSC window title instead of split screen text.
This commit is contained in:
1 parent
fe308e0f36
commit
eaa6e22fbd
11 files changed
+1407
-632
No files matched your search
+5
-2
@@ -4,7 +4,8 @@ import os, pty, sys, time, subprocess, select, re, json, tempfile, signal
|
||||
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
port = 20000 + os.getpid() % 20000
|
||||
srv = subprocess.Popen([sys.executable, f"{root}/tests/fake_anthropic.py", str(port)])
|
||||
tmp = tempfile.mkdtemp()
|
||||
# resolved: hx sees the real cwd (macOS /var -> /private/var) and derives the session dir slug from it
|
||||
tmp = os.path.realpath(tempfile.mkdtemp())
|
||||
os.makedirs(f"{tmp}/home/.hx"); os.makedirs(f"{tmp}/repo")
|
||||
open(f"{tmp}/home/.hx/auth.json", "w").write(json.dumps({"claude": {"access": "fake-token", "refresh": "r", "expires": 99999999999999}}))
|
||||
open(f"{tmp}/repo/notes.md", "w").write("NOTES\n")
|
||||
@@ -86,7 +87,9 @@ send(b"\x10") # ctrl-p
|
||||
send(b"OLDPROMPT")
|
||||
check("picker lists past session", "session just now")
|
||||
send(b"\r", 1)
|
||||
check("picker resumes session", "resumed ")
|
||||
# screen text can be split by ratatui's cursor-move diffing; the OSC window title is written whole
|
||||
# and only carries the old prompt once the session is resumed
|
||||
check("picker resumes session", "hx · OLDPROMPT about parsers")
|
||||
send(b"/new\r")
|
||||
check("new session", "new session")
|
||||
send(b"/sessions\r")
|
||||
|
||||
Reference in new issue
Block a user