OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-svc commits / 4975d44

Add README
Service/Client API, wire format, and consumers (pear-git-v3, pgh-sidecar). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4975d4476d4af12e5db8dd0b81268c4372110537
by plankatron <fleeky@gmail.com> · 2026-05-02T21:04:05.000Z

Changed files (1) +55 -0

README.md +55 -0
……@@ -0,0 +1,55 @@
1# hyper-svc
2
3Reusable per-app daemon library for the hyper-fleeky stack. Local RPC
4over UDS + HTTP, peer RPC over Hyperswarm (Protomux channel),
5replication via the same swarm.
6
7Used by `pear-git-v3`, `pgh-sidecar`, and any other daemon that wants
8"CLI talks to me locally, peer daemons talk to me via swarm."
9
10## API
11
12```js
13import { Service, Client } from 'hyper-svc'
14
15const svc = new Service({
16 socketPath: '/tmp/my-app.sock',
17 port: 4040, // optional HTTP
18 swarm, // optional Hyperswarm for peer RPC
19 topic // optional swarm topic for peer RPC channel
20})
21
22svc.handle('echo', async (params) => params)
23await svc.listen()
24
25// Local CLI client (UDS)
26const client = new Client({ socketPath: '/tmp/my-app.sock' })
27await client.call('echo', { hello: 'world' })
28
29// Peer client (over swarm)
30import { attachRpcClient } from 'hyper-svc'
31const peer = await attachRpcClient({ swarm, topic, peerKey })
32await peer.call('echo', { ... })
33```
34
35## Wire format
36
37`encodeFrame` / `FrameDecoder` provide the length-prefixed JSON frames
38used over both UDS and Protomux. Single source of truth for the wire
39format — keep them in sync if you fork.
40
41## Tests
42
43```bash
44npm test
45```
46
47`examples/` has a runnable echo service.
48
49## Related
50
51- `pear-git-v3` — primary consumer (per-daemon Service mounting all
52 RPC handlers).
53- `pgh-sidecar` — uses Service for `~/.pgh/svc.sock`.
54- `pgh-sidecar`'s app-lookup — apps register their UDS path here so
55 CLIs can resolve daemon → socket by name.