@mastra/server 0.0.0-tool-call-parts-20250630193309 → 0.0.0-transpile-packages-20250724123433
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 +142 -14
- package/dist/_tsup-dts-rollup.d.ts +142 -14
- package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
- package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
- package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
- package/dist/{chunk-E2LP4J6K.js → chunk-5PQQ42EZ.js} +7 -7
- package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
- package/dist/{chunk-L3VURYKY.cjs → chunk-B2PAS2IB.cjs} +134 -55
- package/dist/{chunk-2BCWG3EZ.js → chunk-BK4XT6EG.js} +4 -4
- package/dist/chunk-CBFTEHOO.cjs +157 -0
- package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
- package/dist/{chunk-Z3PTO2AK.cjs → chunk-FRVBFMO2.cjs} +15 -15
- package/dist/{chunk-XUIJ7WRT.js → chunk-G4L7OMCA.js} +84 -5
- package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
- package/dist/{chunk-72LOJGUV.js → chunk-H7DMHBKY.js} +88 -11
- package/dist/{chunk-NGHSYB5B.cjs → chunk-JMLYCXMK.cjs} +36 -36
- 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-EWLR2PNT.js → chunk-LRCAAFUA.js} +3 -3
- package/dist/{chunk-EP3XVEVC.cjs → chunk-LZ3VJXSO.cjs} +14 -14
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
- 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-VULESSU5.js +149 -0
- package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
- package/dist/{chunk-RQ2Z56EC.cjs → chunk-Z75RYULP.cjs} +117 -35
- package/dist/server/handlers/agents.cjs +7 -7
- 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 +21 -9
- package/dist/server/handlers/memory.d.cts +3 -0
- package/dist/server/handlers/memory.d.ts +3 -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 +18 -18
- package/dist/server/handlers/vNextNetwork.js +3 -3
- 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 +21 -13
- package/dist/server/handlers/workflows.d.cts +2 -0
- package/dist/server/handlers/workflows.d.ts +2 -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/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,8 +5,8 @@ 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
|
|
8
|
+
import { DefaultEngineType } from '@mastra/core';
|
|
9
|
+
import { EvalRow } from '@mastra/core';
|
|
10
10
|
import { GenerateObjectResult } from 'ai';
|
|
11
11
|
import { GenerateTextResult } from 'ai';
|
|
12
12
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
@@ -18,21 +18,28 @@ 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';
|
|
23
26
|
import type { Message } from '@mastra/core/a2a';
|
|
27
|
+
import { PaginationInfo } from '@mastra/core';
|
|
24
28
|
import type { QueryResult } from '@mastra/core/vector';
|
|
25
29
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
26
30
|
import { ReadableStream as ReadableStream_3 } from 'stream/web';
|
|
27
31
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
28
32
|
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
33
|
+
import type { ScoreRowData } from '@mastra/core/scores';
|
|
29
34
|
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
30
|
-
import { Step } from '@mastra/core
|
|
35
|
+
import { Step } from '@mastra/core';
|
|
31
36
|
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
32
37
|
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
33
|
-
import { StepResult } from '@mastra/core
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
38
|
+
import { StepResult } from '@mastra/core';
|
|
39
|
+
import type { StorageGetMessagesArg } from '@mastra/core';
|
|
40
|
+
import type { StoragePagination } from '@mastra/core/storage';
|
|
41
|
+
import { StorageThreadType } from '@mastra/core';
|
|
42
|
+
import { StreamEvent } from '@mastra/core';
|
|
36
43
|
import { Task } from '@mastra/core/a2a';
|
|
37
44
|
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
38
45
|
import type { TaskContext } from '@mastra/core/a2a';
|
|
@@ -41,13 +48,15 @@ import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
|
41
48
|
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
42
49
|
import type { TaskStatus } from '@mastra/core/a2a';
|
|
43
50
|
import type { ToolAction } from '@mastra/core/tools';
|
|
51
|
+
import { Trace } from '@mastra/core';
|
|
44
52
|
import { UIMessage } from 'ai';
|
|
45
53
|
import type { VercelTool } from '@mastra/core/tools';
|
|
46
54
|
import type { WatchEvent } from '@mastra/core/workflows';
|
|
47
55
|
import type { Workflow } from '@mastra/core/workflows';
|
|
48
56
|
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
49
|
-
import { WorkflowResult } from '@mastra/core
|
|
57
|
+
import { WorkflowResult } from '@mastra/core';
|
|
50
58
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
59
|
+
import { WorkingMemoryTemplate } from '@mastra/core';
|
|
51
60
|
import { ZodBoolean } from 'zod';
|
|
52
61
|
import { ZodEnum } from 'zod';
|
|
53
62
|
import { ZodNumber } from 'zod';
|
|
@@ -80,13 +89,17 @@ export declare namespace agents {
|
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
export declare interface ApiError extends
|
|
92
|
+
export declare interface ApiError extends MastraError {
|
|
84
93
|
message: string;
|
|
85
94
|
status?: number;
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
|
|
89
98
|
|
|
99
|
+
export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
100
|
+
message: string;
|
|
101
|
+
}>;
|
|
102
|
+
|
|
90
103
|
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
104
|
|
|
92
105
|
export declare interface Context {
|
|
@@ -340,6 +353,10 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, n
|
|
|
340
353
|
uiMessages: UIMessage[];
|
|
341
354
|
}>;
|
|
342
355
|
|
|
356
|
+
export declare function getMessagesPaginatedHandler({ mastra, threadId, resourceId, selectBy, format, }: StorageGetMessagesArg & Pick<MemoryContext, 'mastra'>): Promise<PaginationInfo & {
|
|
357
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
358
|
+
}>;
|
|
359
|
+
|
|
343
360
|
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
344
361
|
id: string;
|
|
345
362
|
name: string;
|
|
@@ -370,6 +387,50 @@ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<Net
|
|
|
370
387
|
};
|
|
371
388
|
}[]>;
|
|
372
389
|
|
|
390
|
+
export declare function getScorerHandler({ mastra, scorerId, runtimeContext, }: Context & {
|
|
391
|
+
scorerId: string;
|
|
392
|
+
runtimeContext: RuntimeContext;
|
|
393
|
+
}): Promise<(MastraScorerEntry & {
|
|
394
|
+
agentIds: string[];
|
|
395
|
+
workflowIds: string[];
|
|
396
|
+
}) | null>;
|
|
397
|
+
|
|
398
|
+
export declare function getScorersHandler({ mastra, runtimeContext }: Context & {
|
|
399
|
+
runtimeContext: RuntimeContext;
|
|
400
|
+
}): Promise<{
|
|
401
|
+
[k: string]: MastraScorerEntry & {
|
|
402
|
+
agentIds: string[];
|
|
403
|
+
workflowIds: string[];
|
|
404
|
+
};
|
|
405
|
+
}>;
|
|
406
|
+
|
|
407
|
+
export declare function getScoresByEntityIdHandler({ mastra, entityId, entityType, pagination, }: Context & {
|
|
408
|
+
entityId: string;
|
|
409
|
+
entityType: string;
|
|
410
|
+
pagination: StoragePagination;
|
|
411
|
+
}): Promise<never[] | {
|
|
412
|
+
pagination: PaginationInfo;
|
|
413
|
+
scores: ScoreRowData[];
|
|
414
|
+
}>;
|
|
415
|
+
|
|
416
|
+
export declare function getScoresByRunIdHandler({ mastra, runId, pagination, }: Context & {
|
|
417
|
+
runId: string;
|
|
418
|
+
pagination: StoragePagination;
|
|
419
|
+
}): Promise<never[] | {
|
|
420
|
+
pagination: PaginationInfo;
|
|
421
|
+
scores: ScoreRowData[];
|
|
422
|
+
}>;
|
|
423
|
+
|
|
424
|
+
export declare function getScoresByScorerIdHandler({ mastra, scorerId, pagination, entityId, entityType, }: Context & {
|
|
425
|
+
scorerId: string;
|
|
426
|
+
pagination: StoragePagination;
|
|
427
|
+
entityId?: string;
|
|
428
|
+
entityType?: string;
|
|
429
|
+
}): Promise<never[] | {
|
|
430
|
+
pagination: PaginationInfo;
|
|
431
|
+
scores: ScoreRowData[];
|
|
432
|
+
}>;
|
|
433
|
+
|
|
373
434
|
/**
|
|
374
435
|
* Get available speakers for an agent
|
|
375
436
|
*/
|
|
@@ -377,7 +438,7 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
|
|
|
377
438
|
voiceId: string;
|
|
378
439
|
}[]>;
|
|
379
440
|
|
|
380
|
-
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<
|
|
441
|
+
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<Trace[]>;
|
|
381
442
|
|
|
382
443
|
export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
|
|
383
444
|
|
|
@@ -438,7 +499,8 @@ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pic
|
|
|
438
499
|
}[]>;
|
|
439
500
|
|
|
440
501
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
441
|
-
steps: SerializedStep
|
|
502
|
+
steps: Record<string, SerializedStep>;
|
|
503
|
+
allSteps: Record<string, SerializedStep>;
|
|
442
504
|
name: string | undefined;
|
|
443
505
|
description: string | undefined;
|
|
444
506
|
stepGraph: SerializedStepFlowEntry[];
|
|
@@ -460,6 +522,21 @@ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, t
|
|
|
460
522
|
|
|
461
523
|
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
462
524
|
|
|
525
|
+
/**
|
|
526
|
+
* Handler to get the working memory for a thread (optionally resource-scoped).
|
|
527
|
+
* @returns workingMemory - the working memory for the thread
|
|
528
|
+
* @returns source - thread or resource
|
|
529
|
+
*/
|
|
530
|
+
export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
531
|
+
resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
|
|
532
|
+
memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
|
|
533
|
+
}): Promise<{
|
|
534
|
+
workingMemory: string | null;
|
|
535
|
+
source: string;
|
|
536
|
+
workingMemoryTemplate: WorkingMemoryTemplate | null;
|
|
537
|
+
threadExists: boolean;
|
|
538
|
+
}>;
|
|
539
|
+
|
|
463
540
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
464
541
|
|
|
465
542
|
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
@@ -554,11 +631,13 @@ export declare class HTTPException extends Error {
|
|
|
554
631
|
* @property res - Optional response object to use.
|
|
555
632
|
* @property message - Optional custom error message.
|
|
556
633
|
* @property cause - Optional cause of the error.
|
|
634
|
+
* @property stack - Optional stack trace for the error.
|
|
557
635
|
*/
|
|
558
636
|
declare type HTTPExceptionOptions = {
|
|
559
637
|
res?: Response;
|
|
560
638
|
message?: string;
|
|
561
639
|
cause?: unknown;
|
|
640
|
+
stack?: string;
|
|
562
641
|
};
|
|
563
642
|
|
|
564
643
|
/**
|
|
@@ -677,8 +756,17 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
|
|
|
677
756
|
}): Promise<{
|
|
678
757
|
status: "success";
|
|
679
758
|
result: {
|
|
680
|
-
|
|
759
|
+
prompt: string;
|
|
760
|
+
resourceId: string;
|
|
761
|
+
result: string;
|
|
762
|
+
task: string;
|
|
763
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
681
764
|
iteration: number;
|
|
765
|
+
isOneOff: boolean;
|
|
766
|
+
threadId?: string | undefined;
|
|
767
|
+
threadResourceId?: string | undefined;
|
|
768
|
+
isComplete?: boolean | undefined;
|
|
769
|
+
completionReason?: string | undefined;
|
|
682
770
|
};
|
|
683
771
|
steps: {
|
|
684
772
|
[x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
|
|
@@ -694,7 +782,10 @@ export declare namespace memory {
|
|
|
694
782
|
createThreadHandler,
|
|
695
783
|
updateThreadHandler,
|
|
696
784
|
deleteThreadHandler,
|
|
697
|
-
|
|
785
|
+
getMessagesPaginatedHandler,
|
|
786
|
+
getMessagesHandler,
|
|
787
|
+
getWorkingMemoryHandler,
|
|
788
|
+
updateWorkingMemoryHandler
|
|
698
789
|
}
|
|
699
790
|
}
|
|
700
791
|
|
|
@@ -783,6 +874,30 @@ export declare function saveMessagesHandler({ mastra, agentId, body, networkId,
|
|
|
783
874
|
};
|
|
784
875
|
}): Promise<MastraMessageV1[]>;
|
|
785
876
|
|
|
877
|
+
export declare function saveScoreHandler({ mastra, score }: Context & {
|
|
878
|
+
score: ScoreRowData;
|
|
879
|
+
}): Promise<never[] | {
|
|
880
|
+
score: ScoreRowData;
|
|
881
|
+
}>;
|
|
882
|
+
|
|
883
|
+
export declare namespace scores {
|
|
884
|
+
export {
|
|
885
|
+
getScorersHandler,
|
|
886
|
+
getScorerHandler,
|
|
887
|
+
getScoresByRunIdHandler,
|
|
888
|
+
getScoresByScorerIdHandler,
|
|
889
|
+
getScoresByEntityIdHandler,
|
|
890
|
+
saveScoreHandler
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
895
|
+
event: string;
|
|
896
|
+
data: unknown;
|
|
897
|
+
}): Promise<{
|
|
898
|
+
message: string;
|
|
899
|
+
}>;
|
|
900
|
+
|
|
786
901
|
declare type SerializedStep = {
|
|
787
902
|
id: string;
|
|
788
903
|
description: string;
|
|
@@ -984,6 +1099,17 @@ export declare function updateThreadHandler({ mastra, agentId, threadId, body, n
|
|
|
984
1099
|
body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
|
|
985
1100
|
}): Promise<StorageThreadType>;
|
|
986
1101
|
|
|
1102
|
+
/**
|
|
1103
|
+
* Handler to update the working memory for a thread (optionally resource-scoped).
|
|
1104
|
+
* @param threadId - the thread id
|
|
1105
|
+
* @param body - the body containing the working memory to update and the resource id (optional)
|
|
1106
|
+
*/
|
|
1107
|
+
export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
1108
|
+
body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
|
|
1109
|
+
}): Promise<{
|
|
1110
|
+
success: boolean;
|
|
1111
|
+
}>;
|
|
1112
|
+
|
|
987
1113
|
declare interface UpsertRequest {
|
|
988
1114
|
indexName: string;
|
|
989
1115
|
vectors: number[][];
|
|
@@ -1054,7 +1180,9 @@ export declare namespace workflows {
|
|
|
1054
1180
|
streamWorkflowHandler,
|
|
1055
1181
|
resumeAsyncWorkflowHandler,
|
|
1056
1182
|
resumeWorkflowHandler,
|
|
1057
|
-
getWorkflowRunsHandler
|
|
1183
|
+
getWorkflowRunsHandler,
|
|
1184
|
+
cancelWorkflowRunHandler,
|
|
1185
|
+
sendWorkflowRunEventHandler
|
|
1058
1186
|
}
|
|
1059
1187
|
}
|
|
1060
1188
|
|
|
@@ -5,8 +5,8 @@ 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
|
|
8
|
+
import { DefaultEngineType } from '@mastra/core';
|
|
9
|
+
import { EvalRow } from '@mastra/core';
|
|
10
10
|
import { GenerateObjectResult } from 'ai';
|
|
11
11
|
import { GenerateTextResult } from 'ai';
|
|
12
12
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
@@ -18,21 +18,28 @@ 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';
|
|
23
26
|
import type { Message } from '@mastra/core/a2a';
|
|
27
|
+
import { PaginationInfo } from '@mastra/core';
|
|
24
28
|
import type { QueryResult } from '@mastra/core/vector';
|
|
25
29
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
26
30
|
import { ReadableStream as ReadableStream_3 } from 'stream/web';
|
|
27
31
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
28
32
|
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
33
|
+
import type { ScoreRowData } from '@mastra/core/scores';
|
|
29
34
|
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
30
|
-
import { Step } from '@mastra/core
|
|
35
|
+
import { Step } from '@mastra/core';
|
|
31
36
|
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
32
37
|
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
33
|
-
import { StepResult } from '@mastra/core
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
38
|
+
import { StepResult } from '@mastra/core';
|
|
39
|
+
import type { StorageGetMessagesArg } from '@mastra/core';
|
|
40
|
+
import type { StoragePagination } from '@mastra/core/storage';
|
|
41
|
+
import { StorageThreadType } from '@mastra/core';
|
|
42
|
+
import { StreamEvent } from '@mastra/core';
|
|
36
43
|
import { Task } from '@mastra/core/a2a';
|
|
37
44
|
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
38
45
|
import type { TaskContext } from '@mastra/core/a2a';
|
|
@@ -41,13 +48,15 @@ import type { TaskQueryParams } from '@mastra/core/a2a';
|
|
|
41
48
|
import type { TaskSendParams } from '@mastra/core/a2a';
|
|
42
49
|
import type { TaskStatus } from '@mastra/core/a2a';
|
|
43
50
|
import type { ToolAction } from '@mastra/core/tools';
|
|
51
|
+
import { Trace } from '@mastra/core';
|
|
44
52
|
import { UIMessage } from 'ai';
|
|
45
53
|
import type { VercelTool } from '@mastra/core/tools';
|
|
46
54
|
import type { WatchEvent } from '@mastra/core/workflows';
|
|
47
55
|
import type { Workflow } from '@mastra/core/workflows';
|
|
48
56
|
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
49
|
-
import { WorkflowResult } from '@mastra/core
|
|
57
|
+
import { WorkflowResult } from '@mastra/core';
|
|
50
58
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
59
|
+
import { WorkingMemoryTemplate } from '@mastra/core';
|
|
51
60
|
import { ZodBoolean } from 'zod';
|
|
52
61
|
import { ZodEnum } from 'zod';
|
|
53
62
|
import { ZodNumber } from 'zod';
|
|
@@ -80,13 +89,17 @@ export declare namespace agents {
|
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
export declare interface ApiError extends
|
|
92
|
+
export declare interface ApiError extends MastraError {
|
|
84
93
|
message: string;
|
|
85
94
|
status?: number;
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
|
|
89
98
|
|
|
99
|
+
export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
100
|
+
message: string;
|
|
101
|
+
}>;
|
|
102
|
+
|
|
90
103
|
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
104
|
|
|
92
105
|
export declare interface Context {
|
|
@@ -340,6 +353,10 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, n
|
|
|
340
353
|
uiMessages: UIMessage[];
|
|
341
354
|
}>;
|
|
342
355
|
|
|
356
|
+
export declare function getMessagesPaginatedHandler({ mastra, threadId, resourceId, selectBy, format, }: StorageGetMessagesArg & Pick<MemoryContext, 'mastra'>): Promise<PaginationInfo & {
|
|
357
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
358
|
+
}>;
|
|
359
|
+
|
|
343
360
|
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
344
361
|
id: string;
|
|
345
362
|
name: string;
|
|
@@ -370,6 +387,50 @@ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<Net
|
|
|
370
387
|
};
|
|
371
388
|
}[]>;
|
|
372
389
|
|
|
390
|
+
export declare function getScorerHandler({ mastra, scorerId, runtimeContext, }: Context & {
|
|
391
|
+
scorerId: string;
|
|
392
|
+
runtimeContext: RuntimeContext;
|
|
393
|
+
}): Promise<(MastraScorerEntry & {
|
|
394
|
+
agentIds: string[];
|
|
395
|
+
workflowIds: string[];
|
|
396
|
+
}) | null>;
|
|
397
|
+
|
|
398
|
+
export declare function getScorersHandler({ mastra, runtimeContext }: Context & {
|
|
399
|
+
runtimeContext: RuntimeContext;
|
|
400
|
+
}): Promise<{
|
|
401
|
+
[k: string]: MastraScorerEntry & {
|
|
402
|
+
agentIds: string[];
|
|
403
|
+
workflowIds: string[];
|
|
404
|
+
};
|
|
405
|
+
}>;
|
|
406
|
+
|
|
407
|
+
export declare function getScoresByEntityIdHandler({ mastra, entityId, entityType, pagination, }: Context & {
|
|
408
|
+
entityId: string;
|
|
409
|
+
entityType: string;
|
|
410
|
+
pagination: StoragePagination;
|
|
411
|
+
}): Promise<never[] | {
|
|
412
|
+
pagination: PaginationInfo;
|
|
413
|
+
scores: ScoreRowData[];
|
|
414
|
+
}>;
|
|
415
|
+
|
|
416
|
+
export declare function getScoresByRunIdHandler({ mastra, runId, pagination, }: Context & {
|
|
417
|
+
runId: string;
|
|
418
|
+
pagination: StoragePagination;
|
|
419
|
+
}): Promise<never[] | {
|
|
420
|
+
pagination: PaginationInfo;
|
|
421
|
+
scores: ScoreRowData[];
|
|
422
|
+
}>;
|
|
423
|
+
|
|
424
|
+
export declare function getScoresByScorerIdHandler({ mastra, scorerId, pagination, entityId, entityType, }: Context & {
|
|
425
|
+
scorerId: string;
|
|
426
|
+
pagination: StoragePagination;
|
|
427
|
+
entityId?: string;
|
|
428
|
+
entityType?: string;
|
|
429
|
+
}): Promise<never[] | {
|
|
430
|
+
pagination: PaginationInfo;
|
|
431
|
+
scores: ScoreRowData[];
|
|
432
|
+
}>;
|
|
433
|
+
|
|
373
434
|
/**
|
|
374
435
|
* Get available speakers for an agent
|
|
375
436
|
*/
|
|
@@ -377,7 +438,7 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
|
|
|
377
438
|
voiceId: string;
|
|
378
439
|
}[]>;
|
|
379
440
|
|
|
380
|
-
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<
|
|
441
|
+
export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<Trace[]>;
|
|
381
442
|
|
|
382
443
|
export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
|
|
383
444
|
|
|
@@ -438,7 +499,8 @@ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pic
|
|
|
438
499
|
}[]>;
|
|
439
500
|
|
|
440
501
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
441
|
-
steps: SerializedStep
|
|
502
|
+
steps: Record<string, SerializedStep>;
|
|
503
|
+
allSteps: Record<string, SerializedStep>;
|
|
442
504
|
name: string | undefined;
|
|
443
505
|
description: string | undefined;
|
|
444
506
|
stepGraph: SerializedStepFlowEntry[];
|
|
@@ -460,6 +522,21 @@ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, t
|
|
|
460
522
|
|
|
461
523
|
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
462
524
|
|
|
525
|
+
/**
|
|
526
|
+
* Handler to get the working memory for a thread (optionally resource-scoped).
|
|
527
|
+
* @returns workingMemory - the working memory for the thread
|
|
528
|
+
* @returns source - thread or resource
|
|
529
|
+
*/
|
|
530
|
+
export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
531
|
+
resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
|
|
532
|
+
memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
|
|
533
|
+
}): Promise<{
|
|
534
|
+
workingMemory: string | null;
|
|
535
|
+
source: string;
|
|
536
|
+
workingMemoryTemplate: WorkingMemoryTemplate | null;
|
|
537
|
+
threadExists: boolean;
|
|
538
|
+
}>;
|
|
539
|
+
|
|
463
540
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
464
541
|
|
|
465
542
|
export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
|
|
@@ -554,11 +631,13 @@ export declare class HTTPException extends Error {
|
|
|
554
631
|
* @property res - Optional response object to use.
|
|
555
632
|
* @property message - Optional custom error message.
|
|
556
633
|
* @property cause - Optional cause of the error.
|
|
634
|
+
* @property stack - Optional stack trace for the error.
|
|
557
635
|
*/
|
|
558
636
|
declare type HTTPExceptionOptions = {
|
|
559
637
|
res?: Response;
|
|
560
638
|
message?: string;
|
|
561
639
|
cause?: unknown;
|
|
640
|
+
stack?: string;
|
|
562
641
|
};
|
|
563
642
|
|
|
564
643
|
/**
|
|
@@ -677,8 +756,17 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
|
|
|
677
756
|
}): Promise<{
|
|
678
757
|
status: "success";
|
|
679
758
|
result: {
|
|
680
|
-
|
|
759
|
+
prompt: string;
|
|
760
|
+
resourceId: string;
|
|
761
|
+
result: string;
|
|
762
|
+
task: string;
|
|
763
|
+
resourceType: "none" | "tool" | "workflow" | "agent";
|
|
681
764
|
iteration: number;
|
|
765
|
+
isOneOff: boolean;
|
|
766
|
+
threadId?: string | undefined;
|
|
767
|
+
threadResourceId?: string | undefined;
|
|
768
|
+
isComplete?: boolean | undefined;
|
|
769
|
+
completionReason?: string | undefined;
|
|
682
770
|
};
|
|
683
771
|
steps: {
|
|
684
772
|
[x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
|
|
@@ -694,7 +782,10 @@ export declare namespace memory {
|
|
|
694
782
|
createThreadHandler,
|
|
695
783
|
updateThreadHandler,
|
|
696
784
|
deleteThreadHandler,
|
|
697
|
-
|
|
785
|
+
getMessagesPaginatedHandler,
|
|
786
|
+
getMessagesHandler,
|
|
787
|
+
getWorkingMemoryHandler,
|
|
788
|
+
updateWorkingMemoryHandler
|
|
698
789
|
}
|
|
699
790
|
}
|
|
700
791
|
|
|
@@ -783,6 +874,30 @@ export declare function saveMessagesHandler({ mastra, agentId, body, networkId,
|
|
|
783
874
|
};
|
|
784
875
|
}): Promise<MastraMessageV1[]>;
|
|
785
876
|
|
|
877
|
+
export declare function saveScoreHandler({ mastra, score }: Context & {
|
|
878
|
+
score: ScoreRowData;
|
|
879
|
+
}): Promise<never[] | {
|
|
880
|
+
score: ScoreRowData;
|
|
881
|
+
}>;
|
|
882
|
+
|
|
883
|
+
export declare namespace scores {
|
|
884
|
+
export {
|
|
885
|
+
getScorersHandler,
|
|
886
|
+
getScorerHandler,
|
|
887
|
+
getScoresByRunIdHandler,
|
|
888
|
+
getScoresByScorerIdHandler,
|
|
889
|
+
getScoresByEntityIdHandler,
|
|
890
|
+
saveScoreHandler
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
895
|
+
event: string;
|
|
896
|
+
data: unknown;
|
|
897
|
+
}): Promise<{
|
|
898
|
+
message: string;
|
|
899
|
+
}>;
|
|
900
|
+
|
|
786
901
|
declare type SerializedStep = {
|
|
787
902
|
id: string;
|
|
788
903
|
description: string;
|
|
@@ -984,6 +1099,17 @@ export declare function updateThreadHandler({ mastra, agentId, threadId, body, n
|
|
|
984
1099
|
body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
|
|
985
1100
|
}): Promise<StorageThreadType>;
|
|
986
1101
|
|
|
1102
|
+
/**
|
|
1103
|
+
* Handler to update the working memory for a thread (optionally resource-scoped).
|
|
1104
|
+
* @param threadId - the thread id
|
|
1105
|
+
* @param body - the body containing the working memory to update and the resource id (optional)
|
|
1106
|
+
*/
|
|
1107
|
+
export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
|
|
1108
|
+
body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
|
|
1109
|
+
}): Promise<{
|
|
1110
|
+
success: boolean;
|
|
1111
|
+
}>;
|
|
1112
|
+
|
|
987
1113
|
declare interface UpsertRequest {
|
|
988
1114
|
indexName: string;
|
|
989
1115
|
vectors: number[][];
|
|
@@ -1054,7 +1180,9 @@ export declare namespace workflows {
|
|
|
1054
1180
|
streamWorkflowHandler,
|
|
1055
1181
|
resumeAsyncWorkflowHandler,
|
|
1056
1182
|
resumeWorkflowHandler,
|
|
1057
|
-
getWorkflowRunsHandler
|
|
1183
|
+
getWorkflowRunsHandler,
|
|
1184
|
+
cancelWorkflowRunHandler,
|
|
1185
|
+
sendWorkflowRunEventHandler
|
|
1058
1186
|
}
|
|
1059
1187
|
}
|
|
1060
1188
|
|
|
@@ -13,6 +13,7 @@ var HTTPException = class extends Error {
|
|
|
13
13
|
super(options?.message, { cause: options?.cause });
|
|
14
14
|
this.res = options?.res;
|
|
15
15
|
this.status = status;
|
|
16
|
+
this.stack = options?.stack || this.stack;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Returns the response object associated with the exception.
|