wave-agent-sdk 1.0.5 → 1.0.6
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 +23 -1
- package/dist/agent.js +34 -4
- package/dist/managers/aiManager.d.ts +36 -0
- package/dist/managers/aiManager.js +240 -8
- package/dist/managers/messageManager.d.ts +1 -3
- package/dist/managers/messageManager.js +13 -6
- package/dist/managers/slashCommandManager.js +28 -0
- package/dist/managers/subagentManager.d.ts +0 -2
- package/dist/telemetry/instrumentation.d.ts +1 -1
- package/dist/telemetry/instrumentation.js +57 -28
- package/dist/tools/bashTool.js +16 -6
- package/dist/tools/grepTool.js +11 -3
- package/dist/types/index.d.ts +3 -0
- package/dist/types/messaging.d.ts +2 -0
- package/dist/utils/containerSetup.js +0 -3
- package/dist/utils/messageOperations.d.ts +2 -1
- package/dist/utils/messageOperations.js +2 -1
- package/dist/utils/notificationXml.js +5 -0
- package/dist/utils/ripgrep.d.ts +4 -4
- package/dist/utils/ripgrep.js +4 -27
- package/package.json +20 -8
- package/bin/rg +0 -79
- package/dist/managers/forkedAgentManager.d.ts +0 -50
- package/dist/managers/forkedAgentManager.js +0 -130
- package/scripts/install_ripgrep.js +0 -111
- package/scripts/postinstall.js +0 -38
- package/src/agent.ts +0 -1271
- package/src/constants/subagents.ts +0 -4
- package/src/constants/toolLimits.ts +0 -15
- package/src/constants/tools.ts +0 -24
- package/src/core/plugin.ts +0 -237
- package/src/core/session.ts +0 -9
- package/src/index.ts +0 -38
- package/src/managers/MemoryRuleManager.ts +0 -198
- package/src/managers/aiManager.ts +0 -2429
- package/src/managers/backgroundTaskManager.ts +0 -480
- package/src/managers/bangManager.ts +0 -119
- package/src/managers/cronManager.ts +0 -401
- package/src/managers/foregroundTaskManager.ts +0 -30
- package/src/managers/forkedAgentManager.ts +0 -216
- package/src/managers/hookManager.ts +0 -1089
- package/src/managers/liveConfigManager.ts +0 -445
- package/src/managers/lspManager.ts +0 -470
- package/src/managers/mcpManager.ts +0 -1010
- package/src/managers/messageManager.ts +0 -1184
- package/src/managers/messageQueue.ts +0 -157
- package/src/managers/permissionManager.ts +0 -1140
- package/src/managers/planManager.ts +0 -112
- package/src/managers/pluginManager.ts +0 -330
- package/src/managers/pluginScopeManager.ts +0 -124
- package/src/managers/reversionManager.ts +0 -178
- package/src/managers/skillManager.ts +0 -578
- package/src/managers/slashCommandManager.ts +0 -564
- package/src/managers/subagentManager.ts +0 -915
- package/src/managers/toolManager.ts +0 -489
- package/src/managers/workflowManager.ts +0 -493
- package/src/prompts/autoMemory.ts +0 -33
- package/src/prompts/autoMemoryExtraction.ts +0 -146
- package/src/prompts/index.ts +0 -506
- package/src/prompts/planModeReminders.ts +0 -126
- package/src/services/GitService.ts +0 -131
- package/src/services/MarketplaceService.ts +0 -1052
- package/src/services/MemoryRuleService.ts +0 -71
- package/src/services/aiService.ts +0 -919
- package/src/services/authService.ts +0 -565
- package/src/services/autoMemoryService.ts +0 -280
- package/src/services/configurationService.ts +0 -1520
- package/src/services/fileWatcher.ts +0 -319
- package/src/services/hook.ts +0 -348
- package/src/services/initializationService.ts +0 -357
- package/src/services/interactionService.ts +0 -229
- package/src/services/jsonlHandler.ts +0 -295
- package/src/services/memory.ts +0 -234
- package/src/services/pluginLoader.ts +0 -252
- package/src/services/remoteSettingsService.ts +0 -366
- package/src/services/reversionService.ts +0 -122
- package/src/services/session.ts +0 -917
- package/src/services/taskManager.ts +0 -321
- package/src/telemetry/events.ts +0 -65
- package/src/telemetry/instrumentation.ts +0 -499
- package/src/telemetry/sessionTracing.ts +0 -348
- package/src/tools/agentTool.ts +0 -322
- package/src/tools/askUserQuestion.ts +0 -160
- package/src/tools/bashTool.ts +0 -621
- package/src/tools/buildTool.ts +0 -61
- package/src/tools/cronCreateTool.ts +0 -161
- package/src/tools/cronDeleteTool.ts +0 -51
- package/src/tools/cronListTool.ts +0 -47
- package/src/tools/editTool.ts +0 -313
- package/src/tools/enterPlanMode.ts +0 -124
- package/src/tools/enterWorktreeTool.ts +0 -190
- package/src/tools/exitPlanMode.ts +0 -139
- package/src/tools/exitWorktreeTool.ts +0 -236
- package/src/tools/globTool.ts +0 -167
- package/src/tools/grepTool.ts +0 -399
- package/src/tools/lspTool.ts +0 -883
- package/src/tools/readTool.ts +0 -426
- package/src/tools/skillTool.ts +0 -248
- package/src/tools/taskManagementTools.ts +0 -574
- package/src/tools/taskStopTool.ts +0 -78
- package/src/tools/types.ts +0 -137
- package/src/tools/webFetchTool.ts +0 -373
- package/src/tools/workflowTool.ts +0 -205
- package/src/tools/writeTool.ts +0 -267
- package/src/types/agent.ts +0 -128
- package/src/types/auth.ts +0 -19
- package/src/types/commands.ts +0 -30
- package/src/types/config.ts +0 -43
- package/src/types/configuration.ts +0 -168
- package/src/types/core.ts +0 -105
- package/src/types/cron.ts +0 -13
- package/src/types/environment.ts +0 -106
- package/src/types/fileSearch.ts +0 -4
- package/src/types/history.ts +0 -7
- package/src/types/hooks.ts +0 -256
- package/src/types/index.ts +0 -41
- package/src/types/lsp.ts +0 -98
- package/src/types/marketplace.ts +0 -71
- package/src/types/mcp.ts +0 -43
- package/src/types/memoryRule.ts +0 -31
- package/src/types/messaging.ts +0 -114
- package/src/types/permissions.ts +0 -80
- package/src/types/plugins.ts +0 -39
- package/src/types/processes.ts +0 -99
- package/src/types/reversion.ts +0 -29
- package/src/types/session.ts +0 -12
- package/src/types/skills.ts +0 -108
- package/src/types/tasks.ts +0 -13
- package/src/types/telemetry.ts +0 -98
- package/src/types/tools.ts +0 -44
- package/src/types/workflow.ts +0 -6
- package/src/utils/abortUtils.ts +0 -118
- package/src/utils/atomicWrite.ts +0 -61
- package/src/utils/bashParser.ts +0 -899
- package/src/utils/cacheControlUtils.ts +0 -426
- package/src/utils/commandArgumentParser.ts +0 -161
- package/src/utils/commandPathResolver.ts +0 -88
- package/src/utils/configPaths.ts +0 -220
- package/src/utils/configValidator.ts +0 -100
- package/src/utils/constants.ts +0 -39
- package/src/utils/container.ts +0 -92
- package/src/utils/containerSetup.ts +0 -371
- package/src/utils/convertMessagesForAPI.ts +0 -326
- package/src/utils/cronTasks.ts +0 -128
- package/src/utils/cronTasksLock.ts +0 -182
- package/src/utils/cronToHuman.ts +0 -99
- package/src/utils/customCommands.ts +0 -95
- package/src/utils/editUtils.ts +0 -20
- package/src/utils/fileFormat.ts +0 -40
- package/src/utils/fileSearch.ts +0 -151
- package/src/utils/fileUtils.ts +0 -223
- package/src/utils/gitUtils.ts +0 -315
- package/src/utils/globalLogger.ts +0 -128
- package/src/utils/groupMessagesByApiRound.ts +0 -121
- package/src/utils/hookMatcher.ts +0 -176
- package/src/utils/markdownParser.ts +0 -317
- package/src/utils/mcpUtils.ts +0 -138
- package/src/utils/messageOperations.ts +0 -659
- package/src/utils/modelCapabilities.ts +0 -30
- package/src/utils/nameGenerator.ts +0 -99
- package/src/utils/notificationXml.ts +0 -57
- package/src/utils/openaiClient.ts +0 -251
- package/src/utils/parseCronExpression.ts +0 -78
- package/src/utils/path.ts +0 -72
- package/src/utils/pathEncoder.ts +0 -400
- package/src/utils/pathSafety.ts +0 -40
- package/src/utils/promptHistory.ts +0 -168
- package/src/utils/ripgrep.ts +0 -35
- package/src/utils/shellResolver.ts +0 -190
- package/src/utils/skillParser.ts +0 -246
- package/src/utils/stringUtils.ts +0 -156
- package/src/utils/subagentParser.ts +0 -279
- package/src/utils/taskReminder.ts +0 -96
- package/src/utils/tokenCalculation.ts +0 -43
- package/src/utils/tokenEstimate.ts +0 -34
- package/src/utils/toolResultStorage.ts +0 -117
- package/src/utils/worktreeSession.ts +0 -26
- package/src/utils/worktreeUtils.ts +0 -786
- package/src/workflow/budgetTracker.ts +0 -34
- package/src/workflow/concurrencyLimiter.ts +0 -47
- package/src/workflow/journal.ts +0 -95
- package/src/workflow/progressReporter.ts +0 -141
- package/src/workflow/runState.ts +0 -65
- package/src/workflow/scriptRuntime.ts +0 -274
- package/src/workflow/structuredOutput.ts +0 -123
- package/src/workflow/types.ts +0 -101
- package/src/workflow/workflowApis.ts +0 -410
- package/vendor/ripgrep/linux-aarch64/rg +0 -0
- package/vendor/ripgrep/linux-x86_64/rg +0 -0
- package/vendor/ripgrep/macos-aarch64/rg +0 -0
- package/vendor/ripgrep/macos-x86_64/rg +0 -0
- package/vendor/ripgrep/windows-aarch64/rg.exe +0 -0
- package/vendor/ripgrep/windows-x86_64/rg.exe +0 -0
|
@@ -8,13 +8,17 @@ import { logger } from "../utils/globalLogger.js";
|
|
|
8
8
|
import * as fs from "node:fs";
|
|
9
9
|
import { AuthService, getOrCreateAnonymousId, } from "../services/authService.js";
|
|
10
10
|
// Lazy-loaded OTEL modules — only imported when telemetry is initialized
|
|
11
|
-
let
|
|
11
|
+
let sdkTraceBase;
|
|
12
|
+
let otelResources;
|
|
12
13
|
let api;
|
|
14
|
+
let apiLogs;
|
|
13
15
|
let sdkLogs;
|
|
14
16
|
let exporterTraceOtlpHttp;
|
|
15
17
|
let exporterLogsOtlpHttp;
|
|
16
|
-
/** Internal
|
|
17
|
-
let
|
|
18
|
+
/** Internal trace provider instance */
|
|
19
|
+
let tracerProvider;
|
|
20
|
+
/** Internal log provider instance */
|
|
21
|
+
let loggerProvider;
|
|
18
22
|
/** Whether telemetry has been initialized */
|
|
19
23
|
let initialized = false;
|
|
20
24
|
/** Current resolved config */
|
|
@@ -34,14 +38,23 @@ function resolveTelemetryFilePath() {
|
|
|
34
38
|
async function loadOTELModules() {
|
|
35
39
|
if (api)
|
|
36
40
|
return; // Already loaded
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
[
|
|
42
|
+
sdkTraceBase,
|
|
43
|
+
otelResources,
|
|
44
|
+
api,
|
|
45
|
+
apiLogs,
|
|
46
|
+
sdkLogs,
|
|
47
|
+
exporterTraceOtlpHttp,
|
|
48
|
+
exporterLogsOtlpHttp,
|
|
49
|
+
] = await Promise.all([
|
|
50
|
+
import("@opentelemetry/sdk-trace-base"),
|
|
51
|
+
import("@opentelemetry/resources"),
|
|
52
|
+
import("@opentelemetry/api"),
|
|
53
|
+
import("@opentelemetry/api-logs"),
|
|
54
|
+
import("@opentelemetry/sdk-logs"),
|
|
55
|
+
import("@opentelemetry/exporter-trace-otlp-http"),
|
|
56
|
+
import("@opentelemetry/exporter-logs-otlp-http"),
|
|
57
|
+
]);
|
|
45
58
|
}
|
|
46
59
|
/**
|
|
47
60
|
* Resolve the exporter target from environment variable or config.
|
|
@@ -281,33 +294,43 @@ export async function initializeTelemetry(config) {
|
|
|
281
294
|
return;
|
|
282
295
|
}
|
|
283
296
|
const { tracesExporter, logsExporter } = currentConfig;
|
|
284
|
-
// Build resource attributes
|
|
285
|
-
const
|
|
286
|
-
const resource = resources.defaultResource().merge(resources.resourceFromAttributes({
|
|
297
|
+
// Build resource attributes (lightweight assembly: sdk-trace-base + resources)
|
|
298
|
+
const resource = otelResources.defaultResource().merge(otelResources.resourceFromAttributes({
|
|
287
299
|
"service.name": "wave",
|
|
288
300
|
"service.version": process.env.npm_package_version || "unknown",
|
|
289
301
|
"os.type": process.platform,
|
|
290
302
|
"host.arch": process.arch,
|
|
291
303
|
}));
|
|
292
|
-
|
|
293
|
-
const nodeSdkOptions = { resource };
|
|
304
|
+
const spanProcessors = [];
|
|
294
305
|
if (tracesExporter === "otlp" && currentConfig.endpoint) {
|
|
295
|
-
|
|
306
|
+
spanProcessors.push(new sdkTraceBase.BatchSpanProcessor(createOTLPTraceExporter(currentConfig)));
|
|
296
307
|
}
|
|
297
308
|
else if (tracesExporter === "jsonl") {
|
|
298
|
-
|
|
309
|
+
spanProcessors.push(new sdkTraceBase.BatchSpanProcessor(new JsonlSpanExporter()));
|
|
299
310
|
}
|
|
300
|
-
|
|
311
|
+
const logProcessors = [];
|
|
301
312
|
if (logsExporter === "otlp" && currentConfig.endpoint) {
|
|
302
|
-
|
|
313
|
+
logProcessors.push(new sdkLogs.BatchLogRecordProcessor(createOTLPLogExporter(currentConfig)));
|
|
303
314
|
}
|
|
304
315
|
else if (logsExporter === "jsonl") {
|
|
305
|
-
|
|
316
|
+
logProcessors.push(new sdkLogs.BatchLogRecordProcessor(new JsonlLogExporter()));
|
|
306
317
|
}
|
|
307
|
-
// Only initialize
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
|
|
318
|
+
// Only initialize providers if at least one exporter is configured
|
|
319
|
+
if (spanProcessors.length > 0 || logProcessors.length > 0) {
|
|
320
|
+
if (spanProcessors.length > 0) {
|
|
321
|
+
tracerProvider = new sdkTraceBase.BasicTracerProvider({
|
|
322
|
+
resource,
|
|
323
|
+
spanProcessors,
|
|
324
|
+
});
|
|
325
|
+
api.trace.setGlobalTracerProvider(tracerProvider);
|
|
326
|
+
}
|
|
327
|
+
if (logProcessors.length > 0) {
|
|
328
|
+
loggerProvider = new sdkLogs.LoggerProvider({
|
|
329
|
+
resource,
|
|
330
|
+
processors: logProcessors,
|
|
331
|
+
});
|
|
332
|
+
apiLogs.logs.setGlobalLoggerProvider(loggerProvider);
|
|
333
|
+
}
|
|
311
334
|
initialized = true;
|
|
312
335
|
logger?.info("OpenTelemetry initialized", {
|
|
313
336
|
tracesExporter,
|
|
@@ -329,7 +352,7 @@ export async function initializeTelemetry(config) {
|
|
|
329
352
|
* Respects shutdownTimeoutMs config.
|
|
330
353
|
*/
|
|
331
354
|
export async function shutdownTelemetry() {
|
|
332
|
-
if (!
|
|
355
|
+
if (!tracerProvider && !loggerProvider) {
|
|
333
356
|
return;
|
|
334
357
|
}
|
|
335
358
|
try {
|
|
@@ -337,14 +360,20 @@ export async function shutdownTelemetry() {
|
|
|
337
360
|
const timeoutPromise = new Promise((_, reject) => {
|
|
338
361
|
setTimeout(() => reject(new Error("Telemetry shutdown timed out")), timeout);
|
|
339
362
|
});
|
|
340
|
-
|
|
363
|
+
const shutdowns = [];
|
|
364
|
+
if (tracerProvider)
|
|
365
|
+
shutdowns.push(tracerProvider.shutdown());
|
|
366
|
+
if (loggerProvider)
|
|
367
|
+
shutdowns.push(loggerProvider.shutdown());
|
|
368
|
+
await Promise.race([Promise.all(shutdowns), timeoutPromise]);
|
|
341
369
|
logger?.debug("OpenTelemetry shut down successfully");
|
|
342
370
|
}
|
|
343
371
|
catch (error) {
|
|
344
372
|
logger?.warn("OpenTelemetry shutdown failed:", error);
|
|
345
373
|
}
|
|
346
374
|
finally {
|
|
347
|
-
|
|
375
|
+
tracerProvider = undefined;
|
|
376
|
+
loggerProvider = undefined;
|
|
348
377
|
initialized = false;
|
|
349
378
|
currentConfig = undefined;
|
|
350
379
|
}
|
package/dist/tools/bashTool.js
CHANGED
|
@@ -152,6 +152,13 @@ The working directory persists between commands. Try to maintain your current wo
|
|
|
152
152
|
error: "Command parameter is required and must be a string",
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
+
// If the session cwd was auto-recovered (e.g. the previous worktree
|
|
156
|
+
// directory was removed manually via `git worktree remove`), surface
|
|
157
|
+
// the notice in this tool's result so the model is aware of the switch.
|
|
158
|
+
const cwdRecovery = context.aiManager?.consumeCwdRecovery?.();
|
|
159
|
+
const recoveryNotice = cwdRecovery
|
|
160
|
+
? `Note: working directory ${cwdRecovery.from} no longer exists; session working directory recovered to ${cwdRecovery.to}.\n`
|
|
161
|
+
: "";
|
|
155
162
|
// Resolve shell path: on Windows, use Git Bash; on macOS/Linux, use bash or zsh
|
|
156
163
|
const shellPath = resolveShellPath();
|
|
157
164
|
if (!shellPath) {
|
|
@@ -221,7 +228,7 @@ The working directory persists between commands. Try to maintain your current wo
|
|
|
221
228
|
].join("\n");
|
|
222
229
|
return {
|
|
223
230
|
success: true,
|
|
224
|
-
content: backgroundMsg,
|
|
231
|
+
content: recoveryNotice + backgroundMsg,
|
|
225
232
|
shortResult: `Background process ${taskId} started${outputPath ? ` → ${outputPath}` : ""}`,
|
|
226
233
|
};
|
|
227
234
|
}
|
|
@@ -387,9 +394,11 @@ The working directory persists between commands. Try to maintain your current wo
|
|
|
387
394
|
const processedOutput = processToolResult(outputBuffer + (errorBuffer ? "\n" + errorBuffer : ""), BASH_MAX_OUTPUT_CHARS, "bash");
|
|
388
395
|
resolve({
|
|
389
396
|
success: false,
|
|
390
|
-
content:
|
|
391
|
-
?
|
|
392
|
-
:
|
|
397
|
+
content: recoveryNotice
|
|
398
|
+
? recoveryNotice + (processedOutput || reason)
|
|
399
|
+
: processedOutput
|
|
400
|
+
? `${processedOutput}\n\n${reason}`
|
|
401
|
+
: reason,
|
|
393
402
|
error: reason,
|
|
394
403
|
});
|
|
395
404
|
}
|
|
@@ -460,7 +469,8 @@ The working directory persists between commands. Try to maintain your current wo
|
|
|
460
469
|
const exitCode = code ?? 0;
|
|
461
470
|
const combinedOutput = outputBuffer + (errorBuffer ? "\n" + errorBuffer : "");
|
|
462
471
|
// Prepend CWD change message to output if present
|
|
463
|
-
const finalOutput =
|
|
472
|
+
const finalOutput = recoveryNotice +
|
|
473
|
+
(cwdMessage ? cwdMessage + "\n" : "") +
|
|
464
474
|
(combinedOutput || `Command executed with exit code: ${exitCode}`);
|
|
465
475
|
const content = processToolResult(finalOutput, BASH_MAX_OUTPUT_CHARS, "bash");
|
|
466
476
|
const lines = combinedOutput.trim().split("\n");
|
|
@@ -490,7 +500,7 @@ The working directory persists between commands. Try to maintain your current wo
|
|
|
490
500
|
resolve({
|
|
491
501
|
success: false,
|
|
492
502
|
content: "",
|
|
493
|
-
error:
|
|
503
|
+
error: `${recoveryNotice}Failed to execute command: ${error.message}`.trim(),
|
|
494
504
|
});
|
|
495
505
|
}
|
|
496
506
|
});
|
package/dist/tools/grepTool.js
CHANGED
|
@@ -131,6 +131,13 @@ export const grepTool = {
|
|
|
131
131
|
}
|
|
132
132
|
try {
|
|
133
133
|
const workdir = context.workdir;
|
|
134
|
+
// If the session cwd was auto-recovered (e.g. the previous worktree
|
|
135
|
+
// directory was removed manually via `git worktree remove`), surface
|
|
136
|
+
// the notice in this tool's result so the model is aware of the switch.
|
|
137
|
+
const cwdRecovery = context.aiManager?.consumeCwdRecovery?.();
|
|
138
|
+
const recoveryNotice = cwdRecovery
|
|
139
|
+
? `Note: working directory ${cwdRecovery.from} no longer exists; session working directory recovered to ${cwdRecovery.to}.\n`
|
|
140
|
+
: "";
|
|
134
141
|
const rgArgs = [
|
|
135
142
|
"--color=never",
|
|
136
143
|
"--max-columns=500",
|
|
@@ -207,7 +214,7 @@ export const grepTool = {
|
|
|
207
214
|
return {
|
|
208
215
|
success: false,
|
|
209
216
|
content: "",
|
|
210
|
-
error:
|
|
217
|
+
error: `${recoveryNotice}ripgrep failed: ${result.stderr}`.trim(),
|
|
211
218
|
};
|
|
212
219
|
}
|
|
213
220
|
if (result.exitCode !== 0 && result.exitCode !== 1) {
|
|
@@ -217,7 +224,8 @@ export const grepTool = {
|
|
|
217
224
|
if (!output) {
|
|
218
225
|
return {
|
|
219
226
|
success: true,
|
|
220
|
-
content:
|
|
227
|
+
content: recoveryNotice +
|
|
228
|
+
"No matches found. Suggestion: specify the 'path' field to search in ignored or other directories (e.g., 'node_modules'), as the default search path is the current working directory and respects .gitignore.",
|
|
221
229
|
shortResult: "No matches found",
|
|
222
230
|
metadata: {
|
|
223
231
|
numMatches: 0,
|
|
@@ -256,7 +264,7 @@ export const grepTool = {
|
|
|
256
264
|
}
|
|
257
265
|
return {
|
|
258
266
|
success: true,
|
|
259
|
-
content: finalOutput,
|
|
267
|
+
content: recoveryNotice + finalOutput,
|
|
260
268
|
shortResult,
|
|
261
269
|
metadata: {
|
|
262
270
|
numMatches: totalMatches,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -35,3 +35,6 @@ export * from "./cron.js";
|
|
|
35
35
|
export * from "./telemetry.js";
|
|
36
36
|
export * from "./auth.js";
|
|
37
37
|
export * from "./workflow.js";
|
|
38
|
+
export type { SessionMetadata, SessionData } from "../services/session.js";
|
|
39
|
+
export type { ToolBlockUpdateCallbackParams } from "../utils/messageOperations.js";
|
|
40
|
+
export type { QueuedMessage } from "../managers/messageQueue.js";
|
|
@@ -20,7 +20,6 @@ import { WorkflowManager } from "../managers/workflowManager.js";
|
|
|
20
20
|
import { MemoryRuleManager } from "../managers/MemoryRuleManager.js";
|
|
21
21
|
import { ReversionManager } from "../managers/reversionManager.js";
|
|
22
22
|
import { SubagentManager } from "../managers/subagentManager.js";
|
|
23
|
-
import { ForkedAgentManager } from "../managers/forkedAgentManager.js";
|
|
24
23
|
import { LiveConfigManager } from "../managers/liveConfigManager.js";
|
|
25
24
|
import { ReversionService } from "../services/reversionService.js";
|
|
26
25
|
import { cleanupMetaOnlySessions } from "../services/session.js";
|
|
@@ -245,8 +244,6 @@ export function setupAgentContainer(setupOptions) {
|
|
|
245
244
|
stream,
|
|
246
245
|
});
|
|
247
246
|
container.register("SubagentManager", subagentManager);
|
|
248
|
-
const forkedAgentManager = new ForkedAgentManager(container);
|
|
249
|
-
container.register("ForkedAgentManager", forkedAgentManager);
|
|
250
247
|
const aiManager = new AIManager(container, {
|
|
251
248
|
callbacks: {
|
|
252
249
|
...callbacks,
|
|
@@ -132,5 +132,6 @@ export interface AddNotificationMessageParams {
|
|
|
132
132
|
status: "completed" | "failed" | "killed" | "aborted";
|
|
133
133
|
summary: string;
|
|
134
134
|
outputFile?: string;
|
|
135
|
+
result?: string;
|
|
135
136
|
}
|
|
136
|
-
export declare const addNotificationMessageToMessages: ({ messages, taskId, taskType, status, summary, outputFile, }: AddNotificationMessageParams) => Message[];
|
|
137
|
+
export declare const addNotificationMessageToMessages: ({ messages, taskId, taskType, status, summary, outputFile, result, }: AddNotificationMessageParams) => Message[];
|
|
@@ -452,7 +452,7 @@ export function getMessageContent(message) {
|
|
|
452
452
|
}
|
|
453
453
|
return "";
|
|
454
454
|
}
|
|
455
|
-
export const addNotificationMessageToMessages = ({ messages, taskId, taskType, status, summary, outputFile, }) => {
|
|
455
|
+
export const addNotificationMessageToMessages = ({ messages, taskId, taskType, status, summary, outputFile, result, }) => {
|
|
456
456
|
const block = {
|
|
457
457
|
type: "task_notification",
|
|
458
458
|
taskId,
|
|
@@ -460,6 +460,7 @@ export const addNotificationMessageToMessages = ({ messages, taskId, taskType, s
|
|
|
460
460
|
status,
|
|
461
461
|
summary,
|
|
462
462
|
...(outputFile !== undefined && { outputFile }),
|
|
463
|
+
...(result !== undefined && { result }),
|
|
463
464
|
};
|
|
464
465
|
const notificationMessage = {
|
|
465
466
|
id: generateMessageId(),
|
|
@@ -5,6 +5,9 @@ export function taskNotificationToXml(block) {
|
|
|
5
5
|
if (block.outputFile) {
|
|
6
6
|
xml += `<output-file>${block.outputFile}</output-file>\n`;
|
|
7
7
|
}
|
|
8
|
+
if (block.result) {
|
|
9
|
+
xml += `<result>${block.result}</result>\n`;
|
|
10
|
+
}
|
|
8
11
|
xml += `<status>${block.status}</status>\n`;
|
|
9
12
|
xml += `<summary>${block.summary}</summary>\n`;
|
|
10
13
|
xml += `</task-notification>`;
|
|
@@ -25,6 +28,7 @@ export function parseTaskNotificationXml(xml) {
|
|
|
25
28
|
return null;
|
|
26
29
|
}
|
|
27
30
|
const outputFile = extractTag(xml, "output-file") || undefined;
|
|
31
|
+
const result = extractTag(xml, "result") || undefined;
|
|
28
32
|
return {
|
|
29
33
|
type: "task_notification",
|
|
30
34
|
taskId,
|
|
@@ -32,6 +36,7 @@ export function parseTaskNotificationXml(xml) {
|
|
|
32
36
|
status,
|
|
33
37
|
summary,
|
|
34
38
|
...(outputFile && { outputFile }),
|
|
39
|
+
...(result && { result }),
|
|
35
40
|
};
|
|
36
41
|
}
|
|
37
42
|
catch {
|
package/dist/utils/ripgrep.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Path to the ripgrep binary
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Path to the ripgrep binary, provided by the @vscode/ripgrep dependency.
|
|
3
|
+
* The wrapper resolves the platform-specific binary package at import time
|
|
4
|
+
* via optionalDependencies + os/cpu filtering.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export { rgPath } from "@vscode/ripgrep";
|
package/dist/utils/ripgrep.js
CHANGED
|
@@ -1,29 +1,6 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import process from "process";
|
|
3
|
-
import { getPackageRoot } from "./configPaths.js";
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
2
|
+
* Path to the ripgrep binary, provided by the @vscode/ripgrep dependency.
|
|
3
|
+
* The wrapper resolves the platform-specific binary package at import time
|
|
4
|
+
* via optionalDependencies + os/cpu filtering.
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
const platform = process.platform;
|
|
9
|
-
const arch = process.arch;
|
|
10
|
-
if (platform === "darwin") {
|
|
11
|
-
return arch === "arm64" ? "macos-aarch64" : "macos-x86_64";
|
|
12
|
-
}
|
|
13
|
-
else if (platform === "linux") {
|
|
14
|
-
return arch === "arm64" ? "linux-aarch64" : "linux-x86_64";
|
|
15
|
-
}
|
|
16
|
-
else if (platform === "win32") {
|
|
17
|
-
return arch === "arm64" ? "windows-aarch64" : "windows-x86_64";
|
|
18
|
-
}
|
|
19
|
-
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
20
|
-
}
|
|
21
|
-
const platformKey = getPlatformKey();
|
|
22
|
-
const isWindows = platformKey.startsWith("windows");
|
|
23
|
-
const binaryName = isWindows ? "rg.exe" : "rg";
|
|
24
|
-
/**
|
|
25
|
-
* Path to the ripgrep binary bundled in the vendor directory.
|
|
26
|
-
* Uses findUpSync to locate the package root, working correctly even
|
|
27
|
-
* when bundled (e.g. esbuild into a VS Code extension).
|
|
28
|
-
*/
|
|
29
|
-
export const rgPath = path.join(getPackageRoot(), `vendor/ripgrep/${platformKey}/${binaryName}`);
|
|
6
|
+
export { rgPath } from "@vscode/ripgrep";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-agent-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "SDK for building AI-powered development tools and agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -13,6 +13,22 @@
|
|
|
13
13
|
"main": "dist/index.js",
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
15
|
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./types": {
|
|
22
|
+
"types": "./dist/types/index.d.ts",
|
|
23
|
+
"default": "./dist/types/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./constants": {
|
|
26
|
+
"types": "./dist/constants/tools.d.ts",
|
|
27
|
+
"default": "./dist/constants/tools.js"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json",
|
|
30
|
+
"./*": "./*"
|
|
31
|
+
},
|
|
16
32
|
"repository": {
|
|
17
33
|
"type": "git",
|
|
18
34
|
"url": "https://github.com/netease-lcap/wave-agent.git",
|
|
@@ -20,10 +36,6 @@
|
|
|
20
36
|
},
|
|
21
37
|
"files": [
|
|
22
38
|
"dist",
|
|
23
|
-
"src",
|
|
24
|
-
"bin",
|
|
25
|
-
"vendor",
|
|
26
|
-
"scripts",
|
|
27
39
|
"builtin",
|
|
28
40
|
"README.md"
|
|
29
41
|
],
|
|
@@ -33,9 +45,10 @@
|
|
|
33
45
|
"@opentelemetry/api-logs": "^0.217.0",
|
|
34
46
|
"@opentelemetry/exporter-logs-otlp-http": "^0.217.0",
|
|
35
47
|
"@opentelemetry/exporter-trace-otlp-http": "^0.217.0",
|
|
48
|
+
"@opentelemetry/resources": "^2.7.1",
|
|
36
49
|
"@opentelemetry/sdk-logs": "^0.217.0",
|
|
37
|
-
"@opentelemetry/sdk-
|
|
38
|
-
"@
|
|
50
|
+
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
51
|
+
"@vscode/ripgrep": "^1.18.0",
|
|
39
52
|
"chokidar": "^4.0.3",
|
|
40
53
|
"cron-parser": "^5.5.0",
|
|
41
54
|
"find-up": "^8.0.0",
|
|
@@ -59,7 +72,6 @@
|
|
|
59
72
|
},
|
|
60
73
|
"license": "MIT",
|
|
61
74
|
"scripts": {
|
|
62
|
-
"postinstall": "node scripts/postinstall.js",
|
|
63
75
|
"build": "rimraf dist && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
64
76
|
"type-check": "tsc --noEmit --incremental",
|
|
65
77
|
"watch": "tsc -p tsconfig.build.json --watch & tsc-alias -p tsconfig.build.json --watch",
|
package/bin/rg
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env dotslash
|
|
2
|
-
|
|
3
|
-
{
|
|
4
|
-
"name": "rg",
|
|
5
|
-
"platforms": {
|
|
6
|
-
"macos-aarch64": {
|
|
7
|
-
"size": 1787248,
|
|
8
|
-
"hash": "blake3",
|
|
9
|
-
"digest": "8d9942032585ea8ee805937634238d9aee7b210069f4703c88fbe568e26fb78a",
|
|
10
|
-
"format": "tar.gz",
|
|
11
|
-
"path": "ripgrep-14.1.1-aarch64-apple-darwin/rg",
|
|
12
|
-
"providers": [
|
|
13
|
-
{
|
|
14
|
-
"url": "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-aarch64-apple-darwin.tar.gz"
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
"linux-aarch64": {
|
|
19
|
-
"size": 2047405,
|
|
20
|
-
"hash": "blake3",
|
|
21
|
-
"digest": "0b670b8fa0a3df2762af2fc82cc4932f684ca4c02dbd1260d4f3133fd4b2a515",
|
|
22
|
-
"format": "tar.gz",
|
|
23
|
-
"path": "ripgrep-14.1.1-aarch64-unknown-linux-gnu/rg",
|
|
24
|
-
"providers": [
|
|
25
|
-
{
|
|
26
|
-
"url": "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-aarch64-unknown-linux-gnu.tar.gz"
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
"macos-x86_64": {
|
|
31
|
-
"size": 2082672,
|
|
32
|
-
"hash": "blake3",
|
|
33
|
-
"digest": "e9b862fc8da3127f92791f0ff6a799504154ca9d36c98bf3e60a81c6b1f7289e",
|
|
34
|
-
"format": "tar.gz",
|
|
35
|
-
"path": "ripgrep-14.1.1-x86_64-apple-darwin/rg",
|
|
36
|
-
"providers": [
|
|
37
|
-
{
|
|
38
|
-
"url": "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-x86_64-apple-darwin.tar.gz"
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
"linux-x86_64": {
|
|
43
|
-
"size": 2566310,
|
|
44
|
-
"hash": "blake3",
|
|
45
|
-
"digest": "f73cca4e54d78c31f832c7f6e2c0b4db8b04fa3eaa747915727d570893dbee76",
|
|
46
|
-
"format": "tar.gz",
|
|
47
|
-
"path": "ripgrep-14.1.1-x86_64-unknown-linux-musl/rg",
|
|
48
|
-
"providers": [
|
|
49
|
-
{
|
|
50
|
-
"url": "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-x86_64-unknown-linux-musl.tar.gz"
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
"windows-x86_64": {
|
|
55
|
-
"size": 2058893,
|
|
56
|
-
"hash": "blake3",
|
|
57
|
-
"digest": "a8ce1a6fed4f8093ee997e57f33254e94b2cd18e26358b09db599c89882eadbd",
|
|
58
|
-
"format": "zip",
|
|
59
|
-
"path": "ripgrep-14.1.1-x86_64-pc-windows-msvc/rg.exe",
|
|
60
|
-
"providers": [
|
|
61
|
-
{
|
|
62
|
-
"url": "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-x86_64-pc-windows-msvc.zip"
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
},
|
|
66
|
-
"windows-aarch64": {
|
|
67
|
-
"size": 1667740,
|
|
68
|
-
"hash": "blake3",
|
|
69
|
-
"digest": "47b971a8c4fca1d23a4e7c19bd4d88465ebc395598458133139406d3bf85f3fa",
|
|
70
|
-
"format": "zip",
|
|
71
|
-
"path": "rg.exe",
|
|
72
|
-
"providers": [
|
|
73
|
-
{
|
|
74
|
-
"url": "https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-13/ripgrep-v13.0.0-13-aarch64-pc-windows-msvc.zip"
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import type { Message } from "../types/index.js";
|
|
3
|
-
import { Container } from "../utils/container.js";
|
|
4
|
-
import { type SubagentInstance } from "./subagentManager.js";
|
|
5
|
-
import type { PermissionMode } from "../types/permissions.js";
|
|
6
|
-
export interface ForkedAgentEntry {
|
|
7
|
-
id: string;
|
|
8
|
-
instance: SubagentInstance;
|
|
9
|
-
logPath: string;
|
|
10
|
-
logStream?: fs.WriteStream;
|
|
11
|
-
status: "running" | "completed" | "failed";
|
|
12
|
-
}
|
|
13
|
-
export interface ForkedAgentManagerCallbacks {
|
|
14
|
-
onForkedAgentStatusChange?: (entries: ForkedAgentEntry[]) => void;
|
|
15
|
-
}
|
|
16
|
-
export declare class ForkedAgentManager {
|
|
17
|
-
private container;
|
|
18
|
-
private activeForks;
|
|
19
|
-
private inFlightPromises;
|
|
20
|
-
private callbacks;
|
|
21
|
-
constructor(container: Container, options?: {
|
|
22
|
-
callbacks?: ForkedAgentManagerCallbacks;
|
|
23
|
-
});
|
|
24
|
-
private get subagentManager();
|
|
25
|
-
/**
|
|
26
|
-
* Creates a forked subagent with conversation history and executes it asynchronously (fire-and-forget).
|
|
27
|
-
* Does NOT interact with BackgroundTaskManager.
|
|
28
|
-
*/
|
|
29
|
-
forkAndExecute(subagentType: string, messages: Message[], parameters: {
|
|
30
|
-
description: string;
|
|
31
|
-
allowedTools?: string[];
|
|
32
|
-
model?: string;
|
|
33
|
-
permissionModeOverride?: PermissionMode;
|
|
34
|
-
maxTurns?: number;
|
|
35
|
-
}, prompt: string): Promise<string>;
|
|
36
|
-
private executeFork;
|
|
37
|
-
/**
|
|
38
|
-
* Abort a running forked agent.
|
|
39
|
-
*/
|
|
40
|
-
stop(id: string): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Stop all running forked agents, wait for in-flight executions to settle, and clear the map.
|
|
43
|
-
*/
|
|
44
|
-
cleanup(): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Returns list of active forked agents.
|
|
47
|
-
*/
|
|
48
|
-
getActiveForks(): ForkedAgentEntry[];
|
|
49
|
-
private notifyChange;
|
|
50
|
-
}
|