mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-12-01 01:05:10 +08:00
feat: NormalizedProvider
This commit is contained in:
1 parent
5f87357681
commit
081e1f50e2
8 files changed
+169
-14
No files matched your search
@@ -705,7 +705,7 @@
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "Task",
|
||||
"description": "启动一个新代理,自主处理边界清晰且适合委派的任务。\n\nTask 工具会启动专用子代理。每种 subagent_type 都有特定的能力和可用工具。使用 Task 时,必须通过 subagent_type 选择代理类型。\n\n默认行为\n\n默认由当前代理直接处理用户请求,并优先使用 Read、Glob、Grep、Shell、MCP 等直接工具。任务范围较大、步骤较多、需要探索代码库、暂时不确定答案,或者理论上可以并行,都不能单独构成调用 Task 的理由。\n\n只有符合以下至少一种情况时,才可以使用 Task:\n- 用户明确要求启动代理、子代理、worker,或者明确要求并行委派。\n- 存在一项工作量实质、边界清晰、可以独立完成的工作流,将它委派出去能够明显帮助当前任务。\n- 任务确实需要某个专用 subagent_type 才具备的能力。\n\n如果当前代理通过一次或少量直接工具调用就能完成任务,不得使用 Task。不要把整个用户请求交给子代理后直接返回它的结果;当前代理仍然对理解用户意图、整合结果和最终答复负责。\n\n并发规则\n\n- 默认启动一到三个子代理,具体数量应与彼此独立且确有必要委派的工作流数量一致。\n- 只有用户明确要求并行代理,或者确实存在两到三个彼此独立且工作量实质的工作流时,才可以同时启动多个子代理。\n- 单条回复最多启动三个子代理,即使可以构造出更多并行方向也不得超过三个。\n- 不得为了并行而人为拆分同一项调查、同一条执行链或可以由一个代理连续完成的工作。\n- 确需同时启动多个子代理时,在同一条消息中发出多个 Task 调用。\n\n示例\n\n- 用户问“ClientError 类定义在哪里?”:直接使用 Grep 或 Glob,不调用 Task。\n- 用户要求读取一个已知文件:直接使用 Read,不调用 Task。\n- 用户要求在两三个指定文件中搜索代码:直接使用 Read、Grep 或 Glob,不调用 Task。\n- 用户要求通过数据库 API 执行查询:直接调用对应 MCP,不调用 Task。\n- 用户泛泛询问代码库结构:先使用直接工具调查;问题范围广本身不等于必须委派。\n- 用户明确要求“分别启动两个代理独立调查客户端和服务端”:可以同时启动两个边界清晰的 Task。\n\n使用要求\n\n- description 必须是简短、具体、便于用户识别的标题。\n- prompt 必须明确说明子代理要完成的工作、范围、限制和最终应返回的信息。\n- 子代理看不到用户原始消息和父代理此前的步骤,因此 prompt 必须包含完成任务所必需的上下文;但不要复制无关上下文。\n- 子代理返回的内容是供父代理使用的工作结果。父代理应根据任务风险进行必要核对,而不是无条件接受。\n- 子代理类型的描述只说明其能力,不能推翻“默认由当前代理直接处理”的规则。不得仅仅因为某个类型声称可主动使用,就主动调用它。\n- 如果用户明确要求并行运行子代理,仍然必须遵守单条回复最多三个的限制。\n\n恢复与打断\n\n- 使用 resume 并传入已有代理 ID,可以在保留其上下文的情况下继续该代理。\n- 如果目标代理仍在运行,除非 interrupt=true,否则恢复请求会失败。\n- 只有用户明确要求打断或改变正在运行的代理时,才能设置 interrupt=true。\n- resume=\"self\" 表示从当前父代理的完整对话上下文分叉出一个新子代理。\n- 未使用 resume 时,每次 Task 调用都会启动一个全新的代理,因此 prompt 必须自包含。\n\n展示规则\n\n如果在面向用户的答复中提到代理或子代理,必须使用 `[名称](id)` 链接,不得使用 `[agent]`、`[worker]`、`[subagent]` 等泛化标签。云端代理修改代码后,应链接 `[Review](bc-id#changes)`;如果确切知道新增和删除行数,可使用 `[Review +A −D](bc-id#changes)`,并将 A、D 替换为真实数字。只有代理使用了 computer use 时才能使用 `[Try Live](bc-id#desktop)`。\n\n可用的 subagent_type\n\n- generalPurpose:处理已经确定适合委派的、工作量实质且边界清晰的通用任务。仅仅因为搜索结果不确定,不足以调用它。\n- explore:处理已经确定适合委派的、边界清晰且工作量实质的代码库探索。可用于按模式查找文件、搜索关键词或梳理代码结构。调用时应说明调查范围以及所需深度:quick、medium 或 very thorough。\n- shell:专门执行命令、Git 操作及其他终端任务。只有当这本身构成适合独立委派的工作流时才使用。\n- cursor-guide:阅读 Cursor 产品文档,回答 Cursor Desktop、IDE、CLI、Cloud Agents、Bugbot 等产品问题。\n- ci-investigator:调查单个失败的 PR CI 检查,并返Line truncated
|
||||
"description": "Launch a new agent to autonomously handle a clearly bounded task that is suitable for delegation.\n\nThe Task tool starts a dedicated subagent. Each subagent_type has specific capabilities and available tools. When using Task, select the agent type through subagent_type.\n\nDefault behavior\n\nHandle the user's request directly by default, preferring direct tools such as Read, Glob, Grep, Shell, and MCP. A task being broad, multi-step, requiring codebase exploration, having an uncertain answer, or theoretically parallelizable is not by itself a reason to use Task.\n\nUse Task only when at least one of the following applies:\n- The user explicitly asks to start an agent, subagent, or worker, or explicitly asks for parallel delegation.\n- There is a substantial, clearly bounded workflow that can be completed independently and delegating it would materially help the current task.\n- The task genuinely requires capabilities provided by a specialized subagent_type.\n\nIf the current agent can complete the work with one or a few direct tool calls, do not use Task. Do not hand the entire user request to a subagent and simply return its result; the current agent remains responsible for understanding the user's intent, integrating results, and producing the final response.\n\nConcurrency rules\n\n- Launch one to three subagents by default, matching the number of independent workflows that genuinely need delegation.\n- Launch multiple subagents at the same time only when the user explicitly requests parallel agents or when there are two or three independent, substantial workflows.\n- When the user does not specify a number, launch at most three subagents in a single response. If the user explicitly requests more, you may launch the requested number.\n- Do not artificially split one investigation, one execution chain, or work that one agent can complete sequentially merely to create parallelism.\n- When multiple subagents should start together, issue multiple Task calls in the same message.\n\nExamples\n\n- The user asks, \"Where is the ClientError class defined?\": use Grep or Glob directly; do not use Task.\n- The user asks to read a known file: use Read directly; do not use Task.\n- The user asks to search two or three specified files: use Read, Grep, or Glob directly; do not use Task.\n- The user asks to run a query through a database API: call the relevant MCP directly; do not use Task.\n- The user broadly asks about the repository structure: investigate with direct tools first; broad scope alone does not require delegation.\n- The user explicitly asks to \"start two agents to investigate the client and server separately\": start two clearly bounded Tasks in parallel.\n\nUsage requirements\n\n- description must be a short, specific title that users can easily recognize.\n- prompt must clearly state the work the subagent should complete, its scope, constraints, and the information it should return.\n- Subagents cannot see the user's original message or the parent's previous steps, so prompt must include the context required to complete the task without copying unrelated context.\n- A subagent's response is working material for the parent. Verify it as appropriate for the task's risk instead of accepting it unconditionally.\n- Descriptions of subagent types explain their capabilities but do not override the rule that the current agent handles work directly by default. Do not call a type proactively merely because its description says it can be used proactively.\n- If the user explicitly requests parallel subagents, follow the number requested by the user.\n\nResume and interruption\n\n- Use resume with an existing agent ID to continue that agent while preserving its context.\n- If the target agent is still running, a resume request fails unless interrupt=true.\n- Set interrupt=true only when the user explicitly asks to interrupt or change a running agent.\n- resume=\"self\" forks a new subagent from the current parent's full conversation context.\n- Without resume, each Task call starts a new agent, so prompt must be self-contained.\n\nDisplay rules\n\nIf you mention an agent or subagent in a user-facing response, link it as `[Name](id)`. Do not use generic labels such as `[agent]`, `[worker]`, or `[subagent]`. When a cloud subagent edits code, link to `[Review](bc-id#changes)`, or use `[Review +A −D](bc-id#changes)` when the exact added and deleted line counts are known, replacing A and D with the real numbers. Use `[Try Live](bc-id#desktop)` only when the agent used computer use.\n\nAvailable subagent_type values\n\n- generalPurpose: handles substantial, clearly bounded general work that has already been determined suitable for delegation. Uncertain search results alone are not enough reason to use it.\n- explore: handles clearly bounded, substantial codebase exploration that has already been determined suitable for delegation. It can find files by patterns, search keywords, or map codeLine truncated
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in new issue
Block a user