Compare commits

...

2 Commits

Author SHA1 Message Date
openhands 5444193d9b fix(frontend): Make terminal read-only 2025-07-18 19:16:52 +00:00
openhands 16a508c15d fix(frontend): Ensure terminal is always interactive when visible 2025-07-18 19:11:44 +00:00
2 changed files with 5 additions and 1 deletions
@@ -13,6 +13,7 @@ function Terminal() {
const ref = useTerminal({
commands,
readOnly: true, // Make terminal read-only
});
return (
+4 -1
View File
@@ -16,10 +16,12 @@ import { parseTerminalOutput } from "#/utils/parse-terminal-output";
interface UseTerminalConfig {
commands: Command[];
readOnly?: boolean;
}
const DEFAULT_TERMINAL_CONFIG: UseTerminalConfig = {
commands: [],
readOnly: false,
};
const renderCommand = (command: Command, terminal: Terminal) => {
@@ -36,6 +38,7 @@ const persistentLastCommandIndex = { current: 0 };
export const useTerminal = ({
commands,
readOnly = false,
}: UseTerminalConfig = DEFAULT_TERMINAL_CONFIG) => {
const { send } = useWsClient();
const { curAgentState } = useSelector((state: RootState) => state.agent);
@@ -44,7 +47,7 @@ export const useTerminal = ({
const ref = React.useRef<HTMLDivElement>(null);
const lastCommandIndex = persistentLastCommandIndex; // Use the persistent reference
const keyEventDisposable = React.useRef<{ dispose: () => void } | null>(null);
const disabled = RUNTIME_INACTIVE_STATES.includes(curAgentState);
const disabled = RUNTIME_INACTIVE_STATES.includes(curAgentState) || readOnly;
const createTerminal = () =>
new Terminal({