Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@suaveplan/api-sse - Abstract Server-Sent Events contracts for @suaveplan/api: SseConnection, SseBroker, SseEvent (Zod), ReplayBuffer with Last-Event-Id resume, SseConnectionRegistry, SSE_CODES, and runSseEngineConformance harness. Concrete engines plug behind these contracts.
Abstract Server-Sent Events contracts for @suaveplan/api. Stage-1 contract package: defines the engine-side SseConnection, SseBroker, ReplayBuffer (Last-Event-Id resume), SseConnectionRegistry, the SSE_CODES error registry, and the runSseEngineConformance harness every concrete engine must pass.
This package ships no concrete engine — @suaveplan/api-sse-bun (and other transports) land at and plug behind these contracts.
Documentation tree
- broker —
SseBrokeris the engine-side publish / subscribe surface for Server-Sent Events. It mirrors the shape of `@suaveplan/…- broker —
SseBrokeris the engine-side publish / subscribe surface for Server-Sent Events. It mirrors the shape of `@suaveplan/…
- broker —
- capability-id — The
"sse"CapabilityIdslot connects this package to the host'sCapabilityMap. Plugin authors declare `requires:…- capability-id — The
"sse"CapabilityIdslot connects this package to the host'sCapabilityMap. Plugin authors declare `requires:…
- capability-id — The
- connection —
SseConnectionis the engine-side contract for a single Server-Sent-Events stream. Concrete engines (api-sse-bun, `a…- connection —
SseConnectionis the engine-side contract for a single Server-Sent-Events stream. Concrete engines (api-sse-bun, `a…
- connection —
- connection-registry —
SseConnectionRegistryis the multi-index registry for active SSE connections. Engines calladdon handshake, `remov…- connection-registry —
SseConnectionRegistryis the multi-index registry for active SSE connections. Engines calladdon handshake, `remov…
- connection-registry —
- error-codes —
SSE_CODESis the stable error-code registry every contract-level failure path in the SSE family raises. Concrete engi…- error-codes —
SSE_CODESis the stable error-code registry every contract-level failure path in the SSE family raises. Concrete engi… - production-throws —
production-throwsexports the canonical factory functions that the host (and concrete SSE engines) invoke at every do…
- error-codes —
- event —
SseEventis the wire-shape contract for a single Server-Sent-Events field block:id, optionalevent,data, opti…- event —
SseEventis the wire-shape contract for a single Server-Sent-Events field block:id, optionalevent,data, opti…
- event —
- replay-buffer —
ReplayBufferis the per-(tenant, topic)ring buffer that powers theLast-Event-Idresume contract. Concrete engin…- replay-buffer —
ReplayBufferis the per-(tenant, topic)ring buffer that powers theLast-Event-Idresume contract. Concrete engin…
- replay-buffer —
- testing —
runSseEngineConformanceis the reusable conformance harness every concrete@suaveplan/api-sseengine MUST pass. Eng…- conformance —
runSseEngineConformanceis the reusable conformance harness every concrete@suaveplan/api-sseengine MUST pass. Eng…
- conformance —
Install
bun add @suaveplan/api-sse
Quick start
import {
createReplayBuffer,
createConnectionRegistry,
SSE_CODES,
} from "@suaveplan/api-sse";
const buffer = createReplayBuffer({ eventBufferSize: 1024 });
const registry = createConnectionRegistry();
buffer.append({ id: "1", data: "hello" });
const since = buffer.since("0").length; // 0 (unknown ids throw SSE_CODES.LAST_EVENT_ID_UNKNOWN)
Modules
connection— engine-sideSseConnectioninterface.event—SseEventZod schema + interface.broker— engine-side publish / subscribe surface.replay-buffer— per-(tenant, topic) ring buffer poweringLast-Event-Idresume.connection-registry— multi-index registry for active connections.capability-id—"sse"slot in the host'sCapabilityMap.error-codes—SSE_CODESregistry +SseErrorclass.error-codes/production-throws— canonical throw-site factories.testing/conformance—runSseEngineConformanceharness.
Status
- Package:
@suaveplan/api-sse - Version:
0.1.0 - Stage: 1 of the API plugin system (contracts).
- Tier: universal — zero browser / Node-only deps; runs everywhere the host runs.