@mastra/server 2.0.4 → 2.1.0-alpha.1
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/dist/_tsup-dts-rollup.d.cts +97 -95
- package/dist/_tsup-dts-rollup.d.ts +97 -95
- package/dist/{chunk-IU5VO2I2.js → chunk-55DOQLP6.js} +2 -2
- package/dist/{chunk-UCTEMO2Q.cjs → chunk-6B4OMWT6.cjs} +46 -44
- package/dist/{chunk-OGCNNUHF.cjs → chunk-7DLZLWJV.cjs} +3 -2
- package/dist/{chunk-4YZ3U35L.cjs → chunk-BNEY4P4P.cjs} +2 -2
- package/dist/{chunk-MIQYDLLM.js → chunk-QY36IPTP.js} +36 -34
- package/dist/{chunk-EJO45KYT.js → chunk-W7VCKPAD.js} +34 -34
- package/dist/{chunk-HWZVAG3H.js → chunk-WFBJJNCK.js} +3 -2
- package/dist/{chunk-I2B73Y4I.cjs → chunk-YIOVBYZH.cjs} +44 -44
- package/dist/server/handlers/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/workflows.cjs +13 -13
- package/dist/server/handlers/workflows.d.cts +2 -2
- package/dist/server/handlers/workflows.d.ts +2 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +16 -16
- package/dist/server/handlers.d.cts +1 -1
- package/dist/server/handlers.d.ts +1 -1
- package/dist/server/handlers.js +5 -5
- package/package.json +4 -4
- package/dist/server/handlers/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
|
@@ -8,24 +8,26 @@ import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
|
|
|
8
8
|
import { EvalRow } from '@mastra/core/storage';
|
|
9
9
|
import { GenerateObjectResult } from 'ai';
|
|
10
10
|
import { GenerateTextResult } from 'ai';
|
|
11
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
11
12
|
import type { JSONRPCError } from '@mastra/core/a2a';
|
|
12
13
|
import { JSONRPCResponse } from '@mastra/core/a2a';
|
|
13
|
-
import
|
|
14
|
+
import { LegacyStep } from '@mastra/core/workflows/legacy';
|
|
15
|
+
import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
|
|
16
|
+
import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
|
|
17
|
+
import type { LegacyWorkflowRuns } from '@mastra/core/storage';
|
|
14
18
|
import type { Mastra } from '@mastra/core/mastra';
|
|
15
19
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
16
20
|
import { Message } from 'ai';
|
|
17
21
|
import type { Message as Message_2 } from '@mastra/core/a2a';
|
|
18
22
|
import { MessageType } from '@mastra/core/memory';
|
|
19
|
-
import { NewStep } from '@mastra/core/workflows/vNext';
|
|
20
|
-
import type { NewWorkflow } from '@mastra/core/workflows/vNext';
|
|
21
23
|
import type { QueryResult } from '@mastra/core/vector';
|
|
22
24
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
23
25
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
24
26
|
import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
25
|
-
import type { SerializedStepFlowEntry } from '@mastra/core/workflows
|
|
27
|
+
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
26
28
|
import { Step } from '@mastra/core/workflows';
|
|
27
|
-
import { StepExecutionContext } from '@mastra/core/workflows';
|
|
28
|
-
import { StepGraph } from '@mastra/core/workflows';
|
|
29
|
+
import { StepExecutionContext } from '@mastra/core/workflows/legacy';
|
|
30
|
+
import { StepGraph } from '@mastra/core/workflows/legacy';
|
|
29
31
|
import { StorageThreadType } from '@mastra/core/memory';
|
|
30
32
|
import { Task } from '@mastra/core/a2a';
|
|
31
33
|
import { TaskAndHistory } from '@mastra/core/a2a';
|
|
@@ -37,9 +39,8 @@ import type { TaskStatus } from '@mastra/core/a2a';
|
|
|
37
39
|
import type { ToolAction } from '@mastra/core/tools';
|
|
38
40
|
import type { VercelTool } from '@mastra/core/tools';
|
|
39
41
|
import type { Workflow } from '@mastra/core/workflows';
|
|
40
|
-
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
|
|
41
|
-
import { WorkflowResult } from '@mastra/core/workflows
|
|
42
|
-
import { WorkflowRunResult } from '@mastra/core/workflows';
|
|
42
|
+
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
|
|
43
|
+
import { WorkflowResult } from '@mastra/core/workflows';
|
|
43
44
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
44
45
|
import { ZodType } from 'zod';
|
|
45
46
|
import { ZodTypeDef } from 'zod';
|
|
@@ -95,7 +96,7 @@ declare interface CreateIndexRequest {
|
|
|
95
96
|
metric?: 'cosine' | 'euclidean' | 'dotproduct';
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
export declare function
|
|
99
|
+
export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
99
100
|
runId: string;
|
|
100
101
|
}>;
|
|
101
102
|
|
|
@@ -114,7 +115,7 @@ export declare function createThreadHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
114
115
|
};
|
|
115
116
|
}): Promise<StorageThreadType>;
|
|
116
117
|
|
|
117
|
-
export declare function
|
|
118
|
+
export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
118
119
|
runId: string;
|
|
119
120
|
}>;
|
|
120
121
|
|
|
@@ -207,7 +208,7 @@ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, r
|
|
|
207
208
|
method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
|
|
208
209
|
params: TaskSendParams | TaskQueryParams | TaskIdParams;
|
|
209
210
|
taskStore?: InMemoryTaskStore;
|
|
210
|
-
logger?:
|
|
211
|
+
logger?: IMastraLogger;
|
|
211
212
|
}): Promise<any>;
|
|
212
213
|
|
|
213
214
|
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
@@ -230,6 +231,28 @@ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agent
|
|
|
230
231
|
evals: EvalRow[];
|
|
231
232
|
}>;
|
|
232
233
|
|
|
234
|
+
export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
235
|
+
stepGraph: StepGraph;
|
|
236
|
+
stepSubscriberGraph: Record<string, StepGraph>;
|
|
237
|
+
serializedStepGraph: StepGraph;
|
|
238
|
+
serializedStepSubscriberGraph: Record<string, StepGraph>;
|
|
239
|
+
name: string;
|
|
240
|
+
triggerSchema: string | undefined;
|
|
241
|
+
steps: any;
|
|
242
|
+
}>;
|
|
243
|
+
|
|
244
|
+
export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
|
|
245
|
+
|
|
246
|
+
export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
247
|
+
fromDate?: Date;
|
|
248
|
+
toDate?: Date;
|
|
249
|
+
limit?: number;
|
|
250
|
+
offset?: number;
|
|
251
|
+
resourceId?: string;
|
|
252
|
+
}): Promise<LegacyWorkflowRuns>;
|
|
253
|
+
|
|
254
|
+
export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
255
|
+
|
|
233
256
|
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
234
257
|
runtimeContext: RuntimeContext;
|
|
235
258
|
agentId: string;
|
|
@@ -240,7 +263,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, a
|
|
|
240
263
|
evals: EvalRow[];
|
|
241
264
|
}>;
|
|
242
265
|
|
|
243
|
-
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<
|
|
266
|
+
export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
|
|
244
267
|
|
|
245
268
|
export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
|
|
246
269
|
|
|
@@ -306,17 +329,18 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
306
329
|
|
|
307
330
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
308
331
|
|
|
309
|
-
export declare function
|
|
332
|
+
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
|
|
310
333
|
steps: SerializedStep[];
|
|
311
334
|
name: string | undefined;
|
|
335
|
+
description: string | undefined;
|
|
312
336
|
stepGraph: SerializedStepFlowEntry[];
|
|
313
337
|
inputSchema: string | undefined;
|
|
314
338
|
outputSchema: string | undefined;
|
|
315
339
|
}>;
|
|
316
340
|
|
|
317
|
-
export declare function
|
|
341
|
+
export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
|
|
318
342
|
|
|
319
|
-
export declare function
|
|
343
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
|
|
320
344
|
fromDate?: Date;
|
|
321
345
|
toDate?: Date;
|
|
322
346
|
limit?: number;
|
|
@@ -324,29 +348,7 @@ export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDa
|
|
|
324
348
|
resourceId?: string;
|
|
325
349
|
}): Promise<WorkflowRuns>;
|
|
326
350
|
|
|
327
|
-
export declare function
|
|
328
|
-
|
|
329
|
-
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
330
|
-
stepGraph: StepGraph;
|
|
331
|
-
stepSubscriberGraph: Record<string, StepGraph>;
|
|
332
|
-
serializedStepGraph: StepGraph;
|
|
333
|
-
serializedStepSubscriberGraph: Record<string, StepGraph>;
|
|
334
|
-
name: string;
|
|
335
|
-
triggerSchema: string | undefined;
|
|
336
|
-
steps: any;
|
|
337
|
-
}>;
|
|
338
|
-
|
|
339
|
-
export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
|
|
340
|
-
|
|
341
|
-
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
342
|
-
fromDate?: Date;
|
|
343
|
-
toDate?: Date;
|
|
344
|
-
limit?: number;
|
|
345
|
-
offset?: number;
|
|
346
|
-
resourceId?: string;
|
|
347
|
-
}): Promise<WorkflowRuns>;
|
|
348
|
-
|
|
349
|
-
export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
351
|
+
export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
|
|
350
352
|
|
|
351
353
|
export declare function handleError(error: unknown, defaultMessage: string): never;
|
|
352
354
|
|
|
@@ -355,7 +357,7 @@ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId
|
|
|
355
357
|
taskStore: InMemoryTaskStore;
|
|
356
358
|
agentId: string;
|
|
357
359
|
taskId: string;
|
|
358
|
-
logger?:
|
|
360
|
+
logger?: IMastraLogger;
|
|
359
361
|
}): Promise<JSONRPCResponse<Task, unknown>>;
|
|
360
362
|
|
|
361
363
|
export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
|
|
@@ -370,7 +372,7 @@ export declare function handleTaskSend({ requestId, params, taskStore, agent, lo
|
|
|
370
372
|
params: TaskSendParams;
|
|
371
373
|
taskStore: InMemoryTaskStore;
|
|
372
374
|
agent: Agent;
|
|
373
|
-
logger?:
|
|
375
|
+
logger?: IMastraLogger;
|
|
374
376
|
runtimeContext: RuntimeContext;
|
|
375
377
|
}): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
|
|
376
378
|
|
|
@@ -379,7 +381,7 @@ export declare function handleTaskSendSubscribe({ requestId, params, taskStore,
|
|
|
379
381
|
params: TaskSendParams;
|
|
380
382
|
taskStore: InMemoryTaskStore;
|
|
381
383
|
agent: Agent;
|
|
382
|
-
logger?:
|
|
384
|
+
logger?: IMastraLogger;
|
|
383
385
|
runtimeContext: RuntimeContext;
|
|
384
386
|
}): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
|
|
385
387
|
state: string;
|
|
@@ -466,6 +468,21 @@ export declare class InMemoryTaskStore {
|
|
|
466
468
|
}): Promise<void>;
|
|
467
469
|
}
|
|
468
470
|
|
|
471
|
+
export declare namespace legacyWorkflows {
|
|
472
|
+
export {
|
|
473
|
+
getLegacyWorkflowsHandler,
|
|
474
|
+
getLegacyWorkflowByIdHandler,
|
|
475
|
+
startAsyncLegacyWorkflowHandler,
|
|
476
|
+
getLegacyWorkflowRunHandler,
|
|
477
|
+
createLegacyWorkflowRunHandler,
|
|
478
|
+
startLegacyWorkflowRunHandler,
|
|
479
|
+
watchLegacyWorkflowHandler,
|
|
480
|
+
resumeAsyncLegacyWorkflowHandler,
|
|
481
|
+
resumeLegacyWorkflowHandler,
|
|
482
|
+
getLegacyWorkflowRunsHandler
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
469
486
|
export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
|
|
470
487
|
|
|
471
488
|
export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
|
|
@@ -475,7 +492,7 @@ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore,
|
|
|
475
492
|
message: Message_2;
|
|
476
493
|
sessionId?: string | null;
|
|
477
494
|
metadata?: Record<string, unknown> | null;
|
|
478
|
-
logger?:
|
|
495
|
+
logger?: IMastraLogger;
|
|
479
496
|
}): Promise<TaskAndHistory>;
|
|
480
497
|
|
|
481
498
|
export declare namespace logs {
|
|
@@ -525,7 +542,7 @@ declare interface NetworkContext extends Context {
|
|
|
525
542
|
runtimeContext: RuntimeContext;
|
|
526
543
|
}
|
|
527
544
|
|
|
528
|
-
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?:
|
|
545
|
+
export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
|
|
529
546
|
|
|
530
547
|
declare interface QueryRequest {
|
|
531
548
|
indexName: string;
|
|
@@ -541,39 +558,39 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
|
|
|
541
558
|
|
|
542
559
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
543
560
|
|
|
544
|
-
export declare function
|
|
561
|
+
export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
562
|
+
body: {
|
|
563
|
+
stepId: string;
|
|
564
|
+
context: any;
|
|
565
|
+
};
|
|
566
|
+
runtimeContext: RuntimeContext;
|
|
567
|
+
}): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
568
|
+
|
|
569
|
+
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
|
|
545
570
|
body: {
|
|
546
571
|
step: string | string[];
|
|
547
572
|
resumeData?: unknown;
|
|
548
573
|
};
|
|
549
574
|
runtimeContext?: RuntimeContext_2;
|
|
550
575
|
runtimeContextFromRequest?: Record<string, unknown>;
|
|
551
|
-
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>,
|
|
576
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
|
|
552
577
|
|
|
553
|
-
export declare function
|
|
578
|
+
export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
554
579
|
body: {
|
|
555
580
|
stepId: string;
|
|
556
581
|
context: any;
|
|
557
582
|
};
|
|
558
583
|
runtimeContext: RuntimeContext;
|
|
559
|
-
}): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
560
|
-
|
|
561
|
-
export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
|
|
562
|
-
body: {
|
|
563
|
-
step: string | string[];
|
|
564
|
-
resumeData?: unknown;
|
|
565
|
-
};
|
|
566
|
-
runtimeContext?: RuntimeContext_2;
|
|
567
584
|
}): Promise<{
|
|
568
585
|
message: string;
|
|
569
586
|
}>;
|
|
570
587
|
|
|
571
|
-
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }:
|
|
588
|
+
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
|
|
572
589
|
body: {
|
|
573
|
-
|
|
574
|
-
|
|
590
|
+
step: string | string[];
|
|
591
|
+
resumeData?: unknown;
|
|
575
592
|
};
|
|
576
|
-
runtimeContext
|
|
593
|
+
runtimeContext?: RuntimeContext_2;
|
|
577
594
|
}): Promise<{
|
|
578
595
|
message: string;
|
|
579
596
|
}>;
|
|
@@ -595,28 +612,28 @@ declare type SerializedStep = {
|
|
|
595
612
|
|
|
596
613
|
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
597
614
|
|
|
598
|
-
export declare function
|
|
599
|
-
inputData?: unknown;
|
|
600
|
-
runtimeContext?: RuntimeContext_2;
|
|
601
|
-
runtimeContextFromRequest?: Record<string, unknown>;
|
|
602
|
-
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
603
|
-
|
|
604
|
-
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
615
|
+
export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
605
616
|
triggerData?: unknown;
|
|
606
617
|
runtimeContext: RuntimeContext;
|
|
607
|
-
}): Promise<
|
|
618
|
+
}): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
608
619
|
|
|
609
|
-
export declare function
|
|
620
|
+
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
610
621
|
inputData?: unknown;
|
|
611
622
|
runtimeContext?: RuntimeContext_2;
|
|
612
623
|
runtimeContextFromRequest?: Record<string, unknown>;
|
|
624
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
|
|
625
|
+
|
|
626
|
+
export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
627
|
+
triggerData?: unknown;
|
|
628
|
+
runtimeContext: RuntimeContext;
|
|
613
629
|
}): Promise<{
|
|
614
630
|
message: string;
|
|
615
631
|
}>;
|
|
616
632
|
|
|
617
|
-
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId,
|
|
618
|
-
|
|
619
|
-
runtimeContext
|
|
633
|
+
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
634
|
+
inputData?: unknown;
|
|
635
|
+
runtimeContext?: RuntimeContext_2;
|
|
636
|
+
runtimeContextFromRequest?: Record<string, unknown>;
|
|
620
637
|
}): Promise<{
|
|
621
638
|
message: string;
|
|
622
639
|
}>;
|
|
@@ -756,26 +773,6 @@ declare interface VectorContext extends Context {
|
|
|
756
773
|
vectorName?: string;
|
|
757
774
|
}
|
|
758
775
|
|
|
759
|
-
declare interface VNextWorkflowContext extends Context {
|
|
760
|
-
workflowId?: string;
|
|
761
|
-
runId?: string;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
export declare namespace vNextWorkflows {
|
|
765
|
-
export {
|
|
766
|
-
getVNextWorkflowsHandler,
|
|
767
|
-
getVNextWorkflowByIdHandler,
|
|
768
|
-
getVNextWorkflowRunByIdHandler,
|
|
769
|
-
createVNextWorkflowRunHandler,
|
|
770
|
-
startAsyncVNextWorkflowHandler,
|
|
771
|
-
startVNextWorkflowRunHandler,
|
|
772
|
-
watchVNextWorkflowHandler,
|
|
773
|
-
resumeAsyncVNextWorkflowHandler,
|
|
774
|
-
resumeVNextWorkflowHandler,
|
|
775
|
-
getVNextWorkflowRunsHandler
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
|
|
779
776
|
export declare namespace voice {
|
|
780
777
|
export {
|
|
781
778
|
getSpeakersHandler,
|
|
@@ -788,22 +785,27 @@ declare interface VoiceContext extends Context {
|
|
|
788
785
|
agentId?: string;
|
|
789
786
|
}
|
|
790
787
|
|
|
791
|
-
export declare function
|
|
788
|
+
export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
792
789
|
|
|
793
|
-
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<
|
|
790
|
+
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
794
791
|
|
|
795
792
|
declare interface WorkflowContext extends Context {
|
|
796
793
|
workflowId?: string;
|
|
797
794
|
runId?: string;
|
|
798
795
|
}
|
|
799
796
|
|
|
797
|
+
declare interface WorkflowContext_3 extends Context {
|
|
798
|
+
workflowId?: string;
|
|
799
|
+
runId?: string;
|
|
800
|
+
}
|
|
801
|
+
|
|
800
802
|
export declare namespace workflows {
|
|
801
803
|
export {
|
|
802
804
|
getWorkflowsHandler,
|
|
803
805
|
getWorkflowByIdHandler,
|
|
806
|
+
getWorkflowRunByIdHandler,
|
|
807
|
+
createWorkflowRunHandler,
|
|
804
808
|
startAsyncWorkflowHandler,
|
|
805
|
-
getWorkflowRunHandler,
|
|
806
|
-
createRunHandler,
|
|
807
809
|
startWorkflowRunHandler,
|
|
808
810
|
watchWorkflowHandler,
|
|
809
811
|
resumeAsyncWorkflowHandler,
|
|
@@ -91,7 +91,7 @@ async function describeIndex({
|
|
|
91
91
|
throw new HTTPException(400, { message: "Index name is required" });
|
|
92
92
|
}
|
|
93
93
|
const vector = getVector(mastra, vectorName);
|
|
94
|
-
const stats = await vector.describeIndex(indexName);
|
|
94
|
+
const stats = await vector.describeIndex({ indexName });
|
|
95
95
|
return {
|
|
96
96
|
dimension: stats.dimension,
|
|
97
97
|
count: stats.count,
|
|
@@ -111,7 +111,7 @@ async function deleteIndex({
|
|
|
111
111
|
throw new HTTPException(400, { message: "Index name is required" });
|
|
112
112
|
}
|
|
113
113
|
const vector = getVector(mastra, vectorName);
|
|
114
|
-
await vector.deleteIndex(indexName);
|
|
114
|
+
await vector.deleteIndex({ indexName });
|
|
115
115
|
return { success: true };
|
|
116
116
|
} catch (error) {
|
|
117
117
|
return handleError(error, "Error deleting index");
|
|
@@ -7,26 +7,27 @@ var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
|
7
7
|
var web = require('stream/web');
|
|
8
8
|
var di = require('@mastra/core/di');
|
|
9
9
|
|
|
10
|
-
// src/server/handlers/
|
|
11
|
-
var
|
|
12
|
-
chunk75ZPJI57_cjs.__export(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
// src/server/handlers/workflows.ts
|
|
11
|
+
var workflows_exports = {};
|
|
12
|
+
chunk75ZPJI57_cjs.__export(workflows_exports, {
|
|
13
|
+
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
14
|
+
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
15
|
+
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
16
|
+
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
17
|
+
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
18
|
+
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
19
|
+
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
20
|
+
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
21
|
+
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
22
|
+
watchWorkflowHandler: () => watchWorkflowHandler
|
|
23
23
|
});
|
|
24
|
-
async function
|
|
24
|
+
async function getWorkflowsHandler({ mastra }) {
|
|
25
25
|
try {
|
|
26
|
-
const workflows = mastra.
|
|
26
|
+
const workflows = mastra.getWorkflows({ serialized: false });
|
|
27
27
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
28
28
|
acc[key] = {
|
|
29
29
|
name: workflow.name,
|
|
30
|
+
description: workflow.description,
|
|
30
31
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
31
32
|
acc2[key2] = {
|
|
32
33
|
id: step.id,
|
|
@@ -49,12 +50,12 @@ async function getVNextWorkflowsHandler({ mastra }) {
|
|
|
49
50
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
async function
|
|
53
|
+
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
53
54
|
try {
|
|
54
55
|
if (!workflowId) {
|
|
55
56
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
56
57
|
}
|
|
57
|
-
const workflow = mastra.
|
|
58
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
58
59
|
if (!workflow) {
|
|
59
60
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
60
61
|
}
|
|
@@ -71,6 +72,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
71
72
|
return acc;
|
|
72
73
|
}, {}),
|
|
73
74
|
name: workflow.name,
|
|
75
|
+
description: workflow.description,
|
|
74
76
|
stepGraph: workflow.serializedStepGraph,
|
|
75
77
|
inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
76
78
|
outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
@@ -79,7 +81,7 @@ async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
79
81
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
|
-
async function
|
|
84
|
+
async function getWorkflowRunByIdHandler({
|
|
83
85
|
mastra,
|
|
84
86
|
workflowId,
|
|
85
87
|
runId
|
|
@@ -91,7 +93,7 @@ async function getVNextWorkflowRunByIdHandler({
|
|
|
91
93
|
if (!runId) {
|
|
92
94
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
93
95
|
}
|
|
94
|
-
const workflow = mastra.
|
|
96
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
95
97
|
if (!workflow) {
|
|
96
98
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
97
99
|
}
|
|
@@ -104,7 +106,7 @@ async function getVNextWorkflowRunByIdHandler({
|
|
|
104
106
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
|
-
async function
|
|
109
|
+
async function createWorkflowRunHandler({
|
|
108
110
|
mastra,
|
|
109
111
|
workflowId,
|
|
110
112
|
runId: prevRunId
|
|
@@ -113,7 +115,7 @@ async function createVNextWorkflowRunHandler({
|
|
|
113
115
|
if (!workflowId) {
|
|
114
116
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
115
117
|
}
|
|
116
|
-
const workflow = mastra.
|
|
118
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
117
119
|
if (!workflow) {
|
|
118
120
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
119
121
|
}
|
|
@@ -123,7 +125,7 @@ async function createVNextWorkflowRunHandler({
|
|
|
123
125
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
|
-
async function
|
|
128
|
+
async function startAsyncWorkflowHandler({
|
|
127
129
|
mastra,
|
|
128
130
|
runtimeContext,
|
|
129
131
|
workflowId,
|
|
@@ -135,7 +137,7 @@ async function startAsyncVNextWorkflowHandler({
|
|
|
135
137
|
if (!workflowId) {
|
|
136
138
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
137
139
|
}
|
|
138
|
-
const workflow = mastra.
|
|
140
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
139
141
|
if (!workflow) {
|
|
140
142
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
141
143
|
}
|
|
@@ -153,7 +155,7 @@ async function startAsyncVNextWorkflowHandler({
|
|
|
153
155
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
|
-
async function
|
|
158
|
+
async function startWorkflowRunHandler({
|
|
157
159
|
mastra,
|
|
158
160
|
runtimeContext,
|
|
159
161
|
workflowId,
|
|
@@ -168,7 +170,7 @@ async function startVNextWorkflowRunHandler({
|
|
|
168
170
|
if (!runId) {
|
|
169
171
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
170
172
|
}
|
|
171
|
-
const workflow = mastra.
|
|
173
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
172
174
|
const run = await workflow.getWorkflowRunById(runId);
|
|
173
175
|
if (!run) {
|
|
174
176
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -187,7 +189,7 @@ async function startVNextWorkflowRunHandler({
|
|
|
187
189
|
return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
|
|
188
190
|
}
|
|
189
191
|
}
|
|
190
|
-
async function
|
|
192
|
+
async function watchWorkflowHandler({
|
|
191
193
|
mastra,
|
|
192
194
|
workflowId,
|
|
193
195
|
runId
|
|
@@ -199,7 +201,7 @@ async function watchVNextWorkflowHandler({
|
|
|
199
201
|
if (!runId) {
|
|
200
202
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
201
203
|
}
|
|
202
|
-
const workflow = mastra.
|
|
204
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
203
205
|
const run = await workflow.getWorkflowRunById(runId);
|
|
204
206
|
if (!run) {
|
|
205
207
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -233,7 +235,7 @@ async function watchVNextWorkflowHandler({
|
|
|
233
235
|
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
|
-
async function
|
|
238
|
+
async function resumeAsyncWorkflowHandler({
|
|
237
239
|
mastra,
|
|
238
240
|
workflowId,
|
|
239
241
|
runId,
|
|
@@ -251,7 +253,7 @@ async function resumeAsyncVNextWorkflowHandler({
|
|
|
251
253
|
if (!body.step) {
|
|
252
254
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
253
255
|
}
|
|
254
|
-
const workflow = mastra.
|
|
256
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
255
257
|
const run = await workflow.getWorkflowRunById(runId);
|
|
256
258
|
if (!run) {
|
|
257
259
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -271,7 +273,7 @@ async function resumeAsyncVNextWorkflowHandler({
|
|
|
271
273
|
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
|
|
272
274
|
}
|
|
273
275
|
}
|
|
274
|
-
async function
|
|
276
|
+
async function resumeWorkflowHandler({
|
|
275
277
|
mastra,
|
|
276
278
|
workflowId,
|
|
277
279
|
runId,
|
|
@@ -288,7 +290,7 @@ async function resumeVNextWorkflowHandler({
|
|
|
288
290
|
if (!body.step) {
|
|
289
291
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
290
292
|
}
|
|
291
|
-
const workflow = mastra.
|
|
293
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
292
294
|
const run = await workflow.getWorkflowRunById(runId);
|
|
293
295
|
if (!run) {
|
|
294
296
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -304,7 +306,7 @@ async function resumeVNextWorkflowHandler({
|
|
|
304
306
|
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
|
|
305
307
|
}
|
|
306
308
|
}
|
|
307
|
-
async function
|
|
309
|
+
async function getWorkflowRunsHandler({
|
|
308
310
|
mastra,
|
|
309
311
|
workflowId,
|
|
310
312
|
fromDate,
|
|
@@ -317,7 +319,7 @@ async function getVNextWorkflowRunsHandler({
|
|
|
317
319
|
if (!workflowId) {
|
|
318
320
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
319
321
|
}
|
|
320
|
-
const workflow = mastra.
|
|
322
|
+
const workflow = mastra.getWorkflow(workflowId);
|
|
321
323
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
322
324
|
runs: [],
|
|
323
325
|
total: 0
|
|
@@ -328,14 +330,14 @@ async function getVNextWorkflowRunsHandler({
|
|
|
328
330
|
}
|
|
329
331
|
}
|
|
330
332
|
|
|
331
|
-
exports.
|
|
332
|
-
exports.
|
|
333
|
-
exports.
|
|
334
|
-
exports.
|
|
335
|
-
exports.
|
|
336
|
-
exports.
|
|
337
|
-
exports.
|
|
338
|
-
exports.
|
|
339
|
-
exports.
|
|
340
|
-
exports.
|
|
341
|
-
exports.
|
|
333
|
+
exports.createWorkflowRunHandler = createWorkflowRunHandler;
|
|
334
|
+
exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
|
|
335
|
+
exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
|
|
336
|
+
exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
|
|
337
|
+
exports.getWorkflowsHandler = getWorkflowsHandler;
|
|
338
|
+
exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
|
|
339
|
+
exports.resumeWorkflowHandler = resumeWorkflowHandler;
|
|
340
|
+
exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
|
|
341
|
+
exports.startWorkflowRunHandler = startWorkflowRunHandler;
|
|
342
|
+
exports.watchWorkflowHandler = watchWorkflowHandler;
|
|
343
|
+
exports.workflows_exports = workflows_exports;
|
|
@@ -39,9 +39,10 @@ async function getLogsByRunIdHandler({
|
|
|
39
39
|
async function getLogTransports({ mastra }) {
|
|
40
40
|
try {
|
|
41
41
|
const logger = mastra.getLogger();
|
|
42
|
-
|
|
42
|
+
console.log(logger);
|
|
43
|
+
const transports = logger.getTransports();
|
|
43
44
|
return {
|
|
44
|
-
transports: transports ?
|
|
45
|
+
transports: transports ? [...transports.keys()] : []
|
|
45
46
|
};
|
|
46
47
|
} catch (error) {
|
|
47
48
|
return chunk64U3UDTH_cjs.handleError(error, "Error getting log Transports");
|
|
@@ -93,7 +93,7 @@ async function describeIndex({
|
|
|
93
93
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Index name is required" });
|
|
94
94
|
}
|
|
95
95
|
const vector = getVector(mastra, vectorName);
|
|
96
|
-
const stats = await vector.describeIndex(indexName);
|
|
96
|
+
const stats = await vector.describeIndex({ indexName });
|
|
97
97
|
return {
|
|
98
98
|
dimension: stats.dimension,
|
|
99
99
|
count: stats.count,
|
|
@@ -113,7 +113,7 @@ async function deleteIndex({
|
|
|
113
113
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Index name is required" });
|
|
114
114
|
}
|
|
115
115
|
const vector = getVector(mastra, vectorName);
|
|
116
|
-
await vector.deleteIndex(indexName);
|
|
116
|
+
await vector.deleteIndex({ indexName });
|
|
117
117
|
return { success: true };
|
|
118
118
|
} catch (error) {
|
|
119
119
|
return chunk64U3UDTH_cjs.handleError(error, "Error deleting index");
|