wave-agent-sdk 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/agent.d.ts +6 -0
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +2 -0
  4. package/dist/core/session.d.ts +1 -1
  5. package/dist/core/session.d.ts.map +1 -1
  6. package/dist/core/session.js +1 -1
  7. package/dist/managers/aiManager.d.ts.map +1 -1
  8. package/dist/managers/aiManager.js +1 -0
  9. package/dist/managers/backgroundTaskManager.d.ts +3 -0
  10. package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
  11. package/dist/managers/backgroundTaskManager.js +3 -0
  12. package/dist/managers/messageManager.d.ts +1 -6
  13. package/dist/managers/messageManager.d.ts.map +1 -1
  14. package/dist/managers/messageManager.js +0 -6
  15. package/dist/managers/permissionManager.d.ts +1 -1
  16. package/dist/managers/permissionManager.d.ts.map +1 -1
  17. package/dist/managers/permissionManager.js +47 -10
  18. package/dist/managers/skillManager.d.ts +17 -2
  19. package/dist/managers/skillManager.d.ts.map +1 -1
  20. package/dist/managers/skillManager.js +93 -21
  21. package/dist/managers/slashCommandManager.d.ts.map +1 -1
  22. package/dist/managers/slashCommandManager.js +7 -1
  23. package/dist/managers/toolManager.d.ts.map +1 -1
  24. package/dist/managers/toolManager.js +1 -0
  25. package/dist/prompts/index.d.ts +1 -1
  26. package/dist/prompts/index.d.ts.map +1 -1
  27. package/dist/prompts/index.js +1 -0
  28. package/dist/services/configurationService.d.ts.map +1 -1
  29. package/dist/services/configurationService.js +1 -0
  30. package/dist/services/fileWatcher.d.ts.map +1 -1
  31. package/dist/services/fileWatcher.js +27 -15
  32. package/dist/services/session.d.ts +16 -2
  33. package/dist/services/session.d.ts.map +1 -1
  34. package/dist/services/session.js +110 -7
  35. package/dist/tools/askUserQuestion.d.ts.map +1 -1
  36. package/dist/tools/askUserQuestion.js +8 -1
  37. package/dist/tools/bashTool.d.ts.map +1 -1
  38. package/dist/tools/bashTool.js +4 -4
  39. package/dist/tools/editTool.d.ts.map +1 -1
  40. package/dist/tools/editTool.js +1 -1
  41. package/dist/tools/exitPlanMode.d.ts.map +1 -1
  42. package/dist/tools/exitPlanMode.js +3 -1
  43. package/dist/tools/grepTool.d.ts.map +1 -1
  44. package/dist/tools/grepTool.js +1 -1
  45. package/dist/tools/lspTool.d.ts.map +1 -1
  46. package/dist/tools/lspTool.js +47 -15
  47. package/dist/tools/taskOutputTool.d.ts.map +1 -1
  48. package/dist/tools/taskOutputTool.js +22 -5
  49. package/dist/tools/types.d.ts +3 -0
  50. package/dist/tools/types.d.ts.map +1 -1
  51. package/dist/tools/writeTool.d.ts.map +1 -1
  52. package/dist/tools/writeTool.js +1 -1
  53. package/dist/types/agent.d.ts +2 -0
  54. package/dist/types/agent.d.ts.map +1 -1
  55. package/dist/types/configuration.d.ts +2 -0
  56. package/dist/types/configuration.d.ts.map +1 -1
  57. package/dist/types/permissions.d.ts +2 -0
  58. package/dist/types/permissions.d.ts.map +1 -1
  59. package/dist/types/skills.d.ts +4 -2
  60. package/dist/types/skills.d.ts.map +1 -1
  61. package/dist/utils/bashParser.d.ts.map +1 -1
  62. package/dist/utils/bashParser.js +50 -0
  63. package/dist/utils/configPaths.d.ts +6 -0
  64. package/dist/utils/configPaths.d.ts.map +1 -1
  65. package/dist/utils/configPaths.js +23 -2
  66. package/dist/utils/containerSetup.d.ts.map +1 -1
  67. package/dist/utils/containerSetup.js +4 -1
  68. package/dist/utils/gitUtils.d.ts +6 -0
  69. package/dist/utils/gitUtils.d.ts.map +1 -1
  70. package/dist/utils/gitUtils.js +22 -0
  71. package/package.json +1 -1
  72. package/src/agent.ts +18 -2
  73. package/src/builtin-skills/settings/HOOKS.md +95 -0
  74. package/src/builtin-skills/settings/SKILL.md +86 -0
  75. package/src/core/session.ts +2 -0
  76. package/src/managers/aiManager.ts +1 -0
  77. package/src/managers/backgroundTaskManager.ts +11 -1
  78. package/src/managers/messageManager.ts +1 -9
  79. package/src/managers/permissionManager.ts +51 -9
  80. package/src/managers/skillManager.ts +111 -25
  81. package/src/managers/slashCommandManager.ts +8 -1
  82. package/src/managers/toolManager.ts +1 -0
  83. package/src/prompts/index.ts +1 -0
  84. package/src/services/configurationService.ts +1 -0
  85. package/src/services/fileWatcher.ts +33 -17
  86. package/src/services/session.ts +124 -7
  87. package/src/tools/askUserQuestion.ts +10 -0
  88. package/src/tools/bashTool.ts +4 -3
  89. package/src/tools/editTool.ts +1 -0
  90. package/src/tools/exitPlanMode.ts +4 -1
  91. package/src/tools/grepTool.ts +2 -1
  92. package/src/tools/lspTool.ts +99 -9
  93. package/src/tools/taskOutputTool.ts +25 -6
  94. package/src/tools/types.ts +4 -0
  95. package/src/tools/writeTool.ts +1 -0
  96. package/src/types/agent.ts +2 -0
  97. package/src/types/configuration.ts +2 -0
  98. package/src/types/permissions.ts +2 -0
  99. package/src/types/skills.ts +4 -2
  100. package/src/utils/bashParser.ts +54 -0
  101. package/src/utils/configPaths.ts +28 -2
  102. package/src/utils/containerSetup.ts +4 -1
  103. package/src/utils/gitUtils.ts +22 -0
@@ -10,9 +10,29 @@
10
10
  * - Project configs override user configs (existing behavior)
11
11
  */
12
12
 
13
- import { join } from "path";
13
+ import { join, dirname } from "path";
14
14
  import { homedir } from "os";
15
15
  import { existsSync } from "fs";
16
+ import { fileURLToPath } from "url";
17
+
18
+ const __filename = fileURLToPath(import.meta.url);
19
+ const __dirname = dirname(__filename);
20
+
21
+ /**
22
+ * Get the builtin skills directory path
23
+ */
24
+ export function getBuiltinSkillsDir(): string {
25
+ // In development, it's in src/builtin-skills
26
+ // In production (dist), it should be in dist/builtin-skills
27
+ // We'll look for it relative to this file
28
+ const devPath = join(__dirname, "..", "builtin-skills");
29
+ const prodPath = join(__dirname, "builtin-skills");
30
+
31
+ if (existsSync(devPath)) {
32
+ return devPath;
33
+ }
34
+ return prodPath;
35
+ }
16
36
 
17
37
  /**
18
38
  * Get the user-specific configuration file path (legacy function)
@@ -62,15 +82,18 @@ export function getProjectConfigPaths(workdir: string): string[] {
62
82
  export function getAllConfigPaths(workdir: string): {
63
83
  userPaths: string[];
64
84
  projectPaths: string[];
85
+ builtinPaths: string[];
65
86
  allPaths: string[];
66
87
  } {
67
88
  const userPaths = getUserConfigPaths();
68
89
  const projectPaths = getProjectConfigPaths(workdir);
90
+ const builtinPaths = [join(getBuiltinSkillsDir(), "settings", "SKILL.md")];
69
91
 
70
92
  return {
71
93
  userPaths,
72
94
  projectPaths,
73
- allPaths: [...userPaths, ...projectPaths],
95
+ builtinPaths,
96
+ allPaths: [...userPaths, ...projectPaths, ...builtinPaths],
74
97
  };
75
98
  }
76
99
 
@@ -81,17 +104,20 @@ export function getAllConfigPaths(workdir: string): {
81
104
  export function getExistingConfigPaths(workdir: string): {
82
105
  userPaths: string[];
83
106
  projectPaths: string[];
107
+ builtinPaths: string[];
84
108
  existingPaths: string[];
85
109
  } {
86
110
  const allPaths = getAllConfigPaths(workdir);
87
111
 
88
112
  const existingUserPaths = allPaths.userPaths.filter(existsSync);
89
113
  const existingProjectPaths = allPaths.projectPaths.filter(existsSync);
114
+ const existingBuiltinPaths = allPaths.builtinPaths.filter(existsSync);
90
115
  const allExistingPaths = allPaths.allPaths.filter(existsSync);
91
116
 
92
117
  return {
93
118
  userPaths: existingUserPaths,
94
119
  projectPaths: existingProjectPaths,
120
+ builtinPaths: existingBuiltinPaths,
95
121
  existingPaths: allExistingPaths,
96
122
  };
97
123
  }
@@ -147,7 +147,10 @@ export function setupAgentContainer(
147
147
  const hookManager = new HookManager(container, workdir);
148
148
  container.register("HookManager", hookManager);
149
149
 
150
- const skillManager = new SkillManager(container, { workdir });
150
+ const skillManager = new SkillManager(container, {
151
+ workdir,
152
+ watch: options.watchSkills ?? true,
153
+ });
151
154
  container.register("SkillManager", skillManager);
152
155
 
153
156
  container.register(
@@ -59,6 +59,28 @@ export function getGitCommonDir(cwd: string): string {
59
59
  }
60
60
  }
61
61
 
62
+ /**
63
+ * Get the main repository root directory (the first worktree in the list)
64
+ * @param cwd Working directory
65
+ * @returns Main repository root path
66
+ */
67
+ export function getGitMainRepoRoot(cwd: string): string {
68
+ try {
69
+ const output = execSync("git worktree list --porcelain", {
70
+ cwd,
71
+ encoding: "utf8",
72
+ stdio: ["ignore", "pipe", "ignore"],
73
+ }).trim();
74
+ const lines = output.split("\n");
75
+ if (lines.length > 0 && lines[0].startsWith("worktree ")) {
76
+ return lines[0].substring("worktree ".length).trim();
77
+ }
78
+ return getGitRepoRoot(cwd);
79
+ } catch {
80
+ return getGitRepoRoot(cwd);
81
+ }
82
+ }
83
+
62
84
  /**
63
85
  * Get the default remote branch (e.g., origin/main)
64
86
  * @param cwd Working directory