@mastra/inngest 1.11.2-alpha.3 → 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/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-HmoLmUk6.cjs → src-Bp3r5ZX4.cjs} +25 -2
- package/dist/src-Bp3r5ZX4.cjs.map +1 -0
- package/dist/{src-3ujfBhgX.js → src-DPEzH8P3.js} +25 -2
- package/dist/src-DPEzH8P3.js.map +1 -0
- package/package.json +4 -4
- package/dist/src-3ujfBhgX.js.map +0 -1
- package/dist/src-HmoLmUk6.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 });
|
|
@@ -4991,4 +5014,4 @@ function init(inngest) {
|
|
|
4991
5014
|
}
|
|
4992
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 };
|
|
4993
5016
|
|
|
4994
|
-
//# sourceMappingURL=src-
|
|
5017
|
+
//# sourceMappingURL=src-DPEzH8P3.js.map
|