Skip to content

feat(stream): local SSE stream server#332

Merged
HugoRCD merged 7 commits intomainfrom
feat/stream
May 9, 2026
Merged

feat(stream): local SSE stream server#332
HugoRCD merged 7 commits intomainfrom
feat/stream

Conversation

@HugoRCD
Copy link
Copy Markdown
Owner

@HugoRCD HugoRCD commented May 9, 2026

Adds a local Server-Sent Events server that exposes the in-process evlog stream over HTTP. Strict opt-in — set evlog: { stream: true } on Nuxt or defineStreamedInstrumentation({ stream: true }) on Next.js. The mini-server runs on 127.0.0.1 on its own ephemeral port, prints the URL at startup, and writes it to .evlog/stream.url so external tools can discover it.

Local development and self-hosted only — does not work on serverless platforms.

Also restructures apps/docs/content/5.build-on-top/ around five axes (Sources / Pipeline / Sinks / Observers / Shared) plus four scenarios (local debug toolkit, tenant-aware logging, compliance audit, cross-app error vocab).

Doc: https://evlog.dev/build-on-top/overview

@vercel
Copy link
Copy Markdown

vercel Bot commented May 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, Comment, Open in v0 May 9, 2026 4:39pm
just-use-evlog Ready Ready Preview, Comment May 9, 2026 4:39pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

Unknown scope "stream" found in pull request title "feat(stream): local SSE stream server". Scope must match one of: docs, playground, evlog, core, bench, nuxthub, deps, repo, nuxt, nitro, next, tanstack-start, hono, express, elysia, fastify, nestjs, react-router, sveltekit, workers, fs, ai, dx.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

Benchmark report

Bundle size

Threshold: 5% · 🔴 larger · 🟡 warning · 🟢 smaller · ⚪ unchanged · 🆕 new

Status Entry Base (gzip) Current (gzip) Change Raw delta
🔴 core (index) 508 B 2.15 kB +334.3% +5.04 kB
🔴 adapter/fs 1.54 kB 3.35 kB +117.6% +6.32 kB
🔴 framework/next 4.23 kB 5.20 kB +23.1% +2.35 kB
🔴 toolkit 719 B 781 B +8.6% +171 B
framework/nitro 7.04 kB 7.16 kB +1.7% +442 B
adapter/better-stack 1.24 kB 1.26 kB +1.6% +65 B
http 1.22 kB 1.24 kB +1.4% +33 B
adapter/axiom 1.48 kB 1.50 kB +1.3% +58 B
adapter/posthog 1.45 kB 1.47 kB +1.2% +60 B
adapter/datadog 2.46 kB 2.48 kB +0.8% +60 B
adapter/otlp 2.12 kB 2.14 kB +0.8% +57 B
adapter/sentry 2.39 kB 2.40 kB +0.7% +59 B
framework/sveltekit 1.59 kB 1.59 kB +0.1% 0 B
framework/ai 4.67 kB 4.67 kB 0.0% 0 B
framework/vite 2.40 kB 2.40 kB 0.0% 0 B
enrichers 1.99 kB 1.99 kB 0.0% 0 B
utils 1.58 kB 1.58 kB 0.0% 0 B
error 1.57 kB 1.57 kB 0.0% 0 B
pipeline 1.35 kB 1.35 kB 0.0% 0 B
framework/elysia 1.33 kB 1.33 kB 0.0% 0 B
workers 1.30 kB 1.30 kB 0.0% 0 B
browser 289 B 289 B 0.0% 0 B
logger 229 B 229 B 0.0% 0 B
client 128 B 128 B 0.0% 0 B
types 31 B 31 B 0.0% 0 B
adapter/hyperdx 1.18 kB 1.18 kB -0.1% 0 B
framework/nestjs 1.26 kB 1.25 kB -0.2% 0 B
framework/hono 616 B 615 B -0.2% 0 B
framework/fastify 1.02 kB 1.02 kB -0.4% 0 B
framework/express 734 B 727 B -1.0% 0 B
🔴 Total 49.59 kB 54.33 kB +9.6% +14.70 kB

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 9, 2026

