mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-13 03:52:00 +00:00
fix(tui): complete absolute paths as paths
This commit is contained in:
parent
b632290166
commit
b816fd4e26
2 changed files with 71 additions and 21 deletions
35
ui-tui/src/__tests__/useCompletion.test.ts
Normal file
35
ui-tui/src/__tests__/useCompletion.test.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { completionRequestForInput } from '../hooks/useCompletion.js'
|
||||
|
||||
describe('completionRequestForInput', () => {
|
||||
it('routes real slash commands to slash completion', () => {
|
||||
expect(completionRequestForInput('/help')).toMatchObject({
|
||||
method: 'complete.slash',
|
||||
params: { text: '/help' },
|
||||
replaceFrom: 1
|
||||
})
|
||||
})
|
||||
|
||||
it('does not route absolute paths through slash completion', () => {
|
||||
expect(
|
||||
completionRequestForInput('/home/d/Desktop/agenda/CrimsonRed/.hermes/plans/2026-05-04-HANDOFF-NEXT.md')
|
||||
).toMatchObject({
|
||||
method: 'complete.path',
|
||||
params: { word: '/home/d/Desktop/agenda/CrimsonRed/.hermes/plans/2026-05-04-HANDOFF-NEXT.md' },
|
||||
replaceFrom: 0
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps path completion for trailing absolute path tokens', () => {
|
||||
expect(completionRequestForInput('read /home/d/Desktop/file.md')).toMatchObject({
|
||||
method: 'complete.path',
|
||||
params: { word: '/home/d/Desktop/file.md' },
|
||||
replaceFrom: 5
|
||||
})
|
||||
})
|
||||
|
||||
it('leaves plain text alone', () => {
|
||||
expect(completionRequestForInput('hello there')).toBeNull()
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue