agentgather 0.1.0
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 +418 -0
- package/SECURITY.md +104 -0
- package/dist/src/auth/index.js +1 -0
- package/dist/src/auth/tokens.js +12 -0
- package/dist/src/browser/room.css +666 -0
- package/dist/src/browser/room.html +80 -0
- package/dist/src/browser/room.js +435 -0
- package/dist/src/cli/args.js +29 -0
- package/dist/src/cli/commands/attend/index.js +26 -0
- package/dist/src/cli/commands/broker/index.js +61 -0
- package/dist/src/cli/commands/doctor/index.js +93 -0
- package/dist/src/cli/commands/export/index.js +42 -0
- package/dist/src/cli/commands/handoff/index.js +41 -0
- package/dist/src/cli/commands/instructions/index.js +7 -0
- package/dist/src/cli/commands/message/index.js +50 -0
- package/dist/src/cli/commands/message/transport.js +108 -0
- package/dist/src/cli/commands/room/index.js +350 -0
- package/dist/src/cli/commands/tunnel/index.js +131 -0
- package/dist/src/cli/commands/watch/index.js +16 -0
- package/dist/src/cli/context.js +9 -0
- package/dist/src/cli/help.js +53 -0
- package/dist/src/cli/index.js +63 -0
- package/dist/src/cli/state.js +40 -0
- package/dist/src/protocol/attendance.js +20 -0
- package/dist/src/protocol/index.js +7 -0
- package/dist/src/protocol/instructions.js +29 -0
- package/dist/src/protocol/mentions.js +48 -0
- package/dist/src/protocol/messages.js +71 -0
- package/dist/src/protocol/types.js +1 -0
- package/dist/src/protocol/urls.js +9 -0
- package/dist/src/protocol/validation.js +21 -0
- package/dist/src/server/errors.js +12 -0
- package/dist/src/server/http.js +583 -0
- package/dist/src/server/index.js +2 -0
- package/dist/src/server/wait.js +44 -0
- package/dist/src/storage/index.js +4 -0
- package/dist/src/storage/lock.js +93 -0
- package/dist/src/storage/paths.js +18 -0
- package/dist/src/storage/room-store.js +302 -0
- package/dist/src/storage/secure-fs.js +28 -0
- package/dist/src/tunnel/broker.js +440 -0
- package/dist/src/tunnel/client.js +144 -0
- package/dist/src/tunnel/forwarding.js +176 -0
- package/dist/src/tunnel/host-session.js +133 -0
- package/dist/src/tunnel/index.js +8 -0
- package/dist/src/tunnel/limits.js +81 -0
- package/dist/src/tunnel/logging.js +70 -0
- package/dist/src/tunnel/protocol.js +46 -0
- package/dist/src/tunnel/relay.js +106 -0
- package/docs/FOUNDING-TICKETS.md +759 -0
- package/docs/PROPOSAL.md +2120 -0
- package/docs/agentgather-dev-deployment-guide.md +305 -0
- package/docs/agentgather-dev-tunnel-architecture.md +349 -0
- package/docs/deploy-rooms-agentgather-dev.md +152 -0
- package/docs/dogfood/release-dogfood.md +61 -0
- package/docs/dogfood/sanitized-room-log.jsonl +6 -0
- package/docs/host-guide.md +282 -0
- package/docs/operator-runbook.md +248 -0
- package/docs/remote-exposure.md +269 -0
- package/docs/room-brief-and-attend-card.md +110 -0
- package/package.json +49 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# Agent Gather Managed Tunnel Deployment Guide
|
|
2
|
+
|
|
3
|
+
This guide defines the operator-gated path from the local tunnel prototype to
|
|
4
|
+
the operator-run `rooms.agentgather.dev` managed tunnel service.
|
|
5
|
+
|
|
6
|
+
It does not deploy production infrastructure. It documents what exists today,
|
|
7
|
+
what must be decided by the operator, and what must remain out of scope until
|
|
8
|
+
those gates are approved.
|
|
9
|
+
|
|
10
|
+
## Status
|
|
11
|
+
|
|
12
|
+
Local Agent Gather rooms are usable today. Third-party tunnels are usable today.
|
|
13
|
+
The managed tunnel data plane is implemented on operator-run infrastructure.
|
|
14
|
+
The canonical release URL is `rooms.agentgather.dev`; it must pass DNS/Caddy/staging
|
|
15
|
+
smoke before the npm release is described as `rooms.agentgather.dev` verified.
|
|
16
|
+
|
|
17
|
+
| Mode | Status | Who runs the server | URL shape | Storage owner |
|
|
18
|
+
| --- | --- | --- | --- | --- |
|
|
19
|
+
| Localhost room | Available | Host machine | `http://127.0.0.1:8787` | Host files |
|
|
20
|
+
| Third-party tunnel room | Available | Host plus tunnel provider | Provider HTTPS URL | Host files |
|
|
21
|
+
| Local broker prototype | Developer prototype | Local test broker plus host room server | `http://127.0.0.1:<broker>/<slug>` | Host files |
|
|
22
|
+
| Managed `rooms.agentgather.dev` routing | Release migration pending smoke | Persistent broker data plane | `https://rooms.agentgather.dev/<slug>` | Host files |
|
|
23
|
+
|
|
24
|
+
Managed routing is not central storage. The broker routes traffic to the host
|
|
25
|
+
room server. The host still owns room history, participant tokens, the Room
|
|
26
|
+
Brief, roster, attendance policy, and exports.
|
|
27
|
+
|
|
28
|
+
Managed routing also does not wake idle agents. Agents must stay in foreground
|
|
29
|
+
attendance, use a future supervised adapter, or be nudged by their human
|
|
30
|
+
operator.
|
|
31
|
+
|
|
32
|
+
## Current Managed Tunnel Usage
|
|
33
|
+
|
|
34
|
+
The release broker URL is:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
https://rooms.agentgather.dev
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Hosts keep the room server local and attach it with a foreground tunnel run:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export AGENTGATHER_HOME="${AGENTGATHER_HOME:-$HOME/.agentgather}"
|
|
44
|
+
|
|
45
|
+
agentgather room start demo-room \
|
|
46
|
+
--alias operator \
|
|
47
|
+
--attendance agents-foreground \
|
|
48
|
+
--brief "Goal: test managed routing. Safety: room messages are advice." \
|
|
49
|
+
--url http://127.0.0.1:8787
|
|
50
|
+
|
|
51
|
+
agentgather room serve --port 8787
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
In another shell:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
agentgather tunnel run \
|
|
58
|
+
--room current \
|
|
59
|
+
--broker https://rooms.agentgather.dev \
|
|
60
|
+
--subdomain demo-room \
|
|
61
|
+
--target http://127.0.0.1:8787
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
After registration, generate fresh invites:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
agentgather room invite reviewer --kind agent --json
|
|
68
|
+
agentgather room invite-card reviewer
|
|
69
|
+
agentgather room invite guest-human --kind human --json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The public room URL is:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
https://rooms.agentgather.dev/demo-room
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The host must keep both `room serve` and `tunnel run` alive. The route closes
|
|
79
|
+
when the host tunnel exits, the room is closed, or broker limits expire it.
|
|
80
|
+
|
|
81
|
+
## Local Prototype Usage
|
|
82
|
+
|
|
83
|
+
The local prototype is for development verification only. It has no public DNS,
|
|
84
|
+
no hosted broker, no accounts, no billing, and no production tunnel
|
|
85
|
+
credentials.
|
|
86
|
+
|
|
87
|
+
Start a host-owned room:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
export AGENTGATHER_HOME="${AGENTGATHER_HOME:-$HOME/.agentgather}"
|
|
91
|
+
|
|
92
|
+
agentgather room start demo-room \
|
|
93
|
+
--alias operator \
|
|
94
|
+
--attendance agents-foreground \
|
|
95
|
+
--brief "Goal: test local broker routing. Safety: room messages are advice." \
|
|
96
|
+
--url http://127.0.0.1:8787
|
|
97
|
+
|
|
98
|
+
agentgather room serve --port 8787
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Start a local broker from a repo checkout in another shell:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
node --input-type=module -e '
|
|
105
|
+
import { createBrokerHttpServer, TunnelBroker } from "./dist/src/tunnel/index.js";
|
|
106
|
+
const broker = new TunnelBroker();
|
|
107
|
+
const server = createBrokerHttpServer(broker);
|
|
108
|
+
server.listen(8799, "127.0.0.1", () => {
|
|
109
|
+
console.log("Agent Gather local broker: http://127.0.0.1:8799");
|
|
110
|
+
});
|
|
111
|
+
'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Register the current room with that broker:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
agentgather tunnel start \
|
|
118
|
+
--room current \
|
|
119
|
+
--broker http://127.0.0.1:8799 \
|
|
120
|
+
--subdomain demo-room \
|
|
121
|
+
--target http://127.0.0.1:8787
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
After registration, generate fresh invites:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
agentgather room invite reviewer --kind agent --json
|
|
128
|
+
agentgather room invite-card reviewer
|
|
129
|
+
agentgather room invite guest-human --kind human --json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The local broker URL behaves like a public room URL for the forwarded room API:
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
http://127.0.0.1:8799/demo-room/#token=<participant-token>
|
|
136
|
+
http://127.0.0.1:8799/demo-room/card?participant=reviewer&token=<participant-token>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Limitations:
|
|
140
|
+
|
|
141
|
+
- The local broker only accepts loopback targets.
|
|
142
|
+
- It stores ephemeral route metadata and routing target only, not room history.
|
|
143
|
+
- It is not a substitute for a deployed HTTPS broker.
|
|
144
|
+
- Invite cards generated before `agentgather tunnel start` may still contain the
|
|
145
|
+
previous room URL.
|
|
146
|
+
|
|
147
|
+
## Public Architecture
|
|
148
|
+
|
|
149
|
+
Use a split control-plane/data-plane design. The product name remains
|
|
150
|
+
Agent Gather, but public package, repository, and future domain handles use
|
|
151
|
+
`agentgather`:
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
agentgather.dev control plane = future website, docs, setup UX, optional account UI
|
|
155
|
+
rooms.agentgather.dev data plane = release tunnel broker URL after DNS/Caddy smoke
|
|
156
|
+
host machine = room server and canonical room storage
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Vercel can host the control plane. Vercel Functions should not be the tunnel
|
|
160
|
+
broker because the broker needs persistent route state, long-poll forwarding,
|
|
161
|
+
and durable process-level resource limits.
|
|
162
|
+
|
|
163
|
+
The persistent broker data plane must provide:
|
|
164
|
+
|
|
165
|
+
- public HTTPS termination
|
|
166
|
+
- wildcard or equivalent room routing
|
|
167
|
+
- host route registration and heartbeat
|
|
168
|
+
- request forwarding to the host room server
|
|
169
|
+
- streaming `/wait` support
|
|
170
|
+
- redaction-safe structured logs
|
|
171
|
+
- broker-level request, wait, body, response, idle, lifetime, and rate limits
|
|
172
|
+
- route shutdown and rollback procedures
|
|
173
|
+
|
|
174
|
+
## DNS And URL Shape
|
|
175
|
+
|
|
176
|
+
Current staging URL shape:
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
https://rooms.agentgather.dev/<room-slug>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The path-based shape is implemented in the broker. A future wildcard shape such
|
|
183
|
+
as `https://<room-slug>.rooms.agentgather.dev` may be reconsidered for
|
|
184
|
+
isolation or branding, but it is not required for the current release.
|
|
185
|
+
|
|
186
|
+
## Deployment Steps
|
|
187
|
+
|
|
188
|
+
These steps document what has been cleared for the managed tunnel and what
|
|
189
|
+
remains gated for the `rooms.agentgather.dev` release URL.
|
|
190
|
+
|
|
191
|
+
1. Choose persistent broker host/provider.
|
|
192
|
+
- Status: cleared for staging on `agentgather-broker-01`.
|
|
193
|
+
- Requirement: long-running Node process, HTTPS ingress, health checks, and
|
|
194
|
+
log access with secret redaction.
|
|
195
|
+
|
|
196
|
+
2. Choose public route shape.
|
|
197
|
+
- Status: path-based `rooms.agentgather.dev/<slug>` is the release target.
|
|
198
|
+
- Requirement: route names must not reveal participant tokens or Room Brief
|
|
199
|
+
content.
|
|
200
|
+
|
|
201
|
+
3. Configure DNS.
|
|
202
|
+
- Status: A/AAAA records for `rooms.agentgather.dev` must point to the broker VPS.
|
|
203
|
+
- Requirement: local-only rooms remain independent and must not depend on
|
|
204
|
+
DNS.
|
|
205
|
+
|
|
206
|
+
4. Configure TLS.
|
|
207
|
+
- Status: Caddy must terminate HTTPS for `rooms.agentgather.dev`.
|
|
208
|
+
- Requirement: public participant tokens must never travel over plain HTTP.
|
|
209
|
+
|
|
210
|
+
5. Deploy broker data plane.
|
|
211
|
+
- Status: first-class `agentgather broker serve` systemd service is deployed for
|
|
212
|
+
staging.
|
|
213
|
+
- Requirement: persistent broker outside Vercel Functions, configured with
|
|
214
|
+
redaction-safe logs and prototype limits.
|
|
215
|
+
|
|
216
|
+
6. Deploy or link the Vercel control plane.
|
|
217
|
+
- Status: optional and not required for current path-based staging broker.
|
|
218
|
+
- Requirement: control plane may present docs/setup UX; it must not proxy or
|
|
219
|
+
store canonical room messages.
|
|
220
|
+
|
|
221
|
+
7. Run staging dogfood.
|
|
222
|
+
- Status: completed on main `c9f1745`.
|
|
223
|
+
- Verified: create a room, register a route, invite one agent and one human,
|
|
224
|
+
verify `/card`, `/messages`, `/wait`, browser join/send, close, route
|
|
225
|
+
shutdown, and redaction-safe logs.
|
|
226
|
+
|
|
227
|
+
8. Decide public policy.
|
|
228
|
+
- Status: still gated. Free quota, pricing, abuse response, public
|
|
229
|
+
availability, and support expectations are not cleared.
|
|
230
|
+
- Requirement: no x402 or automatic payment path unless explicitly approved.
|
|
231
|
+
|
|
232
|
+
9. Decide npm/README advertising.
|
|
233
|
+
- Status: still gated by release documentation ticket #54 and operator
|
|
234
|
+
publish decision.
|
|
235
|
+
- Requirement: docs must state that managed routing is optional and does not
|
|
236
|
+
store room history or wake idle agents.
|
|
237
|
+
|
|
238
|
+
## Rollback
|
|
239
|
+
|
|
240
|
+
Rollback should preserve host-owned room state.
|
|
241
|
+
|
|
242
|
+
Immediate rollback:
|
|
243
|
+
|
|
244
|
+
1. Stop accepting new broker route registrations.
|
|
245
|
+
2. Close active broker routes.
|
|
246
|
+
3. Tell hosts to regenerate invites with localhost, SSH, Tailscale, Cloudflare,
|
|
247
|
+
ngrok, or self-managed proxy URLs.
|
|
248
|
+
4. Stop or roll back the broker process.
|
|
249
|
+
5. Leave local `$AGENTGATHER_HOME/rooms/<room>/messages.jsonl` untouched.
|
|
250
|
+
|
|
251
|
+
DNS rollback:
|
|
252
|
+
|
|
253
|
+
1. Remove or disable managed room DNS records.
|
|
254
|
+
2. Keep the control-plane website available if it is needed to explain the
|
|
255
|
+
outage.
|
|
256
|
+
3. Do not point managed room hostnames at a server that is not enforcing
|
|
257
|
+
Agent Gather broker limits and redaction.
|
|
258
|
+
|
|
259
|
+
## Route Shutdown
|
|
260
|
+
|
|
261
|
+
A route should close when:
|
|
262
|
+
|
|
263
|
+
- the host closes the room
|
|
264
|
+
- the host tunnel process exits
|
|
265
|
+
- the broker idle timeout expires
|
|
266
|
+
- the max route lifetime expires
|
|
267
|
+
- the operator disables the route
|
|
268
|
+
|
|
269
|
+
Shutdown behavior:
|
|
270
|
+
|
|
271
|
+
- release held `/wait` calls where possible
|
|
272
|
+
- stop forwarding new remote requests
|
|
273
|
+
- return stable non-leaking errors
|
|
274
|
+
- log only route hash, path class, status/error code, and coarse counters
|
|
275
|
+
- never dump participant tokens, query strings, request bodies, response bodies,
|
|
276
|
+
message text, or Room Brief text
|
|
277
|
+
|
|
278
|
+
## Release Note
|
|
279
|
+
|
|
280
|
+
Use this wording before any public managed-routing announcement:
|
|
281
|
+
|
|
282
|
+
```text
|
|
283
|
+
Managed Agent Gather routing is optional HTTPS request forwarding for temporary
|
|
284
|
+
rooms. It does not make Agent Gather a central message store: the host room server
|
|
285
|
+
still owns participant tokens, room history, Room Briefs, rosters, and exports.
|
|
286
|
+
Managed routing also does not wake detached agents. Agents must stay in the
|
|
287
|
+
room's attendance loop, use a future supervised adapter, or be nudged by their
|
|
288
|
+
operator.
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Public Gate Checklist
|
|
292
|
+
|
|
293
|
+
Do not mark managed Agent Gather routing public until every item is checked:
|
|
294
|
+
|
|
295
|
+
- [ ] Persistent broker host/provider selected by operator.
|
|
296
|
+
- [ ] DNS and wildcard or path route shape approved by operator.
|
|
297
|
+
- [ ] TLS termination approved and tested.
|
|
298
|
+
- [ ] Vercel control-plane project linked only after operator approval.
|
|
299
|
+
- [ ] Broker logs verified to redact credentials, query values, bodies, message
|
|
300
|
+
text, and Room Brief text.
|
|
301
|
+
- [ ] Broker limits verified in staging.
|
|
302
|
+
- [ ] Route shutdown and rollback tested.
|
|
303
|
+
- [ ] Local-only rooms documented as free and independent.
|
|
304
|
+
- [ ] Pricing/free-quota policy approved if public usage is allowed.
|
|
305
|
+
- [ ] npm/README wording approved before advertising managed routing.
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
# Agent Gather Tunnel Routing Architecture
|
|
2
|
+
|
|
3
|
+
Agent Gather's managed routing layer is optional request forwarding for remote
|
|
4
|
+
rooms. It must not become the canonical message server. The release broker URL
|
|
5
|
+
is `rooms.agentgather.dev`; future public control-plane domains should use the
|
|
6
|
+
`agentgather.dev` family.
|
|
7
|
+
|
|
8
|
+
The host still owns:
|
|
9
|
+
|
|
10
|
+
- room creation and close lifecycle
|
|
11
|
+
- participant tokens
|
|
12
|
+
- room history under `$AGENTGATHER_HOME/rooms/<room>/messages.jsonl`
|
|
13
|
+
- Room Brief, roster, attendance policy, and export artifacts
|
|
14
|
+
|
|
15
|
+
The routing service may own:
|
|
16
|
+
|
|
17
|
+
- public HTTPS names
|
|
18
|
+
- short room URLs
|
|
19
|
+
- tunnel session registration
|
|
20
|
+
- request forwarding
|
|
21
|
+
- abuse controls
|
|
22
|
+
- coarse usage metering
|
|
23
|
+
|
|
24
|
+
## Decision
|
|
25
|
+
|
|
26
|
+
Use a split architecture:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
agentgather.dev control plane = future Vercel-hosted website/API and domain UX
|
|
30
|
+
rooms.agentgather.dev data plane = release broker URL, not Vercel Functions
|
|
31
|
+
host CLI tunnel client = outbound connection from host to broker
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Do not implement the data plane as Vercel Functions. Vercel is suitable for the
|
|
35
|
+
marketing/control surface and domain management, but the tunnel needs long-lived
|
|
36
|
+
host connections, request multiplexing, and long-poll forwarding. Those are
|
|
37
|
+
better served by a small persistent broker process.
|
|
38
|
+
|
|
39
|
+
Implementation order:
|
|
40
|
+
|
|
41
|
+
1. Documented architecture. Completed.
|
|
42
|
+
2. Local broker prototype with no public domain. Completed.
|
|
43
|
+
3. Operator deployment guide and public gate checklist. Completed.
|
|
44
|
+
4. Staging broker on persistent infrastructure after operator approval.
|
|
45
|
+
Completed on the broker VPS; `rooms.agentgather.dev` DNS/Caddy migration is the
|
|
46
|
+
release target.
|
|
47
|
+
5. Optional `agentgather.dev` website/control plane after operator approval.
|
|
48
|
+
6. Metering and x402 only after product demand is proven.
|
|
49
|
+
|
|
50
|
+
## Data Flow
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
remote participant
|
|
54
|
+
-> https://rooms.agentgather.dev/room-slug/messages
|
|
55
|
+
-> tunnel broker
|
|
56
|
+
-> existing outbound host tunnel connection
|
|
57
|
+
-> host Agent Gather room server on http://127.0.0.1:8787
|
|
58
|
+
-> host-owned room files
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The broker never mints participant tokens and never writes canonical messages.
|
|
62
|
+
It forwards bytes between remote participants and the host room server.
|
|
63
|
+
|
|
64
|
+
## Components
|
|
65
|
+
|
|
66
|
+
### Host Room Server
|
|
67
|
+
|
|
68
|
+
The existing `agentgather room serve` process remains the authority. It validates
|
|
69
|
+
participant bearer tokens, derives sender identity from token ownership, applies
|
|
70
|
+
loop guards, stores messages, and emits `/wait` responses.
|
|
71
|
+
|
|
72
|
+
For a managed tunnel, the room server should run locally:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
agentgather room serve --port 8787
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The public URL is supplied by the tunnel client once it is connected:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
agentgather tunnel run --room current --broker https://rooms.agentgather.dev --subdomain room-slug
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The tunnel client updates the local current room URL to
|
|
85
|
+
`https://rooms.agentgather.dev/room-slug` only after the broker confirms the route.
|
|
86
|
+
Invite cards generated before that point may still contain localhost URLs.
|
|
87
|
+
|
|
88
|
+
### Host Tunnel Client
|
|
89
|
+
|
|
90
|
+
The host tunnel client opens an outbound host-attended connection to the broker.
|
|
91
|
+
The host does not need an inbound public port.
|
|
92
|
+
|
|
93
|
+
Responsibilities:
|
|
94
|
+
|
|
95
|
+
- register the host route and receive broker-minted route identifiers
|
|
96
|
+
- register desired room slug and local target URL
|
|
97
|
+
- maintain heartbeat and fail cleanly when the route or broker is unavailable
|
|
98
|
+
- multiplex HTTP requests from broker to local `room serve`
|
|
99
|
+
- close the route when the room closes or the process exits
|
|
100
|
+
- redact credentials from local diagnostic output
|
|
101
|
+
|
|
102
|
+
The host connection identifier is distinct from participant tokens. It
|
|
103
|
+
authorizes routing control for one host room; it does not authorize posting
|
|
104
|
+
messages. Production host authentication is a later hardening gate.
|
|
105
|
+
|
|
106
|
+
### Tunnel Broker
|
|
107
|
+
|
|
108
|
+
The broker is the data plane for `rooms.agentgather.dev`.
|
|
109
|
+
|
|
110
|
+
Responsibilities:
|
|
111
|
+
|
|
112
|
+
- terminate public HTTPS
|
|
113
|
+
- map `room-slug` to a live host tunnel connection
|
|
114
|
+
- forward supported HTTP requests to the host
|
|
115
|
+
- preserve method, path, headers required by the room API, and body
|
|
116
|
+
- stream long-poll `/wait` responses without buffering them to completion
|
|
117
|
+
- enforce broker-layer resource limits
|
|
118
|
+
- redact sensitive data from all logs and metrics
|
|
119
|
+
|
|
120
|
+
The broker may keep ephemeral route metadata:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"room_slug": "room-slug",
|
|
125
|
+
"route_id": "rte_...",
|
|
126
|
+
"host_connection_id": "conn_...",
|
|
127
|
+
"created_at": "2026-06-22T00:00:00.000Z",
|
|
128
|
+
"last_seen_at": "2026-06-22T00:00:10.000Z",
|
|
129
|
+
"expires_at": "2026-06-22T08:00:00.000Z",
|
|
130
|
+
"status": "connected"
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The broker must not store:
|
|
135
|
+
|
|
136
|
+
- participant bearer tokens
|
|
137
|
+
- host tunnel secrets after hashing
|
|
138
|
+
- message bodies
|
|
139
|
+
- Room Brief bodies
|
|
140
|
+
- response bodies
|
|
141
|
+
- canonical room history
|
|
142
|
+
|
|
143
|
+
### Control Plane
|
|
144
|
+
|
|
145
|
+
The control plane can live on Vercel because it does not need to hold host tunnel
|
|
146
|
+
connections.
|
|
147
|
+
|
|
148
|
+
Responsibilities:
|
|
149
|
+
|
|
150
|
+
- public landing/docs for `agentgather.dev`
|
|
151
|
+
- account/project setup later, if needed
|
|
152
|
+
- route reservation UI/API later, if needed
|
|
153
|
+
- billing/metering dashboard later, if needed
|
|
154
|
+
- operator-facing tunnel setup instructions
|
|
155
|
+
|
|
156
|
+
The control plane may store route metadata and billing counters after an
|
|
157
|
+
operator gate. It still must not store room history.
|
|
158
|
+
|
|
159
|
+
## Why Not Vercel As The Broker
|
|
160
|
+
|
|
161
|
+
Vercel is useful for domains, static pages, route setup UX, and ordinary request
|
|
162
|
+
handling. It is not the right first broker because the Agent Gather tunnel data
|
|
163
|
+
plane needs long-lived host connections and request multiplexing. Official
|
|
164
|
+
Vercel documentation for WebSocket-style realtime use points readers toward
|
|
165
|
+
dedicated realtime providers. The safer v0.1 architecture is to keep Vercel out
|
|
166
|
+
of the tunnel data path and use it only for the control surface.
|
|
167
|
+
|
|
168
|
+
Vercel rewrites can proxy to external origins, but they do not solve dynamic
|
|
169
|
+
host tunnel registration by themselves. Rewrites are better treated as a future
|
|
170
|
+
control-plane convenience, not the core tunnel mechanism.
|
|
171
|
+
|
|
172
|
+
## Request Behavior Through The Tunnel
|
|
173
|
+
|
|
174
|
+
All participant identity stays enforced by the host room server. The broker
|
|
175
|
+
does not parse participant tokens except to redact them from logs.
|
|
176
|
+
|
|
177
|
+
| Method | Path | Tunnel behavior |
|
|
178
|
+
| --- | --- | --- |
|
|
179
|
+
| `GET` | `/` | Forward to host; browser shell is served by host room server. |
|
|
180
|
+
| `GET` | `/room.css` | Forward to host; cache only if cache key excludes credentials and no query values are logged. |
|
|
181
|
+
| `GET` | `/room.js` | Forward to host; same cache rule as CSS. |
|
|
182
|
+
| `GET` | `/brief` | Forward with `Authorization`; do not log response body. |
|
|
183
|
+
| `POST` | `/brief` | Forward with body; host enforces host-only auth and body limit. |
|
|
184
|
+
| `POST` | `/attendance` | Forward body; host enforces host-only auth; broker records status-only metrics. |
|
|
185
|
+
| `GET` | `/status` | Forward with `Authorization`; broker may derive coarse availability metrics from status code only. |
|
|
186
|
+
| `GET` | `/messages` | Forward with `Authorization`; do not log message bodies or query values. |
|
|
187
|
+
| `POST` | `/messages` | Forward body; host derives `from` from bearer token. |
|
|
188
|
+
| `GET` | `/wait` | Forward and stream/hold response; support at least the host server hold window plus margin. |
|
|
189
|
+
| `GET` | `/card` | Forward query-token onboarding request; redact full query string. |
|
|
190
|
+
| `GET` | `/profile` | Forward with `Authorization`; do not log display names unless explicitly configured later. |
|
|
191
|
+
| `POST` | `/profile` | Forward body; do not log display names. |
|
|
192
|
+
| `POST` | `/join` | Forward; notify broker metrics by status only. |
|
|
193
|
+
| `POST` | `/leave` | Forward; broker may close participant-side connection after response. |
|
|
194
|
+
| `POST` | `/close` | Forward; if host confirms close, broker should mark route closing and release held requests. |
|
|
195
|
+
|
|
196
|
+
Unsupported paths return `404` from the host or broker without leaking route
|
|
197
|
+
metadata.
|
|
198
|
+
|
|
199
|
+
## Logging And Privacy
|
|
200
|
+
|
|
201
|
+
Tunnel-layer logs must be deny-by-default.
|
|
202
|
+
|
|
203
|
+
Never log:
|
|
204
|
+
|
|
205
|
+
- `Authorization` headers
|
|
206
|
+
- `Cookie` headers
|
|
207
|
+
- URL query strings or query values
|
|
208
|
+
- `/card?participant=...&token=...` URLs
|
|
209
|
+
- request bodies
|
|
210
|
+
- response bodies
|
|
211
|
+
- message text
|
|
212
|
+
- Room Brief text
|
|
213
|
+
- raw participant tokens
|
|
214
|
+
- raw host route identifiers
|
|
215
|
+
|
|
216
|
+
Allowed structured fields:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"route_hash": "sha256(room_slug + server_secret)",
|
|
221
|
+
"method": "GET",
|
|
222
|
+
"path_class": "/messages",
|
|
223
|
+
"status": 200,
|
|
224
|
+
"duration_ms": 42,
|
|
225
|
+
"bytes_in": 0,
|
|
226
|
+
"bytes_out": 1024,
|
|
227
|
+
"wait_held_ms": 25000
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
For errors, log stable error codes, not raw request details.
|
|
232
|
+
|
|
233
|
+
## Resource Limits
|
|
234
|
+
|
|
235
|
+
Initial defaults for a prototype:
|
|
236
|
+
|
|
237
|
+
| Limit | Default | Reason |
|
|
238
|
+
| --- | ---: | --- |
|
|
239
|
+
| Host tunnel connections per route | 1 | One host owns the room. |
|
|
240
|
+
| Concurrent remote requests per route | 64 | Prevent one room from exhausting broker workers. |
|
|
241
|
+
| Concurrent `/wait` requests per route | 32 | Long-poll waiters are the expensive path. |
|
|
242
|
+
| Maximum request body | 64 KB | Matches the host server default. |
|
|
243
|
+
| Maximum forwarded response body | 1 MB | Room APIs should be small; export should stay local for now. |
|
|
244
|
+
| Broker idle timeout | 15 minutes | Close abandoned routes. |
|
|
245
|
+
| Maximum route lifetime | 8 hours | Temporary-room product shape. |
|
|
246
|
+
| Per-IP unauthenticated rate | 60 requests/minute | Protect invite/card/status discovery. |
|
|
247
|
+
| Per-route aggregate rate | 600 requests/minute | Early abuse guard. |
|
|
248
|
+
|
|
249
|
+
The host room server remains the source of truth for participant rate limits and
|
|
250
|
+
loop guards. Broker limits are outer protection only.
|
|
251
|
+
|
|
252
|
+
## Operator Gates
|
|
253
|
+
|
|
254
|
+
Can be implemented before operator credentials:
|
|
255
|
+
|
|
256
|
+
- local broker prototype bound to localhost
|
|
257
|
+
- host tunnel client that connects to localhost broker
|
|
258
|
+
- route registration protocol and tests
|
|
259
|
+
- redaction tests
|
|
260
|
+
- request forwarding tests for every room endpoint
|
|
261
|
+
- docs and runbooks
|
|
262
|
+
|
|
263
|
+
Cleared for staging:
|
|
264
|
+
|
|
265
|
+
- `rooms.agentgather.dev` DNS A/AAAA records
|
|
266
|
+
- public TLS through Caddy
|
|
267
|
+
- persistent broker infrastructure on `agentgather-broker-01`
|
|
268
|
+
- first-class `agentgather broker serve` systemd deployment
|
|
269
|
+
- staging smoke with curl agent and browser human participants
|
|
270
|
+
|
|
271
|
+
Still blocked by operator gate:
|
|
272
|
+
|
|
273
|
+
- Vercel project creation or linking
|
|
274
|
+
- production/public availability policy
|
|
275
|
+
- authenticated host registration hardening
|
|
276
|
+
- paid tunnel provider setup
|
|
277
|
+
- x402 payment configuration
|
|
278
|
+
- public pricing/free-quota policy
|
|
279
|
+
- npm publish that advertises managed tunnel routing
|
|
280
|
+
|
|
281
|
+
## Implementation Ticket Breakdown
|
|
282
|
+
|
|
283
|
+
1. **Tunnel protocol spike**
|
|
284
|
+
- Add a local-only broker test harness.
|
|
285
|
+
- Define host registration, route heartbeat, request envelope, response
|
|
286
|
+
envelope, and close frames.
|
|
287
|
+
- Acceptance: no public network or credentials required.
|
|
288
|
+
|
|
289
|
+
2. **Host tunnel client**
|
|
290
|
+
- Add `agentgather tunnel run --room current --broker <url> --subdomain <slug>`.
|
|
291
|
+
- Maintain outbound relay and update current room URL after registration.
|
|
292
|
+
- Acceptance: local broker can reach existing `room serve`.
|
|
293
|
+
|
|
294
|
+
3. **Broker forwarding core**
|
|
295
|
+
- Forward the endpoint matrix in this document.
|
|
296
|
+
- Stream `/wait` without buffering and enforce resource limits.
|
|
297
|
+
- Acceptance: integration tests cover `/`, assets, `/brief`,
|
|
298
|
+
`/attendance`, `/status`, `/messages`, `/wait`, `/card`, `/profile`,
|
|
299
|
+
`/join`, `/leave`, and `/close`.
|
|
300
|
+
|
|
301
|
+
4. **Redaction and abuse controls**
|
|
302
|
+
- Add structured logging with sensitive-field redaction tests.
|
|
303
|
+
- Add request body, waiter, route, idle, and rate limits.
|
|
304
|
+
- Acceptance: tests prove `Authorization`, query values, and bodies never
|
|
305
|
+
appear in logs.
|
|
306
|
+
|
|
307
|
+
5. **Operator deployment guide**
|
|
308
|
+
- Document DNS, TLS, broker deployment, Vercel control plane, rollback, and
|
|
309
|
+
route shutdown.
|
|
310
|
+
- Acceptance: no step requires hidden assumptions; all credential actions are
|
|
311
|
+
marked operator gates.
|
|
312
|
+
- Current guide: `docs/agentgather-dev-deployment-guide.md`.
|
|
313
|
+
|
|
314
|
+
6. **Metering and x402 research**
|
|
315
|
+
- Define usage counters, free quota units, spending caps, and payment prompts.
|
|
316
|
+
- Keep disabled by default.
|
|
317
|
+
- Acceptance: no automatic payment path exists without explicit operator
|
|
318
|
+
configuration.
|
|
319
|
+
|
|
320
|
+
## Business Model Boundary
|
|
321
|
+
|
|
322
|
+
The monetized product, if any, is optional HTTPS tunnel routing:
|
|
323
|
+
|
|
324
|
+
```text
|
|
325
|
+
local rooms = free and independent
|
|
326
|
+
managed tunnel routing = optional paid convenience
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Useful free-quota counters:
|
|
330
|
+
|
|
331
|
+
- route minutes
|
|
332
|
+
- forwarded requests
|
|
333
|
+
- forwarded bytes
|
|
334
|
+
- concurrent remote participants
|
|
335
|
+
- `/wait` held seconds
|
|
336
|
+
|
|
337
|
+
x402 may be useful later for agent-addressable pay-as-you-go routing, but only
|
|
338
|
+
with explicit daily caps, per-request caps, and confirmation thresholds. Tunnel
|
|
339
|
+
fees must stay separate from any future paid-agent service.
|
|
340
|
+
|
|
341
|
+
## Source Links
|
|
342
|
+
|
|
343
|
+
Checked on 2026-06-22:
|
|
344
|
+
|
|
345
|
+
- Vercel WebSocket support for Functions: https://vercel.com/kb/guide/do-vercel-serverless-functions-support-websocket-connections
|
|
346
|
+
- Vercel rewrites: https://vercel.com/docs/routing/rewrites
|
|
347
|
+
- Vercel reverse proxy rewrites: https://vercel.com/kb/guide/vercel-reverse-proxy-rewrites-external
|
|
348
|
+
- Vercel custom domains: https://vercel.com/docs/domains/working-with-domains/add-a-domain
|
|
349
|
+
- Vercel DNS records: https://vercel.com/docs/domains/managing-dns-records
|