mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-01 01:51:44 +00:00
Merge pull request #13728 from NousResearch/bb/tui-history-local
fix(tui): /history shows the TUI's own transcript, scrollable
This commit is contained in:
commit
1e5daa4ece
2 changed files with 64 additions and 0 deletions
|
|
@ -275,6 +275,34 @@ export const coreCommands: SlashCommand[] = [
|
|||
}
|
||||
},
|
||||
|
||||
{
|
||||
help: 'view current transcript (user + assistant messages)',
|
||||
name: 'history',
|
||||
run: (arg, ctx) => {
|
||||
// The CLI-side `/history` runs in a detached slash-worker subprocess
|
||||
// that never sees the TUI's turns — it only surfaces whatever was
|
||||
// persisted before this process started. Render the TUI's own
|
||||
// transcript so `/history` actually reflects what the user just did.
|
||||
const items = ctx.local.getHistoryItems().filter(m => m.role === 'user' || m.role === 'assistant')
|
||||
|
||||
if (!items.length) {
|
||||
return ctx.transcript.sys('no conversation yet')
|
||||
}
|
||||
|
||||
const preview = Math.max(80, parseInt(arg, 10) || 400)
|
||||
|
||||
const lines = items.map((m, i) => {
|
||||
const tag = m.role === 'user' ? `You #${i + 1}` : `Hermes #${i + 1}`
|
||||
const body = m.text.trim() || (m.tools?.length ? `(${m.tools.length} tool calls)` : '(empty)')
|
||||
const clipped = body.length > preview ? `${body.slice(0, preview).trimEnd()}…` : body
|
||||
|
||||
return `[${tag}]\n${clipped}`
|
||||
})
|
||||
|
||||
ctx.transcript.page(lines.join('\n\n'), 'History')
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
aliases: ['sb'],
|
||||
help: 'toggle status bar',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue