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.

Treat agentDelegatedToUser as agent-owned in task space helpers

0x0915379920b40
diff --git a/package/ego-browser/src/helpers.ts b/package/ego-browser/src/helpers.ts
index 1764f71..2103c31 100644
--- a/package/ego-browser/src/helpers.ts
+++ b/package/ego-browser/src/helpers.ts
@@ -56,8 +56,12 @@ export async function listTaskSpaces() {
}
/*
- * Task space ownership policy (`ownership`: "agent" | "user").
- * What each helper does when the target space is user-owned:
+ * Task space ownership policy (`ownership`: "agent" | "agentDelegatedToUser" | "user").
+ * "agent" and "agentDelegatedToUser" are both agent-owned (see isAgentOwned) — the
+ * latter is the agent's own space with control temporarily handed to the user
+ * (handoff or GUI takeover). The user-control boundary is enforced at the native
+ * bridge when real commands run, not here. The rows below describe what each helper
+ * does when the target space is user-owned:
*
* switchTaskSpace -> throws (agent-owned only)
* useOrCreateTaskSpace -> claims it (ownership transfers to the agent)
@@ -69,6 +73,18 @@ export async function listTaskSpaces() {
* Keep this table in sync with the one in skills/ego-browser/SKILL.md.
*/
+/**
+ * Whether the agent owns the space. "agentDelegatedToUser" is still agent-owned —
+ * the agent created it but control is temporarily with the user (handoff / GUI
+ * takeover). Selecting such a space is fine; the user-control boundary is enforced
+ * separately at the native bridge when real commands run.
+ * @param {string|undefined} ownership
+ * @returns {boolean}
+ */
+function isAgentOwned(ownership) {
+ return ownership === "agent" || ownership === "agentDelegatedToUser";
+}
+
/**
* Select an existing task space by id/name for the current Node invocation.
* @param {string|number} nameOrId Task space id or name.
@@ -80,7 +96,7 @@ export async function switchTaskSpace(nameOrId) {
throw new Error("switchTaskSpace requires ego.useTaskSpace");
}
const space = await findTaskSpace(nameOrId);
- if (space.ownership !== "agent") {
+ if (!isAgentOwned(space.ownership)) {
throw new Error(`switchTaskSpace requires an agent-owned task space, got ownership ${JSON.stringify(space.ownership)}`);
}
return selectTaskSpace(ego, space, "switchTaskSpace");
@@ -118,7 +134,7 @@ export async function useOrCreateTaskSpace(nameOrId) {
}
return newTaskSpace(nameOrId);
}
- if (existing.ownership === "agent") {
+ if (isAgentOwned(existing.ownership)) {
return selectTaskSpace(globalThis.ego, existing, "useOrCreateTaskSpace");
}
if (existing.ownership === "user") {
diff --git a/skills/ego-browser/SKILL.md b/skills/ego-browser/SKILL.md
index bafda02..d0a930a 100644
--- a/skills/ego-browser/SKILL.md
+++ b/skills/ego-browser/SKILL.md
@@ -65,7 +65,7 @@ Use a short name for the current user goal when creating a new task space. Reuse
To continue work from an existing user-owned task space, use `await listTaskSpaces()` to find the space, call `await useOrCreateTaskSpace(id)` to claim it, then use `await listTabs()` and `await switchTab(targetId)` to select the exact tab before acting. This is different from resuming a handoff from your own prior task space, which starts with `await takeOverTaskSpace(nameOrId)`.
-**Ownership policy** — every task space has `ownership: 'agent' | 'user'`; the helpers treat user-owned spaces differently:
+**Ownership policy** — every task space has `ownership: 'agent' | 'agentDelegatedToUser' | 'user'`; the helpers treat user-owned spaces differently:
| Helper | When the target space is user-owned |
|---|---|