@pilotoo/server
Introduction
Section titled “Introduction”@pilotoo/server is the backend as a NestJS module. You import PilotooModule, give it your tools and any ports you want to replace, and it serves the REST and socket.io API that the clients talk to. Use it when you host the backend yourself on Node 22 with PostgreSQL. For a user’s own machine, use @pilotoo/local-server.
Installation
Section titled “Installation”@pilotoo/server 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/server": "file:vendor/pilotoo-server-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 the demo API (apps/api/src/app.module.ts):
import { createAskHumanTool } from '@pilotoo/agent-runtime';import { PilotooModule } from '@pilotoo/server';
import { webSearch } from './web-search';
@Module({ imports: [ PilotooModule.forRoot({ env: process.env, tools: (registry) => { registry.register(webSearch); registry.register(createAskHumanTool(), { optIn: true }); }, }), ],})export class AppModule {}import { configureBodyLimit } from '@pilotoo/server';
configureBodyLimit(app);app.enableCors({ origin: true, credentials: false });Entry points
Section titled “Entry points”| Import | Provides |
|---|---|
@pilotoo/server |
The only entry point. PilotooModule and PilotooModuleOptions, configureBodyLimit, the identity helpers (Anonymous, CallerIdentity, IDENTITY_RESOLVER), StreamingGateway, BackgroundTaskService, ScheduleService, createUsagePriceList, the storage port types and the injection tokens. |
Peer dependencies
Section titled “Peer dependencies”@nestjs/common, @nestjs/core, @nestjs/platform-express, @nestjs/platform-socket.io and @nestjs/websockets (^11.2.3), reflect-metadata (^0.2.2) and rxjs (^7.8.2). They are peers so your app never loads two copies of NestJS.
Learn more
Section titled “Learn more”- Server: assembling a server step by step.
- Authentication: resolving who the caller is.
- Storage: PostgreSQL by default, or your own stores.
- Schedules and Model gateway.