connection binds the web transport: it injects httpServer + apiProxy and registers toFetchHandler(ctx.apiProxy) under the /api prefix (the node:http to fetch bridge moves in from the webserver, keeping the res-close disconnect detection and drain/close backpressure waits). hmr owns dev reload: a stat-poll watch per graph row driven by clientModuleHost.onGraphChanged, rebuilt(id) on content change, and the /plugins/events SSE route (GET/HEAD guarded); frame types are single-sourced in events.ts shared by both halves.
17 lines
693 B
TypeScript
17 lines
693 B
TypeScript
/**
|
|
* Wire protocol of the `/plugins/events` dev SSE channel — single source for
|
|
* both halves of this package. Frames still cross a wire boundary: the
|
|
* browser half validates them at its JSON parse point; sharing the type keeps
|
|
* the two ends from drifting, not from parsing.
|
|
*/
|
|
|
|
import type { WebBootGraph } from '@deepseek-ai/dsh-client-modules'
|
|
|
|
/** One SSE frame: the full graph on connect, or one rebuilt bundle notice. */
|
|
export type PluginsEventFrame =
|
|
| { type: 'graph'; graph: WebBootGraph }
|
|
| { type: 'rebuilt'; id: string; rev: string }
|
|
|
|
/** System SSE endpoint pushing graph/rebuilt frames (wire protocol constant). */
|
|
export const EVENTS_ENDPOINT = '/plugins/events'
|