@mastra/inngest 1.4.0-alpha.1 → 1.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,118 @@
1
1
  # @mastra/inngest
2
2
 
3
+ ## 1.4.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - You can now run ACP-compatible coding agents as Mastra tools or lightweight subagents. ACP agents support incremental response streaming and can be used anywhere Mastra accepts a `SubAgent`, including supervisor delegation and workflow steps. ([#16423](https://github.com/mastra-ai/mastra/pull/16423))
8
+
9
+ ```ts
10
+ import { createACPTool, AcpAgent } from '@mastra/acp';
11
+
12
+ export const codingTool = createACPTool({
13
+ id: 'coding-agent',
14
+ command: 'my-acp-agent',
15
+ });
16
+
17
+ export const codingAgent = new AcpAgent({
18
+ id: 'coding-agent',
19
+ command: 'my-acp-agent',
20
+ });
21
+ ```
22
+
23
+ You can also wire an `AcpAgent` into a supervisor or workflow as a `SubAgent`-compatible implementation:
24
+
25
+ ```ts
26
+ import { Agent } from '@mastra/core/agent';
27
+
28
+ export const supervisor = new Agent({
29
+ name: 'supervisor',
30
+ instructions: 'Delegate coding tasks to the ACP agent.',
31
+ model,
32
+ agents: {
33
+ codingAgent,
34
+ },
35
+ });
36
+ ```
37
+
38
+ Workflows and the Inngest workflow adapter now recognize `SubAgent`-compatible implementations when creating agent-backed workflow steps.
39
+
40
+ - Updated dependencies [[`20787de`](https://github.com/mastra-ai/mastra/commit/20787de5965234a1af28fe35f49437c537dbfa0d), [`784ad98`](https://github.com/mastra-ai/mastra/commit/784ad989549de91dc5d33ab8ef36caa6f7dcd34e), [`0d53730`](https://github.com/mastra-ai/mastra/commit/0d53730c1ed87ef80c87caa5701c4170ea8028e6)]:
41
+ - @mastra/core@1.34.0-alpha.0
42
+
43
+ ## 1.4.0
44
+
45
+ ### Minor Changes
46
+
47
+ - Updated `@mastra/inngest` to use Inngest SDK v4. ([#15377](https://github.com/mastra-ai/mastra/pull/15377))
48
+
49
+ **Breaking:** Requires `inngest@^4` and Inngest Dev Server `v1.18.0` or later. The `@inngest/realtime` package is no longer needed — its functionality is now included in `inngest` v4. Remove it from your dependencies and import realtime helpers from `inngest/realtime` instead.
50
+
51
+ ```diff
52
+ // package.json
53
+ "dependencies": {
54
+ - "@inngest/realtime": "^0.x",
55
+ - "inngest": "^3.x"
56
+ + "inngest": "^4.0.0"
57
+ }
58
+ ```
59
+
60
+ ```diff
61
+ - import { realtimeMiddleware } from '@inngest/realtime/middleware';
62
+ - import { subscribe } from '@inngest/realtime';
63
+ + import { subscribe } from 'inngest/realtime';
64
+
65
+ const inngest = new Inngest({
66
+ id: 'mastra',
67
+ - middleware: [realtimeMiddleware()],
68
+ });
69
+ ```
70
+
71
+ In v4, `subscribe()` and `realtime.publish()` are first-class methods on the client; the standalone middleware is no longer required. `InngestPubSub` publishes via `inngest.realtime.publish()` instead of the function-context `publish` argument that no longer exists in v4, restoring realtime workflow events and agent stream events.
72
+
73
+ **Improved:** Workflow result polling now uses snapshot-based polling, resulting in significantly faster retrieval (~83x).
74
+
75
+ ### Patch Changes
76
+
77
+ - Fixed peer dependency ranges so packages that use the Mastra server require a compatible Mastra core version. ([#16208](https://github.com/mastra-ai/mastra/pull/16208))
78
+
79
+ - Updated the `serve` and `createServe` JSDoc adapter examples to register Inngest at `/inngest/api` instead of `/api/inngest`, matching the Inngest deployment guide and in-repo example projects. ([#16186](https://github.com/mastra-ai/mastra/pull/16186))
80
+
81
+ **Why**
82
+
83
+ Mastra reserves the `/api` prefix for built-in routes (agents, workflows, memory). Custom `apiRoutes[].path` values that start with the server's `apiPrefix` (default `/api`) are rejected at startup, so the previous JSDoc snippets threw `Custom API route "/api/inngest" must not start with "/api"` when copy-pasted into a current Mastra project.
84
+
85
+ **Migration**
86
+
87
+ If you registered Inngest with the previous guide or JSDoc example:
88
+
89
+ ```ts
90
+ // Before
91
+ apiRoutes: [
92
+ {
93
+ path: '/api/inngest',
94
+ method: 'ALL',
95
+ createHandler: async ({ mastra }) => serve({ mastra, inngest }),
96
+ },
97
+ ];
98
+
99
+ // After
100
+ apiRoutes: [
101
+ {
102
+ path: '/inngest/api',
103
+ method: 'ALL',
104
+ createHandler: async ({ mastra }) => serve({ mastra, inngest }),
105
+ },
106
+ ];
107
+ ```
108
+
109
+ Update the dev server URL (`npx inngest-cli dev -u http://localhost:4111/inngest/api`) and, in production, set the **URL** field on your Inngest app to match.
110
+
111
+ If you cannot change the path, set `server.apiPrefix` (for example `/_mastra`) to relocate the built-in routes and remember to update `server.auth.protected` and any `MastraClient` `apiPrefix` to match. See the [Inngest deployment guide](https://mastra.ai/guides/deployment/inngest) for the full walkthrough.
112
+
113
+ - Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`7ad5585`](https://github.com/mastra-ai/mastra/commit/7ad55856406f1de398dc713f6a9eaa78b2784bb6), [`ac47842`](https://github.com/mastra-ai/mastra/commit/ac478427aa7a5f5fdaed633a911218689b438c60), [`cc189cc`](https://github.com/mastra-ai/mastra/commit/cc189cc0128eb7af233476b5e421ec6888bffde7), [`d1fdbd0`](https://github.com/mastra-ai/mastra/commit/d1fdbd012add5623cb7e6b7f882b605ab358bbb4), [`210ea7a`](https://github.com/mastra-ai/mastra/commit/210ea7af559791b73a44fc9c12179908aaa3183f), [`7c275a8`](https://github.com/mastra-ai/mastra/commit/7c275a810595e1a6c41ccc39720531ab65734700), [`bae019e`](https://github.com/mastra-ai/mastra/commit/bae019ecb6694da96909f7ec7b9eb3a0a33aa887), [`890b24c`](https://github.com/mastra-ai/mastra/commit/890b24cc7d32ed6aa4dfe253e54dc6bf4099f690), [`f984b4d`](https://github.com/mastra-ai/mastra/commit/f984b4d6c60bf2ae2a9b156f0e8c35a66fe96c91), [`6742347`](https://github.com/mastra-ai/mastra/commit/6742347d71955d7639adc9ddf6ff8282de7ee3ba), [`b59316f`](https://github.com/mastra-ai/mastra/commit/b59316ffa0f7688165b0f9c81ccdf85da461e5b2), [`0f48ebf`](https://github.com/mastra-ai/mastra/commit/0f48ebfc7ac7897b2092a189f45751924cf56d1c), [`37c0dc5`](https://github.com/mastra-ai/mastra/commit/37c0dc5697d343db98628bf867bf71ce6deec6d7), [`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047), [`83218c8`](https://github.com/mastra-ai/mastra/commit/83218c88b37773c9424fbe733b37be556e55e94d), [`ef6b584`](https://github.com/mastra-ai/mastra/commit/ef6b5847ac33c0a7e80af3a86e8801e2933dd3ee), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`7b0ad1f`](https://github.com/mastra-ai/mastra/commit/7b0ad1f5c53dc118c6da12ae82ae2587037dc2b8), [`d91ebe2`](https://github.com/mastra-ai/mastra/commit/d91ebe28ee065d8f2ed6df741c3c07f58d359529), [`62666c3`](https://github.com/mastra-ai/mastra/commit/62666c367eaeac3941ead454b1d38810cc855721), [`33f5061`](https://github.com/mastra-ai/mastra/commit/33f5061cd1c0335020c3faae61ce96de822854fa), [`4af2160`](https://github.com/mastra-ai/mastra/commit/4af2160322f4718cac421930cce85641e9512389), [`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047), [`265ec9f`](https://github.com/mastra-ai/mastra/commit/265ec9f887b5c81255c873a76ff7796f16e4f99b), [`ce01024`](https://github.com/mastra-ai/mastra/commit/ce010242eee9bdfc09e4c26725b9d37998679a8d), [`6ce80bf`](https://github.com/mastra-ai/mastra/commit/6ce80bf4872a891e0bddf8b80561a80584efb14b), [`f984b4d`](https://github.com/mastra-ai/mastra/commit/f984b4d6c60bf2ae2a9b156f0e8c35a66fe96c91), [`136c959`](https://github.com/mastra-ai/mastra/commit/136c9592fb0eeb0cd212f28629d8a29b7557a2fc), [`9268531`](https://github.com/mastra-ai/mastra/commit/9268531e7ec4be98beeba3b3ae8be0a7ea380662), [`13ead79`](https://github.com/mastra-ai/mastra/commit/13ead79149486b88144db7e11e6ff551caef5be1), [`dccd8f1`](https://github.com/mastra-ai/mastra/commit/dccd8f1f8b8f1ad203b77556207e5529567c616d), [`4df7cc7`](https://github.com/mastra-ai/mastra/commit/4df7cc79342fd065fe7fdeef93c094db14b12bcd), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`9260e01`](https://github.com/mastra-ai/mastra/commit/9260e015276fb1b500f7878ee452b47476bf1583), [`2f6c54e`](https://github.com/mastra-ai/mastra/commit/2f6c54e17c041cac1def54baaa6b771647836414), [`aca3121`](https://github.com/mastra-ai/mastra/commit/aca31211233dac25459f140ea4fcfb3a5af64c18), [`e06a159`](https://github.com/mastra-ai/mastra/commit/e06a1598ca07a6c3778aefc2a2d288363c6294ff), [`4dd900d`](https://github.com/mastra-ai/mastra/commit/4dd900d75dfe9be89f8c15188b368a8622aa1e18), [`b560d6f`](https://github.com/mastra-ai/mastra/commit/b560d6f88b9b904b15c10f75c949eb145bc27684), [`99869ec`](https://github.com/mastra-ai/mastra/commit/99869ecb1f2aa6dfcc44fa4e843e5ee0344efa64), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`55f1e2d`](https://github.com/mastra-ai/mastra/commit/55f1e2d65425b95a49ae788053b266f256e38c96), [`4ff5bdf`](https://github.com/mastra-ai/mastra/commit/4ff5bdfe170cba6dfb5260c6af0f4ba668430772), [`9cdf38e`](https://github.com/mastra-ai/mastra/commit/9cdf38e58506e1109c8b38f97cd7770978a4218e), [`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047), [`db34bc6`](https://github.com/mastra-ai/mastra/commit/db34bc6fb36cf125bda0c46be4d3fdc774b70cc4), [`990851e`](https://github.com/mastra-ai/mastra/commit/990851edcb0e30be5c2c18b6532f1a876cc2d335), [`bbcd93c`](https://github.com/mastra-ai/mastra/commit/bbcd93cf7d8aa1007d6d84bfd033b8015c912087), [`8373ff4`](https://github.com/mastra-ai/mastra/commit/8373ff46745d77af79f183c4470f80fa2727a6b2), [`d48a705`](https://github.com/mastra-ai/mastra/commit/d48a705ff3dfbdc7a996e07ecd8293b5effd9a2a), [`308bd07`](https://github.com/mastra-ai/mastra/commit/308bd074f35cef0c75d82fc1eb19382fe04ecf6f), [`6068a6c`](https://github.com/mastra-ai/mastra/commit/6068a6c42950fad3ebfc92346417896ba60803d2), [`36b3bbf`](https://github.com/mastra-ai/mastra/commit/36b3bbf5a8d59f7e23d47e29340e76c681b4929c), [`d86f031`](https://github.com/mastra-ai/mastra/commit/d86f031eb6b0b2570145afafea664e59bf688962), [`b275631`](https://github.com/mastra-ai/mastra/commit/b275631dc10541a482b2e2d4a3e3cfa843bd5fa1), [`00106be`](https://github.com/mastra-ai/mastra/commit/00106bede59b81e5b0e9cd6aad8d3b5dbc336387), [`bd36d8e`](https://github.com/mastra-ai/mastra/commit/bd36d8eb6de8c9a0310352649dbd4b06703c2299), [`11c1528`](https://github.com/mastra-ai/mastra/commit/11c152848c5d0ef227184853b5040f5b41ee7b1e), [`4999667`](https://github.com/mastra-ai/mastra/commit/49996678b68356cad7f088430009690406c50fbd), [`e2a079c`](https://github.com/mastra-ai/mastra/commit/e2a079cc3755b1895f7bd5dc36e9be81b11c7c22), [`8ac9141`](https://github.com/mastra-ai/mastra/commit/8ac9141439caa8fdd674944c4d84f29b3c730296), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`534a456`](https://github.com/mastra-ai/mastra/commit/534a456a25e4df1e5407e7e632f4cb3b1fa14f9d), [`105e454`](https://github.com/mastra-ai/mastra/commit/105e454c95af06a7c741c15969d8f9b0f02463a7), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a), [`36bae07`](https://github.com/mastra-ai/mastra/commit/36bae07c0e70b1b3006f2fd20830e8883dcbd066), [`5688881`](https://github.com/mastra-ai/mastra/commit/5688881669c7ed157f31ac77f6fc5f8d95ceea32)]:
114
+ - @mastra/core@1.33.0
115
+
3
116
  ## 1.4.0-alpha.1
4
117
 
5
118
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2381,8 +2381,8 @@ function isInngestAgent(obj) {
2381
2381
  function isInngestWorkflow(input) {
2382
2382
  return input instanceof InngestWorkflow;
2383
2383
  }
2384
- function isAgent(input) {
2385
- return input instanceof agent.Agent;
2384
+ function isAgentCompatible(input) {
2385
+ 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";
2386
2386
  }
2387
2387
  function isToolStep(input) {
2388
2388
  return input instanceof tools.Tool;
@@ -2397,7 +2397,7 @@ function createStep(params, agentOrToolOptions) {
2397
2397
  if (isInngestWorkflow(params)) {
2398
2398
  return params;
2399
2399
  }
2400
- if (isAgent(params)) {
2400
+ if (isAgentCompatible(params)) {
2401
2401
  return createStepFromAgent(params, agentOrToolOptions);
2402
2402
  }
2403
2403
  if (isToolStep(params)) {
@@ -2431,7 +2431,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
2431
2431
  const outputSchema = options?.structuredOutput?.schema ?? zod.z.object({ text: zod.z.string() });
2432
2432
  const { retries, scorers, metadata, ...agentOptions } = options ?? {};
2433
2433
  return {
2434
- id: params.name,
2434
+ id: params.id,
2435
2435
  description: params.getDescription(),
2436
2436
  inputSchema: schema.toStandardSchema(
2437
2437
  zod.z.object({
@@ -2460,12 +2460,15 @@ function createStepFromAgent(params, agentOrToolOptions) {
2460
2460
  });
2461
2461
  let structuredResult = null;
2462
2462
  const toolData = {
2463
- name: params.name,
2463
+ name: params.name ?? params.id,
2464
2464
  args: inputData
2465
2465
  };
2466
2466
  let stream;
2467
2467
  if ((await params.getModel()).specificationVersion === "v1") {
2468
- const { fullStream } = await params.streamLegacy(inputData.prompt, {
2468
+ if (typeof params.streamLegacy !== "function") {
2469
+ throw new Error(`Agent step ${params.id} returned a v1 model but does not implement streamLegacy`);
2470
+ }
2471
+ const modelOutput = await params.streamLegacy(inputData.prompt, {
2469
2472
  ...agentOptions ?? {},
2470
2473
  requestContext,
2471
2474
  tracingContext,
@@ -2479,7 +2482,10 @@ function createStepFromAgent(params, agentOrToolOptions) {
2479
2482
  },
2480
2483
  abortSignal
2481
2484
  });
2482
- stream = fullStream;
2485
+ if ("text" in modelOutput) {
2486
+ void modelOutput.text.then(streamPromise.resolve, streamPromise.reject);
2487
+ }
2488
+ stream = modelOutput.fullStream;
2483
2489
  } else {
2484
2490
  const { structuredOutput, ...restAgentOptions } = agentOptions ?? {};
2485
2491
  const baseOptions = {
@@ -2501,6 +2507,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
2501
2507
  structuredOutput
2502
2508
  }) : await params.stream(inputData.prompt, baseOptions);
2503
2509
  stream = modelOutput.fullStream;
2510
+ void modelOutput.text.then(streamPromise.resolve, streamPromise.reject);
2504
2511
  }
2505
2512
  if (streamFormat === "legacy") {
2506
2513
  await pubsub.publish(`workflow.events.v2.${runId}`, {
@@ -2537,7 +2544,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
2537
2544
  text: await streamPromise.promise
2538
2545
  };
2539
2546
  },
2540
- component: params.component
2547
+ component: "AGENT"
2541
2548
  };
2542
2549
  }
2543
2550
  function createStepFromTool(params, agentOrToolOptions) {