sessions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 2 Imported by: ? 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 sessions defines the versioned wire format used to mirror agent sessions.

Index

Constants

View Source
const (
	MaxBatchSessions = 1000
	MaxBatchTurns    = 10000
	MaxBatchBytes    = 1 << 20
)

Limits of one batch. The receiver refuses a request body over MaxBatchBytes, so a reporter splits its work to stay under all three.

View Source
const SchemaVersion = 1

SchemaVersion is the current wire schema version.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Schema   int       `json:"schema"`
	Sessions []Session `json:"sessions"`
	Turns    []Turn    `json:"turns"`
	Gap      bool      `json:"gap,omitempty"`
}

Batch contains sessions and turns sent together to the receiver.

func (Batch) Validate

func (b Batch) Validate() error

Validate checks schema, required fields, enums, and conservative wire limits.

type Session

type Session struct {
	ID               string    `json:"id"`
	Tool             string    `json:"tool"`
	ToolVersion      string    `json:"tool_version,omitempty"`
	ParentID         string    `json:"parent_id,omitempty"`
	JobID            string    `json:"job_id,omitempty"`
	WindowID         string    `json:"window_id,omitempty"`
	Workspace        string    `json:"workspace,omitempty"`
	Project          string    `json:"project,omitempty"`
	Repo             string    `json:"repo,omitempty"`
	Branch           string    `json:"branch,omitempty"`
	CWD              string    `json:"cwd,omitempty"`
	Title            string    `json:"title,omitempty"`
	Models           []string  `json:"models,omitempty"`
	Started          time.Time `json:"started,omitempty"`
	LastActivity     time.Time `json:"last_activity,omitempty"`
	Ended            time.Time `json:"ended,omitempty"`
	Status           string    `json:"status"`
	InputTokens      int64     `json:"input_tokens,omitempty"`
	OutputTokens     int64     `json:"output_tokens,omitempty"`
	CacheReadTokens  int64     `json:"cache_read_tokens,omitempty"`
	CacheWriteTokens int64     `json:"cache_write_tokens,omitempty"`
	ReasoningTokens  int64     `json:"reasoning_tokens,omitempty"`
	CostUSD          *float64  `json:"cost_usd,omitempty"`
	Level            string    `json:"level"`
	Schema           int       `json:"schema"`
}

Session describes one native agent session.

type ToolCall

type ToolCall struct {
	Name       string `json:"name"`
	Target     string `json:"target,omitempty"`
	Status     string `json:"status,omitempty"`
	DurationMS int64  `json:"duration_ms,omitempty"`
	OutputSize int64  `json:"output_size,omitempty"`
	Diff       string `json:"diff,omitempty"`
}

ToolCall describes a tool invocation without its output body.

type Turn

type Turn struct {
	SessionID        string     `json:"session_id"`
	Key              string     `json:"key"`
	Seq              int64      `json:"seq"`
	Role             string     `json:"role"`
	Time             time.Time  `json:"time,omitempty"`
	ObservedAt       time.Time  `json:"observed_at,omitempty"`
	Model            string     `json:"model,omitempty"`
	Text             string     `json:"text,omitempty"`
	ToolCalls        []ToolCall `json:"tool_calls,omitempty"`
	InputTokens      int64      `json:"input_tokens,omitempty"`
	OutputTokens     int64      `json:"output_tokens,omitempty"`
	CacheReadTokens  int64      `json:"cache_read_tokens,omitempty"`
	CacheWriteTokens int64      `json:"cache_write_tokens,omitempty"`
	ReasoningTokens  int64      `json:"reasoning_tokens,omitempty"`
	Event            string     `json:"event,omitempty"`
}

Turn is one ordered, idempotent record in a session.

Jump to

Keyboard shortcuts

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