Class: Rubino::Session::Exporter
- Inherits:
-
Object
- Object
- Rubino::Session::Exporter
- Defined in:
- lib/rubino/session/exporter.rb
Overview
Serializes one session’s transcript to clean markdown — the ‘/export` backend. Deliberately minimal: user/assistant turns verbatim, tool calls and tool results as one-liners, system rows (prompt scaffolding, compaction summaries) omitted. Reasoning never reaches the message store, so a transcript export is reasoning-free by construction.
Constant Summary collapse
- ARGS_PREVIEW_CHARS =
Tool-call arguments are context, not payload — clamp the one-liner.
120
Instance Method Summary collapse
- #default_filename ⇒ Object
-
#initialize(session, store: Store.new) ⇒ Exporter
constructor
A new instance of Exporter.
-
#markdown ⇒ Object
The full markdown document for the session.
-
#write(path = nil) ⇒ Object
Writes #markdown to
path(default ./rubino-session-<id8>.md in the current directory) and returns the absolute path written.
Constructor Details
Instance Method Details
#default_filename ⇒ Object
39 40 41 |
# File 'lib/rubino/session/exporter.rb', line 39 def default_filename "rubino-session-#{@session[:id].to_s[0, 8]}.md" end |
#markdown ⇒ Object
The full markdown document for the session.
23 24 25 26 27 28 29 |
# File 'lib/rubino/session/exporter.rb', line 23 def markdown lines = header @store.for_session(@session[:id]).each do |msg| lines.concat(render(msg)) end "#{lines.join("\n")}\n" end |
#write(path = nil) ⇒ Object
Writes #markdown to path (default ./rubino-session-<id8>.md in the current directory) and returns the absolute path written.
33 34 35 36 37 |
# File 'lib/rubino/session/exporter.rb', line 33 def write(path = nil) target = File.(path.to_s.empty? ? default_filename : path.to_s) File.write(target, markdown) target end |