harness

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 27 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 harness provides a PTY-based TUI for embedding Claude Code.

The harness creates a "window-in-window" interface where Claude Code runs interactively via PTY, with a status bar showing connection state, job info, and queue metrics.

This implementation uses ANSI scroll regions (DECSTBM) to reserve the top lines for status while giving Claude Code full control of the remaining terminal space.

Package harness provides a PTY-based TUI for embedding Claude Code.

Index

Constants

View Source
const DefaultExecutionTimeout = 10 * time.Minute

DefaultExecutionTimeout is the fallback when no execution timeout is set on the job.

View Source
const PTYChunkDelay = 10 * time.Millisecond

PTYChunkDelay is the delay between writing chunks to the PTY.

View Source
const PTYPasteSettleDelay = 500 * time.Millisecond

PTYPasteSettleDelay is the delay after bulk-pasting content, allowing the application to process the pasted text before we send Enter.

View Source
const PTYPostWriteDelay = 50 * time.Millisecond

PTYPostWriteDelay is the delay after writing all content before sending Enter.

View Source
const PTYWriteChunkSize = 4096

PTYWriteChunkSize is the max bytes to write to the PTY at once.

View Source
const PromptDebounceTime = 1 * time.Second

PromptDebounceTime is how long to wait after seeing the prompt before declaring Claude is ready. Used only for initial startup detection.

View Source
const ResizePollInterval = 250 * time.Millisecond

ResizePollInterval is the fallback interval to reconcile terminal size in environments that don't reliably forward SIGWINCH.

View Source
const SignalFileName = "complete"

SignalFileName is the marker file created by the Stop hook.

View Source
const SignalPollInterval = 200 * time.Millisecond

SignalPollInterval is how often to check for completion signal files.

View Source
const StatusBarHeight = 2

StatusBarHeight is the number of lines reserved for the status bar

Variables

View Source
var PromptDetectionBytes = []byte{0xe2, 0x9d, 0xaf, 0x20} // "❯ " in UTF-8

PromptDetectionBytes contains the bytes to detect Claude's input prompt. We look for "❯ " (U+276F HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT + space) to know Claude is ready for input (used for initial ready state).

Functions

func LoadedMCPServers added in v1.2.0

func LoadedMCPServers(cfg *client.RunnerConfigResponse, now time.Time) []string

LoadedMCPServers returns the names of MCP providers that are effectively loaded.

func Run

func Run(ctx context.Context, cfg *Config) error

Run starts the harness TUI.

Types

type Config

type Config struct {
	Client            *client.Client
	HabitatID         string
	QueueID           string
	SupportedAgents   []string
	InstanceID        string
	RunnerConfig      *client.RunnerConfigResponse
	TranscriptEnabled bool
	TranscriptDir     string
	TranscriptLines   int
}

Config holds configuration for the harness.

type ConnectionStatus

type ConnectionStatus int

ConnectionStatus represents the connection state.

const (
	StatusDisconnected ConnectionStatus = iota
	StatusConnecting
	StatusConnected
	StatusProcessing
	StatusError
)

ConnectionStatus values.

func (ConnectionStatus) String

func (s ConnectionStatus) String() string

String returns a human-readable status.

type RootModel

type RootModel struct {
	// contains filtered or unexported fields
}

RootModel manages the harness state with scroll region approach.

func NewRootModel

func NewRootModel(ctx context.Context, cfg *Config) *RootModel

NewRootModel creates a new root model with the given configuration.

func (*RootModel) Run

func (m *RootModel) Run() error

Run starts the harness with scroll region approach.

Jump to

Keyboard shortcuts

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