chat

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package chat turns Claude Code's session transcript (the JSONL under ~/.claude/projects) into a clean, phone-friendly stream of chat events. cuxdeck collects nothing itself — Claude Code writes every line for --resume, so this is a pure read of data that already exists, live for the current session and complete for past ones.

The parser is intentionally forgiving: unknown block types degrade to a labelled marker, malformed lines are skipped, and the shapes it does not recognise never crash the stream. The transcript format belongs to Claude Code and grows freely.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Role   string `json:"role"`             // user | assistant | tool | task | ask | system | divider
	Kind   string `json:"kind,omitempty"`   // text | thinking | tool | image | model-switch | task-create | task-update | todos | question | answer | denied | interrupt
	Text   string `json:"text,omitempty"`   // bubble body / one-line tool summary
	Tool   string `json:"tool,omitempty"`   // tool name (Kind==tool) or task id (task events)
	Detail string `json:"detail,omitempty"` // secondary line (tool target, model names, options)
	Full   string `json:"full,omitempty"`   // expandable body (whole command, task prompt, result)
	ID     string `json:"id,omitempty"`     // tool_use id — pairs a result line with its call
	TS     string `json:"ts,omitempty"`     // when Claude Code recorded the line (RFC3339)
	Tokens int    `json:"tokens,omitempty"` // output tokens of the assistant message (first event only)
}

Event is one item in the chat view.

func Parse

func Parse(line []byte) []Event

Parse converts one transcript line into zero or more chat events. Returns nil for lines that carry nothing worth showing (tool-result echoes, system-wrapper prompts, empty blocks).

Jump to

Keyboard shortcuts

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