@mastra/core 1.23.1-alpha.0 → 1.24.0-alpha.1
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 +71 -0
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/adapters/AIV5Adapter.d.ts.map +1 -1
- package/dist/agent/message-list/conversion/input-converter.d.ts.map +1 -1
- package/dist/agent/message-list/index.cjs +19 -19
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/agent/message-list/state/types.d.ts +7 -4
- package/dist/agent/message-list/state/types.d.ts.map +1 -1
- package/dist/agent/message-list/utils/stamp-part.d.ts +4 -0
- package/dist/agent/message-list/utils/stamp-part.d.ts.map +1 -0
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/channels/index.cjs +4 -4
- package/dist/channels/index.js +1 -1
- package/dist/{chunk-LB3GO6MV.js → chunk-234T424F.js} +5 -5
- package/dist/{chunk-LB3GO6MV.js.map → chunk-234T424F.js.map} +1 -1
- package/dist/{chunk-WCQOOGVM.cjs → chunk-365PDOQ4.cjs} +9 -9
- package/dist/{chunk-WCQOOGVM.cjs.map → chunk-365PDOQ4.cjs.map} +1 -1
- package/dist/{chunk-N7W2KRUH.js → chunk-3RI7ILBW.js} +3 -3
- package/dist/{chunk-N7W2KRUH.js.map → chunk-3RI7ILBW.js.map} +1 -1
- package/dist/{chunk-B4OOPFD3.cjs → chunk-4FFOOHE5.cjs} +27 -2
- package/dist/chunk-4FFOOHE5.cjs.map +1 -0
- package/dist/{chunk-S2546L42.js → chunk-7BBERBXP.js} +6 -6
- package/dist/{chunk-S2546L42.js.map → chunk-7BBERBXP.js.map} +1 -1
- package/dist/{chunk-BG3IPQZ7.cjs → chunk-B2FQ6L2I.cjs} +21 -21
- package/dist/{chunk-BG3IPQZ7.cjs.map → chunk-B2FQ6L2I.cjs.map} +1 -1
- package/dist/{chunk-UNQCLA7I.cjs → chunk-BFOZOAU2.cjs} +54 -26
- package/dist/chunk-BFOZOAU2.cjs.map +1 -0
- package/dist/{chunk-JC2RW3N5.js → chunk-CN6AFOVV.js} +4 -4
- package/dist/{chunk-JC2RW3N5.js.map → chunk-CN6AFOVV.js.map} +1 -1
- package/dist/{chunk-IAUQYADS.cjs → chunk-CY4AMNDV.cjs} +7 -7
- package/dist/{chunk-IAUQYADS.cjs.map → chunk-CY4AMNDV.cjs.map} +1 -1
- package/dist/{chunk-MW6HBUMV.cjs → chunk-D64ZY3NT.cjs} +29 -27
- package/dist/chunk-D64ZY3NT.cjs.map +1 -0
- package/dist/{chunk-JVXQTSRU.js → chunk-E7PBOS66.js} +3 -3
- package/dist/{chunk-JVXQTSRU.js.map → chunk-E7PBOS66.js.map} +1 -1
- package/dist/{chunk-GBUKRAUU.cjs → chunk-EAQQP6OK.cjs} +75 -75
- package/dist/{chunk-GBUKRAUU.cjs.map → chunk-EAQQP6OK.cjs.map} +1 -1
- package/dist/chunk-EGIEQEHP.js +35 -0
- package/dist/chunk-EGIEQEHP.js.map +1 -0
- package/dist/{chunk-C3RGHCOG.js → chunk-EJ62D3QH.js} +7 -7
- package/dist/{chunk-C3RGHCOG.js.map → chunk-EJ62D3QH.js.map} +1 -1
- package/dist/{chunk-J5JND5CL.cjs → chunk-FCW225T4.cjs} +84 -84
- package/dist/{chunk-J5JND5CL.cjs.map → chunk-FCW225T4.cjs.map} +1 -1
- package/dist/{chunk-OVQVLGT2.cjs → chunk-FLMCO42Y.cjs} +4 -4
- package/dist/{chunk-OVQVLGT2.cjs.map → chunk-FLMCO42Y.cjs.map} +1 -1
- package/dist/{chunk-RNKRA4W6.js → chunk-GAW7WFCY.js} +6 -6
- package/dist/{chunk-RNKRA4W6.js.map → chunk-GAW7WFCY.js.map} +1 -1
- package/dist/{chunk-7CWIKWHN.js → chunk-I7DUPZFN.js} +90 -43
- package/dist/chunk-I7DUPZFN.js.map +1 -0
- package/dist/{chunk-HMVCVSAM.js → chunk-IKUMKFM4.js} +5 -5
- package/dist/{chunk-HMVCVSAM.js.map → chunk-IKUMKFM4.js.map} +1 -1
- package/dist/{chunk-YTLU3Q7Q.js → chunk-JBFAGOAG.js} +13 -11
- package/dist/chunk-JBFAGOAG.js.map +1 -0
- package/dist/{chunk-6WRVZNQL.cjs → chunk-L56725IW.cjs} +7 -2
- package/dist/chunk-L56725IW.cjs.map +1 -0
- package/dist/{chunk-FDSY7ZGW.cjs → chunk-L73KZFX6.cjs} +10 -10
- package/dist/{chunk-FDSY7ZGW.cjs.map → chunk-L73KZFX6.cjs.map} +1 -1
- package/dist/{chunk-QX5YBALM.js → chunk-LUEXY2QV.js} +3 -3
- package/dist/{chunk-QX5YBALM.js.map → chunk-LUEXY2QV.js.map} +1 -1
- package/dist/{chunk-235IILEY.js → chunk-MD3VGE3F.js} +7 -2
- package/dist/chunk-MD3VGE3F.js.map +1 -0
- package/dist/{chunk-Q2RTFBSF.js → chunk-MK5IF24D.js} +8 -8
- package/dist/{chunk-Q2RTFBSF.js.map → chunk-MK5IF24D.js.map} +1 -1
- package/dist/{chunk-PJ5YCHXB.js → chunk-MZJQ7OKW.js} +3 -3
- package/dist/{chunk-PJ5YCHXB.js.map → chunk-MZJQ7OKW.js.map} +1 -1
- package/dist/{chunk-3UBTJXPW.cjs → chunk-P5C4HEAB.cjs} +32 -32
- package/dist/{chunk-3UBTJXPW.cjs.map → chunk-P5C4HEAB.cjs.map} +1 -1
- package/dist/{chunk-AMQICJHD.js → chunk-PCHML5XO.js} +11 -11
- package/dist/{chunk-AMQICJHD.js.map → chunk-PCHML5XO.js.map} +1 -1
- package/dist/{chunk-4LJ4M2DI.js → chunk-PQKSETS5.js} +3 -3
- package/dist/{chunk-4LJ4M2DI.js.map → chunk-PQKSETS5.js.map} +1 -1
- package/dist/{chunk-PHSDY5MP.cjs → chunk-QFGYBEP3.cjs} +10 -10
- package/dist/{chunk-PHSDY5MP.cjs.map → chunk-QFGYBEP3.cjs.map} +1 -1
- package/dist/{chunk-2M6QAFRM.cjs → chunk-RJAOQKHJ.cjs} +90 -43
- package/dist/chunk-RJAOQKHJ.cjs.map +1 -0
- package/dist/{chunk-WXCT24DY.cjs → chunk-SRQR5UN6.cjs} +27 -27
- package/dist/{chunk-WXCT24DY.cjs.map → chunk-SRQR5UN6.cjs.map} +1 -1
- package/dist/{chunk-7OU57YXD.cjs → chunk-SUEVJYTA.cjs} +185 -185
- package/dist/{chunk-7OU57YXD.cjs.map → chunk-SUEVJYTA.cjs.map} +1 -1
- package/dist/{chunk-LYCAEN2H.cjs → chunk-SYH64AGV.cjs} +219 -219
- package/dist/{chunk-LYCAEN2H.cjs.map → chunk-SYH64AGV.cjs.map} +1 -1
- package/dist/{chunk-ZHMULBPD.js → chunk-V2HSN7VZ.js} +26 -3
- package/dist/chunk-V2HSN7VZ.js.map +1 -0
- package/dist/{chunk-KPNURYWF.js → chunk-V657RNGK.js} +42 -14
- package/dist/chunk-V657RNGK.js.map +1 -0
- package/dist/{chunk-JGPMCTG4.cjs → chunk-XEDVYHBK.cjs} +3 -3
- package/dist/{chunk-JGPMCTG4.cjs.map → chunk-XEDVYHBK.cjs.map} +1 -1
- package/dist/{chunk-CLNGCSHU.cjs → chunk-XEM4OYJI.cjs} +15 -15
- package/dist/{chunk-CLNGCSHU.cjs.map → chunk-XEM4OYJI.cjs.map} +1 -1
- package/dist/{chunk-QG5JWMFX.cjs → chunk-XS3FHQ34.cjs} +11 -11
- package/dist/{chunk-QG5JWMFX.cjs.map → chunk-XS3FHQ34.cjs.map} +1 -1
- package/dist/{chunk-STZTHX32.js → chunk-XS75QEED.js} +5 -5
- package/dist/{chunk-STZTHX32.js.map → chunk-XS75QEED.js.map} +1 -1
- package/dist/{chunk-5OXVECLF.js → chunk-Y4SL4WJQ.js} +3 -3
- package/dist/{chunk-5OXVECLF.js.map → chunk-Y4SL4WJQ.js.map} +1 -1
- package/dist/chunk-ZPHI6QAA.cjs +40 -0
- package/dist/chunk-ZPHI6QAA.cjs.map +1 -0
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +450 -450
- package/dist/docs/references/reference-observability-tracing-configuration.md +8 -1
- package/dist/docs/references/reference-observability-tracing-span-filtering.md +95 -0
- package/dist/docs/references/reference.md +1 -0
- package/dist/evals/index.cjs +23 -23
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +7 -7
- package/dist/evals/scoreTraces/index.js +3 -3
- package/dist/harness/index.cjs +9 -9
- package/dist/harness/index.js +6 -6
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/llm/index.cjs +20 -20
- package/dist/llm/index.js +5 -5
- package/dist/llm/model/provider-types.generated.d.ts +11 -1
- package/dist/logger/index.cjs +6 -6
- package/dist/logger/index.js +1 -1
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/mastra-5YHFXAJO.js +3 -0
- package/dist/{mastra-JWFZL5TC.js.map → mastra-5YHFXAJO.js.map} +1 -1
- package/dist/mastra-7CFH7DGM.cjs +12 -0
- package/dist/{mastra-ZQK3PKEU.cjs.map → mastra-7CFH7DGM.cjs.map} +1 -1
- package/dist/memory/index.cjs +19 -19
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-X2MWNPAU.cjs +12 -0
- package/dist/{models-dev-6DVNVKP4.cjs.map → models-dev-X2MWNPAU.cjs.map} +1 -1
- package/dist/models-dev-ZXC3IYLG.js +3 -0
- package/dist/{models-dev-FOTHHSEK.js.map → models-dev-ZXC3IYLG.js.map} +1 -1
- package/dist/netlify-GOILLTQO.cjs +12 -0
- package/dist/{netlify-S2IW3O2X.cjs.map → netlify-GOILLTQO.cjs.map} +1 -1
- package/dist/netlify-HJL7EXHY.js +3 -0
- package/dist/{netlify-NMTX7SVL.js.map → netlify-HJL7EXHY.js.map} +1 -1
- package/dist/observability/context-storage.cjs +18 -28
- package/dist/observability/context-storage.cjs.map +1 -1
- package/dist/observability/context-storage.d.ts +9 -0
- package/dist/observability/context-storage.d.ts.map +1 -1
- package/dist/observability/context-storage.js +1 -28
- package/dist/observability/context-storage.js.map +1 -1
- package/dist/observability/index.cjs +33 -25
- package/dist/observability/index.d.ts +2 -0
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +3 -3
- package/dist/observability/rag-ingestion.d.ts +108 -0
- package/dist/observability/rag-ingestion.d.ts.map +1 -0
- package/dist/observability/types/core.d.ts +31 -1
- package/dist/observability/types/core.d.ts.map +1 -1
- package/dist/observability/types/tracing.d.ts +133 -1
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +44 -44
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry-25ELOB67.cjs +44 -0
- package/dist/{provider-registry-7WS3N5BF.cjs.map → provider-registry-25ELOB67.cjs.map} +1 -1
- package/dist/provider-registry-UWTCPEFF.js +3 -0
- package/dist/{provider-registry-YADLRYW6.js.map → provider-registry-UWTCPEFF.js.map} +1 -1
- package/dist/provider-registry.json +34 -6
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/storage/constants.cjs +56 -56
- package/dist/storage/constants.js +1 -1
- package/dist/storage/index.cjs +286 -286
- package/dist/storage/index.js +3 -3
- package/dist/stream/index.cjs +11 -11
- package/dist/stream/index.js +2 -2
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/utils.cjs +25 -25
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +7 -7
- package/dist/vector/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/package.json +5 -5
- package/src/llm/model/provider-types.generated.d.ts +11 -1
- package/dist/chunk-235IILEY.js.map +0 -1
- package/dist/chunk-2M6QAFRM.cjs.map +0 -1
- package/dist/chunk-6WRVZNQL.cjs.map +0 -1
- package/dist/chunk-7CWIKWHN.js.map +0 -1
- package/dist/chunk-B4OOPFD3.cjs.map +0 -1
- package/dist/chunk-KPNURYWF.js.map +0 -1
- package/dist/chunk-MW6HBUMV.cjs.map +0 -1
- package/dist/chunk-UNQCLA7I.cjs.map +0 -1
- package/dist/chunk-YTLU3Q7Q.js.map +0 -1
- package/dist/chunk-ZHMULBPD.js.map +0 -1
- package/dist/mastra-JWFZL5TC.js +0 -3
- package/dist/mastra-ZQK3PKEU.cjs +0 -12
- package/dist/models-dev-6DVNVKP4.cjs +0 -12
- package/dist/models-dev-FOTHHSEK.js +0 -3
- package/dist/netlify-NMTX7SVL.js +0 -3
- package/dist/netlify-S2IW3O2X.cjs +0 -12
- package/dist/provider-registry-7WS3N5BF.cjs +0 -44
- package/dist/provider-registry-YADLRYW6.js +0 -3
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
4
4
|
var chunkRAD2NM47_cjs = require('./chunk-RAD2NM47.cjs');
|
|
5
5
|
var chunkRNJ2FXGD_cjs = require('./chunk-RNJ2FXGD.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkSRQR5UN6_cjs = require('./chunk-SRQR5UN6.cjs');
|
|
7
|
+
var chunkRJAOQKHJ_cjs = require('./chunk-RJAOQKHJ.cjs');
|
|
8
8
|
var chunkY3APFUXZ_cjs = require('./chunk-Y3APFUXZ.cjs');
|
|
9
9
|
var chunkCFMZZDO2_cjs = require('./chunk-CFMZZDO2.cjs');
|
|
10
|
-
var chunkOVQVLGT2_cjs = require('./chunk-OVQVLGT2.cjs');
|
|
11
10
|
var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
|
|
12
11
|
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
12
|
+
var chunkFCW225T4_cjs = require('./chunk-FCW225T4.cjs');
|
|
13
|
+
var chunkXEM4OYJI_cjs = require('./chunk-XEM4OYJI.cjs');
|
|
14
|
+
var chunkFLMCO42Y_cjs = require('./chunk-FLMCO42Y.cjs');
|
|
15
|
+
var chunkXS3FHQ34_cjs = require('./chunk-XS3FHQ34.cjs');
|
|
16
|
+
var chunk4FFOOHE5_cjs = require('./chunk-4FFOOHE5.cjs');
|
|
16
17
|
var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
|
|
17
18
|
var chunkLDLHW3QN_cjs = require('./chunk-LDLHW3QN.cjs');
|
|
18
19
|
var chunkXB4FLS7A_cjs = require('./chunk-XB4FLS7A.cjs');
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var chunk6WRVZNQL_cjs = require('./chunk-6WRVZNQL.cjs');
|
|
20
|
+
var chunkQFGYBEP3_cjs = require('./chunk-QFGYBEP3.cjs');
|
|
21
|
+
var chunkL56725IW_cjs = require('./chunk-L56725IW.cjs');
|
|
22
22
|
var chunk5WBEMKE2_cjs = require('./chunk-5WBEMKE2.cjs');
|
|
23
23
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
24
24
|
var chunkFCQNDFEW_cjs = require('./chunk-FCQNDFEW.cjs');
|
|
@@ -804,7 +804,7 @@ var StructuredOutputProcessor = class {
|
|
|
804
804
|
}
|
|
805
805
|
async processOutputStream(args) {
|
|
806
806
|
const { part, state, streamParts, abort, ...rest } = args;
|
|
807
|
-
const observabilityContext =
|
|
807
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
808
808
|
const controller = state.controller;
|
|
809
809
|
switch (part.type) {
|
|
810
810
|
case "finish":
|
|
@@ -1101,7 +1101,7 @@ var ProcessorState = class {
|
|
|
1101
1101
|
this.span = parentSpan?.createChildSpan({
|
|
1102
1102
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1103
1103
|
name: `output stream processor: ${options.processorName}`,
|
|
1104
|
-
entityType:
|
|
1104
|
+
entityType: chunkL56725IW_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
1105
1105
|
entityName: options.processorName,
|
|
1106
1106
|
attributes: {
|
|
1107
1107
|
processorExecutor: "legacy",
|
|
@@ -1278,7 +1278,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1278
1278
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1279
1279
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1280
1280
|
name: `output processor: ${processor.id}`,
|
|
1281
|
-
entityType:
|
|
1281
|
+
entityType: chunkL56725IW_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
1282
1282
|
entityId: processor.id,
|
|
1283
1283
|
entityName: processor.name,
|
|
1284
1284
|
attributes: {
|
|
@@ -1302,13 +1302,13 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1302
1302
|
state: processorState.customState,
|
|
1303
1303
|
result: result ?? defaultResult,
|
|
1304
1304
|
abort,
|
|
1305
|
-
...
|
|
1305
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1306
1306
|
requestContext,
|
|
1307
1307
|
retryCount,
|
|
1308
1308
|
writer
|
|
1309
1309
|
});
|
|
1310
1310
|
const mutations = messageList.stopRecording();
|
|
1311
|
-
if (processResult instanceof
|
|
1311
|
+
if (processResult instanceof chunkRJAOQKHJ_cjs.MessageList) {
|
|
1312
1312
|
if (processResult !== messageList) {
|
|
1313
1313
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1314
1314
|
category: "USER",
|
|
@@ -1435,7 +1435,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1435
1435
|
abort: (reason, options) => {
|
|
1436
1436
|
throw new TripWire(reason || `Stream part blocked by ${processor.id}`, options, processor.id);
|
|
1437
1437
|
},
|
|
1438
|
-
...
|
|
1438
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: state.span }),
|
|
1439
1439
|
requestContext,
|
|
1440
1440
|
messageList,
|
|
1441
1441
|
retryCount,
|
|
@@ -1578,7 +1578,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1578
1578
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1579
1579
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1580
1580
|
name: `input processor: ${processor.id}`,
|
|
1581
|
-
entityType:
|
|
1581
|
+
entityType: chunkL56725IW_cjs.EntityType.INPUT_PROCESSOR,
|
|
1582
1582
|
entityId: processor.id,
|
|
1583
1583
|
entityName: processor.name,
|
|
1584
1584
|
attributes: {
|
|
@@ -1596,13 +1596,13 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1596
1596
|
systemMessages: currentSystemMessages,
|
|
1597
1597
|
state: processorState.customState,
|
|
1598
1598
|
abort,
|
|
1599
|
-
...
|
|
1599
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1600
1600
|
messageList,
|
|
1601
1601
|
requestContext,
|
|
1602
1602
|
retryCount
|
|
1603
1603
|
});
|
|
1604
1604
|
let mutations;
|
|
1605
|
-
if (result instanceof
|
|
1605
|
+
if (result instanceof chunkRJAOQKHJ_cjs.MessageList) {
|
|
1606
1606
|
if (result !== messageList) {
|
|
1607
1607
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1608
1608
|
category: "USER",
|
|
@@ -1706,7 +1706,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1706
1706
|
*/
|
|
1707
1707
|
async runProcessInputStep(args) {
|
|
1708
1708
|
const { messageList, stepNumber, steps, requestContext, writer } = args;
|
|
1709
|
-
const observabilityContext =
|
|
1709
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(args);
|
|
1710
1710
|
const stepInput = {
|
|
1711
1711
|
messageId: args.messageId,
|
|
1712
1712
|
tools: args.tools,
|
|
@@ -1777,7 +1777,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1777
1777
|
const processorSpan = currentSpan?.createChildSpan({
|
|
1778
1778
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1779
1779
|
name: `input step processor: ${processor.id}`,
|
|
1780
|
-
entityType:
|
|
1780
|
+
entityType: chunkL56725IW_cjs.EntityType.INPUT_STEP_PROCESSOR,
|
|
1781
1781
|
entityId: processor.id,
|
|
1782
1782
|
entityName: processor.name,
|
|
1783
1783
|
attributes: {
|
|
@@ -1808,7 +1808,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1808
1808
|
return nextMessageId;
|
|
1809
1809
|
}
|
|
1810
1810
|
} : {},
|
|
1811
|
-
...
|
|
1811
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1812
1812
|
retryCount: args.retryCount ?? 0,
|
|
1813
1813
|
writer,
|
|
1814
1814
|
abortSignal: args.abortSignal
|
|
@@ -1902,7 +1902,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1902
1902
|
retryCount = 0,
|
|
1903
1903
|
writer
|
|
1904
1904
|
} = args;
|
|
1905
|
-
const observabilityContext =
|
|
1905
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(args);
|
|
1906
1906
|
for (const [index, processorOrWorkflow] of this.outputProcessors.entries()) {
|
|
1907
1907
|
const processableMessages = messageList.get.all.db();
|
|
1908
1908
|
const idsBeforeProcessing = processableMessages.map((m) => m.id);
|
|
@@ -1942,7 +1942,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1942
1942
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1943
1943
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1944
1944
|
name: `output step processor: ${processor.id}`,
|
|
1945
|
-
entityType:
|
|
1945
|
+
entityType: chunkL56725IW_cjs.EntityType.OUTPUT_STEP_PROCESSOR,
|
|
1946
1946
|
entityId: processor.id,
|
|
1947
1947
|
entityName: processor.name,
|
|
1948
1948
|
attributes: {
|
|
@@ -1966,13 +1966,13 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1966
1966
|
steps,
|
|
1967
1967
|
state: processorState.customState,
|
|
1968
1968
|
abort,
|
|
1969
|
-
...
|
|
1969
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1970
1970
|
requestContext,
|
|
1971
1971
|
retryCount,
|
|
1972
1972
|
writer
|
|
1973
1973
|
});
|
|
1974
1974
|
const mutations = messageList.stopRecording();
|
|
1975
|
-
if (result instanceof
|
|
1975
|
+
if (result instanceof chunkRJAOQKHJ_cjs.MessageList) {
|
|
1976
1976
|
if (result !== messageList) {
|
|
1977
1977
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
1978
1978
|
category: "USER",
|
|
@@ -2044,7 +2044,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
2044
2044
|
processor,
|
|
2045
2045
|
stepNumber
|
|
2046
2046
|
}) {
|
|
2047
|
-
if (result instanceof
|
|
2047
|
+
if (result instanceof chunkRJAOQKHJ_cjs.MessageList) {
|
|
2048
2048
|
if (result !== messageList) {
|
|
2049
2049
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
2050
2050
|
category: "USER",
|
|
@@ -2079,7 +2079,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
2079
2079
|
}
|
|
2080
2080
|
const { model: _model, ...rest } = result;
|
|
2081
2081
|
if (result.model) {
|
|
2082
|
-
const resolvedModel = await
|
|
2082
|
+
const resolvedModel = await chunkFCW225T4_cjs.resolveModelConfig(result.model);
|
|
2083
2083
|
const isSupported = isSupportedLanguageModel(resolvedModel);
|
|
2084
2084
|
if (!isSupported) {
|
|
2085
2085
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -2824,7 +2824,7 @@ var MastraModelOutput = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
2824
2824
|
this.#transportRef = options.transportRef;
|
|
2825
2825
|
this.#returnScorerData = !!options.returnScorerData;
|
|
2826
2826
|
this.runId = options.runId;
|
|
2827
|
-
const resultSpan =
|
|
2827
|
+
const resultSpan = chunkQFGYBEP3_cjs.getRootExportSpan(options.tracingContext?.currentSpan);
|
|
2828
2828
|
this.traceId = resultSpan?.externalTraceId;
|
|
2829
2829
|
this.spanId = resultSpan?.id;
|
|
2830
2830
|
this.#model = _model;
|
|
@@ -2886,7 +2886,7 @@ var MastraModelOutput = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
2886
2886
|
} = await processorRunner.processPart(
|
|
2887
2887
|
chunk,
|
|
2888
2888
|
processorStates,
|
|
2889
|
-
|
|
2889
|
+
chunk4FFOOHE5_cjs.resolveObservabilityContext(options),
|
|
2890
2890
|
options.requestContext,
|
|
2891
2891
|
self.messageList,
|
|
2892
2892
|
0,
|
|
@@ -3279,7 +3279,7 @@ var MastraModelOutput = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
3279
3279
|
};
|
|
3280
3280
|
self.messageList = await self.processorRunner.runOutputProcessors(
|
|
3281
3281
|
self.messageList,
|
|
3282
|
-
|
|
3282
|
+
chunk4FFOOHE5_cjs.resolveObservabilityContext(options),
|
|
3283
3283
|
self.#options.requestContext,
|
|
3284
3284
|
0,
|
|
3285
3285
|
outputResultWriter,
|
|
@@ -3287,7 +3287,7 @@ var MastraModelOutput = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
3287
3287
|
);
|
|
3288
3288
|
const responseMessages = self.messageList.get.response.aiV4.core();
|
|
3289
3289
|
const lastResponseMessage = responseMessages[responseMessages.length - 1];
|
|
3290
|
-
const outputText = lastResponseMessage ?
|
|
3290
|
+
const outputText = lastResponseMessage ? chunkRJAOQKHJ_cjs.coreContentToString(lastResponseMessage.content) : "";
|
|
3291
3291
|
if (lastStep && outputText && outputText !== originalText) {
|
|
3292
3292
|
lastStep.text = outputText;
|
|
3293
3293
|
}
|
|
@@ -4669,13 +4669,13 @@ function convertMastraChunkToAISDKv5({
|
|
|
4669
4669
|
case "file": {
|
|
4670
4670
|
const filePart = mode === "generate" ? {
|
|
4671
4671
|
type: "file",
|
|
4672
|
-
file: new
|
|
4672
|
+
file: new chunkRJAOQKHJ_cjs.DefaultGeneratedFile({
|
|
4673
4673
|
data: chunk.payload.data,
|
|
4674
4674
|
mediaType: chunk.payload.mimeType
|
|
4675
4675
|
})
|
|
4676
4676
|
} : {
|
|
4677
4677
|
type: "file",
|
|
4678
|
-
file: new
|
|
4678
|
+
file: new chunkRJAOQKHJ_cjs.DefaultGeneratedFileWithType({
|
|
4679
4679
|
data: chunk.payload.data,
|
|
4680
4680
|
mediaType: chunk.payload.mimeType
|
|
4681
4681
|
})
|
|
@@ -4867,7 +4867,7 @@ var getModelOutputForTripwire = async ({
|
|
|
4867
4867
|
messageList,
|
|
4868
4868
|
...rest
|
|
4869
4869
|
}) => {
|
|
4870
|
-
const observabilityContext =
|
|
4870
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
4871
4871
|
const tripwireStream = new web.ReadableStream({
|
|
4872
4872
|
start(controller) {
|
|
4873
4873
|
controller.enqueue({
|
|
@@ -6800,7 +6800,7 @@ var createTimeTravelExecutionParams = (params) => {
|
|
|
6800
6800
|
result = void 0;
|
|
6801
6801
|
}
|
|
6802
6802
|
if (result) {
|
|
6803
|
-
const formattedResult =
|
|
6803
|
+
const formattedResult = chunkXS3FHQ34_cjs.removeUndefinedValues(result);
|
|
6804
6804
|
stepResults[stepId] = formattedResult;
|
|
6805
6805
|
}
|
|
6806
6806
|
});
|
|
@@ -6892,7 +6892,7 @@ async function executeParallel(engine, params) {
|
|
|
6892
6892
|
perStep,
|
|
6893
6893
|
...rest
|
|
6894
6894
|
} = params;
|
|
6895
|
-
const observabilityContext =
|
|
6895
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
6896
6896
|
const parallelSpan = await engine.createChildSpan({
|
|
6897
6897
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
6898
6898
|
operationId: `workflow.${workflowId}.run.${runId}.parallel.${executionContext.executionPath.join("-")}.span.start`,
|
|
@@ -6970,7 +6970,7 @@ async function executeParallel(engine, params) {
|
|
|
6970
6970
|
state: executionContext.state,
|
|
6971
6971
|
tracingIds: executionContext.tracingIds
|
|
6972
6972
|
},
|
|
6973
|
-
...
|
|
6973
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: parallelSpan }),
|
|
6974
6974
|
pubsub,
|
|
6975
6975
|
abortController,
|
|
6976
6976
|
requestContext,
|
|
@@ -7046,7 +7046,7 @@ async function executeConditional(engine, params) {
|
|
|
7046
7046
|
perStep,
|
|
7047
7047
|
...rest
|
|
7048
7048
|
} = params;
|
|
7049
|
-
const observabilityContext =
|
|
7049
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
7050
7050
|
const conditionalSpan = await engine.createChildSpan({
|
|
7051
7051
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
7052
7052
|
operationId: `workflow.${workflowId}.run.${runId}.conditional.${executionContext.executionPath.join("-")}.span.start`,
|
|
@@ -7088,7 +7088,7 @@ async function executeConditional(engine, params) {
|
|
|
7088
7088
|
inputData: prevOutput,
|
|
7089
7089
|
state: executionContext.state,
|
|
7090
7090
|
retryCount: -1,
|
|
7091
|
-
...
|
|
7091
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: evalSpan }),
|
|
7092
7092
|
getInitData: () => stepResults?.input,
|
|
7093
7093
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
7094
7094
|
bail: (() => {
|
|
@@ -7209,7 +7209,7 @@ async function executeConditional(engine, params) {
|
|
|
7209
7209
|
state: executionContext.state,
|
|
7210
7210
|
tracingIds: executionContext.tracingIds
|
|
7211
7211
|
},
|
|
7212
|
-
...
|
|
7212
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: conditionalSpan }),
|
|
7213
7213
|
pubsub,
|
|
7214
7214
|
abortController,
|
|
7215
7215
|
requestContext,
|
|
@@ -7286,7 +7286,7 @@ async function executeLoop(engine, params) {
|
|
|
7286
7286
|
perStep,
|
|
7287
7287
|
...rest
|
|
7288
7288
|
} = params;
|
|
7289
|
-
const observabilityContext =
|
|
7289
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
7290
7290
|
const { step, condition } = entry;
|
|
7291
7291
|
const loopSpan = await engine.createChildSpan({
|
|
7292
7292
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -7322,7 +7322,7 @@ async function executeLoop(engine, params) {
|
|
|
7322
7322
|
resume: currentResume,
|
|
7323
7323
|
timeTravel: currentTimeTravel,
|
|
7324
7324
|
prevOutput: result.output,
|
|
7325
|
-
...
|
|
7325
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: loopSpan }),
|
|
7326
7326
|
pubsub,
|
|
7327
7327
|
abortController,
|
|
7328
7328
|
requestContext,
|
|
@@ -7358,7 +7358,7 @@ async function executeLoop(engine, params) {
|
|
|
7358
7358
|
options: {
|
|
7359
7359
|
type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
|
|
7360
7360
|
name: `condition: '${entry.loopType}'`,
|
|
7361
|
-
input:
|
|
7361
|
+
input: chunkXS3FHQ34_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
|
|
7362
7362
|
attributes: {
|
|
7363
7363
|
conditionIndex: iteration
|
|
7364
7364
|
},
|
|
@@ -7376,7 +7376,7 @@ async function executeLoop(engine, params) {
|
|
|
7376
7376
|
inputData: result.output,
|
|
7377
7377
|
state: executionContext.state,
|
|
7378
7378
|
retryCount: -1,
|
|
7379
|
-
...
|
|
7379
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: evalSpan }),
|
|
7380
7380
|
iterationCount: iteration + 1,
|
|
7381
7381
|
getInitData: () => stepResults?.input,
|
|
7382
7382
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
@@ -7448,7 +7448,7 @@ async function executeForeach(engine, params) {
|
|
|
7448
7448
|
perStep,
|
|
7449
7449
|
...rest
|
|
7450
7450
|
} = params;
|
|
7451
|
-
const observabilityContext =
|
|
7451
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
7452
7452
|
const { step, opts } = entry;
|
|
7453
7453
|
const results = [];
|
|
7454
7454
|
const concurrency = opts.concurrency;
|
|
@@ -7524,7 +7524,7 @@ async function executeForeach(engine, params) {
|
|
|
7524
7524
|
executionContext: { ...executionContext, foreachIndex: k },
|
|
7525
7525
|
resume: resumeToUse,
|
|
7526
7526
|
prevOutput: item,
|
|
7527
|
-
...
|
|
7527
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: loopSpan }),
|
|
7528
7528
|
pubsub,
|
|
7529
7529
|
abortController,
|
|
7530
7530
|
requestContext,
|
|
@@ -7811,7 +7811,7 @@ async function executeEntry(engine, params) {
|
|
|
7811
7811
|
perStep,
|
|
7812
7812
|
...rest
|
|
7813
7813
|
} = params;
|
|
7814
|
-
const observabilityContext =
|
|
7814
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
7815
7815
|
const prevOutput = engine.getStepOutput(stepResults, prevStep);
|
|
7816
7816
|
let execResults;
|
|
7817
7817
|
let entryRequestContext;
|
|
@@ -8284,7 +8284,7 @@ async function executeSleep(engine, params) {
|
|
|
8284
8284
|
outputWriter,
|
|
8285
8285
|
...rest
|
|
8286
8286
|
} = params;
|
|
8287
|
-
const observabilityContext =
|
|
8287
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
8288
8288
|
let { duration, fn } = entry;
|
|
8289
8289
|
const sleepSpan = await engine.createChildSpan({
|
|
8290
8290
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -8313,7 +8313,7 @@ async function executeSleep(engine, params) {
|
|
|
8313
8313
|
executionContext.state = state;
|
|
8314
8314
|
},
|
|
8315
8315
|
retryCount: -1,
|
|
8316
|
-
...
|
|
8316
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: sleepSpan }),
|
|
8317
8317
|
getInitData: () => stepResults?.input,
|
|
8318
8318
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
8319
8319
|
// TODO: this function shouldn't have suspend probably?
|
|
@@ -8374,7 +8374,7 @@ async function executeSleepUntil(engine, params) {
|
|
|
8374
8374
|
outputWriter,
|
|
8375
8375
|
...rest
|
|
8376
8376
|
} = params;
|
|
8377
|
-
const observabilityContext =
|
|
8377
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
8378
8378
|
let { date, fn } = entry;
|
|
8379
8379
|
const sleepUntilSpan = await engine.createChildSpan({
|
|
8380
8380
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -8404,7 +8404,7 @@ async function executeSleepUntil(engine, params) {
|
|
|
8404
8404
|
executionContext.state = state;
|
|
8405
8405
|
},
|
|
8406
8406
|
retryCount: -1,
|
|
8407
|
-
...
|
|
8407
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: sleepUntilSpan }),
|
|
8408
8408
|
getInitData: () => stepResults?.input,
|
|
8409
8409
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
8410
8410
|
// TODO: this function shouldn't have suspend probably?
|
|
@@ -8483,7 +8483,7 @@ async function executeStep(engine, params) {
|
|
|
8483
8483
|
perStep,
|
|
8484
8484
|
...rest
|
|
8485
8485
|
} = params;
|
|
8486
|
-
const observabilityContext =
|
|
8486
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
8487
8487
|
const stepCallId = crypto2.randomUUID();
|
|
8488
8488
|
const { inputData, validationError: inputValidationError } = await validateStepInput({
|
|
8489
8489
|
prevOutput,
|
|
@@ -8534,7 +8534,7 @@ async function executeStep(engine, params) {
|
|
|
8534
8534
|
options: {
|
|
8535
8535
|
name: `workflow step: '${step.id}'`,
|
|
8536
8536
|
type: "workflow_step" /* WORKFLOW_STEP */,
|
|
8537
|
-
entityType:
|
|
8537
|
+
entityType: chunkL56725IW_cjs.EntityType.WORKFLOW_STEP,
|
|
8538
8538
|
entityId: step.id,
|
|
8539
8539
|
input: inputData,
|
|
8540
8540
|
tracingPolicy: engine.options?.tracingPolicy,
|
|
@@ -8622,7 +8622,7 @@ async function executeStep(engine, params) {
|
|
|
8622
8622
|
deprecationMessage: runCountDeprecationMessage,
|
|
8623
8623
|
logger: engine.getLogger()
|
|
8624
8624
|
});
|
|
8625
|
-
return
|
|
8625
|
+
return chunkQFGYBEP3_cjs.executeWithContext({ span: stepSpan, fn: () => step.execute(proxiedData) });
|
|
8626
8626
|
};
|
|
8627
8627
|
let execResults;
|
|
8628
8628
|
const retries = step.retries ?? executionContext.retryConfig.attempts ?? 0;
|
|
@@ -8647,7 +8647,7 @@ async function executeStep(engine, params) {
|
|
|
8647
8647
|
requestContextUpdate: null
|
|
8648
8648
|
};
|
|
8649
8649
|
const isNestedWorkflow = step.component === "WORKFLOW";
|
|
8650
|
-
const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra :
|
|
8650
|
+
const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra : chunk4FFOOHE5_cjs.wrapMastra(engine.mastra, { currentSpan: stepSpan }) : void 0;
|
|
8651
8651
|
const output = await runStep({
|
|
8652
8652
|
runId,
|
|
8653
8653
|
resourceId,
|
|
@@ -8670,7 +8670,7 @@ async function executeStep(engine, params) {
|
|
|
8670
8670
|
retryCount,
|
|
8671
8671
|
resumeData: resumeDataToUse,
|
|
8672
8672
|
suspendData: suspendDataToUse,
|
|
8673
|
-
...
|
|
8673
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: stepSpan }),
|
|
8674
8674
|
getInitData: () => stepResults?.input,
|
|
8675
8675
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
8676
8676
|
suspend: async (suspendPayload, suspendOptions) => {
|
|
@@ -8772,7 +8772,7 @@ async function executeStep(engine, params) {
|
|
|
8772
8772
|
stepId: step.id,
|
|
8773
8773
|
requestContext,
|
|
8774
8774
|
disableScorers,
|
|
8775
|
-
...
|
|
8775
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: stepSpan })
|
|
8776
8776
|
});
|
|
8777
8777
|
}
|
|
8778
8778
|
if (durableResult.suspended) {
|
|
@@ -8828,7 +8828,7 @@ async function executeStep(engine, params) {
|
|
|
8828
8828
|
}
|
|
8829
8829
|
async function runScorersForStep(params) {
|
|
8830
8830
|
const { engine, scorers, runId, input, output, workflowId, stepId, requestContext, disableScorers, ...rest } = params;
|
|
8831
|
-
const observabilityContext =
|
|
8831
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
8832
8832
|
let scorersToUse = scorers;
|
|
8833
8833
|
if (typeof scorersToUse === "function") {
|
|
8834
8834
|
try {
|
|
@@ -9401,7 +9401,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
9401
9401
|
resume,
|
|
9402
9402
|
timeTravel,
|
|
9403
9403
|
restart,
|
|
9404
|
-
...
|
|
9404
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: workflowSpan }),
|
|
9405
9405
|
abortController: params.abortController,
|
|
9406
9406
|
pubsub: params.pubsub,
|
|
9407
9407
|
requestContext: currentRequestContext,
|
|
@@ -9707,7 +9707,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
|
|
|
9707
9707
|
writer,
|
|
9708
9708
|
...rest
|
|
9709
9709
|
}) => {
|
|
9710
|
-
const observabilityContext =
|
|
9710
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
9711
9711
|
let streamPromise = {};
|
|
9712
9712
|
streamPromise.promise = new Promise((resolve2, reject) => {
|
|
9713
9713
|
streamPromise.resolve = resolve2;
|
|
@@ -9835,7 +9835,7 @@ function createStepFromTool(params, toolOpts) {
|
|
|
9835
9835
|
setState,
|
|
9836
9836
|
...rest
|
|
9837
9837
|
}) => {
|
|
9838
|
-
const observabilityContext =
|
|
9838
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
9839
9839
|
const toolContext = {
|
|
9840
9840
|
mastra,
|
|
9841
9841
|
requestContext,
|
|
@@ -9859,16 +9859,16 @@ function createStepFromProcessor(processor) {
|
|
|
9859
9859
|
const getProcessorEntityType = (phase) => {
|
|
9860
9860
|
switch (phase) {
|
|
9861
9861
|
case "input":
|
|
9862
|
-
return
|
|
9862
|
+
return chunkL56725IW_cjs.EntityType.INPUT_PROCESSOR;
|
|
9863
9863
|
case "inputStep":
|
|
9864
|
-
return
|
|
9864
|
+
return chunkL56725IW_cjs.EntityType.INPUT_STEP_PROCESSOR;
|
|
9865
9865
|
case "outputStream":
|
|
9866
9866
|
case "outputResult":
|
|
9867
|
-
return
|
|
9867
|
+
return chunkL56725IW_cjs.EntityType.OUTPUT_PROCESSOR;
|
|
9868
9868
|
case "outputStep":
|
|
9869
|
-
return
|
|
9869
|
+
return chunkL56725IW_cjs.EntityType.OUTPUT_STEP_PROCESSOR;
|
|
9870
9870
|
default:
|
|
9871
|
-
return
|
|
9871
|
+
return chunkL56725IW_cjs.EntityType.OUTPUT_PROCESSOR;
|
|
9872
9872
|
}
|
|
9873
9873
|
};
|
|
9874
9874
|
const getSpanNamePrefix = (phase) => {
|
|
@@ -9966,7 +9966,7 @@ function createStepFromProcessor(processor) {
|
|
|
9966
9966
|
processorIndex: processor.processorIndex
|
|
9967
9967
|
}
|
|
9968
9968
|
}) : void 0;
|
|
9969
|
-
const processorObservabilityContext =
|
|
9969
|
+
const processorObservabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext(
|
|
9970
9970
|
processorSpan ? { currentSpan: processorSpan } : tracingContext
|
|
9971
9971
|
);
|
|
9972
9972
|
const processorWriter = outputWriter ? {
|
|
@@ -10000,7 +10000,7 @@ function createStepFromProcessor(processor) {
|
|
|
10000
10000
|
phase,
|
|
10001
10001
|
// Auto-create MessageList from messages if not provided
|
|
10002
10002
|
// This enables running processor workflows from the UI where messageList can't be serialized
|
|
10003
|
-
messageList: messageList ?? (Array.isArray(messages) ? new
|
|
10003
|
+
messageList: messageList ?? (Array.isArray(messages) ? new chunkRJAOQKHJ_cjs.MessageList().add(messages, "input").addSystem(systemMessages ?? []) : void 0),
|
|
10004
10004
|
stepNumber,
|
|
10005
10005
|
systemMessages,
|
|
10006
10006
|
streamParts,
|
|
@@ -10024,7 +10024,7 @@ function createStepFromProcessor(processor) {
|
|
|
10024
10024
|
};
|
|
10025
10025
|
const executePhaseWithSpan = async (fn) => {
|
|
10026
10026
|
try {
|
|
10027
|
-
const result = await
|
|
10027
|
+
const result = await chunkQFGYBEP3_cjs.executeWithContext({ span: processorSpan, fn });
|
|
10028
10028
|
processorSpan?.end({ output: result });
|
|
10029
10029
|
return result;
|
|
10030
10030
|
} catch (error) {
|
|
@@ -10057,7 +10057,7 @@ function createStepFromProcessor(processor) {
|
|
|
10057
10057
|
messageList: checkedMessageList,
|
|
10058
10058
|
systemMessages: systemMessages ?? []
|
|
10059
10059
|
});
|
|
10060
|
-
if (result instanceof
|
|
10060
|
+
if (result instanceof chunkRJAOQKHJ_cjs.MessageList) {
|
|
10061
10061
|
if (result !== checkedMessageList) {
|
|
10062
10062
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
10063
10063
|
category: "USER" /* USER */,
|
|
@@ -10168,7 +10168,7 @@ function createStepFromProcessor(processor) {
|
|
|
10168
10168
|
processorSpan2 = parentSpan.createChildSpan({
|
|
10169
10169
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
10170
10170
|
name: `output stream processor: ${processor.id}`,
|
|
10171
|
-
entityType:
|
|
10171
|
+
entityType: chunkL56725IW_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
10172
10172
|
entityId: processor.id,
|
|
10173
10173
|
entityName: processor.name ?? processor.id,
|
|
10174
10174
|
input: { phase, totalChunks: 0 },
|
|
@@ -10185,7 +10185,7 @@ function createStepFromProcessor(processor) {
|
|
|
10185
10185
|
totalChunks: (streamParts ?? []).length
|
|
10186
10186
|
};
|
|
10187
10187
|
}
|
|
10188
|
-
const processorObservabilityContext2 =
|
|
10188
|
+
const processorObservabilityContext2 = chunk4FFOOHE5_cjs.createObservabilityContext(
|
|
10189
10189
|
processorSpan2 ? { currentSpan: processorSpan2 } : baseContext.tracingContext
|
|
10190
10190
|
);
|
|
10191
10191
|
let result;
|
|
@@ -10240,7 +10240,7 @@ function createStepFromProcessor(processor) {
|
|
|
10240
10240
|
messageList: passThrough.messageList,
|
|
10241
10241
|
result: passThrough.result ?? defaultResult
|
|
10242
10242
|
});
|
|
10243
|
-
if (result instanceof
|
|
10243
|
+
if (result instanceof chunkRJAOQKHJ_cjs.MessageList) {
|
|
10244
10244
|
if (result !== passThrough.messageList) {
|
|
10245
10245
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
10246
10246
|
category: "USER" /* USER */,
|
|
@@ -10307,7 +10307,7 @@ function createStepFromProcessor(processor) {
|
|
|
10307
10307
|
systemMessages: systemMessages ?? [],
|
|
10308
10308
|
steps: steps ?? []
|
|
10309
10309
|
});
|
|
10310
|
-
if (result instanceof
|
|
10310
|
+
if (result instanceof chunkRJAOQKHJ_cjs.MessageList) {
|
|
10311
10311
|
if (result !== checkedMessageList) {
|
|
10312
10312
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
10313
10313
|
category: "USER" /* USER */,
|
|
@@ -10931,7 +10931,7 @@ var Workflow = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
10931
10931
|
bail: _bail,
|
|
10932
10932
|
...rest
|
|
10933
10933
|
}) {
|
|
10934
|
-
const observabilityContext =
|
|
10934
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
10935
10935
|
this.__registerMastra(mastra);
|
|
10936
10936
|
const effectiveValidateInputs = validateInputs ?? this.#options.validateInputs ?? true;
|
|
10937
10937
|
this.#options = {
|
|
@@ -11429,11 +11429,11 @@ var Run = class {
|
|
|
11429
11429
|
perStep,
|
|
11430
11430
|
...rest
|
|
11431
11431
|
}) {
|
|
11432
|
-
const observabilityContext =
|
|
11433
|
-
const workflowSpan =
|
|
11432
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
11433
|
+
const workflowSpan = chunkQFGYBEP3_cjs.getOrCreateSpan({
|
|
11434
11434
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
11435
11435
|
name: `workflow run: '${this.workflowId}'`,
|
|
11436
|
-
entityType:
|
|
11436
|
+
entityType: chunkL56725IW_cjs.EntityType.WORKFLOW_RUN,
|
|
11437
11437
|
entityId: this.workflowId,
|
|
11438
11438
|
entityName: this.workflowId,
|
|
11439
11439
|
input: inputData,
|
|
@@ -11511,7 +11511,7 @@ var Run = class {
|
|
|
11511
11511
|
tracingOptions,
|
|
11512
11512
|
...rest
|
|
11513
11513
|
} = {}) {
|
|
11514
|
-
const observabilityContext =
|
|
11514
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
11515
11515
|
if (this.closeStreamAction) {
|
|
11516
11516
|
return {
|
|
11517
11517
|
stream: this.observeStreamLegacy().stream,
|
|
@@ -11636,7 +11636,7 @@ var Run = class {
|
|
|
11636
11636
|
perStep,
|
|
11637
11637
|
...rest
|
|
11638
11638
|
}) {
|
|
11639
|
-
const observabilityContext =
|
|
11639
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
11640
11640
|
if (this.closeStreamAction && this.streamOutput) {
|
|
11641
11641
|
return this.streamOutput;
|
|
11642
11642
|
}
|
|
@@ -11737,7 +11737,7 @@ var Run = class {
|
|
|
11737
11737
|
perStep,
|
|
11738
11738
|
...rest
|
|
11739
11739
|
} = {}) {
|
|
11740
|
-
const observabilityContext =
|
|
11740
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
11741
11741
|
this.closeStreamAction = async () => {
|
|
11742
11742
|
};
|
|
11743
11743
|
const self = this;
|
|
@@ -11866,7 +11866,7 @@ var Run = class {
|
|
|
11866
11866
|
return this._restart(args);
|
|
11867
11867
|
}
|
|
11868
11868
|
async _resume(params) {
|
|
11869
|
-
const observabilityContext =
|
|
11869
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(params);
|
|
11870
11870
|
const workflowsStore = await this.#mastra?.getStorage()?.getStore("workflows");
|
|
11871
11871
|
const snapshot = await workflowsStore?.loadWorkflowSnapshot({
|
|
11872
11872
|
workflowName: this.workflowId,
|
|
@@ -11950,10 +11950,10 @@ var Run = class {
|
|
|
11950
11950
|
traceId: effectiveTraceId,
|
|
11951
11951
|
parentSpanId: shouldUsePersistedParentSpan ? persistedTracingContext?.spanId : params.tracingOptions?.parentSpanId
|
|
11952
11952
|
};
|
|
11953
|
-
const workflowSpan =
|
|
11953
|
+
const workflowSpan = chunkQFGYBEP3_cjs.getOrCreateSpan({
|
|
11954
11954
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
11955
11955
|
name: `workflow run: '${this.workflowId}' (resumed)`,
|
|
11956
|
-
entityType:
|
|
11956
|
+
entityType: chunkL56725IW_cjs.EntityType.WORKFLOW_RUN,
|
|
11957
11957
|
entityId: this.workflowId,
|
|
11958
11958
|
entityName: this.workflowId,
|
|
11959
11959
|
input: resumeDataToUse,
|
|
@@ -12018,7 +12018,7 @@ var Run = class {
|
|
|
12018
12018
|
tracingOptions,
|
|
12019
12019
|
...rest
|
|
12020
12020
|
}) {
|
|
12021
|
-
const observabilityContext =
|
|
12021
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
12022
12022
|
if (this.workflowEngineType !== "default") {
|
|
12023
12023
|
throw new Error(`restart() is not supported on ${this.workflowEngineType} workflows`);
|
|
12024
12024
|
}
|
|
@@ -12070,10 +12070,10 @@ var Run = class {
|
|
|
12070
12070
|
requestContextToUse.set(key, value);
|
|
12071
12071
|
}
|
|
12072
12072
|
}
|
|
12073
|
-
const workflowSpan =
|
|
12073
|
+
const workflowSpan = chunkQFGYBEP3_cjs.getOrCreateSpan({
|
|
12074
12074
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
12075
12075
|
name: `workflow run: '${this.workflowId}'`,
|
|
12076
|
-
entityType:
|
|
12076
|
+
entityType: chunkL56725IW_cjs.EntityType.WORKFLOW_RUN,
|
|
12077
12077
|
entityId: this.workflowId,
|
|
12078
12078
|
entityName: this.workflowId,
|
|
12079
12079
|
metadata: {
|
|
@@ -12124,7 +12124,7 @@ var Run = class {
|
|
|
12124
12124
|
perStep,
|
|
12125
12125
|
...rest
|
|
12126
12126
|
}) {
|
|
12127
|
-
const observabilityContext =
|
|
12127
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
12128
12128
|
if (!stepParam || Array.isArray(stepParam) && stepParam.length === 0) {
|
|
12129
12129
|
throw new Error("Step is required and must be a valid step or array of steps");
|
|
12130
12130
|
}
|
|
@@ -12168,11 +12168,11 @@ var Run = class {
|
|
|
12168
12168
|
requestContextToUse.set(key, value);
|
|
12169
12169
|
}
|
|
12170
12170
|
}
|
|
12171
|
-
const workflowSpan =
|
|
12171
|
+
const workflowSpan = chunkQFGYBEP3_cjs.getOrCreateSpan({
|
|
12172
12172
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
12173
12173
|
name: `workflow run: '${this.workflowId}'`,
|
|
12174
12174
|
input: inputData,
|
|
12175
|
-
entityType:
|
|
12175
|
+
entityType: chunkL56725IW_cjs.EntityType.WORKFLOW_RUN,
|
|
12176
12176
|
entityId: this.workflowId,
|
|
12177
12177
|
entityName: this.workflowId,
|
|
12178
12178
|
metadata: {
|
|
@@ -12227,7 +12227,7 @@ var Run = class {
|
|
|
12227
12227
|
perStep,
|
|
12228
12228
|
...rest
|
|
12229
12229
|
}) {
|
|
12230
|
-
const observabilityContext =
|
|
12230
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
12231
12231
|
this.closeStreamAction = async () => {
|
|
12232
12232
|
};
|
|
12233
12233
|
const self = this;
|
|
@@ -12547,10 +12547,10 @@ var MastraScorer = class _MastraScorer {
|
|
|
12547
12547
|
runId = crypto2.randomUUID();
|
|
12548
12548
|
}
|
|
12549
12549
|
const normalizedRequestContext = this.normalizeRunRequestContext(input.requestContext);
|
|
12550
|
-
const evalSpan =
|
|
12550
|
+
const evalSpan = chunkQFGYBEP3_cjs.getOrCreateSpan({
|
|
12551
12551
|
type: "scorer_run" /* SCORER_RUN */,
|
|
12552
12552
|
name: `scorer run: '${this.id}'`,
|
|
12553
|
-
entityType:
|
|
12553
|
+
entityType: chunkL56725IW_cjs.EntityType.SCORER,
|
|
12554
12554
|
entityId: this.id,
|
|
12555
12555
|
input: {
|
|
12556
12556
|
input: input.input,
|
|
@@ -12578,7 +12578,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12578
12578
|
runId,
|
|
12579
12579
|
...evalSpan?.traceId ? { scoreTraceId: evalSpan.traceId } : {}
|
|
12580
12580
|
};
|
|
12581
|
-
const scorerObservabilityContext =
|
|
12581
|
+
const scorerObservabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: evalSpan });
|
|
12582
12582
|
let workflow;
|
|
12583
12583
|
let workflowRun;
|
|
12584
12584
|
try {
|
|
@@ -12590,7 +12590,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12590
12590
|
}
|
|
12591
12591
|
let workflowResult;
|
|
12592
12592
|
try {
|
|
12593
|
-
workflowResult = await
|
|
12593
|
+
workflowResult = await chunkQFGYBEP3_cjs.executeWithContext({
|
|
12594
12594
|
span: evalSpan,
|
|
12595
12595
|
fn: () => workflowRun.start({
|
|
12596
12596
|
inputData: {
|
|
@@ -12687,7 +12687,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12687
12687
|
inputSchema: v4.z.any(),
|
|
12688
12688
|
outputSchema: v4.z.any(),
|
|
12689
12689
|
execute: async ({ inputData, getInitData, ...rest }) => {
|
|
12690
|
-
const observabilityContext =
|
|
12690
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
12691
12691
|
const { accumulatedResults = {}, generatedPrompts = {} } = inputData;
|
|
12692
12692
|
const { run } = getInitData();
|
|
12693
12693
|
const context = this.createScorerContext(scorerStep.name, run, accumulatedResults);
|
|
@@ -12696,7 +12696,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12696
12696
|
const stepSpan = scorerRunSpan?.createChildSpan({
|
|
12697
12697
|
type: "scorer_step" /* SCORER_STEP */,
|
|
12698
12698
|
name: `scorer step: '${scorerStep.name}'`,
|
|
12699
|
-
entityType:
|
|
12699
|
+
entityType: chunkL56725IW_cjs.EntityType.SCORER,
|
|
12700
12700
|
entityId: this.config.id ?? this.config.name,
|
|
12701
12701
|
input: context,
|
|
12702
12702
|
attributes: {
|
|
@@ -12704,7 +12704,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12704
12704
|
stepType: scorerStep.isPromptObject ? "prompt" : "function"
|
|
12705
12705
|
}
|
|
12706
12706
|
});
|
|
12707
|
-
const stepObservabilityContext =
|
|
12707
|
+
const stepObservabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: stepSpan });
|
|
12708
12708
|
const executionContext = {
|
|
12709
12709
|
...context,
|
|
12710
12710
|
...stepObservabilityContext
|
|
@@ -12713,7 +12713,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12713
12713
|
let prompt;
|
|
12714
12714
|
let judgeModel;
|
|
12715
12715
|
try {
|
|
12716
|
-
await
|
|
12716
|
+
await chunkQFGYBEP3_cjs.executeWithContext({
|
|
12717
12717
|
span: stepSpan,
|
|
12718
12718
|
fn: async () => {
|
|
12719
12719
|
if (scorerStep.isPromptObject) {
|
|
@@ -12781,7 +12781,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12781
12781
|
validateInputs: false
|
|
12782
12782
|
}
|
|
12783
12783
|
});
|
|
12784
|
-
workflow.__setLogger(this.#mastra?.getLogger() ??
|
|
12784
|
+
workflow.__setLogger(this.#mastra?.getLogger() ?? chunkFLMCO42Y_cjs.noopLogger);
|
|
12785
12785
|
let chainedWorkflow = workflow;
|
|
12786
12786
|
for (const step of workflowSteps) {
|
|
12787
12787
|
chainedWorkflow = chainedWorkflow.then(step);
|
|
@@ -12818,7 +12818,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
12818
12818
|
}
|
|
12819
12819
|
});
|
|
12820
12820
|
}
|
|
12821
|
-
const resolvedModel = await
|
|
12821
|
+
const resolvedModel = await chunkFCW225T4_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
|
|
12822
12822
|
const judgeModel = resolvedModel.modelId;
|
|
12823
12823
|
const judge = new Agent({
|
|
12824
12824
|
id: "judge",
|
|
@@ -13049,7 +13049,7 @@ async function runDefaultCompletionCheck(agent, context, streamContext, abortSig
|
|
|
13049
13049
|
Primitives already executed: ${completedPrimitives.join(", ")}` : "";
|
|
13050
13050
|
const completionPrompt = `
|
|
13051
13051
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} has contributed to the task.
|
|
13052
|
-
This is the result: ${
|
|
13052
|
+
This is the result: ${chunkXS3FHQ34_cjs.safeStringify(context.primitiveResult)}
|
|
13053
13053
|
|
|
13054
13054
|
${completedSection}
|
|
13055
13055
|
|
|
@@ -13145,7 +13145,7 @@ async function generateFinalResult(agent, context, streamContext, abortSignal, o
|
|
|
13145
13145
|
Original task: ${context.originalTask}
|
|
13146
13146
|
|
|
13147
13147
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
|
|
13148
|
-
${
|
|
13148
|
+
${chunkXS3FHQ34_cjs.safeStringify(context.primitiveResult)}
|
|
13149
13149
|
|
|
13150
13150
|
IMPORTANT: If the above result is from an AGENT PRIMITIVE and it is a suitable final result itself considering the original task, then finalResult should be an empty string or undefined.
|
|
13151
13151
|
You should evaluate if the above result is comprehensive enough to accomplish the user's original task.
|
|
@@ -13203,7 +13203,7 @@ async function generateStructuredFinalResult(agent, context, structuredOutputOpt
|
|
|
13203
13203
|
Original task: ${context.originalTask}
|
|
13204
13204
|
|
|
13205
13205
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
|
|
13206
|
-
${
|
|
13206
|
+
${chunkXS3FHQ34_cjs.safeStringify(context.primitiveResult)}
|
|
13207
13207
|
|
|
13208
13208
|
Based on the task and result above, generate a structured response according to the provided schema.
|
|
13209
13209
|
Use the conversation history and primitive results to craft the response.
|
|
@@ -14248,7 +14248,7 @@ function createLLMExecutionStep({
|
|
|
14248
14248
|
const processInputStepResult = await processorRunner.runProcessInputStep({
|
|
14249
14249
|
messageList,
|
|
14250
14250
|
stepNumber: inputData.output?.steps?.length || 0,
|
|
14251
|
-
...
|
|
14251
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext(stepTracingContext),
|
|
14252
14252
|
requestContext,
|
|
14253
14253
|
model,
|
|
14254
14254
|
steps: inputData.output?.steps || [],
|
|
@@ -14302,7 +14302,7 @@ function createLLMExecutionStep({
|
|
|
14302
14302
|
const convertedTools = {};
|
|
14303
14303
|
for (const [name, tool2] of Object.entries(currentStep.tools)) {
|
|
14304
14304
|
if (chunkLDLHW3QN_cjs.isMastraTool(tool2)) {
|
|
14305
|
-
convertedTools[name] =
|
|
14305
|
+
convertedTools[name] = chunkXS3FHQ34_cjs.makeCoreTool(
|
|
14306
14306
|
tool2,
|
|
14307
14307
|
{
|
|
14308
14308
|
name,
|
|
@@ -14444,7 +14444,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
14444
14444
|
}
|
|
14445
14445
|
}
|
|
14446
14446
|
if (isSupportedLanguageModel(currentStep.model)) {
|
|
14447
|
-
modelResult =
|
|
14447
|
+
modelResult = chunkQFGYBEP3_cjs.executeWithContextSync({
|
|
14448
14448
|
span: modelSpanTracker?.getTracingContext()?.currentSpan,
|
|
14449
14449
|
fn: () => execute({
|
|
14450
14450
|
runId,
|
|
@@ -14524,7 +14524,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
14524
14524
|
}
|
|
14525
14525
|
});
|
|
14526
14526
|
let transportResolver;
|
|
14527
|
-
if (currentStep.model instanceof
|
|
14527
|
+
if (currentStep.model instanceof chunkFCW225T4_cjs.ModelRouterLanguageModel) {
|
|
14528
14528
|
const routerModel = currentStep.model;
|
|
14529
14529
|
transportResolver = () => routerModel._getStreamTransport();
|
|
14530
14530
|
}
|
|
@@ -14687,7 +14687,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
14687
14687
|
finishReason: immediateFinishReason,
|
|
14688
14688
|
toolCalls: toolCallInfos.length > 0 ? toolCallInfos : void 0,
|
|
14689
14689
|
text: immediateText,
|
|
14690
|
-
...
|
|
14690
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext(outputStepTracingContext),
|
|
14691
14691
|
requestContext,
|
|
14692
14692
|
retryCount: currentRetryCount,
|
|
14693
14693
|
writer: processorWriter
|
|
@@ -14807,7 +14807,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
14807
14807
|
agentName: "LLMMappingStep",
|
|
14808
14808
|
processorStates: rest.processorStates
|
|
14809
14809
|
}) : void 0;
|
|
14810
|
-
const observabilityContext =
|
|
14810
|
+
const observabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
|
|
14811
14811
|
const streamWriter = rest.outputWriter ? { custom: async (data) => rest.outputWriter(data) } : void 0;
|
|
14812
14812
|
async function processAndEnqueueChunk(chunk) {
|
|
14813
14813
|
if (processorRunner && rest.processorStates) {
|
|
@@ -14891,7 +14891,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
14891
14891
|
toolInvocation: {
|
|
14892
14892
|
state: "result",
|
|
14893
14893
|
toolCallId: toolCall.toolCallId,
|
|
14894
|
-
toolName:
|
|
14894
|
+
toolName: chunkRJAOQKHJ_cjs.sanitizeToolName(toolCall.toolName),
|
|
14895
14895
|
args: toolCall.args,
|
|
14896
14896
|
result: toolCall.error?.message ?? toolCall.error
|
|
14897
14897
|
},
|
|
@@ -14926,7 +14926,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
14926
14926
|
toolInvocation: {
|
|
14927
14927
|
state: "result",
|
|
14928
14928
|
toolCallId: toolCall.toolCallId,
|
|
14929
|
-
toolName:
|
|
14929
|
+
toolName: chunkRJAOQKHJ_cjs.sanitizeToolName(toolCall.toolName),
|
|
14930
14930
|
args: toolCall.args,
|
|
14931
14931
|
result: toolCall.result
|
|
14932
14932
|
},
|
|
@@ -14983,7 +14983,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
14983
14983
|
toolInvocation: {
|
|
14984
14984
|
state: "result",
|
|
14985
14985
|
toolCallId: toolCall.toolCallId,
|
|
14986
|
-
toolName:
|
|
14986
|
+
toolName: chunkRJAOQKHJ_cjs.sanitizeToolName(toolCall.toolName),
|
|
14987
14987
|
args: toolCall.args,
|
|
14988
14988
|
result: toolCall.result
|
|
14989
14989
|
},
|
|
@@ -15423,7 +15423,7 @@ function createToolCallStep({
|
|
|
15423
15423
|
}
|
|
15424
15424
|
}
|
|
15425
15425
|
const rawResult = await tool2.execute(args, toolOptions);
|
|
15426
|
-
const result =
|
|
15426
|
+
const result = chunkXS3FHQ34_cjs.ensureSerializable(rawResult);
|
|
15427
15427
|
if (tool2 && "onOutput" in tool2 && typeof tool2.onOutput === "function") {
|
|
15428
15428
|
try {
|
|
15429
15429
|
await tool2.onOutput({
|
|
@@ -15886,12 +15886,12 @@ function workflowLoopStream({
|
|
|
15886
15886
|
}
|
|
15887
15887
|
const executionResult = resumeContext ? await run.resume({
|
|
15888
15888
|
resumeData: resumeContext.resumeData,
|
|
15889
|
-
...
|
|
15889
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
|
|
15890
15890
|
requestContext,
|
|
15891
15891
|
label: toolCallId
|
|
15892
15892
|
}) : await run.start({
|
|
15893
15893
|
inputData: initialData,
|
|
15894
|
-
...
|
|
15894
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
|
|
15895
15895
|
requestContext
|
|
15896
15896
|
});
|
|
15897
15897
|
if (executionResult.status !== "success") {
|
|
@@ -16034,7 +16034,7 @@ function loop({
|
|
|
16034
16034
|
}
|
|
16035
16035
|
const baseStream = workflowLoopStream(workflowLoopProps);
|
|
16036
16036
|
const stream = rest.modelSpanTracker?.wrapStream(baseStream) ?? baseStream;
|
|
16037
|
-
const observabilityContext =
|
|
16037
|
+
const observabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
|
|
16038
16038
|
modelOutput = new MastraModelOutput({
|
|
16039
16039
|
model: {
|
|
16040
16040
|
modelId: firstModel.model.modelId,
|
|
@@ -16166,7 +16166,7 @@ var MastraLLMVNext = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
16166
16166
|
workspace,
|
|
16167
16167
|
...rest
|
|
16168
16168
|
}) {
|
|
16169
|
-
const observabilityContext =
|
|
16169
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
16170
16170
|
let stopWhenToUse;
|
|
16171
16171
|
if (maxSteps && typeof maxSteps === "number") {
|
|
16172
16172
|
stopWhenToUse = chunkY3APFUXZ_cjs.stepCountIs(maxSteps);
|
|
@@ -16196,7 +16196,7 @@ var MastraLLMVNext = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
16196
16196
|
requestContext
|
|
16197
16197
|
});
|
|
16198
16198
|
if (modelSpan) {
|
|
16199
|
-
|
|
16199
|
+
chunkQFGYBEP3_cjs.executeWithContextSync({
|
|
16200
16200
|
span: modelSpan,
|
|
16201
16201
|
fn: () => this.logger.debug("Streaming text", {
|
|
16202
16202
|
runId,
|
|
@@ -16283,7 +16283,7 @@ var MastraLLMVNext = class extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
16283
16283
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
16284
16284
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
16285
16285
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
16286
|
-
await
|
|
16286
|
+
await chunkXS3FHQ34_cjs.delay(10 * 1e3);
|
|
16287
16287
|
}
|
|
16288
16288
|
},
|
|
16289
16289
|
onFinish: async (props) => {
|
|
@@ -16521,7 +16521,7 @@ async function prepareMemoryStep({
|
|
|
16521
16521
|
memoryConfig,
|
|
16522
16522
|
...rest
|
|
16523
16523
|
}) {
|
|
16524
|
-
const observabilityContext =
|
|
16524
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
16525
16525
|
const memory = await routingAgent.getMemory({ requestContext });
|
|
16526
16526
|
let thread = await memory?.getThreadById({ threadId });
|
|
16527
16527
|
if (!thread) {
|
|
@@ -16560,7 +16560,7 @@ async function prepareMemoryStep({
|
|
|
16560
16560
|
);
|
|
16561
16561
|
}
|
|
16562
16562
|
} else {
|
|
16563
|
-
const messageList = new
|
|
16563
|
+
const messageList = new chunkRJAOQKHJ_cjs.MessageList({
|
|
16564
16564
|
threadId: thread?.id,
|
|
16565
16565
|
resourceId: thread?.resourceId
|
|
16566
16566
|
});
|
|
@@ -16616,12 +16616,12 @@ async function prepareMemoryStep({
|
|
|
16616
16616
|
async function saveMessagesWithProcessors(memory, messages, processorRunner, context) {
|
|
16617
16617
|
if (!memory) return;
|
|
16618
16618
|
const { requestContext, ...observabilityContext } = context ?? {};
|
|
16619
|
-
const resolved =
|
|
16619
|
+
const resolved = chunk4FFOOHE5_cjs.resolveObservabilityContext(observabilityContext);
|
|
16620
16620
|
if (!processorRunner || messages.length === 0) {
|
|
16621
16621
|
await memory.saveMessages({ messages, observabilityContext: resolved });
|
|
16622
16622
|
return;
|
|
16623
16623
|
}
|
|
16624
|
-
const messageList = new
|
|
16624
|
+
const messageList = new chunkRJAOQKHJ_cjs.MessageList();
|
|
16625
16625
|
for (const msg of messages) {
|
|
16626
16626
|
messageList.add(msg, "response");
|
|
16627
16627
|
}
|
|
@@ -16701,7 +16701,7 @@ async function createNetworkLoop({
|
|
|
16701
16701
|
const processorRunner = configuredOutputProcessors.length > 0 ? new ProcessorRunner({
|
|
16702
16702
|
outputProcessors: configuredOutputProcessors,
|
|
16703
16703
|
inputProcessors: [],
|
|
16704
|
-
logger: agent.getMastraInstance()?.getLogger() ||
|
|
16704
|
+
logger: agent.getMastraInstance()?.getLogger() || chunkFLMCO42Y_cjs.noopLogger,
|
|
16705
16705
|
agentName: agent.name
|
|
16706
16706
|
}) : null;
|
|
16707
16707
|
const routingStep = createStep({
|
|
@@ -17774,7 +17774,7 @@ async function createNetworkLoop({
|
|
|
17774
17774
|
memory,
|
|
17775
17775
|
context: inputDataToUse,
|
|
17776
17776
|
// TODO: Pass proper tracing context when network supports tracing
|
|
17777
|
-
...
|
|
17777
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: void 0 }),
|
|
17778
17778
|
writer
|
|
17779
17779
|
},
|
|
17780
17780
|
{ toolCallId, messages: [] }
|
|
@@ -18054,7 +18054,7 @@ async function networkLoop({
|
|
|
18054
18054
|
"resumeData": "string"
|
|
18055
18055
|
}
|
|
18056
18056
|
`;
|
|
18057
|
-
const messageList = new
|
|
18057
|
+
const messageList = new chunkRJAOQKHJ_cjs.MessageList();
|
|
18058
18058
|
messageList.addSystem(systemInstructions);
|
|
18059
18059
|
messageList.add(task, "user");
|
|
18060
18060
|
const result = llm.stream({
|
|
@@ -18062,7 +18062,7 @@ async function networkLoop({
|
|
|
18062
18062
|
requestContext,
|
|
18063
18063
|
messageList,
|
|
18064
18064
|
agentId: routingAgent.id,
|
|
18065
|
-
...
|
|
18065
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
|
|
18066
18066
|
structuredOutput: {
|
|
18067
18067
|
schema: v4.z.object({
|
|
18068
18068
|
resumeData: v4.z.string()
|
|
@@ -18440,7 +18440,7 @@ async function networkLoop({
|
|
|
18440
18440
|
messages,
|
|
18441
18441
|
routingAgent,
|
|
18442
18442
|
generateId: generateId2,
|
|
18443
|
-
...
|
|
18443
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
|
|
18444
18444
|
memoryConfig: routingAgentMemoryOptions?.options
|
|
18445
18445
|
});
|
|
18446
18446
|
return new MastraAgentNetworkStream({
|
|
@@ -18649,13 +18649,13 @@ var AgentLegacyHandler = class {
|
|
|
18649
18649
|
tracingOptions,
|
|
18650
18650
|
...rest
|
|
18651
18651
|
}) {
|
|
18652
|
-
const observabilityContext =
|
|
18652
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
18653
18653
|
return {
|
|
18654
18654
|
before: async () => {
|
|
18655
|
-
const agentSpan =
|
|
18655
|
+
const agentSpan = chunkQFGYBEP3_cjs.getOrCreateSpan({
|
|
18656
18656
|
type: "agent_run" /* AGENT_RUN */,
|
|
18657
18657
|
name: `agent run: '${this.capabilities.id}'`,
|
|
18658
|
-
entityType:
|
|
18658
|
+
entityType: chunkL56725IW_cjs.EntityType.AGENT,
|
|
18659
18659
|
entityId: this.capabilities.id,
|
|
18660
18660
|
entityName: this.capabilities.name,
|
|
18661
18661
|
input: {
|
|
@@ -18680,7 +18680,7 @@ var AgentLegacyHandler = class {
|
|
|
18680
18680
|
requestContext,
|
|
18681
18681
|
mastra: this.capabilities.mastra
|
|
18682
18682
|
});
|
|
18683
|
-
const innerObservabilityContext =
|
|
18683
|
+
const innerObservabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
18684
18684
|
const memory = await this.capabilities.getMemory({ requestContext });
|
|
18685
18685
|
const threadId = thread?.id;
|
|
18686
18686
|
const convertedTools = await this.capabilities.convertTools({
|
|
@@ -18695,7 +18695,7 @@ var AgentLegacyHandler = class {
|
|
|
18695
18695
|
methodType: methodType === "generate" ? "generateLegacy" : "streamLegacy",
|
|
18696
18696
|
memoryConfig
|
|
18697
18697
|
});
|
|
18698
|
-
let messageList = new
|
|
18698
|
+
let messageList = new chunkRJAOQKHJ_cjs.MessageList({
|
|
18699
18699
|
threadId,
|
|
18700
18700
|
resourceId,
|
|
18701
18701
|
generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
|
|
@@ -18854,7 +18854,7 @@ var AgentLegacyHandler = class {
|
|
|
18854
18854
|
result: resToLog,
|
|
18855
18855
|
threadId
|
|
18856
18856
|
});
|
|
18857
|
-
const messageListResponses = new
|
|
18857
|
+
const messageListResponses = new chunkRJAOQKHJ_cjs.MessageList({
|
|
18858
18858
|
threadId,
|
|
18859
18859
|
resourceId,
|
|
18860
18860
|
generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
|
|
@@ -18909,7 +18909,7 @@ var AgentLegacyHandler = class {
|
|
|
18909
18909
|
if (shouldGenerate && !thread2.title && messages2.length >= requiredMessages) {
|
|
18910
18910
|
const userMessage = this.capabilities.getMostRecentUserMessage(uiMessages);
|
|
18911
18911
|
if (userMessage) {
|
|
18912
|
-
const observabilityContext2 =
|
|
18912
|
+
const observabilityContext2 = chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
18913
18913
|
promises.push(
|
|
18914
18914
|
this.capabilities.genTitle(userMessage, requestContext, observabilityContext2, titleModel, titleInstructions).then((title) => {
|
|
18915
18915
|
if (title) {
|
|
@@ -18979,7 +18979,7 @@ var AgentLegacyHandler = class {
|
|
|
18979
18979
|
overrideScorers,
|
|
18980
18980
|
threadId,
|
|
18981
18981
|
resourceId,
|
|
18982
|
-
...
|
|
18982
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan })
|
|
18983
18983
|
});
|
|
18984
18984
|
const scoringData = {
|
|
18985
18985
|
input: {
|
|
@@ -19066,7 +19066,7 @@ var AgentLegacyHandler = class {
|
|
|
19066
19066
|
writableStream,
|
|
19067
19067
|
methodType,
|
|
19068
19068
|
tracingOptions,
|
|
19069
|
-
...
|
|
19069
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(args)
|
|
19070
19070
|
});
|
|
19071
19071
|
let messageList;
|
|
19072
19072
|
let thread;
|
|
@@ -19231,7 +19231,7 @@ var AgentLegacyHandler = class {
|
|
|
19231
19231
|
return tripwireResult;
|
|
19232
19232
|
}
|
|
19233
19233
|
const { experimental_output, output, agentSpan, ...llmOptions } = beforeResult;
|
|
19234
|
-
const observabilityContext =
|
|
19234
|
+
const observabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
19235
19235
|
let finalOutputProcessors = mergedGenerateOptions.outputProcessors;
|
|
19236
19236
|
if (!output || experimental_output) {
|
|
19237
19237
|
const result2 = await llmToUse.__text({
|
|
@@ -19519,7 +19519,7 @@ var AgentLegacyHandler = class {
|
|
|
19519
19519
|
}
|
|
19520
19520
|
const { onFinish, runId, output, experimental_output, agentSpan, messageList, requestContext, ...llmOptions } = beforeResult;
|
|
19521
19521
|
const overrideScorers = mergedStreamOptions.scorers;
|
|
19522
|
-
const observabilityContext =
|
|
19522
|
+
const observabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
19523
19523
|
if (!output || experimental_output) {
|
|
19524
19524
|
const streamResult = llm.__stream({
|
|
19525
19525
|
...llmOptions,
|
|
@@ -19844,7 +19844,7 @@ function createMapResultsStep({
|
|
|
19844
19844
|
const modelOutput = await getModelOutputForTripwire({
|
|
19845
19845
|
tripwire: memoryData.tripwire,
|
|
19846
19846
|
runId,
|
|
19847
|
-
...
|
|
19847
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
19848
19848
|
options,
|
|
19849
19849
|
model: agentModel,
|
|
19850
19850
|
messageList: memoryData.messageList
|
|
@@ -19898,7 +19898,7 @@ function createMapResultsStep({
|
|
|
19898
19898
|
methodType: modelMethodType,
|
|
19899
19899
|
agentId,
|
|
19900
19900
|
requestContext: result.requestContext,
|
|
19901
|
-
...
|
|
19901
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
19902
19902
|
runId,
|
|
19903
19903
|
toolChoice: result.toolChoice,
|
|
19904
19904
|
tools: result.tools,
|
|
@@ -20031,7 +20031,7 @@ var prepareToolsStepOutputSchema = v4.z.object({
|
|
|
20031
20031
|
var prepareMemoryStepOutputSchema = v4.z.object({
|
|
20032
20032
|
threadExists: v4.z.boolean(),
|
|
20033
20033
|
thread: storageThreadSchema.optional(),
|
|
20034
|
-
messageList: v4.z.instanceof(
|
|
20034
|
+
messageList: v4.z.instanceof(chunkRJAOQKHJ_cjs.MessageList),
|
|
20035
20035
|
/** Shared processor states map that persists across loop iterations for both input and output processors */
|
|
20036
20036
|
processorStates: v4.z.instanceof(Map),
|
|
20037
20037
|
/** Tripwire data when input processor triggered abort */
|
|
@@ -20071,9 +20071,9 @@ function createPrepareMemoryStep({
|
|
|
20071
20071
|
inputSchema: v4.z.object({}),
|
|
20072
20072
|
outputSchema: prepareMemoryStepOutputSchema,
|
|
20073
20073
|
execute: async ({ ...rest }) => {
|
|
20074
|
-
const observabilityContext =
|
|
20074
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
20075
20075
|
const thread = threadFromArgs;
|
|
20076
|
-
const messageList = new
|
|
20076
|
+
const messageList = new chunkRJAOQKHJ_cjs.MessageList({
|
|
20077
20077
|
threadId: thread?.id,
|
|
20078
20078
|
resourceId,
|
|
20079
20079
|
generateMessageId: capabilities.generateMessageId,
|
|
@@ -20191,7 +20191,7 @@ function createPrepareToolsStep({
|
|
|
20191
20191
|
resourceId,
|
|
20192
20192
|
runId,
|
|
20193
20193
|
requestContext,
|
|
20194
|
-
...
|
|
20194
|
+
...chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
20195
20195
|
outputWriter: options.outputWriter,
|
|
20196
20196
|
methodType,
|
|
20197
20197
|
memoryConfig: options.memory?.options,
|
|
@@ -20245,7 +20245,7 @@ function createStreamStep({
|
|
|
20245
20245
|
...validatedInputData,
|
|
20246
20246
|
outputProcessors: processors,
|
|
20247
20247
|
returnScorerData,
|
|
20248
|
-
...
|
|
20248
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(observabilityContext),
|
|
20249
20249
|
requireToolApproval,
|
|
20250
20250
|
toolCallConcurrency,
|
|
20251
20251
|
resumeContext,
|
|
@@ -21372,7 +21372,7 @@ ${errorMessages}`,
|
|
|
21372
21372
|
*/
|
|
21373
21373
|
listTools({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
21374
21374
|
if (typeof this.#tools !== "function") {
|
|
21375
|
-
return
|
|
21375
|
+
return chunkXS3FHQ34_cjs.ensureToolProperties(this.#tools);
|
|
21376
21376
|
}
|
|
21377
21377
|
const result = this.#tools({
|
|
21378
21378
|
requestContext,
|
|
@@ -21392,7 +21392,7 @@ ${errorMessages}`,
|
|
|
21392
21392
|
this.logger.trackException(mastraError);
|
|
21393
21393
|
throw mastraError;
|
|
21394
21394
|
}
|
|
21395
|
-
return
|
|
21395
|
+
return chunkXS3FHQ34_cjs.ensureToolProperties(tools);
|
|
21396
21396
|
});
|
|
21397
21397
|
}
|
|
21398
21398
|
/**
|
|
@@ -21440,7 +21440,7 @@ ${errorMessages}`,
|
|
|
21440
21440
|
});
|
|
21441
21441
|
});
|
|
21442
21442
|
} else {
|
|
21443
|
-
llm = new
|
|
21443
|
+
llm = new chunkXEM4OYJI_cjs.MastraLLMV1({
|
|
21444
21444
|
model: modelInfo,
|
|
21445
21445
|
mastra: this.#mastra,
|
|
21446
21446
|
options: { tracingPolicy: this.#options?.tracingPolicy }
|
|
@@ -21466,7 +21466,7 @@ ${errorMessages}`,
|
|
|
21466
21466
|
*/
|
|
21467
21467
|
async resolveModelConfig(modelConfig, requestContext) {
|
|
21468
21468
|
try {
|
|
21469
|
-
return await
|
|
21469
|
+
return await chunkFCW225T4_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
|
|
21470
21470
|
} catch (error) {
|
|
21471
21471
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
21472
21472
|
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
@@ -21784,9 +21784,9 @@ ${errorMessages}`,
|
|
|
21784
21784
|
instructions,
|
|
21785
21785
|
...rest
|
|
21786
21786
|
}) {
|
|
21787
|
-
const observabilityContext =
|
|
21787
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
21788
21788
|
const llm = await this.getLLM({ requestContext, model });
|
|
21789
|
-
const normMessage = new
|
|
21789
|
+
const normMessage = new chunkRJAOQKHJ_cjs.MessageList().add(message, "user").get.all.aiV5.ui().at(-1);
|
|
21790
21790
|
if (!normMessage) {
|
|
21791
21791
|
throw new Error(`Could not generate title from input ${JSON.stringify(message)}`);
|
|
21792
21792
|
}
|
|
@@ -21809,7 +21809,7 @@ ${errorMessages}`,
|
|
|
21809
21809
|
const systemInstructions = await this.resolveTitleInstructions(requestContext, instructions);
|
|
21810
21810
|
let text = "";
|
|
21811
21811
|
if (isSupportedLanguageModel(llm.getModel())) {
|
|
21812
|
-
const messageList = new
|
|
21812
|
+
const messageList = new chunkRJAOQKHJ_cjs.MessageList().add(
|
|
21813
21813
|
[
|
|
21814
21814
|
{
|
|
21815
21815
|
role: "system",
|
|
@@ -21862,7 +21862,7 @@ ${errorMessages}`,
|
|
|
21862
21862
|
async genTitle(userMessage, requestContext, observabilityContext, model, instructions) {
|
|
21863
21863
|
try {
|
|
21864
21864
|
if (userMessage) {
|
|
21865
|
-
const normMessage = new
|
|
21865
|
+
const normMessage = new chunkRJAOQKHJ_cjs.MessageList().add(userMessage, "user").get.all.ui().at(-1);
|
|
21866
21866
|
if (normMessage) {
|
|
21867
21867
|
return await this.generateTitleFromUserMessage({
|
|
21868
21868
|
message: normMessage,
|
|
@@ -21907,7 +21907,7 @@ ${errorMessages}`,
|
|
|
21907
21907
|
autoResumeSuspendedTools,
|
|
21908
21908
|
...rest
|
|
21909
21909
|
}) {
|
|
21910
|
-
const observabilityContext =
|
|
21910
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
21911
21911
|
let convertedMemoryTools = {};
|
|
21912
21912
|
if (this._agentNetworkAppend) {
|
|
21913
21913
|
this.logger.debug("Skipping memory tools (agent network context)", { agent: this.name, runId });
|
|
@@ -21938,7 +21938,7 @@ ${errorMessages}`,
|
|
|
21938
21938
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
21939
21939
|
requireApproval: toolObj.requireApproval
|
|
21940
21940
|
};
|
|
21941
|
-
const convertedToCoreTool =
|
|
21941
|
+
const convertedToCoreTool = chunkXS3FHQ34_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
21942
21942
|
convertedMemoryTools[toolName] = convertedToCoreTool;
|
|
21943
21943
|
}
|
|
21944
21944
|
}
|
|
@@ -21957,7 +21957,7 @@ ${errorMessages}`,
|
|
|
21957
21957
|
autoResumeSuspendedTools,
|
|
21958
21958
|
...rest
|
|
21959
21959
|
}) {
|
|
21960
|
-
const observabilityContext =
|
|
21960
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
21961
21961
|
let convertedWorkspaceTools = {};
|
|
21962
21962
|
if (this._agentNetworkAppend) {
|
|
21963
21963
|
this.logger.debug("Skipping workspace tools (agent network context)", { agent: this.name, runId });
|
|
@@ -21991,7 +21991,7 @@ ${errorMessages}`,
|
|
|
21991
21991
|
requireApproval: toolObj.requireApproval,
|
|
21992
21992
|
workspace
|
|
21993
21993
|
};
|
|
21994
|
-
const convertedToCoreTool =
|
|
21994
|
+
const convertedToCoreTool = chunkXS3FHQ34_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
21995
21995
|
convertedWorkspaceTools[toolName] = convertedToCoreTool;
|
|
21996
21996
|
}
|
|
21997
21997
|
}
|
|
@@ -22010,7 +22010,7 @@ ${errorMessages}`,
|
|
|
22010
22010
|
autoResumeSuspendedTools,
|
|
22011
22011
|
...rest
|
|
22012
22012
|
}) {
|
|
22013
|
-
const observabilityContext =
|
|
22013
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
22014
22014
|
const convertedChannelTools = {};
|
|
22015
22015
|
if (!this.#agentChannels) {
|
|
22016
22016
|
return convertedChannelTools;
|
|
@@ -22032,7 +22032,7 @@ ${errorMessages}`,
|
|
|
22032
22032
|
...observabilityContext,
|
|
22033
22033
|
tracingPolicy: this.#options?.tracingPolicy
|
|
22034
22034
|
};
|
|
22035
|
-
convertedChannelTools[toolName] =
|
|
22035
|
+
convertedChannelTools[toolName] = chunkXS3FHQ34_cjs.makeCoreTool(
|
|
22036
22036
|
tool2,
|
|
22037
22037
|
options,
|
|
22038
22038
|
void 0,
|
|
@@ -22058,7 +22058,7 @@ ${errorMessages}`,
|
|
|
22058
22058
|
autoResumeSuspendedTools,
|
|
22059
22059
|
...rest
|
|
22060
22060
|
}) {
|
|
22061
|
-
const observabilityContext =
|
|
22061
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
22062
22062
|
let convertedSkillTools = {};
|
|
22063
22063
|
if (this._agentNetworkAppend) {
|
|
22064
22064
|
return convertedSkillTools;
|
|
@@ -22089,7 +22089,7 @@ ${errorMessages}`,
|
|
|
22089
22089
|
// Skill tools never require approval
|
|
22090
22090
|
workspace
|
|
22091
22091
|
};
|
|
22092
|
-
const convertedToCoreTool =
|
|
22092
|
+
const convertedToCoreTool = chunkXS3FHQ34_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
22093
22093
|
convertedSkillTools[toolName] = convertedToCoreTool;
|
|
22094
22094
|
}
|
|
22095
22095
|
}
|
|
@@ -22107,7 +22107,7 @@ ${errorMessages}`,
|
|
|
22107
22107
|
autoResumeSuspendedTools,
|
|
22108
22108
|
...rest
|
|
22109
22109
|
}) {
|
|
22110
|
-
const observabilityContext =
|
|
22110
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
22111
22111
|
let convertedBrowserTools = {};
|
|
22112
22112
|
if (this._agentNetworkAppend) {
|
|
22113
22113
|
return convertedBrowserTools;
|
|
@@ -22137,7 +22137,7 @@ ${errorMessages}`,
|
|
|
22137
22137
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
22138
22138
|
requireApproval: toolObj.requireApproval
|
|
22139
22139
|
};
|
|
22140
|
-
const convertedToCoreTool =
|
|
22140
|
+
const convertedToCoreTool = chunkXS3FHQ34_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
22141
22141
|
convertedBrowserTools[toolName] = convertedToCoreTool;
|
|
22142
22142
|
}
|
|
22143
22143
|
}
|
|
@@ -22203,7 +22203,7 @@ ${errorMessages}`,
|
|
|
22203
22203
|
*/
|
|
22204
22204
|
async __runProcessInputStep(args) {
|
|
22205
22205
|
const { requestContext, messageList, stepNumber = 0, processorStates, ...rest } = args;
|
|
22206
|
-
const observabilityContext =
|
|
22206
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
22207
22207
|
let tripwire;
|
|
22208
22208
|
if (this.#inputProcessors || this.#memory) {
|
|
22209
22209
|
const runner = await this.getProcessorRunner({
|
|
@@ -22343,7 +22343,7 @@ ${errorMessages}`,
|
|
|
22343
22343
|
autoResumeSuspendedTools,
|
|
22344
22344
|
...rest
|
|
22345
22345
|
}) {
|
|
22346
|
-
const observabilityContext =
|
|
22346
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
22347
22347
|
let toolsForRequest = {};
|
|
22348
22348
|
const memory = await this.getMemory({ requestContext });
|
|
22349
22349
|
const assignedTools = await this.listTools({ requestContext });
|
|
@@ -22370,7 +22370,7 @@ ${errorMessages}`,
|
|
|
22370
22370
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
22371
22371
|
requireApproval: tool2.requireApproval
|
|
22372
22372
|
};
|
|
22373
|
-
return [k,
|
|
22373
|
+
return [k, chunkXS3FHQ34_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
|
|
22374
22374
|
})
|
|
22375
22375
|
);
|
|
22376
22376
|
const assignedToolEntriesConverted = Object.fromEntries(
|
|
@@ -22395,7 +22395,7 @@ ${errorMessages}`,
|
|
|
22395
22395
|
autoResumeSuspendedTools,
|
|
22396
22396
|
...rest
|
|
22397
22397
|
}) {
|
|
22398
|
-
const observabilityContext =
|
|
22398
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
22399
22399
|
let toolsForRequest = {};
|
|
22400
22400
|
const memory = await this.getMemory({ requestContext });
|
|
22401
22401
|
const toolsFromToolsets = Object.values(toolsets || {});
|
|
@@ -22424,7 +22424,7 @@ ${errorMessages}`,
|
|
|
22424
22424
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
22425
22425
|
requireApproval: toolObj.requireApproval
|
|
22426
22426
|
};
|
|
22427
|
-
const convertedToCoreTool =
|
|
22427
|
+
const convertedToCoreTool = chunkXS3FHQ34_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
|
|
22428
22428
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
22429
22429
|
}
|
|
22430
22430
|
}
|
|
@@ -22445,7 +22445,7 @@ ${errorMessages}`,
|
|
|
22445
22445
|
autoResumeSuspendedTools,
|
|
22446
22446
|
...rest
|
|
22447
22447
|
}) {
|
|
22448
|
-
const observabilityContext =
|
|
22448
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
22449
22449
|
let toolsForRequest = {};
|
|
22450
22450
|
const memory = await this.getMemory({ requestContext });
|
|
22451
22451
|
const clientToolsForInput = Object.entries(clientTools || {});
|
|
@@ -22469,7 +22469,7 @@ ${errorMessages}`,
|
|
|
22469
22469
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
22470
22470
|
requireApproval: tool2.requireApproval
|
|
22471
22471
|
};
|
|
22472
|
-
const convertedToCoreTool =
|
|
22472
|
+
const convertedToCoreTool = chunkXS3FHQ34_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
|
|
22473
22473
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
22474
22474
|
}
|
|
22475
22475
|
}
|
|
@@ -22521,7 +22521,7 @@ ${errorMessages}`,
|
|
|
22521
22521
|
delegation,
|
|
22522
22522
|
...rest
|
|
22523
22523
|
}) {
|
|
22524
|
-
const observabilityContext =
|
|
22524
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
22525
22525
|
const convertedAgentTools = {};
|
|
22526
22526
|
const agents = await this.listAgents({ requestContext });
|
|
22527
22527
|
if (Object.keys(agents).length > 0) {
|
|
@@ -22773,7 +22773,7 @@ ${effectiveInstructions}`;
|
|
|
22773
22773
|
const generateResult = resumeData ? await agent.resumeGenerate(resumeData, {
|
|
22774
22774
|
runId: suspendedToolRunId,
|
|
22775
22775
|
requestContext,
|
|
22776
|
-
...
|
|
22776
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {}),
|
|
22777
22777
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
22778
22778
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
22779
22779
|
context: filteredContextMessages,
|
|
@@ -22786,7 +22786,7 @@ ${effectiveInstructions}`;
|
|
|
22786
22786
|
} : {}
|
|
22787
22787
|
}) : await agent.generate(messagesForSubAgent, {
|
|
22788
22788
|
requestContext,
|
|
22789
|
-
...
|
|
22789
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {}),
|
|
22790
22790
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
22791
22791
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
22792
22792
|
context: filteredContextMessages,
|
|
@@ -22858,7 +22858,7 @@ ${effectiveInstructions}`;
|
|
|
22858
22858
|
} else if (methodType === "generate" && modelVersion === "v1") {
|
|
22859
22859
|
const generateResult = await agent.generateLegacy(messagesForSubAgent, {
|
|
22860
22860
|
requestContext,
|
|
22861
|
-
...
|
|
22861
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {}),
|
|
22862
22862
|
context: filteredContextMessages
|
|
22863
22863
|
});
|
|
22864
22864
|
result = { text: generateResult.text };
|
|
@@ -22866,7 +22866,7 @@ ${effectiveInstructions}`;
|
|
|
22866
22866
|
const streamResult = resumeData ? await agent.resumeStream(resumeData, {
|
|
22867
22867
|
runId: suspendedToolRunId,
|
|
22868
22868
|
requestContext,
|
|
22869
|
-
...
|
|
22869
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {}),
|
|
22870
22870
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
22871
22871
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
22872
22872
|
context: filteredContextMessages,
|
|
@@ -22881,7 +22881,7 @@ ${effectiveInstructions}`;
|
|
|
22881
22881
|
} : {}
|
|
22882
22882
|
}) : await agent.stream(messagesForSubAgent, {
|
|
22883
22883
|
requestContext,
|
|
22884
|
-
...
|
|
22884
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {}),
|
|
22885
22885
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
22886
22886
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
22887
22887
|
context: filteredContextMessages,
|
|
@@ -22990,7 +22990,7 @@ ${effectiveInstructions}`;
|
|
|
22990
22990
|
} else {
|
|
22991
22991
|
const streamResult = await agent.streamLegacy(effectivePrompt, {
|
|
22992
22992
|
requestContext,
|
|
22993
|
-
...
|
|
22993
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {})
|
|
22994
22994
|
});
|
|
22995
22995
|
let fullText = "";
|
|
22996
22996
|
for await (const chunk of streamResult.fullStream) {
|
|
@@ -23189,7 +23189,7 @@ ${effectiveInstructions}`;
|
|
|
23189
23189
|
...observabilityContext,
|
|
23190
23190
|
tracingPolicy: this.#options?.tracingPolicy
|
|
23191
23191
|
};
|
|
23192
|
-
convertedAgentTools[`agent-${agentName}`] =
|
|
23192
|
+
convertedAgentTools[`agent-${agentName}`] = chunkXS3FHQ34_cjs.makeCoreTool(
|
|
23193
23193
|
toolObj,
|
|
23194
23194
|
options,
|
|
23195
23195
|
void 0,
|
|
@@ -23212,7 +23212,7 @@ ${effectiveInstructions}`;
|
|
|
23212
23212
|
autoResumeSuspendedTools,
|
|
23213
23213
|
...rest
|
|
23214
23214
|
}) {
|
|
23215
|
-
const observabilityContext =
|
|
23215
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
23216
23216
|
const convertedWorkflowTools = {};
|
|
23217
23217
|
const workflows = await this.listWorkflows({ requestContext });
|
|
23218
23218
|
if (Object.keys(workflows).length > 0) {
|
|
@@ -23284,13 +23284,13 @@ ${effectiveInstructions}`;
|
|
|
23284
23284
|
result = await run.resume({
|
|
23285
23285
|
resumeData,
|
|
23286
23286
|
requestContext,
|
|
23287
|
-
...
|
|
23287
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {})
|
|
23288
23288
|
});
|
|
23289
23289
|
} else {
|
|
23290
23290
|
result = await run.start({
|
|
23291
23291
|
inputData: workflowInputData,
|
|
23292
23292
|
requestContext,
|
|
23293
|
-
...
|
|
23293
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {}),
|
|
23294
23294
|
...initialState && { initialState }
|
|
23295
23295
|
});
|
|
23296
23296
|
}
|
|
@@ -23298,7 +23298,7 @@ ${effectiveInstructions}`;
|
|
|
23298
23298
|
const streamResult = run.streamLegacy({
|
|
23299
23299
|
inputData: workflowInputData,
|
|
23300
23300
|
requestContext,
|
|
23301
|
-
...
|
|
23301
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {})
|
|
23302
23302
|
});
|
|
23303
23303
|
if (context?.writer) {
|
|
23304
23304
|
await streamResult.stream.pipeTo(context.writer);
|
|
@@ -23311,11 +23311,11 @@ ${effectiveInstructions}`;
|
|
|
23311
23311
|
const streamResult = resumeData ? run.resumeStream({
|
|
23312
23312
|
resumeData,
|
|
23313
23313
|
requestContext,
|
|
23314
|
-
...
|
|
23314
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {})
|
|
23315
23315
|
}) : run.stream({
|
|
23316
23316
|
inputData: workflowInputData,
|
|
23317
23317
|
requestContext,
|
|
23318
|
-
...
|
|
23318
|
+
...chunk4FFOOHE5_cjs.resolveObservabilityContext(context ?? {}),
|
|
23319
23319
|
...initialState && { initialState }
|
|
23320
23320
|
});
|
|
23321
23321
|
if (context?.writer) {
|
|
@@ -23410,7 +23410,7 @@ ${effectiveInstructions}`;
|
|
|
23410
23410
|
...observabilityContext,
|
|
23411
23411
|
tracingPolicy: this.#options?.tracingPolicy
|
|
23412
23412
|
};
|
|
23413
|
-
convertedWorkflowTools[`workflow-${workflowName}`] =
|
|
23413
|
+
convertedWorkflowTools[`workflow-${workflowName}`] = chunkXS3FHQ34_cjs.makeCoreTool(
|
|
23414
23414
|
toolObj,
|
|
23415
23415
|
options,
|
|
23416
23416
|
void 0,
|
|
@@ -23438,11 +23438,11 @@ ${effectiveInstructions}`;
|
|
|
23438
23438
|
delegation,
|
|
23439
23439
|
...rest
|
|
23440
23440
|
}) {
|
|
23441
|
-
const observabilityContext =
|
|
23441
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
23442
23442
|
let mastraProxy = void 0;
|
|
23443
23443
|
const logger = this.logger;
|
|
23444
23444
|
if (this.#mastra) {
|
|
23445
|
-
mastraProxy =
|
|
23445
|
+
mastraProxy = chunkXS3FHQ34_cjs.createMastraProxy({ mastra: this.#mastra, logger });
|
|
23446
23446
|
}
|
|
23447
23447
|
const assignedTools = await this.listAssignedTools({
|
|
23448
23448
|
runId,
|
|
@@ -23713,7 +23713,7 @@ ${effectiveInstructions}`;
|
|
|
23713
23713
|
const resolvedModel = await this.resolveModelConfig(selection, requestContext);
|
|
23714
23714
|
this.assertSupportsPreparedModels(resolvedModel);
|
|
23715
23715
|
let headers;
|
|
23716
|
-
if (resolvedModel instanceof
|
|
23716
|
+
if (resolvedModel instanceof chunkFCW225T4_cjs.ModelRouterLanguageModel) {
|
|
23717
23717
|
headers = resolvedModel.config?.headers;
|
|
23718
23718
|
}
|
|
23719
23719
|
return [
|
|
@@ -23745,7 +23745,7 @@ ${effectiveInstructions}`;
|
|
|
23745
23745
|
throw mastraError;
|
|
23746
23746
|
}
|
|
23747
23747
|
let headers;
|
|
23748
|
-
if (model instanceof
|
|
23748
|
+
if (model instanceof chunkFCW225T4_cjs.ModelRouterLanguageModel) {
|
|
23749
23749
|
headers = model.config?.headers;
|
|
23750
23750
|
}
|
|
23751
23751
|
return {
|
|
@@ -23806,7 +23806,7 @@ ${effectiveInstructions}`;
|
|
|
23806
23806
|
model: options.model
|
|
23807
23807
|
});
|
|
23808
23808
|
const resolvedModel = llm.getModel();
|
|
23809
|
-
const isGatewayModel = resolvedModel instanceof
|
|
23809
|
+
const isGatewayModel = resolvedModel instanceof chunkFCW225T4_cjs.ModelRouterLanguageModel && resolvedModel.gatewayId === "mastra";
|
|
23810
23810
|
if (resourceId && threadFromArgs && !this.hasOwnMemory() && !isGatewayModel) {
|
|
23811
23811
|
this.logger.warn("No memory is configured but resourceId and threadId were passed in args", { agent: this.name });
|
|
23812
23812
|
}
|
|
@@ -23832,10 +23832,10 @@ ${effectiveInstructions}`;
|
|
|
23832
23832
|
resourceId
|
|
23833
23833
|
}) || crypto2.randomUUID();
|
|
23834
23834
|
const instructions = options.instructions || await this.getInstructions({ requestContext });
|
|
23835
|
-
const agentSpan =
|
|
23835
|
+
const agentSpan = chunkQFGYBEP3_cjs.getOrCreateSpan({
|
|
23836
23836
|
type: "agent_run" /* AGENT_RUN */,
|
|
23837
23837
|
name: `agent run: '${this.id}'`,
|
|
23838
|
-
entityType:
|
|
23838
|
+
entityType: chunkL56725IW_cjs.EntityType.AGENT,
|
|
23839
23839
|
entityId: this.id,
|
|
23840
23840
|
entityName: this.name,
|
|
23841
23841
|
input: options.messages,
|
|
@@ -23906,7 +23906,7 @@ ${effectiveInstructions}`;
|
|
|
23906
23906
|
workspace
|
|
23907
23907
|
});
|
|
23908
23908
|
const run = await executionWorkflow.createRun();
|
|
23909
|
-
const observabilityContext =
|
|
23909
|
+
const observabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
23910
23910
|
const result = await run.start({ ...observabilityContext });
|
|
23911
23911
|
return result;
|
|
23912
23912
|
}
|
|
@@ -23930,7 +23930,7 @@ ${effectiveInstructions}`;
|
|
|
23930
23930
|
structuredOutput = false,
|
|
23931
23931
|
overrideScorers
|
|
23932
23932
|
}) {
|
|
23933
|
-
const observabilityContext =
|
|
23933
|
+
const observabilityContext = chunk4FFOOHE5_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
23934
23934
|
const resToLog = {
|
|
23935
23935
|
text: result.text,
|
|
23936
23936
|
object: result.object,
|
|
@@ -24219,7 +24219,7 @@ ${effectiveInstructions}`;
|
|
|
24219
24219
|
const defaultOptions = await this.getDefaultOptions({
|
|
24220
24220
|
requestContext: options?.requestContext
|
|
24221
24221
|
});
|
|
24222
|
-
const mergedOptions =
|
|
24222
|
+
const mergedOptions = chunkXS3FHQ34_cjs.deepMerge(
|
|
24223
24223
|
defaultOptions,
|
|
24224
24224
|
options ?? {}
|
|
24225
24225
|
);
|
|
@@ -24290,7 +24290,7 @@ ${effectiveInstructions}`;
|
|
|
24290
24290
|
const defaultOptions = await this.getDefaultOptions({
|
|
24291
24291
|
requestContext: streamOptions?.requestContext
|
|
24292
24292
|
});
|
|
24293
|
-
const mergedOptions =
|
|
24293
|
+
const mergedOptions = chunkXS3FHQ34_cjs.deepMerge(
|
|
24294
24294
|
defaultOptions,
|
|
24295
24295
|
streamOptions ?? {}
|
|
24296
24296
|
);
|
|
@@ -24355,7 +24355,7 @@ ${effectiveInstructions}`;
|
|
|
24355
24355
|
const defaultOptions = await this.getDefaultOptions({
|
|
24356
24356
|
requestContext: streamOptions?.requestContext
|
|
24357
24357
|
});
|
|
24358
|
-
let mergedStreamOptions =
|
|
24358
|
+
let mergedStreamOptions = chunkXS3FHQ34_cjs.deepMerge(
|
|
24359
24359
|
defaultOptions,
|
|
24360
24360
|
streamOptions ?? {}
|
|
24361
24361
|
);
|
|
@@ -24421,7 +24421,7 @@ ${effectiveInstructions}`;
|
|
|
24421
24421
|
const defaultOptions = await this.getDefaultOptions({
|
|
24422
24422
|
requestContext: options?.requestContext
|
|
24423
24423
|
});
|
|
24424
|
-
const mergedOptions =
|
|
24424
|
+
const mergedOptions = chunkXS3FHQ34_cjs.deepMerge(
|
|
24425
24425
|
defaultOptions,
|
|
24426
24426
|
options ?? {}
|
|
24427
24427
|
);
|
|
@@ -24671,7 +24671,7 @@ var ModerationProcessor = class _ModerationProcessor {
|
|
|
24671
24671
|
async processInput(args) {
|
|
24672
24672
|
try {
|
|
24673
24673
|
const { messages, abort, ...rest } = args;
|
|
24674
|
-
const observabilityContext =
|
|
24674
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
24675
24675
|
if (messages.length === 0) {
|
|
24676
24676
|
return messages;
|
|
24677
24677
|
}
|
|
@@ -24711,7 +24711,7 @@ var ModerationProcessor = class _ModerationProcessor {
|
|
|
24711
24711
|
async processOutputStream(args) {
|
|
24712
24712
|
try {
|
|
24713
24713
|
const { part, streamParts, abort, ...rest } = args;
|
|
24714
|
-
const observabilityContext =
|
|
24714
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
24715
24715
|
if (part.type !== "text-delta") {
|
|
24716
24716
|
return part;
|
|
24717
24717
|
}
|
|
@@ -24921,7 +24921,7 @@ var PromptInjectionDetector = class _PromptInjectionDetector {
|
|
|
24921
24921
|
async processInput(args) {
|
|
24922
24922
|
try {
|
|
24923
24923
|
const { messages, abort, ...rest } = args;
|
|
24924
|
-
const observabilityContext =
|
|
24924
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
24925
24925
|
if (messages.length === 0) {
|
|
24926
24926
|
return messages;
|
|
24927
24927
|
}
|
|
@@ -25177,7 +25177,7 @@ var PIIDetector = class _PIIDetector {
|
|
|
25177
25177
|
async processInput(args) {
|
|
25178
25178
|
try {
|
|
25179
25179
|
const { messages, abort, ...rest } = args;
|
|
25180
|
-
const observabilityContext =
|
|
25180
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
25181
25181
|
if (messages.length === 0) {
|
|
25182
25182
|
return messages;
|
|
25183
25183
|
}
|
|
@@ -25466,7 +25466,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
|
|
|
25466
25466
|
*/
|
|
25467
25467
|
async processOutputStream(args) {
|
|
25468
25468
|
const { part, abort, ...rest } = args;
|
|
25469
|
-
const observabilityContext =
|
|
25469
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
25470
25470
|
try {
|
|
25471
25471
|
if (part.type !== "text-delta") {
|
|
25472
25472
|
return part;
|
|
@@ -25529,7 +25529,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
|
|
|
25529
25529
|
abort,
|
|
25530
25530
|
...rest
|
|
25531
25531
|
}) {
|
|
25532
|
-
const observabilityContext =
|
|
25532
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
25533
25533
|
try {
|
|
25534
25534
|
if (messages.length === 0) {
|
|
25535
25535
|
return messages;
|
|
@@ -25666,7 +25666,7 @@ var LanguageDetector = class _LanguageDetector {
|
|
|
25666
25666
|
async processInput(args) {
|
|
25667
25667
|
try {
|
|
25668
25668
|
const { messages, abort, ...rest } = args;
|
|
25669
|
-
const observabilityContext =
|
|
25669
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
25670
25670
|
if (messages.length === 0) {
|
|
25671
25671
|
return messages;
|
|
25672
25672
|
}
|
|
@@ -26346,7 +26346,7 @@ var SystemPromptScrubber = class {
|
|
|
26346
26346
|
*/
|
|
26347
26347
|
async processOutputStream(args) {
|
|
26348
26348
|
const { part, abort, ...rest } = args;
|
|
26349
|
-
const observabilityContext =
|
|
26349
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
26350
26350
|
if (part.type !== "text-delta") {
|
|
26351
26351
|
return part;
|
|
26352
26352
|
}
|
|
@@ -26401,7 +26401,7 @@ var SystemPromptScrubber = class {
|
|
|
26401
26401
|
abort,
|
|
26402
26402
|
...rest
|
|
26403
26403
|
}) {
|
|
26404
|
-
const observabilityContext =
|
|
26404
|
+
const observabilityContext = chunk4FFOOHE5_cjs.resolveObservabilityContext(rest);
|
|
26405
26405
|
const processedMessages = [];
|
|
26406
26406
|
const messagesToCheck = selectMessagesToCheck(messages, this.lastMessageOnly);
|
|
26407
26407
|
const checkedMessageIds = new Set(messagesToCheck.map((message) => message.id));
|
|
@@ -27634,7 +27634,7 @@ var MessageHistory = class {
|
|
|
27634
27634
|
return currentSpan.createChildSpan({
|
|
27635
27635
|
type: "memory_operation" /* MEMORY_OPERATION */,
|
|
27636
27636
|
name: `memory: ${operationType}`,
|
|
27637
|
-
entityType:
|
|
27637
|
+
entityType: chunkL56725IW_cjs.EntityType.MEMORY,
|
|
27638
27638
|
entityName: "Memory",
|
|
27639
27639
|
input,
|
|
27640
27640
|
attributes: { operationType, ...attributes }
|
|
@@ -27874,7 +27874,7 @@ var WorkingMemory = class {
|
|
|
27874
27874
|
return messageList;
|
|
27875
27875
|
}
|
|
27876
27876
|
generateEmptyFromSchemaInternal(schema) {
|
|
27877
|
-
const result =
|
|
27877
|
+
const result = chunkXS3FHQ34_cjs.generateEmptyFromSchema(schema);
|
|
27878
27878
|
return Object.keys(result).length > 0 ? result : null;
|
|
27879
27879
|
}
|
|
27880
27880
|
getWorkingMemoryToolInstruction({
|
|
@@ -28077,7 +28077,7 @@ var SemanticRecall = class {
|
|
|
28077
28077
|
*/
|
|
28078
28078
|
formatCrossThreadMessages(messages, currentThreadId) {
|
|
28079
28079
|
let result = ``;
|
|
28080
|
-
const v1Messages = new
|
|
28080
|
+
const v1Messages = new chunkRJAOQKHJ_cjs.MessageList().add(messages, "memory").get.all.v1();
|
|
28081
28081
|
let lastYmd = null;
|
|
28082
28082
|
for (const msg of v1Messages) {
|
|
28083
28083
|
const date = msg.createdAt;
|
|
@@ -28548,7 +28548,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
28548
28548
|
);
|
|
28549
28549
|
}
|
|
28550
28550
|
if (typeof config.embedder === "string") {
|
|
28551
|
-
this.embedder = new
|
|
28551
|
+
this.embedder = new chunkFCW225T4_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
28552
28552
|
} else {
|
|
28553
28553
|
this.embedder = config.embedder;
|
|
28554
28554
|
}
|
|
@@ -28561,7 +28561,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
28561
28561
|
}
|
|
28562
28562
|
if (config.embedder) {
|
|
28563
28563
|
if (typeof config.embedder === "string") {
|
|
28564
|
-
this.embedder = new
|
|
28564
|
+
this.embedder = new chunkFCW225T4_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
28565
28565
|
} else {
|
|
28566
28566
|
this.embedder = config.embedder;
|
|
28567
28567
|
}
|
|
@@ -28601,7 +28601,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
28601
28601
|
}
|
|
28602
28602
|
setEmbedder(embedder, embedderOptions) {
|
|
28603
28603
|
if (typeof embedder === "string") {
|
|
28604
|
-
this.embedder = new
|
|
28604
|
+
this.embedder = new chunkFCW225T4_cjs.ModelRouterEmbeddingModel(embedder);
|
|
28605
28605
|
} else {
|
|
28606
28606
|
this.embedder = embedder;
|
|
28607
28607
|
}
|
|
@@ -28698,7 +28698,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
28698
28698
|
"The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
|
|
28699
28699
|
);
|
|
28700
28700
|
}
|
|
28701
|
-
const mergedConfig =
|
|
28701
|
+
const mergedConfig = chunkXS3FHQ34_cjs.deepMerge(this.threadConfig, config || {});
|
|
28702
28702
|
if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
|
|
28703
28703
|
mergedConfig.workingMemory.schema = config.workingMemory.schema;
|
|
28704
28704
|
}
|
|
@@ -29050,7 +29050,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
29050
29050
|
} = {}) {
|
|
29051
29051
|
super({
|
|
29052
29052
|
name: "mock",
|
|
29053
|
-
storage: storage || new
|
|
29053
|
+
storage: storage || new chunkSRQR5UN6_cjs.InMemoryStore(),
|
|
29054
29054
|
options: {
|
|
29055
29055
|
...options,
|
|
29056
29056
|
workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : options?.workingMemory,
|
|
@@ -29377,5 +29377,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
|
|
|
29377
29377
|
exports.validateStepResumeData = validateStepResumeData;
|
|
29378
29378
|
exports.validateStepStateData = validateStepStateData;
|
|
29379
29379
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
29380
|
-
//# sourceMappingURL=chunk-
|
|
29381
|
-
//# sourceMappingURL=chunk-
|
|
29380
|
+
//# sourceMappingURL=chunk-SYH64AGV.cjs.map
|
|
29381
|
+
//# sourceMappingURL=chunk-SYH64AGV.cjs.map
|