@mastra/deployer 0.18.0 → 0.19.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
  3. package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
  4. package/dist/build/analyze.cjs +2 -2
  5. package/dist/build/analyze.js +1 -1
  6. package/dist/build/bundler.cjs +3 -3
  7. package/dist/build/bundler.d.ts.map +1 -1
  8. package/dist/build/bundler.js +1 -1
  9. package/dist/build/index.cjs +15 -15
  10. package/dist/build/index.js +5 -5
  11. package/dist/build/plugins/node-modules-extension-resolver.d.ts.map +1 -1
  12. package/dist/build/utils.d.ts +13 -0
  13. package/dist/build/utils.d.ts.map +1 -1
  14. package/dist/build/watcher.d.ts.map +1 -1
  15. package/dist/bundler/index.cjs +2 -2
  16. package/dist/bundler/index.d.ts.map +1 -1
  17. package/dist/bundler/index.js +1 -1
  18. package/dist/bundler/workspaceDependencies.d.ts.map +1 -1
  19. package/dist/{chunk-CGLMV75H.cjs → chunk-3JYRSECU.cjs} +10 -5
  20. package/dist/chunk-3JYRSECU.cjs.map +1 -0
  21. package/dist/{chunk-4PSE6XXT.cjs → chunk-5HLB56SX.cjs} +18 -18
  22. package/dist/chunk-5HLB56SX.cjs.map +1 -0
  23. package/dist/{chunk-CHKSDG3W.js → chunk-5QFG6SCM.js} +8 -3
  24. package/dist/chunk-5QFG6SCM.js.map +1 -0
  25. package/dist/{chunk-36EU6KMX.cjs → chunk-7XYNDWHM.cjs} +58 -37
  26. package/dist/chunk-7XYNDWHM.cjs.map +1 -0
  27. package/dist/{chunk-BZDTNUHJ.cjs → chunk-C63Y45DE.cjs} +18 -12
  28. package/dist/chunk-C63Y45DE.cjs.map +1 -0
  29. package/dist/{chunk-E3RTDQG6.js → chunk-E56YDU6G.js} +56 -36
  30. package/dist/chunk-E56YDU6G.js.map +1 -0
  31. package/dist/{chunk-BNYQVIRY.js → chunk-G6MQAGP6.js} +10 -9
  32. package/dist/chunk-G6MQAGP6.js.map +1 -0
  33. package/dist/{chunk-AGJGRBDD.cjs → chunk-JKSGIHN5.cjs} +5 -5
  34. package/dist/{chunk-AGJGRBDD.cjs.map → chunk-JKSGIHN5.cjs.map} +1 -1
  35. package/dist/{chunk-CKF6WWGH.cjs → chunk-LSVYJCYH.cjs} +24 -23
  36. package/dist/chunk-LSVYJCYH.cjs.map +1 -0
  37. package/dist/{chunk-AUXVJBHV.js → chunk-P76ACDWK.js} +3 -3
  38. package/dist/{chunk-AUXVJBHV.js.map → chunk-P76ACDWK.js.map} +1 -1
  39. package/dist/{chunk-4775FISH.js → chunk-RCG3326W.js} +9 -8
  40. package/dist/chunk-RCG3326W.js.map +1 -0
  41. package/dist/{chunk-IARXPG3L.js → chunk-RZGW2FV5.js} +15 -9
  42. package/dist/chunk-RZGW2FV5.js.map +1 -0
  43. package/dist/index.cjs +12 -12
  44. package/dist/index.js +4 -4
  45. package/dist/server/handlers/routes/agents/handlers.d.ts.map +1 -1
  46. package/dist/server/handlers/routes/agents/router.d.ts.map +1 -1
  47. package/dist/server/handlers/routes/observability/handlers.d.ts +1 -0
  48. package/dist/server/handlers/routes/observability/handlers.d.ts.map +1 -1
  49. package/dist/server/handlers/routes/observability/router.d.ts.map +1 -1
  50. package/dist/server/handlers/routes/workflows/handlers.d.ts.map +1 -1
  51. package/dist/server/handlers/routes/workflows/router.d.ts.map +1 -1
  52. package/dist/server/index.cjs +264 -24
  53. package/dist/server/index.cjs.map +1 -1
  54. package/dist/server/index.d.ts.map +1 -1
  55. package/dist/server/index.js +265 -25
  56. package/dist/server/index.js.map +1 -1
  57. package/dist/services/deps.d.ts.map +1 -1
  58. package/dist/services/index.cjs +4 -4
  59. package/dist/services/index.js +1 -1
  60. package/dist/validator/validate.d.ts.map +1 -1
  61. package/package.json +8 -8
  62. package/dist/chunk-36EU6KMX.cjs.map +0 -1
  63. package/dist/chunk-4775FISH.js.map +0 -1
  64. package/dist/chunk-4PSE6XXT.cjs.map +0 -1
  65. package/dist/chunk-BNYQVIRY.js.map +0 -1
  66. package/dist/chunk-BZDTNUHJ.cjs.map +0 -1
  67. package/dist/chunk-CGLMV75H.cjs.map +0 -1
  68. package/dist/chunk-CHKSDG3W.js.map +0 -1
  69. package/dist/chunk-CKF6WWGH.cjs.map +0 -1
  70. package/dist/chunk-E3RTDQG6.js.map +0 -1
  71. package/dist/chunk-IARXPG3L.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAuB5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,KAAK,QAAQ,GAAG,EAAE,CAAC;AAEnB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,GAAG,CAAC;QAAE,UAAU,EAAE,+BAA+B,CAAA;KAAE,CAAC,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9C,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,wCAmB/D;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAER;cAGgC,QAAQ;eAAa,SAAS;2CAogBhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAoDlG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAuB5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,KAAK,QAAQ,GAAG,EAAE,CAAC;AAEnB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,GAAG,CAAC;QAAE,UAAU,EAAE,+BAA+B,CAAA;KAAE,CAAC,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9C,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,wCAmB/D;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAER;cAGgC,QAAQ;eAAa,SAAS;2CAsgBhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAoDlG"}
