@mastra/client-js 0.0.0-error-handler-fix-20251020202607 → 0.0.0-execa-dynamic-import-20260304221256
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/CHANGELOG.md +3375 -3
- package/LICENSE.md +15 -0
- package/README.md +11 -13
- package/dist/_types/@ai-sdk_ui-utils/dist/index.d.ts +820 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +10345 -0
- package/dist/client.d.ts +397 -75
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +44 -0
- package/dist/docs/assets/SOURCE_MAP.json +6 -0
- package/dist/docs/references/docs-server-auth-auth0.md +220 -0
- package/dist/docs/references/docs-server-auth-clerk.md +132 -0
- package/dist/docs/references/docs-server-auth-firebase.md +272 -0
- package/dist/docs/references/docs-server-auth-jwt.md +110 -0
- package/dist/docs/references/docs-server-auth-supabase.md +117 -0
- package/dist/docs/references/docs-server-auth-workos.md +186 -0
- package/dist/docs/references/docs-server-mastra-client.md +243 -0
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +231 -0
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v4-messages.md +79 -0
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v5-messages.md +76 -0
- package/dist/docs/references/reference-client-js-agents.md +437 -0
- package/dist/docs/references/reference-client-js-error-handling.md +16 -0
- package/dist/docs/references/reference-client-js-logs.md +24 -0
- package/dist/docs/references/reference-client-js-mastra-client.md +63 -0
- package/dist/docs/references/reference-client-js-memory.md +221 -0
- package/dist/docs/references/reference-client-js-observability.md +72 -0
- package/dist/docs/references/reference-client-js-telemetry.md +20 -0
- package/dist/docs/references/reference-client-js-tools.md +44 -0
- package/dist/docs/references/reference-client-js-vectors.md +79 -0
- package/dist/docs/references/reference-client-js-workflows.md +199 -0
- package/dist/index.cjs +4575 -1896
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4875 -2193
- package/dist/index.js.map +1 -1
- package/dist/resources/a2a.d.ts.map +1 -1
- package/dist/resources/agent-builder.d.ts +55 -62
- package/dist/resources/agent-builder.d.ts.map +1 -1
- package/dist/resources/agent.d.ts +89 -51
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/base.d.ts +2 -1
- package/dist/resources/base.d.ts.map +1 -1
- package/dist/resources/index.d.ts +9 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/mcp-tool.d.ts +5 -5
- package/dist/resources/mcp-tool.d.ts.map +1 -1
- package/dist/resources/memory-thread.d.ts +31 -16
- package/dist/resources/memory-thread.d.ts.map +1 -1
- package/dist/resources/observability.d.ts +62 -19
- package/dist/resources/observability.d.ts.map +1 -1
- package/dist/resources/processor-provider.d.ts +15 -0
- package/dist/resources/processor-provider.d.ts.map +1 -0
- package/dist/resources/processor.d.ts +20 -0
- package/dist/resources/processor.d.ts.map +1 -0
- package/dist/resources/run.d.ts +210 -0
- package/dist/resources/run.d.ts.map +1 -0
- package/dist/resources/stored-agent.d.ts +83 -0
- package/dist/resources/stored-agent.d.ts.map +1 -0
- package/dist/resources/stored-mcp-client.d.ts +30 -0
- package/dist/resources/stored-mcp-client.d.ts.map +1 -0
- package/dist/resources/stored-prompt-block.d.ts +83 -0
- package/dist/resources/stored-prompt-block.d.ts.map +1 -0
- package/dist/resources/stored-scorer.d.ts +83 -0
- package/dist/resources/stored-scorer.d.ts.map +1 -0
- package/dist/resources/stored-skill.d.ts +30 -0
- package/dist/resources/stored-skill.d.ts.map +1 -0
- package/dist/resources/tool-provider.d.ts +27 -0
- package/dist/resources/tool-provider.d.ts.map +1 -0
- package/dist/resources/tool.d.ts +4 -4
- package/dist/resources/vector.d.ts +5 -5
- package/dist/resources/vector.d.ts.map +1 -1
- package/dist/resources/workflow.d.ts +32 -231
- package/dist/resources/workflow.d.ts.map +1 -1
- package/dist/resources/workspace.d.ts +125 -0
- package/dist/resources/workspace.d.ts.map +1 -0
- package/dist/tools.d.ts +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/types.d.ts +1673 -146
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +56 -4
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/process-mastra-stream.d.ts +1 -1
- package/dist/utils/process-mastra-stream.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema.d.ts +9 -1
- package/dist/utils/zod-to-json-schema.d.ts.map +1 -1
- package/package.json +20 -18
- package/dist/resources/network-memory-thread.d.ts +0 -47
- package/dist/resources/network-memory-thread.d.ts.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import type { AgentExecutionOptions, MultiPrimitiveExecutionOptions, AgentGenerateOptions, AgentStreamOptions, SerializableStructuredOutputOptions,
|
|
1
|
+
import type { AgentExecutionOptions, MultiPrimitiveExecutionOptions, AgentGenerateOptions, AgentStreamOptions, SerializableStructuredOutputOptions, ToolsInput, UIMessageWithMetadata, AgentInstructions } from '@mastra/core/agent';
|
|
2
2
|
import type { MessageListInput } from '@mastra/core/agent/message-list';
|
|
3
|
+
import type { MastraScorerEntry, ScoreRowData } from '@mastra/core/evals';
|
|
3
4
|
import type { CoreMessage } from '@mastra/core/llm';
|
|
4
5
|
import type { BaseLogMessage, LogLevel } from '@mastra/core/logger';
|
|
5
6
|
import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
|
|
6
|
-
import type { AiMessageType, MastraMessageV1,
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type { OutputSchema } from '@mastra/core/stream';
|
|
7
|
+
import type { AiMessageType, MastraMessageV1, MastraDBMessage, MemoryConfig, StorageThreadType } from '@mastra/core/memory';
|
|
8
|
+
import type { TracingOptions } from '@mastra/core/observability';
|
|
9
|
+
import type { RequestContext } from '@mastra/core/request-context';
|
|
10
|
+
import type { AgentInstructionBlock, PaginationInfo, WorkflowRuns, StorageListMessagesInput, ObservationalMemoryRecord, Rule, RuleGroup, StorageConditionalVariant, StorageConditionalField, StoredProcessorGraph } from '@mastra/core/storage';
|
|
11
11
|
import type { QueryResult } from '@mastra/core/vector';
|
|
12
|
-
import type {
|
|
13
|
-
import type { UIMessage } from 'ai';
|
|
12
|
+
import type { TimeTravelContext, Workflow, WorkflowResult, WorkflowRunStatus, WorkflowState } from '@mastra/core/workflows';
|
|
14
13
|
import type { JSONSchema7 } from 'json-schema';
|
|
15
14
|
import type { ZodSchema } from 'zod';
|
|
16
15
|
export interface ClientOptions {
|
|
17
16
|
/** Base URL for API requests */
|
|
18
17
|
baseUrl: string;
|
|
18
|
+
/** API route prefix. Defaults to '/api'. Set this to match your server's apiPrefix configuration. */
|
|
19
|
+
apiPrefix?: string;
|
|
19
20
|
/** Number of retry attempts for failed requests */
|
|
20
21
|
retries?: number;
|
|
21
22
|
/** Initial backoff time in milliseconds between retries */
|
|
@@ -28,6 +29,8 @@ export interface ClientOptions {
|
|
|
28
29
|
abortSignal?: AbortSignal;
|
|
29
30
|
/** Credentials mode for requests. See https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials for more info. */
|
|
30
31
|
credentials?: 'omit' | 'same-origin' | 'include';
|
|
32
|
+
/** Custom fetch function to use for HTTP requests. Useful for environments like Tauri that require custom fetch implementations. */
|
|
33
|
+
fetch?: typeof fetch;
|
|
31
34
|
}
|
|
32
35
|
export interface RequestOptions {
|
|
33
36
|
method?: string;
|
|
@@ -42,11 +45,14 @@ type WithoutMethods<T> = {
|
|
|
42
45
|
(): any;
|
|
43
46
|
} ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
|
|
44
47
|
};
|
|
45
|
-
export type NetworkStreamParams = {
|
|
48
|
+
export type NetworkStreamParams<OUTPUT = undefined> = {
|
|
46
49
|
messages: MessageListInput;
|
|
47
|
-
|
|
50
|
+
tracingOptions?: TracingOptions;
|
|
51
|
+
} & MultiPrimitiveExecutionOptions<OUTPUT>;
|
|
48
52
|
export interface GetAgentResponse {
|
|
53
|
+
id: string;
|
|
49
54
|
name: string;
|
|
55
|
+
description?: string;
|
|
50
56
|
instructions: AgentInstructions;
|
|
51
57
|
tools: Record<string, GetToolResponse>;
|
|
52
58
|
workflows: Record<string, GetWorkflowResponse>;
|
|
@@ -54,11 +60,13 @@ export interface GetAgentResponse {
|
|
|
54
60
|
id: string;
|
|
55
61
|
name: string;
|
|
56
62
|
}>;
|
|
63
|
+
skills?: SkillMetadata[];
|
|
64
|
+
workspaceTools?: string[];
|
|
65
|
+
/** ID of the agent's workspace (if configured) */
|
|
66
|
+
workspaceId?: string;
|
|
57
67
|
provider: string;
|
|
58
68
|
modelId: string;
|
|
59
69
|
modelVersion: string;
|
|
60
|
-
defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
|
|
61
|
-
defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
|
|
62
70
|
modelList: Array<{
|
|
63
71
|
id: string;
|
|
64
72
|
enabled: boolean;
|
|
@@ -69,27 +77,51 @@ export interface GetAgentResponse {
|
|
|
69
77
|
modelVersion: string;
|
|
70
78
|
};
|
|
71
79
|
}> | undefined;
|
|
80
|
+
inputProcessors?: Array<{
|
|
81
|
+
id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
}>;
|
|
84
|
+
outputProcessors?: Array<{
|
|
85
|
+
id: string;
|
|
86
|
+
name: string;
|
|
87
|
+
}>;
|
|
88
|
+
defaultOptions: WithoutMethods<AgentExecutionOptions>;
|
|
89
|
+
defaultGenerateOptionsLegacy: WithoutMethods<AgentGenerateOptions>;
|
|
90
|
+
defaultStreamOptionsLegacy: WithoutMethods<AgentStreamOptions>;
|
|
91
|
+
/** Serialized JSON schema for request context validation */
|
|
92
|
+
requestContextSchema?: string;
|
|
93
|
+
source?: 'code' | 'stored';
|
|
94
|
+
status?: 'draft' | 'published' | 'archived';
|
|
95
|
+
activeVersionId?: string;
|
|
96
|
+
hasDraft?: boolean;
|
|
72
97
|
}
|
|
73
98
|
export type GenerateLegacyParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
74
99
|
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
75
100
|
output?: T;
|
|
76
101
|
experimental_output?: T;
|
|
77
|
-
|
|
102
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
78
103
|
clientTools?: ToolsInput;
|
|
79
|
-
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | '
|
|
104
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'requestContext' | 'clientTools' | 'abortSignal'>>;
|
|
80
105
|
export type StreamLegacyParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
81
106
|
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
82
107
|
output?: T;
|
|
83
108
|
experimental_output?: T;
|
|
84
|
-
|
|
109
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
85
110
|
clientTools?: ToolsInput;
|
|
86
|
-
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | '
|
|
87
|
-
export type
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
111
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'requestContext' | 'clientTools' | 'abortSignal'>>;
|
|
112
|
+
export type StreamParamsBase<OUTPUT = undefined> = {
|
|
113
|
+
tracingOptions?: TracingOptions;
|
|
114
|
+
requestContext?: RequestContext;
|
|
91
115
|
clientTools?: ToolsInput;
|
|
92
|
-
} & WithoutMethods<Omit<AgentExecutionOptions<OUTPUT>, '
|
|
116
|
+
} & WithoutMethods<Omit<AgentExecutionOptions<OUTPUT>, 'requestContext' | 'clientTools' | 'options' | 'abortSignal' | 'structuredOutput'>>;
|
|
117
|
+
export type StreamParamsBaseWithoutMessages<OUTPUT = undefined> = StreamParamsBase<OUTPUT>;
|
|
118
|
+
export type StreamParams<OUTPUT = undefined> = StreamParamsBase<OUTPUT> & {
|
|
119
|
+
messages: MessageListInput;
|
|
120
|
+
} & (OUTPUT extends undefined ? {
|
|
121
|
+
structuredOutput?: never;
|
|
122
|
+
} : {
|
|
123
|
+
structuredOutput: SerializableStructuredOutputOptions<OUTPUT>;
|
|
124
|
+
});
|
|
93
125
|
export type UpdateModelParams = {
|
|
94
126
|
modelId: string;
|
|
95
127
|
provider: 'openai' | 'anthropic' | 'groq' | 'xai' | 'google';
|
|
@@ -106,28 +138,27 @@ export type UpdateModelInModelListParams = {
|
|
|
106
138
|
export type ReorderModelListParams = {
|
|
107
139
|
reorderedModelIds: string[];
|
|
108
140
|
};
|
|
109
|
-
export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
110
|
-
evals: any[];
|
|
111
|
-
instructions: string;
|
|
112
|
-
name: string;
|
|
113
|
-
id: string;
|
|
114
|
-
}
|
|
115
141
|
export interface GetToolResponse {
|
|
116
142
|
id: string;
|
|
117
143
|
description: string;
|
|
118
144
|
inputSchema: string;
|
|
119
145
|
outputSchema: string;
|
|
146
|
+
requestContextSchema?: string;
|
|
120
147
|
}
|
|
121
|
-
export interface
|
|
148
|
+
export interface ListWorkflowRunsParams {
|
|
122
149
|
fromDate?: Date;
|
|
123
150
|
toDate?: Date;
|
|
124
|
-
|
|
125
|
-
|
|
151
|
+
page?: number;
|
|
152
|
+
perPage?: number;
|
|
126
153
|
resourceId?: string;
|
|
154
|
+
status?: WorkflowRunStatus;
|
|
155
|
+
/** @deprecated Use page instead */
|
|
156
|
+
offset?: number;
|
|
157
|
+
/** @deprecated Use perPage instead */
|
|
158
|
+
limit?: number | false;
|
|
127
159
|
}
|
|
128
|
-
export type
|
|
129
|
-
export type GetWorkflowRunByIdResponse =
|
|
130
|
-
export type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
|
|
160
|
+
export type ListWorkflowRunsResponse = WorkflowRuns;
|
|
161
|
+
export type GetWorkflowRunByIdResponse = WorkflowState;
|
|
131
162
|
export interface GetWorkflowResponse {
|
|
132
163
|
name: string;
|
|
133
164
|
description?: string;
|
|
@@ -139,6 +170,8 @@ export interface GetWorkflowResponse {
|
|
|
139
170
|
outputSchema: string;
|
|
140
171
|
resumeSchema: string;
|
|
141
172
|
suspendSchema: string;
|
|
173
|
+
stateSchema: string;
|
|
174
|
+
metadata?: Record<string, unknown>;
|
|
142
175
|
};
|
|
143
176
|
};
|
|
144
177
|
allSteps: {
|
|
@@ -149,16 +182,20 @@ export interface GetWorkflowResponse {
|
|
|
149
182
|
outputSchema: string;
|
|
150
183
|
resumeSchema: string;
|
|
151
184
|
suspendSchema: string;
|
|
185
|
+
stateSchema: string;
|
|
152
186
|
isWorkflow: boolean;
|
|
187
|
+
metadata?: Record<string, unknown>;
|
|
153
188
|
};
|
|
154
189
|
};
|
|
155
190
|
stepGraph: Workflow['serializedStepGraph'];
|
|
156
191
|
inputSchema: string;
|
|
157
192
|
outputSchema: string;
|
|
193
|
+
stateSchema: string;
|
|
194
|
+
/** Serialized JSON schema for request context validation */
|
|
195
|
+
requestContextSchema?: string;
|
|
196
|
+
/** Whether this workflow is a processor workflow (auto-generated from agent processors) */
|
|
197
|
+
isProcessorWorkflow?: boolean;
|
|
158
198
|
}
|
|
159
|
-
export type WorkflowWatchResult = WatchEvent & {
|
|
160
|
-
runId: string;
|
|
161
|
-
};
|
|
162
199
|
export type WorkflowRunResult = WorkflowResult<any, any, any, any>;
|
|
163
200
|
export interface UpsertVectorParams {
|
|
164
201
|
indexName: string;
|
|
@@ -187,63 +224,100 @@ export interface GetVectorIndexResponse {
|
|
|
187
224
|
count: number;
|
|
188
225
|
}
|
|
189
226
|
export interface SaveMessageToMemoryParams {
|
|
190
|
-
messages: (MastraMessageV1 |
|
|
227
|
+
messages: (MastraMessageV1 | MastraDBMessage)[];
|
|
191
228
|
agentId: string;
|
|
229
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
192
230
|
}
|
|
193
231
|
export interface SaveNetworkMessageToMemoryParams {
|
|
194
|
-
messages: (MastraMessageV1 |
|
|
232
|
+
messages: (MastraMessageV1 | MastraDBMessage)[];
|
|
195
233
|
networkId: string;
|
|
196
234
|
}
|
|
197
|
-
export type SaveMessageToMemoryResponse =
|
|
235
|
+
export type SaveMessageToMemoryResponse = {
|
|
236
|
+
messages: (MastraMessageV1 | MastraDBMessage)[];
|
|
237
|
+
};
|
|
198
238
|
export interface CreateMemoryThreadParams {
|
|
199
239
|
title?: string;
|
|
200
240
|
metadata?: Record<string, any>;
|
|
201
241
|
resourceId: string;
|
|
202
242
|
threadId?: string;
|
|
203
243
|
agentId: string;
|
|
204
|
-
|
|
205
|
-
export interface CreateNetworkMemoryThreadParams {
|
|
206
|
-
title?: string;
|
|
207
|
-
metadata?: Record<string, any>;
|
|
208
|
-
resourceId: string;
|
|
209
|
-
threadId?: string;
|
|
210
|
-
networkId: string;
|
|
244
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
211
245
|
}
|
|
212
246
|
export type CreateMemoryThreadResponse = StorageThreadType;
|
|
213
|
-
export interface
|
|
214
|
-
|
|
215
|
-
|
|
247
|
+
export interface ListMemoryThreadsParams {
|
|
248
|
+
/**
|
|
249
|
+
* Optional resourceId to filter threads. When not provided, returns all threads.
|
|
250
|
+
*/
|
|
251
|
+
resourceId?: string;
|
|
252
|
+
/**
|
|
253
|
+
* Optional metadata filter. Threads must match all specified key-value pairs (AND logic).
|
|
254
|
+
*/
|
|
255
|
+
metadata?: Record<string, unknown>;
|
|
256
|
+
/**
|
|
257
|
+
* Optional agentId. When not provided and storage is configured on the server,
|
|
258
|
+
* threads will be retrieved using storage directly.
|
|
259
|
+
*/
|
|
260
|
+
agentId?: string;
|
|
261
|
+
page?: number;
|
|
262
|
+
perPage?: number;
|
|
263
|
+
orderBy?: 'createdAt' | 'updatedAt';
|
|
264
|
+
sortDirection?: 'ASC' | 'DESC';
|
|
265
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
216
266
|
}
|
|
267
|
+
export type ListMemoryThreadsResponse = PaginationInfo & {
|
|
268
|
+
threads: StorageThreadType[];
|
|
269
|
+
};
|
|
217
270
|
export interface GetMemoryConfigParams {
|
|
218
271
|
agentId: string;
|
|
272
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
219
273
|
}
|
|
220
274
|
export type GetMemoryConfigResponse = {
|
|
221
|
-
config: MemoryConfig
|
|
275
|
+
config: MemoryConfig & {
|
|
276
|
+
observationalMemory?: {
|
|
277
|
+
enabled: boolean;
|
|
278
|
+
scope?: 'thread' | 'resource';
|
|
279
|
+
shareTokenBudget?: boolean;
|
|
280
|
+
messageTokens?: number | {
|
|
281
|
+
min: number;
|
|
282
|
+
max: number;
|
|
283
|
+
};
|
|
284
|
+
observationTokens?: number | {
|
|
285
|
+
min: number;
|
|
286
|
+
max: number;
|
|
287
|
+
};
|
|
288
|
+
observationModel?: string;
|
|
289
|
+
reflectionModel?: string;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
222
292
|
};
|
|
223
|
-
export interface GetNetworkMemoryThreadParams {
|
|
224
|
-
resourceId: string;
|
|
225
|
-
networkId: string;
|
|
226
|
-
}
|
|
227
|
-
export type GetMemoryThreadResponse = StorageThreadType[];
|
|
228
293
|
export interface UpdateMemoryThreadParams {
|
|
229
294
|
title: string;
|
|
230
295
|
metadata: Record<string, any>;
|
|
231
296
|
resourceId: string;
|
|
297
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
232
298
|
}
|
|
233
|
-
export
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
299
|
+
export type ListMemoryThreadMessagesParams = Omit<StorageListMessagesInput, 'threadId'>;
|
|
300
|
+
export type ListMemoryThreadMessagesResponse = {
|
|
301
|
+
messages: MastraDBMessage[];
|
|
302
|
+
};
|
|
303
|
+
export interface CloneMemoryThreadParams {
|
|
304
|
+
newThreadId?: string;
|
|
305
|
+
resourceId?: string;
|
|
306
|
+
title?: string;
|
|
307
|
+
metadata?: Record<string, any>;
|
|
308
|
+
options?: {
|
|
309
|
+
messageLimit?: number;
|
|
310
|
+
messageFilter?: {
|
|
311
|
+
startDate?: Date;
|
|
312
|
+
endDate?: Date;
|
|
313
|
+
messageIds?: string[];
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
244
317
|
}
|
|
245
|
-
export type
|
|
246
|
-
|
|
318
|
+
export type CloneMemoryThreadResponse = {
|
|
319
|
+
thread: StorageThreadType;
|
|
320
|
+
clonedMessages: MastraDBMessage[];
|
|
247
321
|
};
|
|
248
322
|
export interface GetLogsParams {
|
|
249
323
|
transportId: string;
|
|
@@ -272,55 +346,6 @@ export type GetLogsResponse = {
|
|
|
272
346
|
hasMore: boolean;
|
|
273
347
|
};
|
|
274
348
|
export type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
|
|
275
|
-
type SpanStatus = {
|
|
276
|
-
code: number;
|
|
277
|
-
};
|
|
278
|
-
type SpanOther = {
|
|
279
|
-
droppedAttributesCount: number;
|
|
280
|
-
droppedEventsCount: number;
|
|
281
|
-
droppedLinksCount: number;
|
|
282
|
-
};
|
|
283
|
-
type SpanEventAttributes = {
|
|
284
|
-
key: string;
|
|
285
|
-
value: {
|
|
286
|
-
[key: string]: string | number | boolean | null;
|
|
287
|
-
};
|
|
288
|
-
};
|
|
289
|
-
type SpanEvent = {
|
|
290
|
-
attributes: SpanEventAttributes[];
|
|
291
|
-
name: string;
|
|
292
|
-
timeUnixNano: string;
|
|
293
|
-
droppedAttributesCount: number;
|
|
294
|
-
};
|
|
295
|
-
type Span = {
|
|
296
|
-
id: string;
|
|
297
|
-
parentSpanId: string | null;
|
|
298
|
-
traceId: string;
|
|
299
|
-
name: string;
|
|
300
|
-
scope: string;
|
|
301
|
-
kind: number;
|
|
302
|
-
status: SpanStatus;
|
|
303
|
-
events: SpanEvent[];
|
|
304
|
-
links: any[];
|
|
305
|
-
attributes: Record<string, string | number | boolean | null>;
|
|
306
|
-
startTime: number;
|
|
307
|
-
endTime: number;
|
|
308
|
-
duration: number;
|
|
309
|
-
other: SpanOther;
|
|
310
|
-
createdAt: string;
|
|
311
|
-
};
|
|
312
|
-
export interface GetTelemetryResponse {
|
|
313
|
-
traces: Span[];
|
|
314
|
-
}
|
|
315
|
-
export interface GetTelemetryParams {
|
|
316
|
-
name?: string;
|
|
317
|
-
scope?: string;
|
|
318
|
-
page?: number;
|
|
319
|
-
perPage?: number;
|
|
320
|
-
attribute?: Record<string, string>;
|
|
321
|
-
fromDate?: Date;
|
|
322
|
-
toDate?: Date;
|
|
323
|
-
}
|
|
324
349
|
export interface GetVNextNetworkResponse {
|
|
325
350
|
id: string;
|
|
326
351
|
name: string;
|
|
@@ -355,14 +380,14 @@ export interface GenerateOrStreamVNextNetworkParams {
|
|
|
355
380
|
message: string;
|
|
356
381
|
threadId?: string;
|
|
357
382
|
resourceId?: string;
|
|
358
|
-
|
|
383
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
359
384
|
}
|
|
360
385
|
export interface LoopStreamVNextNetworkParams {
|
|
361
386
|
message: string;
|
|
362
387
|
threadId?: string;
|
|
363
388
|
resourceId?: string;
|
|
364
389
|
maxIterations?: number;
|
|
365
|
-
|
|
390
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
366
391
|
}
|
|
367
392
|
export interface LoopVNextNetworkResponse {
|
|
368
393
|
status: 'success';
|
|
@@ -396,48 +421,41 @@ export interface McpToolInfo {
|
|
|
396
421
|
export interface McpServerToolListResponse {
|
|
397
422
|
tools: McpToolInfo[];
|
|
398
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Client version of ScoreRowData with dates serialized as strings (from JSON)
|
|
426
|
+
*/
|
|
399
427
|
export type ClientScoreRowData = Omit<ScoreRowData, 'createdAt' | 'updatedAt'> & {
|
|
400
428
|
createdAt: string;
|
|
401
429
|
updatedAt: string;
|
|
402
|
-
} & {
|
|
403
|
-
spanId?: string;
|
|
404
430
|
};
|
|
405
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Response for listing scores (client version with serialized dates)
|
|
433
|
+
*/
|
|
434
|
+
export type ListScoresResponse = {
|
|
435
|
+
pagination: PaginationInfo;
|
|
436
|
+
scores: ClientScoreRowData[];
|
|
437
|
+
};
|
|
438
|
+
export interface ListScoresByRunIdParams {
|
|
406
439
|
runId: string;
|
|
407
440
|
page?: number;
|
|
408
441
|
perPage?: number;
|
|
409
442
|
}
|
|
410
|
-
export interface
|
|
443
|
+
export interface ListScoresByScorerIdParams {
|
|
411
444
|
scorerId: string;
|
|
412
445
|
entityId?: string;
|
|
413
446
|
entityType?: string;
|
|
414
447
|
page?: number;
|
|
415
448
|
perPage?: number;
|
|
416
449
|
}
|
|
417
|
-
export interface
|
|
450
|
+
export interface ListScoresByEntityIdParams {
|
|
418
451
|
entityId: string;
|
|
419
452
|
entityType: string;
|
|
420
453
|
page?: number;
|
|
421
454
|
perPage?: number;
|
|
422
455
|
}
|
|
423
|
-
export interface GetScoresBySpanParams {
|
|
424
|
-
traceId: string;
|
|
425
|
-
spanId: string;
|
|
426
|
-
page?: number;
|
|
427
|
-
perPage?: number;
|
|
428
|
-
}
|
|
429
456
|
export interface SaveScoreParams {
|
|
430
457
|
score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>;
|
|
431
458
|
}
|
|
432
|
-
export interface GetScoresResponse {
|
|
433
|
-
pagination: {
|
|
434
|
-
total: number;
|
|
435
|
-
page: number;
|
|
436
|
-
perPage: number;
|
|
437
|
-
hasMore: boolean;
|
|
438
|
-
};
|
|
439
|
-
scores: ClientScoreRowData[];
|
|
440
|
-
}
|
|
441
459
|
export interface SaveScoreResponse {
|
|
442
460
|
score: ClientScoreRowData;
|
|
443
461
|
}
|
|
@@ -462,18 +480,1527 @@ export interface TemplateInstallationRequest {
|
|
|
462
480
|
/** Environment variables for template */
|
|
463
481
|
variables?: Record<string, string>;
|
|
464
482
|
}
|
|
465
|
-
export interface GetAITraceResponse {
|
|
466
|
-
trace: AITraceRecord;
|
|
467
|
-
}
|
|
468
|
-
export interface GetAITracesResponse {
|
|
469
|
-
spans: AISpanRecord[];
|
|
470
|
-
pagination: PaginationInfo;
|
|
471
|
-
}
|
|
472
483
|
export interface StreamVNextChunkType {
|
|
473
484
|
type: string;
|
|
474
485
|
payload: any;
|
|
475
486
|
runId: string;
|
|
476
487
|
from: 'AGENT' | 'WORKFLOW';
|
|
477
488
|
}
|
|
489
|
+
export interface MemorySearchResponse {
|
|
490
|
+
results: MemorySearchResult[];
|
|
491
|
+
count: number;
|
|
492
|
+
query: string;
|
|
493
|
+
searchType?: string;
|
|
494
|
+
searchScope?: 'thread' | 'resource';
|
|
495
|
+
}
|
|
496
|
+
export interface MemorySearchResult {
|
|
497
|
+
id: string;
|
|
498
|
+
role: string;
|
|
499
|
+
content: string;
|
|
500
|
+
createdAt: string;
|
|
501
|
+
threadId?: string;
|
|
502
|
+
threadTitle?: string;
|
|
503
|
+
context?: {
|
|
504
|
+
before?: Array<{
|
|
505
|
+
id: string;
|
|
506
|
+
role: string;
|
|
507
|
+
content: string;
|
|
508
|
+
createdAt: string;
|
|
509
|
+
}>;
|
|
510
|
+
after?: Array<{
|
|
511
|
+
id: string;
|
|
512
|
+
role: string;
|
|
513
|
+
content: string;
|
|
514
|
+
createdAt: string;
|
|
515
|
+
}>;
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
export interface TimeTravelParams {
|
|
519
|
+
step: string | string[];
|
|
520
|
+
inputData?: Record<string, any>;
|
|
521
|
+
resumeData?: Record<string, any>;
|
|
522
|
+
initialState?: Record<string, any>;
|
|
523
|
+
context?: TimeTravelContext<any, any, any, any>;
|
|
524
|
+
nestedStepsContext?: Record<string, TimeTravelContext<any, any, any, any>>;
|
|
525
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
526
|
+
tracingOptions?: TracingOptions;
|
|
527
|
+
perStep?: boolean;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Semantic recall configuration for vector-based memory retrieval
|
|
531
|
+
*/
|
|
532
|
+
export interface SemanticRecallConfig {
|
|
533
|
+
topK: number;
|
|
534
|
+
messageRange: number | {
|
|
535
|
+
before: number;
|
|
536
|
+
after: number;
|
|
537
|
+
};
|
|
538
|
+
scope?: 'thread' | 'resource';
|
|
539
|
+
threshold?: number;
|
|
540
|
+
indexName?: string;
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Title generation configuration
|
|
544
|
+
*/
|
|
545
|
+
export type TitleGenerationConfig = boolean | {
|
|
546
|
+
model: string;
|
|
547
|
+
instructions?: string;
|
|
548
|
+
};
|
|
549
|
+
/**
|
|
550
|
+
* Serialized memory configuration matching SerializedMemoryConfig from @mastra/core
|
|
551
|
+
*
|
|
552
|
+
* Note: When semanticRecall is enabled, both `vector` (string, not false) and `embedder` must be configured.
|
|
553
|
+
*/
|
|
554
|
+
/** Serializable observation step config for observational memory */
|
|
555
|
+
export interface SerializedObservationConfig {
|
|
556
|
+
model?: string;
|
|
557
|
+
messageTokens?: number;
|
|
558
|
+
modelSettings?: Record<string, unknown>;
|
|
559
|
+
providerOptions?: Record<string, Record<string, unknown> | undefined>;
|
|
560
|
+
maxTokensPerBatch?: number;
|
|
561
|
+
bufferTokens?: number | false;
|
|
562
|
+
bufferActivation?: number;
|
|
563
|
+
blockAfter?: number;
|
|
564
|
+
}
|
|
565
|
+
/** Serializable reflection step config for observational memory */
|
|
566
|
+
export interface SerializedReflectionConfig {
|
|
567
|
+
model?: string;
|
|
568
|
+
observationTokens?: number;
|
|
569
|
+
modelSettings?: Record<string, unknown>;
|
|
570
|
+
providerOptions?: Record<string, Record<string, unknown> | undefined>;
|
|
571
|
+
blockAfter?: number;
|
|
572
|
+
bufferActivation?: number;
|
|
573
|
+
}
|
|
574
|
+
/** Serializable observational memory configuration */
|
|
575
|
+
export interface SerializedObservationalMemoryConfig {
|
|
576
|
+
model?: string;
|
|
577
|
+
scope?: 'resource' | 'thread';
|
|
578
|
+
shareTokenBudget?: boolean;
|
|
579
|
+
observation?: SerializedObservationConfig;
|
|
580
|
+
reflection?: SerializedReflectionConfig;
|
|
581
|
+
}
|
|
582
|
+
export interface SerializedMemoryConfig {
|
|
583
|
+
/**
|
|
584
|
+
* Vector database identifier. Required when semanticRecall is enabled.
|
|
585
|
+
* Set to false to explicitly disable vector search.
|
|
586
|
+
*/
|
|
587
|
+
vector?: string | false;
|
|
588
|
+
options?: {
|
|
589
|
+
readOnly?: boolean;
|
|
590
|
+
lastMessages?: number | false;
|
|
591
|
+
/**
|
|
592
|
+
* Semantic recall configuration. When enabled (true or object),
|
|
593
|
+
* requires both `vector` and `embedder` to be configured.
|
|
594
|
+
*/
|
|
595
|
+
semanticRecall?: boolean | SemanticRecallConfig;
|
|
596
|
+
generateTitle?: TitleGenerationConfig;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* Embedding model ID in the format "provider/model"
|
|
600
|
+
* (e.g., "openai/text-embedding-3-small")
|
|
601
|
+
* Required when semanticRecall is enabled.
|
|
602
|
+
*/
|
|
603
|
+
embedder?: string;
|
|
604
|
+
/**
|
|
605
|
+
* Options to pass to the embedder
|
|
606
|
+
*/
|
|
607
|
+
embedderOptions?: Record<string, unknown>;
|
|
608
|
+
/**
|
|
609
|
+
* Serialized observational memory configuration.
|
|
610
|
+
* `true` to enable with defaults, or a config object for customization.
|
|
611
|
+
*/
|
|
612
|
+
observationalMemory?: boolean | SerializedObservationalMemoryConfig;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Default options for agent execution (serializable subset of AgentExecutionOptionsBase)
|
|
616
|
+
*/
|
|
617
|
+
export interface DefaultOptions {
|
|
618
|
+
runId?: string;
|
|
619
|
+
savePerStep?: boolean;
|
|
620
|
+
maxSteps?: number;
|
|
621
|
+
activeTools?: string[];
|
|
622
|
+
maxProcessorRetries?: number;
|
|
623
|
+
toolChoice?: 'auto' | 'none' | 'required' | {
|
|
624
|
+
type: 'tool';
|
|
625
|
+
toolName: string;
|
|
626
|
+
};
|
|
627
|
+
modelSettings?: {
|
|
628
|
+
temperature?: number;
|
|
629
|
+
maxTokens?: number;
|
|
630
|
+
topP?: number;
|
|
631
|
+
topK?: number;
|
|
632
|
+
frequencyPenalty?: number;
|
|
633
|
+
presencePenalty?: number;
|
|
634
|
+
stopSequences?: string[];
|
|
635
|
+
seed?: number;
|
|
636
|
+
maxRetries?: number;
|
|
637
|
+
};
|
|
638
|
+
returnScorerData?: boolean;
|
|
639
|
+
tracingOptions?: {
|
|
640
|
+
traceName?: string;
|
|
641
|
+
attributes?: Record<string, unknown>;
|
|
642
|
+
spanId?: string;
|
|
643
|
+
traceId?: string;
|
|
644
|
+
};
|
|
645
|
+
requireToolApproval?: boolean;
|
|
646
|
+
autoResumeSuspendedTools?: boolean;
|
|
647
|
+
toolCallConcurrency?: number;
|
|
648
|
+
includeRawChunks?: boolean;
|
|
649
|
+
[key: string]: unknown;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Per-tool config for stored agents (e.g., description overrides)
|
|
653
|
+
*/
|
|
654
|
+
export interface StoredAgentToolConfig {
|
|
655
|
+
description?: string;
|
|
656
|
+
rules?: RuleGroup;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Per-MCP-client/integration tool configuration stored in agent snapshots.
|
|
660
|
+
* Specifies which tools from an MCP client or integration provider are enabled and their overrides.
|
|
661
|
+
* When `tools` is omitted, all tools from the source are included.
|
|
662
|
+
*/
|
|
663
|
+
export interface StoredMCPClientToolsConfig {
|
|
664
|
+
/** When omitted, all tools from the source are included. */
|
|
665
|
+
tools?: Record<string, StoredAgentToolConfig>;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Scorer config for stored agents
|
|
669
|
+
*/
|
|
670
|
+
export interface StoredAgentScorerConfig {
|
|
671
|
+
description?: string;
|
|
672
|
+
sampling?: {
|
|
673
|
+
type: 'none';
|
|
674
|
+
} | {
|
|
675
|
+
type: 'ratio';
|
|
676
|
+
rate: number;
|
|
677
|
+
};
|
|
678
|
+
rules?: RuleGroup;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Per-skill config stored in agent snapshots.
|
|
682
|
+
* Allows overriding skill description and instructions for a specific agent context.
|
|
683
|
+
*/
|
|
684
|
+
export interface StoredAgentSkillConfig {
|
|
685
|
+
description?: string;
|
|
686
|
+
instructions?: string;
|
|
687
|
+
/** Pin to a specific version ID. Takes precedence over strategy. */
|
|
688
|
+
pin?: string;
|
|
689
|
+
/** Resolution strategy: 'latest' = latest published version, 'live' = read from filesystem */
|
|
690
|
+
strategy?: 'latest' | 'live';
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Workspace reference stored in agent snapshots.
|
|
694
|
+
* Can reference a stored workspace by ID or provide inline workspace config.
|
|
695
|
+
*/
|
|
696
|
+
export type StoredWorkspaceRef = {
|
|
697
|
+
type: 'id';
|
|
698
|
+
workspaceId: string;
|
|
699
|
+
} | {
|
|
700
|
+
type: 'inline';
|
|
701
|
+
config: Record<string, unknown>;
|
|
702
|
+
};
|
|
703
|
+
export type StoredAgentRule = Rule;
|
|
704
|
+
export type StoredAgentRuleGroup = RuleGroup;
|
|
705
|
+
export type ConditionalVariant<T> = StorageConditionalVariant<T>;
|
|
706
|
+
export type ConditionalField<T> = StorageConditionalField<T>;
|
|
707
|
+
/**
|
|
708
|
+
* Stored agent data returned from API
|
|
709
|
+
*/
|
|
710
|
+
export interface StoredAgentResponse {
|
|
711
|
+
id: string;
|
|
712
|
+
status: string;
|
|
713
|
+
activeVersionId?: string;
|
|
714
|
+
authorId?: string;
|
|
715
|
+
metadata?: Record<string, unknown>;
|
|
716
|
+
createdAt: string;
|
|
717
|
+
updatedAt: string;
|
|
718
|
+
name: string;
|
|
719
|
+
description?: string;
|
|
720
|
+
instructions: string | AgentInstructionBlock[];
|
|
721
|
+
model: ConditionalField<{
|
|
722
|
+
provider: string;
|
|
723
|
+
name: string;
|
|
724
|
+
[key: string]: unknown;
|
|
725
|
+
}>;
|
|
726
|
+
tools?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
727
|
+
defaultOptions?: ConditionalField<DefaultOptions>;
|
|
728
|
+
workflows?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
729
|
+
agents?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
730
|
+
integrationTools?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
|
|
731
|
+
mcpClients?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
|
|
732
|
+
inputProcessors?: ConditionalField<StoredProcessorGraph>;
|
|
733
|
+
outputProcessors?: ConditionalField<StoredProcessorGraph>;
|
|
734
|
+
memory?: ConditionalField<SerializedMemoryConfig>;
|
|
735
|
+
scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
|
|
736
|
+
skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
|
|
737
|
+
workspace?: ConditionalField<StoredWorkspaceRef>;
|
|
738
|
+
requestContextSchema?: Record<string, unknown>;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Parameters for listing stored agents
|
|
742
|
+
*/
|
|
743
|
+
export interface ListStoredAgentsParams {
|
|
744
|
+
page?: number;
|
|
745
|
+
perPage?: number;
|
|
746
|
+
orderBy?: {
|
|
747
|
+
field?: 'createdAt' | 'updatedAt';
|
|
748
|
+
direction?: 'ASC' | 'DESC';
|
|
749
|
+
};
|
|
750
|
+
authorId?: string;
|
|
751
|
+
metadata?: Record<string, unknown>;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Response for listing stored agents
|
|
755
|
+
*/
|
|
756
|
+
export interface ListStoredAgentsResponse {
|
|
757
|
+
agents: StoredAgentResponse[];
|
|
758
|
+
total: number;
|
|
759
|
+
page: number;
|
|
760
|
+
perPage: number | false;
|
|
761
|
+
hasMore: boolean;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Parameters for cloning an agent to a stored agent
|
|
765
|
+
*/
|
|
766
|
+
export interface CloneAgentParams {
|
|
767
|
+
/** ID for the cloned agent. If not provided, derived from agent ID. */
|
|
768
|
+
newId?: string;
|
|
769
|
+
/** Name for the cloned agent. Defaults to "{name} (Clone)". */
|
|
770
|
+
newName?: string;
|
|
771
|
+
/** Additional metadata for the cloned agent. */
|
|
772
|
+
metadata?: Record<string, unknown>;
|
|
773
|
+
/** Author identifier for the cloned agent. */
|
|
774
|
+
authorId?: string;
|
|
775
|
+
/** Request context for resolving dynamic agent configuration (instructions, model, tools, etc.) */
|
|
776
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Parameters for creating a stored agent.
|
|
780
|
+
* Flat union of agent-record fields and config fields.
|
|
781
|
+
*/
|
|
782
|
+
export interface CreateStoredAgentParams {
|
|
783
|
+
/** Unique identifier for the agent. If not provided, derived from name via slugify. */
|
|
784
|
+
id?: string;
|
|
785
|
+
authorId?: string;
|
|
786
|
+
metadata?: Record<string, unknown>;
|
|
787
|
+
name: string;
|
|
788
|
+
description?: string;
|
|
789
|
+
instructions: string | AgentInstructionBlock[];
|
|
790
|
+
model: ConditionalField<{
|
|
791
|
+
provider: string;
|
|
792
|
+
name: string;
|
|
793
|
+
[key: string]: unknown;
|
|
794
|
+
}>;
|
|
795
|
+
tools?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
796
|
+
defaultOptions?: ConditionalField<DefaultOptions>;
|
|
797
|
+
workflows?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
798
|
+
agents?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
799
|
+
integrationTools?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
|
|
800
|
+
mcpClients?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
|
|
801
|
+
inputProcessors?: ConditionalField<StoredProcessorGraph>;
|
|
802
|
+
outputProcessors?: ConditionalField<StoredProcessorGraph>;
|
|
803
|
+
memory?: ConditionalField<SerializedMemoryConfig>;
|
|
804
|
+
scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
|
|
805
|
+
skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
|
|
806
|
+
workspace?: ConditionalField<StoredWorkspaceRef>;
|
|
807
|
+
requestContextSchema?: Record<string, unknown>;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Parameters for updating a stored agent
|
|
811
|
+
*/
|
|
812
|
+
export interface UpdateStoredAgentParams {
|
|
813
|
+
authorId?: string;
|
|
814
|
+
metadata?: Record<string, unknown>;
|
|
815
|
+
name?: string;
|
|
816
|
+
description?: string;
|
|
817
|
+
instructions?: string | AgentInstructionBlock[];
|
|
818
|
+
model?: ConditionalField<{
|
|
819
|
+
provider: string;
|
|
820
|
+
name: string;
|
|
821
|
+
[key: string]: unknown;
|
|
822
|
+
}>;
|
|
823
|
+
tools?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
824
|
+
defaultOptions?: ConditionalField<DefaultOptions>;
|
|
825
|
+
workflows?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
826
|
+
agents?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
827
|
+
integrationTools?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
|
|
828
|
+
mcpClients?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
|
|
829
|
+
inputProcessors?: ConditionalField<StoredProcessorGraph>;
|
|
830
|
+
outputProcessors?: ConditionalField<StoredProcessorGraph>;
|
|
831
|
+
memory?: ConditionalField<SerializedMemoryConfig>;
|
|
832
|
+
scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
|
|
833
|
+
skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
|
|
834
|
+
workspace?: ConditionalField<StoredWorkspaceRef>;
|
|
835
|
+
requestContextSchema?: Record<string, unknown>;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Response for deleting a stored agent
|
|
839
|
+
*/
|
|
840
|
+
export interface DeleteStoredAgentResponse {
|
|
841
|
+
success: boolean;
|
|
842
|
+
message: string;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Sampling configuration for scorers
|
|
846
|
+
*/
|
|
847
|
+
export type ScorerSamplingConfig = {
|
|
848
|
+
type: 'none';
|
|
849
|
+
} | {
|
|
850
|
+
type: 'ratio';
|
|
851
|
+
rate: number;
|
|
852
|
+
};
|
|
853
|
+
/**
|
|
854
|
+
* Scorer type discriminator
|
|
855
|
+
*/
|
|
856
|
+
export type StoredScorerType = 'llm-judge' | 'answer-relevancy' | 'answer-similarity' | 'bias' | 'context-precision' | 'context-relevance' | 'faithfulness' | 'hallucination' | 'noise-sensitivity' | 'prompt-alignment' | 'tool-call-accuracy' | 'toxicity';
|
|
857
|
+
/**
|
|
858
|
+
* Stored scorer definition data returned from API
|
|
859
|
+
*/
|
|
860
|
+
export interface StoredScorerResponse {
|
|
861
|
+
id: string;
|
|
862
|
+
status: string;
|
|
863
|
+
activeVersionId?: string;
|
|
864
|
+
authorId?: string;
|
|
865
|
+
metadata?: Record<string, unknown>;
|
|
866
|
+
createdAt: string;
|
|
867
|
+
updatedAt: string;
|
|
868
|
+
name: string;
|
|
869
|
+
description?: string;
|
|
870
|
+
type: StoredScorerType;
|
|
871
|
+
model?: {
|
|
872
|
+
provider: string;
|
|
873
|
+
name: string;
|
|
874
|
+
[key: string]: unknown;
|
|
875
|
+
};
|
|
876
|
+
instructions?: string;
|
|
877
|
+
scoreRange?: {
|
|
878
|
+
min?: number;
|
|
879
|
+
max?: number;
|
|
880
|
+
};
|
|
881
|
+
presetConfig?: Record<string, unknown>;
|
|
882
|
+
defaultSampling?: ScorerSamplingConfig;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Parameters for listing stored scorer definitions
|
|
886
|
+
*/
|
|
887
|
+
export interface ListStoredScorersParams {
|
|
888
|
+
page?: number;
|
|
889
|
+
perPage?: number;
|
|
890
|
+
orderBy?: {
|
|
891
|
+
field?: 'createdAt' | 'updatedAt';
|
|
892
|
+
direction?: 'ASC' | 'DESC';
|
|
893
|
+
};
|
|
894
|
+
authorId?: string;
|
|
895
|
+
metadata?: Record<string, unknown>;
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Response for listing stored scorer definitions
|
|
899
|
+
*/
|
|
900
|
+
export interface ListStoredScorersResponse {
|
|
901
|
+
scorerDefinitions: StoredScorerResponse[];
|
|
902
|
+
total: number;
|
|
903
|
+
page: number;
|
|
904
|
+
perPage: number | false;
|
|
905
|
+
hasMore: boolean;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Parameters for creating a stored scorer definition
|
|
909
|
+
*/
|
|
910
|
+
export interface CreateStoredScorerParams {
|
|
911
|
+
id?: string;
|
|
912
|
+
authorId?: string;
|
|
913
|
+
metadata?: Record<string, unknown>;
|
|
914
|
+
name: string;
|
|
915
|
+
description?: string;
|
|
916
|
+
type: StoredScorerType;
|
|
917
|
+
model?: {
|
|
918
|
+
provider: string;
|
|
919
|
+
name: string;
|
|
920
|
+
[key: string]: unknown;
|
|
921
|
+
};
|
|
922
|
+
instructions?: string;
|
|
923
|
+
scoreRange?: {
|
|
924
|
+
min?: number;
|
|
925
|
+
max?: number;
|
|
926
|
+
};
|
|
927
|
+
presetConfig?: Record<string, unknown>;
|
|
928
|
+
defaultSampling?: ScorerSamplingConfig;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Parameters for updating a stored scorer definition
|
|
932
|
+
*/
|
|
933
|
+
export interface UpdateStoredScorerParams {
|
|
934
|
+
authorId?: string;
|
|
935
|
+
metadata?: Record<string, unknown>;
|
|
936
|
+
name?: string;
|
|
937
|
+
description?: string;
|
|
938
|
+
type?: StoredScorerType;
|
|
939
|
+
model?: {
|
|
940
|
+
provider: string;
|
|
941
|
+
name: string;
|
|
942
|
+
[key: string]: unknown;
|
|
943
|
+
};
|
|
944
|
+
instructions?: string;
|
|
945
|
+
scoreRange?: {
|
|
946
|
+
min?: number;
|
|
947
|
+
max?: number;
|
|
948
|
+
};
|
|
949
|
+
presetConfig?: Record<string, unknown>;
|
|
950
|
+
defaultSampling?: ScorerSamplingConfig;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Response for deleting a stored scorer definition
|
|
954
|
+
*/
|
|
955
|
+
export interface DeleteStoredScorerResponse {
|
|
956
|
+
success: boolean;
|
|
957
|
+
message: string;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* MCP server transport configuration
|
|
961
|
+
*/
|
|
962
|
+
export interface StoredMCPServerConfig {
|
|
963
|
+
type: 'stdio' | 'http';
|
|
964
|
+
command?: string;
|
|
965
|
+
args?: string[];
|
|
966
|
+
env?: Record<string, string>;
|
|
967
|
+
url?: string;
|
|
968
|
+
timeout?: number;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Stored MCP client data returned from API
|
|
972
|
+
*/
|
|
973
|
+
export interface StoredMCPClientResponse {
|
|
974
|
+
id: string;
|
|
975
|
+
status: string;
|
|
976
|
+
activeVersionId?: string;
|
|
977
|
+
authorId?: string;
|
|
978
|
+
metadata?: Record<string, unknown>;
|
|
979
|
+
createdAt: string;
|
|
980
|
+
updatedAt: string;
|
|
981
|
+
name: string;
|
|
982
|
+
description?: string;
|
|
983
|
+
servers: Record<string, StoredMCPServerConfig>;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Parameters for listing stored MCP clients
|
|
987
|
+
*/
|
|
988
|
+
export interface ListStoredMCPClientsParams {
|
|
989
|
+
page?: number;
|
|
990
|
+
perPage?: number;
|
|
991
|
+
orderBy?: {
|
|
992
|
+
field?: 'createdAt' | 'updatedAt';
|
|
993
|
+
direction?: 'ASC' | 'DESC';
|
|
994
|
+
};
|
|
995
|
+
authorId?: string;
|
|
996
|
+
metadata?: Record<string, unknown>;
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Response for listing stored MCP clients
|
|
1000
|
+
*/
|
|
1001
|
+
export interface ListStoredMCPClientsResponse {
|
|
1002
|
+
mcpClients: StoredMCPClientResponse[];
|
|
1003
|
+
total: number;
|
|
1004
|
+
page: number;
|
|
1005
|
+
perPage: number | false;
|
|
1006
|
+
hasMore: boolean;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Parameters for creating a stored MCP client
|
|
1010
|
+
*/
|
|
1011
|
+
export interface CreateStoredMCPClientParams {
|
|
1012
|
+
id?: string;
|
|
1013
|
+
authorId?: string;
|
|
1014
|
+
metadata?: Record<string, unknown>;
|
|
1015
|
+
name: string;
|
|
1016
|
+
description?: string;
|
|
1017
|
+
servers: Record<string, StoredMCPServerConfig>;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Parameters for updating a stored MCP client
|
|
1021
|
+
*/
|
|
1022
|
+
export interface UpdateStoredMCPClientParams {
|
|
1023
|
+
authorId?: string;
|
|
1024
|
+
metadata?: Record<string, unknown>;
|
|
1025
|
+
name?: string;
|
|
1026
|
+
description?: string;
|
|
1027
|
+
servers?: Record<string, StoredMCPServerConfig>;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Response for deleting a stored MCP client
|
|
1031
|
+
*/
|
|
1032
|
+
export interface DeleteStoredMCPClientResponse {
|
|
1033
|
+
success: boolean;
|
|
1034
|
+
message: string;
|
|
1035
|
+
}
|
|
1036
|
+
export interface AgentVersionResponse {
|
|
1037
|
+
id: string;
|
|
1038
|
+
agentId: string;
|
|
1039
|
+
versionNumber: number;
|
|
1040
|
+
name: string;
|
|
1041
|
+
description?: string;
|
|
1042
|
+
instructions: string | AgentInstructionBlock[];
|
|
1043
|
+
model: ConditionalField<{
|
|
1044
|
+
provider: string;
|
|
1045
|
+
name: string;
|
|
1046
|
+
[key: string]: unknown;
|
|
1047
|
+
}>;
|
|
1048
|
+
tools?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
1049
|
+
defaultOptions?: ConditionalField<DefaultOptions>;
|
|
1050
|
+
workflows?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
1051
|
+
agents?: ConditionalField<Record<string, StoredAgentToolConfig>>;
|
|
1052
|
+
integrationTools?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
|
|
1053
|
+
mcpClients?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
|
|
1054
|
+
inputProcessors?: ConditionalField<StoredProcessorGraph>;
|
|
1055
|
+
outputProcessors?: ConditionalField<StoredProcessorGraph>;
|
|
1056
|
+
memory?: ConditionalField<SerializedMemoryConfig>;
|
|
1057
|
+
scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
|
|
1058
|
+
requestContextSchema?: Record<string, unknown>;
|
|
1059
|
+
changedFields?: string[];
|
|
1060
|
+
changeMessage?: string;
|
|
1061
|
+
createdAt: string;
|
|
1062
|
+
}
|
|
1063
|
+
export interface ListAgentVersionsParams {
|
|
1064
|
+
page?: number;
|
|
1065
|
+
perPage?: number;
|
|
1066
|
+
orderBy?: 'versionNumber' | 'createdAt';
|
|
1067
|
+
sortDirection?: 'ASC' | 'DESC';
|
|
1068
|
+
}
|
|
1069
|
+
export interface ListAgentVersionsResponse {
|
|
1070
|
+
versions: AgentVersionResponse[];
|
|
1071
|
+
total: number;
|
|
1072
|
+
page: number;
|
|
1073
|
+
perPage: number | false;
|
|
1074
|
+
hasMore: boolean;
|
|
1075
|
+
}
|
|
1076
|
+
export interface CreateAgentVersionParams {
|
|
1077
|
+
changeMessage?: string;
|
|
1078
|
+
}
|
|
1079
|
+
export interface CreateAgentVersionResponse {
|
|
1080
|
+
version: AgentVersionResponse;
|
|
1081
|
+
}
|
|
1082
|
+
export interface ActivateAgentVersionResponse {
|
|
1083
|
+
success: boolean;
|
|
1084
|
+
message: string;
|
|
1085
|
+
activeVersionId: string;
|
|
1086
|
+
}
|
|
1087
|
+
export interface RestoreAgentVersionResponse {
|
|
1088
|
+
success: boolean;
|
|
1089
|
+
message: string;
|
|
1090
|
+
version: AgentVersionResponse;
|
|
1091
|
+
}
|
|
1092
|
+
export interface DeleteAgentVersionResponse {
|
|
1093
|
+
success: boolean;
|
|
1094
|
+
message: string;
|
|
1095
|
+
}
|
|
1096
|
+
export interface VersionDiff {
|
|
1097
|
+
field: string;
|
|
1098
|
+
previousValue: any;
|
|
1099
|
+
currentValue: any;
|
|
1100
|
+
changeType?: 'added' | 'removed' | 'modified';
|
|
1101
|
+
}
|
|
1102
|
+
export type AgentVersionDiff = VersionDiff;
|
|
1103
|
+
export interface CompareVersionsResponse {
|
|
1104
|
+
fromVersion: AgentVersionResponse;
|
|
1105
|
+
toVersion: AgentVersionResponse;
|
|
1106
|
+
diffs: VersionDiff[];
|
|
1107
|
+
}
|
|
1108
|
+
export interface ScorerVersionResponse {
|
|
1109
|
+
id: string;
|
|
1110
|
+
scorerDefinitionId: string;
|
|
1111
|
+
versionNumber: number;
|
|
1112
|
+
name: string;
|
|
1113
|
+
description?: string;
|
|
1114
|
+
type: StoredScorerType;
|
|
1115
|
+
model?: {
|
|
1116
|
+
provider: string;
|
|
1117
|
+
name: string;
|
|
1118
|
+
[key: string]: unknown;
|
|
1119
|
+
};
|
|
1120
|
+
instructions?: string;
|
|
1121
|
+
scoreRange?: {
|
|
1122
|
+
min?: number;
|
|
1123
|
+
max?: number;
|
|
1124
|
+
};
|
|
1125
|
+
presetConfig?: Record<string, unknown>;
|
|
1126
|
+
defaultSampling?: ScorerSamplingConfig;
|
|
1127
|
+
changedFields?: string[];
|
|
1128
|
+
changeMessage?: string;
|
|
1129
|
+
createdAt: string;
|
|
1130
|
+
}
|
|
1131
|
+
export interface ListScorerVersionsParams {
|
|
1132
|
+
page?: number;
|
|
1133
|
+
perPage?: number;
|
|
1134
|
+
orderBy?: 'versionNumber' | 'createdAt';
|
|
1135
|
+
sortDirection?: 'ASC' | 'DESC';
|
|
1136
|
+
}
|
|
1137
|
+
export interface ListScorerVersionsResponse {
|
|
1138
|
+
versions: ScorerVersionResponse[];
|
|
1139
|
+
total: number;
|
|
1140
|
+
page: number;
|
|
1141
|
+
perPage: number | false;
|
|
1142
|
+
hasMore: boolean;
|
|
1143
|
+
}
|
|
1144
|
+
export interface CreateScorerVersionParams {
|
|
1145
|
+
changeMessage?: string;
|
|
1146
|
+
}
|
|
1147
|
+
export interface ActivateScorerVersionResponse {
|
|
1148
|
+
success: boolean;
|
|
1149
|
+
message: string;
|
|
1150
|
+
activeVersionId: string;
|
|
1151
|
+
}
|
|
1152
|
+
export interface DeleteScorerVersionResponse {
|
|
1153
|
+
success: boolean;
|
|
1154
|
+
message: string;
|
|
1155
|
+
}
|
|
1156
|
+
export interface CompareScorerVersionsResponse {
|
|
1157
|
+
fromVersion: ScorerVersionResponse;
|
|
1158
|
+
toVersion: ScorerVersionResponse;
|
|
1159
|
+
diffs: VersionDiff[];
|
|
1160
|
+
}
|
|
1161
|
+
export interface ListAgentsModelProvidersResponse {
|
|
1162
|
+
providers: Provider[];
|
|
1163
|
+
}
|
|
1164
|
+
export interface Provider {
|
|
1165
|
+
id: string;
|
|
1166
|
+
name: string;
|
|
1167
|
+
envVar: string;
|
|
1168
|
+
connected: boolean;
|
|
1169
|
+
docUrl?: string;
|
|
1170
|
+
models: string[];
|
|
1171
|
+
}
|
|
1172
|
+
export interface MastraPackage {
|
|
1173
|
+
name: string;
|
|
1174
|
+
version: string;
|
|
1175
|
+
}
|
|
1176
|
+
export interface GetSystemPackagesResponse {
|
|
1177
|
+
packages: MastraPackage[];
|
|
1178
|
+
isDev: boolean;
|
|
1179
|
+
cmsEnabled: boolean;
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Workspace capabilities
|
|
1183
|
+
*/
|
|
1184
|
+
export interface WorkspaceCapabilities {
|
|
1185
|
+
hasFilesystem: boolean;
|
|
1186
|
+
hasSandbox: boolean;
|
|
1187
|
+
canBM25: boolean;
|
|
1188
|
+
canVector: boolean;
|
|
1189
|
+
canHybrid: boolean;
|
|
1190
|
+
hasSkills: boolean;
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Workspace safety configuration
|
|
1194
|
+
*/
|
|
1195
|
+
export interface WorkspaceSafety {
|
|
1196
|
+
readOnly: boolean;
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Response for getting workspace info
|
|
1200
|
+
*/
|
|
1201
|
+
export interface WorkspaceInfoResponse {
|
|
1202
|
+
isWorkspaceConfigured: boolean;
|
|
1203
|
+
id?: string;
|
|
1204
|
+
name?: string;
|
|
1205
|
+
status?: string;
|
|
1206
|
+
capabilities?: WorkspaceCapabilities;
|
|
1207
|
+
safety?: WorkspaceSafety;
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Workspace item in list response
|
|
1211
|
+
*/
|
|
1212
|
+
export interface WorkspaceItem {
|
|
1213
|
+
id: string;
|
|
1214
|
+
name: string;
|
|
1215
|
+
status: string;
|
|
1216
|
+
source: 'mastra' | 'agent';
|
|
1217
|
+
agentId?: string;
|
|
1218
|
+
agentName?: string;
|
|
1219
|
+
capabilities: WorkspaceCapabilities;
|
|
1220
|
+
safety: WorkspaceSafety;
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Response for listing all workspaces
|
|
1224
|
+
*/
|
|
1225
|
+
export interface ListWorkspacesResponse {
|
|
1226
|
+
workspaces: WorkspaceItem[];
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* File entry in directory listing
|
|
1230
|
+
*/
|
|
1231
|
+
export interface WorkspaceFileEntry {
|
|
1232
|
+
name: string;
|
|
1233
|
+
type: 'file' | 'directory';
|
|
1234
|
+
size?: number;
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Response for reading a file
|
|
1238
|
+
*/
|
|
1239
|
+
export interface WorkspaceFsReadResponse {
|
|
1240
|
+
path: string;
|
|
1241
|
+
content: string;
|
|
1242
|
+
type: 'file' | 'directory';
|
|
1243
|
+
size?: number;
|
|
1244
|
+
mimeType?: string;
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Response for writing a file
|
|
1248
|
+
*/
|
|
1249
|
+
export interface WorkspaceFsWriteResponse {
|
|
1250
|
+
success: boolean;
|
|
1251
|
+
path: string;
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Response for listing files
|
|
1255
|
+
*/
|
|
1256
|
+
export interface WorkspaceFsListResponse {
|
|
1257
|
+
path: string;
|
|
1258
|
+
entries: WorkspaceFileEntry[];
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Response for deleting a file
|
|
1262
|
+
*/
|
|
1263
|
+
export interface WorkspaceFsDeleteResponse {
|
|
1264
|
+
success: boolean;
|
|
1265
|
+
path: string;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Response for creating a directory
|
|
1269
|
+
*/
|
|
1270
|
+
export interface WorkspaceFsMkdirResponse {
|
|
1271
|
+
success: boolean;
|
|
1272
|
+
path: string;
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Response for getting file stats
|
|
1276
|
+
*/
|
|
1277
|
+
export interface WorkspaceFsStatResponse {
|
|
1278
|
+
path: string;
|
|
1279
|
+
type: 'file' | 'directory';
|
|
1280
|
+
size?: number;
|
|
1281
|
+
createdAt?: string;
|
|
1282
|
+
modifiedAt?: string;
|
|
1283
|
+
mimeType?: string;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Workspace search result
|
|
1287
|
+
*/
|
|
1288
|
+
export interface WorkspaceSearchResult {
|
|
1289
|
+
/** Document identifier (typically the indexed file path) */
|
|
1290
|
+
id: string;
|
|
1291
|
+
content: string;
|
|
1292
|
+
score: number;
|
|
1293
|
+
lineRange?: {
|
|
1294
|
+
start: number;
|
|
1295
|
+
end: number;
|
|
1296
|
+
};
|
|
1297
|
+
scoreDetails?: {
|
|
1298
|
+
vector?: number;
|
|
1299
|
+
bm25?: number;
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Parameters for searching workspace content
|
|
1304
|
+
*/
|
|
1305
|
+
export interface WorkspaceSearchParams {
|
|
1306
|
+
query: string;
|
|
1307
|
+
topK?: number;
|
|
1308
|
+
mode?: 'bm25' | 'vector' | 'hybrid';
|
|
1309
|
+
minScore?: number;
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Response for searching workspace
|
|
1313
|
+
*/
|
|
1314
|
+
export interface WorkspaceSearchResponse {
|
|
1315
|
+
results: WorkspaceSearchResult[];
|
|
1316
|
+
query: string;
|
|
1317
|
+
mode: 'bm25' | 'vector' | 'hybrid';
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Parameters for indexing content
|
|
1321
|
+
*/
|
|
1322
|
+
export interface WorkspaceIndexParams {
|
|
1323
|
+
path: string;
|
|
1324
|
+
content: string;
|
|
1325
|
+
metadata?: Record<string, unknown>;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Response for indexing content
|
|
1329
|
+
*/
|
|
1330
|
+
export interface WorkspaceIndexResponse {
|
|
1331
|
+
success: boolean;
|
|
1332
|
+
path: string;
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* Skill source type indicating where the skill comes from
|
|
1336
|
+
*/
|
|
1337
|
+
export type SkillSource = {
|
|
1338
|
+
type: 'external';
|
|
1339
|
+
packagePath: string;
|
|
1340
|
+
} | {
|
|
1341
|
+
type: 'local';
|
|
1342
|
+
projectPath: string;
|
|
1343
|
+
} | {
|
|
1344
|
+
type: 'managed';
|
|
1345
|
+
mastraPath: string;
|
|
1346
|
+
};
|
|
1347
|
+
/**
|
|
1348
|
+
* Skill metadata (without instructions content)
|
|
1349
|
+
*/
|
|
1350
|
+
export interface SkillMetadata {
|
|
1351
|
+
name: string;
|
|
1352
|
+
description: string;
|
|
1353
|
+
license?: string;
|
|
1354
|
+
compatibility?: string;
|
|
1355
|
+
metadata?: Record<string, string>;
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Full skill data including instructions and file paths
|
|
1359
|
+
*/
|
|
1360
|
+
export interface Skill extends SkillMetadata {
|
|
1361
|
+
path: string;
|
|
1362
|
+
instructions: string;
|
|
1363
|
+
source: SkillSource;
|
|
1364
|
+
references: string[];
|
|
1365
|
+
scripts: string[];
|
|
1366
|
+
assets: string[];
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Response for listing skills
|
|
1370
|
+
*/
|
|
1371
|
+
export interface ListSkillsResponse {
|
|
1372
|
+
skills: SkillMetadata[];
|
|
1373
|
+
isSkillsConfigured: boolean;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Skill search result
|
|
1377
|
+
*/
|
|
1378
|
+
export interface SkillSearchResult {
|
|
1379
|
+
skillName: string;
|
|
1380
|
+
source: string;
|
|
1381
|
+
content: string;
|
|
1382
|
+
score: number;
|
|
1383
|
+
lineRange?: {
|
|
1384
|
+
start: number;
|
|
1385
|
+
end: number;
|
|
1386
|
+
};
|
|
1387
|
+
scoreDetails?: {
|
|
1388
|
+
vector?: number;
|
|
1389
|
+
bm25?: number;
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Parameters for searching skills
|
|
1394
|
+
*/
|
|
1395
|
+
export interface SearchSkillsParams {
|
|
1396
|
+
query: string;
|
|
1397
|
+
topK?: number;
|
|
1398
|
+
minScore?: number;
|
|
1399
|
+
skillNames?: string[];
|
|
1400
|
+
includeReferences?: boolean;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Response for searching skills
|
|
1404
|
+
*/
|
|
1405
|
+
export interface SearchSkillsResponse {
|
|
1406
|
+
results: SkillSearchResult[];
|
|
1407
|
+
query: string;
|
|
1408
|
+
}
|
|
1409
|
+
/**
|
|
1410
|
+
* Response for listing skill references
|
|
1411
|
+
*/
|
|
1412
|
+
export interface ListSkillReferencesResponse {
|
|
1413
|
+
skillName: string;
|
|
1414
|
+
references: string[];
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Response for getting skill reference content
|
|
1418
|
+
*/
|
|
1419
|
+
export interface GetSkillReferenceResponse {
|
|
1420
|
+
skillName: string;
|
|
1421
|
+
referencePath: string;
|
|
1422
|
+
content: string;
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* File node for skill workspace
|
|
1426
|
+
*/
|
|
1427
|
+
export interface StoredSkillFileNode {
|
|
1428
|
+
id: string;
|
|
1429
|
+
name: string;
|
|
1430
|
+
type: 'file' | 'folder';
|
|
1431
|
+
content?: string;
|
|
1432
|
+
children?: StoredSkillFileNode[];
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Stored skill data returned from API
|
|
1436
|
+
*/
|
|
1437
|
+
export interface StoredSkillResponse {
|
|
1438
|
+
id: string;
|
|
1439
|
+
status: string;
|
|
1440
|
+
authorId?: string;
|
|
1441
|
+
metadata?: Record<string, unknown>;
|
|
1442
|
+
createdAt: string;
|
|
1443
|
+
updatedAt: string;
|
|
1444
|
+
name: string;
|
|
1445
|
+
description?: string;
|
|
1446
|
+
instructions: string;
|
|
1447
|
+
license?: string;
|
|
1448
|
+
files?: StoredSkillFileNode[];
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Parameters for listing stored skills
|
|
1452
|
+
*/
|
|
1453
|
+
export interface ListStoredSkillsParams {
|
|
1454
|
+
page?: number;
|
|
1455
|
+
perPage?: number;
|
|
1456
|
+
orderBy?: {
|
|
1457
|
+
field?: 'createdAt' | 'updatedAt';
|
|
1458
|
+
direction?: 'ASC' | 'DESC';
|
|
1459
|
+
};
|
|
1460
|
+
authorId?: string;
|
|
1461
|
+
metadata?: Record<string, unknown>;
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Response for listing stored skills
|
|
1465
|
+
*/
|
|
1466
|
+
export interface ListStoredSkillsResponse {
|
|
1467
|
+
skills: StoredSkillResponse[];
|
|
1468
|
+
total: number;
|
|
1469
|
+
page: number;
|
|
1470
|
+
perPage: number | false;
|
|
1471
|
+
hasMore: boolean;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Parameters for creating a stored skill
|
|
1475
|
+
*/
|
|
1476
|
+
export interface CreateStoredSkillParams {
|
|
1477
|
+
id?: string;
|
|
1478
|
+
authorId?: string;
|
|
1479
|
+
metadata?: Record<string, unknown>;
|
|
1480
|
+
name: string;
|
|
1481
|
+
description?: string;
|
|
1482
|
+
instructions: string;
|
|
1483
|
+
license?: string;
|
|
1484
|
+
files?: StoredSkillFileNode[];
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Parameters for updating a stored skill
|
|
1488
|
+
*/
|
|
1489
|
+
export interface UpdateStoredSkillParams {
|
|
1490
|
+
authorId?: string;
|
|
1491
|
+
metadata?: Record<string, unknown>;
|
|
1492
|
+
name?: string;
|
|
1493
|
+
description?: string;
|
|
1494
|
+
instructions?: string;
|
|
1495
|
+
license?: string;
|
|
1496
|
+
files?: StoredSkillFileNode[];
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Response for deleting a stored skill
|
|
1500
|
+
*/
|
|
1501
|
+
export interface DeleteStoredSkillResponse {
|
|
1502
|
+
success: boolean;
|
|
1503
|
+
message: string;
|
|
1504
|
+
}
|
|
1505
|
+
/**
|
|
1506
|
+
* Processor phase types
|
|
1507
|
+
*/
|
|
1508
|
+
export type ProcessorPhase = 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep';
|
|
1509
|
+
/**
|
|
1510
|
+
* Processor configuration showing how it's attached to an agent
|
|
1511
|
+
*/
|
|
1512
|
+
export interface ProcessorConfiguration {
|
|
1513
|
+
agentId: string;
|
|
1514
|
+
agentName: string;
|
|
1515
|
+
type: 'input' | 'output';
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Processor in list response
|
|
1519
|
+
*/
|
|
1520
|
+
export interface GetProcessorResponse {
|
|
1521
|
+
id: string;
|
|
1522
|
+
name?: string;
|
|
1523
|
+
description?: string;
|
|
1524
|
+
phases: ProcessorPhase[];
|
|
1525
|
+
agentIds: string[];
|
|
1526
|
+
isWorkflow: boolean;
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Detailed processor response
|
|
1530
|
+
*/
|
|
1531
|
+
export interface GetProcessorDetailResponse {
|
|
1532
|
+
id: string;
|
|
1533
|
+
name?: string;
|
|
1534
|
+
description?: string;
|
|
1535
|
+
phases: ProcessorPhase[];
|
|
1536
|
+
configurations: ProcessorConfiguration[];
|
|
1537
|
+
isWorkflow: boolean;
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Parameters for executing a processor
|
|
1541
|
+
*/
|
|
1542
|
+
export interface ExecuteProcessorParams {
|
|
1543
|
+
phase: ProcessorPhase;
|
|
1544
|
+
messages: MastraDBMessage[];
|
|
1545
|
+
agentId?: string;
|
|
1546
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Tripwire result from processor execution
|
|
1550
|
+
*/
|
|
1551
|
+
export interface ProcessorTripwireResult {
|
|
1552
|
+
triggered: boolean;
|
|
1553
|
+
reason?: string;
|
|
1554
|
+
metadata?: unknown;
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Response from processor execution
|
|
1558
|
+
*/
|
|
1559
|
+
export interface ExecuteProcessorResponse {
|
|
1560
|
+
success: boolean;
|
|
1561
|
+
phase: string;
|
|
1562
|
+
messages?: MastraDBMessage[];
|
|
1563
|
+
messageList?: {
|
|
1564
|
+
messages: MastraDBMessage[];
|
|
1565
|
+
};
|
|
1566
|
+
tripwire?: ProcessorTripwireResult;
|
|
1567
|
+
error?: string;
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Parameters for getting observational memory
|
|
1571
|
+
*/
|
|
1572
|
+
export interface GetObservationalMemoryParams {
|
|
1573
|
+
agentId: string;
|
|
1574
|
+
resourceId?: string;
|
|
1575
|
+
threadId?: string;
|
|
1576
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Response for observational memory endpoint
|
|
1580
|
+
*/
|
|
1581
|
+
export interface GetObservationalMemoryResponse {
|
|
1582
|
+
record: ObservationalMemoryRecord | null;
|
|
1583
|
+
history?: ObservationalMemoryRecord[];
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Parameters for awaiting buffer status
|
|
1587
|
+
*/
|
|
1588
|
+
export interface AwaitBufferStatusParams {
|
|
1589
|
+
agentId: string;
|
|
1590
|
+
resourceId?: string;
|
|
1591
|
+
threadId?: string;
|
|
1592
|
+
requestContext?: RequestContext;
|
|
1593
|
+
}
|
|
1594
|
+
/**
|
|
1595
|
+
* Response for buffer status endpoint
|
|
1596
|
+
*/
|
|
1597
|
+
export interface AwaitBufferStatusResponse {
|
|
1598
|
+
record: ObservationalMemoryRecord | null;
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Extended memory status response with OM info
|
|
1602
|
+
*/
|
|
1603
|
+
export interface GetMemoryStatusResponse {
|
|
1604
|
+
result: boolean;
|
|
1605
|
+
observationalMemory?: {
|
|
1606
|
+
enabled: boolean;
|
|
1607
|
+
hasRecord?: boolean;
|
|
1608
|
+
originType?: string;
|
|
1609
|
+
lastObservedAt?: Date | null;
|
|
1610
|
+
tokenCount?: number;
|
|
1611
|
+
observationTokenCount?: number;
|
|
1612
|
+
isObserving?: boolean;
|
|
1613
|
+
isReflecting?: boolean;
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Extended memory config response with OM config
|
|
1618
|
+
*/
|
|
1619
|
+
export interface GetMemoryConfigResponseExtended {
|
|
1620
|
+
config: MemoryConfig & {
|
|
1621
|
+
observationalMemory?: {
|
|
1622
|
+
enabled: boolean;
|
|
1623
|
+
scope?: 'thread' | 'resource';
|
|
1624
|
+
messageTokens?: number | {
|
|
1625
|
+
min: number;
|
|
1626
|
+
max: number;
|
|
1627
|
+
};
|
|
1628
|
+
observationTokens?: number | {
|
|
1629
|
+
min: number;
|
|
1630
|
+
max: number;
|
|
1631
|
+
};
|
|
1632
|
+
observationModel?: string;
|
|
1633
|
+
reflectionModel?: string;
|
|
1634
|
+
};
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Response for listing available vector stores
|
|
1639
|
+
*/
|
|
1640
|
+
export interface ListVectorsResponse {
|
|
1641
|
+
vectors: Array<{
|
|
1642
|
+
name: string;
|
|
1643
|
+
id: string;
|
|
1644
|
+
type: string;
|
|
1645
|
+
}>;
|
|
1646
|
+
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Response for listing available embedding models
|
|
1649
|
+
*/
|
|
1650
|
+
export interface ListEmbeddersResponse {
|
|
1651
|
+
embedders: Array<{
|
|
1652
|
+
id: string;
|
|
1653
|
+
provider: string;
|
|
1654
|
+
name: string;
|
|
1655
|
+
description: string;
|
|
1656
|
+
dimensions: number;
|
|
1657
|
+
maxInputTokens: number;
|
|
1658
|
+
}>;
|
|
1659
|
+
}
|
|
1660
|
+
export interface ToolProviderInfo {
|
|
1661
|
+
id: string;
|
|
1662
|
+
name: string;
|
|
1663
|
+
description?: string;
|
|
1664
|
+
}
|
|
1665
|
+
export interface ToolProviderToolkit {
|
|
1666
|
+
slug: string;
|
|
1667
|
+
name: string;
|
|
1668
|
+
description?: string;
|
|
1669
|
+
icon?: string;
|
|
1670
|
+
}
|
|
1671
|
+
export interface ToolProviderToolInfo {
|
|
1672
|
+
slug: string;
|
|
1673
|
+
name: string;
|
|
1674
|
+
description?: string;
|
|
1675
|
+
toolkit?: string;
|
|
1676
|
+
}
|
|
1677
|
+
export interface ToolProviderPagination {
|
|
1678
|
+
total?: number;
|
|
1679
|
+
page?: number;
|
|
1680
|
+
perPage?: number;
|
|
1681
|
+
hasMore: boolean;
|
|
1682
|
+
}
|
|
1683
|
+
export interface ListToolProvidersResponse {
|
|
1684
|
+
providers: ToolProviderInfo[];
|
|
1685
|
+
}
|
|
1686
|
+
export interface ListToolProviderToolkitsResponse {
|
|
1687
|
+
data: ToolProviderToolkit[];
|
|
1688
|
+
pagination?: ToolProviderPagination;
|
|
1689
|
+
}
|
|
1690
|
+
export interface ListToolProviderToolsParams {
|
|
1691
|
+
toolkit?: string;
|
|
1692
|
+
search?: string;
|
|
1693
|
+
page?: number;
|
|
1694
|
+
perPage?: number;
|
|
1695
|
+
}
|
|
1696
|
+
export interface ListToolProviderToolsResponse {
|
|
1697
|
+
data: ToolProviderToolInfo[];
|
|
1698
|
+
pagination?: ToolProviderPagination;
|
|
1699
|
+
}
|
|
1700
|
+
export type GetToolProviderToolSchemaResponse = Record<string, unknown>;
|
|
1701
|
+
/**
|
|
1702
|
+
* Provider phase names as returned by the server (prefixed form).
|
|
1703
|
+
* Distinct from ProcessorPhase which uses the short/unprefixed form for processor endpoints.
|
|
1704
|
+
*/
|
|
1705
|
+
export type ProcessorProviderPhase = 'processInput' | 'processInputStep' | 'processOutputStream' | 'processOutputResult' | 'processOutputStep';
|
|
1706
|
+
export interface ProcessorProviderInfo {
|
|
1707
|
+
id: string;
|
|
1708
|
+
name: string;
|
|
1709
|
+
description?: string;
|
|
1710
|
+
availablePhases: ProcessorProviderPhase[];
|
|
1711
|
+
}
|
|
1712
|
+
export interface GetProcessorProvidersResponse {
|
|
1713
|
+
providers: ProcessorProviderInfo[];
|
|
1714
|
+
}
|
|
1715
|
+
export interface GetProcessorProviderResponse {
|
|
1716
|
+
id: string;
|
|
1717
|
+
name: string;
|
|
1718
|
+
description?: string;
|
|
1719
|
+
availablePhases: ProcessorProviderPhase[];
|
|
1720
|
+
configSchema: Record<string, unknown>;
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* HTTP error thrown by the Mastra client.
|
|
1724
|
+
* Extends Error with additional properties for better error handling.
|
|
1725
|
+
*
|
|
1726
|
+
* @example
|
|
1727
|
+
* ```typescript
|
|
1728
|
+
* try {
|
|
1729
|
+
* await client.getWorkspace('my-workspace').listFiles('/invalid-path');
|
|
1730
|
+
* } catch (error) {
|
|
1731
|
+
* if (error instanceof MastraClientError) {
|
|
1732
|
+
* if (error.status === 404) {
|
|
1733
|
+
* console.log('Not found:', error.body);
|
|
1734
|
+
* }
|
|
1735
|
+
* }
|
|
1736
|
+
* }
|
|
1737
|
+
* ```
|
|
1738
|
+
*/
|
|
1739
|
+
export declare class MastraClientError extends Error {
|
|
1740
|
+
/** HTTP status code */
|
|
1741
|
+
readonly status: number;
|
|
1742
|
+
/** HTTP status text (e.g., "Not Found", "Internal Server Error") */
|
|
1743
|
+
readonly statusText: string;
|
|
1744
|
+
/** Parsed response body if available */
|
|
1745
|
+
readonly body?: unknown;
|
|
1746
|
+
constructor(status: number, statusText: string, message: string, body?: unknown);
|
|
1747
|
+
}
|
|
1748
|
+
export interface DatasetItem {
|
|
1749
|
+
id: string;
|
|
1750
|
+
datasetId: string;
|
|
1751
|
+
datasetVersion: number;
|
|
1752
|
+
input: unknown;
|
|
1753
|
+
groundTruth?: unknown;
|
|
1754
|
+
metadata?: unknown;
|
|
1755
|
+
createdAt: string | Date;
|
|
1756
|
+
updatedAt: string | Date;
|
|
1757
|
+
}
|
|
1758
|
+
export interface DatasetRecord {
|
|
1759
|
+
id: string;
|
|
1760
|
+
name: string;
|
|
1761
|
+
description?: string | null;
|
|
1762
|
+
metadata?: Record<string, unknown> | null;
|
|
1763
|
+
inputSchema?: Record<string, unknown>;
|
|
1764
|
+
groundTruthSchema?: Record<string, unknown>;
|
|
1765
|
+
version: number;
|
|
1766
|
+
createdAt: string | Date;
|
|
1767
|
+
updatedAt: string | Date;
|
|
1768
|
+
}
|
|
1769
|
+
export interface DatasetExperiment {
|
|
1770
|
+
id: string;
|
|
1771
|
+
datasetId: string | null;
|
|
1772
|
+
datasetVersion: number | null;
|
|
1773
|
+
targetType: 'agent' | 'workflow' | 'scorer' | 'processor';
|
|
1774
|
+
targetId: string;
|
|
1775
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
1776
|
+
totalItems: number;
|
|
1777
|
+
succeededCount: number;
|
|
1778
|
+
failedCount: number;
|
|
1779
|
+
startedAt: string | Date | null;
|
|
1780
|
+
completedAt: string | Date | null;
|
|
1781
|
+
createdAt: string | Date;
|
|
1782
|
+
updatedAt: string | Date;
|
|
1783
|
+
}
|
|
1784
|
+
export interface DatasetExperimentResult {
|
|
1785
|
+
id: string;
|
|
1786
|
+
experimentId: string;
|
|
1787
|
+
itemId: string;
|
|
1788
|
+
itemDatasetVersion: number | null;
|
|
1789
|
+
input: unknown;
|
|
1790
|
+
output: unknown | null;
|
|
1791
|
+
groundTruth: unknown | null;
|
|
1792
|
+
error: string | null;
|
|
1793
|
+
startedAt: string | Date;
|
|
1794
|
+
completedAt: string | Date;
|
|
1795
|
+
retryCount: number;
|
|
1796
|
+
traceId: string | null;
|
|
1797
|
+
scores: Array<{
|
|
1798
|
+
scorerId: string;
|
|
1799
|
+
scorerName: string;
|
|
1800
|
+
score: number | null;
|
|
1801
|
+
reason: string | null;
|
|
1802
|
+
error: string | null;
|
|
1803
|
+
}>;
|
|
1804
|
+
createdAt: string | Date;
|
|
1805
|
+
}
|
|
1806
|
+
export interface CreateDatasetParams {
|
|
1807
|
+
name: string;
|
|
1808
|
+
description?: string;
|
|
1809
|
+
metadata?: Record<string, unknown>;
|
|
1810
|
+
inputSchema?: Record<string, unknown> | null;
|
|
1811
|
+
groundTruthSchema?: Record<string, unknown> | null;
|
|
1812
|
+
}
|
|
1813
|
+
export interface UpdateDatasetParams {
|
|
1814
|
+
datasetId: string;
|
|
1815
|
+
name?: string;
|
|
1816
|
+
description?: string;
|
|
1817
|
+
metadata?: Record<string, unknown>;
|
|
1818
|
+
inputSchema?: Record<string, unknown> | null;
|
|
1819
|
+
groundTruthSchema?: Record<string, unknown> | null;
|
|
1820
|
+
}
|
|
1821
|
+
export interface AddDatasetItemParams {
|
|
1822
|
+
datasetId: string;
|
|
1823
|
+
input: unknown;
|
|
1824
|
+
groundTruth?: unknown;
|
|
1825
|
+
metadata?: Record<string, unknown>;
|
|
1826
|
+
}
|
|
1827
|
+
export interface UpdateDatasetItemParams {
|
|
1828
|
+
datasetId: string;
|
|
1829
|
+
itemId: string;
|
|
1830
|
+
input?: unknown;
|
|
1831
|
+
groundTruth?: unknown;
|
|
1832
|
+
metadata?: Record<string, unknown>;
|
|
1833
|
+
}
|
|
1834
|
+
export interface BatchInsertDatasetItemsParams {
|
|
1835
|
+
datasetId: string;
|
|
1836
|
+
items: Array<{
|
|
1837
|
+
input: unknown;
|
|
1838
|
+
groundTruth?: unknown;
|
|
1839
|
+
metadata?: Record<string, unknown>;
|
|
1840
|
+
}>;
|
|
1841
|
+
}
|
|
1842
|
+
export interface BatchDeleteDatasetItemsParams {
|
|
1843
|
+
datasetId: string;
|
|
1844
|
+
itemIds: string[];
|
|
1845
|
+
}
|
|
1846
|
+
export interface TriggerDatasetExperimentParams {
|
|
1847
|
+
datasetId: string;
|
|
1848
|
+
targetType: 'agent' | 'workflow' | 'scorer';
|
|
1849
|
+
targetId: string;
|
|
1850
|
+
scorerIds?: string[];
|
|
1851
|
+
version?: number;
|
|
1852
|
+
maxConcurrency?: number;
|
|
1853
|
+
}
|
|
1854
|
+
export interface CompareExperimentsParams {
|
|
1855
|
+
datasetId: string;
|
|
1856
|
+
experimentIdA: string;
|
|
1857
|
+
experimentIdB: string;
|
|
1858
|
+
thresholds?: Record<string, {
|
|
1859
|
+
value: number;
|
|
1860
|
+
direction?: 'higher-is-better' | 'lower-is-better';
|
|
1861
|
+
}>;
|
|
1862
|
+
}
|
|
1863
|
+
export interface DatasetItemVersionResponse {
|
|
1864
|
+
id: string;
|
|
1865
|
+
datasetId: string;
|
|
1866
|
+
datasetVersion: number;
|
|
1867
|
+
input: unknown;
|
|
1868
|
+
groundTruth?: unknown;
|
|
1869
|
+
metadata?: Record<string, unknown>;
|
|
1870
|
+
validTo: number | null;
|
|
1871
|
+
isDeleted: boolean;
|
|
1872
|
+
createdAt: string | Date;
|
|
1873
|
+
updatedAt: string | Date;
|
|
1874
|
+
}
|
|
1875
|
+
export interface DatasetVersionResponse {
|
|
1876
|
+
id: string;
|
|
1877
|
+
datasetId: string;
|
|
1878
|
+
version: number;
|
|
1879
|
+
createdAt: string | Date;
|
|
1880
|
+
}
|
|
1881
|
+
export interface CompareExperimentsResponse {
|
|
1882
|
+
baselineId: string;
|
|
1883
|
+
items: Array<{
|
|
1884
|
+
itemId: string;
|
|
1885
|
+
input: unknown;
|
|
1886
|
+
groundTruth: unknown;
|
|
1887
|
+
results: Record<string, {
|
|
1888
|
+
output: unknown;
|
|
1889
|
+
scores: Record<string, number | null>;
|
|
1890
|
+
} | null>;
|
|
1891
|
+
}>;
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1894
|
+
* Stored prompt block data returned from API
|
|
1895
|
+
*/
|
|
1896
|
+
export interface StoredPromptBlockResponse {
|
|
1897
|
+
id: string;
|
|
1898
|
+
status: string;
|
|
1899
|
+
activeVersionId?: string;
|
|
1900
|
+
hasDraft?: boolean;
|
|
1901
|
+
authorId?: string;
|
|
1902
|
+
metadata?: Record<string, unknown>;
|
|
1903
|
+
createdAt: string;
|
|
1904
|
+
updatedAt: string;
|
|
1905
|
+
name: string;
|
|
1906
|
+
description?: string;
|
|
1907
|
+
content: string;
|
|
1908
|
+
rules?: RuleGroup;
|
|
1909
|
+
requestContextSchema?: Record<string, unknown>;
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Parameters for listing stored prompt blocks
|
|
1913
|
+
*/
|
|
1914
|
+
export interface ListStoredPromptBlocksParams {
|
|
1915
|
+
page?: number;
|
|
1916
|
+
perPage?: number;
|
|
1917
|
+
orderBy?: {
|
|
1918
|
+
field?: 'createdAt' | 'updatedAt';
|
|
1919
|
+
direction?: 'ASC' | 'DESC';
|
|
1920
|
+
};
|
|
1921
|
+
status?: 'draft' | 'published' | 'archived';
|
|
1922
|
+
authorId?: string;
|
|
1923
|
+
metadata?: Record<string, unknown>;
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Response for listing stored prompt blocks
|
|
1927
|
+
*/
|
|
1928
|
+
export interface ListStoredPromptBlocksResponse {
|
|
1929
|
+
promptBlocks: StoredPromptBlockResponse[];
|
|
1930
|
+
total: number;
|
|
1931
|
+
page: number;
|
|
1932
|
+
perPage: number | false;
|
|
1933
|
+
hasMore: boolean;
|
|
1934
|
+
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Parameters for creating a stored prompt block
|
|
1937
|
+
*/
|
|
1938
|
+
export interface CreateStoredPromptBlockParams {
|
|
1939
|
+
id?: string;
|
|
1940
|
+
authorId?: string;
|
|
1941
|
+
metadata?: Record<string, unknown>;
|
|
1942
|
+
name: string;
|
|
1943
|
+
description?: string;
|
|
1944
|
+
content: string;
|
|
1945
|
+
rules?: RuleGroup;
|
|
1946
|
+
requestContextSchema?: Record<string, unknown>;
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Parameters for updating a stored prompt block
|
|
1950
|
+
*/
|
|
1951
|
+
export interface UpdateStoredPromptBlockParams {
|
|
1952
|
+
authorId?: string;
|
|
1953
|
+
metadata?: Record<string, unknown>;
|
|
1954
|
+
name?: string;
|
|
1955
|
+
description?: string;
|
|
1956
|
+
content?: string;
|
|
1957
|
+
rules?: RuleGroup;
|
|
1958
|
+
requestContextSchema?: Record<string, unknown>;
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* Response for deleting a stored prompt block
|
|
1962
|
+
*/
|
|
1963
|
+
export interface DeleteStoredPromptBlockResponse {
|
|
1964
|
+
success: boolean;
|
|
1965
|
+
message: string;
|
|
1966
|
+
}
|
|
1967
|
+
export interface PromptBlockVersionResponse {
|
|
1968
|
+
id: string;
|
|
1969
|
+
blockId: string;
|
|
1970
|
+
versionNumber: number;
|
|
1971
|
+
name: string;
|
|
1972
|
+
description?: string;
|
|
1973
|
+
content: string;
|
|
1974
|
+
rules?: RuleGroup;
|
|
1975
|
+
requestContextSchema?: Record<string, unknown>;
|
|
1976
|
+
changedFields?: string[];
|
|
1977
|
+
changeMessage?: string;
|
|
1978
|
+
createdAt: string;
|
|
1979
|
+
}
|
|
1980
|
+
export interface ListPromptBlockVersionsParams {
|
|
1981
|
+
page?: number;
|
|
1982
|
+
perPage?: number;
|
|
1983
|
+
orderBy?: 'versionNumber' | 'createdAt';
|
|
1984
|
+
sortDirection?: 'ASC' | 'DESC';
|
|
1985
|
+
}
|
|
1986
|
+
export interface ListPromptBlockVersionsResponse {
|
|
1987
|
+
versions: PromptBlockVersionResponse[];
|
|
1988
|
+
total: number;
|
|
1989
|
+
page: number;
|
|
1990
|
+
perPage: number | false;
|
|
1991
|
+
hasMore: boolean;
|
|
1992
|
+
}
|
|
1993
|
+
export interface CreatePromptBlockVersionParams {
|
|
1994
|
+
changeMessage?: string;
|
|
1995
|
+
}
|
|
1996
|
+
export interface ActivatePromptBlockVersionResponse {
|
|
1997
|
+
success: boolean;
|
|
1998
|
+
message: string;
|
|
1999
|
+
activeVersionId: string;
|
|
2000
|
+
}
|
|
2001
|
+
export interface DeletePromptBlockVersionResponse {
|
|
2002
|
+
success: boolean;
|
|
2003
|
+
message: string;
|
|
2004
|
+
}
|
|
478
2005
|
export {};
|
|
479
2006
|
//# sourceMappingURL=types.d.ts.map
|