@mastra/client-js 0.0.0-transpile-packages-20250724123433 → 0.0.0-transpile-packages-20250730132657

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
2
  import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
3
- import { processDataStream, processTextStream } from '@ai-sdk/ui-utils';
4
- import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn } from '@mastra/core';
3
+ import { processDataStream } from '@ai-sdk/ui-utils';
4
+ import { GenerateReturn } from '@mastra/core/llm';
5
5
  import { JSONSchema7 } from 'json-schema';
6
6
  import { ZodSchema } from 'zod';
7
+ import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn as GenerateReturn$1 } from '@mastra/core';
7
8
  import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
9
  import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
9
10
  import { RuntimeContext } from '@mastra/core/runtime-context';
11
+ import { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';
10
12
  import { Workflow as Workflow$1, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
11
13
  import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
12
14
  import * as stream_web from 'stream/web';
@@ -378,6 +380,50 @@ interface McpToolInfo {
378
380
  interface McpServerToolListResponse {
379
381
  tools: McpToolInfo[];
380
382
  }
383
+ type ClientScoreRowData = Omit<ScoreRowData, 'createdAt' | 'updatedAt'> & {
384
+ createdAt: string;
385
+ updatedAt: string;
386
+ };
387
+ interface GetScoresByRunIdParams {
388
+ runId: string;
389
+ page?: number;
390
+ perPage?: number;
391
+ }
392
+ interface GetScoresByScorerIdParams {
393
+ scorerId: string;
394
+ entityId?: string;
395
+ entityType?: string;
396
+ page?: number;
397
+ perPage?: number;
398
+ }
399
+ interface GetScoresByEntityIdParams {
400
+ entityId: string;
401
+ entityType: string;
402
+ page?: number;
403
+ perPage?: number;
404
+ }
405
+ interface SaveScoreParams {
406
+ score: ScoreRowData;
407
+ }
408
+ interface GetScoresResponse {
409
+ pagination: {
410
+ total: number;
411
+ page: number;
412
+ perPage: number;
413
+ hasMore: boolean;
414
+ };
415
+ scores: ClientScoreRowData[];
416
+ }
417
+ interface SaveScoreResponse {
418
+ score: ClientScoreRowData;
419
+ }
420
+ type GetScorerResponse = MastraScorerEntry & {
421
+ agentIds: string[];
422
+ workflowIds: string[];
423
+ };
424
+ interface GetScorersResponse {
425
+ scorers: Array<GetScorerResponse>;
426
+ }
381
427
 
382
428
  declare class BaseResource {
383
429
  readonly options: ClientOptions;
@@ -443,32 +489,31 @@ declare class Agent extends BaseResource {
443
489
  * @param params - Generation parameters including prompt
444
490
  * @returns Promise containing the generated response
445
491
  */
446
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
492
+ generate(params: GenerateParams<undefined> & {
447
493
  output?: never;
448
494
  experimental_output?: never;
449
- }): Promise<GenerateReturn<T>>;
450
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
451
- output: T;
495
+ }): Promise<GenerateReturn<any, undefined, undefined>>;
496
+ generate<Output extends JSONSchema7 | ZodSchema>(params: GenerateParams<Output> & {
497
+ output: Output;
452
498
  experimental_output?: never;
453
- }): Promise<GenerateReturn<T>>;
454
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
499
+ }): Promise<GenerateReturn<any, Output, undefined>>;
500
+ generate<StructuredOutput extends JSONSchema7 | ZodSchema>(params: GenerateParams<StructuredOutput> & {
455
501
  output?: never;
456
- experimental_output: T;
457
- }): Promise<GenerateReturn<T>>;
502
+ experimental_output: StructuredOutput;
503
+ }): Promise<GenerateReturn<any, undefined, StructuredOutput>>;
458
504
  private processChatResponse;
459
- /**
460
- * Processes the stream response and handles tool calls
461
- */
462
- private processStreamResponse;
463
505
  /**
464
506
  * Streams a response from the agent
465
507
  * @param params - Stream parameters including prompt
466
- * @returns Promise containing the enhanced Response object with processDataStream and processTextStream methods
508
+ * @returns Promise containing the enhanced Response object with processDataStream method
467
509
  */
468
510
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
469
511
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
470
- processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
471
512
  }>;
513
+ /**
514
+ * Processes the stream response and handles tool calls
515
+ */
516
+ private processStreamResponse;
472
517
  /**
473
518
  * Gets details about a specific tool available to the agent
474
519
  * @param toolId - ID of the tool to retrieve
@@ -510,7 +555,7 @@ declare class Network extends BaseResource {
510
555
  * @param params - Generation parameters including prompt
511
556
  * @returns Promise containing the generated response
512
557
  */
