PtcRunner.SubAgent.Signature.Renderer (PtcRunner v0.9.0)

Copy Markdown View Source

Renders signatures back to string representation.

Converts internal signature format to human-readable syntax for use in prompts and debugging.

Summary

Functions

Render a signature to its string representation.

Render a type spec to its string representation.

Functions

render(arg)

@spec render({:signature, list(), term()}) :: String.t()

Render a signature to its string representation.

Examples

iex> sig = {:signature, [{"id", :int}], :string}
iex> PtcRunner.SubAgent.Signature.Renderer.render(sig)
"(id :int) -> :string"

iex> sig = {:signature, [], {:map, [{"count", :int}]}}
iex> PtcRunner.SubAgent.Signature.Renderer.render(sig)
"-> {count :int}"

render_type(arg1)

@spec render_type(term()) :: String.t()

Render a type spec to its string representation.

Converts type tuples and atoms to their PTC-Lisp syntax representation (e.g., :string, [int], {key :string}).

Examples

iex> PtcRunner.SubAgent.Signature.Renderer.render_type(:string)
":string"

iex> PtcRunner.SubAgent.Signature.Renderer.render_type({:optional, :int})
":int?"

iex> PtcRunner.SubAgent.Signature.Renderer.render_type({:list, :string})
"[:string]"