refactor: Replace pexpect with libtmux in BashSession (#4881)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
Co-authored-by: Robert Brennan <accounts@rbren.io>
This commit is contained in:
Xingyao Wang
2025-01-03 16:22:13 -05:00
committed by GitHub
parent 761a574b09
commit ec70af9412
66 changed files with 2345 additions and 760 deletions

View File

@@ -18,6 +18,7 @@ from openhands.events.action import (
from openhands.events.observation import (
AgentStateChangedObservation,
BrowserOutputObservation,
CmdOutputMetadata,
CmdOutputObservation,
FileReadObservation,
FileWriteObservation,
@@ -54,11 +55,7 @@ class DummyAgent(Agent):
},
{
'action': CmdRunAction(command='echo "foo"'),
'observations': [
CmdOutputObservation(
'foo', command_id=-1, command='echo "foo"', exit_code=0
)
],
'observations': [CmdOutputObservation('foo', command='echo "foo"')],
},
{
'action': FileWriteAction(
@@ -81,9 +78,8 @@ class DummyAgent(Agent):
'observations': [
CmdOutputObservation(
'bash: hello.sh: No such file or directory',
command_id=-1,
command='bash workspace/hello.sh',
exit_code=127,
metadata=CmdOutputMetadata(exit_code=127),
)
],
},
@@ -152,8 +148,6 @@ class DummyAgent(Agent):
obs.pop('timestamp', None)
obs.pop('cause', None)
obs.pop('source', None)
if 'extras' in obs:
obs['extras'].pop('command_id', None)
if hist_obs != expected_obs:
print(