`taskSpace(undefined)` falls through to the create-space path and surfaces a native `createTaskSpace` error
Description
Calling taskSpace() with an undefined locator is not rejected at the public API boundary. The value is treated as an unknown name, the helper takes the "create a new space" branch, and the failure surfaces as a native-binding error that says nothing about the actual mistake:
Error: newTaskSpace: ego.createTaskSpace(name, profileId?) expects a string task name and an optional profile id.
Example: const task = await ego.createTaskSpace('task-selected-from-js', 'Default')
at buildEgoError (file:////[eval1]:445:19)
at invokeEgo (file:////[eval1]:461:15)
at createTaskSpaceResolution (file:////[eval1]:19922:46)
at resolveTaskSpace (file:////[eval1]:19960:16)
at async taskSpace (file:////[eval1]:19997:44)How I got there: the Skill says to "print its spaceId" and resume the space later, so an agent that lost the id naturally does:
const spaces = await listTaskSpaces();
const mine = spaces.filter(s => s.name === "my task");
const task = await taskSpace(mine[0].spaceId); // undefined: list entries expose `id`, not `spaceId`listTaskSpaces() entries carry id / name / ownership; spaceId only exists on the TaskSpace handle (as an alias of id). That asymmetry is fine, but combined with the missing argument check the mistake is very hard to diagnose from the error text.
Steps to reproduce
ego-browser nodejs -e 'const t = await taskSpace(undefined); console.log(t.spaceId);'Expected
An immediate, descriptive error from taskSpace() itself, e.g. taskSpace: expected a task space name (string) or id (number), got undefined. No space is created.
Optionally, one sentence in the Skill next to the listTaskSpaces() example stating that list entries use id and that taskSpace(entry.id) resumes them.
Actual
The call reaches the native createTaskSpace binding and fails with the message above.
Environment
- Ego Lite app/CLI 0.5.0.32, bundled Chromium 152.0.7977.54
- macOS 27.0 (26A428), arm64
- Agent: Claude Code 2.1.272 running
ego-browser nodejsscripts
Source: citrolabs/ego-lite