mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-30 01:41:43 +00:00
fix(tui): clickable hyperlinks and skill slash command dispatch
Two TUI fixes: 1. Hyperlinks are now clickable (Cmd+Click / Ctrl+Click) in terminals that support OSC 8. The markdown renderer was rendering links as plain colored text — now wraps them in the existing <Link> component from @hermes/ink which emits OSC 8 escape sequences. 2. Skill slash commands (e.g. /hermes-agent-dev) now work in the TUI. The slash.exec handler was delegating to the _SlashWorker subprocess which calls cli.process_command(). For skills, process_command() queues the invocation message onto _pending_input — a Queue that nobody reads in the worker subprocess. The skill message was lost. Now slash.exec detects skill commands early and rejects them so the TUI falls through to command.dispatch, which correctly builds and returns the skill payload for the client to send().
This commit is contained in:
parent
b0efdf37d7
commit
2da558ec36
5 changed files with 106 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Box, Text } from '@hermes/ink'
|
||||
import { Box, Link, Text } from '@hermes/ink'
|
||||
import { memo, type ReactNode, useMemo } from 'react'
|
||||
|
||||
import type { Theme } from '../theme.js'
|
||||
|
|
@ -22,10 +22,12 @@ type Fence = {
|
|||
len: number
|
||||
}
|
||||
|
||||
const renderLink = (key: number, t: Theme, label: string) => (
|
||||
<Text color={t.color.amber} key={key} underline>
|
||||
{label}
|
||||
</Text>
|
||||
const renderLink = (key: number, t: Theme, label: string, url: string) => (
|
||||
<Link key={key} url={url}>
|
||||
<Text color={t.color.amber} underline>
|
||||
{label}
|
||||
</Text>
|
||||
</Link>
|
||||
)
|
||||
|
||||
const trimBareUrl = (value: string) => {
|
||||
|
|
@ -38,9 +40,11 @@ const trimBareUrl = (value: string) => {
|
|||
}
|
||||
|
||||
const renderAutolink = (key: number, t: Theme, raw: string) => (
|
||||
<Text color={t.color.amber} key={key} underline>
|
||||
{raw.replace(/^mailto:/, '')}
|
||||
</Text>
|
||||
<Link key={key} url={raw}>
|
||||
<Text color={t.color.amber} underline>
|
||||
{raw.replace(/^mailto:/, '')}
|
||||
</Text>
|
||||
</Link>
|
||||
)
|
||||
|
||||
const indentDepth = (indent: string) => Math.floor(indent.replace(/\t/g, ' ').length / 2)
|
||||
|
|
@ -141,7 +145,7 @@ function MdInline({ t, text }: { t: Theme; text: string }) {
|
|||
</Text>
|
||||
)
|
||||
} else if (m[4] && m[5]) {
|
||||
parts.push(renderLink(parts.length, t, m[4]))
|
||||
parts.push(renderLink(parts.length, t, m[4], m[5]))
|
||||
} else if (m[6]) {
|
||||
parts.push(renderAutolink(parts.length, t, m[6]))
|
||||
} else if (m[7]) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue