Skip to content

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>.vue

The 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:

ts
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

CategoryWhat it covers
Auth & IdentityuseAuth, useAuthorization (RBAC + CRUD sugar), useAccess (per-resource ABAC)
OrganizationuseOrg, useOrgMembers, useOrgTeams, useOrgDepartments, useOrgRoles
Toolbar & BreadcrumbuseToolbar, useBreadcrumb. Panels/popovers/splitters: use @construct-space/ui.
RoutinguseNavigator (GetX-style), useSpaceShortcuts
Networking & DatauseHttp (full HTTP client — no axios needed), useStorage (files / R2), useLocalStorage (per-space KV)
NotificationsuseToast, useNotification, useNotifications, useDelivery
UtilitiesuseMarkdown, useDateFormat, useGoogleFonts
Subpackagessdk/data (typed models), sdk/media, sdk/storage, sdk/schemas, sdk/testing
Components32 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

Released under the MIT License.