exporthtml

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnsiLinesToHTML

func AnsiLinesToHTML(lines []string) string

AnsiLinesToHTML converts ANSI-escaped lines to HTML, one div per line.

func AnsiToHTML

func AnsiToHTML(text string) string

AnsiToHTML converts ANSI-escaped text to HTML with inline styles.

func ExportFromFile

func ExportFromFile(inputPath string, options Options) (string, error)

ExportFromFile exports an existing session file without runtime state.

func ExportMarkdownFromFile

func ExportMarkdownFromFile(inputPath, outputPath string) (string, error)

func ExportSession

func ExportSession(manager *session.SessionManager, options Options) (string, error)

ExportSession writes a self-contained HTML view of a persisted session.

func ExportSessionMarkdown

func ExportSessionMarkdown(manager *session.SessionManager, outputPath string) (string, error)

ExportSessionMarkdown writes the active session branch as portable Markdown.

Types

type Options

type Options struct {
	OutputPath   string
	ThemeName    string
	SystemPrompt *string
	Tools        json.RawMessage
	ToolRenderer ToolHTMLRenderer
	Theme        *modetheme.Theme
}

type ParsedSkillBlock

type ParsedSkillBlock struct {
	Name        string
	Location    string
	Content     string
	UserMessage string
}

ParsedSkillBlock is an upstream skill invocation embedded in a user message.

func ParseSkillBlock

func ParseSkillBlock(text string) (ParsedSkillBlock, bool)

ParseSkillBlock parses the exact upstream skill-message envelope.

type RenderedToolHTML

type RenderedToolHTML struct {
	CallHTML            *string `json:"callHtml,omitempty"`
	ResultHTMLCollapsed *string `json:"resultHtmlCollapsed,omitempty"`
	ResultHTMLExpanded  *string `json:"resultHtmlExpanded,omitempty"`
}

RenderedToolHTML is the custom-tool HTML envelope consumed by the embedded upstream renderer. Pointer fields preserve optional property semantics.

type ToolHTMLRenderResult

type ToolHTMLRenderResult struct {
	Collapsed *string
	Expanded  *string
}

ToolHTMLRenderResult is the optional collapsed/expanded HTML returned for a custom tool result.

type ToolHTMLRenderer

type ToolHTMLRenderer interface {
	RenderCall(toolCallID, toolName string, arguments any) *string
	RenderResult(toolCallID, toolName string, content, details any, isError bool) *ToolHTMLRenderResult
}

ToolHTMLRenderer pre-renders custom tool calls and results for live exports. NewToolHTMLRenderer adapts registered TUI tool renderers to this seam, matching upstream createToolHtmlRenderer and its ANSI-to-HTML conversion.

func NewToolHTMLRenderer

func NewToolHTMLRenderer(deps ToolHTMLRendererDeps) ToolHTMLRenderer

NewToolHTMLRenderer creates the live-export ToolHTMLRenderer over the registered tool definitions (upstream createToolHtmlRenderer).

type ToolHTMLRendererDeps

type ToolHTMLRendererDeps struct {
	// GetToolDefinition looks up a tool definition by name.
	GetToolDefinition func(name string) *extensions.ToolDefinition
	// Theme styles the renders.
	Theme extensions.Theme
	// CWD is the working directory for the render context.
	CWD string
	// Width is the terminal width for rendering (default 100).
	Width int
}

ToolHTMLRendererDeps configures NewToolHTMLRenderer.

Jump to

Keyboard shortcuts

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