Skip to content

Commit bb5cda1

Browse files
refactor: remove unused sendAgentRequest functionality (#398)
- Remove unused sendAgentRequest case from message handler - Remove handleAgentRequest method that's no longer called - Remove wu-wei.sendAgentRequest VS Code command registration - Remove command definition from package.json The system now exclusively uses sendAgentRequestWithPrompt which includes prompt integration and TSX-based composition. (Cursor)
1 parent dc2dd46 commit bb5cda1

File tree

3 files changed

+3
-82
lines changed

3 files changed

+3
-82
lines changed

wu-wei/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@
9292
"category": "Wu Wei",
9393
"icon": "$(refresh)"
9494
},
95-
{
96-
"command": "wu-wei.sendAgentRequest",
97-
"title": "Wu Wei: Send Agent Request",
98-
"category": "Wu Wei",
99-
"icon": "$(send)"
100-
},
10195
{
10296
"command": "wu-wei.refreshAgents",
10397
"title": "Wu Wei: Refresh Agents",
@@ -388,4 +382,4 @@
388382
"url": "https://github.com/your-username/wu-wei.git"
389383
},
390384
"license": "MIT"
391-
}
385+
}

wu-wei/src/extension.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,7 @@ export function activate(context: vscode.ExtensionContext) {
177177
}
178178
});
179179

180-
// Register send agent request command
181-
const sendAgentRequestCommand = vscode.commands.registerCommand('wu-wei.sendAgentRequest', () => {
182-
logger.info('Send agent request command executed');
183-
vscode.window.showInformationMessage('Wu Wei: Use the Agent Panel to send requests');
184-
});
180+
185181

186182
// Register refresh agents command
187183
const refreshAgentsCommand = vscode.commands.registerCommand('wu-wei.refreshAgents', () => {
@@ -281,7 +277,7 @@ export function activate(context: vscode.ExtensionContext) {
281277
exportLogsCommand,
282278
debugModelsCommand,
283279
forceReloadModelsCommand,
284-
sendAgentRequestCommand,
280+
285281
refreshAgentsCommand,
286282
showModelDetailsCommand,
287283
openPromptStoreCommand,

wu-wei/src/providers/agentPanelProvider.ts

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ export class AgentPanelProvider extends BaseWebviewProvider implements vscode.We
148148

149149
protected async handleMessage(message: any): Promise<void> {
150150
switch (message.command) {
151-
case 'sendAgentRequest':
152-
await this.handleAgentRequest(message.agentName, message.method, message.params);
153-
break;
154151
case 'sendAgentRequestWithPrompt':
155152
await this.handleAgentRequestWithPrompt(
156153
message.agentName,
@@ -521,73 +518,7 @@ export class AgentPanelProvider extends BaseWebviewProvider implements vscode.We
521518
}
522519
}
523520

524-
private async handleAgentRequest(agentName: string, method: string, params: any): Promise<void> {
525-
try {
526-
logger.info(`Processing agent request: ${agentName}.${method}`, params);
527-
528-
const agent = this._agentRegistry.getAgent(agentName);
529-
530-
if (!agent) {
531-
const errorMessage = `Agent '${agentName}' not found`;
532-
logger.error(errorMessage);
533-
this.addMessageToHistory({
534-
id: this.generateMessageId(),
535-
timestamp: new Date(),
536-
type: 'error',
537-
error: {
538-
code: -32000,
539-
message: errorMessage
540-
}
541-
});
542-
return;
543-
}
544-
545-
// Create request
546-
const request: AgentRequest = {
547-
id: this.generateMessageId(),
548-
method,
549-
params,
550-
timestamp: new Date()
551-
};
552-
553-
// Add request to history
554-
this.addMessageToHistory({
555-
id: request.id,
556-
timestamp: request.timestamp,
557-
type: 'request',
558-
method: request.method,
559-
params: request.params
560-
});
561521

562-
// Process request
563-
const response = await agent.processRequest(request);
564-
565-
// Add response to history
566-
this.addMessageToHistory({
567-
id: response.id,
568-
timestamp: response.timestamp,
569-
type: 'response',
570-
result: response.result,
571-
error: response.error
572-
});
573-
574-
logger.info(`Agent request completed: ${agentName}.${method}`, response);
575-
576-
} catch (error) {
577-
logger.error('Error handling agent request', error);
578-
579-
this.addMessageToHistory({
580-
id: this.generateMessageId(),
581-
timestamp: new Date(),
582-
type: 'error',
583-
error: {
584-
code: -32603,
585-
message: 'Internal error processing request',
586-
data: error instanceof Error ? error.message : String(error)
587-
}
588-
});
589-
}
590-
}
591522

592523
private addMessageToHistory(message: AgentMessage): void {
593524
this._messageHistory.push(message);

0 commit comments

Comments
 (0)