Developer

Frontend SDK

The @rightplace/sdk API surface available to custom applet iframes.

The @rightplace/sdk package provides the typed API surface for custom applet iframes. It is automatically available in the iframe context - no <script> tag required.

Typed Applet Calls (rp.<type>.*)

The SDK exposes typed namespaces for every applet type that registers calls:

import { createHooksProxy } from "@rightplace/sdk";

const rp = createHooksProxy(myTransport);

const file = await rp.docs.getOpenedFile({ resource_id: resourceId });
//    ^? { path: string | null; content: string; is_dirty: boolean; cursor: number }

await rp.docs.insertAtSelection({ resource_id: resourceId, text: "..." });

Types are generated from the registry’s schema catalog - adding a new hook in Rust automatically updates the SDK types on regeneration (pnpm hooks:regen). See Calls for the full protocol.

Manifest

{
  "capabilities": ["hooks:consume", "docs:read", "docs:write"],
  "hooks": {
    "calls": ["docs.getOpenedFile", "docs.insertAtSelection"]
  }
}

Both must list the permission/hook before the call is allowed.