@mastra/server 0.0.0-playground-studio-cloud-20251031080052 → 0.0.0-playground-studio-again-20251114102707

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 (149) hide show
  1. package/CHANGELOG.md +685 -3
  2. package/README.md +1 -1
  3. package/dist/{chunk-7HCPO76Z.js → chunk-2IS5WICF.js} +4505 -1017
  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-7NADHFD2.cjs → chunk-64ITUOXI.cjs} +2 -2
  12. package/dist/chunk-64ITUOXI.cjs.map +1 -0
  13. package/dist/{chunk-MMROOK5J.js → chunk-6QWQZI4Q.js} +2 -2
  14. package/dist/{chunk-7NADHFD2.cjs.map → chunk-6QWQZI4Q.js.map} +1 -1
  15. package/dist/{chunk-ABRFV4XP.js → chunk-73PAWDM5.js} +13 -13
  16. package/dist/chunk-73PAWDM5.js.map +1 -0
  17. package/dist/{chunk-2S4IMB6E.cjs → chunk-A24TSVEZ.cjs} +39 -39
  18. package/dist/chunk-A24TSVEZ.cjs.map +1 -0
  19. package/dist/{chunk-QQXMIP6C.js → chunk-B3Z6J745.js} +17 -17
  20. package/dist/chunk-B3Z6J745.js.map +1 -0
  21. package/dist/{chunk-G4PUALCE.cjs → chunk-BTWIR2B7.cjs} +4 -4
  22. package/dist/{chunk-G4PUALCE.cjs.map → chunk-BTWIR2B7.cjs.map} +1 -1
  23. package/dist/{chunk-KSFLUEWV.js → chunk-D7T74TVR.js} +4 -5
  24. package/dist/chunk-D7T74TVR.js.map +1 -0
  25. package/dist/{chunk-YSHNCC6F.cjs → chunk-EHACNWDL.cjs} +169 -201
  26. package/dist/chunk-EHACNWDL.cjs.map +1 -0
  27. package/dist/{chunk-MN2TZQ7I.js → chunk-FPBYKMIS.js} +13 -13
  28. package/dist/chunk-FPBYKMIS.js.map +1 -0
  29. package/dist/{chunk-3SNGNFUJ.cjs → chunk-GLAZTMX3.cjs} +37 -37
  30. package/dist/chunk-GLAZTMX3.cjs.map +1 -0
  31. package/dist/{chunk-KDUHLUK4.cjs → chunk-ID6JYDNL.cjs} +4387 -896
  32. package/dist/chunk-ID6JYDNL.cjs.map +1 -0
  33. package/dist/{chunk-TRGAMKHX.cjs → chunk-KF3RI45U.cjs} +46 -41
  34. package/dist/chunk-KF3RI45U.cjs.map +1 -0
  35. package/dist/{chunk-K5T5A3AL.cjs → chunk-KJIDZQRA.cjs} +14 -14
  36. package/dist/chunk-KJIDZQRA.cjs.map +1 -0
  37. package/dist/{chunk-MYR4PVGN.js → chunk-KWH5QBXP.js} +4 -4
  38. package/dist/{chunk-MYR4PVGN.js.map → chunk-KWH5QBXP.js.map} +1 -1
  39. package/dist/{chunk-AHB4JCIQ.js → chunk-ND5OKOMT.js} +31 -26
  40. package/dist/chunk-ND5OKOMT.js.map +1 -0
  41. package/dist/{chunk-XN74I6VW.cjs → chunk-PPMIB3FQ.cjs} +20 -20
  42. package/dist/chunk-PPMIB3FQ.cjs.map +1 -0
  43. package/dist/{chunk-EP3JQDPD.cjs → chunk-S54HNARD.cjs} +18 -18
  44. package/dist/{chunk-EP3JQDPD.cjs.map → chunk-S54HNARD.cjs.map} +1 -1
  45. package/dist/{chunk-4QCXUEAT.js → chunk-SZIFSF4T.js} +3 -3
  46. package/dist/{chunk-4QCXUEAT.js.map → chunk-SZIFSF4T.js.map} +1 -1
  47. package/dist/{chunk-Y7SH5ZKM.cjs → chunk-U7GLIXYO.cjs} +157 -172
  48. package/dist/chunk-U7GLIXYO.cjs.map +1 -0
  49. package/dist/{chunk-CY4TP3FK.js → chunk-UXGQZUYZ.js} +3 -3
  50. package/dist/{chunk-CY4TP3FK.js.map → chunk-UXGQZUYZ.js.map} +1 -1
  51. package/dist/{chunk-RE4RPXT2.cjs → chunk-V5WWQN7P.cjs} +4 -4
  52. package/dist/{chunk-RE4RPXT2.cjs.map → chunk-V5WWQN7P.cjs.map} +1 -1
  53. package/dist/{chunk-OGK26QPW.js → chunk-V6JYJS7O.js} +109 -123
  54. package/dist/chunk-V6JYJS7O.js.map +1 -0
  55. package/dist/{chunk-CJFKRVED.cjs → chunk-W2KMU354.cjs} +4 -5
  56. package/dist/chunk-W2KMU354.cjs.map +1 -0
  57. package/dist/{chunk-B7QWVGQQ.cjs → chunk-X3MICMI2.cjs} +140 -249
  58. package/dist/chunk-X3MICMI2.cjs.map +1 -0
  59. package/dist/{chunk-6VPAV4ZV.js → chunk-Z2O5YVHY.js} +134 -165
  60. package/dist/chunk-Z2O5YVHY.js.map +1 -0
  61. package/dist/{chunk-ZLBL4NQC.js → chunk-ZJ6KEY6H.js} +67 -174
  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 +25 -29
  72. package/dist/server/handlers/agents.d.ts +41 -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 +19 -23
  82. package/dist/server/handlers/memory.d.ts +30 -35
  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 +23 -28
  109. package/dist/server/handlers.d.ts +0 -1
  110. package/dist/server/handlers.d.ts.map +1 -1
  111. package/dist/server/handlers.js +11 -12
  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 +13 -8
  117. package/dist/chunk-2S4IMB6E.cjs.map +0 -1
  118. package/dist/chunk-3SNGNFUJ.cjs.map +0 -1
  119. package/dist/chunk-6VPAV4ZV.js.map +0 -1
  120. package/dist/chunk-7HCPO76Z.js.map +0 -1
  121. package/dist/chunk-ABRFV4XP.js.map +0 -1
  122. package/dist/chunk-AHB4JCIQ.js.map +0 -1
  123. package/dist/chunk-AW5BU3RQ.js.map +0 -1
  124. package/dist/chunk-B7QWVGQQ.cjs.map +0 -1
  125. package/dist/chunk-BATEJLED.js.map +0 -1
  126. package/dist/chunk-CJFKRVED.cjs.map +0 -1
  127. package/dist/chunk-I3C4ODGV.cjs +0 -335
  128. package/dist/chunk-I3C4ODGV.cjs.map +0 -1
  129. package/dist/chunk-K5T5A3AL.cjs.map +0 -1
  130. package/dist/chunk-KDUHLUK4.cjs.map +0 -1
  131. package/dist/chunk-KSFLUEWV.js.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-MN2TZQ7I.js.map +0 -1
  136. package/dist/chunk-OGK26QPW.js.map +0 -1
  137. package/dist/chunk-QQXMIP6C.js.map +0 -1
  138. package/dist/chunk-SPRRK3P7.cjs.map +0 -1
  139. package/dist/chunk-TRGAMKHX.cjs.map +0 -1
  140. package/dist/chunk-XN74I6VW.cjs.map +0 -1
  141. package/dist/chunk-Y7SH5ZKM.cjs.map +0 -1
  142. package/dist/chunk-YSHNCC6F.cjs.map +0 -1
  143. package/dist/chunk-ZLBL4NQC.js.map +0 -1
  144. package/dist/server/handlers/legacyWorkflows.cjs +0 -48
  145. package/dist/server/handlers/legacyWorkflows.cjs.map +0 -1
  146. package/dist/server/handlers/legacyWorkflows.d.ts +0 -59
  147. package/dist/server/handlers/legacyWorkflows.d.ts.map +0 -1
  148. package/dist/server/handlers/legacyWorkflows.js +0 -3
  149. package/dist/server/handlers/legacyWorkflows.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkCJFKRVED_cjs = require('./chunk-CJFKRVED.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] = chunkCJFKRVED_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 = chunkCJFKRVED_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 chunkCJFKRVED_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,37 +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" });
512
- }
513
- if (!body.step) {
514
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
436
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
515
437
  }
