module Riffer::Rig::Terminal::Replay
Constants
- NOTICE
Public Instance Methods
(Array[Riffer::Rig::Terminal::Replay::_Recorded] recorded, theme: Riffer::Rig::Terminal::Theme, width: Integer?) → String
Source
# File lib/riffer/rig/terminal/replay.rb, line 12 def call(recorded, theme:, width:) # A notification without a follow-up count was delivered within the turn # of a prompt, so it opens no turn of its own. kept = recorded.reject do |entry| entry.message[Riffer::Rig::Runtime::JobNotification::MARKER] && !entry.message[:follow_up_exits] end turns = kept.slice_before { |entry| entry.message[:role].to_s == 'user' }.map { |chunk| turn(chunk, theme, width) } replayed = turns.compact.map do |past| "#{past.heading}#{Riffer::Rig::Terminal::TurnReport.call(past, nil, theme: theme, width: width)}" end indent = ' ' * Riffer::Rig::Terminal::TurnReport::INDENT [*replayed, *("\n#{theme.dim("#{indent}#{NOTICE}")}\n" if replayed.size < turns.size)].join end
@rbs recorded: Array @rbs theme: Riffer::Rig::Terminal::Theme @rbs width: Integer? @rbs return: String