mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
fix(tui): delegate unknown /tools subcommand to slash.exec
/tools' local handler silently returned for anything other than enable or disable, so /tools list and friends looked broken even though the Python CLI already implements them (hermes_cli/main.py registers tools_sub for list/enable/disable). Keep the client-owned enable/disable path (which has to run session.setSessionStartedAt + resetVisibleHistory locally) and route every other sub through slash.exec, matching createSlashHandler's page/sys split for long vs short output.
This commit is contained in:
parent
ce98e1ef11
commit
83c1d4ec27
22 changed files with 221 additions and 76 deletions
|
|
@ -240,22 +240,28 @@ export const coreCommands: SlashCommand[] = [
|
|||
return ctx.transcript.sys('usage: /terminal-setup [auto|vscode|cursor|windsurf]')
|
||||
}
|
||||
|
||||
const runner = !target || target === 'auto' ? configureDetectedTerminalKeybindings() : configureTerminalKeybindings(target as 'cursor' | 'vscode' | 'windsurf')
|
||||
const runner =
|
||||
!target || target === 'auto'
|
||||
? configureDetectedTerminalKeybindings()
|
||||
: configureTerminalKeybindings(target as 'cursor' | 'vscode' | 'windsurf')
|
||||
|
||||
void runner.then(result => {
|
||||
if (ctx.stale()) {
|
||||
return
|
||||
}
|
||||
void runner
|
||||
.then(result => {
|
||||
if (ctx.stale()) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.transcript.sys(result.message)
|
||||
if (result.success && result.requiresRestart) {
|
||||
ctx.transcript.sys('restart the IDE terminal for the new keybindings to take effect')
|
||||
}
|
||||
}).catch(error => {
|
||||
if (!ctx.stale()) {
|
||||
ctx.transcript.sys(`terminal setup failed: ${String(error)}`)
|
||||
}
|
||||
})
|
||||
ctx.transcript.sys(result.message)
|
||||
|
||||
if (result.success && result.requiresRestart) {
|
||||
ctx.transcript.sys('restart the IDE terminal for the new keybindings to take effect')
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
if (!ctx.stale()) {
|
||||
ctx.transcript.sys(`terminal setup failed: ${String(error)}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { ToolsConfigureResponse } from '../../../gatewayTypes.js'
|
||||
import type { SlashExecResponse, ToolsConfigureResponse } from '../../../gatewayTypes.js'
|
||||
import type { PanelSection } from '../../../types.js'
|
||||
import { patchOverlayState } from '../../overlayStore.js'
|
||||
import type { SlashCommand } from '../types.js'
|
||||
|
|
@ -207,10 +207,25 @@ export const opsCommands: SlashCommand[] = [
|
|||
{
|
||||
help: 'enable or disable tools (client-side history reset on change)',
|
||||
name: 'tools',
|
||||
run: (arg, ctx) => {
|
||||
run: (arg, ctx, cmd) => {
|
||||
const [subcommand, ...names] = arg.trim().split(/\s+/).filter(Boolean)
|
||||
|
||||
if (subcommand !== 'disable' && subcommand !== 'enable') {
|
||||
ctx.gateway.gw
|
||||
.request<SlashExecResponse>('slash.exec', { command: cmd.slice(1), session_id: ctx.sid })
|
||||
.then(r => {
|
||||
if (ctx.stale()) {
|
||||
return
|
||||
}
|
||||
|
||||
const body = r?.output || '/tools: no output'
|
||||
const text = r?.warning ? `warning: ${r.warning}\n${body}` : body
|
||||
const long = text.length > 180 || text.split('\n').filter(Boolean).length > 2
|
||||
|
||||
long ? ctx.transcript.page(text, 'Tools') : ctx.transcript.sys(text)
|
||||
})
|
||||
.catch(ctx.guardedErr)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { introMsg, toTranscriptMessages, attachedImageNotice } from '../../../domain/messages.js'
|
||||
import { attachedImageNotice, introMsg, toTranscriptMessages } from '../../../domain/messages.js'
|
||||
import type {
|
||||
BackgroundStartResponse,
|
||||
BtwStartResponse,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue