Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Official ego-browser site plugins

Site plugins are maintained scripts that read a site with a fixed UI, such as x.com or Wikipedia, and return structured data. Agents call them with page.runPlugin("x/timeline", { user: "nasa" }) instead of writing extraction code against a snapshot every time.

This repository is the source of the official plugins and also serves them: every ego-browser client reads dist/index.json from main (at most once a day, in the background) and installs or updates the bundles it lists, so a plugin release does not need an SDK release. The SDK ships no copy of the plugins; a client uses a plugin only after it has been downloaded.

Plugin Commands
x timeline, search, post, profile
wikipedia article, search, summary

Layout

plugins/<id>/ego-plugin.json   manifest: id, version, domains, commands
plugins/<id>/*.mjs             command entries and shared modules
plugins/<id>/test/             tests (node --test); not part of the bundle
revoked.json                   withdrawn versions (the kill switch)
scripts/build-index.mjs        builds dist/index.json and dist/bundles/
dist/                          what clients download; built, then committed

npm run build rebuilds dist/. Published bundles are kept, so an old version stays installable after a newer release; rebuilding a published version with different content fails, which forces a version bump. The integrity hash and the file selection must match the ego-browser runtime, which re-hashes installed plugins; the SDK checks every bundle with its own code when it takes a copy of dist/.

Writing a plugin

A command entry exports one async function. It receives validated arguments (with defaults applied) and the same helpers an Agent script has, plus the caller's Page:

export default async function timeline(args, { page, task, fail }) {
  await page.goto(`https://x.com/${args.user}`);
  // ...
  if (signedOut) fail("NOT_LOGGED_IN", "x.com asks to sign in");
  return { posts };
}
  • Use only the v2 TaskSpace/Page API. Functions passed to page.evaluate() run in the page and must be self-contained.
  • Declare args and returns as JSON Schema in the manifest. The runtime rejects bad arguments before the plugin runs, and treats a result that no longer matches returns as SITE_CHANGED. Make required fields strict enough that a redesigned page fails validation instead of returning empty strings.
  • Report known situations with fail(code, message): NOT_LOGGED_IN, RATE_LIMITED, NOT_FOUND, SITE_CHANGED, INVALID_ARGS. Any other exception becomes PLUGIN_BROKEN.
  • Bump the patch version for a fix, the minor version for additions, and the major version when args or returns change incompatibly. Installed plugins update automatically only within the same major version.
  • Mark every command readOnly: true unless it changes data on the site.

To try a plugin without publishing it, put its directory under ~/.ego-browser/plugins/local/. Local plugins take precedence over installed ones and reload when their files change.

Review and release

  1. Change the plugin, bump its version, run npm test and npm run build, and commit the sources together with dist/.
  2. Open a pull request. CI runs the tests and fails if dist/ does not match the sources.
  3. Merging into main is the release: clients pick the new version up on their next daily index sync, and installed plugins update within the same major version. Protect main so a merge needs an approving review.

To withdraw a version, add { "id", "versions": [...], "reason" } to revoked.json, rebuild and merge; clients refuse to run it on their next index sync, and installed official plugins move to the newest non-revoked version.

A plugin that needs a newer SDK API must wait for that SDK release; declare the plugin API version it needs in engines.egoPluginApi.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages