Skip to content

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.

refactor(ego-browser): rename liveErrorText to nativeErrorText

0x0e568aab5278d
diff --git a/package/ego-browser/src/browser-runtime.test.mjs b/package/ego-browser/src/browser-runtime.test.mjs
index 1981590..c9e97ab 100644
--- a/package/ego-browser/src/browser-runtime.test.mjs
+++ b/package/ego-browser/src/browser-runtime.test.mjs
@@ -5,8 +5,8 @@ import { browserCdp } from "../dist/src/browser-runtime.js";
// Gap A: ensureSession() calls the raw listTabs binding to attach a session.
// When the task is blocked it returns { error, error_code }; the result must
-// surface the ego-browser-owned wording for the code (not the live text) and
-// carry error_code, instead of throwing bare live text.
+// surface the ego-browser-owned wording for the code (not the native error
+// message) and carry error_code, instead of throwing the bare native error message.
test("browserCdp surfaces the owned message and error_code when ensureSession is blocked", async () => {
globalThis.ego = {
async listTabs() {
diff --git a/package/ego-browser/src/ego-errors.test.mjs b/package/ego-browser/src/ego-errors.test.mjs
index 1a6bf1e..243264c 100644
--- a/package/ego-browser/src/ego-errors.test.mjs
+++ b/package/ego-browser/src/ego-errors.test.mjs
@@ -41,7 +41,7 @@ test("isEgoErrorCode narrows to known codes only", () => {
assert.equal(isEgoErrorCode(undefined), false);
});
-test("resolveEgoError overrides live text with the owned wording for an owned code", () => {
+test("resolveEgoError overrides the native error message with the owned wording for an owned code", () => {
const resolved = resolveEgoError({
error: "Task space 7 is not assigned to an agent.",
error_code: "EGO_TASK_SPACE_INACTIVE",
@@ -53,7 +53,7 @@ test("resolveEgoError overrides live text with the owned wording for an owned co
});
});
-test("resolveEgoError keeps live text for an unknown future code", () => {
+test("resolveEgoError keeps the native error message for an unknown future code", () => {
assert.deepEqual(
resolveEgoError({
error: "Some build-specific detail",
@@ -66,7 +66,7 @@ test("resolveEgoError keeps live text for an unknown future code", () => {
);
});
-test("resolveEgoError defers to live text for a code ego-browser does not own", () => {
+test("resolveEgoError defers to the native error message for a code ego-browser does not own", () => {
// EGO_OPERATION_FAILED is not owned: the client wording (e.g. which operation
// failed) is more specific than any static line.
assert.deepEqual(
@@ -82,7 +82,7 @@ test("resolveEgoError defers to live text for a code ego-browser does not own",
});
test("resolveEgoError falls back to the raw code for a bare non-owned code", () => {
- // ego-browser does not own NOT_SELECTED and a bare code carries no live text,
+ // ego-browser does not own NOT_SELECTED and a bare code carries no native error message,
// so the stable code itself is the most specific thing to surface.
assert.deepEqual(resolveEgoError("EGO_TASK_SPACE_NOT_SELECTED"), {
code: "EGO_TASK_SPACE_NOT_SELECTED",
diff --git a/package/ego-browser/src/ego-errors.ts b/package/ego-browser/src/ego-errors.ts
index 4ce675c..efa8e4d 100644
--- a/package/ego-browser/src/ego-errors.ts
+++ b/package/ego-browser/src/ego-errors.ts
@@ -9,7 +9,7 @@
* The code is the durable contract; the wording can drift between builds. Branch
* on the code (isEgoUserControlError), not on the message. EGO_ERROR_MESSAGES is
* where ego-browser owns its wording for the few codes an agent must act on; every
- * other code (and any unknown future code) defers to the browser's live text.
+ * other code (and any unknown future code) defers to the native error message.
*
* Single source of truth — error handling was previously duplicated across
* helpers.ts and driver/nav.ts.
@@ -38,9 +38,9 @@ export type EgoErrorCode = (typeof EGO_ERROR_CODES)[number];
/**
* Codes whose wording ego-browser owns. A listed code returns this static, id-less
- * message instead of the browser's live text — reserved for the two business signals
- * an agent must react to, not just report. Every other code is absent here and
- * defers to the live message (and any unknown future code does too), which is more
+ * message instead of the native error message — reserved for the two business signals
+ * an agent must react to, not just report. Every other code is absent here and defers
+ * to the native error message (and any unknown future code does too), which is more
* specific than any static line.
*/
const EGO_ERROR_MESSAGES: Partial<Record<EgoErrorCode, string>> = {
@@ -86,7 +86,7 @@ export function egoErrorCode(err: unknown): string | undefined {
*
* For a code ego-browser owns wording for, `message` is that owned wording.
* Otherwise (a code not owned here, or an unknown future code) it falls back to
- * the live human-readable text the browser supplied, then the bare code, then a
+ * the native error message the binding returned, then the bare code, then a
* generic string. `code` is the stable classifier and may be undefined.
*/
export function resolveEgoError(err: unknown): {
@@ -96,7 +96,7 @@ export function resolveEgoError(err: unknown): {
const code = egoErrorCode(err);
const message =
(isEgoErrorCode(code) ? EGO_ERROR_MESSAGES[code] : undefined) ??
- liveErrorText(err) ??
+ nativeErrorText(err) ??
code ??
"Unknown ego error";
return { code, message };
@@ -138,8 +138,11 @@ export function assertNoEgoError(result, op?: string) {
return result;
}
-/** Human-readable text from any ego error shape, ignoring bare codes. */
-function liveErrorText(err: unknown): string | undefined {
+/**
+ * The native error message from any ego error shape — the binding's runtime
+ * `error`/`message` text (dynamic, may vary across builds). Ignores bare codes.
+ */
+function nativeErrorText(err: unknown): string | undefined {
if (typeof err === "string") {
return isEgoErrorCode(err) ? undefined : err;
}