PtcRunner.SubAgent.Namespace.ExecutionHistory (PtcRunner v0.9.0)

Copy Markdown View Source

Renders tool call history and println output.

Summary

Functions

Render println output from successful turns.

Render tool calls made during successful turns.

Functions

render_output(prints, limit, bool)

@spec render_output([String.t()], non_neg_integer(), boolean()) :: String.t() | nil

Render println output from successful turns.

Returns nil when has_println is false (no output section needed), otherwise a formatted list with header and output lines.

Examples

iex> PtcRunner.SubAgent.Namespace.ExecutionHistory.render_output([], 15, false)
nil

iex> PtcRunner.SubAgent.Namespace.ExecutionHistory.render_output(["hello", "world"], 15, true)
";; Output:\nhello\nworld"

render_tool_calls(tool_calls, limit)

@spec render_tool_calls([map()], non_neg_integer()) :: String.t()

Render tool calls made during successful turns.

Returns ;; No tool calls made for empty list, otherwise formatted list with header and entries.

Hidden fields (keys starting with _) are filtered out by Format.to_clojure.

Examples

iex> PtcRunner.SubAgent.Namespace.ExecutionHistory.render_tool_calls([], 20)
";; No tool calls made"

iex> call = %{name: "search", args: %{query: "hello"}}
iex> PtcRunner.SubAgent.Namespace.ExecutionHistory.render_tool_calls([call], 20)
";; Tool calls made:\n;   search({:query \"hello\"})"

iex> call = %{name: "search", args: %{query: "test", _token: "secret123"}}
iex> PtcRunner.SubAgent.Namespace.ExecutionHistory.render_tool_calls([call], 20)
";; Tool calls made:\n;   search({:query \"test\"})"