wave-agent-sdk 0.18.3 → 0.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/builtin/skills/settings/ENV.md +1 -1
  2. package/builtin/skills/settings/MEMORY.md +76 -0
  3. package/builtin/skills/settings/SKILL.md +4 -4
  4. package/dist/agent.d.ts.map +1 -1
  5. package/dist/agent.js +0 -2
  6. package/dist/managers/MemoryRuleManager.d.ts +9 -0
  7. package/dist/managers/MemoryRuleManager.d.ts.map +1 -1
  8. package/dist/managers/MemoryRuleManager.js +18 -0
  9. package/dist/managers/aiManager.d.ts +1 -1
  10. package/dist/managers/aiManager.d.ts.map +1 -1
  11. package/dist/managers/aiManager.js +370 -345
  12. package/dist/managers/mcpManager.d.ts.map +1 -1
  13. package/dist/managers/mcpManager.js +22 -15
  14. package/dist/managers/messageManager.d.ts +32 -13
  15. package/dist/managers/messageManager.d.ts.map +1 -1
  16. package/dist/managers/messageManager.js +82 -76
  17. package/dist/prompts/index.d.ts +10 -4
  18. package/dist/prompts/index.d.ts.map +1 -1
  19. package/dist/prompts/index.js +21 -20
  20. package/dist/services/aiService.d.ts +2 -1
  21. package/dist/services/aiService.d.ts.map +1 -1
  22. package/dist/services/aiService.js +37 -10
  23. package/dist/services/memory.d.ts +1 -0
  24. package/dist/services/memory.d.ts.map +1 -1
  25. package/dist/services/memory.js +35 -17
  26. package/dist/tools/agentTool.d.ts.map +1 -1
  27. package/dist/tools/agentTool.js +24 -2
  28. package/dist/tools/bashTool.d.ts.map +1 -1
  29. package/dist/tools/bashTool.js +17 -10
  30. package/dist/tools/editTool.d.ts.map +1 -1
  31. package/dist/tools/editTool.js +7 -6
  32. package/dist/tools/readTool.js +2 -2
  33. package/dist/tools/writeTool.js +2 -2
  34. package/dist/utils/constants.d.ts +1 -1
  35. package/dist/utils/constants.js +1 -1
  36. package/dist/utils/containerSetup.d.ts.map +1 -1
  37. package/dist/utils/containerSetup.js +1 -0
  38. package/dist/utils/gitUtils.js +6 -6
  39. package/dist/utils/openaiClient.d.ts.map +1 -1
  40. package/dist/utils/openaiClient.js +33 -32
  41. package/dist/utils/path.d.ts +7 -0
  42. package/dist/utils/path.d.ts.map +1 -1
  43. package/dist/utils/path.js +9 -0
  44. package/dist/utils/taskReminder.d.ts +2 -3
  45. package/dist/utils/taskReminder.d.ts.map +1 -1
  46. package/dist/utils/taskReminder.js +7 -18
  47. package/dist/utils/worktreeUtils.d.ts.map +1 -1
  48. package/dist/utils/worktreeUtils.js +19 -13
  49. package/package.json +1 -1
  50. package/scripts/install_ripgrep.js +21 -1
  51. package/src/agent.ts +0 -5
  52. package/src/managers/MemoryRuleManager.ts +23 -0
  53. package/src/managers/aiManager.ts +473 -434
  54. package/src/managers/mcpManager.ts +26 -15
  55. package/src/managers/messageManager.ts +99 -82
  56. package/src/prompts/index.ts +33 -24
  57. package/src/services/aiService.ts +39 -12
  58. package/src/services/memory.ts +34 -16
  59. package/src/tools/agentTool.ts +24 -2
  60. package/src/tools/bashTool.ts +18 -9
  61. package/src/tools/editTool.ts +7 -9
  62. package/src/tools/readTool.ts +2 -2
  63. package/src/tools/writeTool.ts +2 -2
  64. package/src/utils/constants.ts +1 -1
  65. package/src/utils/containerSetup.ts +1 -0
  66. package/src/utils/gitUtils.ts +6 -6
  67. package/src/utils/openaiClient.ts +40 -31
  68. package/src/utils/path.ts +10 -0
  69. package/src/utils/taskReminder.ts +7 -19
  70. package/src/utils/worktreeUtils.ts +46 -28
  71. package/builtin/skills/settings/MEMORY_RULES.md +0 -60
  72. package/vendor/ripgrep/linux-aarch64/rg +0 -0
  73. package/vendor/ripgrep/macos-aarch64/rg +0 -0
  74. package/vendor/ripgrep/macos-x86_64/rg +0 -0
  75. package/vendor/ripgrep/windows-aarch64/rg.exe +0 -0
  76. package/vendor/ripgrep/windows-x86_64/rg.exe +0 -0
@@ -3,7 +3,7 @@
3
3
  * Used by EnterWorktree and ExitWorktree tools.
4
4
  */
5
5
 
6
- import { execSync } from "node:child_process";
6
+ import { execFileSync } from "node:child_process";
7
7
  import * as path from "node:path";
8
8
  import * as fs from "node:fs";
9
9
  import { getGitMainRepoRoot, getDefaultRemoteBranch } from "./gitUtils.js";
@@ -81,7 +81,7 @@ export function generateWorktreeName(): string {
81
81
  * Get the current HEAD commit SHA.
82
82
  */
83
83
  export function getHeadCommit(cwd: string): string {
84
- return execSync(`git -C "${cwd}" rev-parse HEAD`, {
84
+ return execFileSync("git", ["-C", cwd, "rev-parse", "HEAD"], {
85
85
  encoding: "utf8",
86
86
  stdio: ["ignore", "pipe", "ignore"],
87
87
  }).trim();
@@ -125,8 +125,9 @@ export function createWorktree(name: string, cwd: string): WorktreeInfo {
125
125
 
126
126
  try {
127
127
  // Create worktree and branch
128
- execSync(
129
- `git worktree add -b ${branchName} "${worktreePath}" ${baseBranch}`,
128
+ execFileSync(
129
+ "git",
130
+ ["worktree", "add", "-b", branchName, worktreePath, baseBranch],
130
131
  {
131
132
  cwd: repoRoot,
132
133
  stdio: ["ignore", "pipe", "pipe"],
@@ -151,7 +152,7 @@ export function createWorktree(name: string, cwd: string): WorktreeInfo {
151
152
  if (stderr.includes("already exists")) {
152
153
  // Branch exists but worktree doesn't — attach to existing branch
153
154
  try {
154
- execSync(`git worktree add "${worktreePath}" ${branchName}`, {
155
+ execFileSync("git", ["worktree", "add", worktreePath, branchName], {
155
156
  cwd: repoRoot,
156
157
  stdio: ["ignore", "pipe", "pipe"],
157
158
  env: {
@@ -181,7 +182,7 @@ export function createWorktree(name: string, cwd: string): WorktreeInfo {
181
182
  // Base branch not fetched yet — try fetching then retrying
182
183
  const branchNameOnly = baseBranch.split("/").pop()!;
183
184
  try {
184
- execSync(`git fetch origin ${branchNameOnly}`, {
185
+ execFileSync("git", ["fetch", "origin", branchNameOnly], {
185
186
  cwd: repoRoot,
186
187
  stdio: ["ignore", "pipe", "pipe"],
187
188
  env: {
@@ -190,8 +191,9 @@ export function createWorktree(name: string, cwd: string): WorktreeInfo {
190
191
  GIT_ASKPASS: "",
191
192
  },
192
193
  });
193
- execSync(
194
- `git worktree add -b ${branchName} "${worktreePath}" ${baseBranch}`,
194
+ execFileSync(
195
+ "git",
196
+ ["worktree", "add", "-b", branchName, worktreePath, baseBranch],
195
197
  {
196
198
  cwd: repoRoot,
197
199
  stdio: ["ignore", "pipe", "pipe"],
@@ -213,15 +215,19 @@ export function createWorktree(name: string, cwd: string): WorktreeInfo {
213
215
  } catch {
214
216
  // Fetch or retry failed — fall back to HEAD
215
217
  try {
216
- execSync(`git worktree add -b ${branchName} "${worktreePath}" HEAD`, {
217
- cwd: repoRoot,
218
- stdio: ["ignore", "pipe", "pipe"],
219
- env: {
220
- ...process.env,
221
- GIT_TERMINAL_PROMPT: "0",
222
- GIT_ASKPASS: "",
218
+ execFileSync(
219
+ "git",
220
+ ["worktree", "add", "-b", branchName, worktreePath, "HEAD"],
221
+ {
222
+ cwd: repoRoot,
223
+ stdio: ["ignore", "pipe", "pipe"],
224
+ env: {
225
+ ...process.env,
226
+ GIT_TERMINAL_PROMPT: "0",
227
+ GIT_ASKPASS: "",
228
+ },
223
229
  },
224
- });
230
+ );
225
231
  return {
226
232
  name,
227
233
  path: worktreePath,
@@ -253,24 +259,28 @@ export function removeWorktree(info: WorktreeInfo): void {
253
259
  // Get current branch in worktree before removing
254
260
  let currentBranch: string | undefined;
255
261
  try {
256
- currentBranch = execSync(`git rev-parse --abbrev-ref HEAD`, {
257
- cwd: info.path,
258
- encoding: "utf8",
259
- stdio: ["ignore", "pipe", "ignore"],
260
- }).trim();
262
+ currentBranch = execFileSync(
263
+ "git",
264
+ ["rev-parse", "--abbrev-ref", "HEAD"],
265
+ {
266
+ cwd: info.path,
267
+ encoding: "utf8",
268
+ stdio: ["ignore", "pipe", "ignore"],
269
+ },
270
+ ).trim();
261
271
  } catch {
262
272
  // Ignore errors
263
273
  }
264
274
 
265
275
  // Remove worktree
266
- execSync(`git worktree remove --force "${info.path}"`, {
276
+ execFileSync("git", ["worktree", "remove", "--force", info.path], {
267
277
  cwd: repoRoot,
268
278
  stdio: ["ignore", "pipe", "pipe"],
269
279
  });
270
280
 
271
281
  // Delete worktree branch
272
282
  try {
273
- execSync(`git branch -D ${info.branch}`, {
283
+ execFileSync("git", ["branch", "-D", info.branch], {
274
284
  cwd: repoRoot,
275
285
  stdio: ["ignore", "pipe", "pipe"],
276
286
  });
@@ -293,7 +303,7 @@ export function removeWorktree(info: WorktreeInfo): void {
293
303
  currentBranch !== "master"
294
304
  ) {
295
305
  try {
296
- execSync(`git branch -D ${currentBranch}`, {
306
+ execFileSync("git", ["branch", "-D", currentBranch], {
297
307
  cwd: repoRoot,
298
308
  stdio: ["ignore", "pipe", "pipe"],
299
309
  });
@@ -320,8 +330,9 @@ export function countWorktreeChanges(
320
330
  originalHeadCommit: string | undefined,
321
331
  ): { changedFiles: number; commits: number } | null {
322
332
  try {
323
- const statusOutput = execSync(
324
- `git -C "${worktreePath}" status --porcelain`,
333
+ const statusOutput = execFileSync(
334
+ "git",
335
+ ["-C", worktreePath, "status", "--porcelain"],
325
336
  {
326
337
  encoding: "utf8",
327
338
  stdio: ["ignore", "pipe", "ignore"],
@@ -335,8 +346,15 @@ export function countWorktreeChanges(
335
346
  return null;
336
347
  }
337
348
 
338
- const revListOutput = execSync(
339
- `git -C "${worktreePath}" rev-list --count ${originalHeadCommit}..HEAD`,
349
+ const revListOutput = execFileSync(
350
+ "git",
351
+ [
352
+ "-C",
353
+ worktreePath,
354
+ "rev-list",
355
+ "--count",
356
+ `${originalHeadCommit}..HEAD`,
357
+ ],
340
358
  {
341
359
  encoding: "utf8",
342
360
  stdio: ["ignore", "pipe", "ignore"],
@@ -1,60 +0,0 @@
1
- # Wave Memory Rules Configuration
2
-
3
- Memory rules allow you to provide context-specific instructions and guidelines to the agent. This document explains how to create and manage memory rules in Wave.
4
-
5
- ## What are Memory Rules?
6
-
7
- Memory rules are Markdown files that contain instructions for the agent. They are used to:
8
- - Enforce coding styles and conventions.
9
- - Provide project-specific context (e.g., "always use pnpm").
10
- - Define architectural patterns and best practices.
11
- - Share common knowledge across the team.
12
-
13
- ## Creating Memory Rules
14
-
15
- Wave looks for memory rules in the following locations:
16
-
17
- 1. **User Scope**: `~/.wave/rules/*.md` (Global memory rules)
18
- 2. **Project Scope**: `.wave/rules/*.md` (Project-specific memory rules)
19
- 3. **Project Root**: `AGENTS.md` (Legacy project-level memory rules)
20
-
21
- ### File Structure
22
-
23
- A memory rule file is a standard Markdown file. It can optionally include YAML frontmatter to scope the rules to specific file paths.
24
-
25
- ```markdown
26
- ---
27
- paths:
28
- - "src/api/**/*.ts"
29
- - "src/services/**/*.ts"
30
- ---
31
-
32
- # API and Service Guidelines
33
-
34
- - Always use `async/await` for asynchronous operations.
35
- - Use `Zod` for input validation.
36
- - Follow the repository pattern for data access.
37
- ```
38
-
39
- ### YAML Frontmatter Fields
40
-
41
- - `paths`: (Optional) A list of glob patterns. The rules in this file will only be active when the agent is working with files that match these patterns. If omitted, the rules are always active.
42
-
43
- ## How Memory Rules are Loaded
44
-
45
- Wave automatically discovers and loads all `.md` files in the `.wave/rules/` directory and its immediate subdirectories.
46
-
47
- - **Path-Specific Activation**: If a memory rule has a `paths` field, it is only included in the agent's context if *any* file currently being read or modified matches the glob patterns.
48
- - **Union of Rules**: If multiple files are in context, Wave activates the union of all matching memory rules.
49
- - **Priority**: Project-level memory rules take priority over user-level memory rules if there is a conflict.
50
-
51
- ## Best Practices
52
-
53
- - **Keep rules focused**: Create separate files for different topics (e.g., `testing.md`, `ui-components.md`).
54
- - **Use clear instructions**: Write rules in a way that is easy for the agent to understand and follow.
55
- - **Leverage path scoping**: Use the `paths` field to keep the agent's context window clean and relevant.
56
- - **Share rules with your team**: Commit `.wave/rules/` to your git repository to ensure everyone on the team has the same context.
57
-
58
- ## Auto-Memory
59
-
60
- In addition to manual memory rules, Wave also has an **auto-memory** feature that automatically remembers important information across sessions. This is stored in `~/.wave/projects/<project-id>/memory/MEMORY.md`. You can disable this feature in `settings.json` by setting `"autoMemoryEnabled": false`.
Binary file
Binary file
Binary file