@qwen-code/qwen-code 0.17.0-preview.0 → 0.17.1-nightly.20260604.16dd99fa3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/bundled/qc-helper/docs/features/approval-mode.md +26 -22
  2. package/bundled/qc-helper/docs/features/commands.md +12 -10
  3. package/bundled/qc-helper/docs/features/status-line.md +161 -27
  4. package/chunks/{agent-Z7O3I6MY.js → agent-GNHB6UIW.js} +10 -10
  5. package/chunks/{anthropicContentGenerator-UCGOKLGC.js → anthropicContentGenerator-M45RXZVS.js} +3 -3
  6. package/chunks/{askUserQuestion-DC6OWQIL.js → askUserQuestion-TGRD7FNQ.js} +1 -1
  7. package/chunks/{ca-NMZFEGAU.js → ca-6RSCDYUS.js} +2 -1
  8. package/chunks/{chunk-J5VCSWPA.js → chunk-3PJXIDKI.js} +1153 -103
  9. package/chunks/{chunk-FEENTAB2.js → chunk-6O244QKR.js} +1 -1
  10. package/chunks/chunk-7TQVELRB.js +10412 -0
  11. package/chunks/{chunk-HCSJIOLR.js → chunk-BNESGOSJ.js} +7450 -3516
  12. package/chunks/{chunk-V7LMZR76.js → chunk-JBSYXHJF.js} +1 -1
  13. package/chunks/{chunk-R2B65CAN.js → chunk-JKUAX6UT.js} +0 -1
  14. package/chunks/{chunk-7JHNICSJ.js → chunk-JR346RJ5.js} +643 -136
  15. package/chunks/{chunk-4Q4IDQE5.js → chunk-K3VUDSWM.js} +4 -4
  16. package/chunks/{chunk-MJCO2CPA.js → chunk-NDZEP7SA.js} +45 -6
  17. package/chunks/{chunk-BF5WTWOH.js → chunk-NJY4F5NM.js} +3 -3
  18. package/chunks/{chunk-U2K6HDUJ.js → chunk-QVJ33ZBG.js} +23 -13
  19. package/chunks/{chunk-HAQCNXSG.js → chunk-RQW7WUJR.js} +15 -0
  20. package/chunks/{chunk-UQRYJQBE.js → chunk-SOGUPKP6.js} +1 -1
  21. package/chunks/{chunk-ZWH2TVVN.js → chunk-XK4IGU5E.js} +10 -10
  22. package/chunks/{chunk-OXXOAIGT.js → chunk-YVGIQ2CS.js} +333 -1162
  23. package/chunks/{computer-use-2J5ZXEER.js → computer-use-NAHQPV2L.js} +24 -6
  24. package/chunks/{contextCommand-FU55EUOH.js → contextCommand-VKNIA257.js} +12 -12
  25. package/chunks/{cron-create-FXRORK2U.js → cron-create-V3UK2SJN.js} +1 -1
  26. package/chunks/{cron-delete-D24IN6CA.js → cron-delete-MANALPCP.js} +1 -1
  27. package/chunks/{cron-list-SMOX26SL.js → cron-list-UDIYK3B3.js} +1 -1
  28. package/chunks/{de-OIMT3OMI.js → de-APURNJ3I.js} +2 -1
  29. package/chunks/{dist-GRQVFL3G.js → dist-ATAKC63R.js} +1 -1
  30. package/chunks/{edit-UQFK25NR.js → edit-YP22XCVA.js} +10 -10
  31. package/chunks/{en-2IFZ5THF.js → en-FYO57HJW.js} +3 -1
  32. package/chunks/{enter-worktree-VZT6JX45.js → enter-worktree-BD7UFMUZ.js} +10 -10
  33. package/chunks/{exit-worktree-JETQQ26R.js → exit-worktree-AVWBCQWY.js} +10 -10
  34. package/chunks/{exitPlanMode-SFNBASAU.js → exitPlanMode-2D6EGF76.js} +10 -10
  35. package/chunks/{fr-PVELSHTV.js → fr-32YHQZIS.js} +2 -1
  36. package/chunks/{geminiContentGenerator-XWUW7B7J.js → geminiContentGenerator-YFVW6DXY.js} +2 -2
  37. package/chunks/{glob-34CPYA2M.js → glob-NZWP66L5.js} +10 -10
  38. package/chunks/{grep-4RXPZUYZ.js → grep-RFEZDGI4.js} +10 -10
  39. package/chunks/{ja-P5TK5GNN.js → ja-PEUXN4XT.js} +2 -1
  40. package/chunks/{ls-7FYQHPWF.js → ls-T4SVZWR6.js} +1 -1
  41. package/chunks/{lsp-DKG34USR.js → lsp-U4ZQLNIS.js} +1 -1
  42. package/chunks/{monitor-QCNAUO75.js → monitor-OHKCQLFQ.js} +10 -10
  43. package/chunks/{multipart-parser-IXGBIOIN.js → multipart-parser-AJ4WASWR.js} +2 -2
  44. package/chunks/{notebook-edit-I2MBTWI6.js → notebook-edit-AFRICVUX.js} +10 -10
  45. package/chunks/{openaiContentGenerator-VNQUJIG5.js → openaiContentGenerator-47KB64GP.js} +8 -8
  46. package/chunks/{pt-A5GHG66T.js → pt-2INS7YVC.js} +2 -1
  47. package/chunks/{qwenContentGenerator-LICFK2K7.js → qwenContentGenerator-7BC2OW3T.js} +12 -12
  48. package/chunks/{read-file-N2YTOQ2U.js → read-file-MXUW3RUF.js} +5 -5
  49. package/chunks/{ripGrep-NBWBOVPW.js → ripGrep-AHBINNF3.js} +10 -10
  50. package/chunks/{ru-66XKB4QX.js → ru-6CQ5HNHB.js} +2 -1
  51. package/chunks/{scheduler-XHHMN7TA.js → scheduler-KBRJ3LFC.js} +10 -10
  52. package/chunks/{send-message-ZL7CDM7K.js → send-message-GFYV7WLL.js} +1 -1
  53. package/chunks/{serve-HESJL2FH.js → serve-PVFP6HD7.js} +12 -12
  54. package/chunks/{shell-V7PVS7O7.js → shell-JOXQ5PPL.js} +10 -10
  55. package/chunks/{skill-6LP5ANRL.js → skill-73RYGDJQ.js} +6 -6
  56. package/chunks/{src-TMOD5X6F.js → src-7XL4G4DC.js} +88 -46
  57. package/chunks/{src-4TLZBCTV.js → src-DR3Y7J6D.js} +14 -12
  58. package/chunks/{syntheticOutput-U3YJ3GOO.js → syntheticOutput-DM43O6TY.js} +2 -2
  59. package/chunks/{task-stop-NPUI3YBA.js → task-stop-WKP5OB3V.js} +1 -1
  60. package/chunks/{todoWrite-USWGQJ53.js → todoWrite-GHL6DCLP.js} +8 -2
  61. package/chunks/{tool-search-6CRPUSUB.js → tool-search-DRMR34WX.js} +5 -5
  62. package/chunks/{web-fetch-LGLGFGGT.js → web-fetch-SZIV74ZX.js} +2 -2
  63. package/chunks/{write-file-CCMVL5Q7.js → write-file-B45ZAKUJ.js} +12 -12
  64. package/chunks/{zh-TW-3ND6DQRX.js → zh-TW-SSL3ATVZ.js} +3 -1
  65. package/chunks/{zh-OB5P2ZDO.js → zh-ZHZCMIRG.js} +3 -1
  66. package/cli.js +32976 -50717
  67. package/locales/ca.js +2 -1
  68. package/locales/de.js +2 -1
  69. package/locales/en.js +4 -1
  70. package/locales/fr.js +2 -1
  71. package/locales/ja.js +2 -1
  72. package/locales/pt.js +2 -1
  73. package/locales/ru.js +2 -1
  74. package/locales/zh-TW.js +4 -1
  75. package/locales/zh.js +4 -1
  76. package/package.json +2 -2
  77. package/chunks/chunk-EM6ETG2K.js +0 -60
  78. package/chunks/chunk-TI4GXJKO.js +0 -4277
  79. package/chunks/multipart-parser-3QWGTLK3.js +0 -384
  80. package/chunks/src-IPWIHNMI.js +0 -1406
@@ -24,7 +24,7 @@ import {
24
24
  isInitializedNotification,
25
25
  isJSONRPCRequest,
26
26
  isJSONRPCResultResponse
27
- } from "./chunk-TI4GXJKO.js";
27
+ } from "./chunk-7TQVELRB.js";
28
28
  import {
29
29
  NEVER2 as NEVER,
30
30
  ZodIssueCode2 as ZodIssueCode,
@@ -41,7 +41,7 @@ import {
41
41
  } from "./chunk-AKBFRR6J.js";
42
42
  import {
43
43
  runSideQuery
44
- } from "./chunk-FEENTAB2.js";
44
+ } from "./chunk-6O244QKR.js";
45
45
  import {
46
46
  escapeSystemReminderTags,
47
47
  escapeXml
@@ -51,13 +51,14 @@ import {
51
51
  HOOKS_CONFIG_FIELDS,
52
52
  HookEventName,
53
53
  PermissionRequestHookOutput,
54
+ PostToolBatchHookOutput,
54
55
  PostToolUseFailureHookOutput,
55
56
  PostToolUseHookOutput,
56
57
  PreToolUseHookOutput,
57
58
  StopHookOutput,
58
59
  createHookOutput,
59
60
  getHookKey
60
- } from "./chunk-HAQCNXSG.js";
61
+ } from "./chunk-RQW7WUJR.js";
61
62
  import {
62
63
  DEFAULT_FILE_FILTERING_OPTIONS
63
64
  } from "./chunk-77WXWU44.js";
@@ -101,6 +102,7 @@ import {
101
102
  addToolInputAttributes,
102
103
  addToolResultAttributes,
103
104
  addUserPromptAttributes,
105
+ clearDetailedSpanState,
104
106
  createContentGenerator,
105
107
  defaultModalities,
106
108
  endHookSpan,
@@ -165,7 +167,7 @@ import {
165
167
  truncateSpanError,
166
168
  truncateToolOutput,
167
169
  uiTelemetryService
168
- } from "./chunk-OXXOAIGT.js";
170
+ } from "./chunk-YVGIQ2CS.js";
169
171
  import {
170
172
  safeJsonStringify
171
173
  } from "./chunk-W57YDFU5.js";
@@ -184,7 +186,7 @@ import {
184
186
  } from "./chunk-NQ3E7YLD.js";
185
187
  import {
186
188
  STRUCTURED_OUTPUT_REDACTED_ARGS
187
- } from "./chunk-UQRYJQBE.js";
189
+ } from "./chunk-SOGUPKP6.js";
188
190
  import {
189
191
  ToolDisplayNames,
190
192
  ToolDisplayNamesMigration,
@@ -199,7 +201,7 @@ import {
199
201
  SchemaValidator,
200
202
  hasCycleInSchema,
201
203
  isTool
202
- } from "./chunk-R2B65CAN.js";
204
+ } from "./chunk-JKUAX6UT.js";
203
205
  import {
204
206
  atomicWriteFile,
205
207
  atomicWriteFileSync,
@@ -207,7 +209,7 @@ import {
207
209
  } from "./chunk-HX3JRTWL.js";
208
210
  import {
209
211
  require_undici
210
- } from "./chunk-U2K6HDUJ.js";
212
+ } from "./chunk-QVJ33ZBG.js";
211
213
  import {
212
214
  DEFAULT_TOKEN_LIMIT,
213
215
  ESCALATED_MAX_TOKENS,
@@ -219,7 +221,7 @@ import {
219
221
  createUserContent,
220
222
  mcpToTool,
221
223
  require_src as require_src2
222
- } from "./chunk-HCSJIOLR.js";
224
+ } from "./chunk-BNESGOSJ.js";
223
225
  import {
224
226
  PATH_ARG_KEYS,
225
227
  QWEN_DIR,
@@ -33548,12 +33550,11 @@ You are Qwen Code, an interactive CLI agent developed by Alibaba Group, speciali
33548
33550
  - **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
33549
33551
  - **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
33550
33552
  - **Comments:** Default to none. Only add a comment when the _why_ cannot be conveyed through naming or code structure \u2014 a hidden constraint, a subtle invariant, or a workaround for a specific bug. Do not narrate what the code does. Do not edit comments that are separate from the code you are changing. *NEVER* talk to the user or describe your changes through comments.
33551
- - **Proactiveness:** Fulfill the user's request thoroughly. When adding features or fixing bugs, this includes adding tests to ensure quality. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.
33553
+ - **Proactiveness:** Fulfill the user's request thoroughly. When the task involves code modifications, add tests to verify the change works. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.
33552
33554
  - **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
33553
- - **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
33554
- - **Path Construction:** Before using any file system tool (e.g., ${ToolNames.READ_FILE}' or '${ToolNames.WRITE_FILE}'), you must construct the full absolute path for the file_path argument. Always combine the absolute path of the project's root directory with the file's path relative to the root. For example, if the project root is /path/to/project/ and the file is foo/bar/baz.txt, the final path you must use is /path/to/project/foo/bar/baz.txt. If the user provides a relative path, you must resolve it against the root directory to create an absolute path.
33555
33555
  - **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.
33556
33556
 
33557
+
33557
33558
  # Task Management
33558
33559
  You have access to the ${ToolNames.TODO_WRITE} tool to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
33559
33560
  These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.
@@ -33601,37 +33602,38 @@ I've found some existing telemetry code. Let me mark the first todo as in_progre
33601
33602
  [Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]
33602
33603
  </example>
33603
33604
 
33604
- # Asking questions as you work
33605
-
33606
- You have access to the ${ToolNames.ASK_USER_QUESTION} tool to ask the user questions when you need clarification, want to validate assumptions, or need to make a decision you're unsure about. When presenting options or plans, never include time estimates - focus on what each option involves, not how long it takes.
33607
-
33608
33605
  # Primary Workflows
33609
33606
 
33610
33607
  ## Software Engineering Tasks
33611
33608
  When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this iterative approach:
33612
33609
  - **Plan:** After understanding the user's request, create an initial plan based on your existing knowledge and any immediately obvious context. Use the '${ToolNames.TODO_WRITE}' tool to capture this rough plan for complex or multi-step work. Don't wait for complete understanding - start with what you know.
33613
- - **Implement:** Begin implementing the plan while gathering additional context as needed. Use '${ToolNames.GREP}', '${ToolNames.GLOB}', and '${ToolNames.READ_FILE}' tools strategically when you encounter specific unknowns during implementation. Use the available tools (e.g., '${ToolNames.EDIT}', '${ToolNames.WRITE_FILE}' '${ToolNames.SHELL}' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core Mandates').
33614
- - **Adapt:** As you discover new information or encounter obstacles, update your plan and todos accordingly. Mark todos as in_progress when starting and completed when finishing each task. Add new todos if the scope expands. Refine your approach based on what you learn.
33615
- - **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands.
33616
- - **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards. If unsure about these commands, you can ask the user if they'd like you to run them and if so how to.
33610
+ - **Implement:** Begin implementing while gathering context as needed. Use available search and editing tools strategically, adhering to project conventions (see 'Core Mandates'). Do not add features, refactor code, or make "improvements" beyond what was asked. Don't add error handling, fallbacks, or validation for scenarios that can't happen\u2014only validate at system boundaries (user input, external APIs). Don't create helpers, utilities, or abstractions for one-time operations. Three similar lines of code is better than a premature abstraction. Prefer editing existing files over creating new ones.
33611
+ - **Adapt:** As you discover new information or encounter obstacles, update your plan and todos accordingly. Mark todos as in_progress when starting and completed when finishing each task. Add new todos if the scope expands. Refine your approach based on what you learn. If an approach fails, diagnose why before switching tactics\u2014read the error, check your assumptions, try a focused fix. Don't retry blindly, but don't abandon a viable approach after a single failure.
33612
+ - **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands. Before reporting a task complete, verify it actually works. If you can't verify (no test exists, can't run the code), say so explicitly rather than claiming success.
33613
+ - **Verify (Standards):** When your task involves a code or system change, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards. Read-only or explanatory turns do not require verification.
33614
+ - **Report outcomes faithfully:** If tests fail, say so with the relevant output. If you did not run a verification step, say that rather than implying it succeeded. Never claim "all tests pass" when output shows failures, never suppress failing checks to manufacture a green result, and never characterize incomplete or broken work as done.
33617
33615
 
33618
33616
  **Key Principle:** Start with a reasonable plan based on available information, then adapt as you learn. Users prefer seeing progress quickly rather than waiting for perfect understanding.
33619
33617
 
33620
33618
  - Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.
33621
33619
 
33622
- IMPORTANT: Always use the ${ToolNames.TODO_WRITE} tool to plan and track tasks throughout the conversation.
33623
-
33624
33620
  ## New Applications
33625
33621
 
33626
33622
  When a user wants to create a new application, project, website, game, or library from scratch, use the '${ToolNames.SKILL}' tool with skill="new-app" to load the detailed workflow and tech-stack guidance.
33627
33623
 
33628
33624
  # Operational Guidelines
33629
33625
 
33626
+ ## Communicating With the User
33627
+
33628
+ Before your first tool call, briefly state what you're about to do. While working, give short updates at key moments: when you find something load-bearing (a bug, a root cause), when changing direction, or when you've made progress without an update.
33629
+
33630
+ End-of-turn summary: one or two sentences. What changed and what's next. Nothing else.
33631
+
33630
33632
  ## Tone and Style (CLI Interaction)
33631
33633
  - **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
33632
33634
  - **Minimal Output:** Aim for fewer than 3 lines of text output (excluding tool use/code generation) per response whenever practical. Focus strictly on the user's query.
33633
33635
  - **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.
33634
- - **No Chitchat:** Avoid conversational filler, preambles ("Okay, I will now..."), or postambles ("I have finished the changes..."). Get straight to the action or answer.
33636
+ - **No Chitchat:** Avoid conversational filler and chitchat. Get straight to the action or answer.
33635
33637
  - **Formatting:** Use GitHub-flavored Markdown. Responses will be rendered in monospace.
33636
33638
  - **Tools vs. Text:** Use tools for actions, text output *only* for communication. Do not add explanatory comments within tool calls or code blocks unless specifically part of the required code/command itself.
33637
33639
  - **Handling Inability:** If unable/unwilling to fulfill a request, state so briefly (1-2 sentences) without excessive justification. Offer alternatives if appropriate.
@@ -33640,16 +33642,22 @@ When a user wants to create a new application, project, website, game, or librar
33640
33642
  - **Explain Critical Commands:** Before executing commands with '${ToolNames.SHELL}' that modify the file system, codebase, or system state, you *must* provide a brief explanation of the command's purpose and potential impact. Prioritize user understanding and safety. You should not ask permission to use the tool; the user will be presented with a confirmation dialogue upon use (you do not need to tell them this).
33641
33643
  - **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
33642
33644
 
33643
- ## Tool Usage
33645
+ ## Using Your Tools
33646
+ - **Prefer Dedicated Tools:** Do NOT use the '${ToolNames.SHELL}' to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:
33647
+ - To read files use '${ToolNames.READ_FILE}' instead of cat, head, tail, or sed
33648
+ - To edit files use '${ToolNames.EDIT}' instead of sed or awk
33649
+ - To create files use '${ToolNames.WRITE_FILE}' instead of cat with heredoc or echo redirection
33650
+ - To search for files use '${ToolNames.GLOB}' instead of find or ls
33651
+ - To search the content of files, use '${ToolNames.GREP}' instead of grep or rg
33652
+ - Reserve using the '${ToolNames.SHELL}' exclusively for system commands and terminal operations that require shell execution. If you are unsure and there is a relevant dedicated tool, default to using the dedicated tool and only fallback on using the '${ToolNames.SHELL}' tool for these if it is absolutely necessary.
33653
+ - **Task Management:** Break down and manage your work with the '${ToolNames.TODO_WRITE}' tool. These tools are helpful for planning your work and helping the user track your progress. Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed.
33654
+ - **Parallel Tool Calls:** You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead.
33644
33655
  - **File Paths:** Always use absolute paths when referring to files with tools like '${ToolNames.READ_FILE}' or '${ToolNames.WRITE_FILE}'. Relative paths are not supported. You must provide an absolute path.
33645
- - **Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase).
33646
- - **Command Execution:** Use the '${ToolNames.SHELL}' tool for running shell commands, remembering the safety rule to explain modifying commands first.
33647
33656
  - **Background Processes:** Use background execution with \`is_background: true\` for commands that are unlikely to stop on their own, e.g. \`node server.js\`. Do not append a trailing \`&\` when using the shell tool's managed background mode. If unsure, ask the user.
33648
33657
  - **Interactive Commands:** Try to avoid shell commands that are likely to require user interaction (e.g. \`git rebase -i\`). Use non-interactive versions of commands (e.g. \`npm init -y\` instead of \`npm init\`) when available, and otherwise remind the user that interactive shell commands are not supported and may cause hangs until canceled by the user.
33649
- - **Task Management:** Use the '${ToolNames.TODO_WRITE}' tool proactively for complex, multi-step tasks to track progress and provide visibility to users. This tool helps organize work systematically and ensures no requirements are missed.
33658
+ - **Questions:** Use '${ToolNames.ASK_USER_QUESTION}' when you need clarification or want to validate assumptions. Never include time estimates in options.
33650
33659
  - **Subagent Delegation:** Use the '${ToolNames.AGENT}' tool with specialized agents when the task at hand matches the agent's description. Subagents are valuable for parallelizing independent queries or for protecting the main context window from excessive results, but they should not be used excessively when not needed. Importantly, avoid duplicating work that subagents are already doing - if you delegate research to a subagent, do not also perform the same searches yourself.
33651
- - For simple, directed codebase searches (e.g. for a specific file/class/function) use the '${ToolNames.GREP}' or '${ToolNames.GLOB}' tools directly.
33652
- - For broader codebase exploration and deep research, use the '${ToolNames.AGENT}' tool with subagent_type=Explore. This is slower than using '${ToolNames.GREP}' or '${ToolNames.GLOB}' directly, so use this only when a simple, directed search proves to be insufficient or when your task will clearly require more than 3 queries.
33660
+ - **Codebase Search:** For simple, directed codebase searches (e.g. for a specific file/class/function) use the '${ToolNames.GREP}' or '${ToolNames.GLOB}' tools directly. For broader codebase exploration and deep research, use the '${ToolNames.AGENT}' tool with subagent_type=Explore. This is slower than using '${ToolNames.GREP}' or '${ToolNames.GLOB}' directly, so use this only when a simple, directed search proves to be insufficient or when your task will clearly require more than 3 queries.
33653
33661
  - **Respect User Confirmations:** Most tool calls (also denoted as 'function calls') will first require confirmation from the user, where they will either approve or cancel the function call. If a user cancels a function call, respect their choice and do _not_ try to make the function call again. It is okay to request the tool call again _only_ if the user requests that same tool call on a subsequent prompt. When a user cancels a function call, assume best intentions from the user and consider inquiring if they prefer any alternative paths forward.
33654
33662
 
33655
33663
  ## Interaction Details
@@ -34174,15 +34182,43 @@ function getToolCallExamples(model) {
34174
34182
  return generalToolCallExamples;
34175
34183
  }
34176
34184
  __name(getToolCallExamples, "getToolCallExamples");
34177
- function getSubagentSystemReminder(agentTypes) {
34178
- return `<system-reminder>You have powerful specialized agents at your disposal, available agent types are: ${agentTypes.join(", ")}. PROACTIVELY use the ${ToolNames.AGENT} tool to delegate user's task to appropriate agent when user's task matches agent capabilities. Ignore this message if user's task is not relevant to any agent. This message is for internal use only. Do not mention this to user in your response.</system-reminder>`;
34179
- }
34180
- __name(getSubagentSystemReminder, "getSubagentSystemReminder");
34181
34185
  function getPlanModeSystemReminder(planOnly = false) {
34182
34186
  return `<system-reminder>
34183
- Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supercedes any other instructions you have received (for example, to make edits). Instead, you should:
34184
- 1. Answer the user's query comprehensively
34185
- 2. When you're done researching, present your plan ${planOnly ? "directly" : `by calling the ${ToolNames.EXIT_PLAN_MODE} tool, which will prompt the user to confirm the plan`}. Do NOT make any file changes or run any tools that modify the system state in any way until the user has confirmed the plan. Use ${ToolNames.ASK_USER_QUESTION} if you need to clarify approaches.
34187
+ Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supercedes any other instructions you have received (for example, to make edits).
34188
+
34189
+ ## Iterative Planning Workflow
34190
+
34191
+ You are pair-planning with the user. Explore the code to build context, ask the user questions when you hit decisions you cannot make alone, and refine your plan incrementally.
34192
+
34193
+ ### The Loop
34194
+
34195
+ Repeat this cycle until the plan is complete:
34196
+
34197
+ 1. **Explore** \u2014 Use read-only tools (${ToolNames.READ_FILE}, ${ToolNames.GREP}, ${ToolNames.GLOB}) to read code. Look for existing functions, utilities, and patterns to reuse. For broader or ambiguous tasks, use multiple parallel exploration passes (directly or via agents when appropriate) to understand different parts of the codebase.
34198
+ 2. **Capture findings** \u2014 After each discovery, immediately integrate what you learned into your evolving mental model. Do not wait until the end to synthesize.
34199
+ 3. **Ask the user** \u2014 When you hit an ambiguity or decision you cannot resolve from code alone, use ${ToolNames.ASK_USER_QUESTION}. Then go back to step 1.
34200
+
34201
+ ### First Turn
34202
+
34203
+ Start by quickly scanning a few key files to form an initial understanding of the task scope. Then ask the user your first round of questions if any exist. Do not explore exhaustively before engaging the user.
34204
+
34205
+ ### Asking Good Questions
34206
+
34207
+ - Never ask what you could find out by reading the code
34208
+ - Batch related questions together (use multi-question ${ToolNames.ASK_USER_QUESTION} calls)
34209
+ - Focus on things only the user can answer: requirements, preferences, tradeoffs, edge case priorities
34210
+ - Scale depth to the task \u2014 a vague feature request needs many rounds; a focused bug fix may need one or none
34211
+
34212
+ ### Planning Principles
34213
+
34214
+ - Build a global understanding of how the relevant pieces fit together before deciding on local edits. Do not jump from the first relevant file straight into a plan when the task likely spans multiple files or behaviors.
34215
+ - Design an implementation approach that fits the existing codebase rather than inventing a parallel pattern.
34216
+ - Reference existing functions and utilities you found that should be reused, with their file paths.
34217
+ - Include a verification section describing how to test the changes end-to-end.
34218
+
34219
+ ### When to Converge
34220
+
34221
+ Your plan is ready when you have addressed all ambiguities and it covers: what to change, which files to modify, what existing code to reuse (with file paths), and how to verify the changes. Present your plan ${planOnly ? "directly" : `by calling the ${ToolNames.EXIT_PLAN_MODE} tool, which will prompt the user to confirm the plan`}. Do NOT make any file changes or run any tools that modify the system state in any way until the user has confirmed the plan.
34186
34222
  </system-reminder>`;
34187
34223
  }
