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
- func MCPJSON(env harnesses.Environment) []byte
- func ModelsJSON(env harnesses.Environment) ([]byte, error)
- type Adapter
- func (a *Adapter) Checkpoint(ctx context.Context) (runtimeapi.Checkpoint, error)
- func (a *Adapter) Deliver(ctx context.Context, d harnesses.Delivery) (harnesses.TurnResult, error)
- func (a *Adapter) DescribeCapabilities() harnesses.Capabilities
- func (a *Adapter) Events() <-chan harnesses.Event
- func (a *Adapter) Prepare(ctx context.Context, env harnesses.Environment) error
- func (a *Adapter) Quiesce(ctx context.Context) (harnesses.QuiesceResult, error)
- func (a *Adapter) StartOrResume(ctx context.Context, rec harnesses.RecoveryDescriptor) (harnesses.ResumeResult, error)
- func (a *Adapter) Stop(ctx context.Context) error
- type SessionState
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 (*Adapter) Checkpoint ¶
func (a *Adapter) Checkpoint(ctx context.Context) (runtimeapi.Checkpoint, error)
func (*Adapter) DescribeCapabilities ¶
func (a *Adapter) DescribeCapabilities() harnesses.Capabilities
func (*Adapter) StartOrResume ¶
func (a *Adapter) StartOrResume(ctx context.Context, rec harnesses.RecoveryDescriptor) (harnesses.ResumeResult, 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.
Click to show internal directories.
Click to hide internal directories.