feat(plugin): add onStreamChunk hook for plugin-level SSE streaming support#78
Merged
weiesky merged 1 commit intoweiesky:mainfrom Apr 30, 2026
Merged
Conversation
…upport 新增 onStreamChunk parallel hook,在 /api/stream-chunk 处理流式块时触发, 使插件能够实时接收 Claude Code 的流式响应内容并转发给外部 SSE 客户端。 配合 ccv-remote 插件的 GET /api/plugin/stream SSE 端点,实现远端流式传输。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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
onStreamChunkparallel hook to plugin system, fired during/api/stream-chunkprocessingGET /api/plugin/streamSSE endpoint for remote streamingChanges
lib/plugin-loader.js: AddonStreamChunk: 'parallel'toHOOK_TYPES(+1 line)server.js: CallrunParallelHook('onStreamChunk', payload)aftersendEventToClients('stream-progress')(+3 lines)Use Case
The ccv-remote plugin uses this hook to build a dedicated SSE endpoint (
/api/plugin/stream) that streams Claude Code's output to remote consumers (e.g., openclaw → DingTalk). Previously, plugins could only detect completed entries viaonNewEntry, missing real-time streaming chunks.