lithe-cli 0.1.5__tar.gz → 0.1.6__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.
Files changed (40) hide show
  1. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/PKG-INFO +2 -2
  2. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/__init__.py +1 -1
  3. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/agent.py +16 -4
  4. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/tui.py +7 -4
  5. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli.egg-info/PKG-INFO +2 -2
  6. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli.egg-info/requires.txt +1 -1
  7. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/pyproject.toml +1 -1
  8. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_cli_subagents.py +11 -6
  9. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/LICENSE +0 -0
  10. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/README.md +0 -0
  11. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/__main__.py +0 -0
  12. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/cli_parser.py +0 -0
  13. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/clipboard.py +0 -0
  14. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/commands.py +0 -0
  15. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/config.py +0 -0
  16. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/main.py +0 -0
  17. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/profiles.py +0 -0
  18. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/prompts.py +0 -0
  19. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/py.typed +0 -0
  20. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/sessions.py +0 -0
  21. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/setup.py +0 -0
  22. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/ttui.py +0 -0
  23. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/ttui_render.py +0 -0
  24. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/ttui_widgets.py +0 -0
  25. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/ui.py +0 -0
  26. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli/workbench.py +0 -0
  27. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli.egg-info/SOURCES.txt +0 -0
  28. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli.egg-info/dependency_links.txt +0 -0
  29. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli.egg-info/entry_points.txt +0 -0
  30. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/lithe_cli.egg-info/top_level.txt +0 -0
  31. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/setup.cfg +0 -0
  32. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_cli.py +0 -0
  33. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_cli_budget_steer.py +0 -0
  34. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_cli_clipboard.py +0 -0
  35. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_cli_guard.py +0 -0
  36. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_cli_sessions.py +0 -0
  37. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_profiles.py +0 -0
  38. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_ttui.py +0 -0
  39. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_tui_v2.py +0 -0
  40. {lithe_cli-0.1.5 → lithe_cli-0.1.6}/tests/test_workbench.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lithe-cli
3
- Version: 0.1.5
3
+ Version: 0.1.6
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
 
@@ -39,7 +39,7 @@ Classifier: Typing :: Typed
39
39
  Requires-Python: >=3.10
40
40
  Description-Content-Type: text/markdown
41
41
  License-File: LICENSE
42
- Requires-Dist: lithe>=0.1.3
42
+ Requires-Dist: lithe>=0.1.4
43
43
  Requires-Dist: prompt-toolkit>=3.0.38
44
44
  Requires-Dist: textual>=1.0
45
45
  Provides-Extra: dev
@@ -1,3 +1,3 @@
1
1
  """lithe-cli: the command-line interface for the lithe agent kernel."""
2
2
 
3
- __version__ = "0.1.5"
3
+ __version__ = "0.1.6"
@@ -342,15 +342,27 @@ def tool_names(cfg: Config) -> list[str]:
342
342
  return names
343
343
 
344
344
 
345
+ def _agent_label(ev: dict) -> str:
346
+ """Display label for a delegation event: the roster display name, plus
347
+ the delegation instance's short suffix when present. Same-agent parallel
348
+ delegations (each its own instance, kernel >= 0.1.4) would otherwise be
349
+ indistinguishable in the live feed."""
350
+ who = str(ev.get("display") or ev.get("agent") or "?")
351
+ inst = str(ev.get("instance") or "")
352
+ if inst:
353
+ who = f"{who}·{inst.rsplit(':', 1)[-1][:4]}"
354
+ return who
355
+
356
+
345
357
  def _render_subagent_progress(ev: dict) -> None:
346
- """Render one live subagent heartbeat: ``[检索员] ⚒ read_file · …``.
358
+ """Render one live subagent heartbeat: ``[检索员·a3f2] ⚒ read_file · …``.
347
359
 
348
360
  The kernel's progress hook caps text (300) and dumps ``tool_call`` args
349
361
  to a capped JSON string, so parse them back for the label. ``step``
350
362
  events are skipped — per-step chatter from every parallel worker is
351
363
  noise, the tool lines carry the substance.
