wave-agent-sdk 0.11.6 → 0.11.7
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 +2 -0
- package/builtin/skills/settings/SKILLS.md +3 -2
- package/builtin/skills/settings/SUBAGENTS.md +1 -3
- package/dist/agent.d.ts +6 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +18 -1
- package/dist/constants/tools.d.ts +1 -1
- package/dist/constants/tools.d.ts.map +1 -1
- package/dist/constants/tools.js +1 -1
- package/dist/managers/MemoryRuleManager.d.ts.map +1 -1
- package/dist/managers/MemoryRuleManager.js +1 -9
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +22 -3
- package/dist/managers/messageManager.d.ts +13 -5
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +62 -34
- package/dist/managers/pluginManager.d.ts.map +1 -1
- package/dist/managers/pluginManager.js +4 -2
- package/dist/managers/slashCommandManager.d.ts +2 -0
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +98 -4
- package/dist/managers/toolManager.d.ts.map +1 -1
- package/dist/managers/toolManager.js +8 -2
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +5 -0
- package/dist/services/GitService.d.ts +1 -0
- package/dist/services/GitService.d.ts.map +1 -1
- package/dist/services/GitService.js +16 -0
- package/dist/services/MarketplaceService.d.ts +7 -0
- package/dist/services/MarketplaceService.d.ts.map +1 -1
- package/dist/services/MarketplaceService.js +321 -252
- package/dist/services/aiService.d.ts +34 -0
- package/dist/services/aiService.d.ts.map +1 -1
- package/dist/services/aiService.js +124 -1
- package/dist/services/initializationService.d.ts.map +1 -1
- package/dist/services/initializationService.js +18 -0
- package/dist/tools/agentTool.js +3 -3
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +4 -4
- package/dist/tools/editTool.d.ts.map +1 -1
- package/dist/tools/editTool.js +2 -0
- package/dist/tools/globTool.d.ts.map +1 -1
- package/dist/tools/globTool.js +15 -3
- package/dist/tools/grepTool.d.ts.map +1 -1
- package/dist/tools/grepTool.js +38 -12
- package/dist/tools/readTool.d.ts.map +1 -1
- package/dist/tools/readTool.js +61 -0
- package/dist/tools/skillTool.js +2 -2
- package/dist/tools/types.d.ts +16 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/webFetchTool.d.ts +3 -0
- package/dist/tools/webFetchTool.d.ts.map +1 -0
- package/dist/tools/webFetchTool.js +171 -0
- package/dist/tools/writeTool.d.ts.map +1 -1
- package/dist/tools/writeTool.js +2 -0
- package/dist/types/commands.d.ts +1 -1
- package/dist/types/commands.d.ts.map +1 -1
- package/dist/types/messaging.d.ts +1 -0
- package/dist/types/messaging.d.ts.map +1 -1
- package/dist/utils/bashParser.d.ts +14 -0
- package/dist/utils/bashParser.d.ts.map +1 -1
- package/dist/utils/bashParser.js +243 -142
- package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.js +7 -0
- package/dist/utils/fileUtils.d.ts +8 -0
- package/dist/utils/fileUtils.d.ts.map +1 -1
- package/dist/utils/fileUtils.js +52 -0
- package/dist/utils/messageOperations.d.ts +12 -3
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/messageOperations.js +77 -9
- package/package.json +4 -2
- package/src/agent.ts +19 -1
- package/src/constants/tools.ts +1 -1
- package/src/managers/MemoryRuleManager.ts +1 -10
- package/src/managers/aiManager.ts +23 -3
- package/src/managers/messageManager.ts +76 -38
- package/src/managers/pluginManager.ts +4 -2
- package/src/managers/slashCommandManager.ts +130 -4
- package/src/managers/toolManager.ts +11 -2
- package/src/prompts/index.ts +6 -0
- package/src/services/GitService.ts +20 -0
- package/src/services/MarketplaceService.ts +397 -324
- package/src/services/aiService.ts +197 -1
- package/src/services/initializationService.ts +38 -0
- package/src/tools/agentTool.ts +3 -3
- package/src/tools/bashTool.ts +3 -4
- package/src/tools/editTool.ts +3 -0
- package/src/tools/globTool.ts +16 -3
- package/src/tools/grepTool.ts +41 -13
- package/src/tools/readTool.ts +69 -0
- package/src/tools/skillTool.ts +2 -2
- package/src/tools/types.ts +13 -0
- package/src/tools/webFetchTool.ts +194 -0
- package/src/tools/writeTool.ts +3 -0
- package/src/types/commands.ts +1 -1
- package/src/types/messaging.ts +1 -0
- package/src/utils/bashParser.ts +268 -157
- package/src/utils/convertMessagesForAPI.ts +8 -0
- package/src/utils/fileUtils.ts +69 -0
- package/src/utils/messageOperations.ts +84 -9
- package/dist/tools/taskOutputTool.d.ts +0 -3
- package/dist/tools/taskOutputTool.d.ts.map +0 -1
- package/dist/tools/taskOutputTool.js +0 -198
- package/src/tools/taskOutputTool.ts +0 -222
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { loadCustomSlashCommands } from "../utils/customCommands.js";
|
|
2
2
|
import { substituteCommandParameters, parseSlashCommandInput, hasParameterPlaceholders, } from "../utils/commandArgumentParser.js";
|
|
3
3
|
import { parseBashCommands, replaceBashCommandsWithOutput, executeBashCommands, } from "../utils/markdownParser.js";
|
|
4
|
+
import { countToolBlocks, formatToolTokenSummary, } from "../utils/messageOperations.js";
|
|
4
5
|
import { logger } from "../utils/globalLogger.js";
|
|
5
6
|
export class SlashCommandManager {
|
|
6
7
|
constructor(container, options) {
|
|
@@ -8,6 +9,7 @@ export class SlashCommandManager {
|
|
|
8
9
|
this.commands = new Map();
|
|
9
10
|
this.customCommands = new Map();
|
|
10
11
|
this.skillCommandIds = new Set();
|
|
12
|
+
this.currentCommandAbortController = null;
|
|
11
13
|
this.workdir = options.workdir;
|
|
12
14
|
}
|
|
13
15
|
initialize() {
|
|
@@ -36,6 +38,9 @@ export class SlashCommandManager {
|
|
|
36
38
|
get skillManager() {
|
|
37
39
|
return this.container.get("SkillManager");
|
|
38
40
|
}
|
|
41
|
+
get subagentManager() {
|
|
42
|
+
return this.container.get("SubagentManager");
|
|
43
|
+
}
|
|
39
44
|
initializeBuiltinCommands() {
|
|
40
45
|
// Register built-in clear command
|
|
41
46
|
this.registerCommand({
|
|
@@ -100,7 +105,7 @@ export class SlashCommandManager {
|
|
|
100
105
|
id: commandId,
|
|
101
106
|
name: skill.name,
|
|
102
107
|
description: `Skill: ${skill.description}`,
|
|
103
|
-
handler: async (args) => {
|
|
108
|
+
handler: async (args, signal) => {
|
|
104
109
|
try {
|
|
105
110
|
// 1. Prepare skill content immediately
|
|
106
111
|
const prepared = await this.skillManager.prepareSkill({
|
|
@@ -119,6 +124,82 @@ export class SlashCommandManager {
|
|
|
119
124
|
// If skill not found or invalid, we're done (error message already in prepared.content)
|
|
120
125
|
return;
|
|
121
126
|
}
|
|
127
|
+
if (skill.context === "fork") {
|
|
128
|
+
// Forked skill execution
|
|
129
|
+
const subagentConfigs = await this.subagentManager.loadConfigurations();
|
|
130
|
+
const subagentType = skill.agent || "general-purpose";
|
|
131
|
+
const config = subagentConfigs.find((c) => c.name === subagentType);
|
|
132
|
+
if (!config) {
|
|
133
|
+
throw new Error(`Subagent configuration for ${subagentType} not found`);
|
|
134
|
+
}
|
|
135
|
+
// Add a ToolBlock to the initial command message for progress tracking
|
|
136
|
+
const toolBlockId = this.messageManager.addToolBlockToMessage(messageId, {
|
|
137
|
+
name: subagentType,
|
|
138
|
+
parameters: JSON.stringify({
|
|
139
|
+
description: skill.description,
|
|
140
|
+
prompt: prepared.content,
|
|
141
|
+
subagent_type: subagentType,
|
|
142
|
+
}),
|
|
143
|
+
stage: "running",
|
|
144
|
+
});
|
|
145
|
+
try {
|
|
146
|
+
const instance = await this.subagentManager.createInstance(config, {
|
|
147
|
+
description: skill.description,
|
|
148
|
+
prompt: prepared.content,
|
|
149
|
+
subagent_type: subagentType,
|
|
150
|
+
model: skill.model,
|
|
151
|
+
}, false, () => {
|
|
152
|
+
// Update the tool block with progress
|
|
153
|
+
const subagent = this.subagentManager.getInstance(instance.subagentId);
|
|
154
|
+
if (subagent) {
|
|
155
|
+
const messages = subagent.messages;
|
|
156
|
+
const tokens = subagent.messageManager.getLatestTotalTokens();
|
|
157
|
+
const lastTools = subagent.lastTools;
|
|
158
|
+
const toolCount = countToolBlocks(messages);
|
|
159
|
+
const summary = formatToolTokenSummary(toolCount, tokens);
|
|
160
|
+
let shortResult = "";
|
|
161
|
+
if (toolCount > 2) {
|
|
162
|
+
shortResult += "... ";
|
|
163
|
+
}
|
|
164
|
+
if (lastTools.length > 0) {
|
|
165
|
+
shortResult += `${lastTools.join(", ")} `;
|
|
166
|
+
}
|
|
167
|
+
shortResult += summary;
|
|
168
|
+
this.messageManager.updateToolBlock({
|
|
169
|
+
id: toolBlockId,
|
|
170
|
+
messageId,
|
|
171
|
+
shortResult,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
try {
|
|
176
|
+
const result = await this.subagentManager.executeAgent(instance, prepared.content, signal);
|
|
177
|
+
// Update the ToolBlock with final result
|
|
178
|
+
this.messageManager.updateToolBlock({
|
|
179
|
+
id: toolBlockId,
|
|
180
|
+
messageId,
|
|
181
|
+
result,
|
|
182
|
+
success: true,
|
|
183
|
+
stage: "end",
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
this.subagentManager.cleanupInstance(instance.subagentId);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
// Update the ToolBlock with error
|
|
192
|
+
this.messageManager.updateToolBlock({
|
|
193
|
+
id: toolBlockId,
|
|
194
|
+
messageId,
|
|
195
|
+
success: false,
|
|
196
|
+
error: error instanceof Error ? error.message : String(error),
|
|
197
|
+
stage: "end",
|
|
198
|
+
});
|
|
199
|
+
throw error; // Re-throw to be caught by outer catch for logging/error block
|
|
200
|
+
}
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
122
203
|
// 3. Execute bash commands asynchronously
|
|
123
204
|
const result = await this.skillManager.executeSkill({
|
|
124
205
|
skill_name: skill.name,
|
|
@@ -154,7 +235,6 @@ export class SlashCommandManager {
|
|
|
154
235
|
// Generate description: prioritize custom description, otherwise use default description
|
|
155
236
|
const description = command.description ||
|
|
156
237
|
`Plugin command: ${namespacedName}${hasParameterPlaceholders(command.content) ? " (supports parameters)" : ""}`;
|
|
157
|
-
// Register as a regular command with a handler that executes the custom command
|
|
158
238
|
this.registerCommand({
|
|
159
239
|
id: namespacedId,
|
|
160
240
|
name: namespacedName,
|
|
@@ -215,14 +295,25 @@ export class SlashCommandManager {
|
|
|
215
295
|
if (!command) {
|
|
216
296
|
return false;
|
|
217
297
|
}
|
|
298
|
+
// Abort any previous command if it's still running
|
|
299
|
+
this.currentCommandAbortController?.abort();
|
|
300
|
+
this.currentCommandAbortController = new AbortController();
|
|
218
301
|
try {
|
|
219
|
-
await command.handler(args);
|
|
302
|
+
await command.handler(args, this.currentCommandAbortController.signal);
|
|
220
303
|
return true;
|
|
221
304
|
}
|
|
222
305
|
catch (error) {
|
|
223
|
-
|
|
306
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
307
|
+
logger?.debug(`Slash command ${commandId} was aborted`);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
console.error(`Failed to execute slash command ${commandId}:`, error);
|
|
311
|
+
}
|
|
224
312
|
return false;
|
|
225
313
|
}
|
|
314
|
+
finally {
|
|
315
|
+
this.currentCommandAbortController = null;
|
|
316
|
+
}
|
|
226
317
|
}
|
|
227
318
|
/**
|
|
228
319
|
* Parse and validate a slash command input
|
|
@@ -304,5 +395,8 @@ export class SlashCommandManager {
|
|
|
304
395
|
abortCurrentCommand() {
|
|
305
396
|
// Abort the AI manager if it's running
|
|
306
397
|
this.aiManager.abortAIMessage();
|
|
398
|
+
// Abort the current slash command handler
|
|
399
|
+
this.currentCommandAbortController?.abort();
|
|
400
|
+
this.currentCommandAbortController = null;
|
|
307
401
|
}
|
|
308
402
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolManager.d.ts","sourceRoot":"","sources":["../../src/managers/toolManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAyB7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"toolManager.d.ts","sourceRoot":"","sources":["../../src/managers/toolManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAyB7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,cAAM,WAAW;IACf,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,KAAK,CAAC,CAAW;IACzB,OAAO,CAAC,SAAS,CAAY;gBAEjB,OAAO,EAAE,kBAAkB;IAKvC,OAAO,KAAK,UAAU,GAErB;IAED;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAIvC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,sBAAsB,IAAI,IAAI;IA+BrC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAiBxB;;;;;;;;;;;;OAYG;IACG,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC;IAqGtB,IAAI,IAAI,UAAU,EAAE;IAYpB,cAAc,CAAC,OAAO,CAAC,EAAE;QACvB,kBAAkB,CAAC,EAAE,qBAAqB,EAAE,CAAC;QAC7C,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;QAClC,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,0BAA0B,EAAE;IAwChC;;OAEG;IACI,QAAQ,IAAI,UAAU,EAAE;IAI/B;;OAEG;IACI,iBAAiB,IAAI,cAAc;IAa1C;;;OAGG;IACI,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAIpD;;OAEG;IACI,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAI5D;;OAEG;IACI,cAAc,IACjB,OAAO,4BAA4B,EAAE,WAAW,GAChD,SAAS;CAKd;AAGD,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { bashTool } from "../tools/bashTool.js";
|
|
2
|
-
import { taskOutputTool } from "../tools/taskOutputTool.js";
|
|
3
2
|
import { taskStopTool } from "../tools/taskStopTool.js";
|
|
4
3
|
import { editTool } from "../tools/editTool.js";
|
|
5
4
|
import { writeTool } from "../tools/writeTool.js";
|
|
@@ -8,6 +7,7 @@ import { askUserQuestionTool } from "../tools/askUserQuestion.js";
|
|
|
8
7
|
import { cronCreateTool } from "../tools/cronCreateTool.js";
|
|
9
8
|
import { cronDeleteTool } from "../tools/cronDeleteTool.js";
|
|
10
9
|
import { cronListTool } from "../tools/cronListTool.js";
|
|
10
|
+
import { webFetchTool } from "../tools/webFetchTool.js";
|
|
11
11
|
// New tools
|
|
12
12
|
import { globTool } from "../tools/globTool.js";
|
|
13
13
|
import { grepTool } from "../tools/grepTool.js";
|
|
@@ -16,6 +16,7 @@ import { lspTool } from "../tools/lspTool.js";
|
|
|
16
16
|
import { agentTool } from "../tools/agentTool.js";
|
|
17
17
|
import { skillTool } from "../tools/skillTool.js";
|
|
18
18
|
import { taskCreateTool, taskGetTool, taskUpdateTool, taskListTool, } from "../tools/taskManagementTools.js";
|
|
19
|
+
import * as aiService from "../services/aiService.js";
|
|
19
20
|
import { logger } from "../utils/globalLogger.js";
|
|
20
21
|
/**
|
|
21
22
|
* Tool Manager
|
|
@@ -64,7 +65,6 @@ class ToolManager {
|
|
|
64
65
|
initializeBuiltInTools() {
|
|
65
66
|
const builtInTools = [
|
|
66
67
|
bashTool,
|
|
67
|
-
taskOutputTool,
|
|
68
68
|
taskStopTool,
|
|
69
69
|
editTool,
|
|
70
70
|
writeTool,
|
|
@@ -83,6 +83,7 @@ class ToolManager {
|
|
|
83
83
|
cronCreateTool,
|
|
84
84
|
cronDeleteTool,
|
|
85
85
|
cronListTool,
|
|
86
|
+
webFetchTool,
|
|
86
87
|
];
|
|
87
88
|
for (const tool of builtInTools) {
|
|
88
89
|
if (this.shouldEnableTool(tool.name)) {
|
|
@@ -150,6 +151,11 @@ class ToolManager {
|
|
|
150
151
|
cronManager: this.container.has("CronManager")
|
|
151
152
|
? this.container.get("CronManager")
|
|
152
153
|
: undefined,
|
|
154
|
+
aiManager: this.container.has("AIManager")
|
|
155
|
+
? this.container.get("AIManager")
|
|
156
|
+
: undefined,
|
|
157
|
+
aiService: aiService,
|
|
158
|
+
messageManager: this.container.get("MessageManager"),
|
|
153
159
|
sessionId: context.sessionId,
|
|
154
160
|
toolCallId: context.toolCallId,
|
|
155
161
|
};
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export declare const TOOL_POLICY = "\n# Tool usage policy\n- You can call multip
|
|
|
6
6
|
export declare function buildPlanModePrompt(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
|
|
7
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.";
|
|
8
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.";
|
|
9
|
+
export declare const WEB_CONTENT_SYSTEM_PROMPT = "You are a helpful assistant that extracts information from web content. The content is provided in Markdown format.";
|
|
10
|
+
export declare const BTW_SYSTEM_PROMPT = "You are a helpful assistant. Answer the user's side question based on the conversation history. \nDo NOT say things like \"Let me try...\", \"I'll now...\", \"Let me check...\", or promise to take any action. \nIf you don't know the answer, say so - do not offer to look it up or investigate. \nSimply answer the question with the information you have.";
|
|
9
11
|
export declare function buildSystemPrompt(basePrompt: string | undefined, tools: ToolPlugin[], options?: {
|
|
10
12
|
workdir?: string;
|
|
11
13
|
memory?: 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;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,E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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
|
@@ -127,6 +127,11 @@ Domain-specific details that aren't obvious
|
|
|
127
127
|
Any promises made to the user
|
|
128
128
|
Be concise but complete—err 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.
|
|
129
129
|
Wrap your summary in <summary></summary> tags.`;
|
|
130
|
+
export const WEB_CONTENT_SYSTEM_PROMPT = `You are a helpful assistant that extracts information from web content. The content is provided in Markdown format.`;
|
|
131
|
+
export const BTW_SYSTEM_PROMPT = `You are a helpful assistant. Answer the user's side question based on the conversation history.
|
|
132
|
+
Do NOT say things like "Let me try...", "I'll now...", "Let me check...", or promise to take any action.
|
|
133
|
+
If you don't know the answer, say so - do not offer to look it up or investigate.
|
|
134
|
+
Simply answer the question with the information you have.`;
|
|
130
135
|
export function buildSystemPrompt(basePrompt, tools, options = {}) {
|
|
131
136
|
let prompt = basePrompt || DEFAULT_SYSTEM_PROMPT;
|
|
132
137
|
if (tools.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitService.d.ts","sourceRoot":"","sources":["../../src/services/GitService.ts"],"names":[],"mappings":"AAKA,qBAAa,UAAU;IACrB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASxC;;OAEG;IACG,KAAK,CACT,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"GitService.d.ts","sourceRoot":"","sources":["../../src/services/GitService.ts"],"names":[],"mappings":"AAKA,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU;IAWlB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASxC;;OAEG;IACG,KAAK,CACT,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IAkChB;;OAEG;IACG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB7C,OAAO,CAAC,cAAc;CAoCvB"}
|
|
@@ -2,6 +2,16 @@ import { exec } from "child_process";
|
|
|
2
2
|
import { promisify } from "util";
|
|
3
3
|
const execAsync = promisify(exec);
|
|
4
4
|
export class GitService {
|
|
5
|
+
getTimeout() {
|
|
6
|
+
const envTimeout = process.env.WAVE_PLUGIN_GIT_TIMEOUT_MS;
|
|
7
|
+
if (envTimeout) {
|
|
8
|
+
const parsed = parseInt(envTimeout, 10);
|
|
9
|
+
if (!isNaN(parsed)) {
|
|
10
|
+
return parsed;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return 120000; // Default 120 seconds
|
|
14
|
+
}
|
|
5
15
|
/**
|
|
6
16
|
* Checks if git is installed and available in the system path
|
|
7
17
|
*/
|
|
@@ -36,6 +46,7 @@ export class GitService {
|
|
|
36
46
|
const refArgs = ref ? `-b "${ref}"` : "--depth 1";
|
|
37
47
|
await execAsync(`git clone ${refArgs} "${url}" "${targetPath}"`, {
|
|
38
48
|
env: { ...process.env, LC_ALL: "C" },
|
|
49
|
+
timeout: this.getTimeout(),
|
|
39
50
|
});
|
|
40
51
|
}
|
|
41
52
|
catch (error) {
|
|
@@ -55,6 +66,7 @@ export class GitService {
|
|
|
55
66
|
try {
|
|
56
67
|
await execAsync(`git -C "${targetPath}" pull`, {
|
|
57
68
|
env: { ...process.env, LC_ALL: "C" },
|
|
69
|
+
timeout: this.getTimeout(),
|
|
58
70
|
});
|
|
59
71
|
}
|
|
60
72
|
catch (error) {
|
|
@@ -64,6 +76,10 @@ export class GitService {
|
|
|
64
76
|
handleGitError(context, error) {
|
|
65
77
|
const stderr = error?.stderr || "";
|
|
66
78
|
const message = error?.message || String(error);
|
|
79
|
+
const killed = error?.killed || false;
|
|
80
|
+
if (message.includes("ETIMEDOUT") || killed) {
|
|
81
|
+
return new Error(`Git operation timed out after ${this.getTimeout() / 1000}s. The repository may be too large or the network is slow. You can increase the timeout by setting the WAVE_PLUGIN_GIT_TIMEOUT_MS environment variable.`);
|
|
82
|
+
}
|
|
67
83
|
if (stderr.includes("Repository not found") ||
|
|
68
84
|
stderr.includes("not found")) {
|
|
69
85
|
return new Error(`Repository "${context}" not found. It might be private or doesn't exist.`);
|
|
@@ -6,9 +6,11 @@ import { KnownMarketplace, KnownMarketplacesRegistry, InstalledPlugin, Installed
|
|
|
6
6
|
* and state management for installed plugins.
|
|
7
7
|
*/
|
|
8
8
|
export declare class MarketplaceService {
|
|
9
|
+
private static isLockedInProcess;
|
|
9
10
|
private pluginsDir;
|
|
10
11
|
private knownMarketplacesPath;
|
|
11
12
|
private installedPluginsPath;
|
|
13
|
+
private lockPath;
|
|
12
14
|
private tmpDir;
|
|
13
15
|
private cacheDir;
|
|
14
16
|
private marketplacesDir;
|
|
@@ -19,6 +21,11 @@ export declare class MarketplaceService {
|
|
|
19
21
|
* Ensures the required directory structure exists in ~/.wave/plugins
|
|
20
22
|
*/
|
|
21
23
|
private ensureDirectoryStructure;
|
|
24
|
+
/**
|
|
25
|
+
* Acquires a file-based lock and executes the provided function.
|
|
26
|
+
* Supports re-entrancy within the same process.
|
|
27
|
+
*/
|
|
28
|
+
private withLock;
|
|
22
29
|
/**
|
|
23
30
|
* Loads the known marketplaces registry
|
|
24
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarketplaceService.d.ts","sourceRoot":"","sources":["../../src/services/MarketplaceService.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,gBAAgB,EAChB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