Help us shape the future of Go! Take the 2026 Go Developer Survey

pi

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package pi is the adapter for the Pi coding agent (pi.dev, @earendil-works/pi-coding-agent). It drives one long-running `pi --mode rpc` process over JSONL on stdio (CONTRACT.md):

  • PI_CODING_AGENT_DIR and the session directory live under <runner>/pi on the seat volume, so sessions survive Pod replacement;
  • models.json declares a "steadmesh" provider at the seat's model forwarder, speaking the profile's API (anthropic-messages, openai-responses or openai-completions) with a placeholder key;
  • mcp.json adds steadmesh-tools with exposure "direct" (the default, codemode, would hide the tools);
  • a turn is prompt ... agent_settled; interruption is abort.

Pi asks for no tool approvals; the seat Pod is the boundary. Checkpoint = session file + Pi version (application_checkpoint).

Index

Constants

View Source
const (
	// AdapterName is the harness profile adapter value.
	AdapterName = "pi"
	// PinnedVersion is the verified Pi release (CONTRACT.md).
	PinnedVersion = "1.0.4"
	// SessionFormatPrefix prefixes Checkpoint.FormatVersion.
	SessionFormatPrefix = "pi-session/"
	// MCPServerName is the tool bridge's server name; tools appear as
	// mcp__steadmesh__<tool>.
	MCPServerName = "steadmesh"
	// ProviderID is the models.json provider for the seat's model.
	ProviderID = "steadmesh"
)
View Source
const (
	SettingThinking      = "thinking"       // --thinking level
	SettingContextWindow = "context_window" // models.json contextWindow
	SettingMaxTokens     = "max_tokens"     // models.json maxTokens
	SettingReasoning     = "reasoning"      // models.json reasoning (true for thinking models)
)

Model settings (model.settings).

View Source
const (
	ConfigBinary         = "pi_bin"          // default "pi"
	ConfigVersion        = "version"         // when set, Prepare requires exactly this version
	ConfigInterruptGrace = "interrupt_grace" // Go duration, default 15s
)

Harness profile config keys.

Variables

This section is empty.

Functions

func MCPJSON

func MCPJSON(env harnesses.Environment) []byte

MCPJSON renders mcp.json with the tool bridge exposed directly.

func ModelsJSON

func ModelsJSON(env harnesses.Environment) ([]byte, error)

ModelsJSON renders models.json: one provider at the model forwarder.

Types

type Adapter

type Adapter struct {

	// Tap, when set before StartOrResume, receives every raw stdout record.
	Tap func(line []byte)
	// contains filtered or unexported fields
}

Adapter runs Pi.

func New

func New() *Adapter

New returns a Pi adapter.

func (*Adapter) Checkpoint

func (a *Adapter) Checkpoint(ctx context.Context) (runtimeapi.Checkpoint, error)

func (*Adapter) Deliver

func (*Adapter) DescribeCapabilities

func (a *Adapter) DescribeCapabilities() harnesses.Capabilities

func (*Adapter) Events

func (a *Adapter) Events() <-chan harnesses.Event

func (*Adapter) Prepare

func (a *Adapter) Prepare(ctx context.Context, env harnesses.Environment) error

func (*Adapter) Quiesce

func (a *Adapter) Quiesce(ctx context.Context) (harnesses.QuiesceResult, error)

func (*Adapter) StartOrResume

func (*Adapter) Stop

func (a *Adapter) Stop(ctx context.Context) error

type SessionState

type SessionState struct {
	SessionFile    string    `json:"session_file"`
	SessionID      string    `json:"session_id"`
	PiVersion      string    `json:"pi_version"`
	ConfigRevision string    `json:"config_revision,omitempty"`
	Turns          int       `json:"turns"`
	UpdatedAt      time.Time `json:"updated_at"`
}

SessionState is <runner>/pi-state.json.

Jump to

Keyboard shortcuts

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