mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 04:03:31 +00:00
feat: add process management support (#207)
* feat: improve inspector UI for processes and fix PTY terminal
- Simplify ProcessRunTab layout: compact form with collapsible Advanced section for timeout/maxOutputBytes
- Rewrite ProcessesTab: collapsible create form, lightweight list items with status dots, clean detail panel with tabs
- Extract error details: use problem.detail instead of generic "Stream Error" title for better error messages
- Fix GhosttyTerminal binary frame parsing: handle server's binary ArrayBuffer control frames (ready/exit/error)
- Enable WebSocket proxying in Vite dev server with ws: true
- Set TERM=xterm-256color default for TTY processes so tools like tmux, vim, htop work out of the box
- Remove orange gradient background from terminal container for cleaner look
- Remove orange left border from selected process list items
- Update inspector CSS with new process/terminal styles
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* fix: address review issues and add processes documentation
- Fix unstable onExit callback in ProcessesTab (useCallback)
- Fix SSE follow stream race condition (subscribe before history read)
- Update inspector.mdx with new process management features
- Change observability icon to avoid conflict with processes
- Add docs/processes.mdx covering the full process management API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: simplify processes doc — rename sections, remove low-level protocol
- Rename "Interactive terminals" to "Terminals" with "Connect to a terminal" sub-heading
- Add TTY process creation step at top of Terminals section
- Remove low-level WebSocket protocol table and raw WebSocket example
- Keep browser terminal emulator reference with Ghostty link
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update GhosttyTerminal permalink to latest commit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: use main branch permalink for GhosttyTerminal reference
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: refine process API — WebSocket binary protocol, SDK terminal session, updated tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update GhosttyTerminal permalink to 636eefb
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* inspector: use websocket terminal API
* sdk: restore high-level terminal session
* docs: update inspector terminal permalink
* inspector: update run once placeholder
* Fix lazy install v1 API test fixture
* Add reusable React terminal component
* Fix terminal WebSocket ready state checks
---------
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e7656d78f0
commit
febe8601f6
28 changed files with 2098 additions and 83 deletions
|
|
@ -331,7 +331,10 @@ impl ProcessRuntime {
|
|||
}
|
||||
timeout_ms = timeout_ms.min(config.max_run_timeout_ms);
|
||||
|
||||
let max_output_bytes = spec.max_output_bytes.unwrap_or(config.max_output_bytes);
|
||||
let max_output_bytes = spec
|
||||
.max_output_bytes
|
||||
.unwrap_or(config.max_output_bytes)
|
||||
.min(config.max_output_bytes);
|
||||
|
||||
let mut cmd = Command::new(&spec.command);
|
||||
cmd.args(&spec.args)
|
||||
|
|
@ -343,6 +346,9 @@ impl ProcessRuntime {
|
|||
cmd.current_dir(cwd);
|
||||
}
|
||||
|
||||
if !spec.env.contains_key("TERM") {
|
||||
cmd.env("TERM", "xterm-256color");
|
||||
}
|
||||
for (key, value) in &spec.env {
|
||||
cmd.env(key, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,38 @@ fn write_executable(path: &Path, script: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
fn write_fake_npm(path: &Path) {
|
||||
write_executable(
|
||||
path,
|
||||
r#"#!/usr/bin/env sh
|
||||
set -e
|
||||
prefix=""
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
install|--no-audit|--no-fund)
|
||||
shift
|
||||
;;
|
||||
--prefix)
|
||||
prefix="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
[ -n "$prefix" ] || exit 1
|
||||
mkdir -p "$prefix/node_modules/.bin"
|
||||
for bin in claude-code-acp codex-acp amp-acp pi-acp cursor-agent-acp; do
|
||||
echo '#!/usr/bin/env sh' > "$prefix/node_modules/.bin/$bin"
|
||||
echo 'exit 0' >> "$prefix/node_modules/.bin/$bin"
|
||||
chmod +x "$prefix/node_modules/.bin/$bin"
|
||||
done
|
||||
exit 0
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
fn serve_registry_once(document: Value) -> String {
|
||||
let listener = TcpListener::bind("127.0.0.1:0").expect("bind registry server");
|
||||
let address = listener.local_addr().expect("registry address");
|
||||
|
|
|
|||
|
|
@ -182,10 +182,7 @@ async fn lazy_install_runs_on_first_bootstrap() {
|
|||
.expect("create agent processes dir");
|
||||
write_executable(&install_path.join("codex"), "#!/usr/bin/env sh\nexit 0\n");
|
||||
fs::create_dir_all(install_path.join("bin")).expect("create bin dir");
|
||||
write_executable(
|
||||
&install_path.join("bin").join("npx"),
|
||||
"#!/usr/bin/env sh\nwhile IFS= read -r _line; do :; done\n",
|
||||
);
|
||||
write_fake_npm(&install_path.join("bin").join("npm"));
|
||||
});
|
||||
|
||||
let original_path = std::env::var_os("PATH").unwrap_or_default();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue