lithe-cli 0.9.1__tar.gz → 0.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lithe-cli might be problematic. Click here for more details.
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/PKG-INFO +1 -1
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/__init__.py +1 -1
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/ttui.py +18 -2
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/tui.py +9 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli.egg-info/PKG-INFO +1 -1
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/tests/test_tui_v2.py +19 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/LICENSE +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/README.md +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/__main__.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/agent.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/commands.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/config.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/main.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/profiles.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/prompts.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/py.typed +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/sessions.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/setup.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/ui.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli/workbench.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli.egg-info/SOURCES.txt +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli.egg-info/dependency_links.txt +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli.egg-info/entry_points.txt +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli.egg-info/requires.txt +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/lithe_cli.egg-info/top_level.txt +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/pyproject.toml +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/setup.cfg +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/tests/test_cli.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/tests/test_cli_budget_steer.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/tests/test_cli_sessions.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/tests/test_cli_subagents.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/tests/test_profiles.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/tests/test_ttui.py +0 -0
- {lithe_cli-0.9.1 → lithe_cli-0.9.2}/tests/test_workbench.py +0 -0
|
@@ -83,7 +83,11 @@ def sidebar_markup(state: TuiState) -> str:
|
|
|
83
83
|
status_color = "red"
|
|
84
84
|
out.append(f"[{status_color}]● {state.status}[/]")
|
|
85
85
|
out.append(f"[dim]步骤 {state.step}/{state.max_steps}[/]")
|
|
86
|
-
|
|
86
|
+
live = state.elapsed()
|
|
87
|
+
if state.running:
|
|
88
|
+
if live is not None:
|
|
89
|
+
out.append(f"[yellow]已进行 {fmt_duration(live)}[/]")
|
|
90
|
+
elif state.last_turn_duration is not None:
|
|
87
91
|
out.append(f"[dim]本轮耗时 {fmt_duration(state.last_turn_duration)}[/]")
|
|
88
92
|
out.append("[dim]◆ 工具[/]")
|
|
89
93
|
if not state.tools:
|
|
@@ -137,7 +141,10 @@ def sidebar_markup(state: TuiState) -> str:
|
|
|
137
141
|
|
|
138
142
|
def footer_text(state: TuiState) -> str:
|
|
139
143
|
if state.running:
|
|
140
|
-
|
|
144
|
+
live = state.elapsed()
|
|
145
|
+
timer = f" · {fmt_duration(live)}" if live is not None else ""
|
|
146
|
+
return (f" ● {state.status}{timer} · Ctrl+C 取消 · F3 会话"
|
|
147
|
+
f" · F4 模型 · F6 推理 ")
|
|
141
148
|
return (f" ● {state.status} · Enter 发送 · F2 侧栏 · F3 会话 · F4 模型"
|
|
142
149
|
f" · F5 设置 · F6 推理 · /help ")
|
|
143
150
|
|
|
@@ -440,6 +447,10 @@ class LitheApp(App):
|
|
|
440
447
|
self._sync_feed()
|
|
441
448
|
self._refresh_chrome()
|
|
442
449
|
self.query_one("#prompt", Input).focus()
|
|
450
|
+
# Live turn timer: kernel events alone leave the screen static
|
|
451
|
+
# during long model calls, so the chrome repaints on a heartbeat
|
|
452
|
+
# while a turn runs (elapsed comes from TuiState.elapsed()).
|
|
453
|
+
self.set_interval(0.5, self._tick_elapsed)
|
|
443
454
|
if self.mode == "run" and self.initial_task:
|
|
444
455
|
self.query_one("#prompt", Input).disabled = True
|
|
445
456
|
asyncio.create_task(self._run_one_shot(self.initial_task))
|
|
@@ -546,6 +557,11 @@ class LitheApp(App):
|
|
|
546
557
|
self.query_one("#side-wrap", VerticalScroll).display = \
|
|
547
558
|
self.state.show_sidebar
|
|
548
559
|
|
|
560
|
+
def _tick_elapsed(self) -> None:
|
|
561
|
+
"""Heartbeat for the running turn's live timer (see on_mount)."""
|
|
562
|
+
if self.state.running:
|
|
563
|
+
self._refresh_chrome()
|
|
564
|
+
|
|
549
565
|
# -- workbench events -------------------------------------------------------
|
|
550
566
|
|
|
551
567
|
def on_wb_event(self, message: WbEvent) -> None:
|
|
@@ -106,6 +106,15 @@ class TuiState:
|
|
|
106
106
|
"""Presentation refresh hook. The Textual front-end repaints on its
|
|
107
107
|
own event loop, so this is deliberately a no-op here."""
|
|
108
108
|
|
|
109
|
+
def elapsed(self) -> float | None:
|
|
110
|
+
"""Live seconds since the running turn started (None when idle or
|
|
111
|
+
before the first ``run_start``). Frontends pair this with a periodic
|
|
112
|
+
repaint so the timer advances even while the model call itself
|
|
113
|
+
emits no events."""
|
|
114
|
+
if self.running and self.started is not None:
|
|
115
|
+
return max(0.0, time.monotonic() - self.started)
|
|
116
|
+
return None
|
|
117
|
+
|
|
109
118
|
# -- sessions -------------------------------------------------------------
|
|
110
119
|
|
|
111
120
|
def set_sessions(self, rows: list[dict], busy: set[int]) -> None:
|
|
@@ -63,6 +63,25 @@ def test_footer_switches_hints_by_running_state():
|
|
|
63
63
|
assert "Ctrl+C 取消" in busy and "F3" in busy and "F4" in busy
|
|
64
64
|
|
|
65
65
|
|
|
66
|
+
def test_live_elapsed_shown_while_running():
|
|
67
|
+
import re
|
|
68
|
+
import time as _time
|
|
69
|
+
|
|
70
|
+
state = TuiState("m", "/ws", 5)
|
|
71
|
+
state.on_event({"type": "run_start"})
|
|
72
|
+
state.running = True
|
|
73
|
+
state.started = _time.monotonic() - 12.0
|
|
74
|
+
side = sidebar_markup(state)
|
|
75
|
+
foot = footer_text(state)
|
|
76
|
+
assert re.search(r"已进行 12\.\ds", side)
|
|
77
|
+
assert re.search(r"● 思考中 · 12\.\ds", foot)
|
|
78
|
+
# idle: the live line disappears and the settled duration takes over
|
|
79
|
+
state.running = False
|
|
80
|
+
state.last_turn_duration = 65.0
|
|
81
|
+
assert "已进行" not in sidebar_markup(state)
|
|
82
|
+
assert "本轮耗时 1m05s" in sidebar_markup(state)
|
|
83
|
+
|
|
84
|
+
|
|
66
85
|
def test_completion_suggestions_cover_commands_and_args():
|
|
67
86
|
state = TuiState("m", "/ws", 5)
|
|
68
87
|
state.model_candidates = ["glm-4.6", "glm-4.5-air"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|