@mastra/inngest 1.7.0 → 1.7.1-alpha.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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { InngestPubSub, InngestWorkflow, collectInngestFunctions } from './chunk-NNGHERTQ.js';
2
- export { InngestExecutionEngine, InngestPubSub, InngestRun, InngestWorkflow, connect } from './chunk-NNGHERTQ.js';
1
+ import { InngestPubSub, InngestWorkflow, collectInngestFunctions } from './chunk-5BEMBEWN.js';
2
+ export { InngestExecutionEngine, InngestPubSub, InngestRun, InngestWorkflow, connect } from './chunk-5BEMBEWN.js';
3
3
  import { MessageList, Agent, TripWire } from '@mastra/core/agent';
4
4
  import { MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';
5
5
  import { InternalSpans, EntityType, SpanType } from '@mastra/core/observability';
@@ -11,6 +11,7 @@ import { PUBSUB_SYMBOL, STREAM_FORMAT_SYMBOL } from '@mastra/core/workflows/_con
11
11
  import { z } from 'zod';
12
12
  import { serve as serve$1 } from 'inngest/hono';
13
13
  import { modelConfigSchema, baseIterationStateSchema, createDurableLLMExecutionStep, createDurableToolCallStep, createDurableLLMMappingStep, createDurableBackgroundTaskCheckStep, DurableStepIds, createBaseIterationStateUpdate, durableAgenticOutputSchema, emitFinishEvent, createDurableAgentStream, prepareForDurableExecution, runDurableStreamUntilIdle, emitErrorEvent, DurableAgentDefaults } from '@mastra/core/agent/durable';
14
+ import { InMemoryServerCache } from '@mastra/core/cache';
14
15
  import { CachingPubSub } from '@mastra/core/events';
15
16
 
16
17
  function prepareServeOptions({ mastra, inngest, functions: userFunctions = [], registerOptions }) {
@@ -315,18 +316,27 @@ function createInngestAgent(options) {
315
316
  let _customCache = cache;
316
317
  let innerPubsub = customPubsub ?? new InngestPubSub(inngest, InngestDurableStepIds.AGENTIC_LOOP);
317
318
  let _cachingPubsub = null;
319
+ function resolveCache() {
320
+ const resolved = _customCache ?? mastra?.serverCache ?? new InMemoryServerCache();
321
+ _customCache = resolved;
322
+ return resolved;
323
+ }
318
324
  function getPubsub() {
319
325
  if (!_cachingPubsub) {
320
- const resolvedCache = _customCache ?? mastra?.serverCache;
321
- if (resolvedCache) {
322
- _customCache = resolvedCache;
323
- _cachingPubsub = new CachingPubSub(innerPubsub, resolvedCache);
324
- } else {
326
+ if (innerPubsub instanceof CachingPubSub) {
325
327
  _cachingPubsub = innerPubsub;
328
+ _customCache = _customCache ?? mastra?.serverCache;
329
+ } else {
330
+ _cachingPubsub = new CachingPubSub(innerPubsub, resolveCache());
326
331
  }
327
332
  }
328
333
  return _cachingPubsub;
329
334
  }
335
+ workflow.__setPubsubFactory((defaultPubsub) => {
336
+ if (defaultPubsub instanceof CachingPubSub) return defaultPubsub;
337
+ getPubsub();
338
+ return new CachingPubSub(defaultPubsub, resolveCache());
339
+ });
330
340
  function getCache() {
331
341
  getPubsub();
332
342
  return _customCache;
@@ -411,7 +421,7 @@ function createInngestAgent(options) {
411
421
  provider: workflowInput.modelConfig.provider,
412
422
  streaming: true,
413
423
  parameters: {
414
- temperature: workflowInput.options?.temperature
424
+ temperature: workflowInput.options?.modelSettings?.temperature
415
425
  }
416
426
  }
417
427
  });