statusline

package
v0.16.521 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 19 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 statusline is the sink of Claude Code's status line: the platform's statusline script posts the JSON Claude gives it on every refresh, the sink keeps the subscription limits and the session's figures from it, and answers the line to show, which is the output of the person's own statusLine command when they have one.

Index

Constants

View Source
const (

	// DefaultTimeout is how long the person's command may run: the script's curl gives up after 2 s anyway.
	DefaultTimeout = 2 * time.Second
)

Variables

This section is empty.

Functions

func ReadBody

func ReadBody(r *http.Request) (any, int, string)

ReadBody reads a request body as the old API did before any handler: JSON (an empty one is {}), a form as an object, anything else as its text; 1 MB at most. A non-empty refusal is the plain-text answer to send instead.

Types

type Sink

type Sink struct {
	// Authorized is the old API's own check (a page session or the cli-token); TokenOK is the cli-token the handler
	// asks for besides.
	Authorized, TokenOK func(*http.Request) bool
	// Home is the person's home ($HOME in a command), ClaudeDir Claude Code's folder (its settings.json).
	Home, ClaudeDir string
	Limits          *limits.Cache
	Stats           *history.Stats
	// Ultracode says whether a session belongs to a tab whose remembered launch asked for ultracode; nil for none.
	Ultracode func(sessionID any) bool
	// Broadcast hands the session's stored figures to the conversation views that show it.
	Broadcast func(stats *jsvalue.Object)
	// Script is the platform's own statusline script: a statusLine command that runs it would post here again.
	Script string
	// Timeout bounds the person's command (DefaultTimeout when 0).
	Timeout time.Duration
	// Now is the clock (tests freeze it); nil is the real one.
	Now func() time.Time
	// contains filtered or unexported fields
}

Sink answers POST /api/status/statusline.

func (*Sink) ServeHTTP

func (s *Sink) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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