513
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
558
+ generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn$1<any, Output, StructuredOutput>>;
514
559
  /**
515
560
  * Streams a response from the agent
516
561
  * @param params - Stream parameters including prompt
@@ -1219,6 +1264,36 @@ declare class MastraClient extends BaseResource {
1219
1264
  workingMemory: string;
1220
1265
  resourceId?: string;
1221
1266
  }): Promise<unknown>;
1267
+ /**
1268
+ * Retrieves all available scorers
1269
+ * @returns Promise containing list of available scorers
1270
+ */
1271
+ getScorers(): Promise<Record<string, GetScorerResponse>>;
1272
+ /**
1273
+ * Retrieves a scorer by ID
1274
+ * @param scorerId - ID of the scorer to retrieve
1275
+ * @returns Promise containing the scorer
1276
+ */
1277
+ getScorer(scorerId: string): Promise<GetScorerResponse>;
1278
+ getScoresByScorerId(params: GetScoresByScorerIdParams): Promise<GetScoresResponse>;
1279
+ /**
1280
+ * Retrieves scores by run ID
1281
+ * @param params - Parameters containing run ID and pagination options
1282
+ * @returns Promise containing scores and pagination info
1283
+ */
1284
+ getScoresByRunId(params: GetScoresByRunIdParams): Promise<GetScoresResponse>;
1285
+ /**
1286
+ * Retrieves scores by entity ID and type
1287
+ * @param params - Parameters containing entity ID, type, and pagination options
1288
+ * @returns Promise containing scores and pagination info
1289
+ */
1290
+ getScoresByEntityId(params: GetScoresByEntityIdParams): Promise<GetScoresResponse>;
1291
+ /**
1292
+ * Saves a score
1293
+ * @param params - Parameters containing the score data to save
1294
+ * @returns Promise containing the saved score
1295
+ */
1296
+ saveScore(params: SaveScoreParams): Promise<SaveScoreResponse>;
1222
1297
  }
1223
1298
 
1224
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesPaginatedParams, type GetMemoryThreadMessagesPaginatedResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
1299
+ export { type ClientOptions, type ClientScoreRowData, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesPaginatedParams, type GetMemoryThreadMessagesPaginatedResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetScorerResponse, type GetScorersResponse, type GetScoresByEntityIdParams, type GetScoresByRunIdParams, type GetScoresByScorerIdParams, type GetScoresResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type SaveScoreParams, type SaveScoreResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
2
  import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
3
- import { processDataStream, processTextStream } from '@ai-sdk/ui-utils';
4
- import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn } from '@mastra/core';
3
+ import { processDataStream } from '@ai-sdk/ui-utils';
4
+ import { GenerateReturn } from '@mastra/core/llm';
5
5
  import { JSONSchema7 } from 'json-schema';
6
6
  import { ZodSchema } from 'zod';
7
+ import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn as GenerateReturn$1 } from '@mastra/core';
7
8
  import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
9
  import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
9
10
  import { RuntimeContext } from '@mastra/core/runtime-context';
11
+ import { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';
10
12
  import { Workflow as Workflow$1, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
11
13
  import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
12
14
  import * as stream_web from 'stream/web';
@@ -378,6 +380,50 @@ interface McpToolInfo {
378
380
  interface McpServerToolListResponse {
379
381
  tools: McpToolInfo[];
380
382
  }
383
+ type ClientScoreRowData = Omit<ScoreRowData, 'createdAt' | 'updatedAt'> & {
384
+ createdAt: string;
385
+ updatedAt: string;
386
+ };
387
+ interface GetScoresByRunIdParams {
388
+ runId: string;
389
+ page?: number;
390
+ perPage?: number;
391
+ }
392
+ interface GetScoresByScorerIdParams {
393
+ scorerId: string;
394
+ entityId?: string;
395
+ entityType?: string;
396
+ page?: number;
397
+ perPage?: number;
398
+ }
399
+ interface GetScoresByEntityIdParams {
400
+ entityId: string;
401
+ entityType: string;
402
+ page?: number;
403
+ perPage?: number;
404
+ }
405
+ interface SaveScoreParams {
406
+ score: ScoreRowData;
407
+ }
408
+ interface GetScoresResponse {
409
+ pagination: {
410
+ total: number;
411
+ page: number;
412
+ perPage: number;
413
+ hasMore: boolean;
414
+ };
415
+ scores: ClientScoreRowData[];
416
+ }
417
+ interface SaveScoreResponse {
418
+ score: ClientScoreRowData;
419
+ }
420
+ type GetScorerResponse = MastraScorerEntry & {
421
+ agentIds: string[];
422
+ workflowIds: string[];
423
+ };
424
+ interface GetScorersResponse {
425
+ scorers: Array<GetScorerResponse>;
426
+ }
381
427
 
382
428
  declare class BaseResource {
383
429
  readonly options: ClientOptions;
@@ -443,32 +489,31 @@ declare class Agent extends BaseResource {
443
489
  * @param params - Generation parameters including prompt
444
490
  * @returns Promise containing the generated response
445
491
  */
446
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
492
+ generate(params: GenerateParams<undefined> & {
447
493
  output?: never;
448
494
  experimental_output?: never;
449
- }): Promise<GenerateReturn<T>>;
450
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
451
- output: T;
495
+ }): Promise<GenerateReturn<any, undefined, undefined>>;
496
+ generate<Output extends JSONSchema7 | ZodSchema>(params: GenerateParams<Output> & {
497
+ output: Output;
452
498
  experimental_output?: never;
453
- }): Promise<GenerateReturn<T>>;
454
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
499
+ }): Promise<GenerateReturn<any, Output, undefined>>;
500
+ generate<StructuredOutput extends JSONSchema7 | ZodSchema>(params: GenerateParams<StructuredOutput> & {
455
501
  output?: never;
456
- experimental_output: T;
457
- }): Promise<GenerateReturn<T>>;
502
+ experimental_output: StructuredOutput;
503
+ }): Promise<GenerateReturn<any, undefined, StructuredOutput>>;
458
504
  private processChatResponse;
