{"id":47272464,"url":"https://github.com/JairusSW/wipc","last_synced_at":"2026-03-29T18:00:59.211Z","repository":{"id":336527472,"uuid":"1149321115","full_name":"JairusSW/wipc","owner":"JairusSW","description":"Minimal and performant binary IPC over Standard I/O","archived":false,"fork":false,"pushed_at":"2026-02-04T21:12:49.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-29T00:50:59.667Z","etag":null,"topics":["assemblyscript","channel","ipc","protocol","rpc","stdio","wasm"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JairusSW.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-04T01:25:22.000Z","updated_at":"2026-02-04T21:12:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/JairusSW/wipc","commit_stats":null,"previous_names":["jairussw/wipc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JairusSW/wipc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JairusSW%2Fwipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JairusSW%2Fwipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JairusSW%2Fwipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JairusSW%2Fwipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JairusSW","download_url":"https://codeload.github.com/JairusSW/wipc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JairusSW%2Fwipc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31156651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-29T17:31:56.304Z","status":"ssl_error","status_checked_at":"2026-03-29T17:31:41.973Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assemblyscript","channel","ipc","protocol","rpc","stdio","wasm"],"created_at":"2026-03-15T14:00:18.465Z","updated_at":"2026-03-29T18:00:59.205Z","avatar_url":"https://github.com/JairusSW.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003e\u003cpre\u003e╦ ╦ ╦ ╔═╗ ╔═╗\n║║║ ║ ╠═╝ ║  \n╚╩╝ ╩ ╩   ╚═╝\u003c/pre\u003e\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/JairusSW/wipc/actions\"\u003e\u003cimg src=\"https://github.com/JairusSW/wipc/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/wipc-js\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/wipc-js\" alt=\"npm\"\u003e\u003c/a\u003e\n  \u003ca href=\"./LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/wipc-js\" alt=\"license\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n**Wire IPC** -- minimal binary framing over standard i/o.\n\nWIPC gives you a bidirectional byte channel between any two processes connected by pipes. It handles framing, buffering, and resync. Everything else -- payload encoding, RPC semantics, method dispatch -- is yours to define.\n\nIf a process can read `stdin` and write `stdout`, it can speak WIPC.\n\n## Install\n\n```sh\nnpm install wipc-js\n```\n\n## Example: Echo\n\n### Host (Node.js / Bun)\n\n```ts\nimport { Channel, MessageType } from \"wipc-js\";\nimport { spawn } from \"node:child_process\";\n\nconst child = spawn(\"wasmtime\", [\"./build/test.wasm\"], {\n  stdio: [\"pipe\", \"pipe\", \"inherit\"],\n});\n\nclass Echo extends Channel {\n  onDataMessage(data: Buffer) {\n    console.log(\"\u003c-\", data.toString(\"utf8\"));\n  }\n\n  onPassthrough(data: Buffer) {\n    // Anything the guest writes to stdout that isn't a WIPC frame\n    process.stderr.write(data);\n  }\n}\n\nconst ch = new Echo(child.stdout!, child.stdin!);\nch.send(MessageType.DATA, Buffer.from(\"hello\"));\n```\n\n### Guest (AssemblyScript)\n\n```ts\nimport { readFrame, writeFrame, MessageType, Frame } from \"wipc-js/assembly/channel\";\n\nwhile (true) {\n  const frame: Frame | null = readFrame();\n  if (frame === null) break;\n  writeFrame(frame.type, frame.payload);\n  if (frame.type == MessageType.CLOSE) break;\n}\n```\n\nThat's it. The guest reads frames, echoes them back. The host sends frames, receives echoes.\n\n## Wire Format\n\n9-byte header, then payload:\n\n```\n0       4      5         9        9+N\n┌───────┬──────┬─────────┬─────────┐\n│ WIPC  │ type │ length  │ payload │\n└───────┴──────┴─────────┴─────────┘\n  4 B     1 B     u32 LE     N B\n\n```\n\n```\n┌────────┬──────┬─────────┬──────────────────────┐\n│ Offset │ Size │ Field   │ Description          │\n├────────┼──────┼─────────┼──────────────────────┤\n│      0 │    4 │ MAGIC   │ ASCII \"WIPC\"         │\n│      4 │    1 │ TYPE    │ Message type         │\n│      5 │    4 │ LENGTH  │ Payload size, u32 LE │\n│      9 │    N │ PAYLOAD │ Opaque bytes         │\n└────────┴──────┴─────────┴──────────────────────┘\n```\n\n### Message Types\n\n```\n┌───────┬───────┬────────────────────────────┐\n│ Value │ Name  │ Purpose                    │\n├───────┼───────┼────────────────────────────┤\n│  0x00 │ OPEN  │ Channel initialization     │\n│  0x01 │ CLOSE │ Graceful shutdown          │\n│  0x02 │ CALL  │ RPC / request-response     │\n│  0x03 │ DATA  │ Raw data transfer          │\n└───────┴───────┴────────────────────────────┘\n```\n\nPayloads are opaque. WIPC does not prescribe encoding -- use JSON, protobuf, raw bytes, whatever fits your use case.\n\nSee [SPEC.md](./SPEC.md) for the full protocol specification.\n\n## Architecture\n\n```\n  ┌───────────────┐\n  │      FFI      │\n  └───────────────┘\n          │\n┌────────────────────┐    stdin / stdout (WIPC)   ┌───────────────────────┐\n│        Host        │  \u003c──────────────────────\u003e  │     Guest / Child     │\n└────────────────────┘                            └───────────────────────┘\n          │\n  ┌───────────────┐\n  │  passthrough  │\n  └───────────────┘\n\n```\n\nWIPC frames and regular stdout coexist on the same stream. The `Channel` parser separates them: frames are dispatched, everything else goes to `onPassthrough()`.\n\n## API\n\n### `Channel`\n\n```ts\nimport { Channel, MessageType } from \"wipc-js\";\n```\n\n**Sending:**\n\n- `send(type, payload?)` -- send a frame\n- `sendJSON(type, msg)` -- send a frame with a JSON-encoded payload\n\n**Receiving** (override in a subclass):\n\n- `onOpen()` -- OPEN frame\n- `onClose()` -- CLOSE frame\n- `onCall(msg)` -- CALL frame (payload parsed as JSON)\n- `onDataMessage(data)` -- DATA frame (raw Buffer)\n- `onPassthrough(data)` -- non-WIPC bytes\n\n### Guest API (AssemblyScript)\n\n```ts\nimport { readFrame, writeFrame, MessageType } from \"wipc-js/assembly\";\n```\n\n- `writeFrame(type, payload?)` -- write a frame to stdout\n- `readFrame(): Frame | null` -- blocking read from stdin\n- `encode(type, payload): ArrayBuffer` -- encode without sending\n- `decode(data): Frame | null` -- decode without reading\n\n## Building\n\n```sh\nnpm run asbuild          # build all targets\nnpm run asbuild:debug    # debug build\nnpm run asbuild:release  # release build\nnpm test                 # run test suite\n```\n\n## Performance\n\nHere's some benchmarks taken on my personal machine using Node.js v25:\n\n```\nEncode\n  encode small (27 B)\n    388ms | 2,577,150 ops/s  | 57 MB/s\n\n  encode 1 KB\n    593ms | 1,685,483 ops/s  | 1,726 MB/s\n\n  encode 64 KB\n    449ms | 222,904 ops/s    | 14,608 MB/s\n\nDecode (zero-copy, returns subarray view)\n  decode small (27 B)\n    88ms  | 11,325,136 ops/s | 249 MB/s\n\n  decode 1 KB\n    88ms  | 11,388,579 ops/s | 11,662 MB/s\n\n  decode 64 KB\n    88ms  | 11,422,528 ops/s | 748,587 MB/s\n\nDecode + copy (Buffer.from)\n  decode+copy small (27 B)\n    130ms | 7,694,254 ops/s | 169 MB/s\n\n  decode+copy 1 KB\n    222ms | 4,496,633 ops/s | 4,605 MB/s\n\n  decode+copy 64 KB\n    387ms | 258,641 ops/s   | 16,950 MB/s\n\nChannel round-trip (in-process echo)\n  echo small (27 B)\n    500,000 round-trips in 1,228ms | 407,213 rt/s | 18 MB/s\n```\n\nDecoding returns a `subarray` view -- no copies, constant time regardless of payload size. When you need to own the data, `Buffer.from()` copies at memcpy speed. Encoding cost is dominated by `Buffer.concat`. Round-trip throughput is limited by Node.js stream backpressure, not framing overhead.\n\nRun benchmarks yourself:\n\n```sh\nnpm run bench\n```\n\n## Runtime Requirements\n\n**Host:** Any runtime that WIPC is ported to.\n\n**Guest:** Anything that reads stdin and writes stdout. The included AssemblyScript library targets WASI runtimes (Wasmtime, Wasmer). Porting to Rust, C, Go, or any other language is straightforward -- see [SPEC.md](./SPEC.md).\n\n## License\n\nThis project is distributed under an open source license. Work on this project is done by passion, but if you want to support it financially, you can do so by making a donation to the project's [GitHub Sponsors](https://github.com/sponsors/JairusSW) page.\n\nYou can view the full license using the following link: [License](./LICENSE)\n\n## Contact\n\nPlease send all issues to [GitHub Issues](https://github.com/JairusSW/wipc/issues) and to converse, please send me an email at [me@jairus.dev](mailto:me@jairus.dev)\n\n- **Email:** Send me inquiries, questions, or requests at [me@jairus.dev](mailto:me@jairus.dev)\n- **GitHub:** Visit the official GitHub repository [Here](https://github.com/JairusSW/wipc)\n- **Website:** Visit my official website at [jairus.dev](https://jairus.dev/)\n- **Discord:** Contact me at [My Discord](https://discord.com/users/600700584038760448) or on the [AssemblyScript Discord Server](https://discord.gg/assemblyscript/)\n","funding_links":["https://github.com/sponsors/JairusSW"],"categories":["Packages"],"sub_categories":["I/O"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJairusSW%2Fwipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJairusSW%2Fwipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJairusSW%2Fwipc/lists"}