Skip to content

feat(backend): orchestration tools, Projects mode, prompt/proto re-sync with Cursor 3.14.7 - #245

Open
warelik wants to merge 2 commits into
leookun:mainfrom
warelik:feat/orchestration-agent-features
Open

feat(backend): orchestration tools, Projects mode, prompt/proto re-sync with Cursor 3.14.7#245
warelik wants to merge 2 commits into
leookun:mainfrom
warelik:feat/orchestration-agent-features

Conversation

@warelik

@warelik warelik commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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 #244Stacked 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

  • Protoproto/agent_v1.proto,重新生成 gen/):AgentStoreConflict*MountedAgentStore(+Kind)CloudSubagentParentSpawnKindCloudSubagentParentReference 新增 parent_spawn_kind/parent_spawn_id——均提取自 3.14.7 bundle。
  • Orchestration 工具
    • 全部 prompt/*/tools.json(agent、multitask、projects、orchestrator)新增 create-agentsend-message-to-agentAWAIT schema。
    • internal/backend/agent/bridge/exec/bridge.gocreate-agentForceBackgroundSubagentArgssend-message-to-agent → 带 resume_agent_idSubagentArgsAWAITSubagentAwaitArgsForceBackgroundSubagentResultSubagentAwaitResult 的全部 oneof 分支处理。
    • forwarder:工具白名单(tool_catalog.go)、isExecToolservice.go)、deriveToolNameFromPendingExec 映射,以及为 create-agent 生成 task_tool_call started 展示消息(events.go),使客户端能解析 ForceBackgroundSubagent 引用的 tool_call_id
  • Projects 模式AGENT_MODE_PROJECTModeProjectstool_catalog.goprompt/engine.go)、isSupportedActiveModesupportedToolNamesForMode(完整 agent 工具集)、modeAlias/parseModeAlias/parseTargetModeID"projects")、reminders 安全回退。
  • Prompt:全模式与 bundle 重同步(保留仓库中文译文)——persistence 段、现行 tool-calling/linter 规则、ask/plan/debug reminders、multitask/subagent 委派流程;新增 prompt/projectsprompt/orchestrator 资产并在 embed.go 注册。
  • Statsig mock:开启 agent_store_sync_clientagent_store_conflict_noticesagent_store_principal_local_mountslong_running_jobsglass_projects_enabledproject_followups_use_steering

明确不包含 / Out of scope

  • 本地 runtime 无法服务的 30+ bundle 工具(browser/computer-use/media 等)——未加入 tools.json
  • headless cursor-agent 2026.07.23create-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助手.app127.0.0.1:18080):

  • Task 委派 e2e:cursor-agent -p "используй Task ..." → root 委派、子代理执行(subagent_argssubagent_result)、子代理写入文件、返回合并答案——证据见 history/<conv>/debug/{runsse,bidi.decoded}.jsonl
  • create-agent 线上协议:runsse.jsonl 中存在 task_tool_call started 展示 + 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
  • 整会话审计:0404/unimplemented 响应(app.log path= 请求日志)
  • 交叉评审:独立评审代理核验了侦察偏移量、proto 字段号与 bundle 的一致性、prompt 保真度、门控清单与整体 diff 连贯性——全部 PASS

分支基于 fix/cli-local-mode-endpoints#241),可干净合入。

warelik added 2 commits August 1, 2026 10:58
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Orchestration 工具(create-agent/AWAIT)、Projects 模式、按 Cursor 3.14.7 重同步 prompt/proto

1 participant