@mastra/agent-builder 1.0.0-beta.1 → 1.0.0-beta.3

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,21 @@
1
1
  # @mastra/agent-builder
2
2
 
3
+ ## 1.0.0-beta.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`ac0d2f4`](https://github.com/mastra-ai/mastra/commit/ac0d2f4ff8831f72c1c66c2be809706d17f65789), [`1a0d3fc`](https://github.com/mastra-ai/mastra/commit/1a0d3fc811482c9c376cdf79ee615c23bae9b2d6), [`85a628b`](https://github.com/mastra-ai/mastra/commit/85a628b1224a8f64cd82ea7f033774bf22df7a7e), [`c237233`](https://github.com/mastra-ai/mastra/commit/c23723399ccedf7f5744b3f40997b79246bfbe64), [`15f9e21`](https://github.com/mastra-ai/mastra/commit/15f9e216177201ea6e3f6d0bfb063fcc0953444f), [`ff94dea`](https://github.com/mastra-ai/mastra/commit/ff94dea935f4e34545c63bcb6c29804732698809), [`5b2ff46`](https://github.com/mastra-ai/mastra/commit/5b2ff4651df70c146523a7fca773f8eb0a2272f8), [`db41688`](https://github.com/mastra-ai/mastra/commit/db4168806d007417e2e60b4f68656dca4e5f40c9), [`5ca599d`](https://github.com/mastra-ai/mastra/commit/5ca599d0bb59a1595f19f58473fcd67cc71cef58), [`bff1145`](https://github.com/mastra-ai/mastra/commit/bff114556b3cbadad9b2768488708f8ad0e91475), [`5c8ca24`](https://github.com/mastra-ai/mastra/commit/5c8ca247094e0cc2cdbd7137822fb47241f86e77), [`e191844`](https://github.com/mastra-ai/mastra/commit/e1918444ca3f80e82feef1dad506cd4ec6e2875f), [`22553f1`](https://github.com/mastra-ai/mastra/commit/22553f11c63ee5e966a9c034a349822249584691), [`7237163`](https://github.com/mastra-ai/mastra/commit/72371635dbf96a87df4b073cc48fc655afbdce3d), [`2500740`](https://github.com/mastra-ai/mastra/commit/2500740ea23da067d6e50ec71c625ab3ce275e64), [`873ecbb`](https://github.com/mastra-ai/mastra/commit/873ecbb517586aa17d2f1e99283755b3ebb2863f), [`97fee86`](https://github.com/mastra-ai/mastra/commit/97fee863b3dcca8b998faa016741e57ddff0acc9), [`4f9bbe5`](https://github.com/mastra-ai/mastra/commit/4f9bbe5968f42c86f4930b8193de3c3c17e5bd36), [`02e51fe`](https://github.com/mastra-ai/mastra/commit/02e51feddb3d4155cfbcc42624fd0d0970d032c0), [`8f3fa3a`](https://github.com/mastra-ai/mastra/commit/8f3fa3a652bb77da092f913ec51ae46e3a7e27dc), [`cd29ad2`](https://github.com/mastra-ai/mastra/commit/cd29ad23a255534e8191f249593849ed29160886), [`bdf4d8c`](https://github.com/mastra-ai/mastra/commit/bdf4d8cdc656d8a2c21d81834bfa3bfa70f56c16), [`854e3da`](https://github.com/mastra-ai/mastra/commit/854e3dad5daac17a91a20986399d3a51f54bf68b), [`ce18d38`](https://github.com/mastra-ai/mastra/commit/ce18d38678c65870350d123955014a8432075fd9), [`cccf9c8`](https://github.com/mastra-ai/mastra/commit/cccf9c8b2d2dfc1a5e63919395b83d78c89682a0), [`61a5705`](https://github.com/mastra-ai/mastra/commit/61a570551278b6743e64243b3ce7d73de915ca8a), [`db70a48`](https://github.com/mastra-ai/mastra/commit/db70a48aeeeeb8e5f92007e8ede52c364ce15287), [`f0fdc14`](https://github.com/mastra-ai/mastra/commit/f0fdc14ee233d619266b3d2bbdeea7d25cfc6d13), [`db18bc9`](https://github.com/mastra-ai/mastra/commit/db18bc9c3825e2c1a0ad9a183cc9935f6691bfa1), [`9b37b56`](https://github.com/mastra-ai/mastra/commit/9b37b565e1f2a76c24f728945cc740c2b09be9da), [`41a23c3`](https://github.com/mastra-ai/mastra/commit/41a23c32f9877d71810f37e24930515df2ff7a0f), [`5d171ad`](https://github.com/mastra-ai/mastra/commit/5d171ad9ef340387276b77c2bb3e83e83332d729), [`f03ae60`](https://github.com/mastra-ai/mastra/commit/f03ae60500fe350c9d828621006cdafe1975fdd8), [`d1e74a0`](https://github.com/mastra-ai/mastra/commit/d1e74a0a293866dece31022047f5dbab65a304d0), [`39e7869`](https://github.com/mastra-ai/mastra/commit/39e7869bc7d0ee391077ce291474d8a84eedccff), [`5761926`](https://github.com/mastra-ai/mastra/commit/57619260c4a2cdd598763abbacd90de594c6bc76), [`c900fdd`](https://github.com/mastra-ai/mastra/commit/c900fdd504c41348efdffb205cfe80d48c38fa33), [`604a79f`](https://github.com/mastra-ai/mastra/commit/604a79fecf276e26a54a3fe01bb94e65315d2e0e), [`887f0b4`](https://github.com/mastra-ai/mastra/commit/887f0b4746cdbd7cb7d6b17ac9f82aeb58037ea5), [`2562143`](https://github.com/mastra-ai/mastra/commit/256214336b4faa78646c9c1776612393790d8784), [`ef11a61`](https://github.com/mastra-ai/mastra/commit/ef11a61920fa0ed08a5b7ceedd192875af119749), [`ce32589`](https://github.com/mastra-ai/mastra/commit/ce325896358daa1088715ea13aac9eca596a4871)]:
8
+ - @mastra/core@1.0.0-beta.6
9
+ - @mastra/memory@1.0.0-beta.3
10
+
11
+ ## 1.0.0-beta.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`21a15de`](https://github.com/mastra-ai/mastra/commit/21a15de369fe82aac26bb642ed7be73505475e8b), [`feb7ee4`](https://github.com/mastra-ai/mastra/commit/feb7ee4d09a75edb46c6669a3beaceec78811747), [`b0e2ea5`](https://github.com/mastra-ai/mastra/commit/b0e2ea5b52c40fae438b9e2f7baee6f0f89c5442), [`c456e01`](https://github.com/mastra-ai/mastra/commit/c456e0149e3c176afcefdbd9bb1d2c5917723725), [`ab035c2`](https://github.com/mastra-ai/mastra/commit/ab035c2ef6d8cc7bb25f06f1a38508bd9e6f126b), [`1a46a56`](https://github.com/mastra-ai/mastra/commit/1a46a566f45a3fcbadc1cf36bf86d351f264bfa3), [`3cf540b`](https://github.com/mastra-ai/mastra/commit/3cf540b9fbfea8f4fc8d3a2319a4e6c0b0cbfd52), [`1c6ce51`](https://github.com/mastra-ai/mastra/commit/1c6ce51f875915ab57fd36873623013699a2a65d), [`898a972`](https://github.com/mastra-ai/mastra/commit/898a9727d286c2510d6b702dfd367e6aaf5c6b0f), [`a97003a`](https://github.com/mastra-ai/mastra/commit/a97003aa1cf2f4022a41912324a1e77263b326b8), [`ccc141e`](https://github.com/mastra-ai/mastra/commit/ccc141ed27da0abc3a3fc28e9e5128152e8e37f4), [`fe3b897`](https://github.com/mastra-ai/mastra/commit/fe3b897c2ccbcd2b10e81b099438c7337feddf89), [`00123ba`](https://github.com/mastra-ai/mastra/commit/00123ba96dc9e5cd0b110420ebdba56d8f237b25), [`29c4309`](https://github.com/mastra-ai/mastra/commit/29c4309f818b24304c041bcb4a8f19b5f13f6b62), [`16785ce`](https://github.com/mastra-ai/mastra/commit/16785ced928f6f22638f4488cf8a125d99211799), [`de8239b`](https://github.com/mastra-ai/mastra/commit/de8239bdcb1d8c0cfa06da21f1569912a66bbc8a), [`b5e6cd7`](https://github.com/mastra-ai/mastra/commit/b5e6cd77fc8c8e64e0494c1d06cee3d84e795d1e), [`3759cb0`](https://github.com/mastra-ai/mastra/commit/3759cb064935b5f74c65ac2f52a1145f7352899d), [`651e772`](https://github.com/mastra-ai/mastra/commit/651e772eb1475fb13e126d3fcc01751297a88214), [`b61b93f`](https://github.com/mastra-ai/mastra/commit/b61b93f9e058b11dd2eec169853175d31dbdd567), [`bae33d9`](https://github.com/mastra-ai/mastra/commit/bae33d91a63fbb64d1e80519e1fc1acaed1e9013), [`c0b731f`](https://github.com/mastra-ai/mastra/commit/c0b731fb27d712dc8582e846df5c0332a6a0c5ba), [`43ca8f2`](https://github.com/mastra-ai/mastra/commit/43ca8f2c7334851cc7b4d3d2f037d8784bfbdd5f), [`2ca67cc`](https://github.com/mastra-ai/mastra/commit/2ca67cc3bb1f6a617353fdcab197d9efebe60d6f), [`9e67002`](https://github.com/mastra-ai/mastra/commit/9e67002b52c9be19936c420a489dbee9c5fd6a78), [`35edc49`](https://github.com/mastra-ai/mastra/commit/35edc49ac0556db609189641d6341e76771b81fc)]:
16
+ - @mastra/core@1.0.0-beta.5
17
+ - @mastra/memory@1.0.0-beta.2
18
+
3
19
  ## 1.0.0-beta.1
