Documentation
¶
Overview ¶
Ports packages/coding-agent/src/core/export-html/ansi-to-html.ts
Package export provides HTML session export.
Ports packages/coding-agent/src/core/export-html/index.ts using embedded pinned templates and vendor assets.
Ports packages/coding-agent/src/core/export-html/tool-renderer.ts
Index ¶
- func ExportFromFile(inputPath, outputPath string) (string, error)
- func ExportFromFileWithTools(inputPath, outputPath string, tools []extension.RegisteredTool, cwd string) (string, error)
- func RenderCustomTools(data *SessionData, tools []extension.RegisteredTool, cwd string, width int)
- func ToHTML(data SessionData) string
- type SessionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportFromFile ¶
ExportFromFile reads a session JSONL file and writes the upstream-style HTML export.
func ExportFromFileWithTools ¶
func ExportFromFileWithTools(inputPath, outputPath string, tools []extension.RegisteredTool, cwd string) (string, error)
ExportFromFileWithTools is ExportFromFile with the session's registered tools drawing their calls and results through their renderers, as upstream AgentSession.exportToHtml passes a tool renderer.
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 Pi's self-contained HTML, with a base64 JSON.stringify payload and first-match template substitution.
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.