diff --git a/src/plyngent/cli/repl.py b/src/plyngent/cli/repl.py index 238a056..13a7fdb 100644 --- a/src/plyngent/cli/repl.py +++ b/src/plyngent/cli/repl.py @@ -54,14 +54,20 @@ _CONTENT_PREVIEW = 200 def _cmd_status(state: ReplState) -> None: + from plyngent.agent.budget import estimate_messages_chars + pending = state.agent.pending_retry_text pending_disp = "yes" if pending else "no" + ctx_chars = estimate_messages_chars(state.agent.messages) + ctx_budget = state.agent.max_context_chars click.echo( f"provider={state.provider_name} model={state.model}\n" f"session={state.session_id} messages={len(state.agent.messages)} " f"pending_retry={pending_disp}\n" f"tools={'on' if state.tools_enabled else 'off'} " f"rounds={state.max_rounds} stream={'on' if state.agent.stream else 'off'}\n" + f"context_chars={ctx_chars}/{ctx_budget} " + f"tool_result_max={state.agent.max_tool_result_chars}\n" f"workspace={state.workspace}" ) diff --git a/tests/test_cli/test_repl_commands.py b/tests/test_cli/test_repl_commands.py index 1e1e1ab..4b697af 100644 --- a/tests/test_cli/test_repl_commands.py +++ b/tests/test_cli/test_repl_commands.py @@ -140,3 +140,16 @@ async def test_rounds(state: ReplState) -> None: assert await handle_slash(state, "/rounds 40") is True assert state.max_rounds == 40 # noqa: PLR2004 assert state.agent.max_rounds == 40 # noqa: PLR2004 + + +async def test_status_shows_context_chars( + state: ReplState, capsys: pytest.CaptureFixture[str] +) -> None: + from plyngent.lmproto.openai_compatible.model import UserChatMessage + + state.agent.messages = [UserChatMessage(content="hello")] + assert await handle_slash(state, "/status") is True + out = capsys.readouterr().out + assert "context_chars=" in out + assert "tool_result_max=" in out + assert str(state.workspace) in out