Commit graph

399 commits

Author SHA1 Message Date
Max
85159f49dd Add STT capability support in LLM agent
- Update the `ToMap` function in `capabilities.go` to include the `stt` capability from OpenAI.
- Modify the `convertAnthropicCaps` function to map the `STT` field from Anthropic capabilities.
- Enhance documentation in `llm.go` to describe the new `stt` capability for audio transcription models.
2026-02-14 18:03:13 +08:00
Max
342c2f11a3 Refactor agent call handling and enhance request structures
- Update `forceSkipForSubAgent` to respect caller's `skip.output` setting, allowing for silent internal worker agent execution.
- Refactor error handling in `callAgentWithContext` to utilize a new `NewResult` function for consistent result construction.
- Introduce `ProcessCallRequest` structure for improved agent call parameters, including a default timeout constant for process calls.
2026-02-14 11:30:20 +08:00
Max
464f1abf63 Remove OpenAI API references from Assistant struct and initialization
- Eliminate the `openai` field from the `Assistant` struct and its initialization in the `initialize` method, streamlining the Assistant's internal structure.
- This change simplifies the codebase by removing unnecessary dependencies on the OpenAI API, enhancing maintainability.
2026-02-12 19:47:06 +08:00
Max
831f3051ea Ensure SafeWriter is closed before reading buffer in test
- Added a call to `CloseSafeWriter` in `TestJsValueStreamingWorkflow` to flush all pending async writes before reading the output buffer. This change improves test reliability, particularly on slow CI runners, by preventing potential issues with empty buffers.
2026-02-11 17:07:33 +08:00
Max
1b028abdef Enhance test reliability by closing SafeWriter before buffer read
- Add calls to `CloseSafeWriter` in `TestJsValueSendVsSendStream` to ensure all pending async writes are flushed before reading the output buffer. This change addresses potential issues with empty buffers on slow CI runners, improving test consistency.
2026-02-11 16:03:21 +08:00
Max
69a6a43362 Add Anthropic API key to workflow configurations
- Include `ANTHROPIC_API_KEY` in both `pr-test.yml` and `unit-test.yml` workflows to support Anthropic API integration.
- Refactor tool call processing in `anthropic.go` to ensure deterministic order by sorting tool call indices before processing, enhancing reliability in tool call execution.
2026-02-11 15:12:21 +08:00
Max
650a002a5a Implement support for Anthropic connectors in the LLM and sandbox components
- Add handling for Anthropic connector types in the sandbox, allowing direct connections without a proxy.
- Enhance capability retrieval to support both OpenAI and Anthropic formats, ensuring a unified interface.
- Update the executor and command logic to differentiate between OpenAI and Anthropic configurations, streamlining environment setup.
- Modify the provider selection logic to accommodate Anthropic capabilities, improving flexibility in LLM provider management.
- Refactor API detection to include Anthropic, ensuring accurate identification of connector types.
2026-02-11 12:05:07 +08:00
Max
bdcc3585e2 Enhance script resolution logic and update asset metadata
- Refactor the `ResolveScript` function to improve the script path resolution strategy, allowing for better handling of assistant directories and module paths.
- Update asset metadata timestamps in `bindata.go` to reflect recent changes, ensuring accurate tracking of file modifications.
- Modify CSS component name formatting in `build.go` and TypeScript component selectors in `index.ts` for consistency in syntax.
- Improve locale handling in `locale.go` by implementing a fallback mechanism for locale file resolution based on language prefixes.
- Normalize locale values in `request.go` to lowercase for consistency across the application.
- Enhance component name sanitization in `utils.go` to replace additional characters, ensuring valid component naming conventions.
2026-02-09 18:32:24 +08:00
Max
a372a56cf0 Update IPC socket path in tests to match configuration change
- Modify the test for the Claude executor to check for the IPC socket at the new path "/run/yao.sock" instead of the previous "/tmp/yao.sock". This aligns the test with the updated default configuration for the IPC socket path, ensuring consistency across the codebase.
2026-02-09 00:07:48 +08:00
Max
91ee8c947d Update API URL in proxy configuration test and clean up attachment handling logic
- Modify the expected API URL in the `TestBuildProxyConfig` to include the `/v1` prefix for consistency with the updated URL building logic.
- Remove unnecessary `modified` flags in the `prepareAttachments` method to streamline attachment processing and ensure clarity in the codebase.

This change enhances the accuracy of tests and improves the maintainability of the attachment handling logic.
2026-02-08 14:35:12 +08:00
Max
2a839ff94e Add Claude CLI argument mapping for sandbox arguments
- Introduce a whitelist mapping for `package.yao` sandbox arguments to corresponding Claude CLI flags, allowing selective argument passing.
- Update `BuildCommandWithContinuation` to iterate over the whitelist and append valid arguments to the Claude CLI command.

This change enhances the flexibility of argument handling in the Claude CLI, ensuring only specified arguments are processed.
2026-02-08 12:57:10 +08:00
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
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
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
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
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
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
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
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