@mastra/inngest 1.8.0-alpha.1 → 1.8.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/CHANGELOG.md +87 -0
- package/dist/{chunk-5BEMBEWN.js → chunk-6AX2K2MQ.js} +34 -9
- package/dist/chunk-6AX2K2MQ.js.map +1 -0
- package/dist/{chunk-IJT7VTR7.cjs → chunk-YACLO5I5.cjs} +34 -9
- package/dist/chunk-YACLO5I5.cjs.map +1 -0
- package/dist/connect.cjs +2 -2
- package/dist/connect.js +1 -1
- package/dist/execution-engine.d.ts +2 -0
- package/dist/execution-engine.d.ts.map +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.js +2 -2
- package/dist/run.d.ts +17 -4
- package/dist/run.d.ts.map +1 -1
- package/dist/workflow.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-5BEMBEWN.js.map +0 -1
- package/dist/chunk-IJT7VTR7.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added support for the fine-grained authorization (FGA) `actor` signal on the Inngest execution engine. ([#18674](https://github.com/mastra-ai/mastra/pull/18674))
|
|
8
|
+
|
|
9
|
+
Workflows running on the Inngest engine can now pass a trusted `actor` through `run.start()`, `startAsync()`, `resume()`, `stream()`, and `timeTravel()`. The signal is re-threaded across durable step and nested-workflow boundaries, so every nested agent, tool, and memory FGA check sees the same actor. Previously `actor` was only threaded through the default engine, so trusted background workflows on Inngest lost the membership bypass at each step re-entry.
|
|
10
|
+
|
|
11
|
+
**Usage**
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const run = await workflow.createRun();
|
|
15
|
+
await run.start({
|
|
16
|
+
inputData,
|
|
17
|
+
requestContext, // includes organizationId / tenant scope
|
|
18
|
+
actor: { actorKind: 'system', sourceWorkflow: 'nightly-sync' },
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- Bring `InngestAgent` (Inngest-backed durable agent) to parity with `DurableAgent` for per-call execution options, abort handling, idle-aware resume, and `generate()`. ([#18615](https://github.com/mastra-ai/mastra/pull/18615))
|
|
23
|
+
|
|
24
|
+
`InngestAgent.stream()` and `resume()` now accept the same execution-option surface as `DurableAgent`, including `stopWhen`, `activeTools`, `structuredOutput`, `versions`, `system`, `disableBackgroundTasks`, `tracingOptions`, `actor`, `transform`, `prepareStep`, `isTaskComplete`, `delegation`, function-form `requireToolApproval`, and the lifecycle callbacks `onAbort` / `onIterationComplete`. Closure-shaped options (`prepareStep`, `transform`, function-form `isTaskComplete` / `requireToolApproval`, `stopWhen` callbacks) continue to work in-process; they degrade after a worker hop the same way they do for in-memory `DurableAgent`.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
const result = await inngestAgent.stream(messages, {
|
|
28
|
+
runId: 'run-1',
|
|
29
|
+
abortSignal: controller.signal,
|
|
30
|
+
stopWhen: stepCountIs(5),
|
|
31
|
+
onIterationComplete: ({ iteration }) => console.log('done', iteration),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Cancel a live run from the caller
|
|
35
|
+
result.abort();
|
|
36
|
+
|
|
37
|
+
// Resume and drive the run to completion in a single call
|
|
38
|
+
await inngestAgent.resume({ runId: 'run-1', resumeData, untilIdle: true });
|
|
39
|
+
|
|
40
|
+
// Durable equivalents of Agent.generate / resumeGenerate
|
|
41
|
+
const out = await inngestAgent.generate(messages, { runId: 'run-2' });
|
|
42
|
+
const resumed = await inngestAgent.resumeGenerate({ runId: 'run-2', resumeData });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`@mastra/core` re-exports `globalRunRegistry` and `runResumeDurableStreamUntilIdle` from `@mastra/core/agent/durable` so durable-agent integrations can share the same registry and idle-wrapper plumbing.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Fix `observe()` on Inngest durable agents so late subscribers replay buffered events before the live stream. ([#18535](https://github.com/mastra-ai/mastra/pull/18535))
|
|
50
|
+
|
|
51
|
+
Previously, calling `observe()` after a run had started — or reconnecting after a disconnect — only delivered chunks emitted from that moment on. Anything published earlier in the run was lost, including events from nested durable steps. `observe()` now replays the full history of `chunk`, `finish`, and `suspended` events for the requested `runId`, then continues on the live stream, matching the in-memory `DurableAgent` behavior.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
// First connection kicks off the run
|
|
55
|
+
await inngestAgent.stream(messages, { runId: 'run-1' });
|
|
56
|
+
|
|
57
|
+
// Second connection replays earlier events, then continues live
|
|
58
|
+
const { fullStream } = await inngestAgent.observe('run-1');
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
When no cache is configured, an in-process cache is used as a fallback so single-process replay works out of the box. Cross-process `observe()` still requires a shared cache backend (e.g. Redis) passed via `cache` or `mastra.serverCache`.
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [[`b9a2961`](https://github.com/mastra-ai/mastra/commit/b9a2961c1be81e3639c0879e58588c26dd0ae866), [`b33c77d`](https://github.com/mastra-ai/mastra/commit/b33c77d5293f14a794f3ec38dc947a6676de2764), [`1274eb3`](https://github.com/mastra-ai/mastra/commit/1274eb3a9508f579ceb3187fbce34408222d4b71), [`cdd5f93`](https://github.com/mastra-ai/mastra/commit/cdd5f939cefa67390629704dce92563ccbf492b2), [`1274eb3`](https://github.com/mastra-ai/mastra/commit/1274eb3a9508f579ceb3187fbce34408222d4b71), [`0ac14ce`](https://github.com/mastra-ai/mastra/commit/0ac14cea48e1b0a7857782153c78f7242fdf7e1a), [`9566d27`](https://github.com/mastra-ai/mastra/commit/9566d27ead3d95bdbe5a69e5a082a68222829cf2), [`8be63b0`](https://github.com/mastra-ai/mastra/commit/8be63b015fb8d72cea1220f05e7dc3bb997cc249), [`1009f77`](https://github.com/mastra-ai/mastra/commit/1009f772aa40016b49267c8566d0c29f6a16aa3c), [`1b8728a`](https://github.com/mastra-ai/mastra/commit/1b8728a57fd844205a452b0b4216d20ff60c784a), [`23c31de`](https://github.com/mastra-ai/mastra/commit/23c31de96ed8153402dcf092ac84b27a0c3638c1), [`0368766`](https://github.com/mastra-ai/mastra/commit/0368766744c7ea3df4d6059e2cc15f7bdf55f5a6), [`6f578ac`](https://github.com/mastra-ai/mastra/commit/6f578acba84930b406b2a0700b17cfdfaf5aae56), [`345eecc`](https://github.com/mastra-ai/mastra/commit/345eecce6ba519b5d987f0e10b5de4c8e5734580), [`1917c53`](https://github.com/mastra-ai/mastra/commit/1917c53b19dac43926f29c496893b0686462dca4), [`c01012f`](https://github.com/mastra-ai/mastra/commit/c01012f50368d29eb3fc3764df42d48291973d23), [`705ba98`](https://github.com/mastra-ai/mastra/commit/705ba98726d388a596e896225f237907ca6807a9), [`95857bc`](https://github.com/mastra-ai/mastra/commit/95857bcd6669da7193f503e803f0d72a2bd66be6), [`e62c108`](https://github.com/mastra-ai/mastra/commit/e62c108409dfd6a6cac0a48ec39c5cc81d24fd52), [`2866f04`](https://github.com/mastra-ai/mastra/commit/2866f04953edb78c1637fa45cc53abe24122edcb), [`ee14cae`](https://github.com/mastra-ai/mastra/commit/ee14cae244805783bde518a6142de28b744b169c), [`e84e791`](https://github.com/mastra-ai/mastra/commit/e84e79174031d7bc8793ca6c805eb38b06e7cfb1), [`c2f0b7f`](https://github.com/mastra-ai/mastra/commit/c2f0b7f1370f4428d165f51f0d1d9a48331cc257), [`213feb8`](https://github.com/mastra-ai/mastra/commit/213feb87bfdd1d8ec00ea660e218f9bcfcb34e7b), [`58e287b`](https://github.com/mastra-ai/mastra/commit/58e287b1edaf978b13745a1795989cad3826e82b), [`e420b3c`](https://github.com/mastra-ai/mastra/commit/e420b3c3ffc98bbc5b791897ea390bb47af99696), [`be875ed`](https://github.com/mastra-ai/mastra/commit/be875ed43f856742ce58529f531b5ea0ae6911f3), [`9eefdc0`](https://github.com/mastra-ai/mastra/commit/9eefdc0ac03f989718c6d835334940a977938895), [`bfbbb01`](https://github.com/mastra-ai/mastra/commit/bfbbb01bd845ba54cdc0c678c277d08a7cb847e4), [`7d112ca`](https://github.com/mastra-ai/mastra/commit/7d112ca17078479b2659b88ba1c85b936cfc111c)]:
|
|
64
|
+
- @mastra/core@1.48.0
|
|
65
|
+
|
|
66
|
+
## 1.8.0-alpha.2
|
|
67
|
+
|
|
68
|
+
### Minor Changes
|
|
69
|
+
|
|
70
|
+
- Added support for the fine-grained authorization (FGA) `actor` signal on the Inngest execution engine. ([#18674](https://github.com/mastra-ai/mastra/pull/18674))
|
|
71
|
+
|
|
72
|
+
Workflows running on the Inngest engine can now pass a trusted `actor` through `run.start()`, `startAsync()`, `resume()`, `stream()`, and `timeTravel()`. The signal is re-threaded across durable step and nested-workflow boundaries, so every nested agent, tool, and memory FGA check sees the same actor. Previously `actor` was only threaded through the default engine, so trusted background workflows on Inngest lost the membership bypass at each step re-entry.
|
|
73
|
+
|
|
74
|
+
**Usage**
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
const run = await workflow.createRun();
|
|
78
|
+
await run.start({
|
|
79
|
+
inputData,
|
|
80
|
+
requestContext, // includes organizationId / tenant scope
|
|
81
|
+
actor: { actorKind: 'system', sourceWorkflow: 'nightly-sync' },
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- Updated dependencies [[`8be63b0`](https://github.com/mastra-ai/mastra/commit/8be63b015fb8d72cea1220f05e7dc3bb997cc249), [`345eecc`](https://github.com/mastra-ai/mastra/commit/345eecce6ba519b5d987f0e10b5de4c8e5734580), [`ee14cae`](https://github.com/mastra-ai/mastra/commit/ee14cae244805783bde518a6142de28b744b169c)]:
|
|
88
|
+
- @mastra/core@1.48.0-alpha.7
|
|
89
|
+
|
|
3
90
|
## 1.8.0-alpha.1
|
|
4
91
|
|
|
5
92
|
### Minor Changes
|
|
@@ -270,7 +270,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
270
270
|
pubsub,
|
|
271
271
|
startedAt,
|
|
272
272
|
perStep,
|
|
273
|
-
stepSpan
|
|
273
|
+
stepSpan,
|
|
274
|
+
actor
|
|
274
275
|
} = params;
|
|
275
276
|
const nestedTracingContext = executionContext.tracingIds?.traceId ? {
|
|
276
277
|
traceId: executionContext.tracingIds.traceId,
|
|
@@ -303,7 +304,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
303
304
|
},
|
|
304
305
|
outputOptions: { includeState: true },
|
|
305
306
|
perStep,
|
|
306
|
-
tracingOptions: nestedTracingContext
|
|
307
|
+
tracingOptions: nestedTracingContext,
|
|
308
|
+
actor
|
|
307
309
|
}
|
|
308
310
|
});
|
|
309
311
|
result = invokeResp.result;
|
|
@@ -332,7 +334,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
332
334
|
runId: executionContext.runId,
|
|
333
335
|
outputOptions: { includeState: true },
|
|
334
336
|
perStep,
|
|
335
|
-
tracingOptions: nestedTracingContext
|
|
337
|
+
tracingOptions: nestedTracingContext,
|
|
338
|
+
actor
|
|
336
339
|
}
|
|
337
340
|
});
|
|
338
341
|
result = invokeResp.result;
|
|
@@ -346,7 +349,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
346
349
|
initialState: executionContext.state ?? {},
|
|
347
350
|
outputOptions: { includeState: true },
|
|
348
351
|
perStep,
|
|
349
|
-
tracingOptions: nestedTracingContext
|
|
352
|
+
tracingOptions: nestedTracingContext,
|
|
353
|
+
actor
|
|
350
354
|
}
|
|
351
355
|
});
|
|
352
356
|
result = invokeResp.result;
|
|
@@ -864,6 +868,7 @@ var InngestRun = class extends Run {
|
|
|
864
868
|
outputOptions: args.outputOptions,
|
|
865
869
|
tracingOptions: args.tracingOptions,
|
|
866
870
|
requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},
|
|
871
|
+
actor: args.actor,
|
|
867
872
|
perStep: args.perStep
|
|
868
873
|
}
|
|
869
874
|
});
|
|
@@ -880,6 +885,7 @@ var InngestRun = class extends Run {
|
|
|
880
885
|
tracingOptions,
|
|
881
886
|
format,
|
|
882
887
|
requestContext,
|
|
888
|
+
actor,
|
|
883
889
|
perStep
|
|
884
890
|
}) {
|
|
885
891
|
const workflowsStore = await this.#mastra.getStorage()?.getStore("workflows");
|
|
@@ -915,6 +921,7 @@ var InngestRun = class extends Run {
|
|
|
915
921
|
tracingOptions,
|
|
916
922
|
format,
|
|
917
923
|
requestContext: requestContext ? Object.fromEntries(requestContext.entries()) : {},
|
|
924
|
+
actor,
|
|
918
925
|
perStep
|
|
919
926
|
}
|
|
920
927
|
});
|
|
@@ -1011,6 +1018,13 @@ var InngestRun = class extends Run {
|
|
|
1011
1018
|
resumePath: steps?.[0] ? snapshot?.suspendedPaths?.[steps?.[0]] : void 0
|
|
1012
1019
|
},
|
|
1013
1020
|
requestContext: mergedRequestContext,
|
|
1021
|
+
// `actor` is a per-call trust signal, not rehydrated from the snapshot like
|
|
1022
|
+
// `requestContext` is above. This intentionally matches the default engine,
|
|
1023
|
+
// which passes `actor: params.actor` on resume and never reads it from the
|
|
1024
|
+
// snapshot (see packages/core/src/workflows/workflow.ts `_resume`). The caller
|
|
1025
|
+
// (a trusted background system) re-supplies `actor` on each resume; we never
|
|
1026
|
+
// persist a membership-bypass signal into durable storage.
|
|
1027
|
+
actor: params.actor,
|
|
1014
1028
|
perStep: params.perStep
|
|
1015
1029
|
}
|
|
1016
1030
|
});
|
|
@@ -1167,6 +1181,7 @@ var InngestRun = class extends Run {
|
|
|
1167
1181
|
tracingOptions: params.tracingOptions,
|
|
1168
1182
|
outputOptions: params.outputOptions,
|
|
1169
1183
|
requestContext: params.requestContext ? Object.fromEntries(params.requestContext.entries()) : {},
|
|
1184
|
+
actor: params.actor,
|
|
1170
1185
|
perStep: params.perStep
|
|
1171
1186
|
}
|
|
1172
1187
|
});
|
|
@@ -1220,7 +1235,11 @@ var InngestRun = class extends Run {
|
|
|
1220
1235
|
});
|
|
1221
1236
|
};
|
|
1222
1237
|
}
|
|
1223
|
-
streamLegacy({
|
|
1238
|
+
streamLegacy({
|
|
1239
|
+
inputData,
|
|
1240
|
+
requestContext,
|
|
1241
|
+
actor
|
|
1242
|
+
} = {}) {
|
|
1224
1243
|
const { readable, writable } = new TransformStream();
|
|
1225
1244
|
const writer = writable.getWriter();
|
|
1226
1245
|
void writer.write({
|
|
@@ -1257,7 +1276,7 @@ var InngestRun = class extends Run {
|
|
|
1257
1276
|
writer.releaseLock();
|
|
1258
1277
|
}
|
|
1259
1278
|
};
|
|
1260
|
-
this.executionResults = this._start({ inputData, requestContext, format: "legacy" }).then((result) => {
|
|
1279
|
+
this.executionResults = this._start({ inputData, requestContext, actor, format: "legacy" }).then((result) => {
|
|
1261
1280
|
if (result.status !== "suspended") {
|
|
1262
1281
|
this.closeStreamAction?.().catch(() => {
|
|
1263
1282
|
});
|
|
@@ -1272,6 +1291,7 @@ var InngestRun = class extends Run {
|
|
|
1272
1291
|
stream({
|
|
1273
1292
|
inputData,
|
|
1274
1293
|
requestContext,
|
|
1294
|
+
actor,
|
|
1275
1295
|
tracingOptions,
|
|
1276
1296
|
closeOnSuspend = true,
|
|
1277
1297
|
initialState,
|
|
@@ -1308,6 +1328,7 @@ var InngestRun = class extends Run {
|
|
|
1308
1328
|
const executionResultsPromise = self._start({
|
|
1309
1329
|
inputData,
|
|
1310
1330
|
requestContext,
|
|
1331
|
+
actor,
|
|
1311
1332
|
// tracingContext, // We are not able to pass a reference to a span here, what to do?
|
|
1312
1333
|
initialState,
|
|
1313
1334
|
tracingOptions,
|
|
@@ -1352,6 +1373,7 @@ var InngestRun = class extends Run {
|
|
|
1352
1373
|
context,
|
|
1353
1374
|
nestedStepsContext,
|
|
1354
1375
|
requestContext,
|
|
1376
|
+
actor,
|
|
1355
1377
|
// tracingContext,
|
|
1356
1378
|
tracingOptions,
|
|
1357
1379
|
outputOptions,
|
|
@@ -1389,6 +1411,7 @@ var InngestRun = class extends Run {
|
|
|
1389
1411
|
resumeData,
|
|
1390
1412
|
initialState,
|
|
1391
1413
|
requestContext,
|
|
1414
|
+
actor,
|
|
1392
1415
|
tracingOptions,
|
|
1393
1416
|
outputOptions,
|
|
1394
1417
|
perStep
|
|
@@ -1635,7 +1658,8 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
|
|
|
1635
1658
|
format,
|
|
1636
1659
|
timeTravel,
|
|
1637
1660
|
perStep,
|
|
1638
|
-
tracingOptions
|
|
1661
|
+
tracingOptions,
|
|
1662
|
+
actor
|
|
1639
1663
|
} = event.data;
|
|
1640
1664
|
if (!runId) {
|
|
1641
1665
|
runId = await step.run(`workflow.${this.id}.runIdGen`, async () => {
|
|
@@ -1681,6 +1705,7 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
|
|
|
1681
1705
|
pubsub,
|
|
1682
1706
|
retryConfig: this.retryConfig,
|
|
1683
1707
|
requestContext,
|
|
1708
|
+
actor,
|
|
1684
1709
|
resume,
|
|
1685
1710
|
timeTravel,
|
|
1686
1711
|
perStep,
|
|
@@ -1906,5 +1931,5 @@ async function connect(options) {
|
|
|
1906
1931
|
}
|
|
1907
1932
|
|
|
1908
1933
|
export { InngestExecutionEngine, InngestPubSub, InngestRun, InngestWorkflow, collectInngestFunctions, connect };
|
|
1909
|
-
//# sourceMappingURL=chunk-
|
|
1910
|
-
//# sourceMappingURL=chunk-
|
|
1934
|
+
//# sourceMappingURL=chunk-6AX2K2MQ.js.map
|
|
1935
|
+
//# sourceMappingURL=chunk-6AX2K2MQ.js.map
|