Documentation
¶
Overview ¶
Package shots lists the pictures a Claude Code agent and its subagents looked at: the image files it Read, and the ones a tool such as a browser's screenshot saved. They come from the transcripts only (the main one and the subagents' beside it), read once from the tail and then by what each gained, as internal/sessionmeta does, so a busy agent's every write costs its new lines. The list holds paths the agent really touched and nothing else: a picture is served only by an id of this list, never by a path a caller names.
Index ¶
Constants ¶
const ( // Max is how many pictures the list holds. Max = 30 // MaxBytes is the largest picture served. MaxBytes = 12 << 20 )
const NamedMax = 12
NamedMax is how many pictures one text names, at most.
Variables ¶
var ErrNotServed = errors.New("shots: not served")
ErrNotServed is the answer for a picture that cannot be handed over: gone, not a plain file, too big, not a picture.
Functions ¶
func Allowed ¶
Allowed is the picture file a path names when it may be shown: an absolute path to an image by its name that, its links followed, is a plain non-empty file of at most MaxBytes inside one of the roots (the roots' own links followed too). It gives the real path and the file's stat; ok is false for anything else, a file that is not there included.
func ID ¶
ID is the id of a picture: its path and the time it was looked at, so a file written over again and read again is a new picture to a page that cached the old one.
func Named ¶
Named is the absolute paths of pictures a text names, in order, each once, exactly as the text writes them. A path inside a word or a link (https://host/a.png, ./a.png, ~/a.png) is not one.
func ScratchRoot ¶
func ScratchRoot() string
ScratchRoot is where Claude Code keeps the scratchpads of this user's sessions.
Types ¶
type File ¶
File is a picture opened to be served.
type Reader ¶
type Reader struct {
// Index, when set, reads what a transcript gains for the reader and for the transcript's other readers at once:
// the reader reads a transcript's tail itself and takes the lines after it from the index. nil has it read every
// transcript itself.
Index *transcriptindex.Index
// contains filtered or unexported fields
}
Reader keeps one cursor per transcript. Reads of one conversation take turns.
func (*Reader) Cursors ¶
Cursors is how many files (transcripts and their subagents') the reader keeps a cursor of.