@mastra/client-js 0.0.0-error-handler-fix-20251020202607 → 0.0.0-esbuild-bundle-worker-20260807182016

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +9405 -3
  2. package/LICENSE.md +15 -0
  3. package/README.md +11 -13
  4. package/dist/_types/@ai-sdk_provider/dist/index.d.ts +1587 -0
  5. package/dist/_types/@ai-sdk_provider-utils/dist/index.d.ts +379 -0
  6. package/dist/_types/@ai-sdk_ui-utils/dist/index.d.ts +820 -0
  7. package/dist/agent-learning.d.ts +182 -0
  8. package/dist/agent-learning.d.ts.map +1 -0
  9. package/dist/client.d.ts +767 -80
  10. package/dist/client.d.ts.map +1 -1
  11. package/dist/docs/SKILL.md +52 -0
  12. package/dist/docs/assets/SOURCE_MAP.json +6 -0
  13. package/dist/docs/references/docs-agents-a2a.md +340 -0
  14. package/dist/docs/references/docs-editor-overview.md +349 -0
  15. package/dist/docs/references/docs-long-running-agents-schedules.md +201 -0
  16. package/dist/docs/references/docs-long-running-agents-signals.md +426 -0
  17. package/dist/docs/references/docs-server-auth-auth0.md +262 -0
  18. package/dist/docs/references/docs-server-auth-clerk.md +154 -0
  19. package/dist/docs/references/docs-server-auth-firebase.md +294 -0
  20. package/dist/docs/references/docs-server-auth-jwt.md +116 -0
  21. package/dist/docs/references/docs-server-auth-supabase.md +139 -0
  22. package/dist/docs/references/docs-server-auth-workos.md +271 -0
  23. package/dist/docs/references/docs-server-mastra-client.md +323 -0
  24. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-messages.md +97 -0
  25. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +282 -0
  26. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v4-messages.md +81 -0
  27. package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v5-messages.md +78 -0
  28. package/dist/docs/references/reference-client-js-agents.md +959 -0
  29. package/dist/docs/references/reference-client-js-conversations.md +137 -0
  30. package/dist/docs/references/reference-client-js-error-handling.md +18 -0
  31. package/dist/docs/references/reference-client-js-logs.md +26 -0
  32. package/dist/docs/references/reference-client-js-mastra-client.md +96 -0
  33. package/dist/docs/references/reference-client-js-memory.md +237 -0
  34. package/dist/docs/references/reference-client-js-observability.md +183 -0
  35. package/dist/docs/references/reference-client-js-responses.md +219 -0
  36. package/dist/docs/references/reference-client-js-telemetry.md +22 -0
  37. package/dist/docs/references/reference-client-js-tools.md +46 -0
  38. package/dist/docs/references/reference-client-js-vectors.md +81 -0
  39. package/dist/docs/references/reference-client-js-workflows.md +393 -0
  40. package/dist/docs/references/reference-editor-versioning.md +130 -0
  41. package/dist/index.cjs +7638 -3257
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.ts +9 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +7606 -3252
  46. package/dist/index.js.map +1 -1
  47. package/dist/observability/collector.d.ts +45 -0
  48. package/dist/observability/collector.d.ts.map +1 -0
  49. package/dist/observability/index.d.ts +14 -0
  50. package/dist/observability/index.d.ts.map +1 -0
  51. package/dist/observability/types.d.ts +27 -0
  52. package/dist/observability/types.d.ts.map +1 -0
  53. package/dist/resources/a2a.d.ts +80 -11
  54. package/dist/resources/a2a.d.ts.map +1 -1
  55. package/dist/resources/agent-builder.d.ts +57 -72
  56. package/dist/resources/agent-builder.d.ts.map +1 -1
  57. package/dist/resources/agent-controller.d.ts +589 -0
  58. package/dist/resources/agent-controller.d.ts.map +1 -0
  59. package/dist/resources/agent.d.ts +368 -59
  60. package/dist/resources/agent.d.ts.map +1 -1
  61. package/dist/resources/base.d.ts +2 -1
  62. package/dist/resources/base.d.ts.map +1 -1
  63. package/dist/resources/channels.d.ts +63 -0
  64. package/dist/resources/channels.d.ts.map +1 -0
  65. package/dist/resources/conversations.d.ts +15 -0
  66. package/dist/resources/conversations.d.ts.map +1 -0
  67. package/dist/resources/index.d.ts +14 -0
  68. package/dist/resources/index.d.ts.map +1 -1
  69. package/dist/resources/mcp-tool.d.ts +5 -5
  70. package/dist/resources/mcp-tool.d.ts.map +1 -1
  71. package/dist/resources/memory-thread.d.ts +51 -16
  72. package/dist/resources/memory-thread.d.ts.map +1 -1
  73. package/dist/resources/observability.d.ts +222 -19
  74. package/dist/resources/observability.d.ts.map +1 -1
  75. package/dist/resources/processor-provider.d.ts +15 -0
  76. package/dist/resources/processor-provider.d.ts.map +1 -0
  77. package/dist/resources/processor.d.ts +20 -0
  78. package/dist/resources/processor.d.ts.map +1 -0
  79. package/dist/resources/responses.d.ts +22 -0
  80. package/dist/resources/responses.d.ts.map +1 -0
  81. package/dist/resources/run.d.ts +256 -0
  82. package/dist/resources/run.d.ts.map +1 -0
  83. package/dist/resources/stored-agent.d.ts +112 -0
  84. package/dist/resources/stored-agent.d.ts.map +1 -0
  85. package/dist/resources/stored-mcp-client.d.ts +30 -0
  86. package/dist/resources/stored-mcp-client.d.ts.map +1 -0
  87. package/dist/resources/stored-prompt-block.d.ts +83 -0
  88. package/dist/resources/stored-prompt-block.d.ts.map +1 -0
  89. package/dist/resources/stored-scorer.d.ts +83 -0
  90. package/dist/resources/stored-scorer.d.ts.map +1 -0
  91. package/dist/resources/stored-skill.d.ts +40 -0
  92. package/dist/resources/stored-skill.d.ts.map +1 -0
  93. package/dist/resources/stored-workflow.d.ts +18 -0
  94. package/dist/resources/stored-workflow.d.ts.map +1 -0
  95. package/dist/resources/tool-provider.d.ts +80 -0
  96. package/dist/resources/tool-provider.d.ts.map +1 -0
  97. package/dist/resources/tool.d.ts +4 -4
  98. package/dist/resources/vector.d.ts +9 -9
  99. package/dist/resources/vector.d.ts.map +1 -1
  100. package/dist/resources/workflow.d.ts +32 -231
  101. package/dist/resources/workflow.d.ts.map +1 -1
  102. package/dist/resources/workspace.d.ts +129 -0
  103. package/dist/resources/workspace.d.ts.map +1 -0
  104. package/dist/route-types.generated.d.ts +18087 -0
  105. package/dist/route-types.generated.d.ts.map +1 -0
  106. package/dist/tools.d.ts +3 -6
  107. package/dist/tools.d.ts.map +1 -1
  108. package/dist/types.d.ts +2740 -197
  109. package/dist/types.d.ts.map +1 -1
  110. package/dist/utils/client-tool-model-output.d.ts +16 -0
  111. package/dist/utils/client-tool-model-output.d.ts.map +1 -0
  112. package/dist/utils/index.d.ts +65 -4
  113. package/dist/utils/index.d.ts.map +1 -1
  114. package/dist/utils/process-a2a-stream.d.ts +4 -0
  115. package/dist/utils/process-a2a-stream.d.ts.map +1 -0
  116. package/dist/utils/process-client-tools.d.ts.map +1 -1
  117. package/dist/utils/process-mastra-stream.d.ts +8 -7
  118. package/dist/utils/process-mastra-stream.d.ts.map +1 -1
  119. package/dist/utils/stream-transforms.d.ts +9 -0
  120. package/dist/utils/stream-transforms.d.ts.map +1 -0
  121. package/dist/utils/verify-agent-card-signature.d.ts +21 -0
  122. package/dist/utils/verify-agent-card-signature.d.ts.map +1 -0
  123. package/dist/utils/zod-to-json-schema.d.ts +11 -2
  124. package/dist/utils/zod-to-json-schema.d.ts.map +1 -1
  125. package/package.json +26 -19
  126. package/dist/resources/network-memory-thread.d.ts +0 -47
  127. package/dist/resources/network-memory-thread.d.ts.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,21 +1,41 @@
1
- import type { AgentExecutionOptions, MultiPrimitiveExecutionOptions, AgentGenerateOptions, AgentStreamOptions, SerializableStructuredOutputOptions, DeprecatedOutputOptions, ToolsInput, UIMessageWithMetadata, AgentInstructions } from '@mastra/core/agent';
1
+ import type { AgentExecutionOptions, MultiPrimitiveExecutionOptions, AgentGenerateOptions, AgentStreamOptions, SerializableStructuredOutputOptions, ToolsInput, UIMessageWithMetadata, AgentInstructions, AgentEditorConfig } from '@mastra/core/agent';
2
2
  import type { MessageListInput } from '@mastra/core/agent/message-list';
3
- import type { CoreMessage } from '@mastra/core/llm';
4
- import type { BaseLogMessage, LogLevel } from '@mastra/core/logger';
3
+ import type { BuilderModelPolicy, DefaultModelEntry, ProviderModelEntry } from '@mastra/core/agent-builder/ee';
4
+ import type { MastraScorerEntry, ScoreRowData } from '@mastra/core/evals';
5
+ import type { CoreMessage, Provider as ModelProviderId } from '@mastra/core/llm';
6
+ import type { LogLevel } from '@mastra/core/logger';
5
7
  import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
