wave-agent-sdk 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/agent.js +2 -2
  2. package/dist/constants/tools.d.ts +1 -2
  3. package/dist/constants/tools.d.ts.map +1 -1
  4. package/dist/constants/tools.js +1 -2
  5. package/dist/managers/permissionManager.d.ts.map +1 -1
  6. package/dist/managers/permissionManager.js +49 -36
  7. package/dist/managers/pluginManager.d.ts.map +1 -1
  8. package/dist/managers/pluginManager.js +28 -1
  9. package/dist/managers/subagentManager.d.ts +3 -3
  10. package/dist/managers/subagentManager.d.ts.map +1 -1
  11. package/dist/managers/subagentManager.js +13 -12
  12. package/dist/managers/toolManager.d.ts +2 -2
  13. package/dist/managers/toolManager.d.ts.map +1 -1
  14. package/dist/managers/toolManager.js +4 -6
  15. package/dist/prompts/index.d.ts.map +1 -1
  16. package/dist/prompts/index.js +3 -3
  17. package/dist/tools/agentTool.d.ts +6 -0
  18. package/dist/tools/agentTool.d.ts.map +1 -0
  19. package/dist/tools/{taskTool.js → agentTool.js} +42 -30
  20. package/dist/tools/grepTool.js +2 -2
  21. package/dist/tools/skillTool.js +2 -2
  22. package/dist/tools/types.d.ts +1 -1
  23. package/dist/tools/types.d.ts.map +1 -1
  24. package/dist/utils/bashParser.d.ts +4 -0
  25. package/dist/utils/bashParser.d.ts.map +1 -1
  26. package/dist/utils/bashParser.js +39 -2
  27. package/dist/utils/builtinSubagents.d.ts.map +1 -1
  28. package/dist/utils/builtinSubagents.js +1 -3
  29. package/dist/utils/gitUtils.d.ts.map +1 -1
  30. package/dist/utils/gitUtils.js +47 -1
  31. package/dist/utils/path.d.ts +0 -10
  32. package/dist/utils/path.d.ts.map +1 -1
  33. package/dist/utils/path.js +0 -61
  34. package/package.json +2 -5
  35. package/src/agent.ts +2 -2
  36. package/src/constants/tools.ts +1 -2
  37. package/src/managers/permissionManager.ts +61 -44
  38. package/src/managers/pluginManager.ts +39 -1
  39. package/src/managers/subagentManager.ts +13 -12
  40. package/src/managers/toolManager.ts +4 -6
  41. package/src/prompts/index.ts +3 -2
  42. package/src/tools/{taskTool.ts → agentTool.ts} +42 -30
  43. package/src/tools/grepTool.ts +2 -2
  44. package/src/tools/skillTool.ts +2 -2
  45. package/src/tools/types.ts +1 -1
  46. package/src/utils/bashParser.ts +50 -2
  47. package/src/utils/builtinSubagents.ts +0 -3
  48. package/src/utils/gitUtils.ts +48 -1
  49. package/src/utils/path.ts +0 -62
  50. package/dist/tools/lsTool.d.ts +0 -6
  51. package/dist/tools/lsTool.d.ts.map +0 -1
  52. package/dist/tools/lsTool.js +0 -175
  53. package/dist/tools/taskTool.d.ts +0 -6
  54. package/dist/tools/taskTool.d.ts.map +0 -1
  55. package/src/tools/lsTool.ts +0 -212
package/dist/agent.js CHANGED
@@ -280,7 +280,7 @@ export class Agent {
280
280
  }
281
281
  /** Unified interrupt method, interrupts both AI messages and command execution */
282
282
  abortMessage() {
283
- this.abortAIMessage(); // This will abort tools including Task tool (subagents)
283
+ this.abortAIMessage(); // This will abort tools including Agent tool (subagents)
284
284
  this.abortBashCommand();
285
285
  this.abortSlashCommand();
286
286
  }
@@ -314,7 +314,7 @@ export class Agent {
314
314
  /** Destroy managers, clean up resources */
315
315
  async destroy() {
316
316
  await this.messageManager.saveSession();
317
- this.abortAIMessage(); // This will abort tools including Task tool (subagents)
317
+ this.abortAIMessage(); // This will abort tools including Agent tool (subagents)
318
318
  this.abortBashCommand();
319
319
  this.abortSlashCommand();
320
320
  // Cleanup background task manager
@@ -7,10 +7,9 @@ export declare const EXIT_PLAN_MODE_TOOL_NAME = "ExitPlanMode";
7
7
  export declare const GLOB_TOOL_NAME = "Glob";
8
8
  export declare const GREP_TOOL_NAME = "Grep";
9
9
  export declare const LSP_TOOL_NAME = "LSP";
10
- export declare const LS_TOOL_NAME = "LS";
11
10
  export declare const READ_TOOL_NAME = "Read";
12
11
  export declare const SKILL_TOOL_NAME = "Skill";
13
- export declare const TASK_TOOL_NAME = "Task";
12
+ export declare const AGENT_TOOL_NAME = "Agent";
14
13
  export declare const TASK_CREATE_TOOL_NAME = "TaskCreate";
15
14
  export declare const TASK_GET_TOOL_NAME = "TaskGet";
16
15
  export declare const TASK_UPDATE_TOOL_NAME = "TaskUpdate";
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/constants/tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAC7D,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,eAAO,MAAM,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/constants/tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAC7D,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,eAAO,MAAM,eAAe,UAAU,CAAC"}
@@ -7,10 +7,9 @@ export const EXIT_PLAN_MODE_TOOL_NAME = "ExitPlanMode";
7
7
  export const GLOB_TOOL_NAME = "Glob";
8
8
  export const GREP_TOOL_NAME = "Grep";
9
9
  export const LSP_TOOL_NAME = "LSP";
10
- export const LS_TOOL_NAME = "LS";
11
10
  export const READ_TOOL_NAME = "Read";
12
11
  export const SKILL_TOOL_NAME = "Skill";
13
- export const TASK_TOOL_NAME = "Task";
12
+ export const AGENT_TOOL_NAME = "Agent";
14
13
  export const TASK_CREATE_TOOL_NAME = "TaskCreate";
15
14
  export const TASK_GET_TOOL_NAME = "TaskGet";
16
15
  export const TASK_UPDATE_TOOL_NAME = "TaskUpdate";
@@ -1 +1 @@
1
- {"version":3,"file":"permissionManager.d.ts","sourceRoot":"","sources":["../../src/managers/permissionManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAgBhD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AA8BlD,MAAM,WAAW,wBAAwB;IAC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,EAC9B,QAAQ,CAAC,EAAE,kBAAkB,EAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,qBAAqB;IAgFxB;;OAEG;IACH,OAAO,CAAC,WAAW;IAwDnB;;OAEG;IACH,OAAO,CAAC,eAAe;IAiGvB;;;;;;;OAOG;IACI,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAmFjE;;;OAGG;IACU,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA4C5D"}
@@ -8,9 +8,9 @@
8
8
  import path from "node:path";
9
9
  import { minimatch } from "minimatch";
10
10
  import { RESTRICTED_TOOLS } from "../types/permissions.js";
11
- import { splitBashCommand, stripEnvVars, stripRedirections, getSmartPrefix, DANGEROUS_COMMANDS, } from "../utils/bashParser.js";
11
+ import { splitBashCommand, stripEnvVars, stripRedirections, hasWriteRedirections, getSmartPrefix, DANGEROUS_COMMANDS, } from "../utils/bashParser.js";
12
12
  import { isPathInside } from "../utils/pathSafety.js";
13
- import { BASH_TOOL_NAME, EDIT_TOOL_NAME, WRITE_TOOL_NAME, READ_TOOL_NAME, LS_TOOL_NAME, } from "../constants/tools.js";
13
+ import { BASH_TOOL_NAME, EDIT_TOOL_NAME, WRITE_TOOL_NAME, READ_TOOL_NAME, } from "../constants/tools.js";
14
14
  const SAFE_COMMANDS = ["cd", "ls", "pwd", "true", "false"];
15
15
  const DEFAULT_ALLOWED_RULES = [
16
16
  "Bash(git status*)",
@@ -343,6 +343,9 @@ export class PermissionManager {
343
343
  const workdir = toolInput.workdir;
344
344
  const parts = splitBashCommand(command);
345
345
  const isDangerous = parts.some((part) => {
346
+ if (hasWriteRedirections(part)) {
347
+ return true;
348
+ }
346
349
  const processedPart = stripRedirections(stripEnvVars(part));
347
350
  const commandMatch = processedPart.match(/^(\w+)(\s+.*)?$/);
348
351
  if (commandMatch) {
@@ -390,7 +393,15 @@ export class PermissionManager {
390
393
  // Handle Bash command rules
391
394
  if (toolName === BASH_TOOL_NAME) {
392
395
  const command = String(context.toolInput?.command || "");
393
- const processedPart = stripRedirections(stripEnvVars(command));
396
+ const hasWriteInPattern = hasWriteRedirections(pattern);
397
+ const hasWriteInCommand = hasWriteRedirections(command);
398
+ // If the command has write redirections, it must match a pattern that also has write redirections
399
+ if (hasWriteInCommand && !hasWriteInPattern) {
400
+ return false;
401
+ }
402
+ const processedPart = hasWriteInPattern
403
+ ? stripEnvVars(command)
404
+ : stripRedirections(stripEnvVars(command));
394
405
  // For Bash commands, we want '*' to match everything including slashes and spaces
395
406
  // minimatch's default behavior for '*' is to not match across directory separators
396
407
  // We use a regex to replace '*' with '.*' (match anything)
@@ -402,12 +413,7 @@ export class PermissionManager {
402
413
  return matched;
403
414
  }
404
415
  // Handle path-based rules (e.g., "Read(**/*.env)")
405
- const pathTools = [
406
- READ_TOOL_NAME,
407
- WRITE_TOOL_NAME,
408
- EDIT_TOOL_NAME,
409
- LS_TOOL_NAME,
410
- ];
416
+ const pathTools = [READ_TOOL_NAME, WRITE_TOOL_NAME, EDIT_TOOL_NAME];
411
417
  if (pathTools.includes(toolName)) {
412
418
  const targetPath = (context.toolInput?.file_path ||
413
419
  context.toolInput?.path);
@@ -421,7 +427,7 @@ export class PermissionManager {
421
427
  * Check if a tool call is allowed by persistent or temporary rules
422
428
  */
423
429
  isAllowedByRule(context) {
424
- const isAllowedByRuleList = (ctx, rules) => {
430
+ const isAllowedByRuleList = (ctx, rules, isDefaultRules = false) => {
425
431
  if (ctx.toolName === BASH_TOOL_NAME && ctx.toolInput?.command) {
426
432
  const command = String(ctx.toolInput.command);
427
433
  const parts = splitBashCommand(command);
@@ -429,40 +435,46 @@ export class PermissionManager {
429
435
  return false;
430
436
  const workdir = ctx.toolInput?.workdir;
431
437
  return parts.every((part) => {
438
+ const hasWrite = hasWriteRedirections(part);
432
439
  const processedPart = stripRedirections(stripEnvVars(part));
433
440
  // Check for safe commands
434
- const commandMatch = processedPart.match(/^(\w+)(\s+.*)?$/);
435
- if (commandMatch) {
436
- const cmd = commandMatch[1];
437
- const args = commandMatch[2]?.trim() || "";
438
- if (SAFE_COMMANDS.includes(cmd)) {
439
- if (cmd === "pwd" || cmd === "true" || cmd === "false") {
440
- return true;
441
- }
442
- if (workdir) {
443
- // For cd and ls, check paths
444
- const pathArgs = (args.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) || []).filter((arg) => !arg.startsWith("-")) || [];
445
- if (pathArgs.length === 0) {
446
- // cd or ls without arguments operates on current dir (workdir)
441
+ if (!hasWrite) {
442
+ const commandMatch = processedPart.match(/^(\w+)(\s+.*)?$/);
443
+ if (commandMatch) {
444
+ const cmd = commandMatch[1];
445
+ const args = commandMatch[2]?.trim() || "";
446
+ if (SAFE_COMMANDS.includes(cmd)) {
447
+ if (cmd === "pwd" || cmd === "true" || cmd === "false") {
447
448
  return true;
448
449
  }
449
- const allPathsSafe = pathArgs.every((pathArg) => {
450
- // Remove quotes if present
451
- const cleanPath = pathArg.replace(/^['"](.*)['"]$/, "$1");
452
- const { isInside } = this.isInsideSafeZone(cleanPath, workdir);
453
- return isInside;
454
- });
455
- if (allPathsSafe) {
456
- return true;
450
+ if (workdir) {
451
+ // For cd and ls, check paths
452
+ const pathArgs = (args.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) || []).filter((arg) => !arg.startsWith("-")) || [];
453
+ if (pathArgs.length === 0) {
454
+ // cd or ls without arguments operates on current dir (workdir)
455
+ return true;
456
+ }
457
+ const allPathsSafe = pathArgs.every((pathArg) => {
458
+ // Remove quotes if present
459
+ const cleanPath = pathArg.replace(/^['"](.*)['"]$/, "$1");
460
+ const { isInside } = this.isInsideSafeZone(cleanPath, workdir);
461
+ return isInside;
462
+ });
463
+ if (allPathsSafe) {
464
+ return true;
465
+ }
457
466
  }
458
467
  }
459
468
  }
460
469
  }
461
470
  // Check if this specific part is allowed by any rule
471
+ if (hasWrite && isDefaultRules) {
472
+ return false;
473
+ }
462
474
  // We create a temporary context with just this part of the command
463
475
  const partContext = {
464
476
  ...ctx,
465
- toolInput: { ...ctx.toolInput, command: processedPart },
477
+ toolInput: { ...ctx.toolInput, command: part },
466
478
  };
467
479
  const allowedByRule = rules.some((rule) => {
468
480
  return this.matchesRule(partContext, rule);
@@ -484,7 +496,7 @@ export class PermissionManager {
484
496
  return true;
485
497
  }
486
498
  // Check default allowed rules
487
- return isAllowedByRuleList(context, DEFAULT_ALLOWED_RULES);
499
+ return isAllowedByRuleList(context, DEFAULT_ALLOWED_RULES, true);
488
500
  }
489
501
  /**
490
502
  * Expand a bash command into individual permission rules, filtering out safe commands.
@@ -498,11 +510,12 @@ export class PermissionManager {
498
510
  const parts = splitBashCommand(command);
499
511
  const rules = [];
500
512
  for (const part of parts) {
513
+ const hasWrite = hasWriteRedirections(part);
501
514
  const processedPart = stripRedirections(stripEnvVars(part));
502
515
  // Check for safe commands
503
516
  const commandMatch = processedPart.match(/^(\w+)(\s+.*)?$/);
504
517
  let isSafe = false;
505
- if (commandMatch) {
518
+ if (commandMatch && !hasWrite) {
506
519
  const cmd = commandMatch[1];
507
520
  const args = commandMatch[2]?.trim() || "";
508
521
  if (SAFE_COMMANDS.includes(cmd)) {
@@ -549,12 +562,12 @@ export class PermissionManager {
549
562
  }
550
563
  }
551
564
  }
552
- const smartPrefix = getSmartPrefix(processedPart);
565
+ const smartPrefix = hasWrite ? null : getSmartPrefix(processedPart);
553
566
  if (smartPrefix) {
554
567
  rules.push(`Bash(${smartPrefix}*)`);
555
568
  }
556
569
  else {
557
- rules.push(`Bash(${processedPart})`);
570
+ rules.push(`Bash(${hasWrite ? stripEnvVars(part) : processedPart})`);
558
571
  }
559
572
  }
560
573
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pluginManager.d.ts","sourceRoot":"","sources":["../../src/managers/pluginManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAm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AAC,CAAC;CAC1C;AAED,qBAAa,aAAa;IAMtB,OAAO,CAAC,SAAS;IALnB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAA0B;gBAGtC,SAAS,EAAE,SAAS,EAC5B,OAAO,EAAE,oBAAoB;IAM/B,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,mBAAmB,GAE9B;IAED,OAAO,KAAK,oBAAoB,GAE/B;IAED;;OAEG;IACH,oBAAoB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAInE;;OAEG;YACW,oBAAoB;IA+DlC;;OAEG;YACW,gBAAgB;IAyD9B;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzD;;OAEG;IACH,UAAU,IAAI,MAAM,EAAE;IAItB;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG5C"}
@@ -43,7 +43,34 @@ export class PluginManager {
43
43
  this.enabledPlugins = this.configurationService.getMergedEnabledPlugins(this.workdir);
44
44
  }
45
45
  const marketplaceService = new MarketplaceService();
46
- const installedRegistry = await marketplaceService.getInstalledPlugins();
46
+ let installedRegistry = await marketplaceService.getInstalledPlugins();
47
+ const knownMarketplaces = await marketplaceService.listMarketplaces();
48
+ // Identify missing enabled plugins and auto-install them if marketplace is known
49
+ for (const pluginId of Object.keys(this.enabledPlugins)) {
50
+ if (this.enabledPlugins[pluginId] !== true)
51
+ continue;
52
+ const [name, marketplaceName] = pluginId.split("@");
53
+ if (!name || !marketplaceName)
54
+ continue;
55
+ const isInstalled = installedRegistry.plugins.some((p) => p.name === name && p.marketplace === marketplaceName);
56
+ if (!isInstalled) {
57
+ const isMarketplaceKnown = knownMarketplaces.some((m) => m.name === marketplaceName);
58
+ if (isMarketplaceKnown) {
59
+ logger?.info(`Auto-installing missing plugin: ${pluginId}`);
60
+ try {
61
+ await marketplaceService.installPlugin(pluginId);
62
+ }
63
+ catch (installError) {
64
+ logger?.error(`Failed to auto-install plugin ${pluginId}:`, installError);
65
+ }
66
+ }
67
+ else {
68
+ logger?.warn(`Plugin ${pluginId} is enabled but marketplace ${marketplaceName} is unknown. Skipping auto-install.`);
69
+ }
70
+ }
71
+ }
72
+ // Refresh registry after potential auto-installs
73
+ installedRegistry = await marketplaceService.getInstalledPlugins();
47
74
  for (const p of installedRegistry.plugins) {
48
75
  const pluginId = `${p.name}@${p.marketplace}`;
49
76
  if (this.enabledPlugins[pluginId] !== true) {
@@ -87,12 +87,12 @@ export declare class SubagentManager {
87
87
  model?: string;
88
88
  }, runInBackground?: boolean, onUpdate?: () => void): Promise<SubagentInstance>;
89
89
  /**
90
- * Execute task using subagent instance
90
+ * Execute agent using subagent instance
91
91
  *
92
- * IMPORTANT: This method automatically filters out the Task tool from allowedTools
92
+ * IMPORTANT: This method automatically filters out the Agent tool from allowedTools
93
93
  * to prevent subagents from spawning other subagents (infinite recursion protection)
94
94
  */
95
- executeTask(instance: SubagentInstance, prompt: string, abortSignal?: AbortSignal, runInBackground?: boolean): Promise<string>;
95
+ executeAgent(instance: SubagentInstance, prompt: string, abortSignal?: AbortSignal, runInBackground?: boolean): Promise<string>;
96
96
  backgroundInstance(subagentId: string): Promise<string>;
97
97
  private internalExecute;
98
98
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"subagentManager.d.ts","sourceRoot":"","sources":["../../src/managers/subagentManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,WAAW,EACX,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAA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GAAG,IAAI;IAIxD;;OAEG;IACH,oBAAoB,CAClB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GACjC,IAAI;IAOP;;OAEG;IACH,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAOhE;;OAEG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAYzC;;OAEG;IACH,kBAAkB,IAAI,gBAAgB,EAAE;IAOxC;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;;OAGG;IACH,OAAO,CAAC,uBAAuB;CAqFhC"}
@@ -2,6 +2,7 @@ import { randomUUID } from "crypto";
2
2
  import { AIManager } from "./aiManager.js";
3
3
  import { MessageManager } from "./messageManager.js";
4
4
  import { ToolManager } from "./toolManager.js";
5
+ import { AGENT_TOOL_NAME } from "../constants/tools.js";
5
6
  import { addConsolidatedAbortListener, createAbortPromise, } from "../utils/abortUtils.js";
6
7
  import { logger } from "../utils/globalLogger.js";
7
8
  export class SubagentManager {
@@ -152,16 +153,16 @@ export class SubagentManager {
152
153
  return instance;
153
154
  }
154
155
  /**
155
- * Execute task using subagent instance
156
+ * Execute agent using subagent instance
156
157
  *
157
- * IMPORTANT: This method automatically filters out the Task tool from allowedTools
158
+ * IMPORTANT: This method automatically filters out the Agent tool from allowedTools
158
159
  * to prevent subagents from spawning other subagents (infinite recursion protection)
159
160
  */
160
- async executeTask(instance, prompt, abortSignal, runInBackground) {
161
+ async executeAgent(instance, prompt, abortSignal, runInBackground) {
161
162
  try {
162
163
  // Check if already aborted before starting
163
164
  if (abortSignal?.aborted) {
164
- throw new Error("Task was aborted before execution started");
165
+ throw new Error("Agent was aborted before execution started");
165
166
  }
166
167
  // Set status to active and update parent
167
168
  this.updateInstanceStatus(instance.subagentId, "active");
@@ -269,17 +270,17 @@ export class SubagentManager {
269
270
  try {
270
271
  // Add the user's prompt as a message
271
272
  instance.messageManager.addUserMessage({ content: prompt });
272
- // Create enabled tools list - always exclude Task tool to prevent subagent recursion
273
+ // Create enabled tools list - always exclude Agent tool to prevent subagent recursion
273
274
  // Use instance.configuration.tools if provided, otherwise fallback to all tools
274
275
  let enabledTools = instance.configuration.tools;
275
- // Always filter out the Task tool to prevent subagents from creating sub-subagents
276
+ // Always filter out the Agent tool to prevent subagents from creating sub-subagents
276
277
  if (enabledTools) {
277
- enabledTools = enabledTools.filter((tool) => tool !== "Task");
278
+ enabledTools = enabledTools.filter((tool) => tool !== AGENT_TOOL_NAME);
278
279
  }
279
280
  else {
280
- // If no tools specified, get all tools except Task
281
+ // If no tools specified, get all tools except Agent
281
282
  const allTools = instance.toolManager.list().map((tool) => tool.name);
282
- enabledTools = allTools.filter((tool) => tool !== "Task");
283
+ enabledTools = allTools.filter((tool) => tool !== AGENT_TOOL_NAME);
283
284
  }
284
285
  // Execute the AI request with tool restrictions
285
286
  // The AIManager will handle abort signals through its own abort controllers
@@ -309,7 +310,7 @@ export class SubagentManager {
309
310
  if (abortSignal && !instance.backgroundTaskId) {
310
311
  await Promise.race([
311
312
  executeAI,
312
- createAbortPromise(abortSignal, "Task was aborted"),
313
+ createAbortPromise(abortSignal, "Agent was aborted"),
313
314
  ]);
314
315
  }
315
316
  else {
@@ -336,14 +337,14 @@ export class SubagentManager {
336
337
  const task = backgroundTaskManager.getTask(instance.backgroundTaskId);
337
338
  if (task) {
338
339
  task.status = "completed";
339
- task.stdout = response || "Task completed with no text response";
340
+ task.stdout = response || "Agent completed with no text response";
340
341
  task.endTime = Date.now();
341
342
  if (task.startTime) {
342
343
  task.runtime = task.endTime - task.startTime;
343
344
  }
344
345
  }
345
346
  }
346
- return response || "Task completed with no text response";
347
+ return response || "Agent completed with no text response";
347
348
  }
348
349
  catch (error) {
349
350
  const backgroundTaskManager = this.container.has("BackgroundTaskManager")
@@ -31,10 +31,10 @@ declare class ToolManager {
31
31
  *
32
32
  * This method can be called multiple times safely. When called without dependencies,
33
33
  * it registers basic tools (Bash, Read, Write, TaskCreate, etc.). When called with
34
- * dependencies, it also registers tools that require managers (Task, Skill).
34
+ * dependencies, it also registers tools that require managers (Agent, Skill).
35
35
  *
36
36
  * @param deps Optional dependencies for advanced tools
37
- * @param deps.subagentManager SubagentManager instance for Task tool
37
+ * @param deps.subagentManager SubagentManager instance for Agent tool
38
38
  * @param deps.skillManager SkillManager instance for Skill tool
39
39
  *
40
40
  * @example
@@ -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;AAuB7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,mBAAmB,CAAC;AAM3B,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;IA6BrC;;OAEG;IACH,OAAO,CAAC,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import { globTool } from "../tools/globTool.js";
10
10
  import { grepTool } from "../tools/grepTool.js";
11
- import { lsTool } from "../tools/lsTool.js";
12
11
  import { readTool } from "../tools/readTool.js";
13
12
  import { lspTool } from "../tools/lspTool.js";
14
- import { taskTool } from "../tools/taskTool.js";
13
+ import { agentTool } from "../tools/agentTool.js";
15
14
  import { skillTool } from "../tools/skillTool.js";
16
15
  import { taskCreateTool, taskGetTool, taskUpdateTool, taskListTool, } from "../tools/taskManagementTools.js";
17
16
  import { logger } from "../utils/globalLogger.js";
@@ -41,10 +40,10 @@ class ToolManager {
41
40
  *
42
41
  * This method can be called multiple times safely. When called without dependencies,
43
42
  * it registers basic tools (Bash, Read, Write, TaskCreate, etc.). When called with
44
- * dependencies, it also registers tools that require managers (Task, Skill).
43
+ * dependencies, it also registers tools that require managers (Agent, Skill).
45
44
  *
46
45
  * @param deps Optional dependencies for advanced tools
47
- * @param deps.subagentManager SubagentManager instance for Task tool
46
+ * @param deps.subagentManager SubagentManager instance for Agent tool
48
47
  * @param deps.skillManager SkillManager instance for Skill tool
49
48
  *
50
49
  * @example
@@ -70,10 +69,9 @@ class ToolManager {
70
69
  askUserQuestionTool,
71
70
  globTool,
72
71
  grepTool,
73
- lsTool,
74
72
  readTool,
75
73
  lspTool,
76
- taskTool,
74
+ agentTool,
77
75
  skillTool,
78
76
  taskCreateTool,
79
77
  taskGetTool,
@@ -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;AAiB/C,eAAO,MAAM,kBAAkB,g9DAU+J,CAAC;AAE/L,eAAO,MAAM,WAAW,qvBAIqH,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;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sBG,CAAC;AAEhD,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;CACE,GACL,MAAM,CAsCR"}
@@ -1,7 +1,7 @@
1
1
  import * as os from "node:os";
2
2
  import { isGitRepository } from "../utils/gitUtils.js";
3
3
  import { EXPLORE_SUBAGENT_TYPE, PLAN_SUBAGENT_TYPE, } from "../constants/subagents.js";
4
- import { ASK_USER_QUESTION_TOOL_NAME, BASH_TOOL_NAME, EDIT_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, READ_TOOL_NAME, WRITE_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, } from "../constants/tools.js";
4
+ import { ASK_USER_QUESTION_TOOL_NAME, BASH_TOOL_NAME, EDIT_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, READ_TOOL_NAME, WRITE_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, AGENT_TOOL_NAME, } from "../constants/tools.js";
5
5
  export const BASE_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.
6
6
 
7
7
  # Doing tasks
@@ -39,7 +39,7 @@ You should build your plan incrementally by writing to or editing this file. NOT
39
39
  ## Plan Workflow
40
40
 
41
41
  ### Phase 1: Initial Understanding
42
- Goal: Gain a comprehensive understanding of the user's request by reading through code and asking them questions. Critical: In this phase you should only use the Task subagent type with subagent_type=${EXPLORE_SUBAGENT_TYPE}.
42
+ Goal: Gain a comprehensive understanding of the user's request by reading through code and asking them questions. Critical: In this phase you should only use the ${AGENT_TOOL_NAME} tool with subagent_type=${EXPLORE_SUBAGENT_TYPE}.
43
43
 
44
44
  1. Focus on understanding the user's request and the code associated with their request. Actively search for existing functions, utilities, and patterns that can be reused — avoid proposing new code when suitable implementations already exist.
45
45
 
@@ -52,7 +52,7 @@ Goal: Gain a comprehensive understanding of the user's request by reading throug
52
52
  ### Phase 2: Design
53
53
  Goal: Design an implementation approach.
54
54
 
55
- Launch Task agent(s) with subagent_type=${PLAN_SUBAGENT_TYPE} to design the implementation based on the user's intent and your exploration results from Phase 1.
55
+ Launch agent(s) with subagent_type=${PLAN_SUBAGENT_TYPE} to design the implementation based on the user's intent and your exploration results from Phase 1.
56
56
 
57
57
  You can launch up to 3 agent(s) in parallel.
58
58
 
@@ -0,0 +1,6 @@
1
+ import type { ToolPlugin } from "./types.js";
2
+ /**
3
+ * Agent tool plugin for launching specialized agents to handle complex tasks
4
+ */
5
+ export declare const agentTool: ToolPlugin;
6
+ //# sourceMappingURL=agentTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentTool.d.ts","sourceRoot":"","sources":["../../src/tools/agentTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAStE;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,UA0PvB,CAAC"}