mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-27 01:11:40 +00:00
refactor(tui): clean up touched files — DRY, KISS, functional
Python (tui_gateway/server.py):
- hoist `_wait_agent` next to `_sess` so `_sess` no longer forward-refs
- simplify `_wait_agent`: `ready.wait()` already returns True when set,
no separate `.is_set()` check, collapse two returns into one expr
- factor `_sess_nowait` for handlers that don't need the agent (currently
`terminal.resize` + `input.detect_drop`) — DRY up the duplicated
`_sessions.get` + "session not found" dance
- inline `session = _sessions[sid]` in the session.create build thread so
agent/worker writes don't re-look-up the dict each time
- rename inline `ready_event` → `ready` (it's never ambiguous)
TS:
- `useSessionLifecycle.newSession`: hoist `r.info ?? null` into `info`
so it's one lookup, drop ceremonial `{ … }` blocks around single-line
bodies
- `createGatewayEventHandler.session.info`: wrap the case in a block,
hoist `ev.payload` into `info`, tighten comments
- `useMainApp` flush effect: collapse two guard returns into one
- `bootBanner.ts`: lift `TAGLINE` + `FALLBACK` to module constants, make
`GRADIENT` readonly, one-liner return via template literal
- `theme.ts`: group `selectionBg` inside the status* block (it's a UI
surface bg, same family), trim the comment
This commit is contained in:
parent
275256cdb4
commit
727f0eaf74
6 changed files with 92 additions and 105 deletions
|
|
@ -379,26 +379,19 @@ export function useMainApp(gw: GatewayClient) {
|
|||
sys
|
||||
})
|
||||
|
||||
// Flush any pre-session queued input once the session lands.
|
||||
// Message.complete already drains subsequent items; this only kicks off the first.
|
||||
// Flush any pre-session queued input the moment the session lands.
|
||||
// `message.complete` drains the rest; this just kicks off the first send.
|
||||
const prevSidRef = useRef<null | string>(null)
|
||||
useEffect(() => {
|
||||
const prev = prevSidRef.current
|
||||
prevSidRef.current = ui.sid
|
||||
|
||||
if (prev !== null || !ui.sid || ui.busy) {
|
||||
return
|
||||
}
|
||||
|
||||
if (composerRefs.queueEditRef.current !== null) {
|
||||
if (prev !== null || !ui.sid || ui.busy || composerRefs.queueEditRef.current !== null) {
|
||||
return
|
||||
}
|
||||
|
||||
const next = composerActions.dequeue()
|
||||
|
||||
if (next) {
|
||||
sendQueued(next)
|
||||
}
|
||||
if (next) sendQueued(next)
|
||||
}, [ui.sid, ui.busy, composerActions, composerRefs, sendQueued])
|
||||
|
||||
const { pagerPageSize } = useInputHandlers({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue