NAME

Langertha::Raider::Session::Journal - Internal read-only view of one session journal

VERSION

version 0.503

SYNOPSIS

# Internal to Langertha-Raider -- no API promise.
my $journal = Langertha::Raider::Session::Journal->load($file, id => $id);

for my $run (@{ $journal->runs }) {
  say $run->{run}, ' ', $run->{status};         # 'interrupted' without run.finished
}
my @unknown = @{ $journal->unknown_calls };      # tool.call without tool.result
my @history = @{ $journal->history_messages };   # { role, content } to replay
warn 'damaged lines: '.join(', ', @{ $journal->damaged }) if @{ $journal->damaged };

DESCRIPTION

Internal module. Its interface may change without notice.

A session journal as read from disk (ADR 0015), with the crash rules applied: a line that is not a complete JSON object is skipped and its number listed in "damaged"; a run without run.finished counts as interrupted; a tool.call without its tool.result is unknown. Unknown event types and fields are kept but not interpreted. Beside the event types of ADR 0015 it knows history.cleared (no fields, no run): the REPL's /clear emptied the working history there.

id

The session id.

path

The journal file.

events

The events in file order, each a hash reference.

damaged

The line numbers (1-based) that could not be read.

unterminated

True when the file does not end with a newline -- the last write was cut off.

load

my $journal = Langertha::Raider::Session::Journal->load($file, id => $id);

Reads the file. A missing file reads as an empty journal.

created

The session.created event (line 1), or undef.

last_seq

The highest seq in the journal, 0 for none.

last_run_number

The highest run number (r3 is 3) in the journal, 0 for none.

runs

The runs in order, each a hash reference: run, status (from run.finished, or interrupted without one), started and finished (the events, finished may be undef), prompt (the user message) and response (the assistant message, when there is one).

unknown_calls

The tool.call events that have no tool.result with the same run and call: their outcome is unknown, and they are never run again.

history_messages

The working history to rebuild on resume, as { role, content } hashes: the user input and final assistant text of every run that has a final assistant text. A run that failed or was interrupted before its answer adds nothing, as a live raid adds nothing to history then. A history.cleared event (/clear in the REPL) empties it: only the messages after the last one count. A message outside any run (the history a fork took over) counts as it is.

session_history_messages

The full history to rebuild on resume, from all events, in the shapes "session_history" in Langertha::Raider renders: a message as { role, content }, a tool.call as an assistant tool_use block, a tool.result as { role => 'tool', name, content }, and for a call without result an entry saying its outcome is unknown.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-raider/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.