459
- /**
460
- * Processes the stream response and handles tool calls
461
- */
462
- private processStreamResponse;
463
505
  /**
464
506
  * Streams a response from the agent
465
507
  * @param params - Stream parameters including prompt
466
- * @returns Promise containing the enhanced Response object with processDataStream and processTextStream methods
508
+ * @returns Promise containing the enhanced Response object with processDataStream method
467
509
  */
468
510
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
469
511
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
470
- processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
471
512
  }>;
513
+ /**
514
+ * Processes the stream response and handles tool calls
515
+ */
516
+ private processStreamResponse;
472
517
  /**
473
518
  * Gets details about a specific tool available to the agent
474
519
  * @param toolId - ID of the tool to retrieve
@@ -510,7 +555,7 @@ declare class Network extends BaseResource {
510
555
  * @param params - Generation parameters including prompt
511
556
  * @returns Promise containing the generated response
512
557
  */
513
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
558
+ generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn$1<any, Output, StructuredOutput>>;
514
559
  /**
515
560
  * Streams a response from the agent
516
561
  * @param params - Stream parameters including prompt
@@ -1219,6 +1264,36 @@ declare class MastraClient extends BaseResource {
1219
1264
  workingMemory: string;
1220
1265
  resourceId?: string;
1221
1266
  }): Promise<unknown>;
1267
+ /**
1268
+ * Retrieves all available scorers
1269
+ * @returns Promise containing list of available scorers
1270
+ */
1271
+ getScorers(): Promise<Record<string, GetScorerResponse>>;
1272
+ /**
1273
+ * Retrieves a scorer by ID
1274
+ * @param scorerId - ID of the scorer to retrieve
1275
+ * @returns Promise containing the scorer
1276
+ */
1277
+ getScorer(scorerId: string): Promise<GetScorerResponse>;
1278
+ getScoresByScorerId(params: GetScoresByScorerIdParams): Promise<GetScoresResponse>;
1279
+ /**
1280
+ * Retrieves scores by run ID
1281
+ * @param params - Parameters containing run ID and pagination options
1282
+ * @returns Promise containing scores and pagination info
1283
+ */
1284
+ getScoresByRunId(params: GetScoresByRunIdParams): Promise<GetScoresResponse>;
1285
+ /**
1286
+ * Retrieves scores by entity ID and type
1287
+ * @param params - Parameters containing entity ID, type, and pagination options
1288
+ * @returns Promise containing scores and pagination info
1289
+ */
1290
+ getScoresByEntityId(params: GetScoresByEntityIdParams): Promise<GetScoresResponse>;
1291
+ /**
1292
+ * Saves a score
1293
+ * @param params - Parameters containing the score data to save
1294
+ * @returns Promise containing the saved score
1295
+ */
1296
+ saveScore(params: SaveScoreParams): Promise<SaveScoreResponse>;
1222
1297
  }
1223
1298
 
1224
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesPaginatedParams, type GetMemoryThreadMessagesPaginatedResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
1299
+ export { type ClientOptions, type ClientScoreRowData, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesPaginatedParams, type GetMemoryThreadMessagesPaginatedResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetScorerResponse, type GetScorersResponse, type GetScoresByEntityIdParams, type GetScoresByRunIdParams, type GetScoresByScorerIdParams, type GetScoresResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type SaveScoreParams, type SaveScoreResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };