kkrpc

Build bidirectional RPC channels in TypeScript across stdio, WebSocket, HTTP, and worker transports.

21|1|Updated Feb 17, 2019
One-click install
npx skills add https://github.com/Kiyozz/papyrus-compiler-app --skill kkrpc-kiyozz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kkrpc
Source: https://github.com/Kiyozz/papyrus-compiler-app/tree/main/.claude/skills/kkrpc
Command: npx skills add https://github.com/Kiyozz/papyrus-compiler-app --skill kkrpc-kiyozz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires kkrpc.

What problem does it solve? Calling functions across process, network, or thread boundaries in TypeScript normally requires hand-written message protocols, serialization logic, and error plumbing. This Skill provides the patterns and API reference for kkrpc, a library that exposes typed APIs over a transport and lets remote callers invoke them as if they were local. ## Core Features & Use Cases - Bidirectional RPC channels: Expose a local API object and consume the remote API through a typed proxy, with both sides able to call each other. - Multiple transports: Communicate over stdio (Node.js, Deno, Bun), WebSocket, HTTP, Web Workers, iframes, Chrome extension ports, Electron IPC, and message queues like RabbitMQ, Kafka, Redis Streams, and NATS. - Advanced capabilities: Pass callback functions as arguments, read and write remote properties, preserve custom error fields, validate inputs with Standard Schema (Zod, Valibot, ArkType), and transfer ArrayBuffers with zero copy in browsers. - Use Case: Spawn a Bun worker process from a Node.js app, expose a math API in the worker, and call await api.add(5, 3) from the parent with full type safety. ## Quick Start Ask the AI to create a kkrpc server that exposes a typed API over stdio and a client that spawns the server process and calls its methods.

Frequently Asked Questions about kkrpc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up bidirectional RPC in TypeScript?▼

Create an RPCChannel on each side with a transport adapter and pass an expose option containing your API object. Each side calls rpc.getAPI() to receive a typed proxy for invoking the remote API, so both sides can call each other.

How to communicate between a Node.js process and a Bun worker?▼

Spawn the worker with child_process, then wrap its stdout and stdin in a NodeIo instance and pass it to RPCChannel. The worker creates its own RPCChannel with NodeIo over process.stdin and process.stdout and exposes its API.

Does kkrpc support Deno, Bun, and browsers?▼

Yes, kkrpc works in Node.js, Deno, Bun, and browsers through environment-specific entry points. Import from kkrpc for Node and Bun, kkrpc/deno or jsr:@kunkun/kkrpc for Deno, kkrpc/browser for browsers, and kkrpc/chrome-extension for Chrome extensions.

Can I pass callback functions as RPC arguments?▼

Yes, kkrpc supports sending functions as arguments that the remote side can invoke. A common pattern is passing an onProgress callback to a long-running remote method, which the server calls repeatedly while the client receives the updates.

What is the difference between JSON and superjson serialization in kkrpc?▼

JSON serialization is standard and interoperates with other languages but lacks Date, Map, Set, and BigInt support. Superjson supports those types plus Uint8Array, works only between TypeScript endpoints, and is auto-detected by the receiver.

How do I validate RPC inputs and outputs?▼

Pass a validators option to RPCChannel using any Standard Schema library such as Zod, Valibot, or ArkType. Define input and output schemas per method, and failed validation raises an RPCValidationError.