Commit graph

4001 commits

Author SHA1 Message Date
Max
9eeec111b9
Merge pull request #1452 from trheyi/main
Add Chrome support to sandbox module and update documentation
2026-02-06 17:49:21 +08:00
Max
95cdf7961c Add Chrome support to sandbox module and update documentation
- Introduce a new Chrome image for the sandbox, enabling VNC access with real Chrome and CDP support (amd64 only).
- Update README to reflect the addition of the Chrome image and its build instructions.
- Modify build script to include a dedicated build process for the Chrome image.
- Enhance .gitignore to exclude the new Chrome plan file.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 17:48:49 +08:00
Max
8a582ce149
Merge pull request #1451 from trheyi/main
Fix sandbox compatibility, claude-proxy streaming
2026-02-06 13:17:35 +08:00
Max
28363b973e Fix sandbox compatibility, claude-proxy streaming, and rename playwright to browser
- Fix ListDir to support BusyBox/Alpine ls by falling back from GNU
  --time-style format, resolving CI test failures
- Update parseLS to handle both GNU (epoch) and BusyBox (date string) formats
- Fix claude-proxy streaming: always include usage in message_delta events
  to prevent Claude CLI from falling back to non-streaming mode
- Fix claude-proxy non-streaming: ensure usage is always present in responses
- Add paragraph separators between text blocks in Claude executor stream parser
- Translate VNC proxy UI from Chinese to English
- Rename sandbox-claude-playwright to sandbox-claude-browser across
  Dockerfiles, build scripts, and documentation

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-06 12:31:07 +08:00
Max
0a965c383d Add sandbox ID and VNC URL methods to sandbox executor
- Implement GetSandboxID method to return a mock sandbox ID for testing.
- Add GetVNCUrl method to return an empty string for VNC access in tests.
- Update SandboxExecutor interface to include new methods for sandbox identification and VNC URL retrieval.
- Enhance context creation to set sandbox ID and VNC URL properties in the sandbox instance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-05 21:46:07 +08:00
Max
55164c5665 Enhance VNC sandbox images with Yao branding and sudo support
- Add passwordless sudo for sandbox user in playwright and desktop images
- Configure Yao branding for Fluxbox (CUI dark theme, centered logo)
- Configure Yao branding for XFCE (panel icons, wallpaper, workspace shortcut)
- Add D-Bus support for XFCE desktop environment
- Add dynamic wallpaper generation with configurable resolution and logo size
- Hide Fluxbox toolbar for cleaner Playwright automation view
- Create chromium wrapper script using Playwright's bundled browser
- Add feh and imagemagick for wallpaper management in Fluxbox
- Update .gitignore for config scripts and TODO file

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-05 18:23:15 +08:00
Max
69058787f9 Add VNC remote desktop support for sandbox containers
- Add VNC-enabled Docker images (playwright, desktop) with Xvfb, x11vnc, noVNC
- Implement VNC proxy service for WebSocket-based VNC access
- Add API endpoints: /sandbox/{id}/vnc, /vnc/client, /vnc/ws
- Support dynamic VNC port mapping for Docker Desktop (macOS/Windows)
- Add YAO_SANDBOX_VNC_PORT_MAPPING config option for local development
- Update build.sh to support building VNC images
- Include design document and updated README

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-05 14:45:54 +08:00
Max
015fc9ef92 Add secure_cookie field to EntryConfig API response
- Add SecureCookie field to EntryConfig struct for frontend access
- Add GetCookieName helper to response package for dynamic cookie names
- Update guard.go to use GetCookieName instead of hardcoded __Host- prefix
- Pass secure_cookie setting to /user/entry API response

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-04 20:55:53 +08:00
Max
d7ba22ae8e Enhance OAuth security configuration and cookie handling
- Add SecureCookie field to TempSecurityConfig and SecurityConfig for better cookie security management.
- Implement SetSecureCookieEnabled and IsSecureCookieEnabled functions to manage secure cookie settings globally.
- Update response handling to utilize secure cookie settings, ensuring compliance with security best practices.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-04 20:16:24 +08:00
Max
9a1024722e
Merge pull request #1450 from trheyi/main
Refactor Yao app initialization and enhance error handling
2026-02-04 19:09:36 +08:00
Max
1680d5eefe Refactor Yao app initialization and enhance error handling
- Update start command to check if the current directory is a Yao app root or a subdirectory, providing clearer error messages for users.
- Modify installation logic to handle empty directories more effectively, ensuring the init app is installed only when appropriate.
- Improve welcome message formatting and update links for documentation and community resources.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-04 19:04:23 +08:00
Max
14869bebb6
Merge pull request #1449 from trheyi/main
feat: add production builds with -s -w stripping and UPX compression
2026-02-03 12:29:04 +08:00
Max
76159373e5 feat: add production builds with -s -w stripping and UPX compression
- Add prod builds (stripped) and prod-upx builds (compressed) for Linux
- Add prod builds (stripped) for macOS (UPX not supported)
- Add docker/production-slim for slim images using prod-upx binaries
- Update build-docker.yml to build slim variants
- Update build-macos.yml to sign and notarize all 4 variants
- Add BUILDOPTIONS constant to show build flags in version output
- Add make release-all target for building both dev and prod locally

