@mastra/core 1.20.0 → 1.21.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 +34 -0
- package/dist/_types/@internal_core/dist/index.d.ts +12 -2
- package/dist/agent/agent-legacy.d.ts +2 -1
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts +32 -2
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +8 -8
- package/dist/agent/index.js +1 -1
- package/dist/{chunk-RB7WTRE2.js → chunk-2JJQDDEN.js} +8 -6
- package/dist/chunk-2JJQDDEN.js.map +1 -0
- package/dist/{chunk-2QO3IQWR.cjs → chunk-2STTKMFO.cjs} +82 -82
- package/dist/{chunk-2QO3IQWR.cjs.map → chunk-2STTKMFO.cjs.map} +1 -1
- package/dist/{chunk-3FW24B6P.cjs → chunk-3EPAGV3T.cjs} +4 -4
- package/dist/{chunk-3FW24B6P.cjs.map → chunk-3EPAGV3T.cjs.map} +1 -1
- package/dist/{chunk-F3OO446O.cjs → chunk-3OK3LWP4.cjs} +34 -32
- package/dist/chunk-3OK3LWP4.cjs.map +1 -0
- package/dist/{chunk-7JKIBZI7.js → chunk-5QQZSWLU.js} +4 -4
- package/dist/{chunk-7JKIBZI7.js.map → chunk-5QQZSWLU.js.map} +1 -1
- package/dist/{chunk-7URCVA7N.js → chunk-6PJQGNFV.js} +10 -10
- package/dist/chunk-6PJQGNFV.js.map +1 -0
- package/dist/{chunk-ED6CLXQI.cjs → chunk-75LYWKFT.cjs} +25 -25
- package/dist/chunk-75LYWKFT.cjs.map +1 -0
- package/dist/{chunk-53NCHPV5.cjs → chunk-AL5ACSAH.cjs} +7 -7
- package/dist/{chunk-53NCHPV5.cjs.map → chunk-AL5ACSAH.cjs.map} +1 -1
- package/dist/{chunk-S3JFAGMH.js → chunk-B4KB75RH.js} +67 -21
- package/dist/chunk-B4KB75RH.js.map +1 -0
- package/dist/{chunk-3R4YK3VD.js → chunk-CJA2FWKT.js} +3 -3
- package/dist/{chunk-3R4YK3VD.js.map → chunk-CJA2FWKT.js.map} +1 -1
- package/dist/{chunk-FQCASJGT.js → chunk-D7NEB3NV.js} +5 -5
- package/dist/{chunk-FQCASJGT.js.map → chunk-D7NEB3NV.js.map} +1 -1
- package/dist/{chunk-CRGRF7QL.cjs → chunk-E4TMODUG.cjs} +75 -29
- package/dist/chunk-E4TMODUG.cjs.map +1 -0
- package/dist/{chunk-Q4YIRO5A.js → chunk-ESQI2JRD.js} +5 -3
- package/dist/chunk-ESQI2JRD.js.map +1 -0
- package/dist/{chunk-57OYWNNV.cjs → chunk-EX2LVHTL.cjs} +97 -288
- package/dist/chunk-EX2LVHTL.cjs.map +1 -0
- package/dist/{chunk-J7AHOVB2.cjs → chunk-F6ZURDS4.cjs} +368 -218
- package/dist/chunk-F6ZURDS4.cjs.map +1 -0
- package/dist/chunk-FAULJTC5.js +290 -0
- package/dist/chunk-FAULJTC5.js.map +1 -0
- package/dist/{chunk-T72NHA2O.cjs → chunk-FJT6H2US.cjs} +3 -3
- package/dist/chunk-FJT6H2US.cjs.map +1 -0
- package/dist/{chunk-BCOOJFBB.js → chunk-GGJSRBFY.js} +13 -7
- package/dist/chunk-GGJSRBFY.js.map +1 -0
- package/dist/{chunk-CU6QKXLW.js → chunk-HU6OWHBI.js} +3 -3
- package/dist/{chunk-CU6QKXLW.js.map → chunk-HU6OWHBI.js.map} +1 -1
- package/dist/{chunk-JBOVTCTQ.cjs → chunk-I7AUCCNO.cjs} +69 -69
- package/dist/{chunk-JBOVTCTQ.cjs.map → chunk-I7AUCCNO.cjs.map} +1 -1
- package/dist/{chunk-GFRRPVRL.cjs → chunk-IG6JCDCL.cjs} +185 -185
- package/dist/{chunk-GFRRPVRL.cjs.map → chunk-IG6JCDCL.cjs.map} +1 -1
- package/dist/{chunk-UFXC6VJW.js → chunk-JB7HORUI.js} +3 -3
- package/dist/{chunk-UFXC6VJW.js.map → chunk-JB7HORUI.js.map} +1 -1
- package/dist/{chunk-2H6WEHWI.js → chunk-JBLN5IVV.js} +4 -4
- package/dist/{chunk-2H6WEHWI.js.map → chunk-JBLN5IVV.js.map} +1 -1
- package/dist/{chunk-HOAKFZ6P.js → chunk-JIA3SJK6.js} +198 -48
- package/dist/chunk-JIA3SJK6.js.map +1 -0
- package/dist/{chunk-MIWHSH7L.js → chunk-KLHD3PBK.js} +3 -3
- package/dist/chunk-KLHD3PBK.js.map +1 -0
- package/dist/{chunk-5PAHRQLU.js → chunk-ODUJYYA5.js} +32 -7
- package/dist/chunk-ODUJYYA5.js.map +1 -0
- package/dist/chunk-QRJSP5G2.cjs +300 -0
- package/dist/chunk-QRJSP5G2.cjs.map +1 -0
- package/dist/{chunk-7PYYVPF5.js → chunk-RF42EKVR.js} +6 -6
- package/dist/{chunk-7PYYVPF5.js.map → chunk-RF42EKVR.js.map} +1 -1
- package/dist/{chunk-L6AZQNL2.cjs → chunk-S6B5GIFC.cjs} +31 -25
- package/dist/chunk-S6B5GIFC.cjs.map +1 -0
- package/dist/{chunk-YEQJIM5W.cjs → chunk-TMRHUTY6.cjs} +15 -15
- package/dist/{chunk-YEQJIM5W.cjs.map → chunk-TMRHUTY6.cjs.map} +1 -1
- package/dist/{chunk-BZW4PQNA.cjs → chunk-UUNTJ256.cjs} +9 -7
- package/dist/chunk-UUNTJ256.cjs.map +1 -0
- package/dist/{chunk-RDHIVATT.cjs → chunk-VAACVUEO.cjs} +9 -9
- package/dist/{chunk-RDHIVATT.cjs.map → chunk-VAACVUEO.cjs.map} +1 -1
- package/dist/{chunk-UCCVELTP.js → chunk-VJKW6RRY.js} +7 -7
- package/dist/{chunk-UCCVELTP.js.map → chunk-VJKW6RRY.js.map} +1 -1
- package/dist/{chunk-2NISBCML.js → chunk-WG7QIVL7.js} +92 -280
- package/dist/chunk-WG7QIVL7.js.map +1 -0
- package/dist/{chunk-QG7NJ3JU.cjs → chunk-XANKVDSM.cjs} +10 -10
- package/dist/{chunk-QG7NJ3JU.cjs.map → chunk-XANKVDSM.cjs.map} +1 -1
- package/dist/{chunk-HVVHMUI4.cjs → chunk-Z745DCGY.cjs} +34 -9
- package/dist/chunk-Z745DCGY.cjs.map +1 -0
- package/dist/datasets/experiment/scorer.d.ts.map +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +3 -3
- package/dist/docs/assets/SOURCE_MAP.json +522 -522
- package/dist/docs/references/docs-server-mastra-client.md +12 -10
- package/dist/docs/references/docs-server-mastra-server.md +13 -1
- package/dist/docs/references/docs-studio-observability.md +9 -1
- package/dist/docs/references/docs-studio-overview.md +1 -1
- package/dist/docs/references/reference-agents-getLLM.md +9 -3
- package/dist/docs/references/reference.md +2 -0
- package/dist/evals/base.d.ts +29 -6
- package/dist/evals/base.d.ts.map +1 -1
- package/dist/evals/index.cjs +23 -23
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +21 -37
- package/dist/evals/scoreTraces/index.cjs.map +1 -1
- package/dist/evals/scoreTraces/index.js +18 -34
- package/dist/evals/scoreTraces/index.js.map +1 -1
- package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts +2 -3
- package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
- package/dist/evals/types.d.ts.map +1 -1
- 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 +16 -16
- package/dist/llm/index.js +5 -5
- package/dist/llm/model/provider-types.generated.d.ts +1 -0
- 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/hooks.d.ts +3 -0
- package/dist/mastra/hooks.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +3 -3
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-4HBR4MAS.js +3 -0
- package/dist/{models-dev-WTF6UG4D.js.map → models-dev-4HBR4MAS.js.map} +1 -1
- package/dist/models-dev-W2D3QNCX.cjs +12 -0
- package/dist/{models-dev-TKKI7LVH.cjs.map → models-dev-W2D3QNCX.cjs.map} +1 -1
- package/dist/netlify-A6TIZLU7.cjs +12 -0
- package/dist/{netlify-QCPWAYI2.cjs.map → netlify-A6TIZLU7.cjs.map} +1 -1
- package/dist/netlify-YRVEP6E4.js +3 -0
- package/dist/{netlify-V6N4TT4H.js.map → netlify-YRVEP6E4.js.map} +1 -1
- package/dist/observability/index.cjs +36 -32
- package/dist/observability/index.js +2 -2
- package/dist/observability/no-op.d.ts +1 -1
- package/dist/observability/no-op.d.ts.map +1 -1
- package/dist/observability/types/core.d.ts +15 -1
- package/dist/observability/types/core.d.ts.map +1 -1
- package/dist/observability/types/feedback.d.ts +2 -2
- package/dist/observability/types/feedback.d.ts.map +1 -1
- package/dist/observability/types/scores.d.ts +16 -7
- package/dist/observability/types/scores.d.ts.map +1 -1
- package/dist/observability/types/tracing.d.ts +27 -1
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/observability/utils.d.ts +12 -1
- package/dist/observability/utils.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-6ONBOGD7.cjs +40 -0
- package/dist/{provider-registry-C54SHAP6.cjs.map → provider-registry-6ONBOGD7.cjs.map} +1 -1
- package/dist/provider-registry-AIPF3CGZ.js +3 -0
- package/dist/{provider-registry-34O53EL4.js.map → provider-registry-AIPF3CGZ.js.map} +1 -1
- package/dist/provider-registry.json +4 -2
- 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/domains/observability/base.d.ts +4 -0
- package/dist/storage/domains/observability/base.d.ts.map +1 -1
- package/dist/storage/domains/observability/record-builders.d.ts.map +1 -1
- package/dist/storage/index.cjs +286 -286
- package/dist/storage/index.js +3 -3
- package/dist/stream/index.cjs +8 -8
- package/dist/stream/index.js +1 -1
- 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 +4 -4
- package/src/llm/model/provider-types.generated.d.ts +1 -0
- package/dist/chunk-2NISBCML.js.map +0 -1
- package/dist/chunk-57OYWNNV.cjs.map +0 -1
- package/dist/chunk-5PAHRQLU.js.map +0 -1
- package/dist/chunk-7URCVA7N.js.map +0 -1
- package/dist/chunk-AC5GUOWY.js +0 -72
- package/dist/chunk-AC5GUOWY.js.map +0 -1
- package/dist/chunk-BCOOJFBB.js.map +0 -1
- package/dist/chunk-BZW4PQNA.cjs.map +0 -1
- package/dist/chunk-CRGRF7QL.cjs.map +0 -1
- package/dist/chunk-ED6CLXQI.cjs.map +0 -1
- package/dist/chunk-EZHHTAJU.cjs +0 -78
- package/dist/chunk-EZHHTAJU.cjs.map +0 -1
- package/dist/chunk-F3OO446O.cjs.map +0 -1
- package/dist/chunk-HOAKFZ6P.js.map +0 -1
- package/dist/chunk-HVVHMUI4.cjs.map +0 -1
- package/dist/chunk-J7AHOVB2.cjs.map +0 -1
- package/dist/chunk-L6AZQNL2.cjs.map +0 -1
- package/dist/chunk-MIWHSH7L.js.map +0 -1
- package/dist/chunk-Q4YIRO5A.js.map +0 -1
- package/dist/chunk-RB7WTRE2.js.map +0 -1
- package/dist/chunk-S3JFAGMH.js.map +0 -1
- package/dist/chunk-T72NHA2O.cjs.map +0 -1
- package/dist/models-dev-TKKI7LVH.cjs +0 -12
- package/dist/models-dev-WTF6UG4D.js +0 -3
- package/dist/netlify-QCPWAYI2.cjs +0 -12
- package/dist/netlify-V6N4TT4H.js +0 -3
- package/dist/provider-registry-34O53EL4.js +0 -3
- package/dist/provider-registry-C54SHAP6.cjs +0 -40
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
var chunkGCMBY6NN_cjs = require('./chunk-GCMBY6NN.cjs');
|
|
4
4
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
5
5
|
var chunkSAAJ6W3X_cjs = require('./chunk-SAAJ6W3X.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkS6B5GIFC_cjs = require('./chunk-S6B5GIFC.cjs');
|
|
7
7
|
var chunkUWYGTSWV_cjs = require('./chunk-UWYGTSWV.cjs');
|
|
8
8
|
var chunkY3APFUXZ_cjs = require('./chunk-Y3APFUXZ.cjs');
|
|
9
9
|
var chunkCFMZZDO2_cjs = require('./chunk-CFMZZDO2.cjs');
|
|
10
10
|
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
11
|
+
var chunk2STTKMFO_cjs = require('./chunk-2STTKMFO.cjs');
|
|
12
|
+
var chunkTMRHUTY6_cjs = require('./chunk-TMRHUTY6.cjs');
|
|
13
|
+
var chunk3EPAGV3T_cjs = require('./chunk-3EPAGV3T.cjs');
|
|
14
14
|
var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var chunkXANKVDSM_cjs = require('./chunk-XANKVDSM.cjs');
|
|
16
|
+
var chunkQRJSP5G2_cjs = require('./chunk-QRJSP5G2.cjs');
|
|
17
17
|
var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
|
|
18
18
|
var chunk2OYWVA6F_cjs = require('./chunk-2OYWVA6F.cjs');
|
|
19
19
|
var chunkXB4FLS7A_cjs = require('./chunk-XB4FLS7A.cjs');
|
|
20
|
-
var
|
|
20
|
+
var chunkEX2LVHTL_cjs = require('./chunk-EX2LVHTL.cjs');
|
|
21
21
|
var chunk5WBEMKE2_cjs = require('./chunk-5WBEMKE2.cjs');
|
|
22
22
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
23
23
|
var chunkNDJ35CK6_cjs = require('./chunk-NDJ35CK6.cjs');
|
|
@@ -802,7 +802,7 @@ var StructuredOutputProcessor = class {
|
|
|
802
802
|
}
|
|
803
803
|
async processOutputStream(args) {
|
|
804
804
|
const { part, state, streamParts, abort, ...rest } = args;
|
|
805
|
-
const observabilityContext =
|
|
805
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
806
806
|
const controller = state.controller;
|
|
807
807
|
switch (part.type) {
|
|
808
808
|
case "finish":
|
|
@@ -1099,7 +1099,7 @@ var ProcessorState = class {
|
|
|
1099
1099
|
this.span = parentSpan?.createChildSpan({
|
|
1100
1100
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1101
1101
|
name: `output stream processor: ${options.processorName}`,
|
|
1102
|
-
entityType:
|
|
1102
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
1103
1103
|
entityName: options.processorName,
|
|
1104
1104
|
attributes: {
|
|
1105
1105
|
processorExecutor: "legacy",
|
|
@@ -1276,7 +1276,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1276
1276
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1277
1277
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1278
1278
|
name: `output processor: ${processor.id}`,
|
|
1279
|
-
entityType:
|
|
1279
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
1280
1280
|
entityId: processor.id,
|
|
1281
1281
|
entityName: processor.name,
|
|
1282
1282
|
attributes: {
|
|
@@ -1300,7 +1300,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1300
1300
|
state: processorState.customState,
|
|
1301
1301
|
result: result ?? defaultResult,
|
|
1302
1302
|
abort,
|
|
1303
|
-
...
|
|
1303
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1304
1304
|
requestContext,
|
|
1305
1305
|
retryCount,
|
|
1306
1306
|
writer
|
|
@@ -1433,7 +1433,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1433
1433
|
abort: (reason, options) => {
|
|
1434
1434
|
throw new TripWire(reason || `Stream part blocked by ${processor.id}`, options, processor.id);
|
|
1435
1435
|
},
|
|
1436
|
-
...
|
|
1436
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: state.span }),
|
|
1437
1437
|
requestContext,
|
|
1438
1438
|
messageList,
|
|
1439
1439
|
retryCount,
|
|
@@ -1576,7 +1576,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1576
1576
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1577
1577
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1578
1578
|
name: `input processor: ${processor.id}`,
|
|
1579
|
-
entityType:
|
|
1579
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.INPUT_PROCESSOR,
|
|
1580
1580
|
entityId: processor.id,
|
|
1581
1581
|
entityName: processor.name,
|
|
1582
1582
|
attributes: {
|
|
@@ -1594,7 +1594,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1594
1594
|
systemMessages: currentSystemMessages,
|
|
1595
1595
|
state: processorState.customState,
|
|
1596
1596
|
abort,
|
|
1597
|
-
...
|
|
1597
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1598
1598
|
messageList,
|
|
1599
1599
|
requestContext,
|
|
1600
1600
|
retryCount
|
|
@@ -1704,7 +1704,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1704
1704
|
*/
|
|
1705
1705
|
async runProcessInputStep(args) {
|
|
1706
1706
|
const { messageList, stepNumber, steps, requestContext, writer } = args;
|
|
1707
|
-
const observabilityContext =
|
|
1707
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(args);
|
|
1708
1708
|
const stepInput = {
|
|
1709
1709
|
messageId: args.messageId,
|
|
1710
1710
|
tools: args.tools,
|
|
@@ -1775,7 +1775,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1775
1775
|
const processorSpan = currentSpan?.createChildSpan({
|
|
1776
1776
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1777
1777
|
name: `input step processor: ${processor.id}`,
|
|
1778
|
-
entityType:
|
|
1778
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.INPUT_STEP_PROCESSOR,
|
|
1779
1779
|
entityId: processor.id,
|
|
1780
1780
|
entityName: processor.name,
|
|
1781
1781
|
attributes: {
|
|
@@ -1806,7 +1806,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1806
1806
|
return nextMessageId;
|
|
1807
1807
|
}
|
|
1808
1808
|
} : {},
|
|
1809
|
-
...
|
|
1809
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1810
1810
|
retryCount: args.retryCount ?? 0,
|
|
1811
1811
|
writer,
|
|
1812
1812
|
abortSignal: args.abortSignal
|
|
@@ -1900,7 +1900,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1900
1900
|
retryCount = 0,
|
|
1901
1901
|
writer
|
|
1902
1902
|
} = args;
|
|
1903
|
-
const observabilityContext =
|
|
1903
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(args);
|
|
1904
1904
|
for (const [index, processorOrWorkflow] of this.outputProcessors.entries()) {
|
|
1905
1905
|
const processableMessages = messageList.get.all.db();
|
|
1906
1906
|
const idsBeforeProcessing = processableMessages.map((m) => m.id);
|
|
@@ -1940,7 +1940,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1940
1940
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1941
1941
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1942
1942
|
name: `output step processor: ${processor.id}`,
|
|
1943
|
-
entityType:
|
|
1943
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.OUTPUT_STEP_PROCESSOR,
|
|
1944
1944
|
entityId: processor.id,
|
|
1945
1945
|
entityName: processor.name,
|
|
1946
1946
|
attributes: {
|
|
@@ -1964,7 +1964,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1964
1964
|
steps,
|
|
1965
1965
|
state: processorState.customState,
|
|
1966
1966
|
abort,
|
|
1967
|
-
...
|
|
1967
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1968
1968
|
requestContext,
|
|
1969
1969
|
retryCount,
|
|
1970
1970
|
writer
|
|
@@ -2077,7 +2077,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
2077
2077
|
}
|
|
2078
2078
|
const { model: _model, ...rest } = result;
|
|
2079
2079
|
if (result.model) {
|
|
2080
|
-
const resolvedModel = await
|
|
2080
|
+
const resolvedModel = await chunk2STTKMFO_cjs.resolveModelConfig(result.model);
|
|
2081
2081
|
const isSupported = isSupportedLanguageModel(resolvedModel);
|
|
2082
2082
|
if (!isSupported) {
|
|
2083
2083
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -2822,7 +2822,7 @@ var MastraModelOutput = class extends chunkNDJ35CK6_cjs.MastraBase {
|
|
|
2822
2822
|
this.#transportRef = options.transportRef;
|
|
2823
2823
|
this.#returnScorerData = !!options.returnScorerData;
|
|
2824
2824
|
this.runId = options.runId;
|
|
2825
|
-
const resultSpan =
|
|
2825
|
+
const resultSpan = chunkEX2LVHTL_cjs.getRootExportSpan(options.tracingContext?.currentSpan);
|
|
2826
2826
|
this.traceId = resultSpan?.externalTraceId;
|
|
2827
2827
|
this.spanId = resultSpan?.id;
|
|
2828
2828
|
this.#model = _model;
|
|
@@ -2884,7 +2884,7 @@ var MastraModelOutput = class extends chunkNDJ35CK6_cjs.MastraBase {
|
|
|
2884
2884
|
} = await processorRunner.processPart(
|
|
2885
2885
|
chunk,
|
|
2886
2886
|
processorStates,
|
|
2887
|
-
|
|
2887
|
+
chunkQRJSP5G2_cjs.resolveObservabilityContext(options),
|
|
2888
2888
|
options.requestContext,
|
|
2889
2889
|
self.messageList,
|
|
2890
2890
|
0,
|
|
@@ -3276,7 +3276,7 @@ var MastraModelOutput = class extends chunkNDJ35CK6_cjs.MastraBase {
|
|
|
3276
3276
|
};
|
|
3277
3277
|
self.messageList = await self.processorRunner.runOutputProcessors(
|
|
3278
3278
|
self.messageList,
|
|
3279
|
-
|
|
3279
|
+
chunkQRJSP5G2_cjs.resolveObservabilityContext(options),
|
|
3280
3280
|
self.#options.requestContext,
|
|
3281
3281
|
0,
|
|
3282
3282
|
outputResultWriter,
|
|
@@ -4851,7 +4851,7 @@ var getModelOutputForTripwire = async ({
|
|
|
4851
4851
|
messageList,
|
|
4852
4852
|
...rest
|
|
4853
4853
|
}) => {
|
|
4854
|
-
const observabilityContext =
|
|
4854
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
4855
4855
|
const tripwireStream = new web.ReadableStream({
|
|
4856
4856
|
start(controller) {
|
|
4857
4857
|
controller.enqueue({
|
|
@@ -5503,7 +5503,7 @@ var createTimeTravelExecutionParams = (params) => {
|
|
|
5503
5503
|
result = void 0;
|
|
5504
5504
|
}
|
|
5505
5505
|
if (result) {
|
|
5506
|
-
const formattedResult =
|
|
5506
|
+
const formattedResult = chunkXANKVDSM_cjs.removeUndefinedValues(result);
|
|
5507
5507
|
stepResults[stepId] = formattedResult;
|
|
5508
5508
|
}
|
|
5509
5509
|
});
|
|
@@ -5595,7 +5595,7 @@ async function executeParallel(engine, params) {
|
|
|
5595
5595
|
perStep,
|
|
5596
5596
|
...rest
|
|
5597
5597
|
} = params;
|
|
5598
|
-
const observabilityContext =
|
|
5598
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
5599
5599
|
const parallelSpan = await engine.createChildSpan({
|
|
5600
5600
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
5601
5601
|
operationId: `workflow.${workflowId}.run.${runId}.parallel.${executionContext.executionPath.join("-")}.span.start`,
|
|
@@ -5673,7 +5673,7 @@ async function executeParallel(engine, params) {
|
|
|
5673
5673
|
state: executionContext.state,
|
|
5674
5674
|
tracingIds: executionContext.tracingIds
|
|
5675
5675
|
},
|
|
5676
|
-
...
|
|
5676
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: parallelSpan }),
|
|
5677
5677
|
pubsub,
|
|
5678
5678
|
abortController,
|
|
5679
5679
|
requestContext,
|
|
@@ -5749,7 +5749,7 @@ async function executeConditional(engine, params) {
|
|
|
5749
5749
|
perStep,
|
|
5750
5750
|
...rest
|
|
5751
5751
|
} = params;
|
|
5752
|
-
const observabilityContext =
|
|
5752
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
5753
5753
|
const conditionalSpan = await engine.createChildSpan({
|
|
5754
5754
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
5755
5755
|
operationId: `workflow.${workflowId}.run.${runId}.conditional.${executionContext.executionPath.join("-")}.span.start`,
|
|
@@ -5791,7 +5791,7 @@ async function executeConditional(engine, params) {
|
|
|
5791
5791
|
inputData: prevOutput,
|
|
5792
5792
|
state: executionContext.state,
|
|
5793
5793
|
retryCount: -1,
|
|
5794
|
-
...
|
|
5794
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: evalSpan }),
|
|
5795
5795
|
getInitData: () => stepResults?.input,
|
|
5796
5796
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
5797
5797
|
bail: (() => {
|
|
@@ -5912,7 +5912,7 @@ async function executeConditional(engine, params) {
|
|
|
5912
5912
|
state: executionContext.state,
|
|
5913
5913
|
tracingIds: executionContext.tracingIds
|
|
5914
5914
|
},
|
|
5915
|
-
...
|
|
5915
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: conditionalSpan }),
|
|
5916
5916
|
pubsub,
|
|
5917
5917
|
abortController,
|
|
5918
5918
|
requestContext,
|
|
@@ -5989,7 +5989,7 @@ async function executeLoop(engine, params) {
|
|
|
5989
5989
|
perStep,
|
|
5990
5990
|
...rest
|
|
5991
5991
|
} = params;
|
|
5992
|
-
const observabilityContext =
|
|
5992
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
5993
5993
|
const { step, condition } = entry;
|
|
5994
5994
|
const loopSpan = await engine.createChildSpan({
|
|
5995
5995
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -6025,7 +6025,7 @@ async function executeLoop(engine, params) {
|
|
|
6025
6025
|
resume: currentResume,
|
|
6026
6026
|
timeTravel: currentTimeTravel,
|
|
6027
6027
|
prevOutput: result.output,
|
|
6028
|
-
...
|
|
6028
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: loopSpan }),
|
|
6029
6029
|
pubsub,
|
|
6030
6030
|
abortController,
|
|
6031
6031
|
requestContext,
|
|
@@ -6061,7 +6061,7 @@ async function executeLoop(engine, params) {
|
|
|
6061
6061
|
options: {
|
|
6062
6062
|
type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
|
|
6063
6063
|
name: `condition: '${entry.loopType}'`,
|
|
6064
|
-
input:
|
|
6064
|
+
input: chunkXANKVDSM_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
|
|
6065
6065
|
attributes: {
|
|
6066
6066
|
conditionIndex: iteration
|
|
6067
6067
|
},
|
|
@@ -6079,7 +6079,7 @@ async function executeLoop(engine, params) {
|
|
|
6079
6079
|
inputData: result.output,
|
|
6080
6080
|
state: executionContext.state,
|
|
6081
6081
|
retryCount: -1,
|
|
6082
|
-
...
|
|
6082
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: evalSpan }),
|
|
6083
6083
|
iterationCount: iteration + 1,
|
|
6084
6084
|
getInitData: () => stepResults?.input,
|
|
6085
6085
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
@@ -6151,7 +6151,7 @@ async function executeForeach(engine, params) {
|
|
|
6151
6151
|
perStep,
|
|
6152
6152
|
...rest
|
|
6153
6153
|
} = params;
|
|
6154
|
-
const observabilityContext =
|
|
6154
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
6155
6155
|
const { step, opts } = entry;
|
|
6156
6156
|
const results = [];
|
|
6157
6157
|
const concurrency = opts.concurrency;
|
|
@@ -6227,7 +6227,7 @@ async function executeForeach(engine, params) {
|
|
|
6227
6227
|
executionContext: { ...executionContext, foreachIndex: k },
|
|
6228
6228
|
resume: resumeToUse,
|
|
6229
6229
|
prevOutput: item,
|
|
6230
|
-
...
|
|
6230
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: loopSpan }),
|
|
6231
6231
|
pubsub,
|
|
6232
6232
|
abortController,
|
|
6233
6233
|
requestContext,
|
|
@@ -6514,7 +6514,7 @@ async function executeEntry(engine, params) {
|
|
|
6514
6514
|
perStep,
|
|
6515
6515
|
...rest
|
|
6516
6516
|
} = params;
|
|
6517
|
-
const observabilityContext =
|
|
6517
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
6518
6518
|
const prevOutput = engine.getStepOutput(stepResults, prevStep);
|
|
6519
6519
|
let execResults;
|
|
6520
6520
|
let entryRequestContext;
|
|
@@ -6983,7 +6983,7 @@ async function executeSleep(engine, params) {
|
|
|
6983
6983
|
outputWriter,
|
|
6984
6984
|
...rest
|
|
6985
6985
|
} = params;
|
|
6986
|
-
const observabilityContext =
|
|
6986
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
6987
6987
|
let { duration, fn } = entry;
|
|
6988
6988
|
const sleepSpan = await engine.createChildSpan({
|
|
6989
6989
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -7012,7 +7012,7 @@ async function executeSleep(engine, params) {
|
|
|
7012
7012
|
executionContext.state = state;
|
|
7013
7013
|
},
|
|
7014
7014
|
retryCount: -1,
|
|
7015
|
-
...
|
|
7015
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: sleepSpan }),
|
|
7016
7016
|
getInitData: () => stepResults?.input,
|
|
7017
7017
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
7018
7018
|
// TODO: this function shouldn't have suspend probably?
|
|
@@ -7073,7 +7073,7 @@ async function executeSleepUntil(engine, params) {
|
|
|
7073
7073
|
outputWriter,
|
|
7074
7074
|
...rest
|
|
7075
7075
|
} = params;
|
|
7076
|
-
const observabilityContext =
|
|
7076
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
7077
7077
|
let { date, fn } = entry;
|
|
7078
7078
|
const sleepUntilSpan = await engine.createChildSpan({
|
|
7079
7079
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -7103,7 +7103,7 @@ async function executeSleepUntil(engine, params) {
|
|
|
7103
7103
|
executionContext.state = state;
|
|
7104
7104
|
},
|
|
7105
7105
|
retryCount: -1,
|
|
7106
|
-
...
|
|
7106
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: sleepUntilSpan }),
|
|
7107
7107
|
getInitData: () => stepResults?.input,
|
|
7108
7108
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
7109
7109
|
// TODO: this function shouldn't have suspend probably?
|
|
@@ -7182,7 +7182,7 @@ async function executeStep(engine, params) {
|
|
|
7182
7182
|
perStep,
|
|
7183
7183
|
...rest
|
|
7184
7184
|
} = params;
|
|
7185
|
-
const observabilityContext =
|
|
7185
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
7186
7186
|
const stepCallId = crypto2.randomUUID();
|
|
7187
7187
|
const { inputData, validationError: inputValidationError } = await validateStepInput({
|
|
7188
7188
|
prevOutput,
|
|
@@ -7233,7 +7233,7 @@ async function executeStep(engine, params) {
|
|
|
7233
7233
|
options: {
|
|
7234
7234
|
name: `workflow step: '${step.id}'`,
|
|
7235
7235
|
type: "workflow_step" /* WORKFLOW_STEP */,
|
|
7236
|
-
entityType:
|
|
7236
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.WORKFLOW_STEP,
|
|
7237
7237
|
entityId: step.id,
|
|
7238
7238
|
input: inputData,
|
|
7239
7239
|
tracingPolicy: engine.options?.tracingPolicy,
|
|
@@ -7321,7 +7321,7 @@ async function executeStep(engine, params) {
|
|
|
7321
7321
|
deprecationMessage: runCountDeprecationMessage,
|
|
7322
7322
|
logger: engine.getLogger()
|
|
7323
7323
|
});
|
|
7324
|
-
return
|
|
7324
|
+
return chunkEX2LVHTL_cjs.executeWithContext({ span: stepSpan, fn: () => step.execute(proxiedData) });
|
|
7325
7325
|
};
|
|
7326
7326
|
let execResults;
|
|
7327
7327
|
const retries = step.retries ?? executionContext.retryConfig.attempts ?? 0;
|
|
@@ -7346,7 +7346,7 @@ async function executeStep(engine, params) {
|
|
|
7346
7346
|
requestContextUpdate: null
|
|
7347
7347
|
};
|
|
7348
7348
|
const isNestedWorkflow = step.component === "WORKFLOW";
|
|
7349
|
-
const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra :
|
|
7349
|
+
const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra : chunkQRJSP5G2_cjs.wrapMastra(engine.mastra, { currentSpan: stepSpan }) : void 0;
|
|
7350
7350
|
const output = await runStep({
|
|
7351
7351
|
runId,
|
|
7352
7352
|
resourceId,
|
|
@@ -7369,7 +7369,7 @@ async function executeStep(engine, params) {
|
|
|
7369
7369
|
retryCount,
|
|
7370
7370
|
resumeData: resumeDataToUse,
|
|
7371
7371
|
suspendData: suspendDataToUse,
|
|
7372
|
-
...
|
|
7372
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: stepSpan }),
|
|
7373
7373
|
getInitData: () => stepResults?.input,
|
|
7374
7374
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
7375
7375
|
suspend: async (suspendPayload, suspendOptions) => {
|
|
@@ -7471,7 +7471,7 @@ async function executeStep(engine, params) {
|
|
|
7471
7471
|
stepId: step.id,
|
|
7472
7472
|
requestContext,
|
|
7473
7473
|
disableScorers,
|
|
7474
|
-
...
|
|
7474
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: stepSpan })
|
|
7475
7475
|
});
|
|
7476
7476
|
}
|
|
7477
7477
|
if (durableResult.suspended) {
|
|
@@ -7527,7 +7527,7 @@ async function executeStep(engine, params) {
|
|
|
7527
7527
|
}
|
|
7528
7528
|
async function runScorersForStep(params) {
|
|
7529
7529
|
const { engine, scorers, runId, input, output, workflowId, stepId, requestContext, disableScorers, ...rest } = params;
|
|
7530
|
-
const observabilityContext =
|
|
7530
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
7531
7531
|
let scorersToUse = scorers;
|
|
7532
7532
|
if (typeof scorersToUse === "function") {
|
|
7533
7533
|
try {
|
|
@@ -8100,7 +8100,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
8100
8100
|
resume,
|
|
8101
8101
|
timeTravel,
|
|
8102
8102
|
restart,
|
|
8103
|
-
...
|
|
8103
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: workflowSpan }),
|
|
8104
8104
|
abortController: params.abortController,
|
|
8105
8105
|
pubsub: params.pubsub,
|
|
8106
8106
|
requestContext: currentRequestContext,
|
|
@@ -8406,7 +8406,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
|
|
|
8406
8406
|
writer,
|
|
8407
8407
|
...rest
|
|
8408
8408
|
}) => {
|
|
8409
|
-
const observabilityContext =
|
|
8409
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
8410
8410
|
let streamPromise = {};
|
|
8411
8411
|
streamPromise.promise = new Promise((resolve2, reject) => {
|
|
8412
8412
|
streamPromise.resolve = resolve2;
|
|
@@ -8534,7 +8534,7 @@ function createStepFromTool(params, toolOpts) {
|
|
|
8534
8534
|
setState,
|
|
8535
8535
|
...rest
|
|
8536
8536
|
}) => {
|
|
8537
|
-
const observabilityContext =
|
|
8537
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
8538
8538
|
const toolContext = {
|
|
8539
8539
|
mastra,
|
|
8540
8540
|
requestContext,
|
|
@@ -8558,16 +8558,16 @@ function createStepFromProcessor(processor) {
|
|
|
8558
8558
|
const getProcessorEntityType = (phase) => {
|
|
8559
8559
|
switch (phase) {
|
|
8560
8560
|
case "input":
|
|
8561
|
-
return
|
|
8561
|
+
return chunkEX2LVHTL_cjs.EntityType.INPUT_PROCESSOR;
|
|
8562
8562
|
case "inputStep":
|
|
8563
|
-
return
|
|
8563
|
+
return chunkEX2LVHTL_cjs.EntityType.INPUT_STEP_PROCESSOR;
|
|
8564
8564
|
case "outputStream":
|
|
8565
8565
|
case "outputResult":
|
|
8566
|
-
return
|
|
8566
|
+
return chunkEX2LVHTL_cjs.EntityType.OUTPUT_PROCESSOR;
|
|
8567
8567
|
case "outputStep":
|
|
8568
|
-
return
|
|
8568
|
+
return chunkEX2LVHTL_cjs.EntityType.OUTPUT_STEP_PROCESSOR;
|
|
8569
8569
|
default:
|
|
8570
|
-
return
|
|
8570
|
+
return chunkEX2LVHTL_cjs.EntityType.OUTPUT_PROCESSOR;
|
|
8571
8571
|
}
|
|
8572
8572
|
};
|
|
8573
8573
|
const getSpanNamePrefix = (phase) => {
|
|
@@ -8665,7 +8665,7 @@ function createStepFromProcessor(processor) {
|
|
|
8665
8665
|
processorIndex: processor.processorIndex
|
|
8666
8666
|
}
|
|
8667
8667
|
}) : void 0;
|
|
8668
|
-
const processorObservabilityContext =
|
|
8668
|
+
const processorObservabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext(
|
|
8669
8669
|
processorSpan ? { currentSpan: processorSpan } : tracingContext
|
|
8670
8670
|
);
|
|
8671
8671
|
const processorWriter = outputWriter ? {
|
|
@@ -8723,7 +8723,7 @@ function createStepFromProcessor(processor) {
|
|
|
8723
8723
|
};
|
|
8724
8724
|
const executePhaseWithSpan = async (fn) => {
|
|
8725
8725
|
try {
|
|
8726
|
-
const result = await
|
|
8726
|
+
const result = await chunkEX2LVHTL_cjs.executeWithContext({ span: processorSpan, fn });
|
|
8727
8727
|
processorSpan?.end({ output: result });
|
|
8728
8728
|
return result;
|
|
8729
8729
|
} catch (error) {
|
|
@@ -8867,7 +8867,7 @@ function createStepFromProcessor(processor) {
|
|
|
8867
8867
|
processorSpan2 = parentSpan.createChildSpan({
|
|
8868
8868
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
8869
8869
|
name: `output stream processor: ${processor.id}`,
|
|
8870
|
-
entityType:
|
|
8870
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
8871
8871
|
entityId: processor.id,
|
|
8872
8872
|
entityName: processor.name ?? processor.id,
|
|
8873
8873
|
input: { phase, totalChunks: 0 },
|
|
@@ -8884,7 +8884,7 @@ function createStepFromProcessor(processor) {
|
|
|
8884
8884
|
totalChunks: (streamParts ?? []).length
|
|
8885
8885
|
};
|
|
8886
8886
|
}
|
|
8887
|
-
const processorObservabilityContext2 =
|
|
8887
|
+
const processorObservabilityContext2 = chunkQRJSP5G2_cjs.createObservabilityContext(
|
|
8888
8888
|
processorSpan2 ? { currentSpan: processorSpan2 } : baseContext.tracingContext
|
|
8889
8889
|
);
|
|
8890
8890
|
let result;
|
|
@@ -9630,7 +9630,7 @@ var Workflow = class extends chunkNDJ35CK6_cjs.MastraBase {
|
|
|
9630
9630
|
bail: _bail,
|
|
9631
9631
|
...rest
|
|
9632
9632
|
}) {
|
|
9633
|
-
const observabilityContext =
|
|
9633
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
9634
9634
|
this.__registerMastra(mastra);
|
|
9635
9635
|
const effectiveValidateInputs = validateInputs ?? this.#options.validateInputs ?? true;
|
|
9636
9636
|
this.#options = {
|
|
@@ -10128,11 +10128,11 @@ var Run = class {
|
|
|
10128
10128
|
perStep,
|
|
10129
10129
|
...rest
|
|
10130
10130
|
}) {
|
|
10131
|
-
const observabilityContext =
|
|
10132
|
-
const workflowSpan =
|
|
10131
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
10132
|
+
const workflowSpan = chunkEX2LVHTL_cjs.getOrCreateSpan({
|
|
10133
10133
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
10134
10134
|
name: `workflow run: '${this.workflowId}'`,
|
|
10135
|
-
entityType:
|
|
10135
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.WORKFLOW_RUN,
|
|
10136
10136
|
entityId: this.workflowId,
|
|
10137
10137
|
input: inputData,
|
|
10138
10138
|
metadata: {
|
|
@@ -10209,7 +10209,7 @@ var Run = class {
|
|
|
10209
10209
|
tracingOptions,
|
|
10210
10210
|
...rest
|
|
10211
10211
|
} = {}) {
|
|
10212
|
-
const observabilityContext =
|
|
10212
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
10213
10213
|
if (this.closeStreamAction) {
|
|
10214
10214
|
return {
|
|
10215
10215
|
stream: this.observeStreamLegacy().stream,
|
|
@@ -10334,7 +10334,7 @@ var Run = class {
|
|
|
10334
10334
|
perStep,
|
|
10335
10335
|
...rest
|
|
10336
10336
|
}) {
|
|
10337
|
-
const observabilityContext =
|
|
10337
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
10338
10338
|
if (this.closeStreamAction && this.streamOutput) {
|
|
10339
10339
|
return this.streamOutput;
|
|
10340
10340
|
}
|
|
@@ -10435,7 +10435,7 @@ var Run = class {
|
|
|
10435
10435
|
perStep,
|
|
10436
10436
|
...rest
|
|
10437
10437
|
} = {}) {
|
|
10438
|
-
const observabilityContext =
|
|
10438
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
10439
10439
|
this.closeStreamAction = async () => {
|
|
10440
10440
|
};
|
|
10441
10441
|
const self = this;
|
|
@@ -10564,7 +10564,7 @@ var Run = class {
|
|
|
10564
10564
|
return this._restart(args);
|
|
10565
10565
|
}
|
|
10566
10566
|
async _resume(params) {
|
|
10567
|
-
const observabilityContext =
|
|
10567
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(params);
|
|
10568
10568
|
const workflowsStore = await this.#mastra?.getStorage()?.getStore("workflows");
|
|
10569
10569
|
const snapshot = await workflowsStore?.loadWorkflowSnapshot({
|
|
10570
10570
|
workflowName: this.workflowId,
|
|
@@ -10648,10 +10648,10 @@ var Run = class {
|
|
|
10648
10648
|
traceId: effectiveTraceId,
|
|
10649
10649
|
parentSpanId: shouldUsePersistedParentSpan ? persistedTracingContext?.spanId : params.tracingOptions?.parentSpanId
|
|
10650
10650
|
};
|
|
10651
|
-
const workflowSpan =
|
|
10651
|
+
const workflowSpan = chunkEX2LVHTL_cjs.getOrCreateSpan({
|
|
10652
10652
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
10653
10653
|
name: `workflow run: '${this.workflowId}' (resumed)`,
|
|
10654
|
-
entityType:
|
|
10654
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.WORKFLOW_RUN,
|
|
10655
10655
|
entityId: this.workflowId,
|
|
10656
10656
|
input: resumeDataToUse,
|
|
10657
10657
|
metadata: {
|
|
@@ -10715,7 +10715,7 @@ var Run = class {
|
|
|
10715
10715
|
tracingOptions,
|
|
10716
10716
|
...rest
|
|
10717
10717
|
}) {
|
|
10718
|
-
const observabilityContext =
|
|
10718
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
10719
10719
|
if (this.workflowEngineType !== "default") {
|
|
10720
10720
|
throw new Error(`restart() is not supported on ${this.workflowEngineType} workflows`);
|
|
10721
10721
|
}
|
|
@@ -10767,10 +10767,10 @@ var Run = class {
|
|
|
10767
10767
|
requestContextToUse.set(key, value);
|
|
10768
10768
|
}
|
|
10769
10769
|
}
|
|
10770
|
-
const workflowSpan =
|
|
10770
|
+
const workflowSpan = chunkEX2LVHTL_cjs.getOrCreateSpan({
|
|
10771
10771
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
10772
10772
|
name: `workflow run: '${this.workflowId}'`,
|
|
10773
|
-
entityType:
|
|
10773
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.WORKFLOW_RUN,
|
|
10774
10774
|
entityId: this.workflowId,
|
|
10775
10775
|
metadata: {
|
|
10776
10776
|
resourceId: this.resourceId,
|
|
@@ -10820,7 +10820,7 @@ var Run = class {
|
|
|
10820
10820
|
perStep,
|
|
10821
10821
|
...rest
|
|
10822
10822
|
}) {
|
|
10823
|
-
const observabilityContext =
|
|
10823
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
10824
10824
|
if (!stepParam || Array.isArray(stepParam) && stepParam.length === 0) {
|
|
10825
10825
|
throw new Error("Step is required and must be a valid step or array of steps");
|
|
10826
10826
|
}
|
|
@@ -10864,11 +10864,11 @@ var Run = class {
|
|
|
10864
10864
|
requestContextToUse.set(key, value);
|
|
10865
10865
|
}
|
|
10866
10866
|
}
|
|
10867
|
-
const workflowSpan =
|
|
10867
|
+
const workflowSpan = chunkEX2LVHTL_cjs.getOrCreateSpan({
|
|
10868
10868
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
10869
10869
|
name: `workflow run: '${this.workflowId}'`,
|
|
10870
10870
|
input: inputData,
|
|
10871
|
-
entityType:
|
|
10871
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.WORKFLOW_RUN,
|
|
10872
10872
|
entityId: this.workflowId,
|
|
10873
10873
|
metadata: {
|
|
10874
10874
|
resourceId: this.resourceId,
|
|
@@ -10922,7 +10922,7 @@ var Run = class {
|
|
|
10922
10922
|
perStep,
|
|
10923
10923
|
...rest
|
|
10924
10924
|
}) {
|
|
10925
|
-
const observabilityContext =
|
|
10925
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
10926
10926
|
this.closeStreamAction = async () => {
|
|
10927
10927
|
};
|
|
10928
10928
|
const self = this;
|
|
@@ -11215,6 +11215,15 @@ var MastraScorer = class _MastraScorer {
|
|
|
11215
11215
|
get hasGenerateScore() {
|
|
11216
11216
|
return this.steps.some((step) => step.name === "generateScore");
|
|
11217
11217
|
}
|
|
11218
|
+
normalizeRunRequestContext(requestContext) {
|
|
11219
|
+
if (!requestContext) {
|
|
11220
|
+
return void 0;
|
|
11221
|
+
}
|
|
11222
|
+
if (requestContext instanceof chunk5WBEMKE2_cjs.RequestContext) {
|
|
11223
|
+
return requestContext;
|
|
11224
|
+
}
|
|
11225
|
+
return new chunk5WBEMKE2_cjs.RequestContext(Object.entries(requestContext));
|
|
11226
|
+
}
|
|
11218
11227
|
async run(input) {
|
|
11219
11228
|
if (!this.hasGenerateScore) {
|
|
11220
11229
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -11228,21 +11237,70 @@ var MastraScorer = class _MastraScorer {
|
|
|
11228
11237
|
}
|
|
11229
11238
|
});
|
|
11230
11239
|
}
|
|
11231
|
-
const observabilityContext = chunk57OYWNNV_cjs.resolveObservabilityContext(input);
|
|
11232
11240
|
let runId = input.runId;
|
|
11233
11241
|
if (!runId) {
|
|
11234
11242
|
runId = crypto2.randomUUID();
|
|
11235
11243
|
}
|
|
11236
|
-
const
|
|
11237
|
-
const
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11244
|
+
const normalizedRequestContext = this.normalizeRunRequestContext(input.requestContext);
|
|
11245
|
+
const evalSpan = chunkEX2LVHTL_cjs.getOrCreateSpan({
|
|
11246
|
+
type: "scorer_run" /* SCORER_RUN */,
|
|
11247
|
+
name: `scorer run: '${this.id}'`,
|
|
11248
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.SCORER,
|
|
11249
|
+
entityId: this.id,
|
|
11250
|
+
input: {
|
|
11251
|
+
input: input.input,
|
|
11252
|
+
output: input.output,
|
|
11253
|
+
groundTruth: input.groundTruth,
|
|
11254
|
+
expectedTrajectory: input.expectedTrajectory,
|
|
11255
|
+
requestContext: normalizedRequestContext
|
|
11242
11256
|
},
|
|
11243
|
-
|
|
11257
|
+
attributes: {
|
|
11258
|
+
scorerId: this.id,
|
|
11259
|
+
scorerName: this.name,
|
|
11260
|
+
...input.scoreSource ? { scoreSource: input.scoreSource } : {},
|
|
11261
|
+
...input.targetScope ? { targetScope: input.targetScope } : {},
|
|
11262
|
+
...input.targetEntityType ? { targetEntityType: input.targetEntityType } : {},
|
|
11263
|
+
...this.source ? { scorerDefinition: this.source } : {}
|
|
11264
|
+
},
|
|
11265
|
+
metadata: {
|
|
11266
|
+
...input.targetTraceId ? { targetTraceId: input.targetTraceId } : {},
|
|
11267
|
+
...input.targetSpanId ? { targetSpanId: input.targetSpanId } : {}
|
|
11268
|
+
},
|
|
11269
|
+
mastra: this.#mastra
|
|
11244
11270
|
});
|
|
11271
|
+
const run = {
|
|
11272
|
+
...input,
|
|
11273
|
+
runId,
|
|
11274
|
+
...evalSpan?.traceId ? { scoreTraceId: evalSpan.traceId } : {}
|
|
11275
|
+
};
|
|
11276
|
+
const scorerObservabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: evalSpan });
|
|
11277
|
+
let workflow;
|
|
11278
|
+
let workflowRun;
|
|
11279
|
+
try {
|
|
11280
|
+
workflow = this.toMastraWorkflow();
|
|
11281
|
+
workflowRun = await workflow.createRun();
|
|
11282
|
+
} catch (error) {
|
|
11283
|
+
evalSpan?.error({ error, endSpan: true });
|
|
11284
|
+
throw error;
|
|
11285
|
+
}
|
|
11286
|
+
let workflowResult;
|
|
11287
|
+
try {
|
|
11288
|
+
workflowResult = await chunkEX2LVHTL_cjs.executeWithContext({
|
|
11289
|
+
span: evalSpan,
|
|
11290
|
+
fn: () => workflowRun.start({
|
|
11291
|
+
inputData: {
|
|
11292
|
+
run
|
|
11293
|
+
},
|
|
11294
|
+
...scorerObservabilityContext
|
|
11295
|
+
})
|
|
11296
|
+
});
|
|
11297
|
+
} catch (error) {
|
|
11298
|
+
evalSpan?.error({ error, endSpan: true });
|
|
11299
|
+
throw error;
|
|
11300
|
+
}
|
|
11245
11301
|
if (workflowResult.status === "failed") {
|
|
11302
|
+
const workflowFailure = workflowResult.error instanceof Error ? workflowResult.error : new Error(typeof workflowResult.error === "string" ? workflowResult.error : "Scorer workflow failed");
|
|
11303
|
+
evalSpan?.error({ error: workflowFailure, endSpan: true });
|
|
11246
11304
|
throw new chunk4U7ZLI36_cjs.MastraError(
|
|
11247
11305
|
{
|
|
11248
11306
|
id: "MASTR_SCORER_FAILED_TO_RUN_WORKFLOW_FAILED",
|
|
@@ -11257,7 +11315,46 @@ var MastraScorer = class _MastraScorer {
|
|
|
11257
11315
|
workflowResult.error instanceof Error ? workflowResult.error : void 0
|
|
11258
11316
|
);
|
|
11259
11317
|
}
|
|
11260
|
-
|
|
11318
|
+
const scorerResult = this.transformToScorerResult({ workflowResult, originalInput: run });
|
|
11319
|
+
evalSpan?.end({
|
|
11320
|
+
output: {
|
|
11321
|
+
success: true,
|
|
11322
|
+
score: typeof scorerResult.score === "number" ? scorerResult.score : null,
|
|
11323
|
+
reason: typeof scorerResult.reason === "string" ? scorerResult.reason : null
|
|
11324
|
+
}
|
|
11325
|
+
});
|
|
11326
|
+
if (this.#mastra?.observability.addScore && typeof scorerResult.score === "number") {
|
|
11327
|
+
try {
|
|
11328
|
+
if (!input.targetTraceId) {
|
|
11329
|
+
return scorerResult;
|
|
11330
|
+
}
|
|
11331
|
+
await this.#mastra.observability.addScore({
|
|
11332
|
+
traceId: input.targetTraceId,
|
|
11333
|
+
...input.targetSpanId ? { spanId: input.targetSpanId } : {},
|
|
11334
|
+
score: {
|
|
11335
|
+
scorerId: this.id,
|
|
11336
|
+
scorerName: this.name,
|
|
11337
|
+
...input.scoreSource ? { scoreSource: input.scoreSource } : {},
|
|
11338
|
+
score: scorerResult.score,
|
|
11339
|
+
...typeof scorerResult.reason === "string" ? { reason: scorerResult.reason } : {},
|
|
11340
|
+
...typeof scorerResult.scoreTraceId === "string" ? { scoreTraceId: scorerResult.scoreTraceId } : {},
|
|
11341
|
+
...input.targetEntityType ? { targetEntityType: input.targetEntityType } : {},
|
|
11342
|
+
metadata: {
|
|
11343
|
+
hasGroundTruth: input.groundTruth !== void 0,
|
|
11344
|
+
...input.targetScope ? { targetScope: input.targetScope } : {},
|
|
11345
|
+
...this.source ? { scorerDefinition: this.source } : {}
|
|
11346
|
+
}
|
|
11347
|
+
// TODO: Add targetEntityId / targetEntityName once the score event/storage
|
|
11348
|
+
// contract has first-class fields for unanchored score target identity.
|
|
11349
|
+
// TODO: Add any remaining correlation context that is useful when a
|
|
11350
|
+
// score is emitted without a target trace/span anchor.
|
|
11351
|
+
}
|
|
11352
|
+
});
|
|
11353
|
+
} catch (error) {
|
|
11354
|
+
this.#mastra.getLogger()?.warn?.(`Failed to emit score to observability for scorer ${this.id}:`, error);
|
|
11355
|
+
}
|
|
11356
|
+
}
|
|
11357
|
+
return scorerResult;
|
|
11261
11358
|
}
|
|
11262
11359
|
isPromptObject(stepDef) {
|
|
11263
11360
|
if (typeof stepDef === "object" && "description" in stepDef && "createPrompt" in stepDef && !("outputSchema" in stepDef)) {
|
|
@@ -11267,11 +11364,14 @@ var MastraScorer = class _MastraScorer {
|
|
|
11267
11364
|
return isOtherPromptObject;
|
|
11268
11365
|
}
|
|
11269
11366
|
getSteps() {
|
|
11270
|
-
return this.steps.map((step) =>
|
|
11271
|
-
name: step.
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11367
|
+
return this.steps.map((step) => {
|
|
11368
|
+
const description = step.isPromptObject ? this.originalPromptObjects.get(step.name)?.description : step.definition?.description;
|
|
11369
|
+
return {
|
|
11370
|
+
name: step.name,
|
|
11371
|
+
type: step.isPromptObject ? "prompt" : "function",
|
|
11372
|
+
description
|
|
11373
|
+
};
|
|
11374
|
+
});
|
|
11275
11375
|
}
|
|
11276
11376
|
toMastraWorkflow() {
|
|
11277
11377
|
const workflowSteps = this.steps.map((scorerStep) => {
|
|
@@ -11281,22 +11381,66 @@ var MastraScorer = class _MastraScorer {
|
|
|
11281
11381
|
inputSchema: v4.z.any(),
|
|
11282
11382
|
outputSchema: v4.z.any(),
|
|
11283
11383
|
execute: async ({ inputData, getInitData, ...rest }) => {
|
|
11284
|
-
const observabilityContext =
|
|
11384
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
11285
11385
|
const { accumulatedResults = {}, generatedPrompts = {} } = inputData;
|
|
11286
11386
|
const { run } = getInitData();
|
|
11287
11387
|
const context = this.createScorerContext(scorerStep.name, run, accumulatedResults);
|
|
11388
|
+
const currentSpan = observabilityContext.tracingContext.currentSpan;
|
|
11389
|
+
const scorerRunSpan = currentSpan?.type === "scorer_run" /* SCORER_RUN */ ? currentSpan : currentSpan?.findParent("scorer_run" /* SCORER_RUN */);
|
|
11390
|
+
const stepSpan = scorerRunSpan?.createChildSpan({
|
|
11391
|
+
type: "scorer_step" /* SCORER_STEP */,
|
|
11392
|
+
name: `scorer step: '${scorerStep.name}'`,
|
|
11393
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.SCORER,
|
|
11394
|
+
entityId: this.config.id ?? this.config.name,
|
|
11395
|
+
input: context,
|
|
11396
|
+
attributes: {
|
|
11397
|
+
step: scorerStep.name,
|
|
11398
|
+
stepType: scorerStep.isPromptObject ? "prompt" : "function"
|
|
11399
|
+
}
|
|
11400
|
+
});
|
|
11401
|
+
const stepObservabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: stepSpan });
|
|
11402
|
+
const executionContext = {
|
|
11403
|
+
...context,
|
|
11404
|
+
...stepObservabilityContext
|
|
11405
|
+
};
|
|
11288
11406
|
let stepResult;
|
|
11289
|
-
let
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11407
|
+
let prompt;
|
|
11408
|
+
let judgeModel;
|
|
11409
|
+
try {
|
|
11410
|
+
await chunkEX2LVHTL_cjs.executeWithContext({
|
|
11411
|
+
span: stepSpan,
|
|
11412
|
+
fn: async () => {
|
|
11413
|
+
if (scorerStep.isPromptObject) {
|
|
11414
|
+
const promptStepResult = await this.executePromptStep(
|
|
11415
|
+
scorerStep,
|
|
11416
|
+
stepObservabilityContext,
|
|
11417
|
+
executionContext
|
|
11418
|
+
);
|
|
11419
|
+
stepResult = promptStepResult.result;
|
|
11420
|
+
prompt = promptStepResult.prompt;
|
|
11421
|
+
judgeModel = promptStepResult.judgeModel;
|
|
11422
|
+
} else {
|
|
11423
|
+
stepResult = await this.executeFunctionStep(scorerStep, executionContext);
|
|
11424
|
+
}
|
|
11425
|
+
}
|
|
11426
|
+
});
|
|
11427
|
+
} catch (error) {
|
|
11428
|
+
stepSpan?.error({ error, endSpan: true });
|
|
11429
|
+
throw error;
|
|
11299
11430
|
}
|
|
11431
|
+
if (prompt !== void 0 || judgeModel !== void 0) {
|
|
11432
|
+
stepSpan?.update({
|
|
11433
|
+
attributes: {
|
|
11434
|
+
...prompt !== void 0 ? { prompt } : {},
|
|
11435
|
+
...judgeModel !== void 0 ? { judgeModel } : {}
|
|
11436
|
+
}
|
|
11437
|
+
});
|
|
11438
|
+
}
|
|
11439
|
+
stepSpan?.end({ output: stepResult });
|
|
11440
|
+
const newGeneratedPrompts = prompt !== void 0 ? {
|
|
11441
|
+
...generatedPrompts,
|
|
11442
|
+
[`${scorerStep.name}Prompt`]: prompt
|
|
11443
|
+
} : generatedPrompts;
|
|
11300
11444
|
const newAccumulatedResults = {
|
|
11301
11445
|
...accumulatedResults,
|
|
11302
11446
|
[`${scorerStep.name}StepResult`]: stepResult
|
|
@@ -11328,14 +11472,10 @@ var MastraScorer = class _MastraScorer {
|
|
|
11328
11472
|
generateReasonPrompt: v4.z.string().optional()
|
|
11329
11473
|
}),
|
|
11330
11474
|
options: {
|
|
11331
|
-
// mark all spans generated as part of the scorer workflow internal
|
|
11332
|
-
tracingPolicy: {
|
|
11333
|
-
internal: 15 /* ALL */
|
|
11334
|
-
},
|
|
11335
11475
|
validateInputs: false
|
|
11336
11476
|
}
|
|
11337
11477
|
});
|
|
11338
|
-
workflow.__setLogger(this.#mastra?.getLogger() ??
|
|
11478
|
+
workflow.__setLogger(this.#mastra?.getLogger() ?? chunk3EPAGV3T_cjs.noopLogger);
|
|
11339
11479
|
let chainedWorkflow = workflow;
|
|
11340
11480
|
for (const step of workflowSteps) {
|
|
11341
11481
|
chainedWorkflow = chainedWorkflow.then(step);
|
|
@@ -11372,13 +11512,13 @@ var MastraScorer = class _MastraScorer {
|
|
|
11372
11512
|
}
|
|
11373
11513
|
});
|
|
11374
11514
|
}
|
|
11375
|
-
const resolvedModel = await
|
|
11515
|
+
const resolvedModel = await chunk2STTKMFO_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
|
|
11516
|
+
const judgeModel = resolvedModel.modelId;
|
|
11376
11517
|
const judge = new Agent({
|
|
11377
11518
|
id: "judge",
|
|
11378
11519
|
name: "judge",
|
|
11379
11520
|
model: resolvedModel,
|
|
11380
|
-
instructions
|
|
11381
|
-
options: { tracingPolicy: { internal: 15 /* ALL */ } }
|
|
11521
|
+
instructions
|
|
11382
11522
|
});
|
|
11383
11523
|
if (scorerStep.name === "generateScore") {
|
|
11384
11524
|
let result;
|
|
@@ -11399,7 +11539,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
11399
11539
|
...observabilityContext
|
|
11400
11540
|
});
|
|
11401
11541
|
}
|
|
11402
|
-
return { result: result.object.score, prompt };
|
|
11542
|
+
return { result: result.object.score, prompt, judgeModel };
|
|
11403
11543
|
} else if (scorerStep.name === "generateReason") {
|
|
11404
11544
|
let result;
|
|
11405
11545
|
if (isSupportedLanguageModel(resolvedModel)) {
|
|
@@ -11407,7 +11547,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
11407
11547
|
} else {
|
|
11408
11548
|
result = await judge.generateLegacy(prompt, { ...observabilityContext });
|
|
11409
11549
|
}
|
|
11410
|
-
return { result: result.text, prompt };
|
|
11550
|
+
return { result: result.text, prompt, judgeModel };
|
|
11411
11551
|
} else {
|
|
11412
11552
|
const promptStep = originalStep;
|
|
11413
11553
|
const standardSchema = chunkXB4FLS7A_cjs.toStandardSchema(promptStep.outputSchema);
|
|
@@ -11425,7 +11565,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
11425
11565
|
...observabilityContext
|
|
11426
11566
|
});
|
|
11427
11567
|
}
|
|
11428
|
-
return { result: result.object, prompt };
|
|
11568
|
+
return { result: result.object, prompt, judgeModel };
|
|
11429
11569
|
}
|
|
11430
11570
|
}
|
|
11431
11571
|
transformToScorerResult({
|
|
@@ -11603,7 +11743,7 @@ async function runDefaultCompletionCheck(agent, context, streamContext, abortSig
|
|
|
11603
11743
|
Primitives already executed: ${completedPrimitives.join(", ")}` : "";
|
|
11604
11744
|
const completionPrompt = `
|
|
11605
11745
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} has contributed to the task.
|
|
11606
|
-
This is the result: ${
|
|
11746
|
+
This is the result: ${chunkXANKVDSM_cjs.safeStringify(context.primitiveResult)}
|
|
11607
11747
|
|
|
11608
11748
|
${completedSection}
|
|
11609
11749
|
|
|
@@ -11699,7 +11839,7 @@ async function generateFinalResult(agent, context, streamContext, abortSignal, o
|
|
|
11699
11839
|
Original task: ${context.originalTask}
|
|
11700
11840
|
|
|
11701
11841
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
|
|
11702
|
-
${
|
|
11842
|
+
${chunkXANKVDSM_cjs.safeStringify(context.primitiveResult)}
|
|
11703
11843
|
|
|
11704
11844
|
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.
|
|
11705
11845
|
You should evaluate if the above result is comprehensive enough to accomplish the user's original task.
|
|
@@ -11757,7 +11897,7 @@ async function generateStructuredFinalResult(agent, context, structuredOutputOpt
|
|
|
11757
11897
|
Original task: ${context.originalTask}
|
|
11758
11898
|
|
|
11759
11899
|
The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
|
|
11760
|
-
${
|
|
11900
|
+
${chunkXANKVDSM_cjs.safeStringify(context.primitiveResult)}
|
|
11761
11901
|
|
|
11762
11902
|
Based on the task and result above, generate a structured response according to the provided schema.
|
|
11763
11903
|
Use the conversation history and primitive results to craft the response.
|
|
@@ -12803,7 +12943,7 @@ function createLLMExecutionStep({
|
|
|
12803
12943
|
const processInputStepResult = await processorRunner.runProcessInputStep({
|
|
12804
12944
|
messageList,
|
|
12805
12945
|
stepNumber: inputData.output?.steps?.length || 0,
|
|
12806
|
-
...
|
|
12946
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext(stepTracingContext),
|
|
12807
12947
|
requestContext,
|
|
12808
12948
|
model,
|
|
12809
12949
|
steps: inputData.output?.steps || [],
|
|
@@ -12857,7 +12997,7 @@ function createLLMExecutionStep({
|
|
|
12857
12997
|
const convertedTools = {};
|
|
12858
12998
|
for (const [name, tool2] of Object.entries(currentStep.tools)) {
|
|
12859
12999
|
if (chunk2OYWVA6F_cjs.isMastraTool(tool2)) {
|
|
12860
|
-
convertedTools[name] =
|
|
13000
|
+
convertedTools[name] = chunkXANKVDSM_cjs.makeCoreTool(
|
|
12861
13001
|
tool2,
|
|
12862
13002
|
{
|
|
12863
13003
|
name,
|
|
@@ -12999,7 +13139,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
12999
13139
|
}
|
|
13000
13140
|
}
|
|
13001
13141
|
if (isSupportedLanguageModel(currentStep.model)) {
|
|
13002
|
-
modelResult =
|
|
13142
|
+
modelResult = chunkEX2LVHTL_cjs.executeWithContextSync({
|
|
13003
13143
|
span: modelSpanTracker?.getTracingContext()?.currentSpan,
|
|
13004
13144
|
fn: () => execute({
|
|
13005
13145
|
runId,
|
|
@@ -13069,7 +13209,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
13069
13209
|
}
|
|
13070
13210
|
});
|
|
13071
13211
|
let transportResolver;
|
|
13072
|
-
if (currentStep.model instanceof
|
|
13212
|
+
if (currentStep.model instanceof chunk2STTKMFO_cjs.ModelRouterLanguageModel) {
|
|
13073
13213
|
const routerModel = currentStep.model;
|
|
13074
13214
|
transportResolver = () => routerModel._getStreamTransport();
|
|
13075
13215
|
}
|
|
@@ -13232,7 +13372,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
13232
13372
|
finishReason: immediateFinishReason,
|
|
13233
13373
|
toolCalls: toolCallInfos.length > 0 ? toolCallInfos : void 0,
|
|
13234
13374
|
text: immediateText,
|
|
13235
|
-
...
|
|
13375
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext(outputStepTracingContext),
|
|
13236
13376
|
requestContext,
|
|
13237
13377
|
retryCount: currentRetryCount,
|
|
13238
13378
|
writer: processorWriter
|
|
@@ -13352,7 +13492,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
13352
13492
|
agentName: "LLMMappingStep",
|
|
13353
13493
|
processorStates: rest.processorStates
|
|
13354
13494
|
}) : void 0;
|
|
13355
|
-
const observabilityContext =
|
|
13495
|
+
const observabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
|
|
13356
13496
|
const streamWriter = rest.outputWriter ? { custom: async (data) => rest.outputWriter(data) } : void 0;
|
|
13357
13497
|
async function processAndEnqueueChunk(chunk) {
|
|
13358
13498
|
if (processorRunner && rest.processorStates) {
|
|
@@ -13965,7 +14105,7 @@ function createToolCallStep({
|
|
|
13965
14105
|
}
|
|
13966
14106
|
}
|
|
13967
14107
|
const rawResult = await tool2.execute(args, toolOptions);
|
|
13968
|
-
const result =
|
|
14108
|
+
const result = chunkXANKVDSM_cjs.ensureSerializable(rawResult);
|
|
13969
14109
|
if (tool2 && "onOutput" in tool2 && typeof tool2.onOutput === "function") {
|
|
13970
14110
|
try {
|
|
13971
14111
|
await tool2.onOutput({
|
|
@@ -14428,12 +14568,12 @@ function workflowLoopStream({
|
|
|
14428
14568
|
}
|
|
14429
14569
|
const executionResult = resumeContext ? await run.resume({
|
|
14430
14570
|
resumeData: resumeContext.resumeData,
|
|
14431
|
-
...
|
|
14571
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
|
|
14432
14572
|
requestContext,
|
|
14433
14573
|
label: toolCallId
|
|
14434
14574
|
}) : await run.start({
|
|
14435
14575
|
inputData: initialData,
|
|
14436
|
-
...
|
|
14576
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
|
|
14437
14577
|
requestContext
|
|
14438
14578
|
});
|
|
14439
14579
|
if (executionResult.status !== "success") {
|
|
@@ -14576,7 +14716,7 @@ function loop({
|
|
|
14576
14716
|
}
|
|
14577
14717
|
const baseStream = workflowLoopStream(workflowLoopProps);
|
|
14578
14718
|
const stream = rest.modelSpanTracker?.wrapStream(baseStream) ?? baseStream;
|
|
14579
|
-
const observabilityContext =
|
|
14719
|
+
const observabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
|
|
14580
14720
|
modelOutput = new MastraModelOutput({
|
|
14581
14721
|
model: {
|
|
14582
14722
|
modelId: firstModel.model.modelId,
|
|
@@ -14708,7 +14848,7 @@ var MastraLLMVNext = class extends chunkNDJ35CK6_cjs.MastraBase {
|
|
|
14708
14848
|
workspace,
|
|
14709
14849
|
...rest
|
|
14710
14850
|
}) {
|
|
14711
|
-
const observabilityContext =
|
|
14851
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
14712
14852
|
let stopWhenToUse;
|
|
14713
14853
|
if (maxSteps && typeof maxSteps === "number") {
|
|
14714
14854
|
stopWhenToUse = chunkY3APFUXZ_cjs.stepCountIs(maxSteps);
|
|
@@ -14738,7 +14878,7 @@ var MastraLLMVNext = class extends chunkNDJ35CK6_cjs.MastraBase {
|
|
|
14738
14878
|
requestContext
|
|
14739
14879
|
});
|
|
14740
14880
|
if (modelSpan) {
|
|
14741
|
-
|
|
14881
|
+
chunkEX2LVHTL_cjs.executeWithContextSync({
|
|
14742
14882
|
span: modelSpan,
|
|
14743
14883
|
fn: () => this.logger.debug("Streaming text", {
|
|
14744
14884
|
runId,
|
|
@@ -14825,7 +14965,7 @@ var MastraLLMVNext = class extends chunkNDJ35CK6_cjs.MastraBase {
|
|
|
14825
14965
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
14826
14966
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
14827
14967
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
14828
|
-
await
|
|
14968
|
+
await chunkXANKVDSM_cjs.delay(10 * 1e3);
|
|
14829
14969
|
}
|
|
14830
14970
|
},
|
|
14831
14971
|
onFinish: async (props) => {
|
|
@@ -15063,7 +15203,7 @@ async function prepareMemoryStep({
|
|
|
15063
15203
|
memoryConfig,
|
|
15064
15204
|
...rest
|
|
15065
15205
|
}) {
|
|
15066
|
-
const observabilityContext =
|
|
15206
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
15067
15207
|
const memory = await routingAgent.getMemory({ requestContext });
|
|
15068
15208
|
let thread = await memory?.getThreadById({ threadId });
|
|
15069
15209
|
if (!thread) {
|
|
@@ -15165,7 +15305,7 @@ async function saveMessagesWithProcessors(memory, messages, processorRunner, con
|
|
|
15165
15305
|
const { requestContext, ...observabilityContext } = context ?? {};
|
|
15166
15306
|
await processorRunner.runOutputProcessors(
|
|
15167
15307
|
messageList,
|
|
15168
|
-
|
|
15308
|
+
chunkQRJSP5G2_cjs.resolveObservabilityContext(observabilityContext),
|
|
15169
15309
|
requestContext
|
|
15170
15310
|
);
|
|
15171
15311
|
const processedMessages = messageList.get.response.db();
|
|
@@ -15243,7 +15383,7 @@ async function createNetworkLoop({
|
|
|
15243
15383
|
const processorRunner = configuredOutputProcessors.length > 0 ? new ProcessorRunner({
|
|
15244
15384
|
outputProcessors: configuredOutputProcessors,
|
|
15245
15385
|
inputProcessors: [],
|
|
15246
|
-
logger: agent.getMastraInstance()?.getLogger() ||
|
|
15386
|
+
logger: agent.getMastraInstance()?.getLogger() || chunk3EPAGV3T_cjs.noopLogger,
|
|
15247
15387
|
agentName: agent.name
|
|
15248
15388
|
}) : null;
|
|
15249
15389
|
const routingStep = createStep({
|
|
@@ -16316,7 +16456,7 @@ async function createNetworkLoop({
|
|
|
16316
16456
|
memory,
|
|
16317
16457
|
context: inputDataToUse,
|
|
16318
16458
|
// TODO: Pass proper tracing context when network supports tracing
|
|
16319
|
-
...
|
|
16459
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: void 0 }),
|
|
16320
16460
|
writer
|
|
16321
16461
|
},
|
|
16322
16462
|
{ toolCallId, messages: [] }
|
|
@@ -16604,7 +16744,7 @@ async function networkLoop({
|
|
|
16604
16744
|
requestContext,
|
|
16605
16745
|
messageList,
|
|
16606
16746
|
agentId: routingAgent.id,
|
|
16607
|
-
...
|
|
16747
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
|
|
16608
16748
|
structuredOutput: {
|
|
16609
16749
|
schema: v4.z.object({
|
|
16610
16750
|
resumeData: v4.z.string()
|
|
@@ -16982,7 +17122,7 @@ async function networkLoop({
|
|
|
16982
17122
|
messages,
|
|
16983
17123
|
routingAgent,
|
|
16984
17124
|
generateId: generateId2,
|
|
16985
|
-
...
|
|
17125
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
|
|
16986
17126
|
memoryConfig: routingAgentMemoryOptions?.options
|
|
16987
17127
|
});
|
|
16988
17128
|
return new MastraAgentNetworkStream({
|
|
@@ -17191,13 +17331,13 @@ var AgentLegacyHandler = class {
|
|
|
17191
17331
|
tracingOptions,
|
|
17192
17332
|
...rest
|
|
17193
17333
|
}) {
|
|
17194
|
-
const observabilityContext =
|
|
17334
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
17195
17335
|
return {
|
|
17196
17336
|
before: async () => {
|
|
17197
|
-
const agentSpan =
|
|
17337
|
+
const agentSpan = chunkEX2LVHTL_cjs.getOrCreateSpan({
|
|
17198
17338
|
type: "agent_run" /* AGENT_RUN */,
|
|
17199
17339
|
name: `agent run: '${this.capabilities.id}'`,
|
|
17200
|
-
entityType:
|
|
17340
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.AGENT,
|
|
17201
17341
|
entityId: this.capabilities.id,
|
|
17202
17342
|
entityName: this.capabilities.name,
|
|
17203
17343
|
input: {
|
|
@@ -17222,7 +17362,7 @@ var AgentLegacyHandler = class {
|
|
|
17222
17362
|
requestContext,
|
|
17223
17363
|
mastra: this.capabilities.mastra
|
|
17224
17364
|
});
|
|
17225
|
-
const innerObservabilityContext =
|
|
17365
|
+
const innerObservabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
17226
17366
|
const memory = await this.capabilities.getMemory({ requestContext });
|
|
17227
17367
|
const threadId = thread?.id;
|
|
17228
17368
|
const convertedTools = await this.capabilities.convertTools({
|
|
@@ -17451,7 +17591,7 @@ var AgentLegacyHandler = class {
|
|
|
17451
17591
|
if (shouldGenerate && !thread2.title && messages2.length >= requiredMessages) {
|
|
17452
17592
|
const userMessage = this.capabilities.getMostRecentUserMessage(uiMessages);
|
|
17453
17593
|
if (userMessage) {
|
|
17454
|
-
const observabilityContext2 =
|
|
17594
|
+
const observabilityContext2 = chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
17455
17595
|
promises.push(
|
|
17456
17596
|
this.capabilities.genTitle(userMessage, requestContext, observabilityContext2, titleModel, titleInstructions).then((title) => {
|
|
17457
17597
|
if (title) {
|
|
@@ -17521,7 +17661,7 @@ var AgentLegacyHandler = class {
|
|
|
17521
17661
|
overrideScorers,
|
|
17522
17662
|
threadId,
|
|
17523
17663
|
resourceId,
|
|
17524
|
-
...
|
|
17664
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan })
|
|
17525
17665
|
});
|
|
17526
17666
|
const scoringData = {
|
|
17527
17667
|
input: {
|
|
@@ -17589,7 +17729,10 @@ var AgentLegacyHandler = class {
|
|
|
17589
17729
|
resourceId
|
|
17590
17730
|
}) || crypto2.randomUUID();
|
|
17591
17731
|
const instructions = args.instructions || await this.capabilities.getInstructions({ requestContext });
|
|
17592
|
-
const llm = await this.capabilities.getLLM({
|
|
17732
|
+
const llm = await this.capabilities.getLLM({
|
|
17733
|
+
requestContext,
|
|
17734
|
+
model: args.model
|
|
17735
|
+
});
|
|
17593
17736
|
const memory = await this.capabilities.getMemory({ requestContext });
|
|
17594
17737
|
const { before, after } = this.__primitive({
|
|
17595
17738
|
messages,
|
|
@@ -17605,7 +17748,7 @@ var AgentLegacyHandler = class {
|
|
|
17605
17748
|
writableStream,
|
|
17606
17749
|
methodType,
|
|
17607
17750
|
tracingOptions,
|
|
17608
|
-
...
|
|
17751
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(args)
|
|
17609
17752
|
});
|
|
17610
17753
|
let messageList;
|
|
17611
17754
|
let thread;
|
|
@@ -17770,7 +17913,7 @@ var AgentLegacyHandler = class {
|
|
|
17770
17913
|
return tripwireResult;
|
|
17771
17914
|
}
|
|
17772
17915
|
const { experimental_output, output, agentSpan, ...llmOptions } = beforeResult;
|
|
17773
|
-
const observabilityContext =
|
|
17916
|
+
const observabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
17774
17917
|
let finalOutputProcessors = mergedGenerateOptions.outputProcessors;
|
|
17775
17918
|
if (!output || experimental_output) {
|
|
17776
17919
|
const result2 = await llmToUse.__text({
|
|
@@ -18058,7 +18201,7 @@ var AgentLegacyHandler = class {
|
|
|
18058
18201
|
}
|
|
18059
18202
|
const { onFinish, runId, output, experimental_output, agentSpan, messageList, requestContext, ...llmOptions } = beforeResult;
|
|
18060
18203
|
const overrideScorers = mergedStreamOptions.scorers;
|
|
18061
|
-
const observabilityContext =
|
|
18204
|
+
const observabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
18062
18205
|
if (!output || experimental_output) {
|
|
18063
18206
|
const streamResult = llm.__stream({
|
|
18064
18207
|
...llmOptions,
|
|
@@ -18382,7 +18525,7 @@ function createMapResultsStep({
|
|
|
18382
18525
|
const modelOutput = await getModelOutputForTripwire({
|
|
18383
18526
|
tripwire: memoryData.tripwire,
|
|
18384
18527
|
runId,
|
|
18385
|
-
...
|
|
18528
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
18386
18529
|
options,
|
|
18387
18530
|
model: agentModel,
|
|
18388
18531
|
messageList: memoryData.messageList
|
|
@@ -18436,7 +18579,7 @@ function createMapResultsStep({
|
|
|
18436
18579
|
methodType: modelMethodType,
|
|
18437
18580
|
agentId,
|
|
18438
18581
|
requestContext: result.requestContext,
|
|
18439
|
-
...
|
|
18582
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
18440
18583
|
runId,
|
|
18441
18584
|
toolChoice: result.toolChoice,
|
|
18442
18585
|
tools: result.tools,
|
|
@@ -18609,7 +18752,7 @@ function createPrepareMemoryStep({
|
|
|
18609
18752
|
inputSchema: v4.z.object({}),
|
|
18610
18753
|
outputSchema: prepareMemoryStepOutputSchema,
|
|
18611
18754
|
execute: async ({ ...rest }) => {
|
|
18612
|
-
const observabilityContext =
|
|
18755
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
18613
18756
|
const thread = threadFromArgs;
|
|
18614
18757
|
const messageList = new chunkUWYGTSWV_cjs.MessageList({
|
|
18615
18758
|
threadId: thread?.id,
|
|
@@ -18729,7 +18872,7 @@ function createPrepareToolsStep({
|
|
|
18729
18872
|
resourceId,
|
|
18730
18873
|
runId,
|
|
18731
18874
|
requestContext,
|
|
18732
|
-
...
|
|
18875
|
+
...chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
18733
18876
|
outputWriter: options.outputWriter,
|
|
18734
18877
|
methodType,
|
|
18735
18878
|
memoryConfig: options.memory?.options,
|
|
@@ -18783,7 +18926,7 @@ function createStreamStep({
|
|
|
18783
18926
|
...validatedInputData,
|
|
18784
18927
|
outputProcessors: processors,
|
|
18785
18928
|
returnScorerData,
|
|
18786
|
-
...
|
|
18929
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(observabilityContext),
|
|
18787
18930
|
requireToolApproval,
|
|
18788
18931
|
toolCallConcurrency,
|
|
18789
18932
|
resumeContext,
|
|
@@ -19849,7 +19992,7 @@ ${errorMessages}`,
|
|
|
19849
19992
|
*/
|
|
19850
19993
|
listTools({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
19851
19994
|
if (typeof this.#tools !== "function") {
|
|
19852
|
-
return
|
|
19995
|
+
return chunkXANKVDSM_cjs.ensureToolProperties(this.#tools);
|
|
19853
19996
|
}
|
|
19854
19997
|
const result = this.#tools({
|
|
19855
19998
|
requestContext,
|
|
@@ -19869,7 +20012,7 @@ ${errorMessages}`,
|
|
|
19869
20012
|
this.logger.trackException(mastraError);
|
|
19870
20013
|
throw mastraError;
|
|
19871
20014
|
}
|
|
19872
|
-
return
|
|
20015
|
+
return chunkXANKVDSM_cjs.ensureToolProperties(tools);
|
|
19873
20016
|
});
|
|
19874
20017
|
}
|
|
19875
20018
|
/**
|
|
@@ -19917,7 +20060,7 @@ ${errorMessages}`,
|
|
|
19917
20060
|
});
|
|
19918
20061
|
});
|
|
19919
20062
|
} else {
|
|
19920
|
-
llm = new
|
|
20063
|
+
llm = new chunkTMRHUTY6_cjs.MastraLLMV1({
|
|
19921
20064
|
model: modelInfo,
|
|
19922
20065
|
mastra: this.#mastra,
|
|
19923
20066
|
options: { tracingPolicy: this.#options?.tracingPolicy }
|
|
@@ -19943,7 +20086,7 @@ ${errorMessages}`,
|
|
|
19943
20086
|
*/
|
|
19944
20087
|
async resolveModelConfig(modelConfig, requestContext) {
|
|
19945
20088
|
try {
|
|
19946
|
-
return await
|
|
20089
|
+
return await chunk2STTKMFO_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
|
|
19947
20090
|
} catch (error) {
|
|
19948
20091
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
19949
20092
|
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
@@ -20261,7 +20404,7 @@ ${errorMessages}`,
|
|
|
20261
20404
|
instructions,
|
|
20262
20405
|
...rest
|
|
20263
20406
|
}) {
|
|
20264
|
-
const observabilityContext =
|
|
20407
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20265
20408
|
const llm = await this.getLLM({ requestContext, model });
|
|
20266
20409
|
const normMessage = new chunkUWYGTSWV_cjs.MessageList().add(message, "user").get.all.aiV5.ui().at(-1);
|
|
20267
20410
|
if (!normMessage) {
|
|
@@ -20384,7 +20527,7 @@ ${errorMessages}`,
|
|
|
20384
20527
|
autoResumeSuspendedTools,
|
|
20385
20528
|
...rest
|
|
20386
20529
|
}) {
|
|
20387
|
-
const observabilityContext =
|
|
20530
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20388
20531
|
let convertedMemoryTools = {};
|
|
20389
20532
|
if (this._agentNetworkAppend) {
|
|
20390
20533
|
this.logger.debug("Skipping memory tools (agent network context)", { agent: this.name, runId });
|
|
@@ -20415,7 +20558,7 @@ ${errorMessages}`,
|
|
|
20415
20558
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20416
20559
|
requireApproval: toolObj.requireApproval
|
|
20417
20560
|
};
|
|
20418
|
-
const convertedToCoreTool =
|
|
20561
|
+
const convertedToCoreTool = chunkXANKVDSM_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20419
20562
|
convertedMemoryTools[toolName] = convertedToCoreTool;
|
|
20420
20563
|
}
|
|
20421
20564
|
}
|
|
@@ -20434,7 +20577,7 @@ ${errorMessages}`,
|
|
|
20434
20577
|
autoResumeSuspendedTools,
|
|
20435
20578
|
...rest
|
|
20436
20579
|
}) {
|
|
20437
|
-
const observabilityContext =
|
|
20580
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20438
20581
|
let convertedWorkspaceTools = {};
|
|
20439
20582
|
if (this._agentNetworkAppend) {
|
|
20440
20583
|
this.logger.debug("Skipping workspace tools (agent network context)", { agent: this.name, runId });
|
|
@@ -20465,7 +20608,7 @@ ${errorMessages}`,
|
|
|
20465
20608
|
requireApproval: toolObj.requireApproval,
|
|
20466
20609
|
workspace
|
|
20467
20610
|
};
|
|
20468
|
-
const convertedToCoreTool =
|
|
20611
|
+
const convertedToCoreTool = chunkXANKVDSM_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20469
20612
|
convertedWorkspaceTools[toolName] = convertedToCoreTool;
|
|
20470
20613
|
}
|
|
20471
20614
|
}
|
|
@@ -20487,7 +20630,7 @@ ${errorMessages}`,
|
|
|
20487
20630
|
autoResumeSuspendedTools,
|
|
20488
20631
|
...rest
|
|
20489
20632
|
}) {
|
|
20490
|
-
const observabilityContext =
|
|
20633
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20491
20634
|
let convertedSkillTools = {};
|
|
20492
20635
|
if (this._agentNetworkAppend) {
|
|
20493
20636
|
return convertedSkillTools;
|
|
@@ -20518,7 +20661,7 @@ ${errorMessages}`,
|
|
|
20518
20661
|
// Skill tools never require approval
|
|
20519
20662
|
workspace
|
|
20520
20663
|
};
|
|
20521
|
-
const convertedToCoreTool =
|
|
20664
|
+
const convertedToCoreTool = chunkXANKVDSM_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20522
20665
|
convertedSkillTools[toolName] = convertedToCoreTool;
|
|
20523
20666
|
}
|
|
20524
20667
|
}
|
|
@@ -20584,7 +20727,7 @@ ${errorMessages}`,
|
|
|
20584
20727
|
*/
|
|
20585
20728
|
async __runProcessInputStep(args) {
|
|
20586
20729
|
const { requestContext, messageList, stepNumber = 0, processorStates, ...rest } = args;
|
|
20587
|
-
const observabilityContext =
|
|
20730
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20588
20731
|
let tripwire;
|
|
20589
20732
|
if (this.#inputProcessors || this.#memory) {
|
|
20590
20733
|
const runner = await this.getProcessorRunner({
|
|
@@ -20724,7 +20867,7 @@ ${errorMessages}`,
|
|
|
20724
20867
|
autoResumeSuspendedTools,
|
|
20725
20868
|
...rest
|
|
20726
20869
|
}) {
|
|
20727
|
-
const observabilityContext =
|
|
20870
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20728
20871
|
let toolsForRequest = {};
|
|
20729
20872
|
const memory = await this.getMemory({ requestContext });
|
|
20730
20873
|
const assignedTools = await this.listTools({ requestContext });
|
|
@@ -20751,7 +20894,7 @@ ${errorMessages}`,
|
|
|
20751
20894
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20752
20895
|
requireApproval: tool2.requireApproval
|
|
20753
20896
|
};
|
|
20754
|
-
return [k,
|
|
20897
|
+
return [k, chunkXANKVDSM_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
|
|
20755
20898
|
})
|
|
20756
20899
|
);
|
|
20757
20900
|
const assignedToolEntriesConverted = Object.fromEntries(
|
|
@@ -20776,7 +20919,7 @@ ${errorMessages}`,
|
|
|
20776
20919
|
autoResumeSuspendedTools,
|
|
20777
20920
|
...rest
|
|
20778
20921
|
}) {
|
|
20779
|
-
const observabilityContext =
|
|
20922
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20780
20923
|
let toolsForRequest = {};
|
|
20781
20924
|
const memory = await this.getMemory({ requestContext });
|
|
20782
20925
|
const toolsFromToolsets = Object.values(toolsets || {});
|
|
@@ -20805,7 +20948,7 @@ ${errorMessages}`,
|
|
|
20805
20948
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20806
20949
|
requireApproval: toolObj.requireApproval
|
|
20807
20950
|
};
|
|
20808
|
-
const convertedToCoreTool =
|
|
20951
|
+
const convertedToCoreTool = chunkXANKVDSM_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
|
|
20809
20952
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
20810
20953
|
}
|
|
20811
20954
|
}
|
|
@@ -20826,7 +20969,7 @@ ${errorMessages}`,
|
|
|
20826
20969
|
autoResumeSuspendedTools,
|
|
20827
20970
|
...rest
|
|
20828
20971
|
}) {
|
|
20829
|
-
const observabilityContext =
|
|
20972
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20830
20973
|
let toolsForRequest = {};
|
|
20831
20974
|
const memory = await this.getMemory({ requestContext });
|
|
20832
20975
|
const clientToolsForInput = Object.entries(clientTools || {});
|
|
@@ -20850,7 +20993,7 @@ ${errorMessages}`,
|
|
|
20850
20993
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20851
20994
|
requireApproval: tool2.requireApproval
|
|
20852
20995
|
};
|
|
20853
|
-
const convertedToCoreTool =
|
|
20996
|
+
const convertedToCoreTool = chunkXANKVDSM_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
|
|
20854
20997
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
20855
20998
|
}
|
|
20856
20999
|
}
|
|
@@ -20902,7 +21045,7 @@ ${errorMessages}`,
|
|
|
20902
21045
|
delegation,
|
|
20903
21046
|
...rest
|
|
20904
21047
|
}) {
|
|
20905
|
-
const observabilityContext =
|
|
21048
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
20906
21049
|
const convertedAgentTools = {};
|
|
20907
21050
|
const agents = await this.listAgents({ requestContext });
|
|
20908
21051
|
if (Object.keys(agents).length > 0) {
|
|
@@ -21140,7 +21283,7 @@ ${effectiveInstructions}`;
|
|
|
21140
21283
|
const generateResult = resumeData ? await agent.resumeGenerate(resumeData, {
|
|
21141
21284
|
runId: suspendedToolRunId,
|
|
21142
21285
|
requestContext,
|
|
21143
|
-
...
|
|
21286
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {}),
|
|
21144
21287
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21145
21288
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21146
21289
|
context: filteredContextMessages,
|
|
@@ -21153,7 +21296,7 @@ ${effectiveInstructions}`;
|
|
|
21153
21296
|
} : {}
|
|
21154
21297
|
}) : await agent.generate(messagesForSubAgent, {
|
|
21155
21298
|
requestContext,
|
|
21156
|
-
...
|
|
21299
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {}),
|
|
21157
21300
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21158
21301
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21159
21302
|
context: filteredContextMessages,
|
|
@@ -21219,7 +21362,7 @@ ${effectiveInstructions}`;
|
|
|
21219
21362
|
} else if (methodType === "generate" && modelVersion === "v1") {
|
|
21220
21363
|
const generateResult = await agent.generateLegacy(messagesForSubAgent, {
|
|
21221
21364
|
requestContext,
|
|
21222
|
-
...
|
|
21365
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {}),
|
|
21223
21366
|
context: filteredContextMessages
|
|
21224
21367
|
});
|
|
21225
21368
|
result = { text: generateResult.text };
|
|
@@ -21227,7 +21370,7 @@ ${effectiveInstructions}`;
|
|
|
21227
21370
|
const streamResult = resumeData ? await agent.resumeStream(resumeData, {
|
|
21228
21371
|
runId: suspendedToolRunId,
|
|
21229
21372
|
requestContext,
|
|
21230
|
-
...
|
|
21373
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {}),
|
|
21231
21374
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21232
21375
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21233
21376
|
context: filteredContextMessages,
|
|
@@ -21242,7 +21385,7 @@ ${effectiveInstructions}`;
|
|
|
21242
21385
|
} : {}
|
|
21243
21386
|
}) : await agent.stream(messagesForSubAgent, {
|
|
21244
21387
|
requestContext,
|
|
21245
|
-
...
|
|
21388
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {}),
|
|
21246
21389
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21247
21390
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21248
21391
|
context: filteredContextMessages,
|
|
@@ -21345,7 +21488,7 @@ ${effectiveInstructions}`;
|
|
|
21345
21488
|
} else {
|
|
21346
21489
|
const streamResult = await agent.streamLegacy(effectivePrompt, {
|
|
21347
21490
|
requestContext,
|
|
21348
|
-
...
|
|
21491
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {})
|
|
21349
21492
|
});
|
|
21350
21493
|
let fullText = "";
|
|
21351
21494
|
for await (const chunk of streamResult.fullStream) {
|
|
@@ -21532,7 +21675,7 @@ ${effectiveInstructions}`;
|
|
|
21532
21675
|
...observabilityContext,
|
|
21533
21676
|
tracingPolicy: this.#options?.tracingPolicy
|
|
21534
21677
|
};
|
|
21535
|
-
convertedAgentTools[`agent-${agentName}`] =
|
|
21678
|
+
convertedAgentTools[`agent-${agentName}`] = chunkXANKVDSM_cjs.makeCoreTool(
|
|
21536
21679
|
toolObj,
|
|
21537
21680
|
options,
|
|
21538
21681
|
void 0,
|
|
@@ -21555,7 +21698,7 @@ ${effectiveInstructions}`;
|
|
|
21555
21698
|
autoResumeSuspendedTools,
|
|
21556
21699
|
...rest
|
|
21557
21700
|
}) {
|
|
21558
|
-
const observabilityContext =
|
|
21701
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
21559
21702
|
const convertedWorkflowTools = {};
|
|
21560
21703
|
const workflows = await this.listWorkflows({ requestContext });
|
|
21561
21704
|
if (Object.keys(workflows).length > 0) {
|
|
@@ -21627,13 +21770,13 @@ ${effectiveInstructions}`;
|
|
|
21627
21770
|
result = await run.resume({
|
|
21628
21771
|
resumeData,
|
|
21629
21772
|
requestContext,
|
|
21630
|
-
...
|
|
21773
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {})
|
|
21631
21774
|
});
|
|
21632
21775
|
} else {
|
|
21633
21776
|
result = await run.start({
|
|
21634
21777
|
inputData: workflowInputData,
|
|
21635
21778
|
requestContext,
|
|
21636
|
-
...
|
|
21779
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {}),
|
|
21637
21780
|
...initialState && { initialState }
|
|
21638
21781
|
});
|
|
21639
21782
|
}
|
|
@@ -21641,7 +21784,7 @@ ${effectiveInstructions}`;
|
|
|
21641
21784
|
const streamResult = run.streamLegacy({
|
|
21642
21785
|
inputData: workflowInputData,
|
|
21643
21786
|
requestContext,
|
|
21644
|
-
...
|
|
21787
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {})
|
|
21645
21788
|
});
|
|
21646
21789
|
if (context?.writer) {
|
|
21647
21790
|
await streamResult.stream.pipeTo(context.writer);
|
|
@@ -21654,11 +21797,11 @@ ${effectiveInstructions}`;
|
|
|
21654
21797
|
const streamResult = resumeData ? run.resumeStream({
|
|
21655
21798
|
resumeData,
|
|
21656
21799
|
requestContext,
|
|
21657
|
-
...
|
|
21800
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {})
|
|
21658
21801
|
}) : run.stream({
|
|
21659
21802
|
inputData: workflowInputData,
|
|
21660
21803
|
requestContext,
|
|
21661
|
-
...
|
|
21804
|
+
...chunkQRJSP5G2_cjs.resolveObservabilityContext(context ?? {}),
|
|
21662
21805
|
...initialState && { initialState }
|
|
21663
21806
|
});
|
|
21664
21807
|
if (context?.writer) {
|
|
@@ -21753,7 +21896,7 @@ ${effectiveInstructions}`;
|
|
|
21753
21896
|
...observabilityContext,
|
|
21754
21897
|
tracingPolicy: this.#options?.tracingPolicy
|
|
21755
21898
|
};
|
|
21756
|
-
convertedWorkflowTools[`workflow-${workflowName}`] =
|
|
21899
|
+
convertedWorkflowTools[`workflow-${workflowName}`] = chunkXANKVDSM_cjs.makeCoreTool(
|
|
21757
21900
|
toolObj,
|
|
21758
21901
|
options,
|
|
21759
21902
|
void 0,
|
|
@@ -21781,11 +21924,11 @@ ${effectiveInstructions}`;
|
|
|
21781
21924
|
delegation,
|
|
21782
21925
|
...rest
|
|
21783
21926
|
}) {
|
|
21784
|
-
const observabilityContext =
|
|
21927
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
21785
21928
|
let mastraProxy = void 0;
|
|
21786
21929
|
const logger = this.logger;
|
|
21787
21930
|
if (this.#mastra) {
|
|
21788
|
-
mastraProxy =
|
|
21931
|
+
mastraProxy = chunkXANKVDSM_cjs.createMastraProxy({ mastra: this.#mastra, logger });
|
|
21789
21932
|
}
|
|
21790
21933
|
const assignedTools = await this.listAssignedTools({
|
|
21791
21934
|
runId,
|
|
@@ -22037,7 +22180,7 @@ ${effectiveInstructions}`;
|
|
|
22037
22180
|
const resolvedModel = await this.resolveModelConfig(selection, requestContext);
|
|
22038
22181
|
this.assertSupportsPreparedModels(resolvedModel);
|
|
22039
22182
|
let headers;
|
|
22040
|
-
if (resolvedModel instanceof
|
|
22183
|
+
if (resolvedModel instanceof chunk2STTKMFO_cjs.ModelRouterLanguageModel) {
|
|
22041
22184
|
headers = resolvedModel.config?.headers;
|
|
22042
22185
|
}
|
|
22043
22186
|
return [
|
|
@@ -22069,7 +22212,7 @@ ${effectiveInstructions}`;
|
|
|
22069
22212
|
throw mastraError;
|
|
22070
22213
|
}
|
|
22071
22214
|
let headers;
|
|
22072
|
-
if (model instanceof
|
|
22215
|
+
if (model instanceof chunk2STTKMFO_cjs.ModelRouterLanguageModel) {
|
|
22073
22216
|
headers = model.config?.headers;
|
|
22074
22217
|
}
|
|
22075
22218
|
return {
|
|
@@ -22114,7 +22257,10 @@ ${effectiveInstructions}`;
|
|
|
22114
22257
|
if (resourceId && threadFromArgs && !this.hasOwnMemory()) {
|
|
22115
22258
|
this.logger.warn("No memory is configured but resourceId and threadId were passed in args", { agent: this.name });
|
|
22116
22259
|
}
|
|
22117
|
-
const llm = await this.getLLM({
|
|
22260
|
+
const llm = await this.getLLM({
|
|
22261
|
+
requestContext,
|
|
22262
|
+
model: options.model
|
|
22263
|
+
});
|
|
22118
22264
|
if ("structuredOutput" in options && options.structuredOutput?.schema && !options.structuredOutput?.model) {
|
|
22119
22265
|
const structuredOutputModel = llm.getModel();
|
|
22120
22266
|
const targetProvider = structuredOutputModel.provider;
|
|
@@ -22137,10 +22283,10 @@ ${effectiveInstructions}`;
|
|
|
22137
22283
|
resourceId
|
|
22138
22284
|
}) || crypto2.randomUUID();
|
|
22139
22285
|
const instructions = options.instructions || await this.getInstructions({ requestContext });
|
|
22140
|
-
const agentSpan =
|
|
22286
|
+
const agentSpan = chunkEX2LVHTL_cjs.getOrCreateSpan({
|
|
22141
22287
|
type: "agent_run" /* AGENT_RUN */,
|
|
22142
22288
|
name: `agent run: '${this.id}'`,
|
|
22143
|
-
entityType:
|
|
22289
|
+
entityType: chunkEX2LVHTL_cjs.EntityType.AGENT,
|
|
22144
22290
|
entityId: this.id,
|
|
22145
22291
|
entityName: this.name,
|
|
22146
22292
|
input: options.messages,
|
|
@@ -22211,7 +22357,7 @@ ${effectiveInstructions}`;
|
|
|
22211
22357
|
workspace
|
|
22212
22358
|
});
|
|
22213
22359
|
const run = await executionWorkflow.createRun();
|
|
22214
|
-
const observabilityContext =
|
|
22360
|
+
const observabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
22215
22361
|
const result = await run.start({ ...observabilityContext });
|
|
22216
22362
|
return result;
|
|
22217
22363
|
}
|
|
@@ -22235,7 +22381,7 @@ ${effectiveInstructions}`;
|
|
|
22235
22381
|
structuredOutput = false,
|
|
22236
22382
|
overrideScorers
|
|
22237
22383
|
}) {
|
|
22238
|
-
const observabilityContext =
|
|
22384
|
+
const observabilityContext = chunkQRJSP5G2_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
22239
22385
|
const resToLog = {
|
|
22240
22386
|
text: result.text,
|
|
22241
22387
|
object: result.object,
|
|
@@ -22522,12 +22668,13 @@ ${effectiveInstructions}`;
|
|
|
22522
22668
|
const defaultOptions = await this.getDefaultOptions({
|
|
22523
22669
|
requestContext: options?.requestContext
|
|
22524
22670
|
});
|
|
22525
|
-
const mergedOptions =
|
|
22671
|
+
const mergedOptions = chunkXANKVDSM_cjs.deepMerge(
|
|
22526
22672
|
defaultOptions,
|
|
22527
22673
|
options ?? {}
|
|
22528
22674
|
);
|
|
22529
22675
|
const llm = await this.getLLM({
|
|
22530
|
-
requestContext: mergedOptions.requestContext
|
|
22676
|
+
requestContext: mergedOptions.requestContext,
|
|
22677
|
+
model: mergedOptions.model
|
|
22531
22678
|
});
|
|
22532
22679
|
const modelInfo = llm.getModel();
|
|
22533
22680
|
if (!isSupportedLanguageModel(modelInfo)) {
|
|
@@ -22592,12 +22739,13 @@ ${effectiveInstructions}`;
|
|
|
22592
22739
|
const defaultOptions = await this.getDefaultOptions({
|
|
22593
22740
|
requestContext: streamOptions?.requestContext
|
|
22594
22741
|
});
|
|
22595
|
-
const mergedOptions =
|
|
22742
|
+
const mergedOptions = chunkXANKVDSM_cjs.deepMerge(
|
|
22596
22743
|
defaultOptions,
|
|
22597
22744
|
streamOptions ?? {}
|
|
22598
22745
|
);
|
|
22599
22746
|
const llm = await this.getLLM({
|
|
22600
|
-
requestContext: mergedOptions.requestContext
|
|
22747
|
+
requestContext: mergedOptions.requestContext,
|
|
22748
|
+
model: mergedOptions.model
|
|
22601
22749
|
});
|
|
22602
22750
|
const modelInfo = llm.getModel();
|
|
22603
22751
|
if (!isSupportedLanguageModel(modelInfo)) {
|
|
@@ -22656,12 +22804,13 @@ ${effectiveInstructions}`;
|
|
|
22656
22804
|
const defaultOptions = await this.getDefaultOptions({
|
|
22657
22805
|
requestContext: streamOptions?.requestContext
|
|
22658
22806
|
});
|
|
22659
|
-
let mergedStreamOptions =
|
|
22807
|
+
let mergedStreamOptions = chunkXANKVDSM_cjs.deepMerge(
|
|
22660
22808
|
defaultOptions,
|
|
22661
22809
|
streamOptions ?? {}
|
|
22662
22810
|
);
|
|
22663
22811
|
const llm = await this.getLLM({
|
|
22664
|
-
requestContext: mergedStreamOptions.requestContext
|
|
22812
|
+
requestContext: mergedStreamOptions.requestContext,
|
|
22813
|
+
model: mergedStreamOptions.model
|
|
22665
22814
|
});
|
|
22666
22815
|
if (!isSupportedLanguageModel(llm.getModel())) {
|
|
22667
22816
|
const modelInfo = llm.getModel();
|
|
@@ -22721,12 +22870,13 @@ ${effectiveInstructions}`;
|
|
|
22721
22870
|
const defaultOptions = await this.getDefaultOptions({
|
|
22722
22871
|
requestContext: options?.requestContext
|
|
22723
22872
|
});
|
|
22724
|
-
const mergedOptions =
|
|
22873
|
+
const mergedOptions = chunkXANKVDSM_cjs.deepMerge(
|
|
22725
22874
|
defaultOptions,
|
|
22726
22875
|
options ?? {}
|
|
22727
22876
|
);
|
|
22728
22877
|
const llm = await this.getLLM({
|
|
22729
|
-
requestContext: mergedOptions.requestContext
|
|
22878
|
+
requestContext: mergedOptions.requestContext,
|
|
22879
|
+
model: mergedOptions.model
|
|
22730
22880
|
});
|
|
22731
22881
|
const modelInfo = llm.getModel();
|
|
22732
22882
|
if (!isSupportedLanguageModel(modelInfo)) {
|
|
@@ -22970,7 +23120,7 @@ var ModerationProcessor = class _ModerationProcessor {
|
|
|
22970
23120
|
async processInput(args) {
|
|
22971
23121
|
try {
|
|
22972
23122
|
const { messages, abort, ...rest } = args;
|
|
22973
|
-
const observabilityContext =
|
|
23123
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
22974
23124
|
if (messages.length === 0) {
|
|
22975
23125
|
return messages;
|
|
22976
23126
|
}
|
|
@@ -23010,7 +23160,7 @@ var ModerationProcessor = class _ModerationProcessor {
|
|
|
23010
23160
|
async processOutputStream(args) {
|
|
23011
23161
|
try {
|
|
23012
23162
|
const { part, streamParts, abort, ...rest } = args;
|
|
23013
|
-
const observabilityContext =
|
|
23163
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
23014
23164
|
if (part.type !== "text-delta") {
|
|
23015
23165
|
return part;
|
|
23016
23166
|
}
|
|
@@ -23220,7 +23370,7 @@ var PromptInjectionDetector = class _PromptInjectionDetector {
|
|
|
23220
23370
|
async processInput(args) {
|
|
23221
23371
|
try {
|
|
23222
23372
|
const { messages, abort, ...rest } = args;
|
|
23223
|
-
const observabilityContext =
|
|
23373
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
23224
23374
|
if (messages.length === 0) {
|
|
23225
23375
|
return messages;
|
|
23226
23376
|
}
|
|
@@ -23476,7 +23626,7 @@ var PIIDetector = class _PIIDetector {
|
|
|
23476
23626
|
async processInput(args) {
|
|
23477
23627
|
try {
|
|
23478
23628
|
const { messages, abort, ...rest } = args;
|
|
23479
|
-
const observabilityContext =
|
|
23629
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
23480
23630
|
if (messages.length === 0) {
|
|
23481
23631
|
return messages;
|
|
23482
23632
|
}
|
|
@@ -23765,7 +23915,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
|
|
|
23765
23915
|
*/
|
|
23766
23916
|
async processOutputStream(args) {
|
|
23767
23917
|
const { part, abort, ...rest } = args;
|
|
23768
|
-
const observabilityContext =
|
|
23918
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
23769
23919
|
try {
|
|
23770
23920
|
if (part.type !== "text-delta") {
|
|
23771
23921
|
return part;
|
|
@@ -23828,7 +23978,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
|
|
|
23828
23978
|
abort,
|
|
23829
23979
|
...rest
|
|
23830
23980
|
}) {
|
|
23831
|
-
const observabilityContext =
|
|
23981
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
23832
23982
|
try {
|
|
23833
23983
|
if (messages.length === 0) {
|
|
23834
23984
|
return messages;
|
|
@@ -23965,7 +24115,7 @@ var LanguageDetector = class _LanguageDetector {
|
|
|
23965
24115
|
async processInput(args) {
|
|
23966
24116
|
try {
|
|
23967
24117
|
const { messages, abort, ...rest } = args;
|
|
23968
|
-
const observabilityContext =
|
|
24118
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
23969
24119
|
if (messages.length === 0) {
|
|
23970
24120
|
return messages;
|
|
23971
24121
|
}
|
|
@@ -24638,7 +24788,7 @@ var SystemPromptScrubber = class {
|
|
|
24638
24788
|
*/
|
|
24639
24789
|
async processOutputStream(args) {
|
|
24640
24790
|
const { part, abort, ...rest } = args;
|
|
24641
|
-
const observabilityContext =
|
|
24791
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
24642
24792
|
if (part.type !== "text-delta") {
|
|
24643
24793
|
return part;
|
|
24644
24794
|
}
|
|
@@ -24693,7 +24843,7 @@ var SystemPromptScrubber = class {
|
|
|
24693
24843
|
abort,
|
|
24694
24844
|
...rest
|
|
24695
24845
|
}) {
|
|
24696
|
-
const observabilityContext =
|
|
24846
|
+
const observabilityContext = chunkQRJSP5G2_cjs.resolveObservabilityContext(rest);
|
|
24697
24847
|
const processedMessages = [];
|
|
24698
24848
|
const messagesToCheck = selectMessagesToCheck(messages, this.lastMessageOnly);
|
|
24699
24849
|
const checkedMessageIds = new Set(messagesToCheck.map((message) => message.id));
|
|
@@ -26028,7 +26178,7 @@ var WorkingMemory = class {
|
|
|
26028
26178
|
return messageList;
|
|
26029
26179
|
}
|
|
26030
26180
|
generateEmptyFromSchemaInternal(schema) {
|
|
26031
|
-
const result =
|
|
26181
|
+
const result = chunkXANKVDSM_cjs.generateEmptyFromSchema(schema);
|
|
26032
26182
|
return Object.keys(result).length > 0 ? result : null;
|
|
26033
26183
|
}
|
|
26034
26184
|
getWorkingMemoryToolInstruction({
|
|
@@ -26673,7 +26823,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
26673
26823
|
);
|
|
26674
26824
|
}
|
|
26675
26825
|
if (typeof config.embedder === "string") {
|
|
26676
|
-
this.embedder = new
|
|
26826
|
+
this.embedder = new chunk2STTKMFO_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
26677
26827
|
} else {
|
|
26678
26828
|
this.embedder = config.embedder;
|
|
26679
26829
|
}
|
|
@@ -26686,7 +26836,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
26686
26836
|
}
|
|
26687
26837
|
if (config.embedder) {
|
|
26688
26838
|
if (typeof config.embedder === "string") {
|
|
26689
|
-
this.embedder = new
|
|
26839
|
+
this.embedder = new chunk2STTKMFO_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
26690
26840
|
} else {
|
|
26691
26841
|
this.embedder = config.embedder;
|
|
26692
26842
|
}
|
|
@@ -26726,7 +26876,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
26726
26876
|
}
|
|
26727
26877
|
setEmbedder(embedder, embedderOptions) {
|
|
26728
26878
|
if (typeof embedder === "string") {
|
|
26729
|
-
this.embedder = new
|
|
26879
|
+
this.embedder = new chunk2STTKMFO_cjs.ModelRouterEmbeddingModel(embedder);
|
|
26730
26880
|
} else {
|
|
26731
26881
|
this.embedder = embedder;
|
|
26732
26882
|
}
|
|
@@ -26823,7 +26973,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
26823
26973
|
"The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
|
|
26824
26974
|
);
|
|
26825
26975
|
}
|
|
26826
|
-
const mergedConfig =
|
|
26976
|
+
const mergedConfig = chunkXANKVDSM_cjs.deepMerge(this.threadConfig, config || {});
|
|
26827
26977
|
if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
|
|
26828
26978
|
mergedConfig.workingMemory.schema = config.workingMemory.schema;
|
|
26829
26979
|
}
|
|
@@ -27175,7 +27325,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
27175
27325
|
} = {}) {
|
|
27176
27326
|
super({
|
|
27177
27327
|
name: "mock",
|
|
27178
|
-
storage: storage || new
|
|
27328
|
+
storage: storage || new chunkS6B5GIFC_cjs.InMemoryStore(),
|
|
27179
27329
|
options: {
|
|
27180
27330
|
...options,
|
|
27181
27331
|
workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : options?.workingMemory,
|
|
@@ -27486,5 +27636,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
|
|
|
27486
27636
|
exports.validateStepResumeData = validateStepResumeData;
|
|
27487
27637
|
exports.validateStepStateData = validateStepStateData;
|
|
27488
27638
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
27489
|
-
//# sourceMappingURL=chunk-
|
|
27490
|
-
//# sourceMappingURL=chunk-
|
|
27639
|
+
//# sourceMappingURL=chunk-F6ZURDS4.cjs.map
|
|
27640
|
+
//# sourceMappingURL=chunk-F6ZURDS4.cjs.map
|