wave-agent-sdk 0.13.6 → 0.14.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/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +4 -2
- package/dist/core/plugin.d.ts +2 -2
- package/dist/core/plugin.d.ts.map +1 -1
- package/dist/core/plugin.js +7 -7
- package/dist/managers/aiManager.d.ts +3 -0
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +93 -8
- package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
- package/dist/managers/backgroundTaskManager.js +0 -12
- package/dist/managers/messageManager.d.ts +15 -0
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +52 -2
- package/dist/managers/permissionManager.d.ts +4 -0
- package/dist/managers/permissionManager.d.ts.map +1 -1
- package/dist/managers/permissionManager.js +6 -0
- package/dist/managers/pluginManager.d.ts.map +1 -1
- package/dist/managers/pluginManager.js +1 -1
- package/dist/managers/subagentManager.d.ts.map +1 -1
- package/dist/managers/subagentManager.js +23 -17
- package/dist/prompts/index.d.ts +2 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +50 -25
- package/dist/services/MarketplaceService.d.ts +53 -12
- package/dist/services/MarketplaceService.d.ts.map +1 -1
- package/dist/services/MarketplaceService.js +311 -123
- package/dist/services/aiService.d.ts.map +1 -1
- package/dist/services/aiService.js +11 -1
- package/dist/services/configurationService.d.ts +17 -1
- package/dist/services/configurationService.d.ts.map +1 -1
- package/dist/services/configurationService.js +104 -0
- package/dist/services/pluginLoader.d.ts +6 -0
- package/dist/services/pluginLoader.d.ts.map +1 -1
- package/dist/services/pluginLoader.js +52 -7
- package/dist/tools/agentTool.d.ts.map +1 -1
- package/dist/tools/agentTool.js +14 -2
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +27 -5
- package/dist/tools/types.d.ts +1 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/webFetchTool.d.ts.map +1 -1
- package/dist/tools/webFetchTool.js +202 -78
- package/dist/types/configuration.d.ts +7 -0
- package/dist/types/configuration.d.ts.map +1 -1
- package/dist/types/marketplace.d.ts +28 -1
- package/dist/types/marketplace.d.ts.map +1 -1
- package/dist/types/messaging.d.ts +1 -0
- package/dist/types/messaging.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +13 -1
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.js +1 -1
- package/dist/utils/groupMessagesByApiRound.d.ts +24 -0
- package/dist/utils/groupMessagesByApiRound.d.ts.map +1 -0
- package/dist/utils/groupMessagesByApiRound.js +97 -0
- package/dist/utils/messageOperations.d.ts +1 -0
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/microcompact.d.ts +7 -0
- package/dist/utils/microcompact.d.ts.map +1 -0
- package/dist/utils/microcompact.js +78 -0
- package/package.json +2 -1
- package/src/agent.ts +4 -2
- package/src/core/plugin.ts +13 -7
- package/src/managers/aiManager.ts +117 -15
- package/src/managers/backgroundTaskManager.ts +1 -20
- package/src/managers/messageManager.ts +64 -2
- package/src/managers/permissionManager.ts +7 -0
- package/src/managers/pluginManager.ts +4 -1
- package/src/managers/subagentManager.ts +28 -24
- package/src/prompts/index.ts +51 -25
- package/src/services/MarketplaceService.ts +425 -134
- package/src/services/aiService.ts +14 -1
- package/src/services/configurationService.ts +131 -0
- package/src/services/pluginLoader.ts +66 -7
- package/src/tools/agentTool.ts +14 -2
- package/src/tools/bashTool.ts +27 -5
- package/src/tools/types.ts +1 -0
- package/src/tools/webFetchTool.ts +276 -86
- package/src/types/configuration.ts +8 -0
- package/src/types/marketplace.ts +26 -1
- package/src/types/messaging.ts +1 -0
- package/src/types/plugins.ts +13 -1
- package/src/utils/convertMessagesForAPI.ts +1 -1
- package/src/utils/groupMessagesByApiRound.ts +120 -0
- package/src/utils/messageOperations.ts +1 -0
- package/src/utils/microcompact.ts +101 -0
|
@@ -567,23 +567,25 @@ export class SubagentManager {
|
|
|
567
567
|
instance.logStream?.end();
|
|
568
568
|
const task = backgroundTaskManager.getTask(instance.backgroundTaskId);
|
|
569
569
|
if (task) {
|
|
570
|
+
const wasAlreadyKilled = task.status === "killed";
|
|
570
571
|
task.status = "completed";
|
|
571
572
|
task.stdout = response || "Agent completed with no text response";
|
|
572
573
|
task.endTime = Date.now();
|
|
573
574
|
if (task.startTime) {
|
|
574
575
|
task.runtime = task.endTime - task.startTime;
|
|
575
576
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
577
|
+
// Skip notification if task was already stopped (e.g. by main agent shutdown)
|
|
578
|
+
if (!wasAlreadyKilled) {
|
|
579
|
+
const notificationQueue = this.container.has("NotificationQueue")
|
|
580
|
+
? this.container.get<NotificationQueue>("NotificationQueue")
|
|
581
|
+
: undefined;
|
|
582
|
+
if (notificationQueue) {
|
|
583
|
+
const summary = `Agent task "${instance.description}" completed`;
|
|
584
|
+
notificationQueue.enqueue(
|
|
585
|
+
`<task-notification>\n<task-id>${instance.backgroundTaskId}</task-id>\n<task-type>agent</task-type>\n<status>completed</status>\n<summary>${summary}</summary>\n</task-notification>`,
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
587
589
|
}
|
|
588
590
|
}
|
|
589
591
|
|
|
@@ -602,25 +604,27 @@ export class SubagentManager {
|
|
|
602
604
|
instance.logStream?.end();
|
|
603
605
|
const task = backgroundTaskManager.getTask(instance.backgroundTaskId);
|
|
604
606
|
if (task) {
|
|
607
|
+
const wasAlreadyKilled = task.status === "killed";
|
|
605
608
|
task.status = "failed";
|
|
606
609
|
task.stderr = error instanceof Error ? error.message : String(error);
|
|
607
610
|
task.endTime = Date.now();
|
|
608
611
|
if (task.startTime) {
|
|
609
612
|
task.runtime = task.endTime - task.startTime;
|
|
610
613
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
614
|
+
// Skip notification if task was already stopped (e.g. by main agent shutdown)
|
|
615
|
+
if (!wasAlreadyKilled) {
|
|
616
|
+
const notificationQueue = this.container.has("NotificationQueue")
|
|
617
|
+
? this.container.get<NotificationQueue>("NotificationQueue")
|
|
618
|
+
: undefined;
|
|
619
|
+
if (notificationQueue) {
|
|
620
|
+
const errorMsg =
|
|
621
|
+
error instanceof Error ? error.message : String(error);
|
|
622
|
+
const summary = `Agent task "${instance.description}" failed: ${errorMsg}`;
|
|
623
|
+
notificationQueue.enqueue(
|
|
624
|
+
`<task-notification>\n<task-id>${instance.backgroundTaskId}</task-id>\n<task-type>agent</task-type>\n<status>failed</status>\n<summary>${summary}</summary>\n</task-notification>`,
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
624
628
|
}
|
|
625
629
|
}
|
|
626
630
|
throw error;
|
package/src/prompts/index.ts
CHANGED
|
@@ -179,28 +179,52 @@ NOTE: At any point in time through this workflow you should feel free to ask the
|
|
|
179
179
|
|
|
180
180
|
export const DEFAULT_SYSTEM_PROMPT = BASE_SYSTEM_PROMPT;
|
|
181
181
|
|
|
182
|
-
export const COMPRESS_MESSAGES_SYSTEM_PROMPT = `You
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
182
|
+
export const COMPRESS_MESSAGES_SYSTEM_PROMPT = `You are continuing work on a software engineering task. Write a detailed 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.
|
|
183
|
+
|
|
184
|
+
First, write your analysis in <analysis> tags as a thinking scratchpad:
|
|
185
|
+
- Chronologically review the conversation
|
|
186
|
+
- Identify user intents and goals
|
|
187
|
+
- Note files read/modified, approaches tried, decisions made
|
|
188
|
+
- Check for accuracy and completeness — ensure nothing critical is missing
|
|
189
|
+
|
|
190
|
+
Then produce a structured summary in <summary> tags with these sections:
|
|
191
|
+
|
|
192
|
+
## Primary Request and Intent
|
|
193
|
+
- The user's core request and success criteria
|
|
194
|
+
- Clarifications, constraints, or scope changes
|
|
195
|
+
|
|
196
|
+
## Key Technical Concepts
|
|
197
|
+
- Frameworks, libraries, patterns, architectural decisions
|
|
198
|
+
|
|
199
|
+
## Files and Code Sections
|
|
200
|
+
- Files read, modified, created (with full paths)
|
|
201
|
+
- Critical code snippets (function signatures, bug fixes, key logic)
|
|
202
|
+
- Focus on recent messages — include full code for important sections
|
|
203
|
+
|
|
204
|
+
## Errors and Fixes
|
|
205
|
+
- Errors encountered, root causes, how they were resolved
|
|
206
|
+
- Approaches tried that didn't work and why
|
|
207
|
+
|
|
208
|
+
## Problem Solving
|
|
209
|
+
- Approach evolution, trade-offs considered, decisions made
|
|
210
|
+
|
|
211
|
+
## All User Messages
|
|
212
|
+
- Complete list of all user messages (non-tool content)
|
|
213
|
+
- Preserve exact wording where load-bearing
|
|
214
|
+
|
|
215
|
+
## Pending Tasks
|
|
216
|
+
- Outstanding work, TODOs, unresolved questions
|
|
217
|
+
|
|
218
|
+
## Current Work
|
|
219
|
+
- What was being worked on at the time of summarization
|
|
220
|
+
- Exact state of in-progress changes
|
|
221
|
+
|
|
222
|
+
## Optional Next Step
|
|
223
|
+
- Immediate next action needed
|
|
224
|
+
- Include verbatim quotes from recent conversation if relevant
|
|
225
|
+
|
|
226
|
+
Be concise but complete — include information that prevents duplicate work or repeated mistakes.
|
|
227
|
+
Respond with text only. Do NOT call any tools.
|
|
204
228
|
Wrap your summary in <summary></summary> tags.`;
|
|
205
229
|
|
|
206
230
|
export const WEB_CONTENT_SYSTEM_PROMPT = `You are a helpful assistant that extracts information from web content. The content is provided in Markdown format.`;
|
|
@@ -214,6 +238,7 @@ export function buildSystemPrompt(
|
|
|
214
238
|
tools: ToolPlugin[],
|
|
215
239
|
options: {
|
|
216
240
|
workdir?: string;
|
|
241
|
+
originalWorkdir?: string;
|
|
217
242
|
memory?: string;
|
|
218
243
|
language?: string;
|
|
219
244
|
isSubagent?: boolean;
|
|
@@ -251,8 +276,9 @@ export function buildSystemPrompt(
|
|
|
251
276
|
prompt += `\n\n${buildPlanModePrompt(options.planMode.planFilePath, options.planMode.planExists, options.isSubagent)}`;
|
|
252
277
|
}
|
|
253
278
|
|
|
254
|
-
|
|
255
|
-
|
|
279
|
+
const workdirForPrompt = options.originalWorkdir || options.workdir;
|
|
280
|
+
if (workdirForPrompt) {
|
|
281
|
+
const isGitRepo = isGitRepository(workdirForPrompt);
|
|
256
282
|
const platform = os.platform();
|
|
257
283
|
const osVersion = `${os.type()} ${os.release()}`;
|
|
258
284
|
const today = new Date().toISOString().split("T")[0];
|
|
@@ -267,7 +293,7 @@ export function buildSystemPrompt(
|
|
|
267
293
|
|
|
268
294
|
Here is useful information about the environment you are running in:
|
|
269
295
|
<env>
|
|
270
|
-
Working directory: ${
|
|
296
|
+
Working directory: ${workdirForPrompt}
|
|
271
297
|
Is directory a git repo: ${isGitRepo}
|
|
272
298
|
Platform: ${platform}
|
|
273
299
|
Shell: ${shellName}
|