control

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 14 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

View Source
var ErrNoJob = errors.New("no Claude Code job for that session")

ErrNoJob is claude rm saying it has no job by that id: Claude Code 2.1.310's claude stop drops a job outright. Item 341.

View Source
var ErrUntrusted = errors.New("workspace not trusted")

Functions

func AppleScriptString added in v0.1.6

func AppleScriptString(s string) string

AppleScriptString escapes s for the inside of an AppleScript string literal.

func JobID

func JobID(id string) (string, error)

Types

type Agent

type Agent struct {
	ID        string `json:"id"`
	SessionID string `json:"sessionId"`
	CWD       string `json:"cwd"`
	Kind      string `json:"kind"`
	Status    string `json:"status"`
	State     string `json:"state"`
	PID       int    `json:"pid"`
	StartedAt int64  `json:"startedAt"`
}

type Control

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

func Default

func Default(terminal string) *Control

func New

func New(runner Runner, desktop Desktop, getenv func(string) string, onPath func(string) bool) *Control

func (*Control) Agents

func (c *Control) Agents(ctx context.Context, all bool) ([]Agent, error)

func (*Control) Attach

func (c *Control) Attach(id, dir string) error

Attach opens a terminal on a session, started in the session's directory, dir: when the session ends, claude attach turns into Claude Code's agent view in that terminal's directory, which must be one the session already trusts rather than wherever the city was started (item 302). Empty dir starts it where the city runs.

func (*Control) AttachHere added in v0.3.0

func (c *Control) AttachHere(id string) error

AttachHere attaches to a session in the terminal botropolis runs in.

func (*Control) Copy

func (c *Control) Copy(ctx context.Context, text string) error

Copy puts text on the clipboard through whichever tool is installed. A tool that has not finished within copyTimeout is stopped, and the copy fails rather than holding up whoever asked.

func (*Control) Fork added in v0.2.0

func (c *Control) Fork(ctx context.Context, dir, sessionID string) (string, error)

Fork starts a fresh session from a copy of another's conversation, leaving the original as it was.

func (*Control) New

func (c *Control) New(ctx context.Context, dir, prompt string) (string, error)

func (*Control) Paste added in v0.3.3

func (c *Control) Paste(ctx context.Context) (string, error)

Paste reads the clipboard's text through the tool Copy would use, under the same deadline (item 290).

func (*Control) Remove

func (c *Control) Remove(ctx context.Context, id string) error

func (*Control) Resume

func (c *Control) Resume(ctx context.Context, dir, sessionID string) (string, error)

func (*Control) Reveal

func (c *Control) Reveal(dir string) error

Reveal opens a directory in the desktop's file manager.

func (*Control) Stop

func (c *Control) Stop(ctx context.Context, id string) error

type Desktop added in v0.1.6

type Desktop struct {
	OS         string
	Opener     string
	Clipboards [][]string
	// Pastes are the tools that read the clipboard back, in Clipboards'
	// order, so paste reaches for the tool copy does (item 290).
	Pastes [][]string
	// ClipboardHint is what to install when no clipboard tool is found.
	ClipboardHint string
	Terminals     []string
}

Desktop is what reveal, copy and attach reach for on one operating system.

func DesktopFor added in v0.1.6

func DesktopFor(goos string) Desktop

DesktopFor returns the desktop for a GOOS; anything that is not macOS is treated as a Linux desktop.

func Native added in v0.1.6

func Native() Desktop

Native is the desktop this binary was built for.

func (Desktop) KnownTerminals added in v0.1.6

func (d Desktop) KnownTerminals() []string

KnownTerminals is the list tried when nothing names a terminal.

func (Desktop) TerminalCommand added in v0.1.6

func (d Desktop) TerminalCommand(getenv func(string) string, onPath func(string) bool, command []string) ([]string, error)

type Runner

type Runner interface {
	Run(ctx context.Context, dir string, name string, args ...string) (string, error)
	Start(dir string, name string, args ...string) error
	// Interactive hands the caller's terminal to a command.
	Interactive(name string, args ...string) error
	// Feed runs a command with input on its stdin.
	Feed(ctx context.Context, input string, name string, args ...string) error
	// Read runs a command and returns what it printed.
	Read(ctx context.Context, name string, args ...string) (string, error)
}

Jump to

Keyboard shortcuts

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