cursor

package
v0.2.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package cursor runs the Cursor Agent CLI (cursor-agent) as an agent.Backend: a model call loop over a directory, in Cursor's read-only ask mode with its sandbox enabled, whose final message is a JSON document.

cursor-agent has no structured output: the output schema travels in the prompt, and the generate-and-repair loop validates whatever comes back and sends the findings back as a repair. Its read-only guarantees are weaker than the other CLI backends'; ARCHITECTURE.md and SECURITY.md say what is and is not enforced.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// Binary is the executable. Empty looks up cursor-agent on PATH, then
	// agent, which is used only when its help says it is the Cursor Agent.
	Binary, Model string
	// Env are the user's agent variables (agent.WithUserEnv).
	Env []string
	// contains filtered or unexported fields
}

Backend runs the Cursor Agent CLI over a request's directory, under the user's own Cursor login. It has a single, local profile: the process gets an allowlisted copy of the environment (agent.LocalEnvironment, plus CURSOR_CONFIG_DIR, CURSOR_DATA_DIR and AGENT_CLI_CREDENTIAL_STORE), never a Cursor API key, and a request that names an Endpoint is refused.

The child runs in its own process group, so a terminal's Ctrl-C (SIGINT) does not reach it. A local caller must cancel the context it passes to Run on SIGINT and SIGTERM, for example with signal.NotifyContext, or the CLI keeps running after baum exits. Cancelling kills the group on Unix, and on Windows only the child itself.

func (*Backend) Check

func (c *Backend) Check(ctx context.Context) (version string, err error)

Check resolves the executable and checks that it is the Cursor Agent and lists every option a run passes, as the first Run does, and returns the installed version. A host calls it before assembling anything, so a missing or incompatible installation fails at once instead of as a provider failure retried by the loop. It does not check the login or call a model.

func (*Backend) Name

func (*Backend) Name() string

func (*Backend) Path

func (c *Backend) Path() string

Path is the executable a successful Check or Run resolved, empty before.

func (*Backend) Run

func (c *Backend) Run(ctx context.Context, request agent.Request) (result agent.Result, err error)

Run asks cursor-agent for the document. The prompt goes on stdin with the output schema appended, since the CLI cannot enforce one.

Jump to

Keyboard shortcuts

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