export

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package export provides HTML session export.

Ports upstream export-html/ (index.ts + templates + vendor assets) using embedded upstream template files and pig session-data serialization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportFromFile

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

ExportFromFile reads a session JSONL file and writes the upstream-style HTML export.

func RenderCustomTools

func RenderCustomTools(data *SessionData, tools []extension.RegisteredTool, cwd string, width int)

func ToHTML

func ToHTML(data SessionData) string

ToHTML converts session data to the upstream-style self-contained SPA HTML.

Types

type SessionData

type SessionData struct {
	Header        json.RawMessage           `json:"header"`
	Entries       []json.RawMessage         `json:"entries"`
	LeafID        *string                   `json:"leafId"`
	SystemPrompt  string                    `json:"systemPrompt,omitempty"`
	Tools         []map[string]any          `json:"tools,omitempty"`
	RenderedTools map[string]map[string]any `json:"renderedTools,omitempty"`
}

SessionData mirrors upstream export-html's payload shape. Header and Entries use json.RawMessage to preserve the original JSONL key ordering. Go's map[string]any sorts keys alphabetically on Marshal, but upstream JS preserves insertion order. Using RawMessage ensures the base64-encoded session data in the HTML is byte-identical to upstream.

func FromJSONL

func FromJSONL(data []byte) (SessionData, error)

FromJSONL converts raw session JSONL bytes into export SessionData. Uses json.RawMessage to preserve the original key ordering from the JSONL.

Jump to

Keyboard shortcuts

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