Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.02 KB

File metadata and controls

42 lines (32 loc) · 1.02 KB

Text Host

createConversationTextHost provides default plain-text rendering for programmatic hosts. It handles assistant stream deltas, activity status lines, trace labels, compaction status, and final turn summaries.

import { createConversationTextHost } from '@roackb2/heddle'

const textHost = createConversationTextHost({
  activity: 'status',
  trace: 'off',
  compaction: 'status',
})

const result = await engine.turns.submit({
  sessionId,
  prompt,
  host: textHost.host,
})

textHost.renderTurnResult(result)

Pass a custom writer when output should go somewhere other than stdout:

const lines: string[] = []
const textHost = createConversationTextHost({
  output: (text) => lines.push(text),
  trace: 'status',
})

Modes:

  • off: suppress that output category.
  • status: print compact, human-readable status lines.
  • verbose: include serialized event payloads where supported.

The text host is generic. Product-specific summaries should be layered on top of result.artifacts and result.toolResults.