@pilotoo/local-server
Introduction
Section titled “Introduction”@pilotoo/local-server runs the full backend inside a desktop app. It is @pilotoo/server on SQLite and a config folder, bound to 127.0.0.1 and protected by a per-launch token. Use it as the sidecar of a Tauri or Electron app. It needs no database server and no shared gateway.
Installation
Section titled “Installation”@pilotoo/local-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/local-server": "file:vendor/pilotoo-local-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.
It depends on better-sqlite3, a native module, so it must be built for the Node version that runs it.
Basic usage
Section titled “Basic usage”This is the demo desktop sidecar (apps/desktop/sidecar/launcher.mjs):
import { startLocalServer } from '@pilotoo/local-server';
const server = await startLocalServer({ configDir, dataDir, workspaceDir, execution: 'local-unsandboxed', defaultAgentId: 'orchestrator', allowedOrigins: ['tauri://localhost'], env, host: { tools: hostTools(env) }, printTo: process.stdout,});The port is chosen by the OS and the token is random per launch. printTo writes one line, {"url":"...","token":"..."}, for the parent process to read.
Entry points
Section titled “Entry points”| Import | Provides |
|---|---|
@pilotoo/local-server |
The only entry point. startLocalServer, createLocalModule, resolveLocalConfig, openLocalPersistence, LocalSqliteSaver, the SQLite stores, generateLocalToken and createTokenIdentityResolver. |
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).