@mastra/inngest 1.7.0 → 1.8.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.
- package/CHANGELOG.md +52 -0
- package/dist/{chunk-NNGHERTQ.js → chunk-5BEMBEWN.js} +53 -3
- package/dist/chunk-5BEMBEWN.js.map +1 -0
- package/dist/{chunk-MBGW5JID.cjs → chunk-IJT7VTR7.cjs} +53 -3
- package/dist/chunk-IJT7VTR7.cjs.map +1 -0
- package/dist/connect.cjs +2 -2
- package/dist/connect.js +1 -1
- package/dist/durable-agent/create-inngest-agent.d.ts +126 -17
- package/dist/durable-agent/create-inngest-agent.d.ts.map +1 -1
- package/dist/index.cjs +253 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +242 -23
- package/dist/index.js.map +1 -1
- package/dist/workflow.d.ts +26 -0
- package/dist/workflow.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-MBGW5JID.cjs.map +0 -1
- package/dist/chunk-NNGHERTQ.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-inngest-agent.d.ts","sourceRoot":"","sources":["../../src/durable-agent/create-inngest-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-inngest-agent.d.ts","sourceRoot":"","sources":["../../src/durable-agent/create-inngest-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AASvE,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,gBA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AG,SAAS,EAAE,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAAC,OAAO,CAAC,CAutBjH;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY,CAU5D"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIJT7VTR7_cjs = require('./chunk-IJT7VTR7.cjs');
|
|
4
4
|
var agent = require('@mastra/core/agent');
|
|
5
5
|
var error = require('@mastra/core/error');
|
|
6
6
|
var observability = require('@mastra/core/observability');
|
|
@@ -12,13 +12,14 @@ var _constants = require('@mastra/core/workflows/_constants');
|
|
|
12
12
|
var zod = require('zod');
|
|
13
13
|
var hono = require('inngest/hono');
|
|
14
14
|
var durable = require('@mastra/core/agent/durable');
|
|
15
|
+
var cache = require('@mastra/core/cache');
|
|
15
16
|
var events = require('@mastra/core/events');
|
|
16
17
|
|
|
17
18
|
function prepareServeOptions({ mastra, inngest, functions: userFunctions = [], registerOptions }) {
|
|
18
19
|
return {
|
|
19
20
|
...registerOptions,
|
|
20
21
|
client: inngest,
|
|
21
|
-
functions:
|
|
22
|
+
functions: chunkIJT7VTR7_cjs.collectInngestFunctions({ mastra, functions: userFunctions })
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
function createServe(adapter) {
|
|
@@ -297,6 +298,8 @@ function createInngestDurableAgenticWorkflow(options) {
|
|
|
297
298
|
}
|
|
298
299
|
|
|
299
300
|
// src/durable-agent/create-inngest-agent.ts
|
|
301
|
+
var CLOSE_ON_SUSPEND = /* @__PURE__ */ Symbol("mastra.durable.inngest.closeOnSuspend");
|
|
302
|
+
var STREAM_CLEANUP = /* @__PURE__ */ Symbol("mastra.durable.inngest.streamCleanup");
|
|
300
303
|
function createInngestAgent(options) {
|
|
301
304
|
const {
|
|
302
305
|
agent,
|
|
@@ -304,7 +307,7 @@ function createInngestAgent(options) {
|
|
|
304
307
|
id: idOverride,
|
|
305
308
|
name: nameOverride,
|
|
306
309
|
pubsub: customPubsub,
|
|
307
|
-
cache,
|
|
310
|
+
cache: cache$1,
|
|
308
311
|
mastra: mastraOption
|
|
309
312
|
} = options;
|
|
310
313
|
const agentId = idOverride ?? agent.id;
|
|
@@ -313,21 +316,30 @@ function createInngestAgent(options) {
|
|
|
313
316
|
const activeStreamUntilIdle = /* @__PURE__ */ new Map();
|
|
314
317
|
let proxyRef;
|
|
315
318
|
const workflow = createInngestDurableAgenticWorkflow({ inngest });
|
|
316
|
-
let _customCache = cache;
|
|
317
|
-
let innerPubsub = customPubsub ?? new
|
|
319
|
+
let _customCache = cache$1;
|
|
320
|
+
let innerPubsub = customPubsub ?? new chunkIJT7VTR7_cjs.InngestPubSub(inngest, InngestDurableStepIds.AGENTIC_LOOP);
|
|
318
321
|
let _cachingPubsub = null;
|
|
322
|
+
function resolveCache() {
|
|
323
|
+
const resolved = _customCache ?? mastra?.serverCache ?? new cache.InMemoryServerCache();
|
|
324
|
+
_customCache = resolved;
|
|
325
|
+
return resolved;
|
|
326
|
+
}
|
|
319
327
|
function getPubsub() {
|
|
320
328
|
if (!_cachingPubsub) {
|
|
321
|
-
|
|
322
|
-
if (resolvedCache) {
|
|
323
|
-
_customCache = resolvedCache;
|
|
324
|
-
_cachingPubsub = new events.CachingPubSub(innerPubsub, resolvedCache);
|
|
325
|
-
} else {
|
|
329
|
+
if (innerPubsub instanceof events.CachingPubSub) {
|
|
326
330
|
_cachingPubsub = innerPubsub;
|
|
331
|
+
_customCache = _customCache ?? mastra?.serverCache;
|
|
332
|
+
} else {
|
|
333
|
+
_cachingPubsub = new events.CachingPubSub(innerPubsub, resolveCache());
|
|
327
334
|
}
|
|
328
335
|
}
|
|
329
336
|
return _cachingPubsub;
|
|
330
337
|
}
|
|
338
|
+
workflow.__setPubsubFactory((defaultPubsub) => {
|
|
339
|
+
if (defaultPubsub instanceof events.CachingPubSub) return defaultPubsub;
|
|
340
|
+
getPubsub();
|
|
341
|
+
return new events.CachingPubSub(defaultPubsub, resolveCache());
|
|
342
|
+
});
|
|
331
343
|
function getCache() {
|
|
332
344
|
getPubsub();
|
|
333
345
|
return _customCache;
|
|
@@ -381,11 +393,28 @@ function createInngestAgent(options) {
|
|
|
381
393
|
messages,
|
|
382
394
|
options: streamOptions,
|
|
383
395
|
runId: streamOptions?.runId,
|
|
384
|
-
requestContext: streamOptions?.requestContext
|
|
396
|
+
requestContext: streamOptions?.requestContext,
|
|
397
|
+
methodType: streamOptions?.__methodType ?? "stream"
|
|
385
398
|
});
|
|
386
|
-
const { runId, messageId, workflowInput, threadId, resourceId } = preparation;
|
|
399
|
+
const { runId, messageId, workflowInput, registryEntry, threadId, resourceId } = preparation;
|
|
387
400
|
workflowInput.agentId = agentId;
|
|
388
401
|
workflowInput.agentName = agentName;
|
|
402
|
+
const abortController = new AbortController();
|
|
403
|
+
if (streamOptions?.abortSignal) {
|
|
404
|
+
const external = streamOptions.abortSignal;
|
|
405
|
+
if (external.aborted) {
|
|
406
|
+
abortController.abort(external.reason);
|
|
407
|
+
} else {
|
|
408
|
+
external.addEventListener(
|
|
409
|
+
"abort",
|
|
410
|
+
() => abortController.abort(external.reason),
|
|
411
|
+
{ once: true }
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
registryEntry.abortController = abortController;
|
|
416
|
+
registryEntry.abortSignal = abortController.signal;
|
|
417
|
+
durable.globalRunRegistry.set(runId, registryEntry);
|
|
389
418
|
const observability$1 = mastra?.observability?.getSelectedInstance({
|
|
390
419
|
requestContext: streamOptions?.requestContext
|
|
391
420
|
});
|
|
@@ -412,7 +441,7 @@ function createInngestAgent(options) {
|
|
|
412
441
|
provider: workflowInput.modelConfig.provider,
|
|
413
442
|
streaming: true,
|
|
414
443
|
parameters: {
|
|
415
|
-
temperature: workflowInput.options?.temperature
|
|
444
|
+
temperature: workflowInput.options?.modelSettings?.temperature
|
|
416
445
|
}
|
|
417
446
|
}
|
|
418
447
|
});
|
|
@@ -420,6 +449,12 @@ function createInngestAgent(options) {
|
|
|
420
449
|
workflowInput.agentSpanData = agentSpanData;
|
|
421
450
|
workflowInput.modelSpanData = modelSpanData;
|
|
422
451
|
workflowInput.stepIndex = 0;
|
|
452
|
+
let cleanedUp = false;
|
|
453
|
+
const finalizeGlobalRegistry = () => {
|
|
454
|
+
if (cleanedUp) return;
|
|
455
|
+
cleanedUp = true;
|
|
456
|
+
durable.globalRunRegistry.delete(runId);
|
|
457
|
+
};
|
|
423
458
|
const {
|
|
424
459
|
output,
|
|
425
460
|
cleanup: streamCleanup,
|
|
@@ -437,28 +472,114 @@ function createInngestAgent(options) {
|
|
|
437
472
|
resourceId,
|
|
438
473
|
onChunk: streamOptions?.onChunk,
|
|
439
474
|
onStepFinish: streamOptions?.onStepFinish,
|
|
440
|
-
onFinish:
|
|
441
|
-
|
|
442
|
-
|
|
475
|
+
onFinish: async (result3) => {
|
|
476
|
+
try {
|
|
477
|
+
await streamOptions?.onFinish?.(result3);
|
|
478
|
+
} finally {
|
|
479
|
+
finalizeGlobalRegistry();
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
onError: async (error) => {
|
|
483
|
+
try {
|
|
484
|
+
await streamOptions?.onError?.(error);
|
|
485
|
+
} finally {
|
|
486
|
+
finalizeGlobalRegistry();
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
onSuspended: streamOptions?.onSuspended,
|
|
490
|
+
onAbort: async (data) => {
|
|
491
|
+
try {
|
|
492
|
+
await streamOptions?.onAbort?.(data);
|
|
493
|
+
} finally {
|
|
494
|
+
finalizeGlobalRegistry();
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
onIterationComplete: streamOptions?.onIterationComplete ? async (data) => {
|
|
498
|
+
await streamOptions.onIterationComplete?.(data);
|
|
499
|
+
} : void 0,
|
|
500
|
+
closeOnSuspend: streamOptions?.[CLOSE_ON_SUSPEND] === true
|
|
443
501
|
});
|
|
444
502
|
const tracingOptions = agentSpanData ? { traceId: agentSpanData.traceId, parentSpanId: agentSpanData.id } : void 0;
|
|
445
|
-
ready.then(() => triggerWorkflow(runId, workflowInput, tracingOptions)).catch((error) => {
|
|
503
|
+
const workflowExecution = ready.then(() => triggerWorkflow(runId, workflowInput, tracingOptions)).catch((error) => {
|
|
446
504
|
void emitError(runId, error);
|
|
447
505
|
});
|
|
506
|
+
const trackedEntry = durable.globalRunRegistry.get(runId);
|
|
507
|
+
if (trackedEntry) {
|
|
508
|
+
trackedEntry.workflowExecution = workflowExecution;
|
|
509
|
+
}
|
|
510
|
+
const cleanup = () => {
|
|
511
|
+
streamCleanup();
|
|
512
|
+
finalizeGlobalRegistry();
|
|
513
|
+
};
|
|
514
|
+
const abort = (reason) => {
|
|
515
|
+
if (!abortController.signal.aborted) {
|
|
516
|
+
abortController.abort(reason);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
448
519
|
const result2 = {
|
|
449
520
|
output,
|
|
450
521
|
runId,
|
|
451
522
|
threadId,
|
|
452
523
|
resourceId,
|
|
453
|
-
cleanup
|
|
524
|
+
cleanup,
|
|
525
|
+
abort,
|
|
454
526
|
// Also expose fullStream directly for server compatibility
|
|
455
527
|
get fullStream() {
|
|
456
528
|
return output.fullStream;
|
|
457
|
-
}
|
|
529
|
+
},
|
|
530
|
+
// Internal: stream-only cleanup for generate()/resumeGenerate() to
|
|
531
|
+
// release the subscription on suspend without dropping the registry.
|
|
532
|
+
[STREAM_CLEANUP]: streamCleanup
|
|
458
533
|
};
|
|
459
534
|
return result2;
|
|
460
535
|
},
|
|
461
536
|
async resume(runId, resumeData, resumeOptions) {
|
|
537
|
+
if (resumeOptions?.untilIdle) {
|
|
538
|
+
const { untilIdle, ...rest } = resumeOptions;
|
|
539
|
+
const maxIdleMs = typeof untilIdle === "object" ? untilIdle.maxIdleMs : void 0;
|
|
540
|
+
return durable.runResumeDurableStreamUntilIdle(
|
|
541
|
+
proxyRef,
|
|
542
|
+
runId,
|
|
543
|
+
resumeData,
|
|
544
|
+
{ ...rest, maxIdleMs },
|
|
545
|
+
{
|
|
546
|
+
activeStreams: activeStreamUntilIdle,
|
|
547
|
+
bgManager: mastra?.backgroundTaskManager
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
const abortController = new AbortController();
|
|
552
|
+
if (resumeOptions?.abortSignal) {
|
|
553
|
+
const external = resumeOptions.abortSignal;
|
|
554
|
+
if (external.aborted) {
|
|
555
|
+
abortController.abort(external.reason);
|
|
556
|
+
} else {
|
|
557
|
+
external.addEventListener(
|
|
558
|
+
"abort",
|
|
559
|
+
() => abortController.abort(external.reason),
|
|
560
|
+
{ once: true }
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
let existingEntry = durable.globalRunRegistry.get(runId);
|
|
565
|
+
if (!existingEntry) {
|
|
566
|
+
existingEntry = {
|
|
567
|
+
// Minimal placeholder fields. The durable LLM step recreates tools
|
|
568
|
+
// and model from the workflow input; this slot exists primarily to
|
|
569
|
+
// carry the abort controller across the resumed segment.
|
|
570
|
+
tools: {},
|
|
571
|
+
model: void 0
|
|
572
|
+
};
|
|
573
|
+
durable.globalRunRegistry.set(runId, existingEntry);
|
|
574
|
+
}
|
|
575
|
+
existingEntry.abortController = abortController;
|
|
576
|
+
existingEntry.abortSignal = abortController.signal;
|
|
577
|
+
let resumeCleanedUp = false;
|
|
578
|
+
const finalizeResumeRegistry = () => {
|
|
579
|
+
if (resumeCleanedUp) return;
|
|
580
|
+
resumeCleanedUp = true;
|
|
581
|
+
durable.globalRunRegistry.delete(runId);
|
|
582
|
+
};
|
|
462
583
|
const {
|
|
463
584
|
output,
|
|
464
585
|
cleanup: streamCleanup,
|
|
@@ -476,12 +597,32 @@ function createInngestAgent(options) {
|
|
|
476
597
|
resourceId: resumeOptions?.resourceId,
|
|
477
598
|
onChunk: resumeOptions?.onChunk,
|
|
478
599
|
onStepFinish: resumeOptions?.onStepFinish,
|
|
479
|
-
onFinish:
|
|
480
|
-
|
|
481
|
-
|
|
600
|
+
onFinish: async (result2) => {
|
|
601
|
+
try {
|
|
602
|
+
await resumeOptions?.onFinish?.(result2);
|
|
603
|
+
} finally {
|
|
604
|
+
finalizeResumeRegistry();
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
onError: async (error) => {
|
|
608
|
+
try {
|
|
609
|
+
await resumeOptions?.onError?.(error);
|
|
610
|
+
} finally {
|
|
611
|
+
finalizeResumeRegistry();
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
onSuspended: resumeOptions?.onSuspended,
|
|
615
|
+
onAbort: async (data) => {
|
|
616
|
+
try {
|
|
617
|
+
await resumeOptions?.onAbort?.(data);
|
|
618
|
+
} finally {
|
|
619
|
+
finalizeResumeRegistry();
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
closeOnSuspend: resumeOptions?.[CLOSE_ON_SUSPEND] === true
|
|
482
623
|
});
|
|
483
624
|
const eventName = `workflow.${InngestDurableStepIds.AGENTIC_LOOP}`;
|
|
484
|
-
ready.then(async () => {
|
|
625
|
+
const workflowExecution = ready.then(async () => {
|
|
485
626
|
const workflowsStore = await mastra?.getStorage()?.getStore("workflows");
|
|
486
627
|
const snapshot = await workflowsStore?.loadWorkflowSnapshot({
|
|
487
628
|
workflowName: InngestDurableStepIds.AGENTIC_LOOP,
|
|
@@ -509,6 +650,16 @@ function createInngestAgent(options) {
|
|
|
509
650
|
}).catch((error) => {
|
|
510
651
|
void emitError(runId, error);
|
|
511
652
|
});
|
|
653
|
+
existingEntry.workflowExecution = workflowExecution;
|
|
654
|
+
const abort = (reason) => {
|
|
655
|
+
if (!abortController.signal.aborted) {
|
|
656
|
+
abortController.abort(reason);
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
const cleanup = () => {
|
|
660
|
+
streamCleanup();
|
|
661
|
+
finalizeResumeRegistry();
|
|
662
|
+
};
|
|
512
663
|
return {
|
|
513
664
|
output,
|
|
514
665
|
get fullStream() {
|
|
@@ -517,7 +668,11 @@ function createInngestAgent(options) {
|
|
|
517
668
|
runId,
|
|
518
669
|
threadId: resumeOptions?.threadId,
|
|
519
670
|
resourceId: resumeOptions?.resourceId,
|
|
520
|
-
cleanup
|
|
671
|
+
cleanup,
|
|
672
|
+
abort,
|
|
673
|
+
// Internal: stream-only cleanup for resumeGenerate() to release the
|
|
674
|
+
// subscription on suspend without dropping the resumed registry entry.
|
|
675
|
+
[STREAM_CLEANUP]: streamCleanup
|
|
521
676
|
};
|
|
522
677
|
},
|
|
523
678
|
async prepare(messages, prepareOptions) {
|
|
@@ -559,15 +714,79 @@ function createInngestAgent(options) {
|
|
|
559
714
|
onSuspended: observeOptions?.onSuspended
|
|
560
715
|
});
|
|
561
716
|
await ready;
|
|
717
|
+
const abort = (_reason) => {
|
|
718
|
+
streamCleanup();
|
|
719
|
+
};
|
|
562
720
|
return {
|
|
563
721
|
output,
|
|
564
722
|
get fullStream() {
|
|
565
723
|
return output.fullStream;
|
|
566
724
|
},
|
|
567
725
|
runId,
|
|
568
|
-
cleanup: streamCleanup
|
|
726
|
+
cleanup: streamCleanup,
|
|
727
|
+
abort
|
|
569
728
|
};
|
|
570
729
|
},
|
|
730
|
+
async generate(messages, generateOptions) {
|
|
731
|
+
const { untilIdle, ...rest } = generateOptions ?? {};
|
|
732
|
+
const streamOpts = {
|
|
733
|
+
...rest,
|
|
734
|
+
[CLOSE_ON_SUSPEND]: true,
|
|
735
|
+
__methodType: "generate"
|
|
736
|
+
};
|
|
737
|
+
const result2 = await proxyRef.stream(messages, streamOpts);
|
|
738
|
+
let suspended = false;
|
|
739
|
+
try {
|
|
740
|
+
const fullOutput = await result2.output.getFullOutput();
|
|
741
|
+
if (fullOutput.error) {
|
|
742
|
+
throw fullOutput.error;
|
|
743
|
+
}
|
|
744
|
+
suspended = fullOutput.finishReason === "suspended";
|
|
745
|
+
if (suspended) {
|
|
746
|
+
await durable.globalRunRegistry.get(result2.runId)?.workflowExecution;
|
|
747
|
+
}
|
|
748
|
+
if (!fullOutput.runId) {
|
|
749
|
+
fullOutput.runId = result2.runId;
|
|
750
|
+
}
|
|
751
|
+
return fullOutput;
|
|
752
|
+
} finally {
|
|
753
|
+
if (suspended) {
|
|
754
|
+
const streamOnlyCleanup = result2[STREAM_CLEANUP];
|
|
755
|
+
streamOnlyCleanup?.();
|
|
756
|
+
} else {
|
|
757
|
+
result2.cleanup();
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
},
|
|
761
|
+
async resumeGenerate(runId, resumeData, resumeOptions) {
|
|
762
|
+
const { untilIdle, ...rest } = resumeOptions ?? {};
|
|
763
|
+
const result2 = await proxyRef.resume(runId, resumeData, {
|
|
764
|
+
...rest,
|
|
765
|
+
[CLOSE_ON_SUSPEND]: true
|
|
766
|
+
});
|
|
767
|
+
let suspended = false;
|
|
768
|
+
try {
|
|
769
|
+
const fullOutput = await result2.output.getFullOutput();
|
|
770
|
+
if (fullOutput.error) {
|
|
771
|
+
throw fullOutput.error;
|
|
772
|
+
}
|
|
773
|
+
suspended = fullOutput.finishReason === "suspended";
|
|
774
|
+
if (suspended) {
|
|
775
|
+
await durable.globalRunRegistry.get(result2.runId)?.workflowExecution;
|
|
776
|
+
}
|
|
777
|
+
if (!fullOutput.runId) {
|
|
778
|
+
fullOutput.runId = result2.runId;
|
|
779
|
+
}
|
|
780
|
+
return fullOutput;
|
|
781
|
+
} finally {
|
|
782
|
+
if (suspended) {
|
|
783
|
+
const streamOnlyCleanup = result2[STREAM_CLEANUP];
|
|
784
|
+
streamOnlyCleanup?.();
|
|
785
|
+
} else {
|
|
786
|
+
result2.cleanup();
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
},
|
|
571
790
|
getDurableWorkflows() {
|
|
572
791
|
return [workflow];
|
|
573
792
|
},
|
|
@@ -600,7 +819,7 @@ function isInngestAgent(obj) {
|
|
|
600
819
|
|
|
601
820
|
// src/index.ts
|
|
602
821
|
function isInngestWorkflow(input) {
|
|
603
|
-
return input instanceof
|
|
822
|
+
return input instanceof chunkIJT7VTR7_cjs.InngestWorkflow;
|
|
604
823
|
}
|
|
605
824
|
function isAgentCompatible(input) {
|
|
606
825
|
return typeof input === "object" && input !== null && "generate" in input && typeof input.generate === "function" && "stream" in input && typeof input.stream === "function" && "getDescription" in input && typeof input.getDescription === "function" && "getModel" in input && typeof input.getModel === "function";
|
|
@@ -609,10 +828,10 @@ function isToolStep(input) {
|
|
|
609
828
|
return input instanceof tools.Tool;
|
|
610
829
|
}
|
|
611
830
|
function isStepParams(input) {
|
|
612
|
-
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof agent.Agent) && !(input instanceof tools.Tool) && !(input instanceof
|
|
831
|
+
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof agent.Agent) && !(input instanceof tools.Tool) && !(input instanceof chunkIJT7VTR7_cjs.InngestWorkflow);
|
|
613
832
|
}
|
|
614
833
|
function isProcessor(obj) {
|
|
615
|
-
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof agent.Agent) && !(obj instanceof tools.Tool) && !(obj instanceof
|
|
834
|
+
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof agent.Agent) && !(obj instanceof tools.Tool) && !(obj instanceof chunkIJT7VTR7_cjs.InngestWorkflow) && (typeof obj.processInput === "function" || typeof obj.processInputStep === "function" || typeof obj.processOutputStream === "function" || typeof obj.processOutputResult === "function" || typeof obj.processOutputStep === "function");
|
|
616
835
|
}
|
|
617
836
|
function createStep(params, agentOrToolOptions) {
|
|
618
837
|
if (isInngestWorkflow(params)) {
|
|
@@ -1287,7 +1506,7 @@ function init(inngest) {
|
|
|
1287
1506
|
return {
|
|
1288
1507
|
createTool: tools.createTool,
|
|
1289
1508
|
createWorkflow(params) {
|
|
1290
|
-
return new
|
|
1509
|
+
return new chunkIJT7VTR7_cjs.InngestWorkflow(
|
|
1291
1510
|
params,
|
|
1292
1511
|
inngest
|
|
1293
1512
|
);
|
|
@@ -1327,23 +1546,23 @@ function init(inngest) {
|
|
|
1327
1546
|
|
|
1328
1547
|
Object.defineProperty(exports, "InngestExecutionEngine", {
|
|
1329
1548
|
enumerable: true,
|
|
1330
|
-
get: function () { return
|
|
1549
|
+
get: function () { return chunkIJT7VTR7_cjs.InngestExecutionEngine; }
|
|
1331
1550
|
});
|
|
1332
1551
|
Object.defineProperty(exports, "InngestPubSub", {
|
|
1333
1552
|
enumerable: true,
|
|
1334
|
-
get: function () { return
|
|
1553
|
+
get: function () { return chunkIJT7VTR7_cjs.InngestPubSub; }
|
|
1335
1554
|
});
|
|
1336
1555
|
Object.defineProperty(exports, "InngestRun", {
|
|
1337
1556
|
enumerable: true,
|
|
1338
|
-
get: function () { return
|
|
1557
|
+
get: function () { return chunkIJT7VTR7_cjs.InngestRun; }
|
|
1339
1558
|
});
|
|
1340
1559
|
Object.defineProperty(exports, "InngestWorkflow", {
|
|
1341
1560
|
enumerable: true,
|
|
1342
|
-
get: function () { return
|
|
1561
|
+
get: function () { return chunkIJT7VTR7_cjs.InngestWorkflow; }
|
|
1343
1562
|
});
|
|
1344
1563
|
Object.defineProperty(exports, "connect", {
|
|
1345
1564
|
enumerable: true,
|
|
1346
|
-
get: function () { return
|
|
1565
|
+
get: function () { return chunkIJT7VTR7_cjs.connect; }
|
|
1347
1566
|
});
|
|
1348
1567
|
exports._compatibilityCheck = _compatibilityCheck;
|
|
1349
1568
|
exports.createInngestAgent = createInngestAgent;
|