@mastra/server 0.24.0-alpha.0 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +309 -48
  2. package/README.md +1 -1
  3. package/dist/{chunk-OQPXME7E.js → chunk-2IS5WICF.js} +4569 -1062
  4. package/dist/chunk-2IS5WICF.js.map +1 -0
  5. package/dist/{chunk-SPRRK3P7.cjs → chunk-2YZH5PH6.cjs} +47 -47
  6. package/dist/chunk-2YZH5PH6.cjs.map +1 -0
  7. package/dist/{chunk-BATEJLED.js → chunk-3AMNUUZF.js} +20 -20
  8. package/dist/chunk-3AMNUUZF.js.map +1 -0
  9. package/dist/{chunk-AW5BU3RQ.js → chunk-3F52QCI4.js} +40 -40
  10. package/dist/chunk-3F52QCI4.js.map +1 -0
  11. package/dist/{chunk-PBXWFGEH.js → chunk-4JF5WXPL.js} +130 -207
  12. package/dist/chunk-4JF5WXPL.js.map +1 -0
  13. package/dist/{chunk-7NADHFD2.cjs → chunk-64ITUOXI.cjs} +2 -2
  14. package/dist/chunk-64ITUOXI.cjs.map +1 -0
  15. package/dist/{chunk-MMROOK5J.js → chunk-6QWQZI4Q.js} +2 -2
  16. package/dist/{chunk-7NADHFD2.cjs.map → chunk-6QWQZI4Q.js.map} +1 -1
  17. package/dist/{chunk-ABRFV4XP.js → chunk-73PAWDM5.js} +13 -13
  18. package/dist/chunk-73PAWDM5.js.map +1 -0
  19. package/dist/{chunk-2S4IMB6E.cjs → chunk-A24TSVEZ.cjs} +39 -39
  20. package/dist/chunk-A24TSVEZ.cjs.map +1 -0
  21. package/dist/{chunk-NT5XW5PI.cjs → chunk-A2NPD5N6.cjs} +176 -255
  22. package/dist/chunk-A2NPD5N6.cjs.map +1 -0
  23. package/dist/{chunk-QQXMIP6C.js → chunk-B3Z6J745.js} +17 -17
  24. package/dist/chunk-B3Z6J745.js.map +1 -0
  25. package/dist/{chunk-G4PUALCE.cjs → chunk-BTWIR2B7.cjs} +4 -4
  26. package/dist/{chunk-G4PUALCE.cjs.map → chunk-BTWIR2B7.cjs.map} +1 -1
  27. package/dist/{chunk-YWOK4F5A.js → chunk-D7T74TVR.js} +4 -6
  28. package/dist/chunk-D7T74TVR.js.map +1 -0
  29. package/dist/{chunk-IJSDPAUY.cjs → chunk-EHACNWDL.cjs} +156 -202
  30. package/dist/chunk-EHACNWDL.cjs.map +1 -0
  31. package/dist/{chunk-HPXAM2PG.js → chunk-FPBYKMIS.js} +13 -13
  32. package/dist/chunk-FPBYKMIS.js.map +1 -0
  33. package/dist/{chunk-3SNGNFUJ.cjs → chunk-GLAZTMX3.cjs} +37 -37
  34. package/dist/chunk-GLAZTMX3.cjs.map +1 -0
  35. package/dist/{chunk-TEOUDAN5.cjs → chunk-ID6JYDNL.cjs} +4590 -1080
  36. package/dist/chunk-ID6JYDNL.cjs.map +1 -0
  37. package/dist/{chunk-TRGAMKHX.cjs → chunk-KF3RI45U.cjs} +46 -41
  38. package/dist/chunk-KF3RI45U.cjs.map +1 -0
  39. package/dist/{chunk-TOP25AIO.cjs → chunk-KJIDZQRA.cjs} +14 -14
  40. package/dist/chunk-KJIDZQRA.cjs.map +1 -0
  41. package/dist/{chunk-MYR4PVGN.js → chunk-KWH5QBXP.js} +4 -4
  42. package/dist/{chunk-MYR4PVGN.js.map → chunk-KWH5QBXP.js.map} +1 -1
  43. package/dist/{chunk-AHB4JCIQ.js → chunk-ND5OKOMT.js} +31 -26
  44. package/dist/chunk-ND5OKOMT.js.map +1 -0
  45. package/dist/{chunk-XN74I6VW.cjs → chunk-PPMIB3FQ.cjs} +20 -20
  46. package/dist/chunk-PPMIB3FQ.cjs.map +1 -0
  47. package/dist/{chunk-EP3JQDPD.cjs → chunk-S54HNARD.cjs} +18 -18
  48. package/dist/{chunk-EP3JQDPD.cjs.map → chunk-S54HNARD.cjs.map} +1 -1
  49. package/dist/{chunk-4QCXUEAT.js → chunk-SZIFSF4T.js} +3 -3
  50. package/dist/{chunk-4QCXUEAT.js.map → chunk-SZIFSF4T.js.map} +1 -1
  51. package/dist/{chunk-CY4TP3FK.js → chunk-UXGQZUYZ.js} +3 -3
  52. package/dist/{chunk-CY4TP3FK.js.map → chunk-UXGQZUYZ.js.map} +1 -1
  53. package/dist/{chunk-RE4RPXT2.cjs → chunk-V5WWQN7P.cjs} +4 -4
  54. package/dist/{chunk-RE4RPXT2.cjs.map → chunk-V5WWQN7P.cjs.map} +1 -1
  55. package/dist/{chunk-VY4ENABS.cjs → chunk-W2KMU354.cjs} +4 -6
  56. package/dist/chunk-W2KMU354.cjs.map +1 -0
  57. package/dist/{chunk-H33KYEMY.cjs → chunk-X3MICMI2.cjs} +140 -240
  58. package/dist/chunk-X3MICMI2.cjs.map +1 -0
  59. package/dist/{chunk-Y4VKB6KC.js → chunk-Z2O5YVHY.js} +121 -165
  60. package/dist/chunk-Z2O5YVHY.js.map +1 -0
  61. package/dist/{chunk-PY2K7VNW.js → chunk-ZJ6KEY6H.js} +67 -165
  62. package/dist/chunk-ZJ6KEY6H.js.map +1 -0
  63. package/dist/server/handlers/a2a.cjs +7 -7
  64. package/dist/server/handlers/a2a.d.ts +10 -10
  65. package/dist/server/handlers/a2a.d.ts.map +1 -1
  66. package/dist/server/handlers/a2a.js +1 -1
  67. package/dist/server/handlers/agent-builder.cjs +31 -19
  68. package/dist/server/handlers/agent-builder.d.ts +38 -47
  69. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  70. package/dist/server/handlers/agent-builder.js +1 -1
  71. package/dist/server/handlers/agents.cjs +22 -30
  72. package/dist/server/handlers/agents.d.ts +36 -55
  73. package/dist/server/handlers/agents.d.ts.map +1 -1
  74. package/dist/server/handlers/agents.js +1 -1
  75. package/dist/server/handlers/error.cjs +2 -2
  76. package/dist/server/handlers/error.js +1 -1
  77. package/dist/server/handlers/logs.cjs +7 -7
  78. package/dist/server/handlers/logs.d.ts +3 -3
  79. package/dist/server/handlers/logs.d.ts.map +1 -1
  80. package/dist/server/handlers/logs.js +1 -1
  81. package/dist/server/handlers/memory.cjs +17 -25
  82. package/dist/server/handlers/memory.d.ts +28 -34
  83. package/dist/server/handlers/memory.d.ts.map +1 -1
  84. package/dist/server/handlers/memory.js +1 -1
  85. package/dist/server/handlers/observability.cjs +8 -8
  86. package/dist/server/handlers/observability.d.ts +12 -12
  87. package/dist/server/handlers/observability.d.ts.map +1 -1
  88. package/dist/server/handlers/observability.js +1 -1
  89. package/dist/server/handlers/scores.cjs +11 -11
  90. package/dist/server/handlers/scores.d.ts +24 -24
  91. package/dist/server/handlers/scores.d.ts.map +1 -1
  92. package/dist/server/handlers/scores.js +1 -1
  93. package/dist/server/handlers/tools.cjs +7 -7
  94. package/dist/server/handlers/tools.d.ts +8 -8
  95. package/dist/server/handlers/tools.d.ts.map +1 -1
  96. package/dist/server/handlers/tools.js +1 -1
  97. package/dist/server/handlers/utils.cjs +3 -3
  98. package/dist/server/handlers/utils.js +1 -1
  99. package/dist/server/handlers/vector.cjs +7 -7
  100. package/dist/server/handlers/vector.js +1 -1
  101. package/dist/server/handlers/voice.cjs +5 -5
  102. package/dist/server/handlers/voice.d.ts +6 -6
  103. package/dist/server/handlers/voice.js +1 -1
  104. package/dist/server/handlers/workflows.cjs +21 -29
  105. package/dist/server/handlers/workflows.d.ts +27 -36
  106. package/dist/server/handlers/workflows.d.ts.map +1 -1
  107. package/dist/server/handlers/workflows.js +1 -1
  108. package/dist/server/handlers.cjs +26 -36
  109. package/dist/server/handlers.d.ts +0 -2
  110. package/dist/server/handlers.d.ts.map +1 -1
  111. package/dist/server/handlers.js +11 -13
  112. package/dist/server/http-exception.d.ts +0 -5
  113. package/dist/server/http-exception.d.ts.map +1 -1
  114. package/dist/server/utils.d.ts +3 -2
  115. package/dist/server/utils.d.ts.map +1 -1
  116. package/package.json +9 -13
  117. package/dist/chunk-2S4IMB6E.cjs.map +0 -1
  118. package/dist/chunk-3SNGNFUJ.cjs.map +0 -1
  119. package/dist/chunk-67GYDFSB.js +0 -160
  120. package/dist/chunk-67GYDFSB.js.map +0 -1
  121. package/dist/chunk-6ZR275MD.cjs +0 -165
  122. package/dist/chunk-6ZR275MD.cjs.map +0 -1
  123. package/dist/chunk-ABRFV4XP.js.map +0 -1
  124. package/dist/chunk-AHB4JCIQ.js.map +0 -1
  125. package/dist/chunk-AW5BU3RQ.js.map +0 -1
  126. package/dist/chunk-BATEJLED.js.map +0 -1
  127. package/dist/chunk-H33KYEMY.cjs.map +0 -1
  128. package/dist/chunk-HPXAM2PG.js.map +0 -1
  129. package/dist/chunk-I3C4ODGV.cjs +0 -335
  130. package/dist/chunk-I3C4ODGV.cjs.map +0 -1
  131. package/dist/chunk-IJSDPAUY.cjs.map +0 -1
  132. package/dist/chunk-LLUOPR3J.js +0 -323
  133. package/dist/chunk-LLUOPR3J.js.map +0 -1
  134. package/dist/chunk-MMROOK5J.js.map +0 -1
  135. package/dist/chunk-NT5XW5PI.cjs.map +0 -1
  136. package/dist/chunk-OQPXME7E.js.map +0 -1
  137. package/dist/chunk-PBXWFGEH.js.map +0 -1
  138. package/dist/chunk-PY2K7VNW.js.map +0 -1
  139. package/dist/chunk-QQXMIP6C.js.map +0 -1
  140. package/dist/chunk-SPRRK3P7.cjs.map +0 -1
  141. package/dist/chunk-TEOUDAN5.cjs.map +0 -1
  142. package/dist/chunk-TOP25AIO.cjs.map +0 -1
  143. package/dist/chunk-TRGAMKHX.cjs.map +0 -1
  144. package/dist/chunk-VY4ENABS.cjs.map +0 -1
  145. package/dist/chunk-XN74I6VW.cjs.map +0 -1
  146. package/dist/chunk-Y4VKB6KC.js.map +0 -1
  147. package/dist/chunk-YWOK4F5A.js.map +0 -1
  148. package/dist/server/handlers/legacyWorkflows.cjs +0 -48
  149. package/dist/server/handlers/legacyWorkflows.cjs.map +0 -1
  150. package/dist/server/handlers/legacyWorkflows.d.ts +0 -59
  151. package/dist/server/handlers/legacyWorkflows.d.ts.map +0 -1
  152. package/dist/server/handlers/legacyWorkflows.js +0 -3
  153. package/dist/server/handlers/legacyWorkflows.js.map +0 -1
  154. package/dist/server/handlers/telemetry.cjs +0 -20
  155. package/dist/server/handlers/telemetry.cjs.map +0 -1
  156. package/dist/server/handlers/telemetry.d.ts +0 -33
  157. package/dist/server/handlers/telemetry.d.ts.map +0 -1
  158. package/dist/server/handlers/telemetry.js +0 -3
  159. package/dist/server/handlers/telemetry.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkVY4ENABS_cjs = require('./chunk-VY4ENABS.cjs');
