wave-agent-sdk 0.11.0 → 0.11.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.
- package/builtin/skills/init/SKILL.md +26 -0
- package/builtin/skills/settings/ENV.md +64 -0
- package/{src/builtin-skills → builtin/skills}/settings/HOOKS.md +12 -0
- package/builtin/skills/settings/MCP.md +55 -0
- package/builtin/skills/settings/MEMORY_RULES.md +60 -0
- package/{src/builtin-skills → builtin/skills}/settings/SKILL.md +22 -15
- package/builtin/skills/settings/SKILLS.md +63 -0
- package/builtin/skills/settings/SUBAGENTS.md +60 -0
- package/builtin/subagents/bash.md +18 -0
- package/builtin/subagents/explore.md +42 -0
- package/builtin/subagents/general-purpose.md +20 -0
- package/builtin/subagents/plan.md +55 -0
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +7 -0
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +0 -16
- package/dist/prompts/index.d.ts +2 -6
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +3 -136
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +41 -2
- package/dist/tools/types.d.ts +2 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/configPaths.d.ts +4 -0
- package/dist/utils/configPaths.d.ts.map +1 -1
- package/dist/utils/configPaths.js +11 -9
- package/dist/utils/fileSearch.d.ts.map +1 -1
- package/dist/utils/fileSearch.js +7 -1
- package/dist/utils/subagentParser.d.ts.map +1 -1
- package/dist/utils/subagentParser.js +14 -4
- package/package.json +3 -2
- package/src/managers/aiManager.ts +7 -0
- package/src/managers/slashCommandManager.ts +0 -19
- package/src/prompts/index.ts +3 -144
- package/src/tools/bashTool.ts +48 -2
- package/src/tools/types.ts +2 -0
- package/src/utils/configPaths.ts +12 -10
- package/src/utils/fileSearch.ts +7 -1
- package/src/utils/subagentParser.ts +16 -6
- package/dist/builtin-skills/builtin-skills/loop/parsing.ts +0 -159
- package/dist/builtin-skills/builtin-skills/settings/HOOKS.md +0 -82
- package/dist/builtin-skills/builtin-skills/settings/SKILL.md +0 -86
- package/dist/builtin-skills/loop/parsing.d.ts +0 -13
- package/dist/builtin-skills/loop/parsing.d.ts.map +0 -1
- package/dist/builtin-skills/loop/parsing.js +0 -125
- package/dist/utils/builtinSubagents.d.ts +0 -7
- package/dist/utils/builtinSubagents.d.ts.map +0 -1
- package/dist/utils/builtinSubagents.js +0 -94
- package/src/builtin-skills/loop/SKILL.md +0 -53
- package/src/builtin-skills/loop/parsing.ts +0 -159
- package/src/utils/builtinSubagents.ts +0 -122
- /package/{dist/builtin-skills/builtin-skills → builtin/skills}/loop/SKILL.md +0 -0
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { ToolPlugin } from "../tools/types.js";
|
|
2
2
|
import { PermissionMode } from "../types/permissions.js";
|
|
3
|
+
export declare const MAX_PARALLEL_TOOL_CALLS = 3;
|
|
3
4
|
export declare const BASE_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.\n- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.\n- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.\n - Don't add features, refactor code, or make \"improvements\" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.\n - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.\n - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task\u2014three similar lines of code is better than a premature abstraction.\n- Avoid backwards-compatibility hacks like renaming unused `_vars`, re-exporting types, adding `// removed` comments for removed code, etc. If something is unused, delete it completely.";
|
|
4
|
-
export declare const TOOL_POLICY = "\n# Tool usage policy\n- 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.\n- 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. Never use placeholders or guess missing parameters in tool calls.\n- If the user specifies that they want you to run tools \"in parallel\", you MUST send a single message with multiple tool use content blocks.";
|
|
5
|
+
export declare const TOOL_POLICY = "\n# Tool usage policy\n- 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.\n- **Limit**: You MUST NOT call more than 3 tools in parallel in a single response.\n- 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. Never use placeholders or guess missing parameters in tool calls.\n- If the user specifies that they want you to run tools \"in parallel\", you MUST send a single message with multiple tool use content blocks.";
|
|
5
6
|
export declare function buildPlanModePrompt(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
|
|
6
7
|
export declare const DEFAULT_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.\n- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.\n- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.\n - Don't add features, refactor code, or make \"improvements\" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.\n - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.\n - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task\u2014three similar lines of code is better than a premature abstraction.\n- Avoid backwards-compatibility hacks like renaming unused `_vars`, re-exporting types, adding `// removed` comments for removed code, etc. If something is unused, delete it completely.";
|
|
7
|
-
export declare const BASH_SUBAGENT_SYSTEM_PROMPT = "You are a command execution specialist. Your role is to execute bash commands efficiently and safely.\n\nGuidelines:\n- Execute commands precisely as instructed\n- For git operations, follow git safety protocols\n- Report command output clearly and concisely\n- If a command fails, explain the error and suggest solutions\n- Use command chaining (&&) for dependent operations\n- Quote paths with spaces properly\n- For clear communication, avoid using emojis\n\nComplete the requested operations efficiently.";
|
|
8
|
-
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.";
|
|
9
|
-
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.";
|
|
10
|
-
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.";
|
|
11
|
-
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```";
|
|
12
8
|
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.";
|
|
13
9
|
export declare function buildSystemPrompt(basePrompt: string | undefined, tools: ToolPlugin[], options?: {
|
|
14
10
|
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;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAazD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,eAAO,MAAM,kBAAkB,g9DAU+J,CAAC;AAE/L,eAAO,MAAM,WAAW,y0BAKqH,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,+BAA+B,20CAsBG,CAAC;AAEhD,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,UAAU,EAAE,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;IACF,cAAc,CAAC,EAAE,cAAc,CAAC;CAC5B,GACL,MAAM,CAiDR"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -2,7 +2,8 @@ import * as os from "node:os";
|
|
|
2
2
|
import { isGitRepository } from "../utils/gitUtils.js";
|
|
3
3
|
import { buildAutoMemoryPrompt } from "./autoMemory.js";
|
|
4
4
|
import { EXPLORE_SUBAGENT_TYPE, PLAN_SUBAGENT_TYPE, } from "../constants/subagents.js";
|
|
5
|
-
import { ASK_USER_QUESTION_TOOL_NAME,
|
|
5
|
+
import { ASK_USER_QUESTION_TOOL_NAME, EDIT_TOOL_NAME, WRITE_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, AGENT_TOOL_NAME, } from "../constants/tools.js";
|
|
6
|
+
export const MAX_PARALLEL_TOOL_CALLS = 3;
|
|
6
7
|
export const BASE_SYSTEM_PROMPT = `You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
|
|
7
8
|
|
|
8
9
|
# Doing tasks
|
|
@@ -17,6 +18,7 @@ The user will primarily request you perform software engineering tasks. This inc
|
|
|
17
18
|
export const TOOL_POLICY = `
|
|
18
19
|
# Tool usage policy
|
|
19
20
|
- 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.
|
|
21
|
+
- **Limit**: You MUST NOT call more than ${MAX_PARALLEL_TOOL_CALLS} tools in parallel in a single response.
|
|
20
22
|
- 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. Never use placeholders or guess missing parameters in tool calls.
|
|
21
23
|
- If the user specifies that they want you to run tools "in parallel", you MUST send a single message with multiple tool use content blocks.`;
|
|
22
24
|
export function buildPlanModePrompt(planFilePath, planExists, isSubagent = false) {
|
|
@@ -102,141 +104,6 @@ This is critical - your turn should only end with either using the ${ASK_USER_QU
|
|
|
102
104
|
NOTE: At any point in time through this workflow you should feel free to ask the user questions or clarifications using the ${ASK_USER_QUESTION_TOOL_NAME} tool. Don't make large assumptions about user intent. The goal is to present a well researched plan to the user, and tie any loose ends before implementation begins.`;
|
|
103
105
|
}
|
|
104
106
|
export const DEFAULT_SYSTEM_PROMPT = BASE_SYSTEM_PROMPT;
|
|
105
|
-
export const BASH_SUBAGENT_SYSTEM_PROMPT = `You are a command execution specialist. Your role is to execute bash commands efficiently and safely.
|
|
106
|
-
|
|
107
|
-
Guidelines:
|
|
108
|
-
- Execute commands precisely as instructed
|
|
109
|
-
- For git operations, follow git safety protocols
|
|
110
|
-
- Report command output clearly and concisely
|
|
111
|
-
- If a command fails, explain the error and suggest solutions
|
|
112
|
-
- Use command chaining (&&) for dependent operations
|
|
113
|
-
- Quote paths with spaces properly
|
|
114
|
-
- For clear communication, avoid using emojis
|
|
115
|
-
|
|
116
|
-
Complete the requested operations efficiently.`;
|
|
117
|
-
export 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.
|
|
118
|
-
|
|
119
|
-
Your strengths:
|
|
120
|
-
- Searching for code, configurations, and patterns across large codebases
|
|
121
|
-
- Analyzing multiple files to understand system architecture
|
|
122
|
-
- Investigating complex questions that require exploring many files
|
|
123
|
-
- Performing multi-step research tasks
|
|
124
|
-
|
|
125
|
-
Guidelines:
|
|
126
|
-
- For file searches: Use ${GREP_TOOL_NAME} or ${GLOB_TOOL_NAME} when you need to search broadly. Use ${READ_TOOL_NAME} when you know the specific file path.
|
|
127
|
-
- For analysis: Start broad and narrow down. Use multiple search strategies if the first doesn't yield results.
|
|
128
|
-
- Be thorough: Check multiple locations, consider different naming conventions, look for related files.
|
|
129
|
-
- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one.
|
|
130
|
-
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested.
|
|
131
|
-
- 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.
|
|
132
|
-
- For clear communication, avoid using emojis.`;
|
|
133
|
-
export const EXPLORE_SUBAGENT_SYSTEM_PROMPT = `You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
|
|
134
|
-
|
|
135
|
-
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
136
|
-
This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
|
|
137
|
-
- Creating new files (no Write, touch, or file creation of any kind)
|
|
138
|
-
- Modifying existing files (no Edit operations)
|
|
139
|
-
- Moving or copying files (no mv or cp)
|
|
140
|
-
- Creating temporary files anywhere, including /tmp
|
|
141
|
-
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
142
|
-
- Running ANY commands that change system state
|
|
143
|
-
|
|
144
|
-
Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
145
|
-
|
|
146
|
-
Your strengths:
|
|
147
|
-
- Rapidly finding files using glob patterns
|
|
148
|
-
- Searching code and text with powerful regex patterns
|
|
149
|
-
- Reading and analyzing file contents
|
|
150
|
-
- Using Language Server Protocol (LSP) for deep code intelligence (definitions, references, etc.)
|
|
151
|
-
|
|
152
|
-
Guidelines:
|
|
153
|
-
- Use ${GLOB_TOOL_NAME} for broad file pattern matching
|
|
154
|
-
- Use ${GREP_TOOL_NAME} for searching file contents with regex
|
|
155
|
-
- Use ${READ_TOOL_NAME} when you know the specific file path you need to read
|
|
156
|
-
- Use LSP for code intelligence features like finding definitions, references, implementations, and symbols. This is especially useful for understanding complex code relationships.
|
|
157
|
-
- Use ${BASH_TOOL_NAME} ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)
|
|
158
|
-
- NEVER use ${BASH_TOOL_NAME} for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
159
|
-
- Adapt your search approach based on the thoroughness level specified by the caller
|
|
160
|
-
- Return file paths as absolute paths in your final response
|
|
161
|
-
- For clear communication, avoid using emojis
|
|
162
|
-
- Communicate your final report directly as a regular message - do NOT attempt to create files
|
|
163
|
-
|
|
164
|
-
NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
|
|
165
|
-
- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations
|
|
166
|
-
- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files
|
|
167
|
-
|
|
168
|
-
Complete the user's search request efficiently and report your findings clearly.`;
|
|
169
|
-
export const PLAN_SUBAGENT_SYSTEM_PROMPT = `You are a software architect and planning specialist. Your role is to explore the codebase and design implementation plans.
|
|
170
|
-
|
|
171
|
-
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
172
|
-
This is a READ-ONLY planning task. You are STRICTLY PROHIBITED from:
|
|
173
|
-
- Creating new files (no Write, touch, or file creation of any kind)
|
|
174
|
-
- Modifying existing files (no Edit operations)
|
|
175
|
-
- Moving or copying files (no mv or cp)
|
|
176
|
-
- Creating temporary files anywhere, including /tmp
|
|
177
|
-
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
178
|
-
- Running ANY commands that change system state
|
|
179
|
-
|
|
180
|
-
Your 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.
|
|
181
|
-
|
|
182
|
-
You will be provided with a set of requirements and optionally a perspective on how to approach the design process.
|
|
183
|
-
|
|
184
|
-
## Your Process
|
|
185
|
-
|
|
186
|
-
1. **Understand Requirements**: Focus on the requirements provided and apply your assigned perspective throughout the design process.
|
|
187
|
-
|
|
188
|
-
2. **Explore Thoroughly**:
|
|
189
|
-
- Read any files provided to you in the initial prompt
|
|
190
|
-
- Find existing patterns and conventions using ${GLOB_TOOL_NAME}, ${GREP_TOOL_NAME}, and ${READ_TOOL_NAME}
|
|
191
|
-
- Understand the current architecture
|
|
192
|
-
- Identify similar features as reference
|
|
193
|
-
- Trace through relevant code paths
|
|
194
|
-
- Use ${BASH_TOOL_NAME} ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)
|
|
195
|
-
- NEVER use ${BASH_TOOL_NAME} for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
196
|
-
|
|
197
|
-
3. **Design Solution**:
|
|
198
|
-
- Create implementation approach based on your assigned perspective
|
|
199
|
-
- Consider trade-offs and architectural decisions
|
|
200
|
-
- Follow existing patterns where appropriate
|
|
201
|
-
|
|
202
|
-
4. **Detail the Plan**:
|
|
203
|
-
- Provide step-by-step implementation strategy
|
|
204
|
-
- Identify dependencies and sequencing
|
|
205
|
-
- Anticipate potential challenges
|
|
206
|
-
|
|
207
|
-
## Required Output
|
|
208
|
-
|
|
209
|
-
End your response with:
|
|
210
|
-
|
|
211
|
-
### Critical Files for Implementation
|
|
212
|
-
List 3-5 files most critical for implementing this plan:
|
|
213
|
-
- path/to/file1.ts - [Brief reason: e.g., "Core logic to modify"]
|
|
214
|
-
- path/to/file2.ts - [Brief reason: e.g., "Interfaces to implement"]
|
|
215
|
-
- path/to/file3.ts - [Brief reason: e.g., "Pattern to follow"]
|
|
216
|
-
|
|
217
|
-
REMEMBER: 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.`;
|
|
218
|
-
export 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.
|
|
219
|
-
|
|
220
|
-
What to add:
|
|
221
|
-
1. 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.
|
|
222
|
-
2. 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.
|
|
223
|
-
|
|
224
|
-
Usage notes:
|
|
225
|
-
- If there's already a AGENTS.md, suggest improvements to it.
|
|
226
|
-
- 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".
|
|
227
|
-
- Avoid listing every component or file structure that can be easily discovered.
|
|
228
|
-
- Don't include generic development practices.
|
|
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.
|
|
231
|
-
- If there is a README.md, make sure to include the important parts.
|
|
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.
|
|
233
|
-
- Be sure to prefix the file with the following text:
|
|
234
|
-
|
|
235
|
-
\`\`\`
|
|
236
|
-
# AGENTS.md
|
|
237
|
-
|
|
238
|
-
This file provides guidance to Agent when working with code in this repository.
|
|
239
|
-
\`\`\``;
|
|
240
107
|
export 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:
|
|
241
108
|
1. Task Overview
|
|
242
109
|
The user's core request and success criteria
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAuDtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UA2ZtB,CAAC"}
|
package/dist/tools/bashTool.js
CHANGED
|
@@ -28,6 +28,19 @@ function processOutput(output) {
|
|
|
28
28
|
"\n\n... (output truncated, failed to persist full output)");
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Simple throttle function to limit the frequency of updates.
|
|
33
|
+
*/
|
|
34
|
+
function throttle(func, limit) {
|
|
35
|
+
let inThrottle;
|
|
36
|
+
return function () {
|
|
37
|
+
if (!inThrottle) {
|
|
38
|
+
func();
|
|
39
|
+
inThrottle = true;
|
|
40
|
+
setTimeout(() => (inThrottle = false), limit);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
31
44
|
/**
|
|
32
45
|
* Bash command execution tool - supports both foreground and background execution
|
|
33
46
|
*/
|
|
@@ -194,6 +207,29 @@ Usage notes:
|
|
|
194
207
|
let errorBuffer = "";
|
|
195
208
|
let isAborted = false;
|
|
196
209
|
let isBackgrounded = false;
|
|
210
|
+
let isFinished = false;
|
|
211
|
+
const updateRealtimeResults = throttle(() => {
|
|
212
|
+
if (isAborted || isBackgrounded || isFinished)
|
|
213
|
+
return;
|
|
214
|
+
const combinedOutput = outputBuffer + (errorBuffer ? "\n" + errorBuffer : "");
|
|
215
|
+
// Update shortResult: last 3 lines
|
|
216
|
+
if (context.onShortResultUpdate) {
|
|
217
|
+
const tail = combinedOutput.slice(-5000);
|
|
218
|
+
const lines = tail.trim().split("\n");
|
|
219
|
+
const shortResult = lines.length <= 3
|
|
220
|
+
? lines.join("\n")
|
|
221
|
+
: `... +${lines.length - 3} lines\n` + lines.slice(-3).join("\n");
|
|
222
|
+
context.onShortResultUpdate(shortResult);
|
|
223
|
+
}
|
|
224
|
+
// Update full result
|
|
225
|
+
if (context.onResultUpdate) {
|
|
226
|
+
const content = combinedOutput.length <= MAX_OUTPUT_LENGTH
|
|
227
|
+
? combinedOutput
|
|
228
|
+
: combinedOutput.substring(0, MAX_OUTPUT_LENGTH) +
|
|
229
|
+
"\n\n... (output truncated)";
|
|
230
|
+
context.onResultUpdate(content);
|
|
231
|
+
}
|
|
232
|
+
}, 1000);
|
|
197
233
|
const foregroundTaskId = `bash_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
198
234
|
// Register as foreground task
|
|
199
235
|
if (context.foregroundTaskManager && command) {
|
|
@@ -292,15 +328,18 @@ Usage notes:
|
|
|
292
328
|
if (!isAborted && !isBackgrounded && !runInBackground) {
|
|
293
329
|
const chunk = stripAnsiColors(data.toString());
|
|
294
330
|
outputBuffer += chunk;
|
|
331
|
+
updateRealtimeResults();
|
|
295
332
|
}
|
|
296
333
|
});
|
|
297
334
|
child.stderr?.on("data", (data) => {
|
|
298
335
|
if (!isAborted && !isBackgrounded && !runInBackground) {
|
|
299
336
|
const chunk = stripAnsiColors(data.toString());
|
|
300
337
|
errorBuffer += chunk;
|
|
338
|
+
updateRealtimeResults();
|
|
301
339
|
}
|
|
302
340
|
});
|
|
303
341
|
child.on("exit", (code) => {
|
|
342
|
+
isFinished = true;
|
|
304
343
|
if (context.foregroundTaskManager) {
|
|
305
344
|
context.foregroundTaskManager.unregisterForegroundTask(foregroundTaskId);
|
|
306
345
|
}
|
|
@@ -316,8 +355,7 @@ Usage notes:
|
|
|
316
355
|
const lines = combinedOutput.trim().split("\n");
|
|
317
356
|
const shortResult = lines.length <= 3
|
|
318
357
|
? lines.join("\n")
|
|
319
|
-
: lines.slice(
|
|
320
|
-
`\n... +${lines.length - 3} lines`;
|
|
358
|
+
: `... +${lines.length - 3} lines\n` + lines.slice(-3).join("\n");
|
|
321
359
|
resolve({
|
|
322
360
|
success: exitCode === 0,
|
|
323
361
|
content,
|
|
@@ -329,6 +367,7 @@ Usage notes:
|
|
|
329
367
|
}
|
|
330
368
|
});
|
|
331
369
|
child.on("error", (error) => {
|
|
370
|
+
isFinished = true;
|
|
332
371
|
if (context.foregroundTaskManager) {
|
|
333
372
|
context.foregroundTaskManager.unregisterForegroundTask(foregroundTaskId);
|
|
334
373
|
}
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -67,5 +67,7 @@ export interface ToolContext {
|
|
|
67
67
|
toolCallId?: string;
|
|
68
68
|
/** Callback to update the short result of the current tool block */
|
|
69
69
|
onShortResultUpdate?: (shortResult: string) => void;
|
|
70
|
+
/** Callback to update the full result of the current tool block */
|
|
71
|
+
onResultUpdate?: (result: string) => void;
|
|
70
72
|
}
|
|
71
73
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,mBAAmB,CAAC,EAAE,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,WAAW,KACjB,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;QACf,kBAAkB,CAAC,EAAE,qBAAqB,EAAE,CAAC;QAC7C,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;QAClC,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,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AAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,mEAAmE;IACnE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C"}
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* Get the builtin skills directory path
|
|
14
14
|
*/
|
|
15
15
|
export declare function getBuiltinSkillsDir(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Get the builtin subagents directory path
|
|
18
|
+
*/
|
|
19
|
+
export declare function getBuiltinSubagentsDir(): string;
|
|
16
20
|
/**
|
|
17
21
|
* Get the user-specific configuration file path (legacy function)
|
|
18
22
|
* @deprecated Use getUserConfigPaths() for better priority support
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configPaths.d.ts","sourceRoot":"","sources":["../../src/utils/configPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"configPaths.d.ts","sourceRoot":"","sources":["../../src/utils/configPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAI/C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAG7C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB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E,MAAM,CAAC;KACxB,CAAC;CACH,CAcA"}
|
|
@@ -19,15 +19,17 @@ const __dirname = dirname(__filename);
|
|
|
19
19
|
* Get the builtin skills directory path
|
|
20
20
|
*/
|
|
21
21
|
export function getBuiltinSkillsDir() {
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
// Builtin skills are now in the 'builtin/skills' directory at the root of the package
|
|
23
|
+
// Relative to this file (src/utils/configPaths.ts), it's ../../builtin/skills
|
|
24
|
+
return join(__dirname, "..", "..", "builtin", "skills");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the builtin subagents directory path
|
|
28
|
+
*/
|
|
29
|
+
export function getBuiltinSubagentsDir() {
|
|
30
|
+
// Builtin subagents are now in the 'builtin/subagents' directory at the root of the package
|
|
31
|
+
// Relative to this file (src/utils/configPaths.ts), it's ../../builtin/subagents
|
|
32
|
+
return join(__dirname, "..", "..", "builtin", "subagents");
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Get the user-specific configuration file path (legacy function)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileSearch.d.ts","sourceRoot":"","sources":["../../src/utils/fileSearch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"fileSearch.d.ts","sourceRoot":"","sources":["../../src/utils/fileSearch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAuEvD;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,MAAM,EACb,UAAU;IACR,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,KACA,OAAO,CAAC,QAAQ,EAAE,CA+DpB,CAAC"}
|
package/dist/utils/fileSearch.js
CHANGED
|
@@ -2,6 +2,7 @@ import { spawn } from "child_process";
|
|
|
2
2
|
import { rgPath } from "./ripgrep.js";
|
|
3
3
|
import fuzzysort from "fuzzysort";
|
|
4
4
|
import { logger } from "./globalLogger.js";
|
|
5
|
+
const EXCLUDED_FILES = [".git", ".DS_Store"];
|
|
5
6
|
/**
|
|
6
7
|
* Execute ripgrep to get all file paths
|
|
7
8
|
*/
|
|
@@ -31,7 +32,12 @@ async function getAllFiles(workingDirectory) {
|
|
|
31
32
|
const files = stdout
|
|
32
33
|
.trim()
|
|
33
34
|
.split("\n")
|
|
34
|
-
.filter((f) =>
|
|
35
|
+
.filter((f) => {
|
|
36
|
+
if (f.length === 0)
|
|
37
|
+
return false;
|
|
38
|
+
const parts = f.split(/[/\\]/);
|
|
39
|
+
return !parts.some((part) => EXCLUDED_FILES.includes(part));
|
|
40
|
+
})
|
|
35
41
|
.map((f) => f.replace(/\\/g, "/")); // Normalize to forward slashes
|
|
36
42
|
resolve(files);
|
|
37
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagentParser.d.ts","sourceRoot":"","sources":["../../src/utils/subagentParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subagentParser.d.ts","sourceRoot":"","sources":["../../src/utils/subagentParser.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAwLD;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAsBlC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAGvC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, readdirSync, statSync } from "fs";
|
|
2
|
-
import { join, extname } from "path";
|
|
2
|
+
import { join, extname, basename } from "path";
|
|
3
3
|
import { logger } from "./globalLogger.js";
|
|
4
|
+
import { getBuiltinSubagentsDir } from "./configPaths.js";
|
|
4
5
|
/**
|
|
5
6
|
* Parse YAML frontmatter from markdown file content
|
|
6
7
|
*/
|
|
@@ -85,10 +86,19 @@ function parseSubagentFile(filePath, scope) {
|
|
|
85
86
|
try {
|
|
86
87
|
const content = readFileSync(filePath, "utf-8");
|
|
87
88
|
const { frontmatter, body } = parseFrontmatter(content);
|
|
89
|
+
// Use filename as default name if not specified in frontmatter
|
|
90
|
+
if (!frontmatter.name) {
|
|
91
|
+
frontmatter.name = basename(filePath, extname(filePath));
|
|
92
|
+
}
|
|
88
93
|
validateConfiguration(frontmatter, filePath);
|
|
89
94
|
if (!body.trim()) {
|
|
90
95
|
throw new Error(`Empty system prompt in ${filePath}`);
|
|
91
96
|
}
|
|
97
|
+
let priority = 1;
|
|
98
|
+
if (scope === "user")
|
|
99
|
+
priority = 2;
|
|
100
|
+
if (scope === "builtin")
|
|
101
|
+
priority = 3;
|
|
92
102
|
return {
|
|
93
103
|
name: frontmatter.name,
|
|
94
104
|
description: frontmatter.description,
|
|
@@ -97,7 +107,7 @@ function parseSubagentFile(filePath, scope) {
|
|
|
97
107
|
systemPrompt: body,
|
|
98
108
|
filePath,
|
|
99
109
|
scope,
|
|
100
|
-
priority
|
|
110
|
+
priority,
|
|
101
111
|
};
|
|
102
112
|
}
|
|
103
113
|
catch (error) {
|
|
@@ -137,9 +147,9 @@ function scanSubagentDirectory(dirPath, scope) {
|
|
|
137
147
|
export async function loadSubagentConfigurations(workdir) {
|
|
138
148
|
const projectDir = join(workdir, ".wave", "agents");
|
|
139
149
|
const userDir = join(process.env.HOME || "~", ".wave", "agents");
|
|
150
|
+
const builtinDir = getBuiltinSubagentsDir();
|
|
140
151
|
// Load configurations from all sources
|
|
141
|
-
const
|
|
142
|
-
const builtinConfigs = getBuiltinSubagents();
|
|
152
|
+
const builtinConfigs = scanSubagentDirectory(builtinDir, "builtin");
|
|
143
153
|
const projectConfigs = scanSubagentDirectory(projectDir, "project");
|
|
144
154
|
const userConfigs = scanSubagentDirectory(userDir, "user");
|
|
145
155
|
// Merge configurations, with project configs taking highest precedence
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-agent-sdk",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "SDK for building AI-powered development tools and agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"bin",
|
|
25
25
|
"vendor",
|
|
26
26
|
"scripts",
|
|
27
|
+
"builtin",
|
|
27
28
|
"README.md"
|
|
28
29
|
],
|
|
29
30
|
"dependencies": {
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"license": "MIT",
|
|
49
50
|
"scripts": {
|
|
50
51
|
"postinstall": "node scripts/postinstall.js",
|
|
51
|
-
"build": "rimraf dist && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json
|
|
52
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
52
53
|
"type-check": "tsc --noEmit --incremental",
|
|
53
54
|
"watch": "tsc -p tsconfig.build.json --watch & tsc-alias -p tsconfig.build.json --watch",
|
|
54
55
|
"test": "vitest run --reporter=dot",
|
|
@@ -692,6 +692,13 @@ export class AIManager {
|
|
|
692
692
|
stage: "running", // Keep it in running stage while updating shortResult
|
|
693
693
|
});
|
|
694
694
|
},
|
|
695
|
+
onResultUpdate: (result: string) => {
|
|
696
|
+
this.messageManager.updateToolBlock({
|
|
697
|
+
id: toolId,
|
|
698
|
+
result,
|
|
699
|
+
stage: "running", // Keep it in running stage while updating result
|
|
700
|
+
});
|
|
701
|
+
},
|
|
695
702
|
};
|
|
696
703
|
|
|
697
704
|
// Execute tool
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
replaceBashCommandsWithOutput,
|
|
17
17
|
executeBashCommands,
|
|
18
18
|
} from "../utils/markdownParser.js";
|
|
19
|
-
import { INIT_PROMPT } from "../prompts/index.js";
|
|
20
19
|
import type { SkillManager } from "./skillManager.js";
|
|
21
20
|
import type { SkillMetadata } from "../types/skills.js";
|
|
22
21
|
|
|
@@ -73,24 +72,6 @@ export class SlashCommandManager {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
private initializeBuiltinCommands(): void {
|
|
76
|
-
// Register built-in init command
|
|
77
|
-
this.registerCommand({
|
|
78
|
-
id: "init",
|
|
79
|
-
name: "init",
|
|
80
|
-
description:
|
|
81
|
-
"Initialize repository for AI agents by generating AGENTS.md",
|
|
82
|
-
handler: async () => {
|
|
83
|
-
// Add custom command message to show the command being executed
|
|
84
|
-
this.messageManager.addUserMessage({
|
|
85
|
-
content: "/init",
|
|
86
|
-
customCommandContent: INIT_PROMPT,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// Execute the AI conversation with the init prompt
|
|
90
|
-
await this.aiManager.sendAIMessage();
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
|
|
94
75
|
// Register built-in clear command
|
|
95
76
|
this.registerCommand({
|
|
96
77
|
id: "clear",
|