mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
Revert "fix(tui): report actual session on exit"
This reverts commit 1566f1eecc.
This commit is contained in:
parent
c23463fce9
commit
3e1664923d
4 changed files with 5 additions and 106 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { writeFileSync } from 'node:fs'
|
||||
|
||||
import { evictInkCaches, type ScrollBoxHandle } from '@hermes/ink'
|
||||
import type { ScrollBoxHandle } from '@hermes/ink'
|
||||
import { evictInkCaches } from '@hermes/ink'
|
||||
import { type RefObject, useCallback } from 'react'
|
||||
|
||||
import { buildSetupRequiredSections, SETUP_REQUIRED_TITLE } from '../content/setup.js'
|
||||
|
|
@ -24,19 +23,6 @@ import { getUiState, patchUiState } from './uiStore.js'
|
|||
|
||||
const usageFrom = (info: null | SessionInfo): Usage => (info?.usage ? { ...ZERO, ...info.usage } : ZERO)
|
||||
|
||||
export const writeActiveSessionFile = (sessionId: null | string, file = process.env.HERMES_TUI_ACTIVE_SESSION_FILE) => {
|
||||
if (!file || !sessionId) {
|
||||
return
|
||||
}
|
||||
|
||||
// Best-effort shell-epilogue hint; never break live session changes.
|
||||
try {
|
||||
writeFileSync(file, JSON.stringify({ session_id: sessionId }), { mode: 0o600 })
|
||||
} catch {
|
||||
/* best-effort */
|
||||
}
|
||||
}
|
||||
|
||||
const trimTail = (items: Msg[]) => {
|
||||
const q = [...items]
|
||||
|
||||
|
|
@ -145,7 +131,6 @@ export function useSessionLifecycle(opts: UseSessionLifecycleOptions) {
|
|||
resetSession()
|
||||
setSessionStartedAt(Date.now())
|
||||
|
||||
writeActiveSessionFile(r.session_id)
|
||||
patchUiState({
|
||||
info,
|
||||
sid: r.session_id,
|
||||
|
|
@ -203,7 +188,6 @@ export function useSessionLifecycle(opts: UseSessionLifecycleOptions) {
|
|||
const resumed = toTranscriptMessages(r.messages)
|
||||
|
||||
setHistoryItems(r.info ? [introMsg(r.info), ...resumed] : resumed)
|
||||
writeActiveSessionFile(r.resumed ?? r.session_id)
|
||||
patchUiState({
|
||||
info: r.info ?? null,
|
||||
sid: r.session_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue