npm.io
1.0.0 • Published 3d ago

@taskclan/react

Licence
UNLICENSED
Version
1.0.0
Deps
1
Size
31 kB
Vulns
0
Weekly
0

@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-dom

Quick 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.

Keywords