Files
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

29 lines
1.4 KiB
Markdown

# streamgo (github.com/tutti-os/tutti/packages/events/stream-go)
Catalog-agnostic **server-side** core for the business event stream
(daemon ↔ renderer over WebSocket). The Go counterpart to
`@tutti-os/event-stream-core`.
It owns the in-memory pub/sub registry, scope routing and session fan-out:
- `Service[S comparable]` — sessions, subscriptions, scoped publish/fan-out
- `Session[S]` — per-connection outbound event channel
- the catalog **contract** (`Catalog`, `Direction`, `ValidationError`, …)
Each Session has a bounded queue sized to absorb normal local producer bursts.
The registry never blocks a business producer on a slow consumer and never
grows the queue without bound. If the queue fills, the Session is closed; the
product WebSocket adapter must surface that closure to its client so reconnect
and authoritative reconciliation can recover any missed optimistic events.
It is generic over the scope type `S` and depends only on an injected `Catalog`
(minimal: `TopicVersion` / `ValidatePublish` / `ValidateSubscription`) plus a
`ScopeNormalizer[S]`. It contains **no concrete topics**. Each product binds its
own scope and catalog:
- tutti workspace → `Service[EventScope]` where `EventScope = { WorkspaceID }`
- group chat → `Service[RoomScope]` where `RoomScope = { RoomID }`
The WS frame encode/decode (which is woven through the generated protocol types)
stays in each product's API layer and calls this registry.