352
364
  """
353
- who = str(ev.get("display") or ev.get("agent") or "?")
365
+ who = _agent_label(ev)
354
366
  tag = ui.s(f"[{who}]", MAGENTA)
355
367
  inner = ev.get("event") or {}
356
368
  t = inner.get("type")
@@ -449,12 +461,12 @@ def render_event(
449
461
  elif t == "subagent_start":
450
462
  # Emitted in ToolResult.ui after the delegation finished: the
451
463
  # per-agent record of what it was tasked with.
452
- who = str(ev.get("display") or ev.get("agent") or "?")
464
+ who = _agent_label(ev)
453
465
  task = str(ev.get("task") or "").replace("\n", " ").strip()
454
466
  line = f"{who}:{truncate(task, max(8, ui.width - 14))}" if task else who
455
467
  print(f" {ui.s('▸', MAGENTA)} {ui.s(line, MAGENTA)}")
456
468
  elif t == "subagent_end":
457
- who = str(ev.get("display") or ev.get("agent") or "?")
469
+ who = _agent_label(ev)
458
470
  status = str(ev.get("status") or "")
459
471
  zh = SUBAGENT_STATUS.get(status, status or "?")
460
472
  color = (GREEN if status == "done"
@@ -26,6 +26,7 @@ import os
26
26
  import sys
27
27
  import time
28
28
 
29
+ from .agent import _agent_label
29
30
  from .ui import SUBAGENT_STATUS, fmt_duration, tool_call_label, truncate
30
31
 
31
32
  _STATUS_DONE = "done"
@@ -246,12 +247,14 @@ class TuiState:
246
247
  self.say("user", str(ev.get("text") or ""))
247
248
  elif kind == "subagent_start":
248
249
  # Per-delegation record (ToolResult.ui): which worker got what
249
- # task — the group's feed line, labeled with the display name.
250
- who = str(ev.get("display") or ev.get("agent") or "?")
250
+ # task — the group's feed line, labeled with the display name
251
+ # (plus the instance suffix that keeps same-agent parallel
252
+ # delegations distinguishable).
253
+ who = _agent_label(ev)
251
254
  task = str(ev.get("task") or "").replace("\n", " ").strip()
252
255
  self.say("tool", f"▸ {who}:{task[:120]}" if task else f"▸ {who}")
253
256
  elif kind == "subagent_end":
254
- who = str(ev.get("display") or ev.get("agent") or "?")
257
+ who = _agent_label(ev)
255
258
  status = str(ev.get("status") or "")
256
259
  bits = [SUBAGENT_STATUS.get(status, status or "?")]
257
260
  if ev.get("steps") is not None:
@@ -265,7 +268,7 @@ class TuiState:
265
268
  # Live heartbeat (kernel on_subagent_event, wired in
266
269
  # register_subagents): each worker's tool calls and outputs,
267
270
  # prefixed so parallel workers stay distinguishable.
268
- who = str(ev.get("display") or ev.get("agent") or "?")
271
+ who = _agent_label(ev)
269
272
  inner = ev.get("event") or {}
270
273
  t = inner.get("type")
271
274
  if t == "tool_call":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lithe-cli
3
- Version: 0.1.5
3
+ Version: 0.1.6
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
 
@@ -39,7 +39,7 @@ Classifier: Typing :: Typed
39
39
  Requires-Python: >=3.10
40
40
  Description-Content-Type: text/markdown
41
41
  License-File: LICENSE
42
- Requires-Dist: lithe>=0.1.3
42
+ Requires-Dist: lithe>=0.1.4
43
43
  Requires-Dist: prompt-toolkit>=3.0.38
44
44
  Requires-Dist: textual>=1.0
45
45
  Provides-Extra: dev
@@ -1,4 +1,4 @@
1
- lithe>=0.1.3
1
+ lithe>=0.1.4
2
2
  prompt-toolkit>=3.0.38
3
3
  textual>=1.0
4
4
 
@@ -9,7 +9,7 @@ description = "Command-line interface for the lithe agent kernel: chat, one-shot
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
11
11
  requires-python = ">=3.10"
12
- dependencies = ["lithe>=0.1.3", "prompt-toolkit>=3.0.38", "textual>=1.0"]
12
+ dependencies = ["lithe>=0.1.4", "prompt-toolkit>=3.0.38", "textual>=1.0"]
13
13
  keywords = ["agent", "llm", "react", "cli", "tool-calling"]
14
14
  classifiers = [
15
15
  "Development Status :: 4 - Beta",
@@ -9,6 +9,7 @@ from __future__ import annotations
9
9
 
10
10
  import asyncio
11
11
  import json
12
+ import re
12
13
 
13
14
  from lithe_cli.agent import (
14
15
  build_host,
@@ -95,10 +96,12 @@ def test_delegation_runs_and_records_child_messages(tmp_path, capsys):
95
96
  assert done["status"] == "done"
96
97
  out = capsys.readouterr().out
97
98
  assert "子代理已确认" in out
98
- # the child's messages are recorded under the run, tagged by subagent id
99
+ # the child's messages are recorded under the run, tagged with the
100
+ # delegation instance ("<agent>:<hex8>", kernel >= 0.1.4)
99
101
  rows = host.store.messages_for_run(rid, cfg.user_id)
100
- tagged = [r for r in rows if r.get("subagent") == "researcher"]
101
- assert tagged, "researcher's turns must be recorded with its tag"
102
+ tagged = [r for r in rows
103
+ if str(r.get("subagent") or "").startswith("researcher:")]
104
+ assert tagged, "researcher's turns must be recorded with its instance tag"
102
105
  assert any("a.md" in (r.get("content") or "") for r in tagged)
103
106
 
104
107
 
@@ -172,11 +175,13 @@ def test_delegation_renders_live_progress_and_records(tmp_path, capsys):
172
175
  # the parallel call line names the roster and the task count
173
176
  assert "researcher(1 项)" in out
174
177
  # live heartbeat: the worker's answer, labeled with its display name
175
- assert "[检索员]" in out
178
+ # plus the delegation-instance suffix (kernel >= 0.1.4) that keeps
179
+ # same-agent parallel delegations distinguishable
180
+ assert re.search(r"\[检索员·[0-9a-f]{4}\]", out)
176
181
  assert "a.md 的内容是待办清单" in out
177
182
  # per-agent start/end records follow the delegation's tool_result
178
- assert "▸ 检索员:找一下 a.md 里写了什么" in out
179
- assert "▪ 检索员 · 完成" in out
183
+ assert re.search(r"▸ 检索员·[0-9a-f]{4}:找一下 a\.md 里写了什么", out)
184
+ assert re.search(r"▪ 检索员·[0-9a-f]{4} · 完成", out)
180
185
  # the footer carries the delegation footprint
181
186
  assert "delegations 1" in out
182
187
 
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