Introduction
@construct-space/sdk is the developer SDK for Construct — a Vue 3 + Tauri 2 desktop app where users live inside Spaces: small, focused Vue apps that the host loads as IIFE bundles.
A Space is roughly:
my-space/
├── space.manifest.json # identity, pages, navigation, agent, actions
├── src/
│ ├── entry.ts # auto-generated by `construct build`
│ ├── pages/ # filesystem-routed pages
│ ├── components/
│ ├── composables/
│ ├── models/ # defineModel() — Graph data layer
│ └── actions.ts # the agent-callable action surface
├── agent/config.md # the Space's own agent prompt
└── widgets/<name>/<size>.vueThe SDK is what you import inside that bundle to talk to the host — get the current user, list org members, write to persistent storage, share a folder, register a skill, render a Toast.
Why types-only?
Construct's host already runs Vue, Pinia, the auth store, the project store, the agent client. Re-bundling all that into every Space would balloon every bundle to a megabyte and force every Space to update in lockstep with the host.
Instead, every composable in this SDK is declared like this:
export declare function useAuth(): ReturnType<typeof useAuthStore>The implementation lives on window.__CONSTRUCT__['@construct/sdk'], installed once by the host. Your Space's Vite config externalizes @construct-space/sdk, so the call resolves to the host's runtime at load time. Your bundle stays bytes-small; every Space gets the live host build of the SDK without an upgrade dance.
What's in the box
| Category | What it covers |
|---|---|
| Auth & Identity | useAuth, useAuthorization (RBAC + CRUD sugar), useAccess (per-resource ABAC) |
| Organization | useOrg, useOrgMembers, useOrgTeams, useOrgDepartments, useOrgRoles |
| Toolbar & Breadcrumb | useToolbar, useBreadcrumb. Panels/popovers/splitters: use @construct-space/ui. |
| Routing | useNavigator (GetX-style), useSpaceShortcuts |
| Networking & Data | useHttp (full HTTP client — no axios needed), useStorage (files / R2), useLocalStorage (per-space KV) |
| Notifications | useToast, useNotification, useNotifications, useDelivery |
| Utilities | useMarkdown, useDateFormat, useGoogleFonts |
| Subpackages | sdk/data (typed models), sdk/media, sdk/storage, sdk/schemas, sdk/testing |
| Components | 32 Vue UI primitives — Button, Card, Modal, Input, Tabs, Tooltip, etc. |
Not in the SDK by design
Agent RPC, model selection, skill catalog, assistant panel state, and context-bus internals are not exposed here. External Spaces declare actions in actions.ts and the agent calls them; the agent is the caller, the Space is the callee. Built-in Spaces that need agent-side primitives import them directly from the host, not through this package.
Architecture: where each piece lives
┌─────────────────────────────────────────────────────────┐
│ Construct host app (Tauri + Vue + Pinia) │
│ ┌─────────────────────────────────────────────────┐ │
│ │ window.__CONSTRUCT__['@construct/sdk'] │ │
│ │ └── useAuth, useOrg, useStorage, ... │ │
│ └─────────────────────────────────────────────────┘ │
│ ↑ injected at boot │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Your Space's IIFE bundle │ │
│ │ import { useAuth, Card } from │ │
│ │ '@construct-space/sdk' ← types only │ │
│ │ (Vite externalizes this import) │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘Where to go next
- Quick Start — scaffold your first Space in 5 minutes
- Anatomy of a Space — every file in a Space, what it does, when to touch it
- Per-Resource Access — the
useAccessflow with a Drive-style share dialog walk-through - Composable Reference — all 51 composables grouped by domain