WeKnora/internal/sandbox
nullptr-error 277d6ee851
feat(sandbox): add an interactive terminal and files tab beside chat (#3110)
* feat(sandbox): stream interactive PTYs from Cube and E2B

Give session sandboxes a provider-neutral terminal capability so a later
WebSocket layer can attach without knowing Cube vs E2B. Long-lived
streams use a timeout-free client; idle terminals keep the sandbox alive
by refreshing TTL, and a workspace can set how long to wait before
disconnect.

* feat(session): bridge browser terminals to the session sandbox

Mint a short-lived ticket over a normal authenticated POST so the browser
WebSocket never puts the access JWT in the query string. After upgrade,
recheck the bound token, membership, and session ownership so logout or
revocation tears the PTY down. Provisioning stays opt-in: a GET
handshake only creates a sandbox when the client sends provision=1.

* feat(chat): add a sandbox terminal panel beside the conversation

Open a side panel with an xterm attached to the session sandbox. Starting
the terminal is an explicit click so merely opening the panel does not
create or resume a microVM; reconnects stay lookup-only until the user
confirms create-and-start. Persist the remote shell PID in
sessionStorage so a refresh reattaches instead of spawning an orphan.

* feat(sandbox): let workspaces set terminal idle disconnect

Expose the idle-disconnect duration in the sandbox config editor so an
operator can close unused terminals and let the provider TTL pause the
sandbox, instead of leaving PTYs open for the built-in 15 minutes.

* feat(chat): show generated files in the sandbox side panel

Move the per-message artifact list into the first tab of the right-hand panel so generated files stay in view with the terminal. Keep the old drawer only for embedded chat.

* fix(sandbox-terminal): keep tickets out of logs and live PTYs across refresh

Gin was copying the handshake JWT into response_body logs, silent access-token
rotation dropped open terminals as AUTH_REVOKED, and first-use provisioning
missed shared agents. Local echo now skips password prompts.

---------

Co-authored-by: hailongzhao <hailongzhao@tencent.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-08 17:43:15 +08:00
..
capabilities.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
check_client_guard_test.go feat(sandbox): 沙箱后端改为按空间配置,并补齐 E2B 模板与检测诊断 2026-08-11 15:42:02 +08:00
config_identity.go feat(sandbox): Docker 后端支持会话级长驻容器与远程守护进程 2026-08-24 12:22:58 +08:00
config_identity_test.go feat(sandbox): remove the Local host-process backend 2026-08-26 17:48:21 +08:00
config_required.go feat(sandbox): remove the Local host-process backend 2026-08-26 17:48:21 +08:00
config_sandboxes.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
config_sandboxes_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
cube_dns.go feat(sandbox): pin Cube DNS on templates and freeze skill snapshot configs 2026-08-26 16:56:26 +08:00
cube_dns_test.go feat(sandbox): pin Cube DNS on templates and freeze skill snapshot configs 2026-08-26 16:56:26 +08:00
cube_egress_integration_test.go feat(sandbox): pin Cube DNS on templates and freeze skill snapshot configs 2026-08-26 16:56:26 +08:00
cube_integration_test.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
cube_mock_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
cube_remote_client.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
cube_remote_client_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
cube_template_catalog_test.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
cube_terminal.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
cube_terminal_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
docker_enabled.go feat: require opt-in for the Docker sandbox backend (#2936) 2026-09-01 15:42:28 +08:00
docker_enabled_test.go feat: require opt-in for the Docker sandbox backend (#2936) 2026-09-01 15:42:28 +08:00
docker_engine.go fix(sandbox): treat in-use snapshot deletes as retryable conflicts 2026-08-31 19:42:32 +08:00
docker_host.go feat(sandbox): Docker 后端支持会话级长驻容器与远程守护进程 2026-08-24 12:22:58 +08:00
docker_host_test.go feat(sandbox): Docker 后端支持会话级长驻容器与远程守护进程 2026-08-24 12:22:58 +08:00
docker_idle_sweeper.go feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
docker_idle_sweeper_test.go feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
docker_integration_test.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
docker_remote_client.go feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
docker_remote_client_test.go feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
docker_rpc_timeout.go fix(sandbox): rebuild templates without dropping the live ID 2026-08-26 16:56:26 +08:00
docker_snapshot.go fix(sandbox): delete replaced templates only after persist succeeds 2026-08-26 16:56:26 +08:00
docker_snapshot_test.go fix(sandbox): delete replaced templates only after persist succeeds 2026-08-26 16:56:26 +08:00
docker_template_catalog.go fix(sandbox): delete replaced templates only after persist succeeds 2026-08-26 16:56:26 +08:00
e2b_compatible_integration_test.go feat(sandbox): remove the Local host-process backend 2026-08-26 17:48:21 +08:00
e2b_exec_timeout_test.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
e2b_integration_test.go feat(sandbox): remove the Local host-process backend 2026-08-26 17:48:21 +08:00
e2b_remote_client.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
e2b_remote_client_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
e2b_rpc_timeout.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
e2b_terminal.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
envd_compat_transport.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
envd_compat_transport_test.go feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
filesystem_identity.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
filesystem_identity_test.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
gateway_transport.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
gateway_transport_test.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
inbound_token_registry.go fix(sandbox): always require inbound credentials 2026-09-03 13:34:40 +08:00
inbound_token_registry_test.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
langfuse.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
langfuse_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
manager.go feat(sandbox): remove the Local host-process backend 2026-08-26 17:48:21 +08:00
mkdir.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
mkdir_test.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
orphan_reaper.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
orphan_reaper_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
pty_input_coalesce.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
pty_input_coalesce_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
remote_client.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
remote_client_test.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
remote_errors.go fix(sandbox): treat in-use snapshot deletes as retryable conflicts 2026-08-31 19:42:32 +08:00
remote_errors_test.go fix(sandbox): treat in-use snapshot deletes as retryable conflicts 2026-08-31 19:42:32 +08:00
remote_fake_test.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
remote_sandbox.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
remote_sandbox_test.go feat(agent): write workspace scripts and run them with installed skills 2026-08-29 22:45:18 +08:00
remote_snapshot_test.go fix(sandbox): keep skill image pointer out of sandbox config PUT 2026-08-24 16:00:23 +08:00
runtime_defaults.go feat(sandbox): Docker 后端支持会话级长驻容器与远程守护进程 2026-08-24 12:22:58 +08:00
sandbox.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
sandbox_test.go feat(sandbox): remove the Local host-process backend 2026-08-26 17:48:21 +08:00
session_binding.go fix(sandbox): always require inbound credentials 2026-09-03 13:34:40 +08:00
session_binding_redis.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
session_binding_redis_test.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
session_binding_tenant_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
session_binding_test.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
session_lifecycle.go fix(sandbox): always require inbound credentials 2026-09-03 13:34:40 +08:00
session_lifecycle_test.go feat(sandbox): add tenant-configurable network policy (#2995) 2026-09-03 10:49:46 +08:00
session_manager.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
session_manager_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
shell_quote.go feat(sandbox): add tenant skill install and remove service layer 2026-08-24 17:51:13 +08:00
shell_quote_test.go feat(sandbox): add tenant skill install and remove service layer 2026-08-24 17:51:13 +08:00
skill_image.go feat(sandbox): remove the Local host-process backend 2026-08-26 17:48:21 +08:00
skill_paths.go feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
skill_paths_test.go feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
template_catalog.go fix(sandbox): delete replaced templates only after persist succeeds 2026-08-26 16:56:26 +08:00
template_catalog_test.go feat(sandbox): 沙箱后端改为按空间配置,并补齐 E2B 模板与检测诊断 2026-08-11 15:42:02 +08:00
tenant_config.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
tenant_config_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
tenant_resolver.go feat: require opt-in for the Docker sandbox backend (#2936) 2026-09-01 15:42:28 +08:00
tenant_resolver_test.go feat: require opt-in for the Docker sandbox backend (#2936) 2026-09-01 15:42:28 +08:00
terminal.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
terminal_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
terminal_ttl_test.go feat(sandbox): add an interactive terminal and files tab beside chat (#3110) 2026-09-08 17:43:15 +08:00
url_guard.go fix: share IP classification between SSRF and sandbox URL guards 2026-09-01 15:35:14 +08:00
url_guard_test.go fix: share IP classification between SSRF and sandbox URL guards 2026-09-01 15:35:14 +08:00
validator.go perf(sandbox): compile command-substitution regexps once 2026-06-16 19:51:32 +08:00
validator_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
workspace_failure_test.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
workspace_path.go feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00