-
Notifications
You must be signed in to change notification settings - Fork 750
feat(cli): add full agent options support to YAML scripts #1526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for midscene ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extends YAML agent configuration to support all serializable fields from AgentOpt, adding 7 new configuration options (testId, groupName, groupDescription, generateReport, autoPrintReportMsg, reportFileName, replanningCycleLimit) to achieve feature parity with programmatic API usage.
Key changes:
- Extended
MidsceneYamlScriptAgentOpttype to include 7 new agent configuration fields with comprehensive JSDoc documentation - Updated all 5 agent creation paths (Puppeteer, Bridge, Android, iOS, Generic Interface) to propagate extended options
- Implemented
buildAgentOptions()andresolveTestId()helper functions with proper priority handling (CLI > YAML > filename)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/core/src/yaml.ts |
Extended MidsceneYamlScriptAgentOpt type with 7 new fields and added JSDoc documentation |
packages/web-integration/src/puppeteer/agent-launcher.ts |
Updated puppeteerAgentForTarget signature to accept extended agent options via intersection type |
packages/cli/src/create-yaml-player.ts |
Added helper functions buildAgentOptions() and resolveTestId(), updated all 5 agent creation paths to use these helpers |
packages/cli/tests/unit-test/create-yaml-player.test.ts |
Added 7 new tests covering extended options propagation, testId priority, and helper function getMockCallArg() |
packages/cli/tests/midscene_scripts/agent-opts/extended-options.yml |
Integration test file demonstrating all new agent configuration fields |
apps/site/docs/en/automate-with-scripts-in-yaml.mdx |
Updated English documentation with complete agent field descriptions and examples |
apps/site/docs/zh/automate-with-scripts-in-yaml.mdx |
Updated Chinese documentation with complete agent field descriptions and examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ### `agent` 部分 | ||
|
|
||
| 如需使用 `aiActionContext` 参数,可以通过 `agent` 部分来设置: | ||
| `agent` 部分用于配置 AI 代理的行为和测试报告相关选项。所有字段都是可选的。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"代理" --> Agent
Extended YAML agent configuration to support 7 additional AgentOpt fields: - testId, groupName, groupDescription - generateReport, autoPrintReportMsg, reportFileName - replanningCycleLimit Key changes: - Updated MidsceneYamlScriptAgentOpt type with comprehensive JSDoc - Modified all 5 agent creation paths (Web/Puppeteer, Bridge, Android, iOS, Interface) - Updated puppeteerAgentForTarget signature to accept new options - Added helper functions (buildAgentOptions, resolveTestId, getMockCallArg) - Unified autoPrintReportMsg handling across platforms - Updated English and Chinese documentation with complete agent config examples All 77 tests passing. Maintains backward compatibility - all fields optional. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add 'aiActionContext' to the Pick type in puppeteerAgentForTarget function signature to reflect the actual API usage. The buildAgentOptions() in create-yaml-player.ts spreads the entire yamlAgent object (including aiActionContext) which gets passed through the preference parameter. This makes the API contract explicit and prevents type confusion. Resolves Copilot PR review comment.
7bb3bfa to
690f55b
Compare
Replace '代理' with 'Agent' in Chinese documentation to maintain consistency with technical terminology. Resolves yuyutaotao's review comment.
Summary
Extended YAML agent configuration to support all serializable fields from
AgentOpt, adding 7 new configuration options:testId,groupName,groupDescriptiongenerateReport,autoPrintReportMsg,reportFileNamereplanningCycleLimitPreviously, YAML scripts only supported
aiActionContextandcachein the agent section. This PR brings YAML configuration to feature parity with programmatic API usage.Key Changes
Type System
MidsceneYamlScriptAgentOpttype using TypeScript'sPickutilityImplementation
puppeteerAgentForTarget)AgentOverChromeBridge)agentFromAdbDevice)agentFromWebDriverAgent)createAgent)puppeteerAgentForTargetfunction signature to accept new agent optionsbuildAgentOptions(): Merges YAML agent config with cache and testIdresolveTestId(): Implements priority resolution (CLI > YAML > filename)getMockCallArg<T>(): Test helper for cleaner mock assertionsConfiguration Priority
Code Quality Improvements
autoPrintReportMsghandling across platformsDocumentation Updates
Updated both English and Chinese documentation:
Testing
extended-options.yml)Backward Compatibility
✅ Fully backward compatible - all new fields are optional. Existing YAML scripts continue to work without modification.
🤖 Generated with Claude Code