@mastra/agent-builder 1.0.39-alpha.1 → 1.0.40-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 +17 -0
- package/dist/index.js +107 -45
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @mastra/agent-builder
|
|
2
2
|
|
|
3
|
+
## 1.0.40-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`c973db4`](https://github.com/mastra-ai/mastra/commit/c973db428df1b564ff0c35d4b2a90e8f4f1e13fd), [`552285e`](https://github.com/mastra-ai/mastra/commit/552285e5af43cfc680a0972032cab8de8776c6a0), [`77e686c`](https://github.com/mastra-ai/mastra/commit/77e686c264e493e99ae5024e4dfe3ea5d5a09718), [`ece8dba`](https://github.com/mastra-ai/mastra/commit/ece8dba7ec1a5089eee8c33167cd762bfa91e509), [`e751af2`](https://github.com/mastra-ai/mastra/commit/e751af219433fbf4c7035b2d771b4c9ec8813b05), [`43dd577`](https://github.com/mastra-ai/mastra/commit/43dd577aa2b056b86b92cb903433f4fc13e69687), [`e2a8380`](https://github.com/mastra-ai/mastra/commit/e2a838017a7657850404c1e94c70d79ffdc6f14a), [`be3f1cd`](https://github.com/mastra-ai/mastra/commit/be3f1cd81f0e2a649e8eac15a024d542d814aef8), [`a34d9db`](https://github.com/mastra-ai/mastra/commit/a34d9dbc39fedb722f271318e9355ecee70489ab)]:
|
|
8
|
+
- @mastra/core@1.39.0-alpha.0
|
|
9
|
+
- @mastra/memory@1.20.2-alpha.0
|
|
10
|
+
|
|
11
|
+
## 1.0.39
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`00eca42`](https://github.com/mastra-ai/mastra/commit/00eca4252393aa114dc8c9a5e1da68df91fa06cf), [`fa63872`](https://github.com/mastra-ai/mastra/commit/fa6387280954e6b667bec5714b55ba082bc627ff), [`d779de3`](https://github.com/mastra-ai/mastra/commit/d779de3cd9d2e7ed8110547190e2f15e786a0e41), [`1750c97`](https://github.com/mastra-ai/mastra/commit/1750c975d6179fbf6db2813b15229d4f8f23fc55), [`9283971`](https://github.com/mastra-ai/mastra/commit/928397157009b4aef4d5fdf3a0a273cb371beb55), [`f07b646`](https://github.com/mastra-ai/mastra/commit/f07b64604ab7d25391179790b7fd4823df9e2dff), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`40f9297`](https://github.com/mastra-ai/mastra/commit/40f9297003b921c62373d3e8d3a4bda76c9f6de3), [`19a8658`](https://github.com/mastra-ai/mastra/commit/19a86589c788ef48bb6c1b0612cc82a201857379), [`850af77`](https://github.com/mastra-ai/mastra/commit/850af7779cb87c350804488734544a5b1843de25), [`0f0d1ba`](https://github.com/mastra-ai/mastra/commit/0f0d1ba67bfcb2204e571401662f1eceefc03357), [`a18775a`](https://github.com/mastra-ai/mastra/commit/a18775a693172546ee2378d39b67d4e32895b251), [`1baf2d1`](https://github.com/mastra-ai/mastra/commit/1baf2d152c6881338ff8f114633d5316fe13dd15), [`8c31bcd`](https://github.com/mastra-ai/mastra/commit/8c31bcdb00e597880d5939b1b7d7566fbe5dacae), [`0e32507`](https://github.com/mastra-ai/mastra/commit/0e32507962cdfa5569b7bda5bc6fb3dd34e40b03), [`95b14cd`](https://github.com/mastra-ai/mastra/commit/95b14cdd820e86d97ac05fe568424c513a252e31), [`07c3de7`](https://github.com/mastra-ai/mastra/commit/07c3de7f7bc418beccaea3b5e6b7f7cdda79d492), [`0bf2d93`](https://github.com/mastra-ai/mastra/commit/0bf2d932d20e2936f2d9abb8c0a86e24fbc97ec6), [`7b0d34c`](https://github.com/mastra-ai/mastra/commit/7b0d34cfe4a2fce22ac86ae17404685ff67a2ddb), [`a659a77`](https://github.com/mastra-ai/mastra/commit/a659a779bdebe3a52a518c56d2260592d0240fe0), [`aa36be2`](https://github.com/mastra-ai/mastra/commit/aa36be23aa513b7dc53cb8ca16b7fab8f20e43ad), [`3332be9`](https://github.com/mastra-ai/mastra/commit/3332be9701ecd77aba840959d9a1d1ce7aef02d3), [`212c635`](https://github.com/mastra-ai/mastra/commit/212c635203e61d036ab41db8ff86c3893dc795b3), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`9aa5a73`](https://github.com/mastra-ai/mastra/commit/9aa5a73e7e110f6e9365eec69364a33d5f03bb56), [`f73c789`](https://github.com/mastra-ai/mastra/commit/f73c789e8ef21561580395d2c410119cab5848c8), [`8bd16da`](https://github.com/mastra-ai/mastra/commit/8bd16da73a4cb874d739373643dbd6a6e7f88684), [`09be9d9`](https://github.com/mastra-ai/mastra/commit/09be9d92043fc8db5b82319a729071ebfee26cca), [`c8630f8`](https://github.com/mastra-ai/mastra/commit/c8630f80d4f40cb5d22e60ab162b618b1907167a), [`94dfef6`](https://github.com/mastra-ai/mastra/commit/94dfef6e2bf19a88467ea3940afcbce88a433f0f), [`47f71dc`](https://github.com/mastra-ai/mastra/commit/47f71dc6fbcbd12d71e21a979e676e20a02bd77d), [`50ceae2`](https://github.com/mastra-ai/mastra/commit/50ceae270878e2f8fb2b2c6c2faab09df0007c8a), [`a122f79`](https://github.com/mastra-ai/mastra/commit/a122f79427ae225ec79c7b2ed46278da48d04b17), [`8cdde58`](https://github.com/mastra-ai/mastra/commit/8cdde5875bbba6702d9df226f2b20232b8d75d6c), [`3a081c1`](https://github.com/mastra-ai/mastra/commit/3a081c1255c5ae8c99f6dad91cc612934ef6f2bd), [`49f8abc`](https://github.com/mastra-ai/mastra/commit/49f8abce8258e4f2f87bd326acfbdb641264a47c), [`847ff1e`](https://github.com/mastra-ai/mastra/commit/847ff1e0d94368d94b2e173e4e0908e115568ef3), [`0c1ed1d`](https://github.com/mastra-ai/mastra/commit/0c1ed1d00c7d87b5ac99ca95896211a2fa9189fa), [`259d409`](https://github.com/mastra-ai/mastra/commit/259d409a514174299dbde1ff5e1121209b3ba850), [`9e16c68`](https://github.com/mastra-ai/mastra/commit/9e16c6818b6485ccb43df28aba6f3a2219d28662), [`cefca33`](https://github.com/mastra-ai/mastra/commit/cefca33ae666e69810c935fedf95a929c173d1d7), [`d00e8c5`](https://github.com/mastra-ai/mastra/commit/d00e8c50daebe5bce5bf2f48bde39c86fc3d2fe4), [`36fa7e2`](https://github.com/mastra-ai/mastra/commit/36fa7e24d14e58a1eb46147097b32f583e5b8775), [`87e9774`](https://github.com/mastra-ai/mastra/commit/87e97741c1e493cd6d62f478eb810b49bda4d57c), [`65a72e7`](https://github.com/mastra-ai/mastra/commit/65a72e70c25eedea8ff985a6624b96be2850236b), [`fe9eacd`](https://github.com/mastra-ai/mastra/commit/fe9eacd9545a0a9d64aad31c9fa90294a425289e), [`4c02027`](https://github.com/mastra-ai/mastra/commit/4c020277235eaa6b1dc957c90ad0639eef213992), [`0f77241`](https://github.com/mastra-ai/mastra/commit/0f7724108806703799a8ba80ad0f09414afd5066), [`d8838ae`](https://github.com/mastra-ai/mastra/commit/d8838ae80b69780361693d27098f7f6684af12fe), [`f79df90`](https://github.com/mastra-ai/mastra/commit/f79df90e922c7985677c07d49d8fcf3afd2080c2), [`849efb9`](https://github.com/mastra-ai/mastra/commit/849efb9fca6dc976589c1f90a303fea618769109), [`92ff509`](https://github.com/mastra-ai/mastra/commit/92ff5098ef8a990438ca038077021a5f7541ec1d), [`3fce5e7`](https://github.com/mastra-ai/mastra/commit/3fce5e70d011d289043e75003ef3336ed4aa43c3), [`a763592`](https://github.com/mastra-ai/mastra/commit/a763592c3db46963ef1011cfe16fe372816e775e), [`db79c86`](https://github.com/mastra-ai/mastra/commit/db79c86c60723d57e02f9636ca2611bd4515f194), [`6855012`](https://github.com/mastra-ai/mastra/commit/685501247cc4717506f3e89beed03509d63a5370), [`80c7737`](https://github.com/mastra-ai/mastra/commit/80c7737e32d7917b5f356957d67c169d01744fd3), [`7fef31c`](https://github.com/mastra-ai/mastra/commit/7fef31c0d2a6d362a43a647a8a4f6ab893758a23), [`ab3b611`](https://github.com/mastra-ai/mastra/commit/ab3b611d086c07d7e0c9ece270b51fc17b9f54b8), [`7fef31c`](https://github.com/mastra-ai/mastra/commit/7fef31c0d2a6d362a43a647a8a4f6ab893758a23), [`3f1cf47`](https://github.com/mastra-ai/mastra/commit/3f1cf476f74c1e4cc2df908837e05853a5347e31), [`ff9d743`](https://github.com/mastra-ai/mastra/commit/ff9d743f71d7e072927725c0d700632aca0c1fee)]:
|
|
16
|
+
- @mastra/schema-compat@1.2.11
|
|
17
|
+
- @mastra/core@1.38.0
|
|
18
|
+
- @mastra/memory@1.20.1
|
|
19
|
+
|
|
3
20
|
## 1.0.39-alpha.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -4969,6 +4969,9 @@ var ParseError = class extends Error {
|
|
|
4969
4969
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
4970
4970
|
}
|
|
4971
4971
|
};
|
|
4972
|
+
var LF = 10;
|
|
4973
|
+
var CR = 13;
|
|
4974
|
+
var SPACE = 32;
|
|
4972
4975
|
function noop(_arg) {
|
|
4973
4976
|
}
|
|
4974
4977
|
function createParser(callbacks) {
|
|
@@ -4976,39 +4979,109 @@ function createParser(callbacks) {
|
|
|
4976
4979
|
throw new TypeError(
|
|
4977
4980
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
4978
4981
|
);
|
|
4979
|
-
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
4980
|
-
let
|
|
4981
|
-
function feed(
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4982
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
|
|
4983
|
+
let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
|
|
4984
|
+
function feed(chunk) {
|
|
4985
|
+
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
4986
|
+
const trailing2 = processLines(chunk);
|
|
4987
|
+
trailing2 !== "" && pendingFragments.push(trailing2);
|
|
4988
|
+
return;
|
|
4989
|
+
}
|
|
4990
|
+
if (chunk.indexOf(`
|
|
4991
|
+
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
4992
|
+
pendingFragments.push(chunk);
|
|
4993
|
+
return;
|
|
4994
|
+
}
|
|
4995
|
+
pendingFragments.push(chunk);
|
|
4996
|
+
const input = pendingFragments.join("");
|
|
4997
|
+
pendingFragments.length = 0;
|
|
4998
|
+
const trailing = processLines(input);
|
|
4999
|
+
trailing !== "" && pendingFragments.push(trailing);
|
|
5000
|
+
}
|
|
5001
|
+
function processLines(chunk) {
|
|
5002
|
+
let searchIndex = 0;
|
|
5003
|
+
if (chunk.indexOf("\r") === -1) {
|
|
5004
|
+
let lfIndex = chunk.indexOf(`
|
|
5005
|
+
`, searchIndex);
|
|
5006
|
+
for (; lfIndex !== -1; ) {
|
|
5007
|
+
if (searchIndex === lfIndex) {
|
|
5008
|
+
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
5009
|
+
`, searchIndex);
|
|
5010
|
+
continue;
|
|
5011
|
+
}
|
|
5012
|
+
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
5013
|
+
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
5014
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
5015
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
5016
|
+
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
5017
|
+
`, searchIndex);
|
|
5018
|
+
continue;
|
|
5019
|
+
}
|
|
5020
|
+
data = dataLines === 0 ? value : `${data}
|
|
5021
|
+
${value}`, dataLines++;
|
|
5022
|
+
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
5023
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
5024
|
+
lfIndex
|
|
5025
|
+
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
5026
|
+
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
5027
|
+
`, searchIndex);
|
|
5028
|
+
}
|
|
5029
|
+
return chunk.slice(searchIndex);
|
|
5030
|
+
}
|
|
5031
|
+
for (; searchIndex < chunk.length; ) {
|
|
5032
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
5033
|
+
`, searchIndex);
|
|
5034
|
+
let lineEnd = -1;
|
|
5035
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
5036
|
+
break;
|
|
5037
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
5038
|
+
}
|
|
5039
|
+
return chunk.slice(searchIndex);
|
|
5040
|
+
}
|
|
5041
|
+
function parseLine(chunk, start, end) {
|
|
5042
|
+
if (start === end) {
|
|
4989
5043
|
dispatchEvent();
|
|
4990
5044
|
return;
|
|
4991
5045
|
}
|
|
4992
|
-
|
|
4993
|
-
|
|
5046
|
+
const firstCharCode = chunk.charCodeAt(start);
|
|
5047
|
+
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
5048
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
5049
|
+
data = dataLines === 0 ? value2 : `${data}
|
|
5050
|
+
${value2}`, dataLines++;
|
|
5051
|
+
return;
|
|
5052
|
+
}
|
|
5053
|
+
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
5054
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
5055
|
+
return;
|
|
5056
|
+
}
|
|
5057
|
+
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
5058
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
5059
|
+
id = value2.includes("\0") ? void 0 : value2;
|
|
5060
|
+
return;
|
|
5061
|
+
}
|
|
5062
|
+
if (firstCharCode === 58) {
|
|
5063
|
+
if (onComment) {
|
|
5064
|
+
const line2 = chunk.slice(start, end);
|
|
5065
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
5066
|
+
}
|
|
4994
5067
|
return;
|
|
4995
5068
|
}
|
|
4996
|
-
const fieldSeparatorIndex = line.indexOf(":");
|
|
4997
|
-
if (fieldSeparatorIndex
|
|
4998
|
-
|
|
4999
|
-
processField(field, value, line);
|
|
5069
|
+
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
5070
|
+
if (fieldSeparatorIndex === -1) {
|
|
5071
|
+
processField(line, "", line);
|
|
5000
5072
|
return;
|
|
5001
5073
|
}
|
|
5002
|
-
|
|
5074
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
5075
|
+
processField(field, value, line);
|
|
5003
5076
|
}
|
|
5004
5077
|
function processField(field, value, line) {
|
|
5005
5078
|
switch (field) {
|
|
5006
5079
|
case "event":
|
|
5007
|
-
eventType = value;
|
|
5080
|
+
eventType = value || void 0;
|
|
5008
5081
|
break;
|
|
5009
5082
|
case "data":
|
|
5010
|
-
data = `${data}
|
|
5011
|
-
|
|
5083
|
+
data = dataLines === 0 ? value : `${data}
|
|
5084
|
+
${value}`, dataLines++;
|
|
5012
5085
|
break;
|
|
5013
5086
|
case "id":
|
|
5014
5087
|
id = value.includes("\0") ? void 0 : value;
|
|
@@ -5033,37 +5106,26 @@ function createParser(callbacks) {
|
|
|
5033
5106
|
}
|
|
5034
5107
|
}
|
|
5035
5108
|
function dispatchEvent() {
|
|
5036
|
-
|
|
5109
|
+
dataLines > 0 && onEvent({
|
|
5037
5110
|
id,
|
|
5038
|
-
event: eventType
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
data: data.endsWith(`
|
|
5042
|
-
`) ? data.slice(0, -1) : data
|
|
5043
|
-
}), id = void 0, data = "", eventType = "";
|
|
5111
|
+
event: eventType,
|
|
5112
|
+
data
|
|
5113
|
+
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
5044
5114
|
}
|
|
5045
5115
|
function reset(options = {}) {
|
|
5046
|
-
|
|
5116
|
+
if (options.consume && pendingFragments.length > 0) {
|
|
5117
|
+
const incompleteLine = pendingFragments.join("");
|
|
5118
|
+
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
5119
|
+
}
|
|
5120
|
+
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
|
|
5047
5121
|
}
|
|
5048
5122
|
return { feed, reset };
|
|
5049
5123
|
}
|
|
5050
|
-
function
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
`, searchIndex);
|
|
5056
|
-
let lineEnd = -1;
|
|
5057
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
5058
|
-
incompleteLine = chunk.slice(searchIndex);
|
|
5059
|
-
break;
|
|
5060
|
-
} else {
|
|
5061
|
-
const line = chunk.slice(searchIndex, lineEnd);
|
|
5062
|
-
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
5063
|
-
` && searchIndex++;
|
|
5064
|
-
}
|
|
5065
|
-
}
|
|
5066
|
-
return [lines, incompleteLine];
|
|
5124
|
+
function isDataPrefix(chunk, i, firstCharCode) {
|
|
5125
|
+
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
5126
|
+
}
|
|
5127
|
+
function isEventPrefix(chunk, i, firstCharCode) {
|
|
5128
|
+
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
5067
5129
|
}
|
|
5068
5130
|
var EventSourceParserStream = class extends TransformStream {
|
|
5069
5131
|
constructor({ onError, onRetry, onComment } = {}) {
|