mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
chore: fmt
This commit is contained in:
parent
9d8f9765c1
commit
c49bbbe8c2
5 changed files with 2 additions and 25 deletions
|
|
@ -3,9 +3,7 @@ import { describe, expect, it } from 'vitest'
|
|||
import { FACES, HOTKEYS, INTERPOLATION_RE, PLACEHOLDERS, ROLE, TOOL_VERBS, VERBS, ZERO } from '../constants.js'
|
||||
import { DEFAULT_THEME } from '../theme.js'
|
||||
|
||||
|
||||
describe('constants', () => {
|
||||
|
||||
it('ZERO', () => expect(ZERO).toEqual({ calls: 0, input: 0, output: 0, total: 0 }))
|
||||
|
||||
it('string arrays are populated', () => {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ import { describe, expect, it } from 'vitest'
|
|||
|
||||
import { upsert } from '../lib/messages.js'
|
||||
|
||||
|
||||
describe('upsert', () => {
|
||||
|
||||
it('appends when last role differs', () => {
|
||||
expect(upsert([{ role: 'user', text: 'hi' }], 'assistant', 'hello')).toHaveLength(2)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,9 +11,7 @@ import {
|
|||
userDisplay
|
||||
} from '../lib/text.js'
|
||||
|
||||
|
||||
describe('stripAnsi / hasAnsi', () => {
|
||||
|
||||
it('strips ANSI codes', () => {
|
||||
expect(stripAnsi('\x1b[31mred\x1b[0m')).toBe('red')
|
||||
})
|
||||
|
|
@ -28,9 +26,7 @@ describe('stripAnsi / hasAnsi', () => {
|
|||
})
|
||||
})
|
||||
|
||||
|
||||
describe('compactPreview', () => {
|
||||
|
||||
it('truncates with ellipsis', () => {
|
||||
expect(compactPreview('a'.repeat(100), 20)).toHaveLength(20)
|
||||
expect(compactPreview('a'.repeat(100), 20).at(-1)).toBe('…')
|
||||
|
|
@ -49,9 +45,7 @@ describe('compactPreview', () => {
|
|||
})
|
||||
})
|
||||
|
||||
|
||||
describe('estimateRows', () => {
|
||||
|
||||
it('single line', () => expect(estimateRows('hello', 80)).toBe(1))
|
||||
|
||||
it('wraps long lines', () => expect(estimateRows('a'.repeat(160), 80)).toBe(2))
|
||||
|
|
@ -72,9 +66,7 @@ describe('estimateRows', () => {
|
|||
})
|
||||
})
|
||||
|
||||
|
||||
describe('fmtK', () => {
|
||||
|
||||
it('formats thousands', () => expect(fmtK(1500)).toBe('1.5k'))
|
||||
|
||||
it('keeps small numbers', () => expect(fmtK(42)).toBe('42'))
|
||||
|
|
@ -85,25 +77,19 @@ describe('fmtK', () => {
|
|||
})
|
||||
})
|
||||
|
||||
|
||||
describe('hasInterpolation', () => {
|
||||
|
||||
it('detects {!cmd}', () => expect(hasInterpolation('echo {!date}')).toBe(true))
|
||||
|
||||
it('rejects plain text', () => expect(hasInterpolation('plain')).toBe(false))
|
||||
})
|
||||
|
||||
|
||||
describe('pick', () => {
|
||||
|
||||
it('returns element from array', () => {
|
||||
expect([1, 2, 3]).toContain(pick([1, 2, 3]))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe('userDisplay', () => {
|
||||
|
||||
it('returns short messages as-is', () => expect(userDisplay('hello')).toBe('hello'))
|
||||
|
||||
it('truncates long messages', () => {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ import { describe, expect, it } from 'vitest'
|
|||
|
||||
import { DEFAULT_THEME, fromSkin } from '../theme.js'
|
||||
|
||||
|
||||
describe('DEFAULT_THEME', () => {
|
||||
|
||||
it('has brand defaults', () => {
|
||||
expect(DEFAULT_THEME.brand.name).toBe('Hermes Agent')
|
||||
expect(DEFAULT_THEME.brand.prompt).toBe('❯')
|
||||
|
|
@ -17,9 +15,7 @@ describe('DEFAULT_THEME', () => {
|
|||
})
|
||||
})
|
||||
|
||||
|
||||
describe('fromSkin', () => {
|
||||
|
||||
it('overrides banner colors', () => {
|
||||
expect(fromSkin({ banner_title: '#FF0000' }, {}).color.gold).toBe('#FF0000')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ export function App({ gw }: { gw: GatewayClient }) {
|
|||
|
||||
const { queueRef, queueEditRef, queuedDisplay, queueEditIdx, enqueue, dequeue, replaceQ, setQueueEdit, syncQueue } =
|
||||
useQueue()
|
||||
|
||||
const { historyRef, historyIdx, setHistoryIdx, historyDraftRef, pushHistory } = useInputHistory()
|
||||
const { completions, compIdx, setCompIdx, compReplace } = useCompletion(input, blocked(), gw)
|
||||
|
||||
|
|
@ -733,6 +734,7 @@ export function App({ gw }: { gw: GatewayClient }) {
|
|||
queueEditIdx === null
|
||||
? queueRef.current.length - 1
|
||||
: (queueEditIdx - 1 + queueRef.current.length) % queueRef.current.length
|
||||
|
||||
setQueueEdit(idx)
|
||||
setHistoryIdx(null)
|
||||
setInput(queueRef.current[idx] ?? '')
|
||||
|
|
@ -1014,7 +1016,6 @@ export function App({ gw }: { gw: GatewayClient }) {
|
|||
|
||||
break
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
},
|
||||
[appendMessage, dequeue, newSession, pushActivity, send, sys]
|
||||
)
|
||||
|
|
@ -1470,7 +1471,6 @@ export function App({ gw }: { gw: GatewayClient }) {
|
|||
|
||||
return true
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
},
|
||||
[catalog, compact, gw, lastUserMsg, messages, newSession, pastes, pushActivity, rpc, send, sid, statusBar, sys]
|
||||
)
|
||||
|
|
@ -1526,7 +1526,6 @@ export function App({ gw }: { gw: GatewayClient }) {
|
|||
}
|
||||
|
||||
dispatchSubmission([...inputBuf, value].join('\n'))
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
},
|
||||
[dequeue, dispatchSubmission, inputBuf, sid]
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue