@mastra/client-js 0.1.0-alpha.2 → 0.1.0-alpha.4
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/.eslintrc.js +10 -0
- package/.prettierignore +3 -0
- package/.prettierrc.json +26 -0
- package/LICENSE +44 -201
- package/README.md +90 -271
- package/dist/index.d.mts +359 -0
- package/dist/index.mjs +399 -0
- package/package.json +30 -95
- package/src/client.ts +201 -0
- package/src/index.test.ts +528 -0
- package/src/index.ts +2 -200
- package/src/resources/agent.ts +97 -0
- package/src/resources/index.ts +5 -14
- package/src/resources/memory-thread.ts +51 -0
- package/src/resources/tool.ts +28 -0
- package/src/resources/vector.ts +79 -0
- package/src/resources/workflow.ts +28 -0
- package/src/types.ts +135 -0
- package/tsconfig.json +29 -0
- package/vitest.config.js +8 -0
- package/CHANGELOG.md +0 -29
- package/_shims/MultipartBody.d.ts +0 -9
- package/_shims/MultipartBody.d.ts.map +0 -1
- package/_shims/MultipartBody.js +0 -16
- package/_shims/MultipartBody.js.map +0 -1
- package/_shims/MultipartBody.mjs +0 -12
- package/_shims/MultipartBody.mjs.map +0 -1
- package/_shims/README.md +0 -46
- package/_shims/auto/runtime-bun.d.ts +0 -5
- package/_shims/auto/runtime-bun.d.ts.map +0 -1
- package/_shims/auto/runtime-bun.js +0 -21
- package/_shims/auto/runtime-bun.js.map +0 -1
- package/_shims/auto/runtime-bun.mjs +0 -2
- package/_shims/auto/runtime-bun.mjs.map +0 -1
- package/_shims/auto/runtime-node.d.ts +0 -5
- package/_shims/auto/runtime-node.d.ts.map +0 -1
- package/_shims/auto/runtime-node.js +0 -21
- package/_shims/auto/runtime-node.js.map +0 -1
- package/_shims/auto/runtime-node.mjs +0 -2
- package/_shims/auto/runtime-node.mjs.map +0 -1
- package/_shims/auto/runtime.d.ts +0 -5
- package/_shims/auto/runtime.d.ts.map +0 -1
- package/_shims/auto/runtime.js +0 -21
- package/_shims/auto/runtime.js.map +0 -1
- package/_shims/auto/runtime.mjs +0 -2
- package/_shims/auto/runtime.mjs.map +0 -1
- package/_shims/auto/types-node.d.ts +0 -5
- package/_shims/auto/types-node.d.ts.map +0 -1
- package/_shims/auto/types-node.js +0 -21
- package/_shims/auto/types-node.js.map +0 -1
- package/_shims/auto/types-node.mjs +0 -2
- package/_shims/auto/types-node.mjs.map +0 -1
- package/_shims/auto/types.d.ts +0 -101
- package/_shims/auto/types.js +0 -3
- package/_shims/auto/types.mjs +0 -3
- package/_shims/bun-runtime.d.ts +0 -6
- package/_shims/bun-runtime.d.ts.map +0 -1
- package/_shims/bun-runtime.js +0 -14
- package/_shims/bun-runtime.js.map +0 -1
- package/_shims/bun-runtime.mjs +0 -10
- package/_shims/bun-runtime.mjs.map +0 -1
- package/_shims/index.d.ts +0 -81
- package/_shims/index.js +0 -13
- package/_shims/index.mjs +0 -7
- package/_shims/manual-types.d.ts +0 -12
- package/_shims/manual-types.js +0 -3
- package/_shims/manual-types.mjs +0 -3
- package/_shims/node-runtime.d.ts +0 -3
- package/_shims/node-runtime.d.ts.map +0 -1
- package/_shims/node-runtime.js +0 -89
- package/_shims/node-runtime.js.map +0 -1
- package/_shims/node-runtime.mjs +0 -56
- package/_shims/node-runtime.mjs.map +0 -1
- package/_shims/node-types.d.ts +0 -42
- package/_shims/node-types.js +0 -3
- package/_shims/node-types.mjs +0 -3
- package/_shims/registry.d.ts +0 -37
- package/_shims/registry.d.ts.map +0 -1
- package/_shims/registry.js +0 -41
- package/_shims/registry.js.map +0 -1
- package/_shims/registry.mjs +0 -37
- package/_shims/registry.mjs.map +0 -1
- package/_shims/web-runtime.d.ts +0 -5
- package/_shims/web-runtime.d.ts.map +0 -1
- package/_shims/web-runtime.js +0 -78
- package/_shims/web-runtime.js.map +0 -1
- package/_shims/web-runtime.mjs +0 -71
- package/_shims/web-runtime.mjs.map +0 -1
- package/_shims/web-types.d.ts +0 -83
- package/_shims/web-types.js +0 -3
- package/_shims/web-types.mjs +0 -3
- package/core.d.ts +0 -241
- package/core.d.ts.map +0 -1
- package/core.js +0 -908
- package/core.js.map +0 -1
- package/core.mjs +0 -876
- package/core.mjs.map +0 -1
- package/error.d.ts +0 -47
- package/error.d.ts.map +0 -1
- package/error.js +0 -113
- package/error.js.map +0 -1
- package/error.mjs +0 -97
- package/error.mjs.map +0 -1
- package/index.d.mts +0 -121
- package/index.d.ts +0 -121
- package/index.d.ts.map +0 -1
- package/index.js +0 -131
- package/index.js.map +0 -1
- package/index.mjs +0 -88
- package/index.mjs.map +0 -1
- package/resource.d.ts +0 -6
- package/resource.d.ts.map +0 -1
- package/resource.js +0 -11
- package/resource.js.map +0 -1
- package/resource.mjs +0 -7
- package/resource.mjs.map +0 -1
- package/resources/agents/agents.d.ts +0 -41
- package/resources/agents/agents.d.ts.map +0 -1
- package/resources/agents/agents.js +0 -74
- package/resources/agents/agents.js.map +0 -1
- package/resources/agents/agents.mjs +0 -47
- package/resources/agents/agents.mjs.map +0 -1
- package/resources/agents/index.d.ts +0 -3
- package/resources/agents/index.d.ts.map +0 -1
- package/resources/agents/index.js +0 -9
- package/resources/agents/index.js.map +0 -1
- package/resources/agents/index.mjs +0 -4
- package/resources/agents/index.mjs.map +0 -1
- package/resources/agents/tools.d.ts +0 -17
- package/resources/agents/tools.d.ts.map +0 -1
- package/resources/agents/tools.js +0 -19
- package/resources/agents/tools.js.map +0 -1
- package/resources/agents/tools.mjs +0 -15
- package/resources/agents/tools.mjs.map +0 -1
- package/resources/index.d.ts +0 -8
- package/resources/index.d.ts.map +0 -1
- package/resources/index.js +0 -19
- package/resources/index.js.map +0 -1
- package/resources/index.mjs +0 -9
- package/resources/index.mjs.map +0 -1
- package/resources/logs.d.ts +0 -13
- package/resources/logs.d.ts.map +0 -1
- package/resources/logs.js +0 -24
- package/resources/logs.js.map +0 -1
- package/resources/logs.mjs +0 -20
- package/resources/logs.mjs.map +0 -1
- package/resources/memory/index.d.ts +0 -4
- package/resources/memory/index.d.ts.map +0 -1
- package/resources/memory/index.js +0 -11
- package/resources/memory/index.js.map +0 -1
- package/resources/memory/index.mjs +0 -5
- package/resources/memory/index.mjs.map +0 -1
- package/resources/memory/memory.d.ts +0 -23
- package/resources/memory/memory.d.ts.map +0 -1
- package/resources/memory/memory.js +0 -53
- package/resources/memory/memory.js.map +0 -1
- package/resources/memory/memory.mjs +0 -26
- package/resources/memory/memory.mjs.map +0 -1
- package/resources/memory/status.d.ts +0 -9
- package/resources/memory/status.d.ts.map +0 -1
- package/resources/memory/status.js +0 -18
- package/resources/memory/status.js.map +0 -1
- package/resources/memory/status.mjs +0 -14
- package/resources/memory/status.mjs.map +0 -1
- package/resources/memory/threads/index.d.ts +0 -3
- package/resources/memory/threads/index.d.ts.map +0 -1
- package/resources/memory/threads/index.js +0 -9
- package/resources/memory/threads/index.js.map +0 -1
- package/resources/memory/threads/index.mjs +0 -4
- package/resources/memory/threads/index.mjs.map +0 -1
- package/resources/memory/threads/messages.d.ts +0 -9
- package/resources/memory/threads/messages.d.ts.map +0 -1
- package/resources/memory/threads/messages.js +0 -18
- package/resources/memory/threads/messages.js.map +0 -1
- package/resources/memory/threads/messages.mjs +0 -14
- package/resources/memory/threads/messages.mjs.map +0 -1
- package/resources/memory/threads/threads.d.ts +0 -45
- package/resources/memory/threads/threads.d.ts.map +0 -1
- package/resources/memory/threads/threads.js +0 -104
- package/resources/memory/threads/threads.js.map +0 -1
- package/resources/memory/threads/threads.mjs +0 -77
- package/resources/memory/threads/threads.mjs.map +0 -1
- package/resources/syncs.d.ts +0 -15
- package/resources/syncs.d.ts.map +0 -1
- package/resources/syncs.js +0 -19
- package/resources/syncs.js.map +0 -1
- package/resources/syncs.mjs +0 -15
- package/resources/syncs.mjs.map +0 -1
- package/resources/system.d.ts +0 -9
- package/resources/system.d.ts.map +0 -1
- package/resources/system.js +0 -15
- package/resources/system.js.map +0 -1
- package/resources/system.mjs +0 -11
- package/resources/system.mjs.map +0 -1
- package/resources/tools/index.d.ts +0 -3
- package/resources/tools/index.d.ts.map +0 -1
- package/resources/tools/index.js +0 -9
- package/resources/tools/index.js.map +0 -1
- package/resources/tools/index.mjs +0 -4
- package/resources/tools/index.mjs.map +0 -1
- package/resources/tools/result.d.ts +0 -9
- package/resources/tools/result.d.ts.map +0 -1
- package/resources/tools/result.js +0 -18
- package/resources/tools/result.js.map +0 -1
- package/resources/tools/result.mjs +0 -14
- package/resources/tools/result.mjs.map +0 -1
- package/resources/tools/tools.d.ts +0 -29
- package/resources/tools/tools.d.ts.map +0 -1
- package/resources/tools/tools.js +0 -64
- package/resources/tools/tools.js.map +0 -1
- package/resources/tools/tools.mjs +0 -37
- package/resources/tools/tools.mjs.map +0 -1
- package/resources/workflows.d.ts +0 -23
- package/resources/workflows.d.ts.map +0 -1
- package/resources/workflows.js +0 -37
- package/resources/workflows.js.map +0 -1
- package/resources/workflows.mjs +0 -33
- package/resources/workflows.mjs.map +0 -1
- package/shims/node.d.ts +0 -30
- package/shims/node.d.ts.map +0 -1
- package/shims/node.js +0 -31
- package/shims/node.js.map +0 -1
- package/shims/node.mjs +0 -5
- package/shims/node.mjs.map +0 -1
- package/shims/web.d.ts +0 -26
- package/shims/web.d.ts.map +0 -1
- package/shims/web.js +0 -31
- package/shims/web.js.map +0 -1
- package/shims/web.mjs +0 -5
- package/shims/web.mjs.map +0 -1
- package/src/_shims/MultipartBody.ts +0 -9
- package/src/_shims/README.md +0 -46
- package/src/_shims/auto/runtime-bun.ts +0 -4
- package/src/_shims/auto/runtime-node.ts +0 -4
- package/src/_shims/auto/runtime.ts +0 -4
- package/src/_shims/auto/types-node.ts +0 -4
- package/src/_shims/auto/types.d.ts +0 -101
- package/src/_shims/auto/types.js +0 -3
- package/src/_shims/auto/types.mjs +0 -3
- package/src/_shims/bun-runtime.ts +0 -14
- package/src/_shims/index.d.ts +0 -81
- package/src/_shims/index.js +0 -13
- package/src/_shims/index.mjs +0 -7
- package/src/_shims/manual-types.d.ts +0 -12
- package/src/_shims/manual-types.js +0 -3
- package/src/_shims/manual-types.mjs +0 -3
- package/src/_shims/node-runtime.ts +0 -81
- package/src/_shims/node-types.d.ts +0 -42
- package/src/_shims/node-types.js +0 -3
- package/src/_shims/node-types.mjs +0 -3
- package/src/_shims/registry.ts +0 -67
- package/src/_shims/web-runtime.ts +0 -103
- package/src/_shims/web-types.d.ts +0 -83
- package/src/_shims/web-types.js +0 -3
- package/src/_shims/web-types.mjs +0 -3
- package/src/core.ts +0 -1201
- package/src/error.ts +0 -130
- package/src/lib/.keep +0 -4
- package/src/resource.ts +0 -11
- package/src/resources/agents/agents.ts +0 -83
- package/src/resources/agents/index.ts +0 -4
- package/src/resources/agents/tools.ts +0 -34
- package/src/resources/logs.ts +0 -23
- package/src/resources/memory/index.ts +0 -5
- package/src/resources/memory/memory.ts +0 -43
- package/src/resources/memory/status.ts +0 -16
- package/src/resources/memory/threads/index.ts +0 -4
- package/src/resources/memory/threads/messages.ts +0 -16
- package/src/resources/memory/threads/threads.ts +0 -105
- package/src/resources/syncs.ts +0 -25
- package/src/resources/system.ts +0 -13
- package/src/resources/tools/index.ts +0 -4
- package/src/resources/tools/result.ts +0 -16
- package/src/resources/tools/tools.ts +0 -54
- package/src/resources/workflows.ts +0 -49
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
- package/src/tsconfig.json +0 -11
- package/src/uploads.ts +0 -255
- package/src/version.ts +0 -1
- package/uploads.d.ts +0 -75
- package/uploads.d.ts.map +0 -1
- package/uploads.js +0 -171
- package/uploads.js.map +0 -1
- package/uploads.mjs +0 -158
- package/uploads.mjs.map +0 -1
- package/version.d.ts +0 -2
- package/version.d.ts.map +0 -1
- package/version.js +0 -5
- package/version.js.map +0 -1
- package/version.mjs +0 -2
- package/version.mjs.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { MessageType, OutputType, StorageThreadType, CoreMessage, AiMessageType, StepAction, StepGraph, QueryResult, BaseLogMessage, GenerateReturn, StreamReturn } from '@mastra/core';
|
|
2
|
+
import { JSONSchema7 } from 'json-schema';
|
|
3
|
+
import { StorageThreadType as StorageThreadType$1 } from '@mastra/core/memory';
|
|
4
|
+
|
|
5
|
+
interface ClientOptions {
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
retries?: number;
|
|
8
|
+
backoffMs?: number;
|
|
9
|
+
maxBackoffMs?: number;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
interface RequestOptions {
|
|
13
|
+
method?: string;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
body?: any;
|
|
16
|
+
}
|
|
17
|
+
interface GetAgentResponse {
|
|
18
|
+
name: string;
|
|
19
|
+
model: string;
|
|
20
|
+
instructions: string;
|
|
21
|
+
tools: Record<string, GetToolResponse>;
|
|
22
|
+
}
|
|
23
|
+
interface GenerateParams<T extends JSONSchema7 | undefined = undefined> {
|
|
24
|
+
messages: MessageType[];
|
|
25
|
+
threadId?: string;
|
|
26
|
+
resourceid?: string;
|
|
27
|
+
output?: OutputType | T;
|
|
28
|
+
}
|
|
29
|
+
interface StreamParams<T extends JSONSchema7 | undefined = undefined> {
|
|
30
|
+
messages: MessageType[];
|
|
31
|
+
threadId?: string;
|
|
32
|
+
resourceid?: string;
|
|
33
|
+
output?: OutputType | T;
|
|
34
|
+
}
|
|
35
|
+
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
36
|
+
evals: any[];
|
|
37
|
+
}
|
|
38
|
+
interface GetToolResponse {
|
|
39
|
+
id: string;
|
|
40
|
+
description: string;
|
|
41
|
+
inputSchema: string;
|
|
42
|
+
outputSchema: string;
|
|
43
|
+
}
|
|
44
|
+
interface GetWorkflowResponse {
|
|
45
|
+
name: string;
|
|
46
|
+
triggerSchema: string;
|
|
47
|
+
steps: Record<string, StepAction<any, any, any, any>>;
|
|
48
|
+
stepGraph: StepGraph;
|
|
49
|
+
stepSubscriberGraph: Record<string, StepGraph>;
|
|
50
|
+
}
|
|
51
|
+
interface UpsertVectorParams {
|
|
52
|
+
indexName: string;
|
|
53
|
+
vectors: number[][];
|
|
54
|
+
metadata?: Record<string, any>[];
|
|
55
|
+
ids?: string[];
|
|
56
|
+
}
|
|
57
|
+
interface CreateIndexParams {
|
|
58
|
+
indexName: string;
|
|
59
|
+
dimension: number;
|
|
60
|
+
metric?: 'cosine' | 'euclidean' | 'dotproduct';
|
|
61
|
+
}
|
|
62
|
+
interface QueryVectorParams {
|
|
63
|
+
indexName: string;
|
|
64
|
+
queryVector: number[];
|
|
65
|
+
topK?: number;
|
|
66
|
+
filter?: Record<string, any>;
|
|
67
|
+
includeVector?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface QueryVectorResponse {
|
|
70
|
+
results: QueryResult[];
|
|
71
|
+
}
|
|
72
|
+
interface GetVectorIndexResponse {
|
|
73
|
+
dimension: number;
|
|
74
|
+
metric: 'cosine' | 'euclidean' | 'dotproduct';
|
|
75
|
+
count: number;
|
|
76
|
+
}
|
|
77
|
+
interface SaveMessageToMemoryParams {
|
|
78
|
+
messages: MessageType[];
|
|
79
|
+
}
|
|
80
|
+
type SaveMessageToMemoryResponse = MessageType[];
|
|
81
|
+
interface CreateMemoryThreadParams {
|
|
82
|
+
title: string;
|
|
83
|
+
metadata: Record<string, any>;
|
|
84
|
+
resourceid: string;
|
|
85
|
+
threadId: string;
|
|
86
|
+
}
|
|
87
|
+
type CreateMemoryThreadResponse = StorageThreadType;
|
|
88
|
+
interface GetMemoryThreadParams {
|
|
89
|
+
resourceId: string;
|
|
90
|
+
}
|
|
91
|
+
type GetMemoryThreadResponse = StorageThreadType[];
|
|
92
|
+
interface UpdateMemoryThreadParams {
|
|
93
|
+
title: string;
|
|
94
|
+
metadata: Record<string, any>;
|
|
95
|
+
resourceid: string;
|
|
96
|
+
}
|
|
97
|
+
interface GetMemoryThreadMessagesResponse {
|
|
98
|
+
messages: CoreMessage[];
|
|
99
|
+
uiMessages: AiMessageType[];
|
|
100
|
+
}
|
|
101
|
+
interface GetLogsParams {
|
|
102
|
+
transportId: string;
|
|
103
|
+
}
|
|
104
|
+
interface GetLogParams {
|
|
105
|
+
runId: string;
|
|
106
|
+
transportId: string;
|
|
107
|
+
}
|
|
108
|
+
type GetLogsResponse = BaseLogMessage[];
|
|
109
|
+
type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
|
|
110
|
+
|
|
111
|
+
declare class Agent {
|
|
112
|
+
private request;
|
|
113
|
+
private agentId;
|
|
114
|
+
constructor(request: RequestFunction, agentId: string);
|
|
115
|
+
/**
|
|
116
|
+
* Retrieves details about the agent
|
|
117
|
+
* @returns Promise containing agent details including model and instructions
|
|
118
|
+
*/
|
|
119
|
+
details(): Promise<GetAgentResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Generates a response from the agent
|
|
122
|
+
* @param params - Generation parameters including prompt
|
|
123
|
+
* @returns Promise containing the generated response
|
|
124
|
+
*/
|
|
125
|
+
generate<T extends JSONSchema7 | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
|
|
126
|
+
/**
|
|
127
|
+
* Streams a response from the agent
|
|
128
|
+
* @param params - Stream parameters including prompt
|
|
129
|
+
* @returns Promise containing the streamed response
|
|
130
|
+
*/
|
|
131
|
+
stream<T extends JSONSchema7 | undefined = undefined>(params: StreamParams<T>): Promise<StreamReturn<T>>;
|
|
132
|
+
/**
|
|
133
|
+
* Gets details about a specific tool available to the agent
|
|
134
|
+
* @param toolId - ID of the tool to retrieve
|
|
135
|
+
* @returns Promise containing tool details
|
|
136
|
+
*/
|
|
137
|
+
getTool(toolId: string): Promise<GetToolResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves evaluation results for the agent
|
|
140
|
+
* @returns Promise containing agent evaluations
|
|
141
|
+
*/
|
|
142
|
+
evals(): Promise<GetEvalsByAgentIdResponse>;
|
|
143
|
+
/**
|
|
144
|
+
* Retrieves live evaluation results for the agent
|
|
145
|
+
* @returns Promise containing live agent evaluations
|
|
146
|
+
*/
|
|
147
|
+
liveEvals(): Promise<GetEvalsByAgentIdResponse>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare class MemoryThread {
|
|
151
|
+
private request;
|
|
152
|
+
private threadId;
|
|
153
|
+
constructor(request: RequestFunction, threadId: string);
|
|
154
|
+
/**
|
|
155
|
+
* Retrieves the memory thread details
|
|
156
|
+
* @returns Promise containing thread details including title and metadata
|
|
157
|
+
*/
|
|
158
|
+
get(): Promise<StorageThreadType$1>;
|
|
159
|
+
/**
|
|
160
|
+
* Updates the memory thread properties
|
|
161
|
+
* @param params - Update parameters including title and metadata
|
|
162
|
+
* @returns Promise containing updated thread details
|
|
163
|
+
*/
|
|
164
|
+
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType$1>;
|
|
165
|
+
/**
|
|
166
|
+
* Deletes the memory thread
|
|
167
|
+
* @returns Promise containing deletion result
|
|
168
|
+
*/
|
|
169
|
+
delete(): Promise<{
|
|
170
|
+
result: string;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* Retrieves messages associated with the thread
|
|
174
|
+
* @returns Promise containing thread messages and UI messages
|
|
175
|
+
*/
|
|
176
|
+
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
declare class Tool {
|
|
180
|
+
private request;
|
|
181
|
+
private toolId;
|
|
182
|
+
constructor(request: RequestFunction, toolId: string);
|
|
183
|
+
/**
|
|
184
|
+
* Retrieves details about the tool
|
|
185
|
+
* @returns Promise containing tool details including description and schemas
|
|
186
|
+
*/
|
|
187
|
+
details(): Promise<GetToolResponse>;
|
|
188
|
+
/**
|
|
189
|
+
* Executes the tool with the provided parameters
|
|
190
|
+
* @param params - Parameters required for tool execution
|
|
191
|
+
* @returns Promise containing the tool execution results
|
|
192
|
+
*/
|
|
193
|
+
execute(params: Record<string, any>): Promise<Record<string, any>>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare class Workflow {
|
|
197
|
+
private request;
|
|
198
|
+
private workflowId;
|
|
199
|
+
constructor(request: RequestFunction, workflowId: string);
|
|
200
|
+
/**
|
|
201
|
+
* Retrieves details about the workflow
|
|
202
|
+
* @returns Promise containing workflow details including steps and graphs
|
|
203
|
+
*/
|
|
204
|
+
details(): Promise<GetWorkflowResponse>;
|
|
205
|
+
/**
|
|
206
|
+
* Executes the workflow with the provided parameters
|
|
207
|
+
* @param params - Parameters required for workflow execution
|
|
208
|
+
* @returns Promise containing the workflow execution results
|
|
209
|
+
*/
|
|
210
|
+
execute(params: Record<string, any>): Promise<Record<string, any>>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare class Vector {
|
|
214
|
+
private request;
|
|
215
|
+
private vectorName;
|
|
216
|
+
constructor(request: RequestFunction, vectorName: string);
|
|
217
|
+
/**
|
|
218
|
+
* Retrieves details about a specific vector index
|
|
219
|
+
* @param indexName - Name of the index to get details for
|
|
220
|
+
* @returns Promise containing vector index details
|
|
221
|
+
*/
|
|
222
|
+
details(indexName: string): Promise<GetVectorIndexResponse>;
|
|
223
|
+
/**
|
|
224
|
+
* Deletes a vector index
|
|
225
|
+
* @param indexName - Name of the index to delete
|
|
226
|
+
* @returns Promise indicating deletion success
|
|
227
|
+
*/
|
|
228
|
+
delete(indexName: string): Promise<{
|
|
229
|
+
success: boolean;
|
|
230
|
+
}>;
|
|
231
|
+
/**
|
|
232
|
+
* Retrieves a list of all available indexes
|
|
233
|
+
* @returns Promise containing array of index names
|
|
234
|
+
*/
|
|
235
|
+
getIndexes(): Promise<{
|
|
236
|
+
indexes: string[];
|
|
237
|
+
}>;
|
|
238
|
+
/**
|
|
239
|
+
* Creates a new vector index
|
|
240
|
+
* @param params - Parameters for index creation including dimension and metric
|
|
241
|
+
* @returns Promise indicating creation success
|
|
242
|
+
*/
|
|
243
|
+
createIndex(params: CreateIndexParams): Promise<{
|
|
244
|
+
success: boolean;
|
|
245
|
+
}>;
|
|
246
|
+
/**
|
|
247
|
+
* Upserts vectors into an index
|
|
248
|
+
* @param params - Parameters containing vectors, metadata, and optional IDs
|
|
249
|
+
* @returns Promise containing array of vector IDs
|
|
250
|
+
*/
|
|
251
|
+
upsert(params: UpsertVectorParams): Promise<string[]>;
|
|
252
|
+
/**
|
|
253
|
+
* Queries vectors in an index
|
|
254
|
+
* @param params - Query parameters including query vector and search options
|
|
255
|
+
* @returns Promise containing query results
|
|
256
|
+
*/
|
|
257
|
+
query(params: QueryVectorParams): Promise<QueryVectorResponse>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
declare class MastraClient {
|
|
261
|
+
readonly baseUrl: string;
|
|
262
|
+
private readonly retries;
|
|
263
|
+
private readonly backoffMs;
|
|
264
|
+
private readonly maxBackoffMs;
|
|
265
|
+
private readonly headers;
|
|
266
|
+
constructor(options: ClientOptions);
|
|
267
|
+
/**
|
|
268
|
+
* Makes an HTTP request to the Mastra API
|
|
269
|
+
* @param path - API endpoint path
|
|
270
|
+
* @param options - Request options including method, headers, and body
|
|
271
|
+
* @returns Promise containing the API response
|
|
272
|
+
* @throws Error if the request fails after all retries
|
|
273
|
+
*/
|
|
274
|
+
request(path: string, options?: RequestOptions): Promise<any>;
|
|
275
|
+
/**
|
|
276
|
+
* Retrieves all available agents
|
|
277
|
+
* @returns Promise containing map of agent IDs to agent details
|
|
278
|
+
*/
|
|
279
|
+
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
280
|
+
/**
|
|
281
|
+
* Gets an agent instance by ID
|
|
282
|
+
* @param agentId - ID of the agent to retrieve
|
|
283
|
+
* @returns Agent instance
|
|
284
|
+
*/
|
|
285
|
+
getAgent(agentId: string): Agent;
|
|
286
|
+
/**
|
|
287
|
+
* Retrieves memory threads for a resource
|
|
288
|
+
* @param params - Parameters containing the resource ID
|
|
289
|
+
* @returns Promise containing array of memory threads
|
|
290
|
+
*/
|
|
291
|
+
getMemoryThreads(params: GetMemoryThreadParams): Promise<GetMemoryThreadResponse>;
|
|
292
|
+
/**
|
|
293
|
+
* Creates a new memory thread
|
|
294
|
+
* @param params - Parameters for creating the memory thread
|
|
295
|
+
* @returns Promise containing the created memory thread
|
|
296
|
+
*/
|
|
297
|
+
createMemoryThread(params: CreateMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
|
|
298
|
+
/**
|
|
299
|
+
* Gets a memory thread instance by ID
|
|
300
|
+
* @param threadId - ID of the memory thread to retrieve
|
|
301
|
+
* @returns MemoryThread instance
|
|
302
|
+
*/
|
|
303
|
+
getMemoryThread(threadId: string): MemoryThread;
|
|
304
|
+
/**
|
|
305
|
+
* Saves messages to memory
|
|
306
|
+
* @param params - Parameters containing messages to save
|
|
307
|
+
* @returns Promise containing the saved messages
|
|
308
|
+
*/
|
|
309
|
+
saveMessageToMemory(params: SaveMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
|
|
310
|
+
/**
|
|
311
|
+
* Gets the status of the memory system
|
|
312
|
+
* @returns Promise containing memory system status
|
|
313
|
+
*/
|
|
314
|
+
getMemoryStatus(): Promise<{
|
|
315
|
+
result: boolean;
|
|
316
|
+
}>;
|
|
317
|
+
/**
|
|
318
|
+
* Retrieves all available tools
|
|
319
|
+
* @returns Promise containing map of tool IDs to tool details
|
|
320
|
+
*/
|
|
321
|
+
getTools(): Promise<Record<string, GetToolResponse>>;
|
|
322
|
+
/**
|
|
323
|
+
* Gets a tool instance by ID
|
|
324
|
+
* @param toolId - ID of the tool to retrieve
|
|
325
|
+
* @returns Tool instance
|
|
326
|
+
*/
|
|
327
|
+
getTool(toolId: string): Tool;
|
|
328
|
+
/**
|
|
329
|
+
* Retrieves all available workflows
|
|
330
|
+
* @returns Promise containing map of workflow IDs to workflow details
|
|
331
|
+
*/
|
|
332
|
+
getWorkflows(): Promise<Record<string, GetWorkflowResponse>>;
|
|
333
|
+
/**
|
|
334
|
+
* Gets a workflow instance by ID
|
|
335
|
+
* @param workflowId - ID of the workflow to retrieve
|
|
336
|
+
* @returns Workflow instance
|
|
337
|
+
*/
|
|
338
|
+
getWorkflow(workflowId: string): Workflow;
|
|
339
|
+
/**
|
|
340
|
+
* Gets a vector instance by name
|
|
341
|
+
* @param vectorName - Name of the vector to retrieve
|
|
342
|
+
* @returns Vector instance
|
|
343
|
+
*/
|
|
344
|
+
getVector(vectorName: string): Vector;
|
|
345
|
+
/**
|
|
346
|
+
* Retrieves logs
|
|
347
|
+
* @param params - Parameters for filtering logs
|
|
348
|
+
* @returns Promise containing array of log messages
|
|
349
|
+
*/
|
|
350
|
+
getLogs(params: GetLogsParams): Promise<GetLogsResponse>;
|
|
351
|
+
/**
|
|
352
|
+
* Gets logs for a specific run
|
|
353
|
+
* @param params - Parameters containing run ID to retrieve
|
|
354
|
+
* @returns Promise containing array of log messages
|
|
355
|
+
*/
|
|
356
|
+
getLogForRun(params: GetLogParams): Promise<GetLogsResponse>;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams };
|