mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
Merge pull request #17190 from NousResearch/bb/tui-cold-start-profiling
perf(tui): cut visible cold start ~57% with lazy agent init
This commit is contained in:
commit
5e68503d2f
10 changed files with 309 additions and 161 deletions
|
|
@ -5,8 +5,7 @@ import type { GatewayClient } from '../gatewayClient.js'
|
|||
import type {
|
||||
ConfigFullResponse,
|
||||
ConfigMtimeResponse,
|
||||
ReloadMcpResponse,
|
||||
VoiceToggleResponse
|
||||
ReloadMcpResponse
|
||||
} from '../gatewayTypes.js'
|
||||
import { asRpcResult } from '../lib/rpc.js'
|
||||
|
||||
|
|
@ -118,7 +117,11 @@ export function useConfigSync({ gw, setBellOnComplete, setVoiceEnabled, sid }: U
|
|||
return
|
||||
}
|
||||
|
||||
quietRpc<VoiceToggleResponse>(gw, 'voice.toggle', { action: 'status' }).then(r => setVoiceEnabled(!!r?.enabled))
|
||||
// Keep startup cheap: voice.toggle status probes optional audio/STT deps and
|
||||
// can run long enough to delay prompt.submit on the single stdio RPC pipe.
|
||||
// Environment flags are enough to initialize the UI bit; the heavier status
|
||||
// check still runs when the user opens /voice.
|
||||
setVoiceEnabled(process.env.HERMES_VOICE === '1')
|
||||
quietRpc<ConfigMtimeResponse>(gw, 'config.get', { key: 'mtime' }).then(r => {
|
||||
mtimeRef.current = Number(r?.mtime ?? 0)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -126,6 +126,13 @@ export function useSubmission(opts: UseSubmissionOptions) {
|
|||
return sys('session not ready yet')
|
||||
}
|
||||
|
||||
// Plain prompts are the common path and should not pay an extra RPC
|
||||
// before prompt.submit. File-drop detection still runs for absolute,
|
||||
// tilde, file://, and explicit relative paths.
|
||||
if (!looksLikeSlashCommand(text) && !/(?:^|\s)(?:file:\/\/|~\/|\.?\.\/|\/)[^\s]+/.test(text)) {
|
||||
return startSubmit(text, expand(text), showUserMessage)
|
||||
}
|
||||
|
||||
gw.request<InputDetectDropResponse>('input.detect_drop', { session_id: sid, text })
|
||||
.then(r => {
|
||||
if (!r?.matched) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue