111 """The bound status snapshot the running total and status bar read."""
113 return StatusBarState(
114 model=MODEL, session_name=
"GLM 5.4 Flash test 01", effort=
"high",
115 turn_tokens=7231, turn_iterations=1, turn_tools=0,
116 turn_cache_hit_pct=
None, turn_cache_saved_tokens=0,
117 turn_elapsed_ms=2530,
118 session_tokens=0, session_tools=0,
119 session_cache_hit_pct=
None, session_cache_saved_tokens=0,
120 session_elapsed_ms=1_103_000,
137 """Drive *kind* (``"rich"`` / ``"plain"``) through the scripted turn."""
139 _dbg(
"OC_CHAT.MAIN", func, f
"kind={kind} width={width}", 3)
140 session = SimpleNamespace(name=
"GLM 5.4 Flash test 01", model=MODEL,
141 reasoning_effort=
"high", ui_prefs={})
145 from rich.console
import Console
146 from rich.text
import Text
151 console = Console(file=buf, force_terminal=
False, width=width,
152 no_color=
True, soft_wrap=
False, legacy_windows=
False)
153 presenter = RichPresenter(console=console)
155 def emit(text: str) ->
None:
158 console.print(Text(text), highlight=
False)
161 presenter = ConsolePresenter()
164 presenter.bind_status(_status_state)
166 stdout, sys.stdout = sys.stdout, buf
168 presenter.show_welcome(session)
169 presenter.show_info(SECURITY_LINE)
170 presenter.show_info(PROMPT_TOOLKIT_LINE)
173 session_start = getattr(presenter,
"show_session_start",
None)
174 if session_start
is not None:
178 emit(build_prompt_prefix(session) +
"Hello.")
181 presenter.start_turn()
183 with presenter.turn():
184 presenter.show_waiting()
185 presenter.show_content(ANSWER)
186 presenter.show_iteration_stat(
_stat())
188 presenter.show_turn_summary(
189 prompt=7148, completion=83, total=7231, iterations=1, tool_calls=0,
190 model=MODEL, context_used_pct=11.0, duration_ms=2900,
194 return buf.getvalue()