Linux artifacts: 6 variants (dev, prod, prod-upx for amd64/arm64)
macOS artifacts: 4 variants (dev, prod for amd64/arm64)
Docker images: 6 variants (dev, prod, prod-slim for amd64/arm64)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 12:27:37 +08:00
Max
2b5ae1286b
Merge pull request #1448 from trheyi/main
Enhance build process and options management
2026-02-03 10:23:42 +08:00
Max
6e97de948b Enhance build process and options management
- Update Makefile to include new production and UPX build targets for optimized binaries.
- Add BUILDOPTIONS constant to share/const.go for tracking build configurations.
- Modify version command to display build options.
- Update Dockerfile to install UPX for compression during builds.
- Add release and prod targets to streamline artifact creation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-03 10:22:55 +08:00
Max
7da36965c7
Merge pull request #1447 from trheyi/main
Refactor context ID generation to use UUID
2026-02-02 18:15:11 +08:00
Max
3d7b0a2dbd Refactor context ID generation to use UUID
- Replace the existing NanoID generation in generateContextID with UUID for improved uniqueness.
- Update RequestID method to return the context ID directly instead of generating a new NanoID.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-02 11:49:10 +08:00
Max
5a372300e3
Merge pull request #1446 from trheyi/main
Implement continuation support for Claude CLI commands
2026-02-01 13:39:51 +08:00
Max
702b743de7 Implement continuation support for Claude CLI commands
- Refactor BuildCommand to support session continuation using --continue flag.
- Introduce BuildCommandWithContinuation to handle both initial and continuation requests.
- Add BuildLastUserMessageJSONL for generating JSONL from the last user message in continuation scenarios.
- Enhance Executor to check for existing sessions and adjust command building accordingly.
- Update environment setup to ensure session data is stored correctly for persistence.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-01 13:07:18 +08:00
Max
d78b4ea54a Refactor container file operations for improved performance
- Update ReadFile method to read directly from the host's bind-mounted workspace instead of using Docker's CopyFromContainer, enhancing performance.
- Introduce containerPathToHost method to convert container paths to host paths, ensuring proper access to bind-mounted directories.
- Simplify idle container cleanup logic by storing the idle time in a variable for better readability.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-01 11:24:47 +08:00
Max
60b0eda70c
Merge pull request #1445 from trheyi/main
Fix real_e2e_test max_tokens limit
2026-01-31 23:58:56 +08:00
Max
2e94ce5062 Fix real_e2e_test max_tokens limit for Volcengine API
Add ConnectorOptions with max_tokens: 4096 to avoid exceeding
Volcengine GLM-4.7's 16384 token limit (Claude CLI defaults to 32000)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 23:26:11 +08:00
Max
8a138ced41 Remove remaining demux debug logs
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 23:13:43 +08:00
Max
7857b356d9
Merge pull request #1444 from trheyi/main
Refactor Claude sandbox: replace CCR with claude-proxy and fix streaming issues
2026-01-31 23:00:46 +08:00
Max
ea8be6c287 Add secure proxy configuration with options and secrets support
- Implement secure config file location (/tmp/.yao/proxy.json) instead of user-visible /workspace/
- Add generic options map support for backend-specific parameters (e.g., thinking for Volcengine GLM-4.7)
- Add secrets support for passing sensitive env vars (e.g., GITHUB_TOKEN) to sandbox container
- Remove excessive debug logs, keep critical ones with log.Printf("[Sandbox]...")
- Fix test assertions for system prompt passing via CLI args instead of env var
- Update i18n messages for sandbox loading states

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 22:46:48 +08:00
Max
323b322cf9 Fix sandbox message history not being saved
- Send ChunkMessageStart before ChunkText in parseStream
- This initializes stream state (inGroup=true) required for Buffer.AddAssistantMessage
- Only send ChunkMessageEnd if message was started

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 15:42:33 +08:00
Max
45963137c6 Fix duplicate content and loading message in sandbox output
- Fix Claude CLI output parsing: only extract content from final
  assistant message (with stop_reason) to avoid duplicate content
