Skip to content

zeekay/zap-js

 
 

Repository files navigation

ZAP TypeScript

TypeScript bindings for ZAP (Zero-Copy App Proto) - high-performance Cap'n Proto RPC for AI agents.

Installation

npm install @zap-proto/zap
# or
pnpm add @zap-proto/zap

For server-side usage with TCP transport, also install:

npm install ws

Usage

import { Client } from '@zap-proto/zap';

// Connect to ZAP server
const client = await Client.connect('zap://localhost:9999');

// List available tools
const tools = await client.listTools();
console.log('Tools:', tools);

// Call a tool
const result = await client.callTool('search', { query: 'hello world' });
console.log('Result:', result);

// Clean up
await client.close();

Server

import { Server } from '@zap-proto/zap';

const server = new Server({
  name: 'my-agent',
  version: '1.0.0',
});

// Register a tool
server.tool('search', {
  description: 'Search for content',
  schema: {
    type: 'object',
    properties: {
      query: { type: 'string' },
    },
    required: ['query'],
  },
  handler: async (args) => {
    return { results: [`Found: ${args.query}`] };
  },
});

// Start server
await server.listen(9999);

Features

  • Zero-copy message passing via Cap'n Proto
  • Full ZAP protocol support (tools, resources, prompts)
  • MCP Gateway bridging
  • Post-quantum cryptography (ML-KEM, ML-DSA)
  • W3C DID support
  • Agent consensus voting
  • Lux blockchain integration

Related Packages

License

MIT

About

ZAP JavaScript/TypeScript - Zero-Copy App Proto bindings for JS/TS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 79.5%
  • Cap'n Proto 13.7%
  • ZAP 6.8%