Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,9 @@ function printSessionHistoryByFormat(
format: OutputFormat,
): void {
const history = record.turnHistory ?? [];
const visible = history.slice(Math.max(0, history.length - limit));
// limit === 0 means show all entries
const visible =
limit === 0 ? history : history.slice(Math.max(0, history.length - limit));

if (format === "json") {
process.stdout.write(
Expand Down Expand Up @@ -1429,6 +1431,29 @@ function registerSessionsCommand(
) {
await handleSessionsHistory(explicitAgentName, name, flags, this, config);
});

sessionsCommand
.command("read")
.description("Read full session content (all history entries)")
.argument("[name]", "Session name", parseSessionName)
.option(
"--tail <count>",
"Show only the last N entries instead of all",
parseHistoryLimit,
)
.action(async function (
this: Command,
name: string | undefined,
flags: { tail?: number },
) {
await handleSessionsHistory(
explicitAgentName,
name,
{ limit: flags.tail ?? 0 },
this,
config,
);
});
}

type SharedSubcommandDescriptions = {
Expand Down