feat: renderizar Markdown a HTML en mensajes Matrix con goldmark
Se reemplaza SendText por SendMarkdown en todos los puntos donde el agente envía respuestas: runtime.go (comandos built-in y tareas orquestadas), effects/runner.go (acciones Reply) y tools/matrix.go (matrix_send tool). shell/matrix/client.go ahora usa goldmark para convertir Markdown a HTML real en el campo FormattedBody del evento Matrix, cumpliendo con la spec de Matrix para mensajes formateados. El Body conserva el markdown raw como fallback. Se añade dependencia github.com/yuin/goldmark v1.7.16. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -9,6 +9,7 @@ import (
|
||||
// Satisfied by shell/matrix.Client.
|
||||
type MatrixSender interface {
|
||||
SendText(ctx context.Context, roomID, text string) error
|
||||
SendMarkdown(ctx context.Context, roomID, markdown string) error
|
||||
}
|
||||
|
||||
// NewMatrixSend creates a matrix_send tool that sends a message to a Matrix room.
|
||||
@@ -29,7 +30,7 @@ func NewMatrixSend(sender MatrixSender) Tool {
|
||||
return Result{Err: fmt.Errorf("matrix_send: room_id and message are required")}
|
||||
}
|
||||
|
||||
if err := sender.SendText(ctx, roomID, message); err != nil {
|
||||
if err := sender.SendMarkdown(ctx, roomID, message); err != nil {
|
||||
return Result{Err: fmt.Errorf("matrix_send: %w", err)}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user