6
- import type { AiMessageType, MastraMessageV1, MastraMessageV2, MemoryConfig, StorageThreadType } from '@mastra/core/memory';
7
- import type { RuntimeContext } from '@mastra/core/runtime-context';
8
- import type { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';
9
- import type { AITraceRecord, AISpanRecord, StorageGetMessagesArg, PaginationInfo, WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
10
- import type { OutputSchema } from '@mastra/core/stream';
8
+ import type { AiMessageType, MastraMessageV1, MastraDBMessage, MemoryConfig, StorageThreadType } from '@mastra/core/memory';
9
+ import type { TracingOptions } from '@mastra/core/observability';
10
+ import type { RequestContext } from '@mastra/core/request-context';
11
+ import type { AgentInstructionBlock, PaginationInfo, WorkflowRuns, StorageListMessagesInput, Rule, RuleGroup, StorageConditionalVariant, StorageConditionalField, StoredProcessorGraph } from '@mastra/core/storage';
12
+ import type { ChunkType } from '@mastra/core/stream';
11
13
  import type { QueryResult } from '@mastra/core/vector';
12
- import type { Workflow, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
13
- import type { UIMessage } from 'ai';
14
+ import type { TimeTravelContext, Workflow, WorkflowResult, WorkflowRunStatus, WorkflowState } from '@mastra/core/workflows';
15
+ import type { PublicSchema } from '@mastra/schema-compat/schema';
14
16
  import type { JSONSchema7 } from 'json-schema';
15
- import type { ZodSchema } from 'zod';
17
+ import type { ZodSchema as ZodSchemaV3 } from 'zod/v3';
18
+ import type { ZodType as ZodTypeV4 } from 'zod/v4';
19
+ import type { Body, QueryParams, RouteKey, RouteResponse, Simplify } from './route-types.generated.js';
20
+ export type ZodSchema = ZodSchemaV3 | ZodTypeV4;
21
+ type OptionalizeUndefined<T> = T extends Date ? Date : T extends (...args: any[]) => any ? T : T extends readonly (infer U)[] ? OptionalizeUndefined<U>[] : T extends object ? Simplify<{
22
+ [K in keyof T as undefined extends T[K] ? never : K]: OptionalizeUndefined<T[K]>;
23
+ } & {
24
+ [K in keyof T as undefined extends T[K] ? K : never]?: OptionalizeUndefined<Exclude<T[K], undefined>>;
25
+ }> : T;
26
+ type Serialized<T> = T extends Date ? string : T extends readonly (infer U)[] ? Serialized<U>[] : T extends object ? {
27
+ [K in keyof T]: Serialized<T[K]>;
28
+ } : T;
29
+ type RequestContextOptions = {
30
+ requestContext?: RequestContext | Record<string, any>;
31
+ };
32
+ type GeneratedRequest<T> = OptionalizeUndefined<T>;
33
+ type GeneratedResponse<T extends RouteKey> = Serialized<RouteResponse<T>>;
16
34
  export interface ClientOptions {
17
35
  /** Base URL for API requests */
18
36
  baseUrl: string;
37
+ /** API route prefix. Defaults to '/api'. Set this to match your server's apiPrefix configuration. */
38
+ apiPrefix?: string;
19
39
  /** Number of retry attempts for failed requests */
20
40
  retries?: number;
21
41
  /** Initial backoff time in milliseconds between retries */
@@ -28,6 +48,61 @@ export interface ClientOptions {
28
48
  abortSignal?: AbortSignal;
29
49
  /** Credentials mode for requests. See https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials for more info. */
30
50
  credentials?: 'omit' | 'same-origin' | 'include';
51
+ /** Custom fetch function to use for HTTP requests. Useful for environments like Tauri that require custom fetch implementations. */
52
+ fetch?: typeof fetch;
53
+ }
54
+ export type AgentVersionIdentifier = {
55
+ versionId: string;
56
+ } | {
57
+ status: 'draft' | 'published';
58
+ };
59
+ /**
60
+ * @experimental Agent signals are experimental and may change in a future release.
61
+ */
62
+ export type AgentSignalActiveBehavior = 'deliver' | 'persist' | 'discard';
63
+ /**
64
+ * @experimental Agent signals are experimental and may change in a future release.
65
+ */
66
+ export type AgentSignalIdleBehavior = 'wake' | 'persist' | 'discard';
67
+ /**
68
+ * @experimental Agent signals are experimental and may change in a future release.
69
+ */
70
+ export type SendAgentSignalParams = GeneratedRequest<Body<'POST /agents/:agentId/signals'>>;
71
+ /**
72
+ * @experimental Agent message APIs are experimental and may change in a future release.
73
+ */
74
+ export type SendAgentMessageParams = GeneratedRequest<Body<'POST /agents/:agentId/send-message'>>;
75
+ /**
76
+ * @experimental Agent message APIs are experimental and may change in a future release.
77
+ */
78
+ export type QueueAgentMessageParams = GeneratedRequest<Body<'POST /agents/:agentId/queue-message'>>;
79
+ /**
80
+ * @experimental Agent signals are experimental and may change in a future release.
81
+ */
82
+ export interface SubscribeAgentThreadParams {
83
+ resourceId?: string;
84
+ threadId: string;
85
+ }
86
+ export type ListAgentSuspendedRunsParams = GeneratedRequest<QueryParams<'GET /agents/:agentId/suspended-runs'>>;
87
+ /**
88
+ * Listed suspended runs as returned by `agent.listSuspendedRuns()`.
89
+ * Date fields (e.g. `suspendedAt`) are ISO strings over the wire, matching
90
+ * the rest of the client SDK.
91
+ */
92
+ export type ListAgentSuspendedRunsResponse = GeneratedResponse<'GET /agents/:agentId/suspended-runs'>;
93
+ export type AgentSuspendedRun = ListAgentSuspendedRunsResponse['runs'][number];
94
+ export type AgentSuspendedRunToolCall = AgentSuspendedRun['toolCalls'][number];
95
+ /**
96
+ * @experimental Agent signals are experimental and may change in a future release.
97
+ */
98
+ export interface ProcessAgentThreadStreamOptions {
99
+ onChunk: (chunk: ChunkType) => void | Promise<void>;
100
+ reconnect?: boolean | {
101
+ /** Maximum reconnect attempts after the initial stream ends or errors. Defaults to Infinity. */
102
+ maxRetries?: number;
103
+ /** Delay between reconnect attempts in milliseconds. Defaults to 1000. */
104
+ delayMs?: number;
105
+ };
31
106
  }
32
107
  export interface RequestOptions {
33
108
  method?: string;
@@ -37,16 +112,252 @@ export interface RequestOptions {
37
112
  /** Credentials mode for requests. See https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials for more info. */
38
113
  credentials?: 'omit' | 'same-origin' | 'include';
39
114
  }
115
+ export type ResponseInputTextPart = {
116
+ type: 'input_text' | 'text' | 'output_text';
117
+ text: string;
118
+ };
119
+ export type ResponseInputMessage = {
120
+ role: 'system' | 'developer' | 'user' | 'assistant';
121
+ content: string | ResponseInputTextPart[];
122
+ };
123
+ export type ResponseTextFormat = {
124
+ type: 'json_object';
125
+ } | {
126
+ type: 'json_schema';
127
+ name: string;
128
+ description?: string;
129
+ schema: Record<string, unknown>;
130
+ strict?: boolean;
131
+ };
132
+ export type ResponseTextConfig = {
133
+ format: ResponseTextFormat;
134
+ };
135
+ export type ResponseOutputText = {
136
+ type: 'output_text';
137
+ text: string;
138
+ annotations?: unknown[];
139
+ logprobs?: unknown[];
140
+ };
141
+ export type ResponseOutputMessage = {
142
+ id: string;
143
+ type: 'message';
144
+ role: 'assistant';
145
+ status: 'in_progress' | 'completed' | 'incomplete';
146
+ content: ResponseOutputText[];
147
+ };
148
+ export type ResponseOutputFunctionCall = {
149
+ id: string;
150
+ type: 'function_call';
151
+ call_id: string;
152
+ name: string;
153
+ arguments: string;
154
+ status?: 'in_progress' | 'completed' | 'incomplete';
155
+ };
156
+ export type ResponseOutputFunctionCallOutput = {
157
+ id: string;
158
+ type: 'function_call_output';
159
+ call_id: string;
160
+ output: string;
161
+ };
162
+ export type ResponseUsage = {
163
+ input_tokens: number;
164
+ output_tokens: number;
165
+ total_tokens: number;
166
+ input_tokens_details?: {
167
+ cached_tokens: number;
168
+ };
169
+ output_tokens_details?: {
170
+ reasoning_tokens: number;
171
+ };
172
+ };
173
+ export type ResponseTool = {
174
+ type: 'function';
175
+ name: string;
176
+ description?: string;
177
+ parameters?: unknown;
178
+ };
179
+ export type ResponseOutputItem = ResponseOutputMessage | ResponseOutputFunctionCall | ResponseOutputFunctionCallOutput;
180
+ export type ConversationItemInputText = {
181
+ type: 'input_text';
182
+ text: string;
183
+ };
184
+ export type ConversationItemMessage = {
185
+ id: string;
186
+ type: 'message';
187
+ role: 'system' | 'user' | 'assistant';
188
+ status: 'completed';
189
+ content: Array<ConversationItemInputText | ResponseOutputText>;
190
+ };
191
+ export type ConversationItem = ConversationItemMessage | ResponseOutputFunctionCall | ResponseOutputFunctionCallOutput;
192
+ export type ConversationItemsPage = {
193
+ object: 'list';
194
+ data: ConversationItem[];
195
+ first_id: string | null;
196
+ last_id: string | null;
197
+ has_more: boolean;
198
+ };
199
+ export type ResponsesResponse = {
200
+ id: string;
201
+ object: 'response';
202
+ created_at: number;
203
+ completed_at?: number | null;
204
+ model: string;
205
+ status: 'in_progress' | 'completed' | 'incomplete';
206
+ output: ResponseOutputItem[];
207
+ usage: ResponseUsage | null;
208
+ error?: {
209
+ code?: string;
210
+ message?: string;
211
+ } | null;
212
+ incomplete_details?: {
213
+ reason?: string;
214
+ } | null;
215
+ instructions?: string | null;
216
+ text?: ResponseTextConfig | null;
217
+ previous_response_id?: string | null;
218
+ conversation_id?: string | null;
219
+ /** Provider-returned response state, such as `openai.responseId`, for provider-native continuation. */
220
+ providerOptions?: Record<string, Record<string, unknown> | undefined>;
221
+ tools?: ResponseTool[];
222
+ store?: boolean;
223
+ output_text: string;
224
+ };
225
+ export type ResponsesDeleteResponse = {
226
+ id: string;
227
+ object: 'response';
228
+ deleted: true;
229
+ };
230
+ export type CreateResponseParams = {
231
+ /** Optional model override, such as `openai/gpt-5`. When omitted, the agent default model is used. */
232
+ model?: string;
233
+ /** Mastra agent ID for the request. Required on initial requests; stored follow-ups can omit it when using `previous_response_id`. */
234
+ agent_id?: string;
235
+ /** Input text or message history for the current turn. */
236
+ input: string | ResponseInputMessage[];
237
+ /** Request-scoped instructions for the current response. */
238
+ instructions?: string;
239
+ /** Optional text output format. Supports `json_object` and `json_schema`. */
240
+ text?: ResponseTextConfig;
241
+ /** Optional conversation ID. In Mastra this is the raw threadId. */
242
+ conversation_id?: string;
243
+ /** Optional provider-specific options passed through to the underlying model call. */
244
+ providerOptions?: Record<string, Record<string, unknown> | undefined>;
245
+ /** When true, returns a streaming Responses API event stream. */
246
+ stream?: boolean;
247
+ /** Persists the response through the selected agent's memory. Requires a memory-backed agent. */
248
+ store?: boolean;
249
+ /** Continues a previously stored response chain. */
250
+ previous_response_id?: string;
251
+ requestContext?: RequestContext | Record<string, any>;
252
+ };
253
+ export type Conversation = {
254
+ id: string;
255
+ object: 'conversation';
256
+ thread: StorageThreadType;
257
+ };
258
+ export type ConversationDeleted = {
259
+ id: string;
260
+ object: 'conversation.deleted';
261
+ deleted: true;
262
+ };
263
+ export type CreateConversationParams = {
264
+ agent_id: string;
265
+ conversation_id?: string;
266
+ resource_id?: string;
267
+ title?: string;
268
+ metadata?: Record<string, unknown>;
269
+ requestContext?: RequestContext | Record<string, any>;
270
+ };
271
+ export type ResponsesCreatedEvent = {
272
+ type: 'response.created';
273
+ response: ResponsesResponse;
274
+ sequence_number?: number;
275
+ };
276
+ export type ResponsesInProgressEvent = {
277
+ type: 'response.in_progress';
278
+ response: ResponsesResponse;
279
+ sequence_number?: number;
280
+ };
281
+ export type ResponsesOutputItemAddedEvent = {
282
+ type: 'response.output_item.added';
283
+ output_index: number;
284
+ item: ResponseOutputItem;
285
+ sequence_number?: number;
286
+ };
287
+ export type ResponsesContentPartAddedEvent = {
288
+ type: 'response.content_part.added';
289
+ output_index: number;
290
+ content_index: number;
291
+ item_id: string;
292
+ part: ResponseOutputText;
293
+ sequence_number?: number;
294
+ };
295
+ export type ResponsesOutputTextDeltaEvent = {
296
+ type: 'response.output_text.delta';
297
+ output_index: number;
298
+ content_index: number;
299
+ item_id: string;
300
+ delta: string;
301
+ sequence_number?: number;
302
+ };
303
+ export type ResponsesOutputTextDoneEvent = {
304
+ type: 'response.output_text.done';
305
+ output_index: number;
306
+ content_index: number;
307
+ item_id: string;
308
+ text: string;
309
+ sequence_number?: number;
310
+ };
311
+ export type ResponsesContentPartDoneEvent = {
312
+ type: 'response.content_part.done';
313
+ output_index: number;
314
+ content_index: number;
315
+ item_id: string;
316
+ part: ResponseOutputText;
317
+ sequence_number?: number;
318
+ };
319
+ export type ResponsesOutputItemDoneEvent = {
320
+ type: 'response.output_item.done';
321
+ output_index: number;
322
+ item: ResponseOutputItem;
323
+ sequence_number?: number;
324
+ };
325
+ export type ResponsesFunctionCallArgumentsDeltaEvent = {
326
+ type: 'response.function_call_arguments.delta';
327
+ output_index: number;
328
+ item_id: string;
329
+ delta: string;
330
+ sequence_number?: number;
331
+ };
332
+ export type ResponsesFunctionCallArgumentsDoneEvent = {
333
+ type: 'response.function_call_arguments.done';
334
+ output_index: number;
335
+ item_id: string;
336
+ name: string;
337
+ arguments: string;
338
+ sequence_number?: number;
339
+ };
340
+ export type ResponsesCompletedEvent = {
341
+ type: 'response.completed';
342
+ response: ResponsesResponse;
343
+ sequence_number?: number;
344
+ };
345
+ export type ResponsesStreamEvent = ResponsesCreatedEvent | ResponsesInProgressEvent | ResponsesOutputItemAddedEvent | ResponsesContentPartAddedEvent | ResponsesOutputTextDeltaEvent | ResponsesOutputTextDoneEvent | ResponsesContentPartDoneEvent | ResponsesOutputItemDoneEvent | ResponsesFunctionCallArgumentsDeltaEvent | ResponsesFunctionCallArgumentsDoneEvent | ResponsesCompletedEvent;
40
346
  type WithoutMethods<T> = {
41
347
  [K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
42
348
  (): any;
43
349
  } ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
44
350
  };
45
- export type NetworkStreamParams = {
351
+ export type NetworkStreamParams<OUTPUT = undefined> = {
46
352
  messages: MessageListInput;
47
- } & MultiPrimitiveExecutionOptions;
353
+ model?: string;
354
+ tracingOptions?: TracingOptions;
355
+ } & Omit<MultiPrimitiveExecutionOptions<OUTPUT>, 'model'>;
48
356
  export interface GetAgentResponse {
357
+ id: string;
49
358
  name: string;
359
+ description?: string;
360
+ metadata?: Record<string, unknown>;
50
361
  instructions: AgentInstructions;
51
362
  tools: Record<string, GetToolResponse>;
52
363
  workflows: Record<string, GetWorkflowResponse>;
@@ -54,11 +365,16 @@ export interface GetAgentResponse {
54
365
  id: string;
55
366
  name: string;
56
367
  }>;
368
+ skills?: SkillMetadata[];
369
+ workspaceTools?: string[];
370
+ /** Browser tool names available to this agent (if browser is configured) */
371
+ browserTools?: string[];
372
+ /** ID of the agent's workspace (if configured) */
373
+ workspaceId?: string;
57
374
  provider: string;
58
375
  modelId: string;
59
376
  modelVersion: string;
60
- defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
61
- defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
377
+ supportsMemory?: boolean;
62
378
  modelList: Array<{
63
379
  id: string;
64
380
  enabled: boolean;
@@ -69,36 +385,88 @@ export interface GetAgentResponse {
69
385
  modelVersion: string;
70
386
  };
71
387
  }> | undefined;
388
+ inputProcessors?: Array<{
389
+ id: string;
390
+ name: string;
391
+ }>;
392
+ outputProcessors?: Array<{
393
+ id: string;
394
+ name: string;
395
+ }>;
396
+ defaultOptions: WithoutMethods<AgentExecutionOptions>;
397
+ defaultGenerateOptionsLegacy: WithoutMethods<AgentGenerateOptions>;
398
+ defaultStreamOptionsLegacy: WithoutMethods<AgentStreamOptions>;
399
+ /** Serialized JSON schema for request context validation */
400
+ requestContextSchema?: string;
401
+ source?: 'code' | 'stored';
402
+ status?: 'draft' | 'published' | 'archived';
403
+ activeVersionId?: string;
404
+ hasDraft?: boolean;
405
+ editor?: AgentEditorConfig;
406
+ }
407
+ /**
408
+ * Response from the browser session probe endpoint.
409
+ *
410
+ * Use this to decide whether to open a screencast WebSocket for an agent/thread:
411
+ * - `screencastAvailable`: server has the `ws` / `@hono/node-ws` packages installed.
412
+ * When false, opening a WS will fail and trigger a reconnect loop — skip it.
413
+ * - `hasSession`: the agent has an active browser session for this thread. When
414
+ * false, the WS would just sit idle waiting for the agent to invoke a tool.
415
+ */
416
+ export interface GetAgentBrowserSessionResponse {
417
+ hasSession: boolean;
418
+ screencastAvailable: boolean;
72
419
  }
73
420
  export type GenerateLegacyParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
74
421
  messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
422
+ model?: string;
75
423
  output?: T;
76
424
  experimental_output?: T;
77
- runtimeContext?: RuntimeContext | Record<string, any>;
425
+ requestContext?: RequestContext | Record<string, any>;
78
426
  clientTools?: ToolsInput;
79
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
427
+ } & WithoutMethods<Omit<AgentGenerateOptions<any>, 'model' | 'output' | 'experimental_output' | 'requestContext' | 'clientTools' | 'abortSignal'>>;
80
428
  export type StreamLegacyParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
81
429
  messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
430
+ model?: string;
82
431
  output?: T;
83
432
  experimental_output?: T;
84
- runtimeContext?: RuntimeContext | Record<string, any>;
433
+ requestContext?: RequestContext | Record<string, any>;
85
434
  clientTools?: ToolsInput;
86
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
87
- export type StreamParams<OUTPUT extends OutputSchema = undefined> = {
88
- messages: MessageListInput;
89
- structuredOutput?: SerializableStructuredOutputOptions<OUTPUT>;
90
- runtimeContext?: RuntimeContext | Record<string, any>;
435
+ } & WithoutMethods<Omit<AgentStreamOptions<any>, 'model' | 'output' | 'experimental_output' | 'requestContext' | 'clientTools' | 'abortSignal'>>;
436
+ export type StructuredOutputOptions<OUTPUT = undefined> = Omit<SerializableStructuredOutputOptions<OUTPUT>, 'schema'> & {
437
+ schema: PublicSchema<OUTPUT>;
438
+ };
439
+ export type StreamParamsBase<OUTPUT = undefined> = {
440
+ model?: string;
441
+ tracingOptions?: TracingOptions;
442
+ requestContext?: RequestContext;
91
443
  clientTools?: ToolsInput;
92
- } & WithoutMethods<Omit<AgentExecutionOptions<OUTPUT>, 'output' | 'runtimeContext' | 'clientTools' | 'options' | 'abortSignal' | 'structuredOutput'>> & DeprecatedOutputOptions<OUTPUT>;
444
+ } & WithoutMethods<Omit<AgentExecutionOptions<OUTPUT>, 'model' | 'requestContext' | 'clientTools' | 'options' | 'abortSignal' | 'structuredOutput'>>;
445
+ export type StreamParamsBaseWithoutMessages<OUTPUT = undefined> = StreamParamsBase<OUTPUT>;
446
+ export type StreamParams<OUTPUT = undefined> = StreamParamsBase<OUTPUT> & {
447
+ messages: MessageListInput;
448
+ } & (OUTPUT extends undefined ? {
449
+ structuredOutput?: never;
450
+ } : {
451
+ structuredOutput: StructuredOutputOptions<OUTPUT>;
452
+ });
453
+ /**
454
+ * Provider id widened to accept admin-configured custom gateway providers.
455
+ * Closed unions over the five hard-coded providers are removed in favor of the
456
+ * generated `ModelProviderId` union plus a `(string & {})` escape hatch — this
457
+ * preserves IDE autocomplete on known providers while letting custom gateway
458
+ * ids flow through (see Phase 1 of the admin model configuration plan).
459
+ */
460
+ export type AdminProviderId = ModelProviderId | (string & {});
93
461
  export type UpdateModelParams = {
94
462
  modelId: string;
95
- provider: 'openai' | 'anthropic' | 'groq' | 'xai' | 'google';
463
+ provider: AdminProviderId;
96
464
  };
97
465
  export type UpdateModelInModelListParams = {
98
466
  modelConfigId: string;
99
467
  model?: {
100
468
  modelId: string;
101
- provider: 'openai' | 'anthropic' | 'groq' | 'xai' | 'google';
469
+ provider: AdminProviderId;
102
470
  };
103
471
  maxRetries?: number;
104
472
  enabled?: boolean;
@@ -106,31 +474,38 @@ export type UpdateModelInModelListParams = {
106
474
  export type ReorderModelListParams = {
107
475
  reorderedModelIds: string[];
108
476
  };
109
- export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
110
- evals: any[];
111
- instructions: string;
112
- name: string;
113
- id: string;
114
- }
115
477
  export interface GetToolResponse {
116
478
  id: string;
117
479
  description: string;
118
480
  inputSchema: string;
119
481
  outputSchema: string;
482
+ requestContextSchema?: string;
120
483
  }
121
- export interface GetWorkflowRunsParams {
484
+ export interface ListWorkflowRunsParams {
122
485
  fromDate?: Date;
123
486
  toDate?: Date;
124
- limit?: number;
125
- offset?: number;
487
+ page?: number;
488
+ perPage?: number;
126
489
  resourceId?: string;
490
+ status?: WorkflowRunStatus;
491
+ /** @deprecated Use page instead */
492
+ offset?: number;
493
+ /** @deprecated Use perPage instead */
494
+ limit?: number | false;
127
495
  }
128
- export type GetWorkflowRunsResponse = WorkflowRuns;
129
- export type GetWorkflowRunByIdResponse = WorkflowRun;
130
- export type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
496
+ export type ListWorkflowRunsResponse = WorkflowRuns;
497
+ export type GetWorkflowRunByIdResponse = WorkflowState;
498
+ export type ListStoredWorkflowsParams = GeneratedRequest<QueryParams<'GET /stored/workflows'>>;
499
+ export type ListStoredWorkflowsResponse = GeneratedResponse<'GET /stored/workflows'>;
500
+ export type UpsertStoredWorkflowParams = GeneratedRequest<Body<'POST /stored/workflows'>>;
501
+ export type UpsertStoredWorkflowResponse = GeneratedResponse<'POST /stored/workflows'>;
502
+ type StoredWorkflowDefinitionField = 'description' | 'inputSchema' | 'outputSchema' | 'stateSchema' | 'requestContextSchema' | 'graph';
503
+ export type StoredWorkflowDefinition = Omit<GeneratedResponse<'GET /stored/workflows/:storedWorkflowId'>, StoredWorkflowDefinitionField> & Pick<UpsertStoredWorkflowParams, StoredWorkflowDefinitionField>;
504
+ export type DeleteStoredWorkflowResponse = GeneratedResponse<'DELETE /stored/workflows/:storedWorkflowId'>;
131
505
  export interface GetWorkflowResponse {
132
506
  name: string;
133
507
  description?: string;
508
+ metadata?: Record<string, unknown>;
134
509
  steps: {
135
510
  [key: string]: {
136
511
  id: string;
@@ -139,6 +514,8 @@ export interface GetWorkflowResponse {
139
514
  outputSchema: string;
140
515
  resumeSchema: string;
141
516
  suspendSchema: string;
517
+ stateSchema: string;
518
+ metadata?: Record<string, unknown>;
142
519
  };
143
520
  };
144
521
  allSteps: {
@@ -149,28 +526,29 @@ export interface GetWorkflowResponse {
149
526
  outputSchema: string;
150
527
  resumeSchema: string;
151
528
  suspendSchema: string;
529
+ stateSchema: string;
152
530
  isWorkflow: boolean;
531
+ metadata?: Record<string, unknown>;
153
532
  };
154
533
  };
155
534
  stepGraph: Workflow['serializedStepGraph'];
156
535
  inputSchema: string;
157
536
  outputSchema: string;
537
+ stateSchema: string;
538
+ /** Serialized JSON schema for request context validation */
539
+ requestContextSchema?: string;
540
+ /** Whether this workflow is a processor workflow (auto-generated from agent processors) */
541
+ isProcessorWorkflow?: boolean;
542
+ /**
543
+ * How this workflow got into the live registry. `'code'` for statically
544
+ * authored or `addWorkflow()`-added workflows, `'stored'` for anything
545
+ * hydrated or added via `addStoredWorkflow()`. Absent on older servers.
546
+ */
547
+ origin?: 'code' | 'stored';
158
548
  }
159
- export type WorkflowWatchResult = WatchEvent & {
160
- runId: string;
161
- };
162
549
  export type WorkflowRunResult = WorkflowResult<any, any, any, any>;
163
- export interface UpsertVectorParams {
164
- indexName: string;
165
- vectors: number[][];
166
- metadata?: Record<string, any>[];
167
- ids?: string[];
168
- }
169
- export interface CreateIndexParams {
170
- indexName: string;
171
- dimension: number;
172
- metric?: 'cosine' | 'euclidean' | 'dotproduct';
173
- }
550
+ export type UpsertVectorParams = GeneratedRequest<Body<'POST /vector/:vectorName/upsert'>>;
551
+ export type CreateIndexParams = GeneratedRequest<Body<'POST /vector/:vectorName/create-index'>>;
174
552
  export interface QueryVectorParams {
175
553
  indexName: string;
176
554
  queryVector: number[];
@@ -178,82 +556,89 @@ export interface QueryVectorParams {
178
556
  filter?: Record<string, any>;
179
557
  includeVector?: boolean;
180
558
  }
181
- export interface QueryVectorResponse {
182
- results: QueryResult[];
183
- }
184
- export interface GetVectorIndexResponse {
185
- dimension: number;
186
- metric: 'cosine' | 'euclidean' | 'dotproduct';
187
- count: number;
188
- }
559
+ export type QueryVectorResponse = QueryResult[];
560
+ export type GetVectorIndexResponse = GeneratedResponse<'GET /vector/:vectorName/indexes/:indexName'>;
189
561
  export interface SaveMessageToMemoryParams {
190
- messages: (MastraMessageV1 | MastraMessageV2)[];
562
+ messages: (MastraMessageV1 | MastraDBMessage)[];
191
563
  agentId: string;
564
+ requestContext?: RequestContext | Record<string, any>;
192
565
  }
193
566
  export interface SaveNetworkMessageToMemoryParams {
194
- messages: (MastraMessageV1 | MastraMessageV2)[];
195
- networkId: string;
196
- }
197
- export type SaveMessageToMemoryResponse = (MastraMessageV1 | MastraMessageV2)[];
198
- export interface CreateMemoryThreadParams {
199
- title?: string;
200
- metadata?: Record<string, any>;
201
- resourceId: string;
202
- threadId?: string;
203
- agentId: string;
204
- }
205
- export interface CreateNetworkMemoryThreadParams {
206
- title?: string;
207
- metadata?: Record<string, any>;
208
- resourceId: string;
209
- threadId?: string;
567
+ messages: (MastraMessageV1 | MastraDBMessage)[];
210
568
  networkId: string;
211
569
  }
212
- export type CreateMemoryThreadResponse = StorageThreadType;
213
- export interface GetMemoryThreadParams {
214
- resourceId: string;
215
- agentId: string;
216
- }
217
- export interface GetMemoryConfigParams {
218
- agentId: string;
219
- }
220
- export type GetMemoryConfigResponse = {
221
- config: MemoryConfig;
570
+ export type SaveMessageToMemoryResponse = {
571
+ messages: (MastraMessageV1 | MastraDBMessage)[];
222
572
  };
223
- export interface GetNetworkMemoryThreadParams {
224
- resourceId: string;
225
- networkId: string;
573
+ export type CreateMemoryThreadParams = GeneratedRequest<Body<'POST /memory/threads'> & QueryParams<'POST /memory/threads'>> & RequestContextOptions;
574
+ export type CreateMemoryThreadResponse = GeneratedResponse<'POST /memory/threads'>;
575
+ export interface ListMemoryThreadsParams {
576
+ /**
577
+ * Optional resourceId to filter threads. When not provided, returns all threads.
578
+ */
579
+ resourceId?: string;
580
+ /**
581
+ * Optional metadata filter. Threads must match all specified key-value pairs (AND logic).
582
+ */
583
+ metadata?: Record<string, unknown>;
584
+ /**
585
+ * Optional agentId. When not provided and storage is configured on the server,
586
+ * threads will be retrieved using storage directly.
587
+ */
588
+ agentId?: string;
589
+ page?: number;
590
+ perPage?: number;
591
+ orderBy?: {
592
+ field?: 'createdAt' | 'updatedAt';
593
+ direction?: 'ASC' | 'DESC';
594
+ };
595
+ requestContext?: RequestContext | Record<string, any>;
226
596
  }
227
- export type GetMemoryThreadResponse = StorageThreadType[];
597
+ export type ListMemoryThreadsResponse = GeneratedResponse<'GET /memory/threads'>;
598
+ export type GetMemoryConfigParams = GeneratedRequest<QueryParams<'GET /memory/config'>> & RequestContextOptions;
599
+ export type GetMemoryConfigResponse = GeneratedResponse<'GET /memory/config'>;
228
600
  export interface UpdateMemoryThreadParams {
229
601
  title: string;
230
602
  metadata: Record<string, any>;
231
603
  resourceId: string;
232
- }
233
- export interface GetMemoryThreadMessagesParams {
234
604
  /**
235
- * Limit the number of messages to retrieve (default: 40)
605
+ * Agent ID. Required by the server for write operations. If omitted, the agentId provided
606
+ * to `getMemoryThread({ threadId, agentId })` is used.
236
607
  */
237
- limit?: number;
608
+ agentId?: string;
609
+ requestContext?: RequestContext | Record<string, any>;
238
610
  }
239
- export type GetMemoryThreadMessagesPaginatedParams = Omit<StorageGetMessagesArg, 'threadConfig' | 'threadId'>;
240
- export interface GetMemoryThreadMessagesResponse {
241
- messages: CoreMessage[];
242
- legacyMessages: AiMessageType[];
243
- uiMessages: UIMessage[];
244
- }
245
- export type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
246
- messages: MastraMessageV1[] | MastraMessageV2[];
611
+ export type ListMemoryThreadMessagesParams = Omit<StorageListMessagesInput, 'threadId'> & {
612
+ includeSystemReminders?: boolean;
247
613
  };
248
- export interface GetLogsParams {
249
- transportId: string;
250
- fromDate?: Date;
251
- toDate?: Date;
252
- logLevel?: LogLevel;
253
- filters?: Record<string, string>;
254
- page?: number;
255
- perPage?: number;
614
+ export type ListMemoryThreadMessagesResponse = {
615
+ messages: MastraDBMessage[];
616
+ };
617
+ export interface CloneMemoryThreadParams {
618
+ newThreadId?: string;
619
+ resourceId?: string;
620
+ title?: string;
621
+ metadata?: Record<string, any>;
622
+ options?: {
623
+ messageLimit?: number;
624
+ messageFilter?: {
625
+ startDate?: Date;
626
+ endDate?: Date;
627
+ messageIds?: string[];
628
+ };
629
+ };
630
+ /**
631
+ * Agent ID. Required by the server for write operations. If omitted, the agentId provided
632
+ * to `getMemoryThread({ threadId, agentId })` is used.
633
+ */
634
+ agentId?: string;
635
+ requestContext?: RequestContext | Record<string, any>;
256
636
  }
637
+ export type CloneMemoryThreadResponse = {
638
+ thread: StorageThreadType;
639
+ clonedMessages: MastraDBMessage[];
640
+ };
641
+ export type GetLogsParams = GeneratedRequest<QueryParams<'GET /logs'>>;
257
642
  export interface GetLogParams {
258
643
  runId: string;
259
644
  transportId: string;
@@ -264,63 +649,8 @@ export interface GetLogParams {
264
649
  page?: number;
265
650
  perPage?: number;
266
651
  }
267
- export type GetLogsResponse = {
268
- logs: BaseLogMessage[];
269
- total: number;
270
- page: number;
271
- perPage: number;
272
- hasMore: boolean;
273
- };
652
+ export type GetLogsResponse = GeneratedResponse<'GET /logs'>;
274
653
  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
654
  export interface GetVNextNetworkResponse {
325
655
  id: string;
326
656
  name: string;
@@ -355,14 +685,14 @@ export interface GenerateOrStreamVNextNetworkParams {
355
685
  message: string;
356
686
  threadId?: string;
357
687
  resourceId?: string;
358
- runtimeContext?: RuntimeContext | Record<string, any>;
688
+ requestContext?: RequestContext | Record<string, any>;
359
689
  }
360
690
  export interface LoopStreamVNextNetworkParams {
361
691
  message: string;
362
692
  threadId?: string;
363
693
  resourceId?: string;
364
694
  maxIterations?: number;
365
- runtimeContext?: RuntimeContext | Record<string, any>;
695
+ requestContext?: RequestContext | Record<string, any>;
366
696
  }
367
697
  export interface LoopVNextNetworkResponse {
368
698
  status: 'success';
@@ -392,52 +722,46 @@ export interface McpToolInfo {
392
722
  description?: string;
393
723
  inputSchema: string;
394
724
  toolType?: MCPToolType;
725
+ _meta?: Record<string, unknown>;
395
726
  }
396
727
  export interface McpServerToolListResponse {
397
728
  tools: McpToolInfo[];
398
729
  }
730
+ /**
731
+ * Client version of ScoreRowData with dates serialized as strings (from JSON)
732
+ */
399
733
  export type ClientScoreRowData = Omit<ScoreRowData, 'createdAt' | 'updatedAt'> & {
400
734
  createdAt: string;
401
735
  updatedAt: string;
402
- } & {
403
- spanId?: string;
404
736
  };
405
- export interface GetScoresByRunIdParams {
737
+ /**
738
+ * Response for listing scores (client version with serialized dates)
739
+ */
740
+ export type ListScoresResponse = {
741
+ pagination: PaginationInfo;
742
+ scores: ClientScoreRowData[];
743
+ };
744
+ export interface ListScoresByRunIdParams {
406
745
  runId: string;
407
746
  page?: number;
408
747
  perPage?: number;
409
748
  }
410
- export interface GetScoresByScorerIdParams {
749
+ export interface ListScoresByScorerIdParams {
411
750
  scorerId: string;
412
751
  entityId?: string;
413
752
  entityType?: string;
414
753
  page?: number;
415
754
  perPage?: number;
416
755
  }
417
- export interface GetScoresByEntityIdParams {
756
+ export interface ListScoresByEntityIdParams {
418
757
  entityId: string;
419
758
  entityType: string;
420
759
  page?: number;
421
760
  perPage?: number;
422
761
  }
423
- export interface GetScoresBySpanParams {
424
- traceId: string;
425
- spanId: string;
426
- page?: number;
427
- perPage?: number;
428
- }
429
762
  export interface SaveScoreParams {
430
763
  score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>;
431
764
  }
432
- export interface GetScoresResponse {
433
- pagination: {
434
- total: number;
435
- page: number;
436
- perPage: number;
437
- hasMore: boolean;
438
- };
439
- scores: ClientScoreRowData[];
440
- }
441
765
  export interface SaveScoreResponse {
442
766
  score: ClientScoreRowData;
443
767
  }
@@ -446,6 +770,7 @@ export type GetScorerResponse = MastraScorerEntry & {
446
770
  agentNames: string[];
447
771
  workflowIds: string[];
448
772
  isRegistered: boolean;
773
+ source: 'code' | 'stored';
449
774
  };
450
775
  export interface GetScorersResponse {
451
776
  scorers: Array<GetScorerResponse>;
@@ -462,18 +787,2236 @@ export interface TemplateInstallationRequest {
462
787
  /** Environment variables for template */
463
788
  variables?: Record<string, string>;
464
789
  }
465
- export interface GetAITraceResponse {
466
- trace: AITraceRecord;
467
- }
468
- export interface GetAITracesResponse {
469
- spans: AISpanRecord[];
470
- pagination: PaginationInfo;
471
- }
472
790
  export interface StreamVNextChunkType {
473
791
  type: string;
474
792
  payload: any;
475
793
  runId: string;
476
794
  from: 'AGENT' | 'WORKFLOW';
477
795
  }
478
- export {};
796
+ export interface MemorySearchResponse {
797
+ results: MemorySearchResult[];
798
+ count: number;
799
+ query: string;
800
+ searchType?: string;
801
+ searchScope?: 'thread' | 'resource';
802
+ }
803
+ export interface MemorySearchResult {
804
+ id: string;
805
+ role: string;
806
+ content: string;
807
+ createdAt: string;
808
+ threadId?: string;
809
+ threadTitle?: string;
810
+ context?: {
811
+ before?: Array<{
812
+ id: string;
813
+ role: string;
814
+ content: string;
815
+ createdAt: string;
816
+ }>;
817
+ after?: Array<{
818
+ id: string;
819
+ role: string;
820
+ content: string;
821
+ createdAt: string;
822
+ }>;
823
+ };
824
+ }
825
+ export interface TimeTravelParams {
826
+ step: string | string[];
827
+ inputData?: Record<string, any>;
828
+ resumeData?: Record<string, any>;
829
+ initialState?: Record<string, any>;
830
+ context?: TimeTravelContext<any, any, any, any>;
831
+ nestedStepsContext?: Record<string, TimeTravelContext<any, any, any, any>>;
832
+ requestContext?: RequestContext | Record<string, any>;
833
+ tracingOptions?: TracingOptions;
834
+ perStep?: boolean;
835
+ }
836
+ /**
837
+ * Semantic recall configuration for vector-based memory retrieval
838
+ */
839
+ export interface SemanticRecallConfig {
840
+ topK: number;
841
+ messageRange: number | {
842
+ before: number;
843
+ after: number;
844
+ };
845
+ scope?: 'thread' | 'resource';
846
+ threshold?: number;
847
+ indexName?: string;
848
+ }
849
+ /**
850
+ * Title generation configuration
851
+ */
852
+ export type TitleGenerationConfig = boolean | {
853
+ model: string;
854
+ instructions?: string;
855
+ };
856
+ /**
857
+ * Serialized memory configuration matching SerializedMemoryConfig from @mastra/core
858
+ *
859
+ * Note: When semanticRecall is enabled, both `vector` (string, not false) and `embedder` must be configured.
860
+ */
861
+ /** Serializable observation step config for observational memory */
862
+ export interface SerializedObservationConfig {
863
+ model?: string;
864
+ messageTokens?: number;
865
+ modelSettings?: Record<string, unknown>;
866
+ providerOptions?: Record<string, Record<string, unknown> | undefined>;
867
+ maxTokensPerBatch?: number;
868
+ bufferTokens?: number | false;
869
+ bufferActivation?: number;
870
+ blockAfter?: number;
871
+ }
872
+ /** Serializable reflection step config for observational memory */
873
+ export interface SerializedReflectionConfig {
874
+ model?: string;
875
+ observationTokens?: number;
876
+ modelSettings?: Record<string, unknown>;
877
+ providerOptions?: Record<string, Record<string, unknown> | undefined>;
878
+ blockAfter?: number;
879
+ bufferActivation?: number;
880
+ }
881
+ /** Serializable observational memory configuration */
882
+ export interface SerializedObservationalMemoryConfig {
883
+ model?: string;
884
+ scope?: 'resource' | 'thread';
885
+ shareTokenBudget?: boolean;
886
+ observation?: SerializedObservationConfig;
887
+ reflection?: SerializedReflectionConfig;
888
+ }
889
+ export interface SerializedMemoryConfig {
890
+ /**
891
+ * Vector database identifier. Required when semanticRecall is enabled.
892
+ * Set to false to explicitly disable vector search.
893
+ */
894
+ vector?: string | false;
895
+ options?: {
896
+ readOnly?: boolean;
897
+ lastMessages?: number | false;
898
+ /**
899
+ * Semantic recall configuration. When enabled (true or object),
900
+ * requires both `vector` and `embedder` to be configured.
901
+ */
902
+ semanticRecall?: boolean | SemanticRecallConfig;
903
+ generateTitle?: TitleGenerationConfig;
904
+ };
905
+ /**
906
+ * Embedding model ID in the format "provider/model"
907
+ * (e.g., "openai/text-embedding-3-small")
908
+ * Required when semanticRecall is enabled.
909
+ */
910
+ embedder?: string;
911
+ /**
912
+ * Options to pass to the embedder
913
+ */
914
+ embedderOptions?: Record<string, unknown>;
915
+ /**
916
+ * Serialized observational memory configuration.
917
+ * `true` to enable with defaults, or a config object for customization.
918
+ */
919
+ observationalMemory?: boolean | SerializedObservationalMemoryConfig;
920
+ }
921
+ /**
922
+ * Default options for agent execution (serializable subset of AgentExecutionOptionsBase)
923
+ */
924
+ export interface DefaultOptions {
925
+ runId?: string;
926
+ savePerStep?: boolean;
927
+ maxSteps?: number;
928
+ activeTools?: string[];
929
+ maxProcessorRetries?: number;
930
+ toolChoice?: 'auto' | 'none' | 'required' | {
931
+ type: 'tool';
932
+ toolName: string;
933
+ };
934
+ modelSettings?: {
935
+ temperature?: number;
936
+ maxTokens?: number;
937
+ topP?: number;
938
+ topK?: number;
939
+ frequencyPenalty?: number;
940
+ presencePenalty?: number;
941
+ stopSequences?: string[];
942
+ seed?: number;
943
+ maxRetries?: number;
944
+ };
945
+ returnScorerData?: boolean;
946
+ tracingOptions?: {
947
+ traceName?: string;
948
+ attributes?: Record<string, unknown>;
949
+ spanId?: string;
950
+ traceId?: string;
951
+ };
952
+ requireToolApproval?: boolean;
953
+ autoResumeSuspendedTools?: boolean;
954
+ toolCallConcurrency?: number;
955
+ includeRawChunks?: boolean;
956
+ [key: string]: unknown;
957
+ }
958
+ /**
959
+ * Per-tool config for stored agents (e.g., description overrides)
960
+ */
961
+ export interface StoredAgentToolConfig {
962
+ description?: string;
963
+ rules?: RuleGroup;
964
+ }
965
+ /**
966
+ * Per-MCP-client/integration tool configuration stored in agent snapshots.
967
+ * Specifies which tools from an MCP client or integration provider are enabled and their overrides.
968
+ * When `tools` is omitted, all tools from the source are included.
969
+ */
970
+ export interface StoredMCPClientToolsConfig {
971
+ /** When omitted, all tools from the source are included. */
972
+ tools?: Record<string, StoredAgentToolConfig>;
973
+ }
974
+ /**
975
+ * One pinned connection on a `toolProviders[providerId].connections[toolkit]` bucket.
976
+ * Part of the Agent Builder / CMS tool-providers shape
977
+ * (`StoredAgentSnapshot.toolProviders`).
978
+ */
979
+ export interface StoredToolProviderConnection {
980
+ /**
981
+ * Identity binding kind.
982
+ *
983
+ * - `'author'` — uses the agent author's connection (v1 default).
984
+ * - `'invoker'` — uses the end-user's connection (v1.5, reserved).
985
+ * - `'platform'` — uses a shared platform account (v2, reserved).
986
+ */
987
+ kind: 'author' | 'invoker' | 'platform';
988
+ /** Parent toolkit slug. Denormalized for callsite clarity. */
989
+ toolkit: string;
990
+ /**
991
+ * Provider-opaque identifier for the OAuth bucket.
992
+ *
993
+ * Required for `'author'` and `'platform'`; reserved (empty) for `'invoker'`.
994
+ */
995
+ connectionId: string;
996
+ /**
997
+ * Display label and LLM disambiguator. Optional when this is the only
998
+ * connection on a `toolkit`; required (non-empty, ≤ 32 chars,
999
+ * `[A-Za-z0-9 _-]+`, case-insensitively unique) once ≥ 2 connections share
1000
+ * the same `toolkit`.
1001
+ */
1002
+ label?: string;
1003
+ /**
1004
+ * Ownership scope of the underlying OAuth bucket.
1005
+ *
1006
+ * - `'per-author'` (default) — bucketed under the agent author's id.
1007
+ * - `'shared'` — bucketed under a constant shared id; visible to and
1008
+ * usable by anyone with edit access.
1009
+ * - `'caller-supplied'` — bucketed under the request-context
1010
+ * `MASTRA_RESOURCE_ID_KEY` value at runtime. Used for multi-tenant
1011
+ * deployments where the host app sets the user id per request.
1012
+ */
1013
+ scope?: 'per-author' | 'shared' | 'caller-supplied';
1014
+ }
1015
+ /** Per-tool override stored alongside the selected tool slug. */
1016
+ export interface StoredToolProviderToolMeta {
1017
+ /**
1018
+ * Toolkit this slug belongs to. The runtime groups selected slugs
1019
+ * by this field when fanning out across connections.
1020
+ */
1021
+ toolkit?: string;
1022
+ description?: string;
1023
+ }
1024
+ /** Stored shape for one tool provider's configuration on one agent. */
1025
+ export interface StoredToolProviderConfig {
1026
+ tools: Record<string, StoredToolProviderToolMeta>;
1027
+ connections: Record<string, StoredToolProviderConnection[]>;
1028
+ }
1029
+ /**
1030
+ * Scorer config for stored agents
1031
+ */
1032
+ export interface StoredAgentScorerConfig {
1033
+ description?: string;
1034
+ sampling?: {
1035
+ type: 'none';
1036
+ } | {
1037
+ type: 'ratio';
1038
+ rate: number;
1039
+ };
1040
+ rules?: RuleGroup;
1041
+ }
1042
+ /**
1043
+ * Per-skill config stored in agent snapshots.
1044
+ * Allows overriding skill description and instructions for a specific agent context.
1045
+ */
1046
+ export interface StoredAgentSkillConfig {
1047
+ description?: string;
1048
+ instructions?: string;
1049
+ /** Pin to a specific version ID. Takes precedence over strategy. */
1050
+ pin?: string;
1051
+ /** Resolution strategy: 'latest' = latest published version, 'live' = read from filesystem */
1052
+ strategy?: 'latest' | 'live';
1053
+ }
1054
+ /**
1055
+ * Workspace reference stored in agent snapshots.
1056
+ * Can reference a stored workspace by ID or provide inline workspace config.
1057
+ */
1058
+ export type StoredWorkspaceRef = {
1059
+ type: 'id';
1060
+ workspaceId: string;
1061
+ } | {
1062
+ type: 'inline';
1063
+ config: Record<string, unknown>;
1064
+ };
1065
+ export interface StoredBrowserConfig {
1066
+ provider: string;
1067
+ headless?: boolean;
1068
+ viewport?: {
1069
+ width: number;
1070
+ height: number;
1071
+ };
1072
+ timeout?: number;
1073
+ screencast?: {
1074
+ format?: 'jpeg' | 'png';
1075
+ quality?: number;
1076
+ maxWidth?: number;
1077
+ maxHeight?: number;
1078
+ everyNthFrame?: number;
1079
+ };
1080
+ }
1081
+ export type StoredBrowserRef = {
1082
+ type: 'inline';
1083
+ config: StoredBrowserConfig;
1084
+ };
1085
+ export type StoredAgentRule = Rule;
1086
+ export type StoredAgentRuleGroup = RuleGroup;
1087
+ export type ConditionalVariant<T> = StorageConditionalVariant<T>;
1088
+ export type ConditionalField<T> = StorageConditionalField<T>;
1089
+ /**
1090
+ * Resolved author identity. Returned by the server when an auth provider is
1091
+ * configured and the agent's `authorId` could be looked up. All fields except
1092
+ * `id` are optional — providers may not expose every field.
1093
+ */
1094
+ export interface ResolvedAuthor {
1095
+ id: string;
1096
+ name?: string;
1097
+ email?: string;
1098
+ avatarUrl?: string;
1099
+ }
1100
+ /**
1101
+ * Stored agent data returned from API
1102
+ */
1103
+ export interface StoredAgentResponse {
1104
+ id: string;
1105
+ status: string;
1106
+ activeVersionId?: string;
1107
+ authorId?: string;
1108
+ author?: ResolvedAuthor;
1109
+ visibility?: 'private' | 'public';
1110
+ metadata?: Record<string, unknown>;
1111
+ createdAt: string;
1112
+ updatedAt: string;
1113
+ name: string;
1114
+ description?: string;
1115
+ instructions: string | AgentInstructionBlock[];
1116
+ model: ConditionalField<{
1117
+ provider: string;
1118
+ name: string;
1119
+ [key: string]: unknown;
1120
+ }>;
1121
+ tools?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1122
+ defaultOptions?: ConditionalField<DefaultOptions>;
1123
+ workflows?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1124
+ agents?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1125
+ integrationTools?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
1126
+ toolProviders?: ConditionalField<Record<string, StoredToolProviderConfig>>;
1127
+ mcpClients?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
1128
+ inputProcessors?: ConditionalField<StoredProcessorGraph>;
1129
+ outputProcessors?: ConditionalField<StoredProcessorGraph>;
1130
+ memory?: ConditionalField<SerializedMemoryConfig>;
1131
+ scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
1132
+ skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
1133
+ workspace?: ConditionalField<StoredWorkspaceRef>;
1134
+ browser?: ConditionalField<StoredBrowserRef> | boolean | null;
1135
+ requestContextSchema?: Record<string, unknown>;
1136
+ isFavorited?: boolean;
1137
+ favoriteCount?: number;
1138
+ }
1139
+ /**
1140
+ * Parameters for listing stored agents
1141
+ */
1142
+ export interface ListStoredAgentsParams {
1143
+ page?: number;
1144
+ perPage?: number;
1145
+ orderBy?: {
1146
+ field?: 'createdAt' | 'updatedAt';
1147
+ direction?: 'ASC' | 'DESC';
1148
+ };
1149
+ status?: 'draft' | 'published' | 'archived';
1150
+ authorId?: string;
1151
+ /**
1152
+ * Restrict the list to public records. Only `'public'` is accepted by the
1153
+ * server filter; private records are surfaced via the default scope-aware
1154
+ * filter (caller's own rows + legacy unowned).
1155
+ */
1156
+ visibility?: 'public';
1157
+ metadata?: Record<string, unknown>;
1158
+ /** When true, only return agents favorited by the caller (or by `pinFavoritedFor`). */
1159
+ favoritedOnly?: boolean;
1160
+ /** When set, sort favorited-first for this user id. Required for `favoritedOnly`. */
1161
+ pinFavoritedFor?: string;
1162
+ }
1163
+ /**
1164
+ * Response from favorite / unfavorite mutations.
1165
+ */
1166
+ export interface FavoriteToggleResponse {
1167
+ favorited: boolean;
1168
+ favoriteCount: number;
1169
+ }
1170
+ /**
1171
+ * Response for listing stored agents
1172
+ */
1173
+ export interface ListStoredAgentsResponse {
1174
+ agents: StoredAgentResponse[];
1175
+ total: number;
1176
+ page: number;
1177
+ perPage: number | false;
1178
+ hasMore: boolean;
1179
+ }
1180
+ /**
1181
+ * Parameters for cloning an agent to a stored agent
1182
+ */
1183
+ export interface CloneAgentParams {
1184
+ /** ID for the cloned agent. If not provided, derived from agent ID. */
1185
+ newId?: string;
1186
+ /** Name for the cloned agent. Defaults to "{name} (Clone)". */
1187
+ newName?: string;
1188
+ /** Additional metadata for the cloned agent. */
1189
+ metadata?: Record<string, unknown>;
1190
+ /** Author identifier for the cloned agent. */
1191
+ authorId?: string;
1192
+ /** Visibility of the cloned agent. Defaults to 'private'. */
1193
+ visibility?: 'private' | 'public';
1194
+ /** Request context for resolving dynamic agent configuration (instructions, model, tools, etc.) */
1195
+ requestContext?: RequestContext | Record<string, any>;
1196
+ }
1197
+ /**
1198
+ * Parameters for creating a stored agent.
1199
+ * Flat union of agent-record fields and config fields.
1200
+ */
1201
+ export interface CreateStoredAgentParams {
1202
+ /** Unique identifier for the agent. If not provided, derived from name via slugify. */
1203
+ id?: string;
1204
+ authorId?: string;
1205
+ /** Visibility of the agent. Defaults to 'private'. */
1206
+ visibility?: 'private' | 'public';
1207
+ metadata?: Record<string, unknown>;
1208
+ name: string;
1209
+ description?: string;
1210
+ instructions: string | AgentInstructionBlock[];
1211
+ model: ConditionalField<{
1212
+ provider: string;
1213
+ name: string;
1214
+ [key: string]: unknown;
1215
+ }>;
1216
+ tools?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1217
+ defaultOptions?: ConditionalField<DefaultOptions>;
1218
+ workflows?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1219
+ agents?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1220
+ integrationTools?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
1221
+ toolProviders?: ConditionalField<Record<string, StoredToolProviderConfig>>;
1222
+ mcpClients?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
1223
+ inputProcessors?: ConditionalField<StoredProcessorGraph>;
1224
+ outputProcessors?: ConditionalField<StoredProcessorGraph>;
1225
+ memory?: ConditionalField<SerializedMemoryConfig>;
1226
+ scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
1227
+ skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
1228
+ workspace?: ConditionalField<StoredWorkspaceRef>;
1229
+ /** Browser config. `true` = use admin default, `false` = no browser. */
1230
+ browser?: ConditionalField<StoredBrowserRef> | boolean | null;
1231
+ requestContextSchema?: Record<string, unknown>;
1232
+ /**
1233
+ * Publish the initial version so the agent resolves at `status: 'published'`.
1234
+ * Defaults to true when omitted. Pass false to stage the agent as an unpublished
1235
+ * draft — useful when overriding a code-defined agent, whose code definition keeps
1236
+ * serving traffic until the override is published.
1237
+ */
1238
+ autoPublish?: boolean;
1239
+ }
1240
+ /**
1241
+ * Parameters for updating a stored agent
1242
+ */
1243
+ export type ExportStoredAgentParams = Partial<Omit<CreateStoredAgentParams, 'id' | 'authorId' | 'visibility' | 'metadata' | 'autoPublish'>>;
1244
+ export type OpenStoredAgentChangeRequestParams = ExportStoredAgentParams & {
1245
+ changeMessage?: string;
1246
+ userName?: string;
1247
+ inspectOnly?: boolean;
1248
+ };
1249
+ export interface ExportStoredAgentResponse {
1250
+ agentId: string;
1251
+ fileName: string;
1252
+ content: string;
1253
+ config: Record<string, unknown>;
1254
+ }
1255
+ export interface OpenStoredAgentChangeRequestResponse {
1256
+ id?: string | number;
1257
+ url: string;
1258
+ ref?: string;
1259
+ }
1260
+ export interface UpdateStoredAgentParams {
1261
+ authorId?: string;
1262
+ /** Visibility of the agent. */
1263
+ visibility?: 'private' | 'public';
1264
+ metadata?: Record<string, unknown>;
1265
+ name?: string;
1266
+ description?: string;
1267
+ instructions?: string | AgentInstructionBlock[];
1268
+ model?: ConditionalField<{
1269
+ provider: string;
1270
+ name: string;
1271
+ [key: string]: unknown;
1272
+ }>;
1273
+ tools?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1274
+ defaultOptions?: ConditionalField<DefaultOptions>;
1275
+ workflows?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1276
+ agents?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1277
+ integrationTools?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
1278
+ toolProviders?: ConditionalField<Record<string, StoredToolProviderConfig>>;
1279
+ mcpClients?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
1280
+ inputProcessors?: ConditionalField<StoredProcessorGraph>;
1281
+ outputProcessors?: ConditionalField<StoredProcessorGraph>;
1282
+ memory?: ConditionalField<SerializedMemoryConfig>;
1283
+ scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
1284
+ skills?: ConditionalField<Record<string, StoredAgentSkillConfig>>;
1285
+ workspace?: ConditionalField<StoredWorkspaceRef>;
1286
+ /** Browser config. `true` = use admin default, `false` = no browser. */
1287
+ browser?: ConditionalField<StoredBrowserRef> | boolean | null;
1288
+ requestContextSchema?: Record<string, unknown>;
1289
+ /** Optional message describing the changes for the auto-created version */
1290
+ changeMessage?: string;
1291
+ /** Immediately activate the auto-created version. Defaults to false when omitted. */
1292
+ autoPublish?: boolean;
1293
+ }
1294
+ /**
1295
+ * Response for deleting a stored agent
1296
+ */
1297
+ export interface DeleteStoredAgentResponse {
1298
+ success: boolean;
1299
+ message: string;
1300
+ }
1301
+ /**
1302
+ * A single agent that references another agent as a sub-agent. Includes both
1303
+ * public and the caller's own private agents — anything the caller can read.
1304
+ */
1305
+ export interface StoredAgentDependent {
1306
+ id: string;
1307
+ name: string;
1308
+ }
1309
+ /**
1310
+ * Response for listing dependents of a stored agent.
1311
+ * `dependents` lists caller-readable references (with names).
1312
+ * `hiddenCount` aggregates dependents the caller cannot read; it is only
1313
+ * non-zero when the target agent is public.
1314
+ */
1315
+ export interface StoredAgentDependentsResponse {
1316
+ dependents: StoredAgentDependent[];
1317
+ hiddenCount: number;
1318
+ }
1319
+ /**
1320
+ * Sampling configuration for scorers
1321
+ */
1322
+ export type ScorerSamplingConfig = {
1323
+ type: 'none';
1324
+ } | {
1325
+ type: 'ratio';
1326
+ rate: number;
1327
+ };
1328
+ /**
1329
+ * Scorer type discriminator
1330
+ */
1331
+ export type StoredScorerType = 'llm-judge' | 'answer-relevancy' | 'answer-similarity' | 'bias' | 'context-precision' | 'context-relevance' | 'faithfulness' | 'hallucination' | 'noise-sensitivity' | 'prompt-alignment' | 'tool-call-accuracy' | 'toxicity';
1332
+ /**
1333
+ * Stored scorer definition data returned from API
1334
+ */
1335
+ export interface StoredScorerResponse {
1336
+ id: string;
1337
+ status: string;
1338
+ activeVersionId?: string;
1339
+ authorId?: string;
1340
+ metadata?: Record<string, unknown>;
1341
+ createdAt: string;
1342
+ updatedAt: string;
1343
+ name: string;
1344
+ description?: string;
1345
+ type: StoredScorerType;
1346
+ model?: {
1347
+ provider: string;
1348
+ name: string;
1349
+ [key: string]: unknown;
1350
+ };
1351
+ instructions?: string;
1352
+ scoreRange?: {
1353
+ min?: number;
1354
+ max?: number;
1355
+ };
1356
+ presetConfig?: Record<string, unknown>;
1357
+ defaultSampling?: ScorerSamplingConfig;
1358
+ }
1359
+ /**
1360
+ * Parameters for listing stored scorer definitions
1361
+ */
1362
+ export interface ListStoredScorersParams {
1363
+ page?: number;
1364
+ perPage?: number;
1365
+ orderBy?: {
1366
+ field?: 'createdAt' | 'updatedAt';
1367
+ direction?: 'ASC' | 'DESC';
1368
+ };
1369
+ authorId?: string;
1370
+ metadata?: Record<string, unknown>;
1371
+ }
1372
+ /**
1373
+ * Response for listing stored scorer definitions
1374
+ */
1375
+ export interface ListStoredScorersResponse {
1376
+ scorerDefinitions: StoredScorerResponse[];
1377
+ total: number;
1378
+ page: number;
1379
+ perPage: number | false;
1380
+ hasMore: boolean;
1381
+ }
1382
+ /**
1383
+ * Parameters for creating a stored scorer definition
1384
+ */
1385
+ export interface CreateStoredScorerParams {
1386
+ id?: string;
1387
+ authorId?: string;
1388
+ metadata?: Record<string, unknown>;
1389
+ name: string;
1390
+ description?: string;
1391
+ type: StoredScorerType;
1392
+ model?: {
1393
+ provider: string;
1394
+ name: string;
1395
+ [key: string]: unknown;
1396
+ };
1397
+ instructions?: string;
1398
+ scoreRange?: {
1399
+ min?: number;
1400
+ max?: number;
1401
+ };
1402
+ presetConfig?: Record<string, unknown>;
1403
+ defaultSampling?: ScorerSamplingConfig;
1404
+ }
1405
+ /**
1406
+ * Parameters for updating a stored scorer definition
1407
+ */
1408
+ export interface UpdateStoredScorerParams {
1409
+ authorId?: string;
1410
+ metadata?: Record<string, unknown>;
1411
+ name?: string;
1412
+ description?: string;
1413
+ type?: StoredScorerType;
1414
+ model?: {
1415
+ provider: string;
1416
+ name: string;
1417
+ [key: string]: unknown;
1418
+ };
1419
+ instructions?: string;
1420
+ scoreRange?: {
1421
+ min?: number;
1422
+ max?: number;
1423
+ };
1424
+ presetConfig?: Record<string, unknown>;
1425
+ defaultSampling?: ScorerSamplingConfig;
1426
+ }
1427
+ /**
1428
+ * Response for deleting a stored scorer definition
1429
+ */
1430
+ export interface DeleteStoredScorerResponse {
1431
+ success: boolean;
1432
+ message: string;
1433
+ }
1434
+ /**
1435
+ * MCP server transport configuration
1436
+ */
1437
+ export interface StoredMCPServerConfig {
1438
+ type: 'stdio' | 'http';
1439
+ command?: string;
1440
+ args?: string[];
1441
+ env?: Record<string, string>;
1442
+ url?: string;
1443
+ timeout?: number;
1444
+ }
1445
+ /**
1446
+ * Stored MCP client data returned from API
1447
+ */
1448
+ export interface StoredMCPClientResponse {
1449
+ id: string;
1450
+ status: string;
1451
+ activeVersionId?: string;
1452
+ authorId?: string;
1453
+ metadata?: Record<string, unknown>;
1454
+ createdAt: string;
1455
+ updatedAt: string;
1456
+ name: string;
1457
+ description?: string;
1458
+ servers: Record<string, StoredMCPServerConfig>;
1459
+ }
1460
+ /**
1461
+ * Parameters for listing stored MCP clients
1462
+ */
1463
+ export interface ListStoredMCPClientsParams {
1464
+ page?: number;
1465
+ perPage?: number;
1466
+ orderBy?: {
1467
+ field?: 'createdAt' | 'updatedAt';
1468
+ direction?: 'ASC' | 'DESC';
1469
+ };
1470
+ authorId?: string;
1471
+ metadata?: Record<string, unknown>;
1472
+ }
1473
+ /**
1474
+ * Response for listing stored MCP clients
1475
+ */
1476
+ export interface ListStoredMCPClientsResponse {
1477
+ mcpClients: StoredMCPClientResponse[];
1478
+ total: number;
1479
+ page: number;
1480
+ perPage: number | false;
1481
+ hasMore: boolean;
1482
+ }
1483
+ /**
1484
+ * Parameters for creating a stored MCP client
1485
+ */
1486
+ export interface CreateStoredMCPClientParams {
1487
+ id?: string;
1488
+ authorId?: string;
1489
+ metadata?: Record<string, unknown>;
1490
+ name: string;
1491
+ description?: string;
1492
+ servers: Record<string, StoredMCPServerConfig>;
1493
+ }
1494
+ /**
1495
+ * Parameters for updating a stored MCP client
1496
+ */
1497
+ export interface UpdateStoredMCPClientParams {
1498
+ authorId?: string;
1499
+ metadata?: Record<string, unknown>;
1500
+ name?: string;
1501
+ description?: string;
1502
+ servers?: Record<string, StoredMCPServerConfig>;
1503
+ }
1504
+ /**
1505
+ * Response for deleting a stored MCP client
1506
+ */
1507
+ export interface DeleteStoredMCPClientResponse {
1508
+ success: boolean;
1509
+ message: string;
1510
+ }
1511
+ export interface AgentVersionResponse {
1512
+ id: string;
1513
+ agentId: string;
1514
+ versionNumber: number;
1515
+ name: string;
1516
+ description?: string;
1517
+ instructions: string | AgentInstructionBlock[];
1518
+ model: ConditionalField<{
1519
+ provider: string;
1520
+ name: string;
1521
+ [key: string]: unknown;
1522
+ }>;
1523
+ tools?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1524
+ defaultOptions?: ConditionalField<DefaultOptions>;
1525
+ workflows?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1526
+ agents?: ConditionalField<Record<string, StoredAgentToolConfig>>;
1527
+ integrationTools?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
1528
+ toolProviders?: ConditionalField<Record<string, StoredToolProviderConfig>>;
1529
+ mcpClients?: ConditionalField<Record<string, StoredMCPClientToolsConfig>>;
1530
+ inputProcessors?: ConditionalField<StoredProcessorGraph>;
1531
+ outputProcessors?: ConditionalField<StoredProcessorGraph>;
1532
+ memory?: ConditionalField<SerializedMemoryConfig>;
1533
+ scorers?: ConditionalField<Record<string, StoredAgentScorerConfig>>;
1534
+ requestContextSchema?: Record<string, unknown>;
1535
+ changedFields?: string[];
1536
+ changeMessage?: string;
1537
+ createdAt: string;
1538
+ }
1539
+ export interface ListAgentVersionsParams {
1540
+ page?: number;
1541
+ perPage?: number;
1542
+ orderBy?: {
1543
+ field?: 'versionNumber' | 'createdAt';
1544
+ direction?: 'ASC' | 'DESC';
1545
+ };
1546
+ }
1547
+ export interface ListAgentVersionsResponse {
1548
+ versions: AgentVersionResponse[];
1549
+ total: number;
1550
+ page: number;
1551
+ perPage: number | false;
1552
+ hasMore: boolean;
1553
+ }
1554
+ export interface CreateAgentVersionParams {
1555
+ changeMessage?: string;
1556
+ }
1557
+ export interface CreateCodeAgentVersionParams {
1558
+ instructions?: AgentVersionResponse['instructions'];
1559
+ tools?: AgentVersionResponse['tools'];
1560
+ changeMessage?: string;
1561
+ }
1562
+ export interface CreateAgentVersionResponse {
1563
+ version: AgentVersionResponse;
1564
+ }
1565
+ export interface ActivateAgentVersionResponse {
1566
+ success: boolean;
1567
+ message: string;
1568
+ activeVersionId: string;
1569
+ }
1570
+ export interface RestoreAgentVersionResponse {
1571
+ success: boolean;
1572
+ message: string;
1573
+ version: AgentVersionResponse;
1574
+ }
1575
+ export interface DeleteAgentVersionResponse {
1576
+ success: boolean;
1577
+ message: string;
1578
+ }
1579
+ export interface VersionDiff {
1580
+ field: string;
1581
+ previousValue: any;
1582
+ currentValue: any;
1583
+ changeType?: 'added' | 'removed' | 'modified';
1584
+ }
1585
+ export type AgentVersionDiff = VersionDiff;
1586
+ export interface CompareVersionsResponse {
1587
+ fromVersion: AgentVersionResponse;
1588
+ toVersion: AgentVersionResponse;
1589
+ diffs: VersionDiff[];
1590
+ }
1591
+ export interface ScorerVersionResponse {
1592
+ id: string;
1593
+ scorerDefinitionId: string;
1594
+ versionNumber: number;
1595
+ name: string;
1596
+ description?: string;
1597
+ type: StoredScorerType;
1598
+ model?: {
1599
+ provider: string;
1600
+ name: string;
1601
+ [key: string]: unknown;
1602
+ };
1603
+ instructions?: string;
1604
+ scoreRange?: {
1605
+ min?: number;
1606
+ max?: number;
1607
+ };
1608
+ presetConfig?: Record<string, unknown>;
1609
+ defaultSampling?: ScorerSamplingConfig;
1610
+ changedFields?: string[];
1611
+ changeMessage?: string;
1612
+ createdAt: string;
1613
+ }
1614
+ export interface ListScorerVersionsParams {
1615
+ page?: number;
1616
+ perPage?: number;
1617
+ orderBy?: {
1618
+ field?: 'versionNumber' | 'createdAt';
1619
+ direction?: 'ASC' | 'DESC';
1620
+ };
1621
+ }
1622
+ export interface ListScorerVersionsResponse {
1623
+ versions: ScorerVersionResponse[];
1624
+ total: number;
1625
+ page: number;
1626
+ perPage: number | false;
1627
+ hasMore: boolean;
1628
+ }
1629
+ export interface CreateScorerVersionParams {
1630
+ changeMessage?: string;
1631
+ }
1632
+ export interface ActivateScorerVersionResponse {
1633
+ success: boolean;
1634
+ message: string;
1635
+ activeVersionId: string;
1636
+ }
1637
+ export interface DeleteScorerVersionResponse {
1638
+ success: boolean;
1639
+ message: string;
1640
+ }
1641
+ export interface CompareScorerVersionsResponse {
1642
+ fromVersion: ScorerVersionResponse;
1643
+ toVersion: ScorerVersionResponse;
1644
+ diffs: VersionDiff[];
1645
+ }
1646
+ export type ListAgentsModelProvidersResponse = GeneratedResponse<'GET /agents/providers'>;
1647
+ export interface Provider {
1648
+ id: string;
1649
+ name: string;
1650
+ envVar: string | string[];
1651
+ connected: boolean;
1652
+ docUrl?: string;
1653
+ models: string[];
1654
+ }
1655
+ export interface MastraPackage {
1656
+ name: string;
1657
+ version: string;
1658
+ }
1659
+ export type GetSystemPackagesResponse = GeneratedResponse<'GET /system/packages'>;
1660
+ /**
1661
+ * Workspace capabilities
1662
+ */
1663
+ export type WorkspaceCapabilities = ListWorkspacesResponse['workspaces'][number]['capabilities'];
1664
+ /**
1665
+ * Workspace safety configuration
1666
+ */
1667
+ export type WorkspaceSafety = ListWorkspacesResponse['workspaces'][number]['safety'];
1668
+ /**
1669
+ * Response for getting workspace info
1670
+ */
1671
+ export type WorkspaceInfoResponse = GeneratedResponse<'GET /workspaces/:workspaceId'>;
1672
+ /**
1673
+ * Workspace item in list response
1674
+ */
1675
+ export type WorkspaceItem = ListWorkspacesResponse['workspaces'][number];
1676
+ /**
1677
+ * Response for listing all workspaces
1678
+ */
1679
+ export type ListWorkspacesResponse = GeneratedResponse<'GET /workspaces'>;
1680
+ /**
1681
+ * File entry in directory listing
1682
+ */
1683
+ export interface WorkspaceFileEntry {
1684
+ name: string;
1685
+ type: 'file' | 'directory';
1686
+ size?: number;
1687
+ }
1688
+ /**
1689
+ * Response for reading a file
1690
+ */
1691
+ export type WorkspaceFsReadResponse = GeneratedResponse<'GET /workspaces/:workspaceId/fs/read'>;
1692
+ /**
1693
+ * Response for writing a file
1694
+ */
1695
+ export type WorkspaceFsWriteResponse = GeneratedResponse<'POST /workspaces/:workspaceId/fs/write'>;
1696
+ /**
1697
+ * Response for listing files
1698
+ */
1699
+ export type WorkspaceFsListResponse = GeneratedResponse<'GET /workspaces/:workspaceId/fs/list'>;
1700
+ /**
1701
+ * Response for deleting a file
1702
+ */
1703
+ export type WorkspaceFsDeleteResponse = GeneratedResponse<'DELETE /workspaces/:workspaceId/fs/delete'>;
1704
+ /**
1705
+ * Response for creating a directory
1706
+ */
1707
+ export type WorkspaceFsMkdirResponse = GeneratedResponse<'POST /workspaces/:workspaceId/fs/mkdir'>;
1708
+ /**
1709
+ * Response for getting file stats
1710
+ */
1711
+ export type WorkspaceFsStatResponse = GeneratedResponse<'GET /workspaces/:workspaceId/fs/stat'>;
1712
+ /**
1713
+ * Workspace search result
1714
+ */
1715
+ export interface WorkspaceSearchResult {
1716
+ /** Document identifier (typically the indexed file path) */
1717
+ id: string;
1718
+ content: string;
1719
+ score: number;
1720
+ lineRange?: {
1721
+ start: number;
1722
+ end: number;
1723
+ };
1724
+ scoreDetails?: {
1725
+ vector?: number;
1726
+ bm25?: number;
1727
+ };
1728
+ }
1729
+ /**
1730
+ * Parameters for searching workspace content
1731
+ */
1732
+ export type WorkspaceSearchParams = GeneratedRequest<QueryParams<'GET /workspaces/:workspaceId/search'>>;
1733
+ /**
1734
+ * Response for searching workspace
1735
+ */
1736
+ export type WorkspaceSearchResponse = GeneratedResponse<'GET /workspaces/:workspaceId/search'>;
1737
+ /**
1738
+ * Parameters for indexing content
1739
+ */
1740
+ export type WorkspaceIndexParams = GeneratedRequest<Body<'POST /workspaces/:workspaceId/index'>>;
1741
+ /**
1742
+ * Response for indexing content
1743
+ */
1744
+ export type WorkspaceIndexResponse = GeneratedResponse<'POST /workspaces/:workspaceId/index'>;
1745
+ /**
1746
+ * Skill source type indicating where the skill comes from
1747
+ */
1748
+ export type SkillSource = {
1749
+ type: 'external';
1750
+ packagePath: string;
1751
+ } | {
1752
+ type: 'local';
1753
+ projectPath: string;
1754
+ } | {
1755
+ type: 'managed';
1756
+ mastraPath: string;
1757
+ };
1758
+ /**
1759
+ * Skill metadata (without instructions content)
1760
+ */
1761
+ export interface SkillMetadata {
1762
+ name: string;
1763
+ description: string;
1764
+ license?: string;
1765
+ compatibility?: string;
1766
+ metadata?: Record<string, string>;
1767
+ path: string;
1768
+ }
1769
+ /**
1770
+ * Full skill data including instructions and file paths
1771
+ */
1772
+ export interface Skill extends SkillMetadata {
1773
+ instructions: string;
1774
+ source: SkillSource;
1775
+ references: string[];
1776
+ scripts: string[];
1777
+ assets: string[];
1778
+ }
1779
+ /**
1780
+ * Response for listing skills
1781
+ */
1782
+ export interface ListSkillsResponse {
1783
+ skills: SkillMetadata[];
1784
+ isSkillsConfigured: boolean;
1785
+ }
1786
+ /**
1787
+ * Skill search result
1788
+ */
1789
+ export interface SkillSearchResult {
1790
+ skillName: string;
1791
+ source: string;
1792
+ content: string;
1793
+ score: number;
1794
+ lineRange?: {
1795
+ start: number;
1796
+ end: number;
1797
+ };
1798
+ scoreDetails?: {
1799
+ vector?: number;
1800
+ bm25?: number;
1801
+ };
1802
+ }
1803
+ /**
1804
+ * Parameters for searching skills
1805
+ */
1806
+ export interface SearchSkillsParams {
1807
+ query: string;
1808
+ topK?: number;
1809
+ minScore?: number;
1810
+ skillNames?: string[];
1811
+ includeReferences?: boolean;
1812
+ }
1813
+ /**
1814
+ * Response for searching skills
1815
+ */
1816
+ export interface SearchSkillsResponse {
1817
+ results: SkillSearchResult[];
1818
+ query: string;
1819
+ }
1820
+ /**
1821
+ * Response for listing skill references
1822
+ */
1823
+ export interface ListSkillReferencesResponse {
1824
+ skillName: string;
1825
+ references: string[];
1826
+ }
1827
+ /**
1828
+ * Response for getting skill reference content
1829
+ */
1830
+ export interface GetSkillReferenceResponse {
1831
+ skillName: string;
1832
+ referencePath: string;
1833
+ content: string;
1834
+ }
1835
+ /**
1836
+ * File node for skill workspace
1837
+ */
1838
+ export interface StoredSkillFileNode {
1839
+ id: string;
1840
+ name: string;
1841
+ type: 'file' | 'folder';
1842
+ content?: string;
1843
+ children?: StoredSkillFileNode[];
1844
+ }
1845
+ /**
1846
+ * Stored skill data returned from API
1847
+ */
1848
+ export interface StoredSkillResponse {
1849
+ id: string;
1850
+ status: string;
1851
+ authorId?: string;
1852
+ visibility?: 'private' | 'public';
1853
+ metadata?: Record<string, unknown>;
1854
+ createdAt: string;
1855
+ updatedAt: string;
1856
+ name: string;
1857
+ description?: string;
1858
+ instructions: string;
1859
+ license?: string;
1860
+ files?: StoredSkillFileNode[];
1861
+ isFavorited?: boolean;
1862
+ favoriteCount?: number;
1863
+ }
1864
+ /**
1865
+ * Parameters for listing stored skills
1866
+ */
1867
+ export interface ListStoredSkillsParams {
1868
+ page?: number;
1869
+ perPage?: number;
1870
+ orderBy?: {
1871
+ field?: 'createdAt' | 'updatedAt';
1872
+ direction?: 'ASC' | 'DESC';
1873
+ };
1874
+ authorId?: string;
1875
+ /**
1876
+ * Restrict the list to public records. Only `'public'` is accepted by the
1877
+ * server filter; private records are surfaced via the default scope-aware
1878
+ * filter (caller's own rows + legacy unowned).
1879
+ */
1880
+ visibility?: 'public';
1881
+ metadata?: Record<string, unknown>;
1882
+ /** When true, only return skills favorited by the caller (or by `pinFavoritedFor`). */
1883
+ favoritedOnly?: boolean;
1884
+ /** When set, sort favorited-first for this user id. Required for `favoritedOnly`. */
1885
+ pinFavoritedFor?: string;
1886
+ }
1887
+ /**
1888
+ * Response for listing stored skills
1889
+ */
1890
+ export interface ListStoredSkillsResponse {
1891
+ skills: StoredSkillResponse[];
1892
+ total: number;
1893
+ page: number;
1894
+ perPage: number | false;
1895
+ hasMore: boolean;
1896
+ }
1897
+ /**
1898
+ * Parameters for creating a stored skill
1899
+ */
1900
+ export interface CreateStoredSkillParams {
1901
+ id?: string;
1902
+ authorId?: string;
1903
+ /** Visibility of the skill. Defaults to 'private'. */
1904
+ visibility?: 'private' | 'public';
1905
+ metadata?: Record<string, unknown>;
1906
+ name: string;
1907
+ /** Required by the server: description of what the skill does and when to use it. */
1908
+ description: string;
1909
+ instructions: string;
1910
+ license?: string;
1911
+ files?: StoredSkillFileNode[];
1912
+ }
1913
+ /**
1914
+ * Parameters for updating a stored skill
1915
+ */
1916
+ export interface UpdateStoredSkillParams {
1917
+ authorId?: string;
1918
+ /** Visibility of the skill. */
1919
+ visibility?: 'private' | 'public';
1920
+ metadata?: Record<string, unknown>;
1921
+ name?: string;
1922
+ description?: string;
1923
+ instructions?: string;
1924
+ license?: string;
1925
+ files?: StoredSkillFileNode[];
1926
+ }
1927
+ /**
1928
+ * Response for deleting a stored skill
1929
+ */
1930
+ export interface DeleteStoredSkillResponse {
1931
+ success: boolean;
1932
+ message: string;
1933
+ }
1934
+ /**
1935
+ * Filesystem configuration in a stored workspace
1936
+ */
1937
+ export interface StoredFilesystemConfig {
1938
+ provider: string;
1939
+ config: Record<string, unknown>;
1940
+ readOnly?: boolean;
1941
+ }
1942
+ /**
1943
+ * Sandbox configuration in a stored workspace
1944
+ */
1945
+ export interface StoredSandboxConfig {
1946
+ provider: string;
1947
+ config: Record<string, unknown>;
1948
+ }
1949
+ /**
1950
+ * Stored workspace data returned from API
1951
+ */
1952
+ export interface StoredWorkspaceResponse {
1953
+ id: string;
1954
+ status: string;
1955
+ activeVersionId?: string;
1956
+ authorId?: string;
1957
+ metadata?: Record<string, unknown>;
1958
+ createdAt: string;
1959
+ updatedAt: string;
1960
+ name: string;
1961
+ description?: string;
1962
+ filesystem?: StoredFilesystemConfig;
1963
+ sandbox?: StoredSandboxConfig;
1964
+ mounts?: Record<string, StoredFilesystemConfig>;
1965
+ skills?: string[];
1966
+ tools?: {
1967
+ enabled?: boolean;
1968
+ requireApproval?: boolean;
1969
+ tools?: Record<string, {
1970
+ enabled?: boolean;
1971
+ requireApproval?: boolean;
1972
+ }>;
1973
+ };
1974
+ autoSync?: boolean;
1975
+ operationTimeout?: number;
1976
+ /** Whether this workspace is registered at runtime (only present in list responses) */
1977
+ runtimeRegistered?: boolean;
1978
+ }
1979
+ /**
1980
+ * Parameters for listing stored workspaces
1981
+ */
1982
+ export interface ListStoredWorkspacesParams {
1983
+ page?: number;
1984
+ perPage?: number;
1985
+ orderBy?: {
1986
+ field?: 'createdAt' | 'updatedAt';
1987
+ direction?: 'ASC' | 'DESC';
1988
+ };
1989
+ authorId?: string;
1990
+ metadata?: Record<string, unknown>;
1991
+ }
1992
+ /**
1993
+ * Response for listing stored workspaces
1994
+ */
1995
+ export interface ListStoredWorkspacesResponse {
1996
+ workspaces: StoredWorkspaceResponse[];
1997
+ total: number;
1998
+ page: number;
1999
+ perPage: number | false;
2000
+ hasMore: boolean;
2001
+ }
2002
+ /**
2003
+ * Processor phase types
2004
+ */
2005
+ export type ProcessorPhase = 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep';
2006
+ /**
2007
+ * Processor configuration showing how it's attached to an agent
2008
+ */
2009
+ export interface ProcessorConfiguration {
2010
+ agentId: string;
2011
+ agentName: string;
2012
+ type: 'input' | 'output';
2013
+ }
2014
+ /**
2015
+ * Processor in list response
2016
+ */
2017
+ export interface GetProcessorResponse {
2018
+ id: string;
2019
+ name?: string;
2020
+ description?: string;
2021
+ phases: ProcessorPhase[];
2022
+ agentIds: string[];
2023
+ isWorkflow: boolean;
2024
+ }
2025
+ /**
2026
+ * Detailed processor response
2027
+ */
2028
+ export interface GetProcessorDetailResponse {
2029
+ id: string;
2030
+ name?: string;
2031
+ description?: string;
2032
+ phases: ProcessorPhase[];
2033
+ configurations: ProcessorConfiguration[];
2034
+ isWorkflow: boolean;
2035
+ }
2036
+ /**
2037
+ * Parameters for executing a processor
2038
+ */
2039
+ export interface ExecuteProcessorParams {
2040
+ phase: ProcessorPhase;
2041
+ messages: MastraDBMessage[];
2042
+ agentId?: string;
2043
+ requestContext?: RequestContext | Record<string, any>;
2044
+ }
2045
+ /**
2046
+ * Tripwire result from processor execution
2047
+ */
2048
+ export interface ProcessorTripwireResult {
2049
+ triggered: boolean;
2050
+ reason?: string;
2051
+ metadata?: unknown;
2052
+ }
2053
+ /**
2054
+ * Response from processor execution
2055
+ */
2056
+ export interface ExecuteProcessorResponse {
2057
+ success: boolean;
2058
+ phase: string;
2059
+ messages?: MastraDBMessage[];
2060
+ messageList?: {
2061
+ messages: MastraDBMessage[];
2062
+ };
2063
+ tripwire?: ProcessorTripwireResult;
2064
+ error?: string;
2065
+ }
2066
+ /**
2067
+ * Parameters for getting observational memory
2068
+ */
2069
+ export type GetObservationalMemoryParams = Omit<GeneratedRequest<QueryParams<'GET /memory/observational-memory'>>, 'from' | 'to'> & {
2070
+ from?: Date | string;
2071
+ to?: Date | string;
2072
+ } & RequestContextOptions;
2073
+ /**
2074
+ * Response for observational memory endpoint
2075
+ */
2076
+ export type GetObservationalMemoryResponse = GeneratedResponse<'GET /memory/observational-memory'>;
2077
+ /**
2078
+ * Parameters for awaiting buffer status
2079
+ */
2080
+ export type AwaitBufferStatusParams = GeneratedRequest<Body<'POST /memory/observational-memory/buffer-status'>> & RequestContextOptions;
2081
+ /**
2082
+ * Response for buffer status endpoint
2083
+ */
2084
+ export type AwaitBufferStatusResponse = GeneratedResponse<'POST /memory/observational-memory/buffer-status'>;
2085
+ /**
2086
+ * Extended memory status response with OM info
2087
+ */
2088
+ export type GetMemoryStatusResponse = GeneratedResponse<'GET /memory/status'>;
2089
+ /**
2090
+ * Extended memory config response with OM config
2091
+ */
2092
+ export interface GetMemoryConfigResponseExtended {
2093
+ memoryType?: 'local' | 'gateway';
2094
+ config: MemoryConfig & {
2095
+ observationalMemory?: {
2096
+ enabled: boolean;
2097
+ scope?: 'thread' | 'resource';
2098
+ messageTokens?: number | {
2099
+ min: number;
2100
+ max: number;
2101
+ };
2102
+ observationTokens?: number | {
2103
+ min: number;
2104
+ max: number;
2105
+ };
2106
+ observationModel?: string;
2107
+ reflectionModel?: string;
2108
+ };
2109
+ };
2110
+ }
2111
+ /**
2112
+ * Response for listing available vector stores
2113
+ */
2114
+ export type ListVectorsResponse = GeneratedResponse<'GET /vectors'>;
2115
+ /**
2116
+ * Response for listing available embedding models
2117
+ */
2118
+ export type ListEmbeddersResponse = GeneratedResponse<'GET /embedders'>;
2119
+ export type ToolProviderInfo = GeneratedResponse<'GET /tool-providers'>['providers'][number];
2120
+ export type ToolProviderToolkit = GeneratedResponse<'GET /tool-providers/:providerId/toolkits'>['data'][number];
2121
+ export type ToolProviderToolInfo = GeneratedResponse<'GET /tool-providers/:providerId/tools'>['data'][number];
2122
+ export type ToolProviderPagination = NonNullable<GeneratedResponse<'GET /tool-providers/:providerId/toolkits'>['pagination']>;
2123
+ export type ListToolProvidersResponse = GeneratedResponse<'GET /tool-providers'>;
2124
+ export type ListToolProviderToolkitsResponse = GeneratedResponse<'GET /tool-providers/:providerId/toolkits'>;
2125
+ export type ListToolProviderToolsParams = GeneratedRequest<QueryParams<'GET /tool-providers/:providerId/tools'>>;
2126
+ export type ListToolProviderToolsResponse = GeneratedResponse<'GET /tool-providers/:providerId/tools'>;
2127
+ export type GetToolProviderToolSchemaResponse = GeneratedResponse<'GET /tool-providers/:providerId/tools/:toolSlug/schema'>;
2128
+ export type AuthorizeToolProviderParams = GeneratedRequest<Body<'POST /tool-providers/:providerId/authorize'>>;
2129
+ export type AuthorizeToolProviderResponse = GeneratedResponse<'POST /tool-providers/:providerId/authorize'>;
2130
+ export type ToolProviderAuthStatusResponse = GeneratedResponse<'GET /tool-providers/:providerId/auth-status/:authId'>;
2131
+ export type ToolProviderConnectionStatusParams = GeneratedRequest<Body<'POST /tool-providers/:providerId/connection-status'>>;
2132
+ export type ToolProviderConnectionStatusResponse = GeneratedResponse<'POST /tool-providers/:providerId/connection-status'>;
2133
+ export type ListToolProviderConnectionsParams = GeneratedRequest<QueryParams<'GET /tool-providers/:providerId/connections'>>;
2134
+ export type ListToolProviderConnectionsResponse = GeneratedResponse<'GET /tool-providers/:providerId/connections'>;
2135
+ export type ListToolProviderConnectionFieldsParams = GeneratedRequest<QueryParams<'GET /tool-providers/:providerId/connection-fields'>>;
2136
+ export type ListToolProviderConnectionFieldsResponse = GeneratedResponse<'GET /tool-providers/:providerId/connection-fields'>;
2137
+ export type DisconnectToolProviderConnectionParams = GeneratedRequest<QueryParams<'DELETE /tool-providers/:providerId/connections/:connectionId'>>;
2138
+ export type DisconnectToolProviderConnectionResponse = GeneratedResponse<'DELETE /tool-providers/:providerId/connections/:connectionId'>;
2139
+ export type UpdateToolProviderConnectionParams = GeneratedRequest<Body<'PATCH /tool-providers/:providerId/connections/:connectionId'>>;
2140
+ export type UpdateToolProviderConnectionResponse = GeneratedResponse<'PATCH /tool-providers/:providerId/connections/:connectionId'>;
2141
+ export type GetToolProviderConnectionUsageParams = GeneratedRequest<QueryParams<'GET /tool-providers/:providerId/connections/:connectionId/usage'>>;
2142
+ export type GetToolProviderConnectionUsageResponse = GeneratedResponse<'GET /tool-providers/:providerId/connections/:connectionId/usage'>;
2143
+ export type ToolProviderHealthResponse = GeneratedResponse<'GET /tool-providers/:providerId/health'>;
2144
+ /**
2145
+ * Provider phase names as returned by the server (prefixed form).
2146
+ * Distinct from ProcessorPhase which uses the short/unprefixed form for processor endpoints.
2147
+ */
2148
+ export type ProcessorProviderPhase = 'processInput' | 'processInputStep' | 'processOutputStream' | 'processOutputResult' | 'processOutputStep';
2149
+ export interface ProcessorProviderInfo {
2150
+ id: string;
2151
+ name: string;
2152
+ description?: string;
2153
+ availablePhases: ProcessorProviderPhase[];
2154
+ }
2155
+ export interface GetProcessorProvidersResponse {
2156
+ providers: ProcessorProviderInfo[];
2157
+ }
2158
+ export interface GetProcessorProviderResponse {
2159
+ id: string;
2160
+ name: string;
2161
+ description?: string;
2162
+ availablePhases: ProcessorProviderPhase[];
2163
+ configSchema: Record<string, unknown>;
2164
+ }
2165
+ /**
2166
+ * HTTP error thrown by the Mastra client.
2167
+ * Extends Error with additional properties for better error handling.
2168
+ *
2169
+ * @example
2170
+ * ```typescript
2171
+ * try {
2172
+ * await client.getWorkspace('my-workspace').listFiles('/invalid-path');
2173
+ * } catch (error) {
2174
+ * if (error instanceof MastraClientError) {
2175
+ * if (error.status === 404) {
2176
+ * console.log('Not found:', error.body);
2177
+ * }
2178
+ * }
2179
+ * }
2180
+ * ```
2181
+ */
2182
+ export declare class MastraClientError extends Error {
2183
+ /** HTTP status code */
2184
+ readonly status: number;
2185
+ /** HTTP status text (e.g., "Not Found", "Internal Server Error") */
2186
+ readonly statusText: string;
2187
+ /** Parsed response body if available */
2188
+ readonly body?: unknown;
2189
+ constructor(status: number, statusText: string, message: string, body?: unknown);
2190
+ }
2191
+ export interface DatasetItemSource {
2192
+ type: 'csv' | 'json' | 'trace' | 'llm' | 'experiment-result' | 'candidate-screener';
2193
+ referenceId?: string;
2194
+ }
2195
+ /** A single item-level static tool mock (agent targets only). */
2196
+ export interface DatasetItemToolMock {
2197
+ /** Name of the tool this mock applies to. */
2198
+ toolName: string;
2199
+ /** Arguments to match against the tool call (deep equality when matchArgs is 'strict'). */
2200
+ args: Record<string, unknown>;
2201
+ /** Output served to the agent when this mock is matched and consumed. */
2202
+ output: unknown;
2203
+ /** Argument matching mode. 'strict' (default) deep-equals args; 'ignore' matches on toolName only. */
2204
+ matchArgs?: 'strict' | 'ignore';
2205
+ }
2206
+ /** Diagnostic receipt for item-level tool mocks, returned on experiment results. */
2207
+ export interface ToolMockReport {
2208
+ served: Array<{
2209
+ mockIndex: number;
2210
+ toolName: string;
2211
+ args: unknown;
2212
+ }>;
2213
+ unconsumed: Array<{
2214
+ mockIndex: number;
2215
+ toolName: string;
2216
+ args: unknown;
2217
+ }>;
2218
+ liveCalls: Array<{
2219
+ toolName: string;
2220
+ args: unknown;
2221
+ }>;
2222
+ failure?: {
2223
+ code: 'TOOL_MOCK_MISMATCH' | 'TOOL_MOCK_EXHAUSTED';
2224
+ toolName: string;
2225
+ args: unknown;
2226
+ };
2227
+ }
2228
+ export interface DatasetItem {
2229
+ id: string;
2230
+ datasetId: string;
2231
+ datasetVersion: number;
2232
+ externalId?: string | null;
2233
+ input: unknown;
2234
+ groundTruth?: unknown;
2235
+ expectedTrajectory?: unknown;
2236
+ toolMocks?: DatasetItemToolMock[];
2237
+ scorerIds?: string[];
2238
+ requestContext?: Record<string, unknown>;
2239
+ metadata?: unknown;
2240
+ source?: DatasetItemSource;
2241
+ createdAt: string | Date;
2242
+ updatedAt: string | Date;
2243
+ }
2244
+ export interface DatasetRecord {
2245
+ id: string;
2246
+ name: string;
2247
+ description?: string | null;
2248
+ metadata?: Record<string, unknown> | null;
2249
+ inputSchema?: Record<string, unknown>;
2250
+ groundTruthSchema?: Record<string, unknown>;
2251
+ requestContextSchema?: Record<string, unknown>;
2252
+ tags?: string[] | null;
2253
+ targetType?: string | null;
2254
+ targetIds?: string[] | null;
2255
+ scorerIds?: string[] | null;
2256
+ version: number;
2257
+ createdAt: string | Date;
2258
+ updatedAt: string | Date;
2259
+ }
2260
+ export interface ExperimentProvenance {
2261
+ source?: string;
2262
+ sourceId?: string;
2263
+ sourceVersion?: string;
2264
+ metadata?: Record<string, unknown>;
2265
+ }
2266
+ export interface ExperimentRunnerAttestation {
2267
+ runnerId: string;
2268
+ invocationId: string;
2269
+ runnerVersion?: string;
2270
+ }
2271
+ export interface ExperimentGrouping {
2272
+ experimentSetId?: string;
2273
+ comparisonId?: string;
2274
+ variantId?: string;
2275
+ trialIndex?: number;
2276
+ }
2277
+ export interface ListExperimentsParams extends ExperimentGrouping {
2278
+ page?: number;
2279
+ perPage?: number;
2280
+ }
2281
+ export interface DatasetExperiment {
2282
+ id: string;
2283
+ datasetId: string | null;
2284
+ datasetVersion: number | null;
2285
+ agentVersion: string | null;
2286
+ targetType: 'agent' | 'workflow' | 'scorer' | 'processor';
2287
+ targetId: string;
2288
+ /** Human-readable name used as the primary label wherever the experiment is displayed. */
2289
+ name?: string;
2290
+ /** Longer description shown as secondary detail (e.g. in a tooltip). */
2291
+ description?: string;
2292
+ provenance: ExperimentProvenance | null;
2293
+ runnerAttestation: ExperimentRunnerAttestation | null;
2294
+ experimentSetId: string | null;
2295
+ comparisonId: string | null;
2296
+ variantId: string | null;
2297
+ trialIndex: number | null;
2298
+ status: 'pending' | 'running' | 'completed' | 'failed';
2299
+ totalItems: number;
2300
+ succeededCount: number;
2301
+ failedCount: number;
2302
+ startedAt: string | Date | null;
2303
+ completedAt: string | Date | null;
2304
+ createdAt: string | Date;
2305
+ updatedAt: string | Date;
2306
+ }
2307
+ export interface DatasetExperimentResult {
2308
+ id: string;
2309
+ experimentId: string;
2310
+ itemId: string;
2311
+ itemDatasetVersion: number | null;
2312
+ input: unknown;
2313
+ output: unknown | null;
2314
+ groundTruth: unknown | null;
2315
+ error: string | null;
2316
+ startedAt: string | Date;
2317
+ completedAt: string | Date;
2318
+ retryCount: number;
2319
+ traceId: string | null;
2320
+ status: 'needs-review' | 'reviewed' | 'complete' | null;
2321
+ tags: string[] | null;
2322
+ comment?: string | null;
2323
+ toolMockReport?: ToolMockReport | null;
2324
+ scores: Array<{
2325
+ scorerId: string;
2326
+ scorerName: string;
2327
+ score: number | null;
2328
+ reason: string | null;
2329
+ error: string | null;
2330
+ }>;
2331
+ createdAt: string | Date;
2332
+ }
2333
+ export interface UpdateExperimentResultParams {
2334
+ datasetId: string;
2335
+ experimentId: string;
2336
+ resultId: string;
2337
+ status?: 'needs-review' | 'reviewed' | 'complete' | null;
2338
+ tags?: string[];
2339
+ comment?: string | null;
2340
+ }
2341
+ export interface CreateDatasetParams {
2342
+ name: string;
2343
+ description?: string;
2344
+ metadata?: Record<string, unknown>;
2345
+ inputSchema?: Record<string, unknown> | null;
2346
+ groundTruthSchema?: Record<string, unknown> | null;
2347
+ requestContextSchema?: Record<string, unknown> | null;
2348
+ targetType?: string;
2349
+ targetIds?: string[];
2350
+ scorerIds?: string[];
2351
+ }
2352
+ export interface UpdateDatasetParams {
2353
+ datasetId: string;
2354
+ name?: string;
2355
+ description?: string;
2356
+ metadata?: Record<string, unknown>;
2357
+ inputSchema?: Record<string, unknown> | null;
2358
+ groundTruthSchema?: Record<string, unknown> | null;
2359
+ requestContextSchema?: Record<string, unknown> | null;
2360
+ tags?: string[];
2361
+ targetType?: string;
2362
+ targetIds?: string[];
2363
+ scorerIds?: string[] | null;
2364
+ /** Restrict the lookup to a specific tenant organization. */
2365
+ organizationId?: string;
2366
+ /** Restrict the lookup to a specific tenant project. */
2367
+ projectId?: string;
2368
+ }
2369
+ export interface AddDatasetItemParams {
2370
+ datasetId: string;
2371
+ externalId?: string;
2372
+ input: unknown;
2373
+ groundTruth?: unknown;
2374
+ expectedTrajectory?: unknown;
2375
+ toolMocks?: DatasetItemToolMock[];
2376
+ scorerIds?: string[];
2377
+ requestContext?: Record<string, unknown>;
2378
+ metadata?: Record<string, unknown>;
2379
+ source?: DatasetItemSource;
2380
+ }
2381
+ export interface UpdateDatasetItemParams {
2382
+ datasetId: string;
2383
+ itemId: string;
2384
+ input?: unknown;
2385
+ groundTruth?: unknown;
2386
+ expectedTrajectory?: unknown;
2387
+ toolMocks?: DatasetItemToolMock[];
2388
+ scorerIds?: string[] | null;
2389
+ requestContext?: Record<string, unknown>;
2390
+ metadata?: Record<string, unknown>;
2391
+ source?: DatasetItemSource;
2392
+ }
2393
+ export interface BatchInsertDatasetItemsParams {
2394
+ datasetId: string;
2395
+ items: Array<{
2396
+ externalId?: string;
2397
+ input: unknown;
2398
+ groundTruth?: unknown;
2399
+ expectedTrajectory?: unknown;
2400
+ toolMocks?: DatasetItemToolMock[];
2401
+ scorerIds?: string[];
2402
+ requestContext?: Record<string, unknown>;
2403
+ metadata?: Record<string, unknown>;
2404
+ source?: DatasetItemSource;
2405
+ }>;
2406
+ }
2407
+ export interface BatchDeleteDatasetItemsParams {
2408
+ datasetId: string;
2409
+ itemIds: string[];
2410
+ }
2411
+ export interface GenerateDatasetItemsParams {
2412
+ datasetId: string;
2413
+ modelId: string;
2414
+ prompt: string;
2415
+ count?: number;
2416
+ agentContext?: {
2417
+ description?: string;
2418
+ instructions?: string;
2419
+ tools?: string[];
2420
+ };
2421
+ }
2422
+ export interface GeneratedItem {
2423
+ input: unknown;
2424
+ groundTruth?: unknown;
2425
+ }
2426
+ export interface TriggerDatasetExperimentParams {
2427
+ datasetId: string;
2428
+ targetType: 'agent' | 'workflow' | 'scorer';
2429
+ targetId: string;
2430
+ name?: string;
2431
+ description?: string;
2432
+ metadata?: Record<string, unknown>;
2433
+ scorerIds?: string[];
2434
+ version?: number;
2435
+ agentVersion?: string;
2436
+ maxConcurrency?: number;
2437
+ provenance?: ExperimentProvenance;
2438
+ grouping?: ExperimentGrouping;
2439
+ requestContext?: Record<string, unknown>;
2440
+ }
2441
+ export interface CompareExperimentsParams {
2442
+ datasetId: string;
2443
+ experimentIdA: string;
2444
+ experimentIdB: string;
2445
+ thresholds?: Record<string, {
2446
+ value: number;
2447
+ direction?: 'higher-is-better' | 'lower-is-better';
2448
+ }>;
2449
+ }
2450
+ export interface DatasetItemVersionResponse {
2451
+ id: string;
2452
+ datasetId: string;
2453
+ datasetVersion: number;
2454
+ input: unknown;
2455
+ groundTruth?: unknown;
2456
+ expectedTrajectory?: unknown;
2457
+ toolMocks?: DatasetItemToolMock[];
2458
+ scorerIds?: string[];
2459
+ metadata?: Record<string, unknown>;
2460
+ validTo: number | null;
2461
+ isDeleted: boolean;
2462
+ createdAt: string | Date;
2463
+ updatedAt: string | Date;
2464
+ }
2465
+ export interface DatasetVersionResponse {
2466
+ id: string;
2467
+ datasetId: string;
2468
+ version: number;
2469
+ createdAt: string | Date;
2470
+ }
2471
+ export interface CompareExperimentsResponse {
2472
+ baselineId: string;
2473
+ items: Array<{
2474
+ itemId: string;
2475
+ input: unknown;
2476
+ groundTruth: unknown;
2477
+ results: Record<string, {
2478
+ output: unknown;
2479
+ scores: Record<string, number | null>;
2480
+ } | null>;
2481
+ }>;
2482
+ }
2483
+ /**
2484
+ * Stored prompt block data returned from API
2485
+ */
2486
+ export interface StoredPromptBlockResponse {
2487
+ id: string;
2488
+ status: string;
2489
+ activeVersionId?: string;
2490
+ hasDraft?: boolean;
2491
+ authorId?: string;
2492
+ metadata?: Record<string, unknown>;
2493
+ createdAt: string;
2494
+ updatedAt: string;
2495
+ name: string;
2496
+ description?: string;
2497
+ content: string;
2498
+ rules?: RuleGroup;
2499
+ requestContextSchema?: Record<string, unknown>;
2500
+ }
2501
+ /**
2502
+ * Parameters for listing stored prompt blocks
2503
+ */
2504
+ export interface ListStoredPromptBlocksParams {
2505
+ page?: number;
2506
+ perPage?: number;
2507
+ orderBy?: {
2508
+ field?: 'createdAt' | 'updatedAt';
2509
+ direction?: 'ASC' | 'DESC';
2510
+ };
2511
+ status?: 'draft' | 'published' | 'archived';
2512
+ authorId?: string;
2513
+ metadata?: Record<string, unknown>;
2514
+ }
2515
+ /**
2516
+ * Response for listing stored prompt blocks
2517
+ */
2518
+ export interface ListStoredPromptBlocksResponse {
2519
+ promptBlocks: StoredPromptBlockResponse[];
2520
+ total: number;
2521
+ page: number;
2522
+ perPage: number | false;
2523
+ hasMore: boolean;
2524
+ }
2525
+ /**
2526
+ * Parameters for creating a stored prompt block
2527
+ */
2528
+ export interface CreateStoredPromptBlockParams {
2529
+ id?: string;
2530
+ authorId?: string;
2531
+ metadata?: Record<string, unknown>;
2532
+ name: string;
2533
+ description?: string;
2534
+ content: string;
2535
+ rules?: RuleGroup;
2536
+ requestContextSchema?: Record<string, unknown>;
2537
+ }
2538
+ /**
2539
+ * Parameters for updating a stored prompt block
2540
+ */
2541
+ export interface UpdateStoredPromptBlockParams {
2542
+ authorId?: string;
2543
+ metadata?: Record<string, unknown>;
2544
+ name?: string;
2545
+ description?: string;
2546
+ content?: string;
2547
+ rules?: RuleGroup;
2548
+ requestContextSchema?: Record<string, unknown>;
2549
+ }
2550
+ /**
2551
+ * Response for deleting a stored prompt block
2552
+ */
2553
+ export interface DeleteStoredPromptBlockResponse {
2554
+ success: boolean;
2555
+ message: string;
2556
+ }
2557
+ export interface PromptBlockVersionResponse {
2558
+ id: string;
2559
+ blockId: string;
2560
+ versionNumber: number;
2561
+ name: string;
2562
+ description?: string;
2563
+ content: string;
2564
+ rules?: RuleGroup;
2565
+ requestContextSchema?: Record<string, unknown>;
2566
+ changedFields?: string[];
2567
+ changeMessage?: string;
2568
+ createdAt: string;
2569
+ }
2570
+ export interface ListPromptBlockVersionsParams {
2571
+ page?: number;
2572
+ perPage?: number;
2573
+ orderBy?: {
2574
+ field?: 'versionNumber' | 'createdAt';
2575
+ direction?: 'ASC' | 'DESC';
2576
+ };
2577
+ }
2578
+ export interface ListPromptBlockVersionsResponse {
2579
+ versions: PromptBlockVersionResponse[];
2580
+ total: number;
2581
+ page: number;
2582
+ perPage: number | false;
2583
+ hasMore: boolean;
2584
+ }
2585
+ export interface CreatePromptBlockVersionParams {
2586
+ changeMessage?: string;
2587
+ }
2588
+ export interface ActivatePromptBlockVersionResponse {
2589
+ success: boolean;
2590
+ message: string;
2591
+ activeVersionId: string;
2592
+ }
2593
+ export interface DeletePromptBlockVersionResponse {
2594
+ success: boolean;
2595
+ message: string;
2596
+ }
2597
+ export type BackgroundTaskStatus = 'pending' | 'running' | 'suspended' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
2598
+ export type BackgroundTaskDateColumn = 'createdAt' | 'startedAt' | 'completedAt';
2599
+ export type BackgroundTaskResponse = GeneratedResponse<'GET /background-tasks'>['tasks'][number];
2600
+ export type ListBackgroundTasksParams = GeneratedRequest<QueryParams<'GET /background-tasks'>>;
2601
+ export type ListBackgroundTasksResponse = GeneratedResponse<'GET /background-tasks'>;
2602
+ export type StreamBackgroundTasksParams = GeneratedRequest<QueryParams<'GET /background-tasks/stream'>>;
2603
+ export type ScheduleStatus = 'active' | 'paused';
2604
+ export interface ScheduleRunSummary {
2605
+ status: WorkflowRunStatus;
2606
+ startedAt?: number;
2607
+ completedAt?: number;
2608
+ durationMs?: number;
2609
+ error?: string;
2610
+ }
2611
+ /** Attributes rendered onto the signal's XML tag. */
2612
+ export type ScheduleSignalAttributes = Record<string, string | number | boolean | null | undefined>;
2613
+ /** Mirrors the core `AgentSignalType` union. */
2614
+ export type ScheduleSignalType = 'user' | 'state' | 'reactive' | 'notification' | 'user-message' | 'system-reminder';
2615
+ /** Behavior applied when the thread is already streaming. */
2616
+ export interface ScheduleIfActive {
2617
+ behavior?: 'deliver' | 'persist' | 'discard';
2618
+ attributes?: ScheduleSignalAttributes;
2619
+ }
2620
+ /**
2621
+ * Behavior applied when the thread is idle, plus a serializable subset of
2622
+ * stream options forwarded to the woken run.
2623
+ */
2624
+ export interface ScheduleIfIdle {
2625
+ behavior?: 'wake' | 'persist' | 'discard';
2626
+ attributes?: ScheduleSignalAttributes;
2627
+ streamOptions?: {
2628
+ requestContext?: Record<string, unknown>;
2629
+ };
2630
+ }
2631
+ /**
2632
+ * Flat agent-schedule view returned by the unified `/schedules` surface.
2633
+ * Discriminate from workflow schedules by the presence of `agentId`.
2634
+ */
2635
+ export interface AgentSchedule {
2636
+ id: string;
2637
+ agentId: string;
2638
+ /** Mirror of the workflow-schedule discriminator — always absent on agent schedules. */
2639
+ workflowId?: undefined;
2640
+ /** Workflow-run summary — never hydrated for agent schedules. */
2641
+ lastRun?: undefined;
2642
+ name?: string;
2643
+ threadId?: string;
2644
+ resourceId?: string;
2645
+ prompt: string;
2646
+ cron: string;
2647
+ timezone?: string;
2648
+ status: ScheduleStatus;
2649
+ nextFireAt: number;
2650
+ lastFireAt?: number;
2651
+ lastRunId?: string;
2652
+ signalType?: ScheduleSignalType;
2653
+ tagName?: string;
2654
+ attributes?: ScheduleSignalAttributes;
2655
+ ifActive?: ScheduleIfActive;
2656
+ ifIdle?: ScheduleIfIdle;
2657
+ providerOptions?: Record<string, unknown>;
2658
+ metadata?: Record<string, unknown>;
2659
+ createdAt: number;
2660
+ updatedAt: number;
2661
+ }
2662
+ /**
2663
+ * Flat workflow-schedule view returned by the unified `/schedules` surface.
2664
+ * Discriminate from agent schedules by the presence of `workflowId`.
2665
+ */
2666
+ export interface WorkflowSchedule {
2667
+ id: string;
2668
+ workflowId: string;
2669
+ /** Mirror of the agent-schedule discriminator — always absent on workflow schedules. */
2670
+ agentId?: undefined;
2671
+ cron: string;
2672
+ timezone?: string;
2673
+ status: ScheduleStatus;
2674
+ nextFireAt: number;
2675
+ lastFireAt?: number;
2676
+ lastRunId?: string;
2677
+ lastRun?: ScheduleRunSummary;
2678
+ inputData?: unknown;
2679
+ initialState?: unknown;
2680
+ requestContext?: Record<string, unknown>;
2681
+ metadata?: Record<string, unknown>;
2682
+ createdAt: number;
2683
+ updatedAt: number;
2684
+ }
2685
+ /** Union of the flat views returned by the unified `/schedules` surface. */
2686
+ export type ScheduleResponse = AgentSchedule | WorkflowSchedule;
2687
+ export type ScheduleTriggerOutcome = 'published' | 'succeeded' | 'delivered' | 'persisted' | 'discarded' | 'skipped' | 'aborted' | 'failed';
2688
+ export type ScheduleTriggerKind = 'schedule-fire' | 'queue-drain' | 'manual';
2689
+ export interface ScheduleTriggerResponse {
2690
+ id?: string;
2691
+ scheduleId: string;
2692
+ runId: string | null;
2693
+ scheduledFireAt: number;
2694
+ actualFireAt: number;
2695
+ outcome: ScheduleTriggerOutcome;
2696
+ error?: string;
2697
+ triggerKind?: ScheduleTriggerKind;
2698
+ parentTriggerId?: string;
2699
+ metadata?: Record<string, unknown>;
2700
+ run?: ScheduleRunSummary;
2701
+ }
2702
+ export interface ListSchedulesParams {
2703
+ /** Scope the list to a single agent's schedules. */
2704
+ agentId?: string;
2705
+ /** Scope the list to a single workflow's schedules. */
2706
+ workflowId?: string;
2707
+ status?: ScheduleStatus;
2708
+ /** Agent-schedule only: match the target threadId. */
2709
+ threadId?: string;
2710
+ /** Agent-schedule only: match the target resourceId. */
2711
+ resourceId?: string;
2712
+ /** Agent-schedule only: match the free-form target name. */
2713
+ name?: string;
2714
+ }
2715
+ export interface ListSchedulesResponse {
2716
+ schedules: ScheduleResponse[];
2717
+ }
2718
+ export interface ListScheduleTriggersParams {
2719
+ limit?: number;
2720
+ fromActualFireAt?: number;
2721
+ toActualFireAt?: number;
2722
+ }
2723
+ export interface ListScheduleTriggersResponse {
2724
+ triggers: ScheduleTriggerResponse[];
2725
+ }
2726
+ /**
2727
+ * Agent variant of the `client.createSchedule(...)` body — targets an agent
2728
+ * by `agentId`. Mirrors `CreateAgentScheduleInput` on the core Schedules
2729
+ * service.
2730
+ */
2731
+ export interface CreateAgentScheduleInput {
2732
+ /** Optional stable id; normalized to `agent_<slug>`. A random id is generated when omitted. */
2733
+ id?: string;
2734
+ agentId: string;
2735
+ cron: string;
2736
+ prompt: string;
2737
+ name?: string;
2738
+ timezone?: string;
2739
+ threadId?: string;
2740
+ resourceId?: string;
2741
+ signalType?: ScheduleSignalType;
2742
+ tagName?: string;
2743
+ attributes?: ScheduleSignalAttributes;
2744
+ ifActive?: ScheduleIfActive;
2745
+ ifIdle?: ScheduleIfIdle;
2746
+ providerOptions?: Record<string, unknown>;
2747
+ metadata?: Record<string, unknown>;
2748
+ }
2749
+ /**
2750
+ * Workflow variant of the `client.createSchedule(...)` body — targets a
2751
+ * workflow by `workflowId`. Mirrors `CreateWorkflowScheduleInput` on the
2752
+ * core Schedules service.
2753
+ */
2754
+ export interface CreateWorkflowScheduleInput {
2755
+ /** Optional stable id; normalized to `schedule_<slug>`. A random id is generated when omitted. */
2756
+ id?: string;
2757
+ workflowId: string;
2758
+ cron: string;
2759
+ timezone?: string;
2760
+ inputData?: unknown;
2761
+ initialState?: unknown;
2762
+ requestContext?: Record<string, unknown>;
2763
+ metadata?: Record<string, unknown>;
2764
+ }
2765
+ /**
2766
+ * Body for `client.createSchedule(...)`. Discriminated by which target id is
2767
+ * present: `agentId` creates an agent schedule, `workflowId` a workflow
2768
+ * schedule.
2769
+ */
2770
+ export type CreateScheduleInput = CreateAgentScheduleInput | CreateWorkflowScheduleInput;
2771
+ /**
2772
+ * Patch body for `client.updateSchedule(...)`. Fields apply to the matching
2773
+ * target type; agent-only fields on a workflow schedule are rejected by the
2774
+ * server. `threadId` / `resourceId` are part of an agent schedule's identity
2775
+ * and cannot be changed — to retarget, delete and recreate.
2776
+ */
2777
+ export interface UpdateScheduleInput {
2778
+ cron?: string;
2779
+ timezone?: string;
2780
+ status?: ScheduleStatus;
2781
+ metadata?: Record<string, unknown>;
2782
+ prompt?: string;
2783
+ name?: string;
2784
+ signalType?: ScheduleSignalType;
2785
+ tagName?: string;
2786
+ attributes?: ScheduleSignalAttributes;
2787
+ ifActive?: ScheduleIfActive;
2788
+ ifIdle?: ScheduleIfIdle;
2789
+ providerOptions?: Record<string, unknown>;
2790
+ inputData?: unknown;
2791
+ initialState?: unknown;
2792
+ requestContext?: Record<string, unknown>;
2793
+ }
2794
+ /**
2795
+ * Response for POST /schedules/:scheduleId/run.
2796
+ *
2797
+ * The fire runs asynchronously through the same worker pipeline as scheduled
2798
+ * fires. `claimId` is the trigger row's `runId` (used to look up the
2799
+ * resulting trigger row via `listScheduleTriggers`).
2800
+ */
2801
+ export interface RunScheduleResponse {
2802
+ scheduleId: string;
2803
+ claimId: string;
2804
+ scheduledFireAt: number;
2805
+ }
2806
+ export interface ExperimentReviewCounts {
2807
+ experimentId: string;
2808
+ total: number;
2809
+ needsReview: number;
2810
+ reviewed: number;
2811
+ complete: number;
2812
+ }
2813
+ /**
2814
+ * Agent feature flags for the builder.
2815
+ *
2816
+ * The `GET /editor/builder/settings` response always carries a fully-resolved
2817
+ * object. On admin input, omitted keys default to `true` (default-on / allowlist
2818
+ * model — admins opt out by setting a key to `false`). Special case: `browser`
2819
+ * is only `true` when `configuration.agent.browser` is provided.
2820
+ *
2821
+ * Clients should still use strict `=== true` checks.
2822
+ */
2823
+ export interface BuilderAgentFeatures {
2824
+ tools?: boolean;
2825
+ agents?: boolean;
2826
+ workflows?: boolean;
2827
+ scorers?: boolean;
2828
+ skills?: boolean;
2829
+ memory?: boolean;
2830
+ variables?: boolean;
2831
+ favorites?: boolean;
2832
+ avatarUpload?: boolean;
2833
+ browser?: boolean;
2834
+ /**
2835
+ * Whether the model picker is visible in the Agent Builder.
2836
+ * Omitted/`false` ⇒ picker hidden (locked mode); admin's `models.default` is applied.
2837
+ */
2838
+ model?: boolean;
2839
+ }
2840
+ /**
2841
+ * Re-exported from `@mastra/core/agent-builder/ee` so SDK consumers don't need
2842
+ * a second import for admin model configuration types. Owned by core.
2843
+ */
2844
+ export type { BuilderModelPolicy, DefaultModelEntry, ProviderModelEntry, ModelProviderId };
2845
+ /**
2846
+ * Response from GET /editor/builder/settings
2847
+ */
2848
+ export interface BuilderSettingsResponse {
2849
+ enabled: boolean;
2850
+ features?: {
2851
+ agent?: BuilderAgentFeatures;
2852
+ };
2853
+ configuration?: {
2854
+ agent?: Record<string, unknown>;
2855
+ };
2856
+ /**
2857
+ * Server-derived model policy. Always present; `{ active: false }` when no
2858
+ * builder is configured. UI consumers should read this directly rather than
2859
+ * re-deriving from `features` / `configuration`.
2860
+ */
2861
+ modelPolicy?: BuilderModelPolicy;
2862
+ /**
2863
+ * Resolved picker visibility for tools, agents, and workflows. Present when
2864
+ * the builder is enabled. Each `visible*` field is `null` when unrestricted
2865
+ * (show all registered entries) and `string[]` otherwise — making the
2866
+ * empty-vs-unrestricted distinction explicit so the UI never has to
2867
+ * disambiguate.
2868
+ */
2869
+ picker?: BuilderPickerResponse;
2870
+ /**
2871
+ * Non-fatal warnings produced by builder config validation (e.g. allowlist
2872
+ * entries with unknown providers that aren't tagged `kind: 'custom'`, or
2873
+ * picker allowlist entries that don't match a registered ID).
2874
+ * Only present when there is at least one warning.
2875
+ */
2876
+ modelPolicyWarnings?: string[];
2877
+ }
2878
+ /**
2879
+ * Response from GET /editor/builder/models/available.
2880
+ *
2881
+ * Same provider shape as {@link ListAgentsModelProvidersResponse}, but each
2882
+ * provider's `models` list is already filtered by the active builder model
2883
+ * policy (the server applies the EE allowlist). Providers with no allowed
2884
+ * models are omitted, so the picker can render this verbatim.
2885
+ */
2886
+ export type BuilderAvailableModelsResponse = GeneratedResponse<'GET /editor/builder/models/available'>;
2887
+ /**
2888
+ * A valid permission-pattern string (e.g. `agents:read`, `*`).
2889
+ *
2890
+ * Kept as a string alias so the Playground can name the type while the
2891
+ * authoritative set is fetched from the server at runtime.
2892
+ */
2893
+ export type PermissionPattern = string;
2894
+ /**
2895
+ * Response from GET /auth/permission-patterns.
2896
+ */
2897
+ export type PermissionPatternsResponse = GeneratedResponse<'GET /auth/permission-patterns'>;
2898
+ /**
2899
+ * Resolved picker visibility section returned in {@link BuilderSettingsResponse}.
2900
+ *
2901
+ * Per kind:
2902
+ * - `null` ⇒ unrestricted (show all registered entries).
2903
+ * - `string[]` ⇒ explicit allowlist (may be empty to show none).
2904
+ */
2905
+ export interface BuilderPickerResponse {
2906
+ visibleTools: string[] | null;
2907
+ visibleAgents: string[] | null;
2908
+ visibleWorkflows: string[] | null;
2909
+ }
2910
+ /**
2911
+ * Response from GET /editor/builder/infrastructure
2912
+ *
2913
+ * Agent Builder infrastructure configuration plus lightweight runtime resolution state.
2914
+ */
2915
+ export interface InfrastructureStatusResponse {
2916
+ channels: {
2917
+ providers: Array<{
2918
+ id: string;
2919
+ name: string;
2920
+ isConfigured: boolean;
2921
+ routeCount: number;
2922
+ }>;
2923
+ };
2924
+ browser: {
2925
+ type: string | null;
2926
+ provider: string | null;
2927
+ env: string | null;
2928
+ registered: boolean;
2929
+ availableProviders: string[];
2930
+ config: Array<{
2931
+ key: string;
2932
+ value: string;
2933
+ }>;
2934
+ };
2935
+ workspace: {
2936
+ type: string | null;
2937
+ workspaceId: string | null;
2938
+ name: string | null;
2939
+ source: string | null;
2940
+ registered: boolean;
2941
+ hasFilesystem: boolean;
2942
+ hasSandbox: boolean;
2943
+ filesystemProvider: string | null;
2944
+ sandboxProvider: string | null;
2945
+ config: Array<{
2946
+ key: string;
2947
+ value: string;
2948
+ }>;
2949
+ };
2950
+ registries: {
2951
+ skillsSh: {
2952
+ enabled: boolean;
2953
+ };
2954
+ };
2955
+ }
2956
+ /**
2957
+ * One known skill registry surfaced from the Agent Builder config.
2958
+ */
2959
+ export interface BuilderRegistryDescriptor {
2960
+ id: string;
2961
+ enabled: boolean;
2962
+ label: string;
2963
+ }
2964
+ /**
2965
+ * Response from `GET /editor/builder/registries`.
2966
+ */
2967
+ export interface ListBuilderRegistriesResponse {
2968
+ registries: BuilderRegistryDescriptor[];
2969
+ }
2970
+ /**
2971
+ * Single skill summary returned from a registry search/popular endpoint.
2972
+ * Wire shape matches the upstream skills.sh proxy.
2973
+ */
2974
+ export interface BuilderRegistrySkillSummary {
2975
+ id: string;
2976
+ name: string;
2977
+ installs: number;
2978
+ /** Repository identifier in `owner/repo` or `owner/repo/path` form. */
2979
+ topSource: string;
2980
+ }
2981
+ /**
2982
+ * Response from `GET /editor/builder/registries/:registryId/search`.
2983
+ */
2984
+ export interface BuilderRegistrySearchResponse {
2985
+ query: string;
2986
+ searchType: string;
2987
+ skills: BuilderRegistrySkillSummary[];
2988
+ count: number;
2989
+ }
2990
+ /**
2991
+ * Response from `GET /editor/builder/registries/:registryId/popular`.
2992
+ */
2993
+ export interface BuilderRegistryPopularResponse {
2994
+ skills: BuilderRegistrySkillSummary[];
2995
+ count: number;
2996
+ limit: number;
2997
+ offset: number;
2998
+ }
2999
+ /**
3000
+ * Response from `GET /editor/builder/registries/:registryId/preview`.
3001
+ */
3002
+ export interface BuilderRegistryPreviewResponse {
3003
+ content: string;
3004
+ }
3005
+ /**
3006
+ * Body for `POST /editor/builder/registries/:registryId/install`.
3007
+ */
3008
+ export interface BuilderRegistryInstallBody {
3009
+ owner: string;
3010
+ repo: string;
3011
+ skillName: string;
3012
+ visibility?: 'private' | 'public';
3013
+ }
3014
+ /**
3015
+ * Response from `POST /editor/builder/registries/:registryId/install`.
3016
+ */
3017
+ export interface BuilderRegistryInstallResponse {
3018
+ storedSkillId: string;
3019
+ name: string;
3020
+ filesWritten: number;
3021
+ }
479
3022
  //# sourceMappingURL=types.d.ts.map