4
20
 
5
21
  ### Patch Changes
@@ -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,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAK3E,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,cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,CA6BrC;IAEF;;;OAGG;IACH,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,CA4BjC;IAEF;;;OAGG;IACG,MAAM,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,EAClD,QAAQ,EAAE,gBAAgB,EAC1B,aAAa,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAC5C,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IA2B/B,QAAQ,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,EACpD,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,GACtC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CA0B5E"}
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,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAI3E,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,cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,CA6BrC;IAEF;;;OAGG;IACH,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,CA4BjC;IAEF;;;OAGG;IACG,MAAM,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,EAClD,QAAQ,EAAE,gBAAgB,EAC1B,aAAa,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAC5C,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IA2B/B,QAAQ,CAAC,MAAM,SAAS,YAAY,GAAG,SAAS,EACpD,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,GACtC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CA0B5E"}
@@ -70,7 +70,7 @@ export declare class AgentBuilderDefaults {
70
70
  totalLines: number;
71
71
  lastModified: string;
72
72
  } | undefined;
73
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
73
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "read-file"> & {
74
74
  inputSchema: z.ZodObject<{
75
75
  filePath: z.ZodString;
76
76
  startLine: z.ZodOptional<z.ZodNumber>;
@@ -182,7 +182,7 @@ export declare class AgentBuilderDefaults {
182
182
  filePath: string;
183
183
  error?: string | undefined;
184
184
  bytesWritten?: number | undefined;
185
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
185
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "write-file"> & {
186
186
  inputSchema: z.ZodObject<{
187
187
  filePath: z.ZodString;
188
188
  content: z.ZodString;
@@ -308,7 +308,7 @@ export declare class AgentBuilderDefaults {
308
308
  }[];
309
309
  totalItems: number;
310
310
  error?: string | undefined;
311
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
311
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "list-directory"> & {
312
312
  inputSchema: z.ZodObject<{
313
313
  path: z.ZodString;
314
314
  recursive: z.ZodDefault<z.ZodBoolean>;
@@ -459,7 +459,7 @@ export declare class AgentBuilderDefaults {
459
459
  workingDirectory?: string | undefined;
460
460
  exitCode?: number | undefined;
461
461
  executionTime?: number | undefined;
462
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
462
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "execute-command"> & {
463
463
  inputSchema: z.ZodObject<{
464
464
  command: z.ZodString;
465
465
  workingDirectory: z.ZodOptional<z.ZodString>;
@@ -632,7 +632,7 @@ export declare class AgentBuilderDefaults {
632
632
  dependencies?: string[] | undefined;
633
633
  notes?: string | undefined;
634
634
  }[];
635
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
635
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "task-manager"> & {
636
636
  inputSchema: z.ZodObject<{
637
637
  action: z.ZodEnum<["create", "update", "list", "complete", "remove"]>;
638
638
  tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -854,7 +854,7 @@ export declare class AgentBuilderDefaults {
854
854
  editsApplied: number;
855
855
  backup?: string | undefined;
856
856
  }[];
857
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
857
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "multi-edit"> & {
858
858
  inputSchema: z.ZodObject<{
859
859
  operations: z.ZodArray<z.ZodObject<{
860
860
  filePath: z.ZodString;
@@ -1003,7 +1003,7 @@ export declare class AgentBuilderDefaults {
1003
1003
  error?: string | undefined;
1004
1004
  backup?: string | undefined;
1005
1005
  linesReplaced?: number | undefined;
1006
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
1006
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "replace-lines"> & {
1007
1007
  inputSchema: z.ZodObject<{
1008
1008
  filePath: z.ZodString;
1009
1009
  startLine: z.ZodNumber;
@@ -1109,7 +1109,7 @@ export declare class AgentBuilderDefaults {
1109
1109
  }[];
1110
1110
  totalLines: number;
1111
1111
  error?: string | undefined;
1112
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
1112
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "show-file-lines"> & {
1113
1113
  inputSchema: z.ZodObject<{
1114
1114
  filePath: z.ZodString;
1115
1115
  startLine: z.ZodOptional<z.ZodNumber>;
@@ -1330,7 +1330,7 @@ export declare class AgentBuilderDefaults {
1330
1330
  filesSearched: number;
1331
1331
  patterns: string[];
1332
1332
  };
1333
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
1333
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "smart-search"> & {
1334
1334
  inputSchema: z.ZodObject<{
1335
1335
  query: z.ZodString;
1336
1336
  type: z.ZodDefault<z.ZodEnum<["text", "regex", "fuzzy", "semantic"]>>;
@@ -1604,7 +1604,7 @@ export declare class AgentBuilderDefaults {
1604
1604
  validationsPassed: string[];
1605
1605
  validationsFailed: string[];
1606
1606
  };
1607
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
1607
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "validate-code"> & {
1608
1608
  inputSchema: z.ZodObject<{
1609
1609
  projectPath: z.ZodOptional<z.ZodString>;
1610
1610
  validationType: z.ZodArray<z.ZodEnum<["types", "lint", "schemas", "tests", "build"]>, "many">;
@@ -1799,7 +1799,7 @@ export declare class AgentBuilderDefaults {
1799
1799
  searchTime: number;
1800
1800
  error?: string | undefined;
1801
1801
  suggestions?: string[] | undefined;
1802
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
1802
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "web-search"> & {
1803
1803
  inputSchema: z.ZodObject<{
1804
1804
  query: z.ZodString;
1805
1805
  maxResults: z.ZodDefault<z.ZodNumber>;
@@ -1976,7 +1976,7 @@ export declare class AgentBuilderDefaults {
1976
1976
  summary: string;
1977
1977
  completionId: string;
1978
1978
  confidence: number;
1979
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
1979
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "attempt-completion"> & {
1980
1980
  inputSchema: z.ZodObject<{
1981
1981
  summary: z.ZodString;
1982
1982
  changes: z.ZodArray<z.ZodObject<{
@@ -2120,7 +2120,7 @@ export declare class AgentBuilderDefaults {
2120
2120
  upgraded?: string[] | undefined;
2121
2121
  warnings?: string[] | undefined;
2122
2122
  details?: string | undefined;
2123
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
2123
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "manage-project"> & {
2124
2124
  inputSchema: z.ZodObject<{
2125
2125
  action: z.ZodEnum<["create", "install", "upgrade"]>;
2126
2126
  features: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -2227,7 +2227,7 @@ export declare class AgentBuilderDefaults {
2227
2227
  url?: string | undefined;
2228
2228
  port?: number | undefined;
2229
2229
  pid?: number | undefined;
2230
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
2230
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "manage-server"> & {
2231
2231
  inputSchema: z.ZodObject<{
2232
2232
  action: z.ZodEnum<["start", "stop", "restart", "status"]>;
2233
2233
  port: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
@@ -2328,7 +2328,7 @@ export declare class AgentBuilderDefaults {
2328
2328
  data?: any;
2329
2329
  headers?: Record<string, string> | undefined;
2330
2330
  statusText?: string | undefined;
2331
- }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>> & {
2331
+ }>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "http-request"> & {
2332
2332
  inputSchema: z.ZodObject<{
2333
2333
  method: z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH"]>;
2334
2334
  url: z.ZodString;
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Agent, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '@mastra/core/agent';
2
2
  import { Memory } from '@mastra/memory';
3
- import { TokenLimiter } from '@mastra/memory/processors';
4
3
  import { exec as exec$1, execFile as execFile$1, spawn as spawn$1 } from 'child_process';
5
4
  import { mkdtemp, rm, readFile, writeFile, readdir, mkdir, copyFile, stat } from 'fs/promises';
6
5
  import { join, resolve, basename, extname, dirname, isAbsolute, relative } from 'path';
@@ -11,7 +10,6 @@ import { existsSync, readFileSync } from 'fs';
11
10
  import { createRequire } from 'module';
12
11
  import { promisify } from 'util';
13
12
  import { ModelRouterLanguageModel } from '@mastra/core/llm';
14
- import { MemoryProcessor } from '@mastra/core/memory';
15
13
  import { tmpdir } from 'os';
16
14
  import { openai } from '@ai-sdk/openai';
17
15
  import { createStep, createWorkflow } from '@mastra/core/workflows';
@@ -3084,11 +3082,12 @@ export const mastra = new Mastra({
3084
3082
  }
3085
3083
  }
3086
3084
  };
3087
- var ToolSummaryProcessor = class extends MemoryProcessor {
3085
+ var ToolSummaryProcessor = class {
3086
+ id = "tool-summary-processor";
3087
+ name = "ToolSummaryProcessor";
3088
3088
  summaryAgent;
3089
3089
  summaryCache = /* @__PURE__ */ new Map();
3090
3090
  constructor({ summaryModel }) {
3091
- super({ name: "ToolSummaryProcessor" });
3092
3091
  this.summaryAgent = new Agent({
3093
3092
  id: "tool-summary-agent",
3094
3093
  name: "Tool Summary Agent",
@@ -3125,30 +3124,37 @@ var ToolSummaryProcessor = class extends MemoryProcessor {
3125
3124
  keys: Array.from(this.summaryCache.keys())
3126
3125
  };
3127
3126
  }
3128
- async process(messages) {
3127
+ async processInput({
3128
+ messages,
3129
+ messageList: _messageList
3130
+ }) {
3129
3131
  const summaryTasks = [];
3130
3132
  for (const message of messages) {
3131
- if (message.role === "tool" && Array.isArray(message.content) && message.content.length > 0 && message.content?.some((content) => content.type === "tool-result")) {
3132
- for (const content of message.content) {
3133
- if (content.type === "tool-result") {
3134
- const assistantMessageWithToolCall = messages.find(
3135
- (message2) => message2.role === "assistant" && Array.isArray(message2.content) && message2.content.length > 0 && message2.content?.some(
3136
- (assistantContent) => assistantContent.type === "tool-call" && assistantContent.toolCallId === content.toolCallId
3137
- )
3138
- );
3139
- const toolCall = Array.isArray(assistantMessageWithToolCall?.content) ? assistantMessageWithToolCall?.content.find(
3140
- (assistantContent) => assistantContent.type === "tool-call" && assistantContent.toolCallId === content.toolCallId
3141
- ) : null;
3142
- const cacheKey = this.createCacheKey(toolCall);
3133
+ if (message.content.format === 2 && message.content.parts) {
3134
+ for (let partIndex = 0; partIndex < message.content.parts.length; partIndex++) {
3135
+ const part = message.content.parts[partIndex];
3136
+ if (part && part.type === "tool-invocation" && part.toolInvocation?.state === "result") {
3137
+ const cacheKey = this.createCacheKey(part.toolInvocation);
3143
3138
  const cachedSummary = this.summaryCache.get(cacheKey);
3144
3139
  if (cachedSummary) {
3145
- content.result = `Tool call summary: ${cachedSummary}`;
3140
+ message.content.parts[partIndex] = {
3141
+ type: "tool-invocation",
3142
+ toolInvocation: {
3143
+ state: "result",
3144
+ step: part.toolInvocation.step,
3145
+ toolCallId: part.toolInvocation.toolCallId,
3146
+ toolName: part.toolInvocation.toolName,
3147
+ args: part.toolInvocation.args,
3148
+ result: `Tool call summary: ${cachedSummary}`
3149
+ }
3150
+ };
3146
3151
  } else {
3147
3152
  const summaryPromise = this.summaryAgent.generate(
3148
- `Summarize the following tool call: ${JSON.stringify(toolCall)} and result: ${JSON.stringify(content)}`
3153
+ `Summarize the following tool call: ${JSON.stringify(part.toolInvocation)}`
3149
3154
  );
3150
3155
  summaryTasks.push({
3151
- content,
3156
+ message,
3157
+ partIndex,
3152
3158
  promise: summaryPromise,
3153
3159
  cacheKey
3154
3160
  });
@@ -3166,10 +3172,24 @@ var ToolSummaryProcessor = class extends MemoryProcessor {
3166
3172
  const summaryResult = result.value;
3167
3173
  const summaryText = summaryResult.text;
3168
3174
  this.summaryCache.set(task.cacheKey, summaryText);
3169
- task.content.result = `Tool call summary: ${summaryText}`;
3175
+ if (task.message.content.format === 2 && task.message.content.parts) {
3176
+ const part = task.message.content.parts[task.partIndex];
3177
+ if (part && part.type === "tool-invocation" && part.toolInvocation?.state === "result") {
3178
+ task.message.content.parts[task.partIndex] = {
3179
+ type: "tool-invocation",
3180
+ toolInvocation: {
3181
+ state: "result",
3182
+ step: part.toolInvocation.step,
3183
+ toolCallId: part.toolInvocation.toolCallId,
3184
+ toolName: part.toolInvocation.toolName,
3185
+ args: part.toolInvocation.args,
3186
+ result: `Tool call summary: ${summaryText}`
3187
+ }
3188
+ };
3189
+ }
3190
+ }
3170
3191
  } else if (result.status === "rejected") {
3171
3192
  console.warn(`Failed to generate summary for tool call:`, result.reason);
3172
- task.content.result = `Tool call summary: [Summary generation failed]`;
3173
3193
  }
3174
3194
  });
3175
3195
  }
@@ -3189,6 +3209,7 @@ var AgentBuilder = class extends Agent {
3189
3209
  ${config.instructions}` : "";
3190
3210
  const combinedInstructions = additionalInstructions + AgentBuilderDefaults.DEFAULT_INSTRUCTIONS(config.projectPath);
3191
3211
  const agentConfig = {
3212
+ id: "agent-builder",
3192
3213
  name: "agent-builder",
3193
3214
  description: "An AI agent specialized in generating Mastra agents, tools, and workflows from natural language requirements.",
3194
3215
  instructions: combinedInstructions,
@@ -3200,15 +3221,14 @@ ${config.instructions}` : "";
3200
3221
  };
3201
3222
  },
3202
3223
  memory: new Memory({
3203
- options: AgentBuilderDefaults.DEFAULT_MEMORY_CONFIG,
3204
- processors: [
3205
- // use the write to disk processor to debug the agent's context
3206
- // new WriteToDiskProcessor({ prefix: 'before-filter' }),
3207
- new ToolSummaryProcessor({ summaryModel: config.summaryModel || config.model }),
3208
- new TokenLimiter(1e5)
3209
- // new WriteToDiskProcessor({ prefix: 'after-filter' }),
3210
- ]
3211
- })
3224
+ options: AgentBuilderDefaults.DEFAULT_MEMORY_CONFIG
3225
+ }),
3226
+ inputProcessors: [
3227
+ // use the write to disk processor to debug the agent's context
3228
+ // new WriteToDiskProcessor({ prefix: 'before-filter' }),
3229
+ new ToolSummaryProcessor({ summaryModel: config.summaryModel || config.model })
3230
+ // new WriteToDiskProcessor({ prefix: 'after-filter' }),
3231
+ ]
3212
3232
  };
3213
3233
  super(agentConfig);
3214
3234
  this.builderConfig = config;
@@ -5072,6 +5092,7 @@ var planningIterationStep = createStep({
5072
5092
  try {
5073
5093
  const model = await resolveModel({ requestContext });
5074
5094
  const planningAgent = new Agent({
5095
+ id: "workflow-planning-agent",
5075
5096
  model,
5076
5097
  instructions: taskPlanningPrompts.planningAgent.instructions({
5077
5098
  storedQAPairs
@@ -5802,6 +5823,7 @@ var workflowResearchStep = createStep({
5802
5823
  try {
5803
5824
  const model = await resolveModel({ requestContext });
5804
5825
  const researchAgent = new Agent({
5826
+ id: "workflow-research-agent",
5805
5827
  model,
5806
5828
  instructions: workflowBuilderPrompts.researchAgent.instructions,
5807
5829
  name: "Workflow Research Agent"