INNER CODE UNIT · Python

ShellSession

browser-use/bux · agent/box_agent.py:319

class ShellSession:
	"""A bash PTY whose bytes are streamed over the agent's WS channel.

	Life-cycle:
	  - opened by `shell_attach {session_id}` command
	  - stdout bytes sent as {type: "shell_chunk", session_id, data: <b64>}
	  - stdin received as {cmd: "shell_input", session_id, data: <b64>}
	  - resized via {cmd: "shell_resize", session_id, rows, cols}
	  - closed on process exit OR {cmd: "shell_close", session_id}
	"""

	def __init__(self, session_id: str, on_event) -> None:
		self.session_id = session_id
		self._on_event = on_event
		self._pid: int | None = None
		self._fd: int | None = None
		self._read_task: asyncio.Task | None = None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…