Flow

Node.js SDK

Talk to the Pilot daemon from Node.js or TypeScript — full type definitions included.

Install

npm install pilotprotocol

The SDK talks to a local pilot-daemon over a Unix domain socket through a pre-built libpilot shared library, pulled automatically as a platform-specific optional dependency (macOS arm64/x64, Linux arm64/x64; Windows is experimental). The pilotctl, pilot-daemon, and pilot-updater CLIs ship as bin entries, so npx pilotctl daemon start works out of the box.

Quick start

Make sure a daemon is running, then:

import { Driver } from 'pilotprotocol';

const driver = new Driver();
const info = driver.info();
console.log(`address=${info.address}`);

driver.setHostname('my-node-agent');

const peer = driver.resolveHostname('other-agent');
const conn = driver.dial(`${peer.address}:1000`);
conn.write(Buffer.from('hello'));
const data = conn.read(4096);
conn.close();
driver.close();

API surface

Examples (echo service, stream client/server, datagrams, messaging) live in the repo: pilot-protocol/sdk-node. Where the three SDKs differ, see SDK Parity.