The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.
JavaScript agent-skillsai-agentautomationbrowserbrowser-automationclaude-codecodexhermes-agentskillsskills-sh
chore(ego-browser): unify project skill packaging
Aute7a2dcc1f0e8c
diff --git a/.agents/skills/ego-browser b/.agents/skills/ego-browsernew file mode 120000index 0000000..99c81f8--- /dev/null+++ b/.agents/skills/ego-browser@@ -0,0 +1 @@+../../skills/ego-browser\ No newline at end of filediff --git a/.gitignore b/.gitignoreindex fc731d8..3d4131c 100644--- a/.gitignore+++ b/.gitignore@@ -70,7 +70,8 @@ response_time_testagent-home/.pi/agent/skills/*/sites/*evals/reports/*-.agents/skills+.agents/skills/*+!.agents/skills/ego-browser.gitmodulesissues.mddiff --git a/package/ego-browser/package.json b/package/ego-browser/package.jsonindex 3befa9c..f359a34 100644--- a/package/ego-browser/package.json+++ b/package/ego-browser/package.json@@ -11,11 +11,12 @@"build": "node scripts/build.mjs","generate:api-docs": "npm run build && node scripts/generate-api-reference.mjs","check:api-docs": "node scripts/generate-api-reference.mjs --check",+ "check:skill-translation": "node scripts/check-skill-translation.mjs","e2e": "node scripts/run-real-browser-e2e.mjs","prepare": "if [ \"$CI\" = \"true\" ]; then exit 0; fi; cd ../.. && lefthook install","style:check": "prettier --check","typecheck": "tsc --noEmit",- "test": "npm run build && npm run check:api-docs && npm run typecheck && node --test \"src/**/*.test.mjs\" \"test/*.test.js\"",+ "test": "npm run build && npm run check:api-docs && npm run check:skill-translation && npm run typecheck && node --test \"src/**/*.test.mjs\" \"test/*.test.js\"","validate:learnings": "npm run build && EGO_BROWSER_AGENT_WORKSPACE=../../skills/ego-browser node dist/scripts/validate-site-skills.js","validate:site-skills": "npm run build && EGO_BROWSER_AGENT_WORKSPACE=../../skills/ego-browser node dist/scripts/validate-site-skills.js"},diff --git a/package/ego-browser/scripts/build.mjs b/package/ego-browser/scripts/build.mjsindex 6cc3056..889e4ac 100644--- a/package/ego-browser/scripts/build.mjs+++ b/package/ego-browser/scripts/build.mjs@@ -17,6 +17,7 @@ const bundledCli = join(bundledCliDir, "index.js");const skillSourceDir = join(repoRoot, "skills", "ego-browser");const bundledSkillDir = join(outDir, "ego-browser");const buildLock = join(root, ".build.lock");+const bundledSkillEntries = ["SKILL.md", "learnings", "references", "scripts"];let lock;try {@@ -39,7 +40,7 @@ try {platform: "node",format: "esm",target: "node22",- logLevel: "info"+ logLevel: "info",};await build({@@ -49,7 +50,7 @@ try {outbase: ".",bundle: false,sourcemap: false,- absWorkingDir: root+ absWorkingDir: root,});const rollupConfig = {@@ -62,16 +63,21 @@ try {compilerOptions: {noEmit: false,declaration: false,- removeComments: false- }- })- ]+ removeComments: false,+ },+ }),+ ],};const bundle = await rollup(rollupConfig);await bundle.write({ file: bundledCli, format: "esm", sourcemap: false });await bundle.close();- await cp(skillSourceDir, bundledSkillDir, { recursive: true });+ await mkdir(bundledSkillDir, { recursive: true });+ for (const entry of bundledSkillEntries) {+ await cp(join(skillSourceDir, entry), join(bundledSkillDir, entry), {+ recursive: true,+ });+ }await chmod(bundledCli, 0o755);} finally {await lock.close();@@ -81,7 +87,7 @@ try {async function tsEntryPoints(dirs) {const files = [];for (const dir of dirs) {- files.push(...await collectTsFiles(join(root, dir), dir));+ files.push(...(await collectTsFiles(join(root, dir), dir)));}return files.sort();}@@ -93,7 +99,7 @@ async function collectTsFiles(absDir, relativeDir) {const relativePath = `${relativeDir}/${entry.name}`;const absPath = join(absDir, entry.name);if (entry.isDirectory()) {- files.push(...await collectTsFiles(absPath, relativePath));+ files.push(...(await collectTsFiles(absPath, relativePath)));} else if (entry.isFile() && entry.name.endsWith(".ts")) {files.push(relativePath);}diff --git a/package/ego-browser/scripts/check-skill-translation.mjs b/package/ego-browser/scripts/check-skill-translation.mjsnew file mode 100644index 0000000..74f1bb7--- /dev/null+++ b/package/ego-browser/scripts/check-skill-translation.mjs@@ -0,0 +1,33 @@+import { createHash } from "node:crypto";+import { readFile } from "node:fs/promises";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";++const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));+const repoRoot = dirname(dirname(packageRoot));+const canonicalPath = join(repoRoot, "skills/ego-browser/SKILL.md");+const translationPath = join(+ repoRoot,+ "skills/ego-browser/workbench/SKILL.zh.v2.md",+);++let translation;+try {+ translation = await readFile(translationPath, "utf8");+} catch (error) {+ if (error?.code === "ENOENT") process.exit(0);+ throw error;+}++const canonical = await readFile(canonicalPath);+const actual = createHash("sha256").update(canonical).digest("hex");+const expected = translation.match(+ /<!-- source-skill-sha256: ([a-f0-9]{64}) -->/,+)?.[1];++if (expected !== actual) {+ throw new Error(+ `Local Chinese Skill is out of sync with ${canonicalPath}. ` ++ `Update the translation and set source-skill-sha256 to ${actual}.`,+ );+}diff --git a/package/ego-browser/src/skill-package.test.mjs b/package/ego-browser/src/skill-package.test.mjsnew file mode 100644index 0000000..c765abc--- /dev/null+++ b/package/ego-browser/src/skill-package.test.mjs@@ -0,0 +1,32 @@+import test from "node:test";+import assert from "node:assert/strict";+import { readdir, readFile, readlink } from "node:fs/promises";+import { join } from "node:path";+import { fileURLToPath } from "node:url";++const repoRoot = fileURLToPath(new URL("../../../", import.meta.url));+const bundledSkill = fileURLToPath(+ new URL("../dist/out/ego-browser/", import.meta.url),+);++test("the bundled Skill contains only publishable project resources", async () => {+ assert.deepEqual((await readdir(bundledSkill)).sort(), [+ "SKILL.md",+ "learnings",+ "references",+ "scripts",+ ]);+ assert.equal(+ await readFile(join(bundledSkill, "SKILL.md"), "utf8"),+ await readFile(join(repoRoot, "skills/ego-browser/SKILL.md"), "utf8"),+ );+});++test("project Agent and Codex entries share the canonical Skill", async () => {+ for (const directory of [".agents", ".codex"]) {+ assert.equal(+ await readlink(join(repoRoot, directory, "skills/ego-browser")),+ "../../skills/ego-browser",+ );+ }+});diff --git a/skills/ego-browser/SKILL.md b/skills/ego-browser/SKILL.mdindex c2882be..eaefc93 100644--- a/skills/ego-browser/SKILL.md+++ b/skills/ego-browser/SKILL.md@@ -5,13 +5,9 @@ description: ego-browser (ego lite) is a real Chromium browser designed from the# ego-browser-Ego Lite is a real Chromium browser where Agents work in isolated task spaces-while reusing the user's login state. Obtain a `TaskSpace` with `taskSpace()`,-then operate each tab through its `Page`.-For installation, connection, or runtime problems, read-`references/install.md`. Normal browser work should not require the API-reference; use `help()` or `references/api.md` only for uncommon options.+`references/install.md`. Use `help()` or `references/api.md` for uncommon+options.## Run browser scripts@@ -20,25 +16,24 @@ Run JavaScript through a heredoc:```bashego-browser nodejs <<'EOF'const task = await taskSpace("inspect example page");-const page = await task.openPage("https://example.com", { as: "main" });+const page = await task.openPage("https://example.com");console.log({ taskSpaceId: task.spaceId, page: page.label });console.log(await page.snapshot());EOF```-The heredoc runs in Node.js and all browser APIs are preloaded. Use `document`-and `window` only inside `page.evaluate()`; do not import Playwright, launch-another browser, or create a temporary script file first.+The heredoc runs in Node.js with all browser APIs preloaded. Use them directly,+and run page JavaScript inside `page.evaluate()`. Do not import Playwright or+launch another browser.-When the user explicitly asks for ego-browser, run the first real browser-command immediately. Diagnose the CLI or installation only if that command-fails. Console output is returned together when the script round finishes.+When the user explicitly asks for ego-browser, start with the first real browser+command and diagnose the CLI or installation if it fails. Console output is+returned together when the script round finishes.## Spaces, rounds, and pages-- Complete the user's goal within one task space. Use multiple spaces only when- the user explicitly requests different profiles.+- Complete the user's goal within one task space.- Every heredoc starts a new Node.js process. Task spaces, tabs, and Page labelssurvive across rounds; JavaScript variables do not.- In the first round, use a short goal name and print `task.spaceId`. In later@@ -47,31 +42,16 @@ fails. Console output is returned together when the script round finishes.- All time values are milliseconds.```js-// First round-const task = await taskSpace("collect release notes");-const page = await task.openPage("https://example.com", { as: "source" });-console.log({ taskSpaceId: task.spaceId, page: page.label });--// Later round+// Later round: use the space id and Page label printed earlier.const resumed = await taskSpace(7);-const source = resumed.page("source");+const source = resumed.page("p1");await source.goto("https://example.com/releases");```-When the user explicitly requests a browser profile, select its unique id while-creating a new, uniquely named space:--```js-const matches = (await profiles()).filter((item) => item.name === "Work");-if (matches.length !== 1)- throw new Error("Work profile is missing or ambiguous");-const task = await taskSpace("work account research", {- profileId: matches[0].id,-});-```--Profile display names may be duplicated. Pass the returned `id`; `profileId`-cannot change or resume an existing space.+Do not inspect or select profiles in normal tasks. Call `profiles()` and pass a+`profileId` only when the user explicitly requests a particular Ego Lite+profile. Profile selection applies only when creating a new space and cannot+change an existing one; use `help("profiles")` for this rare workflow.The common TaskSpace surface is:@@ -94,18 +74,19 @@ await task.close();await task.cdp(method, params, { timeout });```-Pages receive permanent labels such as `p1` automatically; `{ as }` chooses a-meaningful label. A space manages at most eight Pages by default. If the budget-is reached, close a temporary Page or navigate an existing one.+Pages receive permanent labels such as `p1`, `p2`, and `p3` automatically. Use+these labels by default; pass `{ as }` only when a custom label is specifically+needed. A space manages at most eight Pages by default. If the budget is+reached, close a temporary Page or navigate an existing one.`task.pages()` returns managed Pages. `task.tabs()` returns every tab in thespace as `{ label?, page, targetId, title, url, active, openedBy }`. A tab-without a label is unmanaged and cannot be operated until adopted:+without a label is unmanaged; adopt it before operating:```jsconst active = (await task.tabs()).find((item) => item.active);if (active && !active.label) {- const page = await task.adopt(active.page, { as: "user" });+ const page = await task.adopt(active.page);console.log({ page: page.label, url: await page.url() });}```@@ -170,16 +151,13 @@ await page.keyboard.type(text, { delay });await page.keyboard.insertText(text);```-Use `help("Page.click")` or `help("TaskSpace.openPage")` when an uncommon-option or exact default matters.-### Semantic pages: snapshot and selectorsFor an ordinary DOM page, start with `page.snapshot()`. It returns semantictext containing refs and stable locators:```js-const page = task.page("main");+const page = task.page("p1");console.log(await page.snapshot());// Suppose the snapshot shows [ref=21] on an email field and@@ -201,18 +179,15 @@ Element actions accept:Unquoted text locators normalize whitespace, ignore case, and match a substring;quote the value for an exact, case-sensitive match, such as-`text="Save changes"`. They select the smallest matching element and reject an-ambiguous match.--Snapshot labels such as `button` and `textbox` are accessibility roles, not-necessarily HTML tag names. Use the current ref for an immediate action and a-generated locator for reuse. CSS searches the document and nested open shadow-roots; XPath and closed shadow roots do not cross shadow boundaries.-For iframe content without a ref, write a `loc=role:` selector from the shown-role and name. If the top-level document has no match, role locators also search-ordinary iframes and OOPIFs.--A ref belongs only to the Page that produced it. Take another snapshot after+`text="Save changes"`. A text locator selects the smallest matching element and+must be unique.++Snapshot node names are accessibility roles. Use the current ref for an+immediate action and a generated locator for reuse. CSS searches nested open+shadow roots. If the top-level document has no role match, role locators also+search ordinary iframes and OOPIFs.++Refs are scoped to the Page that produced them. Take another snapshot afternavigation, a substantial DOM change, raw CDP, or before reusing a ref in alater round.@@ -280,8 +255,8 @@ await page.cdp("Page.handleJavaScriptDialog", { accept: true });// Use accept: false to dismiss it.```-After an action, verify the expected URL, selector, snapshot, screenshot, file,-or application state. Prefer state-based waits over `waitForTimeout()`.+Receipts record dispatched actions and popup or dialog observations. Verify the+application state required by the task with state-based waits.## Files and requests@@ -345,7 +320,7 @@ const task = await claimTaskSpace(7);After verifying the result, call `task.close()` by default. Use`task.finish()` only when the user asks to keep the pages, must continue fromthe result page, or the result cannot be delivered through a URL, file, or-summary. Do not report completion until the chosen method resolves.+summary.If the final output contains `[ego-browser:notice]`, finish the current browsertask, tell the user an Ego Lite update is available, and run