wave-agent-sdk 0.5.0 → 0.6.2
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 +14 -11
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +64 -151
- package/dist/constants/subagents.d.ts +5 -0
- package/dist/constants/subagents.d.ts.map +1 -0
- package/dist/constants/subagents.js +4 -0
- package/dist/constants/tools.d.ts +4 -1
- package/dist/constants/tools.d.ts.map +1 -1
- package/dist/constants/tools.js +4 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/managers/aiManager.d.ts +2 -5
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +43 -48
- package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
- package/dist/managers/backgroundTaskManager.js +63 -53
- package/dist/managers/foregroundTaskManager.d.ts.map +1 -1
- package/dist/managers/foregroundTaskManager.js +3 -2
- package/dist/managers/mcpManager.d.ts.map +1 -1
- package/dist/managers/messageManager.d.ts +13 -27
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +94 -89
- package/dist/managers/permissionManager.d.ts.map +1 -1
- package/dist/managers/permissionManager.js +25 -15
- package/dist/managers/planManager.d.ts +1 -1
- package/dist/managers/planManager.d.ts.map +1 -1
- package/dist/managers/planManager.js +2 -2
- package/dist/managers/reversionManager.d.ts.map +1 -1
- package/dist/managers/reversionManager.js +23 -2
- package/dist/managers/slashCommandManager.d.ts +3 -0
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +8 -3
- package/dist/managers/subagentManager.d.ts +8 -14
- package/dist/managers/subagentManager.d.ts.map +1 -1
- package/dist/managers/subagentManager.js +46 -112
- package/dist/managers/toolManager.d.ts +11 -0
- package/dist/managers/toolManager.d.ts.map +1 -1
- package/dist/managers/toolManager.js +20 -2
- package/dist/{constants/prompts.d.ts → prompts/index.d.ts} +17 -15
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +309 -0
- package/dist/services/aiService.d.ts +0 -1
- package/dist/services/aiService.d.ts.map +1 -1
- package/dist/services/aiService.js +4 -140
- package/dist/services/memory.d.ts +0 -3
- package/dist/services/memory.d.ts.map +1 -1
- package/dist/services/memory.js +0 -59
- package/dist/services/session.d.ts +15 -1
- package/dist/services/session.d.ts.map +1 -1
- package/dist/services/session.js +57 -1
- package/dist/services/taskManager.d.ts +25 -0
- package/dist/services/taskManager.d.ts.map +1 -0
- package/dist/services/taskManager.js +164 -0
- package/dist/tools/askUserQuestion.d.ts.map +1 -1
- package/dist/tools/askUserQuestion.js +39 -25
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +13 -11
- package/dist/tools/editTool.d.ts.map +1 -1
- package/dist/tools/editTool.js +2 -1
- package/dist/tools/exitPlanMode.d.ts.map +1 -1
- package/dist/tools/exitPlanMode.js +26 -2
- package/dist/tools/globTool.d.ts.map +1 -1
- package/dist/tools/globTool.js +8 -2
- package/dist/tools/grepTool.d.ts.map +1 -1
- package/dist/tools/grepTool.js +17 -6
- package/dist/tools/lsTool.d.ts.map +1 -1
- package/dist/tools/lsTool.js +3 -1
- package/dist/tools/readTool.d.ts.map +1 -1
- package/dist/tools/readTool.js +16 -1
- package/dist/tools/taskManagementTools.d.ts +6 -0
- package/dist/tools/taskManagementTools.d.ts.map +1 -0
- package/dist/tools/taskManagementTools.js +461 -0
- package/dist/tools/taskOutputTool.d.ts.map +1 -1
- package/dist/tools/taskOutputTool.js +32 -8
- package/dist/tools/taskStopTool.d.ts.map +1 -1
- package/dist/tools/taskStopTool.js +7 -1
- package/dist/tools/taskTool.d.ts.map +1 -1
- package/dist/tools/taskTool.js +37 -2
- package/dist/tools/types.d.ts +11 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/writeTool.d.ts.map +1 -1
- package/dist/tools/writeTool.js +9 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/messaging.d.ts +2 -18
- package/dist/types/messaging.d.ts.map +1 -1
- package/dist/types/processes.d.ts +16 -6
- package/dist/types/processes.d.ts.map +1 -1
- package/dist/types/tasks.d.ts +13 -0
- package/dist/types/tasks.d.ts.map +1 -0
- package/dist/types/tasks.js +1 -0
- package/dist/types/tools.d.ts +4 -1
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/utils/builtinSubagents.d.ts.map +1 -1
- package/dist/utils/builtinSubagents.js +59 -44
- package/dist/utils/cacheControlUtils.d.ts.map +1 -1
- package/dist/utils/cacheControlUtils.js +18 -12
- package/dist/utils/constants.d.ts +0 -4
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +0 -4
- package/dist/utils/convertMessagesForAPI.js +2 -2
- package/dist/utils/editUtils.d.ts.map +1 -1
- package/dist/utils/editUtils.js +2 -2
- package/dist/utils/gitUtils.d.ts +7 -0
- package/dist/utils/gitUtils.d.ts.map +1 -0
- package/dist/utils/gitUtils.js +24 -0
- package/dist/utils/messageOperations.d.ts +3 -58
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/messageOperations.js +4 -146
- package/dist/utils/nameGenerator.d.ts +1 -1
- package/dist/utils/nameGenerator.d.ts.map +1 -1
- package/dist/utils/nameGenerator.js +19 -3
- package/package.json +1 -1
- package/src/agent.ts +86 -183
- package/src/constants/subagents.ts +4 -0
- package/src/constants/tools.ts +4 -1
- package/src/index.ts +1 -0
- package/src/managers/aiManager.ts +63 -70
- package/src/managers/backgroundTaskManager.ts +58 -54
- package/src/managers/foregroundTaskManager.ts +3 -2
- package/src/managers/mcpManager.ts +6 -3
- package/src/managers/messageManager.ts +126 -142
- package/src/managers/permissionManager.ts +32 -21
- package/src/managers/planManager.ts +2 -2
- package/src/managers/reversionManager.ts +26 -2
- package/src/managers/slashCommandManager.ts +12 -3
- package/src/managers/subagentManager.ts +60 -144
- package/src/managers/toolManager.ts +32 -2
- package/src/prompts/index.ts +366 -0
- package/src/services/aiService.ts +3 -145
- package/src/services/memory.ts +0 -72
- package/src/services/session.ts +73 -0
- package/src/services/taskManager.ts +195 -0
- package/src/tools/askUserQuestion.ts +51 -29
- package/src/tools/bashTool.ts +15 -17
- package/src/tools/editTool.ts +3 -1
- package/src/tools/exitPlanMode.ts +27 -3
- package/src/tools/globTool.ts +10 -2
- package/src/tools/grepTool.ts +17 -6
- package/src/tools/lsTool.ts +3 -1
- package/src/tools/readTool.ts +17 -1
- package/src/tools/taskManagementTools.ts +516 -0
- package/src/tools/taskOutputTool.ts +34 -12
- package/src/tools/taskStopTool.ts +7 -1
- package/src/tools/taskTool.ts +45 -1
- package/src/tools/types.ts +12 -0
- package/src/tools/writeTool.ts +9 -2
- package/src/types/index.ts +1 -0
- package/src/types/messaging.ts +1 -21
- package/src/types/processes.ts +18 -7
- package/src/types/tasks.ts +13 -0
- package/src/types/tools.ts +4 -1
- package/src/utils/builtinSubagents.ts +81 -45
- package/src/utils/cacheControlUtils.ts +26 -18
- package/src/utils/constants.ts +0 -5
- package/src/utils/convertMessagesForAPI.ts +2 -2
- package/src/utils/editUtils.ts +2 -6
- package/src/utils/gitUtils.ts +24 -0
- package/src/utils/messageOperations.ts +6 -229
- package/src/utils/nameGenerator.ts +20 -3
- package/dist/constants/prompts.d.ts.map +0 -1
- package/dist/constants/prompts.js +0 -118
- package/dist/tools/todoWriteTool.d.ts +0 -6
- package/dist/tools/todoWriteTool.d.ts.map +0 -1
- package/dist/tools/todoWriteTool.js +0 -220
- package/src/constants/prompts.ts +0 -155
- package/src/tools/todoWriteTool.ts +0 -257
|
@@ -7,31 +7,43 @@ export const taskOutputTool = {
|
|
|
7
7
|
type: "function",
|
|
8
8
|
function: {
|
|
9
9
|
name: TASK_OUTPUT_TOOL_NAME,
|
|
10
|
-
description: "Retrieves output from a running or completed
|
|
10
|
+
description: "Retrieves output from a running or completed task",
|
|
11
11
|
parameters: {
|
|
12
12
|
type: "object",
|
|
13
13
|
properties: {
|
|
14
14
|
task_id: {
|
|
15
15
|
type: "string",
|
|
16
|
-
description: "The ID
|
|
17
|
-
},
|
|
18
|
-
filter: {
|
|
19
|
-
type: "string",
|
|
20
|
-
description: "Optional regular expression to filter the output lines.",
|
|
16
|
+
description: "The task ID to get output from",
|
|
21
17
|
},
|
|
22
18
|
block: {
|
|
23
19
|
type: "boolean",
|
|
24
|
-
|
|
20
|
+
default: true,
|
|
21
|
+
description: "Whether to wait for completion",
|
|
22
|
+
},
|
|
23
|
+
timeout: {
|
|
24
|
+
type: "number",
|
|
25
|
+
minimum: 0,
|
|
26
|
+
maximum: 600000,
|
|
27
|
+
default: 30000,
|
|
28
|
+
description: "Max wait time in ms",
|
|
25
29
|
},
|
|
26
30
|
},
|
|
27
31
|
required: ["task_id"],
|
|
28
32
|
},
|
|
29
33
|
},
|
|
30
34
|
},
|
|
35
|
+
prompt: () => `- Retrieves output from a running or completed task (background shell, agent, or remote session)
|
|
36
|
+
- Takes a task_id parameter identifying the task
|
|
37
|
+
- Returns the task output along with status information
|
|
38
|
+
- Use block=true (default) to wait for task completion
|
|
39
|
+
- Use block=false for non-blocking check of current status
|
|
40
|
+
- Task IDs can be found using the /tasks command
|
|
41
|
+
- Works with all task types: background shells, async agents, and remote sessions`,
|
|
31
42
|
execute: async (args, context) => {
|
|
32
43
|
const taskId = args.task_id;
|
|
33
44
|
const filter = args.filter;
|
|
34
|
-
const block = args.block;
|
|
45
|
+
const block = args.block ?? true;
|
|
46
|
+
const timeout = args.timeout ?? 30000;
|
|
35
47
|
if (!taskId || typeof taskId !== "string") {
|
|
36
48
|
return {
|
|
37
49
|
success: false,
|
|
@@ -74,6 +86,7 @@ export const taskOutputTool = {
|
|
|
74
86
|
return new Promise((resolve) => {
|
|
75
87
|
let timeoutHandle = null;
|
|
76
88
|
let isAborted = false;
|
|
89
|
+
const startTime = Date.now();
|
|
77
90
|
const cleanup = () => {
|
|
78
91
|
if (timeoutHandle) {
|
|
79
92
|
clearTimeout(timeoutHandle);
|
|
@@ -101,6 +114,17 @@ export const taskOutputTool = {
|
|
|
101
114
|
const check = () => {
|
|
102
115
|
if (isAborted)
|
|
103
116
|
return;
|
|
117
|
+
if (Date.now() - startTime > timeout) {
|
|
118
|
+
if (context.abortSignal) {
|
|
119
|
+
context.abortSignal.removeEventListener("abort", onAbort);
|
|
120
|
+
}
|
|
121
|
+
resolve({
|
|
122
|
+
success: true,
|
|
123
|
+
content: "Retrieval timed out",
|
|
124
|
+
shortResult: `${taskId}: timeout`,
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
104
128
|
const task = backgroundTaskManager.getTask(taskId);
|
|
105
129
|
if (!task) {
|
|
106
130
|
if (context.abortSignal) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskStopTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskStopTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,UAAU,EAAc,MAAM,YAAY,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"taskStopTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskStopTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,UAAU,EAAc,MAAM,YAAY,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,UA0E1B,CAAC"}
|
|
@@ -5,7 +5,7 @@ export const taskStopTool = {
|
|
|
5
5
|
type: "function",
|
|
6
6
|
function: {
|
|
7
7
|
name: TASK_STOP_TOOL_NAME,
|
|
8
|
-
description: "
|
|
8
|
+
description: "Stop a running background task by ID",
|
|
9
9
|
parameters: {
|
|
10
10
|
type: "object",
|
|
11
11
|
properties: {
|
|
@@ -18,6 +18,12 @@ export const taskStopTool = {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
|
+
prompt: () => `
|
|
22
|
+
- Stops a running background task by its ID
|
|
23
|
+
- Takes a task_id parameter identifying the task to stop
|
|
24
|
+
- Returns a success or failure status
|
|
25
|
+
- Use this tool when you need to terminate a long-running task
|
|
26
|
+
`,
|
|
21
27
|
execute: async (args, context) => {
|
|
22
28
|
const taskId = args.task_id;
|
|
23
29
|
if (!taskId || typeof taskId !== "string") {
|
|
@@ -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;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"taskTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAItE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,eAAe,GAAG,UAAU,CAwO3E"}
|
package/dist/tools/taskTool.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EXPLORE_SUBAGENT_TYPE } from "../constants/subagents.js";
|
|
1
2
|
import { TASK_TOOL_NAME } from "../constants/tools.js";
|
|
2
3
|
/**
|
|
3
4
|
* Create a task tool plugin that uses the provided SubagentManager
|
|
@@ -48,6 +49,10 @@ export function createTaskTool(subagentManager) {
|
|
|
48
49
|
},
|
|
49
50
|
};
|
|
50
51
|
},
|
|
52
|
+
prompt: () => `
|
|
53
|
+
- When doing file search, prefer to use the ${TASK_TOOL_NAME} tool in order to reduce context usage.
|
|
54
|
+
- You should proactively use the ${TASK_TOOL_NAME} tool with specialized agents when the task at hand matches the agent's description.
|
|
55
|
+
- VERY IMPORTANT: When exploring the codebase to gather context or to answer a question that is not a needle query for a specific file/class/function, it is CRITICAL that you use the ${TASK_TOOL_NAME} tool with subagent_type=${EXPLORE_SUBAGENT_TYPE} instead of running search commands directly.`,
|
|
51
56
|
execute: async (args, context) => {
|
|
52
57
|
return new Promise((resolve) => {
|
|
53
58
|
(async () => {
|
|
@@ -94,12 +99,39 @@ export function createTaskTool(subagentManager) {
|
|
|
94
99
|
shortResult: "Subagent not found",
|
|
95
100
|
});
|
|
96
101
|
}
|
|
102
|
+
// Set up callback to update shortResult with tool names, tool count and tokens
|
|
103
|
+
const updateShortResult = () => {
|
|
104
|
+
const messages = instance.messageManager.getMessages();
|
|
105
|
+
const tokens = instance.messageManager.getlatestTotalTokens();
|
|
106
|
+
const lastTools = instance.lastTools;
|
|
107
|
+
// Count tool blocks in messages
|
|
108
|
+
let toolCount = 0;
|
|
109
|
+
messages.forEach((msg) => {
|
|
110
|
+
msg.blocks.forEach((block) => {
|
|
111
|
+
if (block.type === "tool") {
|
|
112
|
+
toolCount++;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
let shortResult = "";
|
|
117
|
+
if (lastTools.length > 0) {
|
|
118
|
+
shortResult += `${lastTools.join(", ")} `;
|
|
119
|
+
}
|
|
120
|
+
shortResult += `(${toolCount} tools`;
|
|
121
|
+
if (tokens > 0) {
|
|
122
|
+
shortResult += ` | ${tokens.toLocaleString()} tokens`;
|
|
123
|
+
}
|
|
124
|
+
shortResult += ")";
|
|
125
|
+
context.onShortResultUpdate?.(shortResult);
|
|
126
|
+
};
|
|
97
127
|
// Create subagent instance and execute task
|
|
98
128
|
const instance = await subagentManager.createInstance(configuration, {
|
|
99
129
|
description,
|
|
100
130
|
prompt,
|
|
101
131
|
subagent_type,
|
|
102
|
-
}, run_in_background);
|
|
132
|
+
}, run_in_background, updateShortResult);
|
|
133
|
+
// Initial update
|
|
134
|
+
updateShortResult();
|
|
103
135
|
let isBackgrounded = false;
|
|
104
136
|
// Register for backgrounding if not already in background
|
|
105
137
|
if (!run_in_background && context.foregroundTaskManager) {
|
|
@@ -111,8 +143,9 @@ export function createTaskTool(subagentManager) {
|
|
|
111
143
|
// Resolve the tool execution early so the main agent can continue
|
|
112
144
|
resolve({
|
|
113
145
|
success: true,
|
|
114
|
-
content: `Task moved to background with ID: ${taskId}
|
|
146
|
+
content: `Task moved to background with ID: ${taskId}.`,
|
|
115
147
|
shortResult: "Task backgrounded",
|
|
148
|
+
isManuallyBackgrounded: true,
|
|
116
149
|
});
|
|
117
150
|
},
|
|
118
151
|
});
|
|
@@ -128,6 +161,8 @@ export function createTaskTool(subagentManager) {
|
|
|
128
161
|
shortResult: `Task started in background: ${result}`,
|
|
129
162
|
});
|
|
130
163
|
}
|
|
164
|
+
// Cleanup subagent instance after task completion
|
|
165
|
+
subagentManager.cleanupInstance(instance.subagentId);
|
|
131
166
|
return resolve({
|
|
132
167
|
success: true,
|
|
133
168
|
content: result,
|
package/dist/tools/types.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export interface ToolPlugin {
|
|
|
8
8
|
config: ChatCompletionFunctionTool;
|
|
9
9
|
execute: (args: Record<string, unknown>, context: ToolContext) => Promise<ToolResult>;
|
|
10
10
|
formatCompactParams?: (params: Record<string, unknown>, context: ToolContext) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Optional function to provide a prompt to be added to the system prompt
|
|
13
|
+
*/
|
|
14
|
+
prompt?: () => string;
|
|
11
15
|
}
|
|
12
16
|
export interface ToolResult {
|
|
13
17
|
success: boolean;
|
|
@@ -19,6 +23,7 @@ export interface ToolResult {
|
|
|
19
23
|
data: string;
|
|
20
24
|
mediaType?: string;
|
|
21
25
|
}>;
|
|
26
|
+
isManuallyBackgrounded?: boolean;
|
|
22
27
|
}
|
|
23
28
|
export interface ToolContext {
|
|
24
29
|
abortSignal?: AbortSignal;
|
|
@@ -41,5 +46,11 @@ export interface ToolContext {
|
|
|
41
46
|
messageId?: string;
|
|
42
47
|
/** Foreground task manager for backgrounding tasks */
|
|
43
48
|
foregroundTaskManager?: import("../types/processes.js").IForegroundTaskManager;
|
|
49
|
+
/** Task manager instance for task management */
|
|
50
|
+
taskManager: import("../services/taskManager.js").TaskManager;
|
|
51
|
+
/** Current session ID */
|
|
52
|
+
sessionId?: string;
|
|
53
|
+
/** Callback to update the short result of the current tool block */
|
|
54
|
+
onShortResultUpdate?: (shortResult: string) => void;
|
|
44
55
|
}
|
|
45
56
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,mBAAmB,CAAC,EAAE,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,WAAW,KACjB,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAA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qBAAqB,CAAC,EAAE,OAAO,uBAAuB,EAAE,sBAAsB,CAAC;IAC/E,gDAAgD;IAChD,WAAW,EAAE,OAAO,4BAA4B,EAAE,WAAW,CAAC;IAC9D,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeTool.d.ts","sourceRoot":"","sources":["../../src/tools/writeTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAGtE;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"writeTool.d.ts","sourceRoot":"","sources":["../../src/tools/writeTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAGtE;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,UAiMvB,CAAC"}
|
package/dist/tools/writeTool.js
CHANGED
|
@@ -11,7 +11,7 @@ export const writeTool = {
|
|
|
11
11
|
type: "function",
|
|
12
12
|
function: {
|
|
13
13
|
name: "Write",
|
|
14
|
-
description: "Writes a file to the local filesystem
|
|
14
|
+
description: "Writes a file to the local filesystem.",
|
|
15
15
|
parameters: {
|
|
16
16
|
type: "object",
|
|
17
17
|
properties: {
|
|
@@ -29,6 +29,14 @@ export const writeTool = {
|
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
+
prompt: () => `
|
|
33
|
+
Usage:
|
|
34
|
+
- This tool will overwrite the existing file if there is one at the provided path.
|
|
35
|
+
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
|
|
36
|
+
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
37
|
+
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
|
38
|
+
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.
|
|
39
|
+
- IMPORTANT: Always provide file_path parameter before content parameter when calling this tool.`,
|
|
32
40
|
execute: async (args, context) => {
|
|
33
41
|
const filePath = args.file_path;
|
|
34
42
|
const content = args.content;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,WAAW,CAAC;AAG1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Dependencies: Core (Usage)
|
|
4
4
|
*/
|
|
5
5
|
import type { Usage } from "./core.js";
|
|
6
|
-
import type { SubagentConfiguration } from "../utils/subagentParser.js";
|
|
7
6
|
export declare enum MessageSource {
|
|
8
7
|
USER = "user",
|
|
9
8
|
HOOK = "hook"
|
|
@@ -15,7 +14,7 @@ export interface Message {
|
|
|
15
14
|
usage?: Usage;
|
|
16
15
|
additionalFields?: Record<string, unknown>;
|
|
17
16
|
}
|
|
18
|
-
export type MessageBlock = TextBlock | ErrorBlock | ToolBlock | ImageBlock | CommandOutputBlock | CompressBlock |
|
|
17
|
+
export type MessageBlock = TextBlock | ErrorBlock | ToolBlock | ImageBlock | CommandOutputBlock | CompressBlock | ReasoningBlock | FileHistoryBlock;
|
|
19
18
|
export interface TextBlock {
|
|
20
19
|
type: "text";
|
|
21
20
|
content: string;
|
|
@@ -49,6 +48,7 @@ export interface ToolBlock {
|
|
|
49
48
|
error?: string | Error;
|
|
50
49
|
compactParams?: string;
|
|
51
50
|
parametersChunk?: string;
|
|
51
|
+
isManuallyBackgrounded?: boolean;
|
|
52
52
|
}
|
|
53
53
|
export interface ImageBlock {
|
|
54
54
|
type: "image";
|
|
@@ -66,22 +66,6 @@ export interface CompressBlock {
|
|
|
66
66
|
content: string;
|
|
67
67
|
sessionId: string;
|
|
68
68
|
}
|
|
69
|
-
export interface MemoryBlock {
|
|
70
|
-
type: "memory";
|
|
71
|
-
content: string;
|
|
72
|
-
isSuccess: boolean;
|
|
73
|
-
memoryType?: "project" | "user";
|
|
74
|
-
storagePath?: string;
|
|
75
|
-
}
|
|
76
|
-
export interface SubagentBlock {
|
|
77
|
-
type: "subagent";
|
|
78
|
-
subagentId: string;
|
|
79
|
-
subagentName: string;
|
|
80
|
-
status: "active" | "completed" | "error" | "aborted";
|
|
81
|
-
sessionId: string;
|
|
82
|
-
configuration: SubagentConfiguration;
|
|
83
|
-
runInBackground?: boolean;
|
|
84
|
-
}
|
|
85
69
|
export interface ReasoningBlock {
|
|
86
70
|
type: "reasoning";
|
|
87
71
|
content: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/types/messaging.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/types/messaging.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,aAAa,GACb,cAAc,GACd,gBAAgB,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,aAAa,CAA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jB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,OAAO,gBAAgB,EAAE,YAAY,EAAE,CAAC;CACpD"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type { ChildProcess } from "child_process";
|
|
6
6
|
export type BackgroundTaskStatus = "running" | "completed" | "failed" | "killed";
|
|
7
7
|
export type BackgroundTaskType = "shell" | "subagent";
|
|
8
|
-
export interface
|
|
8
|
+
export interface BackgroundTaskBase {
|
|
9
9
|
id: string;
|
|
10
10
|
type: BackgroundTaskType;
|
|
11
11
|
status: BackgroundTaskStatus;
|
|
@@ -17,11 +17,25 @@ export interface BackgroundTask {
|
|
|
17
17
|
stderr: string;
|
|
18
18
|
exitCode?: number;
|
|
19
19
|
runtime?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Optional callback to be executed when the task is stopped.
|
|
22
|
+
* This allows tasks to define their own cleanup/abortion logic.
|
|
23
|
+
*/
|
|
24
|
+
onStop?: () => void | Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Optional subagent ID associated with this task.
|
|
27
|
+
* Used for cleanup when the task is stopped.
|
|
28
|
+
*/
|
|
29
|
+
subagentId?: string;
|
|
20
30
|
}
|
|
21
|
-
export interface BackgroundShell extends
|
|
31
|
+
export interface BackgroundShell extends BackgroundTaskBase {
|
|
22
32
|
type: "shell";
|
|
23
33
|
process: ChildProcess;
|
|
24
34
|
}
|
|
35
|
+
export interface BackgroundSubagent extends BackgroundTaskBase {
|
|
36
|
+
type: "subagent";
|
|
37
|
+
}
|
|
38
|
+
export type BackgroundTask = BackgroundShell | BackgroundSubagent;
|
|
25
39
|
export interface ForegroundTask {
|
|
26
40
|
id: string;
|
|
27
41
|
backgroundHandler: () => Promise<void>;
|
|
@@ -30,8 +44,4 @@ export interface IForegroundTaskManager {
|
|
|
30
44
|
registerForegroundTask(task: ForegroundTask): void;
|
|
31
45
|
unregisterForegroundTask(id: string): void;
|
|
32
46
|
}
|
|
33
|
-
export interface IForegroundTaskManager {
|
|
34
|
-
registerForegroundTask(task: ForegroundTask): void;
|
|
35
|
-
unregisterForegroundTask(id: string): void;
|
|
36
|
-
}
|
|
37
47
|
//# sourceMappingURL=processes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processes.d.ts","sourceRoot":"","sources":["../../src/types/processes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,WAAW,GACX,QAAQ,GACR,QAAQ,CAAC;AACb,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"processes.d.ts","sourceRoot":"","sources":["../../src/types/processes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,WAAW,GACX,QAAQ,GACR,QAAQ,CAAC;AACb,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAElE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,sBAAsB;IACrC,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IACnD,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type TaskStatus = "pending" | "in_progress" | "completed" | "deleted";
|
|
2
|
+
export interface Task {
|
|
3
|
+
id: string;
|
|
4
|
+
subject: string;
|
|
5
|
+
description: string;
|
|
6
|
+
status: TaskStatus;
|
|
7
|
+
activeForm?: string;
|
|
8
|
+
owner?: string;
|
|
9
|
+
blocks: string[];
|
|
10
|
+
blockedBy: string[];
|
|
11
|
+
metadata: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/types/tasks.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;AAE7E,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/tools.d.ts
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
export interface AskUserQuestionOption {
|
|
8
8
|
label: string;
|
|
9
9
|
description?: string;
|
|
10
|
-
isRecommended?: boolean;
|
|
11
10
|
}
|
|
12
11
|
export interface AskUserQuestion {
|
|
13
12
|
question: string;
|
|
@@ -17,6 +16,10 @@ export interface AskUserQuestion {
|
|
|
17
16
|
}
|
|
18
17
|
export interface AskUserQuestionInput {
|
|
19
18
|
questions: AskUserQuestion[];
|
|
19
|
+
answers?: Record<string, string>;
|
|
20
|
+
metadata?: {
|
|
21
|
+
source?: string;
|
|
22
|
+
};
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
25
|
* Parameters for the Write tool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE;QACT,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtinSubagents.d.ts","sourceRoot":"","sources":["../../src/utils/builtinSubagents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"builtinSubagents.d.ts","sourceRoot":"","sources":["../../src/utils/builtinSubagents.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,qBAAqB,EAAE,CAQ7D"}
|
|
@@ -1,25 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BASH_SUBAGENT_TYPE, EXPLORE_SUBAGENT_TYPE, PLAN_SUBAGENT_TYPE, GENERAL_PURPOSE_SUBAGENT_TYPE, } from "../constants/subagents.js";
|
|
2
|
+
import { BASH_SUBAGENT_SYSTEM_PROMPT, GENERAL_PURPOSE_SYSTEM_PROMPT, PLAN_SUBAGENT_SYSTEM_PROMPT, EXPLORE_SUBAGENT_SYSTEM_PROMPT, } from "../prompts/index.js";
|
|
3
|
+
import { BASH_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, READ_TOOL_NAME, LS_TOOL_NAME, LSP_TOOL_NAME, } from "../constants/tools.js";
|
|
2
4
|
/**
|
|
3
5
|
* Get all built-in subagent configurations
|
|
4
6
|
* Built-in subagents have priority 3 (lowest) and can be overridden by user/project configs
|
|
5
7
|
*/
|
|
6
8
|
export function getBuiltinSubagents() {
|
|
7
9
|
return [
|
|
10
|
+
createBashSubagent(),
|
|
8
11
|
createExploreSubagent(),
|
|
9
12
|
createGeneralPurposeSubagent(),
|
|
13
|
+
createPlanSubagent(),
|
|
10
14
|
// Add more built-in subagents here as needed
|
|
11
15
|
];
|
|
12
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Create the Bash built-in subagent configuration
|
|
19
|
+
* Specialized for executing bash commands and git operations
|
|
20
|
+
*/
|
|
21
|
+
function createBashSubagent() {
|
|
22
|
+
return {
|
|
23
|
+
name: BASH_SUBAGENT_TYPE,
|
|
24
|
+
description: "Command execution specialist for running bash commands. Use this for git operations, command execution, and other terminal tasks.",
|
|
25
|
+
systemPrompt: BASH_SUBAGENT_SYSTEM_PROMPT,
|
|
26
|
+
tools: [BASH_TOOL_NAME],
|
|
27
|
+
model: "inherit",
|
|
28
|
+
filePath: `<builtin:${BASH_SUBAGENT_TYPE}>`,
|
|
29
|
+
scope: "builtin",
|
|
30
|
+
priority: 3,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
13
33
|
/**
|
|
14
34
|
* Create the General-Purpose built-in subagent configuration
|
|
15
35
|
* Specialized for multi-step research and implementation tasks
|
|
16
36
|
*/
|
|
17
37
|
function createGeneralPurposeSubagent() {
|
|
18
38
|
return {
|
|
19
|
-
name:
|
|
39
|
+
name: GENERAL_PURPOSE_SUBAGENT_TYPE,
|
|
20
40
|
description: "General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.",
|
|
21
41
|
systemPrompt: GENERAL_PURPOSE_SYSTEM_PROMPT,
|
|
22
|
-
filePath:
|
|
42
|
+
filePath: `<builtin:${GENERAL_PURPOSE_SUBAGENT_TYPE}>`,
|
|
23
43
|
scope: "builtin",
|
|
24
44
|
priority: 3,
|
|
25
45
|
};
|
|
@@ -29,52 +49,47 @@ function createGeneralPurposeSubagent() {
|
|
|
29
49
|
* Specialized for codebase exploration and file search tasks
|
|
30
50
|
*/
|
|
31
51
|
function createExploreSubagent() {
|
|
32
|
-
const systemPrompt = `You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
|
|
33
|
-
|
|
34
|
-
=== CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS ===
|
|
35
|
-
This is a READ-ONLY exploration task. You are STRICTLY PROHIBITED from:
|
|
36
|
-
- Creating new files (no Write, touch, or file creation of any kind)
|
|
37
|
-
- Modifying existing files (no Edit operations)
|
|
38
|
-
- Deleting files (no rm or deletion)
|
|
39
|
-
- Moving or copying files (no mv or cp)
|
|
40
|
-
- Creating temporary files anywhere, including /tmp
|
|
41
|
-
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
42
|
-
- Running ANY commands that change system state
|
|
43
|
-
|
|
44
|
-
Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools - attempting to edit files will fail.
|
|
45
|
-
|
|
46
|
-
Your strengths:
|
|
47
|
-
- Rapidly finding files using glob patterns
|
|
48
|
-
- Searching code and text with powerful regex patterns
|
|
49
|
-
- Reading and analyzing file contents
|
|
50
|
-
- Using Language Server Protocol (LSP) for deep code intelligence (definitions, references, etc.)
|
|
51
|
-
|
|
52
|
-
Guidelines:
|
|
53
|
-
- Use Glob for broad file pattern matching
|
|
54
|
-
- Use Grep for searching file contents with regex
|
|
55
|
-
- Use Read when you know the specific file path you need to read
|
|
56
|
-
- Use LSP for code intelligence features like finding definitions, references, implementations, and symbols. This is especially useful for understanding complex code relationships.
|
|
57
|
-
- Use Bash ONLY for read-only operations (ls, git status, git log, git diff, find, cat, head, tail)
|
|
58
|
-
- NEVER use Bash for: mkdir, touch, rm, cp, mv, git add, git commit, npm install, pip install, or any file creation/modification
|
|
59
|
-
- Adapt your search approach based on the thoroughness level specified by the caller
|
|
60
|
-
- Return file paths as absolute paths in your final response
|
|
61
|
-
- For clear communication, avoid using emojis
|
|
62
|
-
- Communicate your final report directly as a regular message - do NOT attempt to create files
|
|
63
|
-
|
|
64
|
-
NOTE: You are meant to be a fast agent that returns output as quickly as possible. In order to achieve this you must:
|
|
65
|
-
- Make efficient use of the tools that you have at your disposal: be smart about how you search for files and implementations
|
|
66
|
-
- Wherever possible you should try to spawn multiple parallel tool calls for grepping and reading files
|
|
67
|
-
|
|
68
|
-
Complete the user's search request efficiently and report your findings clearly.`;
|
|
69
52
|
// Define allowed tools for read-only operations
|
|
70
|
-
const allowedTools = [
|
|
53
|
+
const allowedTools = [
|
|
54
|
+
GLOB_TOOL_NAME,
|
|
55
|
+
GREP_TOOL_NAME,
|
|
56
|
+
READ_TOOL_NAME,
|
|
57
|
+
BASH_TOOL_NAME,
|
|
58
|
+
LS_TOOL_NAME,
|
|
59
|
+
LSP_TOOL_NAME,
|
|
60
|
+
];
|
|
71
61
|
return {
|
|
72
|
-
name:
|
|
62
|
+
name: EXPLORE_SUBAGENT_TYPE,
|
|
73
63
|
description: 'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.',
|
|
74
|
-
systemPrompt,
|
|
64
|
+
systemPrompt: EXPLORE_SUBAGENT_SYSTEM_PROMPT,
|
|
75
65
|
tools: allowedTools,
|
|
76
66
|
model: "fastModel", // Special value that will use parent's fastModel
|
|
77
|
-
filePath:
|
|
67
|
+
filePath: `<builtin:${EXPLORE_SUBAGENT_TYPE}>`,
|
|
68
|
+
scope: "builtin",
|
|
69
|
+
priority: 3, // Lowest priority - can be overridden by user configs
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create the Plan built-in subagent configuration
|
|
74
|
+
* Specialized for designing implementation plans and exploring codebases in read-only mode
|
|
75
|
+
*/
|
|
76
|
+
function createPlanSubagent() {
|
|
77
|
+
// Define allowed tools for read-only operations
|
|
78
|
+
const allowedTools = [
|
|
79
|
+
GLOB_TOOL_NAME,
|
|
80
|
+
GREP_TOOL_NAME,
|
|
81
|
+
READ_TOOL_NAME,
|
|
82
|
+
BASH_TOOL_NAME,
|
|
83
|
+
LS_TOOL_NAME,
|
|
84
|
+
LSP_TOOL_NAME,
|
|
85
|
+
];
|
|
86
|
+
return {
|
|
87
|
+
name: PLAN_SUBAGENT_TYPE,
|
|
88
|
+
description: "Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs.",
|
|
89
|
+
systemPrompt: PLAN_SUBAGENT_SYSTEM_PROMPT,
|
|
90
|
+
tools: allowedTools,
|
|
91
|
+
model: "inherit", // Uses parent agent's model
|
|
92
|
+
filePath: `<builtin:${PLAN_SUBAGENT_TYPE}>`,
|
|
78
93
|
scope: "builtin",
|
|
79
94
|
priority: 3, // Lowest priority - can be overridden by user configs
|
|
80
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheControlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/cacheControlUtils.ts"],"names":[],"mappings":"AAAA;;;;;;GA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