@mastra/inngest 1.11.6-alpha.0 → 1.11.6-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/connect.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-D4BQvOQD.cjs");
2
+ const require_src = require("./src-apDn0X9g.cjs");
3
3
  exports.connect = require_src.connect;
package/dist/connect.js CHANGED
@@ -1 +1 @@
1
- export { i as connect } from "./src-BxcFAs-9.js";
1
+ export { i as connect } from "./src-DasTihK7.js";
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-D4BQvOQD.cjs");
2
+ const require_src = require("./src-apDn0X9g.cjs");
3
3
  exports.InngestExecutionEngine = require_src.InngestExecutionEngine;
4
4
  exports.InngestPubSub = require_src.InngestPubSub;
5
5
  exports.InngestRun = require_src.InngestRun;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { m as InngestExecutionEngine, f as InngestPubSub, d as InngestRun, u as InngestWorkflow, p as OVERSIZED_EVENT_CHUNK_TYPE, r as _compatibilityCheck, i as connect, s as createInngestAgent, l as createInngestDurableAgenticWorkflow, a as createServe, t as createStep, n as init, c as isInngestAgent, o as serve } from "./src-BxcFAs-9.js";
1
+ export { m as InngestExecutionEngine, f as InngestPubSub, d as InngestRun, u as InngestWorkflow, p as OVERSIZED_EVENT_CHUNK_TYPE, r as _compatibilityCheck, i as connect, s as createInngestAgent, l as createInngestDurableAgenticWorkflow, a as createServe, t as createStep, n as init, c as isInngestAgent, o as serve } from "./src-DasTihK7.js";
@@ -3298,6 +3298,7 @@ function keepSuspendedRunScopes(snapshot, requestContext, resumeOptions) {
3298
3298
  requestContext[SCOPES_KEY] = saved;
3299
3299
  }
3300
3300
  // src/durable-agent/create-inngest-agent.ts
3301
+ const DURABLE_CONTEXT_SEGMENT_KEY = "__mastra_durableContextSegment";
3301
3302
  var InngestAgentPubSubRouter = class extends PubSub {
3302
3303
  defaultPubsub;
3303
3304
  getAgentPubsub;
@@ -3865,7 +3866,7 @@ function createInngestAgent(options) {
3865
3866
  /**
3866
3867
  * Trigger the workflow via Inngest event
3867
3868
  */
3868
- async function triggerWorkflow(runId, workflowInput, tracingOptions, actor, deadline) {
3869
+ async function triggerWorkflow(runId, workflowInput, tracingOptions, actor, deadline, contextSegment) {
3869
3870
  const eventName = `workflow.${InngestDurableStepIds.AGENTIC_LOOP}`;
3870
3871
  await inngest.send({
3871
3872
  name: eventName,
@@ -3873,7 +3874,10 @@ function createInngestAgent(options) {
3873
3874
  inputData: workflowInput,
3874
3875
  runId,
3875
3876
  resourceId: workflowInput.state?.resourceId,
3876
- requestContext: withSegmentDeadline(workflowInput.requestContextEntries ?? {}, deadline),
3877
+ requestContext: withSegmentDeadline({
3878
+ ...workflowInput.requestContextEntries,
3879
+ [DURABLE_CONTEXT_SEGMENT_KEY]: contextSegment
3880
+ }, deadline),
3877
3881
  tracingOptions,
3878
3882
  actor
3879
3883
  })
@@ -4000,6 +4004,8 @@ function createInngestAgent(options) {
4000
4004
  workflowInput.agentName = agentName;
4001
4005
  const { controller: abortController, detach: stopForwardingAbort } = createRunAbortController(streamOptions?.abortSignal, { onExternalAbort: () => void requestRemoteAbort(runId) });
4002
4006
  registryEntry.abortController = abortController;
4007
+ const contextSegment = crypto.randomUUID();
4008
+ registryEntry.requestContextSegment = contextSegment;
4003
4009
  const { clear: clearTotalTimeout, deadline: segmentDeadline } = armTotalTimeout(registryEntry, abortController, runId, callbackOptions.modelSettings?.timeout?.totalMs);
4004
4010
  registryEntry.messageList = preparation.messageList;
4005
4011
  globalRunRegistry.set(runId, registryEntry);
@@ -4094,7 +4100,7 @@ function createInngestAgent(options) {
4094
4100
  return;
4095
4101
  }
4096
4102
  try {
4097
- await triggerWorkflow(runId, workflowInput, tracingOptions, streamOptions?.actor, segmentDeadline);
4103
+ await triggerWorkflow(runId, workflowInput, tracingOptions, streamOptions?.actor, segmentDeadline, contextSegment);
4098
4104
  } catch (error) {
4099
4105
  if (persistedRunning) await deleteRunSnapshots(runId);
4100
4106
  throw error;
@@ -4266,6 +4272,8 @@ function createInngestAgent(options) {
4266
4272
  existingEntry.abortController = abortController;
4267
4273
  existingEntry.requestContext = callbackOptions.requestContext;
4268
4274
  existingEntry.requestContextRebuilt = false;
4275
+ const contextSegment = crypto.randomUUID();
4276
+ existingEntry.requestContextSegment = contextSegment;
4269
4277
  const resumeSegment = openResumeSegment(runId, suspendedSnapshot, callbackOptions.requestContext);
4270
4278
  existingEntry.resumeAgentSpan = resumeSegment?.agentSpan;
4271
4279
  existingEntry.resumeModelSpan = resumeSegment?.modelSpan;
@@ -4408,7 +4416,10 @@ function createInngestAgent(options) {
4408
4416
  inputData: resumeData,
4409
4417
  runId,
4410
4418
  resourceId: resumeOptions?.resourceId,
4411
- requestContext: withSegmentDeadline(requestContext, segmentDeadline),
4419
+ requestContext: withSegmentDeadline({
4420
+ ...requestContext,
4421
+ [DURABLE_CONTEXT_SEGMENT_KEY]: contextSegment
4422
+ }, segmentDeadline),
4412
4423
  tracingOptions,
4413
4424
  actor: resumeOptions?.actor,
4414
4425
  resume: {
@@ -3320,6 +3320,7 @@ function keepSuspendedRunScopes(snapshot, requestContext, resumeOptions) {
3320
3320
  requestContext[SCOPES_KEY] = saved;
3321
3321
  }
3322
3322
  // src/durable-agent/create-inngest-agent.ts
3323
+ const DURABLE_CONTEXT_SEGMENT_KEY = "__mastra_durableContextSegment";
3323
3324
  var InngestAgentPubSubRouter = class extends _mastra_core_events.PubSub {
3324
3325
  defaultPubsub;
3325
3326
  getAgentPubsub;
@@ -3887,7 +3888,7 @@ function createInngestAgent(options) {
3887
3888
  /**
3888
3889
  * Trigger the workflow via Inngest event
3889
3890
  */
3890
- async function triggerWorkflow(runId, workflowInput, tracingOptions, actor, deadline) {
3891
+ async function triggerWorkflow(runId, workflowInput, tracingOptions, actor, deadline, contextSegment) {
3891
3892
  const eventName = `workflow.${InngestDurableStepIds.AGENTIC_LOOP}`;
3892
3893
  await inngest$1.send({
3893
3894
  name: eventName,
@@ -3895,7 +3896,10 @@ function createInngestAgent(options) {
3895
3896
  inputData: workflowInput,
3896
3897
  runId,
3897
3898
  resourceId: workflowInput.state?.resourceId,
3898
- requestContext: withSegmentDeadline(workflowInput.requestContextEntries ?? {}, deadline),
3899
+ requestContext: withSegmentDeadline({
3900
+ ...workflowInput.requestContextEntries,
3901
+ [DURABLE_CONTEXT_SEGMENT_KEY]: contextSegment
3902
+ }, deadline),
3899
3903
  tracingOptions,
3900
3904
  actor
3901
3905
  })
@@ -4022,6 +4026,8 @@ function createInngestAgent(options) {
4022
4026
  workflowInput.agentName = agentName;
4023
4027
  const { controller: abortController, detach: stopForwardingAbort } = (0, _mastra_core_agent_durable.createRunAbortController)(streamOptions?.abortSignal, { onExternalAbort: () => void requestRemoteAbort(runId) });
4024
4028
  registryEntry.abortController = abortController;
4029
+ const contextSegment = crypto.randomUUID();
4030
+ registryEntry.requestContextSegment = contextSegment;
4025
4031
  const { clear: clearTotalTimeout, deadline: segmentDeadline } = armTotalTimeout(registryEntry, abortController, runId, callbackOptions.modelSettings?.timeout?.totalMs);
4026
4032
  registryEntry.messageList = preparation.messageList;
4027
4033
  _mastra_core_agent_durable.globalRunRegistry.set(runId, registryEntry);
@@ -4116,7 +4122,7 @@ function createInngestAgent(options) {
4116
4122
  return;
4117
4123
  }
4118
4124
  try {
4119
- await triggerWorkflow(runId, workflowInput, tracingOptions, streamOptions?.actor, segmentDeadline);
4125
+ await triggerWorkflow(runId, workflowInput, tracingOptions, streamOptions?.actor, segmentDeadline, contextSegment);
4120
4126
  } catch (error) {
4121
4127
  if (persistedRunning) await deleteRunSnapshots(runId);
4122
4128
  throw error;
@@ -4288,6 +4294,8 @@ function createInngestAgent(options) {
4288
4294
  existingEntry.abortController = abortController;
4289
4295
  existingEntry.requestContext = callbackOptions.requestContext;
4290
4296
  existingEntry.requestContextRebuilt = false;
4297
+ const contextSegment = crypto.randomUUID();
4298
+ existingEntry.requestContextSegment = contextSegment;
4291
4299
  const resumeSegment = openResumeSegment(runId, suspendedSnapshot, callbackOptions.requestContext);
4292
4300
  existingEntry.resumeAgentSpan = resumeSegment?.agentSpan;
4293
4301
  existingEntry.resumeModelSpan = resumeSegment?.modelSpan;
@@ -4430,7 +4438,10 @@ function createInngestAgent(options) {
4430
4438
  inputData: resumeData,
4431
4439
  runId,
4432
4440
  resourceId: resumeOptions?.resourceId,
4433
- requestContext: withSegmentDeadline(requestContext, segmentDeadline),
4441
+ requestContext: withSegmentDeadline({
4442
+ ...requestContext,
4443
+ [DURABLE_CONTEXT_SEGMENT_KEY]: contextSegment
4444
+ }, segmentDeadline),
4434
4445
  tracingOptions,
4435
4446
  actor: resumeOptions?.actor,
4436
4447
  resume: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/inngest",
3
- "version": "1.11.6-alpha.0",
3
+ "version": "1.11.6-alpha.1",
4
4
  "description": "Mastra Inngest integration",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -66,11 +66,11 @@
66
66
  "@internal/lint": "0.0.152",
67
67
  "@internal/types-builder": "0.0.127",
68
68
  "@internal/workflow-test-utils": "0.0.31",
69
- "@mastra/core": "1.87.0-alpha.0",
70
- "@mastra/deployer": "1.87.0-alpha.0",
69
+ "@mastra/core": "1.87.0-alpha.1",
70
+ "@mastra/deployer": "1.87.0-alpha.1",
71
71
  "@mastra/libsql": "1.33.0-alpha.0",
72
- "@mastra/observability": "1.24.4-alpha.0",
73
72
  "@mastra/memory": "1.41.3",
73
+ "@mastra/observability": "1.24.4-alpha.0",
74
74
  "@mastra/pg": "1.39.0-alpha.0"
75
75
  },
76
76
  "peerDependencies": {