@mastra/client-js 0.10.15-alpha.1 → 0.10.15-alpha.2
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +31 -0
- package/README.md +1 -0
- package/dist/index.cjs +327 -248
- package/dist/index.d.cts +124 -19
- package/dist/index.d.ts +124 -19
- package/dist/index.js +327 -248
- package/package.json +2 -2
- package/src/client.ts +97 -0
- package/src/index.test.ts +294 -6
- package/src/resources/agent.ts +272 -297
- package/src/resources/base.ts +3 -1
- package/src/resources/memory-thread.ts +18 -0
- package/src/resources/network.ts +4 -3
- package/src/resources/workflow.ts +9 -0
- package/src/types.ts +75 -1
- package/src/utils/process-client-tools.ts +1 -1
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
|
|
4
|
-
import {
|
|
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';
|
|
@@ -204,10 +206,14 @@ interface GetMemoryThreadMessagesParams {
|
|
|
204
206
|
*/
|
|
205
207
|
limit?: number;
|
|
206
208
|
}
|
|
209
|
+
type GetMemoryThreadMessagesPaginatedParams = Omit<StorageGetMessagesArg, 'threadConfig' | 'threadId'>;
|
|
207
210
|
interface GetMemoryThreadMessagesResponse {
|
|
208
211
|
messages: CoreMessage[];
|
|
209
212
|
uiMessages: AiMessageType[];
|
|
210
213
|
}
|
|
214
|
+
type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
|
|
215
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
216
|
+
};
|
|
211
217
|
interface GetLogsParams {
|
|
212
218
|
transportId: string;
|
|
213
219
|
fromDate?: Date;
|
|
@@ -345,7 +351,17 @@ interface LoopStreamVNextNetworkParams {
|
|
|
345
351
|
interface LoopVNextNetworkResponse {
|
|
346
352
|
status: 'success';
|
|
347
353
|
result: {
|
|
348
|
-
|
|
354
|
+
task: string;
|
|
355
|
+
resourceId: string;
|
|
356
|
+
resourceType: 'agent' | 'workflow' | 'none' | 'tool';
|
|
357
|
+
result: string;
|
|
358
|
+
iteration: number;
|
|
359
|
+
isOneOff: boolean;
|
|
360
|
+
prompt: string;
|
|
361
|
+
threadId?: string | undefined;
|
|
362
|
+
threadResourceId?: string | undefined;
|
|
363
|
+
isComplete?: boolean | undefined;
|
|
364
|
+
completionReason?: string | undefined;
|
|
349
365
|
};
|
|
350
366
|
steps: WorkflowResult<any, any>['steps'];
|
|
351
367
|
}
|
|
@@ -364,6 +380,50 @@ interface McpToolInfo {
|
|
|
364
380
|
interface McpServerToolListResponse {
|
|
365
381
|
tools: McpToolInfo[];
|
|
366
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
|
+
}
|
|
367
427
|
|
|
368
428
|
declare class BaseResource {
|
|
369
429
|
readonly options: ClientOptions;
|
|
@@ -429,32 +489,31 @@ declare class Agent extends BaseResource {
|
|
|
429
489
|
* @param params - Generation parameters including prompt
|
|
430
490
|
* @returns Promise containing the generated response
|
|
431
491
|
*/
|
|
432
|
-
generate
|
|
492
|
+
generate(params: GenerateParams<undefined> & {
|
|
433
493
|
output?: never;
|
|
434
494
|
experimental_output?: never;
|
|
435
|
-
}): Promise<GenerateReturn<
|
|
436
|
-
generate<
|
|
437
|
-
output:
|
|
495
|
+
}): Promise<GenerateReturn<any, undefined, undefined>>;
|
|
496
|
+
generate<Output extends JSONSchema7 | ZodSchema>(params: GenerateParams<Output> & {
|
|
497
|
+
output: Output;
|
|
438
498
|
experimental_output?: never;
|
|
439
|
-
}): Promise<GenerateReturn<
|
|
440
|
-
generate<
|
|
499
|
+
}): Promise<GenerateReturn<any, Output, undefined>>;
|
|
500
|
+
generate<StructuredOutput extends JSONSchema7 | ZodSchema>(params: GenerateParams<StructuredOutput> & {
|
|
441
501
|
output?: never;
|
|
442
|
-
experimental_output:
|
|
443
|
-
}): Promise<GenerateReturn<
|
|
502
|
+
experimental_output: StructuredOutput;
|
|
503
|
+
}): Promise<GenerateReturn<any, undefined, StructuredOutput>>;
|
|
444
504
|
private processChatResponse;
|
|
445
|
-
/**
|
|
446
|
-
* Processes the stream response and handles tool calls
|
|
447
|
-
*/
|
|
448
|
-
private processStreamResponse;
|
|
449
505
|
/**
|
|
450
506
|
* Streams a response from the agent
|
|
451
507
|
* @param params - Stream parameters including prompt
|
|
452
|
-
* @returns Promise containing the enhanced Response object with processDataStream
|
|
508
|
+
* @returns Promise containing the enhanced Response object with processDataStream method
|
|
453
509
|
*/
|
|
454
510
|
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
455
511
|
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
456
|
-
processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
|
|
457
512
|
}>;
|
|
513
|
+
/**
|
|
514
|
+
* Processes the stream response and handles tool calls
|
|
515
|
+
*/
|
|
516
|
+
private processStreamResponse;
|
|
458
517
|
/**
|
|
459
518
|
* Gets details about a specific tool available to the agent
|
|
460
519
|
* @param toolId - ID of the tool to retrieve
|
|
@@ -496,7 +555,7 @@ declare class Network extends BaseResource {
|
|
|
496
555
|
* @param params - Generation parameters including prompt
|
|
497
556
|
* @returns Promise containing the generated response
|
|
498
557
|
*/
|
|
499
|
-
generate<
|
|
558
|
+
generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn$1<any, Output, StructuredOutput>>;
|
|
500
559
|
/**
|
|
501
560
|
* Streams a response from the agent
|
|
502
561
|
* @param params - Stream parameters including prompt
|
|
@@ -535,6 +594,12 @@ declare class MemoryThread extends BaseResource {
|
|
|
535
594
|
* @returns Promise containing thread messages and UI messages
|
|
536
595
|
*/
|
|
537
596
|
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
597
|
+
/**
|
|
598
|
+
* Retrieves paginated messages associated with the thread with advanced filtering and selection options
|
|
599
|
+
* @param params - Pagination parameters including selectBy criteria, page, perPage, date ranges, and message inclusion options
|
|
600
|
+
* @returns Promise containing paginated thread messages with pagination metadata (total, page, perPage, hasMore)
|
|
601
|
+
*/
|
|
602
|
+
getMessagesPaginated({ selectBy, ...rest }: GetMemoryThreadMessagesPaginatedParams): Promise<GetMemoryThreadMessagesPaginatedResponse>;
|
|
538
603
|
}
|
|
539
604
|
|
|
540
605
|
declare class Vector extends BaseResource {
|
|
@@ -752,6 +817,16 @@ declare class Workflow extends BaseResource {
|
|
|
752
817
|
}): Promise<{
|
|
753
818
|
runId: string;
|
|
754
819
|
}>;
|
|
820
|
+
/**
|
|
821
|
+
* Creates a new workflow run (alias for createRun)
|
|
822
|
+
* @param params - Optional object containing the optional runId
|
|
823
|
+
* @returns Promise containing the runId of the created run
|
|
824
|
+
*/
|
|
825
|
+
createRunAsync(params?: {
|
|
826
|
+
runId?: string;
|
|
827
|
+
}): Promise<{
|
|
828
|
+
runId: string;
|
|
829
|
+
}>;
|
|
755
830
|
/**
|
|
756
831
|
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
757
832
|
* @param params - Object containing the runId, inputData and runtimeContext
|
|
@@ -1189,6 +1264,36 @@ declare class MastraClient extends BaseResource {
|
|
|
1189
1264
|
workingMemory: string;
|
|
1190
1265
|
resourceId?: string;
|
|
1191
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>;
|
|
1192
1297
|
}
|
|
1193
1298
|
|
|
1194
|
-
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 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
|
|
4
|
-
import {
|
|
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';
|
|
@@ -204,10 +206,14 @@ interface GetMemoryThreadMessagesParams {
|
|
|
204
206
|
*/
|
|
205
207
|
limit?: number;
|
|
206
208
|
}
|
|
209
|
+
type GetMemoryThreadMessagesPaginatedParams = Omit<StorageGetMessagesArg, 'threadConfig' | 'threadId'>;
|
|
207
210
|
interface GetMemoryThreadMessagesResponse {
|
|
208
211
|
messages: CoreMessage[];
|
|
209
212
|
uiMessages: AiMessageType[];
|
|
210
213
|
}
|
|
214
|
+
type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
|
|
215
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
216
|
+
};
|
|
211
217
|
interface GetLogsParams {
|
|
212
218
|
transportId: string;
|
|
213
219
|
fromDate?: Date;
|
|
@@ -345,7 +351,17 @@ interface LoopStreamVNextNetworkParams {
|
|
|
345
351
|
interface LoopVNextNetworkResponse {
|
|
346
352
|
status: 'success';
|
|
347
353
|
result: {
|
|
348
|
-
|
|
354
|
+
task: string;
|
|
355
|
+
resourceId: string;
|
|
356
|
+
resourceType: 'agent' | 'workflow' | 'none' | 'tool';
|
|
357
|
+
result: string;
|
|
358
|
+
iteration: number;
|
|
359
|
+
isOneOff: boolean;
|
|
360
|
+
prompt: string;
|
|
361
|
+
threadId?: string | undefined;
|
|
362
|
+
threadResourceId?: string | undefined;
|
|
363
|
+
isComplete?: boolean | undefined;
|
|
364
|
+
completionReason?: string | undefined;
|
|
349
365
|
};
|
|
350
366
|
steps: WorkflowResult<any, any>['steps'];
|
|
351
367
|
}
|
|
@@ -364,6 +380,50 @@ interface McpToolInfo {
|
|
|
364
380
|
interface McpServerToolListResponse {
|
|
365
381
|
tools: McpToolInfo[];
|
|
366
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
|
+
}
|
|
367
427
|
|
|
368
428
|
declare class BaseResource {
|
|
369
429
|
readonly options: ClientOptions;
|
|
@@ -429,32 +489,31 @@ declare class Agent extends BaseResource {
|
|
|
429
489
|
* @param params - Generation parameters including prompt
|
|
430
490
|
* @returns Promise containing the generated response
|
|
431
491
|
*/
|
|
432
|
-
generate
|
|
492
|
+
generate(params: GenerateParams<undefined> & {
|
|
433
493
|
output?: never;
|
|
434
494
|
experimental_output?: never;
|
|
435
|
-
}): Promise<GenerateReturn<
|
|
436
|
-
generate<
|
|
437
|
-
output:
|
|
495
|
+
}): Promise<GenerateReturn<any, undefined, undefined>>;
|
|
496
|
+
generate<Output extends JSONSchema7 | ZodSchema>(params: GenerateParams<Output> & {
|
|
497
|
+
output: Output;
|
|
438
498
|
experimental_output?: never;
|
|
439
|
-
}): Promise<GenerateReturn<
|
|
440
|
-
generate<
|
|
499
|
+
}): Promise<GenerateReturn<any, Output, undefined>>;
|
|
500
|
+
generate<StructuredOutput extends JSONSchema7 | ZodSchema>(params: GenerateParams<StructuredOutput> & {
|
|
441
501
|
output?: never;
|
|
442
|
-
experimental_output:
|
|
443
|
-
}): Promise<GenerateReturn<
|
|
502
|
+
experimental_output: StructuredOutput;
|
|
503
|
+
}): Promise<GenerateReturn<any, undefined, StructuredOutput>>;
|
|
444
504
|
private processChatResponse;
|
|
445
|
-
/**
|
|
446
|
-
* Processes the stream response and handles tool calls
|
|
447
|
-
*/
|
|
448
|
-
private processStreamResponse;
|
|
449
505
|
/**
|
|
450
506
|
* Streams a response from the agent
|
|
451
507
|
* @param params - Stream parameters including prompt
|
|
452
|
-
* @returns Promise containing the enhanced Response object with processDataStream
|
|
508
|
+
* @returns Promise containing the enhanced Response object with processDataStream method
|
|
453
509
|
*/
|
|
454
510
|
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
455
511
|
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
456
|
-
processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
|
|
457
512
|
}>;
|
|
513
|
+
/**
|
|
514
|
+
* Processes the stream response and handles tool calls
|
|
515
|
+
*/
|
|
516
|
+
private processStreamResponse;
|
|
458
517
|
/**
|
|
459
518
|
* Gets details about a specific tool available to the agent
|
|
460
519
|
* @param toolId - ID of the tool to retrieve
|
|
@@ -496,7 +555,7 @@ declare class Network extends BaseResource {
|
|
|
496
555
|
* @param params - Generation parameters including prompt
|
|
497
556
|
* @returns Promise containing the generated response
|
|
498
557
|
*/
|
|
499
|
-
generate<
|
|
558
|
+
generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn$1<any, Output, StructuredOutput>>;
|
|
500
559
|
/**
|
|
501
560
|
* Streams a response from the agent
|
|
502
561
|
* @param params - Stream parameters including prompt
|
|
@@ -535,6 +594,12 @@ declare class MemoryThread extends BaseResource {
|
|
|
535
594
|
* @returns Promise containing thread messages and UI messages
|
|
536
595
|
*/
|
|
537
596
|
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
597
|
+
/**
|
|
598
|
+
* Retrieves paginated messages associated with the thread with advanced filtering and selection options
|
|
599
|
+
* @param params - Pagination parameters including selectBy criteria, page, perPage, date ranges, and message inclusion options
|
|
600
|
+
* @returns Promise containing paginated thread messages with pagination metadata (total, page, perPage, hasMore)
|
|
601
|
+
*/
|
|
602
|
+
getMessagesPaginated({ selectBy, ...rest }: GetMemoryThreadMessagesPaginatedParams): Promise<GetMemoryThreadMessagesPaginatedResponse>;
|
|
538
603
|
}
|
|
539
604
|
|
|
540
605
|
declare class Vector extends BaseResource {
|
|
@@ -752,6 +817,16 @@ declare class Workflow extends BaseResource {
|
|
|
752
817
|
}): Promise<{
|
|
753
818
|
runId: string;
|
|
754
819
|
}>;
|
|
820
|
+
/**
|
|
821
|
+
* Creates a new workflow run (alias for createRun)
|
|
822
|
+
* @param params - Optional object containing the optional runId
|
|
823
|
+
* @returns Promise containing the runId of the created run
|
|
824
|
+
*/
|
|
825
|
+
createRunAsync(params?: {
|
|
826
|
+
runId?: string;
|
|
827
|
+
}): Promise<{
|
|
828
|
+
runId: string;
|
|
829
|
+
}>;
|
|
755
830
|
/**
|
|
756
831
|
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
757
832
|
* @param params - Object containing the runId, inputData and runtimeContext
|
|
@@ -1189,6 +1264,36 @@ declare class MastraClient extends BaseResource {
|
|
|
1189
1264
|
workingMemory: string;
|
|
1190
1265
|
resourceId?: string;
|
|
1191
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>;
|
|
1192
1297
|
}
|
|
1193
1298
|
|
|
1194
|
-
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 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 };
|