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
fix(ego-browser): list and claim user spaces that were never renamed
Zhuowei Wange93d27b7dcc2
diff --git a/package/ego-browser/src/helpers.test.mjs b/package/ego-browser/src/helpers.test.mjsindex fea81d4..40e36fb 100644--- a/package/ego-browser/src/helpers.test.mjs+++ b/package/ego-browser/src/helpers.test.mjs@@ -103,6 +103,29 @@ test("listTaskSpaces preserves claimable user-created space metadata", async ());});+test("listTaskSpaces keeps unnamed user spaces, including id 0", async () => {+ const unnamed = (id) => ({+ createdBy: "user",+ id,+ name: "",+ ownership: "user",+ profileId: "Profile 4",+ recentTabTitles: ["New Tab"],+ taskId: "",+ });+ const named = { ...unnamed(10), name: "Space-2", taskId: "Space-2" };+ await withEgo(+ {+ async listTaskSpaces() {+ return { taskSpaces: [unnamed(0), unnamed(8), named] };+ },+ },+ async () => {+ assert.deepEqual(await listTaskSpaces(), [unnamed(0), unnamed(8), named]);+ },+ );+});+test("listTaskSpaces rejects legacy taskIds results", async () => {await withEgo({@@ -889,6 +912,33 @@ test("claimTaskSpace returns a TaskSpace after claiming and selecting", async ()]);});+test("claimTaskSpace claims an unnamed user space without renaming it", async () => {+ const calls = [];+ await withEgo(+ {+ async listTaskSpaces() {+ return {+ taskSpaces: [{ taskId: "", id: 0, name: "", ownership: "user" }],+ };+ },+ async claimTaskSpace(...args) {+ calls.push(["claimTaskSpace", ...args]);+ return { taskId: "", id: args[0], name: "" };+ },+ useTaskSpace() {},+ async listTabs() {+ return { tabs: [] };+ },+ },+ async () => {+ const task = await claimTaskSpace(0);+ assert.equal(task.spaceId, 0);+ assert.equal(task.name, "");+ },+ );+ assert.deepEqual(calls, [["claimTaskSpace", 0]]);+});+test("takeOverTaskSpace returns a TaskSpace when a space is specified", async () => {const calls = [];await withEgo(diff --git a/package/ego-browser/src/helpers.ts b/package/ego-browser/src/helpers.tsindex 6609275..a70296e 100644--- a/package/ego-browser/src/helpers.ts+++ b/package/ego-browser/src/helpers.ts@@ -375,7 +375,11 @@ async function claimResolvedTaskSpace(space, op = "claimTaskSpace") {}const id = taskSpaceNumericId(space, op);const claimed = normalizeTaskSpace(- await invokeEgo(op, () => ego.claimTaskSpace(id, space.name)),+ // An empty name would rename the Space while claiming it; omit it so an+ // unnamed user Space keeps its UI placeholder.+ await invokeEgo(op, () =>+ space.name ? ego.claimTaskSpace(id, space.name) : ego.claimTaskSpace(id),+ ),);if (!claimed) {throw new Error(`${op} returned an invalid task space`);@@ -569,16 +573,17 @@ function normalizeTaskSpaces(raw) {throw new Error("listTaskSpaces expected { taskSpaces: [...] }");}+// `id` is the native locator. `name` and `taskId` are display values and are+// empty for a user Space that was never renamed, so they must not gate entries.function normalizeTaskSpace(space) {- const taskId = space?.taskId ?? space?.name ?? space?.id;- if (taskId === undefined || taskId === null || taskId === "") {+ if (space?.id === undefined || space?.id === null) {return null;}+ const name = space.name ?? space.taskId ?? "";return {...space,- taskId,- id: space?.id ?? taskId,- name: space?.name ?? taskId,+ taskId: space.taskId ?? name,+ name,};}