Documentation
¶
Overview ¶
Package cursor adapts the Cursor Agent CLI (`cursor-agent`) into an inference backend.
The CLI is launched in headless print mode, in read-only ask mode, in an empty scratch directory with a sanitized environment: agent2api uses it as a plain LLM, never as an agent that touches the machine.
Read-only is not tool-free. In ask mode the model still reads any file on the disk, greps and globs outside the scratch directory, starts sub-agents with `Task`, and looks up more tools with `getMcpTools`; asked for the first lines of /etc/hosts, it read them and put them in the answer. No flag takes the tools away, so two layers stand in for one:
- a permissions file in the scratch directory denies what cursor's permission tokens can name (see deniedPermissions), which narrows what a call can do in the moment before the CLI is stopped;
- the parser fails the run at the first tool call and stops the CLI.
The second is the guarantee, as it is for codex and Qwen Code: `Task` and `getMcpTools` ran with the deny list in place, and no list anticipates the next tool.
Index ¶
Constants ¶
const DefaultMode = config.DefaultCursorMode
DefaultMode is the execution mode used when adapters.cursor.mode is not set. It mirrors the config default rather than restating it, so the two cannot drift; the adapter keeps its own fallback because Options can be built without going through the config layer at all.
const ID = "cursor"
ID is the adapter id used to namespace this backend's models.
const MaxPromptBytes = 96 << 10
MaxPromptBytes caps the rendered transcript. Unlike the other CLIs, cursor-agent takes its prompt as a command-line argument, and Linux refuses a single argument longer than 128 KiB. Failing with an explanation beats an opaque "argument list too long" from the kernel.
Variables ¶
This section is empty.