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

Copy Markdown View Source

Renders the data/ namespace section.

Summary

Functions

Render data/ namespace section for USER message.

Functions

render(data, opts \\ [])

@spec render(
  map(),
  keyword()
) :: String.t() | nil

Render data/ namespace section for USER message.

Returns nil for empty data maps, otherwise a formatted string with header and entries showing type label and truncated sample.

Options

  • :field_descriptions - Map of field names to description strings
  • :context_signature - Parsed signature for type information
  • :sample_limit - Max items to show in collections (default: 3)
  • :sample_printable_limit - Max chars for strings (default: 80)

Examples

iex> PtcRunner.SubAgent.Namespace.Data.render(%{})
nil

iex> PtcRunner.SubAgent.Namespace.Data.render(%{count: 42})
";; === data/ ===\ndata/count                    ; integer, sample: 42"

iex> PtcRunner.SubAgent.Namespace.Data.render(%{_token: "secret"})
";; === data/ ===\ndata/_token                   ; string, [Hidden] [Firewalled]"

iex> PtcRunner.SubAgent.Namespace.Data.render(%{x: 5}, field_descriptions: %{x: "Input value"})
";; === data/ ===\ndata/x                        ; integer, sample: 5 -- Input value"