Not published yet. @jalon/dock isn't on the public npm registry yet —
npm install will 404 until it is. For now, use the
script tag install; everything below describes the npm
path as it will work once the package ships.
npm install @jalon/dock
React 19+ is a peer dependency and deliberately not bundled — your app's React must be the only one in the tree, or hooks break across the boundary. The chat window, loaded when a visitor opens it, renders with that same React.
React
import { JalonDock } from '@jalon/dock/react'; export default function App() { return ( <> {/* your app */} <JalonDock appId="pk_…" endpoint="https://console.jalon.dev/api/ai/agent" /> </> ); }
<JalonDock /> takes every field of the mount config except target as
props, plus onReady, which receives the imperative handle. It only remounts when serialisable
config actually changes — inline objects per render are fine.
Next.js App Router: it is a client component, and the package marks it as
one, so it can be rendered straight from a server component. Put it in your own
"use client" file only if you pass onReady or another function as a prop.
Anything else
import { mount } from '@jalon/dock'; const dock = mount({ appId: 'pk_…', endpoint: 'https://console.jalon.dev/api/ai/agent' }); dock.open(); // also: close(), toggle(), destroy()
Importing @jalon/dock has no side effects — it does not auto-mount. Only
the script-tag build mounts on load.
The jalon() command queue
Both install paths expose window.jalon. Commands, all fire-and-forget:
| Command | Arguments | What it does |
|---|---|---|
jalon('identify', user) |
{ id, name, email, role, plan } |
Set or update the signed-in user. Applies to the next request of every open chat. |
jalon('open') |
— | Open the panel. |
jalon('close') |
— | Close it. |
jalon('toggle') |
— | You can guess. |
jalon('guide', goal) |
string | Start a live walkthrough toward a goal. Walkthroughs are part of the Pro plan; below it the call does nothing. |
jalon('practice', goal) |
string | The same walkthrough in practice mode. Pro and above, like guide. |
jalon('privacy', on) |
boolean | The visitor's own switch: true stops the journal, attention measurement and replay for them and purges what this page held; false resumes. Strictly boolean — anything else is ignored. The assistant keeps working, without history or page context. |
Calls made before the dock loads are queued and replayed — define the standard stub first and the order stops mattering:
window.jalon = window.jalon || function () { (window.jalon.q = window.jalon.q || []).push(arguments); };
One dock per page
The dock is a page singleton. A <JalonDock /> alongside a script tag stacks
two perception engines and two launchers — npx @jalon/dock audit warns when a
repo contains both paths.