langstage-cli 0.6.51__tar.gz → 0.6.53__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.
- {langstage_cli-0.6.51/langstage_cli.egg-info → langstage_cli-0.6.53}/PKG-INFO +5 -3
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/README.md +4 -2
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli/cli.py +77 -1
- {langstage_cli-0.6.51 → langstage_cli-0.6.53/langstage_cli.egg-info}/PKG-INFO +5 -3
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/pyproject.toml +1 -1
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_advertised_wave4.py +86 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/LICENSE +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/deepagent_code/__init__.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli/__init__.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli/agui_stream.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli/config.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli/exit_codes.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli/sessions.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli.egg-info/SOURCES.txt +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli.egg-info/dependency_links.txt +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli.egg-info/entry_points.txt +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli.egg-info/requires.txt +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/langstage_cli.egg-info/top_level.txt +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/setup.cfg +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_agui_stream.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_approval_menu_abort.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_async_mode.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_checkpointer.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_cli.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_cli_help.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_codeconfig.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_config.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_config_command.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_configurable.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_ctrl_c_sync_tool.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_custom_decision_195.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_deferred_pass.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_dumb_term.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_exit_codes.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_generic_interrupt.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_help_render.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_hidden_option_suggestions.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_history_persist.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_hitl_approval_preview.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_hitl_resume_warning.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_init.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_interrupt_non_tty.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_legacy_config_home.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_load_error.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_menu_allowed_197.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_message_boundaries.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_no_color.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_no_interactive_approve.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_no_persist_resume.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_paused_session_message.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_persist_env.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_quiet_output.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_reasoning_render.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_rename_shim.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_render_markdown.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_routine_1024.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_session_lifecycle.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_sessions.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_show_config.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_show_config_malformed.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_spec_loading_core.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_spec_resolution.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_spinner_reply_survives.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_stdin_interactive.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_stdin_single_shot.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_stream_mode.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_streaming_marker.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_terminal_width.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_toml_relative_paths.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_tool_card_args.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_tool_output_escape.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_turn_error_verbose.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_turn_exit_and_render.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_unicode_console.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_usage_hint_186.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_verbose_command.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_verify_flag.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/tests/test_workspace.py +0 -0
- {langstage_cli-0.6.51 → langstage_cli-0.6.53}/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.
|
|
3
|
+
Version: 0.6.53
|
|
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,10 @@ 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`.
|
|
358
|
-
|
|
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). Its probe
|
|
359
|
+
turn gets the same `[configurable]` keys from `langstage.toml` a run does, on a fresh
|
|
360
|
+
thread (a pinned `thread_id` is ignored).
|
|
359
361
|
|
|
360
362
|
A spec's inline `:name` (`app.py:prod`) wins over `-g` / `[agent] graph_name`;
|
|
361
363
|
`--show-config` reports the graph that runs, and a run notes the ignored name.
|
|
@@ -316,8 +316,10 @@ 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`.
|
|
320
|
-
|
|
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). Its probe
|
|
321
|
+
turn gets the same `[configurable]` keys from `langstage.toml` a run does, on a fresh
|
|
322
|
+
thread (a pinned `thread_id` is ignored).
|
|
321
323
|
|
|
322
324
|
A spec's inline `:name` (`app.py:prod`) wins over `-g` / `[agent] graph_name`;
|
|
323
325
|
`--show-config` reports the graph that runs, and a run notes the ignored name.
|
|
@@ -2701,6 +2701,51 @@ async def _render_empty_turn(agent: Any, thread_id: str) -> bool:
|
|
|
2701
2701
|
return False
|
|
2702
2702
|
|
|
2703
2703
|
|
|
2704
|
+
def _verify_target(graph: Any, toml_configurable: Any) -> Any:
|
|
2705
|
+
"""What ``--verify`` hands core's ``verify``: the graph a run would drive.
|
|
2706
|
+
|
|
2707
|
+
A run forwards the ``[configurable]`` table (minus ``thread_id``, which is per
|
|
2708
|
+
run) to the graph through ``build_session_agent`` (gh #57). ``--verify`` used to
|
|
2709
|
+
pass the bare graph, so an agent reading ``config["configurable"][...]`` ran fine
|
|
2710
|
+
and failed the CI gate with a ``KeyError`` (gh #202). With keys to forward, build
|
|
2711
|
+
the agent the same way a run does. The probe still uses its own fresh thread, so a
|
|
2712
|
+
pinned ``thread_id`` is dropped. If the build fails (a wrong-type export), return
|
|
2713
|
+
the bare graph so core turns it into its usual clean ``ok=False`` verdict.
|
|
2714
|
+
"""
|
|
2715
|
+
configurable = dict(toml_configurable) if isinstance(toml_configurable, dict) else {}
|
|
2716
|
+
configurable.pop("thread_id", None)
|
|
2717
|
+
if not configurable:
|
|
2718
|
+
return graph
|
|
2719
|
+
from langstage_cli.agui_stream import build_session_agent
|
|
2720
|
+
|
|
2721
|
+
try:
|
|
2722
|
+
return build_session_agent(graph, config={"configurable": configurable})
|
|
2723
|
+
except Exception: # noqa: BLE001 - let core report the bad agent
|
|
2724
|
+
return graph
|
|
2725
|
+
|
|
2726
|
+
|
|
2727
|
+
def _empty_turn_state_keys(graph: Any, thread_id: str, result: Any) -> List[str]:
|
|
2728
|
+
"""The non-``messages`` state keys behind a ``--verify`` "no content" failure.
|
|
2729
|
+
|
|
2730
|
+
Core's verdict fails a turn that completed cleanly with no content, which is right
|
|
2731
|
+
for surfaces that only show messages. The CLI also shows a graph's final state
|
|
2732
|
+
when there's no message (``_render_empty_turn``, gh #120), so a single-shot run
|
|
2733
|
+
passed a ``{"query", "answer"}`` graph that ``--verify`` failed (gh #200). Return
|
|
2734
|
+
the keys that run would show, or ``[]`` when the failure is anything else (an
|
|
2735
|
+
error, no completion) or there is no state, so both paths give one verdict.
|
|
2736
|
+
"""
|
|
2737
|
+
if result.saw_error or not result.saw_complete or result.content_chars:
|
|
2738
|
+
return []
|
|
2739
|
+
try:
|
|
2740
|
+
state = graph.get_state({"configurable": {"thread_id": thread_id}})
|
|
2741
|
+
except Exception: # noqa: BLE001 - no readable state: keep core's verdict
|
|
2742
|
+
return []
|
|
2743
|
+
raw = getattr(state, "values", None)
|
|
2744
|
+
if not isinstance(raw, dict):
|
|
2745
|
+
return []
|
|
2746
|
+
return [k for k in raw if k != "messages"]
|
|
2747
|
+
|
|
2748
|
+
|
|
2704
2749
|
class _DaemonThreadPool(concurrent.futures.ThreadPoolExecutor):
|
|
2705
2750
|
"""The turn loop's default executor: daemon worker threads nothing waits for (gh #192).
|
|
2706
2751
|
|
|
@@ -3851,10 +3896,41 @@ def main(
|
|
|
3851
3896
|
if verify_agent:
|
|
3852
3897
|
from langstage_core.agui import verify as _core_verify
|
|
3853
3898
|
|
|
3854
|
-
|
|
3899
|
+
# A checkpointer and a known thread let us read the graph's final state
|
|
3900
|
+
# when core reports an empty turn (gh #200, below). The in-memory one is
|
|
3901
|
+
# only for this probe: restore the graph after, since the module (and so
|
|
3902
|
+
# the graph object) stays cached in this process.
|
|
3903
|
+
own_checkpointer = getattr(graph, "checkpointer", None)
|
|
3904
|
+
_ensure_checkpointer(graph)
|
|
3905
|
+
verify_thread = f"verify-{uuid.uuid4().hex}"
|
|
3906
|
+
try:
|
|
3907
|
+
result = _core_verify(
|
|
3908
|
+
_verify_target(graph, config_module.get(toml_config, "configurable")),
|
|
3909
|
+
thread_id=verify_thread,
|
|
3910
|
+
)
|
|
3911
|
+
state_keys = (
|
|
3912
|
+
[] if result.ok else _empty_turn_state_keys(graph, verify_thread, result)
|
|
3913
|
+
)
|
|
3914
|
+
finally:
|
|
3915
|
+
if own_checkpointer is None:
|
|
3916
|
+
try:
|
|
3917
|
+
graph.checkpointer = None
|
|
3918
|
+
except Exception: # noqa: BLE001 - best effort
|
|
3919
|
+
pass
|
|
3855
3920
|
if result.ok:
|
|
3856
3921
|
print(f"{GREEN}✓{RESET} agent verified: {result.reason}")
|
|
3857
3922
|
sys.exit(0)
|
|
3923
|
+
if state_keys:
|
|
3924
|
+
print(
|
|
3925
|
+
'note: the agent produced no message (langstage-cli renders the "messages" '
|
|
3926
|
+
"channel); its final state is what a run shows instead.",
|
|
3927
|
+
file=sys.stderr,
|
|
3928
|
+
)
|
|
3929
|
+
print(
|
|
3930
|
+
f"{GREEN}✓{RESET} agent verified: turn completed with final state "
|
|
3931
|
+
f"({', '.join(state_keys)})"
|
|
3932
|
+
)
|
|
3933
|
+
sys.exit(0)
|
|
3858
3934
|
_status(f"{RED}✗ agent verification failed: {result.reason}{RESET}")
|
|
3859
3935
|
sys.exit(1)
|
|
3860
3936
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langstage-cli
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.53
|
|
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,10 @@ 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`.
|
|
358
|
-
|
|
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). Its probe
|
|
359
|
+
turn gets the same `[configurable]` keys from `langstage.toml` a run does, on a fresh
|
|
360
|
+
thread (a pinned `thread_id` is ignored).
|
|
359
361
|
|
|
360
362
|
A spec's inline `:name` (`app.py:prod`) wins over `-g` / `[agent] graph_name`;
|
|
361
363
|
`--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.
|
|
7
|
+
version = "0.6.53"
|
|
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,89 @@ 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
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
# --- gh #202: --verify forwards the [configurable] table a run forwards ---
|
|
313
|
+
|
|
314
|
+
_CFG_AGENT = textwrap.dedent(
|
|
315
|
+
"""
|
|
316
|
+
from langgraph.graph import StateGraph, START, END
|
|
317
|
+
from langgraph.graph.message import MessagesState
|
|
318
|
+
from langchain_core.messages import AIMessage
|
|
319
|
+
from langchain_core.runnables import RunnableConfig
|
|
320
|
+
|
|
321
|
+
def r(s, config: RunnableConfig):
|
|
322
|
+
user = config["configurable"]["user_id"]
|
|
323
|
+
return {"messages": [AIMessage(content=f"hello {user}")]}
|
|
324
|
+
|
|
325
|
+
g = StateGraph(MessagesState); g.add_node("r", r); g.add_edge(START, "r"); g.add_edge("r", END)
|
|
326
|
+
graph = g.compile()
|
|
327
|
+
"""
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def _cfg_toml(spec: str, extra: str = "") -> str:
|
|
332
|
+
return f'[agent]\nspec = "{spec}"\n\n[configurable]\nuser_id = "alex"\n{extra}'
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def test_verify_forwards_configurable_like_a_run(tmp_path, monkeypatch):
|
|
336
|
+
_ws(
|
|
337
|
+
tmp_path,
|
|
338
|
+
monkeypatch,
|
|
339
|
+
{"cfg_202.py": _CFG_AGENT, "langstage.toml": _cfg_toml("cfg_202.py:graph")},
|
|
340
|
+
)
|
|
341
|
+
run = CliRunner().invoke(main, ["--no-persist", "hi"])
|
|
342
|
+
ver = CliRunner().invoke(main, ["--verify"])
|
|
343
|
+
assert run.exit_code == 0 and "hello alex" in run.stdout, run.output
|
|
344
|
+
assert ver.exit_code == 0, ver.output # was KeyError: 'user_id', exit 1
|
|
345
|
+
assert "verified" in ver.stdout, ver.stdout
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def test_verify_with_configurable_ignores_a_pinned_thread_id(tmp_path, monkeypatch):
|
|
349
|
+
toml = _cfg_toml("cfg_202b.py:graph", 'thread_id = "pinned"\n')
|
|
350
|
+
_ws(tmp_path, monkeypatch, {"cfg_202b.py": _CFG_AGENT, "langstage.toml": toml})
|
|
351
|
+
ver = CliRunner().invoke(main, ["--verify"])
|
|
352
|
+
assert ver.exit_code == 0, ver.output
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def test_verify_without_configurable_still_fails_an_agent_that_needs_it(tmp_path, monkeypatch):
|
|
356
|
+
_ws(tmp_path, monkeypatch, {"cfg_202c.py": _CFG_AGENT})
|
|
357
|
+
ver = CliRunner().invoke(main, ["--verify", "-a", "cfg_202c.py:graph"])
|
|
358
|
+
assert ver.exit_code == 1, ver.output
|
|
359
|
+
assert "user_id" in ver.stderr, ver.stderr
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def test_verify_target_falls_back_to_the_graph_when_the_build_fails():
|
|
363
|
+
bad = {"not": "a graph"}
|
|
364
|
+
assert cli._verify_target(bad, {"user_id": "alex"}) is bad
|
|
365
|
+
assert cli._verify_target(bad, None) is bad
|
|
366
|
+
assert cli._verify_target(bad, {"thread_id": "only"}) is bad
|
|
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
|
|
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
|
|
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
|