normal-computing / fuji-web

Fuji is an AI agent that lives in your browser's sidepanel. You can now get tasks done online with a single command!
Apache License 2.0
277 stars 30 forks source link

Expose API for easy integration with browser automation frameworks #144

Open mondaychen opened 7 months ago

mondaychen commented 7 months ago

blocking #140

We plan to enhance WebWand’s programmability by exposing a JS API. This would facilitate integration with browser automation frameworks like Puppeteer, Playwright, and Selenium.

Providing such an API enables:

TODO

mondaychen commented 7 months ago

list of APIs:

lynchee-owo commented 7 months ago

For the initial design of exposing API, we will expose APIs that are necessary to run benchmarking test. Once we raise more attention from the public, we will expand this API to be more general and more specific.

lynchee-owo commented 7 months ago

This task is more difficult than expected, so change the ticket size to Large. Here're the action items:

More specifically (will keep updating this list):

lynchee-owo commented 6 months ago

This task is in parallel with #140

lynchee-owo commented 6 months ago

The following content is to log what I've tried, which was not suitable in the context of webwand.

  1. design a http-based server. When we think about APIs, often the first thing that comes to mind is a web API, which you would interact with via HTTP requests (like POST /settings/set-api-key). These are typically used for server-client communication over a network. However, APIs can also be local, meaning they are libraries or frameworks used directly within the same software environment or system.
  2. design api as standalone "export" functions. This is not feasible because chrome extensions operate in an isolated environment. They have a separate scope from the regular web pages and other extensions/scripts running in the browser. Functions defined within a chrome extension (including those marked with export) are not directly accessible to external scripts (including Python or even other JavaScript running outside the extension).
  3. (as suggested by Mengdi) One way we can really "expose" webwand api to an external script is using message listener.