@mastra/inngest 1.4.0 → 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 +40 -0
- package/dist/index.cjs +15 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
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
|
+
|
|
3
43
|
## 1.4.0
|
|
4
44
|
|
|
5
45
|
### 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
|
|
2385
|
-
return input
|
|
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 (
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
2547
|
+
component: "AGENT"
|
|
2541
2548
|
};
|
|
2542
2549
|
}
|
|
2543
2550
|
function createStepFromTool(params, agentOrToolOptions) {
|