Skip to content

Terminal

Source: src/renderer/src/components/Terminal/AgentTerminal.tsx

Overview

Direct bash terminal. Commands are executed via a PTY subprocess on the backend and streamed back in real time via SSE. No model required.

The NanoCore agent (LLM-driven editing loop with diff proposals, self-healing, and multi-agent support) is in the Code Workspace, not the Terminal page. See Code Workspace.

Bash Execution

  • Output streams in real-time via SSE
  • Blocked commands: rm -rf /, sudo, mkfs, and other destructive patterns
  • Protected paths: /System, /usr, /bin, /sbin, /etc, /Library, /Applications, and others
  • Output capped at 10 KB per command
  • Default timeout: 60 seconds (configurable up to 300 s via timeout field)
  • Sub-shell execution ($(), backticks) is blocked for safety
  • Destructive commands (rm, mv, chmod, etc.) emit a warning before running

SSE Event Protocol

The terminal exec stream emits:

EventDescription
tool_startCommand begins; includes tool name, args, and call ID
tool_logStdout output from the running command
tool_doneCommand completed with exit code
doneStream finished; includes total elapsed time
errorError message

Feed

The feed displays a chronological list of items:

TypeRendering
userUser input
tool_startCommand header
tool_outputCollapsible terminal output
infoStatus messages
errorError messages

Feed state is persisted to sessionStorage (up to 200 items).

Components

FilePurpose
AgentTerminal.tsxMain container, SSE consumer
InputBar.tsxCommand input
MessageFeed.tsxScrollable feed renderer
StreamingMarkdown.tsxMarkdown renderer for tool output

API

EndpointMethodDescription
/api/terminal/execPOSTExecute bash command (PTY + SSE)

See Terminal API for full endpoint details including NanoCore agent endpoints.

Released under the MIT License.