Documentation
¶
Overview ¶
Package cotty shares a terminal session between a person and an AI agent.
The person starts a program under `cotty wrap` and uses it as usual. The wrapper listens on a Unix socket, through which `cotty mcp` lets the agent read the program's output and type into it. There is no daemon: each wrapper owns its session, and the socket directory is the list of sessions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteSize ¶
type ByteSize int
ByteSize is a positive number of bytes, written as a number with an optional unit: B, K, KB, KiB, M, MB or MiB. Every unit is a power of 1024.
func (*ByteSize) UnmarshalText ¶
type Context ¶
type Context struct {
// Home is the directory holding the sockets and logs.
Home string
Version string
Stdin *os.File
Stdout io.Writer
ErrOutput io.Writer
}
Context carries what commands need from the process they run in.
type ExitError ¶
type ExitError struct {
Code int
}
ExitError reports the exit status of the wrapped command, which cotty exits with in turn.
type MCPCmd ¶
type MCPCmd struct {
ReadMax ByteSize `default:"32KiB" env:"COTTY_READ_MAX" help:"Most output one read returns. Older output beyond it is dropped."`
TailLines int `default:"50" env:"COTTY_TAIL_LINES" help:"Lines a read returns when it has no previous read to continue from."`
Timeout time.Duration `default:"30s" env:"COTTY_TIMEOUT" help:"How long a read waits when the agent does not say."`
MaxTimeout time.Duration `default:"10m" env:"COTTY_MAX_TIMEOUT" help:"Longest wait the agent may ask a read for."`
}
MCPCmd serves the sessions to an agent over MCP on stdio.
type SessionInfo ¶
type SessionInfo struct {
Name string `json:"name"`
ID string `json:"id"`
Command []string `json:"command"`
PID int `json:"pid"`
StartedAt time.Time `json:"started_at"`
AgentInput bool `json:"agent_input"`
}
SessionInfo describes a running session.
type WrapCmd ¶
type WrapCmd struct {
Name string `short:"n" required:"" help:"Session name: letters, digits, '.', '_' and '-', up to 32 characters."`
BufferSize ByteSize `default:"1MiB" env:"COTTY_BUFFER_SIZE" help:"How much recent output to keep for the agent to read."`
Command []string `arg:"" passthrough:"" help:"Command to run, with its arguments."`
}
WrapCmd runs a command in a terminal shared with the agent.