@extenshi/mcp
Version:
Extenshi MCP server — bring the extension catalog (search, security, market research) and pre-publish scanning into your AI tools
28 lines • 1.17 kB
TypeScript
/**
* Minimal Server-Sent Events frame parser for the scan progress stream.
*
* Vendored from `@extenshi/cli` (tools/extenshi-cli/src/sse.ts) so this package
* stays a clean standalone npm publish with no cross-workspace dependency
* (npm rejects `workspace:*` at publish time — see scripts/publish.sh in the
* CLI). The scan backend emits `text/event-stream` with named events
* (`progress`, `result`, `error`) plus keep-alive comment frames (`:ping`).
*
* Pure (no I/O): feed it the accumulated buffer, get back the complete events
* plus the unconsumed tail to carry into the next chunk.
*/
export interface SseEvent {
/** The `event:` field value (defaults to "message" per the SSE spec). */
event: string;
/** The joined `data:` field value(s). */
data: string;
}
/**
* Split an accumulated SSE buffer into complete events. Frames are delimited by
* a blank line (`\n\n`); a partial trailing frame is returned as `rest`.
* Comment frames (lines starting with `:`) and dataless frames are skipped.
*/
export declare function parseSseFrames(buffer: string): {
events: SseEvent[];
rest: string;
};
//# sourceMappingURL=sse.d.ts.map