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. The daemon, CLI, and libpilot binaries ship inside the npm package (no install-time scripts run) and are seeded into ~/.pilot/bin/ on first use. The published 1.12.4 build carries macOS arm64 and Linux x64 binaries; Windows support 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.