mirror of https://github.com/buster-so/buster.git
Revert "Add createReports and editReports tools to analyst-agent"
This reverts commit 351689f93b
.
This commit is contained in:
parent
351689f93b
commit
67c2eea1f1
|
@ -3,9 +3,7 @@ import { Agent } from '@mastra/core';
|
|||
import {
|
||||
createDashboards,
|
||||
createMetrics,
|
||||
createReports,
|
||||
doneTool,
|
||||
editReports,
|
||||
modifyDashboards,
|
||||
modifyMetrics,
|
||||
} from '../../tools';
|
||||
|
@ -31,8 +29,6 @@ export const analystAgent = new Agent({
|
|||
modifyMetrics,
|
||||
createDashboards,
|
||||
modifyDashboards,
|
||||
createReports,
|
||||
editReports,
|
||||
doneTool,
|
||||
},
|
||||
defaultGenerateOptions: DEFAULT_OPTIONS,
|
||||
|
|
|
@ -8,8 +8,6 @@ export { createMetrics } from './visualization-tools/create-metrics-file-tool';
|
|||
export { modifyMetrics } from './visualization-tools/modify-metrics-file-tool';
|
||||
export { createDashboards } from './visualization-tools/create-dashboards-file-tool';
|
||||
export { modifyDashboards } from './visualization-tools/modify-dashboards-file-tool';
|
||||
export { createReports } from './visualization-tools/create-reports-file-tool';
|
||||
export { editReports } from './visualization-tools/edit-reports-file-tool';
|
||||
export { executeSql } from './database-tools/execute-sql';
|
||||
export { createTodoList } from './planning-thinking-tools/create-todo-item-tool';
|
||||
export { editFiles } from './file-tools/edit-files-tool/edit-files-tool';
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
import { createTool } from '@mastra/core/tools';
|
||||
import { wrapTraced } from 'braintrust';
|
||||
import { z } from 'zod';
|
||||
|
||||
interface CreateReportsParams {
|
||||
name: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
interface CreateReportsOutput {
|
||||
success: boolean;
|
||||
message: string;
|
||||
file: {
|
||||
id: string;
|
||||
name: string;
|
||||
code: string;
|
||||
};
|
||||
}
|
||||
|
||||
// Main create reports function
|
||||
const createReportsFile = wrapTraced(
|
||||
async (params: CreateReportsParams): Promise<CreateReportsOutput> => {
|
||||
// Dummy implementation - just return success
|
||||
const dummyId = `report_${Date.now()}`;
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Successfully created report: ${params.name}`,
|
||||
file: {
|
||||
id: dummyId,
|
||||
name: params.name,
|
||||
code: params.code,
|
||||
},
|
||||
};
|
||||
},
|
||||
{ name: 'create-reports-file' }
|
||||
);
|
||||
|
||||
// Export the tool
|
||||
export const createReports = createTool({
|
||||
id: 'create-reports',
|
||||
description: 'Create a new report with PLATE.js content',
|
||||
inputSchema: z.object({
|
||||
name: z.string().describe('The name of the report'),
|
||||
code: z.string().describe('The PLATE.js code for the report'),
|
||||
}),
|
||||
outputSchema: z.object({
|
||||
success: z.boolean(),
|
||||
message: z.string(),
|
||||
file: z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
code: z.string(),
|
||||
}),
|
||||
}),
|
||||
execute: async ({ context }) => {
|
||||
return await createReportsFile(context as CreateReportsParams);
|
||||
},
|
||||
});
|
|
@ -1,82 +0,0 @@
|
|||
import { createTool } from '@mastra/core/tools';
|
||||
import { wrapTraced } from 'braintrust';
|
||||
import { z } from 'zod';
|
||||
|
||||
interface EditOperation {
|
||||
code_to_replace: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
interface EditReportsParams {
|
||||
id: string;
|
||||
name: string;
|
||||
edits: EditOperation[];
|
||||
}
|
||||
|
||||
interface EditReportsOutput {
|
||||
success: boolean;
|
||||
message: string;
|
||||
file: {
|
||||
id: string;
|
||||
name: string;
|
||||
code: string;
|
||||
};
|
||||
}
|
||||
|
||||
// Main edit reports function
|
||||
const editReportsFile = wrapTraced(
|
||||
async (params: EditReportsParams): Promise<EditReportsOutput> => {
|
||||
// Dummy implementation - simulate applying edits
|
||||
let simulatedCode = '// Existing report code';
|
||||
|
||||
// Simulate applying each edit
|
||||
for (const edit of params.edits) {
|
||||
if (edit.code_to_replace === '') {
|
||||
// Append mode
|
||||
simulatedCode += `\n${edit.code}`;
|
||||
} else {
|
||||
// Replace mode (in a real implementation)
|
||||
simulatedCode = simulatedCode.replace(edit.code_to_replace, edit.code);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Successfully edited report: ${params.name}`,
|
||||
file: {
|
||||
id: params.id,
|
||||
name: params.name,
|
||||
code: simulatedCode,
|
||||
},
|
||||
};
|
||||
},
|
||||
{ name: 'edit-reports-file' }
|
||||
);
|
||||
|
||||
// Export the tool
|
||||
export const editReports = createTool({
|
||||
id: 'edit-reports',
|
||||
description: 'Edit an existing report with find/replace operations or appends',
|
||||
inputSchema: z.object({
|
||||
id: z.string().describe('The ID of the report to edit'),
|
||||
name: z.string().describe('The updated name of the report'),
|
||||
edits: z.array(
|
||||
z.object({
|
||||
code_to_replace: z.string().describe('Code to replace. If empty, appends to existing code'),
|
||||
code: z.string().describe('The new code to insert or replace with'),
|
||||
})
|
||||
).describe('Array of edit operations to apply'),
|
||||
}),
|
||||
outputSchema: z.object({
|
||||
success: z.boolean(),
|
||||
message: z.string(),
|
||||
file: z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
code: z.string(),
|
||||
}),
|
||||
}),
|
||||
execute: async ({ context }) => {
|
||||
return await editReportsFile(context as EditReportsParams);
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue