harness

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 4 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 is what a client reads from the coding agent and the workspace manager that run it: the agent's hook payloads and the session's identity in its environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claimer

type Claimer interface {
	Claims(cwd string) bool
}

Claimer is a SessionEnv whose manager also runs sessions the loop does not drive: it claims a session only in a working directory it hands the loop.

type Prompts

type Prompts interface {
	Prompt(raw []byte) (string, error)
}

Prompts is a Protocol that reads the prompt of its prompt hook's payload.

type Protocol

type Protocol interface {
	SessionID(getenv func(string) string) string
	Home(getenv func(string) string) string
	SessionStart(raw []byte) (agentSession, source, cwd string, err error)
	Stop(raw []byte) (agentSession, promptID, lastMessage string, err error)
	Block(reason string) []byte
}

Protocol is one coding agent's hook payloads and session environment.

type SessionEnv

type SessionEnv interface {
	Handle(getenv func(string) string) string
	Pane(getenv func(string) string) string
	WorktreeID(getenv func(string) string) string
}

SessionEnv reads, from a session's environment, the identity its workspace manager gives it.

type Set

type Set struct {
	SessionEnvs map[string]SessionEnv
	Agents      map[string]Protocol
	// DefaultAgent is the agent used when the environment names none.
	DefaultAgent string
	// Cwd is the session's working directory; nil reads none, and a Claimer
	// then claims nothing.
	Cwd func() string
}

Set is the session environments and agent protocols a client can read, by name.

func (Set) Detect

func (s Set) Detect(getenv func(string) string) Protocol

Detect is Kind's protocol.

func (Set) For

func (s Set) For(kind string) (Protocol, error)

For is kind's protocol; "" is DefaultAgent's.

func (Set) Handle

func (s Set) Handle(getenv func(string) string) string

Handle is the handle the environment sets, the first by sorted manager name, claimed or not; "" when no manager sets one.

func (Set) Kind

func (s Set) Kind(getenv func(string) string) string

Kind is the agent whose SessionID the environment sets, the first by sorted name, else DefaultAgent.

func (Set) Manager

func (s Set) Manager(getenv func(string) string) (string, SessionEnv)

Manager is Session with the manager's name.

func (Set) Session

func (s Set) Session(getenv func(string) string) SessionEnv

Session is the manager whose Handle the environment sets, the first by sorted name, with its name; nil and "" when no manager runs the session.

type Transcripts

type Transcripts interface {
	Transcript(raw []byte) string
}

Transcripts is a Protocol whose hook payloads name the session's transcript file.

Jump to

Keyboard shortcuts

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