feat(agents): add cursor CLI agent backend#107
Open
valvesss wants to merge 1 commit into
Open
Conversation
|
@valvesss is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
valvesss
force-pushed
the
feat/cursor-cli-agent
branch
from
July 15, 2026 15:38
204a0a8 to
5f03ce8
Compare
Adds a fourth agent backend, `--agent cursor`, that drives the Cursor CLI (`cursor-agent`) headless instead of talking to a model endpoint over HTTP. Cursor runs its own agent loop — the CLI does the Read / Glob / Shell tool calls against the checkout, streams newline-delimited JSON events, and the plugin parses those into deepsec's AgentProgress stream and pulls the findings JSON out of the final message. Why a CLI backend: the Cursor "seat" is reachable over an OpenAI/Anthropic-compatible *message* API, but that path does not relay agentic `tool_use` — driving it via the claude/codex/pi backends produced 0 tool calls and 0 findings. The CLI carries the tool-use loop natively. - New `CursorCliPlugin` (`packages/processor/src/agents/cursor-cli.ts`), registered in `createDefaultAgentRegistry`; implements `investigate` and `revalidate` with a one-shot JSON-repair fallback, reusing the shared prompt/parse helpers. - Default model `auto` (`agent-defaults.ts`); `--agent cursor` resolves as-is. Auth is the user's `cursor-agent` login or `CURSOR_API_KEY`; `cursor` is intentionally left out of preflight's KNOWN_BACKENDS so the gateway credential check is skipped. Binary overridable via `CURSOR_AGENT_BIN`. - Tests: hermetic plugin test driving a fake `cursor-agent` that emits a canned stream-json transcript; registry / default-model / resolve-agent-type coverage. - Docs: models.md (backend table, CLI examples, a "Cursor CLI backend" section) and configuration.md (defaultAgent values + CURSOR_* env). Co-authored-by: Vitor Alves <vitoralvesinfo@gmail.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
valvesss
force-pushed
the
feat/cursor-cli-agent
branch
from
July 15, 2026 15:52
5f03ce8 to
bb1b541
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Adds a fourth agent backend,
--agent cursor, that drives the Cursor CLI(
cursor-agent) headless instead of talking to a model endpoint over HTTP.Cursor runs its own agent loop — the CLI does the Read/Glob/Shell tool calls
against the checkout and streams newline-delimited JSON events, which the new
CursorCliPluginparses into deepsec'sAgentProgressstream and turns intofindings JSON.
Why
The Cursor "seat" is reachable over an OpenAI/Anthropic-compatible message
API, but that path does not relay agentic
tool_use— driving it throughthe existing
claude/codex/pibackends produced 1 turn, 0 tool calls,and 0 findings on obviously-vulnerable code (the agent never reads a file).
The Cursor CLI carries the tool-use loop natively, so a CLI-spawning backend
(like the codex path, but for
cursor-agent) is what makes the Cursor seatusable as a deepsec engine.
Verified end-to-end against an intentionally-vulnerable fixture:
--agent cursorran 9 tool calls over 3 turns and returned 3 correct findings(critical SQL injection, critical command injection, hardcoded secret) —
matching what the
claudebackend finds on the same input.Verification
pnpm test:unitpasses (2138 tests, incl. a new hermetic plugin test)pnpm -r build(typecheck) passespnpm lintpasses (the one remaining warning is pre-existing insandbox/setup.ts, untouched here)pnpm knippassespnpm testfull run — the e2e project is gated on Vercel Sandboxcredentials (
DEEPSEC_E2E_LIVE_SANDBOX) and this change doesn't touchthe sandbox path, so it wasn't run
Notes for reviewer
cursor-agentuses its own login session (
~/.cursor) orCURSOR_API_KEY.cursoristherefore intentionally not added to preflight's
KNOWN_BACKENDS, soassertAgentCredentialno-ops for it (the AI-gateway env is irrelevant tothis backend). Binary path overridable via
CURSOR_AGENT_BIN.--force(no interactive approvals)so it can read + run shell inside the checkout; the prompt instructs it to
read only. Unlike the codex backend, this does not yet apply an
env-allowlist or a read-only CLI mode — noted as a follow-up. It fits the
same trust model as running
codex/claudelocally against a repo.readout shows tokens but omits the
$figure (same handling as a missingprice entry on the codex backend).
formats are unchanged.