Skip to content

Commit 984964b

Browse files
committed
refactor(mastra): remove unused interface and update test schema
Remove the unused MastraChunkBase interface from converter.ts and update test files to use zod schema instead of plain object for inputSchema 移除 converter.ts 中未使用的 MastraChunkBase 接口并更新 测试文件以使用 zod 模式替代普通对象作为 inputSchema Change-Id: I5a3e6958d23ab1362fffe67a9f42b74ea99ae26b Signed-off-by: OhYee <oyohyee@oyohyee.com>
1 parent 1f47364 commit 984964b

3 files changed

Lines changed: 3 additions & 13 deletions

File tree

src/integration/mastra/converter.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ import { EventType, type AgentEvent } from '@/server/core/model';
3030
import { type ChunkType } from '@mastra/core/stream';
3131
import { logger } from '@/utils/log';
3232

33-
// Mastra ChunkType definition
34-
// We define a minimal interface here to avoid direct dependency on @mastra/core
35-
// Users should have @mastra/core installed separately
36-
interface MastraChunkBase {
37-
type: string;
38-
runId: string;
39-
from: string;
40-
payload?: Record<string, unknown>;
41-
}
42-
4333
/**
4434
* Agent event item - can be a string (text) or AgentEvent (structured event)
4535
* Agent 事件项 - 可以是字符串(文本)或 AgentEvent(结构化事件)

src/integration/mastra/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ export async function createMastraTool<
143143
ToolAction<TSchemaIn, TSchemaOut, TSuspend, TResume, TContext, TId>
144144
> {
145145
const { createTool } = await import('@mastra/core/tools');
146-
// @ts-expect-error - Type mismatch with Mastra's createTool
147146
return await createTool(params);
148147
}
149148

tests/unittests/integration/mastra.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
import { TemplateType } from '@/sandbox';
1919
import { Config } from '@/utils/config';
2020
import type { LanguageModelV3 } from '@ai-sdk/provider';
21+
import { z } from 'zod';
2122
import type { ToolsInput } from '@mastra/core/agent';
2223

2324
// Mock external dependencies
@@ -476,7 +477,7 @@ describe('Mastra Integration', () => {
476477
const mockToolDefinition = {
477478
id: 'custom-tool',
478479
description: 'Custom tool description',
479-
inputSchema: { type: 'object' },
480+
inputSchema: z.object({}),
480481
execute: jest.fn(),
481482
};
482483
(createTool as jest.Mock).mockResolvedValue(mockToolDefinition);
@@ -493,7 +494,7 @@ describe('Mastra Integration', () => {
493494
const toolDef = {
494495
id: 'test-tool',
495496
description: 'Test',
496-
inputSchema: {},
497+
inputSchema: z.object({}),
497498
execute: executeFn,
498499
};
499500

0 commit comments

Comments
 (0)