mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
chore(tui): remove dead branch cleanup code
- drop unused TUI helpers, test-only layout scaffolding, and stale public debug exports - remove an unused profiler import and trim test-only coverage for deleted helpers
This commit is contained in:
@@ -30,7 +30,6 @@ import pty
|
|||||||
import select
|
import select
|
||||||
import signal
|
import signal
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import statistics
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
2
ui-tui/packages/hermes-ink/index.d.ts
vendored
2
ui-tui/packages/hermes-ink/index.d.ts
vendored
@@ -4,7 +4,7 @@ export type { StderrHandle } from './src/hooks/use-stderr.ts'
|
|||||||
export { default as useStdout } from './src/hooks/use-stdout.ts'
|
export { default as useStdout } from './src/hooks/use-stdout.ts'
|
||||||
export type { StdoutHandle } from './src/hooks/use-stdout.ts'
|
export type { StdoutHandle } from './src/hooks/use-stdout.ts'
|
||||||
export { Ansi } from './src/ink/Ansi.tsx'
|
export { Ansi } from './src/ink/Ansi.tsx'
|
||||||
export { evictInkCaches, inkCacheSizes } from './src/ink/cache-eviction.ts'
|
export { evictInkCaches } from './src/ink/cache-eviction.ts'
|
||||||
export type { EvictLevel, InkCacheSizes } from './src/ink/cache-eviction.ts'
|
export type { EvictLevel, InkCacheSizes } from './src/ink/cache-eviction.ts'
|
||||||
export { AlternateScreen } from './src/ink/components/AlternateScreen.tsx'
|
export { AlternateScreen } from './src/ink/components/AlternateScreen.tsx'
|
||||||
export { default as Box } from './src/ink/components/Box.tsx'
|
export { default as Box } from './src/ink/components/Box.tsx'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export { default as useStderr } from './hooks/use-stderr.js'
|
export { default as useStderr } from './hooks/use-stderr.js'
|
||||||
export { default as useStdout } from './hooks/use-stdout.js'
|
export { default as useStdout } from './hooks/use-stdout.js'
|
||||||
export { Ansi } from './ink/Ansi.js'
|
export { Ansi } from './ink/Ansi.js'
|
||||||
export { evictInkCaches, type EvictLevel, type InkCacheSizes, inkCacheSizes } from './ink/cache-eviction.js'
|
export { evictInkCaches, type EvictLevel, type InkCacheSizes } from './ink/cache-eviction.js'
|
||||||
export { AlternateScreen } from './ink/components/AlternateScreen.js'
|
export { AlternateScreen } from './ink/components/AlternateScreen.js'
|
||||||
export { default as Box } from './ink/components/Box.js'
|
export { default as Box } from './ink/components/Box.js'
|
||||||
export { default as Link } from './ink/components/Link.js'
|
export { default as Link } from './ink/components/Link.js'
|
||||||
@@ -22,7 +22,7 @@ export { useTerminalFocus } from './ink/hooks/use-terminal-focus.js'
|
|||||||
export { useTerminalTitle } from './ink/hooks/use-terminal-title.js'
|
export { useTerminalTitle } from './ink/hooks/use-terminal-title.js'
|
||||||
export { useTerminalViewport } from './ink/hooks/use-terminal-viewport.js'
|
export { useTerminalViewport } from './ink/hooks/use-terminal-viewport.js'
|
||||||
export { default as measureElement } from './ink/measure-element.js'
|
export { default as measureElement } from './ink/measure-element.js'
|
||||||
export { resetScrollFastPathStats, scrollFastPathStats, type ScrollFastPathStats } from './ink/render-node-to-output.js'
|
export { scrollFastPathStats, type ScrollFastPathStats } from './ink/render-node-to-output.js'
|
||||||
export { createRoot, default as render, renderSync } from './ink/root.js'
|
export { createRoot, default as render, renderSync } from './ink/root.js'
|
||||||
export { stringWidth } from './ink/stringWidth.js'
|
export { stringWidth } from './ink/stringWidth.js'
|
||||||
export { isXtermJs } from './ink/terminal.js'
|
export { isXtermJs } from './ink/terminal.js'
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export interface InkCacheSizes {
|
|||||||
wrap: number
|
wrap: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export function inkCacheSizes(): InkCacheSizes {
|
function inkCacheSizes(): InkCacheSizes {
|
||||||
return {
|
return {
|
||||||
lineWidth: lineWidthCacheSize(),
|
lineWidth: lineWidthCacheSize(),
|
||||||
slice: sliceCacheSize(),
|
slice: sliceCacheSize(),
|
||||||
|
|||||||
@@ -98,19 +98,6 @@ export const scrollFastPathStats: ScrollFastPathStats = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resetScrollFastPathStats(): void {
|
|
||||||
scrollFastPathStats.captured = 0
|
|
||||||
scrollFastPathStats.taken = 0
|
|
||||||
scrollFastPathStats.declined.noPrevScreen = 0
|
|
||||||
scrollFastPathStats.declined.heightDeltaMismatch = 0
|
|
||||||
scrollFastPathStats.declined.other = 0
|
|
||||||
scrollFastPathStats.lastDeclineReason = undefined
|
|
||||||
scrollFastPathStats.lastHeightDelta = undefined
|
|
||||||
scrollFastPathStats.lastHintDelta = undefined
|
|
||||||
scrollFastPathStats.lastScrollHeight = undefined
|
|
||||||
scrollFastPathStats.lastPrevHeight = undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getScrollHint(): ScrollHint | null {
|
export function getScrollHint(): ScrollHint | null {
|
||||||
return scrollHint
|
return scrollHint
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { beforeEach, describe, expect, it } from 'vitest'
|
import { beforeEach, describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
appendTurnSegment,
|
|
||||||
archiveDoneTodos,
|
archiveDoneTodos,
|
||||||
archiveTodosAtTurnEnd,
|
archiveTodosAtTurnEnd,
|
||||||
getTurnState,
|
getTurnState,
|
||||||
@@ -64,13 +63,4 @@ describe('turnStore live progress helpers', () => {
|
|||||||
toggleTodoCollapsed()
|
toggleTodoCollapsed()
|
||||||
expect(getTurnState().todoCollapsed).toBe(false)
|
expect(getTurnState().todoCollapsed).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('merges adjacent live tool shelves before rendering', () => {
|
|
||||||
appendTurnSegment({ kind: 'trail', role: 'system', text: '', tools: ['one ✓'] })
|
|
||||||
appendTurnSegment({ kind: 'trail', role: 'system', text: '', tools: ['two ✓'] })
|
|
||||||
|
|
||||||
expect(getTurnState().streamSegments).toEqual([
|
|
||||||
{ kind: 'trail', role: 'system', text: '', tools: ['one ✓', 'two ✓'] }
|
|
||||||
])
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ export const opsCommands: SlashCommand[] = [
|
|||||||
const [sub, ...rest] = text.split(/\s+/)
|
const [sub, ...rest] = text.split(/\s+/)
|
||||||
const query = rest.join(' ').trim()
|
const query = rest.join(' ').trim()
|
||||||
const { rpc } = ctx.gateway
|
const { rpc } = ctx.gateway
|
||||||
const { page, panel, sys } = ctx.transcript
|
const { panel, sys } = ctx.transcript
|
||||||
|
|
||||||
if (sub === 'list') {
|
if (sub === 'list') {
|
||||||
rpc<SkillsListResponse>('skills.manage', { action: 'list' })
|
rpc<SkillsListResponse>('skills.manage', { action: 'list' })
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { atom } from 'nanostores'
|
import { atom } from 'nanostores'
|
||||||
import { useSyncExternalStore } from 'react'
|
import { useSyncExternalStore } from 'react'
|
||||||
|
|
||||||
import { appendToolShelfMessage, isTodoDone } from '../lib/liveProgress.js'
|
import { isTodoDone } from '../lib/liveProgress.js'
|
||||||
import type { ActiveTool, ActivityItem, Msg, SubagentProgress, TodoItem } from '../types.js'
|
import type { ActiveTool, ActivityItem, Msg, SubagentProgress, TodoItem } from '../types.js'
|
||||||
|
|
||||||
const buildTurnState = (): TurnState => ({
|
const buildTurnState = (): TurnState => ({
|
||||||
@@ -64,9 +64,6 @@ export const archiveTodosAtTurnEnd = () => {
|
|||||||
return [msg]
|
return [msg]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const appendTurnSegment = (msg: Msg) =>
|
|
||||||
patchTurnState(state => ({ ...state, streamSegments: appendToolShelfMessage(state.streamSegments, msg) }))
|
|
||||||
|
|
||||||
export const resetTurnState = () => $turnState.set(buildTurnState())
|
export const resetTurnState = () => $turnState.set(buildTurnState())
|
||||||
|
|
||||||
export interface TurnState {
|
export interface TurnState {
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ export function useMainApp(gw: GatewayClient) {
|
|||||||
|
|
||||||
clipboardPasteRef.current = paste
|
clipboardPasteRef.current = paste
|
||||||
|
|
||||||
const { dispatchSubmission, send, sendQueued, shellExec, submit } = useSubmission({
|
const { dispatchSubmission, send, sendQueued, submit } = useSubmission({
|
||||||
appendMessage,
|
appendMessage,
|
||||||
composerActions,
|
composerActions,
|
||||||
composerRefs,
|
composerRefs,
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ export function useSubmission(opts: UseSubmissionOptions) {
|
|||||||
|
|
||||||
submitRef.current = submit
|
submitRef.current = submit
|
||||||
|
|
||||||
return { dispatchSubmission, send, sendQueued, shellExec, submit }
|
return { dispatchSubmission, send, sendQueued, submit }
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UseSubmissionOptions {
|
export interface UseSubmissionOptions {
|
||||||
|
|||||||
@@ -394,10 +394,6 @@ function SubagentAccordion({
|
|||||||
const hasTools = item.tools.length > 0
|
const hasTools = item.tools.length > 0
|
||||||
const noteRows = [...(summary ? [summary] : []), ...item.notes]
|
const noteRows = [...(summary ? [summary] : []), ...item.notes]
|
||||||
const hasNotes = noteRows.length > 0
|
const hasNotes = noteRows.length > 0
|
||||||
// `showChildren` only seeds the recursive `expanded` prop for nested
|
|
||||||
// subagents — it MUST NOT be OR-ed into the local section toggles, or
|
|
||||||
// expand-all permanently locks the inner chevrons open.
|
|
||||||
const showChildren = expanded || deep
|
|
||||||
const noteColor = statusTone === 'error' ? t.color.error : statusTone === 'warn' ? t.color.warn : t.color.dim
|
const noteColor = statusTone === 'error' ? t.color.error : statusTone === 'warn' ? t.color.warn : t.color.dim
|
||||||
|
|
||||||
const sections: {
|
const sections: {
|
||||||
|
|||||||
@@ -364,11 +364,6 @@ export interface SpawnTreeLoadResponse {
|
|||||||
subagents?: unknown[]
|
subagents?: unknown[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SpawnTreeSaveResponse {
|
|
||||||
path?: string
|
|
||||||
session_id?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type GatewayEvent =
|
export type GatewayEvent =
|
||||||
| { payload?: { skin?: GatewaySkin }; session_id?: string; type: 'gateway.ready' }
|
| { payload?: { skin?: GatewaySkin }; session_id?: string; type: 'gateway.ready' }
|
||||||
| { payload?: GatewaySkin; session_id?: string; type: 'skin.changed' }
|
| { payload?: GatewaySkin; session_id?: string; type: 'skin.changed' }
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import { describe, expect, it } from 'vitest'
|
|
||||||
|
|
||||||
import { liveTailOrder } from './liveLayout.js'
|
|
||||||
|
|
||||||
describe('liveTailOrder', () => {
|
|
||||||
it('anchors live todo after scroll history and assistant output', () => {
|
|
||||||
expect(liveTailOrder()).toEqual(['scroll-history', 'assistant', 'live-todo'])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export const liveTailOrder = () => ['scroll-history', 'assistant', 'live-todo'] as const
|
|
||||||
@@ -2,7 +2,7 @@ import type { Msg } from '../types.js'
|
|||||||
|
|
||||||
import { boundedHistoryRenderText } from './text.js'
|
import { boundedHistoryRenderText } from './text.js'
|
||||||
|
|
||||||
export const hashText = (text: string) => {
|
const hashText = (text: string) => {
|
||||||
let h = 5381
|
let h = 5381
|
||||||
|
|
||||||
for (let i = 0; i < text.length; i++) {
|
for (let i = 0; i < text.length; i++) {
|
||||||
|
|||||||
2
ui-tui/src/types/hermes-ink.d.ts
vendored
2
ui-tui/src/types/hermes-ink.d.ts
vendored
@@ -121,7 +121,6 @@ declare module '@hermes/ink' {
|
|||||||
lastPrevHeight?: number
|
lastPrevHeight?: number
|
||||||
}
|
}
|
||||||
export const scrollFastPathStats: ScrollFastPathStats
|
export const scrollFastPathStats: ScrollFastPathStats
|
||||||
export function resetScrollFastPathStats(): void
|
|
||||||
|
|
||||||
export type EvictLevel = 'all' | 'half'
|
export type EvictLevel = 'all' | 'half'
|
||||||
export type InkCacheSizes = {
|
export type InkCacheSizes = {
|
||||||
@@ -131,7 +130,6 @@ declare module '@hermes/ink' {
|
|||||||
readonly wrap: number
|
readonly wrap: number
|
||||||
}
|
}
|
||||||
export function evictInkCaches(level?: EvictLevel): InkCacheSizes
|
export function evictInkCaches(level?: EvictLevel): InkCacheSizes
|
||||||
export function inkCacheSizes(): InkCacheSizes
|
|
||||||
|
|
||||||
export function render(node: React.ReactNode, options?: NodeJS.WriteStream | RenderOptions): Instance
|
export function render(node: React.ReactNode, options?: NodeJS.WriteStream | RenderOptions): Instance
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user