Skip to content

Conversation

quanru
Copy link
Collaborator

@quanru quanru commented Oct 17, 2025

Summary

This PR refactors the Midscene API by renaming key methods for improved clarity and consistency:

  • aiAction()aiAct() - More concise and clear naming
  • logScreenshot()recordToReport() - Better reflects the method's purpose

Breaking Changes

⚠️ Breaking Change: The following methods have been renamed:

  • aiAction() is now aiAct()
  • logScreenshot() is now recordToReport()

Backward Compatibility: The old aiAction() method is kept as a deprecated wrapper to maintain backward compatibility. Users should migrate to aiAct() when convenient.

Changes

Core Changes

  • ✨ Renamed aiAction() to aiAct() in packages/core/src/agent/agent.ts
  • ✨ Renamed logScreenshot() to recordToReport() in agent implementation
  • 🔄 Added deprecation wrapper for aiAction() with JSDoc warning
  • 🧪 Updated all test files to use new method names

Web Integration

  • 🔧 Updated Playwright fixture to support new method names
  • 🔧 Added aiAct and recordToReport fixture types
  • 🧪 Updated integration tests

Documentation

  • 📝 Updated all English documentation (15 files)
  • 📝 Updated all Chinese documentation (16 files)
  • 📝 Updated README.md and README.zh.md with new examples
  • 📝 Updated code examples in blog posts and guides

Migration Guide

Before:

await aiAction('click the submit button');
await logScreenshot('After submission');

After:

await aiAct('click the submit button');
await recordToReport('After submission');

Impact

  • Users: Need to update method names in their code (or continue using deprecated aiAction())
  • Documentation: All examples now use the new naming convention
  • Tests: All passing with new method names

Test Plan

  • ✅ All existing unit tests pass
  • ✅ All integration tests updated and passing
  • ✅ Documentation examples verified

🤖 Generated with Claude Code

This change ensures that Planning functionality only supports vision
language models (VL mode) and removes DOM-based planning support.

Changes:
- Add validation in ModelConfigManager.getModelConfig() to require
  VL mode for Planning intent
- Remove DOM mode logic from llm-planning.ts (describeUserPage,
  markupImageForLLM)
- Simplify image processing to only support VL mode paths
- Add comprehensive JSDoc documentation for Planning VL mode
  requirement
- Add 6 new unit tests covering Planning VL mode validation in both
  isolated and normal modes
- Fix existing tests to provide VL mode for Planning intent

Breaking Change:
- Planning without VL mode configured will now throw an error with
  clear instructions
- Error message includes all supported VL modes and configuration
  examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
@quanru quanru force-pushed the feat/refactor-api-method-names branch from 80a2c97 to 8162b50 Compare October 17, 2025 11:09
@quanru quanru closed this Oct 20, 2025
@quanru quanru deleted the feat/refactor-api-method-names branch October 20, 2025 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant