Skip to content

feat(plugin): add onStreamChunk hook for plugin-level SSE streaming support#78

Merged
weiesky merged 1 commit intoweiesky:mainfrom
Majorshi:feat/stream-chunk-hook
Apr 30, 2026
Merged

feat(plugin): add onStreamChunk hook for plugin-level SSE streaming support#78
weiesky merged 1 commit intoweiesky:mainfrom
Majorshi:feat/stream-chunk-hook

Conversation

@Majorshi
Copy link
Copy Markdown
Contributor

Summary

  • Add onStreamChunk parallel hook to plugin system, fired during /api/stream-chunk processing
  • Enables plugins to receive real-time streaming content blocks from Claude Code API responses
  • Used by the http-api plugin to implement GET /api/plugin/stream SSE endpoint for remote streaming

Changes

  • lib/plugin-loader.js: Add onStreamChunk: 'parallel' to HOOK_TYPES (+1 line)
  • server.js: Call runParallelHook('onStreamChunk', payload) after sendEventToClients('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 via onNewEntry, missing real-time streaming chunks.

…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>
@weiesky weiesky merged commit 101287e into weiesky:main Apr 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants