@pilotoo/chat-core
Introduction
Section titled “Introduction”@pilotoo/chat-core is the client brain. It holds the view model, the pure reducers, the React chat session, the catalogs (conversations, agents, usage, schedules, presentations), the stores and the transport port. It renders nothing, so it sits under both @pilotoo/ui (web) and @pilotoo/chat-ui (React Native). Use it directly when you build your own screen.
Installation
Section titled “Installation”@pilotoo/chat-core is at version 0.1.0 and is not published to a registry yet. A host gets it today by packing the tarballs from the kit repository:
pnpm installpnpm release:checkrelease:check builds the release packages and writes one .tgz per package to node_modules/.cache/release-check/. Copy the tarballs you need into your project (for example vendor/) and depend on them as files:
{ "dependencies": { "@pilotoo/chat-core": "file:vendor/pilotoo-chat-core-0.1.0.tgz" }}The release set (chat-protocol, chat-core, chat-ui, ui, agent-runtime, server, local-server) is versioned together: install every kit package you use at the same version. See Installation for the full setup.
Basic usage
Section titled “Basic usage”This is how the demo web app opens a session (apps/web/src/features/chat/chat-session.tsx):
import { ChatSessionProvider } from '@pilotoo/chat-core';import { createSocketIoTransport } from '@pilotoo/chat-core/socket-io';
const [transport] = useState(() => createSocketIoTransport(apiUrl, { credentials }));
return <ChatSessionProvider transport={transport}>{children}</ChatSessionProvider>;Create the transport in useState, not useMemo: it opens a socket.
Entry points
Section titled “Entry points”| Import | Provides |
|---|---|
@pilotoo/chat-core |
ChatSessionProvider, useChatSession, the ChatTransport port, the catalog factories (createConversationCatalog, createAgentCatalog, createUsageReader, createScheduleClient, createPresentationSource), createAttachmentUploader, useConversations, useAgents, KeyValueStorage. |
@pilotoo/chat-core/socket-io |
createSocketIoTransport, the only place socket.io-client is imported. |
@pilotoo/chat-core/test-fixtures |
Helpers for tests (for example streamOf). Never bundled by the main entry. |
Peer dependencies
Section titled “Peer dependencies”react>=19socket.io-client^4.8.3, optional: only needed if you use@pilotoo/chat-core/socket-io.
Learn more
Section titled “Learn more”- Connecting a client: transport and credentials.
- Client tools and Attachments.
- Presentation and Catalogs.
- Editing and regenerating.