516
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
438
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
517
439
  if (!workflow) {
518
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
440
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
519
441
  }
520
442
  const run = await workflow.getWorkflowRunById(runId);
521
443
  if (!run) {
522
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
444
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
523
445
  }
524
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
446
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
525
447
  const result = await _run.resume({
526
448
  step: body.step,
527
449
  resumeData: body.resumeData,
528
- runtimeContext,
450
+ requestContext,
529
451
  tracingOptions
530
452
  });
531
453
  return result;
532
454
  } catch (error) {
533
- return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow step");
455
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow step");
534
456
  }
535
457
  }
536
458
  async function resumeWorkflowHandler({
@@ -538,37 +460,34 @@ async function resumeWorkflowHandler({
538
460
  workflowId,
539
461
  runId,
540
462
  body,
541
- runtimeContext,
463
+ requestContext,
542
464
  tracingOptions
543
465
  }) {
544
466
  try {
545
467
  if (!workflowId) {
546
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
468
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
547
469
  }
548
470
  if (!runId) {
549
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
550
- }
551
- if (!body.step) {
552
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
471
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
553
472
  }
554
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
473
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
555
474
  if (!workflow) {
556
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
475
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
557
476
  }
558
477
  const run = await workflow.getWorkflowRunById(runId);
559
478
  if (!run) {
560
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
479
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
561
480
  }
562
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
481
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
563
482
  void _run.resume({
564
483
  step: body.step,
565
484
  resumeData: body.resumeData,
566
- runtimeContext,
485
+ requestContext,
567
486
  tracingOptions
568
487
  });
569
488
  return { message: "Workflow run resumed" };
570
489
  } catch (error) {
571
- return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow");
490
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
572
491
  }
573
492
  }
574
493
  async function resumeStreamWorkflowHandler({
@@ -576,33 +495,30 @@ async function resumeStreamWorkflowHandler({
576
495
  workflowId,
577
496
  runId,
578
497
  body,
579
- runtimeContext,
498
+ requestContext,
580
499
  tracingOptions
581
500
  }) {
582
501
  try {
583
502
  if (!workflowId) {
584
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
503
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
585
504
  }
586
505
  if (!runId) {
587
- 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" });
588
507
  }
589
- if (!body.step) {
590
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
591
- }
592
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
508
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
593
509
  if (!workflow) {
594
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
510
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
595
511
  }
596
512
  const run = await workflow.getWorkflowRunById(runId);
597
513
  if (!run) {
598
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
514
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
599
515
  }
600
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
516
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
601
517
  const serverCache = mastra.getServerCache();
602
518
  const stream = _run.resumeStream({
603
519
  step: body.step,
604
520
  resumeData: body.resumeData,
605
- runtimeContext,
521
+ requestContext,
606
522
  tracingOptions
607
523
  }).fullStream.pipeThrough(
608
524
  new web.TransformStream({
@@ -618,33 +534,39 @@ async function resumeStreamWorkflowHandler({
618
534
  );
619
535
  return stream;
620
536
  } catch (error) {
621
- return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow");
537
+ return chunkV5WWQN7P_cjs.handleError(error, "Error resuming workflow");
622
538
  }
623
539
  }
624
- async function getWorkflowRunsHandler({
540
+ async function listWorkflowRunsHandler({
625
541
  mastra,
626
542
  workflowId,
627
543
  fromDate,
628
544
  toDate,
629
- limit,
630
- offset,
545
+ perPage,
546
+ page,
631
547
  resourceId
632
548
  }) {
633
549
  try {
634
550
  if (!workflowId) {
635
- 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" });
636
555
  }
637
- 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 });
638
560
  if (!workflow) {
639
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
561
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
640
562
  }
641
- const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
563
+ const workflowRuns = await workflow.listWorkflowRuns({ fromDate, toDate, perPage, page, resourceId }) || {
642
564
  runs: [],
643
565
  total: 0
644
566
  };
645
567
  return workflowRuns;
646
568
  } catch (error) {
647
- return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow runs");
569
+ return chunkV5WWQN7P_cjs.handleError(error, "Error getting workflow runs");
648
570
  }
649
571
  }
650
572
  async function cancelWorkflowRunHandler({
@@ -654,53 +576,24 @@ async function cancelWorkflowRunHandler({
654
576
  }) {
655
577
  try {
656
578
  if (!workflowId) {
657
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
579
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "Workflow ID is required" });
658
580
  }
659
581
  if (!runId) {
660
- 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" });
661
583
  }
662
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
584
+ const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
663
585
  if (!workflow) {
664
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
586
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow not found" });
665
587
  }
666
588
  const run = await workflow.getWorkflowRunById(runId);
667
589
  if (!run) {
668
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
590
+ throw new chunk64ITUOXI_cjs.HTTPException(404, { message: "Workflow run not found" });
669
591
  }
670
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
592
+ const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
671
593
  await _run.cancel();
672
594
  return { message: "Workflow run cancelled" };
673
595
  } catch (error) {
674
- return chunkRE4RPXT2_cjs.handleError(error, "Error canceling workflow run");
675
- }
676
- }
677
- async function sendWorkflowRunEventHandler({
678
- mastra,
679
- workflowId,
680
- runId,
681
- event,
682
- data
683
- }) {
684
- try {
685
- if (!workflowId) {
686
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
687
- }
688
- if (!runId) {
689
- throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to send workflow run event" });
690
- }
691
- const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
692
- if (!workflow) {
693
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
694
- }
695
- const run = await workflow.getWorkflowRunById(runId);
696
- if (!run) {
697
- throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
698
- }
699
- const _run = await workflow.createRunAsync({ runId, resourceId: run.resourceId });
700
- await _run.sendEvent(event, data);
701
- return { message: "Workflow run event sent" };
702
- } catch (error) {
703
- return chunkRE4RPXT2_cjs.handleError(error, "Error sending workflow run event");
596
+ return chunkV5WWQN7P_cjs.handleError(error, "Error canceling workflow run");
704
597
  }
705
598
  }
706
599
 
@@ -709,21 +602,19 @@ exports.createWorkflowRunHandler = createWorkflowRunHandler;
709
602
  exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
710
603
  exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
711
604
  exports.getWorkflowRunExecutionResultHandler = getWorkflowRunExecutionResultHandler;
712
- exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
713
- exports.getWorkflowsHandler = getWorkflowsHandler;
605
+ exports.listWorkflowRunsHandler = listWorkflowRunsHandler;
606
+ exports.listWorkflowsHandler = listWorkflowsHandler;
714
607
  exports.observeStreamLegacyWorkflowHandler = observeStreamLegacyWorkflowHandler;
715
608
  exports.observeStreamVNextWorkflowHandler = observeStreamVNextWorkflowHandler;
716
609
  exports.observeStreamWorkflowHandler = observeStreamWorkflowHandler;
717
610
  exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
718
611
  exports.resumeStreamWorkflowHandler = resumeStreamWorkflowHandler;
719
612
  exports.resumeWorkflowHandler = resumeWorkflowHandler;
720
- exports.sendWorkflowRunEventHandler = sendWorkflowRunEventHandler;
721
613
  exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
722
614
  exports.startWorkflowRunHandler = startWorkflowRunHandler;
723
615
  exports.streamLegacyWorkflowHandler = streamLegacyWorkflowHandler;
724
616
  exports.streamVNextWorkflowHandler = streamVNextWorkflowHandler;
725
617
  exports.streamWorkflowHandler = streamWorkflowHandler;
726
- exports.watchWorkflowHandler = watchWorkflowHandler;
727
618
  exports.workflows_exports = workflows_exports;
728
- //# sourceMappingURL=chunk-B7QWVGQQ.cjs.map
729
- //# sourceMappingURL=chunk-B7QWVGQQ.cjs.map
619
+ //# sourceMappingURL=chunk-X3MICMI2.cjs.map
620
+ //# sourceMappingURL=chunk-X3MICMI2.cjs.map