fabric/input

Validated original input for one agent run. Imported history is context, never a source of actions or approvals. Provider replay strings remain opaque and are retained exactly as supplied.

Types

pub opaque type Input
pub type InputError {
  HistoryMustStartWithUser
  InvalidCallId
  DuplicateCallId(id: String)
  UnexpectedToolResult(id: String)
  UnresolvedCalls(ids: List(String))
}

Constructors

  • HistoryMustStartWithUser
  • InvalidCallId
  • DuplicateCallId(id: String)
  • UnexpectedToolResult(id: String)
  • UnresolvedCalls(ids: List(String))

Values

pub fn messages(input: Input) -> List(model.Message)

The complete original input, including its current prompt.

pub fn new(
  history: List(model.Message),
  prompt: String,
) -> Result(Input, InputError)

Validate completed historical tool exchanges, then append the current prompt exactly once. Adjacent user messages and repeated call ids in different assistant turns are valid. Tool results may arrive in any order; their supplied order is preserved. Provider-specific replay validity is checked by the model adapter, not by this generic boundary.

pub fn prompt(text: String) -> Input

The existing single-prompt input, with no imported history.

✨ Search Document