34188
34224
  __name(getPlanModeSystemReminder, "getPlanModeSystemReminder");
@@ -34677,12 +34713,59 @@ function safeRealpath(p) {
34677
34713
  }
34678
34714
  }
34679
34715
  __name(safeRealpath, "safeRealpath");
34716
+ var PLAN_MODE_REMINDER_TEXT = `<plan-mode-active>
34717
+ You are currently in PLAN mode. You may research, read files, and propose plans, but you may not execute modification tools (${ToolNames.WRITE_FILE}, ${ToolNames.EDIT}, ${ToolNames.SHELL}, etc.) until the user exits plan mode. The summary above may not reflect this constraint \u2014 honor plan mode regardless.
34718
+ </plan-mode-active>`;
34719
+ var MAX_SUBAGENT_DESC_CHARS = 200;
34720
+ var MAX_SUBAGENT_SNAPSHOT_COUNT = 30;
34721
+ function buildPlanModeReminderPart() {
34722
+ return { text: PLAN_MODE_REMINDER_TEXT };
34723
+ }
34724
+ __name(buildPlanModeReminderPart, "buildPlanModeReminderPart");
34725
+ function flattenWhitespaceForBullet(text) {
34726
+ return text.replace(/[\r\n\t]+/g, " ");
34727
+ }
34728
+ __name(flattenWhitespaceForBullet, "flattenWhitespaceForBullet");
34729
+ function buildSubagentSnapshotPart(snaps) {
34730
+ if (snaps.length === 0) return null;
34731
+ const sorted2 = [...snaps].sort((a, b) => a.startTime - b.startTime);
34732
+ const overflow = Math.max(0, sorted2.length - MAX_SUBAGENT_SNAPSHOT_COUNT);
34733
+ const shown = overflow > 0 ? sorted2.slice(overflow) : sorted2;
34734
+ const lines = shown.map((s) => {
34735
+ const flattened = flattenWhitespaceForBullet(s.description);
34736
+ const truncated = flattened.length > MAX_SUBAGENT_DESC_CHARS ? flattened.slice(0, MAX_SUBAGENT_DESC_CHARS) + "\u2026" : flattened;
34737
+ return `- [${escapeXml(s.status)}] ${escapeXml(s.id)}: ${escapeXml(truncated)}`;
34738
+ });
34739
+ if (overflow > 0) {
34740
+ lines.push(
34741
+ `- (\u2026 and ${overflow} older task${overflow === 1 ? "" : "s"} not shown)`
34742
+ );
34743
+ }
34744
+ return {
34745
+ text: "<background-tasks>\nThe following background subagent tasks were active at compaction. The summary above does not include their per-task state. Use `task_stop` / `send_message` to interact; do not assume they completed.\n" + lines.join("\n") + "\n</background-tasks>"
34746
+ };
34747
+ }
34748
+ __name(buildSubagentSnapshotPart, "buildSubagentSnapshotPart");
34749
+ function buildStateReminderParts(options2) {
34750
+ const parts2 = [];
34751
+ if (options2.planModeActive) {
34752
+ parts2.push(buildPlanModeReminderPart());
34753
+ }
34754
+ if (options2.runningSubagents && options2.runningSubagents.length > 0) {
34755
+ const snap = buildSubagentSnapshotPart(options2.runningSubagents);
34756
+ if (snap) parts2.push(snap);
34757
+ }
34758
+ return parts2;
34759
+ }
34760
+ __name(buildStateReminderParts, "buildStateReminderParts");
34680
34761
  async function composePostCompactHistory(history, summary, options2 = {}) {
34681
34762
  const {
34682
34763
  workspaceRoot,
34683
34764
  signal,
34684
34765
  maxFiles = POST_COMPACT_MAX_FILES_TO_RESTORE,
34685
- maxImages = POST_COMPACT_MAX_IMAGES_TO_RESTORE
34766
+ maxImages = POST_COMPACT_MAX_IMAGES_TO_RESTORE,
34767
+ planModeActive,
34768
+ runningSubagents
34686
34769
  } = options2;
34687
34770
  const filePaths = extractRecentFilePaths(history, maxFiles).filter(
34688
34771
  (p) => isInsideWorkspace(p, workspaceRoot)
@@ -34690,7 +34773,9 @@ async function composePostCompactHistory(history, summary, options2 = {}) {
34690
34773
  const fileBlocks = await buildFileRestorationBlocks(filePaths, signal);
34691
34774
  const images = extractRecentImages(history, maxImages);
34692
34775
  const imageBlock = buildImageRestorationBlock(images);
34693
- const postAckParts = [];
34776
+ const postAckParts = [
34777
+ ...buildStateReminderParts({ planModeActive, runningSubagents })
34778
+ ];
34694
34779
  for (const block2 of fileBlocks) {
34695
34780
  for (const part of block2.parts ?? []) postAckParts.push(part);
34696
34781
  }
@@ -34727,6 +34812,7 @@ var AUTOCOMPACT_BUFFER = 13e3;
34727
34812
  var WARN_BUFFER = 2e4;
34728
34813
  var HARD_BUFFER = 3e3;
34729
34814
  var MAX_CONSECUTIVE_FAILURES = 3;
34815
+ var MAX_HOOK_INSTRUCTIONS_CHARS = 4e3;
34730
34816
  function computeThresholds(window2) {
34731
34817
  const effectiveWindow = Math.max(0, window2 - SUMMARY_RESERVE);
34732
34818
  const absAuto = effectiveWindow - AUTOCOMPACT_BUFFER;
@@ -34738,6 +34824,41 @@ function computeThresholds(window2) {
34738
34824
  return { warn, auto, hard, effectiveWindow };
34739
34825
  }
34740
34826
  __name(computeThresholds, "computeThresholds");
34827
+ function collectActiveSubagents(config) {
34828
+ const registry = config.getBackgroundTaskRegistry?.();
34829
+ if (!registry) return [];
34830
+ return registry.getAll().filter(
34831
+ (t) => t.kind === "agent" && // Only TRUE background subagents belong in a `<background-tasks>`
34832
+ // block. Foreground entries (`isBackgrounded: false`) are the
34833
+ // parent's synchronously-awaited tool call — their pending
34834
+ // functionCall is still in history and resolves through the normal
34835
+ // tool-result channel, so a reminder would mislabel them. Mirrors
34836
+ // the `getRunningBackgroundCount` filter in background-tasks.ts.
34837
+ t.isBackgrounded && (t.status === "running" || t.status === "paused")
34838
+ ).map((t) => ({
34839
+ id: t.id,
34840
+ description: t.description,
34841
+ status: t.status,
34842
+ startTime: t.startTime
34843
+ }));
34844
+ }
34845
+ __name(collectActiveSubagents, "collectActiveSubagents");
34846
+ function buildCompressionSystemPrompt(userInstructions, hookInstructions) {
34847
+ const base = getCompressionPrompt();
34848
+ const parts2 = [];
34849
+ if (userInstructions && userInstructions.trim().length > 0) {
34850
+ parts2.push(userInstructions.trim());
34851
+ }
34852
+ if (hookInstructions.length > 0) {
34853
+ parts2.push(hookInstructions);
34854
+ }
34855
+ if (parts2.length === 0) return base;
34856
+ return `${base}
34857
+
34858
+ Additional Instructions:
34859
+ ${parts2.join("\n\n")}`;
34860
+ }
34861
+ __name(buildCompressionSystemPrompt, "buildCompressionSystemPrompt");
34741
34862
  var ChatCompressionService = class {
34742
34863
  static {
34743
34864
  __name(this, "ChatCompressionService");
@@ -34804,15 +34925,6 @@ var ChatCompressionService = class {
34804
34925
  }
34805
34926
  };
34806
34927
  }
34807
- const hookSystem = config.getHookSystem();
34808
- if (hookSystem) {
34809
- const preCompactTrigger = compactTrigger === "manual" ? "manual" /* Manual */ : "auto" /* Auto */;
34810
- try {
34811
- await hookSystem.firePreCompactEvent(preCompactTrigger, "", signal);
34812
- } catch (err2) {
34813
- config.getDebugLogger().warn(`PreCompact hook failed: ${err2}`);
34814
- }
34815
- }
34816
34928
  if (curatedHistory.length < 2) {
34817
34929
  return {
34818
34930
  newHistory: null,
@@ -34823,6 +34935,24 @@ var ChatCompressionService = class {
34823
34935
  }
34824
34936
  };
34825
34937
  }
34938
+ let hookExtraInstructions = "";
34939
+ const hookSystem = config.getHookSystem();
34940
+ if (hookSystem) {
34941
+ const preCompactTrigger = compactTrigger === "manual" ? "manual" /* Manual */ : "auto" /* Auto */;
34942
+ try {
34943
+ const result = await hookSystem.firePreCompactEvent(
34944
+ preCompactTrigger,
34945
+ opts.customInstructions ?? "",
34946
+ signal
34947
+ );
34948
+ const merged = result?.getAdditionalContext();
34949
+ if (merged && merged.trim().length > 0) {
34950
+ hookExtraInstructions = merged.trim().slice(0, MAX_HOOK_INSTRUCTIONS_CHARS);
34951
+ }
34952
+ } catch (err2) {
34953
+ config.getDebugLogger().warn(`PreCompact hook failed: ${err2}`);
34954
+ }
34955
+ }
34826
34956
  const slim = slimCompactionInput(curatedHistory);
34827
34957
  if (slim.stats.imagesStripped > 0 || slim.stats.documentsStripped > 0) {
34828
34958
  config.getDebugLogger().debug(
@@ -34835,7 +34965,10 @@ var ChatCompressionService = class {
34835
34965
  // Best-effort: failures fall back to NOOP and the next turn re-triggers
34836
34966
  // compression anyway, so don't burn 7 retries blocking the user mid-turn.
34837
34967
  maxAttempts: 1,
34838
- systemInstruction: getCompressionPrompt(),
34968
+ systemInstruction: buildCompressionSystemPrompt(
34969
+ opts.customInstructions,
34970
+ hookExtraInstructions
34971
+ ),
34839
34972
  contents: [
34840
34973
  ...slim.slimmedHistory,
34841
34974
  {
@@ -34901,15 +35034,28 @@ var ChatCompressionService = class {
34901
35034
  workspaceRoot: config.getTargetDir(),
34902
35035
  signal,
34903
35036
  maxFiles: tuning.maxRecentFiles,
34904
- maxImages: tuning.maxRecentImages
35037
+ maxImages: tuning.maxRecentImages,
35038
+ // Restore plan-mode reminder + running-subagent snapshot so the
35039
+ // post-compact agent does not lose either piece of mid-session
35040
+ // state. Both reduce to no-ops when the corresponding source is
35041
+ // empty.
35042
+ planModeActive: config.getApprovalMode?.() === "plan" /* PLAN */,
35043
+ runningSubagents: collectActiveSubagents(config)
34905
35044
  }
34906
35045
  );
34907
35046
  } catch (err2) {
34908
35047
  config.getDebugLogger().warn(`[chat-compression] composePostCompactHistory failed: ${err2}`);
34909
35048
  const trailingFc = historyForCompose[historyForCompose.length - 1];
34910
35049
  const fcParts = trailingFc?.role === "model" ? (trailingFc.parts ?? []).filter((p) => !!p.functionCall) : [];
35050
+ const reminderParts = buildStateReminderParts({
35051
+ planModeActive: config.getApprovalMode?.() === "plan" /* PLAN */,
35052
+ runningSubagents: collectActiveSubagents(config)
35053
+ });
34911
35054
  extraHistory = [
34912
- { role: "user", parts: [{ text: postProcessSummary(summary) }] },
35055
+ {
35056
+ role: "user",
35057
+ parts: [{ text: postProcessSummary(summary) }, ...reminderParts]
35058
+ },
34913
35059
  {
34914
35060
  role: "model",
34915
35061
  parts: [
@@ -35830,6 +35976,7 @@ var GeminiChat = class {
35830
35976
  pendingUserMessage: options2?.pendingUserMessage,
35831
35977
  precomputedEffectiveTokens: options2?.precomputedEffectiveTokens,
35832
35978
  trigger: options2?.trigger,
35979
+ customInstructions: options2?.customInstructions,
35833
35980
  signal
35834
35981
  });
35835
35982
  if (info2.compressionStatus === 1 /* COMPRESSED */ && newHistory) {
@@ -35842,6 +35989,7 @@ var GeminiChat = class {
35842
35989
  this.setHistory(newHistory);
35843
35990
  debugLogger15.debug("[FILE_READ_CACHE] clear after auto tryCompress");
35844
35991
  this.config.getFileReadCache().clear();
35992
+ clearDetailedSpanState();
35845
35993
  this.lastPromptTokenCount = info2.newTokenCount;
35846
35994
  this.telemetryService?.setLastPromptTokenCount(info2.newTokenCount);
35847
35995
  this.consecutiveFailures = 0;
@@ -37392,6 +37540,7 @@ var MessageBusType = /* @__PURE__ */ ((MessageBusType2) => {
37392
37540
 
37393
37541
  // packages/core/src/core/toolHookTriggers.ts
37394
37542
  var debugLogger16 = createDebugLogger("TOOL_HOOKS");
37543
+ var POST_TOOL_BATCH_HOOK_TIMEOUT_MS = 15e3;
37395
37544
  function generateToolUseId() {
37396
37545
  return `toolu_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
37397
37546
  }
@@ -37544,6 +37693,44 @@ async function firePostToolUseFailureHook(messageBus, toolUseId, toolName, toolI
37544
37693
  }
37545
37694
  }
37546
37695
  __name(firePostToolUseFailureHook, "firePostToolUseFailureHook");
37696
+ async function firePostToolBatchHook(messageBus, toolCalls, permissionMode = "default", signal) {
37697
+ if (!messageBus) {
37698
+ return { shouldStop: false };
37699
+ }
37700
+ try {
37701
+ const response = await messageBus.request(
37702
+ {
37703
+ type: "hook-execution-request" /* HOOK_EXECUTION_REQUEST */,
37704
+ eventName: "PostToolBatch",
37705
+ input: {
37706
+ permission_mode: permissionMode,
37707
+ tool_calls: toolCalls
37708
+ },
37709
+ signal
37710
+ },
37711
+ "hook-execution-response" /* HOOK_EXECUTION_RESPONSE */,
37712
+ POST_TOOL_BATCH_HOOK_TIMEOUT_MS,
37713
+ signal
37714
+ );
37715
+ if (!response.success || !response.output) {
37716
+ const message = response.error?.message || `hook runner returned ${response.success ? "no output" : "success: false"} without error detail`;
37717
+ debugLogger16.warn(`PostToolBatch hook returned failure: ${message}`);
37718
+ return { shouldStop: false, hookError: message };
37719
+ }
37720
+ const batchOutput = createHookOutput("PostToolBatch", response.output);
37721
+ const shouldStop = batchOutput.shouldStopExecution();
37722
+ return {
37723
+ shouldStop,
37724
+ stopReason: shouldStop ? batchOutput.getEffectiveReason() : void 0,
37725
+ additionalContext: batchOutput.getAdditionalContext()
37726
+ };
37727
+ } catch (error) {
37728
+ const message = error instanceof Error ? error.message : String(error);
37729
+ debugLogger16.warn(`PostToolBatch hook error: ${message}`);
37730
+ return { shouldStop: false, hookError: message };
37731
+ }
37732
+ }
37733
+ __name(firePostToolBatchHook, "firePostToolBatchHook");
37547
37734
  async function fireNotificationHook(messageBus, message, notificationType, title, signal) {
37548
37735
  if (!messageBus) {
37549
37736
  return {};
@@ -40866,10 +41053,10 @@ async function getIdeProcessInfo() {
40866
41053
  }
40867
41054
  __name(getIdeProcessInfo, "getIdeProcessInfo");
40868
41055
 
40869
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
41056
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
40870
41057
  init_esbuild_shims();
40871
41058
 
40872
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
41059
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
40873
41060
  init_esbuild_shims();
40874
41061
  function normalizeHeaders(headers) {
40875
41062
  if (!headers)
@@ -40899,7 +41086,7 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
40899
41086
  }
40900
41087
  __name(createFetchWithInit, "createFetchWithInit");
40901
41088
 
40902
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
41089
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
40903
41090
  init_esbuild_shims();
40904
41091
 
40905
41092
  // node_modules/pkce-challenge/dist/index.node.js
@@ -40947,7 +41134,7 @@ async function pkceChallenge(length) {
40947
41134
  }
40948
41135
  __name(pkceChallenge, "pkceChallenge");
40949
41136
 
40950
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
41137
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
40951
41138
  init_esbuild_shims();
40952
41139
  var SafeUrlSchema = url().superRefine((val, ctx) => {
40953
41140
  if (!URL.canParse(val)) {
@@ -41092,7 +41279,7 @@ var OAuthTokenRevocationRequestSchema = object({
41092
41279
  token_type_hint: string().optional()
41093
41280
  }).strip();
41094
41281
 
41095
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
41282
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js
41096
41283
  init_esbuild_shims();
41097
41284
  function resourceUrlFromServerUrl(url2) {
41098
41285
  const resourceURL = typeof url2 === "string" ? new URL(url2) : new URL(url2.href);
@@ -41115,7 +41302,7 @@ function checkResourceAllowed({ requestedResource, configuredResource }) {
41115
41302
  }
41116
41303
  __name(checkResourceAllowed, "checkResourceAllowed");
41117
41304
 
41118
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
41305
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
41119
41306
  init_esbuild_shims();
41120
41307
  var OAuthError = class extends Error {
41121
41308
  static {
@@ -41265,7 +41452,7 @@ var OAUTH_ERRORS = {
41265
41452
  [InvalidTargetError.errorCode]: InvalidTargetError
41266
41453
  };
41267
41454
 
41268
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
41455
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
41269
41456
  var UnauthorizedError2 = class extends Error {
41270
41457
  static {
41271
41458
  __name(this, "UnauthorizedError");
@@ -41282,12 +41469,12 @@ var AUTHORIZATION_CODE_RESPONSE_TYPE = "code";
41282
41469
  var AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
41283
41470
  function selectClientAuthMethod(clientInformation, supportedMethods) {
41284
41471
  const hasClientSecret = clientInformation.client_secret !== void 0;
41285
- if (supportedMethods.length === 0) {
41286
- return hasClientSecret ? "client_secret_post" : "none";
41287
- }
41288
- if ("token_endpoint_auth_method" in clientInformation && clientInformation.token_endpoint_auth_method && isClientAuthMethod(clientInformation.token_endpoint_auth_method) && supportedMethods.includes(clientInformation.token_endpoint_auth_method)) {
41472
+ if ("token_endpoint_auth_method" in clientInformation && clientInformation.token_endpoint_auth_method && isClientAuthMethod(clientInformation.token_endpoint_auth_method) && (supportedMethods.length === 0 || supportedMethods.includes(clientInformation.token_endpoint_auth_method))) {
41289
41473
  return clientInformation.token_endpoint_auth_method;
41290
41474
  }
41475
+ if (supportedMethods.length === 0) {
41476
+ return hasClientSecret ? "client_secret_basic" : "none";
41477
+ }
41291
41478
  if (hasClientSecret && supportedMethods.includes("client_secret_basic")) {
41292
41479
  return "client_secret_basic";
41293
41480
  }
@@ -41366,22 +41553,46 @@ async function auth(provider, options2) {
41366
41553
  }
41367
41554
  __name(auth, "auth");
41368
41555
  async function authInternal(provider, { serverUrl, authorizationCode, scope, resourceMetadataUrl, fetchFn }) {
41556
+ const cachedState = await provider.discoveryState?.();
41369
41557
  let resourceMetadata;
41370
41558
  let authorizationServerUrl;
41371
- try {
41372
- resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl }, fetchFn);
41373
- if (resourceMetadata.authorization_servers && resourceMetadata.authorization_servers.length > 0) {
41374
- authorizationServerUrl = resourceMetadata.authorization_servers[0];
41559
+ let metadata2;
41560
+ let effectiveResourceMetadataUrl = resourceMetadataUrl;
41561
+ if (!effectiveResourceMetadataUrl && cachedState?.resourceMetadataUrl) {
41562
+ effectiveResourceMetadataUrl = new URL(cachedState.resourceMetadataUrl);
41563
+ }
41564
+ if (cachedState?.authorizationServerUrl) {
41565
+ authorizationServerUrl = cachedState.authorizationServerUrl;
41566
+ resourceMetadata = cachedState.resourceMetadata;
41567
+ metadata2 = cachedState.authorizationServerMetadata ?? await discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn });
41568
+ if (!resourceMetadata) {
41569
+ try {
41570
+ resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl: effectiveResourceMetadataUrl }, fetchFn);
41571
+ } catch {
41572
+ }
41375
41573
  }
41376
- } catch {
41377
- }
41378
- if (!authorizationServerUrl) {
41379
- authorizationServerUrl = new URL("/", serverUrl);
41574
+ if (metadata2 !== cachedState.authorizationServerMetadata || resourceMetadata !== cachedState.resourceMetadata) {
41575
+ await provider.saveDiscoveryState?.({
41576
+ authorizationServerUrl: String(authorizationServerUrl),
41577
+ resourceMetadataUrl: effectiveResourceMetadataUrl?.toString(),
41578
+ resourceMetadata,
41579
+ authorizationServerMetadata: metadata2
41580
+ });
41581
+ }
41582
+ } else {
41583
+ const serverInfo = await discoverOAuthServerInfo(serverUrl, { resourceMetadataUrl: effectiveResourceMetadataUrl, fetchFn });
41584
+ authorizationServerUrl = serverInfo.authorizationServerUrl;
41585
+ metadata2 = serverInfo.authorizationServerMetadata;
41586
+ resourceMetadata = serverInfo.resourceMetadata;
41587
+ await provider.saveDiscoveryState?.({
41588
+ authorizationServerUrl: String(authorizationServerUrl),
41589
+ resourceMetadataUrl: effectiveResourceMetadataUrl?.toString(),
41590
+ resourceMetadata,
41591
+ authorizationServerMetadata: metadata2
41592
+ });
41380
41593
  }
41381
41594
  const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
41382
- const metadata2 = await discoverAuthorizationServerMetadata(authorizationServerUrl, {
41383
- fetchFn
41384
- });
41595
+ const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
41385
41596
  let clientInformation = await Promise.resolve(provider.clientInformation());
41386
41597
  if (!clientInformation) {
41387
41598
  if (authorizationCode !== void 0) {
@@ -41405,6 +41616,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
41405
41616
  const fullInformation = await registerClient(authorizationServerUrl, {
41406
41617
  metadata: metadata2,
41407
41618
  clientMetadata: provider.clientMetadata,
41619
+ scope: resolvedScope,
41408
41620
  fetchFn
41409
41621
  });
41410
41622
  await provider.saveClientInformation(fullInformation);
@@ -41448,7 +41660,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
41448
41660
  clientInformation,
41449
41661
  state,
41450
41662
  redirectUrl: provider.redirectUrl,
41451
- scope: scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope,
41663
+ scope: resolvedScope,
41452
41664
  resource
41453
41665
  });
41454
41666
  await provider.saveCodeVerifier(codeVerifier);
@@ -41649,6 +41861,27 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
41649
41861
  return void 0;
41650
41862
  }
41651
41863
  __name(discoverAuthorizationServerMetadata, "discoverAuthorizationServerMetadata");
41864
+ async function discoverOAuthServerInfo(serverUrl, opts) {
41865
+ let resourceMetadata;
41866
+ let authorizationServerUrl;
41867
+ try {
41868
+ resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl: opts?.resourceMetadataUrl }, opts?.fetchFn);
41869
+ if (resourceMetadata.authorization_servers && resourceMetadata.authorization_servers.length > 0) {
41870
+ authorizationServerUrl = resourceMetadata.authorization_servers[0];
41871
+ }
41872
+ } catch {
41873
+ }
41874
+ if (!authorizationServerUrl) {
41875
+ authorizationServerUrl = String(new URL("/", serverUrl));
41876
+ }
41877
+ const authorizationServerMetadata = await discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn: opts?.fetchFn });
41878
+ return {
41879
+ authorizationServerUrl,
41880
+ authorizationServerMetadata,
41881
+ resourceMetadata
41882
+ };
41883
+ }
41884
+ __name(discoverOAuthServerInfo, "discoverOAuthServerInfo");
41652
41885
  async function startAuthorization(authorizationServerUrl, { metadata: metadata2, clientInformation, redirectUrl, scope, state, resource }) {
41653
41886
  let authorizationUrl;
41654
41887
  if (metadata2) {
@@ -41764,7 +41997,7 @@ async function fetchToken(provider, authorizationServerUrl, { metadata: metadata
41764
41997
  });
41765
41998
  }
41766
41999
  __name(fetchToken, "fetchToken");
41767
- async function registerClient(authorizationServerUrl, { metadata: metadata2, clientMetadata, fetchFn }) {
42000
+ async function registerClient(authorizationServerUrl, { metadata: metadata2, clientMetadata, scope, fetchFn }) {
41768
42001
  let registrationUrl;
41769
42002
  if (metadata2) {
41770
42003
  if (!metadata2.registration_endpoint) {
@@ -41779,7 +42012,10 @@ async function registerClient(authorizationServerUrl, { metadata: metadata2, cli
41779
42012
  headers: {
41780
42013
  "Content-Type": "application/json"
41781
42014
  },
41782
- body: JSON.stringify(clientMetadata)
42015
+ body: JSON.stringify({
42016
+ ...clientMetadata,
42017
+ ...scope !== void 0 ? { scope } : {}
42018
+ })
41783
42019
  });
41784
42020
  if (!response.ok) {
41785
42021
  throw await parseErrorResponse(response);
@@ -41933,7 +42169,7 @@ var EventSourceParserStream = class extends TransformStream {
41933
42169
  }
41934
42170
  };
41935
42171
 
41936
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
42172
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js
41937
42173
  var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
41938
42174
  initialReconnectionDelay: 1e3,
41939
42175
  maxReconnectionDelay: 3e4,
@@ -43449,6 +43685,132 @@ var createErrorResponse = /* @__PURE__ */ __name((request, error, errorType) =>
43449
43685
  errorType,
43450
43686
  contentLength: error.message.length
43451
43687
  }), "createErrorResponse");
43688
+ function serializeToolResponse(response) {
43689
+ return {
43690
+ response_parts: response.responseParts.map(summarizeBatchResponsePart),
43691
+ result_display: response.resultDisplay,
43692
+ error: response.error?.message,
43693
+ error_type: response.errorType,
43694
+ content_length: response.contentLength
43695
+ };
43696
+ }
43697
+ __name(serializeToolResponse, "serializeToolResponse");
43698
+ function summarizeBatchResponsePart(part) {
43699
+ const summarized = part.inlineData ? {
43700
+ ...part,
43701
+ inlineData: {
43702
+ mimeType: part.inlineData.mimeType,
43703
+ data: "<binary omitted>"
43704
+ }
43705
+ } : part;
43706
+ if (!summarized.functionResponse?.parts) {
43707
+ return summarized;
43708
+ }
43709
+ return {
43710
+ ...summarized,
43711
+ functionResponse: {
43712
+ ...summarized.functionResponse,
43713
+ parts: summarized.functionResponse.parts.map(summarizeBatchResponsePart)
43714
+ }
43715
+ };
43716
+ }
43717
+ __name(summarizeBatchResponsePart, "summarizeBatchResponsePart");
43718
+ function toPostToolBatchToolCall(call) {
43719
+ return {
43720
+ tool_name: call.request.name,
43721
+ tool_input: call.request.args,
43722
+ tool_use_id: call.request.callId,
43723
+ status: call.status,
43724
+ tool_response: serializeToolResponse(call.response)
43725
+ };
43726
+ }
43727
+ __name(toPostToolBatchToolCall, "toPostToolBatchToolCall");
43728
+ function appendContextToResponsePart(part, additionalContext) {
43729
+ if (!part.functionResponse) {
43730
+ debugLogger22.warn(
43731
+ "appendContextToResponsePart: no functionResponse on part, additionalContext dropped"
43732
+ );
43733
+ return part;
43734
+ }
43735
+ const response = part.functionResponse.response ?? {};
43736
+ const output = response["output"];
43737
+ const error = response["error"];
43738
+ const hasOutput = Object.prototype.hasOwnProperty.call(response, "output");
43739
+ const useOutputKey = typeof output === "string" || hasOutput && typeof error !== "string";
43740
+ const key = useOutputKey ? "output" : "error";
43741
+ const currentText = useOutputKey ? typeof output === "string" ? output : JSON.stringify(output) : typeof error === "string" ? error : JSON.stringify(response);
43742
+ return {
43743
+ ...part,
43744
+ functionResponse: {
43745
+ ...part.functionResponse,
43746
+ response: {
43747
+ ...response,
43748
+ [key]: `${currentText}
43749
+
43750
+ ${additionalContext}`
43751
+ }
43752
+ }
43753
+ };
43754
+ }
43755
+ __name(appendContextToResponsePart, "appendContextToResponsePart");
43756
+ function appendContextToToolResponse(response, additionalContext) {
43757
+ if (!additionalContext || response.responseParts.length === 0) {
43758
+ return response;
43759
+ }
43760
+ const responseParts = [...response.responseParts];
43761
+ const lastIndex = responseParts.length - 1;
43762
+ const appendedPart = appendContextToResponsePart(
43763
+ responseParts[lastIndex],
43764
+ additionalContext
43765
+ );
43766
+ if (appendedPart === responseParts[lastIndex]) {
43767
+ return response;
43768
+ }
43769
+ responseParts[lastIndex] = appendedPart;
43770
+ return {
43771
+ ...response,
43772
+ responseParts,
43773
+ contentLength: response.contentLength !== void 0 ? response.contentLength + additionalContext.length + 2 : void 0
43774
+ };
43775
+ }
43776
+ __name(appendContextToToolResponse, "appendContextToToolResponse");
43777
+ function withPostToolBatchAdditionalContext(completedCalls, additionalContext) {
43778
+ if (!additionalContext || completedCalls.length === 0) {
43779
+ return completedCalls;
43780
+ }
43781
+ const calls = [...completedCalls];
43782
+ const lastIndex = calls.length - 1;
43783
+ calls[lastIndex] = {
43784
+ ...calls[lastIndex],
43785
+ response: appendContextToToolResponse(
43786
+ calls[lastIndex].response,
43787
+ additionalContext
43788
+ )
43789
+ };
43790
+ return calls;
43791
+ }
43792
+ __name(withPostToolBatchAdditionalContext, "withPostToolBatchAdditionalContext");
43793
+ function withPostToolBatchStop(completedCalls, stopReason) {
43794
+ if (completedCalls.length === 0) {
43795
+ return completedCalls;
43796
+ }
43797
+ const calls = [...completedCalls];
43798
+ const lastCall = calls[calls.length - 1];
43799
+ calls[calls.length - 1] = {
43800
+ status: "error",
43801
+ request: lastCall.request,
43802
+ tool: lastCall.tool,
43803
+ response: createErrorResponse(
43804
+ lastCall.request,
43805
+ new Error(stopReason),
43806
+ "execution_denied" /* EXECUTION_DENIED */
43807
+ ),
43808
+ durationMs: lastCall.durationMs,
43809
+ outcome: void 0
43810
+ };
43811
+ return calls;
43812
+ }
43813
+ __name(withPostToolBatchStop, "withPostToolBatchStop");
43452
43814
  function isConcurrencySafe(call) {
43453
43815
  if (canonicalToolName(call.request.name) === ToolNames.AGENT) return true;
43454
43816
  if (call.tool.kind === "execute" /* Execute */) {
@@ -43515,6 +43877,10 @@ var CoreToolScheduler = class {
43515
43877
  // sessions reusing the same AbortSignal don't accumulate listeners
43516
43878
  // and trip Node's MaxListenersExceededWarning (#4321 review-3).
43517
43879
  callIdToBatch = /* @__PURE__ */ new Map();
43880
+ // Keep the scheduling signal until the all-calls-complete hook fires.
43881
+ // callIdToBatch is drained earlier when spans end, so it cannot be used
43882
+ // to recover the PostToolBatch AbortSignal reliably.
43883
+ callIdToPostToolBatchSignal = /* @__PURE__ */ new Map();
43518
43884
  requestQueue = [];
43519
43885
  constructor(options2) {
43520
43886
  this.config = options2.config;
@@ -43662,7 +44028,11 @@ var CoreToolScheduler = class {
43662
44028
  }
43663
44029
  });
43664
44030
  this.notifyToolCallsUpdate();
43665
- this.checkAndNotifyCompletion();
44031
+ void this.checkAndNotifyCompletion().catch((error) => {
44032
+ debugLogger22.warn(
44033
+ `setStatusInternal completion notification failed: ${error instanceof Error ? error.message : String(error)}`
44034
+ );
44035
+ });
43666
44036
  }
43667
44037
  setArgsInternal(targetCallId, args2) {
43668
44038
  this.toolCalls = this.toolCalls.map((call) => {
@@ -43787,6 +44157,7 @@ var CoreToolScheduler = class {
43787
44157
  setToolSpanCancelled(span);
43788
44158
  this.finalizeToolSpan(callId);
43789
44159
  }
44160
+ this.callIdToPostToolBatchSignal.delete(callId);
43790
44161
  } catch (e) {
43791
44162
  debugLogger22.warn(
43792
44163
  `drainSpansForBatch: failed to drain ${callId}: ${e instanceof Error ? e.message : String(e)}`
@@ -44104,6 +44475,7 @@ var CoreToolScheduler = class {
44104
44475
  this.toolSpans.set(reqInfo.callId, toolSpan);
44105
44476
  batchState.callIds.add(reqInfo.callId);
44106
44477
  this.callIdToBatch.set(reqInfo.callId, batchState);
44478
+ this.callIdToPostToolBatchSignal.set(reqInfo.callId, signal);
44107
44479
  try {
44108
44480
  if (signal.aborted) {
44109
44481
  this.setStatusInternal(
@@ -44453,7 +44825,11 @@ var CoreToolScheduler = class {
44453
44825
  }
44454
44826
  }
44455
44827
  await this.attemptExecutionOfScheduledCalls(signal);
44456
- void this.checkAndNotifyCompletion();
44828
+ void this.checkAndNotifyCompletion().catch((error) => {
44829
+ debugLogger22.warn(
44830
+ `_schedule completion notification failed: ${error instanceof Error ? error.message : String(error)}`
44831
+ );
44832
+ });
44457
44833
  if (batchState.callIds.size === 0) {
44458
44834
  signal.removeEventListener("abort", batchState.onAbort);
44459
44835
  }
@@ -45194,21 +45570,78 @@ ${failureHookResult.additionalContext}`;
45194
45570
  (call) => call.status === "success" || call.status === "error" || call.status === "cancelled"
45195
45571
  );
45196
45572
  if (this.toolCalls.length > 0 && allCallsAreTerminal) {
45197
- const completedCalls = [...this.toolCalls];
45573
+ let completedCalls = [...this.toolCalls];
45198
45574
  this.toolCalls = [];
45575
+ this.isFinalizingToolCalls = true;
45576
+ const batchSignal = completedCalls.map(
45577
+ (call) => this.callIdToPostToolBatchSignal.get(call.request.callId)
45578
+ ).find((candidate) => !!candidate);
45199
45579
  for (const call of completedCalls) {
45200
- logToolCall(this.config, new ToolCallEvent(call));
45580
+ this.callIdToPostToolBatchSignal.delete(call.request.callId);
45201
45581
  }
45202
- this.recordToolResults(completedCalls);
45203
- if (this.onAllToolCallsComplete) {
45204
- this.isFinalizingToolCalls = true;
45205
- await this.onAllToolCallsComplete(completedCalls);
45206
- this.isFinalizingToolCalls = false;
45582
+ let messageBus;
45583
+ try {
45584
+ const shouldFirePostToolBatch = !this.config.getDisableAllHooks() && (this.config.hasHooksForEvent?.("PostToolBatch") ?? false);
45585
+ messageBus = shouldFirePostToolBatch ? this.config.getMessageBus() : void 0;
45586
+ } catch (error) {
45587
+ debugLogger22.warn(
45588
+ `PostToolBatch hook setup failed: ${error instanceof Error ? error.message : String(error)}`
45589
+ );
45207
45590
  }
45208
- this.notifyToolCallsUpdate();
45209
- if (this.requestQueue.length > 0) {
45210
- const next = this.requestQueue.shift();
45211
- this._schedule(next.request, next.signal).then(next.resolve).catch(next.reject);
45591
+ try {
45592
+ if (messageBus) {
45593
+ const batchToolCalls = completedCalls.map(toPostToolBatchToolCall);
45594
+ const permissionMode = this.config.getApprovalMode();
45595
+ const batchHookResult = await this.withHookSpan(
45596
+ { hookEvent: "PostToolBatch", toolName: "batch" },
45597
+ () => firePostToolBatchHook(
45598
+ messageBus,
45599
+ batchToolCalls,
45600
+ permissionMode,
45601
+ batchSignal
45602
+ ),
45603
+ (r) => r.hookError ? {
45604
+ success: false,
45605
+ error: r.hookError,
45606
+ shouldStop: false,
45607
+ postBatchStop: false
45608
+ } : {
45609
+ success: true,
45610
+ shouldStop: r.shouldStop,
45611
+ hasAdditionalContext: !!r.additionalContext,
45612
+ blockType: r.shouldStop ? "stop" : void 0,
45613
+ postBatchStop: r.shouldStop,
45614
+ postBatchStopReason: r.shouldStop ? r.stopReason || "no reason given" : void 0
45615
+ }
45616
+ );
45617
+ if (batchHookResult.shouldStop) {
45618
+ debugLogger22.info(
45619
+ `PostToolBatch hook stopped batch (${completedCalls.length} calls): ${batchHookResult.stopReason || "no reason given"}`
45620
+ );
45621
+ completedCalls = withPostToolBatchStop(
45622
+ completedCalls,
45623
+ batchHookResult.stopReason || "Execution stopped by PostToolBatch hook"
45624
+ );
45625
+ }
45626
+ completedCalls = withPostToolBatchAdditionalContext(
45627
+ completedCalls,
45628
+ batchHookResult.additionalContext
45629
+ );
45630
+ }
45631
+ for (const call of completedCalls) {
45632
+ logToolCall(this.config, new ToolCallEvent(call));
45633
+ }
45634
+ this.recordToolResults(completedCalls);
45635
+ if (this.onAllToolCallsComplete) {
45636
+ await this.onAllToolCallsComplete(completedCalls);
45637
+ }
45638
+ this.notifyToolCallsUpdate();
45639
+ } finally {
45640
+ this.isFinalizingToolCalls = false;
45641
+ if (this.requestQueue.length > 0) {
45642
+ const next = this.requestQueue.shift();
45643
+ this._schedule(next.request, next.signal).then(next.resolve).catch(next.reject);
45644
+ }
45212
45645
  }
45213
45646
  }
45214
45647
  }
@@ -46946,6 +47379,10 @@ ${userMemory.trim()}`;
46946
47379
  init_esbuild_shims();
46947
47380
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
46948
47381
  var FORK_SUBAGENT_TYPE = "fork";
47382
+ function isForkSubagentEnabled(config) {
47383
+ return config.isForkSubagentEnabled() && config.isInteractive();
47384
+ }
47385
+ __name(isForkSubagentEnabled, "isForkSubagentEnabled");
46949
47386
  var FORK_BOILERPLATE_TAG = "fork-boilerplate";
46950
47387
  var FORK_DIRECTIVE_PREFIX = "Directive: ";
46951
47388
  var FORK_AGENT = {
@@ -54552,7 +54989,7 @@ The Agent tool launches specialized agents (subprocesses) that autonomously hand
54552
54989
  Available agent types and the tools they have access to:
54553
54990
  ${subagentDescriptions}
54554
54991
 
54555
- When using the Agent tool, specify a subagent_type parameter to select which agent type to use.
54992
+ ${isForkSubagentEnabled(this.config) ? `When using the Agent tool, specify a subagent_type to use a specialized agent, or omit it to fork yourself \u2014 a fork inherits your full conversation context.` : `When using the Agent tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used.`}
54556
54993
 
54557
54994
  When NOT to use the Agent tool:
54558
54995
  - If you want to read a specific file path, use the ${ToolNames.READ_FILE} tool or the ${ToolNames.GLOB} tool instead of the ${ToolNames.AGENT} tool, to find the match more quickly
@@ -54572,6 +55009,35 @@ Usage notes:
54572
55009
  - If the user specifies that they want you to run agents "in parallel", you MUST send a single message with multiple Agent tool use content blocks. For example, if you need to launch both a build-validator agent and a test-runner agent in parallel, send a single message with both tool calls.
54573
55010
  - You can optionally set \`run_in_background: true\` to run the agent in the background. You will be notified when it completes. Use this when you have genuinely independent work to do in parallel and don't need the agent's results before you can proceed.
54574
55011
  - You can optionally set \`isolation: "worktree"\` to run the agent in a temporary git worktree, giving it an isolated copy of the repository. The worktree is automatically cleaned up if the agent makes no changes; if changes are made, the worktree path and branch are returned in the result so you can review or merge them.
55012
+ ${isForkSubagentEnabled(this.config) ? `
55013
+ ## When to fork
55014
+
55015
+ Fork yourself (omit \`subagent_type\`) when the intermediate tool output isn't worth keeping in your context. The criterion is qualitative \u2014 "will I need this output again" \u2014 not task size.
55016
+ - **Research**: fork open-ended questions. If research can be broken into independent questions, launch parallel forks in one message. A fork beats a fresh subagent for this \u2014 it inherits context and shares your cache.
55017
+ - **Implementation**: prefer to fork implementation work that requires more than a couple of edits. Do research before jumping to implementation.
55018
+
55019
+ Forks are cheap because they share your prompt cache. Don't set \`model\` on a fork \u2014 a different model can't reuse the parent's cache. Pass a short \`name\` (one or two words, lowercase) so the user can track the fork.
55020
+
55021
+ **Don't peek.** The tool result includes an output \u2014 do not read or tail it unless the user explicitly asks for a progress check. You get a completion notification; trust it. Reading the transcript mid-flight pulls the fork's tool noise into your context, which defeats the point of forking.
55022
+
55023
+ **Don't race.** After launching, you know nothing about what the fork found. Never fabricate or predict fork results in any format \u2014 not as prose, summary, or structured output. The notification arrives as a user-role message in a later turn; it is never something you write yourself. If the user asks a follow-up before the notification lands, tell them the fork is still running \u2014 give status, not a guess.
55024
+
55025
+ **Writing a fork prompt.** Since the fork inherits your context, the prompt is a *directive* \u2014 what to do, not what the situation is. Be specific about scope: what's in, what's out, what another agent is handling. Don't re-explain background.
55026
+ ` : ""}
55027
+ ## Writing the prompt
55028
+
55029
+ ${isForkSubagentEnabled(this.config) ? "When spawning a fresh agent (with a `subagent_type`), it starts with zero context. " : ""}Brief the agent like a smart colleague who just walked into the room \u2014 it has not seen this conversation, does not know what you've tried, and does not understand why this task matters.
55030
+ - Explain what you're trying to accomplish and why.
55031
+ - Describe what you've already learned or ruled out.
55032
+ - Give enough context about the surrounding problem that the agent can make judgment calls rather than just following a narrow instruction.
55033
+ - If you need a short response, say so explicitly.
55034
+ - For lookups, provide the exact target. For investigations, provide the actual question rather than an over-prescribed sequence of steps.
55035
+
55036
+ ${isForkSubagentEnabled(this.config) ? "For fresh agents, terse" : "Terse"} command-style prompts produce shallow, generic work.
55037
+
55038
+ **Never delegate understanding.** Do not write prompts like "based on your findings, fix the bug" or "based on the research, implement it." Those phrases push synthesis onto the agent instead of doing it yourself. Write prompts that prove you understood the task: include relevant file paths, constraints, what specifically needs to be learned or changed, and what is out of scope.
55039
+
55040
+ After launching an agent, do not fabricate or predict what it found before it returns. If the user asks a follow-up before the result arrives, provide status rather than guessing.
54575
55041
 
54576
55042
  Example usage:
54577
55043
 
@@ -55147,7 +55613,8 @@ var AgentToolInvocation = class extends BaseToolInvocation {
55147
55613
  let restoreParentPM = /* @__PURE__ */ __name(() => {
55148
55614
  }, "restoreParentPM");
55149
55615
  try {
55150
- const isFork = !this.params.subagent_type;
55616
+ const isFork = !this.params.subagent_type && isForkSubagentEnabled(this.config);
55617
+ const effectiveSubagentType = this.params.subagent_type ?? (isFork ? void 0 : DEFAULT_BUILTIN_SUBAGENT_TYPE);
55151
55618
  let subagentConfig;
55152
55619
  if (isFork) {
55153
55620
  subagentConfig = FORK_AGENT;
@@ -55166,18 +55633,18 @@ var AgentToolInvocation = class extends BaseToolInvocation {
55166
55633
  }
55167
55634
  } else {
55168
55635
  const loadedConfig = await this.subagentManager.loadSubagent(
55169
- this.params.subagent_type
55636
+ effectiveSubagentType
55170
55637
  );
55171
55638
  if (!loadedConfig) {
55172
55639
  return {
55173
- llmContent: `Subagent "${this.params.subagent_type}" not found`,
55640
+ llmContent: `Subagent "${effectiveSubagentType}" not found`,
55174
55641
  returnDisplay: {
55175
55642
  type: "task_execution",
55176
- subagentName: this.params.subagent_type,
55643
+ subagentName: effectiveSubagentType,
55177
55644
  taskDescription: this.params.description,
55178
55645
  taskPrompt: this.params.prompt,
55179
55646
  status: "failed",
55180
- terminateReason: `Subagent "${this.params.subagent_type}" not found`
55647
+ terminateReason: `Subagent "${effectiveSubagentType}" not found`
55181
55648
  }
55182
55649
  };
55183
55650
  }
@@ -65569,11 +66036,6 @@ var GeminiClient = class {
65569
66036
  }
65570
66037
  if (messageType === "userQuery" /* UserQuery */ || messageType === "cron" /* Cron */) {
65571
66038
  const systemReminders = [];
65572
- const hasAgentTool = await this.config.getToolRegistry().ensureTool(ToolNames.AGENT);
65573
- const subagents = (await this.config.getSubagentManager().listSubagents()).filter((subagent) => subagent.level !== "builtin").map((subagent) => subagent.name);
65574
- if (hasAgentTool && subagents.length > 0) {
65575
- systemReminders.push(getSubagentSystemReminder(subagents));
65576
- }
65577
66039
  if (this.config.getApprovalMode() === "plan" /* PLAN */) {
65578
66040
  systemReminders.push(
65579
66041
  getPlanModeSystemReminder(this.config.getSdkMode())
@@ -65937,14 +66399,15 @@ var GeminiClient = class {
65937
66399
  * startup context after successful compaction and flips the IDE full-context
65938
66400
  * flag for the next regular message.
65939
66401
  */
65940
- async tryCompressChat(prompt_id, force = false, signal) {
66402
+ async tryCompressChat(prompt_id, force = false, signal, customInstructions) {
65941
66403
  const previousSessionStartContext = this.lastSessionStartContext;
65942
66404
  const previousSessionStartSource = this.lastSessionStartSource;
65943
66405
  const info2 = await this.getChat().tryCompress(
65944
66406
  prompt_id,
65945
66407
  this.config.getModel(),
65946
66408
  force,
65947
- signal
66409
+ signal,
66410
+ customInstructions ? { customInstructions } : void 0
65948
66411
  );
65949
66412
  if (info2.compressionStatus === 1 /* COMPRESSED */) {
65950
66413
  const chat = this.getChat();
@@ -75191,7 +75654,7 @@ __name(assertNever, "assertNever");
75191
75654
  // packages/core/src/tools/mcp-client.ts
75192
75655
  init_esbuild_shims();
75193
75656
 
75194
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
75657
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
75195
75658
  init_esbuild_shims();
75196
75659
 
75197
75660
  // node_modules/eventsource/dist/index.js
@@ -75502,7 +75965,7 @@ function getBaseURL() {
75502
75965
  }
75503
75966
  __name(getBaseURL, "getBaseURL");
75504
75967
 
75505
- // packages/core/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
75968
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
75506
75969
  var SseError = class extends Error {
75507
75970
  static {
75508
75971
  __name(this, "SseError");
@@ -98173,6 +98636,7 @@ var HookAggregator = class {
98173
98636
  case "PreToolUse" /* PreToolUse */:
98174
98637
  case "PostToolUse" /* PostToolUse */:
98175
98638
  case "PostToolUseFailure" /* PostToolUseFailure */:
98639
+ case "PostToolBatch" /* PostToolBatch */:
98176
98640
  case "Stop" /* Stop */:
98177
98641
  case "UserPromptSubmit" /* UserPromptSubmit */:
98178
98642
  case "SubagentStop" /* SubagentStop */:
@@ -98361,6 +98825,8 @@ var HookAggregator = class {
98361
98825
  return new PostToolUseHookOutput(output);
98362
98826
  case "PostToolUseFailure" /* PostToolUseFailure */:
98363
98827
  return new PostToolUseFailureHookOutput(output);
98828
+ case "PostToolBatch" /* PostToolBatch */:
98829
+ return new PostToolBatchHookOutput(output);
98364
98830
  case "Stop" /* Stop */:
98365
98831
  case "SubagentStop" /* SubagentStop */:
98366
98832
  return new StopHookOutput(output);
@@ -98413,6 +98879,7 @@ function getHookMatcherTarget(eventName, context) {
98413
98879
  };
98414
98880
  case "UserPromptSubmit" /* UserPromptSubmit */:
98415
98881
  case "Stop" /* Stop */:
98882
+ case "PostToolBatch" /* PostToolBatch */:
98416
98883
  case "TodoCreated" /* TodoCreated */:
98417
98884
  case "TodoCompleted" /* TodoCompleted */:
98418
98885
  return void 0;
@@ -98756,6 +99223,23 @@ var HookEventHandler = class {
98756
99223
  signal
98757
99224
  );
98758
99225
  }
99226
+ /**
99227
+ * Fire a PostToolBatch event
99228
+ * Called once after every tool call in a batch has resolved
99229
+ */
99230
+ async firePostToolBatchEvent(toolCalls, permissionMode = "default" /* Default */, signal) {
99231
+ const input = {
99232
+ ...this.createBaseInput("PostToolBatch" /* PostToolBatch */),
99233
+ permission_mode: permissionMode,
99234
+ tool_calls: toolCalls
99235
+ };
99236
+ return this.executeHooks(
99237
+ "PostToolBatch" /* PostToolBatch */,
99238
+ input,
99239
+ void 0,
99240
+ signal
99241
+ );
99242
+ }
98759
99243
  /**
98760
99244
  * Fire a Notification event
98761
99245
  */
@@ -99565,6 +100049,17 @@ var HookSystem = class {
99565
100049
  );
99566
100050
  return result.finalOutput ? createHookOutput("PostToolUseFailure", result.finalOutput) : void 0;
99567
100051
  }
100052
+ /**
100053
+ * Fire a PostToolBatch event - called once after a tool-call batch resolves
100054
+ */
100055
+ async firePostToolBatchEvent(toolCalls, permissionMode = "default" /* Default */, signal) {
100056
+ const result = await this.hookEventHandler.firePostToolBatchEvent(
100057
+ toolCalls,
100058
+ permissionMode,
100059
+ signal
100060
+ );
100061
+ return result.finalOutput ? createHookOutput("PostToolBatch", result.finalOutput) : void 0;
100062
+ }
99568
100063
  /**
99569
100064
  * Fire a PreCompact event - called before conversation compaction
99570
100065
  */
@@ -103544,6 +104039,7 @@ var Config = class {
103544
104039
  runtimeStatusEnabled = false;
103545
104040
  experimentalZedIntegration = false;
103546
104041
  cronEnabled = false;
104042
+ forkSubagentEnabled = false;
103547
104043
  computerUseEnabled = true;
103548
104044
  emitToolUseSummaries = true;
103549
104045
  chatRecordingEnabled;
@@ -103704,6 +104200,7 @@ var Config = class {
103704
104200
  this.sessionTokenLimit = params.sessionTokenLimit ?? -1;
103705
104201
  this.experimentalZedIntegration = params.experimentalZedIntegration ?? false;
103706
104202
  this.cronEnabled = params.cronEnabled ?? false;
104203
+ this.forkSubagentEnabled = params.forkSubagentEnabled ?? false;
103707
104204
  this.computerUseEnabled = params.computerUseEnabled ?? true;
103708
104205
  this.emitToolUseSummaries = params.emitToolUseSummaries ?? true;
103709
104206
  this.listExtensions = params.listExtensions ?? false;
@@ -103898,6 +104395,13 @@ var Config = class {
103898
104395
  signal
103899
104396
  );
103900
104397
  break;
104398
+ case "PostToolBatch":
104399
+ result = await hookSystem.firePostToolBatchEvent(
104400
+ input["tool_calls"] || [],
104401
+ input["permission_mode"] || "default",
104402
+ signal
104403
+ );
104404
+ break;
103901
104405
  case "Notification":
103902
104406
  result = await hookSystem.fireNotificationEvent(
103903
104407
  input["message"] || "",
@@ -105166,6 +105670,10 @@ var Config = class {
105166
105670
  if (process5.env["QWEN_CODE_ENABLE_CRON"] === "1") return true;
105167
105671
  return this.cronEnabled;
105168
105672
  }
105673
+ isForkSubagentEnabled() {
105674
+ if (process5.env["QWEN_CODE_ENABLE_FORK_SUBAGENT"] === "1") return true;
105675
+ return this.forkSubagentEnabled;
105676
+ }
105169
105677
  isComputerUseEnabled() {
105170
105678
  return this.computerUseEnabled;
105171
105679
  }
@@ -105740,25 +106248,25 @@ var Config = class {
105740
106248
  if (options2?.forSubAgent) return;
105741
106249
  const schema = this.jsonSchema;
105742
106250
  await registerLazy(ToolNames.STRUCTURED_OUTPUT, async () => {
105743
- const { SyntheticOutputTool } = await import("./syntheticOutput-U3YJ3GOO.js");
106251
+ const { SyntheticOutputTool } = await import("./syntheticOutput-DM43O6TY.js");
105744
106252
  return new SyntheticOutputTool(schema);
105745
106253
  });
105746
106254
  }, "registerStructuredOutputIfRequested");
105747
106255
  if (this.getBareMode()) {
105748
106256
  await registerLazy(ToolNames.READ_FILE, async () => {
105749
- const { ReadFileTool } = await import("./read-file-N2YTOQ2U.js");
106257
+ const { ReadFileTool } = await import("./read-file-MXUW3RUF.js");
105750
106258
  return new ReadFileTool(this);
105751
106259
  });
105752
106260
  await registerLazy(ToolNames.EDIT, async () => {
105753
- const { EditTool } = await import("./edit-UQFK25NR.js");
106261
+ const { EditTool } = await import("./edit-YP22XCVA.js");
105754
106262
  return new EditTool(this);
105755
106263
  });
105756
106264
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
105757
- const { NotebookEditTool } = await import("./notebook-edit-I2MBTWI6.js");
106265
+ const { NotebookEditTool } = await import("./notebook-edit-AFRICVUX.js");
105758
106266
  return new NotebookEditTool(this);
105759
106267
  });
105760
106268
  await registerLazy(ToolNames.SHELL, async () => {
105761
- const { ShellTool: ShellTool2 } = await import("./shell-V7PVS7O7.js");
106269
+ const { ShellTool: ShellTool2 } = await import("./shell-JOXQ5PPL.js");
105762
106270
  return new ShellTool2(this);
105763
106271
  });
105764
106272
  await registerStructuredOutputIfRequested();
@@ -105768,31 +106276,31 @@ var Config = class {
105768
106276
  return registry;
105769
106277
  }
105770
106278
  await registerLazy(ToolNames.TOOL_SEARCH, async () => {
105771
- const { ToolSearchTool } = await import("./tool-search-6CRPUSUB.js");
106279
+ const { ToolSearchTool } = await import("./tool-search-DRMR34WX.js");
105772
106280
  return new ToolSearchTool(this);
105773
106281
  });
105774
106282
  await registerLazy(ToolNames.AGENT, async () => {
105775
- const { AgentTool: AgentTool2 } = await import("./agent-Z7O3I6MY.js");
106283
+ const { AgentTool: AgentTool2 } = await import("./agent-GNHB6UIW.js");
105776
106284
  return new AgentTool2(this);
105777
106285
  });
105778
106286
  await registerLazy(ToolNames.TASK_STOP, async () => {
105779
- const { TaskStopTool } = await import("./task-stop-NPUI3YBA.js");
106287
+ const { TaskStopTool } = await import("./task-stop-WKP5OB3V.js");
105780
106288
  return new TaskStopTool(this);
105781
106289
  });
105782
106290
  await registerLazy(ToolNames.SEND_MESSAGE, async () => {
105783
- const { SendMessageTool } = await import("./send-message-ZL7CDM7K.js");
106291
+ const { SendMessageTool } = await import("./send-message-GFYV7WLL.js");
105784
106292
  return new SendMessageTool(this);
105785
106293
  });
105786
106294
  await registerLazy(ToolNames.SKILL, async () => {
105787
- const { SkillTool } = await import("./skill-6LP5ANRL.js");
106295
+ const { SkillTool } = await import("./skill-73RYGDJQ.js");
105788
106296
  return new SkillTool(this);
105789
106297
  });
105790
106298
  await registerLazy(ToolNames.LS, async () => {
105791
- const { LSTool } = await import("./ls-7FYQHPWF.js");
106299
+ const { LSTool } = await import("./ls-T4SVZWR6.js");
105792
106300
  return new LSTool(this);
105793
106301
  });
105794
106302
  await registerLazy(ToolNames.READ_FILE, async () => {
105795
- const { ReadFileTool } = await import("./read-file-N2YTOQ2U.js");
106303
+ const { ReadFileTool } = await import("./read-file-MXUW3RUF.js");
105796
106304
  return new ReadFileTool(this);
105797
106305
  });
105798
106306
  if (this.getUseRipgrep()) {
@@ -105805,7 +106313,7 @@ var Config = class {
105805
106313
  }
105806
106314
  if (useRipgrep) {
105807
106315
  await registerLazy(ToolNames.GREP, async () => {
105808
- const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-NBWBOVPW.js");
106316
+ const { RipGrepTool: RipGrepTool2 } = await import("./ripGrep-AHBINNF3.js");
105809
106317
  return new RipGrepTool2(this);
105810
106318
  });
105811
106319
  } else {
@@ -105818,89 +106326,89 @@ var Config = class {
105818
106326
  )
105819
106327
  );
105820
106328
  await registerLazy(ToolNames.GREP, async () => {
105821
- const { GrepTool } = await import("./grep-4RXPZUYZ.js");
106329
+ const { GrepTool } = await import("./grep-RFEZDGI4.js");
105822
106330
  return new GrepTool(this);
105823
106331
  });
105824
106332
  }
105825
106333
  } else {
105826
106334
  await registerLazy(ToolNames.GREP, async () => {
105827
- const { GrepTool } = await import("./grep-4RXPZUYZ.js");
106335
+ const { GrepTool } = await import("./grep-RFEZDGI4.js");
105828
106336
  return new GrepTool(this);
105829
106337
  });
105830
106338
  }
105831
106339
  await registerLazy(ToolNames.GLOB, async () => {
105832
- const { GlobTool } = await import("./glob-34CPYA2M.js");
106340
+ const { GlobTool } = await import("./glob-NZWP66L5.js");
105833
106341
  return new GlobTool(this);
105834
106342
  });
105835
106343
  await registerLazy(ToolNames.EDIT, async () => {
105836
- const { EditTool } = await import("./edit-UQFK25NR.js");
106344
+ const { EditTool } = await import("./edit-YP22XCVA.js");
105837
106345
  return new EditTool(this);
105838
106346
  });
105839
106347
  await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
105840
- const { NotebookEditTool } = await import("./notebook-edit-I2MBTWI6.js");
106348
+ const { NotebookEditTool } = await import("./notebook-edit-AFRICVUX.js");
105841
106349
  return new NotebookEditTool(this);
105842
106350
  });
105843
106351
  await registerLazy(ToolNames.WRITE_FILE, async () => {
105844
- const { WriteFileTool } = await import("./write-file-CCMVL5Q7.js");
106352
+ const { WriteFileTool } = await import("./write-file-B45ZAKUJ.js");
105845
106353
  return new WriteFileTool(this);
105846
106354
  });
105847
106355
  await registerLazy(ToolNames.SHELL, async () => {
105848
- const { ShellTool: ShellTool2 } = await import("./shell-V7PVS7O7.js");
106356
+ const { ShellTool: ShellTool2 } = await import("./shell-JOXQ5PPL.js");
105849
106357
  return new ShellTool2(this);
105850
106358
  });
105851
106359
  await registerLazy(ToolNames.TODO_WRITE, async () => {
105852
- const { TodoWriteTool } = await import("./todoWrite-USWGQJ53.js");
106360
+ const { TodoWriteTool } = await import("./todoWrite-GHL6DCLP.js");
105853
106361
  return new TodoWriteTool(this);
105854
106362
  });
105855
106363
  await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
105856
- const { AskUserQuestionTool } = await import("./askUserQuestion-DC6OWQIL.js");
106364
+ const { AskUserQuestionTool } = await import("./askUserQuestion-TGRD7FNQ.js");
105857
106365
  return new AskUserQuestionTool(this);
105858
106366
  });
105859
106367
  if (!this.sdkMode) {
105860
106368
  await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
105861
- const { ExitPlanModeTool } = await import("./exitPlanMode-SFNBASAU.js");
106369
+ const { ExitPlanModeTool } = await import("./exitPlanMode-2D6EGF76.js");
105862
106370
  return new ExitPlanModeTool(this);
105863
106371
  });
105864
106372
  }
105865
106373
  await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
105866
- const { EnterWorktreeTool } = await import("./enter-worktree-VZT6JX45.js");
106374
+ const { EnterWorktreeTool } = await import("./enter-worktree-BD7UFMUZ.js");
105867
106375
  return new EnterWorktreeTool(this);
105868
106376
  });
105869
106377
  await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
105870
- const { ExitWorktreeTool } = await import("./exit-worktree-JETQQ26R.js");
106378
+ const { ExitWorktreeTool } = await import("./exit-worktree-AVWBCQWY.js");
105871
106379
  return new ExitWorktreeTool(this);
105872
106380
  });
105873
106381
  await registerLazy(ToolNames.WEB_FETCH, async () => {
105874
- const { WebFetchTool } = await import("./web-fetch-LGLGFGGT.js");
106382
+ const { WebFetchTool } = await import("./web-fetch-SZIV74ZX.js");
105875
106383
  return new WebFetchTool(this);
105876
106384
  });
105877
106385
  if (this.isLspEnabled() && this.getLspClient()) {
105878
106386
  await registerLazy(ToolNames.LSP, async () => {
105879
- const { LspTool } = await import("./lsp-DKG34USR.js");
106387
+ const { LspTool } = await import("./lsp-U4ZQLNIS.js");
105880
106388
  return new LspTool(this);
105881
106389
  });
105882
106390
  }
105883
106391
  await registerStructuredOutputIfRequested();
105884
106392
  if (this.isCronEnabled()) {
105885
106393
  await registerLazy(ToolNames.CRON_CREATE, async () => {
105886
- const { CronCreateTool } = await import("./cron-create-FXRORK2U.js");
106394
+ const { CronCreateTool } = await import("./cron-create-V3UK2SJN.js");
105887
106395
  return new CronCreateTool(this);
105888
106396
  });
105889
106397
  await registerLazy(ToolNames.CRON_LIST, async () => {
105890
- const { CronListTool } = await import("./cron-list-SMOX26SL.js");
106398
+ const { CronListTool } = await import("./cron-list-UDIYK3B3.js");
105891
106399
  return new CronListTool(this);
105892
106400
  });
105893
106401
  await registerLazy(ToolNames.CRON_DELETE, async () => {
105894
- const { CronDeleteTool } = await import("./cron-delete-D24IN6CA.js");
106402
+ const { CronDeleteTool } = await import("./cron-delete-MANALPCP.js");
105895
106403
  return new CronDeleteTool(this);
105896
106404
  });
105897
106405
  }
105898
106406
  if (this.isComputerUseEnabled()) {
105899
- const { registerComputerUseTools } = await import("./computer-use-2J5ZXEER.js");
106407
+ const { registerComputerUseTools } = await import("./computer-use-NAHQPV2L.js");
105900
106408
  await registerComputerUseTools(registerLazy);
105901
106409
  }
105902
106410
  await registerLazy(ToolNames.MONITOR, async () => {
105903
- const { MonitorTool } = await import("./monitor-QCNAUO75.js");
106411
+ const { MonitorTool } = await import("./monitor-OHKCQLFQ.js");
105904
106412
  return new MonitorTool(this);
105905
106413
  });
105906
106414
  if (this.pendingMcpBudgetCallback) {
@@ -121159,7 +121667,6 @@ export {
121159
121667
  getCoreSystemPrompt,
121160
121668
  getCompressionPrompt,
121161
121669
  getProjectSummaryPrompt,
121162
- getSubagentSystemReminder,
121163
121670
  getPlanModeSystemReminder,
121164
121671
  getArenaSystemReminder,
121165
121672
  getInsightPrompt,