output

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package output serializa snapshots de commits y renderiza conversaciones en los formatos que consumen humanos y agentes (llm, json, markdown).

Index

Constants

View Source
const (
	FormatLLM      = "llm"
	FormatJSON     = "json"
	FormatMarkdown = "markdown"
)

Formato de salida soportado.

Variables

This section is empty.

Functions

func BuildSnapshot

func BuildSnapshot(msgs []db.Message) (string, error)

BuildSnapshot serializa los mensajes a JSON para guardarlos inmutables en un commit.

func Render

func Render(doc Doc, format string) (string, error)

Render produce la representación de doc en el formato pedido.

Types

type Doc

type Doc struct {
	Title    string
	Source   string
	Date     time.Time
	Messages []SnapMessage
	Commit   *db.Commit
}

Doc es lo que se renderiza: metadata del chat, los mensajes y, opcionalmente, el commit que los respalda.

type SnapMessage

type SnapMessage struct {
	Role      string `json:"role"`
	Content   string `json:"content"`
	Timestamp int64  `json:"timestamp"`
	Seq       int64  `json:"seq"`
}

SnapMessage es un mensaje dentro del snapshot inmutable de un commit.

func ParseSnapshot

func ParseSnapshot(s string) ([]SnapMessage, error)

ParseSnapshot deserializa el snapshot JSON de un commit.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL