wave-agent-sdk 0.10.0 → 0.10.2

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 (103) hide show
  1. package/dist/agent.d.ts +6 -0
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +2 -0
  4. package/dist/core/session.d.ts +1 -1
  5. package/dist/core/session.d.ts.map +1 -1
  6. package/dist/core/session.js +1 -1
  7. package/dist/managers/aiManager.d.ts.map +1 -1
  8. package/dist/managers/aiManager.js +1 -0
  9. package/dist/managers/backgroundTaskManager.d.ts +3 -0
  10. package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
  11. package/dist/managers/backgroundTaskManager.js +3 -0
  12. package/dist/managers/messageManager.d.ts +1 -6
  13. package/dist/managers/messageManager.d.ts.map +1 -1
  14. package/dist/managers/messageManager.js +0 -6
  15. package/dist/managers/permissionManager.d.ts +1 -1
  16. package/dist/managers/permissionManager.d.ts.map +1 -1
  17. package/dist/managers/permissionManager.js +47 -10
  18. package/dist/managers/skillManager.d.ts +17 -2
  19. package/dist/managers/skillManager.d.ts.map +1 -1
  20. package/dist/managers/skillManager.js +93 -21
  21. package/dist/managers/slashCommandManager.d.ts.map +1 -1
  22. package/dist/managers/slashCommandManager.js +7 -1
  23. package/dist/managers/toolManager.d.ts.map +1 -1
  24. package/dist/managers/toolManager.js +1 -0
  25. package/dist/prompts/index.d.ts +1 -1
  26. package/dist/prompts/index.d.ts.map +1 -1
  27. package/dist/prompts/index.js +1 -0
  28. package/dist/services/configurationService.d.ts.map +1 -1
  29. package/dist/services/configurationService.js +1 -0
  30. package/dist/services/fileWatcher.d.ts.map +1 -1
  31. package/dist/services/fileWatcher.js +27 -15
  32. package/dist/services/session.d.ts +16 -2
  33. package/dist/services/session.d.ts.map +1 -1
  34. package/dist/services/session.js +110 -7
  35. package/dist/tools/askUserQuestion.d.ts.map +1 -1
  36. package/dist/tools/askUserQuestion.js +8 -1
  37. package/dist/tools/bashTool.d.ts.map +1 -1
  38. package/dist/tools/bashTool.js +4 -4
  39. package/dist/tools/editTool.d.ts.map +1 -1
  40. package/dist/tools/editTool.js +1 -1
  41. package/dist/tools/exitPlanMode.d.ts.map +1 -1
  42. package/dist/tools/exitPlanMode.js +3 -1
  43. package/dist/tools/grepTool.d.ts.map +1 -1
  44. package/dist/tools/grepTool.js +1 -1
  45. package/dist/tools/lspTool.d.ts.map +1 -1
  46. package/dist/tools/lspTool.js +47 -15
  47. package/dist/tools/taskOutputTool.d.ts.map +1 -1
  48. package/dist/tools/taskOutputTool.js +22 -5
  49. package/dist/tools/types.d.ts +3 -0
  50. package/dist/tools/types.d.ts.map +1 -1
  51. package/dist/tools/writeTool.d.ts.map +1 -1
  52. package/dist/tools/writeTool.js +1 -1
  53. package/dist/types/agent.d.ts +2 -0
  54. package/dist/types/agent.d.ts.map +1 -1
  55. package/dist/types/configuration.d.ts +2 -0
  56. package/dist/types/configuration.d.ts.map +1 -1
  57. package/dist/types/permissions.d.ts +2 -0
  58. package/dist/types/permissions.d.ts.map +1 -1
  59. package/dist/types/skills.d.ts +4 -2
  60. package/dist/types/skills.d.ts.map +1 -1
  61. package/dist/utils/bashParser.d.ts.map +1 -1
  62. package/dist/utils/bashParser.js +50 -0
  63. package/dist/utils/configPaths.d.ts +6 -0
  64. package/dist/utils/configPaths.d.ts.map +1 -1
  65. package/dist/utils/configPaths.js +23 -2
  66. package/dist/utils/containerSetup.d.ts.map +1 -1
  67. package/dist/utils/containerSetup.js +4 -1
  68. package/dist/utils/gitUtils.d.ts +6 -0
  69. package/dist/utils/gitUtils.d.ts.map +1 -1
  70. package/dist/utils/gitUtils.js +22 -0
  71. package/package.json +1 -1
  72. package/src/agent.ts +18 -2
  73. package/src/builtin-skills/settings/HOOKS.md +95 -0
  74. package/src/builtin-skills/settings/SKILL.md +86 -0
  75. package/src/core/session.ts +2 -0
  76. package/src/managers/aiManager.ts +1 -0
  77. package/src/managers/backgroundTaskManager.ts +11 -1
  78. package/src/managers/messageManager.ts +1 -9
  79. package/src/managers/permissionManager.ts +51 -9
  80. package/src/managers/skillManager.ts +111 -25
  81. package/src/managers/slashCommandManager.ts +8 -1
  82. package/src/managers/toolManager.ts +1 -0
  83. package/src/prompts/index.ts +1 -0
  84. package/src/services/configurationService.ts +1 -0
  85. package/src/services/fileWatcher.ts +33 -17
  86. package/src/services/session.ts +124 -7
  87. package/src/tools/askUserQuestion.ts +10 -0
  88. package/src/tools/bashTool.ts +4 -3
  89. package/src/tools/editTool.ts +1 -0
  90. package/src/tools/exitPlanMode.ts +4 -1
  91. package/src/tools/grepTool.ts +2 -1
  92. package/src/tools/lspTool.ts +99 -9
  93. package/src/tools/taskOutputTool.ts +25 -6
  94. package/src/tools/types.ts +4 -0
  95. package/src/tools/writeTool.ts +1 -0
  96. package/src/types/agent.ts +2 -0
  97. package/src/types/configuration.ts +2 -0
  98. package/src/types/permissions.ts +2 -0
  99. package/src/types/skills.ts +4 -2
  100. package/src/utils/bashParser.ts +54 -0
  101. package/src/utils/configPaths.ts +28 -2
  102. package/src/utils/containerSetup.ts +4 -1
  103. package/src/utils/gitUtils.ts +22 -0
@@ -7,7 +7,7 @@ export declare const BASH_SUBAGENT_SYSTEM_PROMPT = "You are a command execution
7
7
  export declare const GENERAL_PURPOSE_SYSTEM_PROMPT = "You are an agent. Given the user's message, you should use the tools available to complete the task. Do what has been asked; nothing more, nothing less. When you complete the task simply respond with a detailed writeup.\n\nYour strengths:\n- Searching for code, configurations, and patterns across large codebases\n- Analyzing multiple files to understand system architecture\n- Investigating complex questions that require exploring many files\n- Performing multi-step research tasks\n\nGuidelines:\n- For file searches: Use Grep or Glob when you need to search broadly. Use Read when you know the specific file path.\n- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.\n- Be thorough: Check multiple locations, consider different naming conventions, look for related files.\n- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested.\n- In your final response always share relevant file names and code snippets. Any file paths you return in your response MUST be absolute. Do NOT use relative paths.\n- For clear communication, avoid using emojis.";
8
8
  export declare const EXPLORE_SUBAGENT_SYSTEM_PROMPT = "You are a file search specialist. You excel at thoroughly navigating and exploring codebases.\n\t\n\t=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===\n\tThis is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:\n\t- Creating new files (no Write, touch, or file creation of any kind)\n\t- Modifying existing files (no Edit operations)\n\t- Moving or copying files (no mv or cp)\n\t- Creating temporary files anywhere, including /tmp\n\t- Using redirect operators (>, >>, |) or heredocs to write to files\n\t- Running ANY commands that change system state\n\t\n\tYour role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.\n\t\n\tYour strengths:\n\t- Rapidly finding files using glob patterns\n\t- Searching code and text with powerful regex patterns\n\t- Reading and analyzing file contents\n\t- Using Language Server Protocol (LSP) for deep code intelligence (definitions, references, etc.)\n\t\n\tGuidelines:\n\t- Use Glob for broad file pattern matching\n\t- Use Grep for searching file contents with regex\n\t- Use Read when you know the specific file path you need to read\n\t- Use LSP for code intelligence features like finding definitions, references, implementations, and symbols. This is especially useful for understanding complex code relationships.\n\t- Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)\n\t- NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification\n\t- Adapt your search approach based on the thoroughness level specified by the caller\n\t- Return file paths as absolute paths in your final response\n\t- For clear communication, avoid using emojis\n\t- Communicate your final report directly as a regular message - do NOT attempt to create files\n\t\n\tNOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:\n\t- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations\n\t- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files\n\t\n\tComplete the user's search request efficiently and report your findings clearly.";
9
9
  export declare const PLAN_SUBAGENT_SYSTEM_PROMPT = "You are a software architect and planning specialist. Your role is to explore the codebase and design implementation plans.\n\n=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===\nThis is a READ-ONLY planning task. You are STRICTLY PROHIBITED from:\n- Creating new files (no Write, touch, or file creation of any kind)\n- Modifying existing files (no Edit operations)\n- Moving or copying files (no mv or cp)\n- Creating temporary files anywhere, including /tmp\n- Using redirect operators (>, >>, |) or heredocs to write to files\n- Running ANY commands that change system state\n\nYour role is EXCLUSIVELY to explore the codebase and design implementation plans. You do NOT have access to file editing tools - attempting to edit files will fail.\n\nYou will be provided with a set of requirements and optionally a perspective on how to approach the design process.\n\n## Your Process\n\n1. **Understand Requirements**: Focus on the requirements provided and apply your assigned perspective throughout the design process.\n\n2. **Explore Thoroughly**:\n - Read any files provided to you in the initial prompt\n - Find existing patterns and conventions using Glob, Grep, and Read\n - Understand the current architecture\n - Identify similar features as reference\n - Trace through relevant code paths\n - Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)\n - NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification\n\n3. **Design Solution**:\n - Create implementation approach based on your assigned perspective\n - Consider trade-offs and architectural decisions\n - Follow existing patterns where appropriate\n\n4. **Detail the Plan**:\n - Provide step-by-step implementation strategy\n - Identify dependencies and sequencing\n - Anticipate potential challenges\n\n## Required Output\n\nEnd your response with:\n\n### Critical Files for Implementation\nList 3-5 files most critical for implementing this plan:\n- path/to/file1.ts - [Brief reason: e.g., \"Core logic to modify\"]\n- path/to/file2.ts - [Brief reason: e.g., \"Interfaces to implement\"]\n- path/to/file3.ts - [Brief reason: e.g., \"Pattern to follow\"]\n\nREMEMBER: You can ONLY explore and plan. You CANNOT and MUST NOT write, edit, or modify any files. You do NOT have access to file editing tools.";
10
- export declare const INIT_PROMPT = "Please analyze this codebase and create a AGENTS.md file, which will be given to future instances of Agent to operate in this repository.\n\nWhat to add:\n1. Commands that will be commonly used, such as how to build, lint, and run tests. Include the necessary commands to develop in this codebase, such as how to run a single test.\n2. High-level code architecture and structure so that future instances can be productive more quickly. Focus on the \"big picture\" architecture that requires reading multiple files to understand.\n\nUsage notes:\n- If there's already a AGENTS.md, suggest improvements to it.\n- When you make the initial AGENTS.md, do not repeat yourself and do not include obvious instructions like \"Provide helpful error messages to users\", \"Write unit tests for all new utilities\", \"Never include sensitive information (API keys, tokens) in code or commits\".\n- Avoid listing every component or file structure that can be easily discovered.\n- Don't include generic development practices.\n- If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include the important parts.\n- If there is a README.md, make sure to include the important parts.\n- Do not make up information such as \"Common Development Tasks\", \"Tips for Development\", \"Support and Documentation\" unless this is expressly included in other files that you read.\n- Be sure to prefix the file with the following text:\n\n```\n# AGENTS.md\n\nThis file provides guidance to Agent when working with code in this repository.\n```";
10
+ export declare const INIT_PROMPT = "Please analyze this codebase and create a AGENTS.md file, which will be given to future instances of Agent to operate in this repository.\n\nWhat to add:\n1. Commands that will be commonly used, such as how to build, lint, and run tests. Include the necessary commands to develop in this codebase, such as how to run a single test.\n2. High-level code architecture and structure so that future instances can be productive more quickly. Focus on the \"big picture\" architecture that requires reading multiple files to understand.\n\nUsage notes:\n- If there's already a AGENTS.md, suggest improvements to it.\n- When you make the initial AGENTS.md, do not repeat yourself and do not include obvious instructions like \"Provide helpful error messages to users\", \"Write unit tests for all new utilities\", \"Never include sensitive information (API keys, tokens) in code or commits\".\n- Avoid listing every component or file structure that can be easily discovered.\n- Don't include generic development practices.\n- If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include the important parts.\n- Do NOT include rules from .wave/rules/ as they are automatically loaded by the system.\n- If there is a README.md, make sure to include the important parts.\n- Do not make up information such as \"Common Development Tasks\", \"Tips for Development\", \"Support and Documentation\" unless this is expressly included in other files that you read.\n- Be sure to prefix the file with the following text:\n\n```\n# AGENTS.md\n\nThis file provides guidance to Agent when working with code in this repository.\n```";
11
11
  export declare const COMPRESS_MESSAGES_SYSTEM_PROMPT = "You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:\n1. Task Overview\nThe user's core request and success criteria\nAny clarifications or constraints they specified\n2. Current State\nWhat has been completed so far\nFiles created, modified, or analyzed (with paths if relevant)\nKey outputs or artifacts produced\n3. Important Discoveries\nTechnical constraints or requirements uncovered\nDecisions made and their rationale\nErrors encountered and how they were resolved\nWhat approaches were tried that didn't work (and why)\n4. Next Steps\nSpecific actions needed to complete the task\nAny blockers or open questions to resolve\nPriority order if multiple steps remain\n5. Context to Preserve\nUser preferences or style requirements\nDomain-specific details that aren't obvious\nAny promises made to the user\nBe concise but complete\u2014err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.\nWrap your summary in <summary></summary> tags.";
