feat(cockpit/web): scaffold S3 web cockpit renderer — Hono server, SSE, transcript reducer, chat UI#6
Open
TSchonleber wants to merge 1 commit into
Conversation
…E, transcript reducer, chat UI - auth.ts: loopback-only random token generation + timing-safe verification - server.ts: Hono app factory with GET /events (SSE), POST /input, POST /commands/:slash - transcript-reducer.ts: renderer-agnostic pure state machine consuming CockpitEvent - sse-client.ts: fetch-based SSE consumer with custom header support - ui/index.html: chat-first layout with transcript, subagent tabs, systems drawer, skills feed - ui/app.ts: typed entry point for future Vite bundling - index.ts: re-exports all new modules - 35 tests passing (auth, server contract, transcript reducer parity) Co-Authored-By: Terrence Schonleber <TVschonleber@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scaffolds the S3 web cockpit renderer as specified in §4/§7 of the cockpit design spec. Adds a real Hono-based server, SSE streaming, a renderer-agnostic transcript reducer, and a chat-first HTML UI — all consuming the pinned
CockpitEventschema fromsrc/cockpit/core.What's new
src/cockpit/web/auth.tsgenerateCockpitToken) + timing-safe verification viaX-Cockpit-Tokenheadersrc/cockpit/web/server.tsGET /events(SSE withX-Cockpit-Protocol: 1),POST /input,POST /commands/:slash— all behind token auth middlewaresrc/cockpit/web/transcript-reducer.tsreduceTranscriptEvent(state, event)handles all 14CockpitEventtypes. Ready for Ink parity testssrc/cockpit/web/sse-client.tsEventSourcecan't send headers)src/cockpit/web/ui/index.html/commandroutingsrc/cockpit/web/ui/app.tsServer contract
GET /events— SSE stream,X-Cockpit-Protocol: 1header, JSON-serializedCockpitEventperdata:framePOST /input—{ sessionId, text, metadata? }→ChatController.submit()POST /commands/:slash—{ sessionId, args? }→ChatController.slash()X-Cockpit-Tokenheader (random 32-byte hex, timing-safe comparison)Dependencies
hono^4.12.15 (was already a transitive dep via@modelcontextprotocol/sdk)Test coverage (35 tests passing)
S1 dependencies still stubbed
ChatController— server accepts it as an interface; no implementation yet (S1 delivers this)EventBus— works end-to-end for SSE streaming; no persistent transcript store yetstrand devintegration yet — server factory is ready to mountReview & Testing Checklist for Human
pnpm typecheck && pnpm lint && pnpm test -- tests/cockpit/all passtranscript-reducer.ts— this is the parity-critical piece shared between renderers. Confirm the state shape covers your expected Ink parity test contractserver.tstoken auth middleware — confirm loopback-only + random token design matches your security intent from §4Notes
src/cockpit/core/events.ts) was NOT modified — all types consumed as-issrc/cockpit/web/per write scope, but it's renderer-agnostic and can be promoted tosrc/cockpit/core/for Ink parity (S5's call)ui/index.htmlinline<script>is intentionally a quick bootstrap; the typedapp.ts+sse-client.tsare the real client-side modules for Vite bundlingLink to Devin session: https://app.devin.ai/sessions/6b21ab54f260444d96838afc6007c634
Requested by: @TSchonleber