ISPO SDK
    Preparing search index...
    Markdown

    Connect your app

    Create a project in ISPO, then use the @ispo/sdk dependency supplied by its scaffold. Keep the project's existing build setup. Read the local ispo-sdk skill for the capabilities available in your installed host.

    The host-generated bootstrap calls connectToHost() before loading your app. Scaffolded and imported apps must not call it again. Only a custom direct entry that bypasses that bootstrap calls it once. It installs the host bridge, theme delivery, and focus handling. Do not install a second bridge or a global Tab trap. A custom entry that owns the connection releases its handle with disconnect() on disposal.

    The following code defines an action for an Export button. It publishes text to the user's Files library and returns the host's receipt.

    import { files } from '@ispo/sdk'

    export async function exportNotes(text: string) {
    return files.publish({
    name: 'notes.md',
    mimeType: 'text/markdown',
    content: text,
    })
    }

    Before using this action, the project must request files: ["publish"] in its requests declaration and the user must grant access. Adding a declaration to an already admitted project does not change its reviewed access automatically. See Permissions and errors.

    Use files.pick() when the user should choose an existing file, or files.save() when the user should choose where new bytes go. A picker returning null means the user cancelled.

    Run the project's typecheck, wait for a fresh ISPO build, and exercise the action inside the app. Display the returned Files path after successful publication. Handle denial and cancellation as ordinary states.

    For a standalone browser tab, the SDK's enableBrowserMock() can support development. Mocks do not grant host access or prove that a protected operation works in ISPO.