Commit graph

3482 commits

Author SHA1 Message Date
Max
31a75f0161 Refactor API URL building in OpenAI and Claude components
- Update `buildAPIURL` function in OpenAI provider to delegate URL construction to `connector.BuildAPIURL`, ensuring consistent URL formatting across the agent LLM and sandbox proxy paths.
- Modify backend URL construction in Claude's `BuildProxyConfig` to utilize the shared `connector.BuildAPIURL` helper, applying the necessary `/v1` prefix for compatibility.

This change enhances code maintainability and consistency in API URL handling across different components.
2026-02-08 12:31:28 +08:00
Max
fea1ac0708 Add user attachment handling in Claude executor
- Introduce functionality to resolve and manage user-uploaded files in the sandbox environment.
- Implement `prepareAttachments` method to convert attachment URLs to local file paths and handle duplicates.
- Update message processing to replace attachment content with text references, allowing Claude CLI to access files using Read and Bash tools.
- Enhance documentation to inform users about the new attachment handling capabilities.

This change improves the interaction with user-uploaded files, enabling better integration within the Claude CLI environment.
2026-02-08 11:49:51 +08:00
Max
3bbc11604c Implement ENV variable resolution in team configuration
- Add `resolveTeamConfigENV` function to process and replace environment variables in team configuration settings, including robot email domains, whitelist entries, and invite configuration.
- Enhance `loadTeamConfigs` to call the new function, ensuring that team configurations are properly resolved before storage.

This change improves the flexibility of team configurations by allowing dynamic environment variable substitution.
2026-02-07 20:22:14 +08:00
Max
bf8d82f022 Add Yao authentication source and OAuth email handling
- Introduce `YaoAuthSource` and `OAuthEmail` fields in various structures to capture authentication source and OAuth email during user login and registration processes.
- Update `SignIDToken`, `GetInfo`, and `Map` functions to include new claims for Yao authentication source.
- Modify login context to preserve authentication source and OAuth email across different user flows.
- Enhance token issuance to include authentication source and OAuth email in claims for better tracking and user context.
- Ensure proper handling of OAuth email for third-party logins without affecting user profile email.

This change improves the user experience by providing clearer context on authentication methods used during login and registration processes.
2026-02-07 19:44:10 +08:00
Max
16a96642f5 Refactor user registration process to include default team creation
- Introduce a new function `registerUserWithTeam` that handles user registration and default team creation with rollback on failure.
- Update `GinEntryRegister` and `LoginThirdParty` functions to utilize the new registration method, ensuring consistency in user and team creation.
- Remove redundant error handling for user provider retrieval in `GinEntryRegister`.
- Enhance logging for user registration and team creation failures.
2026-02-07 17:19:28 +08:00
Max
fa664b7db7 Add root configuration to processPing response
- Include the root path from the configuration in the response of the processPing function to provide additional context for the engine's state.
2026-02-07 12:32:32 +08:00
Max
898ba7d4fd Update Makefile to switch .env login URLs from development to release mode
- Modify .env file paths for AFTER_LOGIN_SUCCESS_URL and AFTER_LOGIN_FAILURE_URL to point to the release mode (dashboard) instead of the development mode (__yao_admin_root).
- Ensure backup files are removed after the changes to maintain a clean environment.
2026-02-07 12:21:07 +08:00
Max
37410985f3 Add new skill references and assets for development environments
- Include additional skill markdown files and references for SUI and Yao agent development.
- Add new brand assets for Discord, Twitter, and Yao agents in the default template.
- Update index and layout files with new modification timestamps for consistency.
- Introduce a new VNC scope configuration for sandbox environments.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-07 12:01:42 +08:00
Max
ce4864cfde Enhance sandbox environment setup for VNC and Python compatibility
- Ensure the existence of $HOME/.Xauthority for PyAutoGUI/Xlib compatibility.
- Adjust PYTHONPATH to maintain access to user-installed Python packages.
- Explicitly set XAUTHORITY to the correct path for X11 authentication.
- Pass secrets as environment variables for Claude CLI to ensure proper access.

- Refactor VNC image support check to utilize a centralized keyword list for better maintainability.
2026-02-06 19:38:22 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
Max
0eab417f8f Revise README.md for Clarity and Focus on Autonomous Agents
- Updated the introduction to emphasize Yao as an open-source engine for autonomous agents, shifting from an all-in-one application engine description.
- Enhanced the features section to highlight the unique aspects of Yao, including its proactive nature and integration capabilities.
- Reorganized content to improve readability and better convey the functionality of Yao, including detailed descriptions of agent capabilities and execution modes.
2026-01-29 00:38:32 +08:00
Max
387e254f44 Add Execution Completion Callback to Worker Pool
- Introduced an `OnCompleteCallback` type and updated the `Pool` struct to include an optional callback for execution completion.
- Implemented `SetOnComplete` method to allow setting the completion callback.
- Enhanced worker execution logic to notify the completion callback with the execution status (success, failure, or cancellation) after each execution, improving tracking and management of execution states.
2026-01-28 19:35:38 +08:00
Max
454da5208b Enhance Execution Control and Error Handling in Robot Manager
- Updated execution control methods (`PauseExecution`, `ResumeExecution`, `StopExecution`) to include error handling and database status updates for paused, running, and cancelled states.
- Introduced `ExecuteWithControl` method in the Executor interface to manage execution with pause/resume capabilities, allowing for better control during execution.
- Enhanced the `Execute` methods across different executors (DryRun, Sandbox, Standard) to support pre-generated execution IDs and control mechanisms.
- Improved error messages in the execution handling API to provide clearer feedback on execution status and errors.
- Added support for a new execution status `ExecPaused` in the execution model, enhancing the tracking of execution states.
2026-01-28 19:10:01 +08:00
Max
94492c90a7 Fix Default Email Channel in Tests
- Updated the expected default email channel in the `TestDefaultEmailChannel` test from "email" to "default" to align with recent configuration changes, ensuring accurate test validation.
2026-01-28 16:03:56 +08:00
Max
239dc4d221 Enhance Email Subject Generation in Delivery Center
- Updated the `buildEmailSubject` function to include the robot's display name in the email subject line, improving clarity and personalization.
- Modified the function signature to accept a `robot` parameter, allowing for dynamic subject prefixes based on the robot's identity.
- Ensured that the email subject reflects the robot's name when using template-based or summary-based subjects, enhancing user experience.
2026-01-28 15:53:10 +08:00