SDK Reference

Install the SDK from the public npm registry:

pnpm add @theaiplatform/miniapp-sdk

Use the narrowest entry point for each module. This keeps browser targets from importing build-only dependencies and makes runtime assumptions explicit.

ExportPurpose
@theaiplatform/miniapp-sdkConvenience root that re-exports the config and SDK APIs
@theaiplatform/miniapp-sdk/sdkHost-backed storage, presence, HTTP, credentials, printing, terminal, collaboration, VFS, and specialist APIs
@theaiplatform/miniapp-sdk/mcpPackage-runtime MCP server authoring contract for exact QuickJS tool exposes
@theaiplatform/miniapp-sdk/webBrowser compatibility, editor actions, specialist events, and theme helpers
@theaiplatform/miniapp-sdk/uiPortable React components with public TypeScript declarations
@theaiplatform/miniapp-sdk/ui/markdownSanitized static Markdown rendering without adding its dependencies to the base UI entry
@theaiplatform/miniapp-sdk/ui/wasmSerializable imperative UI lifecycle for Rust/WASM miniapps
@theaiplatform/miniapp-sdk/ui/styles.cssPrecompiled platform theme and component styles
@theaiplatform/miniapp-sdk/ui/tailwind.cssTailwind v4 source integration for miniapp styles
@theaiplatform/miniapp-sdk/ui-components.jsonAgent-readable component family and style catalog
@theaiplatform/miniapp-sdk/surfaceSurface mount contracts, host authority, package events, and asset URL resolution
@theaiplatform/miniapp-sdk/inline-rendererShared isolated inline-renderer theme, action, resource, mount, and cleanup contracts
@theaiplatform/miniapp-sdk/chat-rendererIsolated inline chat-renderer mount, theme, declared action, resource, and cleanup contracts
@theaiplatform/miniapp-sdk/link-unfurlLink-unfurl contribution, host-sealed payload, path captures, and renderer module contracts
@theaiplatform/miniapp-sdk/vscode-webviewCompatibility bridge for converted VS Code webviews, scoped storage, sessions, and mediated HTTP
@theaiplatform/miniapp-sdk/configTyped app configuration helpers
@theaiplatform/miniapp-sdk/authoringTyped package authoring, release derivation, contribution providers, builders, and verification hooks
@theaiplatform/miniapp-sdk/lifecycleTransactional build, check, and explicit publication orchestration
@theaiplatform/miniapp-sdk/source-manifestExact source-manifest parsing, validation, and immutable release-closure extraction
@theaiplatform/miniapp-sdk/source-manifest.schema.jsonPublished JSON Schema for the immutable manifest.tap.json source manifest
@theaiplatform/miniapp-sdk/reactReact hooks for surfaces: specialists, channels, and tasks
@theaiplatform/miniapp-sdk/rspackRsbuild and Rslib target compilation, package assembly, and portability checks
@theaiplatform/miniapp-sdk/testing/rstestRstest 0.11 and Playwright fixtures for Test Lab-hosted surface and Live TAP E2E suites
@theaiplatform/miniapp-sdk/testing/rstest-configDeterministic Rstest configuration with Test Lab-owned isolation, concurrency, and retry policy
@theaiplatform/miniapp-sdk/testing/toolingNode-only Test Lab schema loading and deterministic scaffold tooling used by project initializers
@theaiplatform/miniapp-sdk/testing/tap.test.schema.jsonPublished JSON Schema for the tap.test.json Test Lab project descriptor
@theaiplatform/miniapp-sdk/config-schema.jsonPublished JSON Schema for manifest.tap.json

The root export is convenient for shared types and simple runtime code. Prefer /rspack only in build configuration and scripts, never in a browser or headless target bundle.

Developer Commands

The package installs two command-line tools:

CommandPurpose
tap-miniapp dev [--root <path>] [--once] [--json]Run the project-owned package build once or rebuild complete generations while source files change
tap-miniapp buildCompile authoring, run every target builder, verify the package, and atomically replace output
tap-miniapp checkRun the same compilation and verification without replacing output or publishing
tap-miniapp publish [--from <path>]Verify and publish exactly one assembled package through the configured adapter
tap-miniapp-test <command>Scaffold, inspect, and run the Test Lab contract documented in Testing

tap-miniapp dev reads the exact pnpm version, build:miniapp, and tapMiniapp.output from the miniapp's package.json. JSON mode emits newline-delimited events and is suitable for agents and CI. See Authoring and Package Lifecycle for the release workflow.

Compatibility

The package declares its supported Node.js and peer-dependency ranges in its published metadata. Install peer packages only for the features you use, and keep all Module Federation packages on the same exact version.

Code should treat optional SDK methods and capability groups as feature-detected additions. A host can reject an operation when its realm, scope, permission, or selected target does not authorize it.