wave-agent-sdk 0.8.1 → 0.8.3
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/managers/hookManager.d.ts.map +1 -1
- package/dist/managers/hookManager.js +0 -21
- package/dist/managers/liveConfigManager.d.ts.map +1 -1
- package/dist/managers/liveConfigManager.js +0 -36
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +2 -1
- package/dist/managers/permissionManager.d.ts.map +1 -1
- package/dist/managers/permissionManager.js +47 -29
- package/dist/managers/pluginManager.d.ts.map +1 -1
- package/dist/managers/pluginManager.js +28 -1
- package/dist/managers/skillManager.d.ts.map +1 -1
- package/dist/managers/skillManager.js +8 -2
- package/dist/services/aiService.d.ts.map +1 -1
- package/dist/services/aiService.js +2 -0
- package/dist/services/fileWatcher.d.ts.map +1 -1
- package/dist/services/fileWatcher.js +0 -4
- package/dist/services/initializationService.d.ts.map +1 -1
- package/dist/services/initializationService.js +2 -10
- package/dist/services/pluginLoader.d.ts.map +1 -1
- package/dist/services/pluginLoader.js +1 -3
- package/dist/services/taskManager.d.ts +2 -0
- package/dist/services/taskManager.d.ts.map +1 -1
- package/dist/services/taskManager.js +48 -0
- package/dist/tools/taskManagementTools.d.ts.map +1 -1
- package/dist/tools/taskManagementTools.js +58 -0
- package/dist/tools/taskTool.d.ts.map +1 -1
- package/dist/tools/taskTool.js +60 -50
- package/dist/utils/bashParser.d.ts +4 -0
- package/dist/utils/bashParser.d.ts.map +1 -1
- package/dist/utils/bashParser.js +39 -2
- package/dist/utils/containerSetup.d.ts.map +1 -1
- package/dist/utils/containerSetup.js +3 -0
- package/dist/utils/messageOperations.d.ts +1 -0
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/messageOperations.js +6 -2
- package/dist/utils/openaiClient.d.ts.map +1 -1
- package/dist/utils/openaiClient.js +3 -1
- package/package.json +2 -5
- package/src/managers/hookManager.ts +0 -52
- package/src/managers/liveConfigManager.ts +0 -75
- package/src/managers/messageManager.ts +2 -0
- package/src/managers/permissionManager.ts +60 -37
- package/src/managers/pluginManager.ts +39 -1
- package/src/managers/skillManager.ts +8 -2
- package/src/services/aiService.ts +2 -0
- package/src/services/fileWatcher.ts +0 -8
- package/src/services/initializationService.ts +2 -19
- package/src/services/pluginLoader.ts +1 -3
- package/src/services/taskManager.ts +51 -0
- package/src/tools/taskManagementTools.ts +77 -0
- package/src/tools/taskTool.ts +70 -61
- package/src/utils/bashParser.ts +50 -2
- package/src/utils/containerSetup.ts +3 -0
- package/src/utils/messageOperations.ts +7 -2
- package/src/utils/openaiClient.ts +3 -1
|
@@ -41,7 +41,6 @@ export class InitializationService {
|
|
|
41
41
|
// Initialize hooks configuration
|
|
42
42
|
try {
|
|
43
43
|
// Load hooks configuration using ConfigurationService
|
|
44
|
-
logger?.debug("Loading hooks configuration...");
|
|
45
44
|
const configResult = await configurationService.loadMergedConfiguration(workdir);
|
|
46
45
|
hookManager.loadConfigurationFromWaveConfig(configResult.configuration);
|
|
47
46
|
// Update plugin manager with enabled plugins configuration
|
|
@@ -63,7 +62,6 @@ export class InitializationService {
|
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
|
-
logger?.debug("Hooks system initialized successfully");
|
|
67
65
|
}
|
|
68
66
|
catch (error) {
|
|
69
67
|
logger?.error("Failed to initialize hooks system:", error);
|
|
@@ -103,9 +101,7 @@ export class InitializationService {
|
|
|
103
101
|
}
|
|
104
102
|
// Initialize live configuration reload
|
|
105
103
|
try {
|
|
106
|
-
logger?.debug("Initializing live configuration reload...");
|
|
107
104
|
await liveConfigManager.initialize();
|
|
108
|
-
logger?.debug("Live configuration reload initialized successfully");
|
|
109
105
|
}
|
|
110
106
|
catch (error) {
|
|
111
107
|
logger?.error("Failed to initialize live configuration reload:", error);
|
|
@@ -113,30 +109,26 @@ export class InitializationService {
|
|
|
113
109
|
}
|
|
114
110
|
// Load memory files during initialization
|
|
115
111
|
try {
|
|
116
|
-
logger?.debug("Loading memory files...");
|
|
117
112
|
// Load project memory from AGENTS.md (bypass memory store for direct file access)
|
|
118
113
|
try {
|
|
119
114
|
const projectMemoryPath = path.join(workdir, "AGENTS.md");
|
|
120
115
|
const projectMemoryContent = await fs.readFile(projectMemoryPath, "utf-8");
|
|
121
116
|
setProjectMemory(projectMemoryContent);
|
|
122
|
-
logger?.debug("Project memory loaded successfully");
|
|
123
117
|
}
|
|
124
118
|
catch (error) {
|
|
119
|
+
logger?.warn("Failed to load project memory file:", error);
|
|
125
120
|
setProjectMemory("");
|
|
126
|
-
logger?.debug("Project memory file not found or unreadable, using empty content:", error instanceof Error ? error.message : String(error));
|
|
127
121
|
}
|
|
128
122
|
// Load user memory (bypass memory store for direct file access)
|
|
129
123
|
try {
|
|
130
124
|
const userMemoryPath = path.join(os.homedir(), ".wave", "AGENTS.md");
|
|
131
125
|
const userMemoryContent = await fs.readFile(userMemoryPath, "utf-8");
|
|
132
126
|
setUserMemory(userMemoryContent);
|
|
133
|
-
logger?.debug("User memory loaded successfully");
|
|
134
127
|
}
|
|
135
128
|
catch (error) {
|
|
129
|
+
logger?.warn("Failed to load user memory file:", error);
|
|
136
130
|
setUserMemory("");
|
|
137
|
-
logger?.debug("User memory file not found or unreadable, using empty content:", error instanceof Error ? error.message : String(error));
|
|
138
131
|
}
|
|
139
|
-
logger?.debug("Memory initialization completed");
|
|
140
132
|
}
|
|
141
133
|
catch (error) {
|
|
142
134
|
// Ensure memory is always initialized even if loading fails
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginLoader.d.ts","sourceRoot":"","sources":["../../src/services/pluginLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,SAAS,EACT,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAI3B,qBAAa,YAAY;IACvB;;;OAGG;WACU,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA6CtE;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAW7D;;;OAGG;WACU,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"pluginLoader.d.ts","sourceRoot":"","sources":["../../src/services/pluginLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,SAAS,EACT,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAI3B,qBAAa,YAAY;IACvB;;;OAGG;WACU,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA6CtE;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAW7D;;;OAGG;WACU,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAsC7D;;OAEG;WACU,aAAa,CACxB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAUjC;;OAEG;WACU,aAAa,CACxB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAUjC;;OAEG;WACU,eAAe,CAC1B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAUhD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAgBhC"}
|
|
@@ -73,10 +73,8 @@ export class PluginLoader {
|
|
|
73
73
|
});
|
|
74
74
|
if (parsed.isValid) {
|
|
75
75
|
skills.push({
|
|
76
|
-
|
|
77
|
-
description: parsed.skillMetadata.description,
|
|
76
|
+
...parsed.skillMetadata,
|
|
78
77
|
type: "project", // Plugin skills are treated as project skills
|
|
79
|
-
skillPath: parsed.skillMetadata.skillPath,
|
|
80
78
|
content: parsed.content,
|
|
81
79
|
frontmatter: parsed.frontmatter,
|
|
82
80
|
isValid: parsed.isValid,
|
|
@@ -22,6 +22,8 @@ export declare class TaskManager extends EventEmitter {
|
|
|
22
22
|
createTask(task: Omit<Task, "id">): Promise<string>;
|
|
23
23
|
getTask(taskId: string): Promise<Task | null>;
|
|
24
24
|
updateTask(task: Task): Promise<void>;
|
|
25
|
+
deleteTask(taskId: string): Promise<void>;
|
|
26
|
+
cleanupOldTaskLists(days?: number): Promise<void>;
|
|
25
27
|
listTasks(): Promise<Task[]>;
|
|
26
28
|
getNextTaskId(): Promise<string>;
|
|
27
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskManager.d.ts","sourceRoot":"","sources":["../../src/services/taskManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,qBAAa,WAAY,SAAQ,YAAY;IAKzC,OAAO,CAAC,SAAS;IAJnB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,UAAU,CAAS;gBAGjB,SAAS,EAAE,SAAS,EAC5B,UAAU,EAAE,MAAM;IAOb,aAAa,IAAI,MAAM;IAIvB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAI9C;;;OAGG;IACU,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAW7C,OAAO,CAAC,aAAa;IAId,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI1C,OAAO,CAAC,WAAW;IAIb,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;YAIzB,QAAQ;IA2CtB,OAAO,CAAC,YAAY;IAed,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,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AG,IAAI,CAAC;IAmB7C,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBzC,mBAAmB,CAAC,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCrD,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IA+B5B,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IActC;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3C"}
|
|
@@ -134,6 +134,54 @@ export class TaskManager extends EventEmitter {
|
|
|
134
134
|
logger.debug(`Task ${task.id} updated in task list ${this.taskListId}`);
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
+
async deleteTask(taskId) {
|
|
138
|
+
await this.withLock(async () => {
|
|
139
|
+
const taskPath = this.getTaskPath(taskId);
|
|
140
|
+
try {
|
|
141
|
+
await fs.unlink(taskPath);
|
|
142
|
+
this.emit("tasksChange", this.taskListId);
|
|
143
|
+
logger.debug(`Task ${taskId} deleted from task list ${this.taskListId}`);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
if (error.code !== "ENOENT") {
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async cleanupOldTaskLists(days = 30) {
|
|
153
|
+
const threshold = Date.now() - days * 24 * 60 * 60 * 1000;
|
|
154
|
+
try {
|
|
155
|
+
const dirs = await fs.readdir(this.baseDir);
|
|
156
|
+
for (const dir of dirs) {
|
|
157
|
+
if (dir === this.taskListId)
|
|
158
|
+
continue;
|
|
159
|
+
const dirPath = join(this.baseDir, dir);
|
|
160
|
+
const stats = await fs.stat(dirPath);
|
|
161
|
+
if (!stats.isDirectory())
|
|
162
|
+
continue;
|
|
163
|
+
// Check mtime of the directory and its contents
|
|
164
|
+
let latestMtime = stats.mtimeMs;
|
|
165
|
+
const files = await fs.readdir(dirPath);
|
|
166
|
+
for (const file of files) {
|
|
167
|
+
const filePath = join(dirPath, file);
|
|
168
|
+
const fileStats = await fs.stat(filePath);
|
|
169
|
+
if (fileStats.mtimeMs > latestMtime) {
|
|
170
|
+
latestMtime = fileStats.mtimeMs;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (latestMtime < threshold) {
|
|
174
|
+
logger.info(`Cleaning up old task list directory: ${dirPath}`);
|
|
175
|
+
await fs.rm(dirPath, { recursive: true, force: true });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
if (error.code !== "ENOENT") {
|
|
181
|
+
logger.error("Failed to cleanup old task lists:", error);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
137
185
|
async listTasks() {
|
|
138
186
|
const sessionDir = this.getSessionDir();
|
|
139
187
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskManagementTools.d.ts","sourceRoot":"","sources":["../../src/tools/taskManagementTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AASjE,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"taskManagementTools.d.ts","sourceRoot":"","sources":["../../src/tools/taskManagementTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AASjE,eAAO,MAAM,cAAc,EAAE,UAoI5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,UAyDzB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,UAgW5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAkE1B,CAAC"}
|
|
@@ -91,6 +91,13 @@ NOTE that you should not use this tool if there is only one trivial task to do.
|
|
|
91
91
|
- Check TaskList first to avoid creating duplicate tasks`,
|
|
92
92
|
execute: async (args, context) => {
|
|
93
93
|
const taskManager = context.taskManager;
|
|
94
|
+
if (args.status === "deleted") {
|
|
95
|
+
return {
|
|
96
|
+
success: true,
|
|
97
|
+
content: `Task creation skipped because status was set to 'deleted'.`,
|
|
98
|
+
shortResult: `Skipped deleted task`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
94
101
|
const task = {
|
|
95
102
|
subject: args.subject,
|
|
96
103
|
description: args.description,
|
|
@@ -309,6 +316,57 @@ Set up task dependencies:
|
|
|
309
316
|
content: `Task with ID ${taskId} not found.`,
|
|
310
317
|
};
|
|
311
318
|
}
|
|
319
|
+
if (args.status === "deleted") {
|
|
320
|
+
// Reciprocal Dependency Cleanup
|
|
321
|
+
// For each task in the deleted task's blocks list, remove the deleted task's ID from their blockedBy list.
|
|
322
|
+
for (const targetId of existingTask.blocks) {
|
|
323
|
+
const targetTask = await taskManager.getTask(targetId);
|
|
324
|
+
if (targetTask && targetTask.blockedBy.includes(taskId)) {
|
|
325
|
+
let targetSnapshotId;
|
|
326
|
+
if (context.reversionManager && context.messageId) {
|
|
327
|
+
const targetPath = taskManager.getTaskPath(targetId);
|
|
328
|
+
targetSnapshotId = await context.reversionManager.recordSnapshot(context.messageId, targetPath, "modify");
|
|
329
|
+
}
|
|
330
|
+
await taskManager.updateTask({
|
|
331
|
+
...targetTask,
|
|
332
|
+
blockedBy: targetTask.blockedBy.filter((id) => id !== taskId),
|
|
333
|
+
});
|
|
334
|
+
if (context.reversionManager && targetSnapshotId) {
|
|
335
|
+
await context.reversionManager.commitSnapshot(targetSnapshotId);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
// For each task in the deleted task's blockedBy list, remove the deleted task's ID from their blocks list.
|
|
340
|
+
for (const targetId of existingTask.blockedBy) {
|
|
341
|
+
const targetTask = await taskManager.getTask(targetId);
|
|
342
|
+
if (targetTask && targetTask.blocks.includes(taskId)) {
|
|
343
|
+
let targetSnapshotId;
|
|
344
|
+
if (context.reversionManager && context.messageId) {
|
|
345
|
+
const targetPath = taskManager.getTaskPath(targetId);
|
|
346
|
+
targetSnapshotId = await context.reversionManager.recordSnapshot(context.messageId, targetPath, "modify");
|
|
347
|
+
}
|
|
348
|
+
await taskManager.updateTask({
|
|
349
|
+
...targetTask,
|
|
350
|
+
blocks: targetTask.blocks.filter((id) => id !== taskId),
|
|
351
|
+
});
|
|
352
|
+
if (context.reversionManager && targetSnapshotId) {
|
|
353
|
+
await context.reversionManager.commitSnapshot(targetSnapshotId);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// Record delete snapshot for the task itself
|
|
358
|
+
if (context.reversionManager && context.messageId) {
|
|
359
|
+
const taskPath = taskManager.getTaskPath(taskId);
|
|
360
|
+
const deleteSnapshotId = await context.reversionManager.recordSnapshot(context.messageId, taskPath, "delete");
|
|
361
|
+
await context.reversionManager.commitSnapshot(deleteSnapshotId);
|
|
362
|
+
}
|
|
363
|
+
await taskManager.deleteTask(taskId);
|
|
364
|
+
return {
|
|
365
|
+
success: true,
|
|
366
|
+
content: `Task #${taskId} deleted and removed from disk.`,
|
|
367
|
+
shortResult: `Deleted task ${taskId}`,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
312
370
|
let snapshotId;
|
|
313
371
|
if (context.reversionManager && context.messageId) {
|
|
314
372
|
const taskPath = taskManager.getTaskPath(taskId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAStE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"taskTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAStE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UA8OtB,CAAC"}
|
package/dist/tools/taskTool.js
CHANGED
|
@@ -129,56 +129,66 @@ ${subagentList || "No subagents configured"}
|
|
|
129
129
|
shortResult += summary;
|
|
130
130
|
context.onShortResultUpdate?.(shortResult);
|
|
131
131
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
132
|
+
return new Promise((resolve) => {
|
|
133
|
+
(async () => {
|
|
134
|
+
// Register for backgrounding if not already in background
|
|
135
|
+
if (!run_in_background && context.foregroundTaskManager) {
|
|
136
|
+
context.foregroundTaskManager.registerForegroundTask({
|
|
137
|
+
id: instance.subagentId,
|
|
138
|
+
backgroundHandler: async () => {
|
|
139
|
+
isBackgrounded = true;
|
|
140
|
+
await subagentManager.backgroundInstance(instance.subagentId);
|
|
141
|
+
resolve({
|
|
142
|
+
success: true,
|
|
143
|
+
content: "Task backgrounded",
|
|
144
|
+
shortResult: "Task backgrounded",
|
|
145
|
+
isManuallyBackgrounded: true,
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
const result = await subagentManager.executeTask(instance, prompt, context.abortSignal, run_in_background);
|
|
152
|
+
if (isBackgrounded) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (run_in_background) {
|
|
156
|
+
resolve({
|
|
157
|
+
success: true,
|
|
158
|
+
content: `Task started in background with ID: ${result}`,
|
|
159
|
+
shortResult: `Task started in background: ${result}`,
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
// Cleanup subagent instance after task completion
|
|
164
|
+
subagentManager.cleanupInstance(instance.subagentId);
|
|
165
|
+
const messages = instance.messageManager.getMessages();
|
|
166
|
+
const tokens = instance.messageManager.getlatestTotalTokens();
|
|
167
|
+
const toolCount = countToolBlocks(messages);
|
|
168
|
+
const summary = formatToolTokenSummary(toolCount, tokens);
|
|
169
|
+
resolve({
|
|
170
|
+
success: true,
|
|
171
|
+
content: result,
|
|
172
|
+
shortResult: `Task completed${summary ? ` ${summary}` : ""}`,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
if (!isBackgrounded) {
|
|
177
|
+
resolve({
|
|
178
|
+
success: false,
|
|
179
|
+
content: "",
|
|
180
|
+
error: `Task delegation failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
181
|
+
shortResult: "Delegation error",
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
if (!run_in_background && context.foregroundTaskManager) {
|
|
187
|
+
context.foregroundTaskManager.unregisterForegroundTask(instance.subagentId);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
})();
|
|
191
|
+
});
|
|
182
192
|
}
|
|
183
193
|
catch (error) {
|
|
184
194
|
return {
|
|
@@ -11,6 +11,10 @@ export declare function stripEnvVars(command: string): string;
|
|
|
11
11
|
* Removes redirections (e.g., echo "data" > output.txt -> echo "data").
|
|
12
12
|
*/
|
|
13
13
|
export declare function stripRedirections(command: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if a bash command contains any write redirections (>, >>, &>, 2>, >|).
|
|
16
|
+
*/
|
|
17
|
+
export declare function hasWriteRedirections(command: string): boolean;
|
|
14
18
|
/**
|
|
15
19
|
* Blacklist of dangerous commands that should not be safely prefix-matched
|
|
16
20
|
* and should not have persistent permissions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bashParser.d.ts","sourceRoot":"","sources":["../../src/utils/bashParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"bashParser.d.ts","sourceRoot":"","sources":["../../src/utils/bashParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAmH1D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA2CpD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAuHzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsC7D;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAa9B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAuL7D"}
|
package/dist/utils/bashParser.js
CHANGED
|
@@ -98,8 +98,11 @@ export function splitBashCommand(command) {
|
|
|
98
98
|
parts.push(lastPart);
|
|
99
99
|
const finalResult = [];
|
|
100
100
|
for (const part of parts) {
|
|
101
|
-
const
|
|
102
|
-
|
|
101
|
+
const envStripped = stripEnvVars(part);
|
|
102
|
+
const stripped = stripRedirections(envStripped);
|
|
103
|
+
if (stripped.startsWith("(") &&
|
|
104
|
+
stripped.endsWith(")") &&
|
|
105
|
+
stripped === envStripped) {
|
|
103
106
|
const inner = stripped.substring(1, stripped.length - 1).trim();
|
|
104
107
|
if (inner) {
|
|
105
108
|
finalResult.push(...splitBashCommand(inner));
|
|
@@ -268,6 +271,40 @@ export function stripRedirections(command) {
|
|
|
268
271
|
}
|
|
269
272
|
return result.trim();
|
|
270
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Checks if a bash command contains any write redirections (>, >>, &>, 2>, >|).
|
|
276
|
+
*/
|
|
277
|
+
export function hasWriteRedirections(command) {
|
|
278
|
+
let inSingleQuote = false;
|
|
279
|
+
let inDoubleQuote = false;
|
|
280
|
+
let escaped = false;
|
|
281
|
+
for (let i = 0; i < command.length; i++) {
|
|
282
|
+
const char = command[i];
|
|
283
|
+
if (escaped) {
|
|
284
|
+
escaped = false;
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (char === "\\") {
|
|
288
|
+
escaped = true;
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
if (char === "'" && !inDoubleQuote) {
|
|
292
|
+
inSingleQuote = !inSingleQuote;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (char === '"' && !inSingleQuote) {
|
|
296
|
+
inDoubleQuote = !inDoubleQuote;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (inSingleQuote || inDoubleQuote) {
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (char === ">") {
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
271
308
|
/**
|
|
272
309
|
* Blacklist of dangerous commands that should not be safely prefix-matched
|
|
273
310
|
* and should not have persistent permissions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerSetup.d.ts","sourceRoot":"","sources":["../../src/utils/containerSetup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,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S,CAgOX"}
|
|
@@ -55,6 +55,9 @@ export function setupAgentContainer(setupOptions) {
|
|
|
55
55
|
const tasks = await taskManager.listTasks();
|
|
56
56
|
onTasksChange(tasks);
|
|
57
57
|
});
|
|
58
|
+
taskManager.cleanupOldTaskLists(30).catch((error) => {
|
|
59
|
+
logger.error("Failed to cleanup old task lists:", error);
|
|
60
|
+
});
|
|
58
61
|
const backgroundTaskManager = new BackgroundTaskManager(container, {
|
|
59
62
|
callbacks: {
|
|
60
63
|
...callbacks,
|
|
@@ -65,6 +65,7 @@ export interface CompleteBangParams {
|
|
|
65
65
|
* @returns base64 format image data URL
|
|
66
66
|
*/
|
|
67
67
|
export declare const convertImageToBase64: (imagePath: string) => string;
|
|
68
|
+
export declare const generateMessageId: () => string;
|
|
68
69
|
export declare const addUserMessageToMessages: ({ messages, content, images, customCommandContent, source, }: AddUserMessageParams) => Message[];
|
|
69
70
|
export declare const addAssistantMessageToMessages: (messages: Message[], content?: string, toolCalls?: ChatCompletionMessageFunctionToolCall[], usage?: Usage, additionalFields?: Record<string, unknown>) => Message[];
|
|
70
71
|
export declare const updateToolBlockInMessage: ({ messages, id, parameters, result, success, error, stage, name, shortResult, startLineNumber, images, compactParams, parametersChunk, isManuallyBackgrounded, }: UpdateToolBlockParams) => Message[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageOperations.d.ts","sourceRoot":"","sources":["../../src/utils/messageOperations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messageOperations.d.ts","sourceRoot":"","sources":["../../src/utils/messageOperations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAI5E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MA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,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,CAUR"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from "crypto";
|
|
1
2
|
import { readFileSync } from "fs";
|
|
2
3
|
import { extname } from "path";
|
|
3
4
|
import { logger } from "./globalLogger.js";
|
|
@@ -41,6 +42,7 @@ export const convertImageToBase64 = (imagePath) => {
|
|
|
41
42
|
return `data:image/png;base64,`; // Empty base64, avoid program crash
|
|
42
43
|
}
|
|
43
44
|
};
|
|
45
|
+
export const generateMessageId = () => `msg-${randomUUID()}`;
|
|
44
46
|
// Add user message
|
|
45
47
|
export const addUserMessageToMessages = ({ messages, content, images, customCommandContent, source, }) => {
|
|
46
48
|
const blocks = [];
|
|
@@ -61,7 +63,7 @@ export const addUserMessageToMessages = ({ messages, content, images, customComm
|
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
const userMessage = {
|
|
64
|
-
id:
|
|
66
|
+
id: generateMessageId(),
|
|
65
67
|
role: "user",
|
|
66
68
|
blocks,
|
|
67
69
|
};
|
|
@@ -88,7 +90,7 @@ export const addAssistantMessageToMessages = (messages, content, toolCalls, usag
|
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
92
|
const initialAssistantMessage = {
|
|
91
|
-
id:
|
|
93
|
+
id: generateMessageId(),
|
|
92
94
|
role: "assistant",
|
|
93
95
|
blocks,
|
|
94
96
|
usage, // Include usage data if provided
|
|
@@ -174,6 +176,7 @@ export const addErrorBlockToMessage = ({ messages, error, }) => {
|
|
|
174
176
|
else {
|
|
175
177
|
// If the last message is not an assistant message, create a new assistant message
|
|
176
178
|
newMessages.push({
|
|
179
|
+
id: generateMessageId(),
|
|
177
180
|
role: "assistant",
|
|
178
181
|
blocks: [
|
|
179
182
|
{
|
|
@@ -188,6 +191,7 @@ export const addErrorBlockToMessage = ({ messages, error, }) => {
|
|
|
188
191
|
// Add bang block to message list
|
|
189
192
|
export const addBangMessage = ({ messages, command, }) => {
|
|
190
193
|
const outputMessage = {
|
|
194
|
+
id: generateMessageId(),
|
|
191
195
|
role: "user",
|
|
192
196
|
blocks: [
|
|
193
197
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openaiClient.d.ts","sourceRoot":"","sources":["../../src/utils/openaiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,mCAAmC,EACnC,mBAAmB,EACnB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,KAAK,YAAY,GACb,sCAAsC,GACtC,mCAAmC,CAAC;AAExC,UAAU,WAAW,CAAC,CAAC;IACrB,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,UAAU,UAAU,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IACxC,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC;AAED,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC,IAAI,IAAI;;qBAGO,CAAC,SAAS,YAAY,UACrB,CAAC,YACC;gBAAE,MAAM,CAAC,EAAE,WAAW,CAAA;aAAE,KACjC,UAAU,CACX,CAAC,SAAS,mCAAmC,GACzC,aAAa,CAAC,mBAAmB,CAAC,GAClC,cAAc,CACnB;;
|
|
1
|
+
{"version":3,"file":"openaiClient.d.ts","sourceRoot":"","sources":["../../src/utils/openaiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,mCAAmC,EACnC,mBAAmB,EACnB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,KAAK,YAAY,GACb,sCAAsC,GACtC,mCAAmC,CAAC;AAExC,UAAU,WAAW,CAAC,CAAC;IACrB,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,UAAU,UAAU,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IACxC,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC;AAED,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC,IAAI,IAAI;;qBAGO,CAAC,SAAS,YAAY,UACrB,CAAC,YACC;gBAAE,MAAM,CAAC,EAAE,WAAW,CAAA;aAAE,KACjC,UAAU,CACX,CAAC,SAAS,mCAAmC,GACzC,aAAa,CAAC,mBAAmB,CAAC,GAClC,cAAc,CACnB;;MA2BN;YAEa,OAAO;YAgIN,oBAAoB;CAqCpC"}
|
|
@@ -12,7 +12,9 @@ export class OpenAIClient {
|
|
|
12
12
|
promise.withResponse = () => responsePromise;
|
|
13
13
|
// Prevent unhandled rejection if only withResponse() is used
|
|
14
14
|
promise.catch((e) => {
|
|
15
|
-
|
|
15
|
+
if (!(e instanceof Error && e.name === "AbortError")) {
|
|
16
|
+
logger.error("Unhandled OpenAI promise rejection:", e);
|
|
17
|
+
}
|
|
16
18
|
});
|
|
17
19
|
return promise;
|
|
18
20
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-agent-sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "SDK for building AI-powered development tools and agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -49,9 +49,6 @@
|
|
|
49
49
|
"test": "vitest run --reporter=dot",
|
|
50
50
|
"test:coverage": "vitest run --coverage --reporter=dot",
|
|
51
51
|
"lint": "eslint --cache",
|
|
52
|
-
"format": "prettier --write ."
|
|
53
|
-
"version:patch": "node ../../scripts/version.js patch",
|
|
54
|
-
"version:minor": "node ../../scripts/version.js minor",
|
|
55
|
-
"version:major": "node ../../scripts/version.js major"
|
|
52
|
+
"format": "prettier --write ."
|
|
56
53
|
}
|
|
57
54
|
}
|