wave-agent-sdk 0.10.4 → 0.11.1
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/loop/SKILL.md +53 -0
- package/builtin/skills/settings/ENV.md +64 -0
- package/builtin/skills/settings/HOOKS.md +94 -0
- package/builtin/skills/settings/MCP.md +55 -0
- package/builtin/skills/settings/MEMORY_RULES.md +60 -0
- package/{dist/builtin-skills → builtin/skills}/settings/SKILL.md +23 -16
- 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/agent.d.ts +8 -6
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +12 -9
- package/dist/constants/tools.d.ts +3 -0
- package/dist/constants/tools.d.ts.map +1 -1
- package/dist/constants/tools.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/managers/aiManager.d.ts +0 -2
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +53 -14
- package/dist/managers/cronManager.d.ts +19 -0
- package/dist/managers/cronManager.d.ts.map +1 -0
- package/dist/managers/cronManager.js +124 -0
- package/dist/managers/hookManager.d.ts.map +1 -1
- package/dist/managers/hookManager.js +21 -13
- package/dist/managers/liveConfigManager.js +1 -1
- package/dist/managers/mcpManager.d.ts +1 -1
- package/dist/managers/mcpManager.d.ts.map +1 -1
- package/dist/managers/mcpManager.js +10 -2
- package/dist/managers/messageManager.d.ts +0 -1
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/permissionManager.d.ts +27 -7
- package/dist/managers/permissionManager.d.ts.map +1 -1
- package/dist/managers/permissionManager.js +119 -14
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +7 -12
- package/dist/managers/subagentManager.d.ts +3 -0
- package/dist/managers/subagentManager.d.ts.map +1 -1
- package/dist/managers/subagentManager.js +10 -17
- package/dist/managers/toolManager.d.ts +1 -1
- package/dist/managers/toolManager.d.ts.map +1 -1
- package/dist/managers/toolManager.js +28 -4
- package/dist/prompts/index.d.ts +0 -5
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +1 -136
- package/dist/services/configurationService.d.ts.map +1 -1
- package/dist/services/configurationService.js +8 -7
- package/dist/services/hook.d.ts.map +1 -1
- package/dist/services/hook.js +3 -10
- package/dist/services/initializationService.js +2 -2
- package/dist/services/jsonlHandler.d.ts.map +1 -1
- package/dist/services/jsonlHandler.js +3 -0
- package/dist/services/reversionService.d.ts +2 -2
- package/dist/services/reversionService.d.ts.map +1 -1
- package/dist/services/reversionService.js +3 -3
- package/dist/services/session.d.ts.map +1 -1
- package/dist/services/session.js +18 -11
- package/dist/tools/agentTool.js +1 -1
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +5 -5
- package/dist/tools/cronCreateTool.d.ts +3 -0
- package/dist/tools/cronCreateTool.d.ts.map +1 -0
- package/dist/tools/cronCreateTool.js +59 -0
- package/dist/tools/cronDeleteTool.d.ts +3 -0
- package/dist/tools/cronDeleteTool.d.ts.map +1 -0
- package/dist/tools/cronDeleteTool.js +38 -0
- package/dist/tools/cronListTool.d.ts +3 -0
- package/dist/tools/cronListTool.d.ts.map +1 -0
- package/dist/tools/cronListTool.js +30 -0
- package/dist/tools/skillTool.d.ts +0 -3
- package/dist/tools/skillTool.d.ts.map +1 -1
- package/dist/tools/skillTool.js +4 -3
- package/dist/tools/taskOutputTool.d.ts.map +1 -1
- package/dist/tools/taskOutputTool.js +15 -8
- package/dist/tools/types.d.ts +2 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/types/agent.d.ts +10 -0
- package/dist/types/agent.d.ts.map +1 -1
- package/dist/types/configuration.d.ts +1 -1
- package/dist/types/configuration.d.ts.map +1 -1
- package/dist/types/cron.d.ts +10 -0
- package/dist/types/cron.d.ts.map +1 -0
- package/dist/types/cron.js +1 -0
- package/dist/types/hooks.d.ts +1 -5
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/hooks.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/messaging.d.ts +1 -1
- package/dist/types/messaging.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/containerSetup.d.ts.map +1 -1
- package/dist/utils/containerSetup.js +40 -13
- package/dist/utils/fileSearch.d.ts.map +1 -1
- package/dist/utils/fileSearch.js +7 -1
- package/dist/utils/mcpUtils.d.ts +2 -2
- package/dist/utils/mcpUtils.d.ts.map +1 -1
- package/dist/utils/mcpUtils.js +1 -5
- package/dist/utils/subagentParser.d.ts.map +1 -1
- package/dist/utils/subagentParser.js +14 -4
- package/package.json +4 -2
- package/src/agent.ts +17 -12
- package/src/constants/tools.ts +3 -0
- package/src/index.ts +1 -0
- package/src/managers/aiManager.ts +72 -24
- package/src/managers/cronManager.ts +167 -0
- package/src/managers/hookManager.ts +27 -13
- package/src/managers/liveConfigManager.ts +2 -2
- package/src/managers/mcpManager.ts +23 -2
- package/src/managers/messageManager.ts +0 -6
- package/src/managers/permissionManager.ts +154 -18
- package/src/managers/slashCommandManager.ts +7 -14
- package/src/managers/subagentManager.ts +15 -19
- package/src/managers/toolManager.ts +37 -4
- package/src/prompts/index.ts +0 -144
- package/src/services/configurationService.ts +8 -7
- package/src/services/hook.ts +5 -11
- package/src/services/initializationService.ts +3 -3
- package/src/services/jsonlHandler.ts +4 -0
- package/src/services/reversionService.ts +9 -4
- package/src/services/session.ts +19 -12
- package/src/tools/agentTool.ts +1 -1
- package/src/tools/bashTool.ts +6 -5
- package/src/tools/cronCreateTool.ts +73 -0
- package/src/tools/cronDeleteTool.ts +47 -0
- package/src/tools/cronListTool.ts +38 -0
- package/src/tools/skillTool.ts +6 -4
- package/src/tools/taskOutputTool.ts +14 -8
- package/src/tools/types.ts +2 -0
- package/src/types/agent.ts +10 -0
- package/src/types/configuration.ts +1 -1
- package/src/types/cron.ts +9 -0
- package/src/types/hooks.ts +5 -9
- package/src/types/index.ts +1 -0
- package/src/types/messaging.ts +1 -1
- package/src/utils/configPaths.ts +12 -10
- package/src/utils/containerSetup.ts +50 -16
- package/src/utils/fileSearch.ts +7 -1
- package/src/utils/mcpUtils.ts +2 -5
- package/src/utils/subagentParser.ts +16 -6
- package/dist/builtin-skills/settings/HOOKS.md +0 -95
- 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/settings/HOOKS.md +0 -95
- package/src/builtin-skills/settings/SKILL.md +0 -86
- package/src/utils/builtinSubagents.ts +0 -122
|
@@ -5,6 +5,9 @@ import { editTool } from "../tools/editTool.js";
|
|
|
5
5
|
import { writeTool } from "../tools/writeTool.js";
|
|
6
6
|
import { exitPlanModeTool } from "../tools/exitPlanMode.js";
|
|
7
7
|
import { askUserQuestionTool } from "../tools/askUserQuestion.js";
|
|
8
|
+
import { cronCreateTool } from "../tools/cronCreateTool.js";
|
|
9
|
+
import { cronDeleteTool } from "../tools/cronDeleteTool.js";
|
|
10
|
+
import { cronListTool } from "../tools/cronListTool.js";
|
|
8
11
|
// New tools
|
|
9
12
|
import { globTool } from "../tools/globTool.js";
|
|
10
13
|
import { grepTool } from "../tools/grepTool.js";
|
|
@@ -77,6 +80,9 @@ class ToolManager {
|
|
|
77
80
|
taskGetTool,
|
|
78
81
|
taskUpdateTool,
|
|
79
82
|
taskListTool,
|
|
83
|
+
cronCreateTool,
|
|
84
|
+
cronDeleteTool,
|
|
85
|
+
cronListTool,
|
|
80
86
|
];
|
|
81
87
|
for (const tool of builtInTools) {
|
|
82
88
|
if (this.shouldEnableTool(tool.name)) {
|
|
@@ -85,9 +91,14 @@ class ToolManager {
|
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
/**
|
|
88
|
-
* Check if a tool should be enabled based on tools configuration
|
|
94
|
+
* Check if a tool should be enabled based on tools configuration and permission rules
|
|
89
95
|
*/
|
|
90
96
|
shouldEnableTool(name) {
|
|
97
|
+
const permissionManager = this.container.get("PermissionManager");
|
|
98
|
+
// If tool is explicitly denied by name in permission rules, filter it out
|
|
99
|
+
if (permissionManager?.isToolDenied(name)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
91
102
|
if (!this.tools) {
|
|
92
103
|
return true;
|
|
93
104
|
}
|
|
@@ -136,6 +147,9 @@ class ToolManager {
|
|
|
136
147
|
skillManager: this.container.has("SkillManager")
|
|
137
148
|
? this.container.get("SkillManager")
|
|
138
149
|
: undefined,
|
|
150
|
+
cronManager: this.container.has("CronManager")
|
|
151
|
+
? this.container.get("CronManager")
|
|
152
|
+
: undefined,
|
|
139
153
|
sessionId: context.sessionId,
|
|
140
154
|
toolCallId: context.toolCallId,
|
|
141
155
|
};
|
|
@@ -175,14 +189,22 @@ class ToolManager {
|
|
|
175
189
|
};
|
|
176
190
|
}
|
|
177
191
|
list() {
|
|
178
|
-
const
|
|
179
|
-
const
|
|
192
|
+
const permissionManager = this.container.get("PermissionManager");
|
|
193
|
+
const builtInTools = Array.from(this.toolsRegistry.values()).filter((tool) => !permissionManager?.isToolDenied(tool.name));
|
|
194
|
+
const mcpTools = this.mcpManager
|
|
195
|
+
.getMcpToolPlugins()
|
|
196
|
+
.filter((tool) => !permissionManager?.isToolDenied(tool.name));
|
|
180
197
|
return [...builtInTools, ...mcpTools];
|
|
181
198
|
}
|
|
182
199
|
getToolsConfig(options) {
|
|
200
|
+
const permissionManager = this.container.get("PermissionManager");
|
|
183
201
|
const effectivePermissionMode = this.getPermissionMode();
|
|
184
202
|
const builtInToolsConfig = Array.from(this.toolsRegistry.values())
|
|
185
203
|
.filter((tool) => {
|
|
204
|
+
// If tool is explicitly denied by name in permission rules, filter it out
|
|
205
|
+
if (permissionManager?.isToolDenied(tool.name)) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
186
208
|
if (effectivePermissionMode === "bypassPermissions") {
|
|
187
209
|
if (tool.name === "ExitPlanMode" || tool.name === "AskUserQuestion") {
|
|
188
210
|
return false;
|
|
@@ -207,7 +229,9 @@ class ToolManager {
|
|
|
207
229
|
}
|
|
208
230
|
return config;
|
|
209
231
|
});
|
|
210
|
-
const mcpToolsConfig = this.mcpManager
|
|
232
|
+
const mcpToolsConfig = this.mcpManager
|
|
233
|
+
.getMcpToolsConfig()
|
|
234
|
+
.filter((tool) => !permissionManager?.isToolDenied(tool.function.name));
|
|
211
235
|
return [...builtInToolsConfig, ...mcpToolsConfig];
|
|
212
236
|
}
|
|
213
237
|
/**
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -4,11 +4,6 @@ export declare const BASE_SYSTEM_PROMPT = "You are an interactive CLI tool that
|
|
|
4
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
5
|
export declare function buildPlanModePrompt(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
|
|
6
6
|
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
7
|
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
8
|
export declare function buildSystemPrompt(basePrompt: string | undefined, tools: ToolPlugin[], options?: {
|
|
14
9
|
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,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,+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,7 @@ 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
6
|
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
7
|
|
|
8
8
|
# Doing tasks
|
|
@@ -102,141 +102,6 @@ This is critical - your turn should only end with either using the ${ASK_USER_QU
|
|
|
102
102
|
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
103
|
}
|
|
104
104
|
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
105
|
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
106
|
1. Task Overview
|
|
242
107
|
The user's core request and success criteria
|
|
@@ -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,CAAkC;IAC9D,OAAO,CAAC,GAAG,CAA8B;IACzC,OAAO,CAAC,OAAO,CAAoB;IAEnC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAMvC;;OAEG;IACG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC;IA4DnC;;OAEG;IACH,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,gBAAgB;IAoJlE;;OAEG;IACH,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB;IAwC7D;;;OAGG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAIrD;;OAEG;IACH,kBAAkB,IAAI,MAAM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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,
|
|
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,CAAkC;IAC9D,OAAO,CAAC,GAAG,CAA8B;IACzC,OAAO,CAA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,MAAM,GAAG,kBAAkB;IAa1D;;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,CAqI1B"}
|
|
@@ -187,17 +187,17 @@ export class ConfigurationService {
|
|
|
187
187
|
result.errors.push("All permission deny rules must be strings");
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
// Validate
|
|
191
|
-
if (config.permissions.
|
|
190
|
+
// Validate permissionMode if present
|
|
191
|
+
if (config.permissions.permissionMode !== undefined) {
|
|
192
192
|
const validModes = [
|
|
193
193
|
"default",
|
|
194
194
|
"bypassPermissions",
|
|
195
195
|
"acceptEdits",
|
|
196
196
|
"plan",
|
|
197
197
|
];
|
|
198
|
-
if (!validModes.includes(config.permissions.
|
|
198
|
+
if (!validModes.includes(config.permissions.permissionMode)) {
|
|
199
199
|
result.isValid = false;
|
|
200
|
-
result.errors.push(`Invalid
|
|
200
|
+
result.errors.push(`Invalid permissionMode: "${config.permissions.permissionMode}". Must be one of: ${validModes.join(", ")}`);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -765,9 +765,10 @@ export function loadMergedWaveConfig(workdir) {
|
|
|
765
765
|
]),
|
|
766
766
|
];
|
|
767
767
|
}
|
|
768
|
-
// Merge
|
|
769
|
-
if (config.permissions.
|
|
770
|
-
mergedConfig.permissions.
|
|
768
|
+
// Merge permissionMode (last one wins)
|
|
769
|
+
if (config.permissions.permissionMode !== undefined) {
|
|
770
|
+
mergedConfig.permissions.permissionMode =
|
|
771
|
+
config.permissions.permissionMode;
|
|
771
772
|
}
|
|
772
773
|
// Merge additionalDirectories
|
|
773
774
|
if (config.permissions.additionalDirectories) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;AA0E3B;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CA0I9B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAchC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsBtD"}
|
package/dist/services/hook.js
CHANGED
|
@@ -31,7 +31,9 @@ async function buildHookJsonInput(context) {
|
|
|
31
31
|
hook_event_name: context.event,
|
|
32
32
|
};
|
|
33
33
|
// Add optional fields based on event type
|
|
34
|
-
if (context.event === "PreToolUse" ||
|
|
34
|
+
if (context.event === "PreToolUse" ||
|
|
35
|
+
context.event === "PostToolUse" ||
|
|
36
|
+
context.event === "PermissionRequest") {
|
|
35
37
|
if (context.toolName) {
|
|
36
38
|
jsonInput.tool_name = context.toolName;
|
|
37
39
|
}
|
|
@@ -50,15 +52,6 @@ async function buildHookJsonInput(context) {
|
|
|
50
52
|
if (context.subagentType !== undefined) {
|
|
51
53
|
jsonInput.subagent_type = context.subagentType;
|
|
52
54
|
}
|
|
53
|
-
// Add notification fields for Notification events
|
|
54
|
-
if (context.event === "Notification") {
|
|
55
|
-
if (context.message !== undefined) {
|
|
56
|
-
jsonInput.message = context.message;
|
|
57
|
-
}
|
|
58
|
-
if (context.notificationType !== undefined) {
|
|
59
|
-
jsonInput.notification_type = context.notificationType;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
55
|
// Add name field for WorktreeCreate events
|
|
63
56
|
if (context.event === "WorktreeCreate") {
|
|
64
57
|
if (context.worktreeName !== undefined) {
|
|
@@ -54,8 +54,8 @@ export class InitializationService {
|
|
|
54
54
|
if (configResult.configuration.permissions.deny) {
|
|
55
55
|
permissionManager.updateDeniedRules(configResult.configuration.permissions.deny);
|
|
56
56
|
}
|
|
57
|
-
if (configResult.configuration.permissions.
|
|
58
|
-
permissionManager.
|
|
57
|
+
if (configResult.configuration.permissions.permissionMode) {
|
|
58
|
+
permissionManager.updateConfiguredPermissionMode(configResult.configuration.permissions.permissionMode);
|
|
59
59
|
}
|
|
60
60
|
if (configResult.configuration.permissions.additionalDirectories) {
|
|
61
61
|
permissionManager.updateAdditionalDirectories(configResult.configuration.permissions.additionalDirectories);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonlHandler.d.ts","sourceRoot":"","sources":["../../src/services/jsonlHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAEhC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA8B;;IAQlE;;OAEG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpD;;OAEG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAItE;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAc1E;;OAEG;IACG,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,cAAc,EAAE,EAC1B,OAAO,CAAC,EAAE,iB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AAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAgCtE;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA4BxB;;OAEG;YACW,eAAe;IAW7B;;;;OAIG;IACH,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe;IA6BvD;;;;OAIG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAUjD;;;;;OAKG;IACH,uBAAuB,CACrB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,UAAU,GAC/B,MAAM;CAcV"}
|
|
@@ -152,6 +152,9 @@ export class JsonlHandler {
|
|
|
152
152
|
validateMessages(messages) {
|
|
153
153
|
for (let i = 0; i < messages.length; i++) {
|
|
154
154
|
const message = messages[i];
|
|
155
|
+
if (!message.id) {
|
|
156
|
+
throw new Error(`Message at index ${i} is missing required field: id`);
|
|
157
|
+
}
|
|
155
158
|
if (!message.role) {
|
|
156
159
|
throw new Error(`Message at index ${i} is missing required field: role`);
|
|
157
160
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FileSnapshot } from "../types/reversion.js";
|
|
2
2
|
export declare class ReversionService {
|
|
3
3
|
private historyBaseDir;
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
4
|
+
private rootSessionId;
|
|
5
|
+
constructor(rootSessionId: string);
|
|
6
6
|
private getFilePathHash;
|
|
7
7
|
private getNextVersion;
|
|
8
8
|
private updateVersionsFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reversionService.d.ts","sourceRoot":"","sources":["../../src/services/reversionService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"reversionService.d.ts","sourceRoot":"","sources":["../../src/services/reversionService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,aAAa,CAAS;gBAElB,aAAa,EAAE,MAAM;IAUjC,OAAO,CAAC,eAAe;YAIT,cAAc;YAad,kBAAkB;IAOhC;;;OAGG;IACG,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB3D;;OAEG;IACG,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAWvE;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;YAI7B,eAAe;CAG9B"}
|
|
@@ -3,9 +3,9 @@ import { join } from "path";
|
|
|
3
3
|
import { homedir } from "os";
|
|
4
4
|
import { createHash } from "crypto";
|
|
5
5
|
export class ReversionService {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
8
|
-
this.historyBaseDir = join(homedir(), ".wave", "file-history",
|
|
6
|
+
constructor(rootSessionId) {
|
|
7
|
+
this.rootSessionId = rootSessionId;
|
|
8
|
+
this.historyBaseDir = join(homedir(), ".wave", "file-history", rootSessionId || "default");
|
|
9
9
|
}
|
|
10
10
|
getFilePathHash(filePath) {
|
|
11
11
|
return createHash("md5").update(filePath).digest("hex");
|
|
@@ -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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AI,CAAC,CA6Bf;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAY,GACtB,MAAM,CAQR;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,gBAAgB,CAAC,EAAE,MAAM,EACzB,mBAAmB,CAAC,EAAE,OAAO,EAC7B,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA0ClC;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiCxD"}
|
package/dist/services/session.js
CHANGED
|
@@ -199,12 +199,19 @@ export async function loadSessionFromJsonl(sessionId, workdir, sessionType = "ma
|
|
|
199
199
|
const jsonlHandler = new JsonlHandler();
|
|
200
200
|
// Generate the session file path directly using known session type
|
|
201
201
|
const filePath = await generateSessionFilePath(sessionId, workdir, sessionType);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
// Check if file exists
|
|
203
|
+
try {
|
|
204
|
+
await fs.access(filePath);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
if (error.code === "ENOENT") {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
throw error;
|
|
205
211
|
}
|
|
212
|
+
const messages = await jsonlHandler.read(filePath);
|
|
206
213
|
// Extract metadata from messages
|
|
207
|
-
const lastMessage = messages[messages.length - 1];
|
|
214
|
+
const lastMessage = messages.length > 0 ? messages[messages.length - 1] : null;
|
|
208
215
|
// Try to get rootSessionId and parentSessionId from index
|
|
209
216
|
let rootSessionId;
|
|
210
217
|
let parentSessionId;
|
|
@@ -232,8 +239,10 @@ export async function loadSessionFromJsonl(sessionId, workdir, sessionType = "ma
|
|
|
232
239
|
}),
|
|
233
240
|
metadata: {
|
|
234
241
|
workdir,
|
|
235
|
-
lastActiveAt: lastMessage
|
|
236
|
-
|
|
242
|
+
lastActiveAt: lastMessage
|
|
243
|
+
? lastMessage.timestamp
|
|
244
|
+
: new Date().toISOString(),
|
|
245
|
+
latestTotalTokens: lastMessage?.usage
|
|
237
246
|
? extractLatestTotalTokens([lastMessage])
|
|
238
247
|
: 0,
|
|
239
248
|
},
|
|
@@ -743,16 +752,14 @@ export async function handleSessionRestoration(restoreSessionId, continueLastSes
|
|
|
743
752
|
// Use only JSONL format - no legacy support
|
|
744
753
|
sessionToRestore = await loadSessionFromJsonl(restoreSessionId, workdir);
|
|
745
754
|
if (!sessionToRestore) {
|
|
746
|
-
|
|
747
|
-
process.exit(1);
|
|
755
|
+
throw new Error(`Session not found: ${restoreSessionId}`);
|
|
748
756
|
}
|
|
749
757
|
}
|
|
750
758
|
else if (continueLastSession) {
|
|
751
759
|
// Use only JSONL format - no legacy support
|
|
752
760
|
sessionToRestore = await getLatestSessionFromJsonl(workdir);
|
|
753
761
|
if (!sessionToRestore) {
|
|
754
|
-
|
|
755
|
-
process.exit(1);
|
|
762
|
+
throw new Error(`No previous session found for workdir: ${workdir}`);
|
|
756
763
|
}
|
|
757
764
|
}
|
|
758
765
|
if (sessionToRestore) {
|
|
@@ -764,7 +771,7 @@ export async function handleSessionRestoration(restoreSessionId, continueLastSes
|
|
|
764
771
|
}
|
|
765
772
|
catch (error) {
|
|
766
773
|
console.error("Failed to restore session:", error);
|
|
767
|
-
|
|
774
|
+
throw error;
|
|
768
775
|
}
|
|
769
776
|
}
|
|
770
777
|
/**
|
package/dist/tools/agentTool.js
CHANGED
|
@@ -57,7 +57,7 @@ The Agent tool launches specialized agents (subprocesses) that autonomously hand
|
|
|
57
57
|
Available agent types and the tools they have access to:
|
|
58
58
|
${subagentList || "No agents configured"}
|
|
59
59
|
|
|
60
|
-
When using the Agent tool, you must specify a subagent_type parameter to select which agent type to use.
|
|
60
|
+
When using the Agent tool, you must specify a subagent_type parameter to select which agent type to use from the list above. Choose the agent whose description best matches the task you want to delegate.
|
|
61
61
|
|
|
62
62
|
- When doing file search, prefer to use the ${AGENT_TOOL_NAME} tool in order to reduce context usage.
|
|
63
63
|
- You should proactively use the ${AGENT_TOOL_NAME} tool with specialized agents when the task at hand matches the agent's description.
|
|
@@ -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;AAyCtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAyCtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UA2XtB,CAAC"}
|
package/dist/tools/bashTool.js
CHANGED
|
@@ -313,11 +313,11 @@ Usage notes:
|
|
|
313
313
|
// Handle large output by truncation and persistence if needed
|
|
314
314
|
const finalOutput = combinedOutput || `Command executed with exit code: ${exitCode}`;
|
|
315
315
|
const content = processOutput(finalOutput);
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
.
|
|
319
|
-
.slice(
|
|
320
|
-
|
|
316
|
+
const lines = combinedOutput.trim().split("\n");
|
|
317
|
+
const shortResult = lines.length <= 3
|
|
318
|
+
? lines.join("\n")
|
|
319
|
+
: lines.slice(0, 3).join("\n") +
|
|
320
|
+
`\n... +${lines.length - 3} lines`;
|
|
321
321
|
resolve({
|
|
322
322
|
success: exitCode === 0,
|
|
323
323
|
content,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cronCreateTool.d.ts","sourceRoot":"","sources":["../../src/tools/cronCreateTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAGjE,eAAO,MAAM,cAAc,EAAE,UAqE5B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CRON_CREATE_TOOL_NAME } from "../constants/tools.js";
|
|
2
|
+
export const cronCreateTool = {
|
|
3
|
+
name: CRON_CREATE_TOOL_NAME,
|
|
4
|
+
config: {
|
|
5
|
+
type: "function",
|
|
6
|
+
function: {
|
|
7
|
+
name: CRON_CREATE_TOOL_NAME,
|
|
8
|
+
description: "Schedule a prompt to be enqueued at a future time. Use for both recurring schedules and one-shot reminders.",
|
|
9
|
+
parameters: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
cron: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: 'Standard 5-field cron expression in local time: "M H DoM Mon DoW"',
|
|
15
|
+
},
|
|
16
|
+
prompt: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "The prompt to enqueue at each fire time",
|
|
19
|
+
},
|
|
20
|
+
recurring: {
|
|
21
|
+
type: "boolean",
|
|
22
|
+
description: "Default: true. true = fire on every cron match until deleted or auto-expired after 7 days. false = fire once at the next match, then auto-delete",
|
|
23
|
+
default: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: ["cron", "prompt"],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
execute: async (args, context) => {
|
|
31
|
+
const { cron, prompt, recurring = true, } = args;
|
|
32
|
+
if (!context.cronManager) {
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
content: "",
|
|
36
|
+
error: "CronManager not available",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const job = context.cronManager.createJob({
|
|
41
|
+
cron,
|
|
42
|
+
prompt,
|
|
43
|
+
recurring,
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
success: true,
|
|
47
|
+
content: JSON.stringify({ id: job.id }, null, 2),
|
|
48
|
+
shortResult: `Scheduled job ${job.id}`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return {
|
|
53
|
+
success: false,
|
|
54
|
+
content: "",
|
|
55
|
+
error: error instanceof Error ? error.message : String(error),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cronDeleteTool.d.ts","sourceRoot":"","sources":["../../src/tools/cronDeleteTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAGjE,eAAO,MAAM,cAAc,EAAE,UA2C5B,CAAC"}
|