docs: drop ring buffer mentions from ws spec and plan

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
tao.chen
2026-07-03 14:12:35 +08:00
co-authored by Claude
parent 4a4028486c
commit 0cfe8955a4
2 changed files with 11 additions and 15 deletions
@@ -25,9 +25,9 @@ path.
directions are text frames carrying raw bytes (UTF-8). We do not use a
custom envelope or JSON framing in v1.
- Backend process model gets two new responsibilities: capture child
stdout/stderr into an in-memory ring buffer plus a list of subscriber
channels, and accept stdin writes. This stays inside `internal/process`;
the API layer is a thin WebSocket adapter.
stdout/stderr into a list of subscriber channels, and accept stdin
writes. This stays inside `internal/process`; the API layer is a thin
WebSocket adapter.
- The existing `Manager` interface grows one method: `Subscribe(workspaceID)
(Subscription, error)`. We also add an `Input` accessor on the service
layer for stdin. The surface stays small.
@@ -61,14 +61,13 @@ path.
Buffered to a small constant (e.g. 32) to avoid blocking the producer.
- `Close() error` — drops the subscription. Idempotent.
- `LocalManager` keeps per-session:
- a `bytes.Buffer` of recent output (cap, e.g. 64 KiB) for any future
replay — implemented but **not exposed in v1**.
- a `[]chan []byte` of subscribers, guarded by `sync.Mutex`.
- a `map[Subscription]struct{}` of subscribers, guarded by `sync.Mutex`.
- a `io.WriteCloser` for stdin (created via `cmd.Stdin = ...`).
- On `Start`, set `cmd.Stdout` and `cmd.Stderr` to a pipe. A new goroutine
per session reads from the pipe, writes to the ring buffer, and fans out
to every subscriber channel. A non-blocking send (`select` with
`default`) drops output for slow clients. A 4 KiB read buffer is fine.
per session reads from the pipe and fans out to every subscriber channel.
A non-blocking send (`select` with `default`) drops output for slow
clients. A 4 KiB read buffer is fine. Replay of past output is **not** in
v1; a future task can add a ring buffer behind a separate accessor.
- `Wait()` is called in a separate goroutine; on exit, the manager closes
all subscriber channels and stores the exit status on the session.
@@ -196,9 +195,6 @@ path.
- The `Subscription` type and the `Input` writer are the two new
capabilities the manager must grow. They are small and orthogonal.
- The ring buffer for replay is implemented but unused in v1. This is
dead weight. **Defer**: the spec keeps it for symmetry with future
replay work. Plan may drop it if not needed.
- The exit banner format (`\r\n[process exited with code N]\r\n`) is a
simple, debuggable string. We are not building a structured protocol.
- All v1 design decisions aim to keep the backend diff small, the