feat(backend): orchestration tools, Projects mode, prompt/proto re-sync with Cursor 3.14.7 - #245
Open
warelik wants to merge 2 commits into
Open
feat(backend): orchestration tools, Projects mode, prompt/proto re-sync with Cursor 3.14.7#245warelik wants to merge 2 commits into
warelik wants to merge 2 commits into
Conversation
Desktop Cursor works through the local proxy because it drives the agent
over BidiAppend/RunSSE plus the already-mocked unary endpoints. The
cursor-agent CLI speaks the same agent protocol but calls additional
unary endpoints that had no local handlers, so every request fell into a
wildcard route and came back as HTTP 404, which the Connect client maps
to '[unimplemented] HTTP 404'.
Three independent breaks, one visible symptom:
1. Startup: ServerConfigService/GetServerConfig (only the AiService
variant was mocked), DashboardService/GetTeamAdminSettingsOrEmptyIfNotInTeam
and DashboardService/ListMarketplaces were missing, so the CLI aborted
during session init.
2. Git workspaces: the CLI resolves the repo path-encryption key from
indexingConfig.default{User,Team}PathEncryptionKey in GetServerConfig
when no IDE-stored repo keys exist. The mock returned no indexingConfig,
so repository identity init failed with 'No encryption key found'.
3. Tool execution: every fs tool executor (Ls/Grep/Glob/Shell) consults
the ignore service, which calls getRepoBlockExcludeGlobs() ->
DashboardService/GetTeamReposOrEmptyIfNotInTeam. The 404 propagated as
the tool result error, so model answers arrived but every tool call
returned '[unimplemented] HTTP 404'. Non-git workspaces skip the
repo-block path, which is why tools only failed inside git repos.
Also close the remaining tolerated 404 noise so a CLI session produces
zero unimplemented responses: model listing (GetUsableModels,
GetDefaultModelForCli, GetDefaultModel), dashboard/plugin housekeeping
(GetGlobalCommands, GetEffectiveUserPlugins, RegisterMarketplaceAndPlugins,
GetCliDownloadUrl) and telemetry (AnalyticsService/SubmitLogs,
AnalyticsService/TrackEvents, OTLP /v1/traces).
Additional logging: PolicyMiddleware now includes the request path in the
per-request log line, which is what made this diagnosable from app.log.
…nc with Cursor 3.14.7
Brings the local backend's agent surface in line with the current Cursor
client bundle (3.14.7) and wires model-visible orchestration tools through
the exec bridge to the client runtime.
Proto (extracted from the installed bundle):
- agent_v1: AgentStoreConflict* messages, MountedAgentStore(+Kind),
CloudSubagentParentSpawnKind + parent_spawn_kind/parent_spawn_id on
CloudSubagentParentReference.
Prompts (all modes re-synced, keeping the repo's Chinese translations):
- agent: persistence section and current tool-calling/linter rules.
- ask/plan/debug: current mode reminders (plan/debug via reminder assets).
- multitask/subagent: delegation flow (Task/create-agent/AWAIT) and
child-conversation reporting rules.
- New prompt/projects and prompt/orchestrator assets; embed.go registers
ModeProjects/ModeOrchestrator.
Orchestration tools (bridged to the client, which executes subagents):
- tools.json gains create-agent / send-message-to-agent / AWAIT schemas
(agent, multitask, projects, orchestrator).
- exec bridge: create-agent -> ForceBackgroundSubagentArgs,
send-message-to-agent -> SubagentArgs with resume_agent_id,
AWAIT -> SubagentAwaitArgs; result handling for
ForceBackgroundSubagentResult and SubagentAwaitResult (all oneof cases).
- forwarder: tool allowlist, isExecTool, started task_tool_call display
for create-agent (so the client can resolve the tool_call_id),
deriveToolNameFromPendingExec mappings.
Projects mode (AGENT_MODE_PROJECT):
- mapPromptMode -> ModeProjects (tool_catalog + prompt engine),
isSupportedActiveMode, supportedToolNamesForMode (full agent tool set),
modeAlias/parseModeAlias/parseTargetModeID ('projects').
Statsig mocks: enable agent_store_sync_client,
agent_store_conflict_notices, agent_store_principal_local_mounts,
long_running_jobs, glass_projects_enabled, project_followups_use_steering.
Verified end-to-end through the local proxy with cursor-agent CLI:
Task delegation round-trips (root delegates, subagent executes, result
returns); base CLI flow and model listing unchanged; zero unimplemented
responses in a full session. create-agent/AWAIT depend on client-side
handlers that headless cursor-agent 2026.07.23 does not provide
(cursor-agent-svc background runtime / subagentAwaitArgs handler);
desktop 3.14.7 bundles the handlers.
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.
TL;DR
本 PR 将本地 backend 的 agent 能力对齐到 Cursor 3.14.7 客户端:新增模型可见的 orchestration 工具(
create-agent/send-message-to-agent/AWAIT,经 exec 桥交给客户端执行)、完整接入AGENT_MODE_PROJECT(Projects 模式)、按 bundle 重同步全部模式 prompt 与 proto,并开启 6 个 agent 相关 statsig 门控。e2e 验证Task委派全链路可用,整会话 0 个unimplemented响应。概述 / Summary
Fixes #244。Stacked on #241(请先合并 #241,合并后本 PR 的 diff 会缩减为纯本特性内容)。
此前本地 backend 的 agent 表面停留在旧快照:除
Task外没有 orchestration 工具、不支持AGENT_MODE_PROJECT、prompt/proto/tools 均来自旧版 bundle。本 PR 借助现有 exec 桥架构把这三项全部对齐到已安装的 Cursor 3.14.7 bundle——orchestration 工具下发给客户端 runtime 执行(与现有Task同一模式),因此无需引入服务端子代理运行时。改动内容 / Changes
proto/agent_v1.proto,重新生成gen/):AgentStoreConflict*、MountedAgentStore(+Kind)、CloudSubagentParentSpawnKind、CloudSubagentParentReference新增parent_spawn_kind/parent_spawn_id——均提取自 3.14.7 bundle。prompt/*/tools.json(agent、multitask、projects、orchestrator)新增create-agent、send-message-to-agent、AWAITschema。internal/backend/agent/bridge/exec/bridge.go:create-agent→ForceBackgroundSubagentArgs,send-message-to-agent→ 带resume_agent_id的SubagentArgs,AWAIT→SubagentAwaitArgs;ForceBackgroundSubagentResult与SubagentAwaitResult的全部 oneof 分支处理。tool_catalog.go)、isExecTool(service.go)、deriveToolNameFromPendingExec映射,以及为create-agent生成task_tool_callstarted 展示消息(events.go),使客户端能解析ForceBackgroundSubagent引用的tool_call_id。AGENT_MODE_PROJECT→ModeProjects(tool_catalog.go、prompt/engine.go)、isSupportedActiveMode、supportedToolNamesForMode(完整 agent 工具集)、modeAlias/parseModeAlias/parseTargetModeID("projects")、reminders 安全回退。prompt/projects与prompt/orchestrator资产并在embed.go注册。agent_store_sync_client、agent_store_conflict_notices、agent_store_principal_local_mounts、long_running_jobs、glass_projects_enabled、project_followups_use_steering。明确不包含 / Out of scope
tools.json。2026.07.23上create-agent/AWAIT的客户端限制:客户端返回FORCE_BACKGROUND_SUBAGENT_STATUS_NOT_FOUND(后台子代理运行于cursor-agent-svc守护进程,headless 环境不存在)以及No handler found for server message of type subagentAwaitArgs。线上协议字节是正确的(见测试证据);desktop 3.14.7 自带这两个处理器。prompt/orchestrator目前仅作资产存在——现行客户端协议中没有独立的 orchestrator 模式。测试 / Test plan
按仓库惯例不提交测试文件;验证均基于真实链路端到端进行(源码启动的 backend + mitm 测试端口,以及重新构建并替换安装的
/Applications/Cursor助手.app于127.0.0.1:18080):Task委派 e2e:cursor-agent -p "используй Task ..."→ root 委派、子代理执行(subagent_args→subagent_result)、子代理写入文件、返回合并答案——证据见history/<conv>/debug/{runsse,bidi.decoded}.jsonlcreate-agent线上协议:runsse.jsonl中存在task_tool_callstarted 展示 +force_background_subagent_args{tool_call_id};客户端NOT_FOUND限制已记录(见 Out of scope)AWAIT线上协议:runsse.jsonl中存在subagent_await_args;客户端缺少处理器的事实已记录AGENT_MODE_PROJECT:模式校验、工具过滤、序列化别名——grep 验证;go build ./...与go vet通过--list-models(渠道 hash id)、git 仓库内基础 agent 流程(fs 工具)、重建安装包后桌面端 repo-sync(FastRepoInitHandshakeV2/FastRepoSyncComplete/FSUploadFile)404/unimplemented响应(app.logpath=请求日志)分支基于
fix/cli-local-mode-endpoints(#241),可干净合入。