lithe-cli 0.7.0__tar.gz → 0.8.0__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.7.0 → lithe_cli-0.8.0}/PKG-INFO +36 -35
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/README.md +34 -34
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/__init__.py +1 -1
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/main.py +30 -0
- lithe_cli-0.8.0/lithe_cli/ttui.py +776 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli.egg-info/PKG-INFO +36 -35
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli.egg-info/SOURCES.txt +2 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli.egg-info/requires.txt +1 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/pyproject.toml +1 -1
- lithe_cli-0.8.0/tests/test_ttui.py +308 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/LICENSE +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/__main__.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/agent.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/commands.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/config.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/profiles.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/prompts.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/py.typed +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/sessions.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/setup.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/tui.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/ui.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli/workbench.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli.egg-info/dependency_links.txt +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli.egg-info/entry_points.txt +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/lithe_cli.egg-info/top_level.txt +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/setup.cfg +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/tests/test_cli.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/tests/test_cli_sessions.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/tests/test_profiles.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/tests/test_tui_v2.py +0 -0
- {lithe_cli-0.7.0 → lithe_cli-0.8.0}/tests/test_workbench.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lithe-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Command-line interface for the lithe agent kernel: chat, one-shot runs, undo, and run inspection.
|
|
5
5
|
License: MIT License
|
|
6
6
|
|
|
@@ -41,6 +41,7 @@ Description-Content-Type: text/markdown
|
|
|
41
41
|
License-File: LICENSE
|
|
42
42
|
Requires-Dist: lithe>=0.9.14
|
|
43
43
|
Requires-Dist: prompt-toolkit>=3.0.38
|
|
44
|
+
Requires-Dist: textual>=1.0
|
|
44
45
|
Provides-Extra: dev
|
|
45
46
|
Requires-Dist: pytest>=8; extra == "dev"
|
|
46
47
|
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
@@ -141,25 +142,27 @@ usage/context gauges; `--max-steps` caps the tool loop;
|
|
|
141
142
|
### Full-screen interface
|
|
142
143
|
|
|
143
144
|
On an interactive terminal, `lithe chat` and `lithe run TASK` open a
|
|
144
|
-
persistent full-screen interface
|
|
145
|
-
into the console. The left pane is
|
|
146
|
-
is five fixed sections — 会话(current
|
|
147
|
-
with a turn still running
|
|
145
|
+
persistent full-screen interface (built on [Textual](https://textual.textualize.io))
|
|
146
|
+
instead of scribbling one-line events into the console. The left pane is
|
|
147
|
+
the conversation; the right sidebar is five fixed sections — 会话(current
|
|
148
|
+
+ recent ones, `●` marks sessions with a turn still running)、模型、运行、
|
|
149
|
+
工具/待办、用量:
|
|
148
150
|
|
|
149
151
|
```text
|
|
150
|
-
lithe 0.
|
|
151
|
-
|
|
152
|
-
│ 把 a.txt 改成三行待办清单 ││ ◆ 会话
|
|
153
|
-
│ ◆ edit_file · 局部修改 a.txt ││ #12 重构计划 ●
|
|
154
|
-
│ ✓ 编辑 a.txt(+3 -1 行) 0.0s ││ #11 bugfix ✓ 7轮
|
|
155
|
-
│ 已完成。 ││ F3 切换 · /new
|
|
156
|
-
│ ││ ◆ 模型
|
|
157
|
-
│ ││ zhipu · glm-4.6
|
|
158
|
-
│ ││ ◆ 会话用量
|
|
159
|
-
│ ││ 输入 1,024 · 输出 216│
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
lithe 0.8.0 · ▣ #12 重构计划 │ zhipu · glm-4.6 │ ~/myproj ● 运行中
|
|
153
|
+
╭──────────────────────────────────────╮╭──────────────────────────╮
|
|
154
|
+
│ 把 a.txt 改成三行待办清单 ││ ◆ 会话 │
|
|
155
|
+
│ ◆ edit_file · 局部修改 a.txt ││ #12 重构计划 ● │
|
|
156
|
+
│ ✓ 编辑 a.txt(+3 -1 行) 0.0s ││ #11 bugfix ✓ 7轮 │
|
|
157
|
+
│ 已完成。 ││ F3 切换 · /new 新建 │
|
|
158
|
+
│ ││ ◆ 模型 │
|
|
159
|
+
│ ││ zhipu · glm-4.6 │
|
|
160
|
+
│ ││ ◆ 会话用量 │
|
|
161
|
+
│ ││ 输入 1,024 · 输出 216 │
|
|
162
|
+
╰──────────────────────────────────────╯╰──────────────────────────╯
|
|
163
|
+
Tab 采纳 → /model /models /new
|
|
164
|
+
lithe ❯ _
|
|
165
|
+
● 运行中 · 步骤 2/35 Enter 发送 · F2 侧栏 · F3 会话 · F4 模型 · /help
|
|
163
166
|
```
|
|
164
167
|
|
|
165
168
|
**Switch without leaving the screen**: `F3` opens the session picker
|
|
@@ -167,19 +170,16 @@ lithe ❯ _
|
|
|
167
170
|
(grouped by profile; `Enter` switch, `s` save as the profile's default,
|
|
168
171
|
`r` fetch `/models`). Switching away from a running session does **not**
|
|
169
172
|
cancel it — its badge stays lit and the pane rebuilds from the store when
|
|
170
|
-
you come back. Typing `/`
|
|
171
|
-
model
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
(a new turn jumps back to the output). Layout, wrapping and alignment
|
|
181
|
-
are East-Asian-width aware; narrower terminals stack the two panes
|
|
182
|
-
vertically. Pipes and CI keep the plain per-line output unchanged.
|
|
173
|
+
you come back. Typing `/` shows matching commands above the prompt (`Tab`
|
|
174
|
+
accepts; `/model`, `/profile`, `/resume` complete their arguments too),
|
|
175
|
+
and `↑`/`↓` recall the persistent input history. `Ctrl+C` cancels the
|
|
176
|
+
current turn and exits when idle.
|
|
177
|
+
|
|
178
|
+
Text selection uses the terminal's native `Shift+drag` (hide the sidebar
|
|
179
|
+
with F2 first if it grabs both panes). The earlier prompt_toolkit screen —
|
|
180
|
+
which adds in-app mouse selection and OSC 52 copy — remains available with
|
|
181
|
+
`--ui prompt` / `LITHE_UI=prompt`. Pipes and CI keep the plain per-line
|
|
182
|
+
output unchanged.
|
|
183
183
|
|
|
184
184
|
### Sessions
|
|
185
185
|
|
|
@@ -289,13 +289,14 @@ keys, inline wizard validation, and persistent history.
|
|
|
289
289
|
|
|
290
290
|
- The CLI is a thin host over a `Workbench`: the workbench owns the
|
|
291
291
|
endpoint view (profile + model), the session manager and the running
|
|
292
|
-
turns; the plain REPL and the full-screen
|
|
292
|
+
turns; the plain REPL and the full-screen Textual app are both just
|
|
293
293
|
subscribers to its event bus and callers of one dispatcher. Everything
|
|
294
294
|
else (ReAct loop, streaming, budgets, replay, undo engine) is reused
|
|
295
295
|
from lithe.
|
|
296
|
-
-
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
- The Textual screen is tested headlessly with `App.run_test()` pilots
|
|
297
|
+
(turns, F2/F3/F4, history, completion) — real interaction tests that
|
|
298
|
+
also run on Windows; the legacy prompt_toolkit screen keeps its pure
|
|
299
|
+
row-builder tests plus POSIX-only PTY tests.
|
|
299
300
|
- `python -m lithe_cli` works alongside the `lithe` console script.
|
|
300
301
|
|
|
301
302
|
## License
|
|
@@ -93,25 +93,27 @@ usage/context gauges; `--max-steps` caps the tool loop;
|
|
|
93
93
|
### Full-screen interface
|
|
94
94
|
|
|
95
95
|
On an interactive terminal, `lithe chat` and `lithe run TASK` open a
|
|
96
|
-
persistent full-screen interface
|
|
97
|
-
into the console. The left pane is
|
|
98
|
-
is five fixed sections — 会话(current
|
|
99
|
-
with a turn still running
|
|
96
|
+
persistent full-screen interface (built on [Textual](https://textual.textualize.io))
|
|
97
|
+
instead of scribbling one-line events into the console. The left pane is
|
|
98
|
+
the conversation; the right sidebar is five fixed sections — 会话(current
|
|
99
|
+
+ recent ones, `●` marks sessions with a turn still running)、模型、运行、
|
|
100
|
+
工具/待办、用量:
|
|
100
101
|
|
|
101
102
|
```text
|
|
102
|
-
lithe 0.
|
|
103
|
-
|
|
104
|
-
│ 把 a.txt 改成三行待办清单 ││ ◆ 会话
|
|
105
|
-
│ ◆ edit_file · 局部修改 a.txt ││ #12 重构计划 ●
|
|
106
|
-
│ ✓ 编辑 a.txt(+3 -1 行) 0.0s ││ #11 bugfix ✓ 7轮
|
|
107
|
-
│ 已完成。 ││ F3 切换 · /new
|
|
108
|
-
│ ││ ◆ 模型
|
|
109
|
-
│ ││ zhipu · glm-4.6
|
|
110
|
-
│ ││ ◆ 会话用量
|
|
111
|
-
│ ││ 输入 1,024 · 输出 216│
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
lithe 0.8.0 · ▣ #12 重构计划 │ zhipu · glm-4.6 │ ~/myproj ● 运行中
|
|
104
|
+
╭──────────────────────────────────────╮╭──────────────────────────╮
|
|
105
|
+
│ 把 a.txt 改成三行待办清单 ││ ◆ 会话 │
|
|
106
|
+
│ ◆ edit_file · 局部修改 a.txt ││ #12 重构计划 ● │
|
|
107
|
+
│ ✓ 编辑 a.txt(+3 -1 行) 0.0s ││ #11 bugfix ✓ 7轮 │
|
|
108
|
+
│ 已完成。 ││ F3 切换 · /new 新建 │
|
|
109
|
+
│ ││ ◆ 模型 │
|
|
110
|
+
│ ││ zhipu · glm-4.6 │
|
|
111
|
+
│ ││ ◆ 会话用量 │
|
|
112
|
+
│ ││ 输入 1,024 · 输出 216 │
|
|
113
|
+
╰──────────────────────────────────────╯╰──────────────────────────╯
|
|
114
|
+
Tab 采纳 → /model /models /new
|
|
115
|
+
lithe ❯ _
|
|
116
|
+
● 运行中 · 步骤 2/35 Enter 发送 · F2 侧栏 · F3 会话 · F4 模型 · /help
|
|
115
117
|
```
|
|
116
118
|
|
|
117
119
|
**Switch without leaving the screen**: `F3` opens the session picker
|
|
@@ -119,19 +121,16 @@ lithe ❯ _
|
|
|
119
121
|
(grouped by profile; `Enter` switch, `s` save as the profile's default,
|
|
120
122
|
`r` fetch `/models`). Switching away from a running session does **not**
|
|
121
123
|
cancel it — its badge stays lit and the pane rebuilds from the store when
|
|
122
|
-
you come back. Typing `/`
|
|
123
|
-
model
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
(a new turn jumps back to the output). Layout, wrapping and alignment
|
|
133
|
-
are East-Asian-width aware; narrower terminals stack the two panes
|
|
134
|
-
vertically. Pipes and CI keep the plain per-line output unchanged.
|
|
124
|
+
you come back. Typing `/` shows matching commands above the prompt (`Tab`
|
|
125
|
+
accepts; `/model`, `/profile`, `/resume` complete their arguments too),
|
|
126
|
+
and `↑`/`↓` recall the persistent input history. `Ctrl+C` cancels the
|
|
127
|
+
current turn and exits when idle.
|
|
128
|
+
|
|
129
|
+
Text selection uses the terminal's native `Shift+drag` (hide the sidebar
|
|
130
|
+
with F2 first if it grabs both panes). The earlier prompt_toolkit screen —
|
|
131
|
+
which adds in-app mouse selection and OSC 52 copy — remains available with
|
|
132
|
+
`--ui prompt` / `LITHE_UI=prompt`. Pipes and CI keep the plain per-line
|
|
133
|
+
output unchanged.
|
|
135
134
|
|
|
136
135
|
### Sessions
|
|
137
136
|
|
|
@@ -241,13 +240,14 @@ keys, inline wizard validation, and persistent history.
|
|
|
241
240
|
|
|
242
241
|
- The CLI is a thin host over a `Workbench`: the workbench owns the
|
|
243
242
|
endpoint view (profile + model), the session manager and the running
|
|
244
|
-
turns; the plain REPL and the full-screen
|
|
243
|
+
turns; the plain REPL and the full-screen Textual app are both just
|
|
245
244
|
subscribers to its event bus and callers of one dispatcher. Everything
|
|
246
245
|
else (ReAct loop, streaming, budgets, replay, undo engine) is reused
|
|
247
246
|
from lithe.
|
|
248
|
-
-
|
|
249
|
-
|
|
250
|
-
|
|
247
|
+
- The Textual screen is tested headlessly with `App.run_test()` pilots
|
|
248
|
+
(turns, F2/F3/F4, history, completion) — real interaction tests that
|
|
249
|
+
also run on Windows; the legacy prompt_toolkit screen keeps its pure
|
|
250
|
+
row-builder tests plus POSIX-only PTY tests.
|
|
251
251
|
- `python -m lithe_cli` works alongside the `lithe` console script.
|
|
252
252
|
|
|
253
253
|
## License
|
|
@@ -27,6 +27,7 @@ from __future__ import annotations
|
|
|
27
27
|
|
|
28
28
|
import argparse
|
|
29
29
|
import asyncio
|
|
30
|
+
import os
|
|
30
31
|
import sys
|
|
31
32
|
from typing import Any
|
|
32
33
|
|
|
@@ -112,6 +113,13 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
112
113
|
sp.add_argument(
|
|
113
114
|
"--stream", action="store_true", help="stream tokens as they generate"
|
|
114
115
|
)
|
|
116
|
+
sp.add_argument(
|
|
117
|
+
"--ui",
|
|
118
|
+
choices=["textual", "prompt"],
|
|
119
|
+
default=None,
|
|
120
|
+
help="full-screen frontend (env LITHE_UI; default: textual; "
|
|
121
|
+
"'prompt' is the legacy prompt_toolkit screen)",
|
|
122
|
+
)
|
|
115
123
|
sp.add_argument(
|
|
116
124
|
"--no-setup",
|
|
117
125
|
action="store_true",
|
|
@@ -584,6 +592,24 @@ def _chat_loop(
|
|
|
584
592
|
return 0
|
|
585
593
|
|
|
586
594
|
|
|
595
|
+
def _resolve_ui(args: Any) -> str:
|
|
596
|
+
"""Which full-screen frontend: 'textual' (default) or 'prompt'."""
|
|
597
|
+
ui = getattr(args, "ui", None) or os.environ.get("LITHE_UI") or ""
|
|
598
|
+
ui = ui.strip().lower()
|
|
599
|
+
return ui if ui in ("prompt", "textual") else "textual"
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
def _run_textual(cfg: Any, task: str | None, mode: str, args: Any) -> int:
|
|
603
|
+
try:
|
|
604
|
+
from .ttui import run_textual_screen
|
|
605
|
+
except ImportError as exc: # pragma: no cover - depends on install
|
|
606
|
+
raise SystemExit(
|
|
607
|
+
f"Textual 前端不可用({exc})。pip install textual,"
|
|
608
|
+
"或用 --ui prompt 走旧版界面。"
|
|
609
|
+
) from exc
|
|
610
|
+
return asyncio.run(run_textual_screen(cfg, task, mode, args))
|
|
611
|
+
|
|
612
|
+
|
|
587
613
|
def main(argv: list[str] | None = None) -> int:
|
|
588
614
|
args = build_parser().parse_args(argv)
|
|
589
615
|
if args.command is None:
|
|
@@ -594,6 +620,8 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
594
620
|
if args.command == "run":
|
|
595
621
|
require_endpoint(cfg, interactive=not args.no_setup)
|
|
596
622
|
if screen_supported():
|
|
623
|
+
if _resolve_ui(args) == "textual":
|
|
624
|
+
return _run_textual(cfg, args.task, "run", args)
|
|
597
625
|
from .tui import run_screen
|
|
598
626
|
|
|
599
627
|
return asyncio.run(run_screen(cfg, args.task, "run"))
|
|
@@ -601,6 +629,8 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
601
629
|
if args.command == "chat":
|
|
602
630
|
require_endpoint(cfg, interactive=not args.no_setup)
|
|
603
631
|
if screen_supported():
|
|
632
|
+
if _resolve_ui(args) == "textual":
|
|
633
|
+
return _run_textual(cfg, None, "chat", args)
|
|
604
634
|
from .tui import run_screen
|
|
605
635
|
|
|
606
636
|
return asyncio.run(run_screen(cfg, None, "chat", args))
|