feat: add Cursor Agent CLI as new agent provider (Phase 1)#77
Open
cloud1305 wants to merge 3 commits intoDeadWaveWave:mainfrom
Open
feat: add Cursor Agent CLI as new agent provider (Phase 1)#77cloud1305 wants to merge 3 commits intoDeadWaveWave:mainfrom
cloud1305 wants to merge 3 commits intoDeadWaveWave:mainfrom
Conversation
added 3 commits
March 25, 2026 11:15
Add a comprehensive proposal document for integrating Cursor Agent CLI as a new agent provider in OpenCove, leveraging the official ACP (Agent Client Protocol) for structured session management. Made-with: Cursor
Register cursor-agent across all provider-aware subsystems: - Type registration: AgentProviderId, AgentModelCatalogSource, AGENT_PROVIDERS - Provider metadata: label, capabilities (runtimeObservation: none, experimental) - CLI availability: two-step detection (which + version fingerprint) - Command factory: --yolo, --model, --resume, --continue, prompt args - Model service: parse `agent models` output with cache and fallback - Session/Watcher stubs: explicit null returns to prevent fallthrough into gemini/codex default branches Made-with: Cursor
- Add cursor-agent to IPC provider whitelist (normalizeProvider) - Fix CLI detection: use --help instead of --version for fingerprint - Parse agent models output format (id - DisplayName with ANSI codes) - Auto-resolve current model display name when no model specified - Fix provider title prefix fallthrough to codex Made-with: Cursor
d0715d1 to
4edf8cc
Compare
Owner
|
建议在本 PR 完成 Phase 2 的内容,并提供正确运行时的截图验证后再尝试提交 |
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.
Summary
Add
cursor-agentas the 5th agent provider in OpenCove, integrating the official Cursor Agent CLI (agentcommand) via PTY-based terminal sessions. This is Phase 1 (PTY-only) of the proposal documented indocs/proposals/cursor-agent-support.md.Motivation
TerminalSessionStatemodel. Phase 1 uses PTY-only; Phase 2 will leverage ACP for structured state observation.agent models.Changes
Phase 1 scope (this PR)
agent.ts,agentSettings.ts,providerMeta.tscursor-agenttoAgentProviderId,AGENT_PROVIDERS, provider metadata (label, capabilities)normalize.tscursor-agentto the provider whitelistAgentCliAvailability.tswhich agent+agent --helpfingerprint (contains "cursor")AgentCommandFactory.ts--yolo,--model,--resume,--continue, promptAgentModelService.tsagent modelsoutput (id - DisplayName (current)format), ANSI cleanup, cache with TTL, auto-resolve current model for title displaySessionFileResolver.ts,SessionTurnStateDetector.ts,SessionLastAssistantMessage.extractors.ts,AgentSessionLocator.tsnullreturns to prevent fallthrough into gemini/codex default brancheshelpers.tscursor-agenttoproviderTitlePrefixregister.tsProposal document
docs/proposals/cursor-agent-support.md— comprehensive design document covering feasibility analysis, architecture, state ownership table, invariants, phased execution plan, risk analysis, and acceptance criteria.Key design decisions
cursor-agent(notcursor)none(Phase 1)--helpfingerprintagent --versionoutput doesn't contain "cursor";--helpoutput does ("Start the Cursor Agent")trueagent models(current)model to show actual model name instead of "default model"Test coverage
Verification
pnpm pre-commit: lint ✅, format ✅, type-check ✅, unit tests ✅, E2E ✅ (1 pre-existing flaky failure)Invariants maintained
AgentCommandFactory.buildAgentLaunchCommand— no hardcoded args elsewherewhich agentalone is insufficientnull— no accidental fallthrough into other providers' logicTerminalSessionStatepush path (ptyStateIPC channel) remains consistent across all providersnormalizeAgentSettingscorrectly handles old data withoutcursor-agentkeys viaAGENT_PROVIDERS.reducePhase 2 roadmap (not in this PR)
agent acp+ JSON-RPC client) for structured state observationsession/update→working/standbymappingsession/request_permission→ UI approval dialogexperimentalflag