12
12
  export declare function buildSystemPrompt(basePrompt: string | undefined, tools: ToolPlugin[], options?: {
13
13
  workdir?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAmB/C,eAAO,MAAM,kBAAkB,g9DAU+J,CAAC;AAE/L,eAAO,MAAM,WAAW,qvBAIqH,CAAC;AAE9I,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,UAAU,GAAE,OAAe,GAC1B,MAAM,CAmFR;AAED,eAAO,MAAM,qBAAqB,g9DAAqB,CAAC;AAExD,eAAO,MAAM,2BAA2B,igBAWO,CAAC;AAEhD,eAAO,MAAM,6BAA6B,izCAeK,CAAC;AAEhD,eAAO,MAAM,8BAA8B,mzEAmCuC,CAAC;AAEnF,eAAO,MAAM,2BAA2B,q3EAgDyG,CAAC;AAElJ,eAAO,MAAM,WAAW,k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,EACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACE,GACL,MAAM,CA6CR"}
@@ -227,6 +227,7 @@ Usage notes:
227
227
  - Avoid listing every component or file structure that can be easily discovered.
228
228
  - Don't include generic development practices.
229
229
  - If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include the important parts.
230
+ - Do NOT include rules from .wave/rules/ as they are automatically loaded by the system.
230
231
  - If there is a README.md, make sure to include the important parts.
231
232
  - Do not make up information such as "Common Development Tasks", "Tips for Development", "Support and Documentation" unless this is expressly included in other files that you read.
232
233
  - Be sure to prefix the file with the following text:
@@ -1 +1 @@
1
- {"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EAGX,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,oBAAoB,CAA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MAAM;IAyBzD;;OAEG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB;IAY1D;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoClE;;OAEG;IACG,mBAAmB,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IAuChB;;OAEG;IACG,mBAAmB,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAmChB;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKjE;;;OAGG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI;CAGnE;AAKD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,UAAU,CAAC,EAAE,MAAM,GAClB,2BAA2B,CAsD7B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC9C,OAAO,GAAE,uBAA4B,GACpC,wBAAwB,CAoC1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,iBAAiB,GAAG,IAAI,CA4B1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CAoI1B"}
1
+ {"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mapp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O,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC9C,OAAO,GAAE,uBAA4B,GACpC,wBAAwB,CAoC1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,iBAAiB,GAAG,IAAI,CA4B1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CAoI1B"}
@@ -461,6 +461,7 @@ export class ConfigurationService {
461
461
  return {
462
462
  userPaths: allPaths.userPaths,
463
463
  projectPaths: allPaths.projectPaths,
464
+ builtinPaths: allPaths.builtinPaths,
464
465
  allPaths: allPaths.allPaths,
465
466
  existingPaths: existingPaths.existingPaths,
466
467
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fileWatcher.d.ts","sourceRoot":"","sources":["../../src/services/fileWatcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,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;CAoCxB"}
@@ -48,7 +48,7 @@ export class FileWatcherService extends EventEmitter {
48
48
  await this.initializeWatcher(entry);
49
49
  }
50
50
  catch (error) {
51
- this.logger?.error(`Live Config: Failed to watch file ${path}: ${error.message}`);
51
+ this.logger?.error(`FileWatcher: Failed to watch file ${path}: ${error.message}`);
52
52
  throw error;
53
53
  }
54
54
  }
@@ -67,7 +67,7 @@ export class FileWatcherService extends EventEmitter {
67
67
  this.watchers.delete(path);
68
68
  }
69
69
  catch (error) {
70
- this.logger?.warn(`Live Config: Error unwatching file ${path}: ${error.message}`);
70
+ this.logger?.warn(`FileWatcher: Error unwatching file ${path}: ${error.message}`);
71
71
  }
72
72
  }
73
73
  /**
@@ -143,7 +143,7 @@ export class FileWatcherService extends EventEmitter {
143
143
  entry.errorCount++;
144
144
  entry.isActive = false;
145
145
  entry.lastError = error.message;
146
- this.logger?.error(`Live Config: Failed to initialize watcher for ${entry.path}: ${error.message}`);
146
+ this.logger?.error(`FileWatcher: Failed to initialize watcher for ${entry.path}: ${error.message}`);
147
147
  // Try fallback polling if not already using it
148
148
  if (!entry.config.fallbackPolling &&
149
149
  entry.errorCount < entry.config.maxRetries) {
@@ -167,30 +167,42 @@ export class FileWatcherService extends EventEmitter {
167
167
  this.globalWatcher.on("unlink", (filePath) => {
168
168
  this.handleFileEvent("delete", filePath);
169
169
  });
170
+ this.globalWatcher.on("addDir", (dirPath) => {
171
+ this.handleFileEvent("create", dirPath);
172
+ });
173
+ this.globalWatcher.on("unlinkDir", (dirPath) => {
174
+ this.handleFileEvent("delete", dirPath);
175
+ });
170
176
  this.globalWatcher.on("error", (err) => {
171
177
  const error = err instanceof Error ? err : new Error(String(err));
172
- this.logger?.error(`Live Config: File watcher error: ${error.message}`);
178
+ this.logger?.error(`FileWatcher: File watcher error: ${error.message}`);
173
179
  this.emit("watcherError", error);
174
180
  });
175
181
  }
176
182
  handleFileEvent(type, filePath, stats) {
177
- const entry = this.watchers.get(filePath);
178
- if (!entry)
179
- return;
180
183
  const event = {
181
184
  type,
182
185
  path: filePath,
183
186
  timestamp: Date.now(),
184
187
  size: stats?.size,
185
188
  };
186
- entry.lastEvent = event.timestamp;
187
- // Notify all callbacks for this file
188
- for (const callback of entry.callbacks) {
189
- try {
190
- callback(event);
191
- }
192
- catch (error) {
193
- this.logger?.error(`Live Config: Error in file watch callback for ${filePath}: ${error.message}`);
189
+ // Notify all watchers that match the path or are parents of the path
190
+ for (const [watchedPath, entry] of this.watchers.entries()) {
191
+ if (filePath === watchedPath ||
192
+ filePath.startsWith(watchedPath + "/") ||
193
+ // Handle cases where the watched path might be a file and we get an event for it
194
+ // (already covered by filePath === watchedPath)
195
+ false) {
196
+ entry.lastEvent = event.timestamp;
197
+ // Notify all callbacks for this watcher
198
+ for (const callback of entry.callbacks) {
199
+ try {
200
+ callback(event);
201
+ }
202
+ catch (error) {
203
+ this.logger?.error(`FileWatcher: Error in file watch callback for ${watchedPath} (event on ${filePath}): ${error.message}`);
204
+ }
205
+ }
194
206
  }
195
207
  }
196
208
  }
@@ -131,6 +131,12 @@ export declare function listSessions(workdir: string): Promise<SessionMetadata[]
131
131
  * @returns Promise that resolves to array of session metadata objects
132
132
  */
133
133
  export declare function listSessionsFromJsonl(workdir: string): Promise<SessionMetadata[]>;
134
+ /**
135
+ * List all sessions across all project directories
136
+ *
137
+ * @returns Promise that resolves to array of session metadata objects
138
+ */
139
+ export declare function listAllSessions(): Promise<SessionMetadata[]>;
134
140
  /**
135
141
  * Clean up expired sessions older than 14 days based on file modification time
136
142
  *
@@ -161,9 +167,17 @@ export declare function sessionExistsInJsonl(sessionId: string, workdir: string,
161
167
  */
162
168
  export declare function getFirstMessageContent(sessionId: string, workdir: string): Promise<string | null>;
163
169
  /**
164
- * Truncate content to a maximum length, adding ellipsis if truncated
170
+ * Delete a session
171
+ * @param sessionId - UUID session identifier
172
+ * @param workdir - Working directory for the session
173
+ * @param sessionType - Type of session ("main" or "subagent", defaults to "main")
174
+ */
175
+ export declare function deleteSession(sessionId: string, workdir: string, sessionType?: "main" | "subagent"): Promise<void>;
176
+ /**
177
+ * Truncate content to a maximum length, adding ellipsis if truncated.
178
+ * Also replaces real newlines with the literal string "\n".
165
179
  * @param content - The content to truncate
166
- * @param maxLength - Maximum length before truncation (default: 30)
180
+ * @param maxLength - Maximum length before truncation (default: 100)
167
181
  * @returns Truncated content with ellipsis if needed
168
182
  */
169
183
  export declare function truncateContent(content: string, maxLength?: number): string;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/services/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAOjD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,IAAI,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CACd,MAAM,EACN,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,cAAc,CAAC,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,C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SessionsFromJsonl(workdir) {
302
302
  const projectDir = await encoder.getProjectDirectory(workdir, baseDir);
303
303
  // Try to read from index first
304
304
  const indexPath = join(projectDir.encodedPath, SESSION_INDEX_FILENAME);
305
+ const sevenDaysAgo = new Date();
306
+ sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
305
307
  try {
306
308
  const indexContent = await fs.readFile(indexPath, "utf8");
307
309
  const index = JSON.parse(indexContent);
308
310
  const sessions = Object.entries(index.sessions)
309
- .filter(([, meta]) => meta.sessionType === "main")
311
+ .filter(([, meta]) => {
312
+ const lastActiveAt = new Date(meta.lastActiveAt);
313
+ return meta.sessionType === "main" && lastActiveAt >= sevenDaysAgo;
314
+ })
310
315
  .map(([id, meta]) => ({
311
316
  id,
312
317
  ...meta,
@@ -358,6 +363,9 @@ export async function listSessionsFromJsonl(workdir) {
358
363
  const stats = await fs.stat(filePath);
359
364
  lastActiveAt = stats.mtime;
360
365
  }
366
+ if (lastActiveAt < sevenDaysAgo) {
367
+ continue;
368
+ }
361
369
  // Return inline object for performance (no interface instantiation overhead)
362
370
  const sessionMeta = {
363
371
  id: sessionId,
@@ -412,6 +420,65 @@ export async function listSessionsFromJsonl(workdir) {
412
420
  throw new Error(`Failed to list sessions: ${error}`);
413
421
  }
414
422
  }
423
+ /**
424
+ * List all sessions across all project directories
425
+ *
426
+ * @returns Promise that resolves to array of session metadata objects
427
+ */
428
+ export async function listAllSessions() {
429
+ try {
430
+ const baseDir = SESSION_DIR;
431
+ let projectDirs;
432
+ try {
433
+ projectDirs = await fs.readdir(baseDir);
434
+ }
435
+ catch (error) {
436
+ if (error.code === "ENOENT") {
437
+ return [];
438
+ }
439
+ throw error;
440
+ }
441
+ const allSessions = [];
442
+ const sevenDaysAgo = new Date();
443
+ sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
444
+ for (const projectDirName of projectDirs) {
445
+ const projectPath = join(baseDir, projectDirName);
446
+ try {
447
+ const stat = await fs.stat(projectPath);
448
+ if (!stat.isDirectory()) {
449
+ continue;
450
+ }
451
+ // Try to read from index first
452
+ const indexPath = join(projectPath, SESSION_INDEX_FILENAME);
453
+ try {
454
+ const indexContent = await fs.readFile(indexPath, "utf8");
455
+ const index = JSON.parse(indexContent);
456
+ for (const [id, meta] of Object.entries(index.sessions)) {
457
+ const lastActiveAt = new Date(meta.lastActiveAt);
458
+ if (meta.sessionType === "main" && lastActiveAt >= sevenDaysAgo) {
459
+ allSessions.push({
460
+ id,
461
+ ...meta,
462
+ lastActiveAt,
463
+ });
464
+ }
465
+ }
466
+ }
467
+ catch {
468
+ // If index fails, we skip this project directory
469
+ // In the future, we could scan for .jsonl files here
470
+ }
471
+ }
472
+ catch {
473
+ // Skip if stat fails
474
+ }
475
+ }
476
+ return allSessions.sort((a, b) => b.lastActiveAt.getTime() - a.lastActiveAt.getTime());
477
+ }
478
+ catch (error) {
479
+ throw new Error(`Failed to list all sessions: ${error}`);
480
+ }
481
+ }
415
482
  /**
416
483
  * Clean up expired sessions older than 14 days based on file modification time
417
484
  *
@@ -605,16 +672,52 @@ export async function getFirstMessageContent(sessionId, workdir) {
605
672
  }
606
673
  }
607
674
  /**
608
- * Truncate content to a maximum length, adding ellipsis if truncated
675
+ * Delete a session
676
+ * @param sessionId - UUID session identifier
677
+ * @param workdir - Working directory for the session
678
+ * @param sessionType - Type of session ("main" or "subagent", defaults to "main")
679
+ */
680
+ export async function deleteSession(sessionId, workdir, sessionType = "main") {
681
+ const filePath = await generateSessionFilePath(sessionId, workdir, sessionType);
682
+ try {
683
+ await fs.unlink(filePath);
684
+ }
685
+ catch (error) {
686
+ // Ignore if file doesn't exist
687
+ if (error.code !== "ENOENT") {
688
+ throw error;
689
+ }
690
+ }
691
+ // Also remove from index
692
+ try {
693
+ const encoder = new PathEncoder();
694
+ const projectDir = await encoder.getProjectDirectory(workdir, SESSION_DIR);
695
+ const indexPath = join(projectDir.encodedPath, SESSION_INDEX_FILENAME);
696
+ const indexContent = await fs.readFile(indexPath, "utf8");
697
+ const index = JSON.parse(indexContent);
698
+ if (index.sessions[sessionId]) {
699
+ delete index.sessions[sessionId];
700
+ await fs.writeFile(indexPath, JSON.stringify(index, null, 2), "utf8");
701
+ }
702
+ }
703
+ catch {
704
+ // Ignore index errors
705
+ }
706
+ }
707
+ /**
708
+ * Truncate content to a maximum length, adding ellipsis if truncated.
709
+ * Also replaces real newlines with the literal string "\n".
609
710
  * @param content - The content to truncate
610
- * @param maxLength - Maximum length before truncation (default: 30)
711
+ * @param maxLength - Maximum length before truncation (default: 100)
611
712
  * @returns Truncated content with ellipsis if needed
612
713
  */
613
- export function truncateContent(content, maxLength = 30) {
614
- if (content.length <= maxLength) {
615
- return content;
714
+ export function truncateContent(content, maxLength = 100) {
715
+ // Replace real newlines with literal "\n"
716
+ const singleLineContent = content.replace(/\n/g, "\\n");
717
+ if (singleLineContent.length <= maxLength) {
718
+ return singleLineContent;
616
719
  }
617
- return content.substring(0, maxLength) + "...";
720
+ return singleLineContent.substring(0, maxLength) + "...";
618
721
  }
619
722
  /**
620
723
  * Handle session restoration logic
@@ -1 +1 @@
1
- {"version":3,"file":"askUserQuestion.d.ts","sourceRoot":"","sources":["../../src/tools/askUserQuestion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxC,eAAO,MAAM,mBAAmB,EAAE,UAiJjC,CAAC"}
1
+ {"version":3,"file":"askUserQuestion.d.ts","sourceRoot":"","sources":["../../src/tools/askUserQuestion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxC,eAAO,MAAM,mBAAmB,EAAE,UA2JjC,CAAC"}
@@ -90,10 +90,17 @@ Plan mode note: In plan mode, use this tool to clarify requirements or choose be
90
90
  `,
91
91
  execute: async (args, context) => {
92
92
  const { questions, answers: existingAnswers, metadata, } = args;
93
+ if (!questions || !Array.isArray(questions) || questions.length === 0) {
94
+ return {
95
+ success: false,
96
+ content: "",
97
+ error: "The 'questions' parameter is missing or empty. Please use the correct schema: { questions: [{ question, header, options, multiSelect? }] }",
98
+ };
99
+ }
93
100
  if (!context.permissionManager) {
94
101
  throw new Error(`Permission manager is required for ${ASK_USER_QUESTION_TOOL_NAME} tool`);
95
102
  }
96
- const permissionContext = context.permissionManager.createContext(ASK_USER_QUESTION_TOOL_NAME, context.permissionMode || "default", context.canUseToolCallback, { questions, answers: existingAnswers, metadata });
103
+ const permissionContext = context.permissionManager.createContext(ASK_USER_QUESTION_TOOL_NAME, context.permissionMode || "default", context.canUseToolCallback, { questions, answers: existingAnswers, metadata }, context.toolCallId);
97
104
  permissionContext.hidePersistentOption = true; // Always hide persistent option for questions
98
105
  const decision = await context.permissionManager.checkPermission(permissionContext);
99
106
  if (decision.behavior === "deny") {
@@ -1 +1 @@
1
- {"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AActE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UA2XtB,CAAC"}
1
+ {"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AActE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UA4XtB,CAAC"}
@@ -65,10 +65,10 @@ Usage notes:
65
65
  - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
66
66
  - If the output exceeds ${MAX_OUTPUT_LENGTH} characters, output will be truncated before being returned to you.
67
67
  - You can use the \`run_in_background\` parameter to run the command in the background, which allows you to continue working while the command runs. You can monitor the output using the ${BASH_TOOL_NAME} tool as it becomes available. You do not need to use '&' at the end of the command when using this parameter.
68
- - Avoid using ${BASH_TOOL_NAME} with the \`find\`, \`grep\`, \`cat\`, \`head\`, \`tail\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
68
+ - Avoid using ${BASH_TOOL_NAME} with the \`find\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
69
69
  - File search: Use ${GLOB_TOOL_NAME} (NOT find or ls)
70
- - Content search: Use ${GREP_TOOL_NAME} (NOT grep or rg)
71
- - Read files: Use ${READ_TOOL_NAME} (NOT cat/head/tail)
70
+ - Content search: Use ${GREP_TOOL_NAME}
71
+ - Read files: Use ${READ_TOOL_NAME}
72
72
  - Edit files: Use ${EDIT_TOOL_NAME} (NOT sed/awk)
73
73
  - Write files: Use ${WRITE_TOOL_NAME} (NOT echo >/cat <<EOF)
74
74
  - Communication: Output text directly (NOT echo/printf)
@@ -119,7 +119,7 @@ Usage notes:
119
119
  run_in_background: runInBackground,
120
120
  timeout,
121
121
  workdir: context.workdir,
122
- });
122
+ }, context.toolCallId);
123
123
  const permissionResult = await context.permissionManager.checkPermission(permissionContext);
124
124
  if (permissionResult.behavior === "deny") {
125
125
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"editTool.d.ts","sourceRoot":"","sources":["../../src/tools/editTool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAgBtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAgOtB,CAAC"}
1
+ {"version":3,"file":"editTool.d.ts","sourceRoot":"","sources":["../../src/tools/editTool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAgBtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAiOtB,CAAC"}
@@ -147,7 +147,7 @@ Usage:
147
147
  new_string: newString,
148
148
  replace_all: replaceAll,
149
149
  startLineNumber,
150
- });
150
+ }, context.toolCallId);
151
151
  const permissionResult = await context.permissionManager.checkPermission(permissionContext);
152
152
  if (permissionResult.behavior === "deny") {
153
153
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"exitPlanMode.d.ts","sourceRoot":"","sources":["../../src/tools/exitPlanMode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAItE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAkH9B,CAAC"}
1
+ {"version":3,"file":"exitPlanMode.d.ts","sourceRoot":"","sources":["../../src/tools/exitPlanMode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAItE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAqH9B,CAAC"}
@@ -73,7 +73,9 @@ Ensure your plan is complete and unambiguous:
73
73
  };
74
74
  }
75
75
  // Permission check triggers the 3-option UI
76
- const permissionContext = context.permissionManager.createContext(EXIT_PLAN_MODE_TOOL_NAME, context.permissionMode || "plan", context.canUseToolCallback, { plan_content: planContent });
76
+ const permissionContext = context.permissionManager.createContext(EXIT_PLAN_MODE_TOOL_NAME, context.permissionMode || "plan", context.canUseToolCallback, {
77
+ plan_content: planContent,
78
+ }, context.toolCallId);
77
79
  const permissionResult = await context.permissionManager.checkPermission(permissionContext);
78
80
  if (permissionResult.behavior === "deny") {
79
81
  if (permissionResult.message === OPERATION_CANCELLED_BY_USER) {
@@ -1 +1 @@
1
- {"version":3,"file":"grepTool.d.ts","sourceRoot":"","sources":["../../src/tools/grepTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAUtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAiRtB,CAAC"}
1
+ {"version":3,"file":"grepTool.d.ts","sourceRoot":"","sources":["../../src/tools/grepTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAUtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAkRtB,CAAC"}
@@ -178,7 +178,7 @@ export const grepTool = {
178
178
  if (!output) {
179
179
  return {
180
180
  success: true,
181
- content: "No matches found",
181
+ content: "No matches found. Suggestion: specify the 'path' field to search in ignored or other directories (e.g., 'node_modules'), as the default search path is the current working directory and respects .gitignore.",
182
182
  shortResult: "No matches found",
183
183
  };
184
184
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lspTool.d.ts","sourceRoot":"","sources":["../../src/tools/lspTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAgBtE,eAAO,MAAM,WAAW,OAAO,CAAC;AAChC,eAAO,MAAM,SAAS,MAAM,CAAC;AAglB7B;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,UAoLrB,CAAC"}
1
+ {"version":3,"file":"lspTool.d.ts","sourceRoot":"","sources":["../../src/tools/lspTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAiBtE,eAAO,MAAM,WAAW,OAAO,CAAC;AAChC,eAAO,MAAM,SAAS,MAAM,CAAC;AAypB7B;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,UAoMrB,CAAC"}
@@ -1,4 +1,5 @@
1
- import { relative } from "path";
1
+ import { relative, join, isAbsolute } from "path";
2
+ import * as fs from "fs";
2
3
  import { logger } from "../utils/globalLogger.js";
3
4
  import { getDisplayPath } from "../utils/path.js";
4
5
  import { LSP_TOOL_NAME } from "../constants/tools.js";
@@ -29,6 +30,33 @@ function formatUri(uri, workdir) {
29
30
  }
30
31
  return path;
31
32
  }
33
+ /**
34
+ * Formats an error message when no results are found, including context from the file
35
+ */
36
+ function formatNoResultError(message, filePath, line, character, workdir) {
37
+ let absolutePath = filePath;
38
+ if (!isAbsolute(filePath) && workdir) {
39
+ absolutePath = join(workdir, filePath);
40
+ }
41
+ let lineContent = "";
42
+ try {
43
+ const content = fs.readFileSync(absolutePath, "utf-8");
44
+ const lines = content.split("\n");
45
+ if (line > 0 && line <= lines.length) {
46
+ lineContent = lines[line - 1];
47
+ }
48
+ }
49
+ catch {
50
+ // Ignore file read errors
51
+ }
52
+ const displayPath = getDisplayPath(filePath, workdir || "");
53
+ const baseMessage = `${message}\n\nPlease check if the character offset is correct and points to a valid symbol.`;
54
+ if (lineContent) {
55
+ const pointer = " ".repeat(Math.max(0, character - 1)) + "^";
56
+ return `${message}\n\nContext at ${displayPath}:${line}:${character}:\n${lineContent}\n${pointer}\n\nPlease check if the character offset is correct and points to a valid symbol.`;
57
+ }
58
+ return baseMessage;
59
+ }
32
60
  /**
33
61
  * Groups items by their URI
34
62
  */
@@ -83,15 +111,18 @@ function isLocationLink(loc) {
83
111
  /**
84
112
  * Formats the result of a goToDefinition operation
85
113
  */
86
- function formatGoToDefinitionResult(result, workdir) {
114
+ function formatGoToDefinitionResult(result, filePath, line, character, operation, workdir) {
115
+ const message = operation === "goToImplementation"
116
+ ? "No implementation found. This may occur if the cursor is not on a symbol, or if the implementation is in an external library not indexed by the LSP server."
117
+ : "No definition found. This may occur if the cursor is not on a symbol, or if the definition is in an external library not indexed by the LSP server.";
87
118
  if (!result) {
88
- return "No definition found. This may occur if the cursor is not on a symbol, or if the definition is in an external library not indexed by the LSP server.";
119
+ return formatNoResultError(message, filePath, line, character, workdir);
89
120
  }
90
121
  if (Array.isArray(result)) {
91
122
  const locations = result.map((loc) => isLocationLink(loc) ? locationLinkToLocation(loc) : loc);
92
123
  const validLocations = locations.filter((loc) => loc && loc.uri);
93
124
  if (validLocations.length === 0) {
94
- return "No definition found. This may occur if the cursor is not on a symbol, or if the definition is in an external library not indexed by the LSP server.";
125
+ return formatNoResultError(message, filePath, line, character, workdir);
95
126
  }
96
127
  if (validLocations.length === 1) {
97
128
  return `Defined in ${formatLocation(validLocations[0], workdir)}`;
@@ -112,13 +143,14 @@ function formatGoToDefinitionResult(result, workdir) {
112
143
  /**
113
144
  * Formats the result of a findReferences operation
114
145
  */
115
- function formatFindReferencesResult(result, workdir) {
146
+ function formatFindReferencesResult(result, filePath, line, character, workdir) {
147
+ const message = "No references found. This may occur if the symbol has no usages, or if the LSP server has not fully indexed the workspace.";
116
148
  if (!result || result.length === 0) {
117
- return "No references found. This may occur if the symbol has no usages, or if the LSP server has not fully indexed the workspace.";
149
+ return formatNoResultError(message, filePath, line, character, workdir);
118
150
  }
119
151
  const validLocations = result.filter((loc) => loc && loc.uri);
120
152
  if (validLocations.length === 0) {
121
- return "No references found. This may occur if the symbol has no usages, or if the LSP server has not fully indexed the workspace.";
153
+ return formatNoResultError(message, filePath, line, character, workdir);
122
154
  }
123
155
  if (validLocations.length === 1) {
124
156
  return `Found 1 reference:\n ${formatLocation(validLocations[0], workdir)}`;
@@ -171,9 +203,9 @@ function formatHoverContents(contents) {
171
203
  /**
172
204
  * Formats the result of a hover operation
173
205
  */
174
- function formatHoverResult(result) {
206
+ function formatHoverResult(result, filePath, line, character, workdir) {
175
207
  if (!result) {
176
- return "No hover information available. This may occur if the cursor is not on a symbol, or if the LSP server has not fully indexed the file.";
208
+ return formatNoResultError("No hover information available. This may occur if the cursor is not on a symbol, or if the LSP server has not fully indexed the file.", filePath, line, character, workdir);
177
209
  }
178
210
  const contents = formatHoverContents(result.contents);
179
211
  if (result.range) {
@@ -331,9 +363,9 @@ function formatCallHierarchyItem(item, workdir) {
331
363
  /**
332
364
  * Formats the result of a prepareCallHierarchy operation
333
365
  */
334
- function formatPrepareCallHierarchyResult(result, workdir) {
366
+ function formatPrepareCallHierarchyResult(result, filePath, line, character, workdir) {
335
367
  if (!result || result.length === 0) {
336
- return "No call hierarchy item found at this position";
368
+ return formatNoResultError("No call hierarchy item found at this position", filePath, line, character, workdir);
337
369
  }
338
370
  if (result.length === 1) {
339
371
  return `Call hierarchy item: ${formatCallHierarchyItem(result[0], workdir)}`;
@@ -564,13 +596,13 @@ Note: LSP servers must be configured for the file type. If no server is availabl
564
596
  switch (operation) {
565
597
  case "goToDefinition":
566
598
  case "goToImplementation":
567
- formattedContent = formatGoToDefinitionResult(rawResult, context.workdir);
599
+ formattedContent = formatGoToDefinitionResult(rawResult, filePath, line, character, operation, context.workdir);
568
600
  break;
569
601
  case "findReferences":
570
- formattedContent = formatFindReferencesResult(rawResult, context.workdir);
602
+ formattedContent = formatFindReferencesResult(rawResult, filePath, line, character, context.workdir);
571
603
  break;
572
604
  case "hover":
573
- formattedContent = formatHoverResult(rawResult);
605
+ formattedContent = formatHoverResult(rawResult, filePath, line, character, context.workdir);
574
606
  break;
575
607
  case "documentSymbol":
576
608
  formattedContent = formatDocumentSymbolResult(rawResult, context.workdir);
@@ -579,7 +611,7 @@ Note: LSP servers must be configured for the file type. If no server is availabl
579
611
  formattedContent = formatWorkspaceSymbolResult(rawResult, context.workdir);
580
612
  break;
581
613
  case "prepareCallHierarchy":
582
- formattedContent = formatPrepareCallHierarchyResult(rawResult, context.workdir);
614
+ formattedContent = formatPrepareCallHierarchyResult(rawResult, filePath, line, character, context.workdir);
583
615
  break;
584
616
  case "incomingCalls":
585
617
  formattedContent = formatIncomingCallsResult(rawResult, context.workdir);
@@ -1 +1 @@
1
- {"version":3,"file":"taskOutputTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskOutputTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,UAAU,EAAc,MAAM,YAAY,CAAC;AAKjE,eAAO,MAAM,cAAc,EAAE,UA8L5B,CAAC"}
1
+ {"version":3,"file":"taskOutputTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskOutputTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,UAAU,EAAc,MAAM,YAAY,CAAC;AAKjE,eAAO,MAAM,cAAc,EAAE,UAiN5B,CAAC"}