npm i https://pkg.pr.new/evlog@332
npm i https://pkg.pr.new/@evlog/nuxthub@332

commit: f9802ce

@HugoRCD HugoRCD changed the title feat(stream): in-process drain + SSE bridge with auto-dev mode feat(stream): mini stream server + framework-agnostic build-on-top docs May 9, 2026
@HugoRCD HugoRCD changed the title feat(stream): mini stream server + framework-agnostic build-on-top docs feat(stream): stream server + framework-agnostic build-on-top docs May 9, 2026
@HugoRCD HugoRCD changed the title feat(stream): stream server + framework-agnostic build-on-top docs feat(stream): stream server + framework-agnostic build-on-top May 9, 2026
@HugoRCD HugoRCD changed the title feat(stream): stream server + framework-agnostic build-on-top feat(stream): local SSE stream server May 9, 2026
- ::prompt copy-blocks (copy/cursor/windsurf actions) on 11 of 12 pages so
  users can paste an actionable instruction set into Cursor / Windsurf to wire
  the feature in their own app
- Reuse existing MDC animation components where they fit naturally:
  - lifecycle-flow on plugins
  - enricher-chain on custom-enrichers
  - tail-sample-decision on tail-sampling
  - drain-pipeline-batching on drain-pipeline
  - drain-fan-out on fanout-and-multi-drain
- Skip identity-headers (no actionable user-facing setup, headers are automatic)
Fix factual errors that misled readers because the doc had drifted from the
runtime, plus a round of cleanup from a full review of the consolidated PR.

Doc API alignment:
- 1.stream.md: events() takes no options (use recent() to seed history),
  default buffer is 500 (not 100), drop nonexistent onDrop / replay()
  members, auth uses Authorization: Bearer (not ?token=), hello payload is
  { evlogVersion, bufferSize, heartbeatMs }, heartbeat default 15s, SSE on
  root path (not /sse), filter option documented
- 4.pipeline-extension.md: import definePlugin from 'evlog' instead of a
  fictional 'evlog/toolkit' getGlobalPluginRunner().add() pattern; show the
  actual registration shapes per framework (initLogger plugins, middleware
  options, Nitro hooks); fix defineEnricher signature ({ name, field?, compute })
  and drop inline EvlogPlugin interface that drifted from source
- 5.sinks.md: createDrainPipeline takes one drain (fanout pattern is a
  Promise.allSettled wrapper inside it), maxBufferSize (not bufferSize),
  flush()/pending only (no dispose), rewrite onlyErrors to a clean
  (batch: DrainContext[]) helper
- 6.framework-integration.md: runEnrich/runEnrichAndDrain (not runEnrichers)
- 2.fs-reader.md: actual extension is .jsonl (NDJSON content)

Animations:
- NdjsonTail: surface file1Visible (was unused) and reflect actual .jsonl
  extension in the rendered file paths
- StreamBus, SseWire, NdjsonTail: replace magic timing offsets with named
  constants (FIRST_EMIT_DELAY_MS, EMIT_TO_BUS_MS, etc.)

Cleanup:
- Dedup serverless callout (overview links to stream page) and SSE
  discovery section (consumer-recipes links to stream page)
- Polish overview intro
- Playground stream.vue: link to consumer-recipes docs from the test surface
- Reformulate changeset opt-in note (server is always explicit, only the
  framework integrations gate behind stream:true)
- AGENTS.md: document the two animation families (roomy vs dense), the no
  viewport-shift rule, and final size target

Tests:
- Extract shared makeEvent / makeContext into test/helpers/events.ts
- Replace setTimeout(30) race in stream-server forward test with an event-
  driven barrier on the hello frame (new openSSE helper that exposes
  helloReceived and collectFor)

Local-only follow-up notes parked under .notes/ (gitignored).
@HugoRCD HugoRCD merged commit ced6eda into main May 9, 2026
14 of 15 checks passed
@HugoRCD HugoRCD deleted the feat/stream branch May 9, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant