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:
+3
-3
@@ -391,7 +391,7 @@ func (a *Agent) handleTaskEvent(ctx context.Context, msg bus.AgentMessage) {
|
||||
}
|
||||
|
||||
// Send reply to Matrix room
|
||||
if sendErr := a.matrix.SendText(ctx, roomID, reply); sendErr != nil {
|
||||
if sendErr := a.matrix.SendMarkdown(ctx, roomID, reply); sendErr != nil {
|
||||
a.logger.Error("failed to send orchestrated reply to Matrix", "err", sendErr)
|
||||
}
|
||||
|
||||
@@ -453,13 +453,13 @@ func (a *Agent) handleEvent(ctx context.Context, msgCtx decision.MessageContext,
|
||||
if handler, ok := a.commands[cmdName]; ok {
|
||||
a.logger.Info("command_executed", "command", cmdName)
|
||||
reply := handler(ctx, msgCtx)
|
||||
_ = a.matrix.SendText(ctx, roomID, reply)
|
||||
_ = a.matrix.SendMarkdown(ctx, roomID, reply)
|
||||
return
|
||||
}
|
||||
|
||||
// Unknown command — never falls through to rules or LLM
|
||||
a.logger.Info("command_unknown", "command", msgCtx.Command)
|
||||
_ = a.matrix.SendText(ctx, roomID,
|
||||
_ = a.matrix.SendMarkdown(ctx, roomID,
|
||||
fmt.Sprintf("Comando desconocido: !%s. Usa !help para ver comandos disponibles.", msgCtx.Command))
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user