@mastra/server 1.38.0 → 1.39.0-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 +29 -0
- package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +11 -8
- package/dist/{api-schema-manifest-E3RU6MLF.cjs → api-schema-manifest-ALHYYJMN.cjs} +4 -4
- package/dist/{api-schema-manifest-E3RU6MLF.cjs.map → api-schema-manifest-ALHYYJMN.cjs.map} +1 -1
- package/dist/{api-schema-manifest-DNC2KIKD.js → api-schema-manifest-PQ6VZTB3.js} +3 -3
- package/dist/{api-schema-manifest-DNC2KIKD.js.map → api-schema-manifest-PQ6VZTB3.js.map} +1 -1
- package/dist/chunk-2ONW75MN.cjs +477 -0
- package/dist/chunk-2ONW75MN.cjs.map +1 -0
- package/dist/{chunk-CJMJQR2K.cjs → chunk-3APAH25G.cjs} +4 -4
- package/dist/{chunk-CJMJQR2K.cjs.map → chunk-3APAH25G.cjs.map} +1 -1
- package/dist/{chunk-PXYR3D6L.cjs → chunk-3D55EABW.cjs} +3 -9
- package/dist/chunk-3D55EABW.cjs.map +1 -0
- package/dist/{chunk-WXJSYUBX.cjs → chunk-3KXE2KXE.cjs} +4 -4
- package/dist/{chunk-WXJSYUBX.cjs.map → chunk-3KXE2KXE.cjs.map} +1 -1
- package/dist/{chunk-APV6QKRZ.cjs → chunk-4W7KQRF5.cjs} +28 -28
- package/dist/{chunk-APV6QKRZ.cjs.map → chunk-4W7KQRF5.cjs.map} +1 -1
- package/dist/{chunk-L33BLLID.cjs → chunk-544IXGBW.cjs} +168 -166
- package/dist/chunk-544IXGBW.cjs.map +1 -0
- package/dist/{chunk-VH6QCEN7.cjs → chunk-5DDUXRAY.cjs} +102 -102
- package/dist/{chunk-VH6QCEN7.cjs.map → chunk-5DDUXRAY.cjs.map} +1 -1
- package/dist/{chunk-DNKTFFOV.cjs → chunk-5WB7PKHN.cjs} +4 -4
- package/dist/{chunk-DNKTFFOV.cjs.map → chunk-5WB7PKHN.cjs.map} +1 -1
- package/dist/{chunk-ODIMB6T6.cjs → chunk-6MP52DMQ.cjs} +7 -7
- package/dist/{chunk-ODIMB6T6.cjs.map → chunk-6MP52DMQ.cjs.map} +1 -1
- package/dist/{chunk-3LUN33E7.cjs → chunk-76ONC2XD.cjs} +85 -19
- package/dist/chunk-76ONC2XD.cjs.map +1 -0
- package/dist/{chunk-TLMAHJTC.cjs → chunk-77IY4RTO.cjs} +16 -16
- package/dist/{chunk-TLMAHJTC.cjs.map → chunk-77IY4RTO.cjs.map} +1 -1
- package/dist/{chunk-5PCUNLFX.js → chunk-AEH5OCIH.js} +3 -3
- package/dist/{chunk-5PCUNLFX.js.map → chunk-AEH5OCIH.js.map} +1 -1
- package/dist/{chunk-WADS7CD7.js → chunk-AW5INHG7.js} +4 -4
- package/dist/{chunk-WADS7CD7.js.map → chunk-AW5INHG7.js.map} +1 -1
- package/dist/{chunk-P7FVOCQB.cjs → chunk-AX6REP5O.cjs} +4 -4
- package/dist/{chunk-P7FVOCQB.cjs.map → chunk-AX6REP5O.cjs.map} +1 -1
- package/dist/{chunk-4DVNH3KJ.js → chunk-B5NMA52D.js} +4 -4
- package/dist/{chunk-4DVNH3KJ.js.map → chunk-B5NMA52D.js.map} +1 -1
- package/dist/{chunk-4T6DC425.js → chunk-CBG6LUEW.js} +3 -3
- package/dist/{chunk-4T6DC425.js.map → chunk-CBG6LUEW.js.map} +1 -1
- package/dist/{chunk-SDBN3DIS.cjs → chunk-D5M3VILP.cjs} +26 -26
- package/dist/{chunk-SDBN3DIS.cjs.map → chunk-D5M3VILP.cjs.map} +1 -1
- package/dist/{chunk-Z2ZMHHQW.js → chunk-E7AEYMKH.js} +3 -3
- package/dist/{chunk-Z2ZMHHQW.js.map → chunk-E7AEYMKH.js.map} +1 -1
- package/dist/{chunk-J6OD53OV.js → chunk-ESJTIVEQ.js} +12 -3
- package/dist/chunk-ESJTIVEQ.js.map +1 -0
- package/dist/{chunk-T2FBYRYD.cjs → chunk-ET7KSUVJ.cjs} +12 -2
- package/dist/chunk-ET7KSUVJ.cjs.map +1 -0
- package/dist/{chunk-T6IXA4ZQ.js → chunk-FQCCUWMS.js} +3 -3
- package/dist/{chunk-T6IXA4ZQ.js.map → chunk-FQCCUWMS.js.map} +1 -1
- package/dist/{chunk-QRIHD5UO.js → chunk-G2CL5JMK.js} +5 -5
- package/dist/{chunk-QRIHD5UO.js.map → chunk-G2CL5JMK.js.map} +1 -1
- package/dist/{chunk-XDOMY4VL.cjs → chunk-GAERIPY2.cjs} +5 -5
- package/dist/{chunk-XDOMY4VL.cjs.map → chunk-GAERIPY2.cjs.map} +1 -1
- package/dist/{chunk-QM3NYDZZ.js → chunk-HEBNJ6KJ.js} +4 -4
- package/dist/{chunk-QM3NYDZZ.js.map → chunk-HEBNJ6KJ.js.map} +1 -1
- package/dist/{chunk-AT5ZCHIV.cjs → chunk-HGREXGI2.cjs} +3 -3
- package/dist/{chunk-AT5ZCHIV.cjs.map → chunk-HGREXGI2.cjs.map} +1 -1
- package/dist/{chunk-RBONVWGZ.js → chunk-HJVMQDSZ.js} +9 -3
- package/dist/chunk-HJVMQDSZ.js.map +1 -0
- package/dist/{chunk-MFYZWOKE.cjs → chunk-IGE7NPFH.cjs} +5 -5
- package/dist/{chunk-MFYZWOKE.cjs.map → chunk-IGE7NPFH.cjs.map} +1 -1
- package/dist/{chunk-UFYCA27U.js → chunk-IONXSX77.js} +5 -3
- package/dist/chunk-IONXSX77.js.map +1 -0
- package/dist/{chunk-RTYOFB6W.cjs → chunk-IU3ZRZSG.cjs} +5 -3
- package/dist/chunk-IU3ZRZSG.cjs.map +1 -0
- package/dist/{chunk-76I5G5W5.js → chunk-JMEMSVJ5.js} +4 -9
- package/dist/chunk-JMEMSVJ5.js.map +1 -0
- package/dist/{chunk-56F2IRK3.js → chunk-K6XESXNQ.js} +3 -3
- package/dist/{chunk-56F2IRK3.js.map → chunk-K6XESXNQ.js.map} +1 -1
- package/dist/{chunk-43KD3CRE.cjs → chunk-LBVQK4LO.cjs} +16 -5
- package/dist/chunk-LBVQK4LO.cjs.map +1 -0
- package/dist/{chunk-IJFPP2XB.js → chunk-LNBKA6IA.js} +69 -4
- package/dist/chunk-LNBKA6IA.js.map +1 -0
- package/dist/{chunk-BKYFKSJI.js → chunk-LPYCF5B2.js} +3 -3
- package/dist/{chunk-BKYFKSJI.js.map → chunk-LPYCF5B2.js.map} +1 -1
- package/dist/{chunk-DRXZDKLU.js → chunk-LQQCTO6D.js} +3 -3
- package/dist/{chunk-DRXZDKLU.js.map → chunk-LQQCTO6D.js.map} +1 -1
- package/dist/{chunk-HX5BGP6D.cjs → chunk-LYF4J3JE.cjs} +17 -17
- package/dist/{chunk-HX5BGP6D.cjs.map → chunk-LYF4J3JE.cjs.map} +1 -1
- package/dist/chunk-NQLS4Z3W.js +472 -0
- package/dist/chunk-NQLS4Z3W.js.map +1 -0
- package/dist/{chunk-KSZXXQHZ.js → chunk-NTE3Q3BA.js} +3 -3
- package/dist/{chunk-KSZXXQHZ.js.map → chunk-NTE3Q3BA.js.map} +1 -1
- package/dist/{chunk-5FPJ4RT4.js → chunk-OCWY55IQ.js} +3 -3
- package/dist/{chunk-5FPJ4RT4.js.map → chunk-OCWY55IQ.js.map} +1 -1
- package/dist/{chunk-GPAQ47NG.cjs → chunk-QVFQUBC7.cjs} +9 -3
- package/dist/chunk-QVFQUBC7.cjs.map +1 -0
- package/dist/{chunk-7GOHECZP.js → chunk-SEAEQN2H.js} +3 -3
- package/dist/{chunk-7GOHECZP.js.map → chunk-SEAEQN2H.js.map} +1 -1
- package/dist/{chunk-6XSS54BL.cjs → chunk-THXUZHS6.cjs} +7 -7
- package/dist/{chunk-6XSS54BL.cjs.map → chunk-THXUZHS6.cjs.map} +1 -1
- package/dist/{chunk-M7HLT2GO.js → chunk-UOQHTFYI.js} +3 -3
- package/dist/{chunk-M7HLT2GO.js.map → chunk-UOQHTFYI.js.map} +1 -1
- package/dist/{chunk-5SK4SJJH.js → chunk-V4G7MSFL.js} +3 -3
- package/dist/{chunk-5SK4SJJH.js.map → chunk-V4G7MSFL.js.map} +1 -1
- package/dist/{chunk-XB6H6LOM.js → chunk-VSB4S6R5.js} +3 -3
- package/dist/{chunk-XB6H6LOM.js.map → chunk-VSB4S6R5.js.map} +1 -1
- package/dist/{chunk-4DGDQWQQ.cjs → chunk-VWFP6O2W.cjs} +14 -14
- package/dist/{chunk-4DGDQWQQ.cjs.map → chunk-VWFP6O2W.cjs.map} +1 -1
- package/dist/{chunk-ZNMKBPTN.cjs → chunk-WUPBIK5J.cjs} +15 -15
- package/dist/{chunk-ZNMKBPTN.cjs.map → chunk-WUPBIK5J.cjs.map} +1 -1
- package/dist/{chunk-F27R55RI.cjs → chunk-XGFN7MMF.cjs} +4 -4
- package/dist/{chunk-F27R55RI.cjs.map → chunk-XGFN7MMF.cjs.map} +1 -1
- package/dist/{chunk-YW252K6H.js → chunk-XNGC2C6Z.js} +20 -18
- package/dist/chunk-XNGC2C6Z.js.map +1 -0
- package/dist/{chunk-7GSR7HQ2.js → chunk-Y5CIOSHU.js} +4 -4
- package/dist/{chunk-7GSR7HQ2.js.map → chunk-Y5CIOSHU.js.map} +1 -1
- package/dist/{chunk-OJNVSXOF.js → chunk-YH4WGIEH.js} +16 -5
- package/dist/chunk-YH4WGIEH.js.map +1 -0
- package/dist/{chunk-NSXV3FWO.cjs → chunk-ZIWTQGJV.cjs} +20 -20
- package/dist/{chunk-NSXV3FWO.cjs.map → chunk-ZIWTQGJV.cjs.map} +1 -1
- package/dist/constants-DVRTNEGY-A5OAGF3M.js +3 -0
- package/dist/{constants-SPS7MR4D-YRZDDIPO.js.map → constants-DVRTNEGY-A5OAGF3M.js.map} +1 -1
- package/dist/{constants-SPS7MR4D-ZMHAFWSH.cjs → constants-DVRTNEGY-ZGCNETZ3.cjs} +8 -8
- package/dist/{constants-SPS7MR4D-ZMHAFWSH.cjs.map → constants-DVRTNEGY-ZGCNETZ3.cjs.map} +1 -1
- package/dist/{dist-HIWM6H43.js → dist-LWX2CRMH.js} +304 -125
- package/dist/dist-LWX2CRMH.js.map +1 -0
- package/dist/{dist-LZYJXHUM.cjs → dist-QFLLP7OJ.cjs} +336 -157
- package/dist/dist-QFLLP7OJ.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-TJFOX3YN-A2QE2E3I.cjs → observational-memory-G52HNRHE-73KIWQ2G.cjs} +31 -31
- package/dist/{observational-memory-TJFOX3YN-A2QE2E3I.cjs.map → observational-memory-G52HNRHE-73KIWQ2G.cjs.map} +1 -1
- package/dist/{observational-memory-TJFOX3YN-P3KG2OXA.js → observational-memory-G52HNRHE-RHA4V77M.js} +4 -4
- package/dist/{observational-memory-TJFOX3YN-P3KG2OXA.js.map → observational-memory-G52HNRHE-RHA4V77M.js.map} +1 -1
- package/dist/server/auth/helpers.d.ts +3 -4
- package/dist/server/auth/helpers.d.ts.map +1 -1
- package/dist/server/auth/index.cjs +15 -15
- package/dist/server/auth/index.js +1 -1
- package/dist/server/handlers/a2a.cjs +14 -14
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +17 -17
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-versions.cjs +8 -8
- package/dist/server/handlers/agent-versions.js +1 -1
- package/dist/server/handlers/agents.cjs +45 -45
- package/dist/server/handlers/agents.d.ts +4 -0
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/auth.cjs +12 -12
- package/dist/server/handlers/auth.js +1 -1
- package/dist/server/handlers/conversations.cjs +5 -5
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/memory.cjs +27 -27
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/responses.cjs +4 -4
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/scorer-versions.cjs +8 -8
- package/dist/server/handlers/scorer-versions.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +3 -3
- package/dist/server/handlers/stored-agent-favorites.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +12 -8
- package/dist/server/handlers/stored-agents.d.ts +26 -0
- package/dist/server/handlers/stored-agents.d.ts.map +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/stored-scorers.cjs +6 -6
- package/dist/server/handlers/stored-scorers.js +1 -1
- package/dist/server/handlers/system.cjs +3 -3
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/workflows.cjs +27 -27
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +18 -18
- package/dist/server/handlers.js +9 -9
- package/dist/server/schemas/agents.d.ts +2 -0
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +119 -115
- package/dist/server/schemas/index.js +5 -5
- package/dist/server/schemas/stored-agents.d.ts +17 -0
- package/dist/server/schemas/stored-agents.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +23 -16
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.d.ts.map +1 -1
- package/dist/server/server-adapter/index.js +11 -4
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/stored-agents.d.ts +2 -1
- package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -1
- package/dist/working-memory-state-J7ASTNXX-JNDYMEET.js +3 -0
- package/dist/working-memory-state-J7ASTNXX-JNDYMEET.js.map +1 -0
- package/dist/working-memory-state-J7ASTNXX-WEIO7C67.cjs +24 -0
- package/dist/working-memory-state-J7ASTNXX-WEIO7C67.cjs.map +1 -0
- package/package.json +5 -5
- package/dist/chunk-3LUN33E7.cjs.map +0 -1
- package/dist/chunk-43KD3CRE.cjs.map +0 -1
- package/dist/chunk-76I5G5W5.js.map +0 -1
- package/dist/chunk-GPAQ47NG.cjs.map +0 -1
- package/dist/chunk-IJFPP2XB.js.map +0 -1
- package/dist/chunk-J6OD53OV.js.map +0 -1
- package/dist/chunk-L33BLLID.cjs.map +0 -1
- package/dist/chunk-OJNVSXOF.js.map +0 -1
- package/dist/chunk-PXYR3D6L.cjs.map +0 -1
- package/dist/chunk-RBONVWGZ.js.map +0 -1
- package/dist/chunk-RTYOFB6W.cjs.map +0 -1
- package/dist/chunk-T2FBYRYD.cjs.map +0 -1
- package/dist/chunk-UFYCA27U.js.map +0 -1
- package/dist/chunk-YW252K6H.js.map +0 -1
- package/dist/constants-SPS7MR4D-YRZDDIPO.js +0 -3
- package/dist/dist-HIWM6H43.js.map +0 -1
- package/dist/dist-LZYJXHUM.cjs.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { openai } from './chunk-T3SVB5CX.js';
|
|
2
|
-
import { e, truncateStringByTokens, estimateTokenCount, resolveToolResultValue, formatToolResultForObserver } from './chunk-
|
|
3
|
-
import { __export } from './chunk-76I5G5W5.js';
|
|
2
|
+
import { e, truncateStringByTokens, estimateTokenCount, resolveToolResultValue, formatToolResultForObserver } from './chunk-Y5CIOSHU.js';
|
|
4
3
|
import { standardSchemaToJSONSchema, isStandardSchemaWithJSON, toStandardSchema5 } from './chunk-U2WSRKSA.js';
|
|
5
4
|
import { __commonJS, __toESM } from './chunk-PR4QN5HX.js';
|
|
6
5
|
import { Agent, isSupportedLanguageModel, tryGenerateWithJsonFallback, tryStreamWithJsonFallback, MessageList } from '@mastra/core/agent';
|
|
@@ -33,7 +32,7 @@ var require_ignore = __commonJS({
|
|
|
33
32
|
}
|
|
34
33
|
var UNDEFINED = void 0;
|
|
35
34
|
var EMPTY = "";
|
|
36
|
-
var
|
|
35
|
+
var SPACE4 = " ";
|
|
37
36
|
var ESCAPE = "\\";
|
|
38
37
|
var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
|
39
38
|
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
@@ -77,7 +76,7 @@ var require_ignore = __commonJS({
|
|
|
77
76
|
// (a ) -> (a)
|
|
78
77
|
// (a \ ) -> (a )
|
|
79
78
|
/((?:\\\\)*?)(\\?\s+)$/,
|
|
80
|
-
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ?
|
|
79
|
+
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE4 : EMPTY)
|
|
81
80
|
],
|
|
82
81
|
// Replace (\ ) with ' '
|
|
83
82
|
// (\ ) -> ' '
|
|
@@ -87,7 +86,7 @@ var require_ignore = __commonJS({
|
|
|
87
86
|
/(\\+?)\s/g,
|
|
88
87
|
(_, m1) => {
|
|
89
88
|
const { length } = m1;
|
|
90
|
-
return m1.slice(0, length - length % 2) +
|
|
89
|
+
return m1.slice(0, length - length % 2) + SPACE4;
|
|
91
90
|
}
|
|
92
91
|
],
|
|
93
92
|
// Escape metacharacters
|
|
@@ -481,6 +480,13 @@ var require_ignore = __commonJS({
|
|
|
481
480
|
define(module.exports, /* @__PURE__ */ Symbol.for("setupWindows"), setupWindows);
|
|
482
481
|
}
|
|
483
482
|
});
|
|
483
|
+
|
|
484
|
+
// ../memory/dist/chunk-PZ5AY32C.js
|
|
485
|
+
var __defProp = Object.defineProperty;
|
|
486
|
+
var __export = (target, all) => {
|
|
487
|
+
for (var name4 in all)
|
|
488
|
+
__defProp(target, name4, { get: all[name4], enumerable: true });
|
|
489
|
+
};
|
|
484
490
|
var E_CANCELED = new Error("request for lock canceled");
|
|
485
491
|
var __awaiter$2 = function(thisArg, _arguments, P, generator) {
|
|
486
492
|
function adopt(value) {
|
|
@@ -684,7 +690,7 @@ var Mutex = class {
|
|
|
684
690
|
}
|
|
685
691
|
};
|
|
686
692
|
var __create = Object.create;
|
|
687
|
-
var
|
|
693
|
+
var __defProp2 = Object.defineProperty;
|
|
688
694
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
689
695
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
690
696
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -696,7 +702,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
696
702
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
697
703
|
for (let key of __getOwnPropNames(from))
|
|
698
704
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
699
|
-
|
|
705
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
700
706
|
}
|
|
701
707
|
return to;
|
|
702
708
|
};
|
|
@@ -705,7 +711,7 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
|
|
|
705
711
|
// file that has been converted to a CommonJS file using a Babel-
|
|
706
712
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
707
713
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
708
|
-
|
|
714
|
+
__defProp2(target, "default", { value: mod, enumerable: true }),
|
|
709
715
|
mod
|
|
710
716
|
));
|
|
711
717
|
var require_secure_json_parse = __commonJS2({
|
|
@@ -7658,10 +7664,10 @@ var TraceAPI = (
|
|
|
7658
7664
|
})()
|
|
7659
7665
|
);
|
|
7660
7666
|
var trace = TraceAPI.getInstance();
|
|
7661
|
-
var
|
|
7667
|
+
var __defProp22 = Object.defineProperty;
|
|
7662
7668
|
var __export2 = (target, all) => {
|
|
7663
7669
|
for (var name173 in all)
|
|
7664
|
-
|
|
7670
|
+
__defProp22(target, name173, { get: all[name173], enumerable: true });
|
|
7665
7671
|
};
|
|
7666
7672
|
function prepareResponseHeaders(headers, {
|
|
7667
7673
|
contentType,
|
|
@@ -23576,6 +23582,9 @@ var ParseError = class extends Error {
|
|
|
23576
23582
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
23577
23583
|
}
|
|
23578
23584
|
};
|
|
23585
|
+
var LF = 10;
|
|
23586
|
+
var CR = 13;
|
|
23587
|
+
var SPACE = 32;
|
|
23579
23588
|
function noop(_arg) {
|
|
23580
23589
|
}
|
|
23581
23590
|
function createParser(callbacks) {
|
|
@@ -23583,39 +23592,109 @@ function createParser(callbacks) {
|
|
|
23583
23592
|
throw new TypeError(
|
|
23584
23593
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
23585
23594
|
);
|
|
23586
|
-
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
23587
|
-
let
|
|
23588
|
-
function feed(
|
|
23589
|
-
|
|
23590
|
-
|
|
23591
|
-
|
|
23592
|
-
|
|
23593
|
-
|
|
23594
|
-
|
|
23595
|
-
|
|
23595
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
|
|
23596
|
+
let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
|
|
23597
|
+
function feed(chunk) {
|
|
23598
|
+
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
23599
|
+
const trailing2 = processLines(chunk);
|
|
23600
|
+
trailing2 !== "" && pendingFragments.push(trailing2);
|
|
23601
|
+
return;
|
|
23602
|
+
}
|
|
23603
|
+
if (chunk.indexOf(`
|
|
23604
|
+
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
23605
|
+
pendingFragments.push(chunk);
|
|
23606
|
+
return;
|
|
23607
|
+
}
|
|
23608
|
+
pendingFragments.push(chunk);
|
|
23609
|
+
const input = pendingFragments.join("");
|
|
23610
|
+
pendingFragments.length = 0;
|
|
23611
|
+
const trailing = processLines(input);
|
|
23612
|
+
trailing !== "" && pendingFragments.push(trailing);
|
|
23613
|
+
}
|
|
23614
|
+
function processLines(chunk) {
|
|
23615
|
+
let searchIndex = 0;
|
|
23616
|
+
if (chunk.indexOf("\r") === -1) {
|
|
23617
|
+
let lfIndex = chunk.indexOf(`
|
|
23618
|
+
`, searchIndex);
|
|
23619
|
+
for (; lfIndex !== -1; ) {
|
|
23620
|
+
if (searchIndex === lfIndex) {
|
|
23621
|
+
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
23622
|
+
`, searchIndex);
|
|
23623
|
+
continue;
|
|
23624
|
+
}
|
|
23625
|
+
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
23626
|
+
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
23627
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
23628
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
23629
|
+
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
23630
|
+
`, searchIndex);
|
|
23631
|
+
continue;
|
|
23632
|
+
}
|
|
23633
|
+
data = dataLines === 0 ? value : `${data}
|
|
23634
|
+
${value}`, dataLines++;
|
|
23635
|
+
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
23636
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
23637
|
+
lfIndex
|
|
23638
|
+
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
23639
|
+
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
23640
|
+
`, searchIndex);
|
|
23641
|
+
}
|
|
23642
|
+
return chunk.slice(searchIndex);
|
|
23643
|
+
}
|
|
23644
|
+
for (; searchIndex < chunk.length; ) {
|
|
23645
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
23646
|
+
`, searchIndex);
|
|
23647
|
+
let lineEnd = -1;
|
|
23648
|
+
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)
|
|
23649
|
+
break;
|
|
23650
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
23651
|
+
}
|
|
23652
|
+
return chunk.slice(searchIndex);
|
|
23653
|
+
}
|
|
23654
|
+
function parseLine(chunk, start, end) {
|
|
23655
|
+
if (start === end) {
|
|
23596
23656
|
dispatchEvent();
|
|
23597
23657
|
return;
|
|
23598
23658
|
}
|
|
23599
|
-
|
|
23600
|
-
|
|
23659
|
+
const firstCharCode = chunk.charCodeAt(start);
|
|
23660
|
+
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
23661
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
23662
|
+
data = dataLines === 0 ? value2 : `${data}
|
|
23663
|
+
${value2}`, dataLines++;
|
|
23664
|
+
return;
|
|
23665
|
+
}
|
|
23666
|
+
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
23667
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
23601
23668
|
return;
|
|
23602
23669
|
}
|
|
23603
|
-
|
|
23604
|
-
|
|
23605
|
-
|
|
23606
|
-
|
|
23670
|
+
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
23671
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
23672
|
+
id = value2.includes("\0") ? void 0 : value2;
|
|
23673
|
+
return;
|
|
23674
|
+
}
|
|
23675
|
+
if (firstCharCode === 58) {
|
|
23676
|
+
if (onComment) {
|
|
23677
|
+
const line2 = chunk.slice(start, end);
|
|
23678
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
23679
|
+
}
|
|
23680
|
+
return;
|
|
23681
|
+
}
|
|
23682
|
+
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
23683
|
+
if (fieldSeparatorIndex === -1) {
|
|
23684
|
+
processField(line, "", line);
|
|
23607
23685
|
return;
|
|
23608
23686
|
}
|
|
23609
|
-
|
|
23687
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
23688
|
+
processField(field, value, line);
|
|
23610
23689
|
}
|
|
23611
23690
|
function processField(field, value, line) {
|
|
23612
23691
|
switch (field) {
|
|
23613
23692
|
case "event":
|
|
23614
|
-
eventType = value;
|
|
23693
|
+
eventType = value || void 0;
|
|
23615
23694
|
break;
|
|
23616
23695
|
case "data":
|
|
23617
|
-
data = `${data}
|
|
23618
|
-
|
|
23696
|
+
data = dataLines === 0 ? value : `${data}
|
|
23697
|
+
${value}`, dataLines++;
|
|
23619
23698
|
break;
|
|
23620
23699
|
case "id":
|
|
23621
23700
|
id = value.includes("\0") ? void 0 : value;
|
|
@@ -23640,37 +23719,26 @@ function createParser(callbacks) {
|
|
|
23640
23719
|
}
|
|
23641
23720
|
}
|
|
23642
23721
|
function dispatchEvent() {
|
|
23643
|
-
|
|
23722
|
+
dataLines > 0 && onEvent({
|
|
23644
23723
|
id,
|
|
23645
|
-
event: eventType
|
|
23646
|
-
|
|
23647
|
-
|
|
23648
|
-
data: data.endsWith(`
|
|
23649
|
-
`) ? data.slice(0, -1) : data
|
|
23650
|
-
}), id = void 0, data = "", eventType = "";
|
|
23724
|
+
event: eventType,
|
|
23725
|
+
data
|
|
23726
|
+
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
23651
23727
|
}
|
|
23652
23728
|
function reset(options = {}) {
|
|
23653
|
-
|
|
23729
|
+
if (options.consume && pendingFragments.length > 0) {
|
|
23730
|
+
const incompleteLine = pendingFragments.join("");
|
|
23731
|
+
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
23732
|
+
}
|
|
23733
|
+
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
|
|
23654
23734
|
}
|
|
23655
23735
|
return { feed, reset };
|
|
23656
23736
|
}
|
|
23657
|
-
function
|
|
23658
|
-
|
|
23659
|
-
|
|
23660
|
-
|
|
23661
|
-
|
|
23662
|
-
`, searchIndex);
|
|
23663
|
-
let lineEnd = -1;
|
|
23664
|
-
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) {
|
|
23665
|
-
incompleteLine = chunk.slice(searchIndex);
|
|
23666
|
-
break;
|
|
23667
|
-
} else {
|
|
23668
|
-
const line = chunk.slice(searchIndex, lineEnd);
|
|
23669
|
-
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
23670
|
-
` && searchIndex++;
|
|
23671
|
-
}
|
|
23672
|
-
}
|
|
23673
|
-
return [lines, incompleteLine];
|
|
23737
|
+
function isDataPrefix(chunk, i, firstCharCode) {
|
|
23738
|
+
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
23739
|
+
}
|
|
23740
|
+
function isEventPrefix(chunk, i, firstCharCode) {
|
|
23741
|
+
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;
|
|
23674
23742
|
}
|
|
23675
23743
|
var EventSourceParserStream = class extends TransformStream {
|
|
23676
23744
|
constructor({ onError, onRetry, onComment } = {}) {
|
|
@@ -39963,9 +40031,9 @@ var ParseError2 = class extends Error {
|
|
|
39963
40031
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
39964
40032
|
}
|
|
39965
40033
|
};
|
|
39966
|
-
var
|
|
39967
|
-
var
|
|
39968
|
-
var
|
|
40034
|
+
var LF2 = 10;
|
|
40035
|
+
var CR2 = 13;
|
|
40036
|
+
var SPACE2 = 32;
|
|
39969
40037
|
function noop2(_arg) {
|
|
39970
40038
|
}
|
|
39971
40039
|
function createParser2(callbacks) {
|
|
@@ -40004,17 +40072,17 @@ function createParser2(callbacks) {
|
|
|
40004
40072
|
continue;
|
|
40005
40073
|
}
|
|
40006
40074
|
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
40007
|
-
if (
|
|
40008
|
-
const valueStart = chunk.charCodeAt(searchIndex + 5) ===
|
|
40009
|
-
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) ===
|
|
40075
|
+
if (isDataPrefix2(chunk, searchIndex, firstCharCode)) {
|
|
40076
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE2 ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
40077
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF2) {
|
|
40010
40078
|
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
40011
40079
|
`, searchIndex);
|
|
40012
40080
|
continue;
|
|
40013
40081
|
}
|
|
40014
40082
|
data = dataLines === 0 ? value : `${data}
|
|
40015
40083
|
${value}`, dataLines++;
|
|
40016
|
-
} else
|
|
40017
|
-
chunk.charCodeAt(searchIndex + 6) ===
|
|
40084
|
+
} else isEventPrefix2(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
40085
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE2 ? searchIndex + 7 : searchIndex + 6,
|
|
40018
40086
|
lfIndex
|
|
40019
40087
|
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
40020
40088
|
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
@@ -40028,7 +40096,7 @@ ${value}`, dataLines++;
|
|
|
40028
40096
|
let lineEnd = -1;
|
|
40029
40097
|
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)
|
|
40030
40098
|
break;
|
|
40031
|
-
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) ===
|
|
40099
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR2 && chunk.charCodeAt(searchIndex) === LF2 && searchIndex++;
|
|
40032
40100
|
}
|
|
40033
40101
|
return chunk.slice(searchIndex);
|
|
40034
40102
|
}
|
|
@@ -40038,25 +40106,25 @@ ${value}`, dataLines++;
|
|
|
40038
40106
|
return;
|
|
40039
40107
|
}
|
|
40040
40108
|
const firstCharCode = chunk.charCodeAt(start);
|
|
40041
|
-
if (
|
|
40042
|
-
const valueStart = chunk.charCodeAt(start + 5) ===
|
|
40109
|
+
if (isDataPrefix2(chunk, start, firstCharCode)) {
|
|
40110
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE2 ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
40043
40111
|
data = dataLines === 0 ? value2 : `${data}
|
|
40044
40112
|
${value2}`, dataLines++;
|
|
40045
40113
|
return;
|
|
40046
40114
|
}
|
|
40047
|
-
if (
|
|
40048
|
-
eventType = chunk.slice(chunk.charCodeAt(start + 6) ===
|
|
40115
|
+
if (isEventPrefix2(chunk, start, firstCharCode)) {
|
|
40116
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE2 ? start + 7 : start + 6, end) || void 0;
|
|
40049
40117
|
return;
|
|
40050
40118
|
}
|
|
40051
40119
|
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
40052
|
-
const value2 = chunk.slice(chunk.charCodeAt(start + 3) ===
|
|
40120
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE2 ? start + 4 : start + 3, end);
|
|
40053
40121
|
id = value2.includes("\0") ? void 0 : value2;
|
|
40054
40122
|
return;
|
|
40055
40123
|
}
|
|
40056
40124
|
if (firstCharCode === 58) {
|
|
40057
40125
|
if (onComment) {
|
|
40058
40126
|
const line2 = chunk.slice(start, end);
|
|
40059
|
-
onComment(line2.slice(chunk.charCodeAt(start + 1) ===
|
|
40127
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE2 ? 2 : 1));
|
|
40060
40128
|
}
|
|
40061
40129
|
return;
|
|
40062
40130
|
}
|
|
@@ -40065,7 +40133,7 @@ ${value2}`, dataLines++;
|
|
|
40065
40133
|
processField(line, "", line);
|
|
40066
40134
|
return;
|
|
40067
40135
|
}
|
|
40068
|
-
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) ===
|
|
40136
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE2 ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
40069
40137
|
processField(field, value, line);
|
|
40070
40138
|
}
|
|
40071
40139
|
function processField(field, value, line) {
|
|
@@ -40115,10 +40183,10 @@ ${value}`, dataLines++;
|
|
|
40115
40183
|
}
|
|
40116
40184
|
return { feed, reset };
|
|
40117
40185
|
}
|
|
40118
|
-
function
|
|
40186
|
+
function isDataPrefix2(chunk, i, firstCharCode) {
|
|
40119
40187
|
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
40120
40188
|
}
|
|
40121
|
-
function
|
|
40189
|
+
function isEventPrefix2(chunk, i, firstCharCode) {
|
|
40122
40190
|
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;
|
|
40123
40191
|
}
|
|
40124
40192
|
var EventSourceParserStream2 = class extends TransformStream {
|
|
@@ -47089,6 +47157,8 @@ var recallTool = (_memoryConfig, options) => {
|
|
|
47089
47157
|
}
|
|
47090
47158
|
});
|
|
47091
47159
|
};
|
|
47160
|
+
var UPDATE_WORKING_MEMORY_TOOL_NAME = "updateWorkingMemory";
|
|
47161
|
+
var SET_WORKING_MEMORY_TOOL_NAME = "setWorkingMemory";
|
|
47092
47162
|
function deepMergeWorkingMemory(existing, update) {
|
|
47093
47163
|
if (!update || typeof update !== "object" || Object.keys(update).length === 0) {
|
|
47094
47164
|
return existing && typeof existing === "object" ? { ...existing } : {};
|
|
@@ -47180,7 +47250,9 @@ var updateWorkingMemoryTool = (memoryConfig) => {
|
|
|
47180
47250
|
};
|
|
47181
47251
|
}
|
|
47182
47252
|
const usesMergeSemantics = Boolean(schema);
|
|
47183
|
-
const
|
|
47253
|
+
const useStateSignals = memoryConfig?.workingMemory?.useStateSignals === true;
|
|
47254
|
+
const stateSignalsPreamble = `The current working memory state is delivered to you each turn by the system inside a <working-memory>...</working-memory> block. That block is system-emitted state, NOT something the user typed \u2014 never describe it as the user sharing it. Read from it directly when answering. Only call this tool when the user provides genuinely NEW or CHANGED facts that should be persisted; do NOT call it to re-save unchanged data.`;
|
|
47255
|
+
const description = schema ? useStateSignals ? `${stateSignalsPreamble} Data is merged with existing memory \u2014 only include fields you want to add or update.` : `Update the working memory with new information. Data is merged with existing memory - only include fields you want to add or update. To preserve existing data, omit the field entirely. Arrays are replaced entirely when provided, so pass the complete array or omit it to keep the existing values.` : useStateSignals ? `${stateSignalsPreamble} Pass the full updated Markdown blob as a string in the memory field.` : `Update the working memory with new information. Any data not included will be overwritten. Always pass data as string to the memory field. Never pass an object.`;
|
|
47184
47256
|
return createTool({
|
|
47185
47257
|
id: "update-working-memory",
|
|
47186
47258
|
description,
|
|
@@ -47359,6 +47431,12 @@ var __experimental_updateWorkingMemoryToolVNext = (config3) => {
|
|
|
47359
47431
|
}
|
|
47360
47432
|
});
|
|
47361
47433
|
};
|
|
47434
|
+
function createWorkingMemoryTool(config3, options = {}) {
|
|
47435
|
+
const useStateSignals = config3.workingMemory?.useStateSignals === true;
|
|
47436
|
+
const tool32 = options.vNext ? __experimental_updateWorkingMemoryToolVNext(config3) : updateWorkingMemoryTool(config3);
|
|
47437
|
+
const name21 = useStateSignals ? SET_WORKING_MEMORY_TOOL_NAME : UPDATE_WORKING_MEMORY_TOOL_NAME;
|
|
47438
|
+
return { name: name21, tool: tool32 };
|
|
47439
|
+
}
|
|
47362
47440
|
var WORKING_MEMORY_START_TAG = "<working_memory>";
|
|
47363
47441
|
var WORKING_MEMORY_END_TAG = "</working_memory>";
|
|
47364
47442
|
var LEGACY_SYSTEM_REMINDER_METADATA_KEY = "dynamicAgentsMdReminder";
|
|
@@ -47463,6 +47541,7 @@ var Memory = class extends MastraMemory {
|
|
|
47463
47541
|
},
|
|
47464
47542
|
observationalMemory: config3.options?.observationalMemory
|
|
47465
47543
|
});
|
|
47544
|
+
this.assertWorkingMemoryStateSignalsCompatibility(mergedConfig);
|
|
47466
47545
|
this.threadConfig = mergedConfig;
|
|
47467
47546
|
const omConfig = normalizeObservationalMemoryConfig(mergedConfig.observationalMemory);
|
|
47468
47547
|
if (omConfig?.retrieval && typeof omConfig.retrieval === "object" && omConfig.retrieval.vector) {
|
|
@@ -47830,6 +47909,7 @@ var Memory = class extends MastraMemory {
|
|
|
47830
47909
|
memoryConfig
|
|
47831
47910
|
}) {
|
|
47832
47911
|
const config3 = this.getMergedThreadConfig(memoryConfig || {});
|
|
47912
|
+
this.assertWorkingMemoryStateSignalsCompatibility(config3);
|
|
47833
47913
|
if (!config3.workingMemory?.enabled) {
|
|
47834
47914
|
throw new Error("Working memory is not enabled for this memory instance");
|
|
47835
47915
|
}
|
|
@@ -48209,9 +48289,13 @@ ${workingMemory}`;
|
|
|
48209
48289
|
memoryConfig
|
|
48210
48290
|
}) {
|
|
48211
48291
|
const config3 = this.getMergedThreadConfig(memoryConfig);
|
|
48292
|
+
this.assertWorkingMemoryStateSignalsCompatibility(config3);
|
|
48212
48293
|
if (!config3.workingMemory?.enabled) {
|
|
48213
48294
|
return null;
|
|
48214
48295
|
}
|
|
48296
|
+
if (config3.workingMemory?.useStateSignals) {
|
|
48297
|
+
return null;
|
|
48298
|
+
}
|
|
48215
48299
|
const workingMemoryTemplate = await this.getWorkingMemoryTemplate({ memoryConfig });
|
|
48216
48300
|
const workingMemoryData = await this.getWorkingMemory({ threadId, resourceId, memoryConfig: config3 });
|
|
48217
48301
|
if (!workingMemoryTemplate) {
|
|
@@ -48273,7 +48357,7 @@ ${workingMemory}`;
|
|
|
48273
48357
|
if (obsSystemMessage) {
|
|
48274
48358
|
systemParts.push(obsSystemMessage);
|
|
48275
48359
|
}
|
|
48276
|
-
const { OBSERVATION_CONTINUATION_HINT } = await import('./constants-
|
|
48360
|
+
const { OBSERVATION_CONTINUATION_HINT } = await import('./constants-DVRTNEGY-A5OAGF3M.js');
|
|
48277
48361
|
continuationMessage = {
|
|
48278
48362
|
id: "om-continuation",
|
|
48279
48363
|
role: "user",
|
|
@@ -48375,7 +48459,7 @@ ${workingMemory}`;
|
|
|
48375
48459
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
48376
48460
|
);
|
|
48377
48461
|
}
|
|
48378
|
-
const { ObservationalMemory: OMClass } = await import('./observational-memory-
|
|
48462
|
+
const { ObservationalMemory: OMClass } = await import('./observational-memory-G52HNRHE-RHA4V77M.js');
|
|
48379
48463
|
const onIndexObservations = this.hasRetrievalSearch(omConfig.retrieval) ? async (observation) => {
|
|
48380
48464
|
await this.indexObservation(observation);
|
|
48381
48465
|
} : void 0;
|
|
@@ -48526,6 +48610,13 @@ Notes:
|
|
|
48526
48610
|
const isMDWorkingMemory = !(`schema` in config3.workingMemory) && (typeof config3.workingMemory.template === `string` || config3.workingMemory.template) && config3.workingMemory;
|
|
48527
48611
|
return Boolean(isMDWorkingMemory && isMDWorkingMemory.version === `vnext`);
|
|
48528
48612
|
}
|
|
48613
|
+
assertWorkingMemoryStateSignalsCompatibility(config3) {
|
|
48614
|
+
if (config3?.workingMemory?.useStateSignals === true && this.isVNextWorkingMemoryConfig(config3)) {
|
|
48615
|
+
throw new Error(
|
|
48616
|
+
"workingMemory.useStateSignals is not supported with workingMemory.version: 'vnext'. Use stable template working memory or disable useStateSignals."
|
|
48617
|
+
);
|
|
48618
|
+
}
|
|
48619
|
+
}
|
|
48529
48620
|
getObservationEmbeddingIndexName(dimensions) {
|
|
48530
48621
|
const defaultDimensions = 384;
|
|
48531
48622
|
const usedDimensions = dimensions ?? defaultDimensions;
|
|
@@ -48727,9 +48818,13 @@ Notes:
|
|
|
48727
48818
|
}
|
|
48728
48819
|
listTools(config3) {
|
|
48729
48820
|
const mergedConfig = this.getMergedThreadConfig(config3);
|
|
48821
|
+
this.assertWorkingMemoryStateSignalsCompatibility(mergedConfig);
|
|
48730
48822
|
const tools = {};
|
|
48731
48823
|
if (mergedConfig.workingMemory?.enabled && !mergedConfig.readOnly) {
|
|
48732
|
-
|
|
48824
|
+
const { name: name21, tool: tool32 } = createWorkingMemoryTool(mergedConfig, {
|
|
48825
|
+
vNext: this.isVNextWorkingMemoryConfig(mergedConfig)
|
|
48826
|
+
});
|
|
48827
|
+
tools[name21] = tool32;
|
|
48733
48828
|
}
|
|
48734
48829
|
const omConfig = normalizeObservationalMemoryConfig(mergedConfig.observationalMemory);
|
|
48735
48830
|
if (omConfig?.retrieval) {
|
|
@@ -49275,6 +49370,10 @@ Notes:
|
|
|
49275
49370
|
if (om) {
|
|
49276
49371
|
processors.push(om);
|
|
49277
49372
|
}
|
|
49373
|
+
const wm = await this.createWorkingMemoryStateProcessor(configuredProcessors, context2);
|
|
49374
|
+
if (wm) {
|
|
49375
|
+
processors.push(wm);
|
|
49376
|
+
}
|
|
49278
49377
|
return processors;
|
|
49279
49378
|
}
|
|
49280
49379
|
/**
|
|
@@ -49312,11 +49411,29 @@ Notes:
|
|
|
49312
49411
|
if (!effectiveConfig) return null;
|
|
49313
49412
|
const engine = await this.omEngine;
|
|
49314
49413
|
if (!engine) return null;
|
|
49315
|
-
const { ObservationalMemoryProcessor } = await import('./observational-memory-
|
|
49414
|
+
const { ObservationalMemoryProcessor } = await import('./observational-memory-G52HNRHE-RHA4V77M.js');
|
|
49316
49415
|
return new ObservationalMemoryProcessor(engine, this, {
|
|
49317
49416
|
temporalMarkers: effectiveConfig.temporalMarkers
|
|
49318
49417
|
});
|
|
49319
49418
|
}
|
|
49419
|
+
/**
|
|
49420
|
+
* Creates a WorkingMemoryStateProcessor when working memory is enabled and the
|
|
49421
|
+
* `useStateSignals` opt-in is set. Returns null otherwise or if the processor
|
|
49422
|
+
* is already present in the user's configured processors.
|
|
49423
|
+
*/
|
|
49424
|
+
async createWorkingMemoryStateProcessor(configuredProcessors = [], context2) {
|
|
49425
|
+
const runtimeMemory = context2?.get("MastraMemory");
|
|
49426
|
+
const mergedConfig = this.getMergedThreadConfig(runtimeMemory?.memoryConfig);
|
|
49427
|
+
this.assertWorkingMemoryStateSignalsCompatibility(mergedConfig);
|
|
49428
|
+
if (!mergedConfig.workingMemory?.enabled) return null;
|
|
49429
|
+
if (!mergedConfig.workingMemory?.useStateSignals) return null;
|
|
49430
|
+
const { WORKING_MEMORY_STATE_PROCESSOR_ID: WORKING_MEMORY_STATE_PROCESSOR_ID2, WorkingMemoryStateProcessor: WorkingMemoryStateProcessor2 } = await import('./working-memory-state-J7ASTNXX-JNDYMEET.js');
|
|
49431
|
+
const alreadyConfigured = configuredProcessors.some(
|
|
49432
|
+
(p) => !("workflow" in p) && p.id === WORKING_MEMORY_STATE_PROCESSOR_ID2
|
|
49433
|
+
);
|
|
49434
|
+
if (alreadyConfigured) return null;
|
|
49435
|
+
return new WorkingMemoryStateProcessor2(this, runtimeMemory?.memoryConfig);
|
|
49436
|
+
}
|
|
49320
49437
|
};
|
|
49321
49438
|
|
|
49322
49439
|
// ../agent-builder/dist/index.js
|
|
@@ -54263,6 +54380,9 @@ var ParseError3 = class extends Error {
|
|
|
54263
54380
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
54264
54381
|
}
|
|
54265
54382
|
};
|
|
54383
|
+
var LF3 = 10;
|
|
54384
|
+
var CR3 = 13;
|
|
54385
|
+
var SPACE3 = 32;
|
|
54266
54386
|
function noop3(_arg) {
|
|
54267
54387
|
}
|
|
54268
54388
|
function createParser3(callbacks) {
|
|
@@ -54270,39 +54390,109 @@ function createParser3(callbacks) {
|
|
|
54270
54390
|
throw new TypeError(
|
|
54271
54391
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
54272
54392
|
);
|
|
54273
|
-
const { onEvent = noop3, onError = noop3, onRetry = noop3, onComment } = callbacks;
|
|
54274
|
-
let
|
|
54275
|
-
function feed(
|
|
54276
|
-
|
|
54277
|
-
|
|
54278
|
-
|
|
54279
|
-
|
|
54280
|
-
|
|
54281
|
-
|
|
54282
|
-
|
|
54393
|
+
const { onEvent = noop3, onError = noop3, onRetry = noop3, onComment } = callbacks, pendingFragments = [];
|
|
54394
|
+
let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
|
|
54395
|
+
function feed(chunk) {
|
|
54396
|
+
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
54397
|
+
const trailing2 = processLines(chunk);
|
|
54398
|
+
trailing2 !== "" && pendingFragments.push(trailing2);
|
|
54399
|
+
return;
|
|
54400
|
+
}
|
|
54401
|
+
if (chunk.indexOf(`
|
|
54402
|
+
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
54403
|
+
pendingFragments.push(chunk);
|
|
54404
|
+
return;
|
|
54405
|
+
}
|
|
54406
|
+
pendingFragments.push(chunk);
|
|
54407
|
+
const input = pendingFragments.join("");
|
|
54408
|
+
pendingFragments.length = 0;
|
|
54409
|
+
const trailing = processLines(input);
|
|
54410
|
+
trailing !== "" && pendingFragments.push(trailing);
|
|
54411
|
+
}
|
|
54412
|
+
function processLines(chunk) {
|
|
54413
|
+
let searchIndex = 0;
|
|
54414
|
+
if (chunk.indexOf("\r") === -1) {
|
|
54415
|
+
let lfIndex = chunk.indexOf(`
|
|
54416
|
+
`, searchIndex);
|
|
54417
|
+
for (; lfIndex !== -1; ) {
|
|
54418
|
+
if (searchIndex === lfIndex) {
|
|
54419
|
+
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
54420
|
+
`, searchIndex);
|
|
54421
|
+
continue;
|
|
54422
|
+
}
|
|
54423
|
+
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
54424
|
+
if (isDataPrefix3(chunk, searchIndex, firstCharCode)) {
|
|
54425
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE3 ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
54426
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF3) {
|
|
54427
|
+
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
54428
|
+
`, searchIndex);
|
|
54429
|
+
continue;
|
|
54430
|
+
}
|
|
54431
|
+
data = dataLines === 0 ? value : `${data}
|
|
54432
|
+
${value}`, dataLines++;
|
|
54433
|
+
} else isEventPrefix3(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
54434
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE3 ? searchIndex + 7 : searchIndex + 6,
|
|
54435
|
+
lfIndex
|
|
54436
|
+
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
54437
|
+
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
54438
|
+
`, searchIndex);
|
|
54439
|
+
}
|
|
54440
|
+
return chunk.slice(searchIndex);
|
|
54441
|
+
}
|
|
54442
|
+
for (; searchIndex < chunk.length; ) {
|
|
54443
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
54444
|
+
`, searchIndex);
|
|
54445
|
+
let lineEnd = -1;
|
|
54446
|
+
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)
|
|
54447
|
+
break;
|
|
54448
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR3 && chunk.charCodeAt(searchIndex) === LF3 && searchIndex++;
|
|
54449
|
+
}
|
|
54450
|
+
return chunk.slice(searchIndex);
|
|
54451
|
+
}
|
|
54452
|
+
function parseLine(chunk, start, end) {
|
|
54453
|
+
if (start === end) {
|
|
54283
54454
|
dispatchEvent();
|
|
54284
54455
|
return;
|
|
54285
54456
|
}
|
|
54286
|
-
|
|
54287
|
-
|
|
54457
|
+
const firstCharCode = chunk.charCodeAt(start);
|
|
54458
|
+
if (isDataPrefix3(chunk, start, firstCharCode)) {
|
|
54459
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE3 ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
54460
|
+
data = dataLines === 0 ? value2 : `${data}
|
|
54461
|
+
${value2}`, dataLines++;
|
|
54288
54462
|
return;
|
|
54289
54463
|
}
|
|
54290
|
-
|
|
54291
|
-
|
|
54292
|
-
const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
54293
|
-
processField(field, value, line);
|
|
54464
|
+
if (isEventPrefix3(chunk, start, firstCharCode)) {
|
|
54465
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE3 ? start + 7 : start + 6, end) || void 0;
|
|
54294
54466
|
return;
|
|
54295
54467
|
}
|
|
54296
|
-
|
|
54468
|
+
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
54469
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE3 ? start + 4 : start + 3, end);
|
|
54470
|
+
id = value2.includes("\0") ? void 0 : value2;
|
|
54471
|
+
return;
|
|
54472
|
+
}
|
|
54473
|
+
if (firstCharCode === 58) {
|
|
54474
|
+
if (onComment) {
|
|
54475
|
+
const line2 = chunk.slice(start, end);
|
|
54476
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE3 ? 2 : 1));
|
|
54477
|
+
}
|
|
54478
|
+
return;
|
|
54479
|
+
}
|
|
54480
|
+
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
54481
|
+
if (fieldSeparatorIndex === -1) {
|
|
54482
|
+
processField(line, "", line);
|
|
54483
|
+
return;
|
|
54484
|
+
}
|
|
54485
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE3 ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
54486
|
+
processField(field, value, line);
|
|
54297
54487
|
}
|
|
54298
54488
|
function processField(field, value, line) {
|
|
54299
54489
|
switch (field) {
|
|
54300
54490
|
case "event":
|
|
54301
|
-
eventType = value;
|
|
54491
|
+
eventType = value || void 0;
|
|
54302
54492
|
break;
|
|
54303
54493
|
case "data":
|
|
54304
|
-
data = `${data}
|
|
54305
|
-
|
|
54494
|
+
data = dataLines === 0 ? value : `${data}
|
|
54495
|
+
${value}`, dataLines++;
|
|
54306
54496
|
break;
|
|
54307
54497
|
case "id":
|
|
54308
54498
|
id = value.includes("\0") ? void 0 : value;
|
|
@@ -54327,37 +54517,26 @@ function createParser3(callbacks) {
|
|
|
54327
54517
|
}
|
|
54328
54518
|
}
|
|
54329
54519
|
function dispatchEvent() {
|
|
54330
|
-
|
|
54520
|
+
dataLines > 0 && onEvent({
|
|
54331
54521
|
id,
|
|
54332
|
-
event: eventType
|
|
54333
|
-
|
|
54334
|
-
|
|
54335
|
-
data: data.endsWith(`
|
|
54336
|
-
`) ? data.slice(0, -1) : data
|
|
54337
|
-
}), id = void 0, data = "", eventType = "";
|
|
54522
|
+
event: eventType,
|
|
54523
|
+
data
|
|
54524
|
+
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
54338
54525
|
}
|
|
54339
54526
|
function reset(options = {}) {
|
|
54340
|
-
|
|
54527
|
+
if (options.consume && pendingFragments.length > 0) {
|
|
54528
|
+
const incompleteLine = pendingFragments.join("");
|
|
54529
|
+
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
54530
|
+
}
|
|
54531
|
+
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
|
|
54341
54532
|
}
|
|
54342
54533
|
return { feed, reset };
|
|
54343
54534
|
}
|
|
54344
|
-
function
|
|
54345
|
-
|
|
54346
|
-
|
|
54347
|
-
|
|
54348
|
-
|
|
54349
|
-
`, searchIndex);
|
|
54350
|
-
let lineEnd = -1;
|
|
54351
|
-
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) {
|
|
54352
|
-
incompleteLine = chunk.slice(searchIndex);
|
|
54353
|
-
break;
|
|
54354
|
-
} else {
|
|
54355
|
-
const line = chunk.slice(searchIndex, lineEnd);
|
|
54356
|
-
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
54357
|
-
` && searchIndex++;
|
|
54358
|
-
}
|
|
54359
|
-
}
|
|
54360
|
-
return [lines, incompleteLine];
|
|
54535
|
+
function isDataPrefix3(chunk, i, firstCharCode) {
|
|
54536
|
+
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
54537
|
+
}
|
|
54538
|
+
function isEventPrefix3(chunk, i, firstCharCode) {
|
|
54539
|
+
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;
|
|
54361
54540
|
}
|
|
54362
54541
|
var EventSourceParserStream3 = class extends TransformStream {
|
|
54363
54542
|
constructor({ onError, onRetry, onComment } = {}) {
|
|
@@ -60153,5 +60332,5 @@ var agentBuilderWorkflows = {
|
|
|
60153
60332
|
};
|
|
60154
60333
|
|
|
60155
60334
|
export { AgentBuilder, AgentBuilderDefaults, agentBuilderTemplateWorkflow, agentBuilderWorkflows, mergeTemplateBySlug, planningAndApprovalWorkflow, workflowBuilderWorkflow };
|
|
60156
|
-
//# sourceMappingURL=dist-
|
|
60157
|
-
//# sourceMappingURL=dist-
|
|
60335
|
+
//# sourceMappingURL=dist-LWX2CRMH.js.map
|
|
60336
|
+
//# sourceMappingURL=dist-LWX2CRMH.js.map
|