Commit graph

3460 commits

Author SHA1 Message Date
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
Max
274edfe7cc Update dependencies and enhance email body handling in Delivery Center
- Added new indirect dependencies: `github.com/JohannesKaufmann/dom` and `github.com/JohannesKaufmann/html-to-markdown/v2` for improved HTML processing.
- Updated `github.com/sergi/go-diff` to version 1.4.0 for enhanced diff functionality.
- Modified the `buildEmailBody` function to return both HTML and plain text versions of the email body, improving email formatting capabilities.
- Adjusted the default email channel name in configuration to "default" for better clarity.
2026-01-28 15:32:24 +08:00
Max
423d695d0e Add HMAC Signature Support for Webhook Payloads
- Implemented HMAC-SHA256 signature generation and verification for webhook requests to enhance security.
- Updated the Delivery Center to include the computed signature in the request headers when a secret is configured.
- Added utility functions for computing and verifying HMAC signatures, ensuring integrity of webhook payloads.
- Improved documentation for the new signature handling process to assist developers in implementing secure webhooks.
2026-01-28 14:58:10 +08:00
Max
ecb95f4cc8 Enhance Robot Delivery Logic and Context Management
- Introduced manager ID and email fields in the Robot struct to facilitate mandatory delivery to managers.
- Updated delivery routing logic to ensure manager email is always included if manager ID is set, improving delivery reliability.
- Added JSON serialization handling in the Delivery Center to ensure compatibility with various data types.
- Enhanced context ID generation by replacing time-based IDs with NanoID for improved uniqueness and consistency.
2026-01-28 14:44:42 +08:00
Max
235084dbae Add MCP Output Validation Tests and Enhance Runner Logic
- Introduced tests for validating MCP task output, ensuring only structure validation is performed without semantic checks.
- Implemented the `validateMCPOutput` function to validate MCP task outputs, checking for non-empty results and expected structure.
- Updated the `ExecuteWithRetry` method to incorporate MCP-specific validation logic, improving error handling and output validation for MCP tasks.
- Enhanced test coverage for various output scenarios, including nil, empty string, empty map, and empty array cases, to ensure robust validation behavior.
2026-01-27 19:00:41 +08:00
Max
3ae3f5425d Refine MCP Task Implementation and Documentation
- Updated MCP task executor ID format to use "mcp_server.mcp_tool" for better clarity and consistency.
- Added required MCP-specific fields (`mcp_server` and `mcp_tool`) to the Task struct and validation logic.
- Enhanced documentation in DESIGN.md and TECHNICAL.md to reflect changes in MCP task structure and requirements.
- Improved error handling in ExecuteMCPTask to ensure proper validation of MCP task fields before execution.
2026-01-27 18:44:25 +08:00
Max
0f8287a51b Enhance Robot Configuration with Agents and MCP Servers Integration
- Updated database queries to include 'agents' and 'mcp_servers' fields in robot data retrieval.
- Enhanced the robot configuration structure to merge agents and MCP servers from the member table into the robot's resources.
- Improved the input formatter to display time markers with check/cross indicators for better context awareness.
- Added tests to validate the new functionality and ensure proper formatting of robot identity when identity is nil.
2026-01-27 15:59:14 +08:00
Max
6e68b42128 Enhance Agent Documentation and Add Extract Command Functionality
- Updated README files to include new commands for running tests and extracting results for review.
- Introduced the `yao agent extract` command to facilitate extraction of test results from JSONL files into Markdown or JSON formats.
- Enhanced the `FormatAvailableResources` function to support localization and detailed information for agents and MCP tools.
- Improved output formatting for better readability and usability in test result documentation.
2026-01-27 10:57:27 +08:00
Max
00b6b5ee0e Enhance Tests with SafeWriter Closure for Async Writes
- Added calls to CloseSafeWriter in multiple test cases to ensure all asynchronous writes are completed before verifying output.
- Improved test reliability by ensuring that the SafeWriter's buffer is properly flushed, preventing potential race conditions in output verification.
2026-01-26 18:40:06 +08:00
Max
3f8351de75 Implement Agent-to-Agent Call Enhancements and Context Management
- Introduced mechanisms to handle agent-to-agent (A2A) calls, including automatic history skipping for forked calls and proper source tracking.
- Enhanced context management with the addition of ForkParentInfo to facilitate child stack creation without race conditions.
- Updated JSAPI methods to ensure correct handling of sub-agent calls, maintaining output isolation and preventing history pollution.
- Improved documentation to clarify the behavior of A2A calls and context management in concurrent scenarios.
2026-01-26 18:14:34 +08:00
Max
4f132859a4 Enhance JSAPI and Context Management for Sub-Agent Calls
- Implemented automatic disabling of SSE output for sub-agent calls to prevent message corruption and client disconnection.
- Introduced a `forceSkipOutput` method to ensure `skip.output` is set to true for all sub-agent requests.
- Updated the `Fork` method in the context to create independent Memory instances, preventing state sharing during concurrent executions.
- Enhanced documentation to clarify the behavior of SSE output and context management in batch operations.
2026-01-26 10:48:00 +08:00
Max
bb853ad8e7 Enhance MCP JavaScript API with Cross-Server Tool Operations
- Introduced new methods `All`, `Any`, and `Race` to the MCP JavaScript API for concurrent tool calls across multiple MCP servers, enabling improved flexibility and performance.
- Updated existing methods to return parsed results directly, simplifying the response handling for developers.
- Enhanced documentation to include detailed descriptions and examples for the new cross-server operations, improving developer guidance and usability.
2026-01-26 08:54:27 +08:00
Max
cff93116ec Enhance Agent and LLM APIs with Agent-to-Agent Communication
- Introduced `ctx.agent` and `ctx.llm` objects in the context API for improved agent-to-agent (A2A) and direct LLM calls.
- Added methods for single and parallel agent calls, including `Call`, `All`, `Any`, and `Race`, enabling flexible communication between agents.
- Enhanced documentation with detailed method summaries, parameters, and examples for better developer guidance on using the new APIs.
2026-01-25 20:56:44 +08:00
Max
02e813af0b Update Dependencies and Enhance Agent Context with Forked Context Support
- Updated `logrus` dependency from v1.9.3 to v1.9.4 and `golang.org/x/sys` from v0.38.0 to v0.40.0 for improved functionality and security.
- Introduced a `Fork` method in the agent context to create child contexts for concurrent agent and LLM calls, preventing race conditions on shared state during batch operations.
- Enhanced the `Orchestrator` methods to utilize forked contexts, ensuring independent execution of agent calls without interference.
2026-01-25 20:32:02 +08:00
Max
3a9f32af12 Enhance Agent Context with JSAPI Initialization and Message Handling
- Added initialization for the Agent JSAPI factory to support ctx.agent.* methods, improving agent interaction capabilities.
- Introduced a new agent object in the JSAPI context for calling other agents, enhancing modularity.
- Implemented an OnMessage callback in the context options to handle messages sent via ctx.Send(), allowing for more flexible message processing.
2026-01-25 19:42:56 +08:00
Max
ef63718941 Enhance Attachment Process with Plain Text and UTF-8 Support
- Added tests for saving plain text and Chinese text directly, ensuring proper handling of content without data URI encoding.
- Updated the `parseDataURI` function to support plain text storage, returning the correct content type and data bytes.
- Improved the `getAssistants` method to support nested assistants, enhancing directory scanning for assistant pages.
- Refactored the `Page` method to accommodate assistant IDs with nested structures, improving route handling for pages.
2026-01-25 17:32:50 +08:00
Max
6d4388cf1b Refactor TestGenerateFilename to Simplify Extension Validation
- Removed the validExts field from test cases, streamlining the filename generation tests.
- Enhanced validation to ensure filenames have a proper extension format and are not empty, improving test robustness.
- Updated comments for clarity on expected filename behavior based on content type.
2026-01-25 12:07:38 +08:00
Max
4928a2e493 Remove Debugging Output from OpenAI Provider Request Body
- Eliminated debug print statements for the "thinking" parameter and the full request body in the OpenAI provider, streamlining the request construction process.
- Maintained the functionality of including the "thinking" parameter for models that support reasoning/thinking mode, ensuring improved performance without unnecessary logging.
2026-01-25 11:51:17 +08:00
Max
994950f273 Enhance OpenAI Provider Request Body with Thinking Parameter
- Added support for a new "thinking" parameter in the request body for models that support reasoning/thinking mode, improving functionality.
- Updated the request body construction to include debugging output for the full request body, aiding in troubleshooting and development.
- Ensured that the model and other settings are retrieved from the connector, maintaining consistency in configuration handling.
2026-01-25 11:50:09 +08:00
Max
042066e6b3 Enhance Attachment Package with Process API and Initialization
- Added an initialization step in the Load function to register attachment processes, improving the setup for file management.
- Expanded the README to include detailed documentation on the new Process API, outlining available processes, permission models, and usage examples for better developer guidance.
2026-01-25 11:25:55 +08:00
Max
6fa808c875 Enhance ListRobots API to Include Runtime Status
- Added concurrent fetching of runtime status for each robot in the ListRobots function, improving response efficiency.
- Updated the Response struct to include new fields for runtime status: Running, MaxRunning, LastRun, and NextRun, optimizing dashboard display.
- Implemented unit tests to verify the inclusion of runtime status fields in the ListRobots response, ensuring accurate data representation for users.
2026-01-24 18:49:39 +08:00
Max
3ef536c1e7 Add Activity Type Filtering to ListActivities API
- Introduced a new `Type` field in the `ActivityQuery` struct to allow filtering activities by type (e.g., execution.started, execution.completed, execution.failed, execution.cancelled).
- Updated the `ListActivities` method in `ExecutionStore` to handle the new type filter, mapping it to corresponding execution statuses.
- Enhanced unit tests in `execution_test.go` to validate filtering by activity type, including tests for valid and invalid type scenarios.
- Modified OpenAPI definitions and related types to support the new type filter in the activities endpoint, improving API usability and flexibility.
2026-01-24 18:28:16 +08:00
Max
2f040196ec Add Results and Activities Functionality to ExecutionStore
- Implemented `ListResults` and `CountResults` methods in `ExecutionStore` to retrieve and count completed executions with delivery content, supporting filtering by member ID, team ID, trigger type, and keyword.
- Developed `ListActivities` method to derive activities from execution status changes, allowing retrieval of recent activities for a team.
- Created corresponding unit tests in `execution_test.go` to validate the functionality of results and activities listing, ensuring accurate filtering and pagination.
- Updated OpenAPI routes and types to include new endpoints for listing results and activities, enhancing the API's capabilities for managing execution data.
2026-01-24 17:57:58 +08:00