mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 01:21:43 +00:00
Adds a live + post-hoc audit surface for recursive delegate_task fan-out. None of cc/oc/oclaw tackle nested subagent trees inside an Ink overlay; this ships a view-switched dashboard that handles arbitrary depth + width. Python - delegate_tool: every subagent event now carries subagent_id, parent_id, depth, model, tool_count; subagent.complete also ships input/output/ reasoning tokens, cost, api_calls, files_read/files_written, and a tail of tool-call outputs - delegate_tool: new subagent.spawn_requested event + _active_subagents registry so the overlay can kill a branch by id and pause new spawns - tui_gateway: new RPCs delegation.status, delegation.pause, subagent.interrupt, spawn_tree.save/list/load (disk under \$HERMES_HOME/spawn-trees/<session>/<ts>.json) TUI - /agents overlay: full-width list mode (gantt strip + row picker) and Enter-to-drill full-width scrollable detail mode; inverse+amber selection, heat-coloured branch markers, wall-clock gantt with tick ruler, per-branch rollups - Detail pane: collapsible accordions (Budget, Files, Tool calls, Output, Progress, Summary); open-state persists across agents + mode switches via a shared atom - /replay [N|last|list|load <path>] for in-memory + disk history; /replay-diff <a> <b> for side-by-side tree comparison - Status-bar SpawnHud warns as depth/concurrency approaches caps; overlay auto-follows the just-finished turn onto history[1] - Theme: bump DARK dim #B8860B → #CC9B1F for readable secondary text globally; keep LIGHT untouched Tests: +29 new subagentTree unit tests; 215/215 passing.
51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
import { atom, computed } from 'nanostores'
|
|
|
|
import type { OverlayState } from './interfaces.js'
|
|
|
|
const buildOverlayState = (): OverlayState => ({
|
|
agents: false,
|
|
agentsInitialHistoryIndex: 0,
|
|
approval: null,
|
|
clarify: null,
|
|
confirm: null,
|
|
modelPicker: false,
|
|
pager: null,
|
|
picker: false,
|
|
secret: null,
|
|
skillsHub: false,
|
|
sudo: null
|
|
})
|
|
|
|
export const $overlayState = atom<OverlayState>(buildOverlayState())
|
|
|
|
export const $isBlocked = computed(
|
|
$overlayState,
|
|
({ agents, approval, clarify, confirm, modelPicker, pager, picker, secret, skillsHub, sudo }) =>
|
|
Boolean(agents || approval || clarify || confirm || modelPicker || pager || picker || secret || skillsHub || sudo)
|
|
)
|
|
|
|
export const getOverlayState = () => $overlayState.get()
|
|
|
|
export const patchOverlayState = (next: Partial<OverlayState> | ((state: OverlayState) => OverlayState)) =>
|
|
$overlayState.set(typeof next === 'function' ? next($overlayState.get()) : { ...$overlayState.get(), ...next })
|
|
|
|
/** Full reset — used by session/turn teardown and tests. */
|
|
export const resetOverlayState = () => $overlayState.set(buildOverlayState())
|
|
|
|
/**
|
|
* Soft reset: drop FLOW-scoped overlays (approval / clarify / confirm / sudo
|
|
* / secret / pager) but PRESERVE user-toggled ones — agents dashboard, model
|
|
* picker, skills hub, session picker. Those are opened deliberately and
|
|
* shouldn't vanish when a turn ends. Called from turnController.idle() on
|
|
* every turn completion / interrupt; the old "reset everything" behaviour
|
|
* silently closed /agents the moment delegation finished.
|
|
*/
|
|
export const resetFlowOverlays = () =>
|
|
$overlayState.set({
|
|
...buildOverlayState(),
|
|
agents: $overlayState.get().agents,
|
|
agentsInitialHistoryIndex: $overlayState.get().agentsInitialHistoryIndex,
|
|
modelPicker: $overlayState.get().modelPicker,
|
|
picker: $overlayState.get().picker,
|
|
skillsHub: $overlayState.get().skillsHub
|
|
})
|