- Remove trailing "..." from sandbox loading message

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 15:39:26 +08:00
Max
bec8d9d426 Fix SystemPrompt passing and Claude CLI stream-json parsing
- Fix missing SystemPrompt field in sandbox executor options conversion
  (was causing Claude CLI to be skipped even when prompts were configured)
- Rewrite parseStream to handle Claude CLI stream-json output format:
  - system: initialization message
  - assistant: message with content array (text, tool_use)
  - result: final result with verification string
- Add comprehensive E2E tests via caller for sandbox integration:
  - TestSandboxE2E_ClaudeCLIExecution: verify command execution
  - TestSandboxE2E_FileCreation: verify file operations
  - TestSandboxE2E_HookOnlyMode: verify Claude CLI skip logic
  - TestSandboxE2E_StreamingResponse: verify streaming works
- Add real_e2e_test.go for direct Claude CLI execution testing

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 15:07:40 +08:00
Max
019b606b13 Fix sandbox integration tests for claude-proxy architecture
- Update TestClaudeCommandBuilding to expect new command format
- Rename TestClaudeCCRConfigBuilding to TestClaudeProxyConfigBuilding
- Update assertions for claude-proxy env vars instead of CCR
- Apply gofmt formatting to proxy/types.go

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 14:36:01 +08:00
Max
4e88c7ae78 Update Claude CLI integration with stream-json input format
- Add --input-format stream-json, --output-format stream-json, --verbose flags
- Use heredoc to pass messages via stdin (no CLI length limit)
- Add BuildInputJSONL function for message conversion
- Add shouldSkipClaudeCLI logic to skip when no prompts/skills/mcp
- Update executor to conditionally start claude-proxy only when needed
- Add SystemPrompt field to Options for skip logic
- Add E2E tests for skip mode and command building
- Fix tests to reflect new command structure

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 13:29:31 +08:00
Max
3d16a9de77 Replace CCR with claude-proxy for Claude sandbox
- Add claude-proxy: lightweight Go proxy to translate between Anthropic
  and OpenAI-compatible APIs with full streaming and tool-calling support
- Update Dockerfile to include claude-proxy binary (multi-arch)
- Add auto-start proxy via entrypoint when env vars are set
- Update executor.go to write proxy config and start proxy
- Simplify command.go to use direct Claude CLI with proxy
- Support both docker run -e and config file for proxy settings

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 12:44:29 +08:00
Max
f38deaead0
Merge pull request #1443 from trheyi/main
Update Command Test to Reflect New Command Structure
2026-01-30 21:25:54 +08:00
Max
d07781ceeb Update Command Test to Reflect New Command Structure
- Adjusted assertions in the command test to verify the updated command structure, which now begins with "bash" and includes specific flags for executing CCR commands.
- Enhanced the test to ensure the user prompt is correctly included in the command, improving the accuracy of the test verification.
2026-01-30 20:57:11 +08:00
Max
1e57a206dd
Merge pull request #1442 from trheyi/main
Enhance Sandbox Integration and CI Workflow for AI Tests
2026-01-30 20:23:26 +08:00
Max
e160f304b1 Update Sandbox Integration Test to Reflect Command Structure Changes
- Modified the command verification in the sandbox integration test to assert the new command structure, which now starts with "bash" and includes specific arguments for executing CCR commands.
- Enhanced assertions to check for the presence of required command components, improving the robustness of the test.
2026-01-30 20:09:28 +08:00
Max
c1e92b726d Implement MCP Configuration and Tool Integration for Sandbox
- Added functionality to build and manage MCP configuration for sandbox environments, allowing for dynamic tool execution.
- Enhanced the Assistant's Stream method to skip MCP tool calls in sandbox mode, with internal handling by Claude CLI.
- Introduced unit tests for MCP configuration building and skills directory resolution, ensuring robust integration.
- Updated sandbox manager to create IPC sessions and manage tool exposure dynamically, improving interaction with external agents.
- Enhanced documentation to reflect new features and integration points for MCP and skills within the sandbox.
2026-01-30 19:57:31 +08:00
Max
21242416e0 Enhance Sandbox API and Integration Tests
- Updated the sandbox integration test to verify JSON fields using snake_case for CCR configuration.
- Added detailed documentation for the sandbox API, including properties, methods, and use cases for file operations and command execution.
- Enhanced context API documentation to include sandbox operations, improving clarity on available features when sandbox is configured.
2026-01-30 17:56:57 +08:00
Max
cd5cf32a20 Enhance Sandbox Integration and CI Workflow for AI Tests
- Added steps to pull necessary Docker images for sandbox testing in both CI workflows.
- Updated the AI test execution to utilize sandbox configurations, ensuring proper environment setup.
- Introduced sandbox initialization in the Assistant's Stream method, allowing for execution of coding agents like Claude and Cursor.
- Enhanced context management to support sandbox execution, improving flexibility in handling agent operations.
2026-01-30 17:41:06 +08:00
Max
3fb23d8e85
Merge pull request #1441 from trheyi/main
Update Dockerfiles to Use Ubuntu 24.04 and Enhance Package Installation
2026-01-30 12:52:44 +08:00
Max
f265aee974 Update Dockerfiles to Use Ubuntu 24.04 and Enhance Package Installation
- Updated base Dockerfile to use Ubuntu 24.04 LTS, ensuring long-term support until April 2029.
- Improved package installation in the base image by adding essential tools and utilities, including jq, vim, and network tools.
- Modified the Claude Dockerfile to reflect the new base image and updated Python version to 3.12.
- Added installation for Claude Code Router (CCR) and created an entrypoint script for CCR daemon mode, enhancing functionality for third-party LLM support.
2026-01-30 12:28:03 +08:00
Max
07c76e10cd
Merge pull request #1440 from trheyi/main
feat(sandbox): add persistent Docker sandbox for external CLI agents
2026-01-29 20:18:01 +08:00
Max
b40cea6887 Enhance Sandbox Configuration for CI and Testing
- Updated CI workflows to set the YAO_SANDBOX_CONTAINER_USER environment variable, ensuring proper user permissions during sandbox tests.
- Modified the Config struct to include ContainerUser, allowing for user specification in container execution.
- Improved test setup in config_test.go to clear conflicting environment variables, enhancing test reliability.
- Refactored manager_test.go to utilize the new getContainerUser function for consistent user handling across tests.
2026-01-29 20:13:40 +08:00
Max
68fd1919c0 Enhance Sandbox Test Configuration and Directory Management
- Added environment variables for YAO_SANDBOX_WORKSPACE and YAO_SANDBOX_IPC in the CI workflows to improve sandbox test configuration.
- Refactored test directory management in manager_test.go to utilize the new getTestDirs function, allowing for better handling of workspace and IPC directories, whether using environment variables or temporary directories.
- Improved cleanup logic to ensure temporary directories are removed only when created, enhancing test reliability.
2026-01-29 20:03:08 +08:00
Max
0394727f29 Enhance Config and Manager for Container Path Management
- Added ContainerWorkDir and ContainerIPCSocket fields to the Config struct for better container path configuration.
- Updated DefaultConfig to initialize new fields with default values.
- Modified the Manager to apply defaults for container paths and utilize them in container creation and execution methods, improving flexibility and reliability in container management.
2026-01-29 19:53:30 +08:00
Max
1ece4b0f48 Refactor Exec Method to Enhance Container Execution and Output Handling
- Implemented a readiness check to ensure the container is running before executing commands, improving reliability.
- Updated the method to create an exec instance and attach to it, allowing for better management of command execution.
- Enhanced output handling by reading from the exec response, ensuring context-aware output retrieval.
- Added logic to wait for exec completion and retrieve the exit code, improving feedback on command execution status.
2026-01-29 19:44:47 +08:00
Max
08e7ed36a3 Implement Container Readiness Check in Manager
- Added a loop in the ensureRunning method to wait for the Docker container to be in a running state before proceeding, enhancing reliability in container management.
- Included error handling for container inspection to ensure proper feedback in case of failures during the readiness check.
2026-01-29 19:38:03 +08:00
Max
55e43a7edd Enhance Exec Method with Context-Aware Output Handling and Timeout Verification
- Updated the Exec method to read output with context awareness, allowing for better error handling during command execution.
- Modified the TestExecWithTimeout to ensure it correctly verifies timeout behavior and measures execution duration, improving test reliability.
- Added logic to create parent directories in WriteFile method, ensuring proper file handling within containers.
2026-01-29 19:31:19 +08:00
Max
d4bed4f277 feat(sandbox): add persistent Docker sandbox for external CLI agents 2026-01-29 19:23:50 +08:00
Max
0c64471f6c
Merge pull request #1439 from trheyi/main
Update README.md for Improved Clarity and Visual Appeal
2026-01-29 01:04:58 +08:00
Max
d21dee07c4 Update README.md for Improved Clarity and Visual Appeal
- Revised the title to include a subtitle for better context.
- Added a mission control image to enhance visual engagement.
- Maintained focus on Yao as an open-source engine for autonomous agents.
2026-01-29 01:04:22 +08:00