mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-26 01:01:40 +00:00
Merge branch 'main' of github.com:NousResearch/hermes-agent into bb/tui-audit-followup
# Conflicts: # ui-tui/src/components/markdown.tsx # ui-tui/src/types/hermes-ink.d.ts
This commit is contained in:
commit
93b4080b78
71 changed files with 3243 additions and 42 deletions
|
|
@ -179,6 +179,67 @@ describe('createSlashHandler', () => {
|
|||
expect(createSlashHandler(ctx)('/h')).toBe(true)
|
||||
expect(ctx.transcript.panel).toHaveBeenCalledWith(expect.any(String), expect.any(Array))
|
||||
})
|
||||
|
||||
it('falls through to command.dispatch for skill commands and sends the message', async () => {
|
||||
const skillMessage = 'Use this skill to do X.\n\n## Steps\n1. First step'
|
||||
|
||||
const ctx = buildCtx({
|
||||
gateway: {
|
||||
gw: {
|
||||
getLogTail: vi.fn(() => ''),
|
||||
request: vi.fn((method: string) => {
|
||||
if (method === 'slash.exec') {
|
||||
return Promise.reject(new Error('skill command: use command.dispatch'))
|
||||
}
|
||||
|
||||
if (method === 'command.dispatch') {
|
||||
return Promise.resolve({ type: 'skill', message: skillMessage, name: 'hermes-agent-dev' })
|
||||
}
|
||||
|
||||
return Promise.resolve({})
|
||||
})
|
||||
},
|
||||
rpc: vi.fn(() => Promise.resolve({}))
|
||||
}
|
||||
})
|
||||
|
||||
const h = createSlashHandler(ctx)
|
||||
expect(h('/hermes-agent-dev')).toBe(true)
|
||||
await vi.waitFor(() => {
|
||||
expect(ctx.transcript.sys).toHaveBeenCalledWith('⚡ loading skill: hermes-agent-dev')
|
||||
})
|
||||
expect(ctx.transcript.send).toHaveBeenCalledWith(skillMessage)
|
||||
})
|
||||
|
||||
it('handles send-type dispatch for /plan command', async () => {
|
||||
const planMessage = 'Plan skill content loaded'
|
||||
|
||||
const ctx = buildCtx({
|
||||
gateway: {
|
||||
gw: {
|
||||
getLogTail: vi.fn(() => ''),
|
||||
request: vi.fn((method: string) => {
|
||||
if (method === 'slash.exec') {
|
||||
return Promise.reject(new Error('pending-input command'))
|
||||
}
|
||||
|
||||
if (method === 'command.dispatch') {
|
||||
return Promise.resolve({ type: 'send', message: planMessage })
|
||||
}
|
||||
|
||||
return Promise.resolve({})
|
||||
})
|
||||
},
|
||||
rpc: vi.fn(() => Promise.resolve({}))
|
||||
}
|
||||
})
|
||||
|
||||
const h = createSlashHandler(ctx)
|
||||
expect(h('/plan create a REST API')).toBe(true)
|
||||
await vi.waitFor(() => {
|
||||
expect(ctx.transcript.send).toHaveBeenCalledWith(planMessage)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
const buildCtx = (overrides: Partial<Ctx> = {}): Ctx => ({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue