stitchwire 0.0.0-stage → 0.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +183 -2
- package/THIRD_PARTY_NOTICES.txt +1973 -0
- package/bin/stitchwire +65725 -0
- package/native/darwin-arm64.node +0 -0
- package/native/darwin-x64.node +0 -0
- package/package.json +47 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Max Listov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,184 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/max-listov/stitchwire/v0.58.1/docs/assets/stitchwire-mark.jpg" width="180" alt="Stitchwire" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">Stitchwire</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Broker-mediated typed RPC, bounded streams and volatile events between machines behind NAT.</strong><br/>
|
|
9
|
+
No inbound node ports. No reverse SSH keys. No remote shell.
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://github.com/max-listov/stitchwire/blob/v0.58.1/LICENSE"><img src="https://img.shields.io/badge/license-MIT-2563eb" alt="MIT license" /></a>
|
|
14
|
+
<img src="https://img.shields.io/badge/runtime-Bun%20%E2%89%A51.4.4-fbf0df?logo=bun&logoColor=000" alt="Bun >= 1.4.4" />
|
|
15
|
+
<img src="https://img.shields.io/badge/client-Node%20%E2%89%A522%20%7C%20Bun%20%E2%89%A51.4.4-339933" alt="Node >= 22 | Bun >= 1.4.4" />
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<img src="https://raw.githubusercontent.com/max-listov/stitchwire/v0.58.1/docs/assets/infographic-hero.jpg" alt="Stitchwire: Node A behind NAT connects outbound over TLS through a trusted broker to Node B behind NAT" width="100%" />
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<em>Agents need no inbound network ports. Each agent dials a trusted broker, which accepts the connection. Network connections require TLS. Plain HTTP is allowed on loopback. Local applications talk to the agent over a private <code>0600</code> Unix socket — directly over HTTP-over-Unix or through <code>@stitchwire/client</code>.</em>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
application → local Unix door → agent → trusted broker → agent → declared service
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Why
|
|
33
|
+
|
|
34
|
+
- **No inbound node ports.** Laptops, home servers and private VMs dial outbound over TLS to trusted brokers — no firewall holes, no reverse SSH tunnels, no remote shell. The agent refuses a plain `http:`/`ws:` broker URL anywhere but loopback, which is for local development.
|
|
35
|
+
- **Default-deny grants.** Operator-owned policy decides which caller can reach which target and operation. Service descriptors never grant access by themselves.
|
|
36
|
+
- **Honest delivery certainty.** Timeouts and cancellations report `unknown` delivery instead of silently replaying writes or masking missed events.
|
|
37
|
+
- **Private local `0600` door.** Applications talk to one local agent over a Unix domain socket and never manage daemons, keys or broker connections.
|
|
38
|
+
|
|
39
|
+
### The problem it solves
|
|
40
|
+
|
|
41
|
+
Connecting private machines usually turns into a tangle of reverse SSH tunnels, open firewall ports and fragile ad-hoc scripts. Stitchwire replaces that mesh with one outbound-only brokered transport for typed RPC, pull-driven bounded streams and volatile pub/sub events — while services keep full ownership of their schemas, data, durable journals and business rules.
|
|
42
|
+
|
|
43
|
+
<p align="center">
|
|
44
|
+
<img src="https://raw.githubusercontent.com/max-listov/stitchwire/v0.58.1/docs/assets/infographic-compare.jpg" alt="Without Stitchwire: reverse SSH, open ports and ad-hoc scripts. With Stitchwire: typed RPC, bounded streams and events over one clean wire." width="100%" />
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
### Runtime (broker, agent & CLI — Linux and macOS)
|
|
50
|
+
|
|
51
|
+
Install the runtime from npm with Bun. The package includes the native lock-identity modules for macOS.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
bun add -g stitchwire
|
|
55
|
+
# or run without installing:
|
|
56
|
+
bunx stitchwire --version
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or install the standalone bundle from GitHub Releases. It needs Bun already installed (https://bun.sh) and never installs it; it places `~/.local/bin/stitchwire` and, on macOS, `~/.local/native/darwin-<arch>.node`. The installer verifies the Ed25519 signature on `SHA256SUMS` against its embedded public key, checks the runtime and platform files, and runs the staged binary before replacing the current installation.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
curl -fsSL https://raw.githubusercontent.com/max-listov/stitchwire/main/contrib/install.sh | bash
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> **Platform note:** Stitchwire runtime supports **Linux** and **macOS** (Unix domain sockets `0600` + `systemd` / `launchd`). Windows runtime and browser transport are not supported.
|
|
66
|
+
|
|
67
|
+
### Typed client SDK (Node ≥22 or Bun ≥1.4.4)
|
|
68
|
+
|
|
69
|
+
Install the SDK in your application with Bun or npm.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bun add @stitchwire/client
|
|
73
|
+
# or
|
|
74
|
+
npm install @stitchwire/client
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Importing the client does not start an agent: it talks to the one already running on the machine.
|
|
78
|
+
|
|
79
|
+
## Quickstart
|
|
80
|
+
|
|
81
|
+
Try the full isolated two-broker, two-agent typed service example locally (no external setup or fleet required):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/max-listov/stitchwire.git
|
|
85
|
+
cd stitchwire
|
|
86
|
+
bun install --frozen-lockfile --ignore-scripts
|
|
87
|
+
bun run example:service
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Call a declared service from your application:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { createWireClient, defaultWireSocketPath } from '@stitchwire/client';
|
|
94
|
+
|
|
95
|
+
// ~/.local/state/stitchwire/agent.sock unless STITCHWIRE_AGENT_SOCKET or STITCHWIRE_STATE_DIR is set.
|
|
96
|
+
using wire = createWireClient({ socketPath: defaultWireSocketPath() });
|
|
97
|
+
const result = await wire.invokeService({
|
|
98
|
+
to: 'worker',
|
|
99
|
+
service: 'example.catalog',
|
|
100
|
+
revision: '1',
|
|
101
|
+
operation: 'lookup',
|
|
102
|
+
payload: JSON.stringify({ key: 'alpha' }),
|
|
103
|
+
timeoutMs: 2_000,
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Four transport planes
|
|
108
|
+
|
|
109
|
+
| Plane | Purpose | Key invariants |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| **Declared services** | Typed HTTP-over-Unix RPC & contract streams projected from [Stitchkit](https://github.com/max-listov/stitchkit) contracts | Default-deny per caller/target/operation; opaque owner payloads; explicit byte & timeout ceilings |
|
|
112
|
+
| **Fixed command profiles** | Constrained execution of operator-declared binaries | Fixed executable path and argv rules; never a caller-selected shell |
|
|
113
|
+
| **Bounded streams** | Live stdout/NDJSON/framed feeds across nodes | Pull-driven credit backpressure, explicit terminal reason, cooperative cancellation |
|
|
114
|
+
| **Volatile events** | Pub/sub fan-out with sequence continuity checks | Bounded in-memory retention, explicit gap & boot-change frames — never silent data loss |
|
|
115
|
+
|
|
116
|
+
Runnable examples: [service](https://github.com/max-listov/stitchwire/blob/v0.58.1/examples/service/README.md) · [stream](https://github.com/max-listov/stitchwire/blob/v0.58.1/examples/stream/README.md) · [events](https://github.com/max-listov/stitchwire/blob/v0.58.1/examples/events/README.md).
|
|
117
|
+
|
|
118
|
+
## StitchKit × Stitchwire
|
|
119
|
+
|
|
120
|
+
<p align="center">
|
|
121
|
+
<img src="https://raw.githubusercontent.com/max-listov/stitchwire/v0.58.1/docs/assets/infographic-ecosystem.jpg" alt="StitchKit and Stitchwire: define contracts once and route them across every machine" width="100%" />
|
|
122
|
+
</p>
|
|
123
|
+
|
|
124
|
+
<p align="center">
|
|
125
|
+
<em>Define a service contract once with <a href="https://github.com/max-listov/stitchkit">Stitchkit</a> — route it across every machine over Stitchwire.</em>
|
|
126
|
+
</p>
|
|
127
|
+
|
|
128
|
+
- **One contract, zero glue.** `serviceDescriptorFromContract()` derives operation IDs, exact static paths and stream framing directly from your Stitchkit contract.
|
|
129
|
+
- **Owner ingress & caller fetch.** Mount `createServiceIngress()` on a `0600` Unix socket on the owner machine and hand `createServiceFetch()` to your existing typed Stitchkit client on the caller — preserving cancellation, byte ceilings and `serviceCaller()` identity end to end.
|
|
130
|
+
- **Framework-optional.** The local door is plain HTTP-over-Unix, and `@stitchwire/client` works standalone without Stitchkit for raw `invokeService`, fixed command profiles, bounded streams and volatile events.
|
|
131
|
+
|
|
132
|
+
## Products and distribution
|
|
133
|
+
|
|
134
|
+
| Artifact | Source | Distribution |
|
|
135
|
+
| --- | --- | --- |
|
|
136
|
+
| Broker, agent & CLI runtime | `packages/runtime/src` | standalone GitHub Releases (`SHA256SUMS` + `contrib/install.sh`), and `stitchwire` on npm (`bun add -g stitchwire`); requires Bun ≥1.4.4 |
|
|
137
|
+
| Typed local client SDK | `packages/client/src` | GitHub Releases, and `@stitchwire/client` on npm (ESM + TypeScript declarations; Node ≥22 / Bun ≥1.4.4) |
|
|
138
|
+
| Shared transport contracts | `packages/contracts/src` | Internal workspace package (`private: true`), bundled into runtime and client |
|
|
139
|
+
|
|
140
|
+
Service templates live in `contrib/`:
|
|
141
|
+
- **Linux (`systemd`):** `contrib/systemd/stitchwire-agent.service`, `contrib/systemd/stitchwire-broker.service`
|
|
142
|
+
- **macOS (`launchd`):** `contrib/launchd/com.stitchwire.agent.plist` starts the agent through a `Stitchwire.app` launcher (`contrib/launchd/stitchwire-launcher.c`), so macOS attributes local-network access to Stitchwire. `bun scripts/macos-bundle.ts` builds that bundle from a source checkout and signs it only with your own Apple **Developer ID Application** identity. Without one, delete the launcher line from `ProgramArguments` and launchd runs Bun directly; macOS then attributes the agent's network access to Bun.
|
|
143
|
+
- **Broker TLS reverse proxy:** `contrib/nginx/stitchwire-broker.conf`
|
|
144
|
+
|
|
145
|
+
## Guarantees and deliberate limits
|
|
146
|
+
|
|
147
|
+
| Guarantee / Limit | Contract |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| **Trusted broker, no E2EE** | Brokers authenticate machine tokens by SHA-256 digest and can observe routed payloads |
|
|
150
|
+
| **Default-deny grants** | Service bindings and caller/target/operation grants are operator-owned; descriptors never grant access by themselves |
|
|
151
|
+
| **TLS on every network hop** | The agent refuses plain `http:`/`ws:` broker URLs outside loopback; loopback is for local development or a trusted local reverse proxy |
|
|
152
|
+
| **Honest delivery certainty** | Timeouts and cancellation can mean **unknown delivery** — never automatically replay uncertain writes |
|
|
153
|
+
| **Bounded streams** | Streams have explicit byte and time limits and a terminal reason; a quiet stream is not a dead one |
|
|
154
|
+
| **No durable broker queue** | Event retention is bounded and volatile; gaps are delivered explicitly so owners reconcile from their own durable state |
|
|
155
|
+
| **One fleet, one runtime version** | Brokers and agents enforce exact runtime version handshakes; mixed-version rolling upgrades are refused |
|
|
156
|
+
| **Local Unix door = local authority** | Any process allowed to open the `0600` agent socket has that node's local authority; per-user auth lives above Wire |
|
|
157
|
+
|
|
158
|
+
## Development and verification
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
bun install --frozen-lockfile --ignore-scripts
|
|
162
|
+
bun run check # typecheck, Biome lint/format, full test suite
|
|
163
|
+
bun run build # standalone dist/stitchwire + macOS native sidecars
|
|
164
|
+
bun run check:runtime-package # pack stitchwire runtime tarball and verify isolated install
|
|
165
|
+
bun run check:client-package # pack @stitchwire/client and verify on Node & Bun
|
|
166
|
+
bun run verify # full local verification gate
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
On macOS, `bun run check` also compiles the launcher and builds the app icon, which needs `clang` (Xcode Command Line Tools), `iconutil` and `sips` (part of macOS) and `rsvg-convert` (`brew install librsvg`).
|
|
170
|
+
|
|
171
|
+
## Documentation
|
|
172
|
+
|
|
173
|
+
- [Vision](https://github.com/max-listov/stitchwire/blob/v0.58.1/docs/VISION.md) — product direction and deliberate limits
|
|
174
|
+
- [Architecture and packaging](https://github.com/max-listov/stitchwire/blob/v0.58.1/docs/architecture/product.md) — runtime, broker, agent and planes
|
|
175
|
+
- [Distribution and installation](https://github.com/max-listov/stitchwire/blob/v0.58.1/docs/architecture/distribution.md) — artifacts, macOS/Linux supervision and removal
|
|
176
|
+
- [Local node enrollment](https://github.com/max-listov/stitchwire/blob/v0.58.1/docs/architecture/enrollment.md) — repeatable admission, binding and detach
|
|
177
|
+
- [Diagnostics](https://github.com/max-listov/stitchwire/blob/v0.58.1/docs/architecture/diagnostics.md) — bounded `stitchwire doctor --json`, with the same checks and exit status as text mode; scheduling stays with the operator
|
|
178
|
+
- [Publication inputs](https://github.com/max-listov/stitchwire/blob/v0.58.1/docs/architecture/publication.md) — clean history-free snapshots and release gates
|
|
179
|
+
- [Architecture Decision Records](https://github.com/max-listov/stitchwire/tree/v0.58.1/docs/decisions/) — why each protocol boundary exists
|
|
180
|
+
- [Security policy](https://github.com/max-listov/stitchwire/blob/v0.58.1/SECURITY.md) · [Contributing](https://github.com/max-listov/stitchwire/blob/v0.58.1/CONTRIBUTING.md) · [Changelog](https://github.com/max-listov/stitchwire/blob/v0.58.1/CHANGELOG.md)
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
[MIT](https://github.com/max-listov/stitchwire/blob/v0.58.1/LICENSE) © Max Listov
|