Appearance
Workspace
The dashboard surface: projects and teams outside the open canvas. This namespace reads and creates the containers a design lives in — the project itself and the team it belongs to — mirroring the Snaptrude dashboard. It also carries the workspace-level mode switch for Present mode (openPresentMode / closePresentMode). Accessed via snaptrude.workspace.
All methods are host API calls that return Promises. Reads never throw for a miss (get returns null, list returns []). Create/copy/rename go through the backend, which enforces plan limits — a rejection surfaces as a normal host error. A projectId is the project's floorkey. There are no folders in v1.
Sub-namespaces
Projects
Create, copy, list, read & rename projects — a project is a single Snaptrude model, identified by its projectId (floorkey). (snaptrude.workspace.projects)
Teams
Read teams and their members. A team is a shared workspace that owns projects and members. Read-only in v1: no create/invite/delete (a deliberate safety decision). (snaptrude.workspace.teams)
At a glance
| Method | What it does | Mutates? |
|---|---|---|
projects.create(name, options?) | Create a new empty project | ✓ |
projects.copy(name, options?) | Copy the current project ("Save As") | ✓ |
projects.list(options?) | List accessible projects | — |
projects.get(projectId) | Read one project (null on miss) | — |
projects.rename(projectId, name) | Rename a project | ✓ |
teams.list() | List the user's teams | — |
teams.get(teamId) | Read one team (null on miss) | — |
teams.listMembers(teamId) | List a team's members | — |
openPresentMode() | Switch into Present mode (awaits the mount) | ✓ |
closePresentMode() | Leave Present mode for the modeling canvas | ✓ |
Present-mode switch
openPresentMode()
Open Present mode — the documentation editor the presentation.* namespaces operate on. Runs the exact top-bar tab-click sequence, then resolves only once the Present canvas has finished mounting (waits up to ~15s), so a presentation.* call issued right after this resolves finds Present mode open. Idempotent — resolves immediately when Present mode is already open. Write-gated: switching the mode under the user's feet is approval-controlled by design.
- Parameters: none
- Returns:
void - Throws:
PRECONDITION_FAILEDif the Present canvas does not mount within the timeout, if this session is the Program tab (mode switching applies to the model editor tab), or if plugin writes are disabled (METHOD_NOT_PERMITTED).
ts
await snaptrude.workspace.openPresentMode();
const { sheets } = await snaptrude.presentation.sheets.list();closePresentMode()
Close Present mode and return to the modeling canvas (the Design tab). Idempotent — a no-op when Present mode is not open. Refuses (like the top bar does) while Present mode is mid-view-update. Write-gated, like openPresentMode.
- Parameters: none
- Returns:
void - Throws:
PRECONDITION_FAILEDif Present mode is still updating its views (retry after it finishes) or the canvas does not unmount within ~15s.
ts
await snaptrude.workspace.closePresentMode();Relation to core.mode
These are the workspace-level convenience over the general mode switch core.mode.set: openPresentMode additionally awaits the Present canvas mount, where core.mode.set("present") returns as soon as the mode flips.
Example
ts
// Create a project in a team, then copy the current one as a backup.
const { projectId } = await snaptrude.workspace.projects.create("Tower Study", {
teamId: "team_1",
unit: "mm"
});
const backup = await snaptrude.workspace.projects.copy("Tower Study (backup)");
console.log(projectId, backup.projectId);