@kmlckj/licos-web-sdk
v0.1.1
Published
LICOS Web SDK for embedding published agent and workflow projects
Readme
@kmlckj/licos-web-sdk
LicOS Web SDK for embedding a published Agent conversation page.
The SDK creates an iframe that loads /studio/sdk, waits for IFRAME_READY, then sends INIT with projectId and token by postMessage. When the iframe reports TOKEN_EXPIRED, the SDK calls refreshToken and sends UPDATE_TOKEN.
CDN
The CDN browser script is served by the LicOS Studio frontend static assets. This npm package only ships ESM and React entries.
<script src="https://your-studio-origin/studio/licos-web-sdk/index.min.js"></script>
<script>
licosWebSDK.init({
projectId: 'YOUR_PROJECT_ID',
refreshToken: () => Promise.resolve('<YOUR_TOKEN>'),
});
</script>ESM
npm install @kmlckj/licos-web-sdkimport licosWebSDK from '@kmlckj/licos-web-sdk/js';
licosWebSDK.init({
projectId: 'YOUR_PROJECT_ID',
refreshToken: () => Promise.resolve('<YOUR_TOKEN>'),
});React
npm install @kmlckj/licos-web-sdkimport { LicosWebSDK } from '@kmlckj/licos-web-sdk/react';
export function App() {
return (
<LicosWebSDK
projectId="YOUR_PROJECT_ID"
refreshToken={() => Promise.resolve('<YOUR_TOKEN>')}
/>
);
}Options
type LicosWebSDKInitOptions = {
projectId: string;
token?: string;
refreshToken?: () => Promise<string> | string;
container?: Element | string;
sdkUrl?: string;
baseUrl?: string;
workspaceId?: string;
minHeight?: string | number;
onReady?: () => void;
onTokenExpired?: () => void;
onTokenRefreshed?: (token: string) => void;
};By default the iframe uses a 720px minimum height and opens ${window.location.origin}/studio/sdk. Pass sdkUrl or baseUrl when the SDK host is different from the embedding page.
