Skip to content

feat: add channel event notification system#398

Open
0xsline wants to merge 12 commits intojackwener:mainfrom
0xsline:feat/channel-notification
Open

feat: add channel event notification system#398
0xsline wants to merge 12 commits intojackwener:mainfrom
0xsline:feat/channel-notification

Conversation

@0xsline
Copy link
Contributor

@0xsline 0xsline commented Mar 24, 2026

Summary

  • Add Channel module (src/channel/) that pushes platform event notifications into active Claude Code sessions via MCP Channel protocol
  • Support two event source types: polling (periodic opencli command execution with diff detection) and webhook (HTTP POST receiver)
  • Register opencli channel start/status/stop subcommands

Features

  • Polling source: Wraps any opencli command as a periodic event source, detects new items via snapshot diffing
  • Webhook source: HTTP server on localhost accepting POST events with optional Bearer token auth
  • Event queue: Bounded (200 events) with dedup window (500 IDs) to prevent duplicate notifications
  • Single-instance lock: PID-based lock file with stale detection
  • Browser lock: Cross-process coordination between channel polling and interactive opencli usage
  • MCP Channel protocol: Declares claude/channel experimental capability, pushes via notifications/claude/channel

Usage

# 1. Configure ~/.opencli/channel.yaml
# 2. Register MCP server in ~/.claude.json
# 3. Launch: claude --dangerously-load-development-channels server:opencli-channel

See docs/advanced/channel.md for full documentation.

Test plan

  • Unit tests: EventQueue (6/6), PollingSource (7/7), WebhookSource (5/5)
  • E2E test: channel status lifecycle
  • TypeScript typecheck: zero errors
  • Manual test: webhook notification received in live Claude Code session
  • Manual test: v2ex/hot polling notifications received in live Claude Code session
9e337c482f6c0eadedbf05ccb764d5d9 6c21449db07443810f9f98488c93c2a1

@0xsline 0xsline force-pushed the feat/channel-notification branch from 884add3 to e24ebd0 Compare March 24, 2026 19:39
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.

1 participant