@mastra/server 0.0.0-tool-call-parts-20250630193309 → 0.0.0-transpile-packages-20250730132657
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +11 -42
- package/dist/_tsup-dts-rollup.d.cts +212 -23
- package/dist/_tsup-dts-rollup.d.ts +212 -23
- package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
- package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
- package/dist/{chunk-MEGCYGBU.js → chunk-36BLNJHS.js} +37 -37
- package/dist/chunk-424T5F2J.cjs +157 -0
- package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
- package/dist/{chunk-L3VURYKY.cjs → chunk-6KP2OBYA.cjs} +177 -68
- package/dist/chunk-6T5JUKOQ.js +149 -0
- package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
- package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
- package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
- package/dist/{chunk-LI436ITD.cjs → chunk-HISYIDYH.cjs} +37 -37
- package/dist/{chunk-Z3PTO2AK.cjs → chunk-HRSAZUIK.cjs} +20 -20
- package/dist/{chunk-EP3XVEVC.cjs → chunk-I5JKUCGE.cjs} +50 -20
- package/dist/{chunk-R5VGYBV6.js → chunk-KHZKYUNR.js} +3 -3
- package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
- package/dist/chunk-R3I7AJVL.js +507 -0
- package/dist/{chunk-BFOA2QQY.js → chunk-RG473F6Y.js} +2 -2
- package/dist/{chunk-WJY57THV.cjs → chunk-RHSWAXKB.cjs} +22 -22
- package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
- package/dist/{chunk-72LOJGUV.js → chunk-T7HAZC2E.js} +118 -12
- package/dist/chunk-TTPJHP42.cjs +522 -0
- package/dist/{chunk-NGHSYB5B.cjs → chunk-UCV4247U.cjs} +43 -43
- package/dist/{chunk-2BCWG3EZ.js → chunk-VTTN2FW3.js} +36 -7
- package/dist/{chunk-EWLR2PNT.js → chunk-WBRFIHSF.js} +4 -4
- package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
- package/dist/{chunk-E2LP4J6K.js → chunk-ZYAFP2AV.js} +8 -8
- package/dist/server/handlers/agents.cjs +11 -7
- package/dist/server/handlers/agents.d.cts +1 -0
- package/dist/server/handlers/agents.d.ts +1 -0
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +11 -11
- package/dist/server/handlers/legacyWorkflows.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +29 -9
- package/dist/server/handlers/memory.d.cts +5 -0
- package/dist/server/handlers/memory.d.ts +5 -0
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/scores.cjs +30 -0
- package/dist/server/handlers/scores.d.cts +6 -0
- package/dist/server/handlers/scores.d.ts +6 -0
- package/dist/server/handlers/scores.js +1 -0
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +23 -23
- package/dist/server/handlers/vNextNetwork.js +4 -4
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +5 -5
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +25 -13
- package/dist/server/handlers/workflows.d.cts +3 -0
- package/dist/server/handlers/workflows.d.ts +3 -0
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +28 -23
- package/dist/server/handlers.d.cts +3 -2
- package/dist/server/handlers.d.ts +3 -2
- package/dist/server/handlers.js +11 -10
- package/package.json +8 -7
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-RQ2Z56EC.cjs +0 -251
- package/dist/chunk-XUIJ7WRT.js +0 -241
package/LICENSE.md
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Apache License 2.0
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
17
|
-
|
|
18
|
-
**Patents**
|
|
19
|
-
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
20
|
-
|
|
21
|
-
**Notices**
|
|
22
|
-
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
23
|
-
|
|
24
|
-
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
25
|
-
|
|
26
|
-
**No Other Rights**
|
|
27
|
-
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
28
|
-
|
|
29
|
-
**Termination**
|
|
30
|
-
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
31
|
-
|
|
32
|
-
**No Liability**
|
|
33
|
-
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
34
|
-
|
|
35
|
-
**Definitions**
|
|
36
|
-
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
|
|
37
|
-
|
|
38
|
-
_you_ refers to the individual or entity agreeing to these terms.
|
|
39
|
-
|
|
40
|
-
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
41
|
-
|
|
42
|
-
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
43
|
-
|
|
44
|
-
_use_ means anything you do with the software requiring one of your licenses.
|
|
45
|
-
|
|
46
|
-
_trademark_ means trademarks, service marks, and similar rights.
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
@@ -5,10 +5,10 @@ import type { Artifact } from '@mastra/core/a2a';
|
|
|
5
5
|
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
6
6
|
import { CoreMessage } from 'ai';
|
|
7
7
|
import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
|
|
8
|
-
import { DefaultEngineType } from '@mastra/core
|
|
9
|
-
import { EvalRow } from '@mastra/core
|
|
10
|
-
import {
|
|
11
|
-
import { GenerateTextResult } from '
|
|
8
|
+
import { DefaultEngineType } from '@mastra/core';
|
|
9
|
+
import { EvalRow } from '@mastra/core';
|
|
10
|
+
import type { GenerateReturn } from '@mastra/core/llm';
|
|
11
|
+
import { GenerateTextResult } from '@mastra/core';
|
|
12
12
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
13
13
|
import type { JSONRPCError } from '@mastra/core/a2a';
|
|
14
14
|
import { JSONRPCResponse } from '@mastra/core/a2a';
|
|
@@ -18,21 +18,30 @@ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
|
18
18
|
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
19
19
|
import type { LogLevel } from '@mastra/core/logger';
|
|
20
20
|
import type { Mastra } from '@mastra/core/mastra';
|
|
21
|
+
import type { MastraError } from '@mastra/core/error';
|
|
21
22
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
22
|
-
import { MastraMessageV1 } from '@mastra/core
|
|
23
|
+
import { MastraMessageV1 } from '@mastra/core';
|
|
24
|
+
import { MastraMessageV2 } from '@mastra/core';
|
|
25
|
+
import type { MastraScorerEntry } from '@mastra/core/scores';
|
|
26
|
+
import { MastraWorkflowStream } from '@mastra/core';
|
|
27
|
+
import { MemoryConfig } from '@mastra/core';
|
|
23
28
|
import type { Message } from '@mastra/core/a2a';
|
|
29
|
+
import { PaginationInfo } from '@mastra/core';
|
|
24
30
|
import type { QueryResult } from '@mastra/core/vector';
|
|
25
31
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
26
32
|
import { ReadableStream as ReadableStream_3 } from 'stream/web';
|
|
27
33
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
28
34
|
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
35
|
+
import type { ScoreRowData } from '@mastra/core/scores';
|
|
29
36
|
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
30
|
-
import { Step } from '@mastra/core
|
|
37
|
+
import { Step } from '@mastra/core';
|
|
31
38
|
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
32
39
|
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
33
|
-
import { StepResult } from '@mastra/core
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
40
|
+
import { StepResult } from '@mastra/core';
|
|
41
|
+
import type { StorageGetMessagesArg } from '@mastra/core';
|
|
42
|
+
import type { StoragePagination } from '@mastra/core/storage';
|
|
43
|
+
import { StorageThreadType } from '@mastra/core';
|
|
44
|
+
import { StreamEvent } from '@mastra/core';
|
|
36
45
|
import { Task } from '@mastra/core/a2a';
|
|
37
46
|
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
38
47
|
import type { TaskContext } from '@mastra/core/a2a';
|
|
@@ -41,13 +50,15 @@ import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
|
41
50
|
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
42
51
|
import type { TaskStatus } from '@mastra/core/a2a';
|
|
43
52
|
import type { ToolAction } from '@mastra/core/tools';
|
|
53
|
+
import { Trace } from '@mastra/core';
|
|
44
54
|
import { UIMessage } from 'ai';
|
|
45
55
|
import type { VercelTool } from '@mastra/core/tools';
|
|
46
56
|
import type { WatchEvent } from '@mastra/core/workflows';
|
|
47
57
|
import type { Workflow } from '@mastra/core/workflows';
|
|
48
58
|
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
49
|
-
import { WorkflowResult } from '@mastra/core
|
|
59
|
+
import { WorkflowResult } from '@mastra/core';
|
|
50
60
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
61
|
+
import { WorkingMemoryTemplate } from '@mastra/core';
|
|
51
62
|
import { ZodBoolean } from 'zod';
|
|
52
63
|
import { ZodEnum } from 'zod';
|
|
53
64
|
import { ZodNumber } from 'zod';
|
|
@@ -76,17 +87,22 @@ export declare namespace agents {
|
|
|
76
87
|
getEvalsByAgentIdHandler,
|
|
77
88
|
getLiveEvalsByAgentIdHandler,
|
|
78
89
|
generateHandler,
|
|
79
|
-
streamGenerateHandler
|
|
90
|
+
streamGenerateHandler,
|
|
91
|
+
streamVNextGenerateHandler
|
|
80
92
|
}
|
|
81
93
|
}
|
|
82
94
|
|
|
83
|
-
export declare interface ApiError extends
|
|
95
|
+
export declare interface ApiError extends MastraError {
|
|
84
96
|
message: string;
|
|
85
97
|
status?: number;
|
|
86
98
|
}
|
|
87
99
|
|
|
88
100
|
export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
|
|
89
101
|
|
|
102
|
+
export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
103
|
+
message: string;
|
|
104
|
+
}>;
|
|
105
|
+
|
|
90
106
|
declare type ClientErrorStatusCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451;
|
|
91
107
|
|
|
92
108
|
export declare interface Context {
|
|
@@ -171,14 +187,14 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
|
|
|
171
187
|
runtimeContext?: Record<string, unknown>;
|
|
172
188
|
};
|
|
173
189
|
abortSignal?: AbortSignal;
|
|
174
|
-
}): Promise<GenerateTextResult<any,
|
|
190
|
+
}): Promise<GenerateTextResult<any, undefined>>;
|
|
175
191
|
|
|
176
192
|
export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
|
|
177
193
|
runtimeContext: RuntimeContext;
|
|
178
194
|
body: {
|
|
179
195
|
messages?: Parameters<AgentNetwork['generate']>[0];
|
|
180
196
|
} & Parameters<AgentNetwork['generate']>[1];
|
|
181
|
-
}): Promise<
|
|
197
|
+
}): Promise<GenerateReturn<any, any, any>>;
|
|
182
198
|
|
|
183
199
|
/**
|
|
184
200
|
* Generate speech from text
|
|
@@ -329,6 +345,10 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
|
|
|
329
345
|
transports: string[];
|
|
330
346
|
}>;
|
|
331
347
|
|
|
348
|
+
export declare function getMemoryConfigHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
349
|
+
config: MemoryConfig;
|
|
350
|
+
}>;
|
|
351
|
+
|
|
332
352
|
export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
333
353
|
result: boolean;
|
|
334
354
|
}>;
|
|
@@ -340,6 +360,10 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, n
|
|
|
340
360
|
uiMessages: UIMessage[];
|
|
341
361
|
}>;
|
|
342
362
|
|
|
363
|
+
export declare function getMessagesPaginatedHandler({ mastra, threadId, resourceId, selectBy, format, }: StorageGetMessagesArg & Pick<MemoryContext, 'mastra'>): Promise<PaginationInfo & {
|
|
364
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
365
|
+
}>;
|
|
366
|
+
|
|
343
367
|
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
344
368
|
id: string;
|
|
345
369
|
name: string;
|
|
@@ -370,6 +394,50 @@ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<Net
|
|
|
370
394
|
};
|
|
371
395
|
}[]>;
|
|
372
396
|
|
|
397
|
+
export declare function getScorerHandler({ mastra, scorerId, runtimeContext, }: Context & {
|
|
398
|
+
scorerId: string;
|
|
399
|
+
runtimeContext: RuntimeContext;
|
|
400
|
+
}): Promise<(MastraScorerEntry & {
|
|
401
|
+
agentIds: string[];
|
|
402
|
+
workflowIds: string[];
|
|
403
|
+
}) | null>;
|
|
404
|
+
|
|
405
|
+
export declare function getScorersHandler({ mastra, runtimeContext }: Context & {
|
|
406
|
+
runtimeContext: RuntimeContext;
|
|
407
|
+
}): Promise<{
|
|
408
|
+
[k: string]: MastraScorerEntry & {
|
|
409
|
+
agentIds: string[];
|
|
410
|
+
workflowIds: string[];
|
|
411
|
+
};
|
|
412
|
+
}>;
|
|
413
|
+
|
|
414
|
+
export declare function getScoresByEntityIdHandler({ mastra, entityId, entityType, pagination, }: Context & {
|
|
415
|
+
entityId: string;
|
|
416
|
+
entityType: string;
|
|
417
|
+
pagination: StoragePagination;
|
|
418
|
+
}): Promise<never[] | {
|
|
419
|
+
pagination: PaginationInfo;
|
|
420
|
+
scores: ScoreRowData[];
|
|
421
|
+
}>;
|
|
422
|
+
|
|
423
|
+
export declare function getScoresByRunIdHandler({ mastra, runId, pagination, }: Context & {
|
|
424
|
+
runId: string;
|
|
425
|
+
pagination: StoragePagination;
|
|
426
|
+
}): Promise<never[] | {
|
|
427
|
+
pagination: PaginationInfo;
|
|
428
|
+
scores: ScoreRowData[];
|
|
429
|
+
}>;
|
|
430
|
+
|
|
431
|
+
export declare function getScoresByScorerIdHandler({ mastra, scorerId, pagination, entityId, entityType, }: Context & {
|
|
432
|
+
scorerId: string;
|
|
433
|
+
pagination: StoragePagination;
|
|
434
|
+
entityId?: string;
|
|
435
|
+
entityType?: string;
|
|
436
|
+
}): Promise<never[] | {
|
|
437
|
+
pagination: PaginationInfo;
|
|
438
|
+
scores: ScoreRowData[];
|
|
439
|
+
}>;
|
|
440
|
+
|
|
373
441
|
/**
|
|
374
442
|
* Get available speakers for an agent
|
|
375
443
|
*/
|
|
@@ -377,7 +445,7 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
|
|
|
377
445
|
voiceId: string;
|
|
378
446
|
}[]>;
|
|
379
447
|
|
|
380
|
-
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<
|
|
448
|
+
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<Trace[]>;
|
|
381
449
|
|
|
382
450
|
export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
|
|
383
451
|
|
|
@@ -438,7 +506,8 @@ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pic
|
|
|
438
506
|
}[]>;
|
|
439
507
|
|
|
440
508
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
441
|
-
steps: SerializedStep
|
|
509
|
+
steps: Record<string, SerializedStep>;
|
|
510
|
+
allSteps: Record<string, SerializedStep>;
|
|
442
511
|
name: string | undefined;
|
|
443
512
|
description: string | undefined;
|
|
444
513
|
stepGraph: SerializedStepFlowEntry[];
|
|
@@ -460,6 +529,21 @@ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, t
|
|
|
460
529
|
|
|
461
530
|
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
462
531
|
|
|
532
|
+
/**
|
|
533
|
+
* Handler to get the working memory for a thread (optionally resource-scoped).
|
|
534
|
+
* @returns workingMemory - the working memory for the thread
|
|
535
|
+
* @returns source - thread or resource
|
|
536
|
+
*/
|
|
537
|
+
export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
538
|
+
resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
|
|
539
|
+
memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
|
|
540
|
+
}): Promise<{
|
|
541
|
+
workingMemory: string | null;
|
|
542
|
+
source: string;
|
|
543
|
+
workingMemoryTemplate: WorkingMemoryTemplate | null;
|
|
544
|
+
threadExists: boolean;
|
|
545
|
+
}>;
|
|
546
|
+
|
|
463
547
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
464
548
|
|
|
465
549
|
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
@@ -554,11 +638,13 @@ export declare class HTTPException extends Error {
|
|
|
554
638
|
* @property res - Optional response object to use.
|
|
555
639
|
* @property message - Optional custom error message.
|
|
556
640
|
* @property cause - Optional cause of the error.
|
|
641
|
+
* @property stack - Optional stack trace for the error.
|
|
557
642
|
*/
|
|
558
643
|
declare type HTTPExceptionOptions = {
|
|
559
644
|
res?: Response;
|
|
560
645
|
message?: string;
|
|
561
646
|
cause?: unknown;
|
|
647
|
+
stack?: string;
|
|
562
648
|
};
|
|
563
649
|
|
|
564
650
|
/**
|
|
@@ -649,18 +735,18 @@ export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body,
|
|
|
649
735
|
completionReason: ZodOptional<ZodString>;
|
|
650
736
|
iteration: ZodNumber;
|
|
651
737
|
}, "strip", ZodTypeAny, {
|
|
738
|
+
result: string;
|
|
652
739
|
prompt: string;
|
|
653
740
|
resourceId: string;
|
|
654
|
-
result: string;
|
|
655
741
|
task: string;
|
|
656
742
|
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
657
743
|
iteration: number;
|
|
658
744
|
isComplete?: boolean | undefined;
|
|
659
745
|
completionReason?: string | undefined;
|
|
660
746
|
}, {
|
|
747
|
+
result: string;
|
|
661
748
|
prompt: string;
|
|
662
749
|
resourceId: string;
|
|
663
|
-
result: string;
|
|
664
750
|
task: string;
|
|
665
751
|
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
666
752
|
iteration: number;
|
|
@@ -677,8 +763,17 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
|
|
|
677
763
|
}): Promise<{
|
|
678
764
|
status: "success";
|
|
679
765
|
result: {
|
|
680
|
-
|
|
766
|
+
result: string;
|
|
767
|
+
prompt: string;
|
|
768
|
+
resourceId: string;
|
|
769
|
+
task: string;
|
|
770
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
681
771
|
iteration: number;
|
|
772
|
+
isOneOff: boolean;
|
|
773
|
+
threadId?: string | undefined;
|
|
774
|
+
threadResourceId?: string | undefined;
|
|
775
|
+
isComplete?: boolean | undefined;
|
|
776
|
+
completionReason?: string | undefined;
|
|
682
777
|
};
|
|
683
778
|
steps: {
|
|
684
779
|
[x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
|
|
@@ -688,13 +783,18 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
|
|
|
688
783
|
export declare namespace memory {
|
|
689
784
|
export {
|
|
690
785
|
getMemoryStatusHandler,
|
|
786
|
+
getMemoryConfigHandler,
|
|
691
787
|
getThreadsHandler,
|
|
692
788
|
getThreadByIdHandler,
|
|
693
789
|
saveMessagesHandler,
|
|
694
790
|
createThreadHandler,
|
|
695
791
|
updateThreadHandler,
|
|
696
792
|
deleteThreadHandler,
|
|
697
|
-
|
|
793
|
+
getMessagesPaginatedHandler,
|
|
794
|
+
getMessagesHandler,
|
|
795
|
+
getWorkingMemoryHandler,
|
|
796
|
+
updateWorkingMemoryHandler,
|
|
797
|
+
searchMemoryHandler
|
|
698
798
|
}
|
|
699
799
|
}
|
|
700
800
|
|
|
@@ -783,6 +883,67 @@ export declare function saveMessagesHandler({ mastra, agentId, body, networkId,
|
|
|
783
883
|
};
|
|
784
884
|
}): Promise<MastraMessageV1[]>;
|
|
785
885
|
|
|
886
|
+
export declare function saveScoreHandler({ mastra, score }: Context & {
|
|
887
|
+
score: ScoreRowData;
|
|
888
|
+
}): Promise<never[] | {
|
|
889
|
+
score: ScoreRowData;
|
|
890
|
+
}>;
|
|
891
|
+
|
|
892
|
+
export declare namespace scores {
|
|
893
|
+
export {
|
|
894
|
+
getScorersHandler,
|
|
895
|
+
getScorerHandler,
|
|
896
|
+
getScoresByRunIdHandler,
|
|
897
|
+
getScoresByScorerIdHandler,
|
|
898
|
+
getScoresByEntityIdHandler,
|
|
899
|
+
saveScoreHandler
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Handler to search messages in a thread.
|
|
905
|
+
* @param searchQuery - the text to search for
|
|
906
|
+
* @param resourceId - the resource id (user/org) to validate thread ownership
|
|
907
|
+
* @param threadId - the thread id to search within
|
|
908
|
+
* @param limit - maximum number of results to return (default: 20)
|
|
909
|
+
*/
|
|
910
|
+
export declare function searchMemoryHandler({ mastra, agentId, searchQuery, resourceId, threadId, limit, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
|
|
911
|
+
searchQuery: string;
|
|
912
|
+
resourceId: string;
|
|
913
|
+
threadId?: string;
|
|
914
|
+
limit?: number;
|
|
915
|
+
memoryConfig?: any;
|
|
916
|
+
}): Promise<SearchResponse | ReturnType<typeof handleError>>;
|
|
917
|
+
|
|
918
|
+
declare interface SearchResponse {
|
|
919
|
+
results: SearchResult[];
|
|
920
|
+
count: number;
|
|
921
|
+
query: string;
|
|
922
|
+
searchScope?: string;
|
|
923
|
+
searchType?: string;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
declare interface SearchResult {
|
|
927
|
+
id: string;
|
|
928
|
+
role: string;
|
|
929
|
+
content: any;
|
|
930
|
+
createdAt: Date;
|
|
931
|
+
threadId?: string;
|
|
932
|
+
threadTitle?: string;
|
|
933
|
+
score?: number;
|
|
934
|
+
context?: {
|
|
935
|
+
before?: SearchResult[];
|
|
936
|
+
after?: SearchResult[];
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
941
|
+
event: string;
|
|
942
|
+
data: unknown;
|
|
943
|
+
}): Promise<{
|
|
944
|
+
message: string;
|
|
945
|
+
}>;
|
|
946
|
+
|
|
786
947
|
declare type SerializedStep = {
|
|
787
948
|
id: string;
|
|
788
949
|
description: string;
|
|
@@ -880,9 +1041,9 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
|
|
|
880
1041
|
threadResourceId: ZodOptional<ZodString>;
|
|
881
1042
|
isOneOff: ZodBoolean;
|
|
882
1043
|
}, "strip", ZodTypeAny, {
|
|
1044
|
+
result: string;
|
|
883
1045
|
prompt: string;
|
|
884
1046
|
resourceId: string;
|
|
885
|
-
result: string;
|
|
886
1047
|
task: string;
|
|
887
1048
|
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
888
1049
|
iteration: number;
|
|
@@ -892,9 +1053,9 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
|
|
|
892
1053
|
isComplete?: boolean | undefined;
|
|
893
1054
|
completionReason?: string | undefined;
|
|
894
1055
|
}, {
|
|
1056
|
+
result: string;
|
|
895
1057
|
prompt: string;
|
|
896
1058
|
resourceId: string;
|
|
897
|
-
result: string;
|
|
898
1059
|
task: string;
|
|
899
1060
|
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
900
1061
|
iteration: number;
|
|
@@ -906,6 +1067,20 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
|
|
|
906
1067
|
}>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
|
|
907
1068
|
}>;
|
|
908
1069
|
|
|
1070
|
+
export declare function streamVNextGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
1071
|
+
runtimeContext: RuntimeContext;
|
|
1072
|
+
agentId: string;
|
|
1073
|
+
body: GetBody<'streamVNext'> & {
|
|
1074
|
+
runtimeContext?: string;
|
|
1075
|
+
};
|
|
1076
|
+
abortSignal?: AbortSignal;
|
|
1077
|
+
}): ReturnType<Agent['streamVNext']>;
|
|
1078
|
+
|
|
1079
|
+
export declare function streamVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
1080
|
+
inputData?: unknown;
|
|
1081
|
+
runtimeContext?: RuntimeContext_2;
|
|
1082
|
+
}): Promise<MastraWorkflowStream>;
|
|
1083
|
+
|
|
909
1084
|
export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
910
1085
|
inputData?: unknown;
|
|
911
1086
|
runtimeContext?: RuntimeContext_2;
|
|
@@ -984,6 +1159,17 @@ export declare function updateThreadHandler({ mastra, agentId, threadId, body, n
|
|
|
984
1159
|
body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
|
|
985
1160
|
}): Promise<StorageThreadType>;
|
|
986
1161
|
|
|
1162
|
+
/**
|
|
1163
|
+
* Handler to update the working memory for a thread (optionally resource-scoped).
|
|
1164
|
+
* @param threadId - the thread id
|
|
1165
|
+
* @param body - the body containing the working memory to update and the resource id (optional)
|
|
1166
|
+
*/
|
|
1167
|
+
export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
1168
|
+
body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
|
|
1169
|
+
}): Promise<{
|
|
1170
|
+
success: boolean;
|
|
1171
|
+
}>;
|
|
1172
|
+
|
|
987
1173
|
declare interface UpsertRequest {
|
|
988
1174
|
indexName: string;
|
|
989
1175
|
vectors: number[][];
|
|
@@ -1052,9 +1238,12 @@ export declare namespace workflows {
|
|
|
1052
1238
|
startWorkflowRunHandler,
|
|
1053
1239
|
watchWorkflowHandler,
|
|
1054
1240
|
streamWorkflowHandler,
|
|
1241
|
+
streamVNextWorkflowHandler,
|
|
1055
1242
|
resumeAsyncWorkflowHandler,
|
|
1056
1243
|
resumeWorkflowHandler,
|
|
1057
|
-
getWorkflowRunsHandler
|
|
1244
|
+
getWorkflowRunsHandler,
|
|
1245
|
+
cancelWorkflowRunHandler,
|
|
1246
|
+
sendWorkflowRunEventHandler
|
|
1058
1247
|
}
|
|
1059
1248
|
}
|
|
1060
1249
|
|