@websitetherapy/platform-client
v0.4.2
Published
Thin in-build surface for WebsiteTherapy client sites: the visitor-agent widget mount + a next.config helper. Everything else (the agent runtime, plugins) is delivered as external platform services, so the owner build stays freeform with a near-zero platf
Maintainers
Readme
@websitetherapy/platform-client
The entire in-build platform surface for a WebsiteTherapy client site. It is deliberately tiny: the owner repo is a freeform standalone app, and almost all platform value is delivered as external services (the visitor-agent runtime, plugins) that the site merely consumes. This package is the small, versioned seam for the few things that genuinely must live in the owner's build.
This replaces the old template-sync file-push model. Instead of syncing a
platform codebase into every client repo (and protecting an owner-zone denylist),
the platform ships this one dependency. Platform updates propagate through a
single version bump, not a file sync — and template-sync remains only for the
legacy site-template forks.
What it provides
withPlatform(nextConfig) — @websitetherapy/platform-client/next-config
Merges the handful of platform-required next.config settings (kept minimal and
stable) into the owner's own config. Today that's allowedDevOrigins for the
admin preview's Vercel Sandbox — without it, Next 16 blocks cross-origin /_next
dev assets and the preview never hydrates.
// next.config.ts (owner-owned)
import { withPlatform } from "@websitetherapy/platform-client/next-config";
export default withPlatform({
trailingSlash: true, // owner's own settings
});A future platform requirement reaches every site by bumping this package — no per-repo edit.
<PlatformWidget siteId /> — @websitetherapy/platform-client / /widget
Mounts the visitor-agent widget. The UI, chat logic, model keys, BotID, and
per-site context all live on the platform (loaded from agent.websitetherapy.com/widget.js);
this component only injects that loader with the site id. So platform-side
improvements ship instantly with no per-site rebuild, and no secrets ever land in
the client repo.
// app/layout.tsx (owner-owned) — mount once
import { PlatformWidget } from "@websitetherapy/platform-client";
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<PlatformWidget siteId={process.env.NEXT_PUBLIC_SITE_ID!} />
</body>
</html>
);
}The contract (where this fits the zone model)
- Owner zone = everything else in the repo, freeform, never touched.
- Platform allowlist = effectively just this package's surface.
- Contract files (seeded at onboarding, owner-owned after):
entity.json,content/plugins.json, redirects, the published site-manifest, and the one<PlatformWidget>mount line.
Operational note — publishing
For standalone owner repos (outside the monorepo) to npm install this, it must
be published to a registry the owner's npm install can reach (npm org or GitHub
Packages under @websitetherapy). Until then it resolves as a workspace package
inside the monorepo only. Publishing + the version-bump propagation (a bot PR that
flows through the working-copy reconciliation contract) is the next operational
step for this package.