@@ -22,6 +22,7 @@ import { getAgentCardByIdHandler as getAgentCardByIdHandler$1, getAgentExecution
22
22
  import { stream } from 'hono/streaming';
23
23
  import { bodyLimit } from 'hono/body-limit';
24
24
  import { getAgentBuilderActionsHandler as getAgentBuilderActionsHandler$1, getAgentBuilderActionByIdHandler as getAgentBuilderActionByIdHandler$1, getAgentBuilderActionRunsHandler as getAgentBuilderActionRunsHandler$1, getAgentBuilderActionRunExecutionResultHandler as getAgentBuilderActionRunExecutionResultHandler$1, getAgentBuilderActionRunByIdHandler as getAgentBuilderActionRunByIdHandler$1, resumeAgentBuilderActionHandler as resumeAgentBuilderActionHandler$1, resumeAsyncAgentBuilderActionHandler as resumeAsyncAgentBuilderActionHandler$1, streamAgentBuilderActionHandler as streamAgentBuilderActionHandler$1, streamVNextAgentBuilderActionHandler as streamVNextAgentBuilderActionHandler$1, createAgentBuilderActionRunHandler as createAgentBuilderActionRunHandler$1, startAsyncAgentBuilderActionHandler as startAsyncAgentBuilderActionHandler$1, startAgentBuilderActionRunHandler as startAgentBuilderActionRunHandler$1, watchAgentBuilderActionHandler as watchAgentBuilderActionHandler$1, cancelAgentBuilderActionRunHandler as cancelAgentBuilderActionRunHandler$1, sendAgentBuilderActionRunEventHandler as sendAgentBuilderActionRunEventHandler$1 } from '@mastra/server/handlers/agent-builder';
25
+ import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
25
26
  import { getAgentsHandler as getAgentsHandler$1, getAgentByIdHandler as getAgentByIdHandler$1, getEvalsByAgentIdHandler as getEvalsByAgentIdHandler$1, getLiveEvalsByAgentIdHandler as getLiveEvalsByAgentIdHandler$1, generateLegacyHandler as generateLegacyHandler$1, generateHandler as generateHandler$1, streamNetworkHandler as streamNetworkHandler$1, generateVNextHandler as generateVNextHandler$1, streamVNextGenerateHandler as streamVNextGenerateHandler$1, streamGenerateLegacyHandler as streamGenerateLegacyHandler$1, streamGenerateHandler as streamGenerateHandler$1, streamVNextUIMessageHandler as streamVNextUIMessageHandler$1, updateAgentModelHandler as updateAgentModelHandler$1, reorderAgentModelListHandler as reorderAgentModelListHandler$1, updateAgentModelInModelListHandler as updateAgentModelInModelListHandler$1 } from '@mastra/server/handlers/agents';
26
27
  import { Agent } from '@mastra/core/agent';
27
28
  import { z } from 'zod';
@@ -33,7 +34,7 @@ import { Buffer as Buffer$1 } from 'buffer';
33
34
  import { getMemoryStatusHandler as getMemoryStatusHandler$1, getThreadsHandler as getThreadsHandler$1, getThreadByIdHandler as getThreadByIdHandler$1, getMessagesHandler as getMessagesHandler$1, createThreadHandler as createThreadHandler$1, updateThreadHandler as updateThreadHandler$1, deleteThreadHandler as deleteThreadHandler$1, saveMessagesHandler as saveMessagesHandler$1, deleteMessagesHandler as deleteMessagesHandler$1, getMemoryConfigHandler as getMemoryConfigHandler$1, getThreadsPaginatedHandler as getThreadsPaginatedHandler$1, getMessagesPaginatedHandler as getMessagesPaginatedHandler$1, searchMemoryHandler as searchMemoryHandler$1, getWorkingMemoryHandler as getWorkingMemoryHandler$1, updateWorkingMemoryHandler as updateWorkingMemoryHandler$1 } from '@mastra/server/handlers/memory';
34
35
  import { getVNextNetworksHandler as getVNextNetworksHandler$1, getVNextNetworkByIdHandler as getVNextNetworkByIdHandler$1, generateVNextNetworkHandler as generateVNextNetworkHandler$1, loopVNextNetworkHandler as loopVNextNetworkHandler$1, loopStreamVNextNetworkHandler as loopStreamVNextNetworkHandler$1, streamGenerateVNextNetworkHandler as streamGenerateVNextNetworkHandler$1 } from '@mastra/server/handlers/vNextNetwork';
35
36
  import { AISpanType } from '@mastra/core/ai-tracing';
36
- import { getAITracesPaginatedHandler as getAITracesPaginatedHandler$1, getAITraceHandler as getAITraceHandler$1, scoreTracesHandler } from '@mastra/server/handlers/observability';
37
+ import { getAITracesPaginatedHandler as getAITracesPaginatedHandler$1, getAITraceHandler as getAITraceHandler$1, getScoresBySpan as getScoresBySpan$1, scoreTracesHandler } from '@mastra/server/handlers/observability';
37
38
  import { getScorersHandler as getScorersHandler$1, getScorerHandler as getScorerHandler$1, getScoresByRunIdHandler as getScoresByRunIdHandler$1, getScoresByScorerIdHandler as getScoresByScorerIdHandler$1, getScoresByEntityIdHandler as getScoresByEntityIdHandler$1, saveScoreHandler as saveScoreHandler$1 } from '@mastra/server/handlers/scores';
38
39
  import { getTelemetryHandler as getTelemetryHandler$1, storeTelemetryHandler as storeTelemetryHandler$1 } from '@mastra/server/handlers/telemetry';
39
40
  import { upsertVectors as upsertVectors$1, createIndex as createIndex$1, queryVectors as queryVectors$1, listIndexes as listIndexes$1, describeIndex as describeIndex$1, deleteIndex as deleteIndex$1 } from '@mastra/server/handlers/vector';
@@ -292,12 +293,16 @@ async function readWithoutBlocking(readPromise) {
292
293
  return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
293
294
  }
294
295
  function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
295
- const handleError2 = () => {
296
+ const cancel = (error) => {
297
+ reader.cancel(error).catch(() => {
298
+ });
296
299
  };
297
- writable.on("error", handleError2);
300
+ writable.on("close", cancel);
301
+ writable.on("error", cancel);
298
302
  (currentReadPromise ?? reader.read()).then(flow, handleStreamError);
299
303
  return reader.closed.finally(() => {
300
- writable.off("error", handleError2);
304
+ writable.off("close", cancel);
305
+ writable.off("error", cancel);
301
306
  });
302
307
  function handleStreamError(error) {
303
308
  if (error) {
@@ -2356,6 +2361,17 @@ var vNextBodyOptions = {
2356
2361
  description: "Controls how tools are selected during generation"
2357
2362
  },
2358
2363
  format: { type: "string", enum: ["mastra", "aisdk"], description: "Response format" },
2364
+ tracingOptions: {
2365
+ type: "object",
2366
+ description: "Tracing options for the agent execution",
2367
+ properties: {
2368
+ metadata: {
2369
+ type: "object",
2370
+ description: "Custom metadata to attach to the trace",
2371
+ additionalProperties: true
2372
+ }
2373
+ }
2374
+ },
2359
2375
  ...sharedBodyOptions
2360
2376
  };
2361
2377
  async function getAgentsHandler(c2) {
@@ -2540,6 +2556,27 @@ async function streamNetworkHandler(c2) {
2540
2556
  const runtimeContext = c2.get("runtimeContext");
2541
2557
  const body = await c2.req.json();
2542
2558
  const logger2 = mastra.getLogger();
2559
+ const agent = mastra.getAgent(agentId);
2560
+ if (!agent) {
2561
+ throw new MastraError({
2562
+ id: "AGENT_NOT_FOUND",
2563
+ domain: ErrorDomain.AGENT,
2564
+ category: ErrorCategory.USER,
2565
+ text: "Agent not found"
2566
+ });
2567
+ }
2568
+ const memory = await agent.getMemory({ runtimeContext });
2569
+ if (!memory) {
2570
+ throw new MastraError({
2571
+ id: "AGENT_NETWORK_MEMORY_REQUIRED",
2572
+ domain: ErrorDomain.AGENT_NETWORK,
2573
+ category: ErrorCategory.USER,
2574
+ text: "Memory is required for the agent network to function properly. Please configure memory for the agent.",
2575
+ details: {
2576
+ status: 400
2577
+ }
2578
+ });
2579
+ }
2543
2580
  c2.header("Transfer-Encoding", "chunked");
2544
2581
  return stream(
2545
2582
  c2,
@@ -3078,7 +3115,18 @@ function agentsRouter(bodyLimitOptions) {
3078
3115
  deprecated: true
3079
3116
  },
3080
3117
  runId: { type: "string" },
3081
- output: { type: "object" }
3118
+ output: { type: "object" },
3119
+ tracingOptions: {
3120
+ type: "object",
3121
+ description: "Tracing options for the agent execution",
3122
+ properties: {
3123
+ metadata: {
3124
+ type: "object",
3125
+ description: "Custom metadata to attach to the trace",
3126
+ additionalProperties: true
3127
+ }
3128
+ }
3129
+ }
3082
3130
  },
3083
3131
  required: ["messages"]
3084
3132
  }
@@ -3129,7 +3177,18 @@ function agentsRouter(bodyLimitOptions) {
3129
3177
  deprecated: true
3130
3178
  },
3131
3179
  runId: { type: "string" },
3132
- output: { type: "object" }
3180
+ output: { type: "object" },
3181
+ tracingOptions: {
3182
+ type: "object",
3183
+ description: "Tracing options for the agent execution",
3184
+ properties: {
3185
+ metadata: {
3186
+ type: "object",
3187
+ description: "Custom metadata to attach to the trace",
3188
+ additionalProperties: true
3189
+ }
3190
+ }
3191
+ }
3133
3192
  },
3134
3193
  required: ["messages"]
3135
3194
  }
@@ -3283,7 +3342,18 @@ function agentsRouter(bodyLimitOptions) {
3283
3342
  deprecated: true
3284
3343
  },
3285
3344
  runId: { type: "string" },
3286
- output: { type: "object" }
3345
+ output: { type: "object" },
3346
+ tracingOptions: {
3347
+ type: "object",
3348
+ description: "Tracing options for the agent execution",
3349
+ properties: {
3350
+ metadata: {
3351
+ type: "object",
3352
+ description: "Custom metadata to attach to the trace",
3353
+ additionalProperties: true
3354
+ }
3355
+ }
3356
+ }
3287
3357
  },
3288
3358
  required: ["messages"]
3289
3359
  }
@@ -3334,7 +3404,18 @@ function agentsRouter(bodyLimitOptions) {
3334
3404
  deprecated: true
3335
3405
  },
3336
3406
  runId: { type: "string" },
3337
- output: { type: "object" }
3407
+ output: { type: "object" },
3408
+ tracingOptions: {
3409
+ type: "object",
3410
+ description: "Tracing options for the agent execution",
3411
+ properties: {
3412
+ metadata: {
3413
+ type: "object",
3414
+ description: "Custom metadata to attach to the trace",
3415
+ additionalProperties: true
3416
+ }
3417
+ }
3418
+ }
3338
3419
  },
3339
3420
  required: ["messages"]
3340
3421
  }
@@ -3400,6 +3481,17 @@ function agentsRouter(bodyLimitOptions) {
3400
3481
  { type: "string", enum: ["auto", "none", "required"] },
3401
3482
  { type: "object", properties: { type: { type: "string" }, toolName: { type: "string" } } }
3402
3483
  ]
3484
+ },
3485
+ tracingOptions: {
3486
+ type: "object",
3487
+ description: "Tracing options for the agent execution",
3488
+ properties: {
3489
+ metadata: {
3490
+ type: "object",
3491
+ description: "Custom metadata to attach to the trace",
3492
+ additionalProperties: true
3493
+ }
3494
+ }
3403
3495
  }
3404
3496
  },
3405
3497
  required: ["messages"]
@@ -8828,6 +8920,25 @@ async function processTraceScoringHandler(c2) {
8828
8920
  return handleError(error, "Error processing trace scoring");
8829
8921
  }
8830
8922
  }
8923
+ async function getScoresBySpan(c2) {
8924
+ const mastra = c2.get("mastra");
8925
+ const traceId = c2.req.param("traceId");
8926
+ const spanId = c2.req.param("spanId");
8927
+ const page = parseInt(c2.req.query("page") || "0");
8928
+ const perPage = parseInt(c2.req.query("perPage") || "10");
8929
+ const pagination = { page, perPage };
8930
+ try {
8931
+ const scores = await getScoresBySpan$1({
8932
+ mastra,
8933
+ traceId,
8934
+ spanId,
8935
+ pagination
8936
+ });
8937
+ return c2.json(scores);
8938
+ } catch (error) {
8939
+ return handleError(error, "Error getting scores by span");
8940
+ }
8941
+ }
8831
8942
 
8832
8943
  // src/server/handlers/routes/observability/router.ts
8833
8944
  function observabilityRouter() {
@@ -8920,6 +9031,49 @@ function observabilityRouter() {
8920
9031
  }),
8921
9032
  getAITraceHandler
8922
9033
  );
9034
+ router.get(
9035
+ "/traces/:traceId/:spanId/scores",
9036
+ w({
9037
+ description: "Get scores by trace ID and span ID",
9038
+ tags: ["scores"],
9039
+ parameters: [
9040
+ {
9041
+ name: "traceId",
9042
+ in: "path",
9043
+ required: true,
9044
+ schema: { type: "string" },
9045
+ description: "Trace ID"
9046
+ },
9047
+ {
9048
+ name: "spanId",
9049
+ in: "path",
9050
+ required: true,
9051
+ schema: { type: "string" },
9052
+ description: "Span ID"
9053
+ },
9054
+ {
9055
+ name: "page",
9056
+ in: "query",
9057
+ required: false,
9058
+ schema: { type: "number" },
9059
+ description: "Page number for pagination (default: 0)"
9060
+ },
9061
+ {
9062
+ name: "perPage",
9063
+ in: "query",
9064
+ required: false,
9065
+ schema: { type: "number" },
9066
+ description: "Number of items per page (default: 10)"
9067
+ }
9068
+ ],
9069
+ responses: {
9070
+ 200: {
9071
+ description: "Paginated list of scores for span"
9072
+ }
9073
+ }
9074
+ }),
9075
+ getScoresBySpan
9076
+ );
8923
9077
  router.post(
8924
9078
  "/traces/score",
8925
9079
  w({
@@ -9835,14 +9989,15 @@ async function startAsyncWorkflowHandler(c2) {
9835
9989
  const mastra = c2.get("mastra");
9836
9990
  const runtimeContext = c2.get("runtimeContext");
9837
9991
  const workflowId = c2.req.param("workflowId");
9838
- const { inputData } = await c2.req.json();
9992
+ const { inputData, tracingOptions } = await c2.req.json();
9839
9993
  const runId = c2.req.query("runId");
9840
9994
  const result = await startAsyncWorkflowHandler$1({
9841
9995
  mastra,
9842
9996
  runtimeContext,
9843
9997
  workflowId,
9844
9998
  runId,
9845
- inputData
9999
+ inputData,
10000
+ tracingOptions
9846
10001
  });
9847
10002
  return c2.json(result);
9848
10003
  } catch (error) {
@@ -9854,14 +10009,15 @@ async function startWorkflowRunHandler(c2) {
9854
10009
  const mastra = c2.get("mastra");
9855
10010
  const runtimeContext = c2.get("runtimeContext");
9856
10011
  const workflowId = c2.req.param("workflowId");
9857
- const { inputData } = await c2.req.json();
10012
+ const { inputData, tracingOptions } = await c2.req.json();
9858
10013
  const runId = c2.req.query("runId");
9859
10014
  await startWorkflowRunHandler$1({
9860
10015
  mastra,
9861
10016
  runtimeContext,
9862
10017
  workflowId,
9863
10018
  runId,
9864
- inputData
10019
+ inputData,
10020
+ tracingOptions
9865
10021
  });
9866
10022
  return c2.json({ message: "Workflow run started" });
9867
10023
  } catch (e2) {
@@ -9913,7 +10069,7 @@ async function streamWorkflowHandler(c2) {
9913
10069
  const runtimeContext = c2.get("runtimeContext");
9914
10070
  const logger2 = mastra.getLogger();
9915
10071
  const workflowId = c2.req.param("workflowId");
9916
- const { inputData } = await c2.req.json();
10072
+ const { inputData, tracingOptions } = await c2.req.json();
9917
10073
  const runId = c2.req.query("runId");
9918
10074
  c2.header("Transfer-Encoding", "chunked");
9919
10075
  return stream(
@@ -9925,7 +10081,8 @@ async function streamWorkflowHandler(c2) {
9925
10081
  workflowId,
9926
10082
  runId,
9927
10083
  inputData,
9928
- runtimeContext
10084
+ runtimeContext,
10085
+ tracingOptions
9929
10086
  });
9930
10087
  const reader = result.stream.getReader();
9931
10088
  stream7.onAbort(() => {
@@ -9994,7 +10151,7 @@ async function streamVNextWorkflowHandler(c2) {
9994
10151
  const runtimeContext = c2.get("runtimeContext");
9995
10152
  const logger2 = mastra.getLogger();
9996
10153
  const workflowId = c2.req.param("workflowId");
9997
- const { inputData, closeOnSuspend } = await c2.req.json();
10154
+ const { inputData, closeOnSuspend, tracingOptions } = await c2.req.json();
9998
10155
  const runId = c2.req.query("runId");
9999
10156
  c2.header("Transfer-Encoding", "chunked");
10000
10157
  return stream(
@@ -10007,7 +10164,8 @@ async function streamVNextWorkflowHandler(c2) {
10007
10164
  runId,
10008
10165
  inputData,
10009
10166
  runtimeContext,
10010
- closeOnSuspend
10167
+ closeOnSuspend,
10168
+ tracingOptions
10011
10169
  });
10012
10170
  const reader = result.getReader();
10013
10171
  stream7.onAbort(() => {
@@ -10035,7 +10193,7 @@ async function resumeStreamWorkflowHandler(c2) {
10035
10193
  const runtimeContext = c2.get("runtimeContext");
10036
10194
  const logger2 = mastra.getLogger();
10037
10195
  const workflowId = c2.req.param("workflowId");
10038
- const { step, resumeData } = await c2.req.json();
10196
+ const { step, resumeData, tracingOptions } = await c2.req.json();
10039
10197
  const runId = c2.req.query("runId");
10040
10198
  c2.header("Transfer-Encoding", "chunked");
10041
10199
  return stream(
@@ -10047,7 +10205,8 @@ async function resumeStreamWorkflowHandler(c2) {
10047
10205
  workflowId,
10048
10206
  runId,
10049
10207
  body: { step, resumeData },
10050
- runtimeContext
10208
+ runtimeContext,
10209
+ tracingOptions
10051
10210
  });
10052
10211
  const reader = result.getReader();
10053
10212
  stream7.onAbort(() => {
@@ -10075,7 +10234,7 @@ async function resumeAsyncWorkflowHandler(c2) {
10075
10234
  const runtimeContext = c2.get("runtimeContext");
10076
10235
  const workflowId = c2.req.param("workflowId");
10077
10236
  const runId = c2.req.query("runId");
10078
- const { step, resumeData } = await c2.req.json();
10237
+ const { step, resumeData, tracingOptions } = await c2.req.json();
10079
10238
  if (!runId) {
10080
10239
  throw new HTTPException(400, { message: "runId required to resume workflow" });
10081
10240
  }
@@ -10084,7 +10243,8 @@ async function resumeAsyncWorkflowHandler(c2) {
10084
10243
  runtimeContext,
10085
10244
  workflowId,
10086
10245
  runId,
10087
- body: { step, resumeData }
10246
+ body: { step, resumeData },
10247
+ tracingOptions
10088
10248
  });
10089
10249
  return c2.json(result);
10090
10250
  } catch (error) {
@@ -10097,7 +10257,7 @@ async function resumeWorkflowHandler(c2) {
10097
10257
  const runtimeContext = c2.get("runtimeContext");
10098
10258
  const workflowId = c2.req.param("workflowId");
10099
10259
  const runId = c2.req.query("runId");
10100
- const { step, resumeData } = await c2.req.json();
10260
+ const { step, resumeData, tracingOptions } = await c2.req.json();
10101
10261
  if (!runId) {
10102
10262
  throw new HTTPException(400, { message: "runId required to resume workflow" });
10103
10263
  }
@@ -10106,7 +10266,8 @@ async function resumeWorkflowHandler(c2) {
10106
10266
  runtimeContext,
10107
10267
  workflowId,
10108
10268
  runId,
10109
- body: { step, resumeData }
10269
+ body: { step, resumeData },
10270
+ tracingOptions
10110
10271
  });
10111
10272
  return c2.json({ message: "Workflow run resumed" });
10112
10273
  } catch (error) {
@@ -10467,7 +10628,18 @@ function workflowsRouter(bodyLimitOptions) {
10467
10628
  type: "object",
10468
10629
  properties: {
10469
10630
  stepId: { type: "string" },
10470
- context: { type: "object" }
10631
+ context: { type: "object" },
10632
+ tracingOptions: {
10633
+ type: "object",
10634
+ description: "Tracing options for the workflow execution",
10635
+ properties: {
10636
+ metadata: {
10637
+ type: "object",
10638
+ description: "Custom metadata to attach to the trace",
10639
+ additionalProperties: true
10640
+ }
10641
+ }
10642
+ }
10471
10643
  }
10472
10644
  }
10473
10645
  }
@@ -10504,7 +10676,18 @@ function workflowsRouter(bodyLimitOptions) {
10504
10676
  type: "object",
10505
10677
  properties: {
10506
10678
  stepId: { type: "string" },
10507
- context: { type: "object" }
10679
+ context: { type: "object" },
10680
+ tracingOptions: {
10681
+ type: "object",
10682
+ description: "Tracing options for the workflow execution",
10683
+ properties: {
10684
+ metadata: {
10685
+ type: "object",
10686
+ description: "Custom metadata to attach to the trace",
10687
+ additionalProperties: true
10688
+ }
10689
+ }
10690
+ }
10508
10691
  }
10509
10692
  }
10510
10693
  }
@@ -10853,6 +11036,17 @@ function workflowsRouter(bodyLimitOptions) {
10853
11036
  runtimeContext: {
10854
11037
  type: "object",
10855
11038
  description: "Runtime context for the workflow execution"
11039
+ },
11040
+ tracingOptions: {
11041
+ type: "object",
11042
+ description: "Tracing options for the workflow execution",
11043
+ properties: {
11044
+ metadata: {
11045
+ type: "object",
11046
+ description: "Custom metadata to attach to the trace",
11047
+ additionalProperties: true
11048
+ }
11049
+ }
10856
11050
  }
10857
11051
  },
10858
11052
  required: ["step"]
@@ -10936,6 +11130,17 @@ function workflowsRouter(bodyLimitOptions) {
10936
11130
  runtimeContext: {
10937
11131
  type: "object",
10938
11132
  description: "Runtime context for the workflow execution"
11133
+ },
11134
+ tracingOptions: {
11135
+ type: "object",
11136
+ description: "Tracing options for the workflow execution",
11137
+ properties: {
11138
+ metadata: {
11139
+ type: "object",
11140
+ description: "Custom metadata to attach to the trace",
11141
+ additionalProperties: true
11142
+ }
11143
+ }
10939
11144
  }
10940
11145
  }
10941
11146
  }
@@ -11017,6 +11222,17 @@ function workflowsRouter(bodyLimitOptions) {
11017
11222
  closeOnSuspend: {
11018
11223
  type: "boolean",
11019
11224
  description: "Close the stream on suspend"
11225
+ },
11226
+ tracingOptions: {
11227
+ type: "object",
11228
+ description: "Tracing options for the workflow execution",
11229
+ properties: {
11230
+ metadata: {
11231
+ type: "object",
11232
+ description: "Custom metadata to attach to the trace",
11233
+ additionalProperties: true
11234
+ }
11235
+ }
11020
11236
  }
11021
11237
  }
11022
11238
  }
@@ -11094,6 +11310,17 @@ function workflowsRouter(bodyLimitOptions) {
11094
11310
  runtimeContext: {
11095
11311
  type: "object",
11096
11312
  description: "Runtime context for the workflow execution"
11313
+ },
11314
+ tracingOptions: {
11315
+ type: "object",
11316
+ description: "Tracing options for the workflow execution",
11317
+ properties: {
11318
+ metadata: {
11319
+ type: "object",
11320
+ description: "Custom metadata to attach to the trace",
11321
+ additionalProperties: true
11322
+ }
11323
+ }
11097
11324
  }
11098
11325
  }
11099
11326
  }
@@ -11114,7 +11341,7 @@ function workflowsRouter(bodyLimitOptions) {
11114
11341
  router.post(
11115
11342
  "/:workflowId/start",
11116
11343
  w({
11117
- description: "Create and start a new workflow run",
11344
+ description: "Start an existing workflow run",
11118
11345
  tags: ["workflows"],
11119
11346
  parameters: [
11120
11347
  {
@@ -11141,6 +11368,17 @@ function workflowsRouter(bodyLimitOptions) {
11141
11368
  runtimeContext: {
11142
11369
  type: "object",
11143
11370
  description: "Runtime context for the workflow execution"
11371
+ },
11372
+ tracingOptions: {
11373
+ type: "object",
11374
+ description: "Tracing options for the workflow execution",
11375
+ properties: {
11376
+ metadata: {
11377
+ type: "object",
11378
+ description: "Custom metadata to attach to the trace",
11379
+ additionalProperties: true
11380
+ }
11381
+ }
11144
11382
  }
11145
11383
  }
11146
11384
  }
@@ -11784,9 +12022,11 @@ async function createHonoServer(mastra, options = {
11784
12022
  );
11785
12023
  const serverOptions = mastra.getServer();
11786
12024
  const port = serverOptions?.port ?? (Number(process.env.PORT) || 4111);
12025
+ const hideCloudCta = process.env.MASTRA_HIDE_CLOUD_CTA === "true";
11787
12026
  const host = serverOptions?.host ?? "localhost";
11788
12027
  indexHtml = indexHtml.replace(`'%%MASTRA_SERVER_HOST%%'`, `'${host}'`);
11789
12028
  indexHtml = indexHtml.replace(`'%%MASTRA_SERVER_PORT%%'`, `'${port}'`);
12029
+ indexHtml = indexHtml.replace(`'%%MASTRA_HIDE_CLOUD_CTA%%'`, `'${hideCloudCta}'`);
11790
12030
  return c2.newResponse(indexHtml, 200, { "Content-Type": "text/html" });
11791
12031
  }
11792
12032
  return c2.newResponse(html2, 200, { "Content-Type": "text/html" });