4
- var chunkRE4RPXT2_cjs = require('./chunk-RE4RPXT2.cjs');
5
- var chunk7NADHFD2_cjs = require('./chunk-7NADHFD2.cjs');
3
+ var chunkW2KMU354_cjs = require('./chunk-W2KMU354.cjs');
4
+ var chunkV5WWQN7P_cjs = require('./chunk-V5WWQN7P.cjs');
5
+ var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
6
6
  var chunkO7I5CWRX_cjs = require('./chunk-O7I5CWRX.cjs');
7
7
  var web = require('stream/web');
8
8
 
@@ -14,55 +14,53 @@ chunkO7I5CWRX_cjs.__export(workflows_exports, {
14
14
  getWorkflowByIdHandler: () => getWorkflowByIdHandler,
15
15
  getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
16
16
  getWorkflowRunExecutionResultHandler: () => getWorkflowRunExecutionResultHandler,
17
- getWorkflowRunsHandler: () => getWorkflowRunsHandler,
18
- getWorkflowsHandler: () => getWorkflowsHandler,
17
+ listWorkflowRunsHandler: () => listWorkflowRunsHandler,
18
+ listWorkflowsHandler: () => listWorkflowsHandler,
19
19
  observeStreamLegacyWorkflowHandler: () => observeStreamLegacyWorkflowHandler,
20
20
  observeStreamVNextWorkflowHandler: () => observeStreamVNextWorkflowHandler,
21
21
  observeStreamWorkflowHandler: () => observeStreamWorkflowHandler,
22
22
  resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
23
23
  resumeStreamWorkflowHandler: () => resumeStreamWorkflowHandler,
24
24
  resumeWorkflowHandler: () => resumeWorkflowHandler,
25
- sendWorkflowRunEventHandler: () => sendWorkflowRunEventHandler,
26
25
  startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
27
26
  startWorkflowRunHandler: () => startWorkflowRunHandler,
28
27
  streamLegacyWorkflowHandler: () => streamLegacyWorkflowHandler,
29
28
  streamVNextWorkflowHandler: () => streamVNextWorkflowHandler,
30
- streamWorkflowHandler: () => streamWorkflowHandler,
31
- watchWorkflowHandler: () => watchWorkflowHandler
29
+ streamWorkflowHandler: () => streamWorkflowHandler
32
30
  });
33
- async function getWorkflowsHandler({ mastra }) {
31
+ async function listWorkflowsHandler({ mastra }) {
34
32
  try {
35
- const workflows = mastra.getWorkflows({ serialized: false });
33
+ const workflows = mastra.listWorkflows({ serialized: false });
36
34
  const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
37
- acc[key] = chunkVY4ENABS_cjs.getWorkflowInfo(workflow);
35
+ acc[key] = chunkW2KMU354_cjs.getWorkflowInfo(workflow);
38
36
  return acc;
39
37
  }, {});
40
38
  return _workflows;
41
39
  } catch (error) {
42
- return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflows");
40
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflows");
43
41
  }
44
42
  }
45
- async function getWorkflowsFromSystem({ mastra, workflowId }) {
43
+ async function listWorkflowsFromSystem({ mastra, workflowId }) {
46
44
  const logger = mastra.getLogger();
47
45
  if (!workflowId) {
48
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
46
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
49
47
  }
50
48
  let workflow;
51
- workflow = chunkVY4ENABS_cjs.WorkflowRegistry.getWorkflow(workflowId);
49
+ workflow = chunkW2KMU354_cjs.WorkflowRegistry.getWorkflow(workflowId);
52
50
  if (!workflow) {
53
51
  try {
54
- workflow = mastra.getWorkflow(workflowId);
52
+ workflow = mastra.getWorkflowById(workflowId);
55
53
  } catch (error) {
56
54
  logger.debug("Error getting workflow, searching agents for workflow", error);
57
55
  }
58
56
  }
59
57
  if (!workflow) {
60
58
  logger.debug("Workflow not found, searching agents for workflow", { workflowId });
61
- const agents = mastra.getAgents();
59
+ const agents = mastra.listAgents();
62
60
  if (Object.keys(agents || {}).length) {
63
61
  for (const [_, agent] of Object.entries(agents)) {
64
62
  try {
65
- const workflows = await agent.getWorkflows();
63
+ const workflows = await agent.listWorkflows();
66
64
  if (workflows[workflowId]) {
67
65
  workflow = workflows[workflowId];
68
66
  break;
@@ -75,22 +73,22 @@ async function getWorkflowsFromSystem({ mastra, workflowId }) {
75
73
  }
76
74
  }
77
75
  if (!workflow) {
78
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
76
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
79
77
  }
80
78
  return { workflow };
81
79
  }
82
80
  async function getWorkflowByIdHandler({ mastra, workflowId }) {
83
81
  try {
84
82
  if (!workflowId) {
85
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
83
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
86
84
  }
87
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
85
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
88
86
  if (!workflow) {
89
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
87
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
90
88
  }
91
- return chunkVY4ENABS_cjs.getWorkflowInfo(workflow);
89
+ return chunkW2KMU354_cjs.getWorkflowInfo(workflow);
92
90
  } catch (error) {
93
- return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow");
91
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow");
94
92
  }
95
93
  }
96
94
  async function getWorkflowRunByIdHandler({
@@ -100,22 +98,22 @@ async function getWorkflowRunByIdHandler({
100
98
  }) {
101
99
  try {
102
100
  if (!workflowId) {
103
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
101
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
104
102
  }
105
103
  if (!runId) {
106
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Run ID is required" });
104
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
107
105
  }
108
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
106
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
109
107
  if (!workflow) {
110
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
108
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
111
109
  }
112
110
  const run = await workflow.getWorkflowRunById(runId);
113
111
  if (!run) {
114
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
112
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
115
113
  }
116
114
  return run;
117
115
  } catch (error) {
118
- return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow run");
116
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow run");
119
117
  }
120
118
  }
121
119
  async function getWorkflowRunExecutionResultHandler({
@@ -125,22 +123,22 @@ async function getWorkflowRunExecutionResultHandler({
125
123
  }) {
126
124
  try {
127
125
  if (!workflowId) {
128
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
126
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
129
127
  }
130
128
  if (!runId) {
131
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Run ID is required" });
129
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Run ID is required" });
132
130
  }
133
131
  const workflow = mastra.getWorkflow(workflowId);
134
132
  if (!workflow) {
135
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
133
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
136
134
  }
137
135
  const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
138
136
  if (!executionResult) {
139
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
137
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
140
138
  }
141
139
  return executionResult;
142
140
  } catch (error) {
143
- return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow run execution result");
141
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow run execution result");
144
142
  }
145
143
  }
146
144
  async function createWorkflowRunHandler({
@@ -150,21 +148,21 @@ async function createWorkflowRunHandler({
150
148
  }) {
151
149
  try {
152
150
  if (!workflowId) {
153
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
151
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
154
152
  }
155
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
153
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
156
154
  if (!workflow) {
157
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
155
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
158
156
  }
159
- const run = await workflow.createRunAsync({ runId: prevRunId });
157
+ const run = await workflow.createRun({ runId: prevRunId });
160
158
  return { runId: run.runId };
161
159
  } catch (error) {
162
- return chunkRE4RPXT2_cjs.handleError(error, "Error creating workflow run");
160
+ return chunkV5WWQN7P_cjs.handleError(error, "Error creating workflow run");
163
161
  }
164
162
  }
165
163
  async function startAsyncWorkflowHandler({
166
164
  mastra,
167
- runtimeContext,
165
+ requestContext,
168
166
  workflowId,
169
167
  runId,
170
168
  inputData,
@@ -172,26 +170,26 @@ async function startAsyncWorkflowHandler({
172
170
  }) {
173
171
  try {
174
172
  if (!workflowId) {
175
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
173
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
176
174
  }
177
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
175
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
178
176
  if (!workflow) {
179
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
177
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
180
178
  }
181
- const _run = await workflow.createRunAsync({ runId });
179
+ const _run = await workflow.createRun({ runId });
182
180
  const result = await _run.start({
183
181
  inputData,
184
- runtimeContext,
182
+ requestContext,
185
183
  tracingOptions
186
184
  });
187
185
  return result;
188
186
  } catch (error) {
189
- return chunkRE4RPXT2_cjs.handleError(error, "Error starting async workflow");
187
+ return chunkV5WWQN7P_cjs.handleError(error, "Error starting async workflow");
190
188
  }
191
189
  }
192
190
  async function startWorkflowRunHandler({
193
191
  mastra,
194
- runtimeContext,
192
+ requestContext,
195
193
  workflowId,
196
194
  runId,
197
195
  inputData,
@@ -199,116 +197,43 @@ async function startWorkflowRunHandler({
199
197
  }) {
200
198
  try {
201
199
  if (!workflowId) {
202
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
200
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
203
201
  }
204
202
  if (!runId) {
205
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to start run" });
203
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to start run" });
206
204
  }
207
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
205
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
208
206
  if (!workflow) {
209
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
207
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
210
208
  }
211
209
  const run = await workflow.getWorkflowRunById(runId);
212
210
  if (!run) {
213
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
211
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
214
212
  }
215
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
213
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
216
214
  void _run.start({
217
215
  inputData,
218
- runtimeContext,
216
+ requestContext,
219
217
  tracingOptions
220
218
  });
221
219
  return { message: "Workflow run started" };
222
220
  } catch (e) {
223
- return chunkRE4RPXT2_cjs.handleError(e, "Error starting workflow run");
224
- }
225
- }
226
- async function watchWorkflowHandler({
227
- mastra,
228
- workflowId,
229
- runId,
230
- eventType = "watch"
231
- }) {
232
- try {
233
- if (!workflowId) {
234
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
235
- }
236
- if (!runId) {
237
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to watch workflow" });
238
- }
239
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
240
- if (!workflow) {
241
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
242
- }
243
- const run = await workflow.getWorkflowRunById(runId);
244
- if (!run) {
245
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
246
- }
247
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
248
- let unwatch;
249
- let asyncRef = null;
250
- const stream = new web.ReadableStream({
251
- start(controller) {
252
- if (eventType === "watch") {
253
- unwatch = _run.watch((event) => {
254
- const { type, payload, eventTimestamp } = event;
255
- controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
256
- if (asyncRef) {
257
- clearImmediate(asyncRef);
258
- asyncRef = null;
259
- }
260
- asyncRef = setImmediate(async () => {
261
- const runDone = payload.workflowState?.status !== "running";
262
- if (runDone) {
263
- controller.close();
264
- unwatch?.();
265
- }
266
- });
267
- }, eventType);
268
- } else {
269
- unwatch = _run.watch((event) => {
270
- const { type, payload } = event;
271
- controller.enqueue(JSON.stringify({ type, payload, runId }));
272
- if (asyncRef) {
273
- clearImmediate(asyncRef);
274
- asyncRef = null;
275
- }
276
- asyncRef = setImmediate(async () => {
277
- const runDone = type === "workflow-finish";
278
- if (runDone) {
279
- controller.close();
280
- unwatch?.();
281
- }
282
- });
283
- }, eventType);
284
- }
285
- },
286
- cancel() {
287
- if (asyncRef) {
288
- clearImmediate(asyncRef);
289
- asyncRef = null;
290
- }
291
- unwatch?.();
292
- }
293
- });
294
- return stream;
295
- } catch (error) {
296
- return chunkRE4RPXT2_cjs.handleError(error, "Error watching workflow");
221
+ return chunkV5WWQN7P_cjs.handleError(e, "Error starting workflow run");
297
222
  }
298
223
  }
299
224
  async function streamWorkflowHandler({
300
225
  mastra,
301
- runtimeContext,
226
+ requestContext,
302
227
  workflowId,
303
228
  runId,
304
229
  inputData,
305
230
  tracingOptions
306
231
  }) {
307
- return streamVNextWorkflowHandler({ mastra, workflowId, runId, inputData, runtimeContext, tracingOptions });
232
+ return streamVNextWorkflowHandler({ mastra, workflowId, runId, inputData, requestContext, tracingOptions });
308
233
  }
309
234
  async function streamLegacyWorkflowHandler({
310
235
  mastra,
311
- runtimeContext,
236
+ requestContext,
312
237
  workflowId,
313
238
  runId,
314
239
  inputData,
@@ -316,20 +241,20 @@ async function streamLegacyWorkflowHandler({
316
241
  }) {
317
242
  try {
318
243
  if (!workflowId) {
319
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
244
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
320
245
  }
321
246
  if (!runId) {
322
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
247
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
323
248
  }
324
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
249
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
325
250
  if (!workflow) {
326
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
251
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
327
252
  }
328
253
  const serverCache = mastra.getServerCache();
329
- const run = await workflow.createRunAsync({ runId });
254
+ const run = await workflow.createRun({ runId });
330
255
  const result = run.streamLegacy({
331
256
  inputData,
332
- runtimeContext,
257
+ requestContext,
333
258
  onChunk: async (chunk) => {
334
259
  if (serverCache) {
335
260
  const cacheKey = runId;
@@ -340,7 +265,7 @@ async function streamLegacyWorkflowHandler({
340
265
  });
341
266
  return result;
342
267
  } catch (error) {
343
- return chunkRE4RPXT2_cjs.handleError(error, "Error executing workflow");
268
+ return chunkV5WWQN7P_cjs.handleError(error, "Error executing workflow");
344
269
  }
345
270
  }
346
271
  async function observeStreamLegacyWorkflowHandler({
@@ -350,23 +275,23 @@ async function observeStreamLegacyWorkflowHandler({
350
275
  }) {
351
276
  try {
352
277
  if (!workflowId) {
353
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
278
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
354
279
  }
355
280
  if (!runId) {
356
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
281
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
357
282
  }
358
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
283
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
359
284
  if (!workflow) {
360
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
285
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
361
286
  }
362
287
  const run = await workflow.getWorkflowRunById(runId);
363
288
  if (!run) {
364
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
289
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
365
290
  }
366
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
291
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
367
292
  const serverCache = mastra.getServerCache();
368
293
  if (!serverCache) {
369
- throw new chunk7NADHFD2_cjs.HTTPException(500, { message: "Server cache not found" });
294
+ throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Server cache not found" });
370
295
  }
371
296
  const transformStream = new web.TransformStream();
372
297
  const writer = transformStream.writable.getWriter();
@@ -378,7 +303,7 @@ async function observeStreamLegacyWorkflowHandler({
378
303
  const result = _run.observeStreamLegacy();
379
304
  return result.stream?.pipeThrough(transformStream);
380
305
  } catch (error) {
381
- return chunkRE4RPXT2_cjs.handleError(error, "Error observing workflow stream");
306
+ return chunkV5WWQN7P_cjs.handleError(error, "Error observing workflow stream");
382
307
  }
383
308
  }
384
309
  async function observeStreamWorkflowHandler({
@@ -390,7 +315,7 @@ async function observeStreamWorkflowHandler({
390
315
  }
391
316
  async function streamVNextWorkflowHandler({
392
317
  mastra,
393
- runtimeContext,
318
+ requestContext,
394
319
  workflowId,
395
320
  runId,
396
321
  inputData,
@@ -399,20 +324,20 @@ async function streamVNextWorkflowHandler({
399
324
  }) {
400
325
  try {
401
326
  if (!workflowId) {
402
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
327
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
403
328
  }
404
329
  if (!runId) {
405
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to stream workflow" });
330
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to stream workflow" });
406
331
  }
407
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
332
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
408
333
  if (!workflow) {
409
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
334
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
410
335
  }
411
336
  const serverCache = mastra.getServerCache();
412
- const run = await workflow.createRunAsync({ runId });
337
+ const run = await workflow.createRun({ runId });
413
338
  const result = run.stream({
414
339
  inputData,
415
- runtimeContext,
340
+ requestContext,
416
341
  closeOnSuspend,
417
342
  tracingOptions
418
343
  });
@@ -429,7 +354,7 @@ async function streamVNextWorkflowHandler({
429
354
  })
430
355
  );
431
356
  } catch (error) {
432
- return chunkRE4RPXT2_cjs.handleError(error, "Error streaming workflow");
357
+ return chunkV5WWQN7P_cjs.handleError(error, "Error streaming workflow");
433
358
  }
434
359
  }
435
360
  async function observeStreamVNextWorkflowHandler({
@@ -439,23 +364,23 @@ async function observeStreamVNextWorkflowHandler({
439
364
  }) {
440
365
  try {
441
366
  if (!workflowId) {
442
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
367
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
443
368
  }
444
369
  if (!runId) {
445
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
370
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to observe workflow stream" });
446
371
  }
447
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
372
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
448
373
  if (!workflow) {
449
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
374
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
450
375
  }
451
376
  const run = await workflow.getWorkflowRunById(runId);
452
377
  if (!run) {
453
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
378
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
454
379
  }
455
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
380
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
456
381
  const serverCache = mastra.getServerCache();
457
382
  if (!serverCache) {
458
- throw new chunk7NADHFD2_cjs.HTTPException(500, { message: "Server cache not found" });
383
+ throw new chunk64ITUOXI_cjs.HTTPException(500, { message: "Server cache not found" });
459
384
  }
460
385
  const cachedRunChunks = await serverCache.listFromTo(runId, 0);
461
386
  const combinedStream = new web.ReadableStream({
@@ -492,7 +417,7 @@ async function observeStreamVNextWorkflowHandler({
492
417
  });
493
418
  return combinedStream;
494
419
  } catch (error) {
495
- return chunkRE4RPXT2_cjs.handleError(error, "Error observing workflow stream");
420
+ return chunkV5WWQN7P_cjs.handleError(error, "Error observing workflow stream");
496
421
  }
497
422
  }
498
423
  async function resumeAsyncWorkflowHandler({
@@ -500,34 +425,34 @@ async function resumeAsyncWorkflowHandler({
500
425
  workflowId,
501
426
  runId,
502
427
  body,
503
- runtimeContext,
428
+ requestContext,
504
429
  tracingOptions
505
430
  }) {
506
431
  try {
507
432
  if (!workflowId) {
508
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
433
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
509
434
  }
510
435
  if (!runId) {
511
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
436
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
512
437
  }
513
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
438
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
514
439
  if (!workflow) {
515
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
440
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
516
441
  }
517
442
  const run = await workflow.getWorkflowRunById(runId);
518
443
  if (!run) {
519
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
444
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
520
445
  }
521
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
446
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
522
447
  const result = await _run.resume({
523
448
  step: body.step,
524
449
  resumeData: body.resumeData,
525
- runtimeContext,
450
+ requestContext,
526
451
  tracingOptions
527
452
  });
528
453
  return result;
529
454
  } catch (error) {
530
- return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow step");
455
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow step");
531
456
  }
532
457
  }
533
458
  async function resumeWorkflowHandler({
@@ -535,34 +460,34 @@ async function resumeWorkflowHandler({
535
460
  workflowId,
536
461
  runId,
537
462
  body,
538
- runtimeContext,
463
+ requestContext,
539
464
  tracingOptions
540
465
  }) {
541
466
  try {
542
467
  if (!workflowId) {
543
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
468
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
544
469
  }
545
470
  if (!runId) {
546
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
471
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
547
472
  }
548
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
473
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
549
474
  if (!workflow) {
550
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
475
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
551
476
  }
552
477
  const run = await workflow.getWorkflowRunById(runId);
553
478
  if (!run) {
554
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
479
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
555
480
  }
556
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
481
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
557
482
  void _run.resume({
558
483
  step: body.step,
559
484
  resumeData: body.resumeData,
560
- runtimeContext,
485
+ requestContext,
561
486
  tracingOptions
562
487
  });
563
488
  return { message: "Workflow run resumed" };
564
489
  } catch (error) {
565
- return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow");
490
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
566
491
  }
567
492
  }
568
493
  async function resumeStreamWorkflowHandler({
@@ -570,30 +495,30 @@ async function resumeStreamWorkflowHandler({
570
495
  workflowId,
571
496
  runId,
572
497
  body,
573
- runtimeContext,
498
+ requestContext,
574
499
  tracingOptions
575
500
  }) {
576
501
  try {
577
502
  if (!workflowId) {
578
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
503
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
579
504
  }
580
505
  if (!runId) {
581
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
506
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
582
507
  }
583
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
508
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
584
509
  if (!workflow) {
585
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
510
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
586
511
  }
587
512
  const run = await workflow.getWorkflowRunById(runId);
588
513
  if (!run) {
589
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
514
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
590
515
  }
591
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
516
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
592
517
  const serverCache = mastra.getServerCache();
593
518
  const stream = _run.resumeStream({
594
519
  step: body.step,
595
520
  resumeData: body.resumeData,
596
- runtimeContext,
521
+ requestContext,
597
522
  tracingOptions
598
523
  }).fullStream.pipeThrough(
599
524
  new web.TransformStream({
@@ -609,33 +534,39 @@ async function resumeStreamWorkflowHandler({
609
534
  );
610
535
  return stream;
611
536
  } catch (error) {
612
- return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow");
537
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
613
538
  }
614
539
  }
615
- async function getWorkflowRunsHandler({
540
+ async function listWorkflowRunsHandler({
616
541
  mastra,
617
542
  workflowId,
618
543
  fromDate,
619
544
  toDate,
620
- limit,
621
- offset,
545
+ perPage,
546
+ page,
622
547
  resourceId
623
548
  }) {
624
549
  try {
625
550
  if (!workflowId) {
626
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
551
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
552
+ }
553
+ if (perPage !== void 0 && perPage !== false && (!Number.isInteger(perPage) || perPage <= 0)) {
554
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "perPage must be a positive integer or false" });
627
555
  }
628
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
556
+ if (page !== void 0 && (!Number.isInteger(page) || page < 0)) {
557
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "page must be a non-negative integer" });
558
+ }
559
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
629
560
  if (!workflow) {
630
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
561
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
631
562
  }
632
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
563
+ const workflowRuns = await workflow.listWorkflowRuns({ fromDate, toDate, perPage, page, resourceId }) || {
633
564
  runs: [],
634
565
  total: 0
635
566
  };
636
567
  return workflowRuns;
637
568
  } catch (error) {
638
- return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow runs");
569
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow runs");
639
570
  }
640
571
  }
641
572
  async function cancelWorkflowRunHandler({
@@ -645,53 +576,24 @@ async function cancelWorkflowRunHandler({
645
576
  }) {
646
577
  try {
647
578
  if (!workflowId) {
648
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
579
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
649
580
  }
650
581
  if (!runId) {
651
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to cancel workflow run" });
582
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to cancel workflow run" });
652
583
  }
653
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
584
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
654
585
  if (!workflow) {
655
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
586
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
656
587
  }
657
588
  const run = await workflow.getWorkflowRunById(runId);
658
589
  if (!run) {
659
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
590
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
660
591
  }
661
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
592
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
662
593
  await _run.cancel();
663
594
  return { message: "Workflow run cancelled" };
664
595
  } catch (error) {
665
- return chunkRE4RPXT2_cjs.handleError(error, "Error canceling workflow run");
666
- }
667
- }
668
- async function sendWorkflowRunEventHandler({
669
- mastra,
670
- workflowId,
671
- runId,
672
- event,
673
- data
674
- }) {
675
- try {
676
- if (!workflowId) {
677
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
678
- }
679
- if (!runId) {
680
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to send workflow run event" });
681
- }
682
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
683
- if (!workflow) {
684
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
685
- }
686
- const run = await workflow.getWorkflowRunById(runId);
687
- if (!run) {
688
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
689
- }
690
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
691
- await _run.sendEvent(event, data);
692
- return { message: "Workflow run event sent" };
693
- } catch (error) {
694
- return chunkRE4RPXT2_cjs.handleError(error, "Error sending workflow run event");
596
+ return chunkV5WWQN7P_cjs.handleError(error, "Error canceling workflow run");
695
597
  }
696
598
  }
697
599
 
@@ -700,21 +602,19 @@ exports.createWorkflowRunHandler = createWorkflowRunHandler;
700
602
  exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
701
603
  exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
702
604
  exports.getWorkflowRunExecutionResultHandler = getWorkflowRunExecutionResultHandler;
703
- exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
704
- exports.getWorkflowsHandler = getWorkflowsHandler;
605
+ exports.listWorkflowRunsHandler = listWorkflowRunsHandler;
606
+ exports.listWorkflowsHandler = listWorkflowsHandler;
705
607
  exports.observeStreamLegacyWorkflowHandler = observeStreamLegacyWorkflowHandler;
706
608
  exports.observeStreamVNextWorkflowHandler = observeStreamVNextWorkflowHandler;
707
609
  exports.observeStreamWorkflowHandler = observeStreamWorkflowHandler;
708
610
  exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
709
611
  exports.resumeStreamWorkflowHandler = resumeStreamWorkflowHandler;
710
612
  exports.resumeWorkflowHandler = resumeWorkflowHandler;
711
- exports.sendWorkflowRunEventHandler = sendWorkflowRunEventHandler;
712
613
  exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
713
614
  exports.startWorkflowRunHandler = startWorkflowRunHandler;
714
615
  exports.streamLegacyWorkflowHandler = streamLegacyWorkflowHandler;
715
616
  exports.streamVNextWorkflowHandler = streamVNextWorkflowHandler;
716
617
  exports.streamWorkflowHandler = streamWorkflowHandler;
717
- exports.watchWorkflowHandler = watchWorkflowHandler;
718
618
  exports.workflows_exports = workflows_exports;
719
- //# sourceMappingURL=chunk-H33KYEMY.cjs.map
720
- //# sourceMappingURL=chunk-H33KYEMY.cjs.map
619
+ //# sourceMappingURL=chunk-X3MICMI2.cjs.map
620
+ //# sourceMappingURL=chunk-X3MICMI2.cjs.map