langstage-cli 0.6.51__tar.gz → 0.6.52__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 (79) hide show
  1. {langstage_cli-0.6.51/langstage_cli.egg-info → langstage_cli-0.6.52}/PKG-INFO +3 -3
  2. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/README.md +2 -2
  3. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli/cli.py +51 -1
  4. {langstage_cli-0.6.51 → langstage_cli-0.6.52/langstage_cli.egg-info}/PKG-INFO +3 -3
  5. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/pyproject.toml +1 -1
  6. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_advertised_wave4.py +29 -0
  7. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/LICENSE +0 -0
  8. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/deepagent_code/__init__.py +0 -0
  9. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli/__init__.py +0 -0
  10. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli/agui_stream.py +0 -0
  11. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli/config.py +0 -0
  12. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli/exit_codes.py +0 -0
  13. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli/sessions.py +0 -0
  14. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli.egg-info/SOURCES.txt +0 -0
  15. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli.egg-info/dependency_links.txt +0 -0
  16. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli.egg-info/entry_points.txt +0 -0
  17. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli.egg-info/requires.txt +0 -0
  18. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/langstage_cli.egg-info/top_level.txt +0 -0
  19. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/setup.cfg +0 -0
  20. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_agui_stream.py +0 -0
  21. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_approval_menu_abort.py +0 -0
  22. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_async_mode.py +0 -0
  23. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_checkpointer.py +0 -0
  24. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_cli.py +0 -0
  25. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_cli_help.py +0 -0
  26. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_codeconfig.py +0 -0
  27. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_config.py +0 -0
  28. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_config_command.py +0 -0
  29. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_configurable.py +0 -0
  30. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_ctrl_c_sync_tool.py +0 -0
  31. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_custom_decision_195.py +0 -0
  32. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_deferred_pass.py +0 -0
  33. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_dumb_term.py +0 -0
  34. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_exit_codes.py +0 -0
  35. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_generic_interrupt.py +0 -0
  36. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_help_render.py +0 -0
  37. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_hidden_option_suggestions.py +0 -0
  38. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_history_persist.py +0 -0
  39. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_hitl_approval_preview.py +0 -0
  40. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_hitl_resume_warning.py +0 -0
  41. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_init.py +0 -0
  42. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_interrupt_non_tty.py +0 -0
  43. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_legacy_config_home.py +0 -0
  44. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_load_error.py +0 -0
  45. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_menu_allowed_197.py +0 -0
  46. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_message_boundaries.py +0 -0
  47. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_no_color.py +0 -0
  48. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_no_interactive_approve.py +0 -0
  49. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_no_persist_resume.py +0 -0
  50. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_paused_session_message.py +0 -0
  51. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_persist_env.py +0 -0
  52. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_quiet_output.py +0 -0
  53. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_reasoning_render.py +0 -0
  54. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_rename_shim.py +0 -0
  55. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_render_markdown.py +0 -0
  56. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_routine_1024.py +0 -0
  57. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_session_lifecycle.py +0 -0
  58. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_sessions.py +0 -0
  59. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_show_config.py +0 -0
  60. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_show_config_malformed.py +0 -0
  61. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_spec_loading_core.py +0 -0
  62. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_spec_resolution.py +0 -0
  63. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_spinner_reply_survives.py +0 -0
  64. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_stdin_interactive.py +0 -0
  65. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_stdin_single_shot.py +0 -0
  66. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_stream_mode.py +0 -0
  67. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_streaming_marker.py +0 -0
  68. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_terminal_width.py +0 -0
  69. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_toml_relative_paths.py +0 -0
  70. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_tool_card_args.py +0 -0
  71. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_tool_output_escape.py +0 -0
  72. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_turn_error_verbose.py +0 -0
  73. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_turn_exit_and_render.py +0 -0
  74. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_unicode_console.py +0 -0
  75. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_usage_hint_186.py +0 -0
  76. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_verbose_command.py +0 -0
  77. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_verify_flag.py +0 -0
  78. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_workspace.py +0 -0
  79. {langstage_cli-0.6.51 → langstage_cli-0.6.52}/tests/test_wrong_type_graph.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langstage-cli
3
- Version: 0.6.51
3
+ Version: 0.6.52
4
4
  Summary: The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph
5
5
  Author-email: Kedar Dabhadkar <kdabhadk@gmail.com>
6
6
  License-Expression: MIT
