mirror of https://github.com/buster-so/buster.git
update some biome rules
This commit is contained in:
parent
1bf8418ab8
commit
cf1b9b60ae
|
@ -3,5 +3,17 @@
|
||||||
"extends": ["../../biome.json"],
|
"extends": ["../../biome.json"],
|
||||||
"files": {
|
"files": {
|
||||||
"include": ["src/**/*"]
|
"include": ["src/**/*"]
|
||||||
}
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"include": ["**/*.ts"],
|
||||||
|
"linter": {
|
||||||
|
"rules": {
|
||||||
|
"suspicious": {
|
||||||
|
"noConsoleLog": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"dev": "tsc --watch",
|
"dev": "tsc --watch",
|
||||||
"dev:mastra": "mastra dev --dir src",
|
"dev:mastra": "mastra dev --dir src",
|
||||||
"lintx": "biome check",
|
"lint": "biome check",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest watch",
|
"test:watch": "vitest watch",
|
||||||
"test:coverage": "vitest run --coverage",
|
"test:coverage": "vitest run --coverage",
|
||||||
|
|
|
@ -171,7 +171,6 @@ export async function cleanupOldWorkflowManagers(maxAge = 3600000): Promise<void
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const workflowId of toCleanup) {
|
for (const workflowId of toCleanup) {
|
||||||
// biome-ignore lint/suspicious/noConsoleLog: Dallin had this here
|
|
||||||
console.log(`[WorkflowDataSourceManager] Cleaning up old workflow manager: ${workflowId}`);
|
console.log(`[WorkflowDataSourceManager] Cleaning up old workflow manager: ${workflowId}`);
|
||||||
await cleanupWorkflowDataSources(workflowId);
|
await cleanupWorkflowDataSources(workflowId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { validateSqlPermissions, createPermissionErrorMessage } from './permission-validator';
|
|
||||||
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
||||||
import type { AnalystRuntimeContext } from '../../workflows/analyst-workflow';
|
import type { AnalystRuntimeContext } from '../../workflows/analyst-workflow';
|
||||||
|
import { createPermissionErrorMessage, validateSqlPermissions } from './permission-validator';
|
||||||
|
|
||||||
export interface ExecuteWithPermissionResult<T = any> {
|
export interface ExecuteWithPermissionResult<T = unknown> {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
data?: T;
|
data?: T;
|
||||||
error?: string;
|
error?: string;
|
||||||
|
@ -18,35 +18,35 @@ export async function executeWithPermissionCheck<T>(
|
||||||
executeFn: () => Promise<T>
|
executeFn: () => Promise<T>
|
||||||
): Promise<ExecuteWithPermissionResult<T>> {
|
): Promise<ExecuteWithPermissionResult<T>> {
|
||||||
const userId = runtimeContext.get('userId');
|
const userId = runtimeContext.get('userId');
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: 'User authentication required for SQL execution'
|
error: 'User authentication required for SQL execution',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate permissions
|
// Validate permissions
|
||||||
const permissionResult = await validateSqlPermissions(sql, userId);
|
const permissionResult = await validateSqlPermissions(sql, userId);
|
||||||
|
|
||||||
if (!permissionResult.isAuthorized) {
|
if (!permissionResult.isAuthorized) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: createPermissionErrorMessage(permissionResult.unauthorizedTables)
|
error: createPermissionErrorMessage(permissionResult.unauthorizedTables),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute if authorized
|
// Execute if authorized
|
||||||
try {
|
try {
|
||||||
const result = await executeFn();
|
const result = await executeFn();
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
data: result
|
data: result,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: error instanceof Error ? error.message : 'SQL execution failed'
|
error: error instanceof Error ? error.message : 'SQL execution failed',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe('Healing Mechanism Unit Test - Definitive Proof', () => {
|
||||||
it('PROOF: onError callback receives tool errors and returns healing response', async () => {
|
it('PROOF: onError callback receives tool errors and returns healing response', async () => {
|
||||||
// Create a mock agent that will capture the onError callback
|
// Create a mock agent that will capture the onError callback
|
||||||
let capturedOnError: ((error: unknown) => unknown) | undefined;
|
let capturedOnError: ((error: unknown) => unknown) | undefined;
|
||||||
let simulatedToolError: NoSuchToolError | undefined;
|
let simulatedToolError: NoSuchToolError | undefined = undefined;
|
||||||
|
|
||||||
const mockAgent: MastraAgent = {
|
const mockAgent: MastraAgent = {
|
||||||
name: 'test-agent',
|
name: 'test-agent',
|
||||||
|
|
|
@ -157,14 +157,16 @@ describe('Healing During Streaming - Real Scenario Simulation', () => {
|
||||||
|
|
||||||
// Log the full execution flow
|
// Log the full execution flow
|
||||||
console.log('\n🎬 STREAMING EXECUTION FLOW:');
|
console.log('\n🎬 STREAMING EXECUTION FLOW:');
|
||||||
streamEvents.forEach((event) => console.log(` ${event}`));
|
for (const event of streamEvents) {
|
||||||
|
console.log(` ${event}`);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('\n📊 EXECUTION SUMMARY:');
|
console.log('\n📊 EXECUTION SUMMARY:');
|
||||||
console.log(` - Healing attempts: ${executionLog.healingAttempts}`);
|
console.log(` - Healing attempts: ${executionLog.healingAttempts}`);
|
||||||
console.log(` - Chunks processed: ${executionLog.chunksProcessed}`);
|
console.log(` - Chunks processed: ${executionLog.chunksProcessed}`);
|
||||||
console.log(` - Tool calls seen: ${executionLog.toolCallsSeen.join(', ')}`);
|
console.log(` - Tool calls seen: ${executionLog.toolCallsSeen.join(', ')}`);
|
||||||
console.log(` - Error healed: YES`);
|
console.log(' - Error healed: YES');
|
||||||
console.log(` - Stream completed: YES`);
|
console.log(' - Stream completed: YES');
|
||||||
|
|
||||||
console.log('\n✅ STREAMING HEALING SIMULATION SUCCESSFUL!');
|
console.log('\n✅ STREAMING HEALING SIMULATION SUCCESSFUL!');
|
||||||
});
|
});
|
||||||
|
|
|
@ -210,7 +210,6 @@ export async function updateChat(
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
await db
|
await db
|
||||||
.update(chats)
|
.update(chats)
|
||||||
.set(updateData)
|
.set(updateData)
|
||||||
|
|
Loading…
Reference in New Issue