Skip to content

Commit 8590251

Browse files
committed
chore: rename refactor - may not use this
1 parent 1de07ed commit 8590251

35 files changed

+104
-162
lines changed

docs/tools/agent-tools.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
The agent tools provide ways to create and interact with sub-agents. There are two approaches available:
44

5-
1. The original `subAgent` tool (synchronous, blocking)
5+
1. The original `agentExecute` tool (synchronous, blocking)
66
2. The new `agentStart` and `agentMessage` tools (asynchronous, non-blocking)
77

8-
## subAgent Tool
8+
## agentExecute Tool
99

10-
The `subAgent` tool creates a sub-agent that runs synchronously until completion. The parent agent waits for the sub-agent to complete before continuing.
10+
The `agentExecute` tool creates a sub-agent that runs synchronously until completion. The parent agent waits for the sub-agent to complete before continuing.
1111

1212
```typescript
13-
subAgent({
13+
agentExecute({
1414
description: "A brief description of the sub-agent's purpose",
1515
goal: 'The main objective that the sub-agent needs to achieve',
1616
projectContext: 'Context about the problem or environment',
@@ -123,7 +123,7 @@ while (!agent1Completed || !agent2Completed) {
123123

124124
## Choosing Between Approaches
125125

126-
- Use `subAgent` for simpler tasks where blocking execution is acceptable
126+
- Use `agentExecute` for simpler tasks where blocking execution is acceptable
127127
- Use `agentStart` and `agentMessage` for:
128128
- Parallel execution of multiple sub-agents
129129
- Tasks where you need to monitor progress

packages/agent/CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# [mycoder-agent-v1.4.2](https://github.com/drivecore/mycoder/compare/mycoder-agent-v1.4.1...mycoder-agent-v1.4.2) (2025-03-14)
22

3-
43
### Bug Fixes
54

6-
* improve profiling ([79a3df2](https://github.com/drivecore/mycoder/commit/79a3df2db13b8372666c6604ebe1666d33663be9))
5+
- improve profiling ([79a3df2](https://github.com/drivecore/mycoder/commit/79a3df2db13b8372666c6604ebe1666d33663be9))
76

87
# [mycoder-agent-v1.4.1](https://github.com/drivecore/mycoder/compare/mycoder-agent-v1.4.0...mycoder-agent-v1.4.1) (2025-03-14)
98

@@ -56,7 +55,7 @@
5655
- llm choice working well for openai, anthropic and ollama ([68d34ab](https://github.com/drivecore/mycoder/commit/68d34abf8a73ed533a072359ce334a9364753425))
5756
- **openai:** add OpenAI dependency to agent package and enable provider in config ([30b0807](https://github.com/drivecore/mycoder/commit/30b0807d4f3ecdd24f53b7ee4160645a4ed10444))
5857
- replace @semantic-release/npm with @anolilab/semantic-release-pnpm to properly resolve workspace references ([bacb51f](https://github.com/drivecore/mycoder/commit/bacb51f637f2b2d3b1039bdfdbd33e3d704b6cde))
59-
- up subagent iterations to 200 from 50 ([b405f1e](https://github.com/drivecore/mycoder/commit/b405f1e6d62eb5304dc1aa6c0ff28dc49dc67dce))
58+
- up agentExecute iterations to 200 from 50 ([b405f1e](https://github.com/drivecore/mycoder/commit/b405f1e6d62eb5304dc1aa6c0ff28dc49dc67dce))
6059

6160
### Features
6261

packages/agent/src/core/backgroundTools.cleanup.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
22

33
// Import mocked modules
4+
import { agentStates } from '../tools/agent/agentStart.js';
45
import { BrowserManager } from '../tools/browser/BrowserManager.js';
5-
import { agentStates } from '../tools/interaction/agentStart.js';
6-
import { shellTracker } from '../tools/system/ShellTracker.js';
6+
import { shellTracker } from '../tools/shell/ShellTracker.js';
77

88
import { BackgroundTools, BackgroundToolStatus } from './backgroundTools';
99
import { Tool } from './types';
@@ -43,7 +43,7 @@ vi.mock('../tools/browser/BrowserManager.js', () => {
4343
};
4444
});
4545

46-
vi.mock('../tools/system/ShellTracker.js', () => {
46+
vi.mock('../tools/shell/ShellTracker.js', () => {
4747
return {
4848
shellTracker: {
4949
processStates: new Map<string, MockProcessState>(),
@@ -52,7 +52,7 @@ vi.mock('../tools/system/ShellTracker.js', () => {
5252
};
5353
});
5454

55-
vi.mock('../tools/interaction/agentStart.js', () => {
55+
vi.mock('../tools/agent/agentStart.js', () => {
5656
return {
5757
agentStates: new Map<string, MockAgentState>(),
5858
};

packages/agent/src/core/backgroundTools.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { v4 as uuidv4 } from 'uuid';
22

33
// These imports will be used by the cleanup method
4+
import { agentStates } from '../tools/agent/agentStart.js';
45
import { BrowserManager } from '../tools/browser/BrowserManager.js';
5-
import { agentStates } from '../tools/interaction/agentStart.js';
6-
import { shellTracker } from '../tools/system/ShellTracker.js';
6+
import { shellTracker } from '../tools/shell/ShellTracker.js';
77

88
// Types of background processes we can track
99
export enum BackgroundToolType {
@@ -157,7 +157,7 @@ export class BackgroundTools {
157157
this.cleanupBrowserSession(tool),
158158
);
159159
const agentCleanupPromises = agentTools.map((tool) =>
160-
this.cleanupSubAgent(tool),
160+
this.cleanupagentExecute(tool),
161161
);
162162

163163
// Clean up shell processes using ShellTracker
@@ -193,7 +193,7 @@ export class BackgroundTools {
193193
* Cleans up a sub-agent
194194
* @param tool The agent tool to clean up
195195
*/
196-
private async cleanupSubAgent(tool: AgentBackgroundTool): Promise<void> {
196+
private async cleanupagentExecute(tool: AgentBackgroundTool): Promise<void> {
197197
try {
198198
const agentState = agentStates.get(tool.id);
199199
if (agentState && !agentState.aborted) {

packages/agent/src/core/toolAgent/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export function getDefaultSystemPrompt(toolContext: ToolContext): string {
146146
githubModeInstructions,
147147
'',
148148
'You prefer to call tools in parallel when possible because it leads to faster execution and less resource usage.',
149-
'When done, call the sequenceComplete tool with your results to indicate that the sequence has completed.',
149+
'When done, call the agentComplete tool with your results to indicate that the sequence has completed.',
150150
'',
151151
'For coding tasks:',
152152
'0. Try to break large tasks into smaller sub-tasks that can be completed and verified sequentially.',

packages/agent/src/core/toolAgent/toolAgentCore.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('toolAgentCore empty response detection', () => {
1313
content: [
1414
{
1515
type: 'text',
16-
text: 'I notice you sent an empty response. If you are done with your tasks, please call the sequenceComplete tool with your results. If you are waiting for other tools to complete, you can use the sleep tool to wait before checking again.',
16+
text: 'I notice you sent an empty response. If you are done with your tasks, please call the agentComplete tool with your results. If you are waiting for other tools to complete, you can use the sleep tool to wait before checking again.',
1717
},
1818
],
1919
});

packages/agent/src/core/toolAgent/toolAgentCore.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const toolAgent = async (
100100
messages.push({
101101
role: 'user',
102102
content:
103-
'I notice you sent an empty response. If you are done with your tasks, please call the sequenceComplete tool with your results. If you are waiting for other tools to complete, you can use the sleep tool to wait before checking again.',
103+
'I notice you sent an empty response. If you are done with your tasks, please call the agentComplete tool with your results. If you are waiting for other tools to complete, you can use the sleep tool to wait before checking again.',
104104
});
105105
continue;
106106
}
@@ -129,8 +129,12 @@ export const toolAgent = async (
129129
);
130130

131131
// Execute the tools and get results
132-
const { sequenceCompleted, completionResult, respawn } =
133-
await executeTools(toolCalls, tools, messages, localContext);
132+
const { agentCompleted, completionResult, respawn } = await executeTools(
133+
toolCalls,
134+
tools,
135+
messages,
136+
localContext,
137+
);
134138

135139
if (respawn) {
136140
logger.info('Respawning agent with new context');
@@ -143,7 +147,7 @@ export const toolAgent = async (
143147
continue;
144148
}
145149

146-
if (sequenceCompleted) {
150+
if (agentCompleted) {
147151
const result: ToolAgentResult = {
148152
result: completionResult ?? 'Sequence explicitly completed',
149153
interactions,

packages/agent/src/core/toolAgent/toolExecutor.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function executeTools(
3232
context: ToolContext,
3333
): Promise<ToolCallResult> {
3434
if (toolCalls.length === 0) {
35-
return { sequenceCompleted: false, toolResults: [] };
35+
return { agentCompleted: false, toolResults: [] };
3636
}
3737

3838
const { logger } = context;
@@ -46,7 +46,7 @@ export async function executeTools(
4646
addToolResultToMessages(messages, respawnCall.id, { success: true }, false);
4747

4848
return {
49-
sequenceCompleted: false,
49+
agentCompleted: false,
5050
toolResults: [
5151
{
5252
toolCallId: respawnCall.id,
@@ -97,19 +97,19 @@ export async function executeTools(
9797
}),
9898
);
9999

100-
const sequenceCompletedTool = toolResults.find(
101-
(r) => r.toolName === 'sequenceComplete',
100+
const agentCompletedTool = toolResults.find(
101+
(r) => r.toolName === 'agentComplete',
102102
);
103-
const completionResult = sequenceCompletedTool
104-
? (sequenceCompletedTool.result as { result: string }).result
103+
const completionResult = agentCompletedTool
104+
? (agentCompletedTool.result as { result: string }).result
105105
: undefined;
106106

107-
if (sequenceCompletedTool) {
107+
if (agentCompletedTool) {
108108
logger.verbose('Sequence completed', { completionResult });
109109
}
110110

111111
return {
112-
sequenceCompleted: sequenceCompletedTool !== undefined,
112+
agentCompleted: agentCompletedTool !== undefined,
113113
completionResult,
114114
toolResults,
115115
};

packages/agent/src/core/toolAgent/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface ToolAgentResult {
77
}
88

99
export interface ToolCallResult {
10-
sequenceCompleted: boolean;
10+
agentCompleted: boolean;
1111
completionResult?: string;
1212
toolResults: unknown[];
1313
respawn?: { context: string };

packages/agent/src/index.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,27 @@
33
export * from './tools/io/fetch.js';
44

55
// Tools - System
6-
export * from './tools/system/shellStart.js';
6+
export * from './tools/shell/shellStart.js';
77
export * from './tools/system/sleep.js';
8-
export * from './tools/system/respawn.js';
9-
export * from './tools/system/sequenceComplete.js';
10-
export * from './tools/system/shellMessage.js';
11-
export * from './tools/system/shellExecute.js';
8+
export * from './tools/agent/agentComplete.js';
9+
export * from './tools/shell/shellMessage.js';
10+
export * from './tools/shell/shellExecute.js';
1211
export * from './tools/system/listBackgroundTools.js';
13-
export * from './tools/system/listShells.js';
14-
export * from './tools/system/ShellTracker.js';
12+
export * from './tools/shell/listShells.js';
13+
export * from './tools/shell/ShellTracker.js';
1514

1615
// Tools - Browser
1716
export * from './tools/browser/BrowserManager.js';
1817
export * from './tools/browser/types.js';
19-
export * from './tools/browser/browseMessage.js';
20-
export * from './tools/browser/browseStart.js';
18+
export * from './tools/browser/sessionMessage.js';
19+
export * from './tools/browser/sessionStart.js';
2120
export * from './tools/browser/PageController.js';
2221
export * from './tools/browser/BrowserAutomation.js';
2322

2423
// Tools - Interaction
25-
export * from './tools/interaction/subAgent.js';
24+
export * from './tools/agent/agentExecute.js';
25+
export * from './tools/agent/agentStart.js';
26+
export * from './tools/agent/agentMessage.js';
2627
export * from './tools/interaction/userPrompt.js';
2728

2829
// Core

0 commit comments

Comments
 (0)