cursor

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cursor provides an ACP client for Cursor CLI via its `agent acp` subprocess (https://cursor.com/docs/cli/acp). The ACP session lifecycle — connection wiring, stderr streaming, event translation and result capture — is provided by the shared client package; this package only resolves the agent binary and builds its ACP-mode argument list.

Index

Constants

View Source
const ACPSubcommand = "acp"

ACPSubcommand is the subcommand that puts Cursor CLI into ACP mode.

View Source
const BinaryName = "agent"

BinaryName is the canonical name of the Cursor CLI binary. The official installer creates both `agent` (preferred) and `cursor-agent` (legacy alias) as symlinks to ~/.local/share/cursor-agent/versions/<v>/cursor-agent.

Variables

View Source
var DefaultBinaryPaths = []string{
	"agent",
	"cursor-agent",
	".local/bin/agent",
	".local/bin/cursor-agent",
	"/usr/local/bin/agent",
	"/usr/local/bin/cursor-agent",
	"/usr/bin/agent",
	"/usr/bin/cursor-agent",
}

DefaultBinaryPaths lists common installation locations for the Cursor CLI binary, in priority order. The Cursor installer places the canonical `agent` binary at $HOME/.local/bin/agent; `cursor-agent` is kept as a legacy fallback for older installs.

Functions

This section is empty.

Types

type RunRequest

type RunRequest struct {
	Prompt    string   // Prompt to send to Cursor CLI
	SessionID string   // Optional session ID to resume
	CWD       string   // Working directory
	Env       []string // Additional environment variables
	Command   []string // Optional command override for testing (defaults to agent acp)

	// Cursor-specific options
	APIKey    string // Optional; if set, passed as --api-key. Prefer CURSOR_API_KEY env var.
	AuthToken string // Optional; if set, passed as --auth-token. Prefer CURSOR_AUTH_TOKEN env var.
	Endpoint  string // Optional API endpoint override (e.g. https://api2.cursor.sh).
	Model     string // Optional model hint (informational; Cursor picks per-task).
	Debug     bool   // Enable verbose/debug output if supported by the CLI.
}

RunRequest describes a Cursor CLI prompt turn.

type Runner

type Runner struct {
	// ClientInfo identifies this client to the agent.
	ClientInfo acp.Implementation

	// Binary is the path to the agent (or legacy `cursor-agent`) binary.
	// If empty, uses the first found in DefaultBinaryPaths.
	Binary string

	// Logger for connection debugging.
	Logger *slog.Logger

	// ExtraEnv is additional environment variables to pass to the subprocess.
	ExtraEnv []string
}

Runner launches Cursor CLI in ACP mode and manages the client-side connection. Authentication is taken from the environment (CURSOR_API_KEY / CURSOR_AUTH_TOKEN) unless explicitly overridden.

func (Runner) Start

func (r Runner) Start(ctx context.Context, req RunRequest) (*client.RunningSession, error)

Start launches the Cursor CLI subprocess and begins the ACP flow, delegating the session lifecycle to the shared client runner.

Jump to

Keyboard shortcuts

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