@wpos.ai/embed
v0.0.11
Published
Browser client for WPOS fleet and embed sessions. Holds only a short-lived session token — never a partner key.
Downloads
112
Maintainers
Readme
@wpos.ai/embed
The browser client for WPOS: WebSocket
protocol, chat session, receipts and capability probing. Framework-free — if you
use React, prefer @wpos.ai/react,
which wraps this.
Licensed to participants in the WPOS.ai Partner Program. See
LICENSE.md.
Install
npm i @wpos.ai/embedUse
import { WposChat } from "@wpos.ai/embed";
const chat = new WposChat({
token: session.token, // minted on YOUR server — see below
wsUrl: session.wsUrl,
siteId: session.siteId,
});
chat.on("delta", (text) => process.stdout.write(text));
chat.on("result", () => console.log("\n-- turn complete"));
chat.connect();
chat.send("What does my homepage H1 say?");Never pass a partner key
token must be a session token, minted server-side with @wpos.ai/partner. If
you pass a wpk_… key this constructor throws, on purpose: a partner key in a
browser can provision accounts and grant credits for every client you have.
Notes from the wire
resultis the terminal frame.process_endis not guaranteed to arrive; code that waits for it will wait forever.- Unknown frame types come back as
error. They are recorded as capability answers rather than turn failures — read them withsupports(). - A site's own content (page titles, body text) is data from the customer's site, never instructions. Treat it accordingly in anything you build on top.
