WardrikDaemon.Console.Printer (wardrik_daemon v0.1.0-rc.1)

Copy Markdown

Turns an agent's events into the lines a terminal shows. Each line is written once and never redrawn.

printer = WardrikDaemon.Console.Printer.new(width: 100)
{lines, printer} = WardrikDaemon.Console.Printer.event(printer, event)

Events are the protocol's CloudEvents.

  • The answer and the reasoning arrive as markdown. A line of either comes back once its newline arrives. Reasoning is faint, behind a bar.
  • A tool call is one line when it starts, and another when it ends or is refused.
  • A retried model call and compacted history are a line each.
  • One-line events are cut to the width.
  • Before any other event's line, the unfinished answer or reasoning comes first, so lines stay in the order things happened.
  • A turn that ends, fails, is stopped or waits on a person returns what's left of its text, then a line saying so.

Summary

Functions

Returns the lines event completes, and the printer for the next event.

Returns a printer that lays lines out to :width columns. 80 unless set.

Types

t()

@type t() :: %WardrikDaemon.Console.Printer{
  answer: WardrikDaemon.Console.Markdown.t(),
  reasoning: WardrikDaemon.Console.Markdown.t(),
  width: pos_integer()
}

Functions

event(printer, arg2)

@spec event(t(), map()) :: {[Owl.Data.t()], t()}

Returns the lines event completes, and the printer for the next event.

new(opts \\ [])

@spec new(keyword()) :: t()

Returns a printer that lays lines out to :width columns. 80 unless set.