refactor subagent namings
This commit is contained in:
parent
675378f1a3
commit
1a06d69297
6 changed files with 20 additions and 20 deletions
|
|
@ -22,10 +22,10 @@ export const BUILT_IN_AGENTS: Record<string, AgentConfig> = {
|
|||
runTerminalCommand: true,
|
||||
Fetch: true,
|
||||
writeChecklist: true,
|
||||
// Explicitly disable Task to prevent recursion
|
||||
Task: false,
|
||||
// Explicitly disable Subagent to prevent recursion
|
||||
Subagent: false,
|
||||
},
|
||||
// model: "haiku-4-5-latest", // if the model is not there, skip the task tool (check api key?)
|
||||
// model: "haiku-4-5-latest", // if the model is not there, skip the subagent tool (check api key?)
|
||||
systemPrompt: `You are a specialized task execution agent.
|
||||
|
||||
Your role:
|
||||
|
|
@ -58,13 +58,13 @@ export function listSubagents(): AgentConfig[] {
|
|||
/**
|
||||
* Generate dynamic tool description listing available agents
|
||||
*/
|
||||
export function generateTaskToolDescription(): string {
|
||||
export function generateSubagentToolDescription(): string {
|
||||
const agents = listSubagents();
|
||||
const agentList = agents
|
||||
.map((agent) => ` - ${agent.name}: ${agent.description}`)
|
||||
.join("\n");
|
||||
|
||||
return `Launch a specialized agent to handle complex, multi-step tasks autonomously.
|
||||
return `Launch a specialized subagent to handle complex, multi-step tasks autonomously.
|
||||
|
||||
Available agent types:
|
||||
${agentList}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export async function executeSubAgent(
|
|||
logger.debug("debug1 Filtered tools for agent", {
|
||||
agent: agent.name,
|
||||
toolCount: allowedTools.length,
|
||||
tools: allowedTools.map((t) => t.name).filter((t) => t !== "Task"),
|
||||
tools: allowedTools.map((t) => t.name).filter((t) => t !== "Subagent"), // explicityly remove subagent to prevent recursion
|
||||
});
|
||||
|
||||
// Build agent system message
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { readFileTool } from "./readFile.js";
|
|||
import { reportFailureTool } from "./reportFailure.js";
|
||||
import { runTerminalCommandTool } from "./runTerminalCommand.js";
|
||||
import { searchCodeTool } from "./searchCode.js";
|
||||
import { taskTool } from "./task.js";
|
||||
import { subagentTool } from "./subagent.js";
|
||||
import { uploadArtifactTool } from "./uploadArtifact.js";
|
||||
import { writeChecklistTool } from "./writeChecklist.js";
|
||||
import { writeFileTool } from "./writeFile.js";
|
||||
|
|
@ -23,7 +23,7 @@ export const ALL_BUILT_IN_TOOLS = [
|
|||
runTerminalCommandTool,
|
||||
fetchTool,
|
||||
writeChecklistTool,
|
||||
taskTool,
|
||||
subagentTool,
|
||||
exitTool,
|
||||
reportFailureTool,
|
||||
uploadArtifactTool,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import { readFileTool } from "./readFile.js";
|
|||
import { reportFailureTool } from "./reportFailure.js";
|
||||
import { runTerminalCommandTool } from "./runTerminalCommand.js";
|
||||
import { checkIfRipgrepIsInstalled, searchCodeTool } from "./searchCode.js";
|
||||
import { taskTool } from "./task.js";
|
||||
import { subagentTool } from "./subagent.js";
|
||||
import { isBetaUploadArtifactToolEnabled } from "./toolsConfig.js";
|
||||
import {
|
||||
type Tool,
|
||||
|
|
@ -120,7 +120,7 @@ export async function getAllAvailableTools(
|
|||
tools.push(exitTool);
|
||||
}
|
||||
|
||||
tools.push(taskTool);
|
||||
tools.push(subagentTool);
|
||||
|
||||
const mcpState = await serviceContainer.get<MCPServiceState>(
|
||||
SERVICE_NAMES.MCP,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { services } from "../services/index.js";
|
||||
import {
|
||||
generateTaskToolDescription,
|
||||
generateSubagentToolDescription,
|
||||
getAgent,
|
||||
} from "../subagent/builtInAgents.js";
|
||||
import { executeSubAgent } from "../subagent/executor.js";
|
||||
|
|
@ -8,10 +8,10 @@ import { logger } from "../util/logger.js";
|
|||
|
||||
import { Tool } from "./types.js";
|
||||
|
||||
export const taskTool: Tool = {
|
||||
name: "Task",
|
||||
displayName: "Task",
|
||||
description: generateTaskToolDescription(),
|
||||
export const subagentTool: Tool = {
|
||||
name: "Subagent",
|
||||
displayName: "Subagent",
|
||||
description: generateSubagentToolDescription(),
|
||||
readonly: false,
|
||||
isBuiltIn: true,
|
||||
|
||||
|
|
@ -115,8 +115,8 @@ const ToolResultSummary: React.FC<ToolResultSummaryProps> = ({
|
|||
}
|
||||
}
|
||||
|
||||
// show streaming output for task tool output
|
||||
if (toolName === "Task") {
|
||||
// show streaming output for subagent tool output
|
||||
if (toolName === "Subagent") {
|
||||
const metadataIndex = content.indexOf("<task_metadata>");
|
||||
const actualOutput =
|
||||
metadataIndex >= 0 ? content.slice(0, metadataIndex).trim() : content;
|
||||
|
|
@ -125,7 +125,7 @@ const ToolResultSummary: React.FC<ToolResultSummaryProps> = ({
|
|||
return (
|
||||
<Box>
|
||||
<Text color="dim">⎿ </Text>
|
||||
<Text color="dim"> Task executing...</Text>
|
||||
<Text color="dim"> Subagent executing...</Text>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ const ToolResultSummary: React.FC<ToolResultSummaryProps> = ({
|
|||
<Box flexDirection="column">
|
||||
<Box>
|
||||
<Text color="dim">⎿ </Text>
|
||||
<Text color="dim"> Task output:</Text>
|
||||
<Text color="dim"> Subagent output:</Text>
|
||||
</Box>
|
||||
<Box paddingLeft={2}>
|
||||
<Text>{actualOutput.trimEnd()}</Text>
|
||||
|
|
@ -151,7 +151,7 @@ const ToolResultSummary: React.FC<ToolResultSummaryProps> = ({
|
|||
<Box flexDirection="column">
|
||||
<Box>
|
||||
<Text color="dim">⎿ </Text>
|
||||
<Text color="dim"> Task output:</Text>
|
||||
<Text color="dim"> Subagent output:</Text>
|
||||
</Box>
|
||||
<Box paddingLeft={2}>
|
||||
<Text color="dim">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue