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
feat(ego-browser): print help() output without an explicit log
Zhuowei Wang0f88a24d832c
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 4ac3af6..c2c64c7 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -58,7 +58,7 @@ Pass the absolute bundle path to the installed CLI:```bashego-browser nodejs --sdk-path "$PWD/dist/out/index.js" <<'EOF'-console.log(help());+help();EOF```@@ -72,7 +72,7 @@ standalone CLI reads JavaScript directly from stdin:```bashnode dist/out/index.js <<'EOF'-console.log(await help());+help();EOF```@@ -103,7 +103,7 @@ the SDK after every edit:```bashnpm run buildego-browser nodejs <<'EOF'-console.log(help());+help();EOF```@@ -115,7 +115,7 @@ the selected link or explicitly load the debug entry:readlink "$HOME/Library/Application Support/Citro Labs/debug/index.js"ego-browser nodejs \--sdk-path "$HOME/Library/Application Support/Citro Labs/debug/index.js" <<'EOF'-console.log(help());+help();EOF```diff --git a/package/ego-browser/README.md b/package/ego-browser/README.mdindex 25143a5..303400f 100644--- a/package/ego-browser/README.md+++ b/package/ego-browser/README.md@@ -29,7 +29,7 @@ Local invocation without the browser (for debugging the helper bundle itself) re```bashnode dist/out/index.js <<'JS'-console.log(await help())+help()JS```diff --git a/package/ego-browser/skill-body/SKILL.md b/package/ego-browser/skill-body/SKILL.mdindex 18d6716..9713faa 100644--- a/package/ego-browser/skill-body/SKILL.md+++ b/package/ego-browser/skill-body/SKILL.md@@ -5,8 +5,9 @@ date: "2026-10-08"# ego-browser-Use `help()` for signatures and uncommon options of APIs named below. For-installation or connection problems, read `references/install.md` in the+Call `help()` or `help("page.click")` to print signatures and uncommon options+of APIs named below; it prints by itself, so do not wrap it in `console.log`.+For installation or connection problems, read `references/install.md` in theego-browser Skill directory.## Run browser scriptsdiff --git a/package/ego-browser/src/helpers.ts b/package/ego-browser/src/helpers.tsindex 401ee5d..0d3c3b7 100644--- a/package/ego-browser/src/helpers.ts+++ b/package/ego-browser/src/helpers.ts@@ -7,6 +7,7 @@ import { invokeEgo, probeAgentControl } from "./ego-errors.js";import { help as helpRuntime, formatHelp } from "./help-runtime.js";import { validatePublicApiOptions } from "./public-api-schema.js";import { createStaleEgoBrowserGuard } from "./skill-migration.js";+import { bufferOutput } from "./output-sink.js";import { cdp, decodeUnserializableJsValue, js } from "./cdp-eval.js";import * as pointer from "./driver/pointer.js";import * as keyboard from "./driver/keyboard.js";@@ -668,7 +669,12 @@ export async function learnContext(url = undefined) {});}-export function helperContext(extra: any = {}) {+export function helperContext(+ extra: any = {},+ {+ printHelp = (text: string) => bufferOutput(`${text}\n`),+ }: { printHelp?: (text: string) => void } = {},+) {const { newTab: _newTab, ...publicNav } = nav;const all = {...pointer,@@ -704,11 +710,18 @@ export function helperContext(extra: any = {}) {// The formal 1.3 Skill starts through egoBrowser.*. Keep a narrow guard so// stale conversations get a recovery instruction instead of a ReferenceError.egoBrowser: createStaleEgoBrowserGuard(),+ // help() prints its text so `ego-browser nodejs -e 'help()'` shows it, and+ // still returns the text for scripts that already log or inspect it.help: (...names: string[]) => {const result = helpRuntime(all, ...names);- if (typeof result === "string") return result;- if (Array.isArray(result)) return result.map(formatHelp).join("\n\n");- return formatHelp(result);+ const text =+ typeof result === "string"+ ? result+ : Array.isArray(result)+ ? result.map(formatHelp).join("\n\n")+ : formatHelp(result);+ printHelp(text);+ return text;},};}diff --git a/package/ego-browser/src/index.ts b/package/ego-browser/src/index.tsindex c46fa8e..4dfa8a1 100644--- a/package/ego-browser/src/index.ts+++ b/package/ego-browser/src/index.ts@@ -60,7 +60,11 @@ export function installEgoSdk(return target;}if (target === globalThis) installPageContextGuard(target);- const context = options.context || helpers.helperContext();+ const usingDefaultCliLog = !options.cliLog;+ const cliLogFn = options.cliLog || createCliLog();+ const context =+ options.context ||+ helpers.helperContext({}, { printHelp: (text) => cliLogFn(text) });const readySignal = Promise.resolve(options.ready);// The host may reject readiness before a helper is called. Mark the promise// as observed while preserving the same rejection for every helper await.@@ -88,8 +92,6 @@ export function installEgoSdk(// Install the 1.3 migration guard explicitly so embedded SDK execution and// the direct CLI produce the same actionable error.installStaleEgoBrowserGuard(target);- const usingDefaultCliLog = !options.cliLog;- const cliLogFn = options.cliLog || createCliLog();Object.defineProperty(target, "cliLog", {value: cliLogFn,writable: true,diff --git a/package/ego-browser/src/run-output-sink.test.mjs b/package/ego-browser/src/run-output-sink.test.mjsindex 945e969..fc0a5ca 100644--- a/package/ego-browser/src/run-output-sink.test.mjs+++ b/package/ego-browser/src/run-output-sink.test.mjs@@ -88,6 +88,31 @@ test("a clean run flushes buffered cliLog output in order", async () => {assert.equal(result.stdout, "one\ntwo\n");});+test("help() prints its text without an explicit log", async () => {+ const result = await runScript(`help("TaskSpace.newPage");`);++ assert.equal(result.exitCode, 0);+ assert.equal(+ result.stdout,+ "TaskSpace.newPage\n\nCreate and durably label a blank Page.\n\nawait task.newPage()\n",+ );+});++test("the embedded SDK prints help() through the host cliLog and returns the text", async () => {+ const { installEgoSdk } = await import("../dist/src/index.js");+ const lines = [];+ const target = {};+ installEgoSdk(target, { cliLog: (line) => lines.push(line) });++ const text = target.help("TaskSpace.newPage");++ assert.equal(+ text,+ "TaskSpace.newPage\n\nCreate and durably label a blank Page.\n\nawait task.newPage()",+ );+ assert.deepEqual(lines, [text]);+});+test("round console methods share the buffered output channel", async () => {const result = await runScript(`console.log("plain", { value: 1 });diff --git a/package/ego-browser/src/taskspace-e2e.test.mjs b/package/ego-browser/src/taskspace-e2e.test.mjsindex 2688cc6..872dd40 100644--- a/package/ego-browser/src/taskspace-e2e.test.mjs+++ b/package/ego-browser/src/taskspace-e2e.test.mjs@@ -281,7 +281,16 @@ test("cli e2e exposes the unified helperContext surface (help present, internals);assert.equal(result.exitCode, 0);- assert.deepEqual(firstJsonLine(result.stdout), {+ const lines = result.stdout.trim().split(/\r?\n/);+ assert.deepEqual(lines.slice(0, -1), [+ "TaskSpace.newPage",+ "",+ "Create and durably label a blank Page.",+ "",+ "await task.newPage()",+ 'Legacy helper hidden from default help: click. Use help("legacy", "click").',+ ]);+ assert.deepEqual(JSON.parse(lines.at(-1)), {helpType: "function",publicHelp:"TaskSpace.newPage\n\nCreate and durably label a blank Page.\n\nawait task.newPage()",