mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix(tui): address virtual row and perf log review notes
Keep transcript row keys stable across capped-history trims and rename React Profiler timestamp fields so JSONL consumers don't confuse absolute timestamps with durations.
This commit is contained in:
@@ -133,6 +133,7 @@ export function useMainApp(gw: GatewayClient) {
|
||||
const historyItemsRef = useRef(historyItems)
|
||||
const lastUserMsgRef = useRef(lastUserMsg)
|
||||
const msgIdsRef = useRef(new WeakMap<Msg, string>())
|
||||
const msgIdSeqRef = useRef(0)
|
||||
const heightCachesRef = useRef(new Map<string, Map<string, number>>())
|
||||
|
||||
colsRef.current = cols
|
||||
@@ -180,7 +181,7 @@ export function useMainApp(gw: GatewayClient) {
|
||||
return hit
|
||||
}
|
||||
|
||||
const next = messageHeightKey(msg)
|
||||
const next = `${messageHeightKey(msg)}:${++msgIdSeqRef.current}`
|
||||
|
||||
msgIdsRef.current.set(msg, next)
|
||||
|
||||
@@ -188,7 +189,7 @@ export function useMainApp(gw: GatewayClient) {
|
||||
}, [])
|
||||
|
||||
const virtualRows = useMemo<TranscriptRow[]>(
|
||||
() => historyItems.map((msg, index) => ({ index, key: `${index}:${messageId(msg)}`, msg })),
|
||||
() => historyItems.map((msg, index) => ({ index, key: messageId(msg), msg })),
|
||||
[historyItems, messageId]
|
||||
)
|
||||
|
||||
|
||||
@@ -53,11 +53,11 @@ const onRender: ProfilerOnRenderCallback = (id, phase, actualMs, baseMs, startTi
|
||||
writeRow({
|
||||
actualMs: round2(actualMs),
|
||||
baseMs: round2(baseMs),
|
||||
commitMs: round2(commitTime),
|
||||
commitTimeMs: round2(commitTime),
|
||||
id,
|
||||
phase,
|
||||
src: 'react',
|
||||
startMs: round2(startTime),
|
||||
startTimeMs: round2(startTime),
|
||||
ts: Date.now()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user