diff --git a/packages/ai/biome.json b/packages/ai/biome.json index b242fa54d..5faf4e0fd 100644 --- a/packages/ai/biome.json +++ b/packages/ai/biome.json @@ -3,5 +3,17 @@ "extends": ["../../biome.json"], "files": { "include": ["src/**/*"] - } + }, + "overrides": [ + { + "include": ["**/*.ts"], + "linter": { + "rules": { + "suspicious": { + "noConsoleLog": "off" + } + } + } + } + ] } diff --git a/packages/ai/package.json b/packages/ai/package.json index f12e58263..d00ed6a5e 100644 --- a/packages/ai/package.json +++ b/packages/ai/package.json @@ -19,7 +19,7 @@ "typecheck": "tsc --noEmit", "dev": "tsc --watch", "dev:mastra": "mastra dev --dir src", - "lintx": "biome check", + "lint": "biome check", "test": "vitest run", "test:watch": "vitest watch", "test:coverage": "vitest run --coverage", diff --git a/packages/ai/src/utils/data-source-manager.ts b/packages/ai/src/utils/data-source-manager.ts index 911bcaaa1..ab0fc095f 100644 --- a/packages/ai/src/utils/data-source-manager.ts +++ b/packages/ai/src/utils/data-source-manager.ts @@ -171,7 +171,6 @@ export async function cleanupOldWorkflowManagers(maxAge = 3600000): Promise { +export interface ExecuteWithPermissionResult { success: boolean; data?: T; error?: string; @@ -18,35 +18,35 @@ export async function executeWithPermissionCheck( executeFn: () => Promise ): Promise> { const userId = runtimeContext.get('userId'); - + if (!userId) { return { success: false, - error: 'User authentication required for SQL execution' + error: 'User authentication required for SQL execution', }; } - + // Validate permissions const permissionResult = await validateSqlPermissions(sql, userId); - + if (!permissionResult.isAuthorized) { return { success: false, - error: createPermissionErrorMessage(permissionResult.unauthorizedTables) + error: createPermissionErrorMessage(permissionResult.unauthorizedTables), }; } - + // Execute if authorized try { const result = await executeFn(); return { success: true, - data: result + data: result, }; } catch (error) { return { success: false, - error: error instanceof Error ? error.message : 'SQL execution failed' + error: error instanceof Error ? error.message : 'SQL execution failed', }; } -} \ No newline at end of file +} diff --git a/packages/ai/tests/utils/retry/healing-proof-unit.test.ts b/packages/ai/tests/utils/retry/healing-proof-unit.test.ts index c58c60c37..c3a23cf20 100644 --- a/packages/ai/tests/utils/retry/healing-proof-unit.test.ts +++ b/packages/ai/tests/utils/retry/healing-proof-unit.test.ts @@ -11,7 +11,7 @@ describe('Healing Mechanism Unit Test - Definitive Proof', () => { it('PROOF: onError callback receives tool errors and returns healing response', async () => { // Create a mock agent that will capture the onError callback let capturedOnError: ((error: unknown) => unknown) | undefined; - let simulatedToolError: NoSuchToolError | undefined; + let simulatedToolError: NoSuchToolError | undefined = undefined; const mockAgent: MastraAgent = { name: 'test-agent', diff --git a/packages/ai/tests/utils/retry/healing-stream-simulation.test.ts b/packages/ai/tests/utils/retry/healing-stream-simulation.test.ts index 9f667f2cd..f1288e653 100644 --- a/packages/ai/tests/utils/retry/healing-stream-simulation.test.ts +++ b/packages/ai/tests/utils/retry/healing-stream-simulation.test.ts @@ -157,14 +157,16 @@ describe('Healing During Streaming - Real Scenario Simulation', () => { // Log the full 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(` - Healing attempts: ${executionLog.healingAttempts}`); console.log(` - Chunks processed: ${executionLog.chunksProcessed}`); console.log(` - Tool calls seen: ${executionLog.toolCallsSeen.join(', ')}`); - console.log(` - Error healed: YES`); - console.log(` - Stream completed: YES`); + console.log(' - Error healed: YES'); + console.log(' - Stream completed: YES'); console.log('\nāœ… STREAMING HEALING SIMULATION SUCCESSFUL!'); }); diff --git a/packages/database/src/helpers/chats.ts b/packages/database/src/helpers/chats.ts index ab484ff8d..a34f38df4 100644 --- a/packages/database/src/helpers/chats.ts +++ b/packages/database/src/helpers/chats.ts @@ -210,7 +210,6 @@ export async function updateChat( ), }; - await db .update(chats) .set(updateData)