Vibe.ToolOutput (vibe v0.2.0)

Copy Markdown View Source

Context-safe limits for model-facing tool output.

Summary

Functions

default_max_bytes()

@spec default_max_bytes() :: pos_integer()

limit_content(content, opts \\ [])

@spec limit_content(
  String.t(),
  keyword()
) :: %{
  content: String.t(),
  omitted_lines: non_neg_integer(),
  omitted_bytes: non_neg_integer(),
  truncated?: boolean()
}

limit_text(text, opts \\ 50000)

@spec limit_text(String.t(), pos_integer() | keyword()) :: String.t()

limit_text_result(text, opts \\ 50000)

@spec limit_text_result(String.t(), pos_integer() | keyword()) :: %{
  text: String.t(),
  omitted_bytes: non_neg_integer(),
  limit_bytes: pos_integer(),
  truncated?: boolean()
}

limit_value(value, max_bytes \\ 50000)

@spec limit_value(term(), pos_integer()) :: term()