@mastra/agent-builder 0.0.7 → 0.1.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 +24 -0
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/workflows/task-planning/schema.d.ts +4 -4
- package/dist/workflows/task-planning/task-planning.d.ts +8 -8
- package/dist/workflows/workflow-builder/schema.d.ts +12 -12
- package/dist/workflows/workflow-builder/workflow-builder.d.ts +28 -28
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @mastra/agent-builder
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([#8097](https://github.com/mastra-ai/mastra/pull/8097))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`d41aee5`](https://github.com/mastra-ai/mastra/commit/d41aee526d124e35f42720a08e64043229193679), [`e8fe13c`](https://github.com/mastra-ai/mastra/commit/e8fe13c4b4c255a42520127797ec394310f7c919), [`3ca833d`](https://github.com/mastra-ai/mastra/commit/3ca833dc994c38e3c9b4f9b4478a61cd8e07b32a), [`1edb8d1`](https://github.com/mastra-ai/mastra/commit/1edb8d1cfb963e72a12412990fb9170936c9904c), [`fbf6e32`](https://github.com/mastra-ai/mastra/commit/fbf6e324946332d0f5ed8930bf9d4d4479cefd7a), [`4753027`](https://github.com/mastra-ai/mastra/commit/4753027ee889288775c6958bdfeda03ff909af67)]:
|
|
12
|
+
- @mastra/core@0.20.0
|
|
13
|
+
- @mastra/memory@0.15.5
|
|
14
|
+
|
|
15
|
+
## 0.1.0-alpha.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- Breaking change to move the agent.streamVNext/generateVNext implementation to the default stream/generate. The old stream/generate have now been moved to streamLegacy and generateLegacy ([#8097](https://github.com/mastra-ai/mastra/pull/8097))
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`00cb6bd`](https://github.com/mastra-ai/mastra/commit/00cb6bdf78737c0fac14a5a0c7b532a11e38558a), [`869ba22`](https://github.com/mastra-ai/mastra/commit/869ba222e1d6b58fc1b65e7c9fd55ca4e01b8c2f), [`1b73665`](https://github.com/mastra-ai/mastra/commit/1b73665e8e23f5c09d49fcf3e7d709c75259259e), [`f7d7475`](https://github.com/mastra-ai/mastra/commit/f7d747507341aef60ed39e4b49318db1f86034a6), [`084b77b`](https://github.com/mastra-ai/mastra/commit/084b77b2955960e0190af8db3f77138aa83ed65c), [`a93ff84`](https://github.com/mastra-ai/mastra/commit/a93ff84b5e1af07ee236ac8873dac9b49aa5d501), [`bc5aacb`](https://github.com/mastra-ai/mastra/commit/bc5aacb646d468d325327e36117129f28cd13bf6), [`6b5af12`](https://github.com/mastra-ai/mastra/commit/6b5af12ce9e09066e0c32e821c203a6954498bea), [`bf60e4a`](https://github.com/mastra-ai/mastra/commit/bf60e4a89c515afd9570b7b79f33b95e7d07c397), [`d41aee5`](https://github.com/mastra-ai/mastra/commit/d41aee526d124e35f42720a08e64043229193679), [`e8fe13c`](https://github.com/mastra-ai/mastra/commit/e8fe13c4b4c255a42520127797ec394310f7c919), [`3ca833d`](https://github.com/mastra-ai/mastra/commit/3ca833dc994c38e3c9b4f9b4478a61cd8e07b32a), [`1edb8d1`](https://github.com/mastra-ai/mastra/commit/1edb8d1cfb963e72a12412990fb9170936c9904c), [`fbf6e32`](https://github.com/mastra-ai/mastra/commit/fbf6e324946332d0f5ed8930bf9d4d4479cefd7a), [`4753027`](https://github.com/mastra-ai/mastra/commit/4753027ee889288775c6958bdfeda03ff909af67)]:
|
|
24
|
+
- @mastra/core@0.20.0-alpha.0
|
|
25
|
+
- @mastra/memory@0.15.5-alpha.0
|
|
26
|
+
|
|
3
27
|
## 0.0.7
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -13,17 +13,17 @@ export declare class AgentBuilder extends Agent {
|
|
|
13
13
|
* Enhanced generate method with AgentBuilder-specific configuration
|
|
14
14
|
* Overrides the base Agent generate method to provide additional project context
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
generateLegacy: Agent['generateLegacy'];
|
|
17
17
|
/**
|
|
18
18
|
* Enhanced stream method with AgentBuilder-specific configuration
|
|
19
19
|
* Overrides the base Agent stream method to provide additional project context
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
streamLegacy: Agent['streamLegacy'];
|
|
22
22
|
/**
|
|
23
23
|
* Enhanced stream method with AgentBuilder-specific configuration
|
|
24
24
|
* Overrides the base Agent stream method to provide additional project context
|
|
25
25
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
stream<OUTPUT extends OutputSchema = undefined, FORMAT extends 'mastra' | 'aisdk' | undefined = undefined>(messages: MessageListInput, streamOptions?: AgentExecutionOptions<OUTPUT, FORMAT>): Promise<FORMAT extends 'aisdk' ? AISDKV5OutputStream<OUTPUT> : MastraModelOutput<OUTPUT>>;
|
|
27
|
+
generate<OUTPUT extends OutputSchema = undefined, FORMAT extends 'aisdk' | 'mastra' = 'mastra'>(messages: MessageListInput, options?: AgentExecutionOptions<OUTPUT, FORMAT>): Promise<FORMAT extends 'aisdk' ? Awaited<ReturnType<AISDKV5OutputStream<OUTPUT>['getFullOutput']>> : Awaited<ReturnType<MastraModelOutput<OUTPUT>['getFullOutput']>>>;
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAIV,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKhG,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,UAAU,CAAC;AA+BzE,qBAAa,YAAa,SAAQ,KAAK;IACrC,OAAO,CAAC,aAAa,CAAqB;IAE1C;;OAEG;gBACS,MAAM,EAAE,kBAAkB;IAgCtC;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAIV,q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CHANGED
|
@@ -3234,7 +3234,7 @@ ${config.instructions}` : "";
|
|
|
3234
3234
|
* Enhanced generate method with AgentBuilder-specific configuration
|
|
3235
3235
|
* Overrides the base Agent generate method to provide additional project context
|
|
3236
3236
|
*/
|
|
3237
|
-
|
|
3237
|
+
generateLegacy = async (messages, generateOptions = {}) => {
|
|
3238
3238
|
const { maxSteps, ...baseOptions } = generateOptions;
|
|
3239
3239
|
const originalInstructions = await this.getInstructions({ runtimeContext: generateOptions?.runtimeContext });
|
|
3240
3240
|
const additionalInstructions = baseOptions.instructions;
|
|
@@ -3257,13 +3257,13 @@ ${additionalInstructions}`;
|
|
|
3257
3257
|
this.logger.debug(`[AgentBuilder:${this.name}] Starting generation with enhanced context`, {
|
|
3258
3258
|
projectPath: this.builderConfig.projectPath
|
|
3259
3259
|
});
|
|
3260
|
-
return super.
|
|
3260
|
+
return super.generateLegacy(messages, enhancedOptions);
|
|
3261
3261
|
};
|
|
3262
3262
|
/**
|
|
3263
3263
|
* Enhanced stream method with AgentBuilder-specific configuration
|
|
3264
3264
|
* Overrides the base Agent stream method to provide additional project context
|
|
3265
3265
|
*/
|
|
3266
|
-
|
|
3266
|
+
streamLegacy = async (messages, streamOptions = {}) => {
|
|
3267
3267
|
const { maxSteps, ...baseOptions } = streamOptions;
|
|
3268
3268
|
const originalInstructions = await this.getInstructions({ runtimeContext: streamOptions?.runtimeContext });
|
|
3269
3269
|
const additionalInstructions = baseOptions.instructions;
|
|
@@ -3286,13 +3286,13 @@ ${additionalInstructions}`;
|
|
|
3286
3286
|
this.logger.debug(`[AgentBuilder:${this.name}] Starting streaming with enhanced context`, {
|
|
3287
3287
|
projectPath: this.builderConfig.projectPath
|
|
3288
3288
|
});
|
|
3289
|
-
return super.
|
|
3289
|
+
return super.streamLegacy(messages, enhancedOptions);
|
|
3290
3290
|
};
|
|
3291
3291
|
/**
|
|
3292
3292
|
* Enhanced stream method with AgentBuilder-specific configuration
|
|
3293
3293
|
* Overrides the base Agent stream method to provide additional project context
|
|
3294
3294
|
*/
|
|
3295
|
-
async
|
|
3295
|
+
async stream(messages, streamOptions) {
|
|
3296
3296
|
const { ...baseOptions } = streamOptions || {};
|
|
3297
3297
|
const originalInstructions = await this.getInstructions({ runtimeContext: streamOptions?.runtimeContext });
|
|
3298
3298
|
const additionalInstructions = baseOptions.instructions;
|
|
@@ -3314,9 +3314,9 @@ ${additionalInstructions}`;
|
|
|
3314
3314
|
this.logger.debug(`[AgentBuilder:${this.name}] Starting streaming with enhanced context`, {
|
|
3315
3315
|
projectPath: this.builderConfig.projectPath
|
|
3316
3316
|
});
|
|
3317
|
-
return super.
|
|
3317
|
+
return super.stream(messages, enhancedOptions);
|
|
3318
3318
|
}
|
|
3319
|
-
async
|
|
3319
|
+
async generate(messages, options) {
|
|
3320
3320
|
const { ...baseOptions } = options || {};
|
|
3321
3321
|
const originalInstructions = await this.getInstructions({ runtimeContext: options?.runtimeContext });
|
|
3322
3322
|
const additionalInstructions = baseOptions.instructions;
|
|
@@ -3338,7 +3338,7 @@ ${additionalInstructions}`;
|
|
|
3338
3338
|
this.logger.debug(`[AgentBuilder:${this.name}] Starting streaming with enhanced context`, {
|
|
3339
3339
|
projectPath: this.builderConfig.projectPath
|
|
3340
3340
|
});
|
|
3341
|
-
return super.
|
|
3341
|
+
return super.generate(messages, enhancedOptions);
|
|
3342
3342
|
}
|
|
3343
3343
|
};
|
|
3344
3344
|
var cloneTemplateStep = createStep({
|
|
@@ -3491,10 +3491,10 @@ Return the actual exported names of the units, as well as the file names.`,
|
|
|
3491
3491
|
networks: z.array(z.object({ name: z.string(), file: z.string() })).optional(),
|
|
3492
3492
|
other: z.array(z.object({ name: z.string(), file: z.string() })).optional()
|
|
3493
3493
|
});
|
|
3494
|
-
const result = isV2 ? await agent.
|
|
3494
|
+
const result = isV2 ? await agent.generate(prompt, {
|
|
3495
3495
|
output,
|
|
3496
3496
|
maxSteps: 100
|
|
3497
|
-
}) : await agent.
|
|
3497
|
+
}) : await agent.generateLegacy(prompt, {
|
|
3498
3498
|
experimental_output: output,
|
|
3499
3499
|
maxSteps: 100
|
|
3500
3500
|
});
|
|
@@ -4240,7 +4240,7 @@ For each task:
|
|
|
4240
4240
|
Start by listing your tasks and work through them systematically!
|
|
4241
4241
|
`;
|
|
4242
4242
|
const isV2 = model.specificationVersion === "v2";
|
|
4243
|
-
const result = isV2 ? await agentBuilder.
|
|
4243
|
+
const result = isV2 ? await agentBuilder.stream(prompt) : await agentBuilder.streamLegacy(prompt);
|
|
4244
4244
|
const actualResolutions = [];
|
|
4245
4245
|
for await (const chunk of result.fullStream) {
|
|
4246
4246
|
if (chunk.type === "step-finish" || chunk.type === "step-start") {
|
|
@@ -4482,9 +4482,9 @@ Start by running validateCode with all validation types to get a complete pictur
|
|
|
4482
4482
|
Previous iterations may have fixed some issues, so start by re-running validateCode to see the current state, then fix any remaining issues.`;
|
|
4483
4483
|
const isV2 = model.specificationVersion === "v2";
|
|
4484
4484
|
const output = z.object({ success: z.boolean() });
|
|
4485
|
-
const result = isV2 ? await validationAgent.
|
|
4485
|
+
const result = isV2 ? await validationAgent.stream(iterationPrompt, {
|
|
4486
4486
|
output
|
|
4487
|
-
}) : await validationAgent.
|
|
4487
|
+
}) : await validationAgent.streamLegacy(iterationPrompt, {
|
|
4488
4488
|
experimental_output: output
|
|
4489
4489
|
});
|
|
4490
4490
|
let iterationErrors = 0;
|
|
@@ -5111,7 +5111,7 @@ var planningIterationStep = createStep({
|
|
|
5111
5111
|
projectStructure,
|
|
5112
5112
|
research
|
|
5113
5113
|
});
|
|
5114
|
-
const result = await planningAgent.
|
|
5114
|
+
const result = await planningAgent.generate(planningPrompt, {
|
|
5115
5115
|
output: PlanningAgentOutputSchema
|
|
5116
5116
|
// maxSteps: 15,
|
|
5117
5117
|
});
|
|
@@ -5821,7 +5821,7 @@ var workflowResearchStep = createStep({
|
|
|
5821
5821
|
dependencies: inputData.dependencies,
|
|
5822
5822
|
hasWorkflowsDir: inputData.structure.hasWorkflowsDir
|
|
5823
5823
|
});
|
|
5824
|
-
const result = await researchAgent.
|
|
5824
|
+
const result = await researchAgent.generate(researchPrompt, {
|
|
5825
5825
|
output: WorkflowResearchResultSchema
|
|
5826
5826
|
// stopWhen: stepCountIs(10),
|
|
5827
5827
|
});
|
|
@@ -5973,7 +5973,7 @@ ${additionalInstructions}`;
|
|
|
5973
5973
|
})}
|
|
5974
5974
|
|
|
5975
5975
|
${workflowBuilderPrompts.validation.instructions}`;
|
|
5976
|
-
const stream = await executionAgent.
|
|
5976
|
+
const stream = await executionAgent.stream(iterationPrompt, {
|
|
5977
5977
|
structuredOutput: {
|
|
5978
5978
|
schema: TaskExecutionIterationInputSchema(tasks.length),
|
|
5979
5979
|
model
|