Skip to main content

Frontend Page Host SDK

The Host SDK is the safe connection between developer-authored page code and the installed TWL Tool shell.

import {createAppHostClient} from '@twl-tool/app-sdk';

const host = createAppHostClient();
const context = await host.getContext();

await host.navigate('inspiration');
const run = await host.runWorkflow('writePost', {
prompt: 'Write a practical post about simplifying a roadmap.',
});

Semantic capabilities

The current protocol exposes:

  • navigate — open a surface declared by the installed app
  • workflow.run — launch a workflow through a binding declared by the current Frontend Page

The protocol version is 1. The client creates request IDs, pins the host origin, checks the parent source and response origin, enforces a timeout, and never exposes the host session token.

Lifecycle

Call destroy() when your page tears down the client:

const host = createAppHostClient();

window.addEventListener('beforeunload', () => host.destroy());