@@ -354,8 +354,8 @@ the reply it renders is the graph's `messages` channel. A graph whose state has
354
354
  `state["query"]` fails with `KeyError`, and one that tolerates the missing key runs and
355
355
  the CLI prints its final state as JSON, with a note on stderr. To drive such a graph from
356
356
  the CLI, give it a `messages` channel, or a first node that copies the last message into
357
- `query`. A turn with no message and no state to show is an error (exit 1), the same
358
- verdict `--verify` gives.
357
+ `query`. `--verify` gives the same verdict as a run: it passes a turn that ends with
358
+ final state to show, and fails a turn with no message and no state (exit 1).
359
359
 
360
360
  A spec's inline `:name` (`app.py:prod`) wins over `-g` / `[agent] graph_name`;
361
361
  `--show-config` reports the graph that runs, and a run notes the ignored name.
@@ -316,8 +316,8 @@ the reply it renders is the graph's `messages` channel. A graph whose state has
316
316
  `state["query"]` fails with `KeyError`, and one that tolerates the missing key runs and
317
317
  the CLI prints its final state as JSON, with a note on stderr. To drive such a graph from
318
318
  the CLI, give it a `messages` channel, or a first node that copies the last message into
319
- `query`. A turn with no message and no state to show is an error (exit 1), the same
320
- verdict `--verify` gives.
319
+ `query`. `--verify` gives the same verdict as a run: it passes a turn that ends with
320
+ final state to show, and fails a turn with no message and no state (exit 1).
321
321
 
322
322
  A spec's inline `:name` (`app.py:prod`) wins over `-g` / `[agent] graph_name`;
323
323
  `--show-config` reports the graph that runs, and a run notes the ignored name.
@@ -2701,6 +2701,28 @@ async def _render_empty_turn(agent: Any, thread_id: str) -> bool:
2701
2701
  return False
2702
2702
 
2703
2703
 
2704
+ def _empty_turn_state_keys(graph: Any, thread_id: str, result: Any) -> List[str]:
2705
+ """The non-``messages`` state keys behind a ``--verify`` "no content" failure.
2706
+
2707
+ Core's verdict fails a turn that completed cleanly with no content, which is right
2708
+ for surfaces that only show messages. The CLI also shows a graph's final state
2709
+ when there's no message (``_render_empty_turn``, gh #120), so a single-shot run
2710
+ passed a ``{"query", "answer"}`` graph that ``--verify`` failed (gh #200). Return
2711
+ the keys that run would show, or ``[]`` when the failure is anything else (an
2712
+ error, no completion) or there is no state, so both paths give one verdict.
2713
+ """
2714
+ if result.saw_error or not result.saw_complete or result.content_chars:
2715
+ return []
2716
+ try:
2717
+ state = graph.get_state({"configurable": {"thread_id": thread_id}})
2718
+ except Exception: # noqa: BLE001 - no readable state: keep core's verdict
2719
+ return []
2720
+ raw = getattr(state, "values", None)
2721
+ if not isinstance(raw, dict):
2722
+ return []
2723
+ return [k for k in raw if k != "messages"]
2724
+
2725
+
2704
2726
  class _DaemonThreadPool(concurrent.futures.ThreadPoolExecutor):
2705
2727
  """The turn loop's default executor: daemon worker threads nothing waits for (gh #192).
2706
2728
 
@@ -3851,10 +3873,38 @@ def main(
3851
3873
  if verify_agent:
3852
3874
  from langstage_core.agui import verify as _core_verify
3853
3875
 
3854
- result = _core_verify(graph)
3876
+ # A checkpointer and a known thread let us read the graph's final state
3877
+ # when core reports an empty turn (gh #200, below). The in-memory one is
3878
+ # only for this probe: restore the graph after, since the module (and so
3879
+ # the graph object) stays cached in this process.
3880
+ own_checkpointer = getattr(graph, "checkpointer", None)
3881
+ _ensure_checkpointer(graph)
3882
+ verify_thread = f"verify-{uuid.uuid4().hex}"
3883
+ try:
3884
+ result = _core_verify(graph, thread_id=verify_thread)
3885
+ state_keys = (
3886
+ [] if result.ok else _empty_turn_state_keys(graph, verify_thread, result)
3887
+ )
3888
+ finally:
3889
+ if own_checkpointer is None:
3890
+ try:
3891
+ graph.checkpointer = None
3892
+ except Exception: # noqa: BLE001 - best effort
3893
+ pass
3855
3894
  if result.ok:
3856
3895
  print(f"{GREEN}✓{RESET} agent verified: {result.reason}")
3857
3896
  sys.exit(0)
3897
+ if state_keys:
3898
+ print(
3899
+ 'note: the agent produced no message (langstage-cli renders the "messages" '
3900
+ "channel); its final state is what a run shows instead.",
3901
+ file=sys.stderr,
3902
+ )
3903
+ print(
3904
+ f"{GREEN}✓{RESET} agent verified: turn completed with final state "
3905
+ f"({', '.join(state_keys)})"
3906
+ )
3907
+ sys.exit(0)
3858
3908
  _status(f"{RED}✗ agent verification failed: {result.reason}{RESET}")
3859
3909
  sys.exit(1)
3860
3910
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langstage-cli
3
- Version: 0.6.51
3
+ Version: 0.6.52
4
4
  Summary: The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph
5
5
  Author-email: Kedar Dabhadkar <kdabhadk@gmail.com>
6
6
  License-Expression: MIT
@@ -354,8 +354,8 @@ the reply it renders is the graph's `messages` channel. A graph whose state has
354
354
  `state["query"]` fails with `KeyError`, and one that tolerates the missing key runs and
355
355
  the CLI prints its final state as JSON, with a note on stderr. To drive such a graph from
356
356
  the CLI, give it a `messages` channel, or a first node that copies the last message into
357
- `query`. A turn with no message and no state to show is an error (exit 1), the same
358
- verdict `--verify` gives.
357
+ `query`. `--verify` gives the same verdict as a run: it passes a turn that ends with
358
+ final state to show, and fails a turn with no message and no state (exit 1).
359
359
 
360
360
  A spec's inline `:name` (`app.py:prod`) wins over `-g` / `[agent] graph_name`;
361
361
  `--show-config` reports the graph that runs, and a run notes the ignored name.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "langstage-cli"
7
- version = "0.6.51"
7
+ version = "0.6.52"
8
8
  description = "The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -278,3 +278,32 @@ def test_no_agent_error_without_toml_is_unchanged(tmp_path, monkeypatch):
278
278
  assert r.exit_code == 1, r.output
279
279
  assert "No agent specified" in r.output
280
280
  assert "unknown" not in r.output
281
+
282
+
283
+ # --- gh #200: --verify agrees with a single-shot run on a no-`messages` graph ---
284
+
285
+
286
+ def test_verify_passes_a_graph_whose_run_shows_final_state(tmp_path, monkeypatch):
287
+ _ws(tmp_path, monkeypatch, {"custom_state_200.py": _CUSTOM_STATE})
288
+ run = CliRunner().invoke(main, ["-a", "custom_state_200.py:graph", "hello"])
289
+ ver = CliRunner().invoke(main, ["--verify", "-a", "custom_state_200.py:graph"])
290
+ assert run.exit_code == 0, run.output
291
+ assert ver.exit_code == 0, ver.output # one verdict for the run and the CI gate
292
+ assert "verified" in ver.stdout and "answer" in ver.stdout, ver.stdout
293
+ assert "no message" in ver.stderr, ver.stderr
294
+
295
+
296
+ def test_verify_still_fails_a_turn_with_no_message_and_no_state(tmp_path, monkeypatch):
297
+ _ws(tmp_path, monkeypatch, {"silent_200.py": _SILENT})
298
+ run = CliRunner().invoke(main, ["-a", "silent_200.py:graph", "hello"])
299
+ ver = CliRunner().invoke(main, ["--verify", "-a", "silent_200.py:graph"])
300
+ assert run.exit_code == 1, run.output
301
+ assert ver.exit_code == 1, ver.output
302
+ assert "no content" in ver.stderr, ver.stderr
303
+ assert ver.stdout.strip() == "", ver.stdout
304
+
305
+
306
+ def test_verify_passes_a_final_state_graph_with_no_persist(tmp_path, monkeypatch):
307
+ _ws(tmp_path, monkeypatch, {"custom_state_200b.py": _CUSTOM_STATE})
308
+ ver = CliRunner().invoke(main, ["--no-persist", "--verify", "-a", "custom_state_200b.py:graph"])
309
+ assert ver.exit_code == 0, ver.output
File without changes
File without changes