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
Adapt taskspace helpers to new bindings
Tachikoma6c443f854077
diff --git a/package/ego-browser/package.json b/package/ego-browser/package.jsonindex 172b0b9..ecf3861 100644--- a/package/ego-browser/package.json+++ b/package/ego-browser/package.json@@ -9,6 +9,7 @@"scripts": {"clean": "rm -rf dist artifacts","build": "node scripts/build.mjs",+ "e2e": "bash scripts/run-e2e.sh","typecheck": "tsc --noEmit","test": "npm run build && npm run typecheck && node --test","validate:learnings": "npm run build && EGO_BROWSER_AGENT_WORKSPACE=../../skills/ego-browser node dist/scripts/validate-site-skills.js",diff --git a/package/ego-browser/scripts/run-e2e.sh b/package/ego-browser/scripts/run-e2e.shindex 32ab0c1..9a96dc9 100755--- a/package/ego-browser/scripts/run-e2e.sh+++ b/package/ego-browser/scripts/run-e2e.sh@@ -6,5 +6,5 @@ cd "$(dirname "$0")/.."echo "== build =="npm run build-echo "== E2E (handoff / waitForAgentControl) =="-EGO_BROWSER_E2E=1 node --test test/browser-e2e.test.js+echo "== E2E (taskspace helpers) =="+EGO_BROWSER_E2E=1 node --test src/taskspace-e2e.test.mjsdiff --git a/package/ego-browser/src/helpers.test.mjs b/package/ego-browser/src/helpers.test.mjsnew file mode 100644index 0000000..f2f873c--- /dev/null+++ b/package/ego-browser/src/helpers.test.mjs@@ -0,0 +1,289 @@+import test from "node:test";+import assert from "node:assert/strict";++import {+ newTaskSpace,+ helperContext,+ listTaskSpaces,+ useOrCreateTaskSpace,+ switchTaskSpace+} from "../dist/src/helpers.js";++function withEgo(ego, fn) {+ const previous = globalThis.ego;+ globalThis.ego = ego;+ return Promise.resolve()+ .then(fn)+ .finally(() => {+ if (previous === undefined) {+ delete globalThis.ego;+ } else {+ globalThis.ego = previous;+ }+ });+}++test("listTaskSpaces normalizes the current taskSpaces binding shape", async () => {+ await withEgo({+ async listTaskSpaces() {+ return {+ taskSpaces: [+ {+ taskId: "checkout-flow",+ id: 7,+ name: "Checkout flow",+ createdBy: "agent",+ ownership: "agent",+ recentTabTitles: ["Checkout", "Cart"]+ }+ ]+ };+ }+ }, async () => {+ assert.deepEqual(await listTaskSpaces(), [+ {+ taskId: "checkout-flow",+ id: 7,+ name: "Checkout flow",+ createdBy: "agent",+ ownership: "agent",+ recentTabTitles: ["Checkout", "Cart"]+ }+ ]);+ });+});++test("listTaskSpaces rejects legacy taskIds results", async () => {+ await withEgo({+ async listTaskSpaces() {+ return { taskIds: ["checkout-flow", "research-session"] };+ }+ }, async () => {+ await assert.rejects(+ () => listTaskSpaces(),+ /listTaskSpaces expected \{ taskSpaces: \[\.\.\.\] \}/+ );+ });+});++test("listTaskSpaces throws on binding error objects", async () => {+ await withEgo({+ async listTaskSpaces() {+ return { error: "The task is under user control" };+ }+ }, async () => {+ await assert.rejects(+ () => listTaskSpaces(),+ /listTaskSpaces: The task is under user control/+ );+ });+});++test("taskspace helper surface exposes public helpers without claimTaskSpace", () => {+ const context = helperContext();+ assert.equal(typeof context.listTaskSpaces, "function");+ assert.equal(typeof context.switchTaskSpace, "function");+ assert.equal(typeof context.newTaskSpace, "function");+ assert.equal(typeof context.useOrCreateTaskSpace, "function");+ assert.equal(context.claimTaskSpace, undefined);+});++test("switchTaskSpace selects a matching task space", async () => {+ const calls = [];+ await withEgo({+ async listTaskSpaces() {+ return {+ taskSpaces: [+ { taskId: "checkout-flow", id: 7, name: "Checkout flow", ownership: "agent" }+ ]+ };+ },+ useTaskSpace(taskId) {+ calls.push(["useTaskSpace", taskId]);+ return taskId;+ }+ }, async () => {+ assert.deepEqual(await switchTaskSpace(7), {+ taskId: "checkout-flow",+ id: 7,+ name: "Checkout flow",+ ownership: "agent"+ });+ });+ assert.deepEqual(calls, [["useTaskSpace", "checkout-flow"]]);+});++test("switchTaskSpace rejects non-agent-owned task spaces", async () => {+ await withEgo({+ async listTaskSpaces() {+ return {+ taskSpaces: [+ { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", ownership: "user" }+ ]+ };+ },+ useTaskSpace() {}+ }, async () => {+ await assert.rejects(+ () => switchTaskSpace("checkout-flow"),+ /switchTaskSpace requires an agent-owned task space/+ );+ });+});++test("newTaskSpace creates and selects an agent task space", async () => {+ const calls = [];+ await withEgo({+ async createTaskSpace(name) {+ calls.push(["createTaskSpace", name]);+ return { taskId: name, id: name, name, ownership: "agent" };+ },+ useTaskSpace(taskId) {+ calls.push(["useTaskSpace", taskId]);+ return taskId;+ }+ }, async () => {+ assert.deepEqual(await newTaskSpace("checkout-flow"), {+ taskId: "checkout-flow",+ id: "checkout-flow",+ name: "checkout-flow",+ ownership: "agent"+ });+ });+ assert.deepEqual(calls, [+ ["createTaskSpace", "checkout-flow"],+ ["useTaskSpace", "checkout-flow"]+ ]);+});++test("newTaskSpace throws on binding error objects", async () => {+ await withEgo({+ async createTaskSpace() {+ return { error: "Task space already exists: checkout-flow" };+ },+ useTaskSpace() {}+ }, async () => {+ await assert.rejects(+ () => newTaskSpace("checkout-flow"),+ /newTaskSpace: Task space already exists: checkout-flow/+ );+ });+});++test("useOrCreateTaskSpace reuses existing agent-owned spaces", async () => {+ const calls = [];+ await withEgo({+ async listTaskSpaces() {+ calls.push(["listTaskSpaces"]);+ return {+ taskSpaces: [+ { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", ownership: "agent" }+ ]+ };+ },+ useTaskSpace(taskId) {+ calls.push(["useTaskSpace", taskId]);+ return taskId;+ },+ async createTaskSpace(name) {+ calls.push(["createTaskSpace", name]);+ return { taskId: name, id: name, name, ownership: "agent" };+ },+ async claimTaskSpace(name) {+ calls.push(["claimTaskSpace", name]);+ return { taskId: name, id: name, name, ownership: "agent" };+ }+ }, async () => {+ assert.deepEqual(await useOrCreateTaskSpace("checkout-flow"), {+ taskId: "checkout-flow",+ id: "checkout-flow",+ name: "checkout-flow",+ ownership: "agent"+ });+ });+ assert.deepEqual(calls, [+ ["listTaskSpaces"],+ ["useTaskSpace", "checkout-flow"]+ ]);+});++test("useOrCreateTaskSpace claims existing user-owned spaces", async () => {+ const calls = [];+ await withEgo({+ async listTaskSpaces() {+ calls.push(["listTaskSpaces"]);+ return {+ taskSpaces: [+ { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", ownership: "user" }+ ]+ };+ },+ async claimTaskSpace(name) {+ calls.push(["claimTaskSpace", name]);+ return { taskId: name, id: name, name, ownership: "agent" };+ },+ useTaskSpace(taskId) {+ calls.push(["useTaskSpace", taskId]);+ return taskId;+ }+ }, async () => {+ assert.deepEqual(await useOrCreateTaskSpace("checkout-flow"), {+ taskId: "checkout-flow",+ id: "checkout-flow",+ name: "checkout-flow",+ ownership: "agent"+ });+ });+ assert.deepEqual(calls, [+ ["listTaskSpaces"],+ ["claimTaskSpace", "checkout-flow"],+ ["useTaskSpace", "checkout-flow"]+ ]);+});++test("useOrCreateTaskSpace creates missing spaces", async () => {+ const calls = [];+ await withEgo({+ async listTaskSpaces() {+ calls.push(["listTaskSpaces"]);+ return { taskSpaces: [] };+ },+ async createTaskSpace(name) {+ calls.push(["createTaskSpace", name]);+ return { taskId: name, id: name, name, ownership: "agent" };+ },+ useTaskSpace(taskId) {+ calls.push(["useTaskSpace", taskId]);+ return taskId;+ }+ }, async () => {+ assert.deepEqual(await useOrCreateTaskSpace("checkout-flow"), {+ taskId: "checkout-flow",+ id: "checkout-flow",+ name: "checkout-flow",+ ownership: "agent"+ });+ });+ assert.deepEqual(calls, [+ ["listTaskSpaces"],+ ["createTaskSpace", "checkout-flow"],+ ["useTaskSpace", "checkout-flow"]+ ]);+});++test("useOrCreateTaskSpace rejects unknown ownership", async () => {+ await withEgo({+ async listTaskSpaces() {+ return {+ taskSpaces: [+ { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", ownership: "shared" }+ ]+ };+ }+ }, async () => {+ await assert.rejects(+ () => useOrCreateTaskSpace("checkout-flow"),+ /ownership "shared"/+ );+ });+});diff --git a/package/ego-browser/src/helpers.ts b/package/ego-browser/src/helpers.tsindex dd80cfe..021a0e5 100644--- a/package/ego-browser/src/helpers.ts+++ b/package/ego-browser/src/helpers.ts@@ -43,42 +43,93 @@ export { browserFetch, serverFetch } from "./http.js";/*** List all task spaces.- * @returns {Promise<Array<{taskId:string,id:string,name:string}>>}+ * @returns {Promise<Array<{taskId:string,id:string|number,name:string,createdBy?:string,ownership?:string,recentTabTitles?:string[]}>>}*/export async function listTaskSpaces() {const ego = globalThis.ego;if (!ego || typeof ego.listTaskSpaces !== "function") {throw new Error("listTaskSpaces requires ego.listTaskSpaces");}- return normalizeTaskSpaces(await ego.listTaskSpaces());+ return normalizeTaskSpaces(assertNoEgoError(await ego.listTaskSpaces(), "listTaskSpaces"));}/**- * Use an existing task space by id/name, or create it when missing.+ * Select an existing task space by id/name for the current Node invocation.+ * @param {string|number} nameOrId Task space id or name.+ * @returns {Promise<{taskId:string,id:string|number,name:string,createdBy?:string,ownership?:string,recentTabTitles?:string[]}>}+ */+export async function switchTaskSpace(nameOrId) {+ const ego = globalThis.ego;+ if (!ego || typeof ego.useTaskSpace !== "function") {+ throw new Error("switchTaskSpace requires ego.useTaskSpace");+ }+ const space = await findTaskSpace(nameOrId);+ if (space.ownership !== "agent") {+ throw new Error(`switchTaskSpace requires an agent-owned task space, got ownership ${JSON.stringify(space.ownership)}`);+ }+ return selectTaskSpace(ego, space, "switchTaskSpace");+}++/**+ * Create an agent-owned task space and select it for the current Node invocation.* @param {string} name Task space id or name.- * @returns {Promise<{taskId:string,id:string,name:string}>}+ * @returns {Promise<{taskId:string,id:string|number,name:string,createdBy?:string,ownership?:string,recentTabTitles?:string[]}>}+ */+export async function newTaskSpace(name) {+ const ego = globalThis.ego;+ if (!ego || typeof ego.createTaskSpace !== "function") {+ throw new Error("newTaskSpace requires ego.createTaskSpace");+ }+ const created = normalizeTaskSpace(assertNoEgoError(await ego.createTaskSpace(name), "newTaskSpace"));+ if (!created) {+ throw new Error("newTaskSpace returned an invalid task space");+ }+ return selectTaskSpace(ego, created, "newTaskSpace");+}++/**+ * Use an existing agent-owned task space, claim an existing user-owned space, or create it when missing.+ * @param {string} name Task space name.+ * @returns {Promise<{taskId:string,id:string|number,name:string,createdBy?:string,ownership?:string,recentTabTitles?:string[]}>}*/export async function useOrCreateTaskSpace(name) {const spaces = await listTaskSpaces();- const existing = spaces.find((space) => space.taskId === name || space.id === name || space.name === name);- if (existing) {- globalThis.ego.useTaskSpace(existing.taskId);- return existing;+ const existing = spaces.find((space) => taskSpaceMatches(space, name));+ if (!existing) {+ return newTaskSpace(name);+ }+ if (existing.ownership === "agent") {+ return selectTaskSpace(globalThis.ego, existing, "useOrCreateTaskSpace");}- if (typeof globalThis.ego.createTaskSpace !== "function") {- throw new Error("useOrCreateTaskSpace requires ego.createTaskSpace");+ if (existing.ownership === "user") {+ return claimTaskSpace(name);}- const created = await globalThis.ego.createTaskSpace(name);- const taskId = created?.taskId || created?.id || name;- globalThis.ego.useTaskSpace(taskId);- return { taskId, id: taskId, name };+ throw new Error(`useOrCreateTaskSpace cannot use task space ${JSON.stringify(name)} with ownership ${JSON.stringify(existing.ownership)}`);+}++async function claimTaskSpace(name) {+ const ego = globalThis.ego;+ if (!ego || typeof ego.claimTaskSpace !== "function") {+ throw new Error("useOrCreateTaskSpace requires ego.claimTaskSpace");+ }+ const claimed = normalizeTaskSpace(assertNoEgoError(await ego.claimTaskSpace(name), "claimTaskSpace"));+ if (!claimed) {+ throw new Error("claimTaskSpace returned an invalid task space");+ }+ return selectTaskSpace(ego, claimed, "claimTaskSpace");+}++function selectTaskSpace(ego, space, op: string) {+ if (!ego || typeof ego.useTaskSpace !== "function") {+ throw new Error(`${op} requires ego.useTaskSpace`);+ }+ ego.useTaskSpace(space.taskId);+ return space;}async function switchTaskSpaceIfNamed(ego, name?: string) {if (name === undefined) return;- const spaces = await listTaskSpaces();- const match = spaces.find((s) => s.taskId === name || s.id === name || s.name === name);- if (!match) throw new Error(`task space not found: ${name}`);+ const match = await findTaskSpace(name);ego.useTaskSpace(match.taskId);}@@ -248,25 +299,13 @@ export async function gotoUrl(url) {}function normalizeTaskSpaces(raw) {- if (Array.isArray(raw)) {- return raw.map(normalizeTaskSpace).filter(Boolean);- }if (Array.isArray(raw?.taskSpaces)) {return raw.taskSpaces.map(normalizeTaskSpace).filter(Boolean);}- if (Array.isArray(raw?.spaces)) {- return raw.spaces.map(normalizeTaskSpace).filter(Boolean);- }- if (Array.isArray(raw?.taskIds)) {- return raw.taskIds.map((taskId) => ({ taskId, id: taskId, name: taskId }));- }- return [];+ throw new Error("listTaskSpaces expected { taskSpaces: [...] }");}function normalizeTaskSpace(space) {- if (typeof space === "string") {- return { taskId: space, id: space, name: space };- }const taskId = space?.taskId || space?.id || space?.name;if (!taskId) {return null;@@ -279,6 +318,18 @@ function normalizeTaskSpace(space) {};}+async function findTaskSpace(nameOrId) {+ const spaces = await listTaskSpaces();+ const match = spaces.find((space) => taskSpaceMatches(space, nameOrId));+ if (!match) throw new Error(`task space not found: ${nameOrId}`);+ return match;+}++function taskSpaceMatches(space, nameOrId) {+ const value = String(nameOrId);+ return String(space.taskId) === value || String(space.id) === value || String(space.name) === value;+}+export async function siteSkillsForUrl(url) {return siteSkillsForUrlCore(url, {agentWorkspace: state.agentWorkspace()@@ -354,6 +405,8 @@ export function helperContext(extra: any = {}) {runSiteBrowserTool,learnContext,listTaskSpaces,+ switchTaskSpace,+ newTaskSpace,useOrCreateTaskSpace,completeTaskSpace,handOffTaskSpace,diff --git a/package/ego-browser/src/index.ts b/package/ego-browser/src/index.tsindex 8d3c88c..ab1bd9a 100644--- a/package/ego-browser/src/index.ts+++ b/package/ego-browser/src/index.ts@@ -57,7 +57,7 @@ export function installEgoSdk(target: InstallTarget = globalThis, options: Instatarget.ego.helpers = installed;target.ego.learnings = {};wrapCreateTab(target.ego);- wrapInvalidating(target.ego, ["useTaskSpace", "closeTaskSpace", "createTaskSpace"]);+ wrapInvalidating(target.ego, ["useTaskSpace", "closeTaskSpace", "createTaskSpace", "claimTaskSpace"]);exposeEgoMethods(target, target.ego);}return target;@@ -125,7 +125,7 @@ function wrapCreateTab(ego: EgoRuntime) {}function exposeEgoMethods(target: InstallTarget, ego: EgoRuntime) {- const skip = new Set(["helpers", "learnings", "useTaskSpace", "createTaskSpace", "closeTaskSpace"]);+ const skip = new Set(["helpers", "learnings", "useTaskSpace", "createTaskSpace", "claimTaskSpace", "closeTaskSpace"]);for (const key of Object.keys(ego)) {if (skip.has(key)) continue;if (key in target) continue;diff --git a/package/ego-browser/src/taskspace-e2e.test.mjs b/package/ego-browser/src/taskspace-e2e.test.mjsnew file mode 100644index 0000000..d2556e6--- /dev/null+++ b/package/ego-browser/src/taskspace-e2e.test.mjs@@ -0,0 +1,208 @@+import test from "node:test";+import assert from "node:assert/strict";++import { runMain } from "../dist/src/run.js";++class FakeEgo {+ constructor(taskSpaces = []) {+ this.taskSpaces = taskSpaces.map((space) => ({ ...space }));+ this.calls = [];+ this.selectedTaskId = null;+ }++ async listTaskSpaces() {+ this.calls.push(["listTaskSpaces"]);+ return { taskSpaces: this.taskSpaces.map((space) => ({ ...space })) };+ }++ useTaskSpace(taskId) {+ this.calls.push(["useTaskSpace", taskId]);+ this.selectedTaskId = taskId;+ return taskId;+ }++ async createTaskSpace(name) {+ this.calls.push(["createTaskSpace", name]);+ if (this.taskSpaces.some((space) => space.taskId === name || space.id === name || space.name === name)) {+ return { error: `Task space already exists: ${name}` };+ }+ const created = { taskId: name, id: name, name, createdBy: "agent", ownership: "agent", recentTabTitles: [] };+ this.taskSpaces.push(created);+ return { ...created };+ }++ async claimTaskSpace(name) {+ this.calls.push(["claimTaskSpace", name]);+ const space = this.taskSpaces.find((candidate) => (+ candidate.taskId === name || candidate.id === name || candidate.name === name+ ));+ if (!space || space.ownership !== "user") {+ return { error: `Task space not found: ${name}` };+ }+ space.createdBy = "agent";+ space.ownership = "agent";+ return { ...space };+ }+}++async function runTaskspaceScript(ego, code) {+ const previous = globalThis.ego;+ globalThis.ego = ego;+ const stdout = captureStream();+ const stderr = captureStream();+ try {+ const exitCode = await runMain({+ argv: [],+ stdinText: code,+ stdout,+ stderr,+ services: { printUpdateBanner() {} }+ });+ return { exitCode, stdout: stdout.text(), stderr: stderr.text() };+ } finally {+ if (previous === undefined) {+ delete globalThis.ego;+ } else {+ globalThis.ego = previous;+ }+ }+}++function captureStream() {+ const chunks = [];+ return {+ write(chunk) {+ chunks.push(String(chunk));+ },+ text() {+ return chunks.join("");+ }+ };+}++function firstJsonLine(output) {+ return JSON.parse(output.trim().split(/\r?\n/)[0]);+}++test("taskspace e2e creates and selects a missing task space", async () => {+ const ego = new FakeEgo();+ const result = await runTaskspaceScript(ego, `+ const task = await useOrCreateTaskSpace("checkout-flow");+ cliLog(JSON.stringify({ task, selected: ego.selectedTaskId }));+ `);++ assert.equal(result.exitCode, 0);+ assert.deepEqual(firstJsonLine(result.stdout), {+ task: {+ taskId: "checkout-flow",+ id: "checkout-flow",+ name: "checkout-flow",+ createdBy: "agent",+ ownership: "agent",+ recentTabTitles: []+ },+ selected: "checkout-flow"+ });+ assert.deepEqual(ego.calls, [+ ["listTaskSpaces"],+ ["createTaskSpace", "checkout-flow"],+ ["useTaskSpace", "checkout-flow"]+ ]);+});++test("taskspace e2e reuses an existing agent-owned task space", async () => {+ const ego = new FakeEgo([+ { taskId: "checkout-flow", id: 7, name: "Checkout flow", createdBy: "agent", ownership: "agent" }+ ]);+ const result = await runTaskspaceScript(ego, `+ const task = await useOrCreateTaskSpace(7);+ cliLog(JSON.stringify({ task, selected: ego.selectedTaskId }));+ `);++ assert.equal(result.exitCode, 0);+ assert.deepEqual(firstJsonLine(result.stdout), {+ task: { taskId: "checkout-flow", id: 7, name: "Checkout flow", createdBy: "agent", ownership: "agent" },+ selected: "checkout-flow"+ });+ assert.deepEqual(ego.calls, [+ ["listTaskSpaces"],+ ["useTaskSpace", "checkout-flow"]+ ]);+});++test("taskspace e2e claims and selects an existing user-owned task space", async () => {+ const ego = new FakeEgo([+ { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", createdBy: "user", ownership: "user" }+ ]);+ const result = await runTaskspaceScript(ego, `+ const task = await useOrCreateTaskSpace("checkout-flow");+ cliLog(JSON.stringify({ task, selected: ego.selectedTaskId }));+ `);++ assert.equal(result.exitCode, 0);+ assert.deepEqual(firstJsonLine(result.stdout), {+ task: { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", createdBy: "agent", ownership: "agent" },+ selected: "checkout-flow"+ });+ assert.deepEqual(ego.calls, [+ ["listTaskSpaces"],+ ["claimTaskSpace", "checkout-flow"],+ ["useTaskSpace", "checkout-flow"]+ ]);+});++test("taskspace e2e exposes newTaskSpace but not claimTaskSpace as a helper", async () => {+ const ego = new FakeEgo();+ const result = await runTaskspaceScript(ego, `+ cliLog(JSON.stringify({+ newType: typeof newTaskSpace,+ switchType: typeof switchTaskSpace,+ claimType: typeof claimTaskSpace,+ rawClaimType: typeof ego.claimTaskSpace+ }));+ `);++ assert.equal(result.exitCode, 0);+ assert.deepEqual(firstJsonLine(result.stdout), {+ newType: "function",+ switchType: "function",+ claimType: "undefined",+ rawClaimType: "function"+ });+});++test("taskspace e2e rejects explicit use of a user-owned task space", async () => {+ const ego = new FakeEgo([+ { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", createdBy: "user", ownership: "user" }+ ]);++ await assert.rejects(+ () => runTaskspaceScript(ego, `await switchTaskSpace("checkout-flow")`),+ /switchTaskSpace requires an agent-owned task space/+ );+ assert.deepEqual(ego.calls, [["listTaskSpaces"]]);+});++test("taskspace e2e rejects unknown task space ownership", async () => {+ const ego = new FakeEgo([+ { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", ownership: "shared" }+ ]);++ await assert.rejects(+ () => runTaskspaceScript(ego, `await useOrCreateTaskSpace("checkout-flow")`),+ /ownership "shared"/+ );+ assert.deepEqual(ego.calls, [["listTaskSpaces"]]);+});++test("taskspace e2e surfaces newTaskSpace binding errors", async () => {+ const ego = new FakeEgo([+ { taskId: "checkout-flow", id: "checkout-flow", name: "checkout-flow", ownership: "agent" }+ ]);++ await assert.rejects(+ () => runTaskspaceScript(ego, `await newTaskSpace("checkout-flow")`),+ /newTaskSpace: Task space already exists: checkout-flow/+ );+ assert.deepEqual(ego.calls, [["createTaskSpace", "checkout-flow"]]);+});