messagecounts

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package messagecounts counts the messages of a Claude Code or Codex transcript the way the previous runtime's timeline/message-counts route did: user, assistant and tool messages, and the tools by name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedJsonl

func AllowedJsonl(home, p string) bool

AllowedJsonl: a .jsonl under Claude Code's projects or Codex's sessions in the home, the path resolved first.

Types

type Counts

type Counts struct {
	User, Assistant, Tool int
	Breakdown             *jsvalue.Object
}

Counts is the answer. Breakdown values are numbers, or strings where a tool is named after a property every JavaScript object inherits (the previous runtime added 1 to the inherited function).

func Zero

func Zero() Counts

Zero is the answer for a transcript that cannot be read.

func (Counts) Value

func (c Counts) Value() *jsvalue.Object

Value is the answer as the previous runtime wrote it.

type Route

type Route struct {
	// Home holds the transcripts the route may read (.claude/projects and .codex/sessions under it).
	Home string
	// Authorized is the old API's own check: a page session or the cli-token.
	Authorized func(*http.Request) bool
	// contains filtered or unexported fields
}

Route answers GET /api/timeline/message-counts?jsonlPath=. A transcript only grows, so each file's count is kept with the offset it reached, and a request reads only what was appended since; a file that shrank, was replaced or whose start changed is counted again from the start.

func (*Route) Answer

func (rt *Route) Answer(r *http.Request) (int, any, http.Header)

Answer is the whole answer, refusals included.

func (*Route) Count

func (rt *Route) Count(path string) Counts

Count is the transcript's counts; zeros when it cannot be read.

Jump to

Keyboard shortcuts

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