@mastra/inngest 1.11.2-alpha.2 → 1.11.2-alpha.4
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 +1 -1
- package/dist/connect.js +1 -1
- package/dist/durable-agent/create-inngest-agent.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-zS6LvTK1.cjs → src-Bp3r5ZX4.cjs} +30 -5
- package/dist/src-Bp3r5ZX4.cjs.map +1 -0
- package/dist/{src-IbSX_hCm.js → src-DPEzH8P3.js} +30 -5
- package/dist/src-DPEzH8P3.js.map +1 -0
- package/package.json +6 -6
- package/dist/src-IbSX_hCm.js.map +0 -1
- package/dist/src-zS6LvTK1.cjs.map +0 -1
|
@@ -2347,6 +2347,29 @@ function expandDurableSteps(steps) {
|
|
|
2347
2347
|
} : step;
|
|
2348
2348
|
});
|
|
2349
2349
|
}
|
|
2350
|
+
function isToolResultPart(part) {
|
|
2351
|
+
return part?.type === "tool-result";
|
|
2352
|
+
}
|
|
2353
|
+
/**
|
|
2354
|
+
* Step records for a user's `stopWhen`. It is an AI SDK stop condition, so each
|
|
2355
|
+
* step's tool results must be the AI SDK tool-result parts from its content, as
|
|
2356
|
+
* the default loop builds them (#28519). The records themselves keep tool-call
|
|
2357
|
+
* payloads in `toolResults`, which compaction reads. Records written before
|
|
2358
|
+
* steps carried content are returned as stored.
|
|
2359
|
+
*/
|
|
2360
|
+
function durableStopConditionSteps(steps) {
|
|
2361
|
+
return expandDurableSteps(steps).map((step) => {
|
|
2362
|
+
const content = step?.content;
|
|
2363
|
+
if (!Array.isArray(content)) return step;
|
|
2364
|
+
const toolResults = content.filter(isToolResultPart);
|
|
2365
|
+
return {
|
|
2366
|
+
...step,
|
|
2367
|
+
toolResults,
|
|
2368
|
+
staticToolResults: toolResults.filter((part) => part.dynamic === false),
|
|
2369
|
+
dynamicToolResults: toolResults.filter((part) => part.dynamic === true)
|
|
2370
|
+
};
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2350
2373
|
function buildDurableStepContent(state) {
|
|
2351
2374
|
const step = state.accumulatedSteps.at(-1);
|
|
2352
2375
|
if (!step) return [];
|
|
@@ -2688,7 +2711,7 @@ function createAgenticLoopWorkflow(options) {
|
|
|
2688
2711
|
const stopped = await step.run(`stop-when-${state.runId}-${state.iterationCount}`, async () => {
|
|
2689
2712
|
const stopWhen = getRunRegistryEntry(state.runId, mastra)?.stopWhen;
|
|
2690
2713
|
if (!stopWhen || state.accumulatedSteps.length === 0) return false;
|
|
2691
|
-
const steps =
|
|
2714
|
+
const steps = durableStopConditionSteps(state.accumulatedSteps);
|
|
2692
2715
|
return (await Promise.all((Array.isArray(stopWhen) ? stopWhen : [stopWhen]).map(async (condition) => {
|
|
2693
2716
|
try {
|
|
2694
2717
|
return await condition({ steps });
|
|
@@ -2734,7 +2757,8 @@ function createAgenticLoopWorkflow(options) {
|
|
|
2734
2757
|
steps: state.accumulatedSteps
|
|
2735
2758
|
}
|
|
2736
2759
|
});
|
|
2737
|
-
|
|
2760
|
+
const textRewritten = !!lastStep && finishResult.outputTextChanged;
|
|
2761
|
+
if (lastStep && finishResult.outputTextChanged) {
|
|
2738
2762
|
lastStep.text = finishResult.outputText;
|
|
2739
2763
|
finalText = finishResult.outputText;
|
|
2740
2764
|
}
|
|
@@ -2830,7 +2854,8 @@ function createAgenticLoopWorkflow(options) {
|
|
|
2830
2854
|
});
|
|
2831
2855
|
if (pubsub) await emitFinishEvent(pubsub, state.runId, {
|
|
2832
2856
|
output: finalOutput.output,
|
|
2833
|
-
stepResult: finalOutput.stepResult
|
|
2857
|
+
stepResult: finalOutput.stepResult,
|
|
2858
|
+
...textRewritten && { textRewritten }
|
|
2834
2859
|
});
|
|
2835
2860
|
return finalOutput;
|
|
2836
2861
|
}, { id: "map-final-output" }).map(async (params) => {
|
|
@@ -3981,7 +4006,7 @@ function createInngestAgent(options) {
|
|
|
3981
4006
|
Object.defineProperty(output, "fullStream", {
|
|
3982
4007
|
configurable: true,
|
|
3983
4008
|
get() {
|
|
3984
|
-
const reader = baseFullStream.call(
|
|
4009
|
+
const reader = baseFullStream.call(this).getReader();
|
|
3985
4010
|
return new ReadableStream({
|
|
3986
4011
|
async pull(controller) {
|
|
3987
4012
|
let result;
|
|
@@ -4989,4 +5014,4 @@ function init(inngest) {
|
|
|
4989
5014
|
}
|
|
4990
5015
|
export { createServe as a, isInngestAgent as c, InngestRun as d, InngestPubSub as f, connect as i, createInngestDurableAgenticWorkflow as l, InngestExecutionEngine as m, init as n, serve$1 as o, OVERSIZED_EVENT_CHUNK_TYPE as p, _compatibilityCheck as r, createInngestAgent as s, createStep as t, InngestWorkflow as u };
|
|
4991
5016
|
|
|
4992
|
-
//# sourceMappingURL=src-
|
|
5017
|
+
//# sourceMappingURL=src-DPEzH8P3.js.map
|