feat(mcp): add ChannelPush IPC message + HandleIPCEvents
Services can now push channel events to Claude Code by sending a
ChannelPush message via Core IPC. The MCP service catches it in
HandleIPCEvents and calls ChannelSend to the stdio transport.
- ChannelPush{Channel, Data} message type in subsystem.go
- HandleIPCEvents on Service catches ChannelPush → ChannelSend
- Enables runner→mcp→Claude Code notification pipeline
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
c68698fc5c
commit
3ece6656d2
2 changed files with 21 additions and 2 deletions
|
|
@ -80,6 +80,18 @@ func (s *Service) OnStartup(ctx context.Context) core.Result {
|
|||
return core.Result{OK: true}
|
||||
}
|
||||
|
||||
// HandleIPCEvents implements Core's IPC handler interface.
|
||||
// Catches ChannelPush messages from other services and pushes them to Claude Code sessions.
|
||||
//
|
||||
// c.ACTION(mcp.ChannelPush{Channel: "agent.status", Data: statusMap})
|
||||
func (s *Service) HandleIPCEvents(c *core.Core, msg core.Message) core.Result {
|
||||
switch ev := msg.(type) {
|
||||
case ChannelPush:
|
||||
s.ChannelSend(context.Background(), ev.Channel, ev.Data)
|
||||
}
|
||||
return core.Result{OK: true}
|
||||
}
|
||||
|
||||
// OnShutdown implements core.Stoppable — stops the MCP transport.
|
||||
func (s *Service) OnShutdown(ctx context.Context) core.Result {
|
||||
if err := s.Shutdown(ctx); err != nil {
|
||||
|
|
|
|||
|
|
@ -38,8 +38,15 @@ type Notifier interface {
|
|||
ChannelSend(ctx context.Context, channel string, data any)
|
||||
}
|
||||
|
||||
// Compile-time assertion: *Service implements Notifier.
|
||||
var _ Notifier = (*Service)(nil)
|
||||
// ChannelPush is a Core IPC message that any service can send to push
|
||||
// a channel event to connected Claude Code sessions.
|
||||
// The MCP service catches this in HandleIPCEvents and calls ChannelSend.
|
||||
//
|
||||
// c.ACTION(mcp.ChannelPush{Channel: "agent.status", Data: map[string]any{"repo": "go-io"}})
|
||||
type ChannelPush struct {
|
||||
Channel string
|
||||
Data any
|
||||
}
|
||||
|
||||
// SubsystemWithNotifier extends Subsystem for those that emit channel events.
|
||||
// SetNotifier is called after New() before any tool calls.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue