@taskclan/react
v1.0.0
Published
React components for Taskclan Cloud — <TaskclanProvider>, <TaskclanChat>, useChat, <AgentCard>, <UsageBadge>. Drop a production AI chat UI into any React app in minutes.
Maintainers
Readme
@taskclan/react
React components for Taskclan Cloud. Drop a production AI chat UI into any React app in minutes.
npm install @taskclan/react @taskclan/platform react react-domQuick start
import { TaskclanProvider, TaskclanChat } from '@taskclan/react';
export default function App() {
return (
<TaskclanProvider
baseUrl="https://api.taskclan.com"
product="my-app"
getToken={async () => mySession.accessToken}
>
<TaskclanChat intent="voice.converse" placeholder="Ask anything…" />
</TaskclanProvider>
);
}Exports
| Export | What it does |
|--------|--------------|
| <TaskclanProvider> | Wires the platform client (base URL + token + product) into the tree. |
| useTaskclan() | Access the underlying @taskclan/platform client. |
| useChat({ intent }) | Conversation state + send(); dispatches a Hive intent per turn. |
| <TaskclanChat intent=…> | A drop-in chat UI built on useChat. |
| <AgentCard> | Renders an agent from listAgents(). |
| <UsageBadge costUsd=… /> | A compact model-spend badge. |
The pure conversation state lives in chatCore (addUser, applyDelta,
finishAssistant, extractText) and is exported if you want to build your own
UI.
How it works
useChat calls client.dispatchIntent(intent, { message }) and renders the
reply. Swap intent for any conversational intent your product exposes. Auth,
billing gates, model routing, and cost logging all happen server-side in
Taskclan — the component just sends the turn.
