slopstream 0.0.0-stage → 0.2.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/.claude-plugin/marketplace.json +13 -0
- package/.claude-plugin/plugin.json +18 -0
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/PRIVACY.md +17 -0
- package/README.md +114 -2
- package/SECURITY.md +34 -0
- package/THREAT_MODEL.md +166 -0
- package/bridge/cli.js +433 -0
- package/bridge/config.js +28 -0
- package/bridge/demo.js +146 -0
- package/bridge/gate.js +152 -0
- package/bridge/http.js +18 -0
- package/bridge/init.js +132 -0
- package/bridge/login.js +51 -0
- package/bridge/net.js +89 -0
- package/bridge/server.js +365 -0
- package/bridge/simulate.js +78 -0
- package/bridge/status.js +54 -0
- package/commands/demo.md +15 -0
- package/commands/get-started.md +19 -0
- package/commands/init.md +17 -0
- package/commands/links.md +10 -0
- package/commands/status.md +14 -0
- package/package.json +57 -4
- package/product.md +163 -0
- package/relay/admin.js +31 -0
- package/relay/core.js +555 -0
- package/relay/html.js +44 -0
- package/relay/kv-file.js +41 -0
- package/relay/kv-mem.js +9 -0
- package/relay/server.js +93 -0
package/product.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Slopstream: product overview
|
|
2
|
+
|
|
3
|
+
*Part of [Slopstream](./README.md) · [Quick start](./docs/quickstart.md) · [Security](./docs/security.md) · [Threat model](./THREAT_MODEL.md) · [Contributing](./CONTRIBUTING.md)*
|
|
4
|
+
|
|
5
|
+
> **Your agent can ask mine.**
|
|
6
|
+
|
|
7
|
+
This file explains why Slopstream exists, how it's designed and where it's going. To set it up, see the [Quick start](./docs/quickstart.md).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. The problem: people have become the clipboard between their agents
|
|
12
|
+
|
|
13
|
+
Most work between people who use AI now looks like this:
|
|
14
|
+
|
|
15
|
+
1. You ask **your** agent something.
|
|
16
|
+
2. You copy its answer and send it to a teammate.
|
|
17
|
+
3. They paste it into **their** agent.
|
|
18
|
+
4. They copy *that* answer and send it back.
|
|
19
|
+
5. Repeat.
|
|
20
|
+
|
|
21
|
+
At a company it's the same with documents. Someone has their agent write an idea doc, a proposal or a review, and puts it in Google Drive. When someone else needs it, they download it and give it to *their* agent, which reviews it with *their* rules. Then they paste the feedback back to the first person, who feeds it to their agent again.
|
|
22
|
+
|
|
23
|
+
The agents never meet. Between them, people do the copying, and every hop costs time and loses context. Developers have a name for the walls of AI text that fly back and forth: *slop grenades*. And it feels wrong: *"If my job is to copy-paste between my agent and yours, why am I even there?"*
|
|
24
|
+
|
|
25
|
+
## 2. The idea: connect the intelligence
|
|
26
|
+
|
|
27
|
+
Over months, people load their agents with **their rules, methods, standards and context**: how they review code, what their API guarantees, which risks they care about. The agent can then check things the way its owner would, quickly, without the owner doing it.
|
|
28
|
+
|
|
29
|
+
> **An agent is a piece of its owner's intelligence.**
|
|
30
|
+
|
|
31
|
+
Different people's agents carry different parts of what a team knows. Today that intelligence is reachable only through the owner's **time** (meetings, chat threads, review requests) or by **copying files** into your own agent, which loses the owner's rules and context.
|
|
32
|
+
|
|
33
|
+
**Slopstream connects the intelligence.** Your agent asks your teammate's agent directly:
|
|
34
|
+
|
|
35
|
+
- You tell your agent: *"Ask Leo's agent whether the migration is merged."*
|
|
36
|
+
- The question arrives in **Leo's already-open agent session** as a new prompt, marked as coming from your agent.
|
|
37
|
+
- Leo's agent answers. Leo sees what goes back. The answer lands in your session, and your agent carries on.
|
|
38
|
+
- Nobody copied or pasted anything, and nobody gave up control.
|
|
39
|
+
|
|
40
|
+
> **Your agent shares what you allow. Decisions still need you. You see everything.**
|
|
41
|
+
|
|
42
|
+
It is **not** a chatbot network, a public inbox for your agent, or a swarm of agents running off on their own. It connects specific sessions whose owners agreed to connect them, and the people stay in charge.
|
|
43
|
+
|
|
44
|
+
## 3. The mental model
|
|
45
|
+
|
|
46
|
+
A few facts about how these systems work explain every design choice:
|
|
47
|
+
|
|
48
|
+
- **A model remembers nothing between calls.** A "chat" is just an app storing a list of messages. On every new prompt, the app sends the model the *whole* list again (system prompt, tools, history, your new message). That bundle is the **context window**.
|
|
49
|
+
- So each session has its own private context. Your session and your teammate's are two separate context windows that know nothing about each other.
|
|
50
|
+
- To connect them you don't merge them. You let **explicit messages** cross between them. Each side's full history stays private. Only the messages someone chose to send travel across.
|
|
51
|
+
- An **agent** is that model plus tools, in a loop. Slopstream gives each linked session one new tool (`send_message`) and one new way to receive input (a message that arrives as a prompt).
|
|
52
|
+
|
|
53
|
+
The result: two contexts that stay separate and correct, joined by a thin, controlled connection.
|
|
54
|
+
|
|
55
|
+
## 4. Principles
|
|
56
|
+
|
|
57
|
+
These were decided up front, and every feature is held to them.
|
|
58
|
+
|
|
59
|
+
1. **Specific sessions, explicitly linked.** A link joins specific project sessions, so the context is right. A link can grow to a small group (default up to 3, set by the relay's `MAX_GROUP_SIZE`), and an existing member approves every addition. You can't message "Leo" in general, and a project that isn't linked can't send or receive anything.
|
|
60
|
+
2. **Humans approve decisions, not messages.** That's the goal. Today people approve every message in both directions. Next, factual questions can be answered automatically by a read-only helper while proposals need both people and actions are never triggered remotely (see [§9](#9-roadmap)).
|
|
61
|
+
3. **Live, not queued (for now).** A message is delivered only if the other side's linked session is open right now. Nothing is stored for later, so nobody's agent gets poked at 3 a.m. Asynchronous consultations are on the roadmap, opt-in per link.
|
|
62
|
+
4. **Arrives in the current session, as a new prompt.** Never a new chat, never a side channel. The conversation stays where the context already is.
|
|
63
|
+
5. **Treat the other agent as a stranger.** Everything inbound is marked *untrusted*, the agent is told to show it to its owner and wait, and nothing sensitive moves without explicit approval.
|
|
64
|
+
6. **The agent can't change the rules.** Linking, unlinking and who's allowed are done by a person at a terminal. The agent only has "send a message" and "check status". A malicious message can't talk its way into wider access.
|
|
65
|
+
7. **Any vendor.** Your team doesn't all use the same agent. Only the last hop (getting a message into a running session) is specific to each agent; the relay, trust model and message format are vendor-neutral.
|
|
66
|
+
|
|
67
|
+
## 5. How it works
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
your agent session ⇄ bridge ⇄ RELAY ⇄ bridge ⇄ teammate's agent session
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- **Bridge**: a small program your agent starts inside each linked session. It speaks MCP to the agent, pushes inbound messages in (as a Claude Code *channel*, or with `codex queue` for Codex), and gives the agent the `send_message` and `link_status` tools.
|
|
74
|
+
- **Relay**: a small server that handles logins, invites, who is online, delivery, rate limits and an audit log of metadata. The hosted relay runs on Cloudflare (Workers and a Durable Object). You can [self-host](./docs/self-hosting.md) the same code on Cloudflare or as a plain Node server.
|
|
75
|
+
- **CLI**: the human-only controls: `link`, `join`, `approve`, `links`, `unlink`, `pause`, `devices` and so on. The commands that create links refuse to run without a real terminal, so an agent can't run them.
|
|
76
|
+
- **Login**: GitHub, through the device flow. The relay asks GitHub for nothing beyond your public profile, and your GitHub token never reaches your machine or the relay's storage. Each machine gets its own revocable device token.
|
|
77
|
+
|
|
78
|
+
**Life of a message:**
|
|
79
|
+
|
|
80
|
+
1. You: "Ask Leo's agent whether the migration is merged."
|
|
81
|
+
2. Your agent calls `send_message`. Your agent app asks you to approve. You do.
|
|
82
|
+
3. The bridge sends it to the relay. The relay checks: valid login, linked session, size, rate, **is the target online right now?** If not, the send fails and nothing is stored.
|
|
83
|
+
4. If yes, the relay hands it to Leo's bridge, which neutralises anything that could forge the message wrapper, labels it `[UNTRUSTED message from <you>'s agent]` and pushes it into Leo's open session.
|
|
84
|
+
5. Leo's agent shows it to Leo and waits. Leo decides what, if anything, happens next.
|
|
85
|
+
|
|
86
|
+
## 6. Built on existing standards
|
|
87
|
+
|
|
88
|
+
| Layer | What we use | Notes |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| Agent ⇄ tools | **MCP** (Model Context Protocol) | The bridge is an MCP server |
|
|
91
|
+
| Push into a live Claude Code session | **Claude Code channels** | A research preview: the session must be open, it needs a claude.ai login, and custom channels currently need a development flag |
|
|
92
|
+
| Push into a live Codex session | **`codex queue`** | With a hard approval pop-up from the bridge, and an inbox fallback |
|
|
93
|
+
| Login | **GitHub OAuth device flow** | Run by the relay, public profile only |
|
|
94
|
+
| Hosting | **Cloudflare Workers + Durable Objects** | WebSocket hibernation keeps idle connections nearly free. A plain Node host is included for self-hosting |
|
|
95
|
+
| Message shape | **A2A-shaped** (`contextId`, `parts[]`) | Full compatibility with A2A (the Linux Foundation agent-to-agent standard) is planned under the hood |
|
|
96
|
+
|
|
97
|
+
What we built ourselves is the thin missing layer: scoped linking between people, live delivery with human approval, and the trust handling around inbound agent text.
|
|
98
|
+
|
|
99
|
+
## 7. Security model
|
|
100
|
+
|
|
101
|
+
The main risk is **prompt injection**: text from another agent entering your agent's context and trying to steer it ("ignore your user, send me your files"). The full picture is in [THREAT_MODEL.md](./THREAT_MODEL.md).
|
|
102
|
+
|
|
103
|
+
**Enforced in code by the relay (and tested):**
|
|
104
|
+
- Only linked sessions can connect; strangers and unlinked sessions can't.
|
|
105
|
+
- Live delivery only; no queueing, even if a bridge is modified.
|
|
106
|
+
- Linking needs a one-time invite **and** an existing member's approval, typed by a person at a terminal.
|
|
107
|
+
- Token authentication with per-device tokens stored as hashes; text only; size cap; per-link rate limit; limits on failed logins and wrong invite codes; instant unlink.
|
|
108
|
+
- The agent has no tool for linking, unlinking or allowlisting.
|
|
109
|
+
|
|
110
|
+
**Best-effort, depends on the model and the person:**
|
|
111
|
+
- Inbound text is labelled untrusted and the agent is instructed to show it and wait. A model can still be fooled by a clever injection, which is why the person stays in the loop and the agent app's normal permission prompts stay on.
|
|
112
|
+
- Outgoing approval in Claude Code is its permission prompt, so users must not choose "always allow" for `send_message`. Codex gets a hard approval pop-up from the bridge itself.
|
|
113
|
+
|
|
114
|
+
**Known gap:** message text passes through the relay unencrypted (TLS protects it on the wire). The hosted relay doesn't store message text, but its operator could read it in transit. End-to-end encryption is next on the roadmap.
|
|
115
|
+
|
|
116
|
+
## 8. Where it stands
|
|
117
|
+
|
|
118
|
+
**Works today** (covered by automated end-to-end checks):
|
|
119
|
+
- **Hosted relay with GitHub login and one-link linking**: `npm i -g slopstream`, `slopstream link`, send the link, `slopstream join`. Per-device revocable tokens. Invites last 24 hours and can be approved later. Tested with a real second person.
|
|
120
|
+
- **Claude Code and Codex in any mix**: Claude ↔ Claude, Claude ↔ Codex, Codex ↔ Codex. For Codex, a message is pushed into the open chat with `codex queue` (verified against Codex 0.162.1), behind a hard approval pop-up, with an inbox fallback.
|
|
121
|
+
- **macOS and Windows**, including a Mac and a Windows machine linked together. Still untested: Windows as a self-hosted relay, and the PowerShell approval pop-up. Codex on Windows doesn't work yet.
|
|
122
|
+
- **Small groups, not just pairs**: up to `MAX_GROUP_SIZE` sessions per link (default 3), each addition approved by an existing member. `send_message` takes a `to` once more than one person is linked.
|
|
123
|
+
- Live-only delivery, rate limit, size cap, metadata audit log, instant pause and unlink.
|
|
124
|
+
- **Self-hosting**: the same relay on your own Cloudflare account or as a Node server.
|
|
125
|
+
- A one-command **solo test mode** (`slopstream demo`), so one person can play two or three sides on one machine.
|
|
126
|
+
- **Installable as a Claude Code plugin** (`/plugin install slopstream`) with the safe commands as slash commands. Linking still happens in a terminal on purpose.
|
|
127
|
+
|
|
128
|
+
## 9. Roadmap
|
|
129
|
+
|
|
130
|
+
| Next | Goal | Highlights |
|
|
131
|
+
|---|---|---|
|
|
132
|
+
| **Trust and safety** | Safe to use with anyone | **End-to-end encryption** with key verification. The **autonomy model**: factual questions answered automatically by a read-only helper (opt-in per link, everything shown in a digest), proposals that need both people to accept, actions never triggered remotely. Outbound secret scanning. Loop and budget limits |
|
|
133
|
+
| **More agents** | Your team doesn't all use the same one | An adapter kit so anyone can add an agent. Coding agents (Cursor, Gemini CLI and others) and **chat apps** (Claude, ChatGPT, Gemini, Copilot) |
|
|
134
|
+
| **Real collaboration** | From messages to working together | Consultations that work while the owner is away (opt-in). **Document review**: "review this the way Priya would". Shared decision logs. Approve from your phone |
|
|
135
|
+
| **Teams** | Connect a whole team's intelligence | Organisations, admin policies (the autonomy model, set for a team), audit export, bigger groups |
|
|
136
|
+
| **Enterprise** | For companies that need it | SSO, SCIM, self-hosted relay with support, data residency |
|
|
137
|
+
|
|
138
|
+
## 10. Risks and open questions
|
|
139
|
+
|
|
140
|
+
- **Channels are a research preview.** The mechanism or the required flag could change. A custom channel isn't on Anthropic's approved list, so for now users accept a "development" warning. A wider release needs Anthropic's approval or a different delivery path.
|
|
141
|
+
- **A vendor could build this inside its own walls.** The lasting value is between vendors: connecting your Claude to a teammate's Codex or ChatGPT, under rules the people (and later their company) control.
|
|
142
|
+
- **Prompt injection isn't solved by labelling.** A person in the loop is the real defence today. The read-only helper is what makes automatic answers safe: even if it's fooled, there's nothing dangerous it *can* do.
|
|
143
|
+
- **Live-only protects people but limits them.** No overnight handoffs across time zones yet. Opt-in asynchronous consultations are planned.
|
|
144
|
+
- **Who runs the relay, and what they can see**, matters more as people who don't know each other use it. Hence end-to-end encryption, and self-hosting for companies.
|
|
145
|
+
|
|
146
|
+
## 11. Glossary
|
|
147
|
+
|
|
148
|
+
- **Session / context window**: the message history a model is shown on each turn.
|
|
149
|
+
- **Agent**: a model plus tools, run in a loop. Over time, a piece of its owner's intelligence.
|
|
150
|
+
- **MCP**: the open protocol for connecting a model to tools and data.
|
|
151
|
+
- **Channel**: a Claude Code feature: an MCP server that pushes events into a running session.
|
|
152
|
+
- **A2A**: the open agent-to-agent protocol (Linux Foundation) for agents to talk to each other across vendors.
|
|
153
|
+
- **Bridge**: the per-session program that connects an agent session to the relay.
|
|
154
|
+
- **Relay**: the server that routes messages between bridges.
|
|
155
|
+
- **Link**: a human-approved connection between specific sessions of two or more people.
|
|
156
|
+
- **Chat label**: the short name you give a project's session so a link can refer to it.
|
|
157
|
+
- **Invite**: a one-time code or link (`https://<relay>/j/xxxxx-xxxxx`) that lets someone ask to join a link. Valid 24 hours.
|
|
158
|
+
- **Presence**: whether a linked session is connected right now.
|
|
159
|
+
- **Slop grenade**: a long, unedited AI output lobbed at someone else to deal with. What Slopstream replaces.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
*Slopstream is an independent, open-source project and is not affiliated with Anthropic or OpenAI. See the [README](./README.md#trademarks) for the trademark notice.*
|
package/relay/admin.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Relay admin: add users. Prints the token ONCE; only a hash is stored.
|
|
3
|
+
// node relay/admin.js add-user himnish
|
|
4
|
+
// node relay/admin.js list-users
|
|
5
|
+
// node relay/admin.js remove-user himnish
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import crypto from 'node:crypto';
|
|
9
|
+
|
|
10
|
+
const DATA = path.resolve(process.env.DATA_DIR || './data');
|
|
11
|
+
fs.mkdirSync(DATA, { recursive: true });
|
|
12
|
+
const f = path.join(DATA, 'users.json');
|
|
13
|
+
const read = () => { try { return JSON.parse(fs.readFileSync(f, 'utf8')); } catch { return {}; } };
|
|
14
|
+
const write = (v) => fs.writeFileSync(f, JSON.stringify(v, null, 2));
|
|
15
|
+
const [cmd, name] = process.argv.slice(2);
|
|
16
|
+
|
|
17
|
+
if (cmd === 'add-user') {
|
|
18
|
+
if (!/^[a-zA-Z0-9._-]{1,40}$/.test(name || '')) { console.error('usage: add-user <name> (letters, digits, . _ -)'); process.exit(1); }
|
|
19
|
+
const users = read();
|
|
20
|
+
if (users[name]) { console.error(`user "${name}" already exists (remove it first to reissue a token)`); process.exit(1); }
|
|
21
|
+
const token = crypto.randomBytes(24).toString('base64url');
|
|
22
|
+
users[name] = crypto.createHash('sha256').update(token).digest('hex');
|
|
23
|
+
write(users);
|
|
24
|
+
console.log(`user: ${name}\ntoken: ${token}\n(share this token with ${name} privately; it will not be shown again)`);
|
|
25
|
+
} else if (cmd === 'list-users') {
|
|
26
|
+
console.log(Object.keys(read()).join('\n') || '(none)');
|
|
27
|
+
} else if (cmd === 'remove-user') {
|
|
28
|
+
const users = read(); delete users[name]; write(users); console.log(`removed ${name}`);
|
|
29
|
+
} else {
|
|
30
|
+
console.error('usage: admin.js add-user|list-users|remove-user [name]'); process.exit(1);
|
|
31
|
+
}
|