Files
t3code/docs/user/cursor.md
T
Julius MarmingeandClaude Fable 5 3f8a05150b merge: update PR 2829 with latest main
27 commits from main, including the ⌘P file picker / ⇧⌘F content search
(#4855), thread content search (#4959), sidebar title regeneration
(#4810), image-paste compression (#4967), and the docs restructure
(#4807). Notable resolutions beyond keep-both:

- Thread content search is ported to the v2 surface: searchThreads joins
  ORCHESTRATION_V2_WS_METHODS/rpc/auth scopes, and the SQL now UNIONs
  orchestration_v2_projection_messages so current threads are searchable,
  not just legacy-projected ones.
- Title regeneration's server half lived in the v1 ProviderCommandReactor
  this branch deletes, so the capability is deliberately not advertised:
  clients hide the action, the contract/UI code stays intact, and the
  input field is accepted as a documented no-op.
  TODO(orchestration-v2): port regeneration to the v2 runtime.
- Main's 035_ProjectionThreadTitleRegeneration migration collided with
  this branch's 035-043 range; renumbered to 044.
- Mobile activity grouping keeps this branch's runId/prominence semantics
  while adopting main's O(1) trailing-group optimization (prominence
  tracked in a flag instead of a per-append scan).
- v1-only startup tests from main (heartbeat/auto-bootstrap against the
  deleted reactor-era services) are dropped; their v2 equivalents already
  cover the ordered startup phases.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-30 17:29:43 +02:00

65 lines
3.3 KiB
Markdown

# Cursor
Cursor V2 runs through the official [`@cursor/sdk`](https://cursor.com/docs/api/sdk/typescript)
TypeScript package. It does not use Cursor's ACP transport for V2 execution.
## Prerequisites
- Node.js 22.13 or newer. The repository's supported Node version satisfies this requirement.
- A Cursor API key in `CURSOR_API_KEY`. Provider-instance environment variables override the host
environment in the same way as the other providers.
- A model accepted by the Cursor SDK. `auto` is sent to the SDK as its `default` model selection.
The adapter currently uses the SDK's local-agent runtime so runs operate in the selected T3 Code
workspace. Cursor cloud agents need repository and cloud-environment configuration that T3 Code does
not expose yet.
## V2 Capability Mapping
The adapter supports:
- creating and resuming local Cursor agent threads;
- changing the model and model parameters between turns;
- assistant text, reasoning, tool output, plans, and todo streaming;
- thread-scoped T3 Code MCP tools;
- image attachments;
- interruption, queued app messages, and orchestrator-owned interrupt/restart steering;
- provider conversation snapshots through `Agent.messages.list()`;
- Cursor `task` subagents, projected as read-only child app threads with their tool activity and
final result.
The public SDK does not currently expose native agent fork, conversation rollback, active steering,
or interactive approval callbacks. Direct active steering is advertised as unsupported, while V2
steering uses the orchestrator's interrupt-and-restart path and preserves the app run identity across
provider turns. Same-provider Cursor forks use the orchestrator's portable full-thread context
handoff into a fresh Cursor agent. The SDK has in-process custom callback tools, but the V2 adapter
intentionally uses the authenticated, thread-scoped MCP server instead.
Cursor task events include an `agentId`, but the local SDK does not register that identifier as a
resumable agent: `Agent.resume()` returns `AgentNotFoundError`. The adapter therefore does not attach
a provider thread to native task projections or advertise subagent thread IDs. Sending a new message
from a projected child starts a new Cursor agent rather than pretending to resume the task runtime.
Runtime modes map to the controls the local SDK exposes: full access disables its sandbox, while
restricted modes and explicit non-full-access sandbox policies enable it. Explicit approval policy
overrides also control Cursor Auto-review. Auto-review is not represented as an interactive T3 Code
approval flow.
The existing Cursor binary path and API endpoint settings belong to the CLI/ACP integration. Cursor
V2 execution does not launch that binary, and the SDK does not expose an API endpoint override.
## Replay And Live Testing
Cursor replay fixtures preserve the SDK boundary: agent open/resume, sends, ordered `onDelta`
updates, terminal results, cancellation, message snapshots, and close. The real V2 adapter,
orchestrator, event store, projections, and checkpoint logic still run in tests.
Record a fixture against the real SDK with:
```bash
pnpm --filter t3 record:cursor-replay -- --scenario simple
```
Use `--out <path>` to record a temporary probe without replacing a checked-in fixture. Supported
scenarios are listed by the recorder when an invalid scenario is supplied.