feat(inbound): emit media in notification instead of appending footer
Channel plugins now have a structured way to propagate attachments — Plexum's host turns each MediaItem into a canonical.ImageBlock content on the user message. This replaces the F-6 workaround that crammed local file paths into a markdown footer at the end of the message text. internal/inbound/inbound.go: - Notifier signature gains `media []MediaItem`; MediaItem mirrors the host's channel.MediaRef (Path/MediaType/Name) - dispatch downloads attachments (unchanged) then forwards results as MediaItem to Notify — no more footer appending - dispatch now also receives guildEndpoint so it can resolve Fabric's RELATIVE attachment URLs (`/api/files/<id>`) against the guild base. Previously the downloader received the relative path verbatim and failed every fetch silently. cmd/plexum-fabric-channel-plugin/main.go: - notifier closure pushes media[] in the EmitNotification payload Live verified: alice uploads blue 32x32 PNG → Fabric guild → plugin downloads to /tmp/plexum-fabric/<msg>/blue32.png → emits inbound with media → host routes to kimi agent → Kimi: "Blue". (MiniMax M2.7 is text-only per openclaw model definitions, so the same flow against MiniMax returns "I don't see an image" — that's a model capability limit, not a plugin issue.) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -201,12 +201,24 @@ func (p *fabricPlugin) Init(ctx context.Context, host plugin.HostAPI) error {
|
||||
ctxBg, cancel := context.WithCancel(context.Background())
|
||||
p.inboundCancel = cancel
|
||||
p.inboundDone = make(chan struct{})
|
||||
notifier := func(channelName, message, sessionID string) {
|
||||
p.host.EmitNotification("notifications/plexum/channel/inbound", map[string]any{
|
||||
notifier := func(channelName, message, sessionID string, media []inbound.MediaItem) {
|
||||
payload := map[string]any{
|
||||
"channel_name": channelName,
|
||||
"message": message,
|
||||
"session_id": sessionID,
|
||||
})
|
||||
}
|
||||
if len(media) > 0 {
|
||||
mediaWire := make([]map[string]any, 0, len(media))
|
||||
for _, m := range media {
|
||||
mediaWire = append(mediaWire, map[string]any{
|
||||
"path": m.Path,
|
||||
"media_type": m.MediaType,
|
||||
"name": m.Name,
|
||||
})
|
||||
}
|
||||
payload["media"] = mediaWire
|
||||
}
|
||||
p.host.EmitNotification("notifications/plexum/channel/inbound", payload)
|
||||
}
|
||||
// slog wrapping plugin.HostAPI.Log isn't worth the indirection
|
||||
// here; use a discard-style adapter that pipes WARN/INFO to
|
||||
|
||||
